Tcl Library Source Code

Changes On Branch embedded-doc-work
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch embedded-doc-work Excluding Merge-Ins

This is equivalent to a diff from 309ead7ea9 to 74232072a9

2013-02-08
23:41
Made the doc work official. We now have embedded docs, reachable in the fossil-integrated website of the project. check-in: 507de10864 user: andreask tags: trunk
23:30
localdoc tweaks: More link mapping for the external toc. Updated docs. Closed-Leaf check-in: 74232072a9 user: andreask tags: embedded-doc-work
23:15
localdoc tweaks: Remap the links in the supplied toc, different link to repo homepage. Updated docs. check-in: 02bbef2911 user: andreask tags: embedded-doc-work
19:14
(::ncgi::DecodeHex): [Bug 3603593]: Fixed bad scoping of DecodeHex, now in the ncgi namespace instead of polluting the global. Bumped version to 1.4.2. check-in: 01dcbc7b4f user: andreask tags: trunk
2013-02-07
04:43
Merge review work to doc work check-in: c422c0c2ec user: aku tags: embedded-doc-work
04:40
Merged sak review helper command (for release manager). check-in: 309ead7ea9 user: aku tags: trunk
04:37
Removed sak commands vcompare, rstatus, and note. Completely replaced by "review" and "readme" now. Tweaked "review" help reorganization dropped clear+next next - now skips to next un-reviewed package step is old next, single-step. Closed-Leaf check-in: a87b318066 user: aku tags: sak-work-review
2013-02-06
05:46
Tcllib 1.15 Release check-in: 411c419016 user: aku tags: trunk, tcllib-1-15, release

Changes to ChangeLog.









1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
+
+
+
+
+
+
+
+







2013-02-08  Andreas Kupries <[email protected]>

	* apps/dtplite: Fixed missing -ibase option in direcotry
	* apps/dtplite.man: processing with -merge. Fixed sorting in
	  generated toc and indices. Plus new feature: -toc for external
	  toc to place in the output. Bumped to 1.0.4. Updated
	  documentation.

2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2013-01-28  Andreas Kupries  <[email protected]>

Changes to apps/dtplite.

1
2
3
4
5
6

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32

33
34
35

36
37
38
39

40
41
42

43
44
45
46
47

48
49
50

51
52

53
54
55
56
57
58
59
60
61
62
63

64
65

66
67
68
69
70

71
72
73
74
75
76
77

78
79

80
81
82
83
84

85
86
87
88

89
90

91
92
93
94
95
96
97
98
99

100
101

102
103
104
105
106

107
108
109
110

111
112
113

114
115
116
117
118















119
120
121
122
123
124
125
1
2
3
4
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31

32
33
34

35
36
37
38

39
40
41

42
43
44
45
46

47
48
49

50
51

52
53
54
55
56
57
58
59
60
61
62

63
64

65
66
67
68
69

70
71
72
73
74
75
76

77
78

79
80
81
82
83

84
85
86
87

88
89

90
91
92
93
94
95
96
97
98

99
100

101
102
103
104
105

106
107
108
109

110
111
112

113
114
115
116
117

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139





-
+


















-
+






-
+


-
+



-
+


-
+




-
+


-
+

-
+










-
+

-
+




-
+






-
+

-
+




-
+



-
+

-
+








-
+

-
+




-
+



-
+


-
+




-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







#! /bin/sh
# -*- tcl -*- \
exec tclsh "$0" ${1+"$@"}

# @@ Meta Begin
# Application dtplite 1.0.3
# Application dtplite 1.0.4
# Meta platform     tcl
# Meta summary      Lightweight DocTools Processor
# Meta description  This application is a simple processor
# Meta description  for documents written in the doctools
# Meta description  markup language. It covers the most
# Meta description  common use cases, but is not as
# Meta description  configurable as its big brother dtp.
# Meta category     Processing doctools documents
# Meta subject      doctools doctoc docidx
# Meta require      {doctools 1}
# Meta require      {doctools::idx 1}
# Meta require      {doctools::toc 1}
# Meta require      fileutil
# Meta require      textutil::repeat
# Meta author       Andreas Kupries
# Meta license      BSD
# @@ Meta End

package provide dtplite 1.0.3
package provide dtplite 1.0.4

# dtp lite - Lightweight DocTools Processor
# ======== = ==============================
#
# Use cases
# ---------
# 
#
# (1)	Validation of a single manpage, i.e. checking that it is valid
#	doctools format.
# 
#
# (1a)	Getting a preliminary version of the formatted output, for
#	display in a browser, nroff, etc., proofreading the
#	formatting.
# 
#
# (2)	Generate documentation for a single package, i.e. all the
#	manpages, plus index and table of contents.
# 
#
# (3)	Generation of unified documentation for several
#	packages. Especially unified keyword index and table of
#	contents. This may additionally generate per-package TOCs
#	as well (Per-package indices don't make sense IMHO).
# 
#
# Command syntax
# --------------
# 
#
# Ad 1)	dtplite -o output format file
# 
#
#	The option -o specifies where to write the output to. Using
#	the string "-" as name of the output file causes the tool to
#	write the generated data to stdout. If $output is a directory
#	then a file named [[file rootname $file].$format] is written
#	to the directory.

# Ad 1a)	dtplite validate file
#
#	The "validate" format does not generate output at all, only
#	syntax checking is performed.
# 
#
# Ad 2)	dtplite -o output format directory
# 
#
#	I.e. we distinguish (2) from (1) by the type of the input,
#	file, or directory. In this situation output has to be a
#	directory. Use the path "." to place the results into the
#	current directory.
# 
#
#	We locate _all_ files under directory, i.e. all subdirectories
#	are scanned as well. We replicate the found directory
#	structure in the output (See example below). The index and
#	table of contents are written to the toplevel directory in the
#	output. The names are hardwired to "toc.$format" and
#	"index.$format".
# 
#
# Ad 3)	dtplite -merge -o output format directory
# 
#
#	This can be treated as special case of (2). The -merge option
#	tells it that the output is nested one level deeper, to keep a
#	global toc and index in the toplevel and to merge the package
#	toc and index into them.
# 
#
#	This way the global documents are built up incrementally. This
#	can help us in a future extended installer as well!, extending
#	a global documentation tree of all installed packages.
# 
#
# Additional features.
# 
#
# *	As described above the format name is used as the extension
#	for the generated files. Does it make sense to introduce an
#	option with which we can overide this, or should we simply
#	extect that a calling script does a proper renaming of all the
#	files ?  ... The option is better. In HTML output we have
#	links between the files, and renaming from the outside just
#	breaks the links. This option is '-ext'. It is ignored if the
#	output is a single file (fully specified via -o), or stdout.
# 
#
#	-ext extension
# 
#
# *	Most of the formats don't need much/none of customizability.
#	I.e. text, nroff, wiki, tmml, ...  For HTML however some
#	degree of customizability is required for good output.  What
#	should we given to the user ?
# 
#
#	- Allow setting of a stylesheet.
#	- Allow integration of custom body header and footer html.
#	- Allow additional links for the navigation bar.
# 
#
#	Note: The tool generates standard navigation bars to link the
#	all tocs, indices, and pages together.
# 
#
#	-style file
#	-header file
#	-footer file
#	-nav label url
# 
#
# *	The application may mis-detect files as doctools input.
#	And we cannot always mark them as non-doctools because
#	they may be such. Test cases, for example. To exclude
#	these we have the option '-exclude' taking a glob pattern.
#	Multiple uses of the option accumulate.
#
#	-exclude glob
#
# *	For tcllib itself we have external tools generating a nicer
#	TOC. Use option -toc to specify the doctoc file to use instead
#	of generating our own.
#
#	-toc path
#
# That should be enough to allow the creation of good looking formatted
# documentation without getting overly complex in both implementation
# and use.

package require doctools      1.4.11 ; # 'image' support, -ibase support
package require doctools::idx 1.0.4 ;
package require doctools::toc 1.1.3 ;
298
299
300
301
302
303
304
305

306
307
308




309
310
311
312
313
314
315
312
313
314
315
316
317
318

319
320
321
322
323
324
325
326
327
328
329
330
331
332
333







-
+



+
+
+
+








    # Database of image files for use by dt_imap.

    variable  imap
    array set imap {}

    # Database of exclusion patterns. Files matching these are not
    # manpages. For example, test files for doctools itself may full
    # manpages. For example, test files for doctools itself may fall
    # under this.

    variable excl {}

    # Path of a user specified table of contents (doctoc format).

    variable utoc {}
}

# ### ### ### ######### ######### #########
## External data and status
#
## Only the directory merge mode uses external data, saving the
## internal representations of current toc, index. and xref
344
345
346
347
348
349
350


351
352
353
354
355
356
357
358
359
360
361


362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378




379
380
381
382
383
384
385
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379


380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409







+
+









-
-
+
+

















+
+
+
+







# dtplite	-o outputpath	\
#		?-merge?	\
#		?-ext ext?	\
#		?-style file?	\
#		?-header file?	\
#		?-footer file?	\
#		?-nav label url?... \
#		?-exclude glob?... \
#		?-toc path? \
#		format inputpath
##

proc ::dtplite::processCmdline {} {
    global argv

    variable output ; variable style  ; variable stdout
    variable format ; variable header ; variable single
    variable input  ; variable footer ; variable mode
    variable ext    ; variable nav    ; variable merge  
    variable module ; variable excl
    variable ext    ; variable nav    ; variable merge
    variable module ; variable excl   ; variable utoc

    # Process the options, perform basic validation.

    while {[llength $argv]} {
	set opt [lindex $argv 0]
	if {![string match "-*" $opt]} break

	if {[string equal $opt "-o"]} {
	    if {[llength $argv] < 2} Usage
	    set output [lindex $argv 1]
	    set argv   [lrange $argv 2 end]
	} elseif {[string equal $opt "-merge"]} {
	    set merge 1
	    set argv [lrange $argv 1 end]
	} elseif {[string equal $opt "-ext"]} {
	    if {[llength $argv] < 2} Usage
	    set ext  [lindex $argv 1]
	    set argv [lrange $argv 2 end]
	} elseif {[string equal $opt "-toc"]} {
	    if {[llength $argv] < 2} Usage
	    set utoc [lindex $argv 1]
	    set argv [lrange $argv 2 end]
	} elseif {[string equal $opt "-exclude"]} {
	    if {[llength $argv] < 2} Usage
	    lappend excl [lindex $argv 1]
	    set argv [lrange $argv 2 end]
	} elseif {[string equal $opt "-style"]} {
	    if {[llength $argv] < 2} Usage
697
698
699
700
701
702
703

704
705
706
707
708
709
710
711
712
713
714
715
716
717

718
719
720
721
722






723


724
725
726
727
728
729
730
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741

742
743
744
745
746
747
748
749
750
751
752
753

754
755
756
757
758
759
760
761
762







+













-
+





+
+
+
+
+
+
-
+
+







    # and toc. I.e. any existing index and toc files are overwritten.

    variable input
    variable out
    variable module
    variable meta
    variable format
    variable utoc

    # Phase 0. Find the documents to convert.
    # Phase I. Collect meta data, and compute the map from input to
    # ........ output files. This is also the map for the symbolic
    # ........ references. We extend an existing map (required for use
    # ........ in merge op.
    # Phase II. Build index and toc information from the meta data.
    # Phase III. Convert each file, using index, toc and meta
    # .......... information.

    MapImages
    set files [LocateManpages $input]
    if {![llength $files]} {
	ArgError "Module \"$module\" has no files to process."	
	ArgError "Module \"$module\" has no files to process."
    }

    MetadataGet $files
    StyleMakeLocal

    if {$utoc ne {}} {
	if {[file exists $utoc]} {
	    set utoc [Get $utoc]
	}
	TocWrite toc index $utoc
    } else {
    TocWrite toc index [TocGenerate [TocGet $module toc]]
	TocWrite toc index [TocGenerate [TocGet $module toc]]
    }
    IdxWrite index toc [IdxGenerate $module [IdxGet]]

    dt configure -module $module
    XrefGet
    XrefSetup   dt
    FooterSetup dt
    MapSetup    dt
758
759
760
761
762
763
764

765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780

781
782
783
784
785
786
787






788
789



790
791
792
793
794
795
796
797
798
799
800
801

802
803
804
805
806
807
808
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812

813
814
815
816
817
818
819
820
821
822
823
824
825
826


827
828
829
830
831
832
833
834
835
836
837
838
839
840

841
842
843
844
845
846
847
848







+















-
+







+
+
+
+
+
+
-
-
+
+
+











-
+








    variable input
    variable out
    variable module
    variable meta
    variable output
    variable format
    variable utoc

    # Phase 0. Find the documents to process.
    # Phase I. Collect meta data, and compute the map from input to
    # ........ output files. This is also the map for the symbolic
    # ........ references. We extend an existing map (required for use
    # ........ in merge op.
    # Phase II. Build module local toc from the meta data, insert it
    # ......... into the main toc as well, and generate a global
    # ......... index.
    # Phase III. Process each file, using cross references, and links
    # .......... to boths tocs and the index.

    MapImages
    set files [LocateManpages $input]
    if {![llength $files]} {
	ArgError "Module \"$module\" has no files to process."	
	ArgError "Module \"$module\" has no files to process."
    }

    MetadataGet $files $module
    StyleMakeLocal     $module

    set localtoc [TocGet $module $module/toc]
    TocWrite $module/toc index [TocGenerate $localtoc] [TocMap $localtoc]
    if {$utoc ne {}} {
	if {[file exists $utoc]} {
	    set utoc [Get $utoc]
	}
	TocWrite toc index $utoc
    } else {
    TocWrite toc         index [TocGenerate [TocMergeSaved $localtoc]]
    IdxWrite index       toc   [IdxGenerate {} [IdxGetSaved index]]
	TocWrite toc index [TocGenerate [TocMergeSaved $localtoc]]
    }
    IdxWrite index toc [IdxGenerate {} [IdxGetSaved index]]

    dt configure -module $module
    XrefGetSaved
    XrefSetup   dt
    FooterSetup dt
    MapSetup    dt

    foreach f [lsort -dict $files] {
	puts stdout \t$f

	set o $out($f)
	dt configure -file [At $o]
	dt configure -file [At $o] -ibase $input/$f

	NavbuttonPush {Keyword Index}          [Output index]       $o
	NavbuttonPush {Table Of Contents}      [Output $module/toc] $o
	NavbuttonPush {Main Table Of Contents} [Output toc]         $o
	HeaderSetup dt
	NavbuttonPop
	NavbuttonPop
930
931
932
933
934
935
936
937

938
939
940
941
942
943
944
945
946
947
948
949
950
951
952

953
954
955
956
957
958
959
960
961
962
963
964
965
966

967
968
969
970
971
972
973
970
971
972
973
974
975
976

977
978
979
980
981
982
983
984
985
986
987
988
989
990
991

992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005

1006
1007
1008
1009
1010
1011
1012
1013







-
+














-
+













-
+







}

proc ::dtplite::TocGenerate {data} {
    # Handling single and multiple divisions.
    # single div => div is full toc
    # multi div  => place divs into the toc in alpha order.
    #
    # Sort toc (each division) by label.
    # Sort toc (each division) by label (index 1).
    # Write as doctoc.

    array set toc $data

    TagsBegin
    if {[array size toc] < 2} {
	# Empty, or single division. The division is the TOC, toplevel.

	unset toc
	set desc [lindex $data 0]
	set data [lindex [lindex $data 1] 1]
	TocAlign mxf mxl $data

	Tag+ toc_begin [list {Table Of Contents} $desc]
	foreach item [lsort -dict -index 2 $data] {
	foreach item [lsort -dict -index 1 $data] {
	    foreach {symfile label desc} $item break
	    Tag+ item \
		    [FmtR mxf $symfile] \
		    [FmtR mxl $label] \
		    [list $desc]
	}
    } else {
	Tag+ toc_begin [list {Table Of Contents} Modules]
	foreach desc [lsort -dict [array names toc]] {
	    foreach {ref div} $toc($desc) break
	    TocAlign mxf mxl $div

	    Tag+ division_start [list $desc [Output $ref]]
	    foreach item [lsort -dict -index 2 $div] {
	    foreach item [lsort -dict -index 1 $div] {
		foreach {symfile label desc} $item break
		Tag+ item \
			[FmtR mxf $symfile] \
			[FmtR mxl $label] \
			[list $desc]
	    }
	    Tag+ division_end
1096
1097
1098
1099
1100
1101
1102
1103

1104
1105
1106
1107
1108
1109
1110
1136
1137
1138
1139
1140
1141
1142

1143
1144
1145
1146
1147
1148
1149
1150







-
+







    TagsBegin
    Tag+ index_begin [list {Keyword Index} $desc]

    foreach k [lsort -dict [array names keys]] {
	IdxAlign mxf $keys($k)

	Tag+ key [list $k]
	foreach v [lsort -dict -index 0 $keys($k)] {
	foreach v [lsort -dict -index 1 $keys($k)] {
	    foreach {file label} $v break
	    Tag+ manpage [FmtR mxf $file] [list $label]
	}
    }

    Tag+ index_end
    #puts ____________________\n[join $lines \n]\n_________________________

Changes to apps/dtplite.man.

220
221
222
223
224
225
226










227
228
229
230
231
232
233
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243







+
+
+
+
+
+
+
+
+
+








When processing an input directory the stylesheet file is copied into
the output directory and the generated HTML will refer to the copy, to
make the result more self-contained. When processing an input file we
have no location to copy the stylesheet to and so just reference it as
specified.

[para]

When used multiple times only the last definition is relevant.


[opt_def -toc path]

This option specifies a doctoc file to use for the table of contents
instead of generating our own.

[para]

When used multiple times only the last definition is relevant.


[opt_def -nav "label url"]

Added embedded/man/files/apps/dtplite.n.






















































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/apps/dtplite.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "dtplite" n 1.0 tcllib "Documentation toolbox"
.BS
.SH NAME
dtplite \- Lightweight DocTools Markup Processor
.SH SYNOPSIS
\fBdtplite\fR \fB-o\fR \fIoutput\fR ?options? \fIformat\fR \fIinputfile\fR
.sp
\fBdtplite\fR \fBvalidate\fR \fIinputfile\fR
.sp
\fBdtplite\fR \fB-o\fR \fIoutput\fR ?options? \fIformat\fR \fIinputdirectory\fR
.sp
\fBdtplite\fR \fB-merge\fR \fB-o\fR \fIoutput\fR ?options? \fIformat\fR \fIinputdirectory\fR
.sp
.BE
.SH DESCRIPTION
.PP
The application described by this document, \fBdtplite\fR, is the
successor to the extremely simple \fBmpexpand\fR. Influenced in its
functionality by the \fBdtp\fR doctools processor it is much more
powerful than \fBmpexpand\fR, yet still as easy to use; definitely
easier than \fBdtp\fR with its myriad of subcommands and options.
.PP
\fBdtplite\fR is based upon the package \fBdoctools\fR, like
the other two processors.
.SS "USE CASES"
\fBdtplite\fR was written with the following three use cases in
mind.
.PP
.IP [1]
Validation of a single document, i.e. checking that it was written in
valid doctools format. This mode can also be used to get a preliminary
version of the formatted output for a single document, for display in
a browser, nroff, etc., allowing proofreading of the formatting.
.IP [2]
Generation of the formatted documentation for a single package,
i.e. all the manpages, plus a table of contents and an index of
keywords.
.IP [3]
An extension of the previous mode of operation, a method for the easy
generation of one documentation tree for several packages, and
especially of a unified table of contents and keyword index.
.PP
.PP
Beyond the above we also want to make use of the customization
features provided by the HTML formatter. It is not the only format the
application should be able to generate, but we anticipiate it to be
the most commonly used, and it is one of the few which do provide
customization hooks.
.PP
We allow the caller to specify a header string, footer string, a
stylesheet, and data for a bar of navigation links at the top of the
generated document.
While all can be set as long as the formatting engine provides an
appropriate engine parameter (See section \fBOPTIONS\fR) the last
two have internal processing which make them specific to HTML.
.SS "COMMAND LINE"
.TP
\fBdtplite\fR \fB-o\fR \fIoutput\fR ?options? \fIformat\fR \fIinputfile\fR
This is the form for use case [1]. The \fIoptions\fR will be
explained later, in section \fBOPTIONS\fR.
.RS
.TP
path \fIoutput\fR (in)
This argument specifies where to write the generated document. It can
be the path to a file or directory, or \fB-\fR.
The last value causes the application to write the generated
documented to \fBstdout\fR.
.sp
If the \fIoutput\fR does not exist then [file dirname $output]
has to exist and must be a writable directory.
The generated document will be written to a file in that directory,
and the name of that file will be derived from the \fIinputfile\fR,
the \fIformat\fR, and the value given to option \fB-ext\fR (if
present).
.TP
(path|handle) \fIformat\fR (in)
This argument specifies the formatting engine to use when processing
the input, and thus the format of the generated document. See section
\fBFORMATS\fR for the possibilities recognized by the application.
.TP
path \fIinputfile\fR (in)
This argument specifies the path to the file to process. It has to
exist, must be readable, and written in \fIdoctools\fR format.
.RE
.sp
.TP
\fBdtplite\fR \fBvalidate\fR \fIinputfile\fR
This is a simpler form for use case [1]. The "validate" format
generates no output at all, only syntax checks are performed. As such
the specification of an output file or other options is not necessary
and left out.
.TP
\fBdtplite\fR \fB-o\fR \fIoutput\fR ?options? \fIformat\fR \fIinputdirectory\fR
This is the form for use case [2]. It differs from the form for
use case [1] by having the input documents specified through a
directory instead of a file. The other arguments are identical, except
for \fIoutput\fR, which now has to be the path to an existing and
writable directory.
.sp
The input documents are all files in \fIinputdirectory\fR or any of
its subdirectories which were recognized by \fBfileutil::fileType\fR
as containing text in \fIdoctools\fR format.
.TP
\fBdtplite\fR \fB-merge\fR \fB-o\fR \fIoutput\fR ?options? \fIformat\fR \fIinputdirectory\fR
This is the form for use case [3]. The only difference to the
form for use case [2] is the additional option \fB-merge\fR.
.sp
Each such call will merge the generated documents coming from
processing the input documents under \fIinputdirectory\fR or any of
its subdirectories to the files under \fIoutput\fR. In this manner it
is possible to incrementally build the unified documentation for any
number of packages. Note that it is necessary to run through all the
packages twice to get fully correct cross-references (for formats
supporting them).
.PP
.SS OPTIONS
This section describes all the options available to the user of the
application, with
the exception of the options \fB-o\fR and \fB-merge\fR. These
two were described already, in section \fBCOMMAND LINE\fR.
.PP
.TP
\fB-exclude\fR string
This option specifies an exclude (glob) pattern. Any files identified
as manpages to process which match the exclude pattern are
ignored. The option can be provided multiple times, each usage adding
an additional pattern to the list of exclusions.
.TP
\fB-ext\fR string
If the name of an output file has to be derived from the name of an
input file it will use the name of the \fIformat\fR as the extension
by default. This option here will override this however, forcing it to
use \fIstring\fR as the file extension. This option is ignored if the
name of the output file is fully specified through option \fB-o\fR.
.sp
When used multiple times only the last definition is relevant.
.TP
\fB-header\fR file
This option can be used if and only if the selected \fIformat\fR
provides an engine parameter named "header". It takes the contents of
the specified file and assign them to that parameter, for whatever use
by the engine. The HTML engine will insert the text just after the tag
\fB<body>\fR.
If navigation buttons are present (see option \fB-nav\fR below),
then the HTML generated for them is appended to the header data
originating here before the final assignment to the parameter.
.sp
When used multiple times only the last definition is relevant.
.TP
\fB-footer\fR file
Like \fB-header\fR, except that: Any navigation buttons are ignored,
the corresponding required engine parameter is named "footer", and the
data is inserted just before the tag \fB</body>\fR.
.sp
When used multiple times only the last definition is relevant.
.TP
\fB-style\fR file
This option can be used if and only if the selected \fIformat\fR
provides an engine parameter named "meta". When specified it will
generate a piece of HTML code declaring the \fIfile\fR as the
stylesheet for the generated document and assign that to the
parameter. The HTML engine will insert this inot the document, just
after the tag \fB<head>\fR.
.sp
When processing an input directory the stylesheet file is copied into
the output directory and the generated HTML will refer to the copy, to
make the result more self-contained. When processing an input file we
have no location to copy the stylesheet to and so just reference it as
specified.
.sp
When used multiple times only the last definition is relevant.
.TP
\fB-toc\fR path
This option specifies a doctoc file to use for the table of contents
instead of generating our own.
.sp
When used multiple times only the last definition is relevant.
.TP
\fB-nav\fR label url
Use this option to specify a navigation button with \fIlabel\fR to
display and the \fIurl\fR to link to. This option can be used if and
only if the selected \fIformat\fR provides an engine parameter named
"header". The HTML generated for this is appended to whatever data we
got from option \fB-header\fR before it is inserted into the
generated documents.
.sp
When used multiple times all definitions are collected and a
navigation bar is created, with the first definition shown at the left
edge and the last definition to the right.
.PP
.SS FORMATS
At first the \fIformat\fR argument will be treated as a path to a tcl
file containing the code for the requested formatting engine. The
argument will be treated as the name of one of the predefined formats
listed below if and only if the path does not exist.
.PP
\fINote a limitation\fR: If treating the format as path to the tcl
script implementing the engine was sucessful, then this script has to
implement not only the engine API for doctools, i.e.
\fIdoctools_api\fR, but for \fIdoctoc_api\fR and \fIdocidx_api\fR
as well. Otherwise the generation of a table of contents and of a
keyword index will fail.
.PP
List of predefined formats, i.e. as provided by the
package \fBdoctools\fR:
.PP
.TP
\fBnroff\fR
The processor generates *roff output, the standard format for unix
manpages.
.TP
\fBhtml\fR
The processor generates HTML output, for usage in and display by web
browsers. This engine is currently the only one providing the various
engine parameters required for the additional customaization of the
output.
.TP
\fBtmml\fR
The processor generates TMML output, the Tcl Manpage Markup Language,
a derivative of XML.
.TP
\fBlatex\fR
The processor generates LaTeX output.
.TP
\fBwiki\fR
The processor generates Wiki markup as understood by \fBwikit\fR.
.TP
\fBlist\fR
The processor extracts the information provided by \fBmanpage_begin\fR.
This format is used internally to extract the meta data from which
both table of contents and keyword index are derived from.
.TP
\fBnull\fR
The processor does not generate any output. This is equivalent to
\fBvalidate\fR.
.PP
.SS "DIRECTORY STRUCTURES"
In this section we describe the directory structures generated by the
application under \fIoutput\fR when processing all documents in an
\fIinputdirectory\fR. In other words, this is only relevant to the use
cases [2] and [3].
.TP
[2]
The following directory structure is created when processing a single
set of input documents.  The file extension used is for output in
HTML, but that is not relevant to the structure and was just used to
have proper file names.
.CS


    output/
        toc.html
        index.html
        files/
            path/to/FOO.html

.CE
.IP
The last line in the example shows the document
generated for a file FOO located at
.CS


    inputdirectory/path/to/FOO

.CE
.TP
[3]
When merging many packages into a unified set of documents the
generated directory structure is a bit deeper:
.CS


    output
        .toc
        .idx
        .tocdoc
        .idxdoc
        .xrf
        toc.html
        index.html
        FOO1/
            ...
        FOO2/
            toc.html
            files/
                path/to/BAR.html

.CE
.IP
Each of the directories FOO1, ... contains the documents generated for
the package FOO1, ... and follows the structure shown for use case
[2]. The only exception is that there is no per-package index.
.sp
The files "\fI.toc\fR", "\fI.idx\fR", and "\fI.xrf\fR" contain the
internal status of the whole output and will be read and updated by
the next invokation. Their contents will not be documented. Remove
these files when all packages wanted for the output have been
processed, i.e. when the output is complete.
.sp
The files "\fI.tocdoc\fR", and "\fI.idxdoc\fR", are intermediate files
in doctoc and docidx markup, respectively, containing the main table
of contents and keyword index for the set of documents before their
conversion to the chosen output format.
They are left in place, i.e. not deleted, to serve as demonstrations
of doctoc and docidx markup.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
application and/or documentation.
.SH "SEE ALSO"
docidx introduction, doctoc introduction, doctools introduction
.SH KEYWORDS
HTML, TMML, conversion, docidx, doctoc, doctools, manpage, markup, nroff
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2004 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/apps/nns.n.







































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/apps/nns.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nns" n 1.1 tcllib "Name service facility"
.BS
.SH NAME
nns \- Name service facility, Commandline Client Application
.SH SYNOPSIS
\fBnns\fR \fBbind\fR ?\fB-host\fR \fIhost\fR? ?\fB-port\fR \fIport\fR? \fIname\fR \fIdata\fR
.sp
\fBnns\fR \fBsearch\fR ?\fB-host\fR \fIhost\fR? ?\fB-port\fR \fIport\fR? ?\fB-continuous\fR? ?\fIpattern\fR?
.sp
\fBnns\fR \fBident\fR ?\fB-host\fR \fIhost\fR? ?\fB-port\fR \fIport\fR?
.sp
\fBnns\fR \fBwho\fR
.sp
.BE
.SH DESCRIPTION
.PP
Please read \fIName service facility, introduction\fR first.
.PP
The application described by this document, \fBnns\fR, is a simple
command line client for the nano name service facility provided by the
Tcllib packages \fBnameserv\fR, and \fBnameserv::server\fR.
Beyond that the application's sources also serve as an example of how
to use the client package \fBnameserv\fR. All abilities of a
client are covered, from configuration to registration of names to
searching.
.PP
This name service facility has nothing to do with the Internet's
\fIDomain Name System\fR, otherwise known as \fIDNS\fR. If the
reader is looking for a package dealing with that please see either of
the packages \fBdns\fR and \fBresolv\fR, both found in Tcllib
too.
.SS "USE CASES"
\fBnns\fR was written with the following two main use cases in
mind.
.PP
.IP [1]
Registration of a name/data pair in the name service.
.IP [2]
Searching the name service for entries matching a glob pattern.
.PP
.PP
Beyond the above we also want to be able to identify the client, and
get information about the name service.
.SS "COMMAND LINE"
.TP
\fBnns\fR \fBbind\fR ?\fB-host\fR \fIhost\fR? ?\fB-port\fR \fIport\fR? \fIname\fR \fIdata\fR
This form registers the \fIname\fR/\fIdata\fR pair in the specified
name service. In this form the command will \fInot\fR exit to keep
the registration alive. The user has to kill it explicitly, either by
sending a signal, or through the job-control facilities of the shell
in use. It will especially survive the loss of the connection to the
name service and reestablish the \fIname\fR/\fIdata\fR pair when the
connection is restored.
.sp
The options to specify the name service will be explained later, in
section \fBOPTIONS\fR.
.TP
\fBnns\fR \fBsearch\fR ?\fB-host\fR \fIhost\fR? ?\fB-port\fR \fIport\fR? ?\fB-continuous\fR? ?\fIpattern\fR?
This form searches the specified name service for entries matching the
glob-\fIpattern\fR and prints them to stdout, with each entry on its
own line. If no pattern is specified it defaults to \fB*\fR,
matching everything.
.sp
The options to specify the name service will be explained later, in
section \fBOPTIONS\fR.
.sp
If the option \fB-continuous\fR is specified the client will not
exit after performing the search, but start to continuously monitor
the service for changes to the set of matching entries, appropriately
updating the display as changes arrive. In that form it will
especially also survive the loss of the connection to the name service
and reestablish the search when the connection is restored.
.TP
\fBnns\fR \fBident\fR ?\fB-host\fR \fIhost\fR? ?\fB-port\fR \fIport\fR?
This form asks the specified name service for the version and features
of the name service protocol it supports and prints the results to
stdout.
.sp
The options to specify the name service will be explained later, in
section \fBOPTIONS\fR.
.TP
\fBnns\fR \fBwho\fR
This form prints name, version, and protocol version of the
application to stdout.
.PP
.SS OPTIONS
This section describes all the options available to the user of the
application
.PP
.TP
\fB-host\fR name|ipaddress
If this option is not specified it defaults to \fBlocalhost\fR. It
specifies the name or ip-address of the host the name service to talk
to is running on.
.TP
\fB-port\fR number
If this option is not specified it defaults to \fB38573\fR. It
specifies the TCP port the name service to talk to is listening on for
requests.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
application and/or documentation.
.SH "SEE ALSO"
nameserv(n), nameserv::common(n)
.SH KEYWORDS
application, client, name service
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2007-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/apps/nnsd.n.





























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/apps/nnsd.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nnsd" n 1.0.1 tcllib "Name service facility"
.BS
.SH NAME
nnsd \- Name service facility, Commandline Server Application
.SH SYNOPSIS
\fBnnsd\fR ?\fB-localonly\fR \fIflag\fR? ?\fB-port\fR \fIport\fR?
.sp
.BE
.SH DESCRIPTION
.PP
Please read \fIName service facility, introduction\fR first.
.PP
The application described by this document, \fBnns\fR, is a simple
command line server for the nano name service facility provided by the
Tcllib packages \fBnameserv\fR, and \fBnameserv::server\fR.
Beyond that the application's sources also serve as an example of how
to use the server package \fBnameserv::server\fR.
.PP
This name service facility has nothing to do with the Internet's
\fIDomain Name System\fR, otherwise known as \fIDNS\fR. If the
reader is looking for a package dealing with that please see either of
the packages \fBdns\fR and \fBresolv\fR, both found in Tcllib
too.
.SS "USE CASES"
\fBnnsd\fR was written with the following main use case in
mind.
.PP
.IP [1]
Run a nano name service on some host.
.PP
.PP
.SS "COMMAND LINE"
.TP
\fBnnsd\fR ?\fB-localonly\fR \fIflag\fR? ?\fB-port\fR \fIport\fR?
The command configures a server per the specified options and starts
it. The command will not exit on its, as it keeps the name service
database wholly in memory. The user has to kill it explicitly, eithre
by sending a a signal, or through the job-control facilities of the
shell in use.
.sp
The options to configure the name service are explained in section
\fBOPTIONS\fR.
.PP
.SS OPTIONS
This section describes all the options available to the user of the
application
.PP
.TP
\fB-localonly\fR bool
If this option is not specified it defaults to \fBtrue\fR, i.e.
acceptance of only local connections. The server will accept remote
connections, i.e. connections from other hosts, if and only if this
option is configured to \fBfalse\fR.
.TP
\fB-port\fR number
If this option is not specified it defaults to \fB38573\fR. It
specifies the TCP port the server has to listen on for requests.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
application and/or documentation.
.SH "SEE ALSO"
nameserv::common(n), nameserv::server(n)
.SH KEYWORDS
application, name service, server
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2007-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/apps/nnslog.n.
































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/apps/nnslog.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nnslog" n 1.0 tcllib "Name service facility"
.BS
.SH NAME
nnslog \- Name service facility, Commandline Logging Client Application
.SH SYNOPSIS
\fBnnslog\fR ?\fB-host\fR \fIhost\fR? ?\fB-port\fR \fIport\fR?
.sp
.BE
.SH DESCRIPTION
.PP
Please read \fIName service facility, introduction\fR first.
.PP
The application described by this document, \fBnnslog\fR, is a
simple command line client for the nano name service facility provided
by the Tcllib packages \fBnameserv\fR, and \fBnameserv::server\fR.
.PP
It essentially implements "\fBnns\fR search -continuous *", but
uses a different output formatting. Instead of continuously showing
the current contents of the server in the terminal it simply logs all
received add/remove events to \fBstdout\fR.
.PP
This name service facility has nothing to do with the Internet's
\fIDomain Name System\fR, otherwise known as \fIDNS\fR. If the
reader is looking for a package dealing with that please see either of
the packages \fBdns\fR and \fBresolv\fR, both found in Tcllib
too.
.SS "USE CASES"
\fBnnslog\fR was written with the following main use case in mind.
.PP
.IP [1]
Monitoring the name service for all changes and logging them in a text
terminal.
.PP
.PP
.SS "COMMAND LINE"
.TP
\fBnnslog\fR ?\fB-host\fR \fIhost\fR? ?\fB-port\fR \fIport\fR?
The command connects to the specified name service, sets up a search
for all changes and then prints all received events to stdout, with
each events on its own line. The command will not exit until it is
explicitly terminated by the user. It will especially survive the loss
of the connection to the name service and reestablish the search and
log when the connection is restored.
.sp
The options to specify the name service will be explained later, in
section \fBOPTIONS\fR.
.PP
.SS OPTIONS
This section describes all the options available to the user of the
application
.TP
\fB-host\fR name|ipaddress
If this option is not specified it defaults to \fBlocalhost\fR. It
specifies the name or ip-address of the host the name service to talk
to is running on.
.TP
\fB-port\fR number
If this option is not specified it defaults to \fB38573\fR. It
specifies the TCP port the name service to talk to is listening on for
requests.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
application and/or documentation.
.SH "SEE ALSO"
nameserv(n), nameserv::common(n)
.SH KEYWORDS
application, client, name service
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/apps/page.n.









































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/apps/page.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "page" n 1.0 tcllib "Development Tools"
.BS
.SH NAME
page \- Parser Generator
.SH SYNOPSIS
\fBpage\fR ?\fIoptions\fR...? ?\fIinput\fR ?\fIoutput\fR??
.sp
.BE
.SH DESCRIPTION
.PP
The application described by this document, \fBpage\fR, is actually
not just a parser generator, as the name implies, but a generic tool
for the execution of arbitrary transformations on texts.
.PP
Its genericity comes through the use of \fIplugins\fR for reading,
transforming, and writing data, and the predefined set of plugins
provided by Tcllib is for the generation of memoizing recursive
descent parsers (aka \fIpackrat parsers\fR) from grammar
specifications (\fIParsing Expression Grammars\fR).
.PP
\fBpage\fR is written on top of the package
\fBpage::pluginmgr\fR, wrapping its functionality into a command
line based application. All the other \fBpage::*\fR packages are
plugin and/or supporting packages for the generation of parsers. The
parsers themselves are based on the packages \fBgrammar::peg\fR,
\fBgrammar::peg::interp\fR, and \fBgrammar::mengine\fR.
.SS "COMMAND LINE"
.TP
\fBpage\fR ?\fIoptions\fR...? ?\fIinput\fR ?\fIoutput\fR??
This is general form for calling \fBpage\fR. The application will
read the contents of the file \fIinput\fR, process them under the
control of the specified \fIoptions\fR, and then write the result to
the file \fIoutput\fR.
.sp
If \fIinput\fR is the string \fB-\fR the data to process will be
read from \fBstdin\fR instead of a file. Analogously the result will
be written to \fBstdout\fR instead of a file if \fIoutput\fR is the
string \fB-\fR. A missing output or input specification causes the
application to assume \fB-\fR.
.sp
The detailed specifications of the recognized \fIoptions\fR are
provided in section \fBOPTIONS\fR.
.RS
.TP
path \fIinput\fR (in)
This argument specifies the path to the file to be processed by the
application, or \fB-\fR. The last value causes the application to
read the text from \fBstdin\fR. Otherwise it has to exist, and be
readable. If the argument is missing \fB-\fR is assumed.
.TP
path \fIoutput\fR (in)
This argument specifies where to write the generated text. It can be
the path to a file, or \fB-\fR. The last value causes the
application to write the generated documented to \fBstdout\fR.
.sp
If the file \fIoutput\fR does not exist then
[file dirname $output] has to exist and must be a writable
directory, as the application will create the fileto write to.
.sp
If the argument is missing \fB-\fR is assumed.
.RE
.PP
.SS OPERATION
... reading ... transforming ... writing - plugins - pipeline ...
.SS OPTIONS
This section describes all the options available to the user of the
application. Options are always processed in order. I.e. of both
\fB--help\fR and \fB--version\fR are specified the option
encountered first has precedence.
.PP
Unknown options specified before any of the options \fB-rd\fR,
\fB-wr\fR, or \fB-tr\fR will cause processing to abort with an
error. Unknown options coming in between these options, or after the
last of them are assumed to always take a single argument and are
associated with the last plugin option coming before them. They will
be checked after all the relevant plugins, and thus the options they
understand, are known. I.e. such unknown options cause error if and
only if the plugin option they are associated with does not understand
them, and was not superceded by a plugin option coming after.
.PP
Default options are used if and only if the command line did not
contain any options at all. They will set the application up as a
PEG-based parser generator. The exact list of options is
.PP
.CS

-c peg
.CE
.PP
And now the recognized options and their arguments, if they have any:
.PP
.TP
\fB--help\fR
.TP
\fB-h\fR
.TP
\fB-?\fR
When one of these options is found on the command line all arguments
coming before or after are ignored. The application will print a short
description of the recognized options and exit.
.TP
\fB--version\fR
.TP
\fB-V\fR
When one of these options is found on the command line all arguments
coming before or after are ignored. The application will print its
own revision and exit.
.TP
\fB-P\fR
This option signals the application to activate visual feedback while
reading the input.
.TP
\fB-T\fR
This option signals the application to collect statistics while
reading the input and to print them after reading has completed,
before processing started.
.TP
\fB-D\fR
This option signals the application to activate logging in the Safe
base, for the debugging of problems with plugins.
.TP
\fB-r\fR parser
.TP
\fB-rd\fR parser
.TP
\fB--reader\fR parser
These options specify the plugin the application has to use for
reading the \fIinput\fR. If the options are used multiple times the
last one will be used.
.TP
\fB-w\fR generator
.TP
\fB-wr\fR generator
.TP
\fB--writer\fR generator
These options specify the plugin the application has to use for
generating and writing the final \fIoutput\fR. If the options are used
multiple times the last one will be used.
.TP
\fB-t\fR process
.TP
\fB-tr\fR process
.TP
\fB--transform\fR process
These options specify a plugin to run on the input. In contrast to
readers and writers each use will \fInot\fR supersede previous
uses, but add each chosen plugin to a list of transformations, either
at the front, or the end, per the last seen use of either option
\fB-p\fR or \fB-a\fR. The initial default is to append the new
transformations.
.TP
\fB-a\fR
.TP
\fB--append\fR
These options signal the application that all following
transformations should be added at the end of the list of
transformations.
.TP
\fB-p\fR
.TP
\fB--prepend\fR
These options signal the application that all following
transformations should be added at the beginning of the list of
transformations.
.TP
\fB--reset\fR
This option signals the application to clear the list of
transformations. This is necessary to wipe out the default
transformations used.
.TP
\fB-c\fR file
.TP
\fB--configuration\fR file
This option causes the application to load a configuration file and/or
plugin. This is a plugin which in essence provides a pre-defined set
of commandline options. They are processed exactly as if they have
been specified in place of the option and its arguments. This means
that unknown options found at the beginning of the configuration file
are associated with the last plugin, even if that plugin was specified
before the configuration file itself. Conversely, unknown options
coming after the configuration file can be associated with a plugin
specified in the file.
.sp
If the argument is a file which cannot be loaded as a plugin the
application will assume that its contents are a list of options and
their arguments, separated by space, tabs, and newlines. Options and
argumentes containing spaces can be quoted via double-quotes (") and
quotes ('). The quote character can be specified within in a quoted
string by doubling it. Newlines in a quoted string are accepted as is.
.PP
.SS PLUGINS
\fBpage\fR makes use of four different types of plugins, namely:
readers, writers, transformations, and configurations. Here we provide
only a basic introduction on how to use them from \fBpage\fR. The
exact APIs provided to and expected from the plugins can be found in
the documentation for \fBpage::pluginmgr\fR, for those who wish to
write their own plugins.
.PP
Plugins are specified as arguments to the options \fB-r\fR,
\fB-w\fR, \fB-t\fR, \fB-c\fR, and their equivalent longer
forms. See the section \fBOPTIONS\fR for reference.
.PP
Each such argument will be first treated as the name of a file and
this file is loaded as the plugin. If however there is no file with
that name, then it will be translated into the name of a package, and
this package is then loaded. For each type of plugins the package
management searches not only the regular paths, but a set application-
and type-specific paths as well. Please see the section
\fBPLUGIN LOCATIONS\fR for a listing of all paths and their
sources.
.PP
.TP
\fB-c\fR \fIname\fR
Configurations. The name of the package for the plugin \fIname\fR is
"page::config::\fIname\fR".
.sp
We have one predefined plugin:
.RS
.TP
\fIpeg\fR
It sets the application up as a parser generator accepting parsing
expression grammars and writing a packrat parser in Tcl. The actual
arguments it specifies are:
.sp
.CS


	--reset
	--append
	--reader    peg
	--transform reach
	--transform use
	--writer    me

.CE
.sp
.RE
.TP
\fB-r\fR \fIname\fR
Readers. The name of the package for the plugin \fIname\fR is
"page::reader::\fIname\fR".
.sp
We have five predefined plugins:
.RS
.TP
\fIpeg\fR
Interprets the input as a parsing expression grammar (\fIPEG\fR) and
generates a tree representation for it. Both the syntax of PEGs and
the structure of the tree representation are explained in their own
manpages.
.TP
\fIhb\fR
Interprets the input as Tcl code as generated by the writer plugin
\fIhb\fR and generates its tree representation.
.TP
\fIser\fR
Interprets the input as the serialization of a PEG, as generated by
the writer plugin \fIser\fR, using the package
\fBgrammar::peg\fR.
.TP
\fIlemon\fR
Interprets the input as a grammar specification as understood by
Richard Hipp's \fILEMON\fR parser generator and generates a tree
representation for it. Both the input syntax and the structure of the
tree representation are explained in their own manpages.
.TP
\fItreeser\fR
Interprets the input as the serialization of a
\fBstruct::tree\fR. It is validated as such,
but nothing else. It is \fInot\fR assumed to
be the tree representation of a grammar.
.RE
.TP
\fB-w\fR \fIname\fR
Writers. The name of the package for the plugin \fIname\fR is
"page::writer::\fIname\fR".
.sp
We have eight predefined plugins:
.RS
.TP
\fIidentity\fR
Simply writes the incoming data as it is, without making any
changes. This is good for inspecting the raw result of a reader or
transformation.
.TP
\fInull\fR
Generates nothing, and ignores the incoming data structure.
.TP
\fItree\fR
Assumes that the incoming data structure is a \fBstruct::tree\fR
and generates an indented textual representation of all nodes, their
parental relationships, and their attribute information.
.TP
\fIpeg\fR
Assumes that the incoming data structure is a tree representation of a
\fIPEG\fR or other other grammar and writes it out as a PEG. The
result is nicely formatted and partially simplified (strings as
sequences of characters). A pretty printer in essence, but can also be
used to obtain a canonical representation of the input grammar.
.TP
\fItpc\fR
Assumes that the incoming data structure is a tree representation of a
\fIPEG\fR or other other grammar and writes out Tcl code defining a
package which defines a \fBgrammar::peg\fR object containing the
grammar when it is loaded into an interpreter.
.TP
\fIhb\fR
This is like the writer plugin \fItpc\fR, but it writes only the
statements which define stat expression and grammar rules. The code
making the result a package is left out.
.TP
\fIser\fR
Assumes that the incoming data structure is a tree representation of a
\fIPEG\fR or other other grammar, transforms it internally into a
\fBgrammar::peg\fR object and writes out its serialization.
.TP
\fIme\fR
Assumes that the incoming data structure is a tree representation of a
\fIPEG\fR or other other grammar and writes out Tcl code defining a
package which implements a memoizing recursive descent parser based on
the match engine (ME) provided by the package \fBgrammar::mengine\fR.
.RE
.TP
\fB-t\fR \fIname\fR
Transformers. The name of the package for the plugin \fIname\fR is
"page::transform::\fIname\fR".
.sp
We have two predefined plugins:
.RS
.TP
\fIreach\fR
Assumes that the incoming data structure is a tree representation of a
\fIPEG\fR or other other grammar. It determines which nonterminal
symbols and rules are reachable from start-symbol/expression. All
nonterminal symbols which were not reached are removed.
.TP
\fIuse\fR
Assumes that the incoming data structure is a tree representation of a
\fIPEG\fR or other other grammar. It determines which nonterminal
symbols and rules are able to generate a \fIfinite\fR sequences of
terminal symbols (in the sense for a Context Free Grammar). All
nonterminal symbols which were not deemed useful in this sense are
removed.
.RE
.PP
.SS "PLUGIN LOCATIONS"
The application-specific paths searched by \fBpage\fR either are,
or come from:
.PP
.IP [1]
The directory            "\fI~/.page/plugin\fR"
.IP [2]
The environment variable \fIPAGE_PLUGINS\fR
.IP [3]
The registry entry       \fIHKEY_LOCAL_MACHINE\\SOFTWARE\\PAGE\\PLUGINS\fR
.IP [4]
The registry entry       \fIHKEY_CURRENT_USER\\SOFTWARE\\PAGE\\PLUGINS\fR
.PP
.PP
The type-specific paths searched by \fBpage\fR either are, or come
from:
.PP
.IP [1]
The directory            "\fI~/.page/plugin/<TYPE>\fR"
.IP [2]
The environment variable \fIPAGE_<TYPE>_PLUGINS\fR
.IP [3]
The registry entry       \fIHKEY_LOCAL_MACHINE\\SOFTWARE\\PAGE\\<TYPE>\\PLUGINS\fR
.IP [4]
The registry entry       \fIHKEY_CURRENT_USER\\SOFTWARE\\PAGE\\<TYPE>\\PLUGINS\fR
.PP
.PP
Where the placeholder \fI<TYPE>\fR is always one of the values below,
properly capitalized.
.IP [1]
reader
.IP [2]
writer
.IP [3]
transform
.IP [4]
config
.PP
.PP
The registry entries are specific to the Windows(tm) platform, all
other platforms will ignore them.
.PP
The contents of both environment variables and registry entries are
interpreted as a list of paths, with the elements separated by either
colon (Unix), or semicolon (Windows).
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category \fIpage\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
application and/or documentation.
.SH "SEE ALSO"
page::pluginmgr
.SH KEYWORDS
parser generator, text processing
.SH CATEGORY
Page Parser Generator
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/apps/tcldocstrip.n.























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/apps/tcldocstrip.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcldocstrip" n 1.0 tcllib "Textprocessing toolbox"
.BS
.SH NAME
tcldocstrip \- Tcl-based Docstrip Processor
.SH SYNOPSIS
\fBtcldocstrip\fR \fIoutput\fR ?options? \fIinput\fR ?\fIguards\fR?
.sp
\fBtcldocstrip\fR ?options? \fIoutput\fR (?options? \fIinput\fR \fIguards\fR)...
.sp
\fBtcldocstrip\fR \fB-guards\fR \fIinput\fR
.sp
.BE
.SH DESCRIPTION
.PP
The application described by this document, \fBtcldocstrip\fR, is a
relative of \fBdocstrip\fR, a simple literate programming tool for
LaTeX.
.PP
\fBtcldocstrip\fR is based upon the package \fBdocstrip\fR.
.SS "USE CASES"
\fBtcldocstrip\fR was written with the following three use cases in
mind.
.PP
.IP [1]
Conversion of a single input file according to the listed guards into
the stripped output. This handles the most simple case of a set of
guards specifying a single document found in a single input file.
.IP [2]
Stitching, or the assembly of an output from several sets of guards,
in a specific order, and possibly from different files. This is the
second common case. One document spread over several inputs, and/or
spread over different guard sets.
.IP [3]
Extraction and listing of all the unique guard expressions and guards
used within a document to help a person which did not author the
document in question in familiarizing itself with it.
.PP
.SS "COMMAND LINE"
.TP
\fBtcldocstrip\fR \fIoutput\fR ?options? \fIinput\fR ?\fIguards\fR?
This is the form for use case [1]. It converts the \fIinput\fR
file according to the specified \fIguards\fR and options. The result
is written to the named \fIoutput\fR file.
Usage of the string \fB-\fR as the name of the output signals that
the result should be written to \fBstdout\fR. The guards are
document-specific and have to be known to the caller. The
\fIoptions\fR will be explained later, in section \fBOPTIONS\fR.
.RS
.TP
path \fIoutput\fR (in)
This argument specifies where to write the generated document. It can
be the path to a file or directory, or \fB-\fR.
The last value causes the application to write the generated
documented to \fBstdout\fR.
.sp
If the \fIoutput\fR does not exist then [file dirname $output]
has to exist and must be a writable directory.
.TP
path \fIinputfile\fR (in)
This argument specifies the path to the file to process. It has to
exist, must be readable, and written in \fIdocstrip\fR format.
.RE
.sp
.TP
\fBtcldocstrip\fR ?options? \fIoutput\fR (?options? \fIinput\fR \fIguards\fR)...
This is the form for use case [2]. It differs from the form for
use case [1] by the possibility of having options before the
output file, which apply in general, and specifying more than one
inputfile, each with its own set of input specific options and guards.
.sp
It extracts data from the various \fIinput\fR files, according to the
specified \fIoptions\fR and \fIguards\fR, and writes the result to the
given \fIoutput\fR, in the order of their specification on the command
line. Options specified before the output are global settings, whereas
the options specified before each input are valid only just for this
input file. Unspecified values are taken from the global settings, or
defaults. As for form [1] using the string \fB-\fR as output
causes the application to write to stdout.
Using the string \fB.\fR for an input file signals that the last
input file should be used again. This enables the assembly of the
output from one input file using multiple and different sets of
guards, without having to specify the full name of the file every
time.
.TP
\fBtcldocstrip\fR \fB-guards\fR \fIinput\fR
This is the form for use case [3].
It determines the guards, and unique guard expressions used within the
provided \fIinput\fR document. The found strings are written to
stdout, one string per line.
.PP
.SS OPTIONS
This section describes all the options available to the user of the
application, with the exception of the option \fB-guards\fR. This
option was described already, in section \fBCOMMAND LINE\fR.
.PP
.TP
\fB-metaprefix\fR string
This option is inherited from the command \fBdocstrip::extract\fR
provided by the package \fBdocstrip\fR.
.sp
It specifies the string by which the '%%' prefix of a metacomment line
will be replaced. Defaults to '%%'. For Tcl code this would typically
be '#'.
.TP
\fB-onerror\fR mode
This option is inherited from the command \fBdocstrip::extract\fR
provided by the package \fBdocstrip\fR.
.sp
It controls what will be done when a format error in the \fItext\fR
being processed is detected. The settings are:
.RS
.TP
\fBignore\fR
Just ignore the error; continue as if nothing happened.
.TP
\fBputs\fR
Write an error message to \fBstderr\fR, then continue processing.
.TP
\fBthrow\fR
Throw an error. \fB::errorCode\fR is set to a list whose first element
is \fBDOCSTRIP\fR, second element is the type of error, and third
element is the line number where the error is detected. This is the
default.
.RE
.TP
\fB-trimlines\fR bool
This option is inherited from the command \fBdocstrip::extract\fR
provided by the package \fBdocstrip\fR.
.sp
Controls whether \fIspaces\fR at the end of a line should be trimmed
away before the line is processed. Defaults to \fBtrue\fR.
.TP
\fB-preamble\fR text
.TP
\fB-postamble\fR text
.TP
\fB-nopreamble\fR
.TP
\fB-nopostamble\fR
The -no*amble options deactivate file pre- and postambles altogether,
whereas the -*amble options specify the \fIuser\fR part of the file
pre- and postambles. This part can be empty, in that case only the
standard parts are shown. This is the default.
.sp
Preambles, when active, are written before the actual content of a
generated file. In the same manner postambles are, when active,
written after the actual content of a generated file.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category \fIdocstrip\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
application and/or documentation.
.SH "SEE ALSO"
docstrip
.SH KEYWORDS
.dtx, LaTeX, conversion, docstrip, documentation, literate programming, markup, source
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/aes/aes.n.





































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/aes/aes.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005, Pat Thoyts <[email protected]>
'\" Copyright (c) 2012, Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "aes" n 1.1 tcllib "Advanced Encryption Standard (AES)"
.BS
.SH NAME
aes \- Implementation of the AES block cipher
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBaes  ?1.1?\fR
.sp
\fB::aes::aes\fR ?\fI-mode [ecb|cbc]\fR? ?\fI-dir [encrypt|decrypt]\fR? \fI-key keydata\fR ?\fI-iv vector\fR? ?\fI-hex\fR? ?\fI-out channel\fR? ?\fI-chunksize size\fR? [ \fI-in channel\fR | ?\fB--\fR? \fIdata\fR ]
.sp
\fB::aes::Init\fR \fImode\fR \fIkeydata\fR \fIiv\fR
.sp
\fB::aes::Encrypt\fR \fIKey\fR \fIdata\fR
.sp
\fB::aes::Decrypt\fR \fIKey\fR \fIdata\fR
.sp
\fB::aes::Reset\fR \fIKey\fR \fIiv\fR
.sp
\fB::aes::Final\fR \fIKey\fR
.sp
.BE
.SH DESCRIPTION
.PP
This is an implementation in Tcl of the Advanced Encryption Standard
(AES) as published by the U.S. National Institute of Standards and
Technology [1]. AES is a 128-bit block cipher with a variable
key size of 128, 192 or 256 bits. This implementation supports ECB and
CBC modes.
.SH COMMANDS
.TP
\fB::aes::aes\fR ?\fI-mode [ecb|cbc]\fR? ?\fI-dir [encrypt|decrypt]\fR? \fI-key keydata\fR ?\fI-iv vector\fR? ?\fI-hex\fR? ?\fI-out channel\fR? ?\fI-chunksize size\fR? [ \fI-in channel\fR | ?\fB--\fR? \fIdata\fR ]
Perform the \fBaes\fR algorithm on either the data provided
by the argument or on the data read from the \fI-in\fR channel. If
an \fI-out\fR channel is given then the result will be written to
this channel.
.sp
The \fI-key\fR option must be given. This parameter takes a binary
string of either 16, 24 or 32 bytes in length and is used to generate the
key schedule.
.sp
The \fI-mode\fR and \fI-dir\fR options are optional and default to cbc
mode and encrypt respectively. The initialization vector \fI-iv\fR
takes a 16 byte binary argument which defaults to all zeros.
See \fBMODES OF OPERATION\fR for more about available modes and
their uses.
.sp
AES is a 128-bit block cipher. This means that the data must be
provided in units that are a multiple of 16 bytes.
.PP
.SH "PROGRAMMING INTERFACE"
Internal state is maintained in an opaque structure that is returned
from the \fBInit\fR function. In ECB mode the state is not affected by
the input but for CBC mode some input dependent state is maintained
and may be reset by calling the \fBReset\fR function with a new
initialization vector value.
.TP
\fB::aes::Init\fR \fImode\fR \fIkeydata\fR \fIiv\fR
Construct a new AES key schedule using the specified key data and the
given initialization vector. The initialization vector is not used
with ECB mode but is important for CBC mode.
See \fBMODES OF OPERATION\fR for details about cipher modes.
.TP
\fB::aes::Encrypt\fR \fIKey\fR \fIdata\fR
Use a prepared key acquired by calling \fBInit\fR to encrypt the
provided data. The data argument should be a binary array that is a
multiple of the AES block size of 16 bytes. The result is a binary
array the same size as the input of encrypted data.
.TP
\fB::aes::Decrypt\fR \fIKey\fR \fIdata\fR
Decipher data using the key. Note that the same key may be used to
encrypt and decrypt data provided that the initialization vector is
reset appropriately for CBC mode.
.TP
\fB::aes::Reset\fR \fIKey\fR \fIiv\fR
Reset the initialization vector. This permits the programmer to re-use
a key and avoid the cost of re-generating the key schedule where the
same key data is being used multiple times.
.TP
\fB::aes::Final\fR \fIKey\fR
This should be called to clean up resources associated with \fIKey\fR.
Once this function has been called the key may not be used again.
.PP
.SH "MODES OF OPERATION"
.TP
Electronic Code Book (ECB)
ECB is the basic mode of all block ciphers. Each block is encrypted
independently and so identical plain text will produce identical
output when encrypted with the same key. Any encryption errors will
only affect a single block however this is vulnerable to known
plaintext attacks.
.TP
Cipher Block Chaining (CBC)
CBC mode uses the output of the last block encryption to affect the
current block. An initialization vector of the same size as the cipher
block size is used to handle the first block. The initialization
vector should be chosen randomly and transmitted as the first block of
the output. Errors in encryption affect the current block and the next
block after which the cipher will correct itself. CBC is the most
commonly used mode in software encryption. This is the default mode
of operation for this module.
.PP
.SH EXAMPLES
.CS


% set nil_block [string repeat \\\\0 16]
% aes::aes -hex -mode cbc -dir encrypt -key $nil_block $nil_block
66e94bd4ef8a2c3b884cfa59ca342b2e

.CE
.CS


set Key [aes::Init cbc $sixteen_bytes_key_data $sixteen_byte_iv]
append ciphertext [aes::Encrypt $Key $plaintext]
append ciphertext [aes::Encrypt $Key $additional_plaintext]
aes::Final $Key

.CE
.SH REFERENCES
.IP [1]
"Advanced Encryption Standard",
Federal Information Processing Standards Publication 197, 2001
(\fIhttp://csrc.nist.gov/publications/fips/fips197/fips-197.pdf\fR)
.PP
.SH AUTHORS
Thorsten Schloermann, Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIaes\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
blowfish(n), des(n), md5(n), sha1(n)
.SH KEYWORDS
aes, block cipher, data integrity, encryption, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2005, Pat Thoyts <[email protected]>
Copyright (c) 2012, Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/amazon-s3/S3.n.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/amazon-s3/S3.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) Copyright 2006,2008 Darren New. All Rights Reserved. See LICENSE.TXT for terms.
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "S3" n 1.0.0 tcllib "Amazon S3 Web Service Utilities"
.BS
.SH NAME
S3 \- Amazon S3 Web Service Interface
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBsha1  1.0\fR
.sp
package require \fBmd5  2.0\fR
.sp
package require \fBbase64  2.3\fR
.sp
package require \fBxsxp  1.0\fR
.sp
\fBS3::Configure\fR ?\fB-reset\fR \fIboolean\fR? ?\fB-retries\fR \fIinteger\fR? ?\fB-accesskeyid\fR \fIidstring\fR? ?\fB-secretaccesskey\fR \fIidstring\fR? ?\fB-service-access-point\fR \fIFQDN\fR? ?\fB-use-tls\fR \fIboolean\fR? ?\fB-default-compare\fR \fIalways|never|exists|missing|newer|date|checksum|different\fR? ?\fB-default-separator\fR \fIstring\fR? ?\fB-default-acl\fR \fIprivate|public-read|public-read-write|authenticated-read|keep|calc\fR? ?\fB-default-bucket\fR \fIbucketname\fR?
.sp
\fBS3::SuggestBucket\fR ?\fIname\fR?
.sp
\fBS3::REST\fR \fIdict\fR
.sp
\fBS3::ListAllMyBuckets\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-parse-xml\fR \fIxmlstring\fR? ?\fB-result-type\fR \fIREST|xml|pxml|dict|names|owner\fR?
.sp
\fBS3::PutBucket\fR ?\fB-bucket\fR \fIbucketname\fR? ?\fB-blocking\fR \fIboolean\fR? ?\fB-acl\fR \fI{}|private|public-read|public-read-write|authenticated-read\fR?
.sp
\fBS3::DeleteBucket\fR ?\fB-bucket\fR \fIbucketname\fR? ?\fB-blocking\fR \fIboolean\fR?
.sp
\fBS3::GetBucket\fR ?\fB-bucket\fR \fIbucketname\fR? ?\fB-blocking\fR \fIboolean\fR? ?\fB-parse-xml\fR \fIxmlstring\fR? ?\fB-max-count\fR \fIinteger\fR? ?\fB-prefix\fR \fIprefixstring\fR? ?\fB-delimiter\fR \fIdelimiterstring\fR? ?\fB-result-type\fR \fIREST|xml|pxml|names|dict\fR?
.sp
\fBS3::Put\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-file\fR \fIfilename\fR? ?\fB-content\fR \fIcontentstring\fR? ?\fB-acl\fR \fIprivate|public-read|public-read-write|authenticated-read|calc|keep\fR? ?\fB-content-type\fR \fIcontenttypestring\fR? ?\fB-x-amz-meta-*\fR \fImetadatatext\fR? ?\fB-compare\fR \fIcomparemode\fR?
.sp
\fBS3::Get\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-compare\fR \fIcomparemode\fR? ?\fB-file\fR \fIfilename\fR? ?\fB-content\fR \fIcontentvarname\fR? ?\fB-timestamp\fR \fIaws|now\fR? ?\fB-headers\fR \fIheadervarname\fR?
.sp
\fBS3::Head\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-dict\fR \fIdictvarname\fR? ?\fB-headers\fR \fIheadersvarname\fR? ?\fB-status\fR \fIstatusvarname\fR?
.sp
\fBS3::GetAcl\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-result-type\fR \fIREST|xml|pxml\fR?
.sp
\fBS3::PutAcl\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-acl\fR \fInew-acl\fR?
.sp
\fBS3::Delete\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-status\fR \fIstatusvar\fR?
.sp
\fBS3::Push\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-directory\fR \fIdirectoryname\fR ?\fB-prefix\fR \fIprefixstring\fR? ?\fB-compare\fR \fIcomparemode\fR? ?\fB-x-amz-meta-*\fR \fImetastring\fR? ?\fB-acl\fR \fIaclcode\fR? ?\fB-delete\fR \fIboolean\fR? ?\fB-error\fR \fIthrow|break|continue\fR? ?\fB-progress\fR \fIscriptprefix\fR?
.sp
\fBS3::Pull\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-directory\fR \fIdirectoryname\fR ?\fB-prefix\fR \fIprefixstring\fR? ?\fB-blocking\fR \fIboolean\fR? ?\fB-compare\fR \fIcomparemode\fR? ?\fB-delete\fR \fIboolean\fR? ?\fB-timestamp\fR \fIaws|now\fR? ?\fB-error\fR \fIthrow|break|continue\fR? ?\fB-progress\fR \fIscriptprefix\fR?
.sp
\fBS3::Toss\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-prefix\fR \fIprefixstring\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-error\fR \fIthrow|break|continue\fR? ?\fB-progress\fR \fIscriptprefix\fR?
.sp
.BE
.SH DESCRIPTION
This package provides access to Amazon's Simple Storage Solution web service.
.PP
As a quick summary, Amazon Simple Storage Solution
provides a for-fee web service allowing the storage of arbitrary data as
"resources" within "buckets" online.
See \fIhttp://www.amazonaws.com/\fR for details on that system.
Access to the service is via HTTP (SOAP or REST).  Much of this
documentation will not make sense if you're not familiar with
the terms and functionality of the Amazon S3 service.
.PP
This package provides services for reading and writing
the data items via the REST interface.  It also provides some
higher-level operations.  Other packages in the same distribution
provide for even more functionality.
.PP
Copyright 2006 Darren New. All Rights Reserved.
NO WARRANTIES OF ANY TYPE ARE PROVIDED.
COPYING OR USE INDEMNIFIES THE AUTHOR IN ALL WAYS.
This software is licensed under essentially the same
terms as Tcl. See LICENSE.txt for the terms.
.SH "ERROR REPORTING"
The error reporting from this package makes use of $errorCode to
provide more details on what happened than simply throwing an error.
Any error caught by the S3 package (and we try to catch them all)
will return with an $errorCode being a list having at least three
elements. In all cases, the first element will be "S3". The second
element will take on one of six values, with that element defining
the value of the third and subsequent elements. S3::REST does not
throw an error, but rather returns a dictionary with the keys "error",
"errorInfo", and "errorCode" set. This allows for reliable background
use. The possible second elements are these:
.TP
usage
The usage of the package is incorrect. For example,
a command has been invoked which requires the library to be configured
before the library has been configured, or an invalid combination of
options has been specified. The third element of $errorCode supplies
the name of the parameter that was wrong. The fourth usually provides
the arguments that were actually supplied to the throwing proc, unless
the usage error isn't confined to a single proc.
.TP
local
Something happened on the local system which threw
an error. For example, a request to upload or download a file was made
and the file permissions denied that sort of access. The third element
of $errorCode is the original $errorCode.
.TP
socket
Something happened with the socket. It closed
prematurely, or some other condition of failure-to-communicate-with-Amazon
was detected. The third element of $errorCode is the original $errorCode,
or sometimes the message from fcopy, or ...?
.TP
remote
The Amazon web service returned an error code outside
the 2xx range in the HTTP header. In other words, everything went as
documented, except this particular case was documented not to work.
The third element is the dictionary returned from \fB::S3::REST\fR.
Note that S3::REST itself never throws this error, but just returns
the dictionary. Most of the higher-level commands throw for convenience,
unless an argument indicates they should not. If something is documented
as "not throwing an S3 remote error", it means a status return is set
rather than throwing an error if Amazon returns a non-2XX HTTP result code.
.TP
notyet
The user obeyed the documentation, but the author
has not yet gotten around to implementing this feature. (Right now,
only TLS support and sophisticated permissions fall into this category,
as well as the S3::Acl command.)
.TP
xml
The service has returned invalid XML, or XML whose
schema is unexpected. For the high-level commands that accept
service XML as input for parsing, this may also be thrown.
.PP
.SH COMMANDS
This package provides several separate levels of complexity.
.IP \(bu
The lowest level simply takes arguments to be sent to the service,
sends them, retrieves the result, and provides it to the caller.
\fINote:\fR This layer allows both synchronous and event-driven
processing. It depends on the MD5 and SHA1 and base64 packages
from Tcllib (available at \fIhttp://tcllib.sourceforge.net/\fR).
Note that \fBS3::Configure\fR is required for \fBS3::REST\fR to
work due to the authentication portion, so we put that in the "lowest level."
.IP \(bu
The next layer parses the results of calls, allowing for functionality
such as uploading only changed files, synchronizing directories,
and so on.  This layer depends on the \fBTclXML\fR package as well as the
included \fBxsxp\fR package. These packages are package required when
these more-sophisticated routines are called, so nothing breaks if
they are not correctly installed.
.IP \(bu
Also included is a separate program that uses the library.
It provides code to parse $argv0 and $argv from the
command line, allowing invocation as a tclkit, etc.
(Not yet implmented.)
.IP \(bu
Another separate program provides a GUI interface allowing drag-and-drop
and other such functionality. (Not yet implemented.)
.IP \(bu
Also built on this package is the OddJob program. It is
a separate program designed to allow distribution of
computational work units over Amazon's Elastic Compute
Cloud web service.
.PP
.PP
The goal is to have at least the bottom-most layers implemented in
pure Tcl using only that which comes from widely-available sources,
such as Tcllib.
.SH "LOW LEVEL COMMANDS"
These commands do not require any packages not listed above.
They talk directly to the service, or they are utility or
configuration routines. Note that the "xsxp" package was
written to support this package, so it should be available
wherever you got this package.
.TP
\fBS3::Configure\fR ?\fB-reset\fR \fIboolean\fR? ?\fB-retries\fR \fIinteger\fR? ?\fB-accesskeyid\fR \fIidstring\fR? ?\fB-secretaccesskey\fR \fIidstring\fR? ?\fB-service-access-point\fR \fIFQDN\fR? ?\fB-use-tls\fR \fIboolean\fR? ?\fB-default-compare\fR \fIalways|never|exists|missing|newer|date|checksum|different\fR? ?\fB-default-separator\fR \fIstring\fR? ?\fB-default-acl\fR \fIprivate|public-read|public-read-write|authenticated-read|keep|calc\fR? ?\fB-default-bucket\fR \fIbucketname\fR?
There is one command for configuration, and that is \fBS3::Configure\fR.
If called with no arguments, it returns a
dictionary of key/value pairs listing all current settings.  If called
with one argument, it returns the value of that single argument.  If
called with two or more arguments, it must be called with pairs of
arguments, and it applies the changes in order.  There is only one set
of configuration information per interpreter.
.sp
The following options are accepted:
.RS
.TP
\fB-reset\fR \fIboolean\fR
By default, false.  If true, any previous changes and any changes on the
same call before the reset option will be returned to default values.
.TP
\fB-retries\fR \fIinteger\fR
Default value is 3.
If Amazon returns a 500 error, a retry after an exponential
backoff delay will be tried this many times before finally
throwing the 500 error. This applies to each call to \fBS3::REST\fR
from the higher-level commands, but not to \fBS3::REST\fR itself.
That is, \fBS3::REST\fR will always return httpstatus 500 if that's
what it receives. Functions like \fBS3::Put\fR will retry the PUT call,
and will also retry the GET and HEAD calls used to do content comparison.
Changing this to 0 will prevent retries and their associated delays.
In addition, socket errors (i.e., errors whose errorCode starts with
"S3 socket") will be similarly retried after backoffs.
.TP
\fB-accesskeyid\fR \fIidstring\fR
.TP
\fB-secretaccesskey\fR \fIidstring\fR
Each defaults to an empty string.
These must be set before any calls are made. This is your S3 ID.
Once you sign up for an account, go to \fIhttp://www.amazonaws.com/\fR,
sign in, go to the "Your Web Services Account" button, pick "AWS
Access Identifiers", and your access key ID and secret access keys
will be available. All \fBS3::REST\fR calls are authenticated.
Blame Amazon for the poor choice of names.
.TP
\fB-service-access-point\fR \fIFQDN\fR
Defaults to "s3.amazonaws.com". This is the fully-qualified domain
name of the server to contact for \fBS3::REST\fR calls. You should
probably never need to touch this, unless someone else implements
a compatible service, or you wish to test something by pointing
the library at your own service.
.TP
\fB-slop-seconds\fR \fIinteger\fR
When comparing dates between Amazon and the local machine,
two dates within this many seconds of each other are considered
the same. Useful for clock drift correction, processing overhead
time, and so on.
.TP
\fB-use-tls\fR \fIboolean\fR
Defaults to false. This is not yet implemented. If true, \fBS3::REST\fR will
negotiate a TLS connection to Amazon. If false, unencrypted connections
are used.
.TP
\fB-bucket-prefix\fR \fIstring\fR
Defaults to "TclS3".  This string is used by \fBS3::SuggestBucketName\fR
if that command is passed an empty string as an argument. It is used
to distinguish different applications using the Amazon service.
Your application should always set this to keep from interfering with
the buckets of other users of Amazon S3 or with other buckets of the
same user.
.TP
\fB-default-compare\fR \fIalways|never|exists|missing|newer|date|checksum|different\fR
Defaults to "always." If no -compare is specified on
\fBS3::Put\fR, \fBS3::Get\fR, or \fBS3::Delete\fR, this comparison is used.
See those commands for a description of the meaning.
.TP
\fB-default-separator\fR \fIstring\fR
Defaults to "/". This is currently unused. It might make sense to use
this for \fBS3::Push\fR and \fBS3::Pull\fR, but allowing resources to
have slashes in their names that aren't marking directories would be
problematic. Hence, this currently does nothing.
.TP
\fB-default-acl\fR \fIprivate|public-read|public-read-write|authenticated-read|keep|calc\fR
Defaults to an empty string. If no -acl argument is provided to \fBS3::Put\fR or
\fBS3::Push\fR, this string is used
(given as the x-amz-acl header if not keep or calc). If this is also
empty, no x-amz-acl header is generated.
This is \fInot\fR used by \fBS3::REST\fR.
.TP
\fB-default-bucket\fR \fIbucketname\fR
If no bucket is given to \fBS3::GetBucket\fR, \fBS3::PutBucket\fR,
\fBS3::Get\fR, \fBS3::Put\fR,
\fBS3::Head\fR, \fBS3::Acl\fR,
\fBS3::Delete\fR, \fBS3::Push\fR,
\fBS3::Pull\fR, or \fBS3::Toss\fR, and if this configuration variable
is not an empty string (and not simply "/"), then this value
will be used for the bucket. This is useful if one program does
a large amount of resource manipulation within a single bucket.
.RE
.sp
.TP
\fBS3::SuggestBucket\fR ?\fIname\fR?
The \fBS3::SuggestBucket\fR command accepts an optional string as
a prefix and returns a valid bucket containing the \fIname\fR argument
and the Access Key ID. This makes the name unique to the owner and
to the application (assuming the application picks a good \fIname\fR argument).
If no name is provided,
the name from \fBS3::Configure\fR \fI-bucket-prefix\fR is used.
If that too is empty (which is not the default), an error is thrown.
.TP
\fBS3::REST\fR \fIdict\fR
The \fBS3::REST\fR command takes as an argument a dictionary and
returns a dictionary.  The return dictionary has the same keys
as the input dictionary, and includes additional keys as the result.
The presence or absence of keys in the input dictionary can control
the behavior of the routine.  It never throws an error directly, but
includes keys "error", "errorInfo", and "errorCode" if necessary.
Some keys are required, some optional. The routine can run either
in blocking or non-blocking mode, based on the presense
of \fBresultvar\fR in the input dictionary. This requires
the \fI-accesskeyid\fR and \fI-secretaccesskey\fR to be configured via
\fBS3::Configure\fR before being called.
.sp
The possible input keys are these:
.RS
.TP
\fBverb\fR \fIGET|PUT|DELETE|HEAD\fR
This required item indicates the verb to be used.
.TP
\fBresource\fR \fIstring\fR
This required item indicates the resource to be accessed.
A leading / is added if not there already. It will
be URL-encoded for you if necessary. Do not supply a
resource name that is already URL-encoded.
.TP
?\fBrtype\fR \fItorrent|acl\fR?
This indicates a torrent or acl resource is being manipulated.
Do not include this in the \fBresource\fR key, or the
"?" separator will get URL-encoded.
.TP
?\fBparameters\fR \fIdict\fR?
This optional dictionary provides parameters added to the URL
for the transaction. The keys must be in the correct case
(which is confusing in the Amazon documentation) and the
values must be valid. This can be an empty dictionary or
omitted entirely if no parameters are desired. No other
error checking on parameters is performed.
.TP
?\fBheaders\fR \fIdict\fR?
This optional dictionary provides headers to be added
to the HTTP request. The keys must be in \fIlower case\fR
for the authentication to work. The values must not contain
embedded newlines or carriage returns. This is primarily
useful for adding x-amz-* headers. Since authentication
is calculated by \fBS3::REST\fR, do not add that header here.
Since content-type gets its own key, also do not add
that header here.
.TP
?\fBinbody\fR \fIcontentstring\fR?
This optional item, if provided, gives the content that will
be sent. It is sent with a tranfer encoding of binary, and
only the low bytes are used, so use [encoding convertto utf-8]
if the string is a utf-8 string. This is written all in one blast,
so if you are using non-blocking mode and the \fBinbody\fR is
especially large, you may wind up blocking on the write socket.
.TP
?\fBinfile\fR \fIfilename\fR?
This optional item, if provided, and if \fBinbody\fR is not provided,
names the file from which the body of the HTTP message will be
constructed. The file is opened for reading and sent progressively
by [fcopy], so it should not block in non-blocking mode
even if the file is very large. The file is transfered in
binary mode, so the bytes on your disk will match the bytes
in your resource. Due to HTTP restrictions, it must be possible to
use [file size] on this file to determine the size at the
start of the transaction.
.TP
?\fBS3chan\fR \fIchannel\fR?
This optional item, if provided, indicates the already-open socket
over which the transaction should be conducted. If not provided,
a connection is made to the service access point specified via
\fBS3::Configure\fR, which is normally s3.amazonaws.com. If this
is provided, the channel is not closed at the end of the transaction.
.TP
?\fBoutchan\fR \fIchannel\fR?
This optional item, if provided, indicates the already-open channel
to which the body returned from S3 should be written. That is,
to retrieve a large resource, open a file, set the translation mode,
and pass the channel as the value of the key outchan. Output
will be written to the channel in pieces so memory does not fill
up unnecessarily. The channel is not closed at the end of the transaction.
.TP
?\fBresultvar\fR \fIvarname\fR?
This optional item, if provided, indicates that \fBS3::REST\fR should
run in non-blocking mode. The \fIvarname\fR should be fully qualified
with respect to namespaces and cannot be local to a proc. If provided,
the result of the \fBS3::REST\fR call is assigned to this variable once
everything has completed; use trace or vwait to know when this has happened.
If this key is not provided, the result is simply returned from the
call to \fBS3::REST\fR and no calls to the eventloop are invoked from
within this call.
.TP
?\fBthrowsocket\fR \fIthrow|return\fR?
This optional item, if provided, indicates that \fBS3::REST\fR should
throw an error if throwmode is throw and a socket error is encountered.
It indicates that \fBS3::REST\fR should return the error code in the
returned dictionary if a socket error is encountered and this is
set to return. If \fBthrowsocket\fR is set to \fIreturn\fR or
if the call is not blocking, then a socket error (i.e., an error
whose error code starts with "S3 socket" will be returned in the
dictionary as \fBerror\fR, \fBerrorInfo\fR, and \fBerrorCode\fR.
If a foreground call is made (i.e., \fBresultvar\fR is not provided),
and this option is not provided or is set to \fIthrow\fR, then
\fBerror\fR will be invoked instead.
.RE
.sp
Once the call to \fBS3::REST\fR completes, a new dict is returned,
either in the \fIresultvar\fR or as the result of execution. This dict is
a copy of the original dict with the results added as new keys. The possible
new keys are these:
.RS
.TP
\fBerror\fR \fIerrorstring\fR
.TP
\fBerrorInfo\fR \fIerrorstring\fR
.TP
\fBerrorCode\fR \fIerrorstring\fR
If an error is caught, these three keys will be set in the result.
Note that \fBS3::REST\fR does \fInot\fR consider a non-2XX HTTP
return code as an error. The \fBerrorCode\fR value will be
formatted according to the \fBERROR REPORTING\fR description.
If these are present, other keys described here might not be.
.TP
\fBhttpstatus\fR \fIthreedigits\fR
The three-digit code from the HTTP transaction. 2XX for good,
5XX for server error, etc.
.TP
\fBhttpmessage\fR \fItext\fR
The textual result after the status code. "OK" or "Forbidden"
or etc.
.TP
\fBoutbody\fR \fIcontentstring\fR
If \fIoutchan\fR was not specified, this key will hold a
reference to the (unencoded) contents of the body returned.
If Amazon returned an error (a la the httpstatus not a 2XX value),
the error message will be in \fBoutbody\fR or written to
\fBoutchan\fR as appropriate.
.TP
\fBoutheaders\fR \fIdict\fR
This contains a dictionary of headers returned by Amazon.
The keys are always lower case. It's mainly useful for
finding the x-amz-meta-* headers, if any, although things
like last-modified and content-type are also useful.
The keys of this dictionary are always lower case.
Both keys and values are trimmed of extraneous whitespace.
.RE
.PP
.SH "HIGH LEVEL COMMANDS"
The routines in this section all make use of one or more calls
to \fBS3::REST\fR to do their work, then parse and manage the data
in a convenient way.  All these commands throw errors
as described in \fBERROR REPORTING\fR unless otherwise noted.
.PP
In all these commands, all arguments are presented as name/value pairs,
in any order. All the argument names start with a hyphen.
.PP
There are a few options that are common to many
of the commands, and those common options are documented here.
.TP
\fB-blocking\fR \fIboolean\fR
If provided and specified as false,
then any calls to \fBS3:REST\fR will be non-blocking,
and internally these routines will call [vwait] to get
the results. In other words, these routines will return the
same value, but they'll have event loops running while waiting
for Amazon.
.TP
\fB-parse-xml\fR \fIxmlstring\fR
If provided, the routine skips actually communicating with
Amazon, and instead behaves as if the XML string provided
was returned as the body of the call. Since several of
these routines allow the return of data in various formats,
this argument can be used to parse existing XML to extract
the bits of information that are needed. It's also helpful
for testing.
.TP
\fB-bucket\fR \fIbucketname\fR
Almost every high-level command needs to know what bucket
the resources are in. This option specifies that. (Only the
command to list available buckets does not require this parameter.)
This does not need to be URL-encoded, even if it contains
special or non-ASCII characters. May or may not contain leading
or trailing spaces - commands normalize the bucket. If this is
not supplied, the value is taken from \fBS3::Configure -default-bucket\fR
if that string isn't empty. Note that spaces and slashes are
always trimmed from both ends and the rest must leave a valid bucket.
.TP
\fB-resource\fR \fIresourcename\fR
This specifies the resource of interest within the bucket.
It may or may not start with a slash - both cases are handled.
This does not need to be URL-encoded, even if it contains
special or non-ASCII characters.
.TP
\fB-compare\fR \fIalways|never|exists|missing|newer|date|checksum|different\fR
When commands copy resources to files or files to resources, the caller may specify that the copy should be skipped if the contents are the same. This argument specifies the conditions under which the files should be copied. If it is not passed, the result of \fBS3::Configure -default-compare\fR is used, which in turn defaults to "always." The meanings of the various values are these:
.RS
.TP
\fIalways\fR
Always copy the data. This is the default.
.TP
\fInever\fR
Never copy the data. This is essentially a no-op, except in \fBS3::Push\fR and \fBS3::Pull\fR where the -delete flag might make a difference.
.TP
\fIexists\fR
Copy the data only if the destination already exists.
.TP
\fImissing\fR
Copy the data only if the destination does not already exist.
.TP
\fInewer\fR
Copy the data if the destination is missing, or if the date on the source is
newer than the date on the destination by at
least \fBS3::Configure -slop-seconds\fR seconds. If the source is
Amazon, the date is taken from the Last-Modified header. If the
source is local, it is taken as the mtime of the file. If the source data
is specified in a string rather than a file, it is taken as right now,
via [clock seconds].
.TP
\fIdate\fR
Like \fInewer\fR, except copy if the date is newer \fIor\fR older.
.TP
\fIchecksum\fR
Calculate the MD5 checksum on the local file or string, ask Amazon for the eTag
of the resource, and copy the data if they're different. Copy the data
also if the destination is missing. Note that this can be slow with
large local files unless the C version of the MD5 support is available.
.TP
\fIdifferent\fR
Copy the data if the destination does not exist.
If the destination exists and an actual file name was specified
(rather than a content string),
and the date on the file differs from the date on the resource,
copy the data.
If the data is provided as a content string, the "date" is treated
as "right now", so it will likely always differ unless slop-seconds is large.
If the dates are the same, the MD5 checksums are compared, and the
data is copied if the checksums differ.
.RE
.sp
Note that "newer" and "date" don't care about the contents, and "checksum" doesn't care about the dates, but "different" checks both.
.TP
\fBS3::ListAllMyBuckets\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-parse-xml\fR \fIxmlstring\fR? ?\fB-result-type\fR \fIREST|xml|pxml|dict|names|owner\fR?
This routine performs a GET on the Amazon S3 service, which is
defined to return a list of buckets owned by the account identified
by the authorization header. (Blame Amazon for the dumb names.)
.RS
.TP
\fB-blocking\fR \fIboolean\fR
See above for standard definition.
.TP
\fB-parse-xml\fR \fIxmlstring\fR
See above for standard definition.
.TP
\fB-result-type\fR \fIREST\fR
The dictionary returned by \fBS3::REST\fR is the return value of \fBS3::ListAllMyBuckets\fR. In this case, a non-2XX httpstatus will not throw an error. You may not combine this with \fI-parse-xml\fR.
.TP
\fB-result-type\fR \fIxml\fR
The raw XML of the body is returned as the result (with no encoding applied).
.TP
\fB-result-type\fR \fIpxml\fR
The XML of the body as parsed by \fBxsxp::parse\fR is returned.
.TP
\fB-result-type\fR \fIdict\fR
A dictionary of interesting portions of the XML is returned. The dictionary contains the following keys:
.RS
.TP
Owner/ID
The Amazon AWS ID (in hex) of the owner of the bucket.
.TP
Owner/DisplayName
The Amazon AWS ID's Display Name.
.TP
Bucket/Name
A list of names, one for each bucket.
.TP
Bucket/CreationDate
A list of dates, one for each bucket,
in the same order as Bucket/Name, in ISO format (as returned by Amazon).
.RE
.sp
.TP
\fB-result-type\fR \fInames\fR
A list of bucket names is returned with all other information stripped out.
This is the default result type for this command.
.TP
\fB-result-type\fR \fIowner\fR
A list containing two elements is returned. The first element is
the owner's ID, and the second is the owner's display name.
.RE
.sp
.TP
\fBS3::PutBucket\fR ?\fB-bucket\fR \fIbucketname\fR? ?\fB-blocking\fR \fIboolean\fR? ?\fB-acl\fR \fI{}|private|public-read|public-read-write|authenticated-read\fR?
This command creates a bucket if it does not already exist. Bucket names are
globally unique, so you may get a "Forbidden" error from Amazon even if you
cannot see the bucket in \fBS3::ListAllMyBuckets\fR. See \fBS3::SuggestBucket\fR for ways to minimize this risk. The x-amz-acl header comes from the \fB-acl\fR option, or from \fBS3::Configure -default-acl\fR if not specified.
.TP
\fBS3::DeleteBucket\fR ?\fB-bucket\fR \fIbucketname\fR? ?\fB-blocking\fR \fIboolean\fR?
This command deletes a bucket if it is empty and you have such permission.
Note that Amazon's list of buckets is a global resource, requiring
far-flung synchronization. If you delete a bucket, it may be quite
a few minutes (or hours) before you can recreate it, yielding "Conflict"
errors until then.
.TP
\fBS3::GetBucket\fR ?\fB-bucket\fR \fIbucketname\fR? ?\fB-blocking\fR \fIboolean\fR? ?\fB-parse-xml\fR \fIxmlstring\fR? ?\fB-max-count\fR \fIinteger\fR? ?\fB-prefix\fR \fIprefixstring\fR? ?\fB-delimiter\fR \fIdelimiterstring\fR? ?\fB-result-type\fR \fIREST|xml|pxml|names|dict\fR?
This lists the contents of a bucket. That is, it returns a directory
listing of resources within a bucket, rather than transfering any
user data.
.RS
.TP
\fB-bucket\fR \fIbucketname\fR
The standard bucket argument.
.TP
\fB-blocking\fR \fIboolean\fR
The standard blocking argument.
.TP
\fB-parse-xml\fR \fIxmlstring\fR
The standard parse-xml argument.
.TP
\fB-max-count\fR \fIinteger\fR
If supplied, this is the most number of records to be returned.
If not supplied, the code will iterate until all records have been found.
Not compatible with -parse-xml. Note that if this is supplied, only
one call to \fBS3::REST\fR will be made. Otherwise, enough calls
will be made to exhaust the listing, buffering results in memory,
so take care if you may have huge buckets.
.TP
\fB-prefix\fR \fIprefixstring\fR
If present, restricts listing to resources with a particular prefix. One
leading / is stripped if present.
.TP
\fB-delimiter\fR \fIdelimiterstring\fR
If present, specifies a delimiter for the listing.
The presence of this will summarize multiple resources
into one entry, as if S3 supported directories. See the
Amazon documentation for details.
.TP
\fB-result-type\fR \fIREST|xml|pxml|names|dict\fR
This indicates the format of the return result of the command.
.RS
.TP
REST
If \fI-max-count\fR is specified, the dictionary returned
from \fBS3::REST\fR is returned. If \fI-max-count\fR is
not specified, a list of all the dictionaries returned from
the one or more calls to \fBS3::REST\fR is returned.
.TP
xml
If \fI-max-count\fR is specified, the body returned
from \fBS3::REST\fR is returned. If \fI-max-count\fR is
not specified, a list of all the bodies returned from
the one or more calls to \fBS3::REST\fR is returned.
.TP
pxml
If \fI-max-count\fR is specified, the body returned
from \fBS3::REST\fR is passed throught \fBxsxp::parse\fR and then returned.
If \fI-max-count\fR is
not specified, a list of all the bodies returned from
the one or more calls to \fBS3::REST\fR are each passed through
\fBxsxp::parse\fR and then returned.
.TP
names
Returns a list of all names found in either the Contents/Key fields or
the CommonPrefixes/Prefix fields. If no \fI-delimiter\fR is specified
and no \fI-max-count\fR is specified, this returns a list of all
resources with the specified \fI-prefix\fR.
.TP
dict
Returns a dictionary. (Returns only one dictionary even if \fI-max-count\fR
wasn't specified.) The keys of the dictionary are as follows:
.RS
.TP
Name
The name of the bucket (from the final call to \fBS3::REST\fR).
.TP
Prefix
From the final call to \fBS3::REST\fR.
.TP
Marker
From the final call to \fBS3::REST\fR.
.TP
MaxKeys
From the final call to \fBS3::REST\fR.
.TP
IsTruncated
From the final call to \fBS3::REST\fR, so
always false if \fI-max-count\fR is not specified.
.TP
NextMarker
Always provided if IsTruncated is true, and
calculated of Amazon does not provide it. May be empty if IsTruncated is false.
.TP
Key
A list of names of resources in the bucket matching the \fI-prefix\fR and \fI-delimiter\fR restrictions.
.TP
LastModified
A list of times of resources in the bucket, in the same
order as Key, in the format returned by Amazon. (I.e., it is not parsed into
a seconds-from-epoch.)
.TP
ETag
A list of entity tags (a.k.a. MD5 checksums) in the same order as Key.
.TP
Size
A list of sizes in bytes of the resources, in the same order as Key.
.TP
Owner/ID
A list of owners of the resources in the bucket, in the same order as Key.
.TP
Owner/DisplayName
A list of owners of the resources in the bucket, in the same order as Key. These are the display names.
.TP
CommonPrefixes/Prefix
A list of prefixes common to multiple entities. This is present only if \fI-delimiter\fR was supplied.
.RE
.RE
.RE
.TP
\fBS3::Put\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-file\fR \fIfilename\fR? ?\fB-content\fR \fIcontentstring\fR? ?\fB-acl\fR \fIprivate|public-read|public-read-write|authenticated-read|calc|keep\fR? ?\fB-content-type\fR \fIcontenttypestring\fR? ?\fB-x-amz-meta-*\fR \fImetadatatext\fR? ?\fB-compare\fR \fIcomparemode\fR?
This command sends data to a resource on Amazon's servers for storage,
using the HTTP PUT command. It returns 0 if the \fB-compare\fR mode
prevented the transfer, 1 if the transfer worked, or throws an error
if the transfer was attempted but failed.
Server 5XX errors and S3 socket errors are retried
according to \fBS3:Configure -retries\fR settings before throwing an error;
other errors throw immediately.
.RS
.TP
\fB-bucket\fR
This specifies the bucket into which the resource will be written.
Leading and/or trailing slashes are removed for you, as are spaces.
.TP
\fB-resource\fR
This is the full name of the resource within the bucket. A single
leading slash is removed, but not a trailing slash.
Spaces are not trimmed.
.TP
\fB-blocking\fR
The standard blocking flag.
.TP
\fB-file\fR
If this is specified, the \fIfilename\fR must exist, must be readable,
and must not be a special or directory file. [file size] must
apply to it and must not change for the lifetime of the call.  The
default content-type is calculated based on the name and/or contents
of the file. Specifying this is an error if \fB-content\fR is
also specified, but at least one of \fB-file\fR or \fB-content\fR must
be specified. (The file is allowed to not exist or not be readable if
\fB-compare\fR \fInever\fR is specified.)
.TP
\fB-content\fR
If this is specified, the \fIcontentstring\fR is sent as the body
of the resource. The content-type defaults to "application/octet-string".
Only the low bytes are sent, so non-ASCII should use the appropriate encoding
(such as [encoding convertto utf-8]) before passing it
to this routine, if necessary. Specifying this is an error if \fB-file\fR
is also specified, but at least one of \fB-file\fR or \fB-content\fR must
be specified.
.TP
\fB-acl\fR
This defaults to \fBS3::Configure -default-acl\fR if not specified.
It sets the x-amz-acl header on the PUT operation.
If the value provided is \fIcalc\fR, the x-amz-acl header is
calculated based on the I/O permissions of the file to be uploaded;
it is an error to specify \fIcalc\fR and \fB-content\fR.
If the value provided is \fIkeep\fR, the acl of the resource
is read before the PUT (or the default is used if the
resource does not exist), then set back to what it
was after the PUT (if it existed). An error will occur if
the resource is successfully written but the kept ACL cannot
be then applied. This should never happen.
\fINote:\fR  \fIcalc\fR is not currently fully implemented.
.TP
\fB-x-amz-meta-*\fR
If any header starts with "-x-amz-meta-", its contents are added to the
PUT command to be stored as metadata with the resource. Again, no
encoding is performed, and the metadata should not contain characters
like newlines, carriage returns, and so on. It is best to stick with
simple ASCII strings, or to fix the library in several places.
.TP
\fB-content-type\fR
This overrides the content-type calculated by \fB-file\fR or
sets the content-type for \fB-content\fR.
.TP
\fB-compare\fR
This is the standard compare mode argument. \fBS3::Put\fR returns
1 if the data was copied or 0 if the data was skipped due to
the comparison mode so indicating it should be skipped.
.RE
.sp
.TP
\fBS3::Get\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-compare\fR \fIcomparemode\fR? ?\fB-file\fR \fIfilename\fR? ?\fB-content\fR \fIcontentvarname\fR? ?\fB-timestamp\fR \fIaws|now\fR? ?\fB-headers\fR \fIheadervarname\fR?
This command retrieves data from a resource on Amazon's S3 servers,
using the HTTP GET command. It returns 0 if the \fB-compare\fR mode
prevented the transfer, 1 if the transfer worked, or throws an error
if the transfer was attempted but failed. Server 5XX errors and S3 socket
errors are are retried
according to \fBS3:Configure\fR settings before throwing an error;
other errors throw immediately. Note that this is always authenticated
as the user configured in via \fBS3::Configure -accesskeyid\fR. Use
the Tcllib http for unauthenticated GETs.
.RS
.TP
\fB-bucket\fR
This specifies the bucket from which the resource will be read.
Leading and/or trailing slashes are removed for you, as are spaces.
.TP
\fB-resource\fR
This is the full name of the resource within the bucket. A single
leading slash is removed, but not a trailing slash.
Spaces are not trimmed.
.TP
\fB-blocking\fR
The standard blocking flag.
.TP
\fB-file\fR
If this is specified, the body of the resource will be read into this file,
incrementally without pulling it entirely into memory first. The parent
directory must already exist. If the file already exists, it must be
writable. If an error is thrown part-way through the process and the
file already existed, it may be clobbered. If an error is thrown part-way
through the process and the file did not already exist, any partial
bits will be deleted. Specifying this is an error if \fB-content\fR
is also specified, but at least one of \fB-file\fR or \fB-content\fR must
be specified.
.TP
\fB-timestamp\fR
This is only valid in conjunction with \fB-file\fR. It may be specified
as \fInow\fR or \fIaws\fR. The default is \fInow\fR. If \fInow\fR, the file's
modification date is left up to the system. If \fIaws\fR, the file's
mtime is set to match the Last-Modified header on the resource, synchronizing
the two appropriately for \fB-compare\fR \fIdate\fR or
\fB-compare\fR \fInewer\fR.
.TP
\fB-content\fR
If this is specified, the \fIcontentvarname\fR is a variable in the caller's
scope (not necessarily global) that receives the value of the body of
the resource. No encoding is done, so if the resource (for example) represents
a UTF-8 byte sequence, use [encoding convertfrom utf-8] to get a valid
UTF-8 string. If this is specified, the \fB-compare\fR is ignored unless
it is \fInever\fR, in which case no assignment to \fIcontentvarname\fR is
performed. Specifying this is an error if \fB-file\fR is also specified,
but at least one of \fB-file\fR or \fB-content\fR must be specified.
.TP
\fB-compare\fR
This is the standard compare mode argument. \fBS3::Get\fR returns
1 if the data was copied or 0 if the data was skipped due to
the comparison mode so indicating it should be skipped.
.TP
\fB-headers\fR
If this is specified, the headers resulting from the fetch are stored
in the provided variable, as a dictionary. This will include content-type
and x-amz-meta-* headers, as well as the usual HTTP headers, the x-amz-id
debugging headers, and so on. If no file is fetched (due to \fB-compare\fR
or other errors), no assignment to this variable is performed.
.RE
.sp
.TP
\fBS3::Head\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-dict\fR \fIdictvarname\fR? ?\fB-headers\fR \fIheadersvarname\fR? ?\fB-status\fR \fIstatusvarname\fR?
This command requests HEAD from the resource.
It returns whether a 2XX code was returned as a result
of the request, never throwing an S3 remote error.
That is, if this returns 1, the resource exists and is
accessible. If this returns 0, something went wrong, and the
\fB-status\fR result can be consulted for details.
.RS
.TP
\fB-bucket\fR
This specifies the bucket from which the resource will be read.
Leading and/or trailing slashes are removed for you, as are spaces.
.TP
\fB-resource\fR
This is the full name of the resource within the bucket. A single
leading slash is removed, but not a trailing slash.
Spaces are not trimmed.
.TP
\fB-blocking\fR
The standard blocking flag.
.TP
\fB-dict\fR
If specified, the resulting dictionary from the \fBS3::REST\fR
call is assigned to the indicated (not necessarily global) variable
in the caller's scope.
.TP
\fB-headers\fR
If specified, the dictionary of headers from the result are assigned
to the indicated (not necessarily global) variable in the caller's scope.
.TP
\fB-status\fR
If specified, the indicated (not necessarily global) variable in
the caller's scope is assigned a 2-element list. The first element is
the 3-digit HTTP status code, while the second element is
the HTTP message (such as "OK" or "Forbidden").
.RE
.TP
\fBS3::GetAcl\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-result-type\fR \fIREST|xml|pxml\fR?
This command gets the ACL of the indicated resource or throws an
error if it is unavailable.
.RS
.TP
\fB-blocking\fR \fIboolean\fR
See above for standard definition.
.TP
\fB-bucket\fR
This specifies the bucket from which the resource will be read.
Leading and/or trailing slashes are removed for you, as are spaces.
.TP
\fB-resource\fR
This is the full name of the resource within the bucket. A single
leading slash is removed, but not a trailing slash.
Spaces are not trimmed.
.TP
\fB-parse-xml\fR \fIxml\fR
The XML from a previous GetACL can be passed in to be parsed into
dictionary form.  In this case, -result-type must be pxml or dict.
.TP
\fB-result-type\fR \fIREST\fR
The dictionary returned by \fBS3::REST\fR is the return value of
\fBS3::GetAcl\fR.  In this case, a non-2XX httpstatus will not throw an
error.
.TP
\fB-result-type\fR \fIxml\fR
The raw XML of the body is returned as the result (with no encoding applied).
.TP
\fB-result-type\fR \fIpxml\fR
The XML of the body as parsed by \fBxsxp::parse\fR is returned.
.TP
\fB-result-type\fR \fIdict\fR
This fetches the ACL, parses it, and returns a dictionary of two elements.
.sp
The first element has the key "owner" whose value is the canonical ID of the owner of the resource.
.sp
The second element has the key "acl" whose value is a dictionary.  Each
key in the dictionary is one of Amazon's permissions, namely "READ",
"WRITE", "READ_ACP", "WRITE_ACP", or "FULL_CONTROL".  Each value of each
key is a list of canonical IDs or group URLs that have that permission.
Elements are not in the list in any particular order, and not all keys
are necessarily present.  Display names are not returned, as they are
not especially useful; use pxml to obtain them if necessary.
.RE
.TP
\fBS3::PutAcl\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-acl\fR \fInew-acl\fR?
This sets the ACL on the indicated resource. It returns the XML written to the ACL, or throws an error if anything went wrong.
.RS
.TP
\fB-blocking\fR \fIboolean\fR
See above for standard definition.
.TP
\fB-bucket\fR
This specifies the bucket from which the resource will be read.
Leading and/or trailing slashes are removed for you, as are spaces.
.TP
\fB-resource\fR
This is the full name of the resource within the bucket. A single
leading slash is removed, but not a trailing slash.
Spaces are not trimmed.
.TP
\fB-owner\fR
If this is provided, it is assumed to match the owner of the resource.
Otherwise, a GET may need to be issued against the resource to find
the owner. If you already have the owner (such as from a call
to \fBS3::GetAcl\fR, you can pass the value of the "owner" key
as the value of this option, and it will be used in the construction
of the XML.
.TP
\fB-acl\fR
If this option is specified, it provides the ACL the caller wishes
to write to the resource. If this is not supplied or is empty,
the value is taken from \fBS3::Configure -default-acl\fR.
The ACL is written with a PUT to the ?acl resource.
.sp
If the value passed to this option
starts with "<", it is taken to be a body to be PUT to the ACL resource.
.sp
If the value matches one of the standard Amazon x-amz-acl headers (i.e.,
a canned access policy), that header is translated to XML and then
applied. The canned access policies are private, public-read,
public-read-write, and authenticated-read (in lower case).
.sp
Otherwise, the value is assumed to be a dictionary formatted as the
"acl" sub-entry within the dict returns by \fBS3::GetAcl -result-type dict\fR.
The proper XML is generated and applied to the resource.  Note that a
value containing "//" is assumed to be a group, a value containing "@"
is assumed to be an AmazonCustomerByEmail, and otherwise the value is
assumed to be a canonical Amazon ID.
.sp
Note that you cannot change the owner, so calling GetAcl on a resource
owned by one user and applying it via PutAcl on a resource owned by
another user may not do exactly what you expect.
.RE
.TP
\fBS3::Delete\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-resource\fR \fIresourcename\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-status\fR \fIstatusvar\fR?
This command deletes the specified resource from the specified bucket.
It returns 1 if the resource was deleted successfully, 0 otherwise.
It returns 0 rather than throwing an S3 remote error.
.RS
.TP
\fB-bucket\fR
This specifies the bucket from which the resource will be deleted.
Leading and/or trailing slashes are removed for you, as are spaces.
.TP
\fB-resource\fR
This is the full name of the resource within the bucket. A single
leading slash is removed, but not a trailing slash.
Spaces are not trimmed.
.TP
\fB-blocking\fR
The standard blocking flag.
.TP
\fB-status\fR
If specified, the indicated (not necessarily global) variable
in the caller's scope is set to a two-element list. The first
element is the 3-digit HTTP status code. The second element
is the HTTP message (such as "OK" or "Forbidden"). Note that
Amazon's DELETE result is 204 on success, that being the
code indicating no content in the returned body.
.RE
.sp
.TP
\fBS3::Push\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-directory\fR \fIdirectoryname\fR ?\fB-prefix\fR \fIprefixstring\fR? ?\fB-compare\fR \fIcomparemode\fR? ?\fB-x-amz-meta-*\fR \fImetastring\fR? ?\fB-acl\fR \fIaclcode\fR? ?\fB-delete\fR \fIboolean\fR? ?\fB-error\fR \fIthrow|break|continue\fR? ?\fB-progress\fR \fIscriptprefix\fR?
This synchronises a local directory with a remote bucket
by pushing the differences using \fBS3::Put\fR. Note that
if something has changed in the bucket but not locally,
those changes could be lost. Thus, this is not a general
two-way synchronization primitive. (See \fBS3::Sync\fR
for that.) Note too that resource names are case sensitive,
so changing the case of a file on a Windows machine may lead
to otherwise-unnecessary transfers.
Note that only regular files are considered, so devices, pipes, symlinks,
and directories are not copied.
.RS
.TP
\fB-bucket\fR
This names the bucket into which data will be pushed.
.TP
\fB-directory\fR
This names the local directory from which files will be taken.
It must exist, be readable via [glob] and so on. If only
some of the files therein are readable, \fBS3::Push\fR will PUT
those files that are readable and return in its results the list
of files that could not be opened.
.TP
\fB-prefix\fR
This names the prefix that will be added to all resources.
That is, it is the remote equivalent of \fB-directory\fR.
If it is not specified, the root of the bucket will be treated
as the remote directory. An example may clarify.
.CS


S3::Push -bucket test -directory /tmp/xyz -prefix hello/world

.CE
.IP
In this example, /tmp/xyz/pdq.html will be stored as
http://s3.amazonaws.com/test/hello/world/pdq.html in Amazon's servers. Also,
/tmp/xyz/abc/def/Hello will be stored as
http://s3.amazonaws.com/test/hello/world/abc/def/Hello in Amazon's servers.
Without the \fB-prefix\fR option, /tmp/xyz/pdq.html would be stored
as http://s3.amazonaws.com/test/pdq.html.
.TP
\fB-blocking\fR
This is the standard blocking option.
.TP
\fB-compare\fR
If present, this is passed to each invocation of \fBS3::Put\fR.
Naturally, \fBS3::Configure -default-compare\fR is used
if this is not specified.
.TP
\fB-x-amz-meta-*\fR
If present, this is passed to each invocation of \fBS3::Put\fR. All copied
files will have the same metadata.
.TP
\fB-acl\fR
If present, this is passed to each invocation of \fBS3::Put\fR.
.TP
\fB-delete\fR
This defaults to false. If true, resources in the destination that
are not in the source directory are deleted with \fBS3::Delete\fR.
Since only regular files are considered, the existance of a symlink,
pipe, device, or directory in the local source will \fInot\fR
prevent the deletion of a remote resource with a corresponding name.
.TP
\fB-error\fR
This controls the behavior of \fBS3::Push\fR in the event that
\fBS3::Put\fR throws an error. Note that
errors encountered on the local file system or in reading the
list of resources in the remote bucket always throw errors.
This option allows control over "partial" errors, when some
files were copied and some were not. \fBS3::Delete\fR is always
finished up, with errors simply recorded in the return result.
.RS
.TP
throw
The error is rethrown with the same errorCode.
.TP
break
Processing stops without throwing an error, the error is recorded
in the return value, and the command returns with a normal return.
The calls to \fBS3::Delete\fR are not started.
.TP
continue
This is the default. Processing continues without throwing,
recording the error in the return result, and resuming with the
next file in the local directory to be copied.
.RE
.TP
\fB-progress\fR
If this is specified and the indicated script prefix is not empty, the
indicated script prefix will be invoked several times in the caller's
context with additional arguments at various points in the processing.
This allows progress reporting without backgrounding.  The provided
prefix will be invoked with additional arguments, with the first
additional argument indicating what part of the process is being
reported on.  The prefix is initially invoked with \fIargs\fR as the
first additional argument and a dictionary representing the normalized
arguments to the \fBS3::Push\fR call as the second additional argument.
Then the prefix is invoked with \fIlocal\fR as the first additional
argument and a list of suffixes of the files to be considered as the
second argument.  Then the prefix is invoked with \fIremote\fR as the
first additional argument and a list of suffixes existing in the remote
bucket as the second additional argument.  Then, for each file in the
local list, the prefix will be invoked with \fIstart\fR as the first
additional argument and the common suffix as the second additional
argument.  When \fBS3::Put\fR returns for that file, the prefix will be
invoked with \fIcopy\fR as the first additional argument, the common
suffix as the second additional argument, and a third argument that will
be "copied" (if \fBS3::Put\fR sent the resource), "skipped" (if
\fBS3::Put\fR decided not to based on \fB-compare\fR), or the errorCode
that \fBS3::Put\fR threw due to unexpected errors (in which case the
third argument is a list that starts with "S3"). When all files have
been transfered, the prefix may be invoked zero or more times with
\fIdelete\fR as the first additional argument and the suffix of the
resource being deleted as the second additional argument, with a third
argument being either an empty string (if the delete worked) or the
errorCode from \fBS3::Delete\fR if it failed. Finally, the prefix
will be invoked with \fIfinished\fR as the first additional argument
and the return value as the second additional argument.
.RE
.IP
The return result from this command is a dictionary. They keys are the
suffixes (i.e., the common portion of the path after the \fB-directory\fR
and \fB-prefix\fR), while the values are either "copied", "skipped" (if
\fB-compare\fR indicated not to copy the file), or the errorCode
thrown by \fBS3::Put\fR, as appropriate. If \fB-delete\fR was true,
there may also be entries for suffixes with the value "deleted" or
"notdeleted", indicating whether the attempted \fBS3::Delete\fR
worked or not, respectively. There is one additional pair in the return
result, whose key is the empty string and whose value is a nested dictionary.
The keys of this nested dictionary include "filescopied" (the number of
files successfully copied), "bytescopied" (the number of data bytes in
the files copied, excluding headers, metadata, etc), "compareskipped" (the
number of files not copied due to \fB-compare\fR mode), "errorskipped"
(the number of files not copied due to thrown errors), "filesdeleted"
(the number of resources deleted due to not having corresponding files
locally, or 0 if \fB-delete\fR is false), and "filesnotdeleted"
(the number of resources whose deletion was attempted but failed).
.sp
Note that this is currently implemented somewhat inefficiently.
It fetches the bucket listing (including timestamps and eTags),
then calls \fBS3::Put\fR, which uses HEAD to find the timestamps
and eTags again. Correcting this with no API change
is planned for a future upgrade.
.sp
.TP
\fBS3::Pull\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-directory\fR \fIdirectoryname\fR ?\fB-prefix\fR \fIprefixstring\fR? ?\fB-blocking\fR \fIboolean\fR? ?\fB-compare\fR \fIcomparemode\fR? ?\fB-delete\fR \fIboolean\fR? ?\fB-timestamp\fR \fIaws|now\fR? ?\fB-error\fR \fIthrow|break|continue\fR? ?\fB-progress\fR \fIscriptprefix\fR?
This synchronises a remote bucket with a local directory by pulling the
differences using \fBS3::Get\fR If something has been changed locally but not
in the bucket, those difference may be lost. This is not a general two-way
synchronization mechanism. (See \fBS3::Sync\fR for that.)
This creates directories
if needed; new directories are created with default permissions. Note that
resource names are case sensitive, so changing the case of a file on a
Windows machine may lead to otherwise-unnecessary transfers. Also, try not
to store data in resources that end with a slash, or which are prefixes of
resources that otherwise would start with a slash; i.e., don't use this if
you store data in resources whose names have to be directories locally.
.sp
Note that this is currently implemented somewhat inefficiently.
It fetches the bucket listing (including timestamps and eTags),
then calls \fBS3::Get\fR, which uses HEAD to find the timestamps
and eTags again. Correcting this with no API change
is planned for a future upgrade.
.RS
.TP
\fB-bucket\fR
This names the bucket from which data will be pulled.
.TP
\fB-directory\fR
This names the local directory into which files will be written
It must exist, be readable via [glob], writable for file creation,
and so on. If only some of the files therein are writable,
\fBS3::Pull\fR will GET
those files that are writable and return in its results the list
of files that could not be opened.
.TP
\fB-prefix\fR
The prefix of resources that will be considered for retrieval.
See \fBS3::Push\fR for more details, examples, etc. (Of course,
\fBS3::Pull\fR reads rather than writes, but the prefix is
treated similarly.)
.TP
\fB-blocking\fR
This is the standard blocking option.
.TP
\fB-compare\fR
This is passed to each invocation of \fBS3::Get\fR if provided.
Naturally, \fBS3::Configure -default-compare\fR is
used if this is not provided.
.TP
\fB-timestamp\fR
This is passed to each invocation of \fBS3::Get\fR if provided.
.TP
\fB-delete\fR
If this is specified and true, files that exist in the \fB-directory\fR
that are not in the \fB-prefix\fR will be deleted after all resources
have been copied. In addition, empty directories (other than the
top-level \fB-directory\fR) will be deleted, as
Amazon S3 has no concept of an empty directory.
.TP
\fB-error\fR
See \fBS3::Push\fR for a description of this option.
.TP
\fB-progress\fR
See \fBS3::Push\fR for a description of this option.
It differs slightly in that local directories may be included
with a trailing slash to indicate they are directories.
.RE
.IP
The return value from this command is a dictionary. It
is identical in form and meaning to the description of the
return result of \fBS3::Push\fR. It differs only in that
directories may be included, with a trailing slash in their name,
if they are empty and get deleted.
.TP
\fBS3::Toss\fR ?\fB-bucket\fR \fIbucketname\fR? \fB-prefix\fR \fIprefixstring\fR ?\fB-blocking\fR \fIboolean\fR? ?\fB-error\fR \fIthrow|break|continue\fR? ?\fB-progress\fR \fIscriptprefix\fR?
This deletes some or all resources within a bucket. It would be
considered a "recursive delete" had Amazon implemented actual
directories.
.RS
.TP
\fB-bucket\fR
The bucket from which resources will be deleted.
.TP
\fB\fB-blocking\fR\fR
The standard blocking option.
.TP
\fB\fB-prefix\fR\fR
The prefix for resources to be deleted. Any resource that
starts with this string will be deleted. This is required.
To delete everything in the bucket, pass an empty string
for the prefix.
.TP
\fB\fB-error\fR\fR
If this is "throw", \fBS3::Toss\fR rethrows any errors
it encounters.  If this is "break", \fBS3::Toss\fR returns
with a normal return after the first error, recording that
error in the return result. If this is "continue", which is
the default, \fBS3::Toss\fR continues on and lists all
errors in the return result.
.TP
\fB\fB-progress\fR\fR
If this is specified and not an empty string, the script
prefix will be invoked several times in the context of the caller
with additional arguments appended.  Initially, it will be invoked
with the first additional argument being \fIargs\fR and the second
being the processed list of arguments to \fBS3::Toss\fR. Then it
is invoked with \fIremote\fR as the first additional argument and
the list of suffixes in the bucket to be deleted as the second
additional argument. Then it is invoked with the first additional
argument being \fIdelete\fR and the second additional argument being
the suffix deleted and the third additional argument being "deleted"
or "notdeleted" depending on whether \fBS3::Delete\fR threw an error.
Finally, the script prefix is invoked with a first additional argument
of "finished" and a second additional argument of the return value.
.RE
.IP
The return value is a dictionary. The keys are the suffixes of files
that \fBS3::Toss\fR attempted to delete, and whose values are either
the string "deleted" or "notdeleted". There is also one additional
pair, whose key is the empty string and whose value is an embedded
dictionary. The keys of this embedded dictionary include
"filesdeleted" and "filesnotdeleted", each of which has integer values.
.PP
.SH LIMITATIONS
.IP \(bu
The pure-Tcl MD5 checking is slow. If you are processing
files in the megabyte range, consider ensuring binary support is available.
.IP \(bu
The commands \fBS3::Pull\fR and \fBS3::Push\fR fetch a
directory listing which includes timestamps and MD5 hashes,
then invoke \fBS3::Get\fR and \fBS3::Put\fR. If
a complex \fB-compare\fR mode is specified, \fBS3::Get\fR and
\fBS3::Put\fR will invoke a HEAD operation for each file to fetch
timestamps and MD5 hashes of each resource again. It is expected that
a future release of this package will solve this without any API changes.
.IP \(bu
The commands \fBS3::Pull\fR and \fBS3::Push\fR fetch a
directory listing without using \fB-max-count\fR. The entire
directory is pulled into memory at once. For very large buckets,
this could be a performance problem. The author, at this time,
does not plan to change this behavior. Welcome to Open Source.
.IP \(bu
\fBS3::Sync\fR is neither designed nor implemented yet.
The intention would be to keep changes synchronised, so changes
could be made to both the bucket and the local directory and
be merged by \fBS3::Sync\fR.
.IP \(bu
Nor is
\fB-compare\fR \fIcalc\fR fully implemented. This is primarily due to
Windows not providing a convenient method for distinguishing between
local files that are "public-read" or "public-read-write". Assistance
figuring out TWAPI for this would be appreciated. The U**X semantics
are difficult to map directly as well. See the source for details.
Note that there are not tests for calc, since it isn't done yet.
.IP \(bu
The HTTP processing is implemented within the library,
rather than using a "real" HTTP package. Hence, multi-line headers
are not (yet) handled correctly. Do not include carriage returns or
linefeeds in x-amz-meta-* headers, content-type values, and so on.
The author does not at this time expect to improve this.
.IP \(bu
Internally, \fBS3::Push\fR and \fBS3::Pull\fR and \fBS3::Toss\fR
are all very similar and should be refactored.
.IP \(bu
The idea of using \fB-compare\fR \fInever\fR
\fB-delete\fR \fItrue\fR to delete files that have been
deleted from one place but not the other yet not copying
changed files is untested.
.PP
.SH "USAGE SUGGESTIONS"
To fetch a "directory" out of a bucket, make changes, and store it back:
.CS


file mkdir ./tempfiles
S3::Pull -bucket sample -prefix of/interest -directory ./tempfiles \\
  -timestamp aws
do_my_process ./tempfiles other arguments
S3::Push -bucket sample -prefix of/interest -directory ./tempfiles \\
  -compare newer -delete true

.CE
.PP
To delete files locally that were deleted off of S3 but not otherwise
update files:
.CS


S3::Pull -bucket sample -prefix of/interest -directory ./myfiles \\
  -compare never -delete true

.CE
.SH "FUTURE DEVELOPMENTS"
The author intends to work on several additional projects related to
this package, in addition to finishing the unfinished features.
.PP
First, a command-line program allowing browsing of buckets and
transfer of files from shell scripts and command prompts is useful.
.PP
Second, a GUI-based program allowing visual manipulation of
bucket and resource trees not unlike Windows Explorer would
be useful.
.PP
Third, a command-line (and perhaps a GUI-based) program called
"OddJob" that will use S3 to synchronize computation amongst
multiple servers running OddJob. An S3 bucket will be set up
with a number of scripts to run, and the OddJob program can
be invoked on multiple machines to run scripts on all the machines,
each moving on to the next unstarted task as it finishes each.
This is still being designed, and it is intended primarily
to be run on Amazon's Elastic Compute Cloud.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIamazon-s3\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
amazon, cloud, s3
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) Copyright 2006,2008 Darren New. All Rights Reserved. See LICENSE.TXT for terms.

.fi

Added embedded/man/files/modules/amazon-s3/xsxp.n.






































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/amazon-s3/xsxp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) Copyright 2006 Darren New. All Rights Reserved.
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "xsxp" n 1.0 tcllib "Amazon S3 Web Service Utilities"
.BS
.SH NAME
xsxp \- eXtremely Simple Xml Parser
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBxml \fR
.sp
\fBxsxp::parse\fR \fIxml\fR
.sp
\fBxsxp::fetch\fR \fIpxml\fR \fIpath\fR ?\fIpart\fR?
.sp
\fBxsxp::fetchall\fR \fIpxml_list\fR \fIpath\fR ?\fIpart\fR?
.sp
\fBxsxp::only\fR \fIpxml\fR \fItagname\fR
.sp
\fBxsxp::prettyprint\fR \fIpxml\fR ?\fIchan\fR?
.sp
.BE
.SH DESCRIPTION
This package provides a simple interface to parse XML into a pure-value list.
It also provides accessor routines to pull out specific subtags,
not unlike DOM access.
This package was written for and is used by Darren New's Amazon S3 access package.
.PP
This is pretty lame, but I needed something like this for S3,
and at the time, TclDOM would not work with the new 8.5 Tcl
due to version number problems.
.PP
In addition, this is a pure-value implementation. There is no
garbage to clean up in the event of a thrown error, for example.
This simplifies the code for sufficiently small XML documents,
which is what Amazon's S3 guarantees.
.PP
Copyright 2006 Darren New. All Rights Reserved.
NO WARRANTIES OF ANY TYPE ARE PROVIDED.
COPYING OR USE INDEMNIFIES THE AUTHOR IN ALL WAYS.
This software is licensed under essentially the same
terms as Tcl. See LICENSE.txt for the terms.
.SH COMMANDS
The package implements five rather simple procedures.
One parses, one is for debugging, and the rest pull various
parts of the parsed document out for processing.
.TP
\fBxsxp::parse\fR \fIxml\fR
This parses an XML document (using the standard xml tcllib module in a SAX sort of way) and builds a data structure which it returns if the parsing succeeded. The return value is referred to herein as a "pxml", or "parsed xml". The list consists of two or more elements:
.RS
.IP \(bu
The first element is the name of the tag.
.IP \(bu
The second element is an array-get formatted list of key/value pairs. The keys are attribute names and the values are attribute values. This is an empty list if there are no attributes on the tag.
.IP \(bu
The third through end elements are the children of the node, if any. Each child is, recursively, a pxml.
.IP \(bu
Note that if the zero'th element, i.e. the tag name, is "%PCDATA", then
the attributes will be empty and the third element will be the text of the element. In addition, if an element's contents consists only of PCDATA, it will have only one child, and all the PCDATA will be concatenated. In other words,
this parser works poorly for XML with elements that contain both child tags and PCDATA.  Since Amazon S3 does not do this (and for that matter most
uses of XML where XML is a poor choice don't do this), this is probably
not a serious limitation.
.RE
.sp
.TP
\fBxsxp::fetch\fR \fIpxml\fR \fIpath\fR ?\fIpart\fR?
\fIpxml\fR is a parsed XML, as returned from xsxp::parse.
\fIpath\fR is a list of element tag names. Each element is the name
of a child to look up, optionally followed by a
hash ("#") and a string of digits. An empty list or an initial empty element
selects \fIpxml\fR. If no hash sign is present, the behavior is as if "#0"
had been appended to that element. (In addition to a list, slashes can separate subparts where convenient.)
.sp
An element of \fIpath\fR scans the children at the indicated level
for the n'th instance of a child whose tag matches the part of the
element before the hash sign. If an element is simply "#"  followed
by digits, that indexed child is selected, regardless of the tags
in the children. Hence, an element of "#3" will always select
the fourth child of the node under consideration.
.sp
\fIpart\fR defaults to "%ALL". It can be one of the following case-sensitive terms:
.RS
.TP
%ALL
returns the entire selected element.
.TP
%TAGNAME
returns lindex 0 of the selected element.
.TP
%ATTRIBUTES
returns index 1 of the selected element.
.TP
%CHILDREN
returns lrange 2 through end of the selected element,
resulting in a list of elements being returned.
.TP
%PCDATA
returns a concatenation of all the bodies of
direct children of this node whose tag is %PCDATA.
It throws an error if no such children are found. That
is, part=%PCDATA means return the textual content found
in that node but not its children nodes.
.TP
%PCDATA?
is like %PCDATA, but returns an empty string if
no PCDATA is found.
.RE
.sp
For example, to fetch the first bold text from the fifth paragraph of the body of your HTML file,
.CS

xsxp::fetch $pxml {html body p#4 b} %PCDATA
.CE
.sp
.TP
\fBxsxp::fetchall\fR \fIpxml_list\fR \fIpath\fR ?\fIpart\fR?
This iterates over each PXML in \fIpxml_list\fR (which must be a list
of pxmls) selecting the indicated path from it, building a new list
with the selected data, and returning that new list.
.sp
For example, \fIpxml_list\fR might be
the %CHILDREN of a particular element, and the \fIpath\fR and \fIpart\fR
might select from each child a sub-element in which we're interested.
.sp
.TP
\fBxsxp::only\fR \fIpxml\fR \fItagname\fR
This iterates over the direct children of \fIpxml\fR and selects only
those with \fItagname\fR as their tag. Returns a list of matching
elements.
.sp
.TP
\fBxsxp::prettyprint\fR \fIpxml\fR ?\fIchan\fR?
This outputs to \fIchan\fR (default stdout) a pretty-printed
version of \fIpxml\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIamazon-s3\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
dom, parser, xml
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) Copyright 2006 Darren New. All Rights Reserved.

.fi

Added embedded/man/files/modules/asn/asn.n.














































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/asn/asn.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Andreas Kupries <[email protected]>
'\" Copyright (c) 2004 Jochen Loewer <[email protected]>
'\" Copyright (c) 2004-2011 Michael Schlenker <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "asn" n 0.8 tcllib "ASN.1 processing"
.BS
.SH NAME
asn \- ASN.1 BER encoder/decoder
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBasn  ?0.8.4?\fR
.sp
\fB::asn::asnSequence\fR \fIevalue\fR...
.sp
\fB::asn::asnSequenceFromList\fR \fIelist\fR
.sp
\fB::asn::asnSet\fR \fIevalue\fR...
.sp
\fB::asn::asnSetFromList\fR \fIelist\fR
.sp
\fB::asn::asnApplicationConstr\fR \fIappNumber\fR \fIevalue\fR...
.sp
\fB::asn::asnApplication\fR \fIappNumber\fR \fIdata\fR
.sp
\fB::asn::asnChoice\fR \fIappNumber\fR \fIevalue\fR...
.sp
\fB::asn::asnChoiceConstr\fR \fIappNumber\fR \fIevalue\fR...
.sp
\fB::asn::asnInteger\fR \fInumber\fR
.sp
\fB::asn::asnEnumeration\fR \fInumber\fR
.sp
\fB::asn::asnBoolean\fR \fIbool\fR
.sp
\fB::asn::asnContext\fR \fIcontext\fR \fIdata\fR
.sp
\fB::asn::asnContextConstr\fR \fIcontext\fR \fIevalue\fR...
.sp
\fB::asn::asnObjectIdentifier\fR \fIidlist\fR
.sp
\fB::asn::asnUTCTime\fR \fIutcstring\fR
.sp
\fB::asn::asnNull\fR
.sp
\fB::asn::asnBitString\fR \fIstring\fR
.sp
\fB::asn::asnOctetString\fR \fIstring\fR
.sp
\fB::asn::asnNumericString\fR \fIstring\fR
.sp
\fB::asn::asnPrintableString\fR \fIstring\fR
.sp
\fB::asn::asnIA5String\fR \fIstring\fR
.sp
\fB::asn::asnBMPString\fR \fIstring\fR
.sp
\fB::asn::asnUTF8String\fR \fIstring\fR
.sp
\fB::asn::asnString\fR \fIstring\fR
.sp
\fB::asn::defaultStringType\fR ?\fItype\fR?
.sp
\fB::asn::asnPeekByte\fR \fIdata_var\fR \fIbyte_var\fR
.sp
\fB::asn::asnGetLength\fR \fIdata_var\fR \fIlength_var\fR
.sp
\fB::asn::asnGetResponse\fR \fIchan\fR \fIdata_var\fR
.sp
\fB::asn::asnGetInteger\fR \fIdata_var\fR \fIint_var\fR
.sp
\fB::asn::asnGetEnumeration\fR \fIdata_var\fR \fIenum_var\fR
.sp
\fB::asn::asnGetOctetString\fR \fIdata_var\fR \fIstring_var\fR
.sp
\fB::asn::asnGetString\fR \fIdata_var\fR \fIstring_var\fR ?\fItype_var\fR?
.sp
\fB::asn::asnGetNumericString\fR \fIdata_var\fR \fIstring_var\fR
.sp
\fB::asn::asnGetPrintableString\fR \fIdata_var\fR \fIstring_var\fR
.sp
\fB::asn::asnGetIA5String\fR \fIdata_var\fR \fIstring_var\fR
.sp
\fB::asn::asnGetBMPString\fR \fIdata_var\fR \fIstring_var\fR
.sp
\fB::asn::asnGetUTF8String\fR \fIdata_var\fR \fIstring_var\fR
.sp
\fB::asn::asnGetUTCTime\fR \fIdata_var\fR \fIutc_var\fR
.sp
\fB::asn::asnGetBitString\fR \fIdata_var\fR \fIbits_var\fR
.sp
\fB::asn::asnGetObjectIdentifier\fR \fIdata_var\fR \fIoid_var\fR
.sp
\fB::asn::asnGetBoolean\fR \fIdata_var\fR \fIbool_var\fR
.sp
\fB::asn::asnGetNull\fR \fIdata_var\fR
.sp
\fB::asn::asnGetSequence\fR \fIdata_var\fR \fIsequence_var\fR
.sp
\fB::asn::asnGetSet\fR \fIdata_var\fR \fIset_var\fR
.sp
\fB::asn::asnGetApplication\fR \fIdata_var\fR \fIappNumber_var\fR ?\fIcontent_var\fR? ?\fIencodingType_var\fR?
.sp
\fB::asn::asnGetContext\fR \fIdata_var\fR \fIcontextNumber_var\fR ?\fIcontent_var\fR? ?\fIencodingType_var\fR?
.sp
\fB::asn::asnPeekTag\fR \fIdata_var\fR \fItag_var\fR \fItagtype_var\fR \fIconstr_var\fR
.sp
\fB::asn::asnTag\fR \fItagnumber\fR ?\fIclass\fR? ?\fItagstyle\fR?
.sp
\fB::asn::asnRetag\fR \fIdata_var\fR \fInewTag\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBasn\fR package provides \fIpartial\fR de- and encoder
commands for BER encoded ASN.1 data. It can also be used for
decoding DER, which is a restricted subset of BER.
.PP
ASN.1 is a standard \fIAbstract Syntax Notation\fR, and BER are its
\fIBasic Encoding Rules\fR.
.PP
See \fIhttp://asn1.elibel.tm.fr/en/standards/index.htm\fR for more
information about the standard.
.PP
Also see \fIhttp://luca.ntop.org/Teaching/Appunti/asn1.html\fR for
\fIA Layman's Guide to a Subset of ASN.1, BER, and DER\fR, an RSA
Laboratories Technical Note by Burton S. Kaliski Jr. (Revised November
1, 1993). A text version of this note is part of the module sources
and should be read by any implementor.
.SH "PUBLIC API"
.SS ENCODER
.TP
\fB::asn::asnSequence\fR \fIevalue\fR...
Takes zero or more encoded values, packs them into an ASN sequence and
returns its encoded binary form.
.TP
\fB::asn::asnSequenceFromList\fR \fIelist\fR
Takes a list of encoded values, packs them into an ASN sequence and
returns its encoded binary form.
.TP
\fB::asn::asnSet\fR \fIevalue\fR...
Takes zero or more encoded values, packs them into an ASN set and
returns its encoded binary form.
.TP
\fB::asn::asnSetFromList\fR \fIelist\fR
Takes a list of encoded values, packs them into an ASN set and
returns its encoded binary form.
.TP
\fB::asn::asnApplicationConstr\fR \fIappNumber\fR \fIevalue\fR...
Takes zero or more encoded values, packs them into an ASN application
construct and returns its encoded binary form.
.TP
\fB::asn::asnApplication\fR \fIappNumber\fR \fIdata\fR
Takes a single encoded value \fIdata\fR, packs it into an ASN
application construct and returns its encoded binary form.
.TP
\fB::asn::asnChoice\fR \fIappNumber\fR \fIevalue\fR...
Takes zero or more encoded values, packs them into an ASN choice
construct and returns its encoded binary form.
.TP
\fB::asn::asnChoiceConstr\fR \fIappNumber\fR \fIevalue\fR...
Takes zero or more encoded values, packs them into an ASN choice
construct and returns its encoded binary form.
.TP
\fB::asn::asnInteger\fR \fInumber\fR
Returns the encoded form of the specified integer
\fInumber\fR.
.TP
\fB::asn::asnEnumeration\fR \fInumber\fR
Returns the encoded form of the specified enumeration id
\fInumber\fR.
.TP
\fB::asn::asnBoolean\fR \fIbool\fR
Returns the encoded form of the specified boolean value
\fIbool\fR.
.TP
\fB::asn::asnContext\fR \fIcontext\fR \fIdata\fR
Takes an encoded value and packs it into a constructed value with
application tag, the \fIcontext\fR number.
.TP
\fB::asn::asnContextConstr\fR \fIcontext\fR \fIevalue\fR...
Takes zero or more encoded values and packs them into a constructed
value with application tag, the \fIcontext\fR number.
.TP
\fB::asn::asnObjectIdentifier\fR \fIidlist\fR
Takes a list of at least 2 integers describing an object identifier
(OID) value, and returns the encoded value.
.TP
\fB::asn::asnUTCTime\fR \fIutcstring\fR
Returns the encoded form of the specified UTC time string.
.TP
\fB::asn::asnNull\fR
Returns the NULL encoding.
.TP
\fB::asn::asnBitString\fR \fIstring\fR
Returns the encoded form of the specified \fIstring\fR.
.TP
\fB::asn::asnOctetString\fR \fIstring\fR
Returns the encoded form of the specified \fIstring\fR.
.TP
\fB::asn::asnNumericString\fR \fIstring\fR
Returns the \fIstring\fR encoded as ASN.1 NumericString. Raises an
error if the \fIstring\fR contains characters other than decimal
numbers and space.
.TP
\fB::asn::asnPrintableString\fR \fIstring\fR
Returns the \fIstring\fR encoding as ASN.1 PrintableString. Raises an
error if the \fIstring\fR contains characters which are not allowed by
the Printable String datatype. The allowed characters are A-Z, a-z,
0-9, space, apostrophe, colon, parentheses, plus, minus, comma,
period, forward slash, question mark, and the equals sign.
.TP
\fB::asn::asnIA5String\fR \fIstring\fR
Returns the \fIstring\fR encoded as ASN.1 IA5String. Raises an error
if the \fIstring\fR contains any characters outside of the US-ASCII
range.
.TP
\fB::asn::asnBMPString\fR \fIstring\fR
Returns the \fIstring\fR encoded as ASN.1 Basic Multilingual Plane
string (Which is essentialy big-endian UCS2).
.TP
\fB::asn::asnUTF8String\fR \fIstring\fR
Returns the \fIstring\fR encoded as UTF8 String. Note that some legacy
applications such as Windows CryptoAPI do not like UTF8 strings. Use
BMPStrings if you are not sure.
.TP
\fB::asn::asnString\fR \fIstring\fR
Returns an encoded form of \fIstring\fR, choosing the most restricted
ASN.1 string type possible. If the string contains non-ASCII
characters, then there is more than one string type which can be
used. See \fB::asn::defaultStringType\fR.
.TP
\fB::asn::defaultStringType\fR ?\fItype\fR?
Selects the string type to use for the encoding of non-ASCII
strings. Returns current default when called without argument. If the
argument \fItype\fR is supplied, it should be either \fBUTF8\fR or
\fBBMP\fR to choose UTF8String or BMPString respectively.
.PP
.PP
.SS DECODER
General notes:
.IP [1]
Nearly all decoder commands take two arguments. These arguments are variable
names, except for \fB::asn::asnGetResponse\fR. The first variable
contains the encoded ASN value to decode at the beginning, and more,
and the second variable is where the value is stored to. The remainder
of the input after the decoded value is stored back into the
datavariable.
.IP [2]
After extraction the data variable is always modified first, before by
writing the extracted value to its variable. This means that if both
arguments refer to the same variable, it will always contain the
extracted value after the call, and not the remainder of the input.
.PP
.PP
.TP
\fB::asn::asnPeekByte\fR \fIdata_var\fR \fIbyte_var\fR
Retrieve the first byte of the data, without modifing \fIdata_var\fR.
This can be used to check for implicit tags.
.TP
\fB::asn::asnGetLength\fR \fIdata_var\fR \fIlength_var\fR
Decode the length information for a block of BER data. The tag has already
to be removed from the data.
.TP
\fB::asn::asnGetResponse\fR \fIchan\fR \fIdata_var\fR
Reads an encoded ASN \fIsequence\fR from the channel \fIchan\fR and
stores it into the variable named by \fIdata_var\fR.
.TP
\fB::asn::asnGetInteger\fR \fIdata_var\fR \fIint_var\fR
Assumes that an encoded integer value is at the front of the data
stored in the variable named \fIdata_var\fR, extracts and stores it
into the variable named by \fIint_var\fR. Additionally removes all
bytes associated with the value from the data for further processing
by the following decoder commands.
.TP
\fB::asn::asnGetEnumeration\fR \fIdata_var\fR \fIenum_var\fR
Assumes that an enumeration id is at the front of the data stored in
the variable named \fIdata_var\fR, and stores it into the variable
named by \fIenum_var\fR. Additionally removes all bytes associated
with the value from the data for further processing by the following
decoder commands.
.TP
\fB::asn::asnGetOctetString\fR \fIdata_var\fR \fIstring_var\fR
Assumes that a string is at the front of the data stored in the
variable named \fIdata_var\fR, and stores it into the variable named
by \fIstring_var\fR. Additionally removes all bytes associated with
the value from the data for further processing by the following
decoder commands.
.TP
\fB::asn::asnGetString\fR \fIdata_var\fR \fIstring_var\fR ?\fItype_var\fR?
Decodes a user-readable string. This is a convenience function which
is able to automatically distinguish all supported ASN.1 string types
and convert the input value appropriately.
See \fB::asn::asnGetPrintableString\fR, \fB::asnGetIA5String\fR, etc.
below for the type-specific conversion commands.
.sp
If the optional third argument \fItype_var\fR is supplied, then the
type of the incoming string is stored in the variable named by it.
.sp
The function throws the error
"Invalid command name asnGetSome\fBUnsupportedString\fR" if the
unsupported string type \fBUnsupported\fR is encountered. You can
create the appropriate function
"asn::asnGetSome\fBUnsupportedString\fR" in your application if
neccessary.
.TP
\fB::asn::asnGetNumericString\fR \fIdata_var\fR \fIstring_var\fR
Assumes that a numeric string value is at the front of the data stored
in the variable named \fIdata_var\fR, and stores it into the variable
named by \fIstring_var\fR. Additionally removes all bytes associated
with the value from the data for further processing by the following
decoder commands.
.TP
\fB::asn::asnGetPrintableString\fR \fIdata_var\fR \fIstring_var\fR
Assumes that a printable string value is at the front of the data
stored in the variable named \fIdata_var\fR, and stores it into the
variable named by \fIstring_var\fR. Additionally removes all bytes
associated with the value from the data for further processing by the
following decoder commands.
.TP
\fB::asn::asnGetIA5String\fR \fIdata_var\fR \fIstring_var\fR
Assumes that a IA5 (ASCII) string value is at the front of the data
stored in the variable named \fIdata_var\fR, and stores it into the
variable named by \fIstring_var\fR. Additionally removes all bytes
associated with the value from the data for further processing by the
following decoder commands.
.TP
\fB::asn::asnGetBMPString\fR \fIdata_var\fR \fIstring_var\fR
Assumes that a BMP (two-byte unicode) string value is at the front of
the data stored in the variable named \fIdata_var\fR, and stores it
into the variable named by \fIstring_var\fR, converting it into a
proper Tcl string. Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.
.TP
\fB::asn::asnGetUTF8String\fR \fIdata_var\fR \fIstring_var\fR
Assumes that a UTF8 string value is at the front of the data stored in
the variable named \fIdata_var\fR, and stores it into the variable
named by \fIstring_var\fR, converting it into a proper Tcl string.
Additionally removes all bytes associated with the value from the data
for further processing by the following decoder commands.
.TP
\fB::asn::asnGetUTCTime\fR \fIdata_var\fR \fIutc_var\fR
Assumes that a UTC time value is at the front of the data stored in the
variable named \fIdata_var\fR, and stores it into the variable named
by \fIutc_var\fR. The UTC time value is stored as a string, which has to
be decoded with the usual clock scan commands.
Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.
.TP
\fB::asn::asnGetBitString\fR \fIdata_var\fR \fIbits_var\fR
Assumes that a bit string value is at the front of the data stored in the
variable named \fIdata_var\fR, and stores it into the variable named
by \fIbits_var\fR as a string containing only 0 and 1.
Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.
.TP
\fB::asn::asnGetObjectIdentifier\fR \fIdata_var\fR \fIoid_var\fR
Assumes that a object identifier (OID) value is at the front of the data
stored in the variable named \fIdata_var\fR, and stores it into the variable
named by \fIoid_var\fR as a list of integers.
Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.
.TP
\fB::asn::asnGetBoolean\fR \fIdata_var\fR \fIbool_var\fR
Assumes that a boolean value is at the front of the data stored in the
variable named \fIdata_var\fR, and stores it into the variable named
by \fIbool_var\fR. Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.
.TP
\fB::asn::asnGetNull\fR \fIdata_var\fR
Assumes that a NULL value is at the front of the data stored in the
variable named \fIdata_var\fR and removes the bytes used to encode it
from the data.
.TP
\fB::asn::asnGetSequence\fR \fIdata_var\fR \fIsequence_var\fR
Assumes that an ASN sequence is at the front of the data stored in the
variable named \fIdata_var\fR, and stores it into the variable named
by \fIsequence_var\fR. Additionally removes all bytes associated with
the value from the data for further processing by the following
decoder commands.
.sp
The data in \fIsequence_var\fR is encoded binary and has to be
further decoded according to the definition of the sequence, using the
decoder commands here.
.TP
\fB::asn::asnGetSet\fR \fIdata_var\fR \fIset_var\fR
Assumes that an ASN set is at the front of the data stored in the
variable named \fIdata_var\fR, and stores it into the variable named
by \fIset_var\fR. Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.
.sp
The data in \fIset_var\fR is encoded binary and has to be further
decoded according to the definition of the set, using the decoder
commands here.
.TP
\fB::asn::asnGetApplication\fR \fIdata_var\fR \fIappNumber_var\fR ?\fIcontent_var\fR? ?\fIencodingType_var\fR?
Assumes that an ASN application construct is at the front of the data
stored in the variable named \fIdata_var\fR, and stores its id into
the variable named by \fIappNumber_var\fR. Additionally removes all
bytes associated with the value from the data for further processing
by the following decoder commands.
If a \fIcontent_var\fR is specified, then the command places all data
associated with it into the named variable, in the binary form which
can be processed using the decoder commands of this package.
If a \fIencodingType_var\fR is specified, then that var is set to 1 if
the encoding is constructed and 0 if it is primitive.
.sp
Otherwise it is the responsibility of the caller to decode the
remainder of the application construct based on the id retrieved by
this command, using the decoder commands of this package.
.TP
\fB::asn::asnGetContext\fR \fIdata_var\fR \fIcontextNumber_var\fR ?\fIcontent_var\fR? ?\fIencodingType_var\fR?
Assumes that an ASN context tag construct is at the front of the data
stored in the variable named \fIdata_var\fR, and stores its id into
the variable named by \fIcontextNumber_var\fR. Additionally removes all
bytes associated with the value from the data for further processing
by the following decoder commands.
If a \fIcontent_var\fR is specified, then the command places all data
associated with it into the named variable, in the binary form which
can be processed using the decoder commands of this package.
If a \fIencodingType_var\fR is specified, then that var is set to 1 if
the encoding is constructed and 0 if it is primitive.
.sp
Otherwise it is the responsibility of the caller to decode the
remainder of the construct based on the id retrieved by this command,
using the decoder commands of this package.
.PP
.PP
.SS "HANDLING TAGS"
Working with ASN.1 you often need to decode tagged values, which use a tag thats different
from the universal tag for a type. In those cases you have to replace the tag with the universal tag
used for the type, to decode the value.
To decode a tagged value use the \fB::asn::asnRetag\fR to change the tag to the appropriate type
to use one of the decoders for primitive values.
To help with this the module contains three functions:
.TP
\fB::asn::asnPeekTag\fR \fIdata_var\fR \fItag_var\fR \fItagtype_var\fR \fIconstr_var\fR
The \fB::asn::asnPeekTag\fR command can be used to take a peek at the data and decode the tag value, without
removing it from the data. The \fItag_var\fR gets set to the tag number, while the \fItagtype_var\fR gets set
to the class of the tag. (Either UNIVERSAL, CONTEXT, APPLICATION or PRIVATE). The \fIconstr_var\fR is set to 1 if the
tag is for a constructed value, and to 0 for not constructed. It returns the length of the tag.
.TP
\fB::asn::asnTag\fR \fItagnumber\fR ?\fIclass\fR? ?\fItagstyle\fR?
The \fB::asn::asnTag\fR can be used to create a tag value. The \fItagnumber\fR gives the number of the tag, while
the \fIclass\fR gives one of the classes (UNIVERSAL,CONTEXT,APPLICATION or PRIVATE). The class may be abbreviated to just the first letter (U,C,A,P),
default is UNIVERSAL.
The \fItagstyle\fR is either C for Constructed encoding, or P for primitve encoding. It defaults to P. You can also use 1 instead of C and
0 instead of P for direct use of the values returned by \fB::asn::asnPeekTag\fR.
.TP
\fB::asn::asnRetag\fR \fIdata_var\fR \fInewTag\fR
Replaces the tag in front of the data in \fIdata_var\fR with \fInewTag\fR. The new Tag can be created using the \fB::asn::asnTag\fR command.
.PP
.SH EXAMPLES
Examples for the usage of this package can be found in the
implementation of package \fBldap\fR.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIasn\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
asn, ber, cer, der, internet, protocol, x.208, x.209
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2004 Andreas Kupries <[email protected]>
Copyright (c) 2004 Jochen Loewer <[email protected]>
Copyright (c) 2004-2011 Michael Schlenker <[email protected]>

.fi

Added embedded/man/files/modules/base32/base32.n.






































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/base32/base32.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) Public domain
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "base32" n 0.1 tcllib "Base32 encoding"
.BS
.SH NAME
base32 \- base32 standard encoding
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBbase32::core  ?0.1?\fR
.sp
package require \fBbase32  ?0.1?\fR
.sp
\fB::base32::encode\fR \fIstring\fR
.sp
\fB::base32::decode\fR \fIestring\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides commands for encoding and decoding of strings
into and out of the standard base32 encoding as specified in RFC 3548.
.SH API
.TP
\fB::base32::encode\fR \fIstring\fR
This command encodes the given \fIstring\fR in base32 and returns the
encoded string as its result. The result may be padded with the
character \fB=\fR to signal a partial encoding at the end of the
input string.
.TP
\fB::base32::decode\fR \fIestring\fR
This commands takes the \fIestring\fR and decodes it under the
assumption that it is a valid base32 encoded string. The result of the
decoding is returned as the result of the command.
.sp
Note that while the encoder will generate only uppercase characters
this decoder accepts input in lowercase as well.
.sp
The command will always throw an error whenever encountering
conditions which signal some type of bogus input, namely if
.RS
.IP [1]
the input contains characters which are not valid output of a base32 encoder,
.IP [2]
the length of the input is not a multiple of eight,
.IP [3]
padding appears not at the end of input, but in the middle,
.IP [4]
the padding has not of length six, four, three, or one characters,
.RE
.PP
.SH "CODE MAP"
The code map used to convert 5-bit sequences is shown below, with the
numeric id of the bit sequences to the left and the character used to
encode it to the right. It should be noted that the characters "0" and
"1" are not used by the encoding. This is done as these characters can
be easily confused with "O", "o" and "l" (L).
.CS


	0 A    9 J   18 S   27 3
	1 B   10 K   19 T   28 4
	2 C   11 L   20 U   29 5
	3 D   12 M   21 V   30 6
	4 E   13 N   22 W   31 7
	5 F   14 O   23 X
	6 G   15 P   24 Y
	7 H   16 Q   25 Z
	8 I   17 R   26 2

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbase32\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
base32, rfc3548
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) Public domain

.fi

Added embedded/man/files/modules/base32/base32core.n.


























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/base32/base32core.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) Public domain
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "base32::core" n 0.1 tcllib "Base32 encoding"
.BS
.SH NAME
base32::core \- Expanding basic base32 maps
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBbase32::core  ?0.1?\fR
.sp
\fB::base32::core::define\fR \fImap\fR \fIforwvar\fR \fIbackwvar\fR \fIivar\fR
.sp
\fB::base32::core::valid\fR \fIstring\fR \fIpattern\fR \fImvar\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides generic commands for the construction of full
base32 mappings from a basic mapping listing just the codes and
associated characters. The full mappings, regular and inverse, created
here map to and from bit sequences, and also handle the partial
mappings at the end of a string.
.PP
This is in essence an internal package to be used by implementors of a
base32 en- and decoder. A regular user has no need of this package at
all.
.SH API
.TP
\fB::base32::core::define\fR \fImap\fR \fIforwvar\fR \fIbackwvar\fR \fIivar\fR
This command computes full forward and backward (inverse) mappings
from the basic \fImap\fR and stores them in the variables named by
\fIforwvar\fR and \fIbackwvar\fR resp. It also constructs a regexp
pattern for the detection of invalid characters in supposedly base32
encoded input and stores it in the variable named by \fIivar\fR.
.TP
\fB::base32::core::valid\fR \fIstring\fR \fIpattern\fR \fImvar\fR
This command checks if the input \fIstring\fR is a valid base32
encoded string, based on the \fIpattern\fR of invalid characters as
generated by \fB::base32::core::define\fR, and some other general
rules.
.sp
The result of the command is a boolean flag. Its value is \fBTrue\fR
for a valid \fIstring\fR, and \fBFalse\fR otherwise. In the latter
case an error message describing the problem with the input is stored
into the variable named by \fImvar\fR. The variable is not touched if
the input was found to be valid.
.sp
The rules checked by the command, beyond rejection of bad characters,
are:
.RS
.IP [1]
The length of the input is not a multiple of eight,
.IP [2]
The padding appears not at the end of input, but in the middle,
.IP [3]
The padding has not of length six, four, three, or one characters,
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbase32\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
base32
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) Public domain

.fi

Added embedded/man/files/modules/base32/base32hex.n.








































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/base32/base32hex.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) Public domain
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "base32::hex" n 0.1 tcllib "Base32 encoding"
.BS
.SH NAME
base32::hex \- base32 extended hex encoding
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBbase32::core  ?0.1?\fR
.sp
package require \fBbase32::hex  ?0.1?\fR
.sp
\fB::base32::hex::encode\fR \fIstring\fR
.sp
\fB::base32::hex::decode\fR \fIestring\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides commands for encoding and decoding of strings
into and out of the extended hex base32 encoding as specified in the
RFC 3548bis draft.
.SH API
.TP
\fB::base32::hex::encode\fR \fIstring\fR
This command encodes the given \fIstring\fR in extended hex base32 and
returns the encoded string as its result. The result may be padded
with the character \fB=\fR to signal a partial encoding at the end
of the input string.
.TP
\fB::base32::hex::decode\fR \fIestring\fR
This commands takes the \fIestring\fR and decodes it under the
assumption that it is a valid extended hex base32 encoded string. The
result of the decoding is returned as the result of the command.
.sp
Note that while the encoder will generate only uppercase characters
this decoder accepts input in lowercase as well.
.sp
The command will always throw an error whenever encountering
conditions which signal some type of bogus input, namely if
.RS
.IP [1]
the input contains characters which are not valid output
of a extended hex base32 encoder,
.IP [2]
the length of the input is not a multiple of eight,
.IP [3]
padding appears not at the end of input, but in the middle,
.IP [4]
the padding has not of length six, four, three, or one characters,
.RE
.PP
.SH "CODE MAP"
The code map used to convert 5-bit sequences is shown below, with the
numeric id of the bit sequences to the left and the character used to
encode it to the right. The important feature of the extended hex
mapping is that the first 16 codes map to the digits and hex
characters.
.CS


	0 0    9 9        18 I   27 R
	1 1   10 A        19 J   28 S
	2 2   11 B        20 K   29 T
	3 3   12 C        21 L   30 U
	4 4   13 D        22 M   31 V
	5 5   14 E        23 N
	6 6   15 F        24 O
	7 7        16 G   25 P
	8 8        17 H   26 Q

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbase32\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
base32, hex, rfc3548
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) Public domain

.fi

Added embedded/man/files/modules/base64/ascii85.n.







































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/base64/ascii85.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2010, Emiliano Gavilán
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ascii85" n 1.0 tcllib "Text encoding & decoding binary data"
.BS
.SH NAME
ascii85 \- ascii85-encode/decode binary data
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBascii85  ?1.0?\fR
.sp
\fB::ascii85::encode\fR ?\fB-maxlen\fR \fImaxlen\fR? ?\fB-wrapchar\fR \fIwrapchar\fR? \fIstring\fR
.sp
\fB::ascii85::decode\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides procedures to encode binary data into ascii85 and back.
.TP
\fB::ascii85::encode\fR ?\fB-maxlen\fR \fImaxlen\fR? ?\fB-wrapchar\fR \fIwrapchar\fR? \fIstring\fR
Ascii85 encodes the given binary \fIstring\fR and returns the encoded
result. Inserts the character \fIwrapchar\fR every \fImaxlen\fR
characters of output. \fIwrapchar\fR defaults to newline. \fImaxlen\fR
defaults to \fB76\fR.
.sp
\fINote well\fR: If your string is not simple ascii you should fix
the string encoding before doing ascii85 encoding. See the examples.
.sp
The command will throw an error for negative values of \fImaxlen\fR,
or if \fImaxlen\fR is not an integer number.
.TP
\fB::ascii85::decode\fR \fIstring\fR
Ascii85 decodes the given \fIstring\fR and returns the binary data.
The decoder ignores whitespace in the string, as well as tabs and
newlines.
.PP
.SH EXAMPLES
.CS


% ascii85::encode "Hello, world"
87cURD_*#TDfTZ)

.CE
.CS


% ascii85::encode [string repeat xyz 24]
G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]G
^4U[H$X^\\H?a^]
% ascii85::encode -wrapchar "" [string repeat xyz 24]
G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]G^4U[H$X^\\H?a^]

.CE
.CS


# NOTE: ascii85 encodes BINARY strings.
% set chemical [encoding convertto utf-8 "C\\u2088H\\u2081\\u2080N\\u2084O\\u2082"]
% set encoded [ascii85::encode $chemical]
6fN]R8E,5Pidu\\UiduhZidua
% set caffeine [encoding convertfrom utf-8 [ascii85::decode $encoded]]

.CE
.SH REFERENCES
.IP [1]
\fIhttp://en.wikipedia.org/wiki/Ascii85\fR
.IP [2]
Postscript Language Reference Manual, 3rd Edition, page 131.
\fIhttp://www.adobe.com/devnet/postscript/pdfs/PLRM.pdf\fR
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbase64\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
ascii85, encoding
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) 2010, Emiliano Gavilán

.fi

Added embedded/man/files/modules/base64/base64.n.




































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/base64/base64.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2000, Eric Melski
'\" Copyright (c) 2001, Miguel Sofer
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "base64" n 2.4.2 tcllib "Text encoding & decoding binary data"
.BS
.SH NAME
base64 \- base64-encode/decode binary data
.SH SYNOPSIS
package require \fBTcl  8\fR
.sp
package require \fBbase64  ?2.4.2?\fR
.sp
\fB::base64::encode\fR ?\fB-maxlen\fR \fImaxlen\fR? ?\fB-wrapchar\fR \fIwrapchar\fR? \fIstring\fR
.sp
\fB::base64::decode\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides procedures to encode binary data into base64 and back.
.TP
\fB::base64::encode\fR ?\fB-maxlen\fR \fImaxlen\fR? ?\fB-wrapchar\fR \fIwrapchar\fR? \fIstring\fR
Base64 encodes the given binary \fIstring\fR and returns the encoded
result. Inserts the character \fIwrapchar\fR every \fImaxlen\fR
characters of output. \fIwrapchar\fR defaults to newline. \fImaxlen\fR
defaults to \fB76\fR.
.sp
\fINote\fR that if \fImaxlen\fR is set to \fB0\fR, the
output will not be wrapped at all.
.sp
\fINote well\fR: If your string is not simple ascii you should fix
the string encoding before doing base64 encoding. See the examples.
.sp
The command will throw an error for negative values of \fImaxlen\fR,
or if \fImaxlen\fR is not an integer number.
.TP
\fB::base64::decode\fR \fIstring\fR
Base64 decodes the given \fIstring\fR and returns the binary data.
The decoder ignores whitespace in the string.
.PP
.SH EXAMPLES
.CS


% base64::encode "Hello, world"
SGVsbG8sIHdvcmxk

.CE
.CS


% base64::encode [string repeat xyz 20]
eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6
eHl6eHl6eHl6
% base64::encode -wrapchar "" [string repeat xyz 20]
eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6

.CE
.CS


# NOTE: base64 encodes BINARY strings.
% set chemical [encoding convertto utf-8 "C\\u2088H\\u2081\\u2080N\\u2084O\\u2082"]
% set encoded [base64::encode $chemical]
Q+KCiEjigoHigoBO4oKET+KCgg==
% set caffeine [encoding convertfrom utf-8 [base64::decode $encoded]]

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbase64\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
base64, encoding
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) 2000, Eric Melski
Copyright (c) 2001, Miguel Sofer

.fi

Added embedded/man/files/modules/base64/uuencode.n.
































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/base64/uuencode.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Pat Thoyts
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "uuencode" n 1.1.4 tcllib "Text encoding & decoding binary data"
.BS
.SH NAME
uuencode \- UU-encode/decode binary data
.SH SYNOPSIS
package require \fBTcl  8\fR
.sp
package require \fBuuencode  ?1.1.4?\fR
.sp
\fB::uuencode::encode\fR \fIstring\fR
.sp
\fB::uuencode::decode\fR \fIstring\fR
.sp
\fB::uuencode::uuencode\fR ?\fB-name\fR \fIstring\fR? ?\fB-mode\fR \fIoctal\fR? (\fB-file\fR \fIfilename\fR | ?\fB--\fR? \fIstring\fR)
.sp
\fB::uuencode::uudecode\fR (\fB-file\fR \fIfilename\fR | ?\fB--\fR? \fIstring\fR)
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a Tcl-only implementation of the
\fBuuencode(1)\fR and \fBuudecode(1)\fR commands. This encoding
packs binary data into printable ASCII characters.
.TP
\fB::uuencode::encode\fR \fIstring\fR
returns the uuencoded data. This will encode all the data passed in
even if this is longer than the uuencode maximum line length. If the
number of input bytes is not a multiple of 3 then additional 0 bytes
are added to pad the string.
.TP
\fB::uuencode::decode\fR \fIstring\fR
Decodes the given encoded data. This will return any padding
characters as well and it is the callers responsibility to deal with
handling the actual length of the encoded data. (see uuencode).
.TP
\fB::uuencode::uuencode\fR ?\fB-name\fR \fIstring\fR? ?\fB-mode\fR \fIoctal\fR? (\fB-file\fR \fIfilename\fR | ?\fB--\fR? \fIstring\fR)
.TP
\fB::uuencode::uudecode\fR (\fB-file\fR \fIfilename\fR | ?\fB--\fR? \fIstring\fR)
UUDecode a file or block of data. A file may contain more than one
embedded file so the result is a list where each element is a three
element list of filename, mode value and data.
.PP
.SH OPTIONS
.TP
-filename name
Cause the uuencode or uudecode commands to read their data from the
named file rather that taking a string parameter.
.TP
-name string
The uuencoded data header line contains the suggested file name to be
used when unpacking the data. Use this option to change this from the
default of "data.dat".
.TP
-mode octal
The uuencoded data header line contains a suggested permissions bit
pattern expressed as an octal string. To change the default of 0644
you can set this option. For instance, 0755 would be suitable for an
executable. See \fBchmod(1)\fR.
.PP
.SH EXAMPLES
.PP
.CS


% set d [uuencode::encode "Hello World!"]
2&5L;&\\\\@5V]R;&0A

.CE
.PP
.CS


% uuencode::uudecode $d
Hello World!

.CE
.PP
.CS


% set d [uuencode::uuencode -name hello.txt "Hello World"]
begin 644 hello.txt
+2&5L;&\\@5V]R;&0`
`
end

.CE
.PP
.CS


% uuencode::uudecode $d
{hello.txt 644 {Hello World}}

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbase64\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
encoding, uuencode
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) 2002, Pat Thoyts

.fi

Added embedded/man/files/modules/base64/yencode.n.















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/base64/yencode.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Pat Thoyts
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "yencode" n 1.1.2 tcllib "Text encoding & decoding binary data"
.BS
.SH NAME
yencode \- Y-encode/decode binary data
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fByencode  ?1.1.2?\fR
.sp
\fB::yencode::encode\fR \fIstring\fR
.sp
\fB::yencode::decode\fR \fIstring\fR
.sp
\fB::yencode::yencode\fR ?\fB-name\fR \fIstring\fR? ?\fB-line\fR \fIinteger\fR? ?\fB-crc32\fR \fIboolean\fR? (\fB-file\fR \fIfilename\fR | ?\fB--\fR? \fIstring\fR)
.sp
\fB::yencode::ydecode\fR (\fB-file\fR \fIfilename\fR | ?\fB--\fR? \fIstring\fR)
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a Tcl-only implementation of the yEnc file
encoding. This is a recently introduced method of encoding binary
files for transmission through Usenet. This encoding packs binary data
into a format that requires an 8-bit clean transmission layer but that
escapes characters special to the \fINNTP\fR posting protocols. See
\fIhttp://www.yenc.org/\fR for details concerning the algorithm.
.TP
\fB::yencode::encode\fR \fIstring\fR
returns the yEnc encoded data.
.TP
\fB::yencode::decode\fR \fIstring\fR
Decodes the given yEnc encoded data.
.TP
\fB::yencode::yencode\fR ?\fB-name\fR \fIstring\fR? ?\fB-line\fR \fIinteger\fR? ?\fB-crc32\fR \fIboolean\fR? (\fB-file\fR \fIfilename\fR | ?\fB--\fR? \fIstring\fR)
Encode a file or block of data.
.TP
\fB::yencode::ydecode\fR (\fB-file\fR \fIfilename\fR | ?\fB--\fR? \fIstring\fR)
Decode a file or block of data. A file may contain more than one
embedded file so the result is a list where each element is a three
element list of filename, file size and data.
.PP
.SH OPTIONS
.TP
-filename name
Cause the yencode or ydecode commands to read their data from the
named file rather that taking a string parameter.
.TP
-name string
The encoded data header line contains the suggested file name to be
used when unpacking the data. Use this option to change this from the
default of "data.dat".
.TP
-line integer
The yencoded data header line contains records the line length used
during the encoding. Use this option to select a line length other
that the default of 128. Note that NNTP imposes a 1000 character line
length limit and some gateways may have trouble with more than 255
characters per line.
.TP
-crc32 boolean
The yEnc specification recommends the inclusion of a cyclic redundancy
check value in the footer. Use this option to change the default from
\fItrue\fR to \fIfalse\fR.
.PP
.PP
.CS


% set d [yencode::yencode -file testfile.txt]
=ybegin line=128 size=584 name=testfile.txt
 -o- data not shown -o-
=yend size=584 crc32=ded29f4f

.CE
.SH REFERENCES
.IP [1]
\fIhttp://www.yenc.org/yenc-draft.1.3.txt\fR
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbase64\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
encoding, yEnc, ydecode, yencode
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) 2002, Pat Thoyts

.fi

Added embedded/man/files/modules/bee/bee.n.

































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bee/bee.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bee" n 0.1 tcllib "BitTorrent"
.BS
.SH NAME
bee \- BitTorrent Serialization Format Encoder/Decoder
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBbee  ?0.1?\fR
.sp
\fB::bee::encodeString\fR \fIstring\fR
.sp
\fB::bee::encodeNumber\fR \fIinteger\fR
.sp
\fB::bee::encodeListArgs\fR \fIvalue\fR...
.sp
\fB::bee::encodeList\fR \fIlist\fR
.sp
\fB::bee::encodeDictArgs\fR \fIkey\fR \fIvalue\fR...
.sp
\fB::bee::encodeDict\fR \fIdict\fR
.sp
\fB::bee::decode\fR \fIstring\fR ?\fIendvar\fR? ?\fIstart\fR?
.sp
\fB::bee::decodeIndices\fR \fIstring\fR ?\fIendvar\fR? ?\fIstart\fR?
.sp
\fB::bee::decodeChannel\fR \fIchan\fR \fB-command\fR \fIcmdprefix\fR ?\fB-exact\fR? ?\fB-prefix\fR \fIdata\fR?
.sp
\fBcmdprefix\fR \fBeof\fR \fItoken\fR
.sp
\fBcmdprefix\fR \fBerror\fR \fItoken\fR \fImessage\fR
.sp
\fBcmdprefix\fR \fBvalue\fR \fItoken\fR \fIvalue\fR
.sp
\fB::bee::decodeCancel\fR \fItoken\fR
.sp
\fB::bee::decodePush\fR \fItoken\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBbee\fR package provides de- and encoder commands for data
in bencoding (speak 'bee'), the serialization format for data and
messages used by the BitTorrent application.
.PP
.SH "PUBLIC API"
.SS ENCODER
The package provides one encoder command for each of the basic forms,
and two commands per container, one taking a proper tcl data structure
to encode in the container, the other taking the same information as
several arguments.
.PP
.TP
\fB::bee::encodeString\fR \fIstring\fR
Returns the bee-encoding of the \fIstring\fR.
.TP
\fB::bee::encodeNumber\fR \fIinteger\fR
Returns the bee-encoding of the \fIinteger\fR number.
.TP
\fB::bee::encodeListArgs\fR \fIvalue\fR...
Takes zero or more bee-encoded values and returns the bee-encoding of
their list.
.TP
\fB::bee::encodeList\fR \fIlist\fR
Takes a list of bee-encoded values and returns the bee-encoding of the
list.
.TP
\fB::bee::encodeDictArgs\fR \fIkey\fR \fIvalue\fR...
Takes zero or more pairs of keys and values and returns the
bee-encoding of the dictionary they form. The values are expected to
be already bee-encoded, but the keys must not be. Their encoding will
be done by the command itself.
.TP
\fB::bee::encodeDict\fR \fIdict\fR
Takes a dictionary list of string keys and bee-encoded values and
returns the bee-encoding of the list. Note that the keys in the input
must not be bee-encoded already. This will be done by the command
itself.
.PP
.PP
.SS DECODER
The package provides two main decoder commands, one for decoding a
string expected to contain a complete data structure, the other for
the incremental decoding of bee-values arriving on a channel. The
latter command is asynchronous and provides the completed decoded
values to the user through a command callback.
.PP
.TP
\fB::bee::decode\fR \fIstring\fR ?\fIendvar\fR? ?\fIstart\fR?
Takes the bee-encoding in the string and returns one decoded value. In
the case of this being a container all contained values are decoded
recursively as well and the result is a properly nested tcl list
and/or dictionary.
.sp
If the optional \fIendvar\fR is set then it is the name of a variable
to store the index of the first character \fIafter\fR the decoded
value into. In other words, if the string contains more than one value
then \fIendvar\fR can be used to obtain the position of the bee-value
after the bee-value currently decoded. together with \fIstart\fR, see
below, it is possible to iterate over the string to extract all
contained values.
.sp
The optional \fIstart\fR index defaults to \fB0\fR, i.e. the
beginning of the string. It is the index of the first character of the
bee-encoded value to extract.
.TP
\fB::bee::decodeIndices\fR \fIstring\fR ?\fIendvar\fR? ?\fIstart\fR?
Takes the same arguments as \fB::bee::decode\fR and returns the same
information in \fIendvar\fR. The result however is different. Instead
of the tcl value contained in the \fIstring\fR it returns a list
describing the value with respect to type and location (indices for
the first and last character of the bee-value). In case of a container
the structure also contains the same information for all the embedded
values.
.sp
Formally the results for the various types of bee-values are:
.RS
.TP
string
A list containing three elements:
.RS
.IP \(bu
The constant string \fBstring\fR, denoting the type of the value.
.IP \(bu
An integer number greater than or equal to zero. This is the index of
the first character of the bee-value in the input \fIstring\fR.
.IP \(bu
An integer number greater than or equal to zero. This is the index of
the last character of the bee-value in the input \fIstring\fR.
.RE
.sp
\fINote\fR that this information is present in the results for all
four types of bee-values, with only the first element changing
according to the type of the value.
.TP
integer
The result is like for strings, except that the type element contains
the constant string \fBinteger\fR.
.TP
list
The result is like before, with two exceptions: One, the type element
contains the constant string \fBlist\fR. And two, the result
actually contains four elements. The last element is new, and contains
the index data as described here for all elements of the bee-list.
.TP
dictionary
The result is like for strings, except that the type element contains
the constant string \fBdict\fR. A fourth element is present as well,
with a slightly different structure than for lists. The element is a
dictionary mapping from the strings keys of the bee-dictionary to a
list containing two elements. The first of them is the index
information for the key, and the second element is the index
information for the value the key maps to. This structure is the only
which contains not only index data, but actual values from the
bee-string. While the index information of the keys is unique enough,
i.e. serviceable as keys, they are not easy to navigate when trying to
find particular element. Using the actual keys makes this much easier.
.RE
.sp
.TP
\fB::bee::decodeChannel\fR \fIchan\fR \fB-command\fR \fIcmdprefix\fR ?\fB-exact\fR? ?\fB-prefix\fR \fIdata\fR?
The command creates a decoder for a series of bee-values arriving on
the channel \fIchan\fR and returns its handle. This handle can be used
to remove the decoder again.
Setting up another bee decoder on \fIchan\fR while a bee decoder is
still active will fail with an error message.
.sp
.RS
.TP
\fB-command\fR
The command prefix \fIcmdprefix\fR specified by the \fIrequired\fR
option \fB-command\fR is used to report extracted values and
exceptional situations (error, and EOF on the channel).
The callback will be executed at the global level of the interpreter,
with two or three arguments. The exact call signatures are
.sp
.RS
.TP
\fBcmdprefix\fR \fBeof\fR \fItoken\fR
The decoder has reached eof on the channel \fIchan\fR. No further
invocations of the callback will be made after this. The channel has
already been closed at the time of the call, and the \fItoken\fR is
not valid anymore as well.
.TP
\fBcmdprefix\fR \fBerror\fR \fItoken\fR \fImessage\fR
The decoder encountered an error, which is not eof. For example a
malformed bee-value. The \fImessage\fR provides details about the
error. The decoder token is in the same state as for eof,
i.e. invalid. The channel however is kept open.
.TP
\fBcmdprefix\fR \fBvalue\fR \fItoken\fR \fIvalue\fR
The decoder received and successfully decoded a bee-value.
The format of the equivalent tcl \fIvalue\fR is the same as returned
by \fB::bee::decode\fR. The channel is still open and the decoder
token is valid. This means that the callback is able to remove the
decoder.
.RE
.sp
.TP
\fB-exact\fR
By default the decoder assumes that the remainder of the data in the
channel consists only of bee-values, and reads as much as possible per
event, without regard for boundaries between bee-values. This means
that if the the input contains non-bee data after a series of
bee-value the beginning of that data may be lost because it was
already read by the decoder, but not processed.
.sp
The \fB-exact\fR was made for this situation. When specified the
decoder will take care to not read any characters behind the currently
processed bee-value, so that any non-bee data is kept in the channel
for further processing after removal of the decoder.
.sp
.TP
\fB-prefix\fR
If this option is specified its value is assumed to be the beginning
of the bee-value and used to initialize the internal decoder
buffer. This feature is required if the creator of the decoder used
data from the channel to determine if it should create the decoder or
not. Without the option this data would be lost to the decoding.
.RE
.sp
.TP
\fB::bee::decodeCancel\fR \fItoken\fR
This command cancels the decoder set up by \fB::bee::decodeChannel\fR
and represented by the handle \fItoken\fR.
.TP
\fB::bee::decodePush\fR \fItoken\fR \fIstring\fR
This command appends the \fIstring\fR to the internal decoder
buffer. It is the runtime equivalent of the option \fB-prefix\fR of
\fB::bee::decodeChannel\fR. Use it to push data back into the decoder
when the \fBvalue\fR callback used data from the channel to
determine if it should decode another bee-value or not.
.PP
.PP
.SH "FORMAT DEFINITION"
Data in the bee serialization format is constructed from two basic
forms, and two container forms. The basic forms are strings and
integer numbers, and the containers are lists and dictionaries.
.PP
.TP
String \fIS\fR
A string \fIS\fR of length \fIL\fR is encoded by the string
"\fIL\fR\fB:\fR\fIS\fR", where the length is written out in textual
form.
.TP
Integer \fIN\fR
An integer number \fIN\fR is encoded by the string
"\fBi\fR\fIN\fR\fBe\fR".
.TP
List \fIv1\fR ... \fIvn\fR
A list of the values \fIv1\fR to \fIvn\fR is encoded by the string
"\fBl\fR\fIBV1\fR...\fIBVn\fR\fBe\fR"
where "BV\fBi\fR" is the bee-encoding of the value "v\fBi\fR".
.TP
Dict \fIk1\fR -> \fIv1\fR ...
A dictionary mapping the string key \fIk\fR\fBi\fR to the value
\fIv\fR\fBi\fR, for \fBi\fR in \fB1\fR ... \fBn\fR
is encoded by the string
"\fBd\fR\fIBK\fR\fBi\fR\fIBV\fR\fBi\fR...\fBe\fR"
for i in \fB1\fR ... \fBn\fR, where "BK\fBi\fR" is the bee-encoding
of the key string "k\fBi\fR".  and "BV\fBi\fR" is the bee-encoding of
the value "v\fBi\fR".
.sp
\fINote\fR: The bee-encoding does not retain the order of the keys in
the input, but stores in a sorted order. The sorting is done for the
"raw strings".
.PP
.PP
Note that the type of each encoded item can be determined immediately
from the first character of its representation:
.PP
.TP
i
Integer.
.TP
l
List.
.TP
d
Dictionary.
.TP
[0-9]
String.
.PP
.PP
By wrapping an integer number into \fBi\fR...\fBe\fR the format
makes sure that they are different from strings, which all begin with
a digit.
.SH EXAMPLES
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbee\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
BitTorrent, bee, bittorrent, serialization, torrent
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2004 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/bench/bench.n.







































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bench/bench.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bench" n 0.4 tcllib "Benchmarking/Performance tools"
.BS
.SH NAME
bench \- bench - Processing benchmark suites
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBbench  ?0.4?\fR
.sp
\fB::bench::locate\fR \fIpattern\fR \fIpaths\fR
.sp
\fB::bench::run\fR ?\fIoption value\fR...? \fIinterp_list\fR \fIfile\fR...
.sp
\fB::bench::versions\fR \fIinterp_list\fR
.sp
\fB::bench::del\fR \fIbench_result\fR \fIcolumn\fR
.sp
\fB::bench::edit\fR \fIbench_result\fR \fIcolumn\fR \fInewvalue\fR
.sp
\fB::bench::merge\fR \fIbench_result\fR...
.sp
\fB::bench::norm\fR \fIbench_result\fR \fIcolumn\fR
.sp
\fB::bench::out::raw\fR \fIbench_result\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the execution of benchmarks written
in the bench language, and for the processing of results generated by
such execution.
.PP
A reader interested in the bench language itself should start with the
\fIbench language introduction\fR and proceed from there to the
formal \fIbench language specification\fR.
.PP
.SH "PUBLIC API"
.SS "BENCHMARK EXECUTION"
.TP
\fB::bench::locate\fR \fIpattern\fR \fIpaths\fR
This command locates Tcl interpreters and returns a list containing
their paths. It searches them in the list of \fIpaths\fR specified by
the caller, using the glob \fIpattern\fR.
.sp
The command resolves soft links to find the actual executables
matching the pattern. Note that only interpreters which are marked as
executable and are actually executable on the current platform are put
into the result.
.TP
\fB::bench::run\fR ?\fIoption value\fR...? \fIinterp_list\fR \fIfile\fR...
This command executes the benchmarks declared in the set of files,
once per Tcl interpreter specified via the \fIinterp_list\fR, and per
the configuration specified by the options, and then returns the
accumulated timing results. The format of this result is described in
section \fBResult format\fR.
.sp
It is assumed that the contents of the files are written in the bench
language.
.sp
The available options are
.RS
.TP
\fB-errors\fR \fIflag\fR
The argument is a boolean value. If set errors in benchmarks are
propagated to the command, aborting benchmark execution. Otherwise
they are recorded in the timing result via a special result code. The
default is to propagate and abort.
.TP
\fB-threads\fR \fIn\fR
The argument is a non-negative integer value declaring the number of
threads to use while executing the benchmarks. The default value is
\fB0\fR, to not use threads.
.TP
\fB-match\fR \fIpattern\fR
The argument is a glob pattern. Only benchmarks whose description
matches the pattern are executed. The default is the empty string, to
execute all patterns.
.TP
\fB-rmatch\fR \fIpattern\fR
The argument is a regular expression pattern. Only benchmarks whose
description matches the pattern are executed. The default is the empty
string, to execute all patterns.
.TP
\fB-iters\fR \fIn\fR
The argument is positive integer number, the maximal number of
iterations for any benchmark. The default is \fB1000\fR. Individual
benchmarks can override this.
.TP
\fB-pkgdir\fR \fIpath\fR
The argument is a path to an existing, readable directory. Multiple
paths can be specified, simply use the option multiple times, each
time with one of the paths to use.
.sp
If no paths were specified the system will behave as before.
If one or more paths are specified, say \fBN\fR, each of the specified
interpreters will be invoked \fBN\fR times, with one of the specified
paths. The chosen path is put into the interpreters' \fBauto_path\fR,
thus allowing it to find specific versions of a package.
.sp
In this way the use of \fB-pkgdir\fR allows the user to benchmark
several different versions of a package, against one or more interpreters.
.sp
\fINote:\fR The empty string is allowed as a path and causes the system to
run the specified interpreters with an unmodified \fBauto_path\fR. In case
the package in question is available there as well.
.RE
.sp
.TP
\fB::bench::versions\fR \fIinterp_list\fR
This command takes a list of Tcl interpreters, identified by their
path, and returns a dictionary mapping from the interpreters to their
versions. Interpreters which are not actually executable, or fail when
interrogated, are not put into the result. I.e the result may contain
less interpreters than there in the input list.
.sp
The command uses builtin command \fBinfo patchlevel\fR to determine
the version of each interpreter.
.PP
.SS "RESULT MANIPULATION"
.TP
\fB::bench::del\fR \fIbench_result\fR \fIcolumn\fR
This command removes a column, i.e. all benchmark results for a
specific Tcl interpreter, from the specified benchmark result and
returns the modified result.
.sp
The benchmark results are in the format described in section
\fBResult format\fR.
.sp
The column is identified by an integer number.
.TP
\fB::bench::edit\fR \fIbench_result\fR \fIcolumn\fR \fInewvalue\fR
This command renames a column in the specified benchmark result and
returns the modified result. This means that the path of the Tcl
interpreter in the identified column is changed to an arbitrary
string.
.sp
The benchmark results are in the format described in section
\fBResult format\fR.
.sp
The column is identified by an integer number.
.TP
\fB::bench::merge\fR \fIbench_result\fR...
This commands takes one or more benchmark results, merges them into
one big result, and returns that as its result.
.sp
All benchmark results are in the format described in section
\fBResult format\fR.
.TP
\fB::bench::norm\fR \fIbench_result\fR \fIcolumn\fR
This command normalizes the timing results in the specified benchmark
result and returns the modified result. This means that the cell
values are not times anymore, but factors showing how much faster or
slower the execution was relative to the baseline.
.sp
The baseline against which the command normalizes are the timing
results in the chosen column. This means that after the normalization
the values in this column are all \fB1\fR, as these benchmarks are
neither faster nor slower than the baseline.
.sp
A factor less than \fB1\fR indicates a benchmark which was faster
than the baseline, whereas a factor greater than \fB1\fR indicates a
slower execution.
.sp
The benchmark results are in the format described in section
\fBResult format\fR.
.sp
The column is identified by an integer number.
.TP
\fB::bench::out::raw\fR \fIbench_result\fR
This command formats the specified benchmark result for output to a
file, socket, etc. This specific command does no formatting at all,
it passes the input through unchanged.
.sp
For other formatting styles see the packages \fBbench::out::text\fR
and \fBbench::out::csv\fR which provide commands to format
benchmark results for human consumption, or as CSV data importable by
spread sheets, respectively.
.sp
Complementary, to read benchmark results from files, sockets etc. look
for the package \fBbench::in\fR and the commands provided by it.
.PP
.SS "RESULT FORMAT"
After the execution of a set of benchmarks the raw result returned by
this package is a Tcl dictionary containing all the relevant
information.
The dictionary is a compact representation, i.e. serialization, of a
2-dimensional table which has Tcl interpreters as columns and
benchmarks as rows. The cells of the table contain the timing
results.
The Tcl interpreters / columns are identified by their paths.
The benchmarks / rows are identified by their description.
.PP
The possible keys are all valid Tcl lists of two or three elements and
have one of the following forms:
.TP
{interp *}
The set of keys matching this glob pattern capture the information
about all the Tcl interpreters used to run the benchmarks. The second
element of the key is the path to the interpreter.
.sp
The associated value is the version of the Tcl interpreter.
.TP
{desc *}
The set of keys matching this glob pattern capture the information
about all the benchmarks found in the executed benchmark suite. The
second element of the key is the description of the benchmark, which
has to be unique.
.sp
The associated value is irrelevant, and set to the empty string.
.TP
{usec * *}
The set of keys matching this glob pattern capture the performance
information, i.e. timing results. The second element of the key is the
description of the benchmark, the third element the path of the Tcl
interpreter which was used to run it.
.sp
The associated value is either one of several special result codes, or
the time it took to execute the benchmark, in microseconds. The
possible special result codes are
.RS
.TP
ERR
Benchmark could not be executed, failed with a Tcl error.
.TP
BAD_RES
The benchmark could be executed, however the result from its body did
not match the declared expectations.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbench\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
bench_intro, bench_lang_intro, bench_lang_spec, bench_read, bench_wcsv, bench_wtext
.SH KEYWORDS
benchmark, merging, normalization, performance, testing
.SH CATEGORY
Benchmark tools
.SH COPYRIGHT
.nf
Copyright (c) 2007-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/bench/bench_intro.n.









































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bench/bench_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bench_intro" n 1.0 tcllib "Benchmarking/Performance tools"
.BS
.SH NAME
bench_intro \- bench introduction
.SH DESCRIPTION
.PP
The \fIbench\fR (short for \fIbenchmark tools\fR), is a set of
related, yet different, entities which are working together for the
easy creation and execution of performance test suites, also known as
benchmarks. These are
.IP [1]
A tcl based language for the declaration of test cases. A test case is
represented by a tcl command declaring the various parts needed to
execute it, like setup, cleanup, the commands to test, etc.
.IP [2]
A package providing the ability to execute test cases written in that
language.
.PP
.PP
Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the benchmarking process.
.PP
.IP [1]
A \fIwriter\fR of benchmarks has to understand the bench language
itself. A beginner to bench should read the more informally written
\fIbench language introduction\fR first. Having digested this the
formal \fIbench language specification\fR should become
understandable. A writer experienced with bench may only need this
last document from time to time, to refresh her memory.
.IP [2]
A \fIuser\fR of benchmark suites written in the \fIbench\fR language
has to know which tools are available for use.
At the bottom level sits the package \fBbench\fR, providing the
basic facilities to read and execute files containing benchmarks
written in the bench language, and to manipulate benchmark results.
.PP
.SH "HISTORICAL NOTES"
This module and package have been derived from Jeff Hobbs'
\fBtclbench\fR application for the benchmarking of the Tcl core and
its ancestor "\fIrunbench.tcl\fR".
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIbench\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
bench, bench_lang_faq, bench_lang_intro, bench_lang_spec
.SH KEYWORDS
bench language, benchmark, performance, testing
.SH CATEGORY
Benchmark tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/bench/bench_lang_intro.n.























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bench/bench_lang_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bench_lang_intro" n 1.0 tcllib "Benchmarking/Performance tools"
.BS
.SH NAME
bench_lang_intro \- bench language introduction
.SH DESCRIPTION
.PP
This document is an informal introduction to version 1 of the bench
language based on a multitude of examples. After reading this a
benchmark writer should be ready to understand the formal
\fIbench language specification\fR.
.SS FUNDAMENTALS
In the broadest terms possible the \fIbench language\fR is
essentially Tcl, plus a number of commands to support the declaration
of benchmarks.
A document written in this language is a Tcl script and has the same
syntax.
.PP
.SS BASICS
One of the most simplest benchmarks which can be written in bench is
.CS


bench -desc LABEL -body {
    set a b
}

.CE
This code declares a benchmark named \fBLABEL\fR which measures the
time it takes to assign a value to a variable. The Tcl code doing this
assignment is the \fB-body\fR of the benchmark.
.SS "PRE- AND POSTPROCESSING"
Our next example demonstrates how to declare \fIinitialization\fR and
\fIcleanup\fR code, i.e. code computing information for the use of
the \fB-body\fR, and for releasing such resources after the
measurement is done.
They are the \fB-pre\fR- and the \fB-post\fR-body, respectively.
.PP
In our example, directly drawn from the benchmark suite of Tcllib's
\fBaes\fR package, the concrete initialization code constructs the
key schedule used by the encryption command whose speed we measure,
and the cleanup code releases any resources bound to that schedule.
.CS


bench -desc "AES-${len} ECB encryption core" \fB-pre\fR {
    set key [aes::Init ecb $k $i]
} -body {
    aes::Encrypt $key $p
} \fB-post\fR {
    aes::Final $key
}

.CE
.SS "ADVANCED PRE- AND POSTPROCESSING"
Our last example again deals with initialization and cleanup code. To
see the difference to the regular initialization and cleanup discussed
in the last section it is necessary to know a bit more about how bench
actually measures the speed of the the \fB-body\fR.
.PP
Instead of running the \fB-body\fR just once the system actually
executes the \fB-body\fR several hundred times and then returns the
average of the found execution times. This is done to remove
environmental effects like machine load from the result as much as
possible, with outliers canceling each other out in the average.
.PP
The drawback of doing things this way is that when we measure
operations which are not idempotent we will most likely not measure
the time for the operation we want, but of the state(s) the system is
in after the first iteration, a mixture of things we have no interest
in.
.PP
Should we wish, for example, to measure the time it takes to include
an element into a set, with the element not yet in the set, and the
set having specific properties like being a shared Tcl_Obj, then the
first iteration will measure the time for this. \fIHowever\fR all
subsequent iterations will measure the time to include an element
which is already in the set, and the Tcl_Obj holding the set will not
be shared anymore either. In the end the timings taken for the several
hundred iterations of this state will overwhelm the time taken from
the first iteration, the only one which actually measured what we
wanted.
.PP
The advanced initialization and cleanup codes, \fB-ipre\fR- and the
\fB-ipost\fR-body respectively, are present to solve this very
problem. While the regular initialization and cleanup codes are
executed before and after the whole series of iterations the advanced
codes are executed before and after each iteration of the body,
without being measured themselves. This allows them to bring the
system into the exact state the body wishes to measure.
.PP
Our example, directly drawn from the benchmark suite of Tcllib's
\fBstruct::set\fR package, is for exactly the example we used
above to demonstrate the necessity for the advanced initialization and
cleanup. Its concrete initialization code constructs a variable
refering to a set with specific properties (The set has a string
representation, which is shared) affecting the speed of the inclusion
command, and the cleanup code releases the temporary variables created
by this initialization.
.CS


bench -desc "set include, missing <SC> x$times $n" \fB-ipre\fR {
    set A $sx($times,$n)
    set B $A
} -body {
    struct::set include A x
} \fB-ipost\fR {
    unset A B
}

.CE
.SH "FURTHER READING"
Now that this document has been digested the reader, assumed to be a
\fIwriter\fR of benchmarks, he should be fortified enough to be able
to understand the formal \fIbench language specfication\fR. It will
also serve as the detailed specification and cheat sheet for all
available commands and their syntax.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIbench\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
bench_intro, bench_lang_spec
.SH KEYWORDS
bench language, benchmark, examples, performance, testing
.SH CATEGORY
Benchmark tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/bench/bench_lang_spec.n.













































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bench/bench_lang_spec.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bench_lang_spec" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
bench_lang_spec \- bench language specification
.SH SYNOPSIS
\fBbench_rm\fR \fIpath\fR...
.sp
\fBbench_tmpfile\fR
.sp
\fBbench\fR \fIoptions\fR...
.sp
.BE
.SH DESCRIPTION
.PP
This document specifies both names and syntax of all the commands
which together are the bench language, version 1.
As this document is intended to be a reference the commands are listed
in alphabetical order, and the descriptions are relatively short.
A beginner should read the more informally written
\fIbench language introduction\fR first.
.SH COMMANDS
.TP
\fBbench_rm\fR \fIpath\fR...
This command silently removes the files specified as its arguments and
then returns the empty string as its result.
The command is \fItrusted\fR, there is no checking if the specified
files are outside of whatever restricted area the benchmarks are run
in.
.TP
\fBbench_tmpfile\fR
This command returns the path to a bench specific unique temporary
file. The uniqueness means that multiple calls will return different
paths. While the path may exist from previous runs, the command itself
does \fInot\fR create aynthing.
.sp
The base location of the temporary files is platform dependent:
.RS
.TP
Unix, and indeterminate platform
"\fI/tmp\fR"
.TP
Windows
\fB$TEMP\fR
.TP
Anything else
The current working directory.
.RE
.sp
.TP
\fBbench\fR \fIoptions\fR...
This command declares a single benchmark. Its result is the empty
string. All parts of the benchmark are declared via options, and their
values. The options can occur in any order. The accepted options are:
.RS
.TP
\fB-body\fR script
The argument of this option declares the body of the benchmark, the
Tcl script whose performance we wish to measure. This option, and
\fB-desc\fR, are the two required parts of each benchmark.
.TP
\fB-desc\fR msg
The argument of this option declares the name of the benchmark. It has
to be unique, or timing data from different benchmarks will be mixed
together.
.sp
\fIBeware!\fR This requirement is not checked when benchmarks are
executed, and the system will silently produce bogus data. This
option, and \fB-body\fR, are the two required parts of each
benchmark.
.TP
\fB-ipost\fR script
The argument of this option declares a script which is run immediately
\fIafter\fR each iteration of the body. Its responsibility is to
release resources created by the body, or \fB-ipre\fR-bodym which
we do not wish to live into the next iteration.
.TP
\fB-ipre\fR script
The argument of this option declares a script which is run immediately
\fIbefore\fR each iteration of the body. Its responsibility is to
create the state of the system expected by the body so that we measure
the right thing.
.TP
\fB-iterations\fR num
The argument of this option declares the maximum number of times to
run the \fB-body\fR of the benchmark. During execution this and the
global maximum number of iterations are compared and the smaller of
the two values is used.
.sp
This option should be used only for benchmarks which are expected or
known to take a long time per run. I.e. reduce the number of times
they are run to keep the overall time for the execution of the whole
benchmark within manageable limits.
.TP
\fB-post\fR script
The argument of this option declares a script which is run
\fIafter\fR all iterations of the body have been run. Its
responsibility is to release resources created by the body,
or \fB-pre\fR-body.
.TP
\fB-pre\fR script
The argument of this option declares a script which is run
\fIbefore\fR any of the iterations of the body are run. Its
responsibility is to create whatever resources are needed by the body
to run without failing.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbench\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
bench_intro, bench_lang_intro
.SH KEYWORDS
bench language, benchmark, performance, specification, testing
.SH CATEGORY
Benchmark tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/bench/bench_read.n.

















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bench/bench_read.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bench::in" n 0.1 tcllib "Benchmarking/Performance tools"
.BS
.SH NAME
bench::in \- bench::in - Reading benchmark results
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBcsv \fR
.sp
package require \fBbench::in  ?0.1?\fR
.sp
\fB::bench::in::read\fR \fIfile\fR
.sp
.BE
.SH DESCRIPTION
This package provides a command for reading benchmark results from
files, sockets, etc.
.PP
A reader interested in the creation, processing or writing of such
results should go and read
\fIbench - Processing benchmark suites\fR instead.
.PP
If the bench language itself is the actual interest please start with
the \fIbench language introduction\fR and then proceed from there
to the formal \fIbench language specification\fR.
.PP
.SH "PUBLIC API"
.TP
\fB::bench::in::read\fR \fIfile\fR
This command reads a benchmark result from the specified \fIfile\fR
and returns it as its result. The command understands the three
formats created by the commands
.RS
.TP
\fBbench::out::raw\fR
Provided by package \fBbench\fR.
.TP
\fBbench::out::csv\fR
Provided by package \fBbench::out::csv\fR.
.TP
\fBbench::out::text\fR
Provided by package \fBbench::out::text\fR.
.RE
.sp
and automatically detects which format is used by the input file.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbench\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
bench, bench::out::csv, bench::out::text, bench_intro
.SH KEYWORDS
benchmark, csv, formatting, human readable, parsing, performance, reading, testing, text
.SH CATEGORY
Benchmark tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/bench/bench_wcsv.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bench/bench_wcsv.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bench::out::csv" n 0.1.2 tcllib "Benchmarking/Performance tools"
.BS
.SH NAME
bench::out::csv \- bench::out::csv - Formatting benchmark results as CSV
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBbench::out::csv  ?0.1.2?\fR
.sp
\fB::bench::out::csv\fR \fIbench_result\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for fomatting of benchmark results into
a CSV table importable by spread sheets.
.PP
A reader interested in the generation or processing of such results should
go and read \fIbench - Processing benchmark suites\fR instead.
.PP
If the bench language itself is the actual interest please start with
the \fIbench language introduction\fR and then proceed from there
to the formal \fIbench language specification\fR.
.PP
.SH "PUBLIC API"
.TP
\fB::bench::out::csv\fR \fIbench_result\fR
This command formats the specified benchmark result for output to a
file, socket, etc. This specific command generates CSV data importable
by spread sheets.
.sp
For other formatting styles see the packages \fBbench\fR and
\fBbench::out::text\fR which provide commands to format benchmark
results in raw form, or for human consumption, respectively.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbench\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
bench, bench::out::text
.SH KEYWORDS
benchmark, csv, formatting, performance, testing
.SH CATEGORY
Benchmark tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/bench/bench_wtext.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bench/bench_wtext.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bench::out::text" n 0.1.2 tcllib "Benchmarking/Performance tools"
.BS
.SH NAME
bench::out::text \- bench::out::text - Formatting benchmark results as human readable text
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBbench::out::text  ?0.1.2?\fR
.sp
\fB::bench::out::text\fR \fIbench_result\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for fomatting of benchmark results into
human readable text.
.PP
A reader interested in the generation or processing of such results should
go and read \fIbench - Processing benchmark suites\fR instead.
.PP
If the bench language itself is the actual interest please start with
the \fIbench language introduction\fR and then proceed from there
to the formal \fIbench language specification\fR.
.PP
.SH "PUBLIC API"
.TP
\fB::bench::out::text\fR \fIbench_result\fR
This command formats the specified benchmark result for output to a
file, socket, etc. This specific command generates human readable
text.
.sp
For other formatting styles see the packages \fBbench\fR and
\fBbench::out::csv\fR which provide commands to format benchmark
results in raw form, or as importable CSV data, respectively.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbench\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
bench, bench::out::csv
.SH KEYWORDS
benchmark, formatting, human readable, performance, testing, text
.SH CATEGORY
Benchmark tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/bibtex/bibtex.n.














































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/bibtex/bibtex.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 for documentation, Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "bibtex" n 0.5 tcllib "bibtex"
.BS
.SH NAME
bibtex \- Parse bibtex files
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBbibtex  ?0.5?\fR
.sp
\fB::bibtex::parse\fR ?\fIoptions\fR? ?\fItext\fR?
.sp
\fB::bibtex::parse\fR \fItext\fR
.sp
\fB::bibtex::parse\fR ?\fB-command\fR \fIcmd\fR? \fB-channel\fR \fIchan\fR
.sp
\fB::bibtex::parse\fR ?\fB-recordcommand\fR   \fIrecordcmd\fR? ?\fB-preamblecommand\fR \fIpreamblecmd\fR? ?\fB-stringcommand\fR   \fIstringcmd\fR? ?\fB-commentcommand\fR  \fIcommentcmd\fR? ?\fB-progresscommand\fR \fIprogresscmd\fR? (\fItext\fR | \fB-channel\fR \fIchan\fR)
.sp
\fB::bibtex::wait\fR \fItoken\fR
.sp
\fB::bibtex::destroy\fR \fItoken\fR
.sp
\fB::bibtex::addStrings\fR \fItoken\fR \fIstringdict\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides commands for the parsing of bibliographies in
BibTeX format.
.TP
\fB::bibtex::parse\fR ?\fIoptions\fR? ?\fItext\fR?
This is the general form of the command for parsing a
bibliography. Depending on the options used to invoke it it will
either return a token for the parser, or the parsed entries of the
input bibliography. Instead of performing an immediate parse returning
a predefined format the command can also enter an event-based parsing
style where all relevant entries in the input are reported through
callback commands, in the style of SAX.
.TP
\fB::bibtex::parse\fR \fItext\fR
In this form the command will assume that the specified \fItext\fR is
a bibliography in BibTeX format, parse it, and then return a list
containing one element per record found in the bibliography. Note that
comments, string definitions, preambles, etc. will not show up in the
result.  Each element will be a list containing record type,
bibliography key and record data, in this order. The record data will
be a dictionary, its keys the keys of the record, with the associated
values.
.TP
\fB::bibtex::parse\fR ?\fB-command\fR \fIcmd\fR? \fB-channel\fR \fIchan\fR
In this form the command will reads the bibliography from the
specified Tcl channel \fIchan\fR and then returns the same data
structure as described above.
.sp
If however the option \fB-command\fR is specified the result will be a
handle for the parser instead and all processing will be incremental
and happen in the background. When the input has been exhausted the
callback \fIcmd\fR will be invoked with the result of the parse. The
exact definition for the callback is
.sp
.RS
.TP
\fBcmd\fR \fItoken\fR \fIparseresult\fR
The parse result will have the structure explained above, for the
simpler forms of the parser.
.RE
.sp
\fINote\fR that the parser will \fInot\fR close the channel after it
has exhausted it. This is still the responsibility of the user of the
parser.
.TP
\fB::bibtex::parse\fR ?\fB-recordcommand\fR   \fIrecordcmd\fR? ?\fB-preamblecommand\fR \fIpreamblecmd\fR? ?\fB-stringcommand\fR   \fIstringcmd\fR? ?\fB-commentcommand\fR  \fIcommentcmd\fR? ?\fB-progresscommand\fR \fIprogresscmd\fR? (\fItext\fR | \fB-channel\fR \fIchan\fR)
This is the most low-level form for the parser. The returned result
will be a handle for the parser. During processing it will invoke the
invoke the specified callback commands for each type of data found in
the bibliography.
.sp
The processing will be incremental and happen in the background if,
and only if a Tcl channel \fIchan\fR is specified. For a \fItext\fR
the processing will happen immediately and all callbacks will be
invoked before the command itself returns.
.sp
The callbacks, i.e. \fI*cmd\fR, are all command prefixes and will be
invoked with additional arguments appended to them. The meaning of the
arguments depends on the callback and is explained below. The first
argument will however always be the handle of the parser invoking the
callback.
.RS
.TP
\fBrecordcmd\fR \fItoken\fR \fItype\fR \fIkey\fR \fIrecorddict\fR
This callback is invoked whenever the parser detects a bibliography
record in the input. Its arguments are the record type, the
bibliography key for the record, and a dictionary containing the keys
and values describing the record. Any string macros known to the
parser have already been expanded.
.TP
\fBpreamblecmd\fR \fItoken\fR \fIpreambletext\fR
This callback is invoked whenever the parser detects an @preamble
block in the input. The only additional argument is the text found in
the preamble block. By default such entries are ignored.
.TP
\fBstringcmd\fR \fItoken\fR \fIstringdict\fR
This callback is invoked whenever the parser detects an @string-based
macro definition in the input. The argument is a dictionary with the
macro names as keys and their replacement strings as values. By
default such definitions are added to the parser state for use in
future bibliography records.
.TP
\fBcommentcmd\fR \fItoken\fR \fIcommenttext\fR
This callback is invoked whenever the parser detects a comment in the
input. The only additional argument is the comment text. By default
such entries are ignored.
.TP
\fBprogresscmd\fR \fItoken\fR \fIpercent\fR
This callback is invoked during processing to tell the user about the
progress which has been made. Its argument is the percentage of data
processed, as integer number between \fB0\fR and \fB100\fR.
In the case of incremental processing the perecentage will always be
\fB-1\fR as the total number of entries is not known beforehand.
.RE
.sp
.TP
\fB::bibtex::wait\fR \fItoken\fR
This command waits for the parser represented by the \fItoken\fR to
complete and then returns. The returned result is the empty string.
.TP
\fB::bibtex::destroy\fR \fItoken\fR
This command cleans up all internal state associated with the parser
represented by the handle \fItoken\fR, effectively destroying it. This
command can be called from within the parser callbacks to terminate
processing.
.TP
\fB::bibtex::addStrings\fR \fItoken\fR \fIstringdict\fR
This command adds the macro definitions stored in the
dictionary \fIstringdict\fR to the parser represented
by the handle \fItoken\fR.
.sp
The dictionary keys are the macro names and the values their
replacement strings. This command has the correct signature for use as
a \fB-stringcommand\fR callback in an invokation of the command
\fB::bibtex::parse\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIbibtex\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
bibliography, bibtex, parsing, text processing
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) 2005 for documentation, Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/blowfish/blowfish.n.



































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/blowfish/blowfish.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "blowfish" n 1.0.3 tcllib "Blowfish Block Cipher"
.BS
.SH NAME
blowfish \- Implementation of the Blowfish block cipher
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBblowfish  ?1.0.4?\fR
.sp
\fB::blowfish::blowfish\fR ?\fI-mode [ecb|cbc]\fR? ?\fI-dir [encrypt|decrypt]\fR? \fI-key keydata\fR ?\fI-iv vector\fR? ?\fI-out channel\fR? ?\fI-chunksize size\fR? ?\fI-pad padchar\fR? [ \fI-in channel\fR | ?\fI--\fR? \fIdata\fR ]
.sp
\fB::blowfish::Init\fR \fImode\fR \fIkeydata\fR \fIiv\fR
.sp
\fB::blowfish::Encrypt\fR \fIKey\fR \fIdata\fR
.sp
\fB::blowfish::Decrypt\fR \fIKey\fR \fIdata\fR
.sp
\fB::blowfish::Reset\fR \fIKey\fR \fIiv\fR
.sp
\fB::blowfish::Final\fR \fIKey\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package is an implementation in Tcl of the Blowfish algorithm
developed by Bruce Schneier [1]. Blowfish is a 64-bit block cipher
designed to operate quickly on 32 bit architectures and accepting a
variable key length. This implementation supports ECB and CBC mode
blowfish encryption.
.SH COMMANDS
.TP
\fB::blowfish::blowfish\fR ?\fI-mode [ecb|cbc]\fR? ?\fI-dir [encrypt|decrypt]\fR? \fI-key keydata\fR ?\fI-iv vector\fR? ?\fI-out channel\fR? ?\fI-chunksize size\fR? ?\fI-pad padchar\fR? [ \fI-in channel\fR | ?\fI--\fR? \fIdata\fR ]
Perform the \fBblowfish\fR algorithm on either the data provided
by the argument or on the data read from the \fI-in\fR channel. If
an \fI-out\fR channel is given then the result will be written to
this channel.
.sp
The \fI-key\fR option must be given. This parameter takes a binary
string of variable length and is used to generate the \fBblowfish\fR
key schedule. You should be aware that creating a key
schedule is quite an expensive operation in blowfish so it is worth
reusing the key where possible. See \fBReset\fR.
.sp
The \fI-mode\fR and \fI-dir\fR options are optional and default to cbc
mode and encrypt respectively. The initialization vector \fI-iv\fR
takes an 8 byte binary argument which defaults to 8 zeros.
See \fBMODES OF OPERATION\fR for more about available modes and
their uses.
.sp
Blowfish is a 64-bit block cipher. This means that the data must be
provided in units that are a multiple of 8 bytes. The \fBblowfish\fR
command will by default add nul characters to pad the input data to a
multiple of 8 bytes if necessary. The programming api commands will
never add padding and instead will raise an error if the input is not
a multiple of the block size. The \fI-pad\fR option can be used to
change the padding character or to disable padding if the empty string
is provided as the argument.
.PP
.SH "PROGRAMMING INTERFACE"
.TP
\fB::blowfish::Init\fR \fImode\fR \fIkeydata\fR \fIiv\fR
Construct a new blowfish key schedule using the specified key data and
the given initialization vector. The initialization vector is not used
with ECB mode but is important for CBC mode.
See \fBMODES OF OPERATION\fR for details about cipher modes.
.TP
\fB::blowfish::Encrypt\fR \fIKey\fR \fIdata\fR
Use a prepared key acquired by calling \fBInit\fR to encrypt the
provided data. The data argument should be a binary array that is a
multiple of the block size of 8 bytes. The result is a binary
array the same size as the input of encrypted data.
.TP
\fB::blowfish::Decrypt\fR \fIKey\fR \fIdata\fR
Decipher data using the key. Note that the same key may be used to
encrypt and decrypt data provided that the initialization vector is
reset appropriately for CBC mode.
.TP
\fB::blowfish::Reset\fR \fIKey\fR \fIiv\fR
Reset the initialization vector. This permits the programmer to re-use
a key and avoid the cost of re-generating the key schedule where the
same key data is being used multiple times.
.TP
\fB::blowfish::Final\fR \fIKey\fR
This should be called to clean up resources associated with \fIKey\fR.
Once this function has been called the key may not be used again.
.PP
.SH "MODES OF OPERATION"
.TP
Electronic Code Book (ECB)
ECB is the basic mode of all block ciphers. Each block is encrypted
independently and so identical plain text will produce identical
output when encrypted with the same key. Any encryption errors will
only affect a single block however this is vulnerable to known
plaintext attacks.
.TP
Cipher Block Chaining (CBC)
CBC mode uses the output of the last block encryption to affect the
current block. An initialization vector of the same size as the cipher
block size is used to handle the first block. The initialization
vector should be chosen randomly and transmitted as the first block of
the output. Errors in encryption affect the current block and the next
block after which the cipher will correct itself. CBC is the most
commonly used mode in software encryption.
.PP
.SH EXAMPLES
.CS


% blowfish::blowfish -hex -mode ecb -dir encrypt -key secret01 "hello, world!"
d0d8f27e7a374b9e2dbd9938dd04195a

.CE
.CS


 set Key [blowfish::Init cbc $eight_bytes_key_data $eight_byte_iv]
 append ciphertext [blowfish::Encrypt $Key $plaintext]
 append ciphertext [blowfish::Encrypt $Key $additional_plaintext]
 blowfish::Final $Key

.CE
.SH REFERENCES
.IP [1]
Schneier, B. "Applied Cryptography, 2nd edition", 1996,
ISBN 0-471-11709-9, pub. John Wiley & Sons.
.PP
.SH AUTHORS
Frank Pilhofer, Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIblowfish\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
3des, des, rc4
.SH KEYWORDS
block cipher, blowfish, cryptography, encryption, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2003, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/cache/async.n.
























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/cache/async.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "cache::async" n 0.3 tcllib "In-memory caches"
.BS
.SH NAME
cache::async \- Asynchronous in-memory cache
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBcache::async  ?0.3?\fR
.sp
\fB::cache::async\fR \fIobjectName\fR \fIcommandprefix\fR ?\fIoptions\fR...?
.sp
\fIobjectName\fR \fBget\fR \fIkey\fR \fIdonecmdprefix\fR
.sp
\fIobjectName\fR \fBset\fR \fIkey\fR \fIvalue\fR
.sp
\fIobjectName\fR \fBunset\fR \fIkey\fR
.sp
\fIobjectName\fR \fBexists\fR \fIkey\fR
.sp
\fIobjectName\fR \fBclear\fR ?\fIkey\fR?
.sp
.BE
.SH DESCRIPTION
This package provides objects which cache data in memory, and operate
asynchronously with regard to request and responses. The objects are
agnostic with regard to cache keys and values, and unknown methods are
delegated to the provider of cached data. These two properties make it
easy to use caches as a facade for any data provider.
.SH API
The package exports a class, \fBcache::async\fR, as specified
below.
.TP
\fB::cache::async\fR \fIobjectName\fR \fIcommandprefix\fR ?\fIoptions\fR...?
The command creates a new \fIcache\fR object with an associated
global Tcl command whose name is \fIobjectName\fR.  This command may
be used to invoke various operations on the object.
.sp
The \fIcommandprefix\fR is the action to perform when an user asks for
data in the cache and the cache doesn't yet know about the key. When
run the commandprefix is given three additional arguments, the string
\fBget\fR, the key requested, and the cache object itself, in the
form of its object command, in this order. The execution of the action
is done in an idle-handler, decoupling it from the original request.
.sp
The only supported option is
.RS
.TP
\fB-full-async-results\fR
This option defines the behaviour of the cache for when requested keys
are known to the cache at the time of \fBget\fR request. By default
such requeste are responded to asynchronously as well. Setting this
option to \fBfalse\fR forces the cache to respond to them
synchronuously, although still through the specified callback.
.RE
.PP
The object commands created by the class commands above have
the form:
.TP
\fIobjectName\fR \fBget\fR \fIkey\fR \fIdonecmdprefix\fR
This method requests the data for the \fIkey\fR from the cache. If the
data is not yet known the command prefix specified during construction
of the cache object is used to ask for this information.
.sp
Whenever the information is/becomes available the \fIdonecmdprefix\fR
will be run to transfer the result to the caller. This command prefix
is invoked with either 2 or 3 arguments, i.e.
.RS
.IP [1]
The string \fBset\fR, the \fIkey\fR, and the value.
.IP [2]
The string \fBunset\fR, and the \fIkey\fR.
.RE
.IP
These two possibilities are used to either signal the value for the
\fIkey\fR, or that the \fIkey\fR has no value defined for it. The
latter is distinct from the cache not knowing about the \fIkey\fR.
.sp
For a cache object configured to be fully asynchronous (default) the
\fIdonecmdprefix\fR is always run in an idle-handler, decoupling it
from the request. Otherwise the callback will be invoked synchronously
when the \fIkey\fR is known to the cache at the time of the
invokation.
.sp
Another important part of the cache's behaviour, as it is asynchronous
it is possible that multiple \fBget\fR requests are issued for the
same \fIkey\fR before it can respond. In that case the cache will
issue only one data request to the provider, for the first of these,
and suspend the others, and then notify all of them when the data
becomes available.
.TP
\fIobjectName\fR \fBset\fR \fIkey\fR \fIvalue\fR
.TP
\fIobjectName\fR \fBunset\fR \fIkey\fR
These two methods are provided to allow users of the cache to make
keys known to the cache, as either having a \fIvalue\fR, or as
undefined.
.sp
It is expected that the data provider (see \fIcommandprefix\fR of the
constructor) uses them in response to data requests for unknown keys.
.sp
Note how this matches the cache's own API towards its caller, calling
the \fIdonecmd\fR of \fBget\fR-requests issued to itself with
either "set key value" or "unset key", versus issuing
\fBget\fR-requests to its own provider with itself in the place of
the \fIdonecmd\fR, expecting to be called with either "set key value"
or "unset key".
.sp
This also means that these methods invoke the \fIdonecmd\fR of all
\fBget\fR-requests waiting for information about the modified
\fIkey\fR.
.TP
\fIobjectName\fR \fBexists\fR \fIkey\fR
This method queries the cache for knowledge about the \fIkey\fR and
returns a boolean value. The result is \fBtrue\fR if the key is
known, and \fBfalse\fR otherwise.
.TP
\fIobjectName\fR \fBclear\fR ?\fIkey\fR?
This method resets the state of either the specified \fIkey\fR or of
all keys known to the cache, making it unkown. This forces future
\fBget\fR-requests to reload the information from the provider.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcache\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
asynchronous, cache, callback, synchronous
.SH COPYRIGHT
.nf
Copyright (c) 2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/clock/iso8601.n.


































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/clock/iso8601.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "clock_iso8601" n 0.1 tcllib "Date/Time Utilities"
.BS
.SH NAME
clock_iso8601 \- Parsing ISO 8601 dates/times
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBclock::iso8601  ?0.1?\fR
.sp
\fB::clock::iso8601 parse_date\fR \fIdate\fR \fIoptions...\fR
.sp
\fB::clock::iso8601 parse_time\fR \fItime\fR \fIoptions...\fR
.sp
.BE
.SH DESCRIPTION
This package provides functionality to parse dates and times in
ISO 8601 format.
.PP
.TP
\fB::clock::iso8601 parse_date\fR \fIdate\fR \fIoptions...\fR
This command parses an ISO8601 date string in an unknown variant and
returns the given date/time in seconds since epoch.
.sp
The acceptable options are
\fB-base\fR,
\fB-gmt\fR,
\fB-locale\fR, and
\fB-timezone\fR
of the builtin command \fBclock scan\fR.
.TP
\fB::clock::iso8601 parse_time\fR \fItime\fR \fIoptions...\fR
This command parses a full ISO8601 timestamp string (date and time) in
an unknown variant and returns the given time in seconds since epoch.
.sp
The acceptable options are
\fB-base\fR,
\fB-gmt\fR,
\fB-locale\fR, and
\fB-timezone\fR
of the builtin command \fBclock scan\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIclock::iso8601\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH CATEGORY
Text processing

Added embedded/man/files/modules/clock/rfc2822.n.















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/clock/rfc2822.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "clock_rfc2822" n 0.1 tcllib "Date/Time Utilities"
.BS
.SH NAME
clock_rfc2822 \- Parsing ISO 8601 dates/times
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBclock::rfc2822  ?0.1?\fR
.sp
\fB::clock::rfc2822 parse_date\fR \fIdate\fR
.sp
.BE
.SH DESCRIPTION
This package provides functionality to parse dates in
RFC 2822 format.
.PP
.TP
\fB::clock::rfc2822 parse_date\fR \fIdate\fR
This command parses an RFC2822 date string and returns
the given date in seconds since epoch. An error is thrown
if the command is unable to parse the date.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIclock::rfc2822\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH CATEGORY
Text processing

Added embedded/man/files/modules/cmdline/cmdline.n.

















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/cmdline/cmdline.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "cmdline" n 1.3.3 tcllib "Command line and option processing"
.BS
.SH NAME
cmdline \- Procedures to process command lines and options.
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBcmdline  ?1.3.3?\fR
.sp
\fB::cmdline::getopt\fR \fIargvVar\fR \fIoptstring\fR \fIoptVar\fR \fIvalVar\fR
.sp
\fB::cmdline::getKnownOpt\fR \fIargvVar\fR \fIoptstring\fR \fIoptVar\fR \fIvalVar\fR
.sp
\fB::cmdline::getoptions\fR \fIarglistVar\fR \fIoptlist\fR ?\fIusage\fR?
.sp
\fB::cmdline::getKnownOptions\fR \fIarglistVar\fR \fIoptlist\fR ?\fIusage\fR?
.sp
\fB::cmdline::usage\fR \fIoptlist\fR ?\fIusage\fR?
.sp
\fB::cmdline::getfiles\fR \fIpatterns\fR \fIquiet\fR
.sp
\fB::cmdline::getArgv0\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands to parse command lines and options.
.SH "::ARGV HANDLING"
One of the most common variables this package will be used with is
\fB::argv\fR, which holds the command line of the current
application. This variable has a companion \fB::argc\fR which is
initialized to the number of elements in \fB::argv\fR at the beginning
of the application.
.PP
The commands in this package will \fInot\fR modify the \fB::argc\fR
companion when called with \fB::argv\fR. Keeping the value consistent,
if such is desired or required, is the responsibility of the caller.
.SH API
.TP
\fB::cmdline::getopt\fR \fIargvVar\fR \fIoptstring\fR \fIoptVar\fR \fIvalVar\fR
This command works in a fashion like the standard C based \fBgetopt\fR
function.  Given an option string and a pointer to an array of args
this command will process the first argument and return info on how to
proceed. The command returns 1 if an option was found, 0 if no more
options were found, and -1 if an error occurred.
.sp
\fIargvVar\fR contains the name of the list of arguments to
process. If options are found the list is modified and the processed
arguments are removed from the start of the list.
.sp
\fIoptstring\fR contains a list of command options that the
application will accept.  If the option ends in ".arg" the command
will use the next argument as an argument to the option.  Otherwise
the option is a boolean that is set to 1 if present.
.sp
\fIoptVar\fR refers to the variable the command will store the found
option into (without the leading '-' and without the .arg extension).
.sp
\fIvalVar\fR refers to the variable to store either the value for the
specified option into upon success or an error message in the case of
failure. The stored value comes from the command line for .arg
options, otherwise the value is 1.
.TP
\fB::cmdline::getKnownOpt\fR \fIargvVar\fR \fIoptstring\fR \fIoptVar\fR \fIvalVar\fR
Like \fB::cmdline::getopt\fR, but ignores any unknown options in the
input.
.TP
\fB::cmdline::getoptions\fR \fIarglistVar\fR \fIoptlist\fR ?\fIusage\fR?
Processes the set of command line options found in the list variable
named by \fIarglistVar\fR and fills in defaults for those not
specified.  This also generates an error message that lists the
allowed flags if an incorrect flag is specified. The optional
\fIusage\fR-argument contains a string to include in front of the
generated message. If not present it defaults to "options:".
.sp
\fIoptlist\fR contains a list of lists where each element specifies an
option in the form: \fIflag\fR \fIdefault\fR \fIcomment\fR.
.sp
If \fIflag\fR ends in ".arg" then the value is taken from the command
line. Otherwise it is a boolean and appears in the result if present
on the command line. If \fIflag\fR ends in ".secret", it will not be
displayed in the usage.
.sp
The options \fB-?\fR, \fB-help\fR, and \fB--\fR are
implicitly understood. The first two abort option processing and force
the generation of the usage message, whereas the the last aborts
option processing without an error, leaving all arguments coming after
for regular processing, even if starting with a dash.
.sp
The result of the command is a dictionary mapping all options to their
values, be they user-specified or defaults.
.TP
\fB::cmdline::getKnownOptions\fR \fIarglistVar\fR \fIoptlist\fR ?\fIusage\fR?
Like \fB::cmdline::getoptions\fR, but ignores any unknown options in the
input.
.TP
\fB::cmdline::usage\fR \fIoptlist\fR ?\fIusage\fR?
Generates and returns an error message that lists the allowed
flags. \fIoptlist\fR is defined as for
\fB::cmdline::getoptions\fR. The optional \fIusage\fR-argument
contains a string to include in front of the generated message. If not
present it defaults to "options:".
.TP
\fB::cmdline::getfiles\fR \fIpatterns\fR \fIquiet\fR
Given a list of file \fIpatterns\fR this command computes the set of
valid files.  On windows, file globbing is performed on each argument.
On Unix, only file existence is tested.  If a file argument produces
no valid files, a warning is optionally generated (set \fIquiet\fR to
true).
.sp
This code also uses the full path for each file.  If not given it
prepends the current working directory to the filename. This ensures
that these files will never conflict with files in a wrapped zip
file. The last sentence refers to the pro-tools.
.TP
\fB::cmdline::getArgv0\fR
This command returns the "sanitized" version of \fIargv0\fR.  It will
strip off the leading path and removes the extension ".bin". The
latter is used by the pro-apps because they must be wrapped by a shell
script.
.PP
.SH EXAMPLES
.CS


        set options {
            {a          "set the atime only"}
            {m          "set the mtime only"}
            {c          "do not create non-existent files"}
            {r.arg  ""  "use time from ref_file"}
            {t.arg  -1  "use specified time"}
        }
        set usage ": MyCommandName \\[options] filename ...\\noptions:"
        array set params [::cmdline::getoptions argv $options $usage]

        if {  $params(a) } { set set_atime "true" }
        set has_t [expr {$params(t) != -1}]
        set has_r [expr {[string length $params(r)] > 0}]
        if {$has_t && $has_r} {
            return -code error "Cannot specify both -r and -t"
        } elseif {$has_t} {
	    ...
        }

.CE
.PP
This example, taken (and slightly modified) from the package
\fBfileutil\fR, shows how to use cmdline.  First, a list of
options is created, then the 'args' list is passed to cmdline for
processing.  Subsequently, different options are checked to see if
they have been passed to the script, and what their value is.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcmdline\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
argument processing, argv, argv0, cmdline processing, command line processing
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/comm/comm.n.






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/comm/comm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 1995-1998 The Open Group. All Rights Reserved.
'\" Copyright (c) 2003-2004 ActiveState Corporation.
'\" Copyright (c) 2006-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "comm" n 4.6.2 tcllib "Remote communication"
.BS
.SH NAME
comm \- A remote communication facility for Tcl (8.3 and later)
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBcomm  ?4.6.2?\fR
.sp
\fB::comm::comm send\fR ?-async? ?-command \fIcallback\fR? \fIid\fR \fIcmd\fR ?\fIarg arg ...\fR?
.sp
\fB::comm::comm self\fR
.sp
\fB::comm::comm interps\fR
.sp
\fB::comm::comm connect\fR ?\fIid\fR?
.sp
\fB::comm::comm new\fR \fIchan\fR ?\fIname value ...\fR?
.sp
\fB::comm::comm channels\fR
.sp
\fB::comm::comm config\fR
.sp
\fB::comm::comm config\fR \fIname\fR
.sp
\fB::comm::comm config\fR ?\fIname\fR \fIvalue\fR \fI...\fR?
.sp
\fB::comm::comm shutdown\fR \fIid\fR
.sp
\fB::comm::comm abort\fR
.sp
\fB::comm::comm destroy\fR
.sp
\fB::comm::comm hook\fR \fIevent\fR ?\fB+\fR? ?\fIscript\fR?
.sp
\fB::comm::comm remoteid\fR
.sp
\fB::comm::comm_send\fR
.sp
\fB::comm::comm return_async\fR
.sp
\fB$future\fR \fBreturn\fR ?\fB-code\fR \fIcode\fR? ?\fIvalue\fR?
.sp
\fB$future\fR \fBconfigure\fR ?\fB-command\fR ?\fIcmdprefix\fR??
.sp
\fB$future\fR \fBcget\fR \fB-command\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBcomm\fR command provides an inter-interpreter remote
execution facility much like Tk's \fBsend(n)\fR, except that it uses
sockets rather than the X server for the communication path.  As a
result, \fBcomm\fR works with multiple interpreters, works on
Windows and Macintosh systems, and provides control over the remote
execution path.
.PP
These commands work just like \fBsend\fR and \fBwinfo interps\fR :
.PP
.CS


    ::comm::comm send ?-async? id cmd ?arg arg ...?
    ::comm::comm interps

.CE
.PP
This is all that is really needed to know in order to use
\fBcomm\fR
.SS COMMANDS
The package initializes \fB::comm::comm\fR as the default \fIchan\fR.
.PP
\fBcomm\fR names communication endpoints with an \fIid\fR unique
to each machine.  Before sending commands, the \fIid\fR of another
interpreter is needed.  Unlike Tk's send, \fBcomm\fR doesn't
implicitly know the \fIid\fR's of all the interpreters on the system.
The following four methods make up the basic \fBcomm\fR interface.
.TP
\fB::comm::comm send\fR ?-async? ?-command \fIcallback\fR? \fIid\fR \fIcmd\fR ?\fIarg arg ...\fR?
This invokes the given command in the interpreter named by \fIid\fR.  The
command waits for the result and remote errors are returned unless the
\fB-async\fR or \fB-command\fR option is given.  If \fB-async\fR
is given, send returns immediately and there is no further notification of
result.  If \fB-command\fR is used, \fIcallback\fR specifies a command
to invoke when the result is received.  These options are mutually
exclusive.  The callback will receive arguments in the form
\fI-option value\fR, suitable for \fBarray set\fR.
The options are: \fI-id\fR, the comm id of the interpreter that received
the command; \fI-serial\fR, a unique serial for each command sent to a
particular comm interpreter; \fI-chan\fR, the comm channel name;
\fI-code\fR, the result code of the command; \fI-errorcode\fR, the
errorcode, if any, of the command; \fI-errorinfo\fR, the errorinfo, if
any, of the command; and \fI-result\fR, the return value of the command.
If connection is lost before a reply is received, the callback will be
invoked with a connection lost message with -code equal to -1.  When
\fB-command\fR is used, the command returns the unique serial for the
command.
.TP
\fB::comm::comm self\fR
Returns the \fIid\fR for this channel.
.TP
\fB::comm::comm interps\fR
Returns a list of all the remote \fIid\fR's to which this channel is
connected.  \fBcomm\fR learns a new remote \fIid\fR when a command
is first issued it, or when a remote \fIid\fR first issues a command
to this comm channel.  \fB::comm::comm ids\fR is an alias for this
method.
.TP
\fB::comm::comm connect\fR ?\fIid\fR?
Whereas \fB::comm::comm send\fR will automatically connect to the
given \fIid\fR, this forces a connection to a remote \fIid\fR without
sending a command.  After this, the remote \fIid\fR will appear in
\fB::comm::comm interps\fR.
.PP
.SS "EVAL SEMANTICS"
.PP
The evaluation semantics of \fB::comm::comm send\fR are intended to
match Tk's \fBsend\fR \fIexactly\fR. This means that \fBcomm\fR
evaluates arguments on the remote side.
.PP
If you find that \fB::comm::comm send\fR doesn't work for a
particular command, try the same thing with Tk's send and see if the
result is different.  If there is a problem, please report it.  For
instance, there was had one report that this command produced an
error.  Note that the equivalent \fBsend\fR command also produces the
same error.
.PP
.CS


    % ::comm::comm send id llength {a b c}
    wrong # args: should be "llength list"
    % send name llength {a b c}
    wrong # args: should be "llength list"

.CE
.PP
The \fBeval\fR hook (described below) can be used to change from
\fBsend\fR's double eval semantics to single eval semantics.
.SS "MULTIPLE CHANNELS"
.PP
More than one \fBcomm\fR channel (or \fIlistener\fR) can be created
in each Tcl interpreter.  This allows flexibility to create full and
restricted channels.  For instance, \fIhook\fR scripts are specific
to the channel they are defined against.
.TP
\fB::comm::comm new\fR \fIchan\fR ?\fIname value ...\fR?
This creates a new channel and Tcl command with the given channel
name.  This new command controls the new channel and takes all the
same arguments as \fB::comm::comm\fR.  Any remaining arguments are
passed to the \fBconfig\fR method.  The fully qualified channel
name is returned.
.TP
\fB::comm::comm channels\fR
This lists all the channels allocated in this Tcl interpreter.
.PP
.PP
The default configuration parameters for a new channel are:
.PP
.CS


    "-port 0 -local 1 -listen 0 -silent 0"

.CE
.PP
The default channel \fB::comm::comm\fR is created with:
.PP
.CS


    "::comm::comm new ::comm::comm -port 0 -local 1 -listen 1 -silent 0"

.CE
.SS "CHANNEL CONFIGURATION"
.PP
The \fBconfig\fR method acts similar to \fBfconfigure\fR in that it
sets or queries configuration variables associated with a channel.
.TP
\fB::comm::comm config\fR
.TP
\fB::comm::comm config\fR \fIname\fR
.TP
\fB::comm::comm config\fR ?\fIname\fR \fIvalue\fR \fI...\fR?
When given no arguments, \fBconfig\fR returns a list of all variables
and their value With one argument, \fBconfig\fR returns the value of
just that argument.  With an even number of arguments, the given
variables are set to the given values.
.PP
.PP
These configuration variables can be changed (descriptions of them are
elsewhere in this manual page):
.TP
\fB-listen\fR ?\fI0|1\fR?
.TP
\fB-local\fR  ?\fI0|1\fR?
.TP
\fB-port\fR   ?\fIport\fR?
.TP
\fB-silent\fR ?\fI0|1\fR?
.TP
\fB-socketcmd\fR ?\fIcommandname\fR?
.TP
\fB-interp\fR ?\fIinterpreter\fR?
.TP
\fB-events\fR ?\fIeventlist\fR?
.PP
.PP
These configuration variables are read only:
.TP
\fB-chan\fR    \fIchan\fR
.TP
\fB-serial\fR  \fIn\fR
.TP
\fB-socket\fR  sock\fIIn\fR
.PP
.PP
When \fBconfig\fR changes the parameters of an existing channel (with
the exception of \fB-interp\fR and \fB-events\fR), it closes and
reopens the listening socket.
An automatically assigned channel \fIid\fR will change when this
happens.
Recycling the socket is done by invoking \fB::comm::comm abort\fR,
which causes all active sends to terminate.
.SS "ID/PORT ASSIGNMENTS"
.PP
\fBcomm\fR uses a TCP port for endpoint \fIid\fR.  The
\fBinterps\fR (or \fBids\fR) method merely lists all the TCP ports
to which the channel is connected.  By default, each channel's
\fIid\fR is randomly assigned by the operating system (but usually
starts at a low value around 1024 and increases each time a new socket
is opened).  This behavior is accomplished by giving the
\fB-port\fR config option a value of 0.  Alternately, a specific
TCP port number may be provided for a given channel.  As a special
case, comm contains code to allocate a a high-numbered TCP port
(>10000) by using \fB-port {}\fR.  Note that a channel won't be
created and initialized unless the specific port can be allocated.
.PP
As a special case, if the channel is configured with
\fB-listen 0\fR, then it will not create a listening socket and
will use an id of \fB0\fR for itself.  Such a channel is only good
for outgoing connections (although once a connection is established,
it can carry send traffic in both directions).
As another special case, if the channel is configured with
\fB-silent 0\fR, then the listening side will ignore connection
attempts where the protocol negotiation phase failed, instead of
throwing an error.
.SS "EXECUTION ENVIRONMENT"
A communication channel in its default configuration will use the
current interpreter for the execution of all received scripts, and of
the event scripts associated with the various hooks.
.PP
This insecure setup can be changed by the user via the two options
\fB-interp\fR, and \fB-events\fR.
.PP
When \fB-interp\fR is set all received scripts are executed in the
slave interpreter specified as the value of the option. This
interpreter is expected to exist before configuration. I.e. it is the
responsibility of the user to create it. However afterward the
communication channel takes ownership of this interpreter, and will
destroy it when the communication channel is destroyed.
Note that reconfiguration of the communication channel to either a
different interpreter or the empty string will release the ownership
\fIwithout\fR destroying the previously configured interpreter.  The
empty string has a special meaning, it restores the default behaviour
of executing received scripts in the current interpreter.
.PP
\fIAlso of note\fR is that replies and callbacks (a special form of
reply) are \fInot\fR considered as received scripts. They are
trusted, part of the internal machinery of comm, and therefore always
executed in the current interpreter.
.PP
Even if an interpreter has been configured as the execution
environment for received scripts the event scripts associated with the
various hooks will by default still be executed in the current
interpreter. To change this use the option \fB-events\fR to declare
a list of the events whose scripts should be executed in the declared
interpreter as well. The contents of this option are ignored if the
communication channel is configured to execute received scripts in the
current interpreter.
.SS "REMOTE INTERPRETERS"
.PP
By default, each channel is restricted to accepting connections from
the local system.  This can be overridden by using the
\fB-local 0\fR configuration option For such channels, the
\fIid\fR parameter takes the form \fI{ id host }\fR.
.PP
\fIWARNING\fR: The \fIhost\fR must always be specified in the same
form (e.g., as either a fully qualified domain name, plain hostname or
an IP address).
.SS "CLOSING CONNECTIONS"
.PP
These methods give control over closing connections:
.TP
\fB::comm::comm shutdown\fR \fIid\fR
This closes the connection to \fIid\fR, aborting all outstanding
commands in progress.  Note that nothing prevents the connection from
being immediately reopened by another incoming or outgoing command.
.TP
\fB::comm::comm abort\fR
This invokes shutdown on all open connections in this comm channel.
.TP
\fB::comm::comm destroy\fR
This aborts all connections and then destroys the this comm channel
itself, including closing the listening socket.  Special code allows
the default \fB::comm::comm\fR channel to be closed such that the
\fB::comm::comm\fR command it is not destroyed.  Doing so closes the
listening socket, preventing both incoming and outgoing commands on
the channel.  This sequence reinitializes the default channel:
.sp
.CS


    "::comm::comm destroy; ::comm::comm new ::comm::comm"

.CE
.PP
.PP
When a remote connection is lost (because the remote exited or called
\fBshutdown\fR), \fBcomm\fR can invoke an application callback.
This can be used to cleanup or restart an ancillary process, for
instance.  See the \fIlost\fR callback below.
.SS CALLBACKS
.PP
This is a mechanism for setting hooks for particular events:
.TP
\fB::comm::comm hook\fR \fIevent\fR ?\fB+\fR? ?\fIscript\fR?
This uses a syntax similar to Tk's \fBbind\fR command.  Prefixing
\fIscript\fR with a \fB+\fR causes the new script to be appended.
Without this, a new \fIscript\fR replaces any existing script.  When
invoked without a script, no change is made.  In all cases, the new
hook script is returned by the command.
.sp
When an \fIevent\fR occurs, the \fIscript\fR associated with it is
evaluated with the listed variables in scope and available.  The
return code (\fInot\fR the return value) of the script is commonly
used decide how to further process after the hook.
.sp
Common variables include:
.RS
.TP
\fBchan\fR
the name of the comm channel (and command)
.TP
\fBid\fR
the id of the remote in question
.TP
\fBfid\fR
the file id for the socket of the connection
.RE
.PP
.PP
These are the defined \fIevents\fR:
.TP
\fBconnecting\fR
Variables:
\fBchan\fR, \fBid\fR
.sp
This hook is invoked before making a connection to the remote named in
\fIid\fR.  An error return (via \fBerror\fR) will abort the connection
attempt with the error.  Example:
.sp
.CS


    % ::comm::comm hook connecting {
        if {[string match {*[02468]} $id]} {
            error "Can't connect to even ids"
        }
    }
    % ::comm::comm send 10000 puts ok
    Connect to remote failed: Can't connect to even ids
    %

.CE
.TP
\fBconnected\fR
Variables:
\fBchan\fR, \fBfid\fR, \fBid\fR, \fBhost\fR, and \fBport\fR.
.sp
This hook is invoked immediately after making a remote connection to
\fIid\fR, allowing arbitrary authentication over the socket named by
\fIfid\fR.  An error return (via \fBerror\fR ) will close the
connection with the error.  \fIhost\fR and \fIport\fR are merely
extracted from the \fIid\fR; changing any of these will have no effect
on the connection, however.  It is also possible to substitute and
replace \fIfid\fR.
.TP
\fBincoming\fR
Variables:
\fBchan\fR, \fBfid\fR, \fBaddr\fR, and \fBremport\fR.
.sp
Hook invoked when receiving an incoming connection, allowing arbitrary
authentication over socket named by \fIfid\fR.  An error return (via
\fBerror\fR) will close the connection with the error.  Note that the
peer is named by \fIremport\fR and \fIaddr\fR but that the remote
\fIid\fR is still unknown.  Example:
.sp
.CS


    ::comm::comm hook incoming {
        if {[string match 127.0.0.1 $addr]} {
            error "I don't talk to myself"
        }
    }

.CE
.TP
\fBeval\fR
Variables:
\fBchan\fR, \fBid\fR, \fBcmd\fR, and \fBbuffer\fR.
.sp
This hook is invoked after collecting a complete script from a remote
but \fIbefore\fR evaluating it.  This allows complete control over
the processing of incoming commands.  \fIcmd\fR contains either
\fBsend\fR or \fBasync\fR.  \fIbuffer\fR holds the script to
evaluate.  At the time the hook is called, \fI$chan remoteid\fR is
identical in value to \fIid\fR.
.sp
By changing \fIbuffer\fR, the hook can change the script to be
evaluated.  The hook can short circuit evaluation and cause a value to
be immediately returned by using \fBreturn\fR \fIresult\fR (or, from
within a procedure, \fBreturn -code return\fR \fIresult\fR).  An
error return (via \fBerror\fR) will return an error result, as is if
the script caused the error.  Any other return will evaluate the
script in \fIbuffer\fR as normal.  For compatibility with 3.2,
\fBbreak\fR and \fBreturn -code break\fR \fIresult\fR is supported,
acting similarly to \fBreturn {}\fR and \fBreturn -code return\fR
\fIresult\fR.
.sp
Examples:
.RS
.IP [1]
augmenting a command
.sp
.CS


    % ::comm::comm send [::comm::comm self] pid
    5013
    % ::comm::comm hook eval {puts "going to execute $buffer"}
    % ::comm::comm send [::comm::comm self] pid
    going to execute pid
    5013

.CE
.IP [2]
short circuiting a command
.sp
.CS


    % ::comm::comm hook eval {puts "would have executed $buffer"; return 0}
    % ::comm::comm send [::comm::comm self] pid
    would have executed pid
    0

.CE
.IP [3]
Replacing double eval semantics
.sp
.CS


    % ::comm::comm send [::comm::comm self] llength {a b c}
    wrong # args: should be "llength list"
    % ::comm::comm hook eval {return [uplevel #0 $buffer]}
    return [uplevel #0 $buffer]
    % ::comm::comm send [::comm::comm self] llength {a b c}
    3

.CE
.IP [4]
Using a slave interpreter
.sp
.CS


    % interp create foo
    % ::comm::comm hook eval {return [foo eval $buffer]}
    % ::comm::comm send [::comm::comm self] set myvar 123
    123
    % set myvar
    can't read "myvar": no such variable
    % foo eval set myvar
    123

.CE
.IP [5]
Using a slave interpreter (double eval)
.sp
.CS


    % ::comm::comm hook eval {return [eval foo eval $buffer]}

.CE
.IP [6]
Subverting the script to execute
.sp
.CS


    % ::comm::comm hook eval {
        switch -- $buffer {
            a {return A-OK}
            b {return B-OK}
            default {error "$buffer is a no-no"}
        }
    }
    % ::comm::comm send [::comm::comm self] pid
    pid is a no-no
    % ::comm::comm send [::comm::comm self] a
    A-OK

.CE
.RE
.TP
\fBreply\fR
Variables:
\fBchan\fR, \fBid\fR, \fBbuffer\fR, \fBret\fR, and \fBreturn()\fR.
.sp
This hook is invoked after collecting a complete reply script from a
remote but \fIbefore\fR evaluating it.  This allows complete
control over the processing of replies to sent commands.  The reply
\fIbuffer\fR is in one of the following forms
.RS
.IP \(bu
return result
.IP \(bu
return -code code result
.IP \(bu
return -code code -errorinfo info -errorcode ecode msg
.RE
.sp
For safety reasons, this is decomposed.  The return result is in
\fIret\fR, and the return switches are in the return array:
.RS
.IP \(bu
\fIreturn(-code)\fR
.IP \(bu
\fIreturn(-errorinfo)\fR
.IP \(bu
\fIreturn(-errorcode)\fR
.RE
.sp
Any of these may be the empty string.  Modifying these four variables
can change the return value, whereas modifying \fIbuffer\fR has no
effect.
.TP
\fBcallback\fR
Variables:
\fBchan\fR, \fBid\fR, \fBbuffer\fR, \fBret\fR, and \fBreturn()\fR.
.sp
Similar to \fIreply\fR, but used for callbacks.
.TP
\fBlost\fR
Variables:
\fBchan\fR, \fBid\fR, and \fBreason\fR.
.sp
This hook is invoked when the connection to \fBid\fR is lost.  Return
value (or thrown error) is ignored.  \fIreason\fR is an explanatory
string indicating why the connection was lost.  Example:
.sp
.CS


    ::comm::comm hook lost {
        global myvar
        if {$myvar(id) == $id} {
            myfunc
            return
        }
    }

.CE
.PP
.SS UNSUPPORTED
.PP
These interfaces may change or go away in subsequence releases.
.TP
\fB::comm::comm remoteid\fR
Returns the \fIid\fR of the sender of the last remote command
executed on this channel.  If used by a proc being invoked remotely,
it must be called before any events are processed.  Otherwise, another
command may get invoked and change the value.
.TP
\fB::comm::comm_send\fR
Invoking this procedure will substitute the Tk \fBsend\fR and
\fBwinfo interps\fR commands with these equivalents that use
\fB::comm::comm\fR.
.sp
.CS


    proc send {args} {
        eval ::comm::comm send $args
    }
    rename winfo tk_winfo
    proc winfo {cmd args} {
        if {![string match in* $cmd]} {
            return [eval [list tk_winfo $cmd] $args]
        }
        return [::comm::comm interps]
    }

.CE
.PP
.SS SECURITY
Starting with version 4.6 of the package an option \fB-socketcmd\fR
is supported, allowing the user of a comm channel to specify which
command to use when opening a socket. Anything which is API-compatible
with the builtin \fB::socket\fR (the default) can be used.
.PP
The envisioned main use is the specification of the \fBtls::socket\fR
command, see package \fBtls\fR, to secure the communication.
.PP
.CS


	# Load and initialize tls
	package require tls
	tls::init  -cafile /path/to/ca/cert -keyfile ...

	# Create secured comm channel
	::comm::comm new SECURE -socketcmd tls::socket -listen 1
	...

.CE
.PP
The sections \fBExecution Environment\fR and \fBCallbacks\fR
are also relevant to the security of the system, providing means to
restrict the execution to a specific environment, perform additional
authentication, and the like.
.SS "BLOCKING SEMANTICS"
.PP
There is one outstanding difference between \fBcomm\fR and
\fBsend\fR.  When blocking in a synchronous remote command, \fBsend\fR
uses an internal C hook (Tk_RestrictEvents) to the event loop to look
ahead for send-related events and only process those without
processing any other events.  In contrast, \fBcomm\fR uses the
\fBvwait\fR command as a semaphore to indicate the return message has
arrived.  The difference is that a synchronous \fBsend\fR will block
the application and prevent all events (including window related ones)
from being processed, while a synchronous \fB::comm::comm send\fR
will block the application but still allow other events to get
processed.  In particular, \fBafter idle\fR handlers will fire
immediately when comm blocks.
.PP
What can be done about this?  First, note that this behavior will come
from any code using \fBvwait\fR to block and wait for an event to
occur.  At the cost of multiple channel support, \fBcomm\fR could
be changed to do blocking I/O on the socket, giving send-like blocking
semantics.  However, multiple channel support is a very useful feature
of comm that it is deemed too important to lose.  The remaining
approaches involve a new loadable module written in C (which is
somewhat against the philosophy of \fBcomm\fR) One way would be to
create a modified version of the \fBvwait\fR command that allow the
event flags passed to Tcl_DoOneEvent to be specified.  For \fBcomm\fR,
just the TCL_FILE_EVENTS would be processed.  Another way would be to
implement a mechanism like Tk_RestrictEvents, but apply it to the Tcl
event loop (since \fBcomm\fR doesn't require Tk).  One of these
approaches will be available in a future \fBcomm\fR release as an
optional component.
.SS "ASYNCHRONOUS RESULT GENERATION"
By default the result returned by a remotely invoked command is the
result sent back to the invoker. This means that the result is
generated synchronously, and the server handling the call is blocked
for the duration of the command.
.PP
While this is tolerable as long as only short-running commands are
invoked on the server long-running commands, like database queries
make this a problem. One command can prevent the processing requests
of all other clients for an arbitrary period of time.
.PP
Before version 4.5 of comm the only solution was to rewrite the server
command to use the Tcl builtin command \fBvwait\fR, or one of its
relatives like \fBtkwait\fR, to open a new event loop which processes
requests while the long-running operation is executed. This however
has its own perils, as this makes it possible to both overflow the Tcl
stack with a large number of event loop, and to have a newer requests
block the return of older ones, as the eventloop have to be unwound in
the order of their creation.
.PP
The proper solution is to have the invoked command indicate to
\fBcomm\fR that it cannot or will not deliver an immediate,
synchronous result, but will do so later. At that point the framework
can put sending the actual result on hold and continue processing
requests using the main event loop. No blocking, no nesting of event
loops. At some future date the long running operation delivers the
result to comm, via the future object, which is then forwarded to the
invoker as usual.
.PP
The necessary support for this solution has been added to comm since
version 4.5, in the form of the new method \fBreturn_async\fR.
.TP
\fB::comm::comm return_async\fR
This command is used by a remotely invoked script to notify the comm
channel which invoked it that the result to send back to the invoker
is not generated synchronously. If this command is not called the
default/standard behaviour of comm is to send the synchronously
generated result of the script itself to the invoker.
.sp
The result of \fBreturn_async\fR is an object. This object, called a
\fIfuture\fR is where the result of the script has to be delivered to
when it becomes ready. When that happens it will take all the
necessary actions to deliver the result to the invoker of the script,
and then destroy itself. Should comm have lost the connection to the
invoker while the result is being computed the future will not try to
deliver the result it got, but just destroy itself. The future can be
configured with a command to call when the invoker is lost. This
enables the user to implement an early abort of the long-running
operation, should this be supported by it.
.sp
An example:
.CS


# Procedure invoked by remote clients to run database operations.
proc select {sql} {
    # Signal the async generation of the result

    set future [::comm::comm return_async]

    # Generate an async db operation and tell it where to deliver the result.

    set query [db query -command [list $future return] $sql]

    # Tell the database system which query to cancel if the connection
    # goes away while it is running.

    $future configure -command [list db cancel $query]

    # Note: The above will work without problem only if the async
    # query will nover run its completion callback immediately, but
    # only from the eventloop. Because otherwise the future we wish to
    # configure may already be gone. If that is possible use 'catch'
    # to prevent the error from propagating.
    return
}

.CE
.sp
The API of a future object is:
.RS
.TP
\fB$future\fR \fBreturn\fR ?\fB-code\fR \fIcode\fR? ?\fIvalue\fR?
Use this method to tell the future that long-running operation has
completed. Arguments are an optional return value (defaults to the
empty string), and the Tcl return code (defaults to OK).
.sp
The future will deliver this information to invoker, if the connection
was not lost in the meantime, and then destroy itself. If the
connection was lost it will do nothing but destroy itself.
.TP
\fB$future\fR \fBconfigure\fR ?\fB-command\fR ?\fIcmdprefix\fR??
.TP
\fB$future\fR \fBcget\fR \fB-command\fR
These methods allow the user to retrieve and set a command to be
called if the connection the future belongs to has been lost.
.RE
.PP
.SS COMPATIBILITY
.PP
\fBcomm\fR exports itself as a package.  The package version number
is in the form \fImajor . minor\fR, where the major version will
only change when a non-compatible change happens to the API or
protocol.  Minor bug fixes and changes will only affect the minor
version.  To load \fBcomm\fR this command is usually used:
.PP
.CS


    package require comm 3

.CE
.PP
Note that requiring no version (or a specific version) can also be done.
.PP
The revision history of \fBcomm\fR includes these releases:
.TP
4.6.2
Fixed bugs 2972571 and 3066872, the first a misdetection of quoted
brace after double backslash, the other a blocking gets making for an
obvious (hinsight) DoS attack on comm channels.
.TP
4.6.1
Changed the implementation of \fBcomm::commCollect\fR to emulate
lindex's pre-Tcl 8 behaviour, i.e. it was given the ability to parse
out the first word of a list, even if the whole buffer is not a
well-formed list. Without this change the first word could only be
extracted if the whole buffer was a well-formed list (ever since Tcl
8), and in a ver-high-load situation, i.e. a server sending lots
and/or large commands very fast, this may never happen, eventually
crashing the receiver when it runs out of memory. With the change the
receiver is always able to process the first word when it becomes
well-formed, regardless of the structure of the remainder of the
buffer.
.TP
4.6
Added the option \fB-socketcmd\fR enabling users to override how a
socket is opened. The envisioned main use is the specification of the
\fBtls::socket\fR command, see package \fBtls\fR, to secure the
communication.
.TP
4.5.7
Changed handling of ports already in use to provide a proper error
message.
.TP
4.5.6
Bugfix in the replacement for \fBvwait\fR, made robust against of
variable names containing spaces.
.TP
4.5.5
Bugfix in the handling of hooks, typo in variable name.
.TP
4.5.4
Bugfix in the handling of the result received by the \fBsend\fR
method. Replaced an \fIafter idle unset result\fR with an immediate
\fBunset\fR, with the information saved to a local variable.
.sp
The \fBafter idle\fR can spill into a forked child process if there
is no event loop between its setup and the fork. This may bork the
child if the next event loop is the \fBvwait\fR of \fBcomm\fR's
\fBsend\fR a few lines above the \fBafter idle\fR, and the child
used the same serial number for its next request. In that case the
parent's \fBafter idle unset\fR will delete the very array element
the child is waiting for, unlocking the \fBvwait\fR, causing it to
access a now missing array element, instead of the expected result.
.TP
4.5.3
Bugfixes in the wrappers for the builtin \fBupdate\fR and \fBvwait\fR
commands.
.TP
4.5.2
Bugfix in the wrapper for the builtin \fBupdate\fR command.
.TP
4.5.1
Bugfixes in the handling of -interp for regular scripts. The handling
of the buffer was wrong for scripts which are a single statement as
list. Fixed missing argument to new command \fBcommSendReply\fR,
introduced by version 4.5. Affected debugging.
.TP
4.5
New server-side feature. The command invoked on the server can now
switch comm from the standard synchronous return of its result to an
asynchronous (defered) return. Due to the use of snit to implement the
\fIfuture\fR objects used by this feature from this version on comm
requires at least Tcl 8.3 to run. Please read the section
\fBAsynchronous Result Generation\fR for more details.
.TP
4.4.1
Bugfix in the execution of hooks.
.TP
4.4
Bugfixes in the handling of -interp for regular and hook
scripts. Bugfixes in channel cleanup.
.TP
4.3.1
Introduced -interp and -events to enable easy use of a slave interp
for execution of received scripts, and of event scripts.
.TP
4.3
Bugfixes, and introduces -silent to allow the user to force the
server/listening side to silently ignore connection attempts where the
protocol negotiation failed.
.TP
4.2
Bugfixes, and most important, switched to utf-8 as default encoding
for full i18n without any problems.
.TP
4.1
Rewrite of internal code to remove old pseudo-object model.  Addition
of send -command asynchronous callback option.
.TP
4.0
Per request by John LoVerso. Improved handling of error for async
invoked commands.
.TP
3.7
Moved into tcllib and placed in a proper namespace.
.TP
3.6
A bug in the looking up of the remoteid for a executed command could
be triggered when the connection was closed while several asynchronous
sends were queued to be executed.
.TP
3.5
Internal change to how reply messages from a \fBsend\fR are handled.
Reply messages are now decoded into the \fIvalue\fR to pass to
\fBreturn\fR; a new return statement is then cons'd up to with this
value.  Previously, the return code was passed in from the remote as a
command to evaluate.  Since the wire protocol has not changed, this is
still the case.  Instead, the reply handling code decodes the
\fBreply\fR message.
.TP
3.4
Added more source commentary, as well as documenting config variables
in this man page.  Fixed bug were loss of connection would give error
about a variable named \fBpending\fR rather than the message about
the lost connection.  \fBcomm ids\fR is now an alias for
\fBcomm interps\fR (previously, it an alias for \fBcomm chans\fR).
Since the method invocation change of 3.0, break and other exceptional
conditions were not being returned correctly from \fBcomm send\fR.
This has been fixed by removing the extra level of indirection into
the internal procedure \fBcommSend\fR.  Also added propagation of
the \fIerrorCode\fR variable.  This means that these commands return
exactly as they would with \fBsend\fR:
.sp
.CS


    comm send id break
    catch {comm send id break}
    comm send id expr 1 / 0

.CE
.sp
Added a new hook for reply messages.  Reworked method invocation to
avoid the use of comm:* procedures; this also cut the invocation time
down by 40%.  Documented \fBcomm config\fR (as this manual page
still listed the defunct \fBcomm init\fR!)
.TP
3.3
Some minor bugs were corrected and the documentation was cleaned up.
Added some examples for hooks.  The return semantics of the \fBeval\fR
hook were changed.
.TP
3.2
A new wire protocol, version 3, was added.  This is backwards
compatible with version 2 but adds an exchange of supported protocol
versions to allow protocol negotiation in the future.  Several bugs
with the hook implementation were fixed.  A new section of the man
page on blocking semantics was added.
.TP
3.1
All the documented hooks were implemented.  \fBcommLostHook\fR was
removed.  A bug in \fBcomm new\fR was fixed.
.TP
3.0
This is a new version of \fBcomm\fR with several major changes.
There is a new way of creating the methods available under the
\fBcomm\fR command.  The \fBcomm init\fR method has been retired
and is replaced by \fBcomm configure\fR which allows access to many
of the well-defined internal variables.  This also generalizes the
options available to \fBcomm new\fR.  Finally, there is now a
protocol version exchanged when a connection is established.  This
will allow for future on-wire protocol changes.  Currently, the
protocol version is set to 2.
.TP
2.3
\fBcomm ids\fR was renamed to \fBcomm channels\fR.  General
support for \fBcomm hook\fR was fully implemented, but only the
\fIlost\fR hook exists, and it was changed to follow the general
hook API.  \fBcommLostHook\fR was unsupported (replaced by
\fBcomm hook lost\fR) and \fBcommLost\fR was removed.
.TP
2.2
The \fIdied\fR hook was renamed \fIlost\fR, to be accessed by
\fBcommLostHook\fR and an early implementation of
\fBcomm lost hook\fR.  As such, \fBcommDied\fR is now
\fBcommLost\fR.
.TP
2.1
Unsupported method \fBcomm remoteid\fR was added.
.TP
2.0
\fBcomm\fR has been rewritten from scratch (but is fully compatible
with Comm 1.0, without the requirement to use obTcl).
.PP
.SH AUTHOR
John LoVerso, [email protected]
.PP
\fIhttp://www.opengroup.org/~loverso/tcl-tk/#comm\fR
.SH LICENSE
Please see the file \fIcomm.LICENSE\fR that accompanied this source,
or
\fIhttp://www.opengroup.org/www/dist_client/caubweb/COPYRIGHT.free.html\fR.
.PP
This license for \fBcomm\fR, new as of version 3.2, allows it to be
used for free, without any licensing fee or royalty.
.SH BUGS
.IP \(bu
If there is a failure initializing a channel created with
\fB::comm::comm new\fR, then the channel should be destroyed.
Currently, it is left in an inconsistent state.
.IP \(bu
There should be a way to force a channel to quiesce when changing the
configuration.
.PP
.PP
The following items can be implemented with the existing hooks and are
listed here as a reminder to provide a sample hook in a future
version.
.IP \(bu
Allow easier use of a slave interp for actual command execution
(especially when operating in "not local" mode).
.IP \(bu
Add host list (xhost-like) or "magic cookie" (xauth-like)
authentication to initial handshake.
.PP
.PP
The following are outstanding todo items.
.IP \(bu
Add an interp discovery and name->port mapping.  This is likely to be
in a separate, optional nameserver.  (See also the related work,
below.)
.IP \(bu
Fix the \fI{id host}\fR form so as not to be dependent upon
canonical hostnames.  This requires fixes to Tcl to resolve hostnames!
.PP
.PP
This man page is bigger than the source file.
.SH "ON USING OLD VERSIONS OF TCL"
.PP
Tcl7.5 under Windows contains a bug that causes the interpreter to
hang when EOF is reached on non-blocking sockets.  This can be
triggered with a command such as this:
.PP
.CS


    "comm send $other exit"

.CE
.PP
Always make sure the channel is quiescent before closing/exiting or
use at least Tcl7.6 under Windows.
.PP
Tcl7.6 on the Mac contains several bugs.  It is recommended you use
at least Tcl7.6p2.
.PP
Tcl8.0 on UNIX contains a socket bug that can crash Tcl.  It is recommended
you use Tcl8.0p1 (or Tcl7.6p2).
.SH "RELATED WORK"
.PP
Tcl-DP provides an RPC-based remote execution interface, but is a
compiled Tcl extension.  See
\fIhttp://www.cs.cornell.edu/Info/Projects/zeno/Projects/Tcl-DP.html\fR.
.PP
Michael Doyle <[email protected]> has code that implements the Tcl-DP
RPC interface using standard Tcl sockets, much like \fBcomm\fR.
.PP
Andreas Kupries <[email protected]> uses
\fBcomm\fR and has built a simple nameserver as part of his Pool
library.  See \fIhttp://www.purl.org/net/akupries/soft/pool/index.htm\fR.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcomm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
send(n)
.SH KEYWORDS
comm, communication, ipc, message, remote communication, remote execution, rpc, secure, send, socket, ssl, tls
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 1995-1998 The Open Group. All Rights Reserved.
Copyright (c) 2003-2004 ActiveState Corporation.
Copyright (c) 2006-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/comm/comm_wire.n.


























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/comm/comm_wire.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Docs. Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "comm_wire" n 3 tcllib "Remote communication"
.BS
.SH NAME
comm_wire \- The comm wire protocol
.SH SYNOPSIS
package require \fBcomm \fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBcomm\fR command provides an inter-interpreter remote
execution facility much like Tk's \fBsend(n)\fR, except that it uses
sockets rather than the X server for the communication path.  As a
result, \fBcomm\fR works with multiple interpreters, works on
Windows and Macintosh systems, and provides control over the remote
execution path.
.PP
This document contains a specification of the various versions of the
wire protocol used by comm internally for the communication between
its endpoints. It has no relevance to users of \fBcomm\fR, only to
developers who wish to modify the package, write a compatible facility
in a different language, or some other facility based on the same
protocol.
.SH "WIRE PROTOCOL VERSION 3"
.SS "BASIC LAYER"
The basic encoding for \fIall\fR data is UTF-8. Because of this
binary data, including the NULL character, can be sent over the wire
as is, without the need for armoring it.
.SS "BASIC MESSAGE LAYER"
On top of the \fBBasic Layer\fR we have a
\fImessage oriented\fR exchange of data.
The totality of all characters written to the channel is a Tcl list,
with each element a separate \fImessage\fR, each itself a list. The
messages in the overall list are separated by EOL. Note that EOL
characters can occur within the list as well. They can be
distinguished from the message-separating EOL by the fact that the
data from the beginning up to their location is not a valid Tcl list.
.PP
EOL is signaled through the linefeed character, i.e \fBLF\fR, or,
hex \fB0x0a\fR. This is following the unix convention for
line-endings.
.PP
As a list each message is composed of \fIwords\fR. Their meaning
depends on when the message was sent in the overall exchange. This is
described in the upcoming sections.
.SS "NEGOTIATION MESSAGES - INITIAL HANDSHAKE"
The command protocol is defined like this:
.IP \(bu
The first message send by a client to a server, when opening the
connection, contains two words. The first word is a list as well, and
contains the versions of the wire protocol the client is willing to
accept, with the most preferred version first. The second word is the
TCP port the client is listening on for connections to itself. The
value \fB0\fR is used here to signal that the client will not listen
for connections, i.e. that it is purely for sending commands, and not
receiving them.
.IP \(bu
The first message sent by the server to the client, in response to the
message above contains only one word. This word is a list, containing
the string \fBvers\fR as its first element, and the version of the
wire protocol the server has selected from the offered versions as the
second.
.PP
.SS "SCRIPT/COMMAND MESSAGES"
All messages coming after the \fBinitial handshake\fR
consist of three words. These are an instruction, a transaction id,
and the payload. The valid instructions are shown below. The
transaction ids are used by the client to match any incoming replies
to the command messages it sent. This means that a server has to copy
the transaction id from a command message to the reply it sends for
that message.
.TP
\fBsend\fR
.TP
\fBasync\fR
.TP
\fBcommand\fR
The payload is the Tcl script to execute on the server. It is actually
a list containing the script fragments. These fragment are
\fBconcat\fRenated together by the server to form the full script to
execute on the server side.
This emulates the Tcl "eval" semantics.
In most cases it is best to have only one word in the list, a list
containing the exact command.
.sp
Examples:
.sp
.CS


    (a)     {send 1 {{array get tcl_platform}}}
    (b)     {send 1 {array get tcl_platform}}
    (c)     {send 1 {array {get tcl_platform}}}

    are all valid representations of the same command. They are
    generated via

    (a')    send {array get tcl_platform}
    (b')    send array get tcl_platform
    (c')    send array {get tcl_platform}

    respectively

.CE
.sp
Note that (a), generated by (a'), is the usual form, if only single
commands are sent by the client.
For example constructed using \fBlist\fR, if the command contains
variable arguments. Like
.sp
.CS


    send [list array get $the_variable]

.CE
.sp
These three instructions all invoke the script on the server
side. Their difference is in the treatment of result values, and thus
determines if a reply is expected.
.RS
.TP
\fBsend\fR
A reply is expected. The sender is waiting for the result.
.TP
\fBasync\fR
No reply is expected, the sender has no interest in the result and is
not waiting for any.
.TP
\fBcommand\fR
A reply is expected, but the sender is not waiting for it. It has
arranged to get a process-internal notification when the result
arrives.
.RE
.TP
\fBreply\fR
Like the previous three command, however the tcl script in the payload
is highly restricted.
It has to be a syntactically valid Tcl \fBreturn\fR command. This
contains result code, value, error code, and error info.
.sp
Examples:
.sp
.CS


    {reply 1 {return -code 0 {}}}
    {reply 1 {return -code 0 {osVersion 2.4.21-99-default byteOrder littleEndian machine i686 platform unix os Linux user andreask wordSize 4}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcomm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
comm
.SH KEYWORDS
comm, communication, ipc, message, remote communication, remote execution, rpc, socket
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2005 Docs. Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/control/control.n.



































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/control/control.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "control" n 0.1.3 tcllib "Tcl Control Flow Commands"
.BS
.SH NAME
control \- Procedures for control flow structures.
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBcontrol  ?0.1.3?\fR
.sp
\fBcontrol::control\fR \fIcommand\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fBcontrol::assert\fR \fIexpr\fR ?\fIarg arg ...\fR?
.sp
\fBcontrol::do\fR \fIbody\fR ?\fIoption test\fR?
.sp
\fBcontrol::no-op\fR ?\fIarg arg ...\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBcontrol\fR package provides a variety of commands that provide
additional flow of control structures beyond the built-in ones
provided by Tcl.  These are commands that in many programming
languages might be considered \fIkeywords\fR, or a part of the
language itself.  In Tcl, control flow structures are just commands
like everything else.
.SH COMMANDS
.TP
\fBcontrol::control\fR \fIcommand\fR \fIoption\fR ?\fIarg arg ...\fR?
The \fBcontrol\fR command is used as a configuration command for
customizing the other public commands of the control package.  The
\fIcommand\fR argument names the command to be customized.  The set of
valid \fIoption\fR and subsequent arguments are determined by the
command being customized, and are documented with the command.
.TP
\fBcontrol::assert\fR \fIexpr\fR ?\fIarg arg ...\fR?
When disabled, the \fBassert\fR command behaves exactly like the
\fBno-op\fR command.
.sp
When enabled, the \fBassert\fR command evaluates \fIexpr\fR as an
expression (in the same way that \fBexpr\fR evaluates its argument).
If evaluation reveals that \fIexpr\fR is not a valid boolean
expression (according to [\fBstring is boolean -strict\fR]),
an error is raised.  If \fIexpr\fR evaluates to a true boolean value
(as recognized by \fBif\fR), then \fBassert\fR returns an empty
string.  Otherwise, the remaining arguments to \fBassert\fR are used
to construct a message string.  If there are no arguments, the message
string is "assertion failed: $expr".  If there are arguments, they are
joined by \fBjoin\fR to form the message string.  The message string
is then appended as an argument to a callback command, and the
completed callback command is evaluated in the global namespace.
.sp
The \fBassert\fR command can be customized by the \fBcontrol\fR
command in two ways:
.sp
[\fBcontrol::control assert enabled\fR ?\fIboolean\fR?]
queries or sets whether \fBcontrol::assert\fR is enabled.  When called
without a \fIboolean\fR argument, a boolean value is returned
indicating whether the \fBcontrol::assert\fR command is enabled.  When
called with a valid boolean value as the \fIboolean\fR argument, the
\fBcontrol::assert\fR command is enabled or disabled to match the
argument, and an empty string is returned.
.sp
[\fBcontrol::control assert callback\fR ?\fIcommand\fR?]
queries or sets the callback command that will be called by an enabled
\fBassert\fR on assertion failure.  When called without a
\fIcommand\fR argument, the current callback command is returned.
When called with a \fIcommand\fR argument, that argument becomes the
new assertion failure callback command.  Note that an assertion
failure callback command is always defined, even when \fBassert\fR
is disabled.  The default callback command is
[\fBreturn -code error\fR].
.sp
Note that \fBcontrol::assert\fR has been written so that in
combination with [\fBnamespace import\fR], it is possible to
use enabled \fBassert\fR commands in some namespaces and disabled
\fBassert\fR commands in other namespaces at the same time.  This
capability is useful so that debugging efforts can be independently
controlled module by module.
.sp
.CS


% package require control
% control::control assert enabled 1
% namespace eval one namespace import ::control::assert
% control::control assert enabled 0
% namespace eval two namespace import ::control::assert
% one::assert {1 == 0}
assertion failed: 1 == 0
% two::assert {1 == 0}

.CE
.TP
\fBcontrol::do\fR \fIbody\fR ?\fIoption test\fR?
The \fBdo\fR command evaluates the script \fIbody\fR repeatedly
\fIuntil\fR the expression \fItest\fR becomes true or as long as
(\fIwhile\fR) \fItest\fR is true, depending on the value of
\fIoption\fR being \fBuntil\fR or \fBwhile\fR. If
\fIoption\fR and \fItest\fR are omitted the body is evaluated exactly
once. After normal completion, \fBdo\fR returns an empty string.
Exceptional return codes (\fBbreak\fR, \fBcontinue\fR, \fBerror\fR,
etc.) during the evaluation of \fIbody\fR are handled in the same way
the \fBwhile\fR command handles them, except as noted in
\fBLIMITATIONS\fR, below.
.TP
\fBcontrol::no-op\fR ?\fIarg arg ...\fR?
The \fBno-op\fR command takes any number of arguments and does
nothing.  It returns an empty string.
.PP
.SH LIMITATIONS
Several of the commands provided by the \fBcontrol\fR package accept
arguments that are scripts to be evaluated.  Due to fundamental
limitations of Tcl's \fBcatch\fR and \fBreturn\fR commands, it is not
possible for these commands to properly evaluate the command
[\fBreturn -code $code\fR] within one of those script
arguments for any value of \fI$code\fR other than \fIok\fR.  In this
way, the commands of the \fBcontrol\fR package are limited as compared
to Tcl's built-in control flow commands (such as \fBif\fR,
\fBwhile\fR, etc.) and those control flow commands that can be
provided by packages coded in C.  An example of this difference:
.PP
.CS


% package require control
% proc a {} {while 1 {return -code error a}}
% proc b {} {control::do {return -code error b} while 1}
% catch a
1
% catch b
0

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcontrol\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
break, continue, expr, if, join, namespace, return, string, while
.SH KEYWORDS
assert, control, do, flow, no-op, structure
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/coroutine/coro_auto.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/coroutine/coro_auto.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2010-2011 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "coroutine::auto" n 1 tcllib "Coroutine utilities"
.BS
.SH NAME
coroutine::auto \- Automatic event and IO coroutine awareness
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBcoroutine::auto  1.1\fR
.sp
package require \fBcoroutine  1.1\fR
.sp
.BE
.SH DESCRIPTION
The \fBcoroutine::auto\fR package provides no commands or other
directly visible functionality.
Built on top of the package \fBcoroutine\fR, it intercepts various
builtin commands of the Tcl core to make any code using them
coroutine-oblivious, i.e. able to run inside and outside of a
coroutine without changes.
.PP
The commands so affected by this package are
.TP
\fBafter\fR
.TP
\fBexit\fR
.TP
\fBgets\fR
.TP
\fBglobal\fR
.TP
\fBread\fR
.TP
\fBupdate\fR
.TP
\fBvwait\fR
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcoroutine\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
after, channel, coroutine, events, exit, gets, global, green threads, read, threads, update, vwait
.SH CATEGORY
Coroutine
.SH COPYRIGHT
.nf
Copyright (c) 2010-2011 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/coroutine/coroutine.n.































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/coroutine/coroutine.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2010-2011 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "coroutine" n 1 tcllib "Coroutine utilities"
.BS
.SH NAME
coroutine \- Coroutine based event and IO handling
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBcoroutine  1.1\fR
.sp
\fBcoroutine::util after\fR \fIdelay\fR
.sp
\fBcoroutine::util await\fR \fIvarname\fR...
.sp
\fBcoroutine::util create\fR \fIarg\fR...
.sp
\fBcoroutine::util exit\fR ?\fIstatus\fR?
.sp
\fBcoroutine::util gets\fR \fIchan\fR ?\fIvarname\fR?
.sp
\fBcoroutine::util global\fR \fIvarname\fR...
.sp
\fBcoroutine::util read\fR \fB-nonewline\fR \fIchan\fR ?\fIn\fR?
.sp
\fBcoroutine::util update\fR ?\fBidletasks\fR?
.sp
\fBcoroutine::util vwait\fR \fIvarname\fR
.sp
.BE
.SH DESCRIPTION
The \fBcoroutine\fR package provides coroutine-aware
implementations of various event- and channel related commands. It can
be in multiple modes:
.IP [1]
Call the commands through their ensemble, in code which is
explicitly written for use within coroutines.
.IP [2]
Import the commands into a namespace, either directly, or
through \fBnamespace path\fR. This allows the use from within code
which is not coroutine-aware per se and restricted to specific
namespaces.
.PP
A more agressive form of making code coroutine-oblivious than point 2
above is available through the package \fBcoroutine::auto\fR,
which intercepts the relevant builtin commands and changes their
implementation dependending on the context they are run in, i.e.
inside or outside of a coroutine.
.SH API
All the commands listed below are synchronous with respect to the
coroutine invoking them, i.e. this coroutine blocks until the result
is available. The overall eventloop is not blocked however.
.TP
\fBcoroutine::util after\fR \fIdelay\fR
This command delays the coroutine invoking it by \fIdelay\fR
milliseconds.
.TP
\fBcoroutine::util await\fR \fIvarname\fR...
This command is an extension form of the \fBcoroutine::util vwait\fR
command (see below) which waits on a write to one of many named
namespace variables.
.TP
\fBcoroutine::util create\fR \fIarg\fR...
This command creates a new coroutine with an automatically assigned
name and causes it to run the code specified by the arguments.
.TP
\fBcoroutine::util exit\fR ?\fIstatus\fR?
This command exits the current coroutine, causing it to return
\fIstatus\fR. If no status was specified the default \fI0\fR is
returned.
.TP
\fBcoroutine::util gets\fR \fIchan\fR ?\fIvarname\fR?
This command reads a line from the channel \fIchan\fR and returns it
either as its result, or, if a \fIvarname\fR was specified, writes it
to the named variable and returns the number of characters read.
.TP
\fBcoroutine::util global\fR \fIvarname\fR...
This command imports the named global variables of the coroutine into
the current scope. From the technical point of view these variables
reside in level \fB#1\fR of the Tcl stack. I.e. these are not the
regular global variable in to the global namespace, and each coroutine
can have their own set, independent of all others.
.TP
\fBcoroutine::util read\fR \fB-nonewline\fR \fIchan\fR ?\fIn\fR?
This command reads \fIn\fR characters from the channel \fIchan\fR and
returns them as its result. If \fIn\fR is not specified the command
will read the channel until EOF is reached.
.TP
\fBcoroutine::util update\fR ?\fBidletasks\fR?
This command causes the coroutine invoking it to run pending events or
idle handlers before proceeding.
.TP
\fBcoroutine::util vwait\fR \fIvarname\fR
This command causes the coroutine calling it to wait for a write to
the named namespace variable \fIvarname\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcoroutine\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
after, channel, coroutine, events, exit, gets, global, green threads, read, threads, update, vwait
.SH CATEGORY
Coroutine
.SH COPYRIGHT
.nf
Copyright (c) 2010-2011 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/counter/counter.n.













































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/counter/counter.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "counter" n 2.0.4 tcllib "Counters and Histograms"
.BS
.SH NAME
counter \- Procedures for counters and histograms
.SH SYNOPSIS
package require \fBTcl  8\fR
.sp
package require \fBcounter  ?2.0.4?\fR
.sp
\fB::counter::init\fR \fItag args\fR
.sp
\fB::counter::count\fR \fItag\fR ?\fIdelta\fR? ?\fIinstance\fR?
.sp
\fB::counter::start\fR \fItag instance\fR
.sp
\fB::counter::stop\fR \fItag instance\fR
.sp
\fB::counter::get\fR \fItag args\fR
.sp
\fB::counter::exists\fR \fItag\fR
.sp
\fB::counter::names\fR
.sp
\fB::counter::histHtmlDisplay\fR \fItag args\fR
.sp
\fB::counter::reset\fR \fItag args\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBcounter\fR package provides a counter facility and can
compute statistics and histograms over the collected data.
.TP
\fB::counter::init\fR \fItag args\fR
This defines a counter with the name \fItag\fR.  The \fIargs\fR
determines the characteristics of the counter.  The \fIargs\fR are
.RS
.TP
\fB-group\fR \fIname\fR
Keep a grouped counter where the name of the histogram bucket is
passed into \fB::counter::count\fR.
.TP
\fB-hist\fR \fIbucketsize\fR
Accumulate the counter into histogram buckets of size
\fIbucketsize\fR.  For example, if the samples are millisecond time
values and \fIbucketsize\fR is 10, then each histogram bucket
represents time values of 0 to 10 msec, 10 to 20 msec, 20 to 30 msec,
and so on.
.TP
\fB-hist2x\fR \fIbucketsize\fR
Accumulate the statistic into histogram buckets.  The size of the
first bucket is \fIbucketsize\fR, each other bucket holds values 2
times the size of the previous bucket.  For example, if
\fIbucketsize\fR is 10, then each histogram bucket represents time
values of 0 to 10 msec, 10 to 20 msec, 20 to 40 msec, 40 to 80 msec,
and so on.
.TP
\fB-hist10x\fR \fIbucketsize\fR
Accumulate the statistic into histogram buckets.  The size of the
first bucket is \fIbucketsize\fR, each other bucket holds values 10
times the size of the previous bucket.  For example, if
\fIbucketsize\fR is 10, then each histogram bucket represents time
values of 0 to 10 msec, 10 to 100 msec, 100 to 1000 msec, and so on.
.TP
\fB-lastn\fR \fIN\fR
Save the last \fIN\fR values of the counter to maintain a "running
average" over the last \fIN\fR values.
.TP
\fB-timehist\fR \fIsecsPerMinute\fR
Keep a time-based histogram.  The counter is summed into a histogram
bucket based on the current time.  There are 60 per-minute buckets
that have a size determined by \fIsecsPerMinute\fR, which is normally
60, but for testing purposes can be less.  Every "hour" (i.e., 60
"minutes") the contents of the per-minute buckets are summed into the
next hourly bucket.  Every 24 "hours" the contents of the per-hour
buckets are summed into the next daily bucket.  The counter package
keeps all time-based histograms in sync, so the first
\fIsecsPerMinute\fR value seen by the package is used for all
subsequent time-based histograms.
.RE
.TP
\fB::counter::count\fR \fItag\fR ?\fIdelta\fR? ?\fIinstance\fR?
Increment the counter identified by \fItag\fR.  The default increment
is 1, although you can increment by any value, integer or real, by
specifying \fIdelta\fR.  You must declare each counter with
\fB::counter::init\fR to define the characteristics of counter before
you start to use it.  If the counter type is \fB-group\fR, then the
counter identified by \fIinstance\fR is incremented.
.TP
\fB::counter::start\fR \fItag instance\fR
Record the starting time of an interval.  The \fItag\fR is the name of
the counter defined as a \fB-hist\fR value-based histogram.  The
\fIinstance\fR is used to distinguish this interval from any other
intervals that might be overlapping this one.
.TP
\fB::counter::stop\fR \fItag instance\fR
Record the ending time of an interval.  The delta time since the
corresponding \fB::counter::start\fR call for \fIinstance\fR is
recorded in the histogram identified by \fItag\fR.
.TP
\fB::counter::get\fR \fItag args\fR
Return statistics about a counter identified by \fItag\fR.  The
\fIargs\fR determine what value to return:
.RS
.TP
\fB-total\fR
Return the total value of the counter.  This is the default if
\fIargs\fR is not specified.
.TP
\fB-totalVar\fR
Return the name of the total variable.  Useful for specifying with
-textvariable in a Tk widget.
.TP
\fB-N\fR
Return the number of samples accumulated into the counter.
.TP
\fB-avg\fR
Return the average of samples accumulated into the counter.
.TP
\fB-avgn\fR
Return the average over the last \fIN\fR samples taken.  The \fIN\fR
value is set in the \fB::counter::init\fR call.
.TP
\fB-hist\fR \fIbucket\fR
If \fIbucket\fR is specified, then the value in that bucket of the
histogram is returned.  Otherwise the complete histogram is returned
in array get format sorted by bucket.
.TP
\fB-histVar\fR
Return the name of the histogram array variable.
.TP
\fB-histHour\fR
Return the complete hourly histogram in array get format sorted by
bucket.
.TP
\fB-histHourVar\fR
Return the name of the hourly histogram array variable.
.TP
\fB-histDay\fR
Return the complete daily histogram in array get format sorted by
bucket.
.TP
\fB-histDayVar\fR
Return the name of the daily histogram array variable.
.TP
\fB-resetDate\fR
Return the clock seconds value recorded when the
counter was last reset.
.TP
\fB-all\fR
Return an array get of the array used to store the counter.  This
includes the total, the number of samples (N), and any type-specific
information.  This does not include the histogram array.
.RE
.TP
\fB::counter::exists\fR \fItag\fR
Returns 1 if the counter is defined.
.TP
\fB::counter::names\fR
Returns a list of all counters defined.
.TP
\fB::counter::histHtmlDisplay\fR \fItag args\fR
Generate HTML to display a histogram for a counter.  The \fIargs\fR
control the format of the display.  They are:
.RS
.TP
\fB-title\fR \fIstring\fR
Label to display above bar chart
.TP
\fB-unit\fR \fIunit\fR
Specify \fBminutes\fR, \fBhours\fR, or \fBdays\fR for the
time-base histograms.  For value-based histograms, the \fIunit\fR is
used in the title.
.TP
\fB-images\fR \fIurl\fR
URL of /images directory.
.TP
\fB-gif\fR \fIfilename\fR
Image for normal histogram bars.  The \fIfilename\fR is relative to
the \fB-images\fR directory.
.TP
\fB-ongif\fR \fIfilename\fR
Image for the active histogram bar.  The \fIfilename\fR is relative to
the \fB-images\fR directory.
.TP
\fB-max\fR \fIN\fR
Maximum number of value-based buckets to display.
.TP
\fB-height\fR \fIN\fR
Pixel height of the highest bar.
.TP
\fB-width\fR \fIN\fR
Pixel width of each bar.
.TP
\fB-skip\fR \fIN\fR
Buckets to skip when labeling value-based histograms.
.TP
\fB-format\fR \fIstring\fR
Format used to display labels of buckets.
.TP
\fB-text\fR \fIboolean\fR
If 1, a text version of the histogram is dumped, otherwise a graphical
one is generated.
.RE
.TP
\fB::counter::reset\fR \fItag args\fR
Resets the counter with the name \fItag\fR to an initial state. The
\fIargs\fR determine the new characteristics of the counter. They have
the same meaning as described for \fB::counter::init\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcounter\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
counting, histogram, statistics, tallying
.SH CATEGORY
Data structures

Added embedded/man/files/modules/crc/cksum.n.
















































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/crc/cksum.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Pat Thoyts
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "cksum" n 1.1.3 tcllib "Cyclic Redundancy Checks"
.BS
.SH NAME
cksum \- Calculate a cksum(1) compatible checksum
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBcksum  ?1.1.3?\fR
.sp
\fB::crc::cksum\fR ?\fI-format format\fR? ?\fI-chunksize size\fR? [ \fI-channel chan\fR | \fI-filename file\fR | \fIstring\fR ]
.sp
\fB::crc::CksumInit\fR
.sp
\fB::crc::CksumUpdate\fR \fItoken\fR \fIdata\fR
.sp
\fB::crc::CksumFinal\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a Tcl implementation of the cksum(1) algorithm
based upon information provided at in the GNU implementation of this
program as part of the GNU Textutils 2.0 package.
.SH COMMANDS
.TP
\fB::crc::cksum\fR ?\fI-format format\fR? ?\fI-chunksize size\fR? [ \fI-channel chan\fR | \fI-filename file\fR | \fIstring\fR ]
The command takes string data or a channel or file name and returns a
checksum value calculated using the \fBcksum(1)\fR algorithm. The
result is formatted using the \fIformat\fR(n) specifier provided or as
an unsigned integer (%u) by default.
.PP
.SH OPTIONS
.TP
-channel \fIname\fR
Return a checksum for the data read from a channel. The command will
read data from the channel until the \fBeof\fR is true. If you need
to be able to process events during this calculation see the
\fBPROGRAMMING INTERFACE\fR section
.TP
-filename \fIname\fR
This is a convenience option that opens the specified file, sets the
encoding to binary and then acts as if the \fI-channel\fR option had
been used. The file is closed on completion.
.TP
-format \fIstring\fR
Return the checksum using an alternative format template.
.PP
.SH "PROGRAMMING INTERFACE"
The cksum package implements the checksum using a context variable to
which additional data can be added at any time. This is expecially
useful in an event based environment such as a Tk application or a web
server package. Data to be checksummed may be handled incrementally
during a \fBfileevent\fR handler in discrete chunks. This can improve
the interactive nature of a GUI application and can help to avoid
excessive memory consumption.
.TP
\fB::crc::CksumInit\fR
Begins a new cksum context. Returns a token ID that must be used for the
remaining functions. An optional seed may be specified if required.
.TP
\fB::crc::CksumUpdate\fR \fItoken\fR \fIdata\fR
Add data to the checksum identified by token. Calling
\fICksumUpdate $token "abcd"\fR is equivalent to calling
\fICksumUpdate $token "ab"\fR followed by
\fICksumUpdate $token "cb"\fR. See \fBEXAMPLES\fR.
.TP
\fB::crc::CksumFinal\fR \fItoken\fR
Returns the checksum value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a 32 bit integer value.
.PP
.SH EXAMPLES
.PP
.CS


% crc::cksum "Hello, World!"
2609532967

.CE
.PP
.CS


% crc::cksum -format 0x%X "Hello, World!"
0x9B8A5027

.CE
.PP
.CS


% crc::cksum -file cksum.tcl
1828321145

.CE
.PP
.CS


% set tok [crc::CksumInit]
% crc::CksumUpdate $tok "Hello, "
% crc::CksumUpdate $tok "World!"
% crc::CksumFinal $tok
2609532967

.CE
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcrc\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
crc32(n), sum(n)
.SH KEYWORDS
checksum, cksum, crc, crc32, cyclic redundancy check, data integrity, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2002, Pat Thoyts

.fi

Added embedded/man/files/modules/crc/crc16.n.


































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/crc/crc16.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Pat Thoyts
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crc16" n 1.1.2 tcllib "Cyclic Redundancy Checks"
.BS
.SH NAME
crc16 \- Perform a 16bit Cyclic Redundancy Check
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBcrc16  ?1.1.2?\fR
.sp
\fB::crc::crc16\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? \fImessage\fR
.sp
\fB::crc::crc16\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? -filename \fIfile\fR
.sp
\fB::crc::crc-ccitt\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? \fImessage\fR
.sp
\fB::crc::crc-ccitt\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? -filename \fIfile\fR
.sp
\fB::crc::xmodem\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? \fImessage\fR
.sp
\fB::crc::xmodem\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? -filename \fIfile\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a Tcl-only implementation of the CRC
algorithms based upon information provided at
http://www.microconsultants.com/tips/crc/crc.txt
There are a number of permutations available for calculating CRC
checksums and this package can handle all of them. Defaults are set up
for the most common cases.
.SH COMMANDS
.TP
\fB::crc::crc16\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? \fImessage\fR
.TP
\fB::crc::crc16\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? -filename \fIfile\fR
.TP
\fB::crc::crc-ccitt\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? \fImessage\fR
.TP
\fB::crc::crc-ccitt\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? -filename \fIfile\fR
.TP
\fB::crc::xmodem\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? \fImessage\fR
.TP
\fB::crc::xmodem\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? ?-implementation \fIprocname\fR? -filename \fIfile\fR
The command takes either string data or a file name and returns a checksum
value calculated using the CRC algorithm. The command used sets up the
CRC polynomial, initial value and bit ordering for the desired
standard checksum calculation. The result is formatted
using the \fIformat\fR(n) specifier provided or as an unsigned integer
(%u) by default.
.sp
A number of common polynomials are in use with the CRC algorithm and
the most commonly used of these are included in this package. For
convenience each of these has a command alias in the crc namespace.
.sp
It is possible to implement the CRC-32 checksum using this crc16
package as the implementation is sufficiently generic to extend to 32
bit checksums. As an example this has been done already - however this
is not the fastest method to implement this algorithm in Tcl and a
separate \fBcrc32\fR package is available.
.PP
.SH OPTIONS
.TP
-filename \fIname\fR
Return a checksum for the file contents instead of for parameter data.
.TP
-format \fIstring\fR
Return the checksum using an alternative format template.
.TP
-seed \fIvalue\fR
Select an alternative seed value for the CRC calculation. The default
is 0 for the CRC16 calculation and 0xFFFF for the CCITT version.
This can be useful for calculating the CRC for data
structures without first converting the whole structure into a
string. The CRC of the previous member can be used as the seed for
calculating the CRC of the next member. It is also used for
accumulating a checksum from fragments of a large message (or file)
.TP
-implementation \fIprocname\fR
This hook is provided to allow users to provide their own
implementation (perhaps a C compiled extension). The
procedure specfied is called with two parameters. The first is the
data to be checksummed and the second is the seed value. An
integer is expected as the result.
.sp
The package provides some implementations of standard CRC polynomials
for the XMODEM, CCITT and the usual CRC-16 checksum. For convenience,
additional commands have been provided that make use of these
implementations.
.TP
--
Terminate option processing.
.PP
.SH EXAMPLES
.PP
.CS


% crc::crc16 "Hello, World!"
64077

.CE
.PP
.CS


% crc::crc-ccitt "Hello, World!"
26586

.CE
.PP
.CS


% crc::crc16 -format 0x%X "Hello, World!"
0xFA4D

.CE
.PP
.CS


% crc::crc16 -file crc16.tcl
51675

.CE
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcrc\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
cksum(n), crc32(n), sum(n)
.SH KEYWORDS
checksum, cksum, crc, crc16, crc32, cyclic redundancy check, data integrity, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2002, Pat Thoyts

.fi

Added embedded/man/files/modules/crc/crc32.n.
































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/crc/crc32.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Pat Thoyts
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crc32" n 1.3 tcllib "Cyclic Redundancy Checks"
.BS
.SH NAME
crc32 \- Perform a 32bit Cyclic Redundancy Check
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBcrc32  ?1.3?\fR
.sp
\fB::crc::crc32\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? [ \fI-channel chan\fR | \fI-filename file\fR | \fImessage\fR ]
.sp
\fB::crc::Crc32Init\fR ?\fIseed\fR?
.sp
\fB::crc::Crc32Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::crc::Crc32Final\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a Tcl implementation of the CRC-32
algorithm based upon information provided at
http://www.naaccr.org/standard/crc32/document.html
If either the \fBcritcl\fR package or the \fBTrf\fR package
are available then a compiled version may be used internally to
accelerate the checksum calculation.
.SH COMMANDS
.TP
\fB::crc::crc32\fR ?-format \fIformat\fR? ?-seed \fIvalue\fR? [ \fI-channel chan\fR | \fI-filename file\fR | \fImessage\fR ]
The command takes either string data or a channel or file name and
returns a checksum value calculated using the CRC-32 algorithm. The
result is formatted using the \fIformat\fR(n) specifier provided. The
default is to return the value as an unsigned integer (format %u).
.PP
.SH OPTIONS
.TP
-channel \fIname\fR
Return a checksum for the data read from a channel. The command will
read data from the channel until the \fBeof\fR is true. If you need
to be able to process events during this calculation see the
\fBPROGRAMMING INTERFACE\fR section
.TP
-filename \fIname\fR
This is a convenience option that opens the specified file, sets the
encoding to binary and then acts as if the \fI-channel\fR option had
been used. The file is closed on completion.
.TP
-format \fIstring\fR
Return the checksum using an alternative format template.
.TP
-seed \fIvalue\fR
Select an alternative seed value for the CRC calculation. The default
is 0xffffffff. This can be useful for calculating the CRC for data
structures without first converting the whole structure into a
string. The CRC of the previous member can be used as the seed for
calculating the CRC of the next member.
Note that the crc32 algorithm includes a final XOR step. If
incremental processing is desired then this must be undone before
using the output of the algorithm as the seed for further
processing. A simpler alternative is to use the
\fBPROGRAMMING INTERFACE\fR which is intended for this mode of
operation.
.PP
.SH "PROGRAMMING INTERFACE"
The CRC-32 package implements the checksum using a context variable to
which additional data can be added at any time. This is expecially
useful in an event based environment such as a Tk application or a web
server package. Data to be checksummed may be handled incrementally
during a \fBfileevent\fR handler in discrete chunks. This can improve
the interactive nature of a GUI application and can help to avoid
excessive memory consumption.
.TP
\fB::crc::Crc32Init\fR ?\fIseed\fR?
Begins a new CRC32 context. Returns a token ID that must be used for the
remaining functions. An optional seed may be specified if required.
.TP
\fB::crc::Crc32Update\fR \fItoken\fR \fIdata\fR
Add data to the checksum identified by token. Calling
\fICrc32Update $token "abcd"\fR is equivalent to calling
\fICrc32Update $token "ab"\fR followed by
\fICrc32Update $token "cb"\fR. See \fBEXAMPLES\fR.
.TP
\fB::crc::Crc32Final\fR \fItoken\fR
Returns the checksum value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a 32 bit integer value.
.PP
.SH EXAMPLES
.PP
.CS


% crc::crc32 "Hello, World!"
3964322768

.CE
.PP
.CS


% crc::crc32 -format 0x%X "Hello, World!"
0xEC4AC3D0

.CE
.PP
.CS


% crc::crc32 -file crc32.tcl
483919716

.CE
.PP
.CS


% set tok [crc::Crc32Init]
% crc::Crc32Update $tok "Hello, "
% crc::Crc32Update $tok "World!"
% crc::Crc32Final $tok
3964322768

.CE
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcrc\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
cksum(n), crc16(n), sum(n)
.SH KEYWORDS
checksum, cksum, crc, crc32, cyclic redundancy check, data integrity, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2002, Pat Thoyts

.fi

Added embedded/man/files/modules/crc/sum.n.



















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/crc/sum.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "sum" n 1.1.0 tcllib "Cyclic Redundancy Checks"
.BS
.SH NAME
sum \- Calculate a sum(1) compatible checksum
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBsum  ?1.1.0?\fR
.sp
\fB::crc::sum\fR ?\fI-bsd\fR | \fI-sysv\fR? ?\fI-format fmt\fR? ?\fI-chunksize size\fR? [ \fI-filename file\fR | \fI-channel chan\fR | \fIstring\fR ]
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a Tcl-only implementation of the sum(1) command
which calculates a 16 bit checksum value from the input data.  The BSD
sum algorithm is used by default but the SysV algorithm is also
available.
.SH COMMANDS
.TP
\fB::crc::sum\fR ?\fI-bsd\fR | \fI-sysv\fR? ?\fI-format fmt\fR? ?\fI-chunksize size\fR? [ \fI-filename file\fR | \fI-channel chan\fR | \fIstring\fR ]
The command takes string data or a file name or a channel and returns
a checksum value calculated using the \fBsum(1)\fR algorithm. The
result is formatted using the \fIformat\fR(n) specifier provided or as
an unsigned integer (%u) by default.
.PP
.SH OPTIONS
.TP
-sysv
The SysV algorithm is fairly naive. The byte values are summed and any
overflow is discarded. The lowest 16 bits are returned as the
checksum.  Input with the same content but different ordering will
give the same result.
.TP
-bsd
This algorithm is similar to the SysV version but includes a bit rotation
step which provides a dependency on the order of the data values.
.TP
-filename \fIname\fR
Return a checksum for the file contents instead of for parameter data.
.TP
-channel \fIchan\fR
Return a checksum for the contents of the specified channel. The
channel must be open for reading and should be configured for binary
translation. The channel will no be closed on completion.
.TP
-chunksize \fIsize\fR
Set the block size used when reading data from either files or
channels. This value defaults to 4096.
.TP
-format \fIstring\fR
Return the checksum using an alternative format template.
.PP
.SH EXAMPLES
.PP
.CS


% crc::sum "Hello, World!"
37287

.CE
.PP
.CS


% crc::sum -format 0x%X "Hello, World!"
0x91A7

.CE
.PP
.CS


% crc::sum -file sum.tcl
13392

.CE
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcrc\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
cksum(n), crc32(n), sum(1)
.SH KEYWORDS
checksum, cksum, crc, crc32, cyclic redundancy check, data integrity, security, sum
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2002, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/csv/csv.n.




























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/csv/csv.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002-2013 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "csv" n 0.8 tcllib "CSV processing"
.BS
.SH NAME
csv \- Procedures to handle CSV data.
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBcsv  ?0.8?\fR
.sp
\fB::csv::iscomplete\fR \fIdata\fR
.sp
\fB::csv::join\fR \fIvalues\fR ?\fIsepChar\fR? ?\fIdelChar\fR? ?\fIdelMode\fR?
.sp
\fB::csv::joinlist\fR \fIvalues\fR ?\fIsepChar\fR? ?\fIdelChar\fR? ?\fIdelMode\fR?
.sp
\fB::csv::joinmatrix\fR \fImatrix\fR ?\fIsepChar\fR? ?\fIdelChar\fR? ?\fIdelMode\fR?
.sp
\fB::csv::read2matrix\fR ?\fB-alternate\fR? \fIchan m\fR {\fIsepChar\fR ,} {\fIexpand\fR none}
.sp
\fB::csv::read2queue\fR ?\fB-alternate\fR? \fIchan q\fR {\fIsepChar\fR ,}
.sp
\fB::csv::report\fR \fIcmd matrix\fR ?\fIchan\fR?
.sp
\fB::csv::split\fR ?\fB-alternate\fR? \fIline\fR ?\fIsepChar\fR? ?\fIdelChar\fR?
.sp
\fB::csv::split2matrix\fR ?\fB-alternate\fR? \fIm line\fR {\fIsepChar\fR ,} {\fIexpand\fR none}
.sp
\fB::csv::split2queue\fR ?\fB-alternate\fR? \fIq line\fR {\fIsepChar\fR ,}
.sp
\fB::csv::writematrix\fR \fIm chan\fR ?\fIsepChar\fR? ?\fIdelChar\fR?
.sp
\fB::csv::writequeue\fR \fIq chan\fR ?\fIsepChar\fR? ?\fIdelChar\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBcsv\fR package provides commands to manipulate information
in CSV \fBFORMAT\fR (CSV = Comma Separated Values).
.SH COMMANDS
.PP
The following commands are available:
.TP
\fB::csv::iscomplete\fR \fIdata\fR
A predicate checking if the argument \fIdata\fR is a complete csv
record. The result is a boolean flag indicating the completeness of
the data. The result is true if the data is complete.
.TP
\fB::csv::join\fR \fIvalues\fR ?\fIsepChar\fR? ?\fIdelChar\fR? ?\fIdelMode\fR?
Takes a list of values and returns a string in CSV format containing
these values. The separator character can be defined by the caller,
but this is optional. The default is ",". The quoting aka delimiting character can
be defined by the caller, but this is optional. The default is '"'.
By default the quoting mode \fIdelMode\fR is "auto", surrounding
values with \fIdelChar\fR only when needed. When set to "always"
however, values are always surrounded by the \fIdelChar\fR instead.
.TP
\fB::csv::joinlist\fR \fIvalues\fR ?\fIsepChar\fR? ?\fIdelChar\fR? ?\fIdelMode\fR?
Takes a list of lists of values and returns a string in CSV format
containing these values. The separator character can be defined by the
caller, but this is optional. The default is ",". The quoting character
can be defined by the caller, but this is optional. The default is '"'.
By default the quoting mode \fIdelMode\fR is "auto", surrounding
values with \fIdelChar\fR only when needed. When set to "always"
however, values are always surrounded by the \fIdelChar\fR instead.
Each element of the outer list is considered a record, these are
separated by newlines in the result. The elements of each record are
formatted as usual (via \fB::csv::join\fR).
.TP
\fB::csv::joinmatrix\fR \fImatrix\fR ?\fIsepChar\fR? ?\fIdelChar\fR? ?\fIdelMode\fR?
Takes a \fImatrix\fR object following the API specified for the
struct::matrix package and returns a string in CSV format containing
these values. The separator character can be defined by the caller,
but this is optional. The default is ",". The quoting character
can be defined by the caller, but this is optional. The default is
\'"'.
By default the quoting mode \fIdelMode\fR is "auto", surrounding
values with \fIdelChar\fR only when needed. When set to "always"
however, values are always surrounded by the \fIdelChar\fR instead.
Each row of the matrix is considered a record, these are
separated by newlines in the result. The elements of each record are
formatted as usual (via \fB::csv::join\fR).
.TP
\fB::csv::read2matrix\fR ?\fB-alternate\fR? \fIchan m\fR {\fIsepChar\fR ,} {\fIexpand\fR none}
A wrapper around \fB::csv::split2matrix\fR (see below) reading
CSV-formatted lines from the specified channel (until EOF) and adding
them to the given matrix. For an explanation of the \fIexpand\fR
argument see \fB::csv::split2matrix\fR.
.TP
\fB::csv::read2queue\fR ?\fB-alternate\fR? \fIchan q\fR {\fIsepChar\fR ,}
A wrapper around \fB::csv::split2queue\fR (see below) reading
CSV-formatted lines from the specified channel (until EOF) and adding
them to the given queue.
.TP
\fB::csv::report\fR \fIcmd matrix\fR ?\fIchan\fR?
A report command which can be used by the matrix methods
\fBformat 2string\fR and \fBformat 2chan\fR. For the latter this
command delegates the work to \fB::csv::writematrix\fR. \fIcmd\fR is
expected to be either \fBprintmatrix\fR or
\fBprintmatrix2channel\fR. The channel argument, \fIchan\fR, has
to be present for the latter and must not be present for the first.
.TP
\fB::csv::split\fR ?\fB-alternate\fR? \fIline\fR ?\fIsepChar\fR? ?\fIdelChar\fR?
converts a \fIline\fR in CSV format into a list of the values
contained in the line. The character used to separate the values from
each other can be defined by the caller, via \fIsepChar\fR, but this
is optional. The default is ",". The quoting character can be defined
by the caller, but this is optional. The default is '"'.
.sp
If the option \fB-alternate\fR is specified a slightly different
syntax is used to parse the input. This syntax is explained below, in
the section \fBFORMAT\fR.
.TP
\fB::csv::split2matrix\fR ?\fB-alternate\fR? \fIm line\fR {\fIsepChar\fR ,} {\fIexpand\fR none}
The same as \fB::csv::split\fR, but appends the resulting list as a
new row to the matrix \fIm\fR, using the method \fBadd row\fR. The
expansion mode specified via \fIexpand\fR determines how the command
handles a matrix with less columns than contained in \fIline\fR. The
allowed modes are:
.RS
.TP
\fBnone\fR
This is the default mode. In this mode it is the responsibility of the
caller to ensure that the matrix has enough columns to contain the
full line. If there are not enough columns the list of values is
silently truncated at the end to fit.
.TP
\fBempty\fR
In this mode the command expands an empty matrix to hold all columns
of the specified line, but goes no further. The overall effect is that
the first of a series of lines determines the number of columns in the
matrix and all following lines are truncated to that size, as if mode
\fBnone\fR was set.
.TP
\fBauto\fR
In this mode the command expands the matrix as needed to hold all
columns contained in \fIline\fR. The overall effect is that after
adding a series of lines the matrix will have enough columns to hold
all columns of the longest line encountered so far.
.RE
.TP
\fB::csv::split2queue\fR ?\fB-alternate\fR? \fIq line\fR {\fIsepChar\fR ,}
The same as \fB::csv::split\fR, but appending the resulting list as a
single item to the queue \fIq\fR, using the method \fBput\fR.
.TP
\fB::csv::writematrix\fR \fIm chan\fR ?\fIsepChar\fR? ?\fIdelChar\fR?
A wrapper around \fB::csv::join\fR taking all rows in the matrix
\fIm\fR and writing them CSV formatted into the channel \fIchan\fR.
.TP
\fB::csv::writequeue\fR \fIq chan\fR ?\fIsepChar\fR? ?\fIdelChar\fR?
A wrapper around \fB::csv::join\fR taking all items in the queue
\fIq\fR (assumes that they are lists) and writing them CSV formatted
into the channel \fIchan\fR.
.PP
.SH FORMAT
.PP
The format of regular CSV files is specified as
.IP [1]
Each record of a csv file (comma-separated values, as exported e.g. by
Excel) is a set of ASCII values separated by ",". For other languages
it may be ";" however, although this is not important for this case as
the functions provided here allow any separator character.
.IP [2]
If and only if a value contains itself the separator ",", then it (the
value) has to be put between "". If the value does not contain the
separator character then quoting is optional.
.IP [3]
If a value contains the character ", that character is represented by "".
.IP [4]
The output string "" represents the value ". In other words, it is
assumed that it was created through rule 3, and only this rule,
i.e. that the value was not quoted.
.PP
.PP
An alternate format definition mainly used by MS products specifies
that the output string "" is a representation of the empty
string. In other words, it is assumed that the output was generated
out of the empty string by quoting it (i.e. rule 2), and not through
rule 3. This is the only difference between the regular and the
alternate format.
.PP
The alternate format is activated through specification of the option
\fB-alternate\fR to the various split commands.
.SH EXAMPLE
Using the regular format the record
.PP
.CS


123,"123,521.2","Mary says ""Hello, I am Mary""",""

.CE
.PP
is parsed into the items
.PP
.CS


a) 123
b) 123,521.2
c) Mary says "Hello, I am Mary"
d) "

.CE
.PP
Using the alternate format the result is
.PP
.CS


a) 123
b) 123,521.2
c) Mary says "Hello, I am Mary"
d) (the empty string)

.CE
instead. As can be seen only item (d) is different, now the empty string
instead of a ".
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIcsv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
matrix, queue
.SH KEYWORDS
csv, matrix, package, queue, tcllib
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) 2002-2013 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/des/des.n.




































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/des/des.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "des" n 1.1 tcllib "Data Encryption Standard (DES)"
.BS
.SH NAME
des \- Implementation of the DES and triple-DES ciphers
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBdes  1.1\fR
.sp
\fB::DES::des\fR ?\fI-mode [ecb|cbc|cfb|ofb]\fR? ?\fI-dir [encrypt|decrypt]\fR? \fI-key keydata\fR ?\fI-iv vector\fR? ?\fI-hex\fR? ?\fI-weak\fR? ?\fI-out channel\fR? ?\fI-chunksize size\fR? [ \fI-in channel\fR | \fIdata\fR ]
.sp
\fB::DES::Init\fR \fImode\fR \fIkeydata\fR \fIiv\fR ?\fIweak\fR?
.sp
\fB::DES::Encrypt\fR \fIKey\fR \fIdata\fR
.sp
\fB::DES::Decrypt\fR \fIKey\fR \fIdata\fR
.sp
\fB::DES::Reset\fR \fIKey\fR \fIiv\fR
.sp
\fB::DES::Final\fR \fIKey\fR
.sp
.BE
.SH DESCRIPTION
.PP
This is an implementation in Tcl of the Data Encryption Standard (DES)
as published by the U.S. National Institute of Standards and
Technology (NIST) [1]. This implementation also supports triple
DES (3DES) extension to DES. DES is a 64-bit block cipher that uses a
56-bit key. 3DES uses a 168-bit key. DES has now officially been
superceeded by AES but is in common use in many protocols.
.PP
The tcllib implementation of DES and 3DES uses an implementation by
Mac Cody and is available as a separate download from [2]. For
anyone concerned about the details of exporting this code please see
the TclDES web pages. The tcllib specific code is a wrapper to the
TclDES API that presents same API for the DES cipher as for other
ciphers in the library.
.SH COMMANDS
.TP
\fB::DES::des\fR ?\fI-mode [ecb|cbc|cfb|ofb]\fR? ?\fI-dir [encrypt|decrypt]\fR? \fI-key keydata\fR ?\fI-iv vector\fR? ?\fI-hex\fR? ?\fI-weak\fR? ?\fI-out channel\fR? ?\fI-chunksize size\fR? [ \fI-in channel\fR | \fIdata\fR ]
Perform the \fBDES\fR algorithm on either the data provided
by the argument or on the data read from the \fI-in\fR channel. If
an \fI-out\fR channel is given then the result will be written to
this channel.
.sp
The \fI-key\fR option must be given. This parameter takes a binary
string of 8 bytes in length and is used to generate the key schedule.
In DES only 56 bits of key data are used. The highest bit from each
byte is discarded.
.sp
The \fI-mode\fR and \fI-dir\fR options are optional and default to cbc
mode and encrypt respectively. The initialization vector \fI-iv\fR
takes an 8 byte binary argument. This defaults to all zeros. See
\fBMODES OF OPERATION\fR for more about \fI-mode\fR and the use
of the initialization vector.
.sp
DES is a 64-bit block cipher. This means that the data must be
provided in units that are a multiple of 8 bytes.
.PP
.SH "PROGRAMMING INTERFACE"
Internal state is maintained in an opaque structure that is returned
from the \fBInit\fR function. In ECB mode the state is not affected by
the input but for other modes some input dependent state is maintained
and may be reset by calling the \fBReset\fR function with a new
initialization vector value.
.TP
\fB::DES::Init\fR \fImode\fR \fIkeydata\fR \fIiv\fR ?\fIweak\fR?
Construct a new DES key schedule using the specified key data and the
given initialization vector. The initialization vector is not used
with ECB mode but is important for other usage modes.
See \fBMODES OF OPERATION\fR.
.sp
There are a small number of keys that are known to be weak when used
with DES. By default if such a key is passed in then an error will be
raised. If there is a need to accept such keys then the \fIweak\fR
parameter can be set true to avoid the error being thrown.
.TP
\fB::DES::Encrypt\fR \fIKey\fR \fIdata\fR
Use a prepared key acquired by calling \fBInit\fR to encrypt the
provided data. The data argument should be a binary array that is a
multiple of the DES block size of 8 bytes. The result is a binary
array the same size as the input of encrypted data.
.TP
\fB::DES::Decrypt\fR \fIKey\fR \fIdata\fR
Decipher data using the key. Note that the same key may be used to
encrypt and decrypt data provided that the initialization vector is
reset appropriately for CBC mode.
.TP
\fB::DES::Reset\fR \fIKey\fR \fIiv\fR
Reset the initialization vector. This permits the programmer to re-use
a key and avoid the cost of re-generating the key schedule where the
same key data is being used multiple times.
.TP
\fB::DES::Final\fR \fIKey\fR
This should be called to clean up resources associated with \fIKey\fR.
Once this function has been called the key may not be used again.
.PP
.SH "MODES OF OPERATION"
.TP
Electronic Code Book (ECB)
ECB is the basic mode of all block ciphers. Each block is encrypted
independently and so identical plain text will produce identical
output when encrypted with the same key. Any encryption errors will
only affect a single block however this is vulnerable to known
plaintext attacks.
.TP
Cipher Block Chaining (CBC)
CBC mode uses the output of the last block encryption to affect the
current block. An initialization vector of the same size as the cipher
block size is used to handle the first block. The initialization
vector should be chosen randomly and transmitted as the first block of
the output. Errors in encryption affect the current block and the next
block after which the cipher will correct itself. CBC is the most
commonly used mode in software encryption.
.TP
Cipher Feedback (CFB)
CFB mode can be used to convert block ciphers into stream ciphers. In
CFB mode the initialization vector is encrypted and the output is then
xor'd with the plaintext stream. The result is then used as the
initialization vector for the next round. Errors will affect the
current block and the next block.
.TP
Output Feedback (OFB)
OFB is similar to CFB except that the output of the cipher is fed back
into the next round and not the xor'd plain text. This means that
errors only affect a single block but the cipher is more vulnerable to
attack.
.PP
.SH EXAMPLES
.CS


% set ciphertext [DES::des -mode cbc -dir encrypt -key $secret $plaintext]
% set plaintext [DES::des -mode cbc -dir decrypt -key $secret $ciphertext]

.CE
.CS


set iv [string repeat \\\\0 8]
set Key [DES::Init cbc \\\\0\\\\1\\\\2\\\\3\\\\4\\\\5\\\\6\\\\7 $iv]
set ciphertext [DES::Encrypt $Key "somedata"]
append ciphertext [DES::Encrypt $Key "moredata"]
DES::Reset $Key $iv
set plaintext [DES::Decrypt $Key $ciphertext]
DES::Final $Key

.CE
.SH REFERENCES
.IP [1]
"Data Encryption Standard",
Federal Information Processing Standards Publication 46-3, 1999,
(\fIhttp://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\fR)
.IP [2]
"TclDES: munitions-grade Tcl scripting"
\fIhttp://tcldes.sourceforge.net/\fR
.PP
.SH AUTHORS
Jochen C Loewer,
Mac Cody,
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdes\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
aes(n), blowfish(n), md5(n), rc4(n), sha1(n)
.SH KEYWORDS
3DES, DES, block cipher, data integrity, encryption, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2005, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/dns/tcllib_dns.n.


























































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/dns/tcllib_dns.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Pat Thoyts
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "dns" n 1.3.3 tcllib "Domain Name Service"
.BS
.SH NAME
dns \- Tcl Domain Name Service Client
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBdns  ?1.3.3?\fR
.sp
\fB::dns::resolve\fR \fIquery\fR ?\fIoptions\fR?
.sp
\fB::dns::configure\fR ?\fIoptions\fR?
.sp
\fB::dns::name\fR \fItoken\fR
.sp
\fB::dns::address\fR \fItoken\fR
.sp
\fB::dns::cname\fR \fItoken\fR
.sp
\fB::dns::result\fR \fItoken\fR
.sp
\fB::dns::status\fR \fItoken\fR
.sp
\fB::dns::error\fR \fItoken\fR
.sp
\fB::dns::reset\fR \fItoken\fR
.sp
\fB::dns::wait\fR \fItoken\fR
.sp
\fB::dns::cleanup\fR \fItoken\fR
.sp
\fB::dns::nameservers\fR
.sp
.BE
.SH DESCRIPTION
.PP
The dns package provides a Tcl only Domain Name Service client. You
should refer to (1) and (2) for information about the DNS protocol or
read resolver(3) to find out how the C library resolves domain names.
The intention of this package is to insulate Tcl scripts
from problems with using the system library resolver for slow name servers.
It may or may not be of practical use. Internet name resolution is a
complex business and DNS is only one part of the resolver. You may
find you are supposed to be using hosts files, NIS or WINS to name a
few other systems. This package is not a substitute for the C library
resolver - it does however implement name resolution over DNS.
The package also extends the package \fBuri\fR to support DNS URIs
(4) of the form \fIdns:what.host.com\fR or
\fIdns://my.nameserver/what.host.com\fR. The \fBdns::resolve\fR
command can handle DNS URIs or simple domain names as a query.
.PP
\fINote:\fR The package defaults to using DNS over TCP
connections. If you wish to use UDP you will need to have the
\fBtcludp\fR package installed and have a version that
correctly handles binary data (> 1.0.4).
This is available at \fIhttp://tcludp.sourceforge.net/\fR.
If the \fBudp\fR package is present then UDP will be used by default.
.SH COMMANDS
.TP
\fB::dns::resolve\fR \fIquery\fR ?\fIoptions\fR?
Resolve a domain name using the \fIDNS\fR protocol. \fIquery\fR is
the domain name to be lookup up. This should be either a fully
qualified domain name or a DNS URI.
.RS
.TP
\fB-nameserver\fR \fIhostname\fR or \fB-server\fR \fIhostname\fR
Specify an alternative name server for this request.
.TP
\fB-protocol\fR \fItcp|udp\fR
Specify the network protocol to use for this request. Can be one of
\fItcp\fR or \fIudp\fR.
.TP
\fB-port\fR \fIportnum\fR
Specify an alternative port.
.TP
\fB-search\fR \fIdomainlist\fR
.TP
\fB-timeout\fR \fImilliseconds\fR
Override the default timeout.
.TP
\fB-type\fR \fITYPE\fR
Specify the type of DNS record you are interested in. Valid values
are A, NS, MD, MF, CNAME, SOA, MB, MG, MR, NULL, WKS, PTR, HINFO,
MINFO, MX, TXT, SPF, SRV, AAAA, AXFR, MAILB, MAILA and *.
See RFC1035 for details about the return values.
See \fIhttp://spf.pobox.com/\fR about SPF.
See (3) about AAAA records and RFC2782 for details of SRV records.
.TP
\fB-class\fR \fICLASS\fR
Specify the class of domain name. This is usually IN but may be one
of IN for internet domain names, CS, CH, HS or * for any class.
.TP
\fB-recurse\fR \fIboolean\fR
Set to \fIfalse\fR if you do not want the name server to recursively
act upon your request. Normally set to \fItrue\fR.
.TP
\fB-command\fR \fIprocname\fR
Set a procedure to be called upon request completion. The procedure
will be passed the token as its only argument.
.RE
.sp
.TP
\fB::dns::configure\fR ?\fIoptions\fR?
The \fB::dns::configure\fR command is used to setup the dns
package. The server to query, the protocol and domain search path are
all set via this command. If no arguments are provided then a list of
all the current settings is returned.  If only one argument then it
must the the name of an option and the value for that option is
returned.
.RS
.TP
\fB-nameserver\fR \fIhostname\fR
Set the default name server to be used by all queries. The default is
\fIlocalhost\fR.
.TP
\fB-protocol\fR \fItcp|udp\fR
Set the default network protocol to be used. Default is \fItcp\fR.
.TP
\fB-port\fR \fIportnum\fR
Set the default port to use on the name server. The default is 53.
.TP
\fB-search\fR \fIdomainlist\fR
Set the domain search list. This is currently not used.
.TP
\fB-timeout\fR \fImilliseconds\fR
Set the default timeout value for DNS lookups. Default is 30 seconds.
.TP
\fB-loglevel\fR \fIlevel\fR
Set the log level used for emitting diagnostic messages from this
package. The default is \fIwarn\fR. See the \fBlog\fR package
for details of the available levels.
.RE
.sp
.TP
\fB::dns::name\fR \fItoken\fR
Returns a list of all domain names returned as an answer to your query.
.sp
.TP
\fB::dns::address\fR \fItoken\fR
Returns a list of the address records that match your query.
.sp
.TP
\fB::dns::cname\fR \fItoken\fR
Returns a list of canonical names (usually just one) matching your query.
.sp
.TP
\fB::dns::result\fR \fItoken\fR
Returns a list of all the decoded answer records provided for your
query. This permits you to extract the result for more unusual query types.
.sp
.TP
\fB::dns::status\fR \fItoken\fR
Returns the status flag. For a successfully completed query this will be
\fIok\fR. May be \fIerror\fR or \fItimeout\fR or \fIeof\fR.
See also \fB::dns::error\fR
.sp
.TP
\fB::dns::error\fR \fItoken\fR
Returns the error message provided for requests whose status is \fIerror\fR.
If there is no error message then an empty string is returned.
.sp
.TP
\fB::dns::reset\fR \fItoken\fR
Reset or cancel a DNS query.
.sp
.TP
\fB::dns::wait\fR \fItoken\fR
Wait for a DNS query to complete and return the status upon completion.
.sp
.TP
\fB::dns::cleanup\fR \fItoken\fR
Remove all state variables associated with the request.
.sp
.TP
\fB::dns::nameservers\fR
Attempts to return a list of the nameservers currently configured
for the users system. On a unix machine this parses the
/etc/resolv.conf file for nameservers (if it exists) and on Windows
systems we examine certain parts of the registry. If no nameserver can
be found then the loopback address (127.0.0.1) is used as a default.
.PP
.SH EXAMPLES
.PP
.CS


% set tok [dns::resolve www.tcl.tk]
::dns::1
% dns::status $tok
ok
% dns::address $tok
199.175.6.239
% dns::name $tok
www.tcl.tk
% dns::cleanup $tok

.CE
.PP
Using DNS URIs as queries:
.CS


% set tok [dns::resolve "dns:tcl.tk;type=MX"]
% set tok [dns::resolve "dns://l.root-servers.net/www.tcl.tk"]

.CE
.PP
Reverse address lookup:
.CS


% set tok [dns::resolve 127.0.0.1]
::dns::1
% dns::name $tok
localhost
% dns::cleanup $tok

.CE
.SH REFERENCES
.IP [1]
Mockapetris, P., "Domain Names - Concepts and Facilities",
RFC 1034, November 1987.
(\fIhttp://www.ietf.org/rfc/rfc1034.txt\fR)
.IP [2]
Mockapetris, P., "Domain Names - Implementation and Specification",
RFC 1035, November 1087.
(\fIhttp://www.ietf.org/rfc/rfc1035.txt\fR)
.IP [3]
Thompson, S. and Huitema, C., "DNS Extensions to support IP version 6",
RFC 1886, December 1995.
(\fIhttp://www.ietf.org/rfc/rfc1886.txt\fR)
.IP [4]
Josefsson, S., "Domain Name System Uniform Resource Identifiers",
Internet-Draft, October 2003,
(\fIhttp://www.ietf.org/internet-drafts/draft-josefsson-dns-url-09.txt\fR)
.IP [5]
Gulbrandsen, A., Vixie, P. and Esibov, L.,
"A DNS RR for specifying the location of services (DNS SRV)",
RFC 2782, February 2000,
(\fIhttp://www.ietf.org/rfc/rfc2782.txt\fR)
.IP [6]
Ohta, M. "Incremental Zone Transfer in DNS",
RFC 1995, August 1996,
(\fIhttp://www.ietf.org/rfc/rfc1995.txt\fR)
.PP
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdns\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
resolver(5)
.SH KEYWORDS
DNS, domain name service, resolver, rfc 1034, rfc 1035, rfc 1886
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2002, Pat Thoyts

.fi

Added embedded/man/files/modules/dns/tcllib_ip.n.






















































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/dns/tcllib_ip.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004, Pat Thoyts
'\" Copyright (c) 2005 Aamer Akhter <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcllib_ip" n 1.3 tcllib "Domain Name Service"
.BS
.SH NAME
tcllib_ip \- IPv4 and IPv6 address manipulation
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBip  ?1.2?\fR
.sp
\fB::ip::version\fR \fIaddress\fR
.sp
\fB::ip::is\fR \fIclass\fR \fIaddress\fR
.sp
\fB::ip::equal\fR \fIaddress\fR \fIaddress\fR
.sp
\fB::ip::normalize\fR \fIaddress\fR
.sp
\fB::ip::contract\fR \fIaddress\fR
.sp
\fB::ip::prefix\fR \fIaddress\fR
.sp
\fB::ip::type\fR \fIaddress\fR
.sp
\fB::ip::mask\fR \fIaddress\fR
.sp
\fB::ip::prefixToNative\fR \fIprefix\fR
.sp
\fB::ip::nativeToPrefix\fR \fInativeList\fR|\fInative\fR ?\fB-ipv4\fR?
.sp
\fB::ip::intToString\fR \fInumber\fR ?\fB-ipv4\fR?
.sp
\fB::ip::toInteger\fR \fIipaddr\fR
.sp
\fB::ip::toHex\fR \fIipaddr\fR
.sp
\fB::ip::maskToInt\fR \fIipmask\fR
.sp
\fB::ip::broadcastAddress\fR \fIprefix\fR ?\fB-ipv4\fR?
.sp
\fB::ip::maskToLength\fR \fIdottedMask\fR|\fIintegerMask\fR|\fIhexMask\fR ?\fB-ipv4\fR?
.sp
\fB::ip::lengthToMask\fR \fImaskLength\fR ?\fB-ipv4\fR?
.sp
\fB::ip::nextNet\fR \fIipaddr\fR \fIipmask\fR ?\fIcount\fR? ?\fB-ipv4\fR?
.sp
\fB::ip::isOverlap\fR \fIprefix\fR \fIprefix\fR...
.sp
\fB::ip::isOverlapNative\fR ?\fB-all\fR? ?\fB-inline\fR? ?\fB-ipv4\fR? \fIhexipaddr\fR \fIhexipmask\fR \fIhexiplist\fR
.sp
\fB::ip::ipToLayer2Multicast\fR \fIipaddr\fR
.sp
\fB::ip::ipHostFromPrefix\fR \fIprefix\fR ?\fB-exclude\fR \fIprefixExcludeList\fR?
.sp
\fB::ip::reduceToAggregates\fR \fIprefixlist\fR
.sp
\fB::ip::longestPrefixMatch\fR \fIipaddr\fR \fIprefixlist\fR ?\fB-ipv4\fR?
.sp
\fB::ip::collapse\fR \fIprefixlist\fR
.sp
\fB::ip::subtract\fR \fIprefixlist\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a set of commands to help in parsing, displaying
and comparing internet addresses. The package can handle both IPv4 (1)
and IPv6 (2) address types.
.SH COMMANDS
.TP
\fB::ip::version\fR \fIaddress\fR
Returns the protocol version of the address (4 or 6) or 0 if the
address is neither IPv4 or IPv6.
.TP
\fB::ip::is\fR \fIclass\fR \fIaddress\fR
Returns true if the address is a member of the given protocol
class. The class parameter may be either \fIipv4\fR or \fIipv6\fR
This is effectively a boolean equivalent of the \fBversion\fR
command. The \fIclass\fR argument may be shortened to \fI4\fR or
\fI6\fR.
.TP
\fB::ip::equal\fR \fIaddress\fR \fIaddress\fR
Compare two address specifications for equivalence. The arguments are
normalized and the address prefix determined (if a mask is
supplied). The normalized addresses are then compared bit-by-bit and
the procedure returns true if they match.
.TP
\fB::ip::normalize\fR \fIaddress\fR
Convert an IPv4 or IPv6 address into a fully expanded version. There
are various shorthand ways to write internet addresses, missing out
redundant parts or digts.. This procedure is the opposite of
\fBcontract\fR.
.TP
\fB::ip::contract\fR \fIaddress\fR
Convert a \fBnormalize\fRd internet address into a more compact form
suitable for displaying to users.
.TP
\fB::ip::prefix\fR \fIaddress\fR
Returns the address prefix generated by masking the address part with
the mask if provided. If there is no mask then it is equivalent to
calling \fBnormalize\fR
.TP
\fB::ip::type\fR \fIaddress\fR
.TP
\fB::ip::mask\fR \fIaddress\fR
If the address supplied includes a mask then this is returned
otherwise returns an empty string.
.TP
\fB::ip::prefixToNative\fR \fIprefix\fR
This command converts the string \fIprefix\fR from dotted form
(<ipaddr>/<mask> format) to native (hex) form. Returns a list
containing two elements, ipaddress and mask, in this order, in
hexadecimal notation.
.sp
.CS


   % ip::prefixToNative 1.1.1.0/24
   0x01010100 0xffffff00

.CE
.TP
\fB::ip::nativeToPrefix\fR \fInativeList\fR|\fInative\fR ?\fB-ipv4\fR?
This command converts from native (hex) form to dotted form.
It is the complement of \fB::ip::prefixToNative\fR.
.sp
.RS
.TP
list \fInativeList\fR (in)
List of several ip addresses in native form. The native form is a list
as returned by \fB::ip::prefixToNative\fR.
.TP
list \fInative\fR (in)
A list as returned by \fB::ip::prefixToNative\fR.
.RE
.sp
The command returns a list of addresses in dotted form if it was
called with a list of addresses. Otherwise a single address in dotted
form is returned.
.sp
.CS


   % ip::nativeToPrefix {0x01010100 0xffffff00} -ipv4
   1.1.1.0/24

.CE
.TP
\fB::ip::intToString\fR \fInumber\fR ?\fB-ipv4\fR?
This command converts from an ip address specified as integer number
to dotted form.
.sp
.CS


       ip::intToString 4294967295
       255.255.255.255

.CE
.TP
\fB::ip::toInteger\fR \fIipaddr\fR
This command converts a dotted form ip into an integer number.
.sp
.CS


   % ::ip::toInteger 1.1.1.0
   16843008

.CE
.TP
\fB::ip::toHex\fR \fIipaddr\fR
This command converts dotted form ip into a hexadecimal number.
.sp
.CS


   % ::ip::toHex 1.1.1.0
   0x01010100

.CE
.TP
\fB::ip::maskToInt\fR \fIipmask\fR
This command convert an ipmask in either dotted (255.255.255.0) form
or mask length form (24) into an integer number.
.sp
.CS


   ::ip::maskToInt 24
   4294967040

.CE
.TP
\fB::ip::broadcastAddress\fR \fIprefix\fR ?\fB-ipv4\fR?
This commands returns a broadcast address in dotted form for the given
route \fIprefix\fR, either in the form "addr/mask", or in native
form. The result is in dotted form.
.sp
.CS


   ::ip::broadcastAddress 1.1.1.0/24
   1.1.1.255

   ::ip::broadcastAddress {0x01010100 0xffffff00}
   0x010101ff

.CE
.TP
\fB::ip::maskToLength\fR \fIdottedMask\fR|\fIintegerMask\fR|\fIhexMask\fR ?\fB-ipv4\fR?
This command converts the dotted or integer form of an ipmask to
the mask length form.
.sp
.CS


   ::ip::maskToLength 0xffffff00 -ipv4
   24

   % ::ip::maskToLength 255.255.255.0
   24

.CE
.TP
\fB::ip::lengthToMask\fR \fImaskLength\fR ?\fB-ipv4\fR?
This command converts an ipmask in mask length form to its dotted
form.
.sp
.CS


   ::ip::lengthToMask 24
   255.255.255.0

.CE
.TP
\fB::ip::nextNet\fR \fIipaddr\fR \fIipmask\fR ?\fIcount\fR? ?\fB-ipv4\fR?
This command returns an ipaddress in the same position in the
\fIcount\fR next network. The default value for \fIcount\fR is
\fB1\fR.
.sp
The address can be specified as either integer number or in dotted
form. The mask can be specified as either integer number, dotted form,
or mask length form.
.sp
The result is in hex form.
.TP
\fB::ip::isOverlap\fR \fIprefix\fR \fIprefix\fR...
This command checks if the given ip prefixes overlap.  All arguments
are in dotted "addr/mask" form. All arguments after the first prefix
are compared against the first prefix. The result is a boolean
value. It is true if an overlap was found for any of the prefixes.
.sp
.CS


  % ::ip::isOverlap 1.1.1.0/24 2.1.0.1/32
  0

  ::ip::isOverlap 1.1.1.0/24 2.1.0.1/32 1.1.1.1/32
  1

.CE
.TP
\fB::ip::isOverlapNative\fR ?\fB-all\fR? ?\fB-inline\fR? ?\fB-ipv4\fR? \fIhexipaddr\fR \fIhexipmask\fR \fIhexiplist\fR
This command is similar to \fB::ip::isOverlap\fR, however the
arguments are in the native form, and the form of the result is under
greater control of the caller.
If the option \fB-all\fR is specified it checks all addresses for
overlap, not only until the first one is found.
If the option \fB-inline\fR is specified the command returns the
overlapping prefix instead of index values.
.sp
The result of the command is, depending on the specified options,
.RS
.TP
no options
The index of the first overlap found, or 0 if there is none.
.TP
-all
A list containing the indices of all overlaps found, or an empty list
if there are none.
.TP
-inline
The first overlapping prefix, or an empoty string if there is none.
.TP
-all -inline
A list containing the prefixes of all overlaps found, or an empty list
if there are none.
.RE
.sp
.CS


  % ::ip::isOverlapNative 0x01010100 0xffffff00 {{0x02010001 0xffffffff}}
  0

  % ::ip::isOverlapNative 0x01010100 0xffffff00 {{0x02010001 0xffffffff} {0x01010101 0xffffffff}}
  2

.CE
.TP
\fB::ip::ipToLayer2Multicast\fR \fIipaddr\fR
This command an converts ipv4 address in dotted form into a layer 2
multicast address, also in dotted form.
.sp
.CS


  % ::ip::ipToLayer2Multicast 224.0.0.2
  01.00.5e.00.00.02

.CE
.TP
\fB::ip::ipHostFromPrefix\fR \fIprefix\fR ?\fB-exclude\fR \fIprefixExcludeList\fR?
This command returns a host address from a prefix in the form
"ipaddr/masklen", also making sure that the result is not an address
found in the \fIprefixExcludeList\fR.
The result is an ip address in dotted form.
.sp
.CS


  %::ip::ipHostFromPrefix  1.1.1.5/24
  1.1.1.1

  %::ip::ipHostFromPrefix  1.1.1.1/32
  1.1.1.1

.CE
.TP
\fB::ip::reduceToAggregates\fR \fIprefixlist\fR
This command finds nets that overlap and filters out the more specific
nets. The prefixes are in either addr/mask form or in native format.
The result is a list containing the non-overlapping ip prefixes from
the input.
.sp
.CS


  % ::ip::reduceToAggregates {1.1.1.0/24 1.1.0.0/8  2.1.1.0/24 1.1.1.1/32 }
  1.0.0.0/8 2.1.1.0/24

.CE
.TP
\fB::ip::longestPrefixMatch\fR \fIipaddr\fR \fIprefixlist\fR ?\fB-ipv4\fR?
This command finds longest prefix match from set of prefixes, given a
specific host address. The prefixes in the list are in either native
or dotted form, whereas the host address is in either ipprefix format,
dotted form, or integer form.
The result is the prefix which is the most specific match to the host
address.
.sp
.CS


  % ::ip::longestPrefixMatch 1.1.1.1 {1.1.1.0/24 1.0.0.0/8  2.1.1.0/24 1.1.1.0/28 }
  1.1.1.0/28

.CE
.TP
\fB::ip::collapse\fR \fIprefixlist\fR
This commands takes a list of prefixes and returns a list prefixes
with the largest possible subnet masks covering the input, in this
manner collapsing adjacent prefixes into larger ranges.
.sp
This is different from \fB::ip::reduceToAggregates\fR in that
the latter only removes specific nets from a list when they are
covered by other elements of the input whereas this command actively
merges nets into larger ranges when they are adjacent to each other.
.sp
.CS


% ::ip::collapse {1.2.2.0/24 1.2.3.0/24}
1.2.2.0/23

.CE
.TP
\fB::ip::subtract\fR \fIprefixlist\fR
This command takes a list of prefixes, some of which are prefixed by a
dash. These latter \fInegative\fR prefixes are used to punch holes
into the ranges described by the other, \fIpositive\fR,
prefixes. I.e. the negative prefixes are subtracted frrom the positive
ones, resulting in a larger list of describes describing the covered
ranges only as positives.
.PP
.SH EXAMPLES
.PP
.CS


% ip::version ::1
6
% ip::version 127.0.0.1
4

.CE
.CS


% ip::normalize 127/8
127.0.0.0/8
% ip::contract 192.168.0.0
192.168
%
% ip::normalize fec0::1
fec0:0000:0000:0000:0000:0000:0000:0001
% ip::contract fec0:0000:0000:0000:0000:0000:0000:0001
fec0::1

.CE
.CS


% ip::equal 192.168.0.4/16 192.168.0.0/16
1
% ip::equal fec0::1/10 fec0::fe01/10
1

.CE
.SH REFERENCES
.IP [1]
Postel, J. "Internet Protocol." RFC 791,  September 1981,
(\fIhttp://www.ietf.org/rfc/rfc791.txt\fR)
.IP [2]
Hinden, R. and Deering, S.,
"Internet Protocol Version 6 (IPv6) Addressing Architecture",
RFC 3513, April 2003
(\fIhttp://www.ietf.org/rfc/rfc3513.txt\fR)
.PP
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdns\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
inet(3), ip(7), ipv6(7)
.SH KEYWORDS
internet address, ip, ipv4, ipv6, rfc 3513
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2004, Pat Thoyts
Copyright (c) 2005 Aamer Akhter <[email protected]>

.fi

Added embedded/man/files/modules/docstrip/docstrip.n.





















































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/docstrip/docstrip.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003–2010 Lars Hellström <Lars dot Hellstrom at residenset dot net>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "docstrip" n 1.2 tcllib "Literate programming tool"
.BS
.SH NAME
docstrip \- Docstrip style source code extraction
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdocstrip  ?1.2?\fR
.sp
\fBdocstrip::extract\fR \fItext\fR \fIterminals\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
\fBdocstrip::sourcefrom\fR \fIfilename\fR \fIterminals\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
.BE
.SH DESCRIPTION
\fBDocstrip\fR is a tool created to support a brand of Literate
Programming. It is most common in the (La)TeX community, where it
is being used for pretty much everything from the LaTeX core and up,
but there is nothing about \fBdocstrip\fR which prevents using it
for other types of software.
.PP
In short, the basic principle of literate programming is that program
source should primarily be written and structured to suit the
developers (and advanced users who want to peek "under the hood"), not
to suit the whims of a compiler or corresponding source code consumer.
This means literate sources often need some kind of "translation" to an
illiterate form that dumb software can understand.
The \fBdocstrip\fR Tcl package handles this translation.
.PP
Even for those who do not whole-hartedly subscribe to the philosophy
behind literate programming, \fBdocstrip\fR can bring greater
clarity to in particular:
.IP \(bu
programs employing non-obvious mathematics
.IP \(bu
projects where separate pieces of code, perhaps in
different languages, need to be closely coordinated.
.PP
The first is by providing access to much more powerful typographical
features for source code comments than are possible in plain text.
The second is because all the separate pieces of code can be kept
next to each other in the same source file.
.PP
The way it works is that the programmer edits directly only one or
several "master" source code files, from which \fBdocstrip\fR
generates the more traditional "source" files compilers or the like
would expect. The master sources typically contain a large amount of
documentation of the code, sometimes even in places where the code
consumers would not allow any comments. The etymology of "docstrip"
is that this \fIdoc\fRumentation was \fIstrip\fRped away (although
"code extraction" might be a better description, as it has always
been a matter of copying selected pieces of the master source rather
than deleting text from it).
The \fBdocstrip\fR Tcl package contains a reimplementation of
the basic extraction functionality from the \fBdocstrip\fR
program, and thus makes it possible for a Tcl interpreter to read
and interpret the master source files directly.
.PP
Readers who are not previously familiar with \fBdocstrip\fR but
want to know more about it may consult the following sources.
.IP [1]
\fIThe tclldoc package and class\fR,
\fIhttp://ctan.org/tex-archive/macros/latex/contrib/tclldoc/\fR.
.IP [2]
\fIThe DocStrip utility\fR,
\fIhttp://ctan.org/tex-archive/macros/latex/base/docstrip.dtx\fR.
.IP [3]
\fIThe doc and shortvrb Packages\fR,
\fIhttp://ctan.org/tex-archive/macros/latex/base/doc.dtx\fR.
.IP [4]
Chapter 14 of
\fIThe LaTeX Companion\fR (second edition),
Addison-Wesley, 2004; ISBN 0-201-36299-6.
.PP
.SH "FILE FORMAT"
The basic unit \fBdocstrip\fR operates on are the \fIlines\fR of
a master source file. Extraction consists of selecting some of these
lines to be copied from input text to output text. The basic
distinction is that between \fIcode lines\fR (which are copied and
do not begin with a percent character) and \fIcomment lines\fR
(which begin with a percent character and are not copied).
.CS


   docstrip::extract [join {
     {% comment}
     {% more comment !"#$%&/(}
     {some command}
     { % blah $blah "Not a comment."}
     {% abc; this is comment}
     {# def; this is code}
     {ghi}
     {% jkl}
   } \\n] {}

.CE
returns the same sequence of lines as
.CS


   join {
     {some command}
     { % blah $blah "Not a comment."}
     {# def; this is code}
     {ghi} ""
   } \\n

.CE
It does not matter to \fBdocstrip\fR what format is used for the
documentation in the comment lines, but in order to do better than
plain text comments, one typically uses some markup language. Most
commonly LaTeX is used, as that is a very established standard and
also provides the best support for mathematical formulae, but the
\fBdocstrip::util\fR package also gives some support for
\fIdoctools\fR-like markup.
.PP
Besides the basic code and comment lines, there are also
\fIguard lines\fR, which begin with the two characters '%<', and
\fImeta-comment lines\fR, which begin with the two characters
\'%%'. Within guard lines there is furthermore the distinction between
\fIverbatim guard lines\fR, which begin with '%<<', and ordinary
guard lines, where the '%<' is not followed by another '<'. The last
category is by far the most common.
.PP
Ordinary guard lines conditions extraction of the code line(s) they
guard by the value of a boolean expression; the guarded block of
code lines will only be included if the expression evaluates to true.
The syntax of an ordinary guard line is one of
.CS


    '%' '<' STARSLASH EXPRESSION '>'
    '%' '<' PLUSMINUS EXPRESSION '>' CODE

.CE
where
.CS


    STARSLASH  ::=  '*' | '/'
    PLUSMINUS  ::=  | '+' | '-'
    EXPRESSION ::= SECONDARY | SECONDARY ',' EXPRESSION
                 | SECONDARY '|' EXPRESSION
    SECONDARY  ::= PRIMARY | PRIMARY '&' SECONDARY
    PRIMARY    ::= TERMINAL | '!' PRIMARY | '(' EXPRESSION ')'
    CODE       ::= { any character except end-of-line }

.CE
Comma and vertical bar both denote 'or'. Ampersand denotes 'and'.
Exclamation mark denotes 'not'. A TERMINAL can be any nonempty string
of characters not containing '>', '&', '|', comma, '(', or ')',
although the \fBdocstrip\fR manual is a bit restrictive and only
guarantees proper operation for strings of letters (although even
the LaTeX core sources make heavy use also of digits in TERMINALs).
The second argument of \fBdocstrip::extract\fR is the list of those
TERMINALs that should count as having the value 'true'; all other
TERMINALs count as being 'false' when guard expressions are evaluated.
.PP
In the case of a '%<*\fIEXPRESSION\fR>' guard, the lines guarded are
all lines up to the next '%</\fIEXPRESSION\fR>' guard with the same
\fIEXPRESSION\fR (compared as strings). The blocks of code delimited
by such '*' and '/' guard lines must be properly nested.
.CS


   set text [join {
      {begin}
      {%<*foo>}
      {1}
      {%<*bar>}
      {2}
      {%</bar>}
      {%<*!bar>}
      {3}
      {%</!bar>}
      {4}
      {%</foo>}
      {5}
      {%<*bar>}
      {6}
      {%</bar>}
      {end}
   } \\n]
   set res [docstrip::extract $text foo]
   append res [docstrip::extract $text {foo bar}]
   append res [docstrip::extract $text bar]

.CE
sets $res to the result of
.CS


   join {
      {begin}
      {1}
      {3}
      {4}
      {5}
      {end}
      {begin}
      {1}
      {2}
      {4}
      {5}
      {6}
      {end}
      {begin}
      {5}
      {6}
      {end} ""
   } \\n

.CE
In guard lines without a '*', '/', '+', or '-' modifier after the
\'%<', the guard applies only to the CODE following the '>' on that
single line. A '+' modifier is equivalent to no modifier. A '-'
modifier is like the case with no modifier, but the expression is
implicitly negated, i.e., the CODE of a '%<-' guard line is only
included if the expression evaluates to false.
.PP
Metacomment lines are "comment lines which should not be stripped
away", but be extracted like code lines; these are sometimes used for
copyright notices and similar material. The '%%' prefix is however
not kept, but substituted by the current \fB-metaprefix\fR, which
is customarily set to some "comment until end of line" character (or
character sequence) of the language of the code being extracted.
.CS


   set text [join {
      {begin}
      {%<foo> foo}
      {%<+foo>plusfoo}
      {%<-foo>minusfoo}
      {middle}
      {%% some metacomment}
      {%<*foo>}
      {%%another metacomment}
      {%</foo>}
      {end}
   } \\n]
   set res [docstrip::extract $text foo -metaprefix {# }]
   append res [docstrip::extract $text bar -metaprefix {#}]

.CE
sets $res to the result of
.CS


   join {
      {begin}
      { foo}
      {plusfoo}
      {middle}
      {#  some metacomment}
      {# another metacomment}
      {end}
      {begin}
      {minusfoo}
      {middle}
      {# some metacomment}
      {end} ""
   } \\n

.CE
Verbatim guards can be used to force code line
interpretation of a block of lines even if some of them happen to look
like any other type of lines to docstrip. A verbatim guard has the
form '%<<\fIEND-TAG\fR' and the verbatim block is terminated by the
first line that is exactly '%\fIEND-TAG\fR'.
.CS


   set text [join {
      {begin}
      {%<*myblock>}
      {some stupid()}
      {   #computer<program>}
      {%<<QQQ-98765}
      {% These three lines are copied verbatim (including percents}
      {%% even if -metaprefix is something different than %%).}
      {%</myblock>}
      {%QQQ-98765}
      {   using*strange@programming<language>}
      {%</myblock>}
      {end}
   } \\n]
   set res [docstrip::extract $text myblock -metaprefix {# }]
   append res [docstrip::extract $text {}]

.CE
sets $res to the result of
.CS


   join {
      {begin}
      {some stupid()}
      {   #computer<program>}
      {% These three lines are copied verbatim (including percents}
      {%% even if -metaprefix is something different than %%).}
      {%</myblock>}
      {   using*strange@programming<language>}
      {end}
      {begin}
      {end} ""
   } \\n

.CE
The processing of verbatim guards takes place also inside blocks of
lines which due to some outer block guard will not be copied.
.PP
The final piece of \fBdocstrip\fR syntax is that extraction
stops at a line that is exactly "\\endinput"; this is often used to
avoid copying random whitespace at the end of a file. In the unlikely
case that one wants such a code line, one can protect it with a
verbatim guard.
.SH COMMANDS
The package defines two commands.
.TP
\fBdocstrip::extract\fR \fItext\fR \fIterminals\fR ?\fIoption\fR \fIvalue\fR ...?
The \fBextract\fR command docstrips the \fItext\fR and returns the
extracted lines of code, as a string with each line terminated with
a newline. The \fIterminals\fR is the list of those guard
expression terminals which should evaluate to true.
The available options are:
.RS
.TP
\fB-annotate\fR \fIlines\fR
Requests the specified number of lines of annotation to follow
each extracted line in the result. Defaults to 0. Annotation lines
are mostly useful when the extracted lines are to undergo some
further transformation. A first annotation line is a list of three
elements: line type, prefix removed in extraction, and prefix
inserted in extraction. The line type is one of: 'V' (verbatim),
\'M' (metacomment), '+' (+ or no modifier guard line), '-' (-
modifier guard line), '.' (normal line). A second annotation line
is the source line number. A third annotation line is the current
stack of block guards. Requesting more than three lines of
annotation is currently not supported.
.TP
\fB-metaprefix\fR \fIstring\fR
The string by which the '%%' prefix of a metacomment line will
be replaced. Defaults to '%%'. For Tcl code this would typically
be '#'.
.TP
\fB-onerror\fR \fIkeyword\fR
Controls what will be done when a format error in the \fItext\fR
being processed is detected. The settings are:
.RS
.TP
\fBignore\fR
Just ignore the error; continue as if nothing happened.
.TP
\fBputs\fR
Write an error message to \fBstderr\fR, then continue
processing.
.TP
\fBthrow\fR
Throw an error. The \fB-errorcode\fR is set to a list whose
first element is \fBDOCSTRIP\fR, second element is the
type of error, and third element is the line number where
the error is detected. This is the default.
.RE
.TP
\fB-trimlines\fR \fIboolean\fR
Controls whether \fIspaces\fR at the end of a line should be
trimmed away before the line is processed. Defaults to true.
.RE
.IP
It should be remarked that the \fIterminals\fR are often called
"options" in the context of the \fBdocstrip\fR program, since
these specify which optional code fragments should be included.
.TP
\fBdocstrip::sourcefrom\fR \fIfilename\fR \fIterminals\fR ?\fIoption\fR \fIvalue\fR ...?
The \fBsourcefrom\fR command is a docstripping emulation of
\fBsource\fR. It opens the file \fIfilename\fR, reads it, closes it,
docstrips the contents as specified by the \fIterminals\fR, and
evaluates the result in the local context of the caller, during
which time the \fBinfo\fR \fBscript\fR value will be the
\fIfilename\fR. The options are passed on to \fBfconfigure\fR to
configure the file before its contents are read. The
\fB-metaprefix\fR is set to '#', all other \fBextract\fR
options have their default values.
.PP
.SH "DOCUMENT STRUCTURE"
The file format (as described above) determines whether a master
source code file can be processed correctly by \fBdocstrip\fR,
but the usefulness of the format is to no little part also dependent
on that the code and comment lines together constitute a well-formed
document.
.PP
For a document format that does not require any non-Tcl software, see
the \fBddt2man\fR command in the \fBdocstrip::util\fR package. It
is suggested that files employing that document format are given the
suffix "\fI.ddt\fR", to distinguish them from the more traditional
LaTeX-based "\fI.dtx\fR" files.
.PP
Master source files with "\fI.dtx\fR" extension are usually set up so
that they can be typeset directly by \fBlatex\fR without any
support from other files. This is achieved by beginning the file
with the lines
.CS


   % \\iffalse
   %<*driver>
   \\documentclass{tclldoc}
   \\begin{document}
   \\DocInput{\fIfilename.dtx\fR}
   \\end{document}
   %</driver>
   % \\fi

.CE
or some variation thereof. The trick is that the file gets read twice.
With normal LaTeX reading rules, the first two lines are comments and
therefore ignored. The third line is the document preamble, the fourth
line begins the document body, and the sixth line ends the document,
so LaTeX stops there — non-comments below that point in
the file are never subjected to the normal LaTeX reading rules. Before
that, however, the \\DocInput command on the fifth line is processed,
and that does two things: it changes the interpretation of '%' from
"comment" to "ignored", and it inputs the file specified in the
argument (which is normally the name of the file the command is in).
It is this second time that the file is being read that the comments
and code in it are typeset.
.PP
The function of the \\iffalse ... \\fi is to skip lines two to seven
on this second time through; this is similar to the "if 0 { ... }"
idiom for block comments in Tcl code, and it is needed here because
(amongst other things) the \\documentclass command may only be
executed once. The function of the <driver> guards is to prevent this
short piece of LaTeX code from being extracted by \fBdocstrip\fR.
The total effect is that the file can function both as a LaTeX
document and as a \fBdocstrip\fR master source code file.
.PP
It is not necessary to use the tclldoc document class, but that does
provide a number of features that are convenient for "\fI.dtx\fR"
files containing Tcl code. More information on this matter can be
found in the references above.
.SH "SEE ALSO"
docstrip_util
.SH KEYWORDS
.dtx, LaTeX, docstrip, documentation, literate programming, source
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2003–2010 Lars Hellström <Lars dot Hellstrom at residenset dot net>

.fi

Added embedded/man/files/modules/docstrip/docstrip_util.n.




























































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/docstrip/docstrip_util.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003–2010 Lars Hellström <Lars dot Hellstrom at residenset dot net>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "docstrip_util" n 1.3 tcllib "Literate programming tool"
.BS
.SH NAME
docstrip_util \- Docstrip-related utilities
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdocstrip  ?1.2?\fR
.sp
package require \fBdocstrip::util  ?1.3?\fR
.sp
\fBpkgProvide\fR \fIname\fR \fIversion\fR \fIterminals\fR
.sp
\fBpkgIndex\fR ?\fIterminal\fR ...?
.sp
\fBfileoptions\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
\fBdocstrip::util::index_from_catalogue\fR \fIdir\fR \fIpattern\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
\fBdocstrip::util::modules_from_catalogue\fR \fItarget\fR \fIsource\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
\fBdocstrip::util::classical_preamble\fR \fImetaprefix\fR \fImessage\fR \fItarget\fR ?\fIsource\fR \fIterminals\fR ...?
.sp
\fBdocstrip::util::classical_postamble\fR \fImetaprefix\fR \fImessage\fR \fItarget\fR ?\fIsource\fR \fIterminals\fR ...?
.sp
\fBdocstrip::util::packages_provided\fR \fItext\fR ?\fIsetup-script\fR?
.sp
\fBdocstrip::util::ddt2man\fR \fItext\fR
.sp
\fBdocstrip::util::guards\fR \fIsubcmd\fR \fItext\fR
.sp
\fBdocstrip::util::patch\fR \fIsource-var\fR \fIterminals\fR \fIfromtext\fR \fIdiff\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
\fBdocstrip::util::thefile\fR \fIfilename\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
\fBdocstrip::util::import_unidiff\fR \fIdiff-text\fR ?\fIwarning-var\fR?
.sp
.BE
.SH DESCRIPTION
The \fBdocstrip::util\fR package is meant for collecting various
utility procedures that are mainly useful at installation or
development time. It is separate from the base package to avoid
overhead when the latter is used to \fBsource\fR code.
.PP
.SH "PACKAGE INDEXING COMMANDS"
Like raw "\fI.tcl\fR" files, code lines in docstrip source files can
be searched for package declarations and corresponding indices
constructed. A complication is however that one cannot tell from the
code blocks themselves which will fit together to make a working
package; normally that information would be found in an accompanying
"\fI.ins\fR" file, but parsing one of those is not an easy task.
Therefore \fBdocstrip::util\fR introduces an alternative encoding
of such information, in the form of a declarative Tcl script: the
\fIcatalogue\fR (of the contents in a source file).
.PP
The special commands which are available inside a catalogue are:
.TP
\fBpkgProvide\fR \fIname\fR \fIversion\fR \fIterminals\fR
Declares that the code for a package with name \fIname\fR and
version \fIversion\fR is made up from those modules in the source
file which are selected by the \fIterminals\fR list of guard
expression terminals. This code should preferably not contain a
\fBpackage\fR \fBprovide\fR command for the package, as one
will be provided by the package loading mechanisms.
.TP
\fBpkgIndex\fR ?\fIterminal\fR ...?
Declares that the code for a package is made up from those modules
in the source file which are selected by the listed guard
expression \fIterminal\fRs. The name and version of this package is
determined from \fBpackage\fR \fBprovide\fR command(s) found
in that code (hence there must be such a command in there).
.TP
\fBfileoptions\fR ?\fIoption\fR \fIvalue\fR ...?
Declares the \fBfconfigure\fR options that should be in force when
reading the source; this can usually be ignored for pure ASCII
files, but if the file needs to be interpreted according to some
other \fB-encoding\fR then this is how to specify it. The
command should normally appear first in the catalogue, as it takes
effect only for commands following it.
.PP
Other Tcl commands are supported too — a catalogue is
parsed by being evaluated in a safe interpreter — but they
are rarely needed. To allow for future extensions, unknown commands
in the catalogue are silently ignored.
.PP
To simplify distribution of catalogues together with their source
files, the catalogue is stored \fIin the source file itself\fR as
a module selected by the terminal '\fBdocstrip.tcl::catalogue\fR'.
This supports both the style of collecting all catalogue lines in one
place and the style of putting each catalogue line in close proximity
of the code that it declares.
.PP
Putting catalogue entries next to the code they declare may look as
follows
.CS


%    First there's the catalogue entry
%    \\begin{tcl}
%<docstrip.tcl::catalogue>pkgProvide foo::bar 1.0 {foobar load}
%    \\end{tcl}
%    second a metacomment used to include a copyright message
%    \\begin{macrocode}
%<*foobar>
%% This file is placed in the public domain.
%    \\end{macrocode}
%    third the package implementation
%    \\begin{tcl}
namespace eval foo::bar {
   # ... some clever piece of Tcl code elided ...
%    \\end{tcl}
%    which at some point may have variant code to make use of a
%    |load|able extension
%    \\begin{tcl}
%<*load>
   load [file rootname [info script]][info sharedlibextension]
%</load>
%<*!load>
   # ... even more clever scripted counterpart of the extension
   # also elided ...
%</!load>
}
%</foobar>
%    \\end{tcl}
%    and that's it!

.CE
The corresponding set-up with \fBpkgIndex\fR would be
.CS


%    First there's the catalogue entry
%    \\begin{tcl}
%<docstrip.tcl::catalogue>pkgIndex foobar load
%    \\end{tcl}
%    second a metacomment used to include a copyright message
%    \\begin{tcl}
%<*foobar>
%% This file is placed in the public domain.
%    \\end{tcl}
%    third the package implementation
%    \\begin{tcl}
package provide foo::bar 1.0
namespace eval foo::bar {
   # ... some clever piece of Tcl code elided ...
%    \\end{tcl}
%    which at some point may have variant code to make use of a
%    |load|able extension
%    \\begin{tcl}
%<*load>
   load [file rootname [info script]][info sharedlibextension]
%</load>
%<*!load>
   # ... even more clever scripted counterpart of the extension
   # also elided ...
%</!load>
}
%</foobar>
%    \\end{tcl}
%    and that's it!

.CE
.TP
\fBdocstrip::util::index_from_catalogue\fR \fIdir\fR \fIpattern\fR ?\fIoption\fR \fIvalue\fR ...?
This command is a sibling of the standard \fBpkg_mkIndex\fR
command, in that it adds package entries to "\fIpkgIndex.tcl\fR"
files. The difference is that it indexes \fBdocstrip\fR-style
source files rather than raw "\fI.tcl\fR" or loadable library files.
Only packages listed in the catalogue of a file are considered.
.sp
The \fIdir\fR argument is the directory in which to look for files
(and whose "\fIpkgIndex.tcl\fR" file should be amended).
The \fIpattern\fR argument is a \fBglob\fR pattern of files to look
into; a typical value would be \fB*.dtx\fR or
\fB*.{dtx,ddt}\fR. Remaining arguments are option-value pairs,
where the supported options are:
.RS
.TP
\fB-recursein\fR \fIdirpattern\fR
If this option is given, then the \fBindex_from_catalogue\fR
operation will be repeated in each subdirectory whose name
matches the \fIdirpattern\fR. \fB-recursein\fR \fB*\fR will
cause the entire subtree rooted at \fIdir\fR to be indexed.
.TP
\fB-sourceconf\fR \fIdictionary\fR
Specify \fBfileoptions\fR to use when reading the catalogues of
files (and also for reading the packages if the catalogue does
not contain a \fBfileoptions\fR command). Defaults to being
empty. Primarily useful if your system encoding is very different
from that of the source file (e.g., one is a two-byte encoding
and the other is a one-byte encoding). \fBascii\fR and
\fButf-8\fR are not very different in that sense.
.TP
\fB-options\fR \fIterminals\fR
The \fIterminals\fR is a list of terminals in addition to
\fBdocstrip.tcl::catalogue\fR that should be held as true when
extracting the catalogue. Defaults to being empty. This makes it
possible to make use of "variant sections" in the catalogue
itself, e.g. gaurd some entries with an extra "experimental" and
thus prevent them from appearing in the index unless that is
generated with "experimental" among the \fB-options\fR.
.TP
\fB-report\fR \fIboolean\fR
If the \fIboolean\fR is true then the return value will be a
textual, probably multiline, report on what was done. Defaults
to false, in which case there is no particular return value.
.TP
\fB-reportcmd\fR \fIcommandPrefix\fR
Every item in the report is handed as an extra argument to the
command prefix. Since \fBindex_from_catalogue\fR would typically
be used at a rather high level in installation scripts and the
like, the \fIcommandPrefix\fR defaults to
"\fBputs\fR \fBstdout\fR".
Use \fBlist\fR to effectively disable this feature. The return
values from the prefix are ignored.
.RE
.IP
The \fBpackage ifneeded\fR scripts that are generated contain
one \fBpackage require docstrip\fR command and one
\fBdocstrip::sourcefrom\fR command. If the catalogue entry was
of the \fBpkgProvide\fR kind then the \fBpackage ifneeded\fR
script also contains the \fBpackage provide\fR command.
.sp
Note that \fBindex_from_catalogue\fR never removes anything from an
existing "\fIpkgIndex.tcl\fR" file. Hence you may need to delete it
(or have \fBpkg_mkIndex\fR recreate it from scratch) before running
\fBindex_from_catalogue\fR to update some piece of information, such
as a package version number.
.sp
.TP
\fBdocstrip::util::modules_from_catalogue\fR \fItarget\fR \fIsource\fR ?\fIoption\fR \fIvalue\fR ...?
This command is an alternative to \fBindex_from_catalogue\fR which
creates Tcl Module ("\fI.tm\fR") files rather than
"\fIpkgIndex.tcl\fR" entries. Since this action is more similar to
what \fBdocstrip\fR classically does, it has features for
putting pre- and postambles on the generated files.
.sp
The \fIsource\fR argument is the name of the source file to
generate "\fI.tm\fR" files from. The \fItarget\fR argument is the
directory which should count as a module path, i.e., this is what
the relative paths derived from package names are joined to. The
supported options are:
.RS
.TP
\fB-preamble\fR \fImessage\fR
A message to put in the preamble (initial block of comments) of
generated files. Defaults to a space. May be several lines, which
are then separated by newlines. Traditionally used for copyright
notices or the like, but metacomment lines provide an alternative
to that.
.TP
\fB-postamble\fR \fImessage\fR
Like \fB-preamble\fR, but the message is put at the end of the
file instead of the beginning. Defaults to being empty.
.TP
\fB-sourceconf\fR \fIdictionary\fR
Specify \fBfileoptions\fR to use when reading the catalogue of
the \fIsource\fR (and also for reading the packages if the
catalogue does not contain a \fBfileoptions\fR command). Defaults
to being empty. Primarily useful if your system encoding is very
different from that of the source file (e.g., one is a two-byte
encoding and the other is a one-byte encoding). \fBascii\fR and
\fButf-8\fR are not very different in that sense.
.TP
\fB-options\fR \fIterminals\fR
The \fIterminals\fR is a list of terminals in addition to
\fBdocstrip.tcl::catalogue\fR that should be held as true when
extracting the catalogue. Defaults to being empty. This makes it
possible to make use of "variant sections" in the catalogue
itself, e.g. gaurd some entries with an extra "experimental" guard
and thus prevent them from contributing packages unless those are
generated with "experimental" among the \fB-options\fR.
.TP
\fB-formatpreamble\fR \fIcommandPrefix\fR
Command prefix used to actually format the preamble. Takes four
additional arguments \fImessage\fR, \fItargetFilename\fR,
\fIsourceFilename\fR, and \fIterminalList\fR and returns a fully
formatted preamble. Defaults to using \fBclassical_preamble\fR
with a \fImetaprefix\fR of '##'.
.TP
\fB-formatpostamble\fR \fIcommandPrefix\fR
Command prefix used to actually format the postamble. Takes four
additional arguments \fImessage\fR, \fItargetFilename\fR,
\fIsourceFilename\fR, and \fIterminalList\fR and returns a fully
formatted postamble. Defaults to using \fBclassical_postamble\fR
with a \fImetaprefix\fR of '##'.
.TP
\fB-report\fR \fIboolean\fR
If the \fIboolean\fR is true (which is the default) then the return
value will be a textual, probably multiline, report on what was
done. If it is false then there is no particular return value.
.TP
\fB-reportcmd\fR \fIcommandPrefix\fR
Every item in the report is handed as an extra argument to this
command prefix. Defaults to \fBlist\fR, which effectively disables
this feature. The return values from the prefix are ignored. Use
for example "\fBputs\fR \fBstdout\fR" to get report items
written immediately to the terminal.
.RE
.IP
An existing file of the same name as one to be created will be
overwritten.
.TP
\fBdocstrip::util::classical_preamble\fR \fImetaprefix\fR \fImessage\fR \fItarget\fR ?\fIsource\fR \fIterminals\fR ...?
This command returns a preamble in the classical
\fBdocstrip\fR style
.CS


##
## This is `TARGET',
## generated by the docstrip::util package.
##
## The original source files were:
##
## SOURCE (with options: `foo,bar')
##
## Some message line 1
## line2
## line3

.CE
.IP
if called as
.CS


docstrip::util::classical_preamble {##}\\
  "\\nSome message line 1\\nline2\\nline3" TARGET SOURCE {foo bar}

.CE
.IP
The command supports preambles for files generated from multiple
sources, even though \fBmodules_from_catalogue\fR at present does
not need that.
.TP
\fBdocstrip::util::classical_postamble\fR \fImetaprefix\fR \fImessage\fR \fItarget\fR ?\fIsource\fR \fIterminals\fR ...?
This command returns a postamble in the classical
\fBdocstrip\fR style
.CS


## Some message line 1
## line2
## line3
##
## End of file `TARGET'.

.CE
.IP
if called as
.CS


docstrip::util::classical_postamble {##}\\
  "Some message line 1\\nline2\\nline3" TARGET SOURCE {foo bar}

.CE
.IP
In other words, the \fIsource\fR and \fIterminals\fR arguments are
ignored, but supported for symmetry with \fBclassical_preamble\fR.
.TP
\fBdocstrip::util::packages_provided\fR \fItext\fR ?\fIsetup-script\fR?
This command returns a list where every even index element is the
name of a package \fBprovide\fRd by \fItext\fR when that is
evaluated as a Tcl script, and the following odd index element is
the corresponding version. It is used to do package indexing of
extracted pieces of code, in the manner of \fBpkg_mkIndex\fR.
.sp
One difference to \fBpkg_mkIndex\fR is that the \fItext\fR gets
evaluated in a safe interpreter. \fBpackage require\fR commands
are silently ignored, as are unknown commands (which includes
\fBsource\fR and \fBload\fR). Other errors cause
processing of the \fItext\fR to stop, in which case only those
package declarations that had been encountered before the error
will be included in the return value.
.sp
The \fIsetup-script\fR argument can be used to customise the
evaluation environment, if the code in \fItext\fR has some very
special needs. The \fIsetup-script\fR is evaluated in the local
context of the \fBpackages_provided\fR procedure just before the
\fItext\fR is processed. At that time, the name of the slave
command for the safe interpreter that will do this processing is
kept in the local variable \fBc\fR. To for example copy the
contents of the \fB::env\fR array to the safe interpreter, one
might use a \fIsetup-script\fR of
.CS

  $c eval [list array set env [array get ::env]]
.CE
.PP
.SH "SOURCE PROCESSING COMMANDS"
Unlike the previous group of commands, which would use
\fBdocstrip::extract\fR to extract some code lines and then process
those further, the following commands operate on text consisting of
all types of lines.
.TP
\fBdocstrip::util::ddt2man\fR \fItext\fR
The \fBddt2man\fR command reformats \fItext\fR from the general
\fBdocstrip\fR format to \fBdoctools\fR "\fI.man\fR" format
(Tcl Markup Language for Manpages). The different line types are
treated as follows:
.RS
.TP
comment and metacomment lines
The '%' and '%%' prefixes are removed, the rest of the text is
kept as it is.
.TP
empty lines
These are kept as they are. (Effectively this means that they will
count as comment lines after a comment line and as code lines
after a code line.)
.TP
code lines
\fBexample_begin\fR and \fBexample_end\fR commands are placed
at the beginning and end of every block of consecutive code
lines. Brackets in a code line are converted to \fBlb\fR and
\fBrb\fR commands.
.TP
verbatim guards
These are processed as usual, so they do not show up in the
result but every line in a verbatim block is treated as a code
line.
.TP
other guards
These are treated as code lines, except that the actual guard is
\fBemph\fRasised.
.RE
.IP
At the time of writing, no project has employed \fBdoctools\fR
markup in master source files, so experience of what works well is
not available. A source file could however look as follows
.CS


% [manpage_begin gcd n 1.0]
% [moddesc {Greatest Common Divisor}]
% [require gcd [opt 1.0]]
% [description]
%
% [list_begin definitions]
% [call [cmd gcd] [arg a] [arg b]]
%   The [cmd gcd] procedure takes two arguments [arg a] and [arg b] which
%   must be integers and returns their greatest common divisor.
proc gcd {a b} {
%   The first step is to take the absolute values of the arguments.
%   This relieves us of having to worry about how signs will be treated
%   by the remainder operation.
   set a [expr {abs($a)}]
   set b [expr {abs($b)}]
%   The next line does all of Euclid's algorithm! We can make do
%   without a temporary variable, since $a is substituted before the
%   [lb]set a $b[rb] and thus continues to hold a reference to the
%   "old" value of [var a].
   while {$b>0} { set b [expr { $a % [set a $b] }] }
%   In Tcl 8.3 we might want to use [cmd set] instead of [cmd return]
%   to get the slight advantage of byte-compilation.
%<tcl83>  set a
%<!tcl83>   return $a
}
% [list_end]
%
% [manpage_end]

.CE
.IP
If the above text is fed through \fBdocstrip::util::ddt2man\fR then
the result will be a syntactically correct \fBdoctools\fR
manpage, even though its purpose is a bit different.
.sp
It is suggested that master source code files with \fBdoctools\fR
markup are given the suffix "\fI.ddt\fR", hence the "ddt" in
\fBddt2man\fR.
.TP
\fBdocstrip::util::guards\fR \fIsubcmd\fR \fItext\fR
The \fBguards\fR command returns information (mostly of a
statistical nature) about the ordinary docstrip guards that occur
in the \fItext\fR. The \fIsubcmd\fR selects what is returned.
.RS
.TP
\fBcounts\fR
List the guard expression terminals with counts. The format of
the return value is a dictionary which maps the terminal name to
the number of occurencies of it in the file.
.TP
\fBexprcount\fR
List the guard expressions with counts. The format of the return
value is a dictionary which maps the expression to the number of
occurencies of it in the file.
.TP
\fBexprerr\fR
List the syntactically incorrect guard expressions (e.g.
parentheses do not match, or a terminal is missing). The return
value is a list, with the elements in no particular order.
.TP
\fBexpressions\fR
List the guard expressions. The return value is a list, with the
elements in no particular order.
.TP
\fBexprmods\fR
List the guard expressions with modifiers. The format of the return
value is a dictionary where each index is a guard expression and
each entry is a string with one character for every guard line that
has this expression. The characters in the entry specify what
modifier was used in that line: +, -, *, /, or (for guard without
modifier:) space. This is the most primitive form of the
information gathered by \fBguards\fR.
.TP
\fBnames\fR
List the guard expression terminals. The return value is a list,
with the elements in no particular order.
.TP
\fBrotten\fR
List the malformed guard lines (this does not include lines where
only the expression is malformed, though). The format of the return
value is a dictionary which maps line numbers to their contents.
.RE
.TP
\fBdocstrip::util::patch\fR \fIsource-var\fR \fIterminals\fR \fIfromtext\fR \fIdiff\fR ?\fIoption\fR \fIvalue\fR ...?
This command tries to apply a \fBdiff\fR file (for example a
contributed patch) that was computed for a generated file to the
\fBdocstrip\fR source. This can be useful if someone has
edited a generated file, thus mistaking it for being the source.
This command makes no presumptions which are specific for the case
that the generated file is a Tcl script.
.sp
\fBpatch\fR requires that the source file to patch is kept as a
list of lines in a variable, and the name of that variable in the
calling context is what goes into the \fIsource-var\fR argument.
The \fIterminals\fR is the list of terminals used to extract the
file that has been patched. The \fIdiff\fR is the actual diff to
apply (in a format as explained below) and the \fIfromtext\fR is
the contents of the file which served as "from" when the diff was
computed. Options can be used to further control the process.
.sp
The process works by "lifting" the hunks in the \fIdiff\fR from
generated to source file, and then applying them to the elements of
the \fIsource-var\fR. In order to do this lifting, it is necessary
to determine how lines in the \fIfromtext\fR correspond to elements
of the \fIsource-var\fR, and that is where the \fIterminals\fR come
in; the source is first \fBextract\fRed under the given
\fIterminals\fR, and the result of that is then matched against
the \fIfromtext\fR. This produces a map which translates line
numbers stated in the \fIdiff\fR to element numbers in
\fIsource-var\fR, which is what is needed to lift the hunks.
.sp
The reason that both the \fIterminals\fR and the \fIfromtext\fR
must be given is twofold. First, it is very difficult to keep track
of how many lines of preamble are supplied some other way than by
copying lines from source files. Second, a generated file might
contain material from several source files. Both make it impossible
to predict what line number an extracted file would have in the
generated file, so instead the algorithm for computing the line
number map looks for a block of lines in the \fIfromtext\fR which
matches what can be extracted from the source. This matching is
affected by the following options:
.RS
.TP
\fB-matching\fR \fImode\fR
How equal must two lines be in order to match? The supported
\fImode\fRs are:
.RS
.TP
\fBexact\fR
Lines must be equal as strings. This is the default.
.TP
\fBanyspace\fR
All sequences of whitespace characters are converted to single
spaces before comparing.
.TP
\fBnonspace\fR
Only non-whitespace characters are considered when comparing.
.TP
\fBnone\fR
Any two lines are considered to be equal.
.RE
.TP
\fB-metaprefix\fR \fIstring\fR
The \fB-metaprefix\fR value to use when extracting. Defaults
to "%%", but for Tcl code it is more likely that "#" or "##" had
been used for the generated file.
.TP
\fB-trimlines\fR \fIboolean\fR
The \fB-trimlines\fR value to use when extracting. Defaults to
true.
.RE
.IP
The return value is in the form of a unified diff, containing only
those hunks which were not applied or were only partially applied;
a comment in the header of each hunk specifies which case is at
hand. It is normally necessary to manually review both the return
value from \fBpatch\fR and the patched text itself, as this command
cannot adjust comment lines to match new content.
.sp
An example use would look like
.CS


set sourceL [split [docstrip::util::thefile from.dtx] \\n]
set terminals {foo bar baz}
set fromtext [docstrip::util::thefile from.tcl]
set difftext [exec diff --unified from.tcl to.tcl]
set leftover [docstrip::util::patch sourceL $terminals $fromtext\\
  [docstrip::util::import_unidiff $difftext] -metaprefix {#}]
set F [open to.dtx w]; puts $F [join $sourceL \\n]; close $F
return $leftover

.CE
.IP
Here, "\fIfrom.dtx\fR" was used as source for "\fIfrom.tcl\fR", which
someone modified into "\fIto.tcl\fR". We're trying to construct a
"\fIto.dtx\fR" which can be used as source for "\fIto.tcl\fR".
.TP
\fBdocstrip::util::thefile\fR \fIfilename\fR ?\fIoption\fR \fIvalue\fR ...?
The \fBthefile\fR command opens the file \fIfilename\fR, reads it to
end, closes it, and returns the contents (dropping a final newline
if there is one). The option-value pairs are
passed on to \fBfconfigure\fR to configure the open file channel
before anything is read from it.
.TP
\fBdocstrip::util::import_unidiff\fR \fIdiff-text\fR ?\fIwarning-var\fR?
This command parses a unified (\fBdiff\fR flags \fB-U\fR and
\fB--unified\fR) format diff into the list-of-hunks format
expected by \fBdocstrip::util::patch\fR. The \fIdiff-text\fR
argument is the text to parse and the \fIwarning-var\fR is, if
specified, the name in the calling context of a variable to which
any warnings about parsing problems will be \fBappend\fRed.
.sp
The return value is a list of \fIhunks\fR. Each hunk is a list of
five elements "\fIstart1\fR \fIend1\fR \fIstart2\fR \fIend2\fR
\fIlines\fR". \fIstart1\fR and \fIend1\fR are line numbers in the
"from" file of the first and last respectively lines of the hunk.
\fIstart2\fR and \fIend2\fR are the corresponding line numbers in
the "to" file. Line numbers start at 1. The \fIlines\fR is a list
with two elements for each line in the hunk; the first specifies the
type of a line and the second is the actual line contents. The type
is \fB-\fR for lines only in the "from" file, \fB+\fR for lines
that are only in the "to" file, and \fB0\fR for lines that are
in both.
.PP
.SH "SEE ALSO"
docstrip, doctools, doctools_fmt
.SH KEYWORDS
.ddt, Tcl module, catalogue, diff, docstrip, doctools, documentation, literate programming, module, package indexing, patch, source
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2003–2010 Lars Hellström <Lars dot Hellstrom at residenset dot net>

.fi

Added embedded/man/files/modules/doctools/changelog.n.

















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/changelog.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003-2013 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::changelog" n 1.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::changelog \- Processing text in Emacs ChangeLog format
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil \fR
.sp
package require \fBdoctools::changelog  ?1.1?\fR
.sp
\fB::doctools::changelog::scan\fR \fItext\fR
.sp
\fB::doctools::changelog::flatten\fR \fIentries\fR
.sp
\fB::doctools::changelog::toDoctools\fR \fItitle\fR \fImodule\fR \fIversion\fR \fIentries\fR
.sp
\fB::doctools::changelog::merge\fR \fIentries\fR...
.sp
.BE
.SH DESCRIPTION
This package provides Tcl commands for the processing and reformatting
of text in the "\fIChangeLog\fR" format generated by \fBemacs\fR.
.SH API
.TP
\fB::doctools::changelog::scan\fR \fItext\fR
The command takes the \fItext\fR and parses it under the assumption
that it contains a ChangeLog as generated by \fBemacs\fR. It
returns a data structure describing the contents of this ChangeLog.
.sp
This data structure is a list where each element describes one entry
in the ChangeLog. Each element/entry is then a list of three elements
describing the date of the entry, its author, and the comments made,
in this order. The last item in each element/entry, the comments, is a
list of sections. Each section is described by a list containing two
elements, a list of file names, and a string containing the true
comment associated with the files of the section.
.sp
.CS


    {
	{
	    date
	    author
	    {
		{
		    {file ...}
		    commenttext
		}
		...
	    }
	}
	{...}
    }

.CE
.TP
\fB::doctools::changelog::flatten\fR \fIentries\fR
This command converts a list of entries as generated by
\fBchange::scan\fR above into a simpler list of plain
text blocks each containing all the information of a
single entry.
.TP
\fB::doctools::changelog::toDoctools\fR \fItitle\fR \fImodule\fR \fIversion\fR \fIentries\fR
This command converts the pre-parsed ChangeLog \fIentries\fR as
generated by the command \fB::doctools::changelog::scan\fR into a
document in \fIdoctools\fR format and returns it as the result of the
command.
.sp
The other three arguments supply the information for the header of
that document which is not available from the changelog itself.
.TP
\fB::doctools::changelog::merge\fR \fIentries\fR...
Each argument of the command is assumed to be a pre-parsed Changelog
as generated by the command \fB::doctools::changelog::scan\fR. This
command merges all of them into a single structure, and collapses
multiple entries for the same date and author into a single entry. The
new structure is returned as the result of the command.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
changelog, doctools, emacs
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2003-2013 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/cvs.n.














































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/cvs.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::cvs" n 1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::cvs \- Processing text in 'cvs log' format
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil \fR
.sp
package require \fBdoctools::cvs  ?1?\fR
.sp
\fB::doctools::cvs::scanLog\fR \fItext\fR \fIevar\fR \fIcvar\fR \fIfvar\fR
.sp
\fB::doctools::cvs::toChangeLog\fR \fIevar\fR \fIcvar\fR \fIfvar\fR
.sp
.BE
.SH DESCRIPTION
This package provides Tcl commands for the processing and reformatting
text in the format generated by the \fBcvs log\fR command.
.PP
The commands \fB::doctools::cvs::scanLog\fR
and \fB::doctools::cvs::toChangeLog\fR are derived from code found on
the \fITcl'ers Wiki\fR [http://wiki.tcl.tk]. See the references at the
end of the page.
.SH API
.TP
\fB::doctools::cvs::scanLog\fR \fItext\fR \fIevar\fR \fIcvar\fR \fIfvar\fR
The command takes the \fItext\fR and parses it under the assumption
that it contains a CVS log as generated by \fBcvs log\fR. The
resulting information is stored in the variables whose names were
specified via \fIevar\fR, \fIcvar\fR, and \fIfvar\fR.
.sp
Already existing information in the referenced variables is preserved,
allowing the caller to merge data from multiple logs into one
database.
.RS
.TP
varname \fIevar\fR (in)
Has to refer to a scalar variable. After the call this variable will
contain a list of all the entries found in the log file. An entry is
identified through the combination of date and author, and can be
split over multiple physical entries, one per touched file.
.sp
It should be noted that the entries are listed in the same order as
they were found in the \fItext\fR. This is not necessarily sorted by
date or author.
.sp
Each item in the list is a list containing two elements, the date of
the entry, and its author, in this order. The date is formatted as
\fByear\fR/\fBmonth\fR/\fBday\fR.
.TP
varname \fIcvar\fR (in)
Has to refer to an array variable. Keys are strings containing the
date and author of log entries, in this order, separated by a comma.
.sp
The values are lists of comments made for the entry.
.TP
varname \fIfvar\fR (in)
Has to refer to an array variable. Keys are strings containing
date, author of a log entry, and a comment for that entry, in this
order, separated by commas.
.sp
The values are lists of the files the entry is touching.
.RE
.sp
.TP
\fB::doctools::cvs::toChangeLog\fR \fIevar\fR \fIcvar\fR \fIfvar\fR
]
The three arguments for this command are the same as the last three
arguments of the command \fB::doctools::cvs::scanLog\fR. This command
however expects them to be filled with information about one or more
logs. It takes this information and converts it into a text in the
format of a ChangeLog as accepted and generated by \fBemacs\fR. The
constructed text is returned as the result of the command.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
\fIhttp://wiki.tcl.tk/log2changelog\fR
.SH KEYWORDS
changelog, cvs, cvs log, emacs, log
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2003-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/docidx.n.
























































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/docidx.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003-2010 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx" n 1.0.4 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx \- docidx - Processing indices
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBdoctools::idx  ?1.0.4?\fR
.sp
\fB::doctools::idx::new\fR \fIobjectName\fR ?\fB-option\fR \fIvalue\fR ...?
.sp
\fB::doctools::idx::help\fR
.sp
\fB::doctools::idx::search\fR \fIpath\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBconfigure\fR
.sp
\fIobjectName\fR \fBconfigure\fR \fIoption\fR
.sp
\fIobjectName\fR \fBconfigure\fR \fB-option\fR \fIvalue\fR...
.sp
\fIobjectName\fR \fBcget\fR \fB-option\fR
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBformat\fR \fItext\fR
.sp
\fIobjectName\fR \fBmap\fR \fIsymbolic\fR \fIactual\fR
.sp
\fIobjectName\fR \fBparameters\fR
.sp
\fIobjectName\fR \fBsearch\fR \fIpath\fR
.sp
\fIobjectName\fR \fBsetparam\fR \fIname\fR \fIvalue\fR
.sp
\fIobjectName\fR \fBwarnings\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for the creation of objects able to
process and convert text written in the \fIdocidx\fR markup language
into any output format X for which a \fIformatting engine\fR is
available.
.PP
A reader interested in the markup language itself should start with
the \fIdocidx language introduction\fR and proceed from there to
the formal specifications, i.e. the \fIdocidx language syntax\fR
and the \fIdocidx language command reference\fR.
.PP
If on the other hand the reader wishes to write her own formatting
engine for some format, i.e. is a \fIplugin writer\fR then reading
and understanding the \fIdocidx plugin API reference\fR is an
absolute necessity, as that document specifies the interaction between
this package and its plugins, i.e. the formatting engines, in detail.
.SH "PUBLIC API"
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::idx::new\fR \fIobjectName\fR ?\fB-option\fR \fIvalue\fR ...?
This command creates a new docidx object with an associated Tcl
command whose name is \fIobjectName\fR. This \fIobject\fR command is
explained in full detail in the sections \fBOBJECT COMMAND\fR
and \fBOBJECT METHODS\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.sp
The options and their values coming after the name of the object are
used to set the initial configuration of the object.
.TP
\fB::doctools::idx::help\fR
This is a convenience command for applications wishing to provide
their user with a short description of the available formatting
commands and their meanings. It returns a string containing a standard
help text.
.TP
\fB::doctools::idx::search\fR \fIpath\fR
Whenever an object created by this the package has to map the name of
a format to the file containing the code for its formatting engine it
will search for the file in a number of directories stored in a
list. See section \fBFORMAT MAPPING\fR for more explanations.
.sp
This list not only contains three default directories which are
declared by the package itself, but is also extensible user of the
package.
This command is the means to do so. When given a \fIpath\fR to an
existing and readable directory it will prepend that directory to the
list of directories to search. This means that the \fIpath\fR added
last is later searched through first.
.sp
An error will be thrown if the \fIpath\fR either does not exist, is
not a directory, or is not readable.
.PP
.SS "OBJECT COMMAND"
All commands created by \fB::doctools::idx::new\fR have the following
general form and may be used to invoke various operations on their
docidx converter object.
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the exact
behavior of the command. See section \fBOBJECT METHODS\fR for
the detailed specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBconfigure\fR
The method returns a list of all known options and their current
values when called without any arguments.
.TP
\fIobjectName\fR \fBconfigure\fR \fIoption\fR
The method behaves like the method \fBcget\fR when called with a
single argument and returns the value of the option specified by said
argument.
.TP
\fIobjectName\fR \fBconfigure\fR \fB-option\fR \fIvalue\fR...
The method reconfigures the specified \fBoption\fRs of the object,
setting them to the associated \fIvalue\fRs, when called with an even
number of arguments, at least two.
.sp
The legal options are described in the section
\fBOBJECT CONFIGURATION\fR.
.TP
\fIobjectName\fR \fBcget\fR \fB-option\fR
This method expects a legal configuration option as argument and will
return the current value of that option for the object the method was
invoked for.
.sp
The legal configuration options are described in section
\fBOBJECT CONFIGURATION\fR.
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBformat\fR \fItext\fR
This method runs the \fItext\fR through the configured formatting
engine and returns the generated string as its result. An error will
be thrown if no \fB-format\fR was configured for the object.
.sp
The method assumes that the \fItext\fR is in \fIdocidx\fR format as
specified in the companion document \fIdocidx_fmt\fR. Errors will be
thrown otherwise.
.TP
\fIobjectName\fR \fBmap\fR \fIsymbolic\fR \fIactual\fR
This methods add one entry to the per-object mapping from
\fIsymbolic\fR filenames to the \fIactual\fR uris.
The object just stores this mapping and makes it available to the
configured formatting engine through the command \fBdt_fmap\fR.
This command is described in more detail in the
\fIdocidx plugin API reference\fR which specifies the interaction
between the objects created by this package and index formatting
engines.
.TP
\fIobjectName\fR \fBparameters\fR
This method returns a list containing the names of all engine
parameters provided by the configured formatting engine. It will
return an empty list if the object is not yet configured for a
specific format.
.TP
\fIobjectName\fR \fBsearch\fR \fIpath\fR
This method extends the per-object list of paths searched for index
formatting engines. See also the command \fB::doctools::idx::search\fR
on how to extend the per-package list of paths. Note that the path
entered last will be searched first.
For more details see section \fBFORMAT MAPPING\fR.
.TP
\fIobjectName\fR \fBsetparam\fR \fIname\fR \fIvalue\fR
This method sets the \fIname\fRd engine parameter to the specified
\fIvalue\fR.
It will throw an error if the object is either not yet configured for
a specific format, or if the formatting engine for the configured
format does not provide a parameter with the given \fIname\fR.
The list of parameters provided by the configured formatting engine
can be retrieved through the method \fBparameters\fR.
.TP
\fIobjectName\fR \fBwarnings\fR
This method returns a list containing all the warnings which were
generated by the configured formatting engine during the last
invocation of the method \fBformat\fR.
.PP
.SS "OBJECT CONFIGURATION"
All docidx objects understand the following configuration options:
.TP
\fB-file\fR \fIfile\fR
The argument of this option is stored in the object and made available
to the configured formatting engine through the command \fBdt_file\fR.
This command is described in more detail in the companion document
\fIdocidx_api\fR which specifies the API between the object and
formatting engines.
.sp
The default value of this option is the empty string.
.sp
The configured formatting engine should interpret the value as the
name of the file containing the document which is currently processed.
.TP
\fB-format\fR \fItext\fR
The argument of this option specifies the format to generate and by
implication the formatting engine to use when converting text via the
method \fBformat\fR. Its default value is the empty string. The
method \fBformat\fR cannot be used if this option is not set to a
valid value at least once.
.sp
The package will immediately try to map the given name to a file
containing the code for a formatting engine generating that format. An
error will be thrown if this mapping fails. In that case a previously
configured format is left untouched.
.sp
The section \fBFORMAT MAPPING\fR explains in detail how the
package and object will look for engine implementations.
.PP
.SS "FORMAT MAPPING"
The package and object will perform the following algorithm when
trying to map a format name \fIfoo\fR to a file containing an
implementation of a formatting engine for \fIfoo\fR:
.IP [1]
If \fIfoo\fR is the name of an existing file then this file is
directly taken as the implementation.
.IP [2]
If not, the list of per-object search paths is searched. For each
directory in the list the package checks if that directory contains a
file "\fIidx.\fIfoo\fR\fR". If yes, then that file is taken as the
implementation.
.sp
Note that this list of paths is initially empty and can be extended
through the object method \fBsearch\fR.
.IP [3]
If not, the list of package paths is searched.
For each directory in the list the package checks if that directory
contains a file "\fIidx.\fIfoo\fR\fR". If yes, then that file is taken
as the implementation.
.sp
This list of paths can be extended
through the command \fB::doctools::idx::search\fR.
It contains initially one path, the subdirectory "\fImpformats\fR" of
the directory the package itself is located in. In other words, if the
package implementation "\fIdocidx.tcl\fR" is installed in the directory
"\fI/usr/local/lib/tcllib/doctools\fR" then it will by default search
the directory "\fI/usr/local/lib/tcllib/doctools/mpformats\fR" for
format implementations.
.IP [4]
The mapping fails.
.PP
.SH "PREDEFINED ENGINES"
The package provides predefined formatting engines for the following
formats. Some of the formatting engines support engine
parameters. These will be explicitly highlighted.
.TP
html
This engine generates HTML markup, for processing by web browsers and
the like. This engine supports three parameters:
.RS
.TP
footer
The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
before the \fB</body>\fR tag, closing the body of the generated
HTML.
.sp
This can be used to insert boilerplate footer markup into the
generated document.
.TP
header
The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the \fB<body>\fR tag, starting the body of the generated HTML.
.sp
This can be used to insert boilerplate header markup into the
generated document.
.TP
meta
The value for this parameter has to be valid selfcontained HTML markup
for the header section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the \fB<head>\fR tag, starting the header section of the
generated HTML.
.sp
This can be used to insert boilerplate meta data markup into the
generated document, like references to a stylesheet, standard meta
keywords, etc.
.RE
.sp
.TP
latex
This engine generates output suitable for the \fBlatex\fR text
processor coming out of the TeX world.
.TP
list
This engine retrieves version, section and title of the manpage from
the document. As such it can be used to generate a directory listing
for a set of manpages.
.TP
nroff
This engine generates nroff output, for processing by \fBnroff\fR,
or \fBgroff\fR. The result will be standard man pages as they are
known in the unix world.
.TP
null
This engine generates no outout at all. This can be used if one just
wants to validate some input.
.TP
tmml
This engine generates TMML markup as specified by Joe English. The Tcl
Manpage Markup Language is a derivate of XML.
.TP
wiki
This engine generates Wiki markup as understood by Jean Claude
Wippler's \fBwikit\fR application.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
docidx_intro, docidx_lang_cmdref, docidx_lang_intro, docidx_lang_syntax, docidx_plugin_apiref
.SH KEYWORDS
HTML, TMML, conversion, docidx, documentation, index, keyword index, latex, manpage, markup, nroff, wiki
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2003-2010 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/docidx_intro.n.
































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/docidx_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "docidx_intro" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
docidx_intro \- docidx introduction
.SH DESCRIPTION
.PP
\fIdocidx\fR (short for \fIdocumentation tables of contents\fR)
stands for a set of related, yet different, entities which are working
together for the easy creation and transformation of keyword-based
indices for documentation. These are
.IP [1]
A tcl based language for the semantic markup of a keyword index.
Markup is represented by Tcl commands.
.IP [2]
A package providing the ability to read and transform texts written in
that markup language. It is important to note that the actual
transformation of the input text is delegated to plugins.
.IP [3]
An API describing the interface between the package above and a
plugin.
.PP
.PP
Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.
.PP
.IP [1]
A \fIwriter\fR of documentation has to understand the markup language
itself. A beginner to docidx should read the more informally written
\fIdocidx language introduction\fR first. Having digested this
the formal \fIdocidx language syntax\fR specification should
become understandable. A writer experienced with docidx may only
need the \fIdocidx language command reference\fR from time to
time to refresh her memory.
.sp
While a document is written the \fBdtp\fR application can be used
to validate it, and after completion it also performs the conversion
into the chosen system of visual markup, be it *roff, HTML, plain
text, wiki, etc. The simpler \fBdtplite\fR application makes
internal use of docidx when handling directories of documentation,
automatically generating a proper keyword index for them.
.IP [2]
A \fIprocessor\fR of documentation written in the \fIdocidx\fR
markup language has to know which tools are available for use.
.sp
The main tool is the aforementioned \fBdtp\fR application provided
by Tcllib. The simpler \fBdtplite\fR does not expose docidx to the
user.
At the bottom level, common to both applications, however sits the
package \fBdoctoools::idx\fR, providing the basic facilities to
read and process files containing text in the docidx format.
.IP [3]
At last, but not least, \fIplugin writers\fR have to understand the
interaction between the \fBdoctools::idx\fR package and its
plugins, as described in the \fIdocidx plugin API reference\fR.
.PP
.SH "RELATED FORMATS"
docidx does not stand alone, it has two companion formats. These are
called \fIdoctoc\fR and \fIdoctools\fR, and they are for the markup
of \fItables of contents\fR, and general documentation,
respectively.
They are described in their own sets of documents, starting at the
\fIdoctoc introduction\fR and the \fIdoctools introduction\fR,
respectively.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
docidx_lang_cmdref, docidx_lang_faq, docidx_lang_intro, docidx_lang_syntax, docidx_plugin_apiref, doctoc_intro, doctools::idx, doctools_intro
.SH KEYWORDS
index, keyword index, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/docidx_lang_cmdref.n.











































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/docidx_lang_cmdref.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "docidx_lang_cmdref" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
docidx_lang_cmdref \- docidx language command reference
.SH SYNOPSIS
\fBcomment\fR \fIplaintext\fR
.sp
\fBinclude\fR \fIfilename\fR
.sp
\fBindex_begin\fR \fItext\fR \fItitle\fR
.sp
\fBindex_end\fR
.sp
\fBkey\fR \fItext\fR
.sp
\fBlb\fR
.sp
\fBmanpage\fR \fIfile\fR \fItext\fR
.sp
\fBrb\fR
.sp
\fBurl\fR \fIurl\fR \fIlabel\fR
.sp
\fBvset\fR \fIvarname\fR \fIvalue\fR
.sp
\fBvset\fR \fIvarname\fR
.sp
.BE
.SH DESCRIPTION
.PP
This document specifies both names and syntax of all the commands
which together are the docidx markup language, version 1.
As this document is intended to be a reference the commands are listed
in alphabetical order, and the descriptions are relatively short.
A beginner should read the much more informally written
\fIdocidx language introduction\fR first.
.SH COMMANDS
.TP
\fBcomment\fR \fIplaintext\fR
Index markup. The argument text is marked up as a comment standing
outside of the actual text of the document. Main use is in free-form
text.
.TP
\fBinclude\fR \fIfilename\fR
Templating. The contents of the named file are interpreted as text
written in the docidx markup and processed in the place of the
include command. The markup in the file has to be self-contained. It
is not possible for a markup command to cross the file boundaries.
.TP
\fBindex_begin\fR \fItext\fR \fItitle\fR
Document structure. The command to start an index. The arguments are a
label for the whole group of documents the index refers to
(\fItext\fR) and the overall title text for the index (\fItitle\fR),
without markup.
.sp
The label often is the name of the package (or extension) the
documents belong to.
.TP
\fBindex_end\fR
Document structure. Command to end an index. Anything in the document
coming after this command is in error.
.TP
\fBkey\fR \fItext\fR
Index structure. This command adds the keyword \fItext\fR to the
index.
.TP
\fBlb\fR
Text. The command is replaced with a left bracket. Use in free-form
text. Required to avoid interpretation of a left bracket as the start
of a markup command. Its usage is restricted to the arguments of other
markup commands.
.TP
\fBmanpage\fR \fIfile\fR \fItext\fR
Index structure. This command adds an element to the index which
refers to a document. The document is specified through the symbolic
name \fIfile\fR. The \fItext\fR argument is used to label the
reference.
.sp
Symbolic names are used to preserve the convertibility of this format
to any output format. The actual name of the file will be inserted by
the chosen formatting engine when converting the input. This will be
based on a mapping from symbolic to actual names given to the engine.
.TP
\fBrb\fR
Text. The command is replaced with a right bracket. Use in free-form
text. Required to avoid interpretation of a right bracket as the end
of a markup command. Its usage is restricted to the arguments of other
commands.
.TP
\fBurl\fR \fIurl\fR \fIlabel\fR
Index structure. This is the second command to add an element to the
index. To refer to a document it is not using a symbolic name however,
but a (possibly format-specific) url describing the exact location of
the document indexed here.
.TP
\fBvset\fR \fIvarname\fR \fIvalue\fR
Templating. In this form the command sets the named document variable
to the specified \fIvalue\fR. It does not generate output. I.e. the
command is replaced by the empty string.
.TP
\fBvset\fR \fIvarname\fR
Templating. In this form the command is replaced by the value of the
named document variable
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
docidx_intro, docidx_lang_faq, docidx_lang_intro, docidx_lang_syntax
.SH KEYWORDS
docidx commands, docidx language, docidx markup, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/docidx_lang_faq.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/docidx_lang_faq.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "docidx_lang_faq" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
docidx_lang_faq \- docidx language faq
.SH DESCRIPTION
.PP
.SH OVERVIEW
.SS "WHAT IS THIS DOCUMENT?"
This document is currently mainly a placeholder, to be filled with
commonly asked questions about the docidx markup language and
companions, and their answers.
.PP
Please report any questions (and, if possible, answers) we should
consider for this document in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
.SH EXAMPLES
.SS "WHERE DO I FIND DOCIDX EXAMPLES?"
We have no direct examples of documents written using docidx
markup. However the doctools processor \fBdtplite\fR does generate
keyword indices when processing a set of documents written in doctools
markup. The intermediate files use docidx markup and are not deleted
when generation completes. These files can therefore serve as
examples.
.PP
\fBdtplite\fR is distributed as part of Tcllib, so to get it you
need one of
.IP [1]
A CVS snapshot of Tcllib. How to retrieve such a snapshot and the
tools required for this are described at
\fIhttp://sourceforge.net/cvs/?group_id=12883\fR
.IP [2]
A Tcllib release archive. They are available at
\fIhttp://sourceforge.net/project/showfiles.php?group_id=12883\fR
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report any such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
the package and/or the documentation.
.SH "SEE ALSO"
docidx_lang_cmdref, docidx_lang_intro, docidx_lang_syntax
.SH KEYWORDS
docidx commands, docidx language, docidx markup, docidx syntax, examples, faq, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/docidx_lang_intro.n.



















































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/docidx_lang_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "docidx_lang_intro" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
docidx_lang_intro \- docidx language introduction
.SH DESCRIPTION
.PP
This document is an informal introduction to version 1 of the docidx
markup language based on a multitude of examples. After reading this a
writer should be ready to understand the two parts of the formal
specification, i.e. the \fIdocidx language syntax\fR specification
and the \fIdocidx language command reference\fR.
.SS FUNDAMENTALS
While the \fIdocidx markup language\fR is quite similar to the
\fIdoctools markup language\fR, in the broadest terms possible,
there is one key difference. An index consists essentially only of
markup commands, with no plain text interspersed between them, except
for whitespace.
.PP
Each markup command is a Tcl command surrounded by a matching pair of
\fB[\fR and \fB]\fR. Inside of these delimiters the usual
rules for a Tcl command apply with regard to word quotation, nested
commands, continuation lines, etc. I.e.
.PP
.CS


    ... [key {markup language}] ...

.CE
.CS


  ... [manpage thefile \\\\
          {file description}] ...

.CE
.SS "BASIC STRUCTURE"
The most simple document which can be written in docidx is
.CS


    [index_begin GROUPTITLE TITLE]
    [index_end]

.CE
.PP
Not very useful, but valid. This also shows us that all docidx
documents consist of only one part where we will list all keys and
their references.
.PP
A more useful index will contain at least keywords, or short 'keys',
i.e. the phrases which were indexed. So:
.CS


[index_begin GROUPTITLE TITLE]
[\fBkey markup\fR]
[\fBkey {semantic markup}]\fR]
[\fBkey {docidx markup}\fR]
[\fBkey {docidx language}\fR]
[\fBkey {docidx commands}\fR]
[index_end]

.CE
.PP
In the above example the command \fBkey\fR is used to declare the
keyword phrases we wish to be part of the index.
.PP
However a truly useful index does not only list the keyword phrases,
but will also contain references to documents associated with the
keywords. Here is a made-up index for all the manpages in the module
\fIbase64\fR:
.CS


[index_begin tcllib/base64 {De- & Encoding}]
[key base64]
[\fBmanpage base64\fR]
[key encoding]
[\fBmanpage base64\fR]
[\fBmanpage uuencode\fR]
[\fBmanpage yencode\fR]
[key uuencode]
[\fBmanpage uuencode\fR]
[key yEnc]
[\fBmanpage yencode\fR]
[key ydecode]
[\fBmanpage yencode\fR]
[key yencode]
[\fBmanpage yencode\fR]
[index_end]

.CE
.PP
In the above example the command \fBmanpage\fR is used to insert
references to documents, using symbolic file names, with each command
belonging to the last \fBkey\fR command coming before it.
.PP
The other command to insert references is \fBurl\fR. In contrast to
\fBmanpage\fR it uses explicit (possibly format-specific) urls to
describe the location of the referenced document. As such this command
is intended for the creation of references to external documents which
could not be handled in any other way.
.SS "ADVANCED STRUCTURE"
In all previous examples we fudged a bit regarding the markup actually
allowed to be used before the \fBindex_begin\fR command opening the
document.
.PP
Instead of only whitespace the two templating commands \fBinclude\fR
and \fBvset\fR are also allowed, to enable the writer to either set
and/or import configuration settings relevant to the table of
contents. I.e. it is possible to write
.CS


[\fBinclude FILE\fR]
[\fBvset VAR VALUE\fR]
[index_begin GROUPTITLE TITLE]
...
[index_end]

.CE
Even more important, these two commands are allowed anywhere where a
markup command is allowed, without regard for any other
structure.
.CS


[index_begin GROUPTITLE TITLE]
[\fBinclude FILE\fR]
[\fBvset VAR VALUE\fR]
...
[index_end]

.CE
The only restriction \fBinclude\fR has to obey is that the contents of
the included file must be valid at the place of the inclusion. I.e. a
file included before \fBindex_begin\fR may contain only the templating
commands \fBvset\fR and \fBinclude\fR, a file included after a key
may contain only manape or url references, and other keys, etc.
.SS ESCAPES
Beyond the 6 commands shown so far we have two more available.
However their function is not the marking up of index structure, but
the insertion of characters, namely \fB[\fR and \fB]\fR.
These commands, \fBlb\fR and \fBrb\fR respectively, are required
because our use of [ and ] to bracket markup commands makes it
impossible to directly use [ and ] within the text.
.PP
Our example of their use are the sources of the last sentence in the
previous paragraph, with some highlighting added.
.CS


  ...
  These commands, [cmd lb] and [cmd lb] respectively, are required
  because our use of [\fBlb\fR] and [\fBrb\fR] to bracket markup commands makes it
  impossible to directly use [\fBlb\fR] and [\fBrb\fR] within the text.
  ...

.CE
.SH "FURTHER READING"
Now that this document has been digested the reader, assumed to be a
\fIwriter\fR of documentation should be fortified enough to be able
to understand the formal \fIdocidx language syntax\fR
specification as well. From here on out the
\fIdocidx language command reference\fR will also serve as the
detailed specification and cheat sheet for all available commands and
their syntax.
.PP
To be able to validate a document while writing it, it is also
recommended to familiarize oneself with Tclapps' ultra-configurable
\fBdtp\fR.
.PP
On the other hand, docidx is perfectly suited for the automatic
generation from doctools documents, and this is the route Tcllib's
easy and simple \fBdtplite\fR goes, creating an index for a set of
documents behind the scenes, without the writer having to do so on
their own.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
docidx_intro, docidx_lang_cmdref, docidx_lang_syntax
.SH KEYWORDS
docidx commands, docidx language, docidx markup, docidx syntax, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/docidx_lang_syntax.n.



















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/docidx_lang_syntax.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "docidx_lang_syntax" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
docidx_lang_syntax \- docidx language syntax
.SH DESCRIPTION
.PP
This document contains the formal specification of the syntax of the
docidx markup language, version 1 in Backus-Naur-Form. This document
is intended to be a reference, complementing the
\fIdocidx language command reference\fR.
A beginner should read the much more informally written
\fIdocidx language introduction\fR first before trying to
understand either this document or the command reference.
.SH FUNDAMENTALS
In the broadest terms possible the \fIdocidx markup language\fR is
like SGML and similar languages. A document written in this language
consists primarily of markup commands, with text embedded into it at
some places.
.PP
Each markup command is a just Tcl command surrounded by a matching
pair of \fB[\fR and \fB]\fR. Which commands are available,
and their arguments, i.e. syntax is specified in the
\fIdocidx language command reference\fR.
.PP
In this document we specify first the lexeme, and then the syntax,
i.e. how we can mix text and markup commands with each other.
.SH "LEXICAL DEFINITIONS"
In the syntax rules listed in the next section
.IP [1]
<TEXT> stands for all text except markup commands.
.IP [2]
Any XXX stands for the markup command [xxx] including its
arguments. Each markup command is a Tcl command surrounded by a
matching pair of \fB[\fR and \fB]\fR. Inside of these
delimiters the usual rules for a Tcl command apply with regard to word
quotation, nested commands, continuation lines, etc.
.IP [3]
<WHITE> stands for all text consisting only of spaces, newlines,
tabulators and the \fBcomment\fR markup command.
.PP
.SH SYNTAX
The rules listed here specify only the syntax of docidx documents. The
lexical level of the language was covered in the previous section.
.PP
Regarding the syntax of the (E)BNF itself
.IP [1]
The construct { X } stands for zero or more occurrences of X.
.IP [2]
The construct [ X ] stands for zero or one occurrence of X.
.PP
The syntax:
.CS


index     = defs
            INDEX_BEGIN
            [ contents ]
            INDEX_END
            { <WHITE> }

defs      = { INCLUDE | VSET | <WHITE> }
contents  = keyword { keyword }

keyword   = defs KEY ref { ref }
ref       = MANPAGE | URL | defs

.CE
At last a rule we were unable to capture in the EBNF syntax, as it is
about the arguments of the markup commands, something which is not
modeled here.
.IP [1]
The arguments of all markup commands have to be plain text, and/or text
markup commands, i.e. one of
.RS
.IP [1]
\fBlb\fR,
.IP [2]
\fBrb\fR, or
.IP [3]
\fBvset\fR (1-argument form).
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
docidx_intro, docidx_lang_cmdref, docidx_lang_faq, docidx_lang_intro
.SH KEYWORDS
docidx commands, docidx language, docidx markup, docidx syntax, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/docidx_plugin_apiref.n.









































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/docidx_plugin_apiref.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "docidx_plugin_apiref" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
docidx_plugin_apiref \- docidx plugin API reference
.SH SYNOPSIS
\fBdt_fmap\fR \fIsymfname\fR
.sp
\fBdt_format\fR
.sp
\fBdt_read\fR \fIfile\fR
.sp
\fBdt_source\fR \fIfile\fR
.sp
\fBex_cappend\fR \fItext\fR
.sp
\fBex_cget\fR \fIvarname\fR
.sp
\fBex_cis\fR \fIcname\fR
.sp
\fBex_cname\fR
.sp
\fBex_cpop\fR \fIcname\fR
.sp
\fBex_cpush\fR \fIcname\fR
.sp
\fBex_cset\fR \fIvarname\fR \fIvalue\fR
.sp
\fBex_lb\fR ?\fInewbracket\fR?
.sp
\fBex_rb\fR ?\fInewbracket\fR?
.sp
\fBidx_initialize\fR
.sp
\fBidx_listvariables\fR
.sp
\fBidx_numpasses\fR
.sp
\fBidx_postprocess\fR \fItext\fR
.sp
\fBidx_setup\fR \fIn\fR
.sp
\fBidx_shutdown\fR
.sp
\fBidx_varset\fR \fIvarname\fR \fItext\fR
.sp
\fBfmt_plain_text\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
This document is intended for \fIplugin writers\fR, i.e. developers
wishing to write an index \fIformatting engine\fR for some output
format X.
.PP
It specifies the interaction between the \fBdoctools::idx\fR
package and its plugins, i.e. the interface any index formatting
engine has to comply with.
.PP
This document deals with version 1 of the interface.
.PP
A reader who is on the other hand more interested in the markup
language itself should start with the
\fIdocidx language introduction\fR and proceed from there to the
formal specifications, i.e. the \fIdocidx language syntax\fR and
the \fIdocidx language command reference\fR.
.SH OVERVIEW
The API for an index formatting engine consists of two major sections.
.PP
On the one side we have a set of commands through which the plugin is
able to query the frontend. These commands are provided by the
frontend and linked into the plugin interpreter. Please see section
\fBFRONTEND COMMANDS\fR for their detailed specification.
.PP
And on the other side the plugin has to provide its own set of
commands which will then be called by the frontend in a specific
sequence while processing input. They, again, fall into two
categories, management and formatting.
Please see section \fBPLUGIN COMMANDS\fR and its subsections for
their detailed specification.
.SH "FRONTEND COMMANDS"
This section specifies the set of commands through which a plugin,
also known as an index formatting engine, is able to query the
frontend. These commands are provided by the frontend and linked into
the plugin interpreter.
.PP
I.e. an index formatting engine can assume that all of the following
commands are present when any of its own commands (as specified in
section \fBPLUGIN COMMANDS\fR) are executed.
.PP
Beyond that it can also assume that it has full access to its own safe
interpreter and thus is not able to damage the other parts of the
processor, nor can it damage the filesystem.
It is however able to either kill or hang the whole process, by
exiting, or running an infinite loop.
.PP
Coming back to the imported commands, all the commands with prefix
\fIdt_\fR provide limited access to specific parts of the frontend,
whereas the commands with prefix \fIex_\fR provide access to the
state of the \fBtextutil::expander\fR object which does the main
parsing of the input within the frontend. These commands should not be
except under very special circumstances.
.PP
.TP
\fBdt_fmap\fR \fIsymfname\fR
Query command. It returns the actual pathname to use in the output in
place of the symbolic filename \fIsymfname\fR. It will return the
unchanged input if no mapping was established for \fIsymfname\fR.
.sp
The required mappings are established with the method \fBmap\fR of
a frontend, as explained in section \fBOBJECT METHODS\fR
of the documentation for the package \fBdoctools::idx\fR.
.TP
\fBdt_format\fR
Query command. It returns the name of the format associated with the
index formatting engine.
.TP
\fBdt_read\fR \fIfile\fR
Controlled filesystem access. Returns contents of \fIfile\fR for
whatever use desired by the plugin.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.
.TP
\fBdt_source\fR \fIfile\fR
Controlled filesystem access. This command allows the index formatting
engine to load additional Tcl code it may need.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.
.TP
\fBex_cappend\fR \fItext\fR
Appends a string to the output in the current context.  This command
should rarely be used by macros or application code.
.TP
\fBex_cget\fR \fIvarname\fR
Retrieves the value of variable \fIvarname\fR, defined in the current
context.
.TP
\fBex_cis\fR \fIcname\fR
Determines whether or not the name of the current context is
\fIcname\fR.
.TP
\fBex_cname\fR
Returns the name of the current context.
.TP
\fBex_cpop\fR \fIcname\fR
Pops a context from the context stack, returning all accumulated
output in that context.  The context must be named \fIcname\fR, or an
error results.
.TP
\fBex_cpush\fR \fIcname\fR
Pushes a context named \fIcname\fR onto the context stack.  The
context must be popped by \fBcpop\fR before expansion ends or an
error results.
.TP
\fBex_cset\fR \fIvarname\fR \fIvalue\fR
Sets variable \fIvarname\fR to \fIvalue\fR in the current context.
.TP
\fBex_lb\fR ?\fInewbracket\fR?
Returns the current value of the left macro expansion bracket; this is
for use as or within a macro, when the bracket needs to be included in
the output text.  If \fInewbracket\fR is specified, it becomes the new
bracket, and is returned.
.TP
\fBex_rb\fR ?\fInewbracket\fR?
Returns the current value of the right macro expansion bracket; this
is for use as or within a macro, when the bracket needs to be included
in the output text.  If \fInewbracket\fR is specified, it becomes the
new bracket, and is returned.
.PP
.SH "PLUGIN COMMANDS"
The plugin has to provide its own set of commands which will then be
called by the frontend in a specific sequence while processing
input. They fall into two categories, management and formatting. Their
expected names, signatures, and responsibilities are specified in the
following two subsections.
.SS "MANAGEMENT COMMANDS"
The management commands a plugin has to provide are used by the
frontend to
.IP [1]
initialize and shutdown the plugin
.IP [2]
determine the number of passes it has
to make over the input
.IP [3]
initialize and shutdown each pass
.IP [4]
query and initialize engine parameters
.PP
.PP
After the plugin has been loaded and the frontend commands are
established the commands will be called in the following sequence:
.CS


    idx_numpasses -> n
    idx_listvariables -> vars

    idx_varset var1 value1
    idx_varset var2 value2
    ...
    idx_varset varK valueK
    idx_initialize
    idx_setup 1
    ...
    idx_setup 2
    ...
    ...
    idx_setup n
    ...
    idx_postprocess
    idx_shutdown
    ...

.CE
I.e. first the number of passes and the set of available engine
parameters is established, followed by calls setting the
parameters. That second part is optional.
.PP
After that the plugin is initialized, the specified number of passes
executed, the final result run through a global post processing step
and at last the plugin is shutdown again. This can be followed by more
conversions, restarting the sequence at \fBidx_varset\fR.
.PP
In each of the passes, i.e. after the calls of \fBidx_setup\fR the
frontend will process the input and call the formatting commands as
markup is encountered. This means that the sequence of formatting
commands is determined by the grammar of the docidx markup language,
as specified in the \fIdocidx language syntax\fR specification.
.PP
A different way of looking at the sequence is:
.IP \(bu
First some basic parameters are determined.
.IP \(bu
Then everything starting at the first \fBidx_varset\fR to
\fBidx_shutdown\fR forms a \fIrun\fR, the formatting of a
single input. Each run can be followed by more.
.IP \(bu
Embedded within each run we have one or more \fIpasses\fR,
each starting with \fBidx_setup\fR and going until either the next
\fBidx_setup\fR or \fBidx_postprocess\fR is reached.
.sp
If more than one pass is required to perform the formatting only the
output of the last pass is relevant. The output of all the previous,
preparatory passes is ignored.
.PP
.PP
The commands, their names, signatures, and responsibilities are, in
detail:
.TP
\fBidx_initialize\fR
\fIInitialization/Shutdown\fR.
This command is called at the beginning of every conversion run, as
the first command of that run. Note that a run is not a pass, but may
consist of multiple passes.
It has to initialize the general state of the plugin, beyond the
initialization done during the load. No return value is expected, and
any returned value is ignored.
.TP
\fBidx_listvariables\fR
\fIInitialization/Shutdown\fR and \fIEngine parameters\fR.
Second command is called after the plugin code has been loaded,
i.e. immediately after \fBidx_numpasses\fR.
It has to return a list containing the names of the parameters the
frontend can set to configure the engine. This list can be empty.
.TP
\fBidx_numpasses\fR
\fIInitialization/Shutdown\fR and \fIPass management\fR.
First command called after the plugin code has been loaded. No other
command of the engine will be called before it.
It has to return the number of passes this engine requires to fully
process the input document. This value has to be an integer number
greater or equal to one.
.TP
\fBidx_postprocess\fR \fItext\fR
\fIInitialization/Shutdown\fR.
This command is called immediately after the last pass in a run. Its
argument is the result of the conversion generated by that pass. It is
provided to allow the engine to perform any global modifications of
the generated document. If no post-processing is required for a
specific format the command has to just return the argument.
.sp
Expected to return a value, the final result of formatting the input.
.TP
\fBidx_setup\fR \fIn\fR
\fIInitialization/Shutdown\fR and \fIPass management\fR.
This command is called at the beginning of each pass over the input in
a run. Its argument is the number of the pass which has begun. Passes
are counted from \fB1\fR upward.
The command has to set up the internal state of the plugin for this
particular pass. No return value is expected, and any returned value
is ignored.
.TP
\fBidx_shutdown\fR
\fIInitialization/Shutdown\fR.
This command is called at the end of every conversion run. It is the
last command called in a run. It has to clean up of all the
run-specific state in the plugin.
After the call the engine has to be in a state which allows the
initiation of another run without fear that information from the last
run is leaked into this new run.
No return value is expected, and any returned value is ignored.
.TP
\fBidx_varset\fR \fIvarname\fR \fItext\fR
\fIEngine parameters\fR.
This command is called by the frontend to set an engine parameter to a
particular value.
The parameter to change is specified by \fIvarname\fR, the value to
set in \fItext\fR.
.sp
The command has to throw an error if an unknown \fIvarname\fR is
used. Only the names returned by \fBidx_listvariables\fR have to be
considered as known.
.sp
The values of all engine parameters have to persist between passes and
runs.
.PP
.SS "FORMATTING COMMANDS"
The formatting commands have to implement the formatting for the
output format, for all the markup commands of the docidx markup
language, except \fBlb\fR, \fBrb\fR, \fBvset\fR, \fBinclude\fR, and
\fBcomment\fR. These exceptions are processed by the frontend and are
never seen by the plugin. In return a command for the formatting of
plain text has to be provided, something which has no markup in the
input at all.
.PP
This means, that each of the five markup commands specified in the
\fIdocidx language command reference\fR and outside of the set of
exceptions listed above has an equivalent formatting command which
takes the same arguments as the markup command and whose name is the
name of markup command with the prefix \fIfmt_\fR added to it.
.PP
All commands are expected to format their input in some way per the
semantics specified in the command reference and to return whatever
part of this that they deem necessary as their result, which will be
added to the output.
.PP
To avoid essentially duplicating the command reference we do not list
any of the command here and simply refer the reader to the
\fIdocidx language command reference\fR for their signature and
description. The sole exception is the plain text formatter, which has
no equivalent markup command.
.PP
The calling sequence of formatting commands is not as rigid as for the
management commands, but determined by the grammar of the docidx
markup language, as specified in the \fIdocidx language syntax\fR
specification.
.PP
.TP
\fBfmt_plain_text\fR \fItext\fR
\fINo associated markup command\fR.
.sp
Called by the frontend for any plain text encountered in the
input. It has to perform any and all special processing required for
plain text.
.sp
The formatted text is expected as the result of the command,
and added to the output. If no special processing is required it has
to simply return its argument without change.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
docidx_intro, docidx_lang_cmdref, docidx_lang_faq, docidx_lang_intro, docidx_lang_syntax, doctools::idx
.SH KEYWORDS
formatting engine, index, index formatter, keywords, markup, plugin, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctoc.n.
























































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctoc.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003-2010 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc" n 1.1.3 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc \- doctoc - Processing tables of contents
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBdoctools::toc  ?1.1.3?\fR
.sp
\fB::doctools::toc::new\fR \fIobjectName\fR ?\fB-option\fR \fIvalue\fR ...?
.sp
\fB::doctools::toc::help\fR
.sp
\fB::doctools::toc::search\fR \fIpath\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBconfigure\fR
.sp
\fIobjectName\fR \fBconfigure\fR \fIoption\fR
.sp
\fIobjectName\fR \fBconfigure\fR \fB-option\fR \fIvalue\fR...
.sp
\fIobjectName\fR \fBcget\fR \fB-option\fR
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBformat\fR \fItext\fR
.sp
\fIobjectName\fR \fBmap\fR \fIsymbolic\fR \fIactual\fR
.sp
\fIobjectName\fR \fBparameters\fR
.sp
\fIobjectName\fR \fBsearch\fR \fIpath\fR
.sp
\fIobjectName\fR \fBsetparam\fR \fIname\fR \fIvalue\fR
.sp
\fIobjectName\fR \fBwarnings\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for the creation of objects able to
process and convert text written in the \fIdoctoc\fR markup language
into any output format X for which a \fIformatting engine\fR is
available.
.PP
A reader interested in the markup language itself should start with
the \fIdoctoc language introduction\fR and proceed from there to
the formal specifications, i.e. the \fIdoctoc language syntax\fR
and the \fIdoctoc language command reference\fR.
.PP
If on the other hand the reader wishes to write her own formatting
engine for some format, i.e. is a \fIplugin writer\fR then reading
and understanding the \fIdoctoc plugin API reference\fR is an
absolute necessity, as that document specifies the interaction between
this package and its plugins, i.e. the formatting engines, in detail.
.SH "PUBLIC API"
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::toc::new\fR \fIobjectName\fR ?\fB-option\fR \fIvalue\fR ...?
This command creates a new doctoc object with an associated Tcl
command whose name is \fIobjectName\fR. This \fIobject\fR command is
explained in full detail in the sections \fBOBJECT COMMAND\fR
and \fBOBJECT METHODS\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.sp
The options and their values coming after the name of the object are
used to set the initial configuration of the object.
.TP
\fB::doctools::toc::help\fR
This is a convenience command for applications wishing to provide
their user with a short description of the available formatting
commands and their meanings. It returns a string containing a standard
help text.
.TP
\fB::doctools::toc::search\fR \fIpath\fR
Whenever an object created by this the package has to map the name of
a format to the file containing the code for its formatting engine it
will search for the file in a number of directories stored in a
list. See section \fBFORMAT MAPPING\fR for more explanations.
.sp
This list not only contains three default directories which are
declared by the package itself, but is also extensible user of the
package.
This command is the means to do so. When given a \fIpath\fR to an
existing and readable directory it will prepend that directory to the
list of directories to search. This means that the \fIpath\fR added
last is later searched through first.
.sp
An error will be thrown if the \fIpath\fR either does not exist, is
not a directory, or is not readable.
.PP
.SS "OBJECT COMMAND"
All commands created by \fB::doctools::toc::new\fR have the following
general form and may be used to invoke various operations on their
doctoc converter object.
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the exact
behavior of the command. See section \fBOBJECT METHODS\fR for
the detailed specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBconfigure\fR
The method returns a list of all known options and their current
values when called without any arguments.
.TP
\fIobjectName\fR \fBconfigure\fR \fIoption\fR
The method behaves like the method \fBcget\fR when called with a
single argument and returns the value of the option specified by said
argument.
.TP
\fIobjectName\fR \fBconfigure\fR \fB-option\fR \fIvalue\fR...
The method reconfigures the specified \fBoption\fRs of the object,
setting them to the associated \fIvalue\fRs, when called with an even
number of arguments, at least two.
.sp
The legal options are described in the section
\fBOBJECT CONFIGURATION\fR.
.TP
\fIobjectName\fR \fBcget\fR \fB-option\fR
This method expects a legal configuration option as argument and will
return the current value of that option for the object the method was
invoked for.
.sp
The legal configuration options are described in section
\fBOBJECT CONFIGURATION\fR.
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBformat\fR \fItext\fR
This method runs the \fItext\fR through the configured formatting
engine and returns the generated string as its result. An error will
be thrown if no \fB-format\fR was configured for the object.
.sp
The method assumes that the \fItext\fR is in \fIdoctoc\fR format as
specified in the companion document \fIdoctoc_fmt\fR. Errors will be
thrown otherwise.
.TP
\fIobjectName\fR \fBmap\fR \fIsymbolic\fR \fIactual\fR
This methods add one entry to the per-object mapping from
\fIsymbolic\fR filenames to the \fIactual\fR uris.
The object just stores this mapping and makes it available to the
configured formatting engine through the command \fBdt_fmap\fR.
This command is described in more detail in the
\fIdoctoc plugin API reference\fR which specifies the interaction
between the objects created by this package and toc formatting
engines.
.TP
\fIobjectName\fR \fBparameters\fR
This method returns a list containing the names of all engine
parameters provided by the configured formatting engine. It will
return an empty list if the object is not yet configured for a
specific format.
.TP
\fIobjectName\fR \fBsearch\fR \fIpath\fR
This method extends the per-object list of paths searched for toc
formatting engines. See also the command \fB::doctools::toc::search\fR
on how to extend the per-package list of paths. Note that the path
entered last will be searched first.
For more details see section \fBFORMAT MAPPING\fR.
.TP
\fIobjectName\fR \fBsetparam\fR \fIname\fR \fIvalue\fR
This method sets the \fIname\fRd engine parameter to the specified
\fIvalue\fR.
It will throw an error if the object is either not yet configured for
a specific format, or if the formatting engine for the configured
format does not provide a parameter with the given \fIname\fR.
The list of parameters provided by the configured formatting engine
can be retrieved through the method \fBparameters\fR.
.TP
\fIobjectName\fR \fBwarnings\fR
This method returns a list containing all the warnings which were
generated by the configured formatting engine during the last
invocation of the method \fBformat\fR.
.PP
.SS "OBJECT CONFIGURATION"
All doctoc objects understand the following configuration options:
.TP
\fB-file\fR \fIfile\fR
The argument of this option is stored in the object and made available
to the configured formatting engine through the command \fBdt_file\fR.
This command is described in more detail in the companion document
\fIdoctoc_api\fR which specifies the API between the object and
formatting engines.
.sp
The default value of this option is the empty string.
.sp
The configured formatting engine should interpret the value as the
name of the file containing the document which is currently processed.
.TP
\fB-format\fR \fItext\fR
The argument of this option specifies the format to generate and by
implication the formatting engine to use when converting text via the
method \fBformat\fR. Its default value is the empty string. The
method \fBformat\fR cannot be used if this option is not set to a
valid value at least once.
.sp
The package will immediately try to map the given name to a file
containing the code for a formatting engine generating that format. An
error will be thrown if this mapping fails. In that case a previously
configured format is left untouched.
.sp
The section \fBFORMAT MAPPING\fR explains in detail how the
package and object will look for engine implementations.
.PP
.SS "FORMAT MAPPING"
The package and object will perform the following algorithm when
trying to map a format name \fIfoo\fR to a file containing an
implementation of a formatting engine for \fIfoo\fR:
.IP [1]
If \fIfoo\fR is the name of an existing file then this file is
directly taken as the implementation.
.IP [2]
If not, the list of per-object search paths is searched. For each
directory in the list the package checks if that directory contains a
file "\fItoc.\fIfoo\fR\fR". If yes, then that file is taken as the
implementation.
.sp
Note that this list of paths is initially empty and can be extended
through the object method \fBsearch\fR.
.IP [3]
If not, the list of package paths is searched.
For each directory in the list the package checks if that directory
contains a file "\fItoc.\fIfoo\fR\fR". If yes, then that file is taken
as the implementation.
.sp
This list of paths can be extended
through the command \fB::doctools::toc::search\fR.
It contains initially one path, the subdirectory "\fImpformats\fR" of
the directory the package itself is located in. In other words, if the
package implementation "\fIdoctoc.tcl\fR" is installed in the directory
"\fI/usr/local/lib/tcllib/doctools\fR" then it will by default search
the directory "\fI/usr/local/lib/tcllib/doctools/mpformats\fR" for
format implementations.
.IP [4]
The mapping fails.
.PP
.SH "PREDEFINED ENGINES"
The package provides predefined formatting engines for the following
formats. Some of the formatting engines support engine
parameters. These will be explicitly highlighted.
.TP
html
This engine generates HTML markup, for processing by web browsers and
the like. This engine supports three parameters:
.RS
.TP
footer
The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
before the \fB</body>\fR tag, closing the body of the generated
HTML.
.sp
This can be used to insert boilerplate footer markup into the
generated document.
.TP
header
The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the \fB<body>\fR tag, starting the body of the generated HTML.
.sp
This can be used to insert boilerplate header markup into the
generated document.
.TP
meta
The value for this parameter has to be valid selfcontained HTML markup
for the header section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the \fB<head>\fR tag, starting the header section of the
generated HTML.
.sp
This can be used to insert boilerplate meta data markup into the
generated document, like references to a stylesheet, standard meta
keywords, etc.
.RE
.sp
.TP
latex
This engine generates output suitable for the \fBlatex\fR text
processor coming out of the TeX world.
.TP
list
This engine retrieves version, section and title of the manpage from
the document. As such it can be used to generate a directory listing
for a set of manpages.
.TP
nroff
This engine generates nroff output, for processing by \fBnroff\fR,
or \fBgroff\fR. The result will be standard man pages as they are
known in the unix world.
.TP
null
This engine generates no outout at all. This can be used if one just
wants to validate some input.
.TP
tmml
This engine generates TMML markup as specified by Joe English. The Tcl
Manpage Markup Language is a derivate of XML.
.TP
wiki
This engine generates Wiki markup as understood by Jean Claude
Wippler's \fBwikit\fR application.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
doctoc_intro, doctoc_lang_cmdref, doctoc_lang_intro, doctoc_lang_syntax, doctoc_plugin_apiref
.SH KEYWORDS
HTML, TMML, conversion, doctoc, documentation, latex, manpage, markup, nroff, table of contents, toc, wiki
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2003-2010 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctoc_intro.n.































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctoc_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctoc_intro" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctoc_intro \- doctoc introduction
.SH DESCRIPTION
.PP
\fIdoctoc\fR (short for \fIdocumentation tables of contents\fR)
stands for a set of related, yet different, entities which are working
together for the easy creation and transformation of tables of
contents for documentation. These are
.IP [1]
A tcl based language for the semantic markup of a table of
contents. Markup is represented by Tcl commands.
.IP [2]
A package providing the ability to read and transform texts written in
that markup language. It is important to note that the actual
transformation of the input text is delegated to plugins.
.IP [3]
An API describing the interface between the package above and a
plugin.
.PP
.PP
Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.
.PP
.IP [1]
A \fIwriter\fR of documentation has to understand the markup language
itself. A beginner to doctoc should read the more informally written
\fIdoctoc language introduction\fR first. Having digested this
the formal \fIdoctoc language syntax\fR specification should
become understandable. A writer experienced with doctoc may only
need the \fIdoctoc language command reference\fR from time to
time to refresh her memory.
.sp
While a document is written the \fBdtp\fR application can be used
to validate it, and after completion it also performs the conversion
into the chosen system of visual markup, be it *roff, HTML, plain
text, wiki, etc. The simpler \fBdtplite\fR application makes
internal use of doctoc when handling directories of documentation,
automatically generating a proper table of contents for them.
.IP [2]
A \fIprocessor\fR of documentation written in the \fIdoctoc\fR
markup language has to know which tools are available for use.
.sp
The main tool is the aforementioned \fBdtp\fR application provided
by Tcllib. The simpler \fBdtplite\fR does not expose doctoc to the
user.
At the bottom level, common to both applications, however sits the
package \fBdoctoools::toc\fR, providing the basic facilities to
read and process files containing text in the doctoc format.
.IP [3]
At last, but not least, \fIplugin writers\fR have to understand the
interaction between the \fBdoctools::toc\fR package and its
plugins, as described in the \fIdoctoc plugin API reference\fR.
.PP
.SH "RELATED FORMATS"
doctoc does not stand alone, it has two companion formats. These are
called \fIdocidx\fR and \fIdoctools\fR, and they are for the markup
of \fIkeyword indices\fR, and general documentation, respectively.
They are described in their own sets of documents, starting at the
\fIdocidx introduction\fR and the \fIdoctools introduction\fR,
respectively.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
docidx_intro, doctoc_lang_cmdref, doctoc_lang_faq, doctoc_lang_intro, doctoc_lang_syntax, doctoc_plugin_apiref, doctools::toc, doctools_intro
.SH KEYWORDS
markup, semantic markup, table of contents, toc
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctoc_lang_cmdref.n.


















































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctoc_lang_cmdref.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctoc_lang_cmdref" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctoc_lang_cmdref \- doctoc language command reference
.SH SYNOPSIS
\fBcomment\fR \fIplaintext\fR
.sp
\fBdivision_end\fR
.sp
\fBdivision_start\fR \fItext\fR ?\fIsymfile\fR?
.sp
\fBinclude\fR \fIfilename\fR
.sp
\fBitem\fR \fIfile\fR \fItext\fR \fIdesc\fR
.sp
\fBlb\fR
.sp
\fBrb\fR
.sp
\fBtoc_begin\fR \fItext\fR \fItitle\fR
.sp
\fBtoc_end\fR
.sp
\fBvset\fR \fIvarname\fR \fIvalue\fR
.sp
\fBvset\fR \fIvarname\fR
.sp
.BE
.SH DESCRIPTION
.PP
This document specifies both names and syntax of all the commands
which together are the doctoc markup language, version 1.
As this document is intended to be a reference the commands are listed
in alphabetical order, and the descriptions are relatively short.
A beginner should read the much more informally written
\fIdoctoc language introduction\fR first.
.SH COMMANDS
.TP
\fBcomment\fR \fIplaintext\fR
Toc markup. The argument text is marked up as a comment standing
outside of the actual text of the document. Main use is in free-form
text.
.TP
\fBdivision_end\fR
Toc structure. This command closes the division opened by the last
\fBdivision_begin\fR command coming before it, and not yet closed.
.TP
\fBdivision_start\fR \fItext\fR ?\fIsymfile\fR?
Toc structure. This command opens a division in the table of
contents. Its counterpart is \fBdivision_end\fR. Together they allow a
user to give a table of contents additional structure.
.sp
The title of the new division is provided by the argument \fItext\fR.
.sp
If the symbolic filename \fIsymfile\fR is present then the section
title should link to the referenced document, if links are supported
by the output format.
.TP
\fBinclude\fR \fIfilename\fR
Templating. The contents of the named file are interpreted as text
written in the doctoc markup and processed in the place of the
include command. The markup in the file has to be self-contained. It
is not possible for a markup command to cross the file boundaries.
.TP
\fBitem\fR \fIfile\fR \fItext\fR \fIdesc\fR
Toc structure. This command adds an individual element to the table of
contents. Each such element refers to a document. The document is
specified through the symbolic name \fIfile\fR. The \fItext\fR
argument is used to label the reference, whereas the \fIdesc\fR
provides a short descriptive text of that document.
.sp
The symbolic names are used to preserve the convertibility of this
format to any output format. The actual name of the file will be
inserted by the chosen formatting engine when converting the
input. This will be based on a mapping from symbolic to actual names
given to the engine.
.TP
\fBlb\fR
Text. The command is replaced with a left bracket. Use in free-form
text. Required to avoid interpretation of a left bracket as the start
of a markup command. Its usage is restricted to the arguments of other
markup commands.
.TP
\fBrb\fR
Text. The command is replaced with a right bracket. Use in free-form
text. Required to avoid interpretation of a right bracket as the end
of a markup command. Its usage is restricted to the arguments of other
commands.
.TP
\fBtoc_begin\fR \fItext\fR \fItitle\fR
Document structure. The command to start a table of contents. The
arguments are a label for the whole group of documents the index
refers to (\fItext\fR) and the overall title text for the index
(\fItitle\fR), without markup.
.sp
The label often is the name of the package (or extension) the
documents belong to.
.TP
\fBtoc_end\fR
Document structure. Command to end a table of contents. Anything in
the document coming after this command is in error.
.TP
\fBvset\fR \fIvarname\fR \fIvalue\fR
Templating. In this form the command sets the named document variable
to the specified \fIvalue\fR. It does not generate output. I.e. the
command is replaced by the empty string.
.TP
\fBvset\fR \fIvarname\fR
Templating. In this form the command is replaced by the value of the
named document variable
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
doctoc_intro, doctoc_lang_faq, doctoc_lang_intro, doctoc_lang_syntax
.SH KEYWORDS
doctoc commands, doctoc language, doctoc markup, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctoc_lang_faq.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctoc_lang_faq.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctoc_lang_faq" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctoc_lang_faq \- doctoc language faq
.SH DESCRIPTION
.PP
.SH OVERVIEW
.SS "WHAT IS THIS DOCUMENT?"
This document is currently mainly a placeholder, to be filled with
commonly asked questions about the doctoc markup language and
companions, and their answers.
.PP
Please report any questions (and, if possible, answers) we should
consider for this document in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
.SH EXAMPLES
.SS "WHERE DO I FIND DOCTOC EXAMPLES?"
We have no direct examples of documents written using doctoc
markup. However the doctools processor \fBdtplite\fR does generate
a table of contents when processing a set of documents written in
doctools markup. The intermediate file for it uses doctoc markup and
is not deleted when generation completes. Such files can therefore
serve as examples.
.PP
\fBdtplite\fR is distributed as part of Tcllib, so to get it you
need one of
.IP [1]
A CVS snapshot of Tcllib. How to retrieve such a snapshot and the
tools required for this are described at
\fIhttp://sourceforge.net/cvs/?group_id=12883\fR
.IP [2]
A Tcllib release archive. They are available at
\fIhttp://sourceforge.net/project/showfiles.php?group_id=12883\fR
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report any such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
the package and/or the documentation.
.SH "SEE ALSO"
doctoc_lang_cmdref, doctoc_lang_intro, doctoc_lang_syntax
.SH KEYWORDS
doctoc commands, doctoc language, doctoc markup, doctoc syntax, examples, faq, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctoc_lang_intro.n.


























































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctoc_lang_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctoc_lang_intro" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctoc_lang_intro \- doctoc language introduction
.SH DESCRIPTION
.PP
This document is an informal introduction to version 1.1 of the doctoc
markup language based on a multitude of examples. After reading this a
writer should be ready to understand the two parts of the formal
specification, i.e. the \fIdoctoc language syntax\fR specification
and the \fIdoctoc language command reference\fR.
.SS FUNDAMENTALS
While the \fIdoctoc markup language\fR is quite similar to the
\fIdoctools markup language\fR, in the broadest terms possible,
there is one key difference. A table of contents consists essentially
only of markup commands, with no plain text interspersed between them,
except for whitespace.
.PP
Each markup command is a Tcl command surrounded by a matching pair of
\fB[\fR and \fB]\fR. Inside of these delimiters the usual
rules for a Tcl command apply with regard to word quotation, nested
commands, continuation lines, etc. I.e.
.PP
.CS


    ... [division_start {Appendix 1}] ...

.CE
.CS


  ... [item thefile \\\\
          label {file description}] ...

.CE
.SS "BASIC STRUCTURE"
The most simple document which can be written in doctoc is
.CS


    [toc_begin GROUPTITLE TITLE]
    [toc_end]

.CE
This also shows us that all doctoc documents consist of only one
part where we will list \fIitems\fR and \fIdivisions\fR.
.PP
The user is free to mix these as she sees fit. This is a change from
version 1 of the language, which did not allow this mixing, but only
the use of either a series of items or a series of divisions.
.PP
We will discuss the commands for each of these two possibilities in
the next sections.
.SS ITEMS
Use the command \fBitem\fR to put an \fIitem\fR into a table of
contents. This is essentially a reference to a section, subsection,
etc. in the document, or set of documents, the table of contents is
for. The command takes three arguments, a symbolic name for the file
the item is for and two text to label the item and describe the
referenced section.
.PP
Symbolic names are used to preserve the convertibility of this format
to any output format. The actual name of any file will be inserted by
the chosen formatting engine when converting the input, based on a
mapping from symbolic to actual names given to the engine.
.PP
Here a made up example for a table of contents of this document:
.CS


[toc_begin Doctoc {Language Introduction}]
[\fBitem 1 DESCRIPTION\fR]
[\fBitem 1.1 {Basic structure}\fR]
[\fBitem 1.2 Items\fR]
[\fBitem 1.3 Divisions\fR]
[\fBitem 2 {FURTHER READING}\fR]
[toc_end]

.CE
.SS DIVISIONS
One thing of notice in the last example in the previous section is
that the referenced sections actually had a nested structure,
something which was expressed in the item labels, by using a common
prefix for all the sections nested under section 1.
.PP
This kind of structure can be made more explicit in the doctoc
language by using divisions. Instead of using a series of plain items
we use a series of divisions for the major references, and then place
the nested items inside of these.
.PP
Of course, instead of the nested items we can again use divisions and
thus nest arbitrarily deep.
.PP
A division is marked by two commands instead of one, one to start it,
the other to close the last opened division. They are:
.TP
\fBdivision_start\fR
This command opens a new division. It takes one or two arguments, the
title of the division, and the symbolic name of the file it refers
to. The latter is optional.
If the symbolic filename is present then the section title should link
to the referenced document, if links are supported by the output
format.
.TP
\fBdivision_end\fR
This command closes the last opened and not yet closed division.
.PP
.PP
Using this we can recast the last example like this
.CS


[toc_begin Doctoc {Language Introduction}]
[\fBdivision_start DESCRIPTION\fR]
[item 1 {Basic structure}]
[item 2 Items]
[item 3 Divisions]
[\fBdivision_end\fR]
[\fBdivision_start {FURTHER READING}\fR]
[\fBdivision_end\fR]
[toc_end]

.CE
.PP
Or, to demonstrate deeper nesting
.CS


[toc_begin Doctoc {Language Introduction}]
[\fBdivision_start DESCRIPTION\fR]
[\fBdivision_start {Basic structure}\fR]
[item 1 Do]
[item 2 Re]
[\fBdivision_end\fR]
[\fBdivision_start Items\fR]
[item a Fi]
[item b Fo]
[item c Fa]
[\fBdivision_end\fR]
[\fBdivision_start Divisions\fR]
[item 1 Sub]
[item 1 Zero]
[\fBdivision_end\fR]
[\fBdivision_end\fR]
[\fBdivision_start {FURTHER READING}\fR]
[\fBdivision_end\fR]
[toc_end]

.CE
And do not forget, it is possible to freely mix items and divisions,
and to have empty divisions.
.CS


[toc_begin Doctoc {Language Introduction}]
[item 1 Do]
[\fBdivision_start DESCRIPTION\fR]
[\fBdivision_start {Basic structure}\fR]
[item 2 Re]
[\fBdivision_end\fR]
[item a Fi]
[\fBdivision_start Items\fR]
[item b Fo]
[item c Fa]
[\fBdivision_end\fR]
[\fBdivision_start Divisions\fR]
[\fBdivision_end\fR]
[\fBdivision_end\fR]
[\fBdivision_start {FURTHER READING}\fR]
[\fBdivision_end\fR]
[toc_end]

.CE
.SS "ADVANCED STRUCTURE"
In all previous examples we fudged a bit regarding the markup actually
allowed to be used before the \fBtoc_begin\fR command opening the
document.
.PP
Instead of only whitespace the two templating commands \fBinclude\fR
and \fBvset\fR are also allowed, to enable the writer to either set
and/or import configuration settings relevant to the table of
contents. I.e. it is possible to write
.CS


[\fBinclude FILE\fR]
[\fBvset VAR VALUE\fR]
[toc_begin GROUPTITLE TITLE]
...
[toc_end]

.CE
Even more important, these two commands are allowed anywhere where a
markup command is allowed, without regard for any other
structure.
.CS


[toc_begin GROUPTITLE TITLE]
[\fBinclude FILE\fR]
[\fBvset VAR VALUE\fR]
...
[toc_end]

.CE
The only restriction \fBinclude\fR has to obey is that the contents of
the included file must be valid at the place of the inclusion. I.e. a
file included before \fBtoc_begin\fR may contain only the templating
commands \fBvset\fR and \fBinclude\fR, a file included in a division
may contain only items or divisions commands, etc.
.SS ESCAPES
Beyond the 6 commands shown so far we have two more available.
However their function is not the marking up of toc structure, but the
insertion of characters, namely \fB[\fR and \fB]\fR.
These commands, \fBlb\fR and \fBrb\fR respectively, are required
because our use of [ and ] to bracket markup commands makes it
impossible to directly use [ and ] within the text.
.PP
Our example of their use are the sources of the last sentence in the
previous paragraph, with some highlighting added.
.CS


  ...
  These commands, [cmd lb] and [cmd lb] respectively, are required
  because our use of [\fBlb\fR] and [\fBrb\fR] to bracket markup commands makes it
  impossible to directly use [\fBlb\fR] and [\fBrb\fR] within the text.
  ...

.CE
.SH "FURTHER READING"
Now that this document has been digested the reader, assumed to be a
\fIwriter\fR of documentation should be fortified enough to be able
to understand the formal \fIdoctoc language syntax\fR
specification as well. From here on out the
\fIdoctoc language command reference\fR will also serve as the
detailed specification and cheat sheet for all available commands and
their syntax.
.PP
To be able to validate a document while writing it, it is also
recommended to familiarize oneself with Tclapps' ultra-configurable
\fBdtp\fR.
.PP
On the other hand, doctoc is perfectly suited for the automatic
generation from doctools documents, and this is the route Tcllib's
easy and simple \fBdtplite\fR goes, creating a table of contents
for a set of documents behind the scenes, without the writer having to
do so on their own.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
doctoc_intro, doctoc_lang_cmdref, doctoc_lang_syntax
.SH KEYWORDS
doctoc commands, doctoc language, doctoc markup, doctoc syntax, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctoc_lang_syntax.n.







































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctoc_lang_syntax.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctoc_lang_syntax" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctoc_lang_syntax \- doctoc language syntax
.SH DESCRIPTION
.PP
This document contains the formal specification of the syntax of the
doctoc markup language, version 1.1 in Backus-Naur-Form. This document
is intended to be a reference, complementing the
\fIdoctoc language command reference\fR.
A beginner should read the much more informally written
\fIdoctoc language introduction\fR first before trying to
understand either this document or the command reference.
.SH FUNDAMENTALS
In the broadest terms possible the \fIdoctoc markup language\fR is
like SGML and similar languages. A document written in this language
consists primarily of markup commands, with text embedded into it at
some places.
.PP
Each markup command is a just Tcl command surrounded by a matching
pair of \fB[\fR and \fB]\fR. Which commands are available,
and their arguments, i.e. syntax is specified in the
\fIdoctoc language command reference\fR.
.PP
In this document we specify first the lexeme, and then the syntax,
i.e. how we can mix text and markup commands with each other.
.SH "LEXICAL DEFINITIONS"
In the syntax rules listed in the next section
.IP [1]
<TEXT> stands for all text except markup commands.
.IP [2]
Any XXX stands for the markup command [xxx] including its
arguments. Each markup command is a Tcl command surrounded by a
matching pair of \fB[\fR and \fB]\fR. Inside of these
delimiters the usual rules for a Tcl command apply with regard to word
quotation, nested commands, continuation lines, etc.
.IP [3]
<WHITE> stands for all text consisting only of spaces, newlines,
tabulators and the \fBcomment\fR markup command.
.PP
.SH SYNTAX
The rules listed here specify only the syntax of doctoc documents. The
lexical level of the language was covered in the previous section.
.PP
Regarding the syntax of the (E)BNF itself
.IP [1]
The construct { X } stands for zero or more occurrences of X.
.IP [2]
The construct [ X ] stands for zero or one occurrence of X.
.PP
The syntax:
.CS


toc       = defs
            TOC_BEGIN
            contents
            TOC_END
            { <WHITE> }

defs      = { INCLUDE | VSET | <WHITE> }
contents  = { defs entry } [ defs ]

entry     = ITEM | division

division  = DIVISION_START
            contents
            DIVISION_END

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
doctoc_intro, doctoc_lang_cmdref, doctoc_lang_faq, doctoc_lang_intro
.SH KEYWORDS
doctoc commands, doctoc language, doctoc markup, doctoc syntax, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctoc_plugin_apiref.n.









































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctoc_plugin_apiref.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctoc_plugin_apiref" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctoc_plugin_apiref \- doctoc plugin API reference
.SH SYNOPSIS
\fBdt_fmap\fR \fIsymfname\fR
.sp
\fBdt_format\fR
.sp
\fBdt_read\fR \fIfile\fR
.sp
\fBdt_source\fR \fIfile\fR
.sp
\fBex_cappend\fR \fItext\fR
.sp
\fBex_cget\fR \fIvarname\fR
.sp
\fBex_cis\fR \fIcname\fR
.sp
\fBex_cname\fR
.sp
\fBex_cpop\fR \fIcname\fR
.sp
\fBex_cpush\fR \fIcname\fR
.sp
\fBex_cset\fR \fIvarname\fR \fIvalue\fR
.sp
\fBex_lb\fR ?\fInewbracket\fR?
.sp
\fBex_rb\fR ?\fInewbracket\fR?
.sp
\fBtoc_initialize\fR
.sp
\fBtoc_listvariables\fR
.sp
\fBtoc_numpasses\fR
.sp
\fBtoc_postprocess\fR \fItext\fR
.sp
\fBtoc_setup\fR \fIn\fR
.sp
\fBtoc_shutdown\fR
.sp
\fBtoc_varset\fR \fIvarname\fR \fItext\fR
.sp
\fBfmt_plain_text\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
This document is intended for \fIplugin writers\fR, i.e. developers
wishing to write a toc \fIformatting engine\fR for some output
format X.
.PP
It specifies the interaction between the \fBdoctools::toc\fR
package and its plugins, i.e. the interface any toc formatting engine
has to comply with.
.PP
This document deals with version 1 of the interface.
.PP
A reader who is on the other hand more interested in the markup
language itself should start with the
\fIdoctoc language introduction\fR and proceed from there to the
formal specifications, i.e. the \fIdoctoc language syntax\fR and
the \fIdoctoc language command reference\fR.
.SH OVERVIEW
The API for a toc formatting engine consists of two major sections.
.PP
On the one side we have a set of commands through which the plugin is
able to query the frontend. These commands are provided by the
frontend and linked into the plugin interpreter. Please see section
\fBFRONTEND COMMANDS\fR for their detailed specification.
.PP
And on the other side the plugin has to provide its own set of
commands which will then be called by the frontend in a specific
sequence while processing input. They, again, fall into two
categories, management and formatting.
Please see section \fBPLUGIN COMMANDS\fR and its subsections for
their detailed specification.
.SH "FRONTEND COMMANDS"
This section specifies the set of commands through which a plugin,
also known as a toc formatting engine, is able to query the
frontend. These commands are provided by the frontend and linked into
the plugin interpreter.
.PP
I.e. a toc formatting engine can assume that all of the following
commands are present when any of its own commands (as specified in
section \fBPLUGIN COMMANDS\fR) are executed.
.PP
Beyond that it can also assume that it has full access to its own safe
interpreter and thus is not able to damage the other parts of the
processor, nor can it damage the filesystem.
It is however able to either kill or hang the whole process, by
exiting, or running an infinite loop.
.PP
Coming back to the imported commands, all the commands with prefix
\fIdt_\fR provide limited access to specific parts of the frontend,
whereas the commands with prefix \fIex_\fR provide access to the
state of the \fBtextutil::expander\fR object which does the main
parsing of the input within the frontend. These commands should not be
except under very special circumstances.
.PP
.TP
\fBdt_fmap\fR \fIsymfname\fR
Query command. It returns the actual pathname to use in the output in
place of the symbolic filename \fIsymfname\fR. It will return the
unchanged input if no mapping was established for \fIsymfname\fR.
.sp
The required mappings are established with the method \fBmap\fR of
a frontend, as explained in section \fBOBJECT METHODS\fR
of the documentation for the package \fBdoctools::toc\fR.
.TP
\fBdt_format\fR
Query command. It returns the name of the format associated with the
toc formatting engine.
.TP
\fBdt_read\fR \fIfile\fR
Controlled filesystem access. Returns contents of \fIfile\fR for
whatever use desired by the plugin.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.
.TP
\fBdt_source\fR \fIfile\fR
Controlled filesystem access. This command allows the toc formatting
engine to load additional Tcl code it may need.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.
.TP
\fBex_cappend\fR \fItext\fR
Appends a string to the output in the current context.  This command
should rarely be used by macros or application code.
.TP
\fBex_cget\fR \fIvarname\fR
Retrieves the value of variable \fIvarname\fR, defined in the current
context.
.TP
\fBex_cis\fR \fIcname\fR
Determines whether or not the name of the current context is
\fIcname\fR.
.TP
\fBex_cname\fR
Returns the name of the current context.
.TP
\fBex_cpop\fR \fIcname\fR
Pops a context from the context stack, returning all accumulated
output in that context.  The context must be named \fIcname\fR, or an
error results.
.TP
\fBex_cpush\fR \fIcname\fR
Pushes a context named \fIcname\fR onto the context stack.  The
context must be popped by \fBcpop\fR before expansion ends or an
error results.
.TP
\fBex_cset\fR \fIvarname\fR \fIvalue\fR
Sets variable \fIvarname\fR to \fIvalue\fR in the current context.
.TP
\fBex_lb\fR ?\fInewbracket\fR?
Returns the current value of the left macro expansion bracket; this is
for use as or within a macro, when the bracket needs to be included in
the output text.  If \fInewbracket\fR is specified, it becomes the new
bracket, and is returned.
.TP
\fBex_rb\fR ?\fInewbracket\fR?
Returns the current value of the right macro expansion bracket; this
is for use as or within a macro, when the bracket needs to be included
in the output text.  If \fInewbracket\fR is specified, it becomes the
new bracket, and is returned.
.PP
.SH "PLUGIN COMMANDS"
The plugin has to provide its own set of commands which will then be
called by the frontend in a specific sequence while processing
input. They fall into two categories, management and formatting. Their
expected names, signatures, and responsibilities are specified in the
following two subsections.
.SS "MANAGEMENT COMMANDS"
The management commands a plugin has to provide are used by the
frontend to
.IP [1]
initialize and shutdown the plugin
.IP [2]
determine the number of passes it has
to make over the input
.IP [3]
initialize and shutdown each pass
.IP [4]
query and initialize engine parameters
.PP
.PP
After the plugin has been loaded and the frontend commands are
established the commands will be called in the following sequence:
.CS


    toc_numpasses -> n
    toc_listvariables -> vars

    toc_varset var1 value1
    toc_varset var2 value2
    ...
    toc_varset varK valueK
    toc_initialize
    toc_setup 1
    ...
    toc_setup 2
    ...
    ...
    toc_setup n
    ...
    toc_postprocess
    toc_shutdown
    ...

.CE
I.e. first the number of passes and the set of available engine
parameters is established, followed by calls setting the
parameters. That second part is optional.
.PP
After that the plugin is initialized, the specified number of passes
executed, the final result run through a global post processing step
and at last the plugin is shutdown again. This can be followed by more
conversions, restarting the sequence at \fBtoc_varset\fR.
.PP
In each of the passes, i.e. after the calls of \fBtoc_setup\fR the
frontend will process the input and call the formatting commands as
markup is encountered. This means that the sequence of formatting
commands is determined by the grammar of the doctoc markup language,
as specified in the \fIdoctoc language syntax\fR specification.
.PP
A different way of looking at the sequence is:
.IP \(bu
First some basic parameters are determined.
.IP \(bu
Then everything starting at the first \fBtoc_varset\fR to
\fBtoc_shutdown\fR forms a \fIrun\fR, the formatting of a
single input. Each run can be followed by more.
.IP \(bu
Embedded within each run we have one or more \fIpasses\fR,
each starting with \fBtoc_setup\fR and going until either the next
\fBtoc_setup\fR or \fBtoc_postprocess\fR is reached.
.sp
If more than one pass is required to perform the formatting only the
output of the last pass is relevant. The output of all the previous,
preparatory passes is ignored.
.PP
.PP
The commands, their names, signatures, and responsibilities are, in
detail:
.TP
\fBtoc_initialize\fR
\fIInitialization/Shutdown\fR.
This command is called at the beginning of every conversion run, as
the first command of that run. Note that a run is not a pass, but may
consist of multiple passes.
It has to initialize the general state of the plugin, beyond the
initialization done during the load. No return value is expected, and
any returned value is ignored.
.TP
\fBtoc_listvariables\fR
\fIInitialization/Shutdown\fR and \fIEngine parameters\fR.
Second command is called after the plugin code has been loaded,
i.e. immediately after \fBtoc_numpasses\fR.
It has to return a list containing the names of the parameters the
frontend can set to configure the engine. This list can be empty.
.TP
\fBtoc_numpasses\fR
\fIInitialization/Shutdown\fR and \fIPass management\fR.
First command called after the plugin code has been loaded. No other
command of the engine will be called before it.
It has to return the number of passes this engine requires to fully
process the input document. This value has to be an integer number
greater or equal to one.
.TP
\fBtoc_postprocess\fR \fItext\fR
\fIInitialization/Shutdown\fR.
This command is called immediately after the last pass in a run. Its
argument is the result of the conversion generated by that pass. It is
provided to allow the engine to perform any global modifications of
the generated document. If no post-processing is required for a
specific format the command has to just return the argument.
.sp
Expected to return a value, the final result of formatting the input.
.TP
\fBtoc_setup\fR \fIn\fR
\fIInitialization/Shutdown\fR and \fIPass management\fR.
This command is called at the beginning of each pass over the input in
a run. Its argument is the number of the pass which has begun. Passes
are counted from \fB1\fR upward.
The command has to set up the internal state of the plugin for this
particular pass. No return value is expected, and any returned value
is ignored.
.TP
\fBtoc_shutdown\fR
\fIInitialization/Shutdown\fR.
This command is called at the end of every conversion run. It is the
last command called in a run. It has to clean up of all the
run-specific state in the plugin.
After the call the engine has to be in a state which allows the
initiation of another run without fear that information from the last
run is leaked into this new run.
No return value is expected, and any returned value is ignored.
.TP
\fBtoc_varset\fR \fIvarname\fR \fItext\fR
\fIEngine parameters\fR.
This command is called by the frontend to set an engine parameter to a
particular value.
The parameter to change is specified by \fIvarname\fR, the value to
set in \fItext\fR.
.sp
The command has to throw an error if an unknown \fIvarname\fR is
used. Only the names returned by \fBtoc_listvariables\fR have to be
considered as known.
.sp
The values of all engine parameters have to persist between passes and
runs.
.PP
.SS "FORMATTING COMMANDS"
The formatting commands have to implement the formatting for the
output format, for all the markup commands of the doctoc markup
language, except \fBlb\fR, \fBrb\fR, \fBvset\fR, \fBinclude\fR, and
\fBcomment\fR. These exceptions are processed by the frontend and are
never seen by the plugin. In return a command for the formatting of
plain text has to be provided, something which has no markup in the
input at all.
.PP
This means, that each of the five markup commands specified in the
\fIdoctoc language command reference\fR and outside of the set of
exceptions listed above has an equivalent formatting command which
takes the same arguments as the markup command and whose name is the
name of markup command with the prefix \fIfmt_\fR added to it.
.PP
All commands are expected to format their input in some way per the
semantics specified in the command reference and to return whatever
part of this that they deem necessary as their result, which will be
added to the output.
.PP
To avoid essentially duplicating the command reference we do not list
any of the command here and simply refer the reader to the
\fIdoctoc language command reference\fR for their signature and
description. The sole exception is the plain text formatter, which has
no equivalent markup command.
.PP
The calling sequence of formatting commands is not as rigid as for the
management commands, but determined by the grammar of the doctoc
markup language, as specified in the \fIdoctoc language syntax\fR
specification.
.PP
.TP
\fBfmt_plain_text\fR \fItext\fR
\fINo associated markup command\fR.
.sp
Called by the frontend for any plain text encountered in the
input. It has to perform any and all special processing required for
plain text.
.sp
The formatted text is expected as the result of the command,
and added to the output. If no special processing is required it has
to simply return its argument without change.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
doctoc_intro, doctoc_lang_cmdref, doctoc_lang_faq, doctoc_lang_intro, doctoc_lang_syntax, doctools::toc
.SH KEYWORDS
formatting engine, markup, plugin, semantic markup, table of contents, toc, toc formatter
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctools.n.




































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctools.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003-2013 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools" n 1.4.14 tcllib "Documentation tools"
.BS
.SH NAME
doctools \- doctools - Processing documents
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBdoctools  ?1.4.14?\fR
.sp
\fB::doctools::new\fR \fIobjectName\fR ?\fIoption value\fR...?
.sp
\fB::doctools::help\fR
.sp
\fB::doctools::search\fR \fIpath\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBconfigure\fR
.sp
\fIobjectName\fR \fBconfigure\fR \fIoption\fR
.sp
\fIobjectName\fR \fBconfigure\fR \fB-option\fR \fIvalue\fR...
.sp
\fIobjectName\fR \fBcget\fR \fB-option\fR
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBformat\fR \fItext\fR
.sp
\fIobjectName\fR \fBmap\fR \fIsymbolic\fR \fIactual\fR
.sp
\fIobjectName\fR \fBparameters\fR
.sp
\fIobjectName\fR \fBsearch\fR \fIpath\fR
.sp
\fIobjectName\fR \fBsetparam\fR \fIname\fR \fIvalue\fR
.sp
\fIobjectName\fR \fBwarnings\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for the creation of objects able to
process and convert text written in the \fIdoctools\fR markup
language into any output format X for which a
\fIformatting engine\fR is available.
.PP
A reader interested in the markup language itself should start with
the \fIdoctools language introduction\fR and proceed from there to
the formal specifications, i.e. the \fIdoctools language syntax\fR
and the \fIdoctools language command reference\fR.
.PP
If on the other hand the reader wishes to write her own formatting
engine for some format, i.e. is a \fIplugin writer\fR then reading
and understanding the \fIdoctools plugin API reference\fR is an
absolute necessity, as that document specifies the interaction between
this package and its plugins, i.e. the formatting engines, in detail.
.SH "PUBLIC API"
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::new\fR \fIobjectName\fR ?\fIoption value\fR...?
This command creates a new doctools object with an associated Tcl
command whose name is \fIobjectName\fR. This \fIobject\fR command is
explained in full detail in the sections \fBOBJECT COMMAND\fR
and \fBOBJECT METHODS\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.sp
The options and their values coming after the name of the object are
used to set the initial configuration of the object.
.TP
\fB::doctools::help\fR
This is a convenience command for applications wishing to provide
their user with a short description of the available formatting
commands and their meanings. It returns a string containing a standard
help text.
.TP
\fB::doctools::search\fR \fIpath\fR
Whenever an object created by this the package has to map the name of
a format to the file containing the code for its formatting engine it
will search for the file in a number of directories stored in a
list. See section \fBFORMAT MAPPING\fR for more explanations.
.sp
This list not only contains three default directories which are
declared by the package itself, but is also extensible user of the
package.
This command is the means to do so. When given a \fIpath\fR to an
existing and readable directory it will prepend that directory to the
list of directories to search. This means that the \fIpath\fR added
last is later searched through first.
.sp
An error will be thrown if the \fIpath\fR either does not exist, is
not a directory, or is not readable.
.PP
.SS "OBJECT COMMAND"
All commands created by \fB::doctools::new\fR have the following
general form and may be used to invoke various operations on their
doctools converter object.
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the exact
behavior of the command. See section \fBOBJECT METHODS\fR for
the detailed specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBconfigure\fR
The method returns a list of all known options and their current
values when called without any arguments.
.TP
\fIobjectName\fR \fBconfigure\fR \fIoption\fR
The method behaves like the method \fBcget\fR when called with a
single argument and returns the value of the option specified by said
argument.
.TP
\fIobjectName\fR \fBconfigure\fR \fB-option\fR \fIvalue\fR...
The method reconfigures the specified \fBoption\fRs of the object,
setting them to the associated \fIvalue\fRs, when called with an even
number of arguments, at least two.
.sp
The legal options are described in the section
\fBOBJECT CONFIGURATION\fR.
.TP
\fIobjectName\fR \fBcget\fR \fB-option\fR
This method expects a legal configuration option as argument and will
return the current value of that option for the object the method was
invoked for.
.sp
The legal configuration options are described in section
\fBOBJECT CONFIGURATION\fR.
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBformat\fR \fItext\fR
This method runs the \fItext\fR through the configured formatting
engine and returns the generated string as its result. An error will
be thrown if no \fB-format\fR was configured for the object.
.sp
The method assumes that the \fItext\fR is in \fIdoctools\fR format as
specified in the companion document \fIdoctools_fmt\fR. Errors will
be thrown otherwise.
.TP
\fIobjectName\fR \fBmap\fR \fIsymbolic\fR \fIactual\fR
This methods add one entry to the per-object mapping from
\fIsymbolic\fR filenames to the \fIactual\fR uris.
The object just stores this mapping and makes it available to the
configured formatting engine through the command \fBdt_fmap\fR.
This command is described in more detail in the
\fIdoctools plugin API reference\fR which specifies the interaction
between the objects created by this package and doctools formatting
engines.
.TP
\fIobjectName\fR \fBparameters\fR
This method returns a list containing the names of all engine
parameters provided by the configured formatting engine. It will
return an empty list if the object is not yet configured for a
specific format.
.TP
\fIobjectName\fR \fBsearch\fR \fIpath\fR
This method extends the per-object list of paths searched for doctools
formatting engines. See also the command \fB::doctools::search\fR on
how to extend the per-package list of paths. Note that the path
entered last will be searched first.
For more details see section \fBFORMAT MAPPING\fR.
.TP
\fIobjectName\fR \fBsetparam\fR \fIname\fR \fIvalue\fR
This method sets the \fIname\fRd engine parameter to the specified
\fIvalue\fR.
It will throw an error if the object is either not yet configured for
a specific format, or if the formatting engine for the configured
format does not provide a parameter with the given \fIname\fR.
The list of parameters provided by the configured formatting engine
can be retrieved through the method \fBparameters\fR.
.TP
\fIobjectName\fR \fBwarnings\fR
This method returns a list containing all the warnings which were
generated by the configured formatting engine during the last
invocation of the method \fBformat\fR.
.PP
.SS "OBJECT CONFIGURATION"
All doctools objects understand the following configuration options:
.TP
\fB-file\fR \fIfile\fR
The argument of this option is stored in the object and made available
to the configured formatting engine through the commands \fBdt_file\fR
and \fBdt_mainfile\fR.
These commands are described in more detail in the companion document
\fIdoctools_api\fR which specifies the API between the object and
formatting engines.
.sp
The default value of this option is the empty string.
.sp
The configured formatting engine should interpret the value as the
name of the file containing the document which is currently processed.
.TP
\fB-ibase\fR \fIfile\fR
The argument of this option is stored in the object and used as the
base path for resolution of relative include paths. If this option is
not set (empty string) the value of \fB-file\fR is used instead.
.sp
Note that \fB-file\fR and \fB-ibase\fR, while similar looking,
are actually very different. The value of \fB-file\fR is used by
some engines for the generation of proper relative references between
output documents (HTML). As such this is a \fIdestination\fR
path. The \fB-ibase\fR on the other hand is used to resolve
relative include paths, and as such deals with \fIsource\fR paths.
.sp
The default value of this option is the empty string.
.TP
\fB-module\fR \fItext\fR
The argument of this option is stored in the object and made available
to the configured formatting engine through the command \fBdt_module\fR.
This command is described in more detail in the companion document
\fIdoctools_api\fR which specifies the API between the object and
formatting engines.
.sp
The default value of this option is the empty string.
.sp
The configured formatting engine should interpret the value as the
name of the module the file containing the document which is currently
processed belongs to.
.TP
\fB-format\fR \fItext\fR
The argument of this option specifies the format to generate and by
implication the formatting engine to use when converting text via the
method \fBformat\fR. Its default value is the empty string. The
method \fBformat\fR cannot be used if this option is not set to a
valid value at least once.
.sp
The package will immediately try to map the given name to a file
containing the code for a formatting engine generating that format. An
error will be thrown if this mapping fails. In that case a previously
configured format is left untouched.
.sp
The section \fBFORMAT MAPPING\fR explains in detail how the
package and object will look for engine implementations.
.TP
\fB-deprecated\fR \fIboolean\fR
This option is a boolean flag. The object will generate warnings if
this flag is set and the text given to method \fBformat\fR contains
the deprecated markup command \fBstrong\fR.
Its default value is \fBFALSE\fR. In other words, no warnings will
be generated.
.TP
\fB-copyright\fR \fItext\fR
The argument of this option is stored in the object and made available
to the configured formatting engine through the command \fBdt_copyright\fR.
This command is described in more detail in the companion document
\fIdoctools_api\fR which specifies the API between the object and
formatting engines.
.sp
The default value of this option is the empty string.
.sp
The configured formatting engine should interpret the value as a
copyright assignment for the document which is currently processed, or
the package described by it.
.sp
This information must be used if and only if the engine is unable to
find any copyright assignments within the document itself. Such are
specified by the formatting command \fBcopyright\fR. This command is
described in more detail in the companion document \fIdoctools_fmt\fR
which specifies the \fIdoctools\fR format itself.
.PP
.SS "FORMAT MAPPING"
The package and object will perform the following algorithm when
trying to map a format name \fIfoo\fR to a file containing an
implementation of a formatting engine for \fIfoo\fR:
.IP [1]
If \fIfoo\fR is the name of an existing file then this file is
directly taken as the implementation.
.IP [2]
If not, the list of per-object search paths is searched. For each
directory in the list the package checks if that directory contains a
file "\fIfmt.\fIfoo\fR\fR". If yes, then that file is taken as the
implementation.
.sp
Note that this list of paths is initially empty and can be extended
through the object method \fBsearch\fR.
.IP [3]
If not, the list of package paths is searched.
For each directory in the list the package checks if that directory
contains a file "\fIfmt.\fIfoo\fR\fR". If yes, then that file is taken
as the implementation.
.sp
This list of paths can be extended
through the command \fB::doctools::search\fR.
It contains initially one path, the subdirectory "\fImpformats\fR" of
the directory the package itself is located in.
In other words, if the package implementation "\fIdoctools.tcl\fR" is
installed in the directory "\fI/usr/local/lib/tcllib/doctools\fR" then
it will by default search the
directory "\fI/usr/local/lib/tcllib/doctools/mpformats\fR" for format
implementations.
.IP [4]
The mapping fails.
.PP
.SH "PREDEFINED ENGINES"
The package provides predefined engines for the following
formats. Some of the engines support parameters. These will be
explained below as well.
.TP
html
This engine generates HTML markup, for processing by web browsers and
the like. This engine supports four parameters:
.RS
.TP
footer
The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
before the \fB</body>\fR tag, closing the body of the generated
HTML.
.sp
This can be used to insert boilerplate footer markup into the
generated document.
.TP
header
The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the \fB<body>\fR tag, starting the body of the generated HTML.
.sp
This can be used to insert boilerplate header markup into the
generated document.
.TP
meta
The value for this parameter has to be valid selfcontained HTML markup
for the header section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the \fB<head>\fR tag, starting the header section of the
generated HTML.
.sp
This can be used to insert boilerplate meta data markup into the
generated document, like references to a stylesheet, standard meta
keywords, etc.
.TP
xref
The value for this parameter has to be a list of triples specifying
cross-reference information. This information is used by the engine to
create more hyperlinks. Each triple is a list containing a pattern,
symbolic filename and fragment reference, in this order. If a pattern
is specified multiple times the last occurence of the pattern will be
used.
.sp
The engine will consult the xref database when encountering specific
commands and will create a link if the relevant text matches one of
the patterns. No link will be created if no match was found. The link
will go to the uri \fBfile#fragment\fR listed in the relevant
triple, after conversion of the symbolic file name to the actual uri
via \fBdt_fmap\fR (see the \fIdoctools plugin API reference\fR).
This file-to-uri mapping was build by calls to the method \fBmap\fR
of the doctools object (See section \fBOBJECT METHODS\fR).
.sp
The following formatting commands will consult the xref database:
.RS
.TP
\fBcmd\fR \fIword\fR
The command will look for the patterns \fBsa,\fR\fIword\fR, and
\fIword\fR, in this order. If this fails if it will convert \fIword\fR
to all lowercase and try again.
.TP
\fBsyscmd\fR \fIword\fR
The command will look for the patterns \fBsa,\fR\fIword\fR, and
\fIword\fR, in this order. If this fails if it will convert \fIword\fR
to all lowercase and try again.
.TP
\fBterm\fR \fIword\fR
The command will look for the patterns \fBkw,\fR\fIword\fR,
\fBsa,\fR\fIword\fR, and \fIword\fR, in this order. If this fails if
it will convert \fIword\fR to all lowercase and try again.
.TP
\fBpackage\fR \fIword\fR
The command will look for the patterns \fBsa,\fR\fIword\fR,
\fBkw,\fR\fIword\fR, and \fIword\fR, in this order. If this fails if
it will convert \fIword\fR to all lowercase and try again.
.TP
\fBsee_also\fR \fIword\fR...
The command will look for the patterns \fBsa,\fR\fIword\fR, and
\fIword\fR, in this order, for each \fIword\fR given to the
command. If this fails if it will convert \fIword\fR to all lowercase
and try again.
.TP
\fBkeywords\fR \fIword\fR...
The command will look for the patterns \fBkw,\fR\fIword\fR, and
\fIword\fR, in this order, for each \fIword\fR given to the
command. If this fails if it will convert \fIword\fR to all lowercase
and try again.
.RE
.RE
.sp
.TP
latex
This engine generates output suitable for the \fBlatex\fR text
processor coming out of the TeX world.
.TP
list
This engine retrieves version, section and title of the manpage from
the document. As such it can be used to generate a directory listing
for a set of manpages.
.TP
nroff
This engine generates nroff output, for processing by \fBnroff\fR,
or \fBgroff\fR. The result will be standard man pages as they are
known in the unix world.
.TP
null
This engine generates no outout at all. This can be used if one just
wants to validate some input.
.TP
tmml
This engine generates TMML markup as specified by Joe English. The Tcl
Manpage Markup Language is a derivate of XML.
.TP
wiki
This engine generates Wiki markup as understood by Jean Claude
Wippler's \fBwikit\fR application.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
doctools_intro, doctools_lang_cmdref, doctools_lang_intro, doctools_lang_syntax, doctools_plugin_apiref
.SH KEYWORDS
HTML, TMML, conversion, documentation, manpage, markup, nroff
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2003-2013 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctools_intro.n.






























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctools_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools_intro" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctools_intro \- doctools introduction
.SH DESCRIPTION
.PP
\fIdoctools\fR (short for \fIdocumentation tools\fR) stands for
a set of related, yet different, entities which are working together
for the easy creation and transformation of documentation. These are
.IP [1]
A tcl based language for the semantic markup of text. Markup is
represented by Tcl commands interspersed with the actual text.
.IP [2]
A package providing the ability to read and transform texts written in
that markup language. It is important to note that the actual
transformation of the input text is delegated to plugins.
.IP [3]
An API describing the interface between the package above and a
plugin.
.PP
.PP
Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.
.PP
.IP [1]
A \fIwriter\fR of documentation has to understand the markup language
itself. A beginner to doctools should read the more informally written
\fIdoctools language introduction\fR first. Having digested this
the formal \fIdoctools language syntax\fR specification should
become understandable. A writer experienced with doctools may only
need the \fIdoctools language command reference\fR from time to
time to refresh her memory.
.sp
While a document is written the \fBdtplite\fR application can be
used to validate it, and after completion it also performs the
conversion into the chosen system of visual markup, be it *roff, HTML,
plain text, wiki, etc.
.IP [2]
A \fIprocessor\fR of documentation written in the \fIdoctools\fR
markup language has to know which tools are available for use.
.sp
The main tool is the aforementioned \fBdtplite\fR application
provided by Tcllib. A more powerful one (in terms of options and
ability to configure it) is the \fBdtp\fR application, provided by
Tclapps.
At the bottom level, common to both applications, however sits the
package \fBdoctools\fR, providing the basic facilities to read and
process files containing text in the doctools format.
.IP [3]
At last, but not least, \fIplugin writers\fR have to understand the
interaction between the \fBdoctools\fR package and its plugins, as
described in the \fIdoctools plugin API reference\fR.
.PP
.SH "RELATED FORMATS"
doctools does not stand alone, it has two companion formats. These are
called \fIdocidx\fR and \fIdoctoc\fR, and they are for the markup of
\fIkeyword indices\fR, and \fItables of contents\fR,
respectively.
They are described in their own sets of documents, starting at the
\fIdocidx introduction\fR and the \fIdoctoc introduction\fR,
respectively.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
docidx_intro, doctoc_intro, doctools, doctools_lang_cmdref, doctools_lang_faq, doctools_lang_intro, doctools_lang_syntax, doctools_plugin_apiref
.SH KEYWORDS
markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctools_lang_cmdref.n.















































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctools_lang_cmdref.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2010 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools_lang_cmdref" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctools_lang_cmdref \- doctools language command reference
.SH SYNOPSIS
\fBarg\fR \fItext\fR
.sp
\fBarg_def\fR \fItype\fR \fIname\fR ?\fImode\fR?
.sp
\fBbullet\fR
.sp
\fBcall\fR \fIargs\fR
.sp
\fBcategory\fR \fItext\fR
.sp
\fBclass\fR \fItext\fR
.sp
\fBcmd\fR \fItext\fR
.sp
\fBcmd_def\fR \fIcommand\fR
.sp
\fBcomment\fR \fIplaintext\fR
.sp
\fBconst\fR \fItext\fR
.sp
\fBcopyright\fR \fItext\fR
.sp
\fBdef\fR \fItext\fR
.sp
\fBdescription\fR
.sp
\fBenum\fR
.sp
\fBemph\fR \fItext\fR
.sp
\fBexample\fR \fItext\fR
.sp
\fBexample_begin\fR
.sp
\fBexample_end\fR
.sp
\fBfile\fR \fItext\fR
.sp
\fBfun\fR \fItext\fR
.sp
\fBimage\fR \fIname\fR ?\fIlabel\fR?
.sp
\fBinclude\fR \fIfilename\fR
.sp
\fBitem\fR
.sp
\fBkeywords\fR \fIargs\fR
.sp
\fBlb\fR
.sp
\fBlist_begin\fR \fIwhat\fR
.sp
\fBlist_end\fR
.sp
\fBlst_item\fR \fItext\fR
.sp
\fBmanpage_begin\fR \fIcommand\fR \fIsection\fR \fIversion\fR
.sp
\fBmanpage_end\fR
.sp
\fBmethod\fR \fItext\fR
.sp
\fBmoddesc\fR \fItext\fR
.sp
\fBnamespace\fR \fItext\fR
.sp
\fBnl\fR
.sp
\fBopt\fR \fItext\fR
.sp
\fBopt_def\fR \fIname\fR ?\fIarg\fR?
.sp
\fBoption\fR \fItext\fR
.sp
\fBpackage\fR \fItext\fR
.sp
\fBpara\fR
.sp
\fBrb\fR
.sp
\fBrequire\fR \fIpackage\fR ?\fIversion\fR?
.sp
\fBsection\fR \fIname\fR
.sp
\fBsectref\fR \fIid\fR ?\fItext\fR?
.sp
\fBsectref-external\fR \fItext\fR
.sp
\fBsee_also\fR \fIargs\fR
.sp
\fBstrong\fR \fItext\fR
.sp
\fBsubsection\fR \fIname\fR
.sp
\fBsyscmd\fR \fItext\fR
.sp
\fBterm\fR \fItext\fR
.sp
\fBtitledesc\fR \fIdesc\fR
.sp
\fBtkoption_def\fR \fIname\fR \fIdbname\fR \fIdbclass\fR
.sp
\fBtype\fR \fItext\fR
.sp
\fBuri\fR \fItext\fR ?\fItext\fR?
.sp
\fBusage\fR \fIargs\fR
.sp
\fBvar\fR \fItext\fR
.sp
\fBvset\fR \fIvarname\fR \fIvalue\fR
.sp
\fBvset\fR \fIvarname\fR
.sp
\fBwidget\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
This document specifies both names and syntax of all the commands
which together are the doctools markup language, version 1.
As this document is intended to be a reference the commands are listed
in alphabetical order, and the descriptions are relatively short.
A beginner should read the much more informally written
\fIdoctools language introduction\fR first.
.SH COMMANDS
.TP
\fBarg\fR \fItext\fR
Text markup. The argument text is marked up as the \fIargument\fR of
a command. Main uses are the highlighting of command arguments in
free-form text, and for the argument parameters of the markup commands
\fBcall\fR and \fBusage\fR.
.TP
\fBarg_def\fR \fItype\fR \fIname\fR ?\fImode\fR?
Text structure. List element. Argument list. Automatically closes the
previous list element. Specifies the data-\fItype\fR of the described
argument of a command, its \fIname\fR and its i/o-\fImode\fR. The
latter is optional.
.TP
\fBbullet\fR
\fIDeprecated\fR. Text structure. List element. Itemized list. See
\fBitem\fR for the canonical command to open a list item in an
itemized list.
.TP
\fBcall\fR \fIargs\fR
Text structure. List element. Definition list. Automatically closes
the previous list element. Defines the term as a command and its
arguments.
The first argument is the name of the command described by the
following free-form text, and all arguments coming after that are
descriptions of the command's arguments.
It is expected that the arguments are marked up with \fBarg\fR,
\fBmethod\fR, \fBoption\fR etc., as is appropriate, and that the
command itself is marked up with \fBcmd\fR.
It is expected that the formatted term is not only printed in place,
but also in the table of contents of the document, or synopsis,
depending on the output format.
.TP
\fBcategory\fR \fItext\fR
Document information. Anywhere. This command registers its plain text
arguments as the category this document belongs to. If this command is
used multiple times the last value specified is used.
.TP
\fBclass\fR \fItext\fR
Text markup. The argument is marked up as the name of a
\fIclass\fR. The text may have other markup already applied to
it. Main use is the highlighting of class names in free-form text.
.TP
\fBcmd\fR \fItext\fR
Text markup. The argument text is marked up as the name of a
\fITcl command\fR. The text may have other markup already applied
to it. Main uses are the highlighting of commands in free-form text,
and for the command parameters of the markup commands \fBcall\fR and
\fBusage\fR.
.TP
\fBcmd_def\fR \fIcommand\fR
Text structure. List element. Command list. Automatically closes the
previous list element. The argument specifies the name of the
\fITcl command\fR to be described by the list element. Expected to
be marked up in the output as if it had been formatted with \fBcmd\fR.
.TP
\fBcomment\fR \fIplaintext\fR
Text markup. The argument text is marked up as a comment standing
outside of the actual text of the document. Main use is in free-form
text.
.TP
\fBconst\fR \fItext\fR
Text markup. The argument is marked up as a \fIconstant\fR value. The
text may have other markup already applied to it. Main use is the
highlighting of constants in free-form text.
.TP
\fBcopyright\fR \fItext\fR
Document information. Anywhere. The command registers the plain text
argument as a copyright assignment for the manpage. When invoked more
than once the assignments are accumulated.
.TP
\fBdef\fR \fItext\fR
Text structure. List element. Definition list. Automatically closes
the previous list element. The argument text is the term defined by
the new list element. Text markup can be applied to it.
.TP
\fBdescription\fR
Document structure. This command separates the header from the
document body.  Implicitly starts a section named "DESCRIPTION" (See
command \fBsection\fR).
.TP
\fBenum\fR
Text structure. List element. Enumerated list. Automatically closes
the previous list element.
.TP
\fBemph\fR \fItext\fR
Text markup. The argument text is marked up as emphasized. Main use is
for general highlighting of pieces of free-form text without attaching
special meaning to the pieces.
.TP
\fBexample\fR \fItext\fR
Text structure, Text markup. This command marks its argument up as an
\fIexample\fR. Main use is the simple embedding of examples in
free-form text. It should be used if the example does \fInot\fR need
special markup of its own. Otherwise use a sequence of
\fBexample_begin\fR ... \fBexample_end\fR.
.TP
\fBexample_begin\fR
Text structure. This commands starts an example. All text until the
next \fBexample_end\fR belongs to the example. Line breaks, spaces,
and tabs have to be preserved literally. Examples cannot be nested.
.TP
\fBexample_end\fR
Text structure. This command closes the example started by the last
\fBexample_begin\fR.
.TP
\fBfile\fR \fItext\fR
Text markup. The argument is marked up as a \fIfile\fR or
\fIdirectory\fR, i.e. in general a \fIpath\fR. The text may have
other markup already applied to it. Main use is the highlighting of
paths in free-form text.
.TP
\fBfun\fR \fItext\fR
Text markup. The argument is marked up as the name of a
\fIfunction\fR. The text may have other markup already applied to
it. Main use is the highlighting of function names in free-form text.
.TP
\fBimage\fR \fIname\fR ?\fIlabel\fR?
Text markup. The argument is the symbolic name of an \fIimage\fR
and replaced with the image itself, if a suitable variant is found
by the backend. The second argument, should it be present, will be
interpreted the human-readable description of the image, and put
into the output in a suitable position, if such is supported by the
format. The HTML format, for example, can place it into the \fIalt\fR
attribute of image references.
.TP
\fBinclude\fR \fIfilename\fR
Templating. The contents of the named file are interpreted as text
written in the doctools markup and processed in the place of the
include command. The markup in the file has to be self-contained. It
is not possible for a markup command to cross the file boundaries.
.TP
\fBitem\fR
Text structure. List element. Itemized list. Automatically closes the
previous list element.
.TP
\fBkeywords\fR \fIargs\fR
Document information. Anywhere. This command registers all its plain text
arguments as keywords applying to this document. Each argument is a single
keyword. If this command is used multiple times all the arguments accumulate.
.TP
\fBlb\fR
Text. The command is replaced with a left bracket. Use in free-form text.
Required to avoid interpretation of a left bracket as the start of a markup
command.
.TP
\fBlist_begin\fR \fIwhat\fR
Text structure. This command starts a list. The exact nature of the
list is determined by the argument \fIwhat\fR of the command. This
further determines which commands are have to be used to start the
list elements. Lists can be nested, i.e. it is allowed to start a new
list within a list element.
.sp
The allowed types (and their associated item commands) are:
.RS
.TP
\fBarguments\fR
\fBarg_def\fR.
.TP
\fBcommands\fR
\fBcmd_def\fR.
.TP
\fBdefinitions\fR
\fBdef\fR and \fBcall\fR.
.TP
\fBenumerated\fR
\fBenum\fR
.TP
\fBitemized\fR
\fBitem\fR
.TP
\fBoptions\fR
\fBopt_def\fR
.TP
\fBtkoptions\fR
\fBtkoption_def\fR
.RE
.sp
Additionally the following names are recognized as shortcuts for some
of the regular types:
.RS
.TP
\fBargs\fR
Short for \fBarguments\fR.
.TP
\fBcmds\fR
Short for \fBcommands\fR.
.TP
\fBenum\fR
Short for \fBenumerated\fR.
.TP
\fBitem\fR
Short for \fBitemized\fR.
.TP
\fBopts\fR
Short for \fBoptions\fR.
.RE
.sp
At last the following names are still recognized for backward
compatibility, but are otherwise considered to be \fIdeprecated\fR.
.RS
.TP
\fBarg\fR
\fIDeprecated\fR. See \fBarguments\fR.
.TP
\fBbullet\fR
\fIDeprecated\fR. See \fBitemized\fR.
.TP
\fBcmd\fR
\fIDeprecated\fR. See \fBcommands\fR.
.TP
\fBopt\fR
\fIDeprecated\fR. See \fBoptions\fR.
.TP
\fBtkoption\fR
\fIDeprecated\fR. See \fBtkoptions\fR.
.RE
.sp
.TP
\fBlist_end\fR
Text structure. This command closes the list opened by the last
\fBlist_begin\fR command coming before it.
.TP
\fBlst_item\fR \fItext\fR
\fIDeprecated\fR. Text structure. List element. Definition list. See
\fBdef\fR for the canonical command to open a general list item in a
definition list.
.TP
\fBmanpage_begin\fR \fIcommand\fR \fIsection\fR \fIversion\fR
Document structure. The command to start a manpage. The arguments are
the name of the \fIcommand\fR described by the manpage, the
\fIsection\fR of the manpages this manpage resides in, and the
\fIversion\fR of the module containing the command. All arguments have
to be plain text, without markup.
.TP
\fBmanpage_end\fR
Document structure. Command to end a manpage/document. Anything in the document
coming after this command is in error.
.TP
\fBmethod\fR \fItext\fR
Text markup. The argument text is marked up as the name of an
\fIobject\fR \fImethod\fR, i.e. subcommand of a Tcl command. The
text may have other markup already applied to it. Main uses are the
highlighting of method names in free-form text, and for the command
parameters of the markup commands \fBcall\fR and \fBusage\fR.
.TP
\fBmoddesc\fR \fItext\fR
Document information. Header. Registers the plain text argument as a short
description of the module the manpage resides in.
.TP
\fBnamespace\fR \fItext\fR
Text markup. The argument text is marked up as a namespace name. The
text may have other markup already applied to it. Main use is the
highlighting of namespace names in free-form text.
.TP
\fBnl\fR
\fIDeprecated\fR. Text structure. See \fBpara\fR for the canonical
command to insert paragraph breaks into the text.
.TP
\fBopt\fR \fItext\fR
Text markup. The argument text is marked up as \fIoptional\fR. The text may
have other markup already applied to it. Main use is the highlighting of
optional arguments, see the command arg \fBarg\fR.
.TP
\fBopt_def\fR \fIname\fR ?\fIarg\fR?
Text structure. List element. Option list. Automatically closes the
previous list element. Specifies \fIname\fR and arguments of the
\fIoption\fR described by the list element. It is expected that the
name is marked up using \fBoption\fR.
.TP
\fBoption\fR \fItext\fR
Text markup. The argument is marked up as \fIoption\fR. The text may
have other markup already applied to it. Main use is the highlighting
of options, also known as command-switches, in either free-form text,
or the arguments of the \fBcall\fR and \fBusage\fR commands.
.TP
\fBpackage\fR \fItext\fR
Text markup. The argument is marked up as the name of a
\fIpackage\fR. The text may have other markup already applied to
it. Main use is the highlighting of package names in free-form text.
.TP
\fBpara\fR
Text structure. This command breaks free-form text into
paragraphs. Each command closes the paragraph coming before it and
starts a new paragraph for the text coming after it. Higher-level
forms of structure are sections and subsections.
.TP
\fBrb\fR
Text. The command is replaced with a right bracket. Use in free-form text.
Required to avoid interpretation of a right bracket as the end of a markup
command.
.TP
\fBrequire\fR \fIpackage\fR ?\fIversion\fR?
Document information. Header. This command registers its argument
\fIpackage\fR as the name of a package or application required by the
described package or application. A minimum version can be provided as
well. This argument can be marked up. The usual markup is \fBopt\fR.
.TP
\fBsection\fR \fIname\fR
Text structure. This command starts a new named document section. The
argument has to be plain text. Implicitly closes the last paragraph
coming before it and also implicitly opens the first paragraph of the
new section.
.TP
\fBsectref\fR \fIid\fR ?\fItext\fR?
Text markup. Formats a reference to the section identified by \fIid\fR.
If no \fItext\fR is specified the title of the referenced section is
used in the output, otherwise \fItext\fR is used.
.TP
\fBsectref-external\fR \fItext\fR
Text markup. Like \fBsectref\fR, except that the section is assumed to
be in a different document and therefore doesn't need to be identified,
nor are any checks for existence made. Only the text to format is needed.
.TP
\fBsee_also\fR \fIargs\fR
Document information. Anywhere. The command defines direct cross-references
to other documents. Each argument is a plain text label identifying the
referenced document. If this command is used multiple times all the arguments
accumulate.
.TP
\fBstrong\fR \fItext\fR
\fIDeprecated\fR. Text markup. See \fBemph\fR for the canonical
command to emphasize text.
.TP
\fBsubsection\fR \fIname\fR
Text structure. This command starts a new named subsection of a
section. The argument has to be plain text. Implicitly closes the last
paragraph coming before it and also implicitly opens the first
paragraph of the new subsection.
.TP
\fBsyscmd\fR \fItext\fR
Text markup. The argument text is marked up as the name of an external
command. The text may have other markup already applied to it. Main
use is the highlighting of external commands in free-form text.
.TP
\fBterm\fR \fItext\fR
Text markup. The argument is marked up as unspecific terminology.  The
text may have other markup already applied to it. Main use is the
highlighting of important terms and concepts in free-form text.
.TP
\fBtitledesc\fR \fIdesc\fR
Document information. Header. Optional. Registers the plain text
argument as the title of the manpage. Defaults to the value registered
by \fBmoddesc\fR.
.TP
\fBtkoption_def\fR \fIname\fR \fIdbname\fR \fIdbclass\fR
Text structure. List element. Widget option list. Automatically closes
the previous list element. Specifies the \fIname\fR of the option as
used in scripts, the name used by the option database (\fIdbname\fR),
and its class (\fIdbclass\fR), i.e. its type. It is expected that the
name is marked up using \fBoption\fR.
.TP
\fBtype\fR \fItext\fR
Text markup. The argument is marked up as the name of a
\fIdata type\fR. The text may have other markup already applied to
it. Main use is the highlighting of data types in free-form text.
.TP
\fBuri\fR \fItext\fR ?\fItext\fR?
Text markup. The argument is marked up as an \fIuri\fR (i.e. a
\fIuniform resource identifier\fR. The text may have other markup
already applied to it. Main use is the highlighting of uris in
free-form text. The second argument, should it be present, will be
interpreted the human-readable description of the uri. In other words,
as its label. Without an explicit label the uri will be its own label.
.TP
\fBusage\fR \fIargs\fR
Text markup. See \fBcall\fR for the full description, this command is
syntactically identical, as it is in its expectations for the markup
of its arguments.
In contrast to \fBcall\fR it is however not allowed to generate output
where this command occurs in the text. The command is \fIsilent\fR.
The formatted text may only appear in a different section of the
output, for example a table of contents, or synopsis, depending on the
output format.
.TP
\fBvar\fR \fItext\fR
Text markup. The argument is marked up as the name of a
\fIvariable\fR. The text may have other markup already applied to
it. Main use is the highlighting of variables in free-form text.
.TP
\fBvset\fR \fIvarname\fR \fIvalue\fR
Templating. In this form the command sets the named document variable
to the specified \fIvalue\fR. It does not generate output. I.e. the
command is replaced by the empty string.
.TP
\fBvset\fR \fIvarname\fR
Templating. In this form the command is replaced by the value of the
named document variable
.TP
\fBwidget\fR \fItext\fR
Text markup. The argument is marked up as the name of a
\fIwidget\fR. The text may have other markup already applied to
it. Main use is the highlighting of widget names in free-form text.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
doctools_intro, doctools_lang_faq, doctools_lang_intro, doctools_lang_syntax
.SH KEYWORDS
doctools commands, doctools language, doctools markup, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007-2010 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctools_lang_faq.n.


































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctools_lang_faq.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools_lang_faq" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctools_lang_faq \- doctools language faq
.SH DESCRIPTION
.PP
.SH OVERVIEW
.SS "WHAT IS THIS DOCUMENT?"
This document is currently mainly a placeholder, to be filled with
commonly asked questions about the doctools markup language and
companions, and their answers.
.PP
Please report any questions (and, if possible, answers) we should
consider for this document in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
.SH EXAMPLES
.SS "WHERE DO I FIND DOCTOOLS EXAMPLES?"
The most examples of doctools markup currently known can be found in
the Tcllib and Tklib package bundles where basically the documentation
of all packages is written in it.
In Tcllib you will also find the sources for the doctools
documentation themselves, which makes use of nearly all of the
available markup commands.
You need one of
.IP [1]
A CVS snapshot of Tcllib. How to retrieve such a snapshot and the
tools required for this are described at
\fIhttp://sourceforge.net/cvs/?group_id=12883\fR
.IP [2]
A Tcllib release archive. They are available at
\fIhttp://sourceforge.net/project/showfiles.php?group_id=12883\fR
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report any such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
the package and/or the documentation.
.SH "SEE ALSO"
doctools_lang_cmdref, doctools_lang_intro, doctools_lang_syntax
.SH KEYWORDS
doctools commands, doctools language, doctools markup, doctools syntax, examples, faq, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctools_lang_intro.n.





























































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctools_lang_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools_lang_intro" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctools_lang_intro \- doctools language introduction
.SH DESCRIPTION
.PP
This document is an informal introduction to version 1 of the doctools
markup language based on a multitude of examples. After reading this a
writer should be ready to understand the two parts of the formal
specification, i.e. the \fIdoctools language syntax\fR specification
and the \fIdoctools language command reference\fR.
.SS FUNDAMENTALS
In the broadest terms possible the \fIdoctools markup language\fR
is LaTeX-like, instead of like SGML and similar languages. A document
written in this language consists primarily of text, with markup
commands embedded into it.
.PP
Each markup command is a Tcl command surrounded by a matching pair of
\fB[\fR and \fB]\fR. Inside of these delimiters the usual
rules for a Tcl command apply with regard to word quotation, nested
commands, continuation lines, etc. I.e.
.PP
.CS


  ... [list_begin enumerated] ...

.CE
.CS


  ... [call [cmd foo] \\\\
          [arg bar]] ...

.CE
.CS


  ... [term {complex concept}] ...

.CE
.CS


  ... [opt "[arg key] [arg value]"] ...

.CE
.SS "BASIC STRUCTURE"
The most simple document which can be written in doctools is
.CS


    [manpage_begin NAME SECTION VERSION]
    [description]
    [manpage_end]

.CE
This also shows us that all doctools documents are split into two
parts, the \fIheader\fR and the \fIbody\fR. Everything coming before
[\fBdescription\fR] belongs to the header, and everything coming
after belongs to the body, with the whole document bracketed by the
two \fBmanpage_*\fR commands. Before and after these opening and
closing commands we have only \fIwhitespace\fR.
.PP
In the remainder of this section we will discuss only the contents of
the header, the structure of the body will be discussed in the section
\fBText structure\fR.
.PP
The header section can be empty, and otherwise may contain only an
arbitrary sequence of the four so-called \fIheader\fR commands, plus
\fIwhitespace\fR. These commands are
.TP
\fBtitledesc\fR
.TP
\fBmoddesc\fR
.TP
\fBrequire\fR
.TP
\fBcopyright\fR
.PP
They provide, through their arguments, additional information about
the document, like its title, the title of the larger group the
document belongs to (if applicable), the requirements of the
documented packages (if applicable), and copyright assignments. All of
them can occur multiple times, including none, and they can be used in
any order.
However for \fBtitledesc\fR and \fBmoddesc\fR only the last occurrence
is taken. For the other two the specified information is accumulated,
in the given order. Regular text is not allowed within the header.
.PP
Given the above a less minimal example of a document is
.CS


[manpage_begin NAME SECTION VERSION]
[\fBcopyright {YEAR AUTHOR}\fR]
[\fBtitledesc TITLE\fR]
[\fBmoddesc   MODULE_TITLE\fR]
[\fBrequire   PACKAGE VERSION\fR]
[\fBrequire   PACKAGE\fR]
[description]
[manpage_end]

.CE
Remember that the whitespace is optional. The document
.CS


    [manpage_begin NAME SECTION VERSION]
    [copyright {YEAR AUTHOR}][titledesc TITLE][moddesc MODULE_TITLE]
    [require PACKAGE VERSION][require PACKAGE][description]
    [manpage_end]

.CE
has the same meaning as the example before.
.PP
On the other hand, if \fIwhitespace\fR is present it consists not
only of any sequence of characters containing the space character,
horizontal and vertical tabs, carriage return, and newline, but it may
contain comment markup as well, in the form of the \fBcomment\fR
command.
.CS


[\fBcomment { ... }\fR]
[manpage_begin NAME SECTION VERSION]
[copyright {YEAR AUTHOR}]
[titledesc TITLE]
[moddesc   MODULE_TITLE][\fBcomment { ... }\fR]
[require   PACKAGE VERSION]
[require   PACKAGE]
[description]
[manpage_end]
[\fBcomment { ... }\fR]

.CE
.SS "ADVANCED STRUCTURE"
In the simple examples of the last section we fudged a bit regarding
the markup actually allowed to be used before the \fBmanpage_begin\fR
command opening the document.
.PP
Instead of only whitespace the two templating commands \fBinclude\fR
and \fBvset\fR are also allowed, to enable the writer to either set
and/or import configuration settings relevant to the document. I.e. it
is possible to write
.CS


[\fBinclude FILE\fR]
[\fBvset VAR VALUE\fR]
[manpage_begin NAME SECTION VERSION]
[description]
[manpage_end]

.CE
Even more important, these two commands are allowed anywhere where a
markup command is allowed, without regard for any other
structure. I.e. for example in the header as well.
.CS


[manpage_begin NAME SECTION VERSION]
[\fBinclude FILE\fR]
[\fBvset VAR VALUE\fR]
[description]
[manpage_end]

.CE
The only restriction \fBinclude\fR has to obey is that the contents of
the included file must be valid at the place of the inclusion. I.e. a
file included before \fBmanpage_begin\fR may contain only the
templating commands \fBvset\fR and \fBinclude\fR, a file included in
the header may contain only header commands, etc.
.SS "TEXT STRUCTURE"
The body of the document consists mainly of text, possibly split into
sections, subsections, and paragraphs, with parts marked up to
highlight various semantic categories of text, and additional
structure through the use of examples and (nested) lists.
.PP
This section explains the high-level structural commands, with
everything else deferred to the following sections.
.PP
The simplest way of structuring the body is through the introduction
of paragraphs. The command for doing so is \fBpara\fR. Each occurrence
of this command closes the previous paragraph and automatically opens
the next. The first paragraph is automatically opened at the beginning
of the body, by \fBdescription\fR. In the same manner the last
paragraph automatically ends at \fBmanpage_end\fR.
.CS


[manpage_begin NAME SECTION VERSION]
[description]
 ...
[\fBpara\fR]
 ...
[\fBpara\fR]
 ...
[manpage_end]

.CE
Empty paragraphs are ignored.
.PP
A structure coarser than paragraphs are sections, which allow the
writer to split a document into larger, and labeled, pieces. The
command for doing so is \fBsection\fR. Each occurrence of this command
closes the previous section and automatically opens the next,
including its first paragraph. The first section is automatically
opened at the beginning of the body, by \fBdescription\fR (This
section is labeled "DESCRIPTION"). In the same manner the last section
automatically ends at \fBmanpage_end\fR.
.PP
Empty sections are \fInot\fR ignored. We are free to (not) use
paragraphs within sections.
.CS


[manpage_begin NAME SECTION VERSION]
[description]
 ...
[\fBsection {Section A}\fR]
 ...
[para]
 ...
[\fBsection {Section B}\fR]
 ...
[manpage_end]

.CE
Between sections and paragraphs we have subsections, to split sections.
The command for doing so is \fBsubsection\fR. Each occurrence of this
command closes the previous subsection and automatically opens the
next, including its first paragraph. A subsection is automatically
opened at the beginning of the body, by \fBdescription\fR, and at the
beginning of each section. In the same manner the last subsection
automatically ends at \fBmanpage_end\fR.
.PP
Empty subsections are \fInot\fR ignored. We are free to (not) use
paragraphs within subsections.
.CS


[manpage_begin NAME SECTION VERSION]
[description]
 ...
[section {Section A}]
 ...
[\fBsubsection {Sub 1}\fR]
 ...
[para]
 ...
[\fBsubsection {Sub 2}\fR]
 ...
[section {Section B}]
 ...
[manpage_end]

.CE
.SS "TEXT MARKUP"
Having handled the overall structure a writer can impose on the
document we now take a closer at the text in a paragraph.
.PP
While most often this is just the unadorned content of the document we
do have situations where we wish to highlight parts of it as some type
of thing or other, like command arguments, command names, concepts,
uris, etc.
.PP
For this we have a series of markup commands which take the text to
highlight as their single argument. It should be noted that while
their predominant use is the highlighting of parts of a paragraph they
can also be used to mark up the arguments of list item commands, and
of other markup commands.
.PP
The commands available to us are
.TP
\fBarg\fR
Its argument is a the name of a command argument.
.TP
\fBclass\fR
Its argument is a class name.
.TP
\fBcmd\fR
Its argument is a command name (Tcl command).
.TP
\fBconst\fR
Its argument is a constant.
.TP
\fBemph\fR
General, non-semantic emphasis.
.TP
\fBfile\fR
Its argument is a filename / path.
.TP
\fBfun\fR
Its argument is a function name.
.TP
\fBmethod\fR
Its argument is a method name
.TP
\fBnamespace\fR
Its argument is namespace name.
.TP
\fBopt\fR
Its argument is some optional syntax element.
.TP
\fBoption\fR
Its argument is a command line switch / widget option.
.TP
\fBpackage\fR
Its argument is a package name.
.TP
\fBsectref\fR
Its argument is the title of a section or subsection,
i.e. a section reference.
.TP
\fBsyscmd\fR
Its argument is a command name (external, system command).
.TP
\fBterm\fR
Its argument is a concept, or general terminology.
.TP
\fBtype\fR
Its argument is a type name.
.TP
\fBuri\fR
Its argument is a uniform resource identifier, i.e an
external reference. A second argument can be used
to specify an explicit label for the reference in
question.
.TP
\fBusage\fR
The arguments describe the syntax of a Tcl command.
.TP
\fBvar\fR
Its argument is a variable.
.TP
\fBwidget\fR
Its argument is a widget name.
.PP
The example demonstrating the use of text markup is an excerpt from
the \fIdoctools language command reference\fR, with some
highlighting added.
It shows their use within a block of text, as the arguments of a list
item command (\fBcall\fR), and our ability to nest them.
.CS


  ...
  [call [\fBcmd arg_def\fR] [\fBarg type\fR] [\fBarg name\fR]] [\fBopt\fR [\fBarg mode\fR]]]

  Text structure. List element. Argument list. Automatically closes the
  previous list element. Specifies the data-[\fBarg type\fR] of the described
  argument of a command, its [\fBarg name\fR] and its i/o-[\fBarg mode\fR]. The
  latter is optional.
  ...

.CE
.SS ESCAPES
Beyond the 20 commands for simple markup shown in the previous section
we have two more available which are technically simple markup.
However their function is not the marking up of phrases as specific
types of things, but the insertion of characters, namely \fB[\fR
and \fB]\fR.
These commands, \fBlb\fR and \fBrb\fR respectively, are required
because our use of [ and ] to bracket markup commands makes it
impossible to directly use [ and ] within the text.
.PP
Our example of their use are the sources of the last sentence in the
previous paragraph, with some highlighting added.
.CS


  ...
  These commands, [cmd lb] and [cmd lb] respectively, are required
  because our use of [\fBlb\fR] and [\fBrb\fR] to bracket markup commands makes it
  impossible to directly use [\fBlb\fR] and [\fBrb\fR] within the text.
  ...

.CE
.SS CROSS-REFERENCES
The last two commands we have to discuss are for the declaration of
cross-references between documents, explicit and implicit. They are
\fBkeywords\fR and \fBsee_also\fR. Both take an arbitrary number of
arguments, all of which have to be plain unmarked text. I.e. it is not
allowed to use markup on them. Both commands can be used multiple
times in a document. If that is done all arguments of all occurrences
of one of them are put together into a single set.
.TP
\fBkeywords\fR
The arguments of this command are interpreted as keywords describing
the document. A processor can use this information to create an index
indirectly linking the containing document to all documents with the
same keywords.
.TP
\fBsee_also\fR
The arguments of this command are interpreted as references to other
documents. A processor can format them as direct links to these
documents.
.PP
.PP
All the cross-reference commands can occur anywhere in the document
between \fBmanpage_begin\fR and \fBmanpage_end\fR. As such the writer
can choose whether she wants to have them at the beginning of the
body, or at its end, maybe near the place a keyword is actually
defined by the main content, or considers them as meta data which
should be in the header, etc.
.PP
Our example shows the sources for the cross-references of this
document, with some highlighting added. Incidentally they are found
at the end of the body.
.CS


  ...
  [\fBsee_also doctools_intro\fR]
  [\fBsee_also doctools_lang_syntax\fR]
  [\fBsee_also doctools_lang_cmdref\fR]
  [\fBkeywords markup {semantic markup}\fR]
  [\fBkeywords {doctools markup} {doctools language}\fR]
  [\fBkeywords {doctools syntax} {doctools commands}\fR]
  [manpage_end]

.CE
.SS EXAMPLES
Where ever we can write plain text we can write examples too. For
simple examples we have the command \fBexample\fR which takes a single
argument, the text of the argument. The example text must not contain
markup. If we wish to have markup within an example we have to use the
2-command combination \fBexample_begin\fR / \fBexample_end\fR instead.
.PP
The first opens an example block, the other closes it, and in between
we can write plain text and use all the regular text markup commands.
Note that text structure commands are not allowed. This also means
that it is not possible to embed examples and lists within an example.
On the other hand, we \fIcan\fR use templating commands within
example blocks to read their contents from a file (Remember section
\fBAdvanced structure\fR).
.PP
The source for the very first example in this document (see section
\fBFundamentals\fR), with some highlighting added, is
.CS


  [\fBexample\fR {
    ... [list_begin enumerated] ...
  }]

.CE
Using \fBexample_begin\fR / \fBexample_end\fR this would look like
.CS


  [\fBexample_begin\fR]
    ... [list_begin enumerated] ...
  [\fBexample_end\fR]

.CE
.SS LISTS
Where ever we can write plain text we can write lists too. The main
commands are \fBlist_begin\fR to start a list, and \fBlist_end\fR to
close one. The opening command takes an argument specifying the type
of list started it, and this in turn determines which of the eight
existing list item commands are allowed within the list to start list
items.
.PP
After the opening command only whitespace is allowed, until the first
list item command opens the first item of the list. Each item is a
regular series of paragraphs and is closed by either the next list
item command, or the end of the list. If closed by a list item command
this command automatically opens the next list item. A consequence of
a list item being a series of paragraphs is that all regular text
markup can be used within a list item, including examples and other
lists.
.PP
The list types recognized by \fBlist_begin\fR and their associated
list item commands are:
.TP
\fBarguments\fR
(\fBarg_def\fR) This opens an \fIargument (declaration) list\fR. It
is a specialized form of a term definition list where the term is an
argument name, with its type and i/o-mode.
.TP
\fBcommands\fR
(\fBcmd_def\fR) This opens a \fIcommand (declaration) list\fR. It
is a specialized form of a term definition list where the term is a
command name.
.TP
\fBdefinitions\fR
(\fBdef\fR and \fBcall\fR) This opens a general
\fIterm definition list\fR. The terms defined by the list items are
specified through the argument(s) of the list item commands, either
general terms, possibly with markup (\fBdef\fR), or Tcl commands with
their syntax (\fBcall\fR).
.TP
\fBenumerated\fR
(\fBenum\fR) This opens a general \fIenumerated list\fR.
.TP
\fBitemized\fR
(\fBitem\fR)
This opens a general \fIitemized list\fR.
.TP
\fBoptions\fR
(\fBopt_def\fR) This opens an \fIoption (declaration) list\fR. It
is a specialized form of a term definition list where the term is an
option name, possibly with the option's arguments.
.TP
\fBtkoptions\fR
(\fBtkoption_def\fR) This opens a
\fIwidget option (declaration) list\fR. It is a specialized form of
a term definition list where the term is the name of a configuration
option for a widget, with its name and class in the option database.
.PP
Our example is the source of the definition list in the previous
paragraph, with most of the content in the middle removed.
.CS


  ...
  [\fBlist_begin\fR definitions]
  [\fBdef\fR [const arg]]

  ([cmd arg_def]) This opens an argument (declaration) list. It is a
  specialized form of a definition list where the term is an argument
  name, with its type and i/o-mode.

  [\fBdef\fR [const itemized]]

  ([cmd item])
  This opens a general itemized list.

  ...
  [\fBdef\fR [const tkoption]]

  ([cmd tkoption_def]) This opens a widget option (declaration) list. It
  is a specialized form of a definition list where the term is the name
  of a configuration option for a widget, with its name and class in the
  option database.

  [\fBlist_end\fR]
  ...

.CE
Note that a list cannot begin in one (sub)section and end in
another. Differently said, (sub)section breaks are not allowed within
lists and list items. An example of this \fIillegal\fR construct is
.CS


  ...
  [list_begin itemized]
  [item]
  ...
  [\fBsection {ILLEGAL WITHIN THE LIST}\fR]
  ...
  [list_end]
  ...

.CE
.SH "FURTHER READING"
Now that this document has been digested the reader, assumed to be a
\fIwriter\fR of documentation should be fortified enough to be able
to understand the formal \fIdoctools language syntax\fR
specification as well. From here on out the
\fIdoctools language command reference\fR will also serve as the
detailed specification and cheat sheet for all available commands and
their syntax.
.PP
To be able to validate a document while writing it, it is also
recommended to familiarize oneself with one of the applications for
the processing and conversion of doctools documents, i.e. either
Tcllib's easy and simple \fBdtplite\fR, or Tclapps'
ultra-configurable \fBdtp\fR.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
doctools_intro, doctools_lang_cmdref, doctools_lang_faq, doctools_lang_syntax
.SH KEYWORDS
doctools commands, doctools language, doctools markup, doctools syntax, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctools_lang_syntax.n.












































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctools_lang_syntax.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools_lang_syntax" n 1.0 tcllib "Documentation tools"
.BS
.SH NAME
doctools_lang_syntax \- doctools language syntax
.SH DESCRIPTION
.PP
This document contains the formal specification of the syntax of the
doctools markup language, version 1 in Backus-Naur-Form. This document
is intended to be a reference, complementing the
\fIdoctools language command reference\fR.
A beginner should read the much more informally written
\fIdoctools language introduction\fR first before trying to
understand either this document or the command reference.
.SH FUNDAMENTALS
In the broadest terms possible the \fIdoctools markup language\fR
is LaTeX-like, instead of like SGML and similar languages. A document
written in this language consists primarily of text, with markup
commands embedded into it.
.PP
Each markup command is a just Tcl command surrounded by a matching
pair of \fB[\fR and \fB]\fR. Which commands are available,
and their arguments, i.e. syntax is specified in the
\fIdoctools language command reference\fR.
.PP
In this document we specify first the lexeme, and then the syntax,
i.e. how we can mix text and markup commands with each other.
.SH "LEXICAL DEFINITIONS"
In the syntax rules listed in the next section
.IP [1]
<TEXT> stands for all text except markup commands.
.IP [2]
Any XXX stands for the markup command [xxx] including its
arguments. Each markup command is a Tcl command surrounded by a
matching pair of \fB[\fR and \fB]\fR. Inside of these
delimiters the usual rules for a Tcl command apply with regard to word
quotation, nested commands, continuation lines, etc.
.IP [3]
<WHITE> stands for all text consisting only of spaces, newlines,
tabulators and the \fBcomment\fR markup command.
.PP
.SH SYNTAX
The rules listed here specify only the syntax of doctools
documents. The lexical level of the language was covered in the
previous section.
.PP
Regarding the syntax of the (E)BNF itself
.IP [1]
The construct { X } stands for zero or more occurrences of X.
.IP [2]
The construct [ X ] stands for zero or one occurrence of X.
.IP [3]
The construct LIST_BEGIN<X> stands for the markup command
\fBlist_begin\fR with \fBX\fR as its type argument.
.PP
The syntax:
.CS


manpage = defs
          MANPAGE_BEGIN
          header
          DESCRIPTION
          body
          MANPAGE_END
          { <WHITE> }

defs    = { INCLUDE | VSET | <WHITE> }

header  = { TITLEDESC | MODDESC | COPYRIGHT | REQUIRE | defs | xref }

xref    = KEYWORDS | SEE_ALSO | CATEGORY

body    = paras { SECTION    sbody  }
sbody   = paras { SUBSECTION ssbody }
ssbody  = paras

paras   = tblock { (PARA | NL) tblock }

tblock  = { <TEXT> | defs | markup | xref | an_example | a_list }

markup  = ARG     | CLASS | CMD     | CONST     | EMPH   | FILE
        | FUN     | LB    | METHOD  | NAMESPACE | OPT    | OPTION
        | PACKAGE | RB    | SECTREF | STRONG    | SYSCMD | TERM
        | TYPE    | URI   | USAGE   | VAR       | WIDGET

example = EXAMPLE
        | EXAMPLE_BEGIN extext EXAMPLE_END

extext  = { <TEXT> | defs | markup }

a_list  = LIST_BEGIN<arguments>   argd_list   LIST_END
        | LIST_BEGIN<commands>    cmdd_list   LIST_END
        | LIST_BEGIN<definitions> def_list    LIST_END
        | LIST_BEGIN<enumerated>  enum_list   LIST_END
        | LIST_BEGIN<itemized>    item_list   LIST_END
        | LIST_BEGIN<options>     optd_list   LIST_END
        | LIST_BEGIN<tkoptions>   tkoptd_list LIST_END

argd_list   = [ <WHITE> ] { ARG_DEF      paras }
cmdd_list   = [ <WHITE> ] { CMD_DEF      paras }
def_list    = [ <WHITE> ] { (DEF|CALL)   paras }
enum_list   = [ <WHITE> ] { ENUM         paras }
item_list   = [ <WHITE> ] { ITEM         paras }
optd_list   = [ <WHITE> ] { OPT_DEF      paras }
tkoptd_list = [ <WHITE> ] { TKOPTION_DEF paras }

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
doctools_intro, doctools_lang_cmdref, doctools_lang_faq, doctools_lang_intro
.SH KEYWORDS
doctools commands, doctools language, doctools markup, doctools syntax, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/doctools_plugin_apiref.n.













































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/doctools_plugin_apiref.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2010 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools_plugin_apiref" n 1.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools_plugin_apiref \- doctools plugin API reference
.SH SYNOPSIS
\fBdt_copyright\fR
.sp
\fBdt_file\fR
.sp
\fBdt_mainfile\fR
.sp
\fBdt_fileid\fR
.sp
\fBdt_fmap\fR \fIsymfname\fR
.sp
\fBdt_format\fR
.sp
\fBdt_imgdata\fR \fIkey\fR \fIextensions\fR
.sp
\fBdt_imgdst\fR \fIkey\fR \fIextensions\fR
.sp
\fBdt_imgsrc\fR \fIkey\fR \fIextensions\fR
.sp
\fBdt_lnesting\fR
.sp
\fBdt_module\fR
.sp
\fBdt_read\fR \fIfile\fR
.sp
\fBdt_source\fR \fIfile\fR
.sp
\fBdt_user\fR
.sp
\fBex_cappend\fR \fItext\fR
.sp
\fBex_cget\fR \fIvarname\fR
.sp
\fBex_cis\fR \fIcname\fR
.sp
\fBex_cname\fR
.sp
\fBex_cpop\fR \fIcname\fR
.sp
\fBex_cpush\fR \fIcname\fR
.sp
\fBex_cset\fR \fIvarname\fR \fIvalue\fR
.sp
\fBex_lb\fR ?\fInewbracket\fR?
.sp
\fBex_rb\fR ?\fInewbracket\fR?
.sp
\fBfmt_initialize\fR
.sp
\fBfmt_listvariables\fR
.sp
\fBfmt_numpasses\fR
.sp
\fBfmt_postprocess\fR \fItext\fR
.sp
\fBfmt_setup\fR \fIn\fR
.sp
\fBfmt_shutdown\fR
.sp
\fBfmt_varset\fR \fIvarname\fR \fItext\fR
.sp
\fBfmt_plain_text\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
This document is intended for \fIplugin writers\fR, i.e. developers
wishing to write a doctools \fIformatting engine\fR for some output
format X.
.PP
It specifies the interaction between the \fBdoctools\fR package
and its plugins, i.e. the interface any doctools formatting engine has
to comply with.
.PP
This document deals with version 1 of the interface.
.PP
A reader who is on the other hand more interested in the markup
language itself should start with the
\fIdoctools language introduction\fR and proceed from there to the
formal specifications, i.e. the \fIdoctools language syntax\fR and
the \fIdoctools language command reference\fR.
.SH OVERVIEW
The API for a doctools formatting engine consists of two major
sections.
.PP
On the one side we have a set of commands through which the plugin is
able to query the frontend. These commands are provided by the
frontend and linked into the plugin interpreter. Please see section
\fBFRONTEND COMMANDS\fR for their detailed specification.
.PP
And on the other side the plugin has to provide its own set of
commands which will then be called by the frontend in a specific
sequence while processing input. They, again, fall into two
categories, management and formatting.
Please see section \fBPLUGIN COMMANDS\fR and its subsections for
their detailed specification.
.SH "FRONTEND COMMANDS"
This section specifies the set of commands through which a plugin,
also known as a doctools formatting engine, is able to query the
frontend. These commands are provided by the frontend and linked into
the plugin interpreter.
.PP
I.e. a doctools formatting engine can assume that all of the following
commands are present when any of its own commands (as specified in
section \fBPLUGIN COMMANDS\fR) are executed.
.PP
Beyond that it can also assume that it has full access to its own safe
interpreter and thus is not able to damage the other parts of the
processor, nor can it damage the filesystem.
It is however able to either kill or hang the whole process, by
exiting, or running an infinite loop.
.PP
Coming back to the imported commands, all the commands with prefix
\fIdt_\fR provide limited access to specific parts of the frontend,
whereas the commands with prefix \fIex_\fR provide access to the
state of the \fBtextutil::expander\fR object which does the main
parsing of the input within the frontend. These commands should not be
except under very special circumstances.
.PP
.TP
\fBdt_copyright\fR
Query command. It returns a string containing the copyright
information the doctools processor was configured with. The relevant
option is \fB-copyright\fR).
.TP
\fBdt_file\fR
Query command. It returns the full path of the file containing the
input currently processed by the engine. This may be an included file.
.TP
\fBdt_mainfile\fR
Query command. It returns the full path of the toplevel file containing
the input currently processed by the engine.
.TP
\fBdt_fileid\fR
Query command. It returns the name of the file containing the input
currently processed by the engine, without path, nor extension.
.TP
\fBdt_fmap\fR \fIsymfname\fR
Query command. It returns the actual pathname to use in the output in
place of the symbolic filename \fIsymfname\fR. It will return the
unchanged input if no mapping was established for \fIsymfname\fR.
.sp
The required mappings are established with the method \fBmap\fR of
a frontend, as explained in section \fBOBJECT METHODS\fR
of the documentation for the package \fBdoctools\fR.
.TP
\fBdt_format\fR
Query command. It returns the name of the format associated with the
doctools formatting engine.
.TP
\fBdt_imgdata\fR \fIkey\fR \fIextensions\fR
Query command. Access to the image map. Looks for an image recorded
under the \fIkey\fR and having on the specified \fIextension\fR. If a
matching image is found its data is returned as the result of the
command. Otherwise an empty string is returned.
.TP
\fBdt_imgdst\fR \fIkey\fR \fIextensions\fR
Query command. Access to the image map. Looks for an image recorded
under the \fIkey\fR and having on the specified \fIextension\fR. If a
matching image is found its destination path in the output is returned
as the result of the command. Otherwise an empty string is returned.
.TP
\fBdt_imgsrc\fR \fIkey\fR \fIextensions\fR
Query command. Access to the image map. Looks for an image recorded
under the \fIkey\fR and having on the specified \fIextension\fR. If a
matching image is found its origin path is returned as the result of
the command. Otherwise an empty string is returned.
.TP
\fBdt_lnesting\fR
Query command. It returns the number of lists currently open.
.TP
\fBdt_module\fR
Query command. It returns the name of the module the input currently
processed belongs to.
.TP
\fBdt_read\fR \fIfile\fR
Controlled filesystem access. Returns contents of \fIfile\fR for
whatever use desired by the plugin.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.
.TP
\fBdt_source\fR \fIfile\fR
Controlled filesystem access. This command allows the doctools
formatting engine to load additional Tcl code it may need.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.
.TP
\fBdt_user\fR
Query command. It returns the name of the current user as known to the
tcl interpreter the frontend controlling the formatting engine resides
in.
.TP
\fBex_cappend\fR \fItext\fR
Appends a string to the output in the current context.  This command
should rarely be used by macros or application code.
.TP
\fBex_cget\fR \fIvarname\fR
Retrieves the value of variable \fIvarname\fR, defined in the current
context.
.TP
\fBex_cis\fR \fIcname\fR
Determines whether or not the name of the current context is
\fIcname\fR.
.TP
\fBex_cname\fR
Returns the name of the current context.
.TP
\fBex_cpop\fR \fIcname\fR
Pops a context from the context stack, returning all accumulated
output in that context.  The context must be named \fIcname\fR, or an
error results.
.TP
\fBex_cpush\fR \fIcname\fR
Pushes a context named \fIcname\fR onto the context stack.  The
context must be popped by \fBcpop\fR before expansion ends or an
error results.
.TP
\fBex_cset\fR \fIvarname\fR \fIvalue\fR
Sets variable \fIvarname\fR to \fIvalue\fR in the current context.
.TP
\fBex_lb\fR ?\fInewbracket\fR?
Returns the current value of the left macro expansion bracket; this is
for use as or within a macro, when the bracket needs to be included in
the output text.  If \fInewbracket\fR is specified, it becomes the new
bracket, and is returned.
.TP
\fBex_rb\fR ?\fInewbracket\fR?
Returns the current value of the right macro expansion bracket; this
is for use as or within a macro, when the bracket needs to be included
in the output text.  If \fInewbracket\fR is specified, it becomes the
new bracket, and is returned.
.PP
.SH "PLUGIN COMMANDS"
The plugin has to provide its own set of commands which will then be
called by the frontend in a specific sequence while processing
input. They fall into two categories, management and formatting. Their
expected names, signatures, and responsibilities are specified in the
following two subsections.
.SS "MANAGEMENT COMMANDS"
The management commands a plugin has to provide are used by the
frontend to
.IP [1]
initialize and shutdown the plugin
.IP [2]
determine the number of passes it has
to make over the input
.IP [3]
initialize and shutdown each pass
.IP [4]
query and initialize engine parameters
.PP
.PP
After the plugin has been loaded and the frontend commands are
established the commands will be called in the following sequence:
.CS


    fmt_numpasses -> n
    fmt_listvariables -> vars

    fmt_varset var1 value1
    fmt_varset var2 value2
    ...
    fmt_varset varK valueK
    fmt_initialize
    fmt_setup 1
    ...
    fmt_setup 2
    ...
    ...
    fmt_setup n
    ...
    fmt_postprocess
    fmt_shutdown
    ...

.CE
I.e. first the number of passes and the set of available engine
parameters is established, followed by calls setting the
parameters. That second part is optional.
.PP
After that the plugin is initialized, the specified number of passes
executed, the final result run through a global post processing step
and at last the plugin is shutdown again. This can be followed by more
conversions, restarting the sequence at \fBfmt_varset\fR.
.PP
In each of the passes, i.e. after the calls of \fBfmt_setup\fR the
frontend will process the input and call the formatting commands as
markup is encountered. This means that the sequence of formatting
commands is determined by the grammar of the doctools markup language,
as specified in the \fIdoctools language syntax\fR specification.
.PP
A different way of looking at the sequence is:
.IP \(bu
First some basic parameters are determined.
.IP \(bu
Then everything starting at the first \fBfmt_varset\fR to
\fBfmt_shutdown\fR forms a \fIrun\fR, the formatting of a
single input. Each run can be followed by more.
.IP \(bu
Embedded within each run we have one or more \fIpasses\fR,
each starting with \fBfmt_setup\fR and going until either the next
\fBfmt_setup\fR or \fBfmt_postprocess\fR is reached.
.sp
If more than one pass is required to perform the formatting only the
output of the last pass is relevant. The output of all the previous,
preparatory passes is ignored.
.PP
.PP
The commands, their names, signatures, and responsibilities are, in
detail:
.TP
\fBfmt_initialize\fR
\fIInitialization/Shutdown\fR.
This command is called at the beginning of every conversion run, as
the first command of that run. Note that a run is not a pass, but may
consist of multiple passes.
It has to initialize the general state of the plugin, beyond the
initialization done during the load. No return value is expected, and
any returned value is ignored.
.TP
\fBfmt_listvariables\fR
\fIInitialization/Shutdown\fR and \fIEngine parameters\fR.
Second command is called after the plugin code has been loaded,
i.e. immediately after \fBfmt_numpasses\fR.
It has to return a list containing the names of the parameters the
frontend can set to configure the engine. This list can be empty.
.TP
\fBfmt_numpasses\fR
\fIInitialization/Shutdown\fR and \fIPass management\fR.
First command called after the plugin code has been loaded. No other
command of the engine will be called before it.
It has to return the number of passes this engine requires to fully
process the input document. This value has to be an integer number
greater or equal to one.
.TP
\fBfmt_postprocess\fR \fItext\fR
\fIInitialization/Shutdown\fR.
This command is called immediately after the last pass in a run. Its
argument is the result of the conversion generated by that pass. It is
provided to allow the engine to perform any global modifications of
the generated document. If no post-processing is required for a
specific format the command has to just return the argument.
.sp
Expected to return a value, the final result of formatting the input.
.TP
\fBfmt_setup\fR \fIn\fR
\fIInitialization/Shutdown\fR and \fIPass management\fR.
This command is called at the beginning of each pass over the input in
a run. Its argument is the number of the pass which has begun. Passes
are counted from \fB1\fR upward.
The command has to set up the internal state of the plugin for this
particular pass. No return value is expected, and any returned value
is ignored.
.TP
\fBfmt_shutdown\fR
\fIInitialization/Shutdown\fR.
This command is called at the end of every conversion run. It is the
last command called in a run. It has to clean up of all the
run-specific state in the plugin.
After the call the engine has to be in a state which allows the
initiation of another run without fear that information from the last
run is leaked into this new run.
No return value is expected, and any returned value is ignored.
.TP
\fBfmt_varset\fR \fIvarname\fR \fItext\fR
\fIEngine parameters\fR.
This command is called by the frontend to set an engine parameter to a
particular value.
The parameter to change is specified by \fIvarname\fR, the value to
set in \fItext\fR.
.sp
The command has to throw an error if an unknown \fIvarname\fR is
used. Only the names returned by \fBfmt_listvariables\fR have to be
considered as known.
.sp
The values of all engine parameters have to persist between passes and
runs.
.PP
.SS "FORMATTING COMMANDS"
The formatting commands have to implement the formatting for the
output format, for all the markup commands of the doctools markup
language, except \fBlb\fR, \fBrb\fR, \fBvset\fR, \fBinclude\fR, and
\fBcomment\fR. These exceptions are processed by the frontend and are
never seen by the plugin. In return a command for the formatting of
plain text has to be provided, something which has no markup in the
input at all.
.PP
This means, that each of the 49 markup commands specified in the
\fIdoctools language command reference\fR and outside of the set of
exceptions listed above has an equivalent formatting command which
takes the same arguments as the markup command and whose name is the
name of markup command with the prefix \fIfmt_\fR added to it.
.PP
All commands are expected to format their input in some way per the
semantics specified in the command reference and to return whatever
part of this that they deem necessary as their result, which will be
added to the output.
.PP
To avoid essentially duplicating the command reference we do not list
any of the command here and simply refer the reader to the
\fIdoctools language command reference\fR for their signature and
description. The sole exception is the plain text formatter, which has
no equivalent markup command.
.PP
The calling sequence of formatting commands is not as rigid as for the
management commands, but determined by the grammar of the doctools
markup language, as specified in the \fIdoctools language syntax\fR
specification.
.PP
.TP
\fBfmt_plain_text\fR \fItext\fR
\fINo associated markup command\fR.
.sp
Called by the frontend for any plain text encountered in the
input. It has to perform any and all special processing required for
plain text.
.sp
The formatted text is expected as the result of the command,
and added to the output. If no special processing is required it has
to simply return its argument without change.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
doctools, doctools_intro, doctools_lang_cmdref, doctools_lang_faq, doctools_lang_intro, doctools_lang_syntax
.SH KEYWORDS
document, formatter, formatting engine, manpage, markup, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2007-2010 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools/mpexpand.n.
































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools/mpexpand.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002 Andreas Kupries <[email protected]>
'\" Copyright (c) 2003 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "mpexpand" n 1.0 tcllib "Documentation toolbox"
.BS
.SH NAME
mpexpand \- Markup processor
.SH SYNOPSIS
\fBmpexpand\fR ?-module \fImodule\fR? \fIformat\fR \fIinfile\fR|- \fIoutfile\fR|-
.sp
\fBmpexpand.all\fR ?\fI-verbose\fR? ?\fImodule\fR?
.sp
.BE
.SH DESCRIPTION
.PP
This manpage describes a processor / converter for manpages in the
doctools format as specified in \fBdoctools_fmt\fR. The processor
is based upon the package \fBdoctools\fR.
.TP
\fBmpexpand\fR ?-module \fImodule\fR? \fIformat\fR \fIinfile\fR|- \fIoutfile\fR|-
The processor takes three arguments, namely the code describing which
formatting to generate as the output, the file to read the markup
from, and the file to write the generated output into. If the
\fIinfile\fR is "\fB-\fR" the processor will read from
\fBstdin\fR. If \fIoutfile\fR is "\fB-\fR" the processor will
write to \fBstdout\fR.
.sp
If the option \fI-module\fR is present its value overrides the internal
definition of the module name.
.sp
The currently known output formats are
.RS
.TP
\fBnroff\fR
The processor generates *roff output, the standard format for unix
manpages.
.TP
\fBhtml\fR
The processor generates HTML output, for usage in and display by web
browsers.
.TP
\fBtmml\fR
The processor generates TMML output, the Tcl Manpage Markup Language,
a derivative of XML.
.TP
\fBlatex\fR
The processor generates LaTeX output.
.TP
\fBwiki\fR
The processor generates Wiki markup as understood by \fBwikit\fR.
.TP
\fBlist\fR
The processor extracts the information provided by \fBmanpage_begin\fR.
.TP
\fBnull\fR
The processor does not generate any output.
.RE
.TP
\fBmpexpand.all\fR ?\fI-verbose\fR? ?\fImodule\fR?
This command uses \fBmpexpand\fR to generate all possible output
formats for all manpages in the current directory. The manpages are
recognized through the extension "\fI.man\fR". If \fI-verbose\fR is
specified the command will list its actions before executing them.
.sp
The \fImodule\fR information is passed to \fBmpexpand\fR.
.PP
.SH NOTES
.PP
Possible future formats are plain text, pdf and postscript.
.SH "SEE ALSO"
expander(n), format(n), formatter(n)
.SH KEYWORDS
HTML, TMML, conversion, manpage, markup, nroff
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2002 Andreas Kupries <[email protected]>
Copyright (c) 2003 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2base/html_cssdefaults.n.



























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2base/html_cssdefaults.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::html::cssdefaults" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::html::cssdefaults \- Default CSS style for HTML export plugins
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::html::cssdefaults  ?0.1?\fR
.sp
\fB::doctools::html::cssdefaults::contents\fR
.sp
.BE
.SH DESCRIPTION
This package provides a single command providing access to the text of
the default CSS style to use for HTML markup generated by the various
HTML export plugins.
.PP
This is an internal package of doctools, for use by \fIexport\fR plugins,
i.e. the packages converting doctools related documented into other
formats, most notably \fIHTML\fR.
.SH API
.TP
\fB::doctools::html::cssdefaults::contents\fR
This command returns the text of the default CSS style to use for HTML
markup generated by the various HTML export plugins.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
CSS, HTML, doctools, export, plugin, style
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2base/nroff_manmacros.n.



























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2base/nroff_manmacros.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::nroff::man_macros" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::nroff::man_macros \- Default CSS style for NROFF export plugins
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::nroff::man_macros  ?0.1?\fR
.sp
\fB::doctools::nroff::man_macros::contents\fR
.sp
.BE
.SH DESCRIPTION
This package provides a single command providing access to the
definition of the nroff \fIman\fR macro set to use for NROFF markup
generated by the various NROFF export plugins.
.PP
This is an internal package of doctools, for use by \fIexport\fR plugins,
i.e. the packages converting doctools related documented into other
formats, most notably \fInroff\fR.
.SH API
.TP
\fB::doctools::nroff::man_macros::contents\fR
This command returns the text of the default CSS style to use for NROFF
generated by the various NROFF export plugins.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctools, export, macros, man_macros, nroff, plugin
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2base/tcl_parse.n.

























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2base/tcl_parse.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::tcl::parse" n 1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::tcl::parse \- Processing text in 'subst -novariables' format
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit \fR
.sp
package require \fBfileutil \fR
.sp
package require \fBlogger \fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBstruct::stack \fR
.sp
package require \fBstruct::set \fR
.sp
package require \fBtreeql \fR
.sp
\fB::doctools::tcl::parse\fR \fBtext\fR \fItree\fR \fItext\fR ?\fIroot\fR?
.sp
\fB::doctools::tcl::parse\fR \fBfile\fR \fItree\fR \fIpath\fR ?\fIroot\fR?
.sp
.BE
.SH DESCRIPTION
This package provides commands for parsing text with embedded Tcl
commands as accepted by the Tcl builtin command
\fBsubst -novariables\fR. The result of the parsing is an abstract
syntax tree.
.PP
This is an internal package of doctools, for use by the higher level
parsers processing the \fIdocidx\fR, \fIdoctoc\fR, and \fIdoctools\fR
markup languages.
.SH API
.TP
\fB::doctools::tcl::parse\fR \fBtext\fR \fItree\fR \fItext\fR ?\fIroot\fR?
The command takes the \fItext\fR and parses it under the assumption
that it contains a string acceptable to the Tcl builtin command
\fBsubst -novariables\fR. Errors are thrown otherwise during the
parsing. The format used for these errors in described in section
\fBError format\fR.
.sp
The command returns the empty string as it result. The actual result
of the parsing is entered into the tree structure \fItree\fR, under
the node \fIroot\fR.
If \fIroot\fR is not specified the root of \fItree\fR is used. The
\fItree\fR has to exist and be the command of a tree object which
supports the same methods as trees created by the package
\fBstruct::tree\fR.
.sp
In case of errors \fItree\fR will be left in an undefined state.
.TP
\fB::doctools::tcl::parse\fR \fBfile\fR \fItree\fR \fIpath\fR ?\fIroot\fR?
The same as \fBtext\fR, except that the text to parse is read from
the file specified by \fIpath\fR.
.PP
.SH "ERROR FORMAT"
When the parser encounters a problem in the input
it will throw an error using the format described
here.
.IP [1]
The message will contain the reason for the problem (unexpected
character or end of input in input), the character in question, if
any, and the line and column the problem was found at, in a human
readable form. This part is not documented further as its format may
change as we see fit. It is intended for human consumption, not
machine.
.IP [2]
The error code however will contain a machine-readable representation
of the problem, in the form of a 5-element list containing, in the
order listed below
.RS
.IP [1]
the constant string \fBdoctools::tcl::parse\fR
.IP [2]
the cause of the problem, one of
.RS
.TP
\fBchar\fR
Unexpected character in input
.TP
\fBeof\fR
Unexpected end of the input
.RE
.IP [3]
The location of the problem as offset from the beginning of the input,
counted in characters. Note: Line markers count as one character.
.IP [4]
The line the problem was found on (counted from 1 (one)),
.IP [5]
The column the problem was found at (counted from 0 (zero))
.RE
.PP
.SH "TREE STRUCTURE"
After successfully parsing a string the generated tree will have the
following structure:
.IP [1]
In the following items the word 'root' refers to the node which was
specified as the root of the tree when invoking either \fBtext\fR
or \fBfile\fR. This may be the actual root of the tree.
.IP [2]
All the following items further ignore the possibility of pre-existing
attributes in the pre-existing nodes. If attributes exists with the
same names as the attributes used by the parser the pre-existing
values are written over. Attributes with names not clashing with the
parser's attributes are not touched.
.IP [3]
The root node has no attributes.
.IP [4]
All other nodes have the attributes
.RS
.TP
type
The value is a string from the set { Command , Text , Word }
.TP
range
The value is either empty or a 2-element list containing integer
numbers. The numbers are the offsets of the first and last character
in the input text, of the token described by the node,.
.TP
line
The value is an integer, it describes the line in the input the token
described by the node ends on. Lines are counted from 1 (\fBone\fR).
.TP
col
The value is an integer, it describes the column in the line in the
input the token described by the node ends on. Columns are counted
from 0 (\fBzero\fR).
.RE
.IP [5]
The children of the root, if any, are of type Command and Text, in
semi-alternation. This means: After a Text node a Command node has to
follow, and anything can follow a Command node, a Text or other
Command node.
.IP [6]
The children of a Command node, if any, are of type Command, and Text,
and Word, they describe the arguments of the command.
.IP [7]
The children of a Word node, if any, are of type Command, Text, in
semi-alternation. This means: After a Text node a Command node has to
follow, and anything can follow a Command node, a Text or other
Command node.
.IP [8]
A Word node without children represents the empty string.
.IP [9]
All Text nodes are leaves of the tree.
.IP [10]
All leaves of the tree are either Text or Command nodes.
Word nodes cannot be leaves.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
Tcl syntax, command, doctools, parser, subst, word
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2base/tcllib_msgcat.n.
















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2base/tcllib_msgcat.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat \- Message catalog management for the various document parsers
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat  ?0.1?\fR
.sp
\fB::doctools::msgcat::init\fR \fIprefix\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat\fR is a support module handling
the selection of message catalogs for the various document processing
packages in the doctools system version 2. As such it is an internal
package a regular user (developer) should not be in direct contact
with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the various
parser packages, and is shared by them. Underneath it, but not
explicit dependencies, are the packages providing the message catalogs
for the various languages.
.SH API
.TP
\fB::doctools::msgcat::init\fR \fIprefix\fR
The command locates and loads the message catalogs for all the
languages returned by \fBmsgcat::mcpreferences\fR, provided that they
could be found. It returns an integer number describing how many
packages were found and loaded.
.sp
The names of the packages the command will look for have the form
"doctools::msgcat::\fIprefix\fR::\fBlangcode\fR", with \fIprefix\fR
the argument to the command, and the \fBlangcode\fR supplied by the
result of \fBmsgcat::mcpreferences\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
catalog package, docidx, doctoc, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/container.n.



















































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/container.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx" n 2 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx \- Holding keyword indices
.SH SYNOPSIS
package require \fBdoctools::idx  ?2?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::structure \fR
.sp
package require \fBsnit \fR
.sp
\fB::doctools::idx\fR \fIobjectName\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBkey add\fR \fIname\fR
.sp
\fIobjectName\fR \fBkey remove\fR \fIname\fR
.sp
\fIobjectName\fR \fBkey references\fR \fIname\fR
.sp
\fIobjectName\fR \fBkeys\fR
.sp
\fIobjectName\fR \fBreference add\fR \fItype\fR \fIkey\fR \fIname\fR \fIlabel\fR
.sp
\fIobjectName\fR \fBreference remove\fR \fIname\fR
.sp
\fIobjectName\fR \fBreference label\fR \fIname\fR
.sp
\fIobjectName\fR \fBreference keys\fR \fIname\fR
.sp
\fIobjectName\fR \fBreference type\fR \fIname\fR
.sp
\fIobjectName\fR \fBreferences\fR
.sp
\fIobjectName\fR \fBtitle\fR
.sp
\fIobjectName\fR \fBtitle\fR \fItext\fR
.sp
\fIobjectName\fR \fBlabel\fR
.sp
\fIobjectName\fR \fBlabel\fR \fItext\fR
.sp
\fIobjectName\fR \fBimporter\fR
.sp
\fIobjectName\fR \fBimporter\fR \fIobject\fR
.sp
\fIobjectName\fR \fBexporter\fR
.sp
\fIobjectName\fR \fBexporter\fR \fIobject\fR
.sp
\fIobjectName\fR \fBdeserialize =\fR \fIdata\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBdeserialize +=\fR \fIdata\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBserialize\fR ?\fIformat\fR?
.sp
.BE
.SH DESCRIPTION
This package provides a class to contain and programmatically
manipulate keyword indices
.PP
This is one of the three public pillars the management of keyword
indices resides on. The other two pillars are
.IP [1]
\fIExporting keyword indices\fR, and
.IP [2]
\fIImporting keyword indices\fR
.PP
.PP
For information about the \fBConcepts\fR of keyword indices, and
their parts, see the same-named section.
For information about the data structure which is used to encode
keyword indices as values see the section
\fBKeyword index serialization format\fR.
This is the only format directly known to this class. Conversions from
and to any other format are handled by export and import manager
objects. These may be attached to a container, but do not have to be,
it is merely a convenience.
.SH CONCEPTS
.IP [1]
A \fIkeyword index\fR consists of a (possibly empty) set of \fIkeywords\fR.
.IP [2]
Each keyword in the set is identified by its name.
.IP [3]
Each keyword has a (possibly empty) set of \fIreferences\fR.
.IP [4]
A reference can be associated with more than one keyword.
.IP [5]
A reference not associated with at least one keyword is not possible
however.
.IP [6]
Each reference is identified by its target, specified as either an url
or symbolic filename, depending on the type of reference (\fBurl\fR,
or \fBmanpage\fR).
.IP [7]
The type of a reference (url, or manpage) depends only on the
reference itself, and not the keywords it is associated with.
.IP [8]
In addition to a type each reference has a descriptive label as
well. This label depends only on the reference itself, and not the
keywords it is associated with.
.PP
A few notes
.IP [1]
Manpage references are intended to be used for references to the
documents the index is made for. Their target is a symbolic file name
identifying the document, and export plugins may replace symbolic with
actual file names, if specified.
.IP [2]
Url references are intended on the othre hand are inteded to be used
for links to anything else, like websites. Their target is an url.
.IP [3]
While url and manpage references share a namespace for their
identifiers, this should be no problem, given that manpage identifiers
are symbolic filenames and as such they should never look like urls,
the identifiers for url references.
.PP
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::idx\fR \fIobjectName\fR
This command creates a new container object with an associated Tcl
command whose name is \fIobjectName\fR. This \fIobject\fR command is
explained in full detail in the sections \fBObject command\fR
and \fBObject methods\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::doctools::idx\fR command have the
following general form:
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBkey add\fR \fIname\fR
This method adds the keyword \fIname\fR to the index. If the keyword
is already known nothing is done. The result of the method is the
empty string.
.TP
\fIobjectName\fR \fBkey remove\fR \fIname\fR
This method removes the keyword \fIname\fR from the index. If the
keyword is already gone nothing is done. Any references for whom this
keyword was the last association are removed as well.  The result of
the method is the empty string.
.TP
\fIobjectName\fR \fBkey references\fR \fIname\fR
This method returns a list containing the names of all references
associated with the keyword \fIname\fR. An error is thrown in the
keyword is not known to the index. The order of the references in the
list is undefined.
.TP
\fIobjectName\fR \fBkeys\fR
This method returns a list containing the names of all keywords known
to the index. The order of the keywords in the list is undefined.
.TP
\fIobjectName\fR \fBreference add\fR \fItype\fR \fIkey\fR \fIname\fR \fIlabel\fR
This method adds the reference \fIname\fR to the index and associates
it with the keyword \fIkey\fR.
The other two arguments hold the \fItype\fR and \fIlabel\fR of the
reference, respectively.
The type has to match the stored information, should the reference
exist already, i.e. this information is immutable after the reference
is known. The only way to change it is delete and recreate the
reference.
The label on the other hand is automatically updated to the value of
the argument, overwriting any previously stored information.
Should the reference exists already it is simply associated with the
\fIkey\fR.  If that is true already as well nothing is done, but the
\fIlabel\fR updated to the new value.  The result of the method is the
empty string.
.sp
The \fItype\fR argument has be to one of \fBmanpage\fR or \fBurl\fR.
.TP
\fIobjectName\fR \fBreference remove\fR \fIname\fR
The reference \fIname\fR is removed from the index. All associations
with keywords are released and the relevant reference labels removed.
The result of the method is the empty string.
.TP
\fIobjectName\fR \fBreference label\fR \fIname\fR
This method returns the label associated with the reference
\fIname\fR. An error is thrown if the reference is not known.
.TP
\fIobjectName\fR \fBreference keys\fR \fIname\fR
This method returns a list containing the names of all keywords
associated with the reference \fIname\fR. An error is thrown in the
reference is not known to the index. The order of the keywords in the
list is undefined.
.TP
\fIobjectName\fR \fBreference type\fR \fIname\fR
This method returns the type of the reference \fIname\fR. An error is
thrown in the reference is not known to the index.
.TP
\fIobjectName\fR \fBreferences\fR
This method returns a list containing the names of all references
known to the index. The order of the references in the list is
undefined.
.TP
\fIobjectName\fR \fBtitle\fR
Returns the currently defined title of the keyword index.
.TP
\fIobjectName\fR \fBtitle\fR \fItext\fR
Sets the title of the keyword index to \fItext\fR, and returns it as
the result of the command.
.TP
\fIobjectName\fR \fBlabel\fR
Returns the currently defined label of the keyword index.
.TP
\fIobjectName\fR \fBlabel\fR \fItext\fR
Sets the label of the keyword index to \fItext\fR, and returns it as
the result of the command.
.TP
\fIobjectName\fR \fBimporter\fR
Returns the import manager object currently attached to the container,
if any.
.TP
\fIobjectName\fR \fBimporter\fR \fIobject\fR
Attaches the \fIobject\fR as import manager to the container, and
returns it as the result of the command.
Note that the \fIobject\fR is \fInot\fR put into ownership of the
container. I.e., destruction of the container will \fInot\fR destroy
the \fIobject\fR.
.sp
It is expected that \fIobject\fR provides a method named
\fBimport text\fR which takes a text and a format name, and
returns the canonical serialization of the keyword index contained in
the text, assuming the given format.
.TP
\fIobjectName\fR \fBexporter\fR
Returns the export manager object currently attached to the container,
if any.
.TP
\fIobjectName\fR \fBexporter\fR \fIobject\fR
Attaches the \fIobject\fR as export manager to the container, and
returns it as the result of the command.
Note that the \fIobject\fR is \fInot\fR put into ownership of the
container. I.e., destruction of the container will \fInot\fR destroy
the \fIobject\fR.
.sp
It is expected that \fIobject\fR provides a method named
\fBexport object\fR which takes the container and a format name,
and returns a text encoding keyword index stored in the container, in
the given format. It is further expected that the \fIobject\fR will
use the container's method \fBserialize\fR to obtain the
serialization of the keyword index from which to generate the text.
.TP
\fIobjectName\fR \fBdeserialize =\fR \fIdata\fR ?\fIformat\fR?
This method replaces the contents of the index object with the index
contained in the \fIdata\fR. If no \fIformat\fR was specified it is
assumed to be the regular serialization of a keyword index.
.sp
Otherwise the object will use the attached import manager to convert
the data from the specified format to a serialization it can handle.
In that case an error will be thrown if the container has no import
manager attached to it.
.sp
The result of the method is the empty string.
.TP
\fIobjectName\fR \fBdeserialize +=\fR \fIdata\fR ?\fIformat\fR?
This method behaves like \fBdeserialize =\fR in its essentials,
except that it merges the keyword index in the \fIdata\fR to its
contents instead of replacing it.
The method will throw an error if merging is not possible, i.e. would
produce an invalid index. The existing content is left unchanged in
that case.
.sp
The result of the method is the empty string.
.TP
\fIobjectName\fR \fBserialize\fR ?\fIformat\fR?
This method returns the keyword index contained in the object. If no
\fIformat\fR is not specified the returned result is the canonical
serialization of its contents.
.sp
Otherwise the object will use the attached export manager to convert
the data to the specified format.
In that case an error will be thrown if the container has no export
manager attached to it.
.PP
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
HTML, TMML, conversion, docidx markup, documentation, formatting, generation, index, json, keyword index, latex, manpage, markup, nroff, parsing, plugin, reference, tcler's wiki, text, url, wiki
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/export.n.

































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/export.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::export" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::export \- Exporting keyword indices
.SH SYNOPSIS
package require \fBdoctools::idx::export  ?0.1?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::config \fR
.sp
package require \fBdoctools::idx::structure \fR
.sp
package require \fBsnit \fR
.sp
package require \fBpluginmgr \fR
.sp
\fB::doctools::idx::export\fR \fIobjectName\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBexport serial\fR \fIserial\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBexport object\fR \fIobject\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBconfig names\fR
.sp
\fIobjectName\fR \fBconfig get\fR
.sp
\fIobjectName\fR \fBconfig set\fR \fIname\fR ?\fIvalue\fR?
.sp
\fIobjectName\fR \fBconfig unset\fR \fIpattern\fR...
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class to manage the plugins for the export of
keyword indices to other formats, i.e. their conversion to, for
example \fIdocidx\fR, \fIHTML\fR, etc.
.PP
This is one of the three public pillars the management of keyword
indices resides on. The other two pillars are
.IP [1]
\fIImporting keyword indices\fR, and
.IP [2]
\fIHolding keyword indices\fR
.PP
.PP
For information about the \fBConcepts\fR of keyword indices, and
their parts, see the same-named section.
For information about the data structure which is the major input to
the manager objects provided by this package see the section
\fBKeyword index serialization format\fR.
.PP
The plugin system of our class is based on the package
\fBpluginmgr\fR, and configured to look for plugins using
.IP [1]
the environment variable \fBDOCTOOLS_IDX_EXPORT_PLUGINS\fR,
.IP [2]
the environment variable \fBDOCTOOLS_IDX_PLUGINS\fR,
.IP [3]
the environment variable \fBDOCTOOLS_PLUGINS\fR,
.IP [4]
the path "\fI~/.doctools/idx/export/plugin\fR"
.IP [5]
the path "\fI~/.doctools/idx/plugin\fR"
.IP [6]
the path "\fI~/.doctools/plugin\fR"
.IP [7]
the path "\fI~/.doctools/idx/export/plugins\fR"
.IP [8]
the path "\fI~/.doctools/idx/plugins\fR"
.IP [9]
the path "\fI~/.doctools/plugins\fR"
.IP [10]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\IDX\\EXPORT\\PLUGINS"
.IP [11]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\IDX\\PLUGINS"
.IP [12]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\PLUGINS"
.PP
The last three are used only when the package is run on a machine
using Windows(tm) operating system.
.PP
The whole system is delivered with six predefined export plugins,
namely
.TP
docidx
See \fIdocidx export plugin\fR for details.
.TP
html
See \fIhtml export plugin\fR for details.
.TP
json
See \fIjson export plugin\fR for details.
.TP
nroff
See \fInroff export plugin\fR for details.
.TP
text
See \fItext export plugin\fR for details.
.TP
wiki
See \fIwiki export plugin\fR for details.
.PP
.PP
Readers wishing to write their own export plugin for some format, i.e.
\fIplugin writer\fRs reading and understanding the section
containing the \fBExport plugin API v2 reference\fR is an
absolute necessity, as it specifies the interaction between this
package and its plugins in detail.
.SH CONCEPTS
.IP [1]
A \fIkeyword index\fR consists of a (possibly empty) set of \fIkeywords\fR.
.IP [2]
Each keyword in the set is identified by its name.
.IP [3]
Each keyword has a (possibly empty) set of \fIreferences\fR.
.IP [4]
A reference can be associated with more than one keyword.
.IP [5]
A reference not associated with at least one keyword is not possible
however.
.IP [6]
Each reference is identified by its target, specified as either an url
or symbolic filename, depending on the type of reference (\fBurl\fR,
or \fBmanpage\fR).
.IP [7]
The type of a reference (url, or manpage) depends only on the
reference itself, and not the keywords it is associated with.
.IP [8]
In addition to a type each reference has a descriptive label as
well. This label depends only on the reference itself, and not the
keywords it is associated with.
.PP
A few notes
.IP [1]
Manpage references are intended to be used for references to the
documents the index is made for. Their target is a symbolic file name
identifying the document, and export plugins may replace symbolic with
actual file names, if specified.
.IP [2]
Url references are intended on the othre hand are inteded to be used
for links to anything else, like websites. Their target is an url.
.IP [3]
While url and manpage references share a namespace for their
identifiers, this should be no problem, given that manpage identifiers
are symbolic filenames and as such they should never look like urls,
the identifiers for url references.
.PP
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::idx::export\fR \fIobjectName\fR
This command creates a new export manager object with an associated
Tcl command whose name is \fIobjectName\fR. This \fIobject\fR command
is explained in full detail in the sections \fBObject command\fR
and \fBObject methods\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::doctools::idx::export\fR command have
the following general form:
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBexport serial\fR \fIserial\fR ?\fIformat\fR?
This method takes the canonical serialization of a keyword index
stored in \fIserial\fR and converts it to the specified \fIformat\fR,
using the export plugin for the format. An error is thrown if no
plugin could be found for the format.
The string generated by the conversion process is returned as
the result of this method.
.sp
If no format is specified the method defaults to \fBdocidx\fR.
.sp
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBKeyword index serialization format\fR.
.sp
The plugin has to conform to the interface specified in section
\fBExport plugin API v2 reference\fR.
.TP
\fIobjectName\fR \fBexport object\fR \fIobject\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBexport serial\fR
method described by the previous item.
It expects that \fIobject\fR is an object command supporting a
\fBserialize\fR method returning the canonical serialization of a
keyword index. It invokes that method, feeds the result into
\fBexport serial\fR and returns the resulting string as its own
result.
.TP
\fIobjectName\fR \fBconfig names\fR
This method returns a list containing the names of all configuration
variables currently known to the object.
.TP
\fIobjectName\fR \fBconfig get\fR
This method returns a dictionary containing the names and values of
all configuration variables currently known to the object.
.TP
\fIobjectName\fR \fBconfig set\fR \fIname\fR ?\fIvalue\fR?
This method sets the configuration variable \fIname\fR to the
specified \fIvalue\fR and returns the new value of the variable.
.sp
If no value is specified it simply returns the current value, without
changing it.
.sp
Note that while the user can set the predefined configuration
variables \fBuser\fR and \fBformat\fR doing so will have no
effect, these values will be internally overriden when invoking an
import plugin.
.TP
\fIobjectName\fR \fBconfig unset\fR \fIpattern\fR...
This method unsets all configuration variables matching the specified
glob \fIpattern\fRs. If no pattern is specified it will unset all
currently defined configuration variables.
.PP
.SH "EXPORT PLUGIN API V2 REFERENCE"
Plugins are what this package uses to manage the support for any
output format beyond the
\fBKeyword index serialization format\fR. Here we specify the
API the objects created by this package use to interact with their
plugins.
.PP
A plugin for this package has to follow the rules listed below:
.IP [1]
A plugin is a package.
.IP [2]
The name of a plugin package has the form
doctools::idx::export::\fBFOO\fR,
where \fBFOO\fR is the name of the format the plugin will
generate output for. This name is also the argument to provide
to the various \fBexport\fR methods of export manager
objects to get a string encoding a keyword index in that
format.
.IP [3]
The plugin can expect that the package
\fBdoctools::idx::export::plugin\fR is present, as
indicator that it was invoked from a genuine plugin manager.
.IP [4]
A plugin has to provide one command, with the signature shown
below.
.RS
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
Whenever an export manager of \fBdoctools::idx\fR has to generate
output for an index it will invoke this command.
.RS
.TP
string \fIserial\fR
This argument will contain the \fIcanonical\fR serialization of the
index for which to generate the output.
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBKeyword index serialization format\fR.
.TP
dictionary \fIconfiguration\fR
This argument will contain the current configuration to apply to the
generation, as a dictionary mapping from variable names to values.
.sp
The following configuration variables have a predefined meaning all
plugins have to obey, although they can ignore this information at
their discretion. Any other other configuration variables recognized
by a plugin will be described in the manpage for that plugin.
.RS
.TP
user
This variable is expected to contain the name of the user
owning the process invoking the plugin.
.TP
format
This variable is expected to contain the name of the
format whose plugin is invoked.
.TP
file
This variable, if defined by the user of the index object
is expected to contain the name of the input file for which
the plugin is generating its output for.
.TP
map
This variable, if defined by the user of the index object is
expected to contain a dictionary mapping from symbolic file
names used in the references of type \fBmanpage\fR to
actual paths (or urls). A plugin has to be able to handle
the possibility that a symbolic name is without entry in
this mapping.
.RE
.RE
.RE
.IP [5]
A single usage cycle of a plugin consists of the invokations of
the command \fBexport\fR. This call has to leave the plugin in
a state where another usage cycle can be run without problems.
.PP
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
HTML, conversion, docidx, documentation, export, formatting, generation, index, json, keyword index, manpage, markup, nroff, plugin, reference, tcler's wiki, text, url, wiki
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/export_docidx.n.



















































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/export_docidx.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::export::docidx" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::export::docidx \- docidx export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::export::docidx  ?0.1?\fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools keyword index export plugin for
the generation of docidx markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially \fBdoctools::idx::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::idx::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
docidx export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a keyword index, as
specified in section \fBKeyword index serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates docidx markup encoding the index.
The created string is then returned as the result of the command.
.PP
.SH "[DOCIDX] NOTATION OF KEYWORD INDICES"
The docidx format for keyword indices, also called the
\fIdocidx markup language\fR, is too large to be covered in single
section.
The interested reader should start with the document
.IP [1]
\fIdocidx language introduction\fR
.PP
and then proceed from there to the formal specifications, i.e. the
documents
.IP [1]
\fIdocidx language syntax\fR and
.IP [2]
\fIdocidx language command reference\fR.
.PP
to get a thorough understanding of the language.
.SH CONFIGURATION
The docidx export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
string \fIuser\fR
This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.
.TP
string \fIfile\fR
This standard configuration variable contains the name of the file the
index came from. This variable may not be set or contain the empty
string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.
.TP
boolean \fInewlines\fR
If this flag is set the plugin will break the generated docidx code
across lines, with each markup command on a separate line.
.sp
If this flag is not set (the default), the whole document will be
written on a single line, with minimum spacing between all elements.
.TP
boolean \fIindented\fR
If this flag is set the plugin will indent the markup commands
according to the structure of indices. To make this work this also
implies that \fBnewlines\fR is set. This effect is independent of the
value for \fBaligned\fR however.
.sp
If this flag is not set (the default), the output is formatted as per
the values of \fBnewlines\fR and \fBaligned\fR, and no indenting is
done.
.TP
boolean \fIaligned\fR
If this flag is set the generator ensures that the arguments for the
\fBmanpage\fR and \fBurl\fR commands in a keyword section are aligned
vertically for a nice table effect. To make this work this also
implies that \fBnewlines\fR is set. This effect is independent of the
value for \fBindented\fR however.
.sp
If this flag is not set (the default), the output is formatted as per
the values of \fBnewlines\fR and \fBindented\fR, and no alignment is
done.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBformat\fR, and \fBmap\fR, and their values.
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
docidx, doctools, export, index, serialization
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/export_html.n.








































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/export_html.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::export::html" n 0.2 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::export::html \- HTML export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::export::html  ?0.2?\fR
.sp
package require \fBdoctools::text \fR
.sp
package require \fBdoctools::html \fR
.sp
package require \fBdoctools::html::cssdefaults \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools keyword index export plugin for
the generation of HTML markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially \fBdoctools::idx::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::idx::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
docidx export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a keyword index, as
specified in section \fBKeyword index serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates HTML markup encoding the index.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The html export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
string \fIuser\fR
This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.
.TP
string \fIfile\fR
This standard configuration variable contains the name of the file the
index came from. This variable may not be set or contain the empty
string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.
.TP
dictionary \fImap\fR
This standard configuration variable contains a dictionary mapping
from the symbolic files names in manpage references to the actual
filenames and/or urls to be used in the output.
.sp
Url references and symbolic file names without a mapping are used
unchanged.
.TP
boolean \fInewlines\fR
If this flag is set the plugin will break the generated html code
across lines, with each markup command on a separate line.
.sp
If this flag is not set (the default), the whole document will be
written on a single line, with minimum spacing between all elements.
.TP
boolean \fIindented\fR
If this flag is set the plugin will indent the markup commands
according to the structure of indices. To make this work this also
implies that \fBnewlines\fR is set.
.sp
If this flag is not set (the default), the output is formatted as per
the value of \fBnewlines\fR, and no indenting is done.
.TP
string \fImeta\fR
This variable is meant to hold a fragment of HTML (default: empty).
The fragment it contains will be inserted into the generated output in
the <head> section of the document, just after the <title> tag.
.TP
string \fIheader\fR
This variable is meant to hold a fragment of HTML (default: empty).
The fragment it contains will be inserted into the generated output
just after the <h1> title tag in the body of the document, in the
class.header <div>'ision.
.TP
string \fIfooter\fR
This variable is meant to hold a fragment of HTML (default:
empty). The fragment it contains will be inserted into the generated
output just before the </body> tag, in the class.footer <div>'ision.
.TP
dictionary \fIkwid\fR
The value of this variable (default: empty) maps keywords to the
identifiers to use as their anchor names. Each keyword \fBFOO\fR not
found in the dictionary uses \fBKW-\fR\fBFOO\fR as anchor,
i.e. itself prefixed with the string \fBKW-\fR.
.TP
string \fIsepline\fR
The value of this variable is the string to use for the separator
comments inserted into the output when the outpout is broken across
lines and/or indented. The default string consists of 60 dashes.
.TP
integer \fIkwidth\fR
This variable holds the size of the keyword column in the main table
generated by the plugin, in percent of the total width of the
table. This is an integer number in the range of 1 to 99. Choosing a
value outside of that range causes the generator to switch back to the
defauly setting, 35 percent.
.TP
string \fIdot\fR
This variable contains a HTML fragment inserted between the entries of
the navigation bar, and the references associated with each keyword.
The default is the HTML entity &#183; i.e. the bullet character, also
known as the "Greek middle dot", i.e. the unicode character 00B7.
.TP
string \fIclass.main\fR
This variable contains the class name for the main <div>'ivision of
the generated document. The default is \fBdoctools\fR.
.TP
string \fIclass.header\fR
This variable contains the class name for the header <div>'ision of
the generated document. The default is \fBidx-header\fR.  This
division contains the document title, the user specified \fBheader\fR,
if any, a visible separator line, and the navigation bar for quick
access to each keyword section.
.TP
string \fIclass.title\fR
This variable contains the class name for the <h1> tag enclosing the
document title. The default is \fBidx-title\fR.
.TP
string \fIclass.navsep\fR
This variable contains the class name for the <hr> separators in the
header and footer sections of the generated document. The default is
\fBidx-navsep\fR.
.TP
string \fIclass.navbar\fR
This variable contains the class name for the navigation <div>'ision
enclosing the navigation bar of the generated document. The default is
\fBidx-kwnav\fR.
.TP
string \fIclass.contents\fR
This variable contains the class name for the <table> holding the
keywords and their references in the generated document. The default
is \fBidx-contents\fR.
.TP
string \fIclass.leader\fR
This variable contains the class name for the anchor names the plugin
inserts into the keyword table when switching from one section to the
next (Each section holds all keywords with a particular first
character). The default is \fBidx-leader\fR.
.TP
string \fIclass.row0\fR
This variable contains the class name used to label the even rows
(<tr>) of the keyword table. The default is \fBidx-even\fR.
.TP
string \fIclass.row1\fR
This variable contains the class name used to label the odd rows
(<tr>) of the keyword table. The default is \fBidx-odd\fR.
.TP
string \fIclass.keyword\fR
This variable contains the class name used to label the keyword
cells/column (<td>) in the keyword table of the document. The default
is \fBidx-keyword\fR.
.TP
string \fIclass.refs\fR
This variable contains the class name used to label the reference
cells/column (<td>) in the keyword table of the document. The default
is \fBidx-refs\fR.
.TP
string \fIclass.footer\fR
This variable contains the class name for the footer <div>'ision of
the generated document. The default is \fBidx-footer\fR. This
division contains a browser-visible separator line and the user
specified \fBfooter\fR, if any.
.PP
\fINote\fR that this plugin ignores the standard configuration
variable \fBformat\fR, and its value.
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
HTML, doctools, export, index, serialization
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/export_json.n.




































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/export_json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::export::json" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::export::json \- JSON export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::export::json  ?0.1?\fR
.sp
package require \fBtextutil::adjust \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools keyword index export plugin for
the generation of JSON markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially \fBdoctools::idx::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::idx::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
docidx export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a keyword index, as
specified in section \fBKeyword index serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates JSON markup encoding the index.
The created string is then returned as the result of the command.
.PP
.SH "JSON NOTATION OF KEYWORD INDICES"
The JSON format used for keyword indices is a direct translation of
the \fBKeyword index serialization format\fR, mapping Tcl
dictionaries as JSON objects and Tcl lists as JSON arrays.
For example, the Tcl serialization
.CS


doctools::idx {
	label {Keyword Index}
	keywords {
		changelog  {changelog.man cvs.man}
		conversion {doctools.man docidx.man doctoc.man apps/dtplite.man mpexpand.man}
		cvs        cvs.man
	}
	references {
		apps/dtplite.man {manpage dtplite}
		changelog.man    {manpage doctools::changelog}
		cvs.man          {manpage doctools::cvs}
		docidx.man       {manpage doctools::idx}
		doctoc.man       {manpage doctools::toc}
		doctools.man     {manpage doctools}
		mpexpand.man     {manpage mpexpand}
	}
	title {}
}

.CE
is equivalent to the JSON string
.CS


{
    "doctools::idx" : {
        "label"      : "Keyword Index",
        "keywords"   : {
            "changelog"  : ["changelog.man","cvs.man"],
            "conversion" : ["doctools.man","docidx.man","doctoc.man","apps\\/dtplite.man","mpexpand.man"],
            "cvs"        : ["cvs.man"],
        },
        "references" : {
            "apps\\/dtplite.man" : ["manpage","dtplite"],
            "changelog.man"     : ["manpage","doctools::changelog"],
            "cvs.man"           : ["manpage","doctools::cvs"],
            "docidx.man"        : ["manpage","doctools::idx"],
            "doctoc.man"        : ["manpage","doctools::toc"],
            "doctools.man"      : ["manpage","doctools"],
            "mpexpand.man"      : ["manpage","mpexpand"]
        },
        "title"      : ""
    }
}

.CE
.SH CONFIGURATION
The JSON export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
boolean \fIindented\fR
If this flag is set the plugin will break the generated JSON code
across lines and indent it according to its inner structure, with each
key of a dictionary on a separate line.
.sp
If this flag is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.
.TP
boolean \fIaligned\fR
If this flag is set the generator ensures that the values for the keys
in a dictionary are vertically aligned with each other, for a nice
table effect. To make this work this also implies that \fBindented\fR
is set.
.sp
If this flag is not set (the default), the output is formatted as per
the value of \fBindented\fR, without trying to align the values for
dictionary keys.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBuser\fR, \fBformat\fR, \fBfile\fR, and \fBmap\fR and
their values.
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
JSON, doctools, export, index, serialization
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/export_nroff.n.



















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/export_nroff.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::export::nroff" n 0.3 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::export::nroff \- nroff export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::export::nroff  ?0.3?\fR
.sp
package require \fBdoctools::text \fR
.sp
package require \fBdoctools::nroff::man_macros \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools keyword index export plugin for
the generation of nroff markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially \fBdoctools::idx::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::idx::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
docidx export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a keyword index, as
specified in section \fBKeyword index serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates nroff markup encoding the index.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The nroff export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
string \fIuser\fR
This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.
.TP
string \fIfile\fR
This standard configuration variable contains the name of the file the
index came from. This variable may not be set or contain the empty
string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.
.TP
boolean \fIinline\fR
If this flag is set (default) the plugin will place the definitions of
the man macro set directly into the output.
.sp
If this flag is not set, the plugin will place a reference to the
definitions of the man macro set into the output, but not the macro
definitions themselves.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBformat\fR, and \fBmap\fR, and their values.
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctools, export, index, nroff, serialization
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/export_text.n.



































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/export_text.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::export::text" n 0.2 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::export::text \- plain text export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::export::text  ?0.2?\fR
.sp
package require \fBdoctools::text \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools keyword index export plugin for
the generation of plain text markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially \fBdoctools::idx::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::idx::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
docidx export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a keyword index, as
specified in section \fBKeyword index serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates plain text markup encoding the index.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The text export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
dictionary \fImap\fR
This standard configuration variable contains a dictionary mapping
from the symbolic files names in manpage references to the actual
filenames and/or urls to be used in the output.
.sp
Url references and symbolic file names without a mapping are used
unchanged.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBuser\fR, \fBfile\fR, and \fBformat\fR, and their values.
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctools, export, index, plain text, serialization
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/export_wiki.n.
















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/export_wiki.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::export::wiki" n 0.2 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::export::wiki \- wiki export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::export::wiki  ?0.2?\fR
.sp
package require \fBdoctools::text \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools keyword index export plugin for
the generation of wiki markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially \fBdoctools::idx::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::idx::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
docidx export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a keyword index, as
specified in section \fBKeyword index serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates wiki markup encoding the index.
The created string is then returned as the result of the command.
.PP
.SH "WIKI MARKUP"
The basic syntax of the wiki markup generated by this plugin are
described at \fIhttp://wiki.tcl.tk/14\fR.
.PP
The plugin goes beyond the classic markup to generate proper headers
and either a table or indented list of the keywords and their
references.
.SH CONFIGURATION
The wiki export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
dictionary \fImap\fR
This standard configuration variable contains a dictionary mapping
from the symbolic files names in manpage references to the actual
filenames and/or urls to be used in the output.
.sp
Url references and symbolic file names without a mapping are used
unchanged.
.TP
enum \fIstyle\fR
This variable recognizes two values as legal, \fBlist\fR (default),
and \fBtable\fR.
Depending on the value the plugin generates either a list- or
table-based wiki page for the index.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBuser\fR, \fBfile\fR and \fBformat\fR, and their values.
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctools, export, index, serialization, wiki
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/import.n.
















































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/import.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::import" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::import \- Importing keyword indices
.SH SYNOPSIS
package require \fBdoctools::idx::import  ?0.1?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::config \fR
.sp
package require \fBdoctools::idx::structure \fR
.sp
package require \fBsnit \fR
.sp
package require \fBpluginmgr \fR
.sp
\fB::doctools::idx::import\fR \fIobjectName\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBimport text\fR \fItext\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport file\fR \fIpath\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport object text\fR \fIobject\fR \fItext\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport object file\fR \fIobject\fR \fIpath\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBconfig names\fR
.sp
\fIobjectName\fR \fBconfig get\fR
.sp
\fIobjectName\fR \fBconfig set\fR \fIname\fR ?\fIvalue\fR?
.sp
\fIobjectName\fR \fBconfig unset\fR \fIpattern\fR...
.sp
\fIobjectName\fR \fBincludes\fR
.sp
\fIobjectName\fR \fBinclude add\fR \fIpath\fR
.sp
\fIobjectName\fR \fBinclude remove\fR \fIpath\fR
.sp
\fIobjectName\fR \fBinclude clear\fR
.sp
\fBIncludeFile\fR \fIcurrentfile\fR \fIpath\fR
.sp
\fBimport\fR \fItext\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class to manage the plugins for the import of
keyword indices from other formats, i.e. their conversion from, for
example \fIdocidx\fR, \fIjson\fR, etc.
.PP
This is one of the three public pillars the management of keyword
indices resides on. The other two pillars are
.IP [1]
\fIExporting keyword indices\fR, and
.IP [2]
\fIHolding keyword indices\fR
.PP
.PP
For information about the \fBConcepts\fR of keyword indices, and
their parts, see the same-named section.
For information about the data structure which is the major output of
the manager objects provided by this package see the section
\fBKeyword index serialization format\fR.
.PP
The plugin system of our class is based on the package
\fBpluginmgr\fR, and configured to look for plugins using
.IP [1]
the environment variable \fBDOCTOOLS_IDX_IMPORT_PLUGINS\fR,
.IP [2]
the environment variable \fBDOCTOOLS_IDX_PLUGINS\fR,
.IP [3]
the environment variable \fBDOCTOOLS_PLUGINS\fR,
.IP [4]
the path "\fI~/.doctools/idx/import/plugin\fR"
.IP [5]
the path "\fI~/.doctools/idx/plugin\fR"
.IP [6]
the path "\fI~/.doctools/plugin\fR"
.IP [7]
the path "\fI~/.doctools/idx/import/plugins\fR"
.IP [8]
the path "\fI~/.doctools/idx/plugins\fR"
.IP [9]
the path "\fI~/.doctools/plugins\fR"
.IP [10]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\IDX\\IMPORT\\PLUGINS"
.IP [11]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\IDX\\PLUGINS"
.IP [12]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\PLUGINS"
.PP
The last three are used only when the package is run on a machine
using Windows(tm) operating system.
.PP
The whole system is delivered with two predefined import plugins,
namely
.TP
docidx
See \fIdocidx import plugin\fR for details.
.TP
json
See \fIjson import plugin\fR for details.
.PP
.PP
Readers wishing to write their own import plugin for some format, i.e.
\fIplugin writer\fRs reading and understanding the section
containing the \fBImport plugin API v2 reference\fR is an
absolute necessity, as it specifies the interaction between this
package and its plugins in detail.
.SH CONCEPTS
.IP [1]
A \fIkeyword index\fR consists of a (possibly empty) set of \fIkeywords\fR.
.IP [2]
Each keyword in the set is identified by its name.
.IP [3]
Each keyword has a (possibly empty) set of \fIreferences\fR.
.IP [4]
A reference can be associated with more than one keyword.
.IP [5]
A reference not associated with at least one keyword is not possible
however.
.IP [6]
Each reference is identified by its target, specified as either an url
or symbolic filename, depending on the type of reference (\fBurl\fR,
or \fBmanpage\fR).
.IP [7]
The type of a reference (url, or manpage) depends only on the
reference itself, and not the keywords it is associated with.
.IP [8]
In addition to a type each reference has a descriptive label as
well. This label depends only on the reference itself, and not the
keywords it is associated with.
.PP
A few notes
.IP [1]
Manpage references are intended to be used for references to the
documents the index is made for. Their target is a symbolic file name
identifying the document, and export plugins may replace symbolic with
actual file names, if specified.
.IP [2]
Url references are intended on the othre hand are inteded to be used
for links to anything else, like websites. Their target is an url.
.IP [3]
While url and manpage references share a namespace for their
identifiers, this should be no problem, given that manpage identifiers
are symbolic filenames and as such they should never look like urls,
the identifiers for url references.
.PP
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::idx::import\fR \fIobjectName\fR
This command creates a new import manager object with an associated
Tcl command whose name is \fIobjectName\fR. This \fIobject\fR command
is explained in full detail in the sections \fBObject command\fR
and \fBObject methods\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::doctools::idx::import\fR command have
the following general form:
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBimport text\fR \fItext\fR ?\fIformat\fR?
This method takes the \fItext\fR and converts it from the specified
\fIformat\fR to the canonical serialization of a keyword index using
the import plugin for the format. An error is thrown if no plugin
could be found for the format.
The serialization generated by the conversion process is returned as
the result of this method.
.sp
If no format is specified the method defaults to \fBdocidx\fR.
.sp
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBKeyword index serialization format\fR.
.sp
The plugin has to conform to the interface specified in section
\fBImport plugin API v2 reference\fR.
.TP
\fIobjectName\fR \fBimport file\fR \fIpath\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBimport text\fR
method described by the previous item.
It reads the contents of the specified file into memory, feeds the
result into \fBimport text\fR and returns the resulting
serialization as its own result.
.TP
\fIobjectName\fR \fBimport object text\fR \fIobject\fR \fItext\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBimport text\fR
method described by the previous item.
It expects that \fIobject\fR is an object command supporting a
\fBdeserialize\fR method expecting the canonical serialization of a
keyword index.
It imports the text using \fBimport text\fR and then feeds the
resulting serialization into the \fIobject\fR via \fBdeserialize\fR.
This method returns the empty string as it result.
.TP
\fIobjectName\fR \fBimport object file\fR \fIobject\fR \fIpath\fR ?\fIformat\fR?
This method behaves like \fBimport object text\fR, except that it
reads the text to convert from the specified file instead of being
given it as argument.
.TP
\fIobjectName\fR \fBconfig names\fR
This method returns a list containing the names of all configuration
variables currently known to the object.
.TP
\fIobjectName\fR \fBconfig get\fR
This method returns a dictionary containing the names and values of
all configuration variables currently known to the object.
.TP
\fIobjectName\fR \fBconfig set\fR \fIname\fR ?\fIvalue\fR?
This method sets the configuration variable \fIname\fR to the
specified \fIvalue\fR and returns the new value of the variable.
.sp
If no value is specified it simply returns the current value, without
changing it.
.sp
Note that while the user can set the predefined configuration
variables \fBuser\fR and \fBformat\fR doing so will have no
effect, these values will be internally overriden when invoking an
import plugin.
.TP
\fIobjectName\fR \fBconfig unset\fR \fIpattern\fR...
This method unsets all configuration variables matching the specified
glob \fIpattern\fRs. If no pattern is specified it will unset all
currently defined configuration variables.
.TP
\fIobjectName\fR \fBincludes\fR
This method returns a list containing the currently specified paths to
use to search for include files when processing input.
The order of paths in the list corresponds to the order in which they
are used, from first to last, and also corresponds to the order in
which they were added to the object.
.TP
\fIobjectName\fR \fBinclude add\fR \fIpath\fR
This methods adds the specified \fIpath\fR to the list of paths to use
to search for include files when processing input. The path is added
to the end of the list, causing it to be searched after all previously
added paths. The result of the command is the empty string.
.sp
The method does nothing if the path is already known.
.TP
\fIobjectName\fR \fBinclude remove\fR \fIpath\fR
This methods removes the specified \fIpath\fR from the list of paths
to use to search for include files when processing input. The result
of the command is the empty string.
.sp
The method does nothing if the path is not known.
.TP
\fIobjectName\fR \fBinclude clear\fR
This method clears the list of paths to use to search for include
files when processing input. The result of the command is the empty
string.
.PP
.SH "IMPORT PLUGIN API V2 REFERENCE"
Plugins are what this package uses to manage the support for any input
format beyond the \fBKeyword index serialization format\fR. Here
we specify the API the objects created by this package use to interact
with their plugins.
.PP
A plugin for this package has to follow the rules listed below:
.IP [1]
A plugin is a package.
.IP [2]
The name of a plugin package has the form
doctools::idx::import::\fBFOO\fR,
where \fBFOO\fR is the name of the format the plugin will
generate output for. This name is also the argument to provide
to the various \fBimport\fR methods of import manager
objects to get a string encoding a keyword index in that
format.
.IP [3]
The plugin can expect that the package
\fBdoctools::idx::export::plugin\fR is present, as
indicator that it was invoked from a genuine plugin manager.
.IP [4]
The plugin can expect that a command named \fBIncludeFile\fR is
present, with the signature
.RS
.TP
\fBIncludeFile\fR \fIcurrentfile\fR \fIpath\fR
This command has to be invoked by the plugin when it has to process an
included file, if the format has the concept of such. An example of
such a format would be \fIdocidx\fR.
.sp
The plugin has to supply the following arguments
.RS
.TP
string \fIcurrentfile\fR
The path of the file it is currently processing. This may be the empty
string if no such is known.
.TP
string \fIpath\fR
The path of the include file as specified in the include directive
being processed.
.RE
.IP
The result of the command will be a 5-element list containing
.RS
.IP [1]
A boolean flag indicating the success (\fBTrue\fR) or failure
(\fBFalse\fR) of the operation.
.IP [2]
In case of success the contents of the included file, and the
empty string otherwise.
.IP [3]
The resolved, i.e. absolute path of the included file, if
possible, or the unchanged \fIpath\fR argument. This is for
display in an error message, or as the \fIcurrentfile\fR
argument of another call to \fBIncludeFile\fR should this file
contain more files.
.IP [4]
In case of success an empty string, and for failure a code
indicating the reason for it, one of
.RS
.TP
notfound
The specified file could not be found.
.TP
notread
The specified file was found, but not be read into memory.
.RE
.IP [5]
An empty string in case of success of a \fBnotfound\fR
failure, and an additional error message describing the reason
for a \fBnotread\fR error in more detail.
.RE
.RE
.IP [5]
A plugin has to provide one command, with the signature shown
below.
.RS
.TP
\fBimport\fR \fItext\fR \fIconfiguration\fR
Whenever an import manager of \fBdoctools::idx\fR has to parse
input for an index it will invoke this command.
.RS
.TP
string \fItext\fR
This argument will contain the text encoding the index per the format
the plugin is for.
.TP
dictionary \fIconfiguration\fR
This argument will contain the current configuration to apply to the
parsing, as a dictionary mapping from variable names to values.
.sp
The following configuration variables have a predefined meaning all
plugins have to obey, although they can ignore this information at
their discretion. Any other other configuration variables recognized
by a plugin will be described in the manpage for that plugin.
.RS
.TP
user
This variable is expected to contain the name of the user
owning the process invoking the plugin.
.TP
format
This variable is expected to contain the name of the
format whose plugin is invoked.
.RE
.RE
.RE
.IP [6]
A single usage cycle of a plugin consists of the invokations of
the command \fBimport\fR. This call has to leave the plugin in
a state where another usage cycle can be run without problems.
.PP
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
conversion, docidx, documentation, import, index, json, keyword index, manpage, markup, parsing, plugin, reference, url
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/import_docidx.n.



























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/import_docidx.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::import::docidx" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::import::docidx \- docidx import plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::import::docidx  ?0.1?\fR
.sp
package require \fBdoctools::idx::parse \fR
.sp
package require \fBdoctools::idx::structure \fR
.sp
package require \fBdoctools::msgcat \fR
.sp
package require \fBdoctools::tcl::parse \fR
.sp
package require \fBfileutil \fR
.sp
package require \fBlogger \fR
.sp
package require \fBsnit \fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBstruct::set \fR
.sp
package require \fBstruct::stack \fR
.sp
package require \fBstruct::tree \fR
.sp
package require \fBtreeql \fR
.sp
\fBimport\fR \fIstring\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools keyword index import plugin for
the parsing of docidx markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially \fBdoctools::idx::import\fR, the import manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::idx::import\fR and the import manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
docidx import plugin API version 2.
.TP
\fBimport\fR \fIstring\fR \fIconfiguration\fR
This command takes the \fIstring\fR and parses it as docidx
markup encoding a keyword index, in the context of the specified
\fIconfiguration\fR (a dictionary). The result of the command is the
canonical serialization of that keyword index, in the form specified
in section \fBKeyword index serialization format\fR.
.PP
.SH "[DOCIDX] NOTATION OF KEYWORD INDICES"
The docidx format for keyword indices, also called the
\fIdocidx markup language\fR, is too large to be covered in single
section.
The interested reader should start with the document
.IP [1]
\fIdocidx language introduction\fR
.PP
and then proceed from there to the formal specifications, i.e. the
documents
.IP [1]
\fIdocidx language syntax\fR and
.IP [2]
\fIdocidx language command reference\fR.
.PP
to get a thorough understanding of the language.
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
deserialization, docidx, doctools, import, index
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/import_json.n.













































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/import_json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::import::json" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::import::json \- JSON import plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::import::json  ?0.1?\fR
.sp
package require \fBdoctools::idx::structure \fR
.sp
package require \fBjson \fR
.sp
\fBimport\fR \fIstring\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools keyword index import plugin for
the parsing of JSON markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially \fBdoctools::idx::import\fR, the import manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::idx::import\fR and the import manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
docidx import plugin API version 2.
.TP
\fBimport\fR \fIstring\fR \fIconfiguration\fR
This command takes the \fIstring\fR and parses it as JSON
markup encoding a keyword index, in the context of the specified
\fIconfiguration\fR (a dictionary). The result of the command is the
canonical serialization of that keyword index, in the form specified
in section \fBKeyword index serialization format\fR.
.PP
.SH "JSON NOTATION OF KEYWORD INDICES"
The JSON format used for keyword indices is a direct translation of
the \fBKeyword index serialization format\fR, mapping Tcl
dictionaries as JSON objects and Tcl lists as JSON arrays.
For example, the Tcl serialization
.CS


doctools::idx {
	label {Keyword Index}
	keywords {
		changelog  {changelog.man cvs.man}
		conversion {doctools.man docidx.man doctoc.man apps/dtplite.man mpexpand.man}
		cvs        cvs.man
	}
	references {
		apps/dtplite.man {manpage dtplite}
		changelog.man    {manpage doctools::changelog}
		cvs.man          {manpage doctools::cvs}
		docidx.man       {manpage doctools::idx}
		doctoc.man       {manpage doctools::toc}
		doctools.man     {manpage doctools}
		mpexpand.man     {manpage mpexpand}
	}
	title {}
}

.CE
is equivalent to the JSON string
.CS


{
    "doctools::idx" : {
        "label"      : "Keyword Index",
        "keywords"   : {
            "changelog"  : ["changelog.man","cvs.man"],
            "conversion" : ["doctools.man","docidx.man","doctoc.man","apps\\/dtplite.man","mpexpand.man"],
            "cvs"        : ["cvs.man"],
        },
        "references" : {
            "apps\\/dtplite.man" : ["manpage","dtplite"],
            "changelog.man"     : ["manpage","doctools::changelog"],
            "cvs.man"           : ["manpage","doctools::cvs"],
            "docidx.man"        : ["manpage","doctools::idx"],
            "doctoc.man"        : ["manpage","doctools::toc"],
            "doctools.man"      : ["manpage","doctools"],
            "mpexpand.man"      : ["manpage","mpexpand"]
        },
        "title"      : ""
    }
}

.CE
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
JSON, deserialization, doctools, import, index
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/introduction.n.






































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/introduction.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools2idx_introduction" n 2.0 tcllib "Documentation tools"
.BS
.SH NAME
doctools2idx_introduction \- DocTools - Keyword indices
.SH DESCRIPTION
\fIdocidx\fR (short for \fIdocumentation indices\fR) stands for a
set of related, yet different, entities which are working together for
the easy creation and transformation of keyword indices for
documentation.
.PP
These are
.IP [1]
A tcl based language for the semantic markup of a keyword index.
Markup is represented by Tcl commands.
Beginners should start with the
\fIdocidx language introduction\fR.
The formal specification is split over two documents, one dealing with
the \fIdocidx language syntax\fR, the other a
\fIdocidx language command reference\fR.
.IP [2]
A set of packages for the programmatic manipulation of keyword indices
in memory, and their conversion between various formats, reading and
writing. The aforementioned markup language is one of the formats
which can be both read from and written to.
.IP [3]
The system for the conversion of indices is based on a plugin
mechanism, for this we have two APIs describing the interface between
the packages above and the import/export plugins.
.PP
.PP
Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.
.PP
.IP [1]
A \fIwriter\fR of documentation has to understand the markup language
itself. A beginner to docidx should read the more informally written
\fIdocidx language introduction\fR first. Having digested this
the formal \fIdocidx language syntax\fR specification should
become understandable. A writer experienced with docidx may only
need the \fIdocidx language command reference\fR from time to
time to refresh her memory.
.sp
While a document is written the \fBdtp\fR application can be used
to validate it, and after completion it also performs the conversion
into the chosen system of visual markup, be it *roff, HTML, plain
text, wiki, etc. The simpler \fBdtplite\fR application makes
internal use of docidx when handling directories of documentation,
automatically generating a proper keyword index for them.
.IP [2]
A \fIprocessor\fR of documentation written in the \fIdocidx\fR
markup language has to know which tools are available for use.
.sp
The main tool is the aforementioned \fBdtp\fR application provided
by Tcllib. The simpler \fBdtplite\fR does not expose docidx to the
user. At the bottom level, common to both applications, however we
find the three packages providing the basic facilities to handle
keyword indices, i.e. import from textual formats, programmatic
manipulation in memory, and export to textual formats. These are
.RS
.TP
\fBdoctools::idx\fR
Programmatic manipulation of keyword indices in memory.
.TP
\fBdoctools::idx::import\fR
Import of keyword indices from various textual formats. The set of
supported formats is extensible through plugin packages.
.TP
\fBdoctools::idx::export\fR
Export of keyword indices to various textual formats. The set of
supported formats is extensible through plugin packages.
.RE
.IP
See also section \fBPackage Overview\fR for an overview of the
dependencies between these and other, supporting packages.
.IP [3]
At last, but not least, \fIplugin writers\fR have to understand the
interaction between the import and export packages and their plugins.
These APIs are described in the documentation for the two relevant
packages, i.e.
.RS
.IP \(bu
\fBdoctools::idx::import\fR
.IP \(bu
\fBdoctools::idx::export\fR
.RE
.PP
.SH "RELATED FORMATS"
The docidx format does not stand alone, it has two companion formats.
These are called \fIdoctoc\fR and \fIdoctools\fR, and they are
intended for the markup of \fItables of contents\fR, and of general
documentation, respectively.
They are described in their own sets of documents, starting at
the \fIDocTools - Tables Of Contents\fR and
the \fIDocTools - General\fR, respectively.
.SH "PACKAGE OVERVIEW"
.CS


                                    ~~~~~~~~~~~ doctools::idx ~~~~~~~~~~~
                                   ~~                   |               ~~
                doctools::idx::export ~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~ doctools::idx::import
                        |                               |                       |
        +---------------+-------------------------+     |    +------------------+---------------+-----------------------+---------------+
        |               |                         |     |    |                  |               |                       |               |
doctools::config        =                         |     |    |                  =       doctools::include       doctools::config doctools::paths
                        |                         |     |    |                  |
                doctools::idx::export::<*>        |     |    |          doctools::idx::import::<*>
                        docidx                    |     |    |                  docidx, json
                        json                      |     |    |                  |           \\\\
                        html                      |     |    |          doctools::idx::parse \\\\
                        nroff                     |     |    |                  |             \\\\
                        wiki                      |     |    |  +---------------+              json
                        text                      |     |    |  |               |
                                                doctools::idx::structure        |
                                                                                |
                                                                        +-------+---------------+
                                                                        |                       |
          doctools::html  doctools::html::cssdefaults           doctools::tcl::parse    doctools::msgcat
                |                                                                               |
          doctools::text  doctools::nroff::man_macros                                           =
                                                                                                |
                                                                                        doctools::msgcat::idx::<*>
                                                                                                c, en, de, fr
                                                                                                (fr == en for now)
        ~~      Interoperable objects, without actual package dependencies
        --      Package dependency, higher requires lower package
        =       Dynamic dependency through plugin system
        <*>     Multiple packages following the given form of naming.


.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
doctools2doc_introduction, doctools2toc_introduction
.SH KEYWORDS
conversion, formatting, index, keyword index, markup, parsing, plugin, semantic markup
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/msgcat_c.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/msgcat_c.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat::idx::c" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat::idx::c \- Message catalog for the docidx parser (C)
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat::idx::c  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat::idx::c\fR is a
support module providing the C language message catalog
for the docidx parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the package
\fBdoctools::msgcat\fR providing the general message catalog
management within the system. \fINote\fR that there is \fIno\fR
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.
.SH API
This package has no exported API.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
C, catalog package, docidx, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/msgcat_de.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/msgcat_de.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat::idx::de" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat::idx::de \- Message catalog for the docidx parser (DE)
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat::idx::de  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat::idx::de\fR is a
support module providing the DE (german) language message catalog
for the docidx parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the package
\fBdoctools::msgcat\fR providing the general message catalog
management within the system. \fINote\fR that there is \fIno\fR
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.
.SH API
This package has no exported API.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
DE, catalog package, docidx, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/msgcat_en.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/msgcat_en.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat::idx::en" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat::idx::en \- Message catalog for the docidx parser (EN)
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat::idx::en  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat::idx::en\fR is a
support module providing the EN (english) language message catalog
for the docidx parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the package
\fBdoctools::msgcat\fR providing the general message catalog
management within the system. \fINote\fR that there is \fIno\fR
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.
.SH API
This package has no exported API.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EN, catalog package, docidx, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/msgcat_fr.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/msgcat_fr.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat::idx::fr" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat::idx::fr \- Message catalog for the docidx parser (FR)
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat::idx::fr  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat::idx::fr\fR is a
support module providing the FR (french) language message catalog
for the docidx parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the package
\fBdoctools::msgcat\fR providing the general message catalog
management within the system. \fINote\fR that there is \fIno\fR
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.
.SH API
This package has no exported API.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
FR, catalog package, docidx, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/parse.n.




























































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/parse.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::parse" n 1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::parse \- Parsing text in docidx format
.SH SYNOPSIS
package require \fBdoctools::idx::parse  ?0.1?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::idx::structure \fR
.sp
package require \fBdoctools::msgcat \fR
.sp
package require \fBdoctools::tcl::parse \fR
.sp
package require \fBfileutil \fR
.sp
package require \fBlogger \fR
.sp
package require \fBsnit \fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBstruct::stack \fR
.sp
\fB::doctools::idx::parse\fR \fBtext\fR \fItext\fR
.sp
\fB::doctools::idx::parse\fR \fBfile\fR \fIpath\fR
.sp
\fB::doctools::idx::parse\fR \fBincludes\fR
.sp
\fB::doctools::idx::parse\fR \fBinclude add\fR \fIpath\fR
.sp
\fB::doctools::idx::parse\fR \fBinclude remove\fR \fIpath\fR
.sp
\fB::doctools::idx::parse\fR \fBinclude clear\fR
.sp
\fB::doctools::idx::parse\fR \fBvars\fR
.sp
\fB::doctools::idx::parse\fR \fBvar set\fR \fIname\fR \fIvalue\fR
.sp
\fB::doctools::idx::parse\fR \fBvar unset\fR \fIname\fR
.sp
\fB::doctools::idx::parse\fR \fBvar clear\fR ?\fIpattern\fR?
.sp
.BE
.SH DESCRIPTION
This package provides commands to parse text written in the
\fIdocidx\fR markup language and convert it into the canonical
serialization of the keyword index encoded in the text.
See the section \fBKeyword index serialization format\fR for
specification of their format.
.PP
This is an internal package of doctools, for use by the higher level
packages handling \fIdocidx\fR documents.
.SH API
.TP
\fB::doctools::idx::parse\fR \fBtext\fR \fItext\fR
The command takes the string contained in \fItext\fR and parses it
under the assumption that it contains a document written using the
\fIdocidx\fR markup language. An error is thrown if this assumption
is found to be false. The format of these errors is described in
section \fBParse errors\fR.
.sp
When successful the command returns the canonical serialization of the
keyword index which was encoded in the text.
See the section \fBKeyword index serialization format\fR for
specification of that format.
.TP
\fB::doctools::idx::parse\fR \fBfile\fR \fIpath\fR
The same as \fBtext\fR, except that the text to parse is read from
the file specified by \fIpath\fR.
.TP
\fB::doctools::idx::parse\fR \fBincludes\fR
This method returns the current list of search paths used when looking
for include files.
.TP
\fB::doctools::idx::parse\fR \fBinclude add\fR \fIpath\fR
This method adds the \fIpath\fR to the list of paths searched when
looking for an include file. The call is ignored if the path is
already in the list of paths. The method returns the empty string as
its result.
.TP
\fB::doctools::idx::parse\fR \fBinclude remove\fR \fIpath\fR
This method removes the \fIpath\fR from the list of paths searched
when looking for an include file. The call is ignored if the path is
not contained in the list of paths. The method returns the empty
string as its result.
.TP
\fB::doctools::idx::parse\fR \fBinclude clear\fR
This method clears the list of search paths for include files.
.TP
\fB::doctools::idx::parse\fR \fBvars\fR
This method returns a dictionary containing the current set of
predefined variables known to the \fBvset\fR markup command during
processing.
.TP
\fB::doctools::idx::parse\fR \fBvar set\fR \fIname\fR \fIvalue\fR
This method adds the variable \fIname\fR to the set of predefined
variables known to the \fBvset\fR markup command during processing,
and gives it the specified \fIvalue\fR. The method returns the empty
string as its result.
.TP
\fB::doctools::idx::parse\fR \fBvar unset\fR \fIname\fR
This method removes the variable \fIname\fR from the set of predefined
variables known to the \fBvset\fR markup command during
processing. The method returns the empty string as its result.
.TP
\fB::doctools::idx::parse\fR \fBvar clear\fR ?\fIpattern\fR?
This method removes all variables matching the \fIpattern\fR from the
set of predefined variables known to the \fBvset\fR markup command
during processing. The method returns the empty string as its result.
.sp
The pattern matching is done with \fBstring match\fR, and the
default pattern used when none is specified, is \fB*\fR.
.PP
.SH "PARSE ERRORS"
The format of the parse error messages thrown when encountering
violations of the \fIdocidx\fR markup syntax is human readable and
not intended for processing by machines. As such it is not documented.
.PP
\fIHowever\fR, the errorCode attached to the message is
machine-readable and has the following format:
.IP [1]
The error code will be a list, each element describing a single error
found in the input. The list has at least one element, possibly more.
.IP [2]
Each error element will be a list containing six strings describing an
error in detail. The strings will be
.RS
.IP [1]
The path of the file the error occured in. This may be empty.
.IP [2]
The range of the token the error was found at. This range is a
two-element list containing the offset of the first and last character
in the range, counted from the beginning of the input (file). Offsets
are counted from zero.
.IP [3]
The line the first character after the error is on.
Lines are counted from one.
.IP [4]
The column the first character after the error is at.
Columns are counted from zero.
.IP [5]
The message code of the error. This value can be used as argument to
\fBmsgcat::mc\fR to obtain a localized error message, assuming that
the application had a suitable call of \fBdoctools::msgcat::init\fR to
initialize the necessary message catalogs (See package
\fBdoctools::msgcat\fR).
.IP [6]
A list of details for the error, like the markup command involved. In
the case of message code \fBdocidx/include/syntax\fR this value is
the set of errors found in the included file, using the format
described here.
.RE
.PP
.SH "[DOCIDX] NOTATION OF KEYWORD INDICES"
The docidx format for keyword indices, also called the
\fIdocidx markup language\fR, is too large to be covered in single
section.
The interested reader should start with the document
.IP [1]
\fIdocidx language introduction\fR
.PP
and then proceed from there to the formal specifications, i.e. the
documents
.IP [1]
\fIdocidx language syntax\fR and
.IP [2]
\fIdocidx language command reference\fR.
.PP
to get a thorough understanding of the language.
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
docidx, doctools, lexer, parser
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2idx/structure.n.




















































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2idx/structure.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::idx::structure" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::idx::structure \- Docidx serialization utilities
.SH SYNOPSIS
package require \fBdoctools::idx::structure  ?0.1?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBlogger \fR
.sp
package require \fBsnit \fR
.sp
\fB::doctools::idx::structure\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
.sp
\fB::doctools::idx::structure\fR \fBverify-as-canonical\fR \fIserial\fR
.sp
\fB::doctools::idx::structure\fR \fBcanonicalize\fR \fIserial\fR
.sp
\fB::doctools::idx::structure\fR \fBprint\fR \fIserial\fR
.sp
\fB::doctools::idx::structure\fR \fBmerge\fR \fIseriala\fR \fIserialb\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands to work with the serializations of
keyword indices as managed by the doctools system v2, and specified in
section \fBKeyword index serialization format\fR.
.PP
This is an internal package of doctools, for use by the higher level
packages handling keyword indices and their conversion into and out of
various other formats, like documents written using \fIdocidx\fR
markup.
.SH API
.TP
\fB::doctools::idx::structure\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
This command verifies that the content of \fIserial\fR is a valid
\fIregular\fR serialization of a keyword index and will throw an
error if that is not the case. The result of the command is the empty
string.
.sp
If the argument \fIcanonvar\fR is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if \fIserial\fR is a valid regular
serialization. Its value will be a boolean, with \fBTrue\fR
indicating that the serialization is not only valid, but also
\fIcanonical\fR. \fBFalse\fR will be written for a valid, but
non-canonical serialization.
.sp
For the specification of regular and canonical keyword index
serializations see the section
\fBKeyword index serialization format\fR.
.TP
\fB::doctools::idx::structure\fR \fBverify-as-canonical\fR \fIserial\fR
This command verifies that the content of \fIserial\fR is a valid
\fIcanonical\fR serialization of a keyword index and will throw an
error if that is not the case. The result of the command is the empty
string.
.sp
For the specification of canonical keyword index serializations see
the section \fBKeyword index serialization format\fR.
.TP
\fB::doctools::idx::structure\fR \fBcanonicalize\fR \fIserial\fR
This command assumes that the content of \fIserial\fR is a valid
\fIregular\fR serialization of a keyword index and will throw an
error if that is not the case.
.sp
It will then convert the input into the \fIcanonical\fR serialization
of the contained keyword index and return it as its result. If the
input is already canonical it will be returned unchanged.
.sp
For the specification of regular and canonical keyword index
serializations see the section
\fBKeyword index serialization format\fR.
.TP
\fB::doctools::idx::structure\fR \fBprint\fR \fIserial\fR
This command assumes that the argument \fIserial\fR contains a valid
regular serialization of a keyword index and returns a string
containing that index in a human readable form.
.sp
The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.
.sp
For the specification of regular keyword index serializations see the
section \fBKeyword index serialization format\fR.
.TP
\fB::doctools::idx::structure\fR \fBmerge\fR \fIseriala\fR \fIserialb\fR
This command accepts the regular serializations of two keyword indices
and uses them to create their union.  The result of the command is the
canonical serialization of this unified keyword index.
.sp
Title and label of the resulting index are taken from the index
contained in \fIserialb\fR. The set of keys, references and their
connections is the union of the set of keys and references of the two
inputs.
.sp
For the specification of regular and canonical keyword index
serializations see the section
\fBKeyword index serialization format\fR.
.PP
.SH "KEYWORD INDEX SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
An index serialization is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::idx\fR, and its
value. This value holds the contents of the index.
.IP [3]
The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the index.
.TP
\fBlabel\fR
The value is a string containing a label for the index.
.TP
\fBkeywords\fR
The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.
.sp
Any reference identifier used in these lists has to exist as a key in
the \fBreferences\fR dictionary, see the next item for its
definition.
.TP
\fBreferences\fR
The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.
.sp
Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the \fBkeywords\fR dictionary, see previous item for its
definition.
.RE
.IP [4]
The \fItype\fR of a reference can be one of two values,
.RS
.TP
\fBmanpage\fR
The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.
.TP
\fBurl\fR
The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.
.RE
.RE
.TP
canonical serialization
The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their \fIlabels\fR, as
generated by Tcl's builtin command \fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
deserialization, docidx, doctools, serialization
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/container.n.






































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/container.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc" n 2 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc \- Holding tables of contents
.SH SYNOPSIS
package require \fBdoctools::toc  ?2?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::structure \fR
.sp
package require \fBstruct::tree \fR
.sp
package require \fBsnit \fR
.sp
\fB::doctools::toc\fR \fIobjectName\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fB+ reference\fR \fIid\fR \fIlabel\fR \fIdocid\fR \fIdesc\fR
.sp
\fIobjectName\fR \fB+ division\fR \fIid\fR \fIlabel\fR ?\fIdocid\fR?
.sp
\fIobjectName\fR \fBremove\fR \fIid\fR
.sp
\fIobjectName\fR \fBup\fR \fIid\fR
.sp
\fIobjectName\fR \fBnext\fR \fIid\fR
.sp
\fIobjectName\fR \fBprev\fR \fIid\fR
.sp
\fIobjectName\fR \fBchild\fR \fIid\fR \fIlabel\fR ?\fI...\fR?
.sp
\fIobjectName\fR \fBelement\fR ?\fI...\fR?
.sp
\fIobjectName\fR \fBchildren\fR \fIid\fR
.sp
\fIobjectName\fR \fBtype\fR \fIid\fR
.sp
\fIobjectName\fR \fBfull-label\fR \fIid\fR
.sp
\fIobjectName\fR \fBelabel\fR \fIid\fR ?\fInewlabel\fR?
.sp
\fIobjectName\fR \fBdescription\fR \fIid\fR ?\fInewdesc\fR?
.sp
\fIobjectName\fR \fBdocument\fR \fIid\fR ?\fInewdocid\fR?
.sp
\fIobjectName\fR \fBtitle\fR
.sp
\fIobjectName\fR \fBtitle\fR \fItext\fR
.sp
\fIobjectName\fR \fBlabel\fR
.sp
\fIobjectName\fR \fBlabel\fR \fItext\fR
.sp
\fIobjectName\fR \fBimporter\fR
.sp
\fIobjectName\fR \fBimporter\fR \fIobject\fR
.sp
\fIobjectName\fR \fBexporter\fR
.sp
\fIobjectName\fR \fBexporter\fR \fIobject\fR
.sp
\fIobjectName\fR \fBdeserialize =\fR \fIdata\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBdeserialize +=\fR \fIdata\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBserialize\fR ?\fIformat\fR?
.sp
.BE
.SH DESCRIPTION
This package provides a class to contain and programmatically
manipulate tables of contents.
.PP
This is one of the three public pillars the management of tables of
contents resides on. The other two pillars are
.IP [1]
\fIExporting tables of contents\fR, and
.IP [2]
\fIImporting tables of contents\fR
.PP
.PP
For information about the \fBConcepts\fR of tables of contents, and
their parts, see the same-named section.
For information about the data structure which is used to encode
tables of contents as values see the section
\fBToC serialization format\fR.
This is the only format directly known to this class. Conversions from
and to any other format are handled by export and import manager
objects. These may be attached to a container, but do not have to be,
it is merely a convenience.
.SH CONCEPTS
.IP [1]
A \fItable of contents\fR consists of a (possibly empty) list of
\fIelements\fR.
.IP [2]
Each element in the list is identified by its label.
.IP [3]
Each element is either a \fIreference\fR, or a \fIdivision\fR.
.IP [4]
Each reference has an associated document, identified by a symbolic
id, and a textual description.
.IP [5]
Each division may have an associated document, identified by a
symbolic id.
.IP [6]
Each division consists consists of a (possibly empty) list of
\fIelements\fR, with each element following the rules as specified in
item 2 and above.
.PP
A few notes
.IP [1]
The above rules span up a tree of elements, with references as the
leaf nodes, and divisions as the inner nodes, and each element
representing an entry in the whole table of contents.
.IP [2]
The identifying labels of any element E are unique within their
division (or toc), and the full label of any element E is the list of
labels for all nodes on the unique path from the root of the tree to
E, including E.
.PP
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::toc\fR \fIobjectName\fR
This command creates a new container object with an associated Tcl
command whose name is \fIobjectName\fR. This \fIobject\fR command is
explained in full detail in the sections \fBObject command\fR
and \fBObject methods\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::doctools::toc\fR command have the
following general form:
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fB+ reference\fR \fIid\fR \fIlabel\fR \fIdocid\fR \fIdesc\fR
This method adds a new reference element to the table of contents,
under the element specified via its handle \fIid\fR. This parent
element has to be a division element, or the root. An error is thrown
otherwise.
The new element will be externally identified by its \fIlabel\fR,
which has to be be unique within the parent element. An error is
thrown otherwise.
.sp
As a reference element it will refer to a document identified by the
symbolic \fIdocid\fR. This reference must not be the empty string, an
error is thrown otherwise.
Beyond the label the element also has a longer descriptive string,
supplied via \fIdesc\fR.
.sp
The result of the method is the handle (id) of the new element.
.TP
\fIobjectName\fR \fB+ division\fR \fIid\fR \fIlabel\fR ?\fIdocid\fR?
This method adds a new division element to the table of contents,
under the element specified via its handle \fIid\fR. This parent
element has to be a division element, or the root. An error is thrown
otherwise.
The new element will be externally identified by its \fIlabel\fR,
which has to be be unique within the parent element. An error is
thrown otherwise.
.sp
As a division element it is can refer to a document, identified by the
symbolic \fIdocid\fR, but may choose not to.
.sp
The result of the method is the handle (id) of the new element.
.TP
\fIobjectName\fR \fBremove\fR \fIid\fR
This method removes the element identified by the handle \fIid\fR from
the table of contents.
If the element is a division all of its children, if any, are removed
as well. The root element/division of the table of contents cannot be
removed however, only its children.
.sp
The result of the method is the empty string.
.TP
\fIobjectName\fR \fBup\fR \fIid\fR
This method returns the handle of the parent for the element
identified by its handle \fIid\fR, or the empty string if \fIid\fR
refered to the root element.
.TP
\fIobjectName\fR \fBnext\fR \fIid\fR
This method returns the handle of the right sibling for the element
identified by its handle \fIid\fR, or the handle of the parent if the
element has no right sibling, or the empty string if \fIid\fR refered
to the root element.
.TP
\fIobjectName\fR \fBprev\fR \fIid\fR
This method returns the handle of the left sibling for the element
identified by its handle \fIid\fR, or the handle of the parent if the
element has no left sibling, or the empty string if \fIid\fR refered
to the root element.
.TP
\fIobjectName\fR \fBchild\fR \fIid\fR \fIlabel\fR ?\fI...\fR?
This method returns the handle of a child of the element identified by
its handle \fIid\fR. The child itself is identified by a series of
labels.
.TP
\fIobjectName\fR \fBelement\fR ?\fI...\fR?
This method returns the handle of the element identified by a series
of labels, starting from the root of the table of contents. The series
of labels is allowed to be empty, in which case the handle of the root
element is returned.
.TP
\fIobjectName\fR \fBchildren\fR \fIid\fR
This method returns a list containing the handles of all children of
the element identified by the handle \fIid\fR, from first to last, in
that order.
.TP
\fIobjectName\fR \fBtype\fR \fIid\fR
This method returns the type of the element, either \fBreference\fR,
or \fBdivision\fR.
.TP
\fIobjectName\fR \fBfull-label\fR \fIid\fR
This method is the complement of the method \fBelement\fR,
converting the handle \fIid\fR of an element into a list of labels
full identifying the element within the whole table of contents.
.TP
\fIobjectName\fR \fBelabel\fR \fIid\fR ?\fInewlabel\fR?
This method queries and/or changes the label of the element identified
by the handle \fIid\fR. If the argument \fInewlabel\fR is present then
the label is changed to that value. Regardless of this, the result of
the method is the current value of the label.
.sp
If the label is changed the new label has to be unique within the
containing division, or an error is thrown.
.sp
Further, of the \fIid\fR refers to the root element of the table of
contents, then using this method is equivalent to using the method
\fIlabel\fR, i.e. it is accessing the global label for the whole
table.
.TP
\fIobjectName\fR \fBdescription\fR \fIid\fR ?\fInewdesc\fR?
This method queries and/or changes the description of the element
identified by the handle \fIid\fR. If the argument \fInewdesc\fR is
present then the description is changed to that value. Regardless of
this, the result of the method is the current value of the description.
.sp
The element this method operates on has to be a reference element, or
an error will be thrown.
.TP
\fIobjectName\fR \fBdocument\fR \fIid\fR ?\fInewdocid\fR?
This method queries and/or changes the document reference of the
element identified by the handle \fIid\fR.
If the argument \fInewdocid\fR is present then the description is
changed to that value. Regardless of this, the result of the method is
the current value of the document reference.
.sp
Setting the reference to the empty string means unsetting it, and is
allowed only for division elements. Conversely, if the result is the
empty string then the element has no document reference, and this can
happen only for division elements.
.TP
\fIobjectName\fR \fBtitle\fR
Returns the currently defined title of the table of contents.
.TP
\fIobjectName\fR \fBtitle\fR \fItext\fR
Sets the title of the table of contents to \fItext\fR, and returns it as
the result of the command.
.TP
\fIobjectName\fR \fBlabel\fR
Returns the currently defined label of the table of contents.
.TP
\fIobjectName\fR \fBlabel\fR \fItext\fR
Sets the label of the table of contents to \fItext\fR, and returns it as
the result of the command.
.TP
\fIobjectName\fR \fBimporter\fR
Returns the import manager object currently attached to the container,
if any.
.TP
\fIobjectName\fR \fBimporter\fR \fIobject\fR
Attaches the \fIobject\fR as import manager to the container, and
returns it as the result of the command.
Note that the \fIobject\fR is \fInot\fR put into ownership of the
container. I.e., destruction of the container will \fInot\fR destroy
the \fIobject\fR.
.sp
It is expected that \fIobject\fR provides a method named
\fBimport text\fR which takes a text and a format name, and
returns the canonical serialization of the table of contents contained in
the text, assuming the given format.
.TP
\fIobjectName\fR \fBexporter\fR
Returns the export manager object currently attached to the container,
if any.
.TP
\fIobjectName\fR \fBexporter\fR \fIobject\fR
Attaches the \fIobject\fR as export manager to the container, and
returns it as the result of the command.
Note that the \fIobject\fR is \fInot\fR put into ownership of the
container. I.e., destruction of the container will \fInot\fR destroy
the \fIobject\fR.
.sp
It is expected that \fIobject\fR provides a method named
\fBexport object\fR which takes the container and a format name,
and returns a text encoding table of contents stored in the container, in
the given format. It is further expected that the \fIobject\fR will
use the container's method \fBserialize\fR to obtain the
serialization of the table of contents from which to generate the text.
.TP
\fIobjectName\fR \fBdeserialize =\fR \fIdata\fR ?\fIformat\fR?
This method replaces the contents of the table object with the table
contained in the \fIdata\fR. If no \fIformat\fR was specified it is
assumed to be the regular serialization of a table of contents.
.sp
Otherwise the object will use the attached import manager to convert
the data from the specified format to a serialization it can handle.
In that case an error will be thrown if the container has no import
manager attached to it.
.sp
The result of the method is the empty string.
.TP
\fIobjectName\fR \fBdeserialize +=\fR \fIdata\fR ?\fIformat\fR?
This method behaves like \fBdeserialize =\fR in its essentials,
except that it merges the table of contents in the \fIdata\fR to its
contents instead of replacing it.
The method will throw an error if merging is not possible, i.e. would
produce an invalid table. The existing content is left unchanged in
that case.
.sp
The result of the method is the empty string.
.TP
\fIobjectName\fR \fBserialize\fR ?\fIformat\fR?
This method returns the table of contents contained in the object. If no
\fIformat\fR is not specified the returned result is the canonical
serialization of its contents.
.sp
Otherwise the object will use the attached export manager to convert
the data to the specified format.
In that case an error will be thrown if the container has no export
manager attached to it.
.PP
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
HTML, TMML, conversion, doctoc markup, documentation, formatting, generation, json, latex, markup, nroff, parsing, plugin, reference, table, table of contents, tcler's wiki, text, wiki
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/export.n.


















































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/export.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::export" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::export \- Exporting tables of contents
.SH SYNOPSIS
package require \fBdoctools::toc::export  ?0.1?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::config \fR
.sp
package require \fBdoctools::toc::structure \fR
.sp
package require \fBsnit \fR
.sp
package require \fBpluginmgr \fR
.sp
\fB::doctools::toc::export\fR \fIobjectName\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBexport serial\fR \fIserial\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBexport object\fR \fIobject\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBconfig names\fR
.sp
\fIobjectName\fR \fBconfig get\fR
.sp
\fIobjectName\fR \fBconfig set\fR \fIname\fR ?\fIvalue\fR?
.sp
\fIobjectName\fR \fBconfig unset\fR \fIpattern\fR...
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class to manage the plugins for the export of
tables of contents to other formats, i.e. their conversion to, for
example \fIdoctoc\fR, \fIHTML\fR, etc.
.PP
This is one of the three public pillars the management of tables of
contents resides on. The other two pillars are
.IP [1]
\fIImporting tables of contents\fR, and
.IP [2]
\fIHolding tables of contents\fR
.PP
.PP
For information about the \fBConcepts\fR of tables of contents,
and their parts, see the same-named section.
For information about the data structure which is the major input to
the manager objects provided by this package see the section
\fBToC serialization format\fR.
.PP
The plugin system of our class is based on the package
\fBpluginmgr\fR, and configured to look for plugins using
.IP [1]
the environment variable \fBDOCTOOLS_TOC_EXPORT_PLUGINS\fR,
.IP [2]
the environment variable \fBDOCTOOLS_TOC_PLUGINS\fR,
.IP [3]
the environment variable \fBDOCTOOLS_PLUGINS\fR,
.IP [4]
the path "\fI~/.doctools/toc/export/plugin\fR"
.IP [5]
the path "\fI~/.doctools/toc/plugin\fR"
.IP [6]
the path "\fI~/.doctools/plugin\fR"
.IP [7]
the path "\fI~/.doctools/toc/export/plugins\fR"
.IP [8]
the path "\fI~/.doctools/toc/plugins\fR"
.IP [9]
the path "\fI~/.doctools/plugins\fR"
.IP [10]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\TOC\\EXPORT\\PLUGINS"
.IP [11]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\TOC\\PLUGINS"
.IP [12]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\PLUGINS"
.PP
The last three are used only when the package is run on a machine
using Windows(tm) operating system.
.PP
The whole system is delivered with six predefined export plugins,
namely
.TP
doctoc
See \fIdoctoc export plugin\fR for details.
.TP
html
See \fIhtml export plugin\fR for details.
.TP
json
See \fIjson export plugin\fR for details.
.TP
nroff
See \fInroff export plugin\fR for details.
.TP
text
See \fItext export plugin\fR for details.
.TP
wiki
See \fIwiki export plugin\fR for details.
.PP
.PP
Readers wishing to write their own export plugin for some format, i.e.
\fIplugin writer\fRs reading and understanding the section
containing the \fBExport plugin API v2 reference\fR is an
absolute necessity, as it specifies the interaction between this
package and its plugins in detail.
.SH CONCEPTS
.IP [1]
A \fItable of contents\fR consists of a (possibly empty) list of
\fIelements\fR.
.IP [2]
Each element in the list is identified by its label.
.IP [3]
Each element is either a \fIreference\fR, or a \fIdivision\fR.
.IP [4]
Each reference has an associated document, identified by a symbolic
id, and a textual description.
.IP [5]
Each division may have an associated document, identified by a
symbolic id.
.IP [6]
Each division consists consists of a (possibly empty) list of
\fIelements\fR, with each element following the rules as specified in
item 2 and above.
.PP
A few notes
.IP [1]
The above rules span up a tree of elements, with references as the
leaf nodes, and divisions as the inner nodes, and each element
representing an entry in the whole table of contents.
.IP [2]
The identifying labels of any element E are unique within their
division (or toc), and the full label of any element E is the list of
labels for all nodes on the unique path from the root of the tree to
E, including E.
.PP
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::toc::export\fR \fIobjectName\fR
This command creates a new export manager object with an associated
Tcl command whose name is \fIobjectName\fR. This \fIobject\fR command
is explained in full detail in the sections \fBObject command\fR
and \fBObject methods\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::doctools::toc::export\fR command have
the following general form:
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBexport serial\fR \fIserial\fR ?\fIformat\fR?
This method takes the canonical serialization of a table of contents
stored in \fIserial\fR and converts it to the specified \fIformat\fR,
using the export plugin for the format. An error is thrown if no
plugin could be found for the format.
The string generated by the conversion process is returned as
the result of this method.
.sp
If no format is specified the method defaults to \fBdoctoc\fR.
.sp
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBToC serialization format\fR.
.sp
The plugin has to conform to the interface specified in section
\fBExport plugin API v2 reference\fR.
.TP
\fIobjectName\fR \fBexport object\fR \fIobject\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBexport serial\fR
method described by the previous item.
It expects that \fIobject\fR is an object command supporting a
\fBserialize\fR method returning the canonical serialization of a
table of contents. It invokes that method, feeds the result into
\fBexport serial\fR and returns the resulting string as its own
result.
.TP
\fIobjectName\fR \fBconfig names\fR
This method returns a list containing the names of all configuration
variables currently known to the object.
.TP
\fIobjectName\fR \fBconfig get\fR
This method returns a dictionary containing the names and values of
all configuration variables currently known to the object.
.TP
\fIobjectName\fR \fBconfig set\fR \fIname\fR ?\fIvalue\fR?
This method sets the configuration variable \fIname\fR to the
specified \fIvalue\fR and returns the new value of the variable.
.sp
If no value is specified it simply returns the current value, without
changing it.
.sp
Note that while the user can set the predefined configuration
variables \fBuser\fR and \fBformat\fR doing so will have no
effect, these values will be internally overriden when invoking an
import plugin.
.TP
\fIobjectName\fR \fBconfig unset\fR \fIpattern\fR...
This method unsets all configuration variables matching the specified
glob \fIpattern\fRs. If no pattern is specified it will unset all
currently defined configuration variables.
.PP
.SH "EXPORT PLUGIN API V2 REFERENCE"
Plugins are what this package uses to manage the support for any
output format beyond the \fBToC serialization format\fR. Here we
specify the API the objects created by this package use to interact
with their plugins.
.PP
A plugin for this package has to follow the rules listed below:
.IP [1]
A plugin is a package.
.IP [2]
The name of a plugin package has the form
doctools::toc::export::\fBFOO\fR,
where \fBFOO\fR is the name of the format the plugin will
generate output for. This name is also the argument to provide
to the various \fBexport\fR methods of export manager
objects to get a string encoding a table of contents in that
format.
.IP [3]
The plugin can expect that the package
\fBdoctools::toc::export::plugin\fR is present, as
indicator that it was invoked from a genuine plugin manager.
.IP [4]
A plugin has to provide one command, with the signature shown
below.
.RS
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
Whenever an export manager of \fBdoctools::toc\fR has to generate
output for a table of contents it will invoke this command.
.RS
.TP
string \fIserial\fR
This argument will contain the \fIcanonical\fR serialization of the
table of contents for which to generate the output.
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBToC serialization format\fR.
.TP
dictionary \fIconfiguration\fR
This argument will contain the current configuration to apply to the
generation, as a dictionary mapping from variable names to values.
.sp
The following configuration variables have a predefined meaning all
plugins have to obey, although they can ignore this information at
their discretion. Any other other configuration variables recognized
by a plugin will be described in the manpage for that plugin.
.RS
.TP
user
This variable is expected to contain the name of the user
owning the process invoking the plugin.
.TP
format
This variable is expected to contain the name of the
format whose plugin is invoked.
.TP
file
This variable, if defined by the user of the table object
is expected to contain the name of the input file for which
the plugin is generating its output for.
.TP
map
This variable, if defined by the user of the table object is
expected to contain a dictionary mapping from symbolic
document ids used in the table entries to actual paths (or
urls). A plugin has to be able to handle the possibility
that a document id is without entry in this mapping.
.RE
.RE
.RE
.IP [5]
A single usage cycle of a plugin consists of the invokations of
the command \fBexport\fR. This call has to leave the plugin in
a state where another usage cycle can be run without problems.
.PP
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
HTML, conversion, doctoc, documentation, export, formatting, generation, json, manpage, markup, nroff, plugin, reference, table, table of contents, tcler's wiki, text, url, wiki
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/export_doctoc.n.














































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/export_doctoc.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::export::doctoc" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::export::doctoc \- doctoc export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::export::doctoc  ?0.1?\fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools table of contents export plugin
for the generation of doctoc markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially \fBdoctools::toc::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::toc::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a table of contents,
as specified in section \fBToC serialization format\fR, and
contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary, and
generates doctoc markup encoding the table.
The created string is then returned as the result of the command.
.PP
.SH "[DOCTOC] NOTATION OF TABLES OF CONTENTS"
The doctoc format for tables of contents, also called the
\fIdoctoc markup language\fR, is too large to be covered in single
section.
The interested reader should start with the document
.IP [1]
\fIdoctoc language introduction\fR
.PP
and then proceed from there to the formal specifications, i.e. the
documents
.IP [1]
\fIdoctoc language syntax\fR and
.IP [2]
\fIdoctoc language command reference\fR.
.PP
to get a thorough understanding of the language.
.SH CONFIGURATION
The doctoc export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
string \fIuser\fR
This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.
.TP
string \fIfile\fR
This standard configuration variable contains the name of the file the
table of contents came from. This variable may not be set or contain
the empty string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.
.TP
boolean \fInewlines\fR
If this flag is set the plugin will break the generated doctoc code
across lines, with each markup command on a separate line.
.sp
If this flag is not set (the default), the whole document will be
written on a single line, with minimum spacing between all elements.
.TP
boolean \fIindented\fR
If this flag is set the plugin will indent the markup commands
according to the structure of tables of contents. To make this work
this also implies that \fBnewlines\fR is set. This effect is
independent of the value for \fBaligned\fR however.
.sp
If this flag is not set (the default), the output is formatted as per
the value of \fBnewlines\fR, and no indenting is done.
.TP
boolean \fIaligned\fR
If this flag is set the generator ensures that the arguments for the
\fBitem\fR commands in a division are aligned vertically for a nice
table effect. To make this work this also implies that \fBnewlines\fR
is set. This effect is independent of the value for \fBindented\fR
however.
.sp
If this flag is not set (the default), the output is formatted as per
the values of \fBnewlines\fR and \fBindented\fR, and no alignment is
done.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBformat\fR, and \fBmap\fR, and their values.
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctoc, doctools, export, serialization, table of contents, toc
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/export_html.n.
































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/export_html.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::export::html" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::export::html \- HTML export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::export::html  ?0.1?\fR
.sp
package require \fBdoctools::text \fR
.sp
package require \fBdoctools::html \fR
.sp
package require \fBdoctools::html::cssdefaults \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools table of contents export plugin
for the generation of HTML markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially \fBdoctools::toc::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::toc::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a table of contents,
as specified in section \fBToC serialization format\fR, and
contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary, and
generates HTML markup encoding the table.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The html export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
string \fIuser\fR
This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.
.TP
string \fIfile\fR
This standard configuration variable contains the name of the file the
table of contents came from. This variable may not be set or contain
the empty string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.
.TP
dictionary \fImap\fR
This standard configuration variable contains a dictionary mapping
from the (symbolic) document ids in reference entries to the actual
filenames and/or urls to be used in the output.
.sp
Document ids without a mapping are used unchanged.
.TP
boolean \fInewlines\fR
If this flag is set the plugin will break the generated html code
across lines, with each markup command on a separate line.
.sp
If this flag is not set (the default), the whole document will be
written on a single line, with minimum spacing between all elements.
.TP
boolean \fIindented\fR
If this flag is set the plugin will indent the markup commands
according to the structure of indices. To make this work this also
implies that \fBnewlines\fR is set.
.sp
If this flag is not set (the default), the output is formatted as per
the value of \fBnewlines\fR, and no indenting is done.
.TP
string \fImeta\fR
This variable is meant to hold a fragment of HTML (default: empty).
The fragment it contains will be inserted into the generated output in
the <head> section of the document, just after the <title> tag.
.TP
string \fIheader\fR
This variable is meant to hold a fragment of HTML (default: empty).
The fragment it contains will be inserted into the generated output
just after the <h1> title tag in the body of the document, in the
class.header <div>'ision.
.TP
string \fIfooter\fR
This variable is meant to hold a fragment of HTML (default:
empty). The fragment it contains will be inserted into the generated
output just before the </body> tag, in the class.footer <div>'ision.
.TP
dictionary \fIrid\fR
The value of this variable (default: empty) maps references to the
identifiers to use as their anchor names. Each reference \fBFOO\fR not
found in the dictionary uses \fBREF-\fR\fBFOO\fR as anchor,
i.e. itself prefixed with the string \fBREF-\fR.
.TP
string \fIsepline\fR
The value of this variable is the string to use for the separator
comments inserted into the output when the outpout is broken across
lines and/or indented. The default string consists of 60 dashes.
.TP
string \fIclass.main\fR
This variable contains the class name for the main <div>'ivision of
the generated document. The default is \fBdoctools\fR.
.TP
string \fIclass.header\fR
This variable contains the class name for the header <div>'ision of
the generated document. The default is \fBtoc-header\fR.  This
division contains the document title, the user specified \fBheader\fR,
if any, and a visible separator line.
.TP
string \fIclass.title\fR
This variable contains the class name for the <h1> tag enclosing the
document title. The default is \fBtoc-title\fR.
.TP
string \fIclass.navsep\fR
This variable contains the class name for the <hr> separators in the
header and footer sections of the generated document. The default is
\fBtoc-navsep\fR.
.TP
string \fIclass.contents\fR
This variable contains the class name for the XXXXX holding the
keywords and their references in the generated document. The default
is \fBtoc-contents\fR.
.TP
string \fIclass.ref\fR
This variable contains the class name for the table elements which are
references to other documents. The default is \fBtoc-ref\fR.
.TP
string \fIclass.div\fR
This variable contains the class name for the table elements which are
divisions. The default is \fBtoc-div\fR.
.TP
string \fIclass.footer\fR
This variable contains the class name for the footer <div>'ision of
the generated document. The default is \fBtoc-footer\fR. This
division contains a browser-visible separator line and the user
specified \fBfooter\fR, if any.
.PP
\fINote\fR that this plugin ignores the standard configuration
variable \fBformat\fR, and its value.
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
HTML, doctools, export, serialization, table of contents, toc
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/export_json.n.




















































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/export_json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::export::json" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::export::json \- JSON export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::export::json  ?0.1?\fR
.sp
package require \fBtextutil::adjust \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools table of contents export plugin
for the generation of JSON markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially \fBdoctools::toc::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::toc::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a table of contents,
as specified in section \fBToC serialization format\fR, and
contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary, and
generates JSON markup encoding the table.
The created string is then returned as the result of the command.
.PP
.SH "JSON NOTATION OF TABLES OF CONTENTS"
The JSON format used for tables of contents is a direct translation of
the \fBToC serialization format\fR, mapping Tcl dictionaries as
JSON objects and Tcl lists as JSON arrays.
For example, the Tcl serialization
.CS


doctools::toc {
    items {
        {reference {
	    desc {DocTools - Tables of Contents}
	     id introduction.man
	     label doctools::toc::introduction
	}}
	{division {
	     id processing.man
	     items {
	         {reference {
		     desc {doctoc serialization utilities}
		     id structure.man
		     label doctools::toc::structure
		 }}
		 {reference {
		     desc {Parsing text in doctoc format}
		     id parse.man
		     label doctools::toc::parse
		 }}
	     }
             label Processing
        }}
    }
    label {Table of Contents}
    title TOC
}

.CE
is equivalent to the JSON string
.CS


{
    "doctools::toc" : {
        "items" : [{
            "reference" : {
                "desc"  : "DocTools - Tables of Contents",
                "id"    : "introduction.man",
                "label" : "doctools::toc::introduction"
            }
        },{
            "division" : {
                "id"    : "processing.man",
                "items" : [{
                    "reference" : {
                        "desc"  : "doctoc serialization utilities",
                        "id"    : "structure.man",
                        "label" : "doctools::toc::structure"
                    }
                },{
                    "reference" : {
                        "desc"  : "Parsing text in doctoc format",
                        "id"    : "parse.man",
                        "label" : "doctools::toc::parse"
                    }
                }],
                "label" : "Processing"
            }
        }],
        "label" : "Table of Contents",
        "title" : "TOC"
    }
}

.CE
.SH CONFIGURATION
The JSON export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
boolean \fIindented\fR
If this flag is set the plugin will break the generated JSON code
across lines and indent it according to its inner structure, with each
key of a dictionary on a separate line.
.sp
If this flag is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.
.TP
boolean \fIaligned\fR
If this flag is set the generator ensures that the values for the keys
in a dictionary are vertically aligned with each other, for a nice
table effect. To make this work this also implies that \fBindented\fR
is set.
.sp
If this flag is not set (the default), the output is formatted as per
the value of \fBindented\fR, without trying to align the values for
dictionary keys.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBuser\fR, \fBformat\fR, \fBfile\fR, and \fBmap\fR and
their values.
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
JSON, doctools, export, serialization, table of contents, toc
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/export_nroff.n.















































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/export_nroff.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::export::nroff" n 0.2 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::export::nroff \- nroff export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::export::nroff  ?0.2?\fR
.sp
package require \fBdoctools::text \fR
.sp
package require \fBdoctools::nroff::man_macros \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools table of contents export plugin
for the generation of nroff markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially \fBdoctools::toc::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::toc::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a table of contents,
as specified in section \fBToC serialization format\fR, and
contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary, and
generates nroff markup encoding the table.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The nroff export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
string \fIuser\fR
This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.
.TP
string \fIfile\fR
This standard configuration variable contains the name of the file the
table of contents came from. This variable may not be set or contain
the empty string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.
.TP
boolean \fIinline\fR
If this flag is set (default) the plugin will place the definitions of
the man macro set directly into the output.
.sp
If this flag is not set, the plugin will place a reference to the
definitions of the man macro set into the output, but not the macro
definitions themselves.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBformat\fR, and \fBmap\fR, and their values.
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctools, export, nroff, serialization, table of contents, toc
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/export_text.n.






























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/export_text.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::export::text" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::export::text \- plain text export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::export::text  ?0.1?\fR
.sp
package require \fBdoctools::text \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools table of contents export plugin
for the generation of plain text markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially \fBdoctools::toc::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::toc::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a table of contents,
as specified in section \fBToC serialization format\fR, and
contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary, and
generates plain text markup encoding the table.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The text export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
dictionary \fImap\fR
This standard configuration variable contains a dictionary mapping
from the (symbolic) document ids in reference entries to the actual
filenames and/or urls to be used in the output.
.sp
Document ids without a mapping are used unchanged.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBuser\fR, \fBfile\fR, and \fBformat\fR, and their values.
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctools, export, plain text, serialization, table of contents, toc
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/export_wiki.n.




































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/export_wiki.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::export::wiki" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::export::wiki \- wiki export plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::export::wiki  ?0.1?\fR
.sp
package require \fBdoctools::text \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools table of contents export plugin
for the generation of wiki markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially \fBdoctools::toc::export\fR, the export manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::toc::export\fR and the export manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a table of contents,
as specified in section \fBToC serialization format\fR, and
contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary, and
generates wiki markup encoding the table.
The created string is then returned as the result of the command.
.PP
.SH "WIKI MARKUP"
The basic syntax of the wiki markup generated by this plugin are
described at \fIhttp://wiki.tcl.tk/14\fR.
.PP
The plugin goes beyond the classic markup to generate proper headers
and indenting.
.SH CONFIGURATION
The wiki export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
dictionary \fImap\fR
This standard configuration variable contains a dictionary mapping
from the (symbolic) document ids in reference entries to the actual
filenames and/or urls to be used in the output.
.sp
Document ids without a mapping are used unchanged.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBuser\fR, \fBfile\fR and \fBformat\fR, and their values.
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctools, export, serialization, table of contents, toc, wiki
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/import.n.



































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/import.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::import" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::import \- Importing keyword indices
.SH SYNOPSIS
package require \fBdoctools::toc::import  ?0.1?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::config \fR
.sp
package require \fBdoctools::toc::structure \fR
.sp
package require \fBsnit \fR
.sp
package require \fBpluginmgr \fR
.sp
\fB::doctools::toc::import\fR \fIobjectName\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBimport text\fR \fItext\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport file\fR \fIpath\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport object text\fR \fIobject\fR \fItext\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport object file\fR \fIobject\fR \fIpath\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBconfig names\fR
.sp
\fIobjectName\fR \fBconfig get\fR
.sp
\fIobjectName\fR \fBconfig set\fR \fIname\fR ?\fIvalue\fR?
.sp
\fIobjectName\fR \fBconfig unset\fR \fIpattern\fR...
.sp
\fIobjectName\fR \fBincludes\fR
.sp
\fIobjectName\fR \fBinclude add\fR \fIpath\fR
.sp
\fIobjectName\fR \fBinclude remove\fR \fIpath\fR
.sp
\fIobjectName\fR \fBinclude clear\fR
.sp
\fBIncludeFile\fR \fIcurrentfile\fR \fIpath\fR
.sp
\fBimport\fR \fItext\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class to manage the plugins for the import of
tables of contents from other formats, i.e. their conversion from, for
example \fIdoctoc\fR, \fIjson\fR, etc.
.PP
This is one of the three public pillars the management of tables of
contents resides on. The other two pillars are
.IP [1]
\fIExporting tables of contents\fR, and
.IP [2]
\fIHolding tables of contents\fR
.PP
.PP
For information about the \fBConcepts\fR of tables of contents,
and their parts, see the same-named section.
For information about the data structure which is the major output of
the manager objects provided by this package see the section
\fBToC serialization format\fR.
.PP
The plugin system of our class is based on the package
\fBpluginmgr\fR, and configured to look for plugins using
.IP [1]
the environment variable \fBDOCTOOLS_TOC_IMPORT_PLUGINS\fR,
.IP [2]
the environment variable \fBDOCTOOLS_TOC_PLUGINS\fR,
.IP [3]
the environment variable \fBDOCTOOLS_PLUGINS\fR,
.IP [4]
the path "\fI~/.doctools/toc/import/plugin\fR"
.IP [5]
the path "\fI~/.doctools/toc/plugin\fR"
.IP [6]
the path "\fI~/.doctools/plugin\fR"
.IP [7]
the path "\fI~/.doctools/toc/import/plugins\fR"
.IP [8]
the path "\fI~/.doctools/toc/plugins\fR"
.IP [9]
the path "\fI~/.doctools/plugins\fR"
.IP [10]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\TOC\\IMPORT\\PLUGINS"
.IP [11]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\TOC\\PLUGINS"
.IP [12]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\DOCTOOLS\\PLUGINS"
.PP
The last three are used only when the package is run on a machine
using Windows(tm) operating system.
.PP
The whole system is delivered with two predefined import plugins,
namely
.TP
doctoc
See \fIdoctoc import plugin\fR for details.
.TP
json
See \fIjson import plugin\fR for details.
.PP
.PP
Readers wishing to write their own import plugin for some format, i.e.
\fIplugin writer\fRs reading and understanding the section
containing the \fBImport plugin API v2 reference\fR is an
absolute necessity, as it specifies the interaction between this
package and its plugins in detail.
.SH CONCEPTS
.IP [1]
A \fItable of contents\fR consists of a (possibly empty) list of
\fIelements\fR.
.IP [2]
Each element in the list is identified by its label.
.IP [3]
Each element is either a \fIreference\fR, or a \fIdivision\fR.
.IP [4]
Each reference has an associated document, identified by a symbolic
id, and a textual description.
.IP [5]
Each division may have an associated document, identified by a
symbolic id.
.IP [6]
Each division consists consists of a (possibly empty) list of
\fIelements\fR, with each element following the rules as specified in
item 2 and above.
.PP
A few notes
.IP [1]
The above rules span up a tree of elements, with references as the
leaf nodes, and divisions as the inner nodes, and each element
representing an entry in the whole table of contents.
.IP [2]
The identifying labels of any element E are unique within their
division (or toc), and the full label of any element E is the list of
labels for all nodes on the unique path from the root of the tree to
E, including E.
.PP
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fB::doctools::toc::import\fR \fIobjectName\fR
This command creates a new import manager object with an associated
Tcl command whose name is \fIobjectName\fR. This \fIobject\fR command
is explained in full detail in the sections \fBObject command\fR
and \fBObject methods\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::doctools::toc::import\fR command have
the following general form:
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBimport text\fR \fItext\fR ?\fIformat\fR?
This method takes the \fItext\fR and converts it from the specified
\fIformat\fR to the canonical serialization of a table of contents using
the import plugin for the format. An error is thrown if no plugin
could be found for the format.
The serialization generated by the conversion process is returned as
the result of this method.
.sp
If no format is specified the method defaults to \fBdoctoc\fR.
.sp
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBToC serialization format\fR.
.sp
The plugin has to conform to the interface specified in section
\fBImport plugin API v2 reference\fR.
.TP
\fIobjectName\fR \fBimport file\fR \fIpath\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBimport text\fR
method described by the previous item.
It reads the contents of the specified file into memory, feeds the
result into \fBimport text\fR and returns the resulting
serialization as its own result.
.TP
\fIobjectName\fR \fBimport object text\fR \fIobject\fR \fItext\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBimport text\fR
method described by the previous item.
It expects that \fIobject\fR is an object command supporting a
\fBdeserialize\fR method expecting the canonical serialization of a
table of contents.
It imports the text using \fBimport text\fR and then feeds the
resulting serialization into the \fIobject\fR via \fBdeserialize\fR.
This method returns the empty string as it result.
.TP
\fIobjectName\fR \fBimport object file\fR \fIobject\fR \fIpath\fR ?\fIformat\fR?
This method behaves like \fBimport object text\fR, except that it
reads the text to convert from the specified file instead of being
given it as argument.
.TP
\fIobjectName\fR \fBconfig names\fR
This method returns a list containing the names of all configuration
variables currently known to the object.
.TP
\fIobjectName\fR \fBconfig get\fR
This method returns a dictionary containing the names and values of
all configuration variables currently known to the object.
.TP
\fIobjectName\fR \fBconfig set\fR \fIname\fR ?\fIvalue\fR?
This method sets the configuration variable \fIname\fR to the
specified \fIvalue\fR and returns the new value of the variable.
.sp
If no value is specified it simply returns the current value, without
changing it.
.sp
Note that while the user can set the predefined configuration
variables \fBuser\fR and \fBformat\fR doing so will have no
effect, these values will be internally overriden when invoking an
import plugin.
.TP
\fIobjectName\fR \fBconfig unset\fR \fIpattern\fR...
This method unsets all configuration variables matching the specified
glob \fIpattern\fRs. If no pattern is specified it will unset all
currently defined configuration variables.
.TP
\fIobjectName\fR \fBincludes\fR
This method returns a list containing the currently specified paths to
use to search for include files when processing input.
The order of paths in the list corresponds to the order in which they
are used, from first to last, and also corresponds to the order in
which they were added to the object.
.TP
\fIobjectName\fR \fBinclude add\fR \fIpath\fR
This methods adds the specified \fIpath\fR to the list of paths to use
to search for include files when processing input. The path is added
to the end of the list, causing it to be searched after all previously
added paths. The result of the command is the empty string.
.sp
The method does nothing if the path is already known.
.TP
\fIobjectName\fR \fBinclude remove\fR \fIpath\fR
This methods removes the specified \fIpath\fR from the list of paths
to use to search for include files when processing input. The result
of the command is the empty string.
.sp
The method does nothing if the path is not known.
.TP
\fIobjectName\fR \fBinclude clear\fR
This method clears the list of paths to use to search for include
files when processing input. The result of the command is the empty
string.
.PP
.SH "IMPORT PLUGIN API V2 REFERENCE"
Plugins are what this package uses to manage the support for any input
format beyond the \fBToC serialization format\fR. Here we
specify the API the objects created by this package use to interact
with their plugins.
.PP
A plugin for this package has to follow the rules listed below:
.IP [1]
A plugin is a package.
.IP [2]
The name of a plugin package has the form
doctools::toc::import::\fBFOO\fR,
where \fBFOO\fR is the name of the format the plugin will
generate output for. This name is also the argument to provide
to the various \fBimport\fR methods of import manager
objects to get a string encoding a table of contents in that
format.
.IP [3]
The plugin can expect that the package
\fBdoctools::toc::export::plugin\fR is present, as
indicator that it was invoked from a genuine plugin manager.
.IP [4]
The plugin can expect that a command named \fBIncludeFile\fR is
present, with the signature
.RS
.TP
\fBIncludeFile\fR \fIcurrentfile\fR \fIpath\fR
This command has to be invoked by the plugin when it has to process an
included file, if the format has the concept of such. An example of
such a format would be \fIdoctoc\fR.
.sp
The plugin has to supply the following arguments
.RS
.TP
string \fIcurrentfile\fR
The path of the file it is currently processing. This may be the empty
string if no such is known.
.TP
string \fIpath\fR
The path of the include file as specified in the include directive
being processed.
.RE
.IP
The result of the command will be a 5-element list containing
.RS
.IP [1]
A boolean flag indicating the success (\fBTrue\fR) or failure
(\fBFalse\fR) of the operation.
.IP [2]
In case of success the contents of the included file, and the
empty string otherwise.
.IP [3]
The resolved, i.e. absolute path of the included file, if
possible, or the unchanged \fIpath\fR argument. This is for
display in an error message, or as the \fIcurrentfile\fR
argument of another call to \fBIncludeFile\fR should this file
contain more files.
.IP [4]
In case of success an empty string, and for failure a code
indicating the reason for it, one of
.RS
.TP
notfound
The specified file could not be found.
.TP
notread
The specified file was found, but not be read into memory.
.RE
.IP [5]
An empty string in case of success of a \fBnotfound\fR
failure, and an additional error message describing the reason
for a \fBnotread\fR error in more detail.
.RE
.RE
.IP [5]
A plugin has to provide one command, with the signature shown
below.
.RS
.TP
\fBimport\fR \fItext\fR \fIconfiguration\fR
Whenever an import manager of \fBdoctools::toc\fR has to parse
input for a table of contents it will invoke this command.
.RS
.TP
string \fItext\fR
This argument will contain the text encoding the table of contents per
the format the plugin is for.
.TP
dictionary \fIconfiguration\fR
This argument will contain the current configuration to apply to the
parsing, as a dictionary mapping from variable names to values.
.sp
The following configuration variables have a predefined meaning all
plugins have to obey, although they can ignore this information at
their discretion. Any other other configuration variables recognized
by a plugin will be described in the manpage for that plugin.
.RS
.TP
user
This variable is expected to contain the name of the user
owning the process invoking the plugin.
.TP
format
This variable is expected to contain the name of the
format whose plugin is invoked.
.RE
.RE
.RE
.IP [6]
A single usage cycle of a plugin consists of the invokations of
the command \fBimport\fR. This call has to leave the plugin in
a state where another usage cycle can be run without problems.
.PP
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
conversion, doctoc, documentation, import, json, manpage, markup, parsing, plugin, reference, table, table of contents, url
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/import_doctoc.n.























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/import_doctoc.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::import::doctoc" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::import::doctoc \- doctoc import plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::import::doctoc  ?0.1?\fR
.sp
package require \fBdoctools::toc::parse \fR
.sp
package require \fBdoctools::toc::structure \fR
.sp
package require \fBdoctools::msgcat \fR
.sp
package require \fBdoctools::tcl::parse \fR
.sp
package require \fBfileutil \fR
.sp
package require \fBlogger \fR
.sp
package require \fBsnit \fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBstruct::set \fR
.sp
package require \fBstruct::stack \fR
.sp
package require \fBstruct::tree \fR
.sp
package require \fBtreeql \fR
.sp
\fBimport\fR \fIstring\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools table of contents import plugin
for the parsing of doctoc markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially \fBdoctools::toc::import\fR, the import manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::toc::import\fR and the import manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
doctoc import plugin API version 2.
.TP
\fBimport\fR \fIstring\fR \fIconfiguration\fR
This command takes the \fIstring\fR and parses it as doctoc
markup encoding a table of contents, in the context of the specified
\fIconfiguration\fR (a dictionary). The result of the command is the
canonical serialization of that table of contents, in the form
specified in section \fBToC serialization format\fR.
.PP
.SH "[DOCTOC] NOTATION OF TABLES OF CONTENTS"
The doctoc format for tables of contents, also called the
\fIdoctoc markup language\fR, is too large to be covered in single
section.
The interested reader should start with the document
.IP [1]
\fIdoctoc language introduction\fR
.PP
and then proceed from there to the formal specifications, i.e. the
documents
.IP [1]
\fIdoctoc language syntax\fR and
.IP [2]
\fIdoctoc language command reference\fR.
.PP
to get a thorough understanding of the language.
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
deserialization, doctoc, doctools, import, table of contents, toc
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/import_json.n.





























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/import_json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::import::json" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::import::json \- JSON import plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::import::json  ?0.1?\fR
.sp
package require \fBdoctools::toc::structure \fR
.sp
package require \fBjson \fR
.sp
\fBimport\fR \fIstring\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
This package implements the doctools table of contents import plugin
for the parsing of JSON markup.
.PP
This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially \fBdoctools::toc::import\fR, the import manager.
.PP
Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
\fBdoctools::toc::import\fR and the import manager objects it
provides.
.SH API
The API provided by this package satisfies the specification of the
doctoc import plugin API version 2.
.TP
\fBimport\fR \fIstring\fR \fIconfiguration\fR
This command takes the \fIstring\fR and parses it as JSON
markup encoding a table of contents, in the context of the specified
\fIconfiguration\fR (a dictionary). The result of the command is the
canonical serialization of that table of contents, in the form
specified in section \fBToC serialization format\fR.
.PP
.SH "JSON NOTATION OF TABLES OF CONTENTS"
The JSON format used for tables of contents is a direct translation of
the \fBToC serialization format\fR, mapping Tcl dictionaries as
JSON objects and Tcl lists as JSON arrays.
For example, the Tcl serialization
.CS


doctools::toc {
    items {
        {reference {
	    desc {DocTools - Tables of Contents}
	     id introduction.man
	     label doctools::toc::introduction
	}}
	{division {
	     id processing.man
	     items {
	         {reference {
		     desc {doctoc serialization utilities}
		     id structure.man
		     label doctools::toc::structure
		 }}
		 {reference {
		     desc {Parsing text in doctoc format}
		     id parse.man
		     label doctools::toc::parse
		 }}
	     }
             label Processing
        }}
    }
    label {Table of Contents}
    title TOC
}

.CE
is equivalent to the JSON string
.CS


{
    "doctools::toc" : {
        "items" : [{
            "reference" : {
                "desc"  : "DocTools - Tables of Contents",
                "id"    : "introduction.man",
                "label" : "doctools::toc::introduction"
            }
        },{
            "division" : {
                "id"    : "processing.man",
                "items" : [{
                    "reference" : {
                        "desc"  : "doctoc serialization utilities",
                        "id"    : "structure.man",
                        "label" : "doctools::toc::structure"
                    }
                },{
                    "reference" : {
                        "desc"  : "Parsing text in doctoc format",
                        "id"    : "parse.man",
                        "label" : "doctools::toc::parse"
                    }
                }],
                "label" : "Processing"
            }
        }],
        "label" : "Table of Contents",
        "title" : "TOC"
    }
}

.CE
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
JSON, deserialization, doctools, import, table of contents, toc
.SH CATEGORY
Text formatter plugin
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/introduction.n.






































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/introduction.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools2toc_introduction" n 2.0 tcllib "Documentation tools"
.BS
.SH NAME
doctools2toc_introduction \- DocTools - Tables of Contents
.SH DESCRIPTION
\fIdoctoc\fR (short for \fIdocumentation tables of contents\fR)
stands for a set of related, yet different, entities which are working
together for the easy creation and transformation of tables and
contents for documentation.
.PP
These are
.IP [1]
A tcl based language for the semantic markup of a table of contents.
Markup is represented by Tcl commands.
Beginners should start with the
\fIdoctoc language introduction\fR.
The formal specification is split over two documents, one dealing with
the \fIdoctoc language syntax\fR, the other a
\fIdoctoc language command reference\fR.
.IP [2]
A set of packages for the programmatic manipulation of tables of
contents in memory, and their conversion between various formats,
reading and writing. The aforementioned markup language is one of the
formats which can be both read from and written to.
.IP [3]
The system for the conversion of tables of contents is based on a
plugin mechanism, for this we have two APIs describing the interface
between the packages above and the import/export plugins.
.PP
.PP
Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.
.PP
.IP [1]
A \fIwriter\fR of documentation has to understand the markup language
itself. A beginner to doctoc should read the more informally written
\fIdoctoc language introduction\fR first. Having digested this
the formal \fIdoctoc language syntax\fR specification should
become understandable. A writer experienced with doctoc may only
need the \fIdoctoc language command reference\fR from time to
time to refresh her memory.
.sp
While a document is written the \fBdtp\fR application can be used
to validate it, and after completion it also performs the conversion
into the chosen system of visual markup, be it *roff, HTML, plain
text, wiki, etc. The simpler \fBdtplite\fR application makes
internal use of doctoc when handling directories of documentation,
automatically generating a proper table of contents for them.
.IP [2]
A \fIprocessor\fR of documentation written in the \fIdoctoc\fR
markup language has to know which tools are available for use.
.sp
The main tool is the aforementioned \fBdtp\fR application provided
by Tcllib. The simpler \fBdtplite\fR does not expose doctoc to the
user. At the bottom level, common to both applications, however we
find the three packages providing the basic facilities to handle
tables of contents, i.e. import from textual formats, programmatic
manipulation in memory, and export to textual formats. These are
.RS
.TP
\fBdoctoools::toc\fR
Programmatic manipulation of tables of contents in memory.
.TP
\fBdoctoools::toc::import\fR
Import of tables of contents from various textual formats. The set of
supported formats is extensible through plugin packages.
.TP
\fBdoctoools::toc::export\fR
Export of tables of contents to various textual formats. The set of
supported formats is extensible through plugin packages.
.RE
.IP
See also section \fBPackage Overview\fR for an overview of the
dependencies between these and other, supporting packages.
.IP [3]
At last, but not least, \fIplugin writers\fR have to understand the
interaction between the import and export packages and their plugins.
These APIs are described in the documentation for the two relevant
packages, i.e.
.RS
.IP \(bu
\fBdoctoools::toc::import\fR
.IP \(bu
\fBdoctoools::toc::export\fR
.RE
.PP
.SH "RELATED FORMATS"
The doctoc format does not stand alone, it has two companion formats.
These are called \fIdocidx\fR and \fIdoctools\fR, and they are
intended for the markup of \fIkeyword indices\fR, and of general
documentation, respectively.
They are described in their own sets of documents, starting at
the \fIDocTools - Keyword Indices\fR and
the \fIDocTools - General\fR, respectively.
.SH "PACKAGE OVERVIEW"
.CS


                                    ~~~~~~~~~~~ doctools::toc ~~~~~~~~~~~
                                   ~~                   |               ~~
                doctools::toc::export ~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~ doctools::toc::import
                        |                               |                       |
        +---------------+-------------------------+     |    +------------------+---------------+-----------------------+---------------+
        |               |                         |     |    |                  |               |                       |               |
doctools::config        =                         |     |    |                  =       doctools::include       doctools::config doctools::paths
                        |                         |     |    |                  |
                doctools::toc::export::<*>        |     |    |          doctools::toc::import::<*>
                        doctoc                    |     |    |                  doctoc, json
                        json                      |     |    |                  |           \\\\
                        html                      |     |    |          doctools::toc::parse \\\\
                        nroff                     |     |    |                  |             \\\\
                        wiki                      |     |    |  +---------------+              json
                        text                      |     |    |  |               |
                                                doctools::toc::structure        |
                                                                                |
                                                                        +-------+---------------+
                                                                        |                       |
          doctools::html  doctools::html::cssdefaults           doctools::tcl::parse    doctools::msgcat
                |                                                                               |
          doctools::text  doctools::nroff::man_macros                                           =
                                                                                                |
                                                                                        doctools::msgcat::toc::<*>
                                                                                                c, en, de, fr
                                                                                                (fr == en for now)
        ~~      Interoperable objects, without actual package dependencies
        --      Package dependency, higher requires lower package
        =       Dynamic dependency through plugin system
        <*>     Multiple packages following the given form of naming.


.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
doctools2doc_introduction, doctools2idx_introduction
.SH KEYWORDS
contents, conversion, formatting, markup, parsing, plugin, semantic markup, table of contents
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/msgcat_c.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/msgcat_c.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat::toc::c" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat::toc::c \- Message catalog for the doctoc parser (C)
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat::toc::c  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat::toc::c\fR is a
support module providing the C language message catalog
for the doctoc parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the package
\fBdoctools::msgcat\fR providing the general message catalog
management within the system. \fINote\fR that there is \fIno\fR
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.
.SH API
This package has no exported API.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
C, catalog package, doctoc, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/msgcat_de.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/msgcat_de.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat::toc::de" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat::toc::de \- Message catalog for the doctoc parser (DE)
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat::toc::de  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat::toc::de\fR is a
support module providing the DE (german) language message catalog
for the doctoc parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the package
\fBdoctools::msgcat\fR providing the general message catalog
management within the system. \fINote\fR that there is \fIno\fR
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.
.SH API
This package has no exported API.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
DE, catalog package, doctoc, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/msgcat_en.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/msgcat_en.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat::toc::en" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat::toc::en \- Message catalog for the doctoc parser (EN)
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat::toc::en  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat::toc::en\fR is a
support module providing the EN (english) language message catalog
for the doctoc parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the package
\fBdoctools::msgcat\fR providing the general message catalog
management within the system. \fINote\fR that there is \fIno\fR
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.
.SH API
This package has no exported API.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EN, catalog package, doctoc, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/msgcat_fr.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/msgcat_fr.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::msgcat::toc::fr" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::msgcat::toc::fr \- Message catalog for the doctoc parser (FR)
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmsgcat \fR
.sp
package require \fBdoctools::msgcat::toc::fr  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
The package \fBdoctools::msgcat::toc::fr\fR is a
support module providing the FR (french) language message catalog
for the doctoc parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.
.PP
If you are such please go the documentation of either
.IP [1]
\fBdoctools::doc\fR,
.IP [2]
\fBdoctools::toc\fR, or
.IP [3]
\fBdoctools::idx\fR
.PP
.PP
Within the system architecture this package resides under the package
\fBdoctools::msgcat\fR providing the general message catalog
management within the system. \fINote\fR that there is \fIno\fR
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.
.SH API
This package has no exported API.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
FR, catalog package, doctoc, doctools, i18n, internationalization, l10n, localization, message catalog, message package
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/parse.n.
























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/parse.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::parse" n 1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::parse \- Parsing text in doctoc format
.SH SYNOPSIS
package require \fBdoctools::toc::parse  ?0.1?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBdoctools::toc::structure \fR
.sp
package require \fBdoctools::msgcat \fR
.sp
package require \fBdoctools::tcl::parse \fR
.sp
package require \fBfileutil \fR
.sp
package require \fBlogger \fR
.sp
package require \fBsnit \fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBstruct::stack \fR
.sp
\fB::doctools::toc::parse\fR \fBtext\fR \fItext\fR
.sp
\fB::doctools::toc::parse\fR \fBfile\fR \fIpath\fR
.sp
\fB::doctools::toc::parse\fR \fBincludes\fR
.sp
\fB::doctools::toc::parse\fR \fBinclude add\fR \fIpath\fR
.sp
\fB::doctools::toc::parse\fR \fBinclude remove\fR \fIpath\fR
.sp
\fB::doctools::toc::parse\fR \fBinclude clear\fR
.sp
\fB::doctools::toc::parse\fR \fBvars\fR
.sp
\fB::doctools::toc::parse\fR \fBvar set\fR \fIname\fR \fIvalue\fR
.sp
\fB::doctools::toc::parse\fR \fBvar unset\fR \fIname\fR
.sp
\fB::doctools::toc::parse\fR \fBvar clear\fR ?\fIpattern\fR?
.sp
.BE
.SH DESCRIPTION
This package provides commands to parse text written in the
\fIdoctoc\fR markup language and convert it into the canonical
serialization of the table of contents encoded in the text.
See the section \fBToC serialization format\fR for specification
of their format.
.PP
This is an internal package of doctools, for use by the higher level
packages handling \fIdoctoc\fR documents.
.SH API
.TP
\fB::doctools::toc::parse\fR \fBtext\fR \fItext\fR
The command takes the string contained in \fItext\fR and parses it
under the assumption that it contains a document written using the
\fIdoctoc\fR markup language. An error is thrown if this assumption
is found to be false. The format of these errors is described in
section \fBParse errors\fR.
.sp
When successful the command returns the canonical serialization of the
table of contents which was encoded in the text.
See the section \fBToC serialization format\fR for specification
of that format.
.TP
\fB::doctools::toc::parse\fR \fBfile\fR \fIpath\fR
The same as \fBtext\fR, except that the text to parse is read from
the file specified by \fIpath\fR.
.TP
\fB::doctools::toc::parse\fR \fBincludes\fR
This method returns the current list of search paths used when looking
for include files.
.TP
\fB::doctools::toc::parse\fR \fBinclude add\fR \fIpath\fR
This method adds the \fIpath\fR to the list of paths searched when
looking for an include file. The call is ignored if the path is
already in the list of paths. The method returns the empty string as
its result.
.TP
\fB::doctools::toc::parse\fR \fBinclude remove\fR \fIpath\fR
This method removes the \fIpath\fR from the list of paths searched
when looking for an include file. The call is ignored if the path is
not contained in the list of paths. The method returns the empty
string as its result.
.TP
\fB::doctools::toc::parse\fR \fBinclude clear\fR
This method clears the list of search paths for include files.
.TP
\fB::doctools::toc::parse\fR \fBvars\fR
This method returns a dictionary containing the current set of
predefined variables known to the \fBvset\fR markup command during
processing.
.TP
\fB::doctools::toc::parse\fR \fBvar set\fR \fIname\fR \fIvalue\fR
This method adds the variable \fIname\fR to the set of predefined
variables known to the \fBvset\fR markup command during processing,
and gives it the specified \fIvalue\fR. The method returns the empty
string as its result.
.TP
\fB::doctools::toc::parse\fR \fBvar unset\fR \fIname\fR
This method removes the variable \fIname\fR from the set of predefined
variables known to the \fBvset\fR markup command during
processing. The method returns the empty string as its result.
.TP
\fB::doctools::toc::parse\fR \fBvar clear\fR ?\fIpattern\fR?
This method removes all variables matching the \fIpattern\fR from the
set of predefined variables known to the \fBvset\fR markup command
during processing. The method returns the empty string as its result.
.sp
The pattern matching is done with \fBstring match\fR, and the
default pattern used when none is specified, is \fB*\fR.
.PP
.SH "PARSE ERRORS"
The format of the parse error messages thrown when encountering
violations of the \fIdoctoc\fR markup syntax is human readable and
not intended for processing by machines. As such it is not documented.
.PP
\fIHowever\fR, the errorCode attached to the message is
machine-readable and has the following format:
.IP [1]
The error code will be a list, each element describing a single error
found in the input. The list has at least one element, possibly more.
.IP [2]
Each error element will be a list containing six strings describing an
error in detail. The strings will be
.RS
.IP [1]
The path of the file the error occured in. This may be empty.
.IP [2]
The range of the token the error was found at. This range is a
two-element list containing the offset of the first and last character
in the range, counted from the beginning of the input (file). Offsets
are counted from zero.
.IP [3]
The line the first character after the error is on.
Lines are counted from one.
.IP [4]
The column the first character after the error is at.
Columns are counted from zero.
.IP [5]
The message code of the error. This value can be used as argument to
\fBmsgcat::mc\fR to obtain a localized error message, assuming that
the application had a suitable call of \fBdoctools::msgcat::init\fR to
initialize the necessary message catalogs (See package
\fBdoctools::msgcat\fR).
.IP [6]
A list of details for the error, like the markup command involved. In
the case of message code \fBdoctoc/include/syntax\fR this value is
the set of errors found in the included file, using the format
described here.
.RE
.PP
.SH "[DOCTOC] NOTATION OF TABLES OF CONTENTS"
The doctoc format for tables of contents, also called the
\fIdoctoc markup language\fR, is too large to be covered in single
section.
The interested reader should start with the document
.IP [1]
\fIdoctoc language introduction\fR
.PP
and then proceed from there to the formal specifications, i.e. the
documents
.IP [1]
\fIdoctoc language syntax\fR and
.IP [2]
\fIdoctoc language command reference\fR.
.PP
to get a thorough understanding of the language.
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
doctoc, doctools, lexer, parser
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/doctools2toc/structure.n.

































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/doctools2toc/structure.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "doctools::toc::structure" n 0.1 tcllib "Documentation tools"
.BS
.SH NAME
doctools::toc::structure \- Doctoc serialization utilities
.SH SYNOPSIS
package require \fBdoctools::toc::structure  ?0.1?\fR
.sp
package require \fBTcl  8.4\fR
.sp
package require \fBlogger \fR
.sp
package require \fBsnit \fR
.sp
\fB::doctools::toc::structure\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
.sp
\fB::doctools::toc::structure\fR \fBverify-as-canonical\fR \fIserial\fR
.sp
\fB::doctools::toc::structure\fR \fBcanonicalize\fR \fIserial\fR
.sp
\fB::doctools::toc::structure\fR \fBprint\fR \fIserial\fR
.sp
\fB::doctools::toc::structure\fR \fBmerge\fR \fIseriala\fR \fIserialb\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands to work with the serializations of
tables of contents as managed by the doctools system v2, and specified
in section \fBToC serialization format\fR.
.PP
This is an internal package of doctools, for use by the higher level
packages handling tables of contents and their conversion into and out
of various other formats, like documents written using \fIdoctoc\fR
markup.
.SH API
.TP
\fB::doctools::toc::structure\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
This command verifies that the content of \fIserial\fR is a valid
\fIregular\fR serialization of a table of contents and will throw an
error if that is not the case. The result of the command is the empty
string.
.sp
If the argument \fIcanonvar\fR is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if \fIserial\fR is a valid regular
serialization. Its value will be a boolean, with \fBTrue\fR
indicating that the serialization is not only valid, but also
\fIcanonical\fR. \fBFalse\fR will be written for a valid, but
non-canonical serialization.
.sp
For the specification of regular and canonical serializations see the
section \fBToC serialization format\fR.
.TP
\fB::doctools::toc::structure\fR \fBverify-as-canonical\fR \fIserial\fR
This command verifies that the content of \fIserial\fR is a valid
\fIcanonical\fR serialization of a table of contents and will throw
an error if that is not the case. The result of the command is the
empty string.
.sp
For the specification of canonical serializations see the section
\fBToC serialization format\fR.
.TP
\fB::doctools::toc::structure\fR \fBcanonicalize\fR \fIserial\fR
This command assumes that the content of \fIserial\fR is a valid
\fIregular\fR serialization of a table of contents and will throw an
error if that is not the case.
.sp
It will then convert the input into the \fIcanonical\fR serialization
of the contained table of contents and return it as its result. If the
input is already canonical it will be returned unchanged.
.sp
For the specification of regular and canonical serializations see the
section \fBToC serialization format\fR.
.TP
\fB::doctools::toc::structure\fR \fBprint\fR \fIserial\fR
This command assumes that the argument \fIserial\fR contains a valid
regular serialization of a table of contents and returns a string
containing that table in a human readable form.
.sp
The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.
.sp
For the specification of regular serializations see the section
\fBToC serialization format\fR.
.TP
\fB::doctools::toc::structure\fR \fBmerge\fR \fIseriala\fR \fIserialb\fR
This command accepts the regular serializations of two tables of
contents and uses them to create their union.  The result of the
command is the canonical serialization of this unified table of
contents.
.sp
Title and label of the resulting table are taken from the table
contained in \fIserialb\fR.
.sp
The whole table and its divisions are merged recursively in the same
manner:
.RS
.IP [1]
All reference elements which occur in both divisions (identified by
their label) are unified with document id's and descriptions taken
from the second table.
.IP [2]
All division elements which occur in both divisions (identified by
their label) are unified with the optional document id taken from the
second table, if any, or from the first if none is in the second. The
elements in the division are merged recursively using the same
algorithm as described in this list.
.IP [3]
Type conflicts between elements, i.e. finding two elements with the
same label but different types result in a merge error.
.IP [4]
All elements found in the second division but not in the first are
added to the end of the list of elements in the merge result.
.RE
.sp
For the specification of regular and canonical serializations see the
section \fBToC serialization format\fR.
.PP
.SH "TOC SERIALIZATION FORMAT"
Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be \fIcanonical\fR.
.PP
.TP
regular serialization
.RS
.IP [1]
The serialization of any table of contents is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBdoctools::toc\fR, and its
value. This value holds the contents of the table of contents.
.IP [3]
The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are
.RS
.TP
\fBtitle\fR
The value is a string containing the title of the table of contents.
.TP
\fBlabel\fR
The value is a string containing a label for the table of contents.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the table, in the
order they are to be shown.
.sp
Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.
.sp
The two legal item types and their descriptions are
.RS
.TP
\fBreference\fR
This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the entry.
.TP
\fBlabel\fR
The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBdesc\fR
The value is a string containing a longer description for this entry.
.RE
.TP
\fBdivision\fR
This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are
.RS
.TP
\fBid\fR
The value is a string containing the id of the document associated
with the whole group. This key is optional.
.TP
\fBlabel\fR
The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.
.TP
\fBitems\fR
The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
\fBitems\fR used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.
.RE
.RE
.RE
.RE
.TP
canonical serialization
The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIdoctools\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
deserialization, doctoc, doctools, serialization
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/exif/exif.n.


























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/exif/exif.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "exif" n 1.1.2 tcllib "EXIF parsing"
.BS
.SH NAME
exif \- Tcl EXIF extracts and parses EXIF fields from digital images
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBexif  ?1.1.2?\fR
.sp
\fBexif::analyze\fR \fIchannel\fR ?\fIthumbnail\fR?
.sp
\fBexif::analyzeFile\fR \fIfilename\fR ?\fIthumbnail\fR?
.sp
\fBexif::fieldnames\fR
.sp
.BE
.SH DESCRIPTION
.PP
The EXIF package is a recoding of Chris Breeze's Perl package to do
the same thing.  This version accepts a channel as input and returns a
serialized array with all the recognised fields parsed out.
.PP
There is also a function to obtain a list of all possible field names
that might be present, which is useful in building GUIs that present
such information.
.SH COMMANDS
.TP
\fBexif::analyze\fR \fIchannel\fR ?\fIthumbnail\fR?
\fIchannel\fR should be an open file handle rewound to the start.  It
does not need to be seekable.  \fIchannel\fR will be set to binary
mode and is left wherever it happens to stop being parsed, usually at
the end of the file or the start of the image data.  You must open and
close the stream yourself.  If no error is thrown, the return value is
a serialized array with informative English text about what was found
in the EXIF block.  Failure during parsing or I/O throw errors.
.sp
If \fIthumbnail\fR is present and not the empty string it will be
interpreted as the name of a file, and the thumbnail image contained
in the exif data will be written into it.
.TP
\fBexif::analyzeFile\fR \fIfilename\fR ?\fIthumbnail\fR?
This is a file-based wrapper around \fBexif::analyze\fR. Instead of
taking a stream it takes a \fIfilename\fR and analyzes the contents of
the specified file.
.TP
\fBexif::fieldnames\fR
This returns a list of all possible field names.  That is, the array
returned by \fBexif::analyze\fR will not contain keys that are not
listed in the return from \fBexif::fieldnames\fR.  Of course, if
information is missing in the image file, \fBexif::analyze\fR may not
return all the fields listed in the return from exif::fieldnames.
This function is expected to be primarily useful for building GUIs to
display results.
.sp
N.B.: Read the implementation of \fBexif::fieldnames\fR before
modifying the implementation of \fBexif::analyze\fR.
.PP
.SH COPYRIGHTS
(c) 2002 Darren New
Hold harmless the author, and any lawful use is allowed.
.SH ACKNOWLEDGEMENTS
This code is a direct translation of version 1.3 of exif.pl by Chris
Breeze.  See the source for full headers, references, etc.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIexif\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
exif, jpeg, maker note, tiff
.SH CATEGORY
File formats

Added embedded/man/files/modules/fileutil/fileutil.n.









































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fileutil/fileutil.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil" n 1.14.5 tcllib "file utilities"
.BS
.SH NAME
fileutil \- Procedures implementing some file utilities
.SH SYNOPSIS
package require \fBTcl  8\fR
.sp
package require \fBfileutil  ?1.14.5?\fR
.sp
\fB::fileutil::lexnormalize\fR \fIpath\fR
.sp
\fB::fileutil::fullnormalize\fR \fIpath\fR
.sp
\fB::fileutil::test\fR \fIpath\fR \fIcodes\fR ?\fImsgvar\fR? ?\fIlabel\fR?
.sp
\fB::fileutil::cat\fR (?\fIoptions\fR? \fIfile\fR)...
.sp
\fB::fileutil::writeFile\fR ?\fIoptions\fR? \fIfile\fR \fIdata\fR
.sp
\fB::fileutil::appendToFile\fR ?\fIoptions\fR? \fIfile\fR \fIdata\fR
.sp
\fB::fileutil::insertIntoFile\fR ?\fIoptions\fR? \fIfile\fR \fIat\fR \fIdata\fR
.sp
\fB::fileutil::removeFromFile\fR ?\fIoptions\fR? \fIfile\fR \fIat\fR \fIn\fR
.sp
\fB::fileutil::replaceInFile\fR ?\fIoptions\fR? \fIfile\fR \fIat\fR \fIn\fR \fIdata\fR
.sp
\fB::fileutil::updateInPlace\fR ?\fIoptions\fR? \fIfile\fR \fIcmd\fR
.sp
\fB::fileutil::fileType\fR \fIfilename\fR
.sp
\fB::fileutil::find\fR ?\fIbasedir\fR ?\fIfiltercmd\fR??
.sp
\fB::fileutil::findByPattern\fR \fIbasedir\fR ?\fB-regexp\fR|\fB-glob\fR? ?\fB--\fR? \fIpatterns\fR
.sp
\fB::fileutil::foreachLine\fR \fIvar filename cmd\fR
.sp
\fB::fileutil::grep\fR \fIpattern\fR ?\fIfiles\fR?
.sp
\fB::fileutil::install\fR ?\fB-m\fR \fImode\fR? \fIsource\fR \fIdestination\fR
.sp
\fB::fileutil::stripN\fR \fIpath\fR \fIn\fR
.sp
\fB::fileutil::stripPwd\fR \fIpath\fR
.sp
\fB::fileutil::stripPath\fR \fIprefix\fR \fIpath\fR
.sp
\fB::fileutil::jail\fR \fIjail\fR \fIpath\fR
.sp
\fB::fileutil::touch\fR ?\fB-a\fR? ?\fB-c\fR? ?\fB-m\fR? ?\fB-r\fR \fIref_file\fR? ?\fB-t\fR \fItime\fR? \fIfilename\fR ?\fI...\fR?
.sp
\fB::fileutil::tempdir\fR
.sp
\fB::fileutil::tempdir\fR \fIpath\fR
.sp
\fB::fileutil::tempdirReset\fR
.sp
\fB::fileutil::tempfile\fR ?\fIprefix\fR?
.sp
\fB::fileutil::relative\fR \fIbase\fR \fIdst\fR
.sp
\fB::fileutil::relativeUrl\fR \fIbase\fR \fIdst\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides implementations of standard unix utilities.
.TP
\fB::fileutil::lexnormalize\fR \fIpath\fR
This command performs purely lexical normalization on the \fIpath\fR and returns
the changed path as its result. Symbolic links in the path are \fInot\fR resolved.
.sp
Examples:
.CS


    fileutil::lexnormalize /foo/./bar
    => /foo/bar

    fileutil::lexnormalize /foo/../bar
    => /bar

.CE
.TP
\fB::fileutil::fullnormalize\fR \fIpath\fR
This command resolves all symbolic links in the \fIpath\fR and returns
the changed path as its result.
In contrast to the builtin \fBfile normalize\fR this command
resolves a symbolic link in the last element of the path as well.
.TP
\fB::fileutil::test\fR \fIpath\fR \fIcodes\fR ?\fImsgvar\fR? ?\fIlabel\fR?
A command for the testing of several properties of a \fIpath\fR. The
properties to test for are specified in \fIcodes\fR, either as a list
of keywords describing the properties, or as a string where each
letter is a shorthand for a property to test. The recognized keywords,
shorthands, and associated properties are shown in the list below. The
tests are executed in the order given to the command.
.sp
The result of the command is a boolean value. It will be true if and
only if the \fIpath\fR passes all the specified tests.
In the case of the \fIpath\fR not passing one or more test the first
failing test will leave a message in the variable referenced by
\fImsgvar\fR, if such is specified. The message will be prefixed with
\fIlabel\fR, if it is specified.
\fINote\fR that the variabled referenced by \fImsgvar\fR is not touched at
all if all the tests pass.
.sp
.RS
.TP
\fIr\fRead
\fBfile readable\fR
.TP
\fIw\fRrite
\fBfile writable\fR
.TP
\fIe\fRxists
\fBfile exists\fR
.TP
e\fIx\fRec
\fBfile executable\fR
.TP
\fIf\fRile
\fBfile isfile\fR
.TP
\fId\fRir
\fBfile isdirectory\fR
.RE
.TP
\fB::fileutil::cat\fR (?\fIoptions\fR? \fIfile\fR)...
A tcl implementation of the UNIX \fBcat\fR command.  Returns the
contents of the specified file(s). The arguments are files to read,
with interspersed options configuring the process. If there are
problems reading any of the files, an error will occur, and no data
will be returned.
.sp
The options accepted are \fB-encoding\fR, \fB-translation\fR,
\fB-eofchar\fR, and \fB--\fR. With the exception of the last all
options take a single value as argument, as specified by the tcl
builtin command \fBfconfigure\fR. The \fB--\fR has to be used to
terminate option processing before a file if that file's name begins
with a dash.
.sp
Each file can have its own set of options coming before it, and for
anything not specified directly the defaults are inherited from the
options of the previous file. The first file inherits the system
default for unspecified options.
.TP
\fB::fileutil::writeFile\fR ?\fIoptions\fR? \fIfile\fR \fIdata\fR
The command replaces the current contents of the specified \fIfile\fR
with \fIdata\fR, with the process configured by the options. The
command accepts the same options as \fB::fileutil::cat\fR. The
specification of a non-existent file is legal and causes the command
to create the file (and all required but missing directories).
.TP
\fB::fileutil::appendToFile\fR ?\fIoptions\fR? \fIfile\fR \fIdata\fR
This command is like \fB::fileutil::writeFile\fR, except that the
previous contents of \fIfile\fR are not replaced, but appended to. The
command accepts the same options as \fB::fileutil::cat\fR
.TP
\fB::fileutil::insertIntoFile\fR ?\fIoptions\fR? \fIfile\fR \fIat\fR \fIdata\fR
This comment is similar to \fB::fileutil::appendToFile\fR, except that
the new data is not appended at the end, but inserted at a specified
location within the file. In further contrast this command has to be
given the path to an existing file. It will not create a missing file,
but throw an error instead.
.sp
The specified location \fIat\fR has to be an integer number in the
range \fB0\fR ... [file size \fIfile\fR]. \fB0\fR will cause
insertion of the new data before the first character of the existing
content, whereas [file size \fIfile\fR] causes insertion after
the last character of the existing content, i.e. appending.
.sp
The command accepts the same options as \fB::fileutil::cat\fR.
.TP
\fB::fileutil::removeFromFile\fR ?\fIoptions\fR? \fIfile\fR \fIat\fR \fIn\fR
This command is the complement to \fB::fileutil::insertIntoFile\fR, removing \fIn\fR characters from the \fIfile\fR, starting at location \fIat\fR.
The specified location \fIat\fR has to be an integer number in the
range \fB0\fR ... [file size \fIfile\fR] - \fIn\fR. \fB0\fR
will cause the removal of the new data to start with the first
character of the existing content,
whereas [file size \fIfile\fR] - \fIn\fR causes the removal of
the tail of the existing content, i.e. the truncation of the file.
.sp
The command accepts the same options as \fB::fileutil::cat\fR.
.TP
\fB::fileutil::replaceInFile\fR ?\fIoptions\fR? \fIfile\fR \fIat\fR \fIn\fR \fIdata\fR
This command is a combination of \fB::fileutil::removeFromFile\fR and
\fB::fileutil::insertIntoFile\fR. It first removes the part of the
contents specified by the arguments \fIat\fR and \fIn\fR, and then
inserts \fIdata\fR at the given location, effectively replacing the
removed by content with \fIdata\fR.
All constraints imposed on \fIat\fR and \fIn\fR by
\fB::fileutil::removeFromFile\fR and \fB::fileutil::insertIntoFile\fR
are obeyed.
.sp
The command accepts the same options as \fB::fileutil::cat\fR.
.TP
\fB::fileutil::updateInPlace\fR ?\fIoptions\fR? \fIfile\fR \fIcmd\fR
This command can be seen as the generic core functionality of
\fB::fileutil::replaceInFile\fR.
It first reads the contents of the specified \fIfile\fR, then runs the
command prefix \fIcmd\fR with that data appended to it, and at last
writes the result of that invokation back as the new contents of the
file.
.sp
If the executed command throws an error the \fIfile\fR is not changed.
.sp
The command accepts the same options as \fB::fileutil::cat\fR.
.TP
\fB::fileutil::fileType\fR \fIfilename\fR
An implementation of the UNIX \fBfile\fR command, which uses
various heuristics to guess the type of a file.  Returns a list
specifying as much type information as can be determined about the
file, from most general (eg, "binary" or "text") to most specific (eg,
"gif").  For example, the return value for a GIF file would be "binary
graphic gif".  The command will detect the following types of files:
directory, empty, binary, text, script (with interpreter), executable
elf, executable dos, executable ne, executable pe, graphic gif, graphic
jpeg, graphic png, graphic tiff, graphic bitmap, html, xml (with doctype
if available), message pgp, binary pdf, text ps, text eps, binary
gravity_wave_data_frame, compressed bzip, compressed gzip, compressed
zip, compressed tar, audio wave, audio mpeg, and link. It further
detects doctools, doctoc, and docidx documentation files, and
tklib diagrams.
.TP
\fB::fileutil::find\fR ?\fIbasedir\fR ?\fIfiltercmd\fR??
An implementation of the unix command \fBfind\fR. Adapted from the
Tcler's Wiki. Takes at most two arguments, the path to the directory
to start searching from and a command to use to evaluate interest in
each file. The path defaults to "\fI.\fR", i.e. the current
directory. The command defaults to the empty string, which means that
all files are of interest. The command takes care \fInot\fR to
lose itself in infinite loops upon encountering circular link
structures. The result of the command is a list containing the paths
to the interesting files.
.sp
The \fIfiltercmd\fR, if specified, is interpreted as a command prefix
and one argument is added to it, the name of the file or directory
find is currently looking at. Note that this name is \fInot\fR fully
qualified. It has to be joined it with the result of \fBpwd\fR to get
an absolute filename.
.sp
The result of \fIfiltercmd\fR is a boolean value that indicates if the
current file should be included in the list of interesting files.
.sp
Example:
.sp
.CS


    # find .tcl files
    package require fileutil
    proc is_tcl {name} {return [string match *.tcl $name]}
    set tcl_files [fileutil::find . is_tcl]

.CE
.TP
\fB::fileutil::findByPattern\fR \fIbasedir\fR ?\fB-regexp\fR|\fB-glob\fR? ?\fB--\fR? \fIpatterns\fR
This command is based upon the \fBTclX\fR command
\fBrecursive_glob\fR, except that it doesn't allow recursion over more
than one directory at a time. It uses \fB::fileutil::find\fR
internally and is thus able to and does follow symbolic links,
something the \fBTclX\fR command does not do. First argument is
the directory to start the search in, second argument is a list of
\fIpatterns\fR. The command returns a list of all files reachable
through \fIbasedir\fR whose names match at least one of the
patterns. The options before the pattern-list determine the style of
matching, either regexp or glob. glob-style matching is the default if
no options are given. Usage of the option \fB--\fR stops option
processing. This allows the use of a leading '-' in the patterns.
.TP
\fB::fileutil::foreachLine\fR \fIvar filename cmd\fR
The command reads the file \fIfilename\fR and executes the script
\fIcmd\fR for every line in the file. During the execution of the
script the variable \fIvar\fR is set to the contents of the current
line. The return value of this command is the result of the last
invocation of the script \fIcmd\fR or the empty string if the file was
empty.
.TP
\fB::fileutil::grep\fR \fIpattern\fR ?\fIfiles\fR?
Implementation of \fBgrep\fR. Adapted from the Tcler's Wiki. The
first argument defines the \fIpattern\fR to search for. This is
followed by a list of \fIfiles\fR to search through. The list is
optional and \fBstdin\fR will be used if it is missing. The result
of the procedures is a list containing the matches. Each match is a
single element of the list and contains filename, number and contents
of the matching line, separated by a colons.
.TP
\fB::fileutil::install\fR ?\fB-m\fR \fImode\fR? \fIsource\fR \fIdestination\fR
The \fBinstall\fR command is similar in functionality to the \fBinstall\fR
command found on many unix systems, or the shell script
distributed with many source distributions (unix/install-sh in the Tcl
sources, for example).  It copies \fIsource\fR, which can be either a
file or directory to \fIdestination\fR, which should be a directory,
unless \fIsource\fR is also a single file.  The ?-m? option lets
the user specify a unix-style mode (either octal or symbolic - see
\fBfile attributes\fR.
.TP
\fB::fileutil::stripN\fR \fIpath\fR \fIn\fR
Removes the first \fIn\fR elements from the specified \fIpath\fR and
returns the modified path. If \fIn\fR is greater than the number of
components in \fIpath\fR an empty string is returned. The number of
components in a given path may be determined by performing
\fBllength\fR on the list returned by \fBfile split\fR.
.TP
\fB::fileutil::stripPwd\fR \fIpath\fR
If, and only if the \fIpath\fR is inside of the directory returned by
[\fBpwd\fR] (or the current working directory itself) it is made
relative to that directory. In other words, the current working
directory is stripped from the \fIpath\fR.  The possibly modified path
is returned as the result of the command. If the current working
directory itself was specified for \fIpath\fR the result is the string
"\fB.\fR".
.TP
\fB::fileutil::stripPath\fR \fIprefix\fR \fIpath\fR
If, and only of the \fIpath\fR is inside of the directory
"\fIprefix\fR" (or the prefix directory itself) it is made relative to
that directory. In other words, the prefix directory is stripped from
the \fIpath\fR. The possibly modified path is returned as the result
of the command.
If the prefix directory itself was specified for \fIpath\fR the result
is the string "\fB.\fR".
.TP
\fB::fileutil::jail\fR \fIjail\fR \fIpath\fR
This command ensures that the \fIpath\fR is not escaping the directory
\fIjail\fR. It always returns an absolute path derived from \fIpath\fR
which is within \fIjail\fR.
.sp
If \fIpath\fR is an absolute path and already within \fIjail\fR it is
returned unmodified.
.sp
An absolute path outside of \fIjail\fR is stripped of its root element
and then put into the \fIjail\fR by prefixing it with it. The same
happens if \fIpath\fR is relative, except that nothing is stripped of
it. Before adding the \fIjail\fR prefix the \fIpath\fR is lexically
normalized to prevent the caller from using \fB..\fR segments in
\fIpath\fR to escape the jail.
.TP
\fB::fileutil::touch\fR ?\fB-a\fR? ?\fB-c\fR? ?\fB-m\fR? ?\fB-r\fR \fIref_file\fR? ?\fB-t\fR \fItime\fR? \fIfilename\fR ?\fI...\fR?
Implementation of \fBtouch\fR. Alter the atime and mtime of the
specified files. If \fB-c\fR, do not create files if they do not
already exist. If \fB-r\fR, use the atime and mtime from
\fIref_file\fR. If \fB-t\fR, use the integer clock value
\fItime\fR. It is illegal to specify both \fB-r\fR and
\fB-t\fR. If \fB-a\fR, only change the atime. If \fB-m\fR,
only change the mtime.
.sp
\fIThis command is not available for Tcl versions less than 8.3.\fR
.TP
\fB::fileutil::tempdir\fR
The command returns the path of a directory where the caller can
place temporary files, such as "\fI/tmp\fR" on Unix systems. The
algorithm we use to find the correct directory is as follows:
.RS
.IP [1]
The directory set by an invokation of \fB::fileutil::tempdir\fR with
an argument. If this is present it is tried exclusively and none of
the following item are tried.
.IP [2]
The directory named in the TMPDIR environment variable.
.IP [3]
The directory named in the TEMP environment variable.
.IP [4]
The directory named in the TMP environment variable.
.IP [5]
A platform specific location:
.RS
.TP
Windows
"\fIC:\\TEMP\fR", "\fIC:\\TMP\fR", "\fI\\TEMP\fR",
and "\fI\\TMP\fR" are tried in that order.
.TP
(classic) Macintosh
The TRASH_FOLDER environment variable is used.  This is most likely
not correct.
.TP
Unix
The directories "\fI/tmp\fR", "\fI/var/tmp\fR", and "\fI/usr/tmp\fR" are
tried in that order.
.RE
.RE
.sp
The algorithm utilized is mainly that used in the Python standard
library. The exception is the first item, the ability to have the
search overridden by a user-specified directory.
.TP
\fB::fileutil::tempdir\fR \fIpath\fR
In this mode the command sets the \fIpath\fR as the first and only
directory to try as a temp. directory. See the previous item for the
use of the set directory. The command returns the empty string.
.TP
\fB::fileutil::tempdirReset\fR
Invoking this command clears the information set by the
last call of [\fB::fileutil::tempdir\fR \fIpath\fR].
See the last item too.
.TP
\fB::fileutil::tempfile\fR ?\fIprefix\fR?
The command generates a temporary file name suitable for writing to,
and the associated file.  The file name will be unique, and the file
will be writable and contained in the appropriate system specific temp
directory. The name of the file will be returned as the result of the
command.
.sp
The code was taken from \fIhttp://wiki.tcl.tk/772\fR, attributed to
Igor Volobouev and anon.
.TP
\fB::fileutil::relative\fR \fIbase\fR \fIdst\fR
This command takes two directory paths, both either absolute or relative
and computes the path of \fIdst\fR relative to \fIbase\fR. This relative
path is returned as the result of the command. As implied in the previous
sentence, the command is not able to compute this relationship between the
arguments if one of the paths is absolute and the other relative.
.sp
\fINote:\fR The processing done by this command is purely lexical.
Symbolic links are \fInot\fR taken into account.
.TP
\fB::fileutil::relativeUrl\fR \fIbase\fR \fIdst\fR
This command takes two file paths, both either absolute or relative
and computes the path of \fIdst\fR relative to \fIbase\fR, as seen
from inside of the \fIbase\fR. This is the algorithm how a browser
resolves a relative link found in the currently shown file.
.sp
The computed relative path is returned as the result of the command.
As implied in the previous sentence, the command is not able to compute
this relationship between the arguments if one of the paths is absolute
and the other relative.
.sp
\fINote:\fR The processing done by this command is purely lexical.
Symbolic links are \fInot\fR taken into account.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
cat, file utilities, grep, temp file, test, touch, type
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/fileutil/multi.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fileutil/multi.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil::multi" n 0.1 tcllib "file utilities"
.BS
.SH NAME
fileutil::multi \- Multi-file operation, scatter/gather, standard object
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBfileutil::multi  ?0.1?\fR
.sp
package require \fBfileutil::multi::op  ?0.1?\fR
.sp
package require \fBwip  ?1.0?\fR
.sp
\fB::fileutil::multi\fR ?\fIword\fR...?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a single command to perform actions on multiple
files selected by glob patterns. It is a thin layer over the package
\fBfileutil::multi::op\fR which provides objects for the
same. This package simply creates a single such object and directs all
file commands to it.
.PP
At the core is a domain specific language allowing the easy
specification of multi-file copy and/or move and/or deletion
operations. Alternate names would be scatter/gather processor, or
maybe even assembler.
For the detailed specification of this language, and examples, please
see the documention for the package \fBfileutil::multi::op\fR.
.SH "PUBLIC API"
The main command of the package is:
.TP
\fB::fileutil::multi\fR ?\fIword\fR...?
This command interprets the specified words as file commands to
execute. See the section \fBFILE API\fR of the
documentation for the package \fBfileutil::multi::op\fR for
the set of acceptable commands, their syntax, and semantics.
.sp
The result of the command is the result generated by the last file
command it executed.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
copy, file utilities, move, multi-file, remove
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/fileutil/multiop.n.






















































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fileutil/multiop.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil::multi::op" n 0.5.3 tcllib "file utilities"
.BS
.SH NAME
fileutil::multi::op \- Multi-file operation, scatter/gather
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBfileutil::multi::op  ?0.5.3?\fR
.sp
package require \fBwip  ?1.0?\fR
.sp
\fB::fileutil::multi::op\fR ?\fIopName\fR? ?\fIword\fR...?
.sp
\fBopName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fB$opName\fR \fBdo\fR ?\fIword\fR...?
.sp
\fBinto\fR \fIdirectory\fR
.sp
\fBin\fR \fIdirectory\fR
.sp
\fBto\fR \fIdirectory\fR
.sp
\fBfrom\fR \fIdirectory\fR
.sp
\fBnot\fR \fIpattern\fR
.sp
\fBfor\fR \fIpattern\fR
.sp
\fBexclude\fR \fIpattern\fR
.sp
\fBbut\fR
.sp
\fBexcept\fR
.sp
\fBas\fR \fIname\fR
.sp
\fBrecursive\fR
.sp
\fBrecursively\fR
.sp
\fBcopy\fR
.sp
\fBmove\fR
.sp
\fBremove\fR
.sp
\fBexpand\fR
.sp
\fBinvoke\fR \fIcmdprefix\fR
.sp
\fBreset\fR
.sp
\fB(\fR
.sp
\fB)\fR
.sp
\fBcd\fR \fIdirectory\fR
.sp
\fBup\fR
.sp
\fBfor-windows\fR
.sp
\fBfor-win\fR
.sp
\fBfor-unix\fR
.sp
\fBthe\fR \fIpattern\fR
.sp
\fBthe-set\fR \fIvarname\fR
.sp
\fB->\fR \fIvarname\fR
.sp
\fBstrict\fR
.sp
\fB!strict\fR
.sp
\fBfiles\fR
.sp
\fBlinks\fR
.sp
\fBdirectories\fR
.sp
\fBdirs\fR
.sp
\fBall\fR
.sp
\fBstate?\fR
.sp
\fBas?\fR
.sp
\fBexcluded?\fR
.sp
\fBfrom?\fR
.sp
\fBinto?\fR
.sp
\fBoperation?\fR
.sp
\fBrecursive?\fR
.sp
\fBstrict?\fR
.sp
\fBtype?\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides objects which are able to perform actions on
multiple files selected by glob patterns.
.PP
At the core is a domain specific language allowing the easy
specification of multi-file copy and/or move and/or deletion
operations. Alternate names would be scatter/gather processor, or
maybe even assembler.
.SH "CLASS API"
The main command of the package is:
.TP
\fB::fileutil::multi::op\fR ?\fIopName\fR? ?\fIword\fR...?
The command creates a new multi-file operation object with an
associated global Tcl command whose name is \fIopName\fR.  This
command can be used to invoke the various possible file operations.
It has the following general form:
.RS
.TP
\fBopName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.RE
.sp
If the string \fB%AUTO%\fR is used as the \fIopName\fR then the
package will generate a unique name on its own.
.sp
If one or more \fIword\fRs are specified they are interpreted as an
initial set of file commands to execute. I.e. the method \fBdo\fR
of the newly constructed object is implicitly invoked using the words
as its arguments.
.PP
.PP
.SH "OBJECT API"
The following methods are possible for multi-file operation objects:
.TP
\fB$opName\fR \fBdo\fR ?\fIword\fR...?
This method interprets the specified words as file commands to
execute. See the section \fBFILE API\fR for the set of
acceptable commands, their syntax, and semantics.
.sp
The result of the method is the result generated by the last file
command it executed.
.PP
.SH "FILE API"
Both object constructor and method \fBdo\fR take a list of words
and interpret them as file commands to execute. The names were chosen
to allow the construction of operations as sentences in near-natural
language. Most of the commands influence just the state of the object,
i.e. are simply providing the configuration used by the command
triggering the actual action.
.TP
\fBinto\fR \fIdirectory\fR
Specifies the destination directory for operations.
.TP
\fBin\fR \fIdirectory\fR
Alias for \fBinto\fR.
.TP
\fBto\fR \fIdirectory\fR
Alias for \fBinto\fR.
.TP
\fBfrom\fR \fIdirectory\fR
Specifies the source directory for operations.
.TP
\fBnot\fR \fIpattern\fR
Specifies a glob pattern for paths to be excluded from the operation.
.TP
\fBfor\fR \fIpattern\fR
Alias for \fBnot\fR.
.TP
\fBexclude\fR \fIpattern\fR
Alias for \fBnot\fR.
.TP
\fBbut\fR
Has no arguments of its own, but looks ahead in the list of words and
executes all \fBnot\fR commands immediately following it. This allows the
construction of "but not" and "but exclude" clauses for a more natural
sounding specification of excluded paths.
.TP
\fBexcept\fR
A semi-alias for \fBbut\fR. Has no arguments of its own, but looks
ahead in the list of words and executes all \fBfor\fR commands
immediately following it. This allows the construction of "except for"
clauses for a more natural sounding specification of excluded paths.
.TP
\fBas\fR \fIname\fR
Specifies a new name for the first file handled by the current
operation. I.e. for the renaming of a single file during the
operation.
.TP
\fBrecursive\fR
Signals that file expansion should happen in the whole directory
hierarchy and not just the directory itself.
.TP
\fBrecursively\fR
An alias for \fBrecursive\fR.
.TP
\fBcopy\fR
Signals that the operation is the copying of files from source to
destination directory per the specified inclusion and exclusion
patterns.
.TP
\fBmove\fR
Signals that the operation is the moving of files from source to
destination directory per the specified inclusion and exclusion
patterns.
.TP
\fBremove\fR
Signals that the operation is the removal of files in the destination
directory per the specified inclusion and exclusion patterns.
.TP
\fBexpand\fR
Signals that there is no operation but the calculation of the set of
files from the include and exclude patterns. This operation is not
available if \fBthe-set\fR is used.
.TP
\fBinvoke\fR \fIcmdprefix\fR
Signals that the user-specified command prefix \fIcmdprefix\fR is the
operation to perform. The command prefix is executed at the global
level and given the source directory, destination directory, and set
of files (as dictionary mapping from source to destination files), in
this order.
.TP
\fBreset\fR
Forces the object into the ground state where all parts of the
configuration have default values.
.TP
\fB(\fR
Saves a copy of the current object state on a stack.
.TP
\fB)\fR
Takes the state at the top of the state stack and restores it,
i.e. makes it the new current object state.
.TP
\fBcd\fR \fIdirectory\fR
Changes the destination directory to the sub-directory \fIdirectory\fR
of the current destination.
.TP
\fBup\fR
Changes the destination directory to the parent directory of the
current destination.
.TP
\fBfor-windows\fR
Checks that Windows is the current platform. Aborts processing if not.
.TP
\fBfor-win\fR
An alias for \fBfor-windows\fR.
.TP
\fBfor-unix\fR
Checks that Unix is the current platform. Aborts processing if not.
.TP
\fBthe\fR \fIpattern\fR
This command specifies the files to operate on per a glob pattern, and
is also the active element, i.e. the command which actually performs
the specified operation. All the other commands only modified the
object state to set the operation up, but di nothing else.
.sp
To allow for a more natural sounding syntax this command also looks
ahead in the list of words looks and executes several commands
immediately following it before performing its own actions.
These commands are \fBas\fR, \fBbut\fR, \fBexclude\fR, \fBexcept\fR,
\fBfrom\fR, and \fBinto\fR (and aliases). That way these commands act
like qualifiers, and still take effect as if they had been written
before this command.
.sp
After the operation has been performed the object state the exclude
patterns and the alias name, if specified, are reset to their default
values (i.e. empty), but nothing else.
.TP
\fBthe-set\fR \fIvarname\fR
Like \fBthe\fR, however the set of files to use is not specified
implicitly per a glob pattern, but contained and loaded from the
specified variable. The operation \fBexpand\fR is not available
if this command is used.
.TP
\fB->\fR \fIvarname\fR
Saves the set of files from the last expansion into the specified
variable.
.TP
\fBstrict\fR
Make file expansion and definition of destination directory (\fBin\fR
and aliases) strict, i.e. report errors for missing directories, and
empty expansion.
.TP
\fB!strict\fR
Complement of \fBstrict\fR. A missing destination directory or empty
expansion are not reported as errors.
.TP
\fBfiles\fR
Limit the search to files. Default is to accept every type of path.
.TP
\fBlinks\fR
Limit the search to symbolic links. Default is to accept every type of path.
.TP
\fBdirectories\fR
Limit the search to directories. Default is to accept every type of path.
.TP
\fBdirs\fR
An alias for \fBdirectories\fR.
.TP
\fBall\fR
Accept all types of paths (default).
.TP
\fBstate?\fR
Returns the current state of the object as dictionary. The dictionary keys and their meanings are:
.RS
.TP
\fBas\fR
Last setting made by \fBas\fR.
.TP
\fBexcluded\fR
List of currently known exclusion patterns.
.TP
\fBfrom\fR
Current source directory, set by \fBfrom\fR.
.TP
\fBinto\fR
Current destination directory, set by \fBinto\fR (and aliases).
.TP
\fBoperation\fR
Current operation to perform, set by \fBcopy\fR, \fBmove\fR, \fBremove\fR, \fBexpand\fR, or \fBinvoke\fR.
.TP
\fBrecursive\fR
Current recursion status. Set/unset by \fBrecursive\fR and \fB!recursive\fR.
.TP
\fBstrict\fR
Current strictness. Set/unset by \fBstrict\fR and \fB!strict\fR.
.TP
\fBtype\fR
Current path type limiter. Set by either \fBfiles\fR, \fBdirectories\fR, \fBlinks\fR, or \fBall\fR.
.RE
.TP
\fBas?\fR
Returns the current alias name.
.TP
\fBexcluded?\fR
Returns the current set of exclusion patterns.
.TP
\fBfrom?\fR
Returns the current source directory.
.TP
\fBinto?\fR
Returns the current destination directory.
.TP
\fBoperation?\fR
Returns the current operation to perform.
.TP
\fBrecursive?\fR
Returns the current recursion status.
.TP
\fBstrict?\fR
Returns the current strictness.
.TP
\fBtype?\fR
Returns the current path type limiter.
.PP
.SH EXAMPLES
The following examples assume that the variable \fBF\fR contains a
reference to a multi-file operation object.
.CS


    $F do copy                       \\\\
	the  *.dll                    \\\\
	from c:/TDK/PrivateOpenSSL/bin \\\\
	to   [installdir_of tls]

.CE
.CS


    $F do move      \\\\
	the  *       \\\\
	from /sources \\\\
	into /scratch  \\\\
	but not *.html

    # Alternatively use 'except for *.html'.

.CE
.CS


    $F do           \\\\
	move         \\\\
	the  index    \\\\
	from /sources  \\\\
	into /scratch   \\\\
	as   pkgIndex.tcl

.CE
.CS


    $F do         \\\\
	remove     \\\\
	the *.txt  \\\\
	in /scratch

.CE
Note that the fact that most commands just modify the object state
allows us to use more off forms as specifications instead of just
nearly-natural language sentences.
For example the second example in this section can re-arranged into:
.CS


    $F do            \\\\
	from /sources \\\\
	into /scratch  \\\\
	but not *.html \\\\
	move           \\\\
	the  *

.CE
and the result is not only still a valid specification, but even stays
relatively readable.
.PP
Further note that the information collected by the commands \fBbut\fR,
\fBexcept\fR, and \fBas\fR is automatically reset after the associated
\fBthe\fR was executed. However no other state is reset in that
manner, allowing the user to avoid repetitions of unchanging
information. For example the second and third examples of this section
can be merged and rewritten into the equivalent:
.CS


$F do                   \\\\
    move                 \\\\
    the  *                \\\\
    from /sources          \\\\
    into /scratch           \\\\
    but not *.html not index \\\\
    the  index               \\\\
    as   pkgIndex.tcl

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
copy, file utilities, move, multi-file, remove
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/fileutil/traverse.n.








































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fileutil/traverse.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil_traverse" n 0.4.3 tcllib "file utilities"
.BS
.SH NAME
fileutil_traverse \- Iterative directory traversal
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBfileutil::traverse  ?0.4.3?\fR
.sp
package require \fBfileutil \fR
.sp
package require \fBcontrol \fR
.sp
\fB::fileutil::traverse\fR ?\fIobjectName\fR? \fIpath\fR ?\fIoption\fR \fIvalue\fR...?
.sp
\fB$traverser\fR \fBcommand\fR ?\fIarg arg ...\fR?
.sp
\fB$traverser\fR \fBfiles\fR
.sp
\fB$traverser\fR \fBforeach\fR \fIfilevar\fR \fIscript\fR
.sp
\fB$traverser\fR \fBnext\fR \fIfilevar\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides objects for the programmable traversal of
directory hierarchies.
The main command exported by the package is:
.TP
\fB::fileutil::traverse\fR ?\fIobjectName\fR? \fIpath\fR ?\fIoption\fR \fIvalue\fR...?
The command creates a new traversal object with an associated global
Tcl command whose name is \fIobjectName\fR. This command may be used
to invoke various operations on the traverser.
If the string \fB%AUTO%\fR is used as the \fIobjectName\fR then a
unique name will be generated by the package itself.
.sp
Regarding the recognized options see section \fBOPTIONS\fR. Note
that all these options can be set only during the creation of the
traversal object. Changing them later is not possible and causes
errors to be thrown if attempted.
.sp
The object command has the following general form:
.RS
.TP
\fB$traverser\fR \fBcommand\fR ?\fIarg arg ...\fR?
\fICommand\fR and its \fIarg\fRuments determine the exact behavior of
the object.
.RE
.PP
The following commands are possible for traversal objects:
.TP
\fB$traverser\fR \fBfiles\fR
This method is the most highlevel one provided by traversal
objects. When invoked it returns a list containing the names of all
files and directories matching the current configuration of the
traverser.
.TP
\fB$traverser\fR \fBforeach\fR \fIfilevar\fR \fIscript\fR
The highlevel \fBfiles\fR method (see above) is based on this
mid-level method. When invoked it finds all files and directories
matching per the current configuration and executes the \fIscript\fR
for each path. The current path under consideration is stored in the
variable named by \fIfilevar\fR. Both variable and script live / are
executed in the context of the caller of the method. In the method
\fBfiles\fR the script simply saves the found paths into the list
to return.
.TP
\fB$traverser\fR \fBnext\fR \fIfilevar\fR
This is the lowest possible interface to the traverser, the core all
higher methods are built on. When invoked it returns a boolean value
indicating whether it found a path matching the current configuration
(\fBTrue\fR), or not (\fBFalse\fR). If a path was found it is
stored into the variable named by \fIfilevar\fR, in the context of the
caller.
The \fBforeach\fR method simply calls this method in a loop until
it returned \fBFalse\fR. This method is exposed so that we are also
able to incrementally traverse a directory hierarchy in an event-based
manner.
.PP
.SH OPTIONS
.TP
\fB-prefilter\fR command_prefix
This callback is executed for directories. Its result determines if
the traverser recurses into the directory or not. The default is to
always recurse into all directories. The callback is invoked with a
single argument, the \fIabsolute\fR path of the directory, and has to
return a boolean value, \fBTrue\fR when the directory passes the
filter, and \fBFalse\fR if not.
.TP
\fB-filter\fR command_prefix
This callback is executed for all paths. Its result determines if the
current path is a valid result, and returned by \fBnext\fR. The
default is to accept all paths as valid. The callback is invoked with
a single argument, the \fIabsolute\fR path to check, and has to
return a boolean value, \fBTrue\fR when the path passes the filter,
and \fBFalse\fR if not.
.TP
\fB-errorcmd\fR command_prefix
This callback is executed for all paths the traverser has trouble
with. Like being unable to change into them, get their status,
etc. The default is to ignore any such problems. The callback is
invoked with a two arguments, the \fIabsolute\fR path for which the
error occured, and the error message. Errors thrown by the filter
callbacks are handled through this callback too. Errors thrown by the
error callback itself are not caught and ignored, but allowed to pass
to the caller, i.e. however invoked the \fBnext\fR. Any other
results from the callback are ignored.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
directory traversal, traversal
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/ftp/ftp.n.


















































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ftp/ftp.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ftp" n 2.4.11 tcllib "ftp client"
.BS
.SH NAME
ftp \- Client-side tcl implementation of the ftp protocol
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBftp  ?2.4.11?\fR
.sp
\fB::ftp::Open\fR \fIserver\fR \fIuser\fR \fIpasswd\fR ?\fIoptions\fR?
.sp
\fB::ftp::Close\fR \fIhandle\fR
.sp
\fB::ftp::Cd\fR \fIhandle\fR \fIdirectory\fR
.sp
\fB::ftp::Pwd\fR \fIhandle\fR
.sp
\fB::ftp::Type\fR \fIhandle\fR ?\fBascii|binary|tenex\fR?
.sp
\fB::ftp::List\fR \fIhandle\fR ?\fIpattern\fR?
.sp
\fB::ftp::NList\fR \fIhandle\fR ?\fIdirectory\fR?
.sp
\fB::ftp::FileSize\fR \fIhandle\fR \fIfile\fR
.sp
\fB::ftp::ModTime\fR \fIhandle\fR \fIfile\fR
.sp
\fB::ftp::Delete\fR \fIhandle\fR \fIfile\fR
.sp
\fB::ftp::Rename\fR \fIhandle\fR \fIfrom\fR \fIto\fR
.sp
\fB::ftp::Put\fR \fIhandle\fR (\fIlocal\fR | -data \fIdata\fR | -channel \fIchan\fR) ?\fIremote\fR?
.sp
\fB::ftp::Append\fR \fIhandle\fR (\fIlocal\fR | -data \fIdata\fR | -channel \fIchan\fR) ?\fIremote\fR?
.sp
\fB::ftp::Get\fR \fIhandle\fR \fIremote\fR ?(\fIlocal\fR | -variable \fIvarname\fR | -channel \fIchan\fR)?
.sp
\fB::ftp::Reget\fR \fIhandle\fR \fIremote\fR ?\fIlocal\fR? ?\fIfrom\fR? ?\fIto\fR?
.sp
\fB::ftp::Newer\fR \fIhandle\fR \fIremote\fR ?\fIlocal\fR?
.sp
\fB::ftp::MkDir\fR \fIhandle\fR \fIdirectory\fR
.sp
\fB::ftp::RmDir\fR \fIhandle\fR \fIdirectory\fR
.sp
\fB::ftp::Quote\fR \fIhandle\fR \fIarg1\fR \fIarg2\fR \fI...\fR
.sp
\fB::ftp::DisplayMsg\fR \fIhandle\fR \fImsg\fR ?\fIstate\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The ftp package provides the client side of the ftp protocol as
specified in RFC 959 (\fIhttp://www.rfc-editor.org/rfc/rfc959.txt\fR).
The package implements both active (default) and passive ftp sessions.
.PP
A new ftp session is started with the \fB::ftp::Open\fR command. To
shutdown an existing ftp session use \fB::ftp::Close\fR. All other
commands are restricted to usage in an an open ftp session. They will
generate errors if they are used out of context.  The ftp package
includes file and directory manipulating commands for remote sites. To
perform the same operations on the local site use commands built into
the core, like \fBcd\fR or \fBfile\fR.
.PP
The output of the package is controlled by two state variables,
\fB::ftp::VERBOSE\fR and \fB::ftp::DEBUG\fR. Setting
\fB::ftp::VERBOSE\fR to "1" forces the package to show all responses
from a remote server. The default value is "0". Setting
\fB::ftp::DEBUG\fR to "1" enables debugging and forces the package to
show all return codes, states, state changes and "real" ftp
commands. The default value is "0".
.PP
The command \fB::ftp::DisplayMsg\fR is used to show the different
messages from the ftp session. The setting of \fB::ftp::VERBOSE\fR
determines if this command is called or not. The current
implementation of the command uses the \fBlog\fR package of tcllib
to write the messages to their final destination. This means that the
behaviour of \fB::ftp::DisplayMsg\fR can be customized without
changing its implementation. For more radical changes overwriting its
implementation by the application is of course still possible. Note
that the default implementation honors the option \fB-output\fR to
\fB::ftp::Open\fR for a session specific log command.
.PP
\fICaution\fR: The default implementation logs error messages like
all other messages. If this behaviour is changed to throwing an error
instead all commands in the API will change their behaviour too. In
such a case they will not return a failure code as described below but
pass the thrown error to their caller.
.SH API
.TP
\fB::ftp::Open\fR \fIserver\fR \fIuser\fR \fIpasswd\fR ?\fIoptions\fR?
This command is used to start a FTP session by establishing a control
connection to the FTP server. The defaults are used for any option not
specified by the caller.
.sp
The command takes a host name \fIserver\fR, a user name \fIuser\fR and
a password \fIpassword\fR as its parameters and returns a session
handle that is an integer number greater than or equal to "0", if the
connection is successfully established. Otherwise it returns "-1".
The \fIserver\fR parameter must be the name or internet address (in
dotted decimal notation) of the ftp server to connect to. The
\fIuser\fR and \fIpasswd\fR parameters must contain a valid user name
and password to complete the login process.
.sp
The options overwrite some default values or set special abilities:
.RS
.TP
\fB-blocksize\fR \fIsize\fR
The blocksize is used during data transfer. At most \fIsize\fR bytes
are transfered at once. The default value for this option is 4096.
The package will evaluate the \fB-progress callback\fR for the
session after the transfer of each block.
.TP
\fB-timeout\fR \fIseconds\fR
If \fIseconds\fR is non-zero, then \fB::ftp::Open\fR sets up a timeout
which will occur after the specified number of seconds. The default
value is 600.
.TP
\fB-port\fR \fInumber\fR
The port \fInumber\fR specifies an alternative remote port on the ftp
server on which the ftp service resides. Most ftp services listen for
connection requests on the default port 21. Sometimes, usually for
security reasons, port numbers other than 21 are used for ftp
connections.
.TP
\fB-mode\fR \fImode\fR
The transfer \fImode\fR option determines if a file transfer occurs in
\fBactive\fR or \fBpassive\fR mode. In passive mode the client
will ask the ftp server to listen on a data port and wait for the
connection rather than to initiate the process by itself when a data
transfer request comes in. Passive mode is normally a requirement when
accessing sites via a firewall. The default mode is \fBactive\fR.
.TP
\fB-progress\fR \fIcallback\fR
This \fIcallback\fR is evaluated whenever a block of data was
transfered. See the option \fB-blocksize\fR for how to specify the
size of the transfered blocks.
.sp
When evaluating the \fIcallback\fR one argument is appended to the
callback script, the current accumulated number of bytes transferred
so far.
.TP
\fB-command\fR \fIcallback\fR
Specifying this option places the connection into asynchronous
mode. The \fIcallback\fR is evaluated after the completion of any
operation. When an operation is running no further operations must be
started until a callback has been received for the currently executing
operation.
.sp
When evaluating the \fIcallback\fR several arguments are appended to
the callback script, namely the keyword of the operation that has
completed and any additional arguments specific to the operation.  If
an error occurred during the execution of the operation the callback is
given the keyword \fBerror\fR.
.TP
\fB-output\fR \fIcallback\fR
This option has no default. If it is set the default implementation of
\fB::ftp::DisplayMsg\fR will use its value as command prefix to log
all internal messages. The callback will have three arguments appended
to it before evaluation, the id of the session, the message itself,
and the connection state, in this order.
.RE
.TP
\fB::ftp::Close\fR \fIhandle\fR
This command terminates the specified ftp session. If no file transfer
is in progress, the server will close the control connection
immediately. If a file transfer is in progress however, the control
connection will remain open until the transfers completes. When that
happens the server will write the result response for the transfer to
it and close the connection afterward.
.TP
\fB::ftp::Cd\fR \fIhandle\fR \fIdirectory\fR
This command changes the current working directory on the ftp server
to a specified target \fIdirectory\fR.  The command returns 1 if the
current working directory was successfully changed to the specified
directory or 0 if it fails.  The target directory can be
.RS
.IP \(bu
a subdirectory of the current directory,
.IP \(bu
Two dots, \fB..\fR  (as an indicator for the parent directory of
the current directory)
.IP \(bu
or a fully qualified path to a new working directory.
.RE
.TP
\fB::ftp::Pwd\fR \fIhandle\fR
This command returns the complete path of the current working
directory on the ftp server, or an empty string in case of an error.
.TP
\fB::ftp::Type\fR \fIhandle\fR ?\fBascii|binary|tenex\fR?
This command sets the ftp file transfer type to either \fBascii\fR,
\fBbinary\fR, or \fBtenex\fR. The command always returns the
currently set type. If called without type no change is made.
.sp
Currently only \fBascii\fR and \fBbinary\fR types are
supported. There is some early (alpha) support for Tenex mode. The
type \fBascii\fR is normally used to convert text files into a
format suitable for text editors on the platform of the destination
machine. This mainly affects end-of-line markers. The type
\fBbinary\fR on the other hand allows the undisturbed transfer of
non-text files, such as compressed files, images and executables.
.TP
\fB::ftp::List\fR \fIhandle\fR ?\fIpattern\fR?
This command returns a human-readable list of files.  Wildcard
expressions such as "\fI*.tcl\fR" are allowed.  If \fIpattern\fR
refers to a specific directory, then the contents of that directory
are returned.  If the \fIpattern\fR is not a fully-qualified path
name, the command lists entries relative to the current remote
directory.  If no \fIpattern\fR is specified, the contents of the
current remote directory is returned.
.sp
The listing includes any system-dependent information that the server
chooses to include. For example most UNIX systems produce output from
the command \fBls -l\fR. The command returns the retrieved
information as a tcl list with one item per entry. Empty lines and
UNIX's "total" lines are ignored and not included in the result as
reported by this command.
.sp
If the command fails an empty list is returned.
.TP
\fB::ftp::NList\fR \fIhandle\fR ?\fIdirectory\fR?
This command has the same behavior as the \fB::ftp::List\fR command,
except that it only retrieves an abbreviated listing. This means only
file names are returned in a sorted list.
.TP
\fB::ftp::FileSize\fR \fIhandle\fR \fIfile\fR
This command returns the size of the specified \fIfile\fR on the ftp
server. If the command fails an empty string is returned.
.sp
\fIATTENTION!\fR It will not work properly when in ascii mode and
is not supported by all ftp server implementations.
.TP
\fB::ftp::ModTime\fR \fIhandle\fR \fIfile\fR
This command retrieves the time of the last modification of the
\fIfile\fR on the ftp server as a system dependent integer value in
seconds or an empty string if an error occurred. Use the built-in
command \fBclock\fR to convert the retrieves value into other formats.
.TP
\fB::ftp::Delete\fR \fIhandle\fR \fIfile\fR
This command deletes the specified \fIfile\fR on the ftp server. The
command returns 1 if the specified file was successfully deleted or 0
if it failed.
.TP
\fB::ftp::Rename\fR \fIhandle\fR \fIfrom\fR \fIto\fR
This command renames the file \fIfrom\fR in the current directory of
the ftp server to the specified new file name \fIto\fR. This new file
name must not be the same as any existing subdirectory or file name.
The command returns 1 if the specified file was successfully renamed
or 0 if it failed.
.TP
\fB::ftp::Put\fR \fIhandle\fR (\fIlocal\fR | -data \fIdata\fR | -channel \fIchan\fR) ?\fIremote\fR?
This command transfers a local file \fIlocal\fR to a remote file
\fIremote\fR on the ftp server. If the file parameters passed to the
command do not fully qualified path names the command will use the
current directory on local and remote host. If the remote file name is
unspecified, the server will use the name of the local file as the
name of the remote file. The command returns 1 to indicate a successful
transfer and 0 in the case of a failure.
.sp
If \fB-data\fR \fIdata\fR is specified instead of a local file, the
system will not transfer a file, but the \fIdata\fR passed into it. In
this case the name of the remote file has to be specified.
.sp
If \fB-channel\fR \fIchan\fR is specified instead of a local file,
the system will not transfer a file, but read the contents of the
channel \fIchan\fR and write this to the remote file. In this case the
name of the remote file has to be specified. After the transfer
\fIchan\fR will be closed.
.TP
\fB::ftp::Append\fR \fIhandle\fR (\fIlocal\fR | -data \fIdata\fR | -channel \fIchan\fR) ?\fIremote\fR?
This command behaves like \fB::ftp::Puts\fR, but appends the
transfered information to the remote file. If the file did not exist
on the server it will be created.
.TP
\fB::ftp::Get\fR \fIhandle\fR \fIremote\fR ?(\fIlocal\fR | -variable \fIvarname\fR | -channel \fIchan\fR)?
This command retrieves a remote file \fIremote\fR on the ftp server
and stores its contents into the local file \fIlocal\fR. If the file
parameters passed to the command are not fully qualified path names
the command will use the current directory on local and remote
host. If the local file name is unspecified, the server will use the
name of the remote file as the name of the local file. The command
returns 1 to indicate a successful transfer and 0 in the case of a
failure. The command will throw an error if the directory the file
\fIlocal\fR is to be placed in does not exist.
.sp
If \fB-variable\fR \fIvarname\fR is specified, the system will
store the retrieved data into the variable \fIvarname\fR instead of a
file.
.sp
If \fB-channel\fR \fIchan\fR is specified, the system will write
the retrieved data into the channel \fIchan\fR instead of a file. The
system will \fInot\fR close \fIchan\fR after the transfer, this is
the responsibility of the caller to \fB::ftp::Get\fR.
.TP
\fB::ftp::Reget\fR \fIhandle\fR \fIremote\fR ?\fIlocal\fR? ?\fIfrom\fR? ?\fIto\fR?
This command behaves like \fB::ftp::Get\fR, except that if local file
\fIlocal\fR exists and is smaller than remote file \fIremote\fR, the
local file is presumed to be a partially transferred copy of the
remote file and the transfer is continued from the apparent point of
failure.  The command will throw an error if the directory the file
\fIlocal\fR is to be placed in does not exist. This command is useful
when transferring very large files over networks that tend to drop
connections.
.sp
Specifying the additional byte offsets \fIfrom\fR and \fIto\fR will
cause the command to change its behaviour and to download exactly the
specified slice of the remote file. This mode is possible only if a
local destination is explicitly provided. Omission of \fIto\fR leads
to downloading till the end of the file.
.TP
\fB::ftp::Newer\fR \fIhandle\fR \fIremote\fR ?\fIlocal\fR?
This command behaves like \fB::ftp::Get\fR, except that it retrieves
the remote file only if the modification time of the remote file is
more recent than the file on the local system. If the file does not
exist on the local system, the remote file is considered newer. The
command will throw an error if the directory the file \fIlocal\fR is
to be placed in does not exist.
.TP
\fB::ftp::MkDir\fR \fIhandle\fR \fIdirectory\fR
This command creates the specified \fIdirectory\fR on the ftp
server. If the specified path is relative the new directory will be
created as a subdirectory of the current working directory. Else the
created directory will have the specified path name. The command
returns 1 to indicate a successful creation of the directory and 0 in
the case of a failure.
.TP
\fB::ftp::RmDir\fR \fIhandle\fR \fIdirectory\fR
This command removes the specified directory on the ftp server. The
remote directory has to be empty or the command will fail. The command
returns 1 to indicate a successful removal of the directory and 0 in
the case of a failure.
.TP
\fB::ftp::Quote\fR \fIhandle\fR \fIarg1\fR \fIarg2\fR \fI...\fR
This command is used to send an arbitrary ftp command to the
server. It cannot be used to obtain a directory listing or for
transferring files. It is included to allow an application to execute
commands on the ftp server which are not provided by this package.
The arguments are sent verbatim, i.e. as is, with no changes.
.sp
In contrast to the other commands in this package this command will
not parse the response it got from the ftp server but return it
verbatim to the caller.
.TP
\fB::ftp::DisplayMsg\fR \fIhandle\fR \fImsg\fR ?\fIstate\fR?
This command is used by the package itself to show the different
messages from the ftp sessions. The package itself declares this
command very simple, writing the messages to \fBstdout\fR (if
\fB::ftp::VERBOSE\fR was set, see below) and throwing tcl errors for
error messages. It is the responsibility of the application to
overwrite it as needed. A state variable for different states assigned
to different colors is recommended by the author. The package
\fBlog\fR is useful for this.
.TP
\fB::ftp::VERBOSE\fR
A state variable controlling the output of the package. Setting
\fB::ftp::VERBOSE\fR to "1" forces the package to show all responses
from a remote server. The default value is "0".
.TP
\fB::ftp::DEBUG\fR
A state variable controlling the output of ftp. Setting
\fB::ftp::DEBUG\fR to "1" enables debugging and forces the package to
show all return codes, states, state changes and "real" ftp
commands. The default value is "0".
.PP
.SH BUGS
.PP
The correct execution of many commands depends upon the proper
behavior by the remote server, network and router configuration.
.PP
An update command placed in the procedure \fB::ftp::DisplayMsg\fR may
run into persistent errors or infinite loops. The solution to this
problem is to use \fBupdate idletasks\fR instead of \fBupdate\fR.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIftp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
ftpd, mime, pop3, smtp
.SH KEYWORDS
ftp, internet, net, rfc 959
.SH CATEGORY
Networking

Added embedded/man/files/modules/ftp/ftp_geturl.n.



































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ftp/ftp_geturl.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ftp::geturl" n 0.2.1 tcllib "ftp client"
.BS
.SH NAME
ftp::geturl \- Uri handler for ftp urls
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBftp::geturl  ?0.2.1?\fR
.sp
\fB::ftp::geturl\fR \fIurl\fR
.sp
.BE
.SH DESCRIPTION
This package provides a command which wraps around the client side of
the \fIftp\fR protocol provided by package \fBftp\fR to allow the
retrieval of urls using the \fIftp\fR schema.
.SH API
.TP
\fB::ftp::geturl\fR \fIurl\fR
This command can be used by the generic command \fB::uri::geturl\fR
(See package \fBuri\fR) to retrieve the contents of ftp
urls. Internally it uses the commands of the package \fBftp\fR to
fulfill the request.
.sp
The contents of a \fIftp\fR url are defined as follows:
.RS
.TP
\fIfile\fR
The contents of the specified file itself.
.TP
\fIdirectory\fR
A listing of the contents of the directory in key value notation where
the file name is the key and its attributes the associated value.
.TP
\fIlink\fR
The attributes of the link, including the path it refers to.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIftp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
ftpd, mime, pop3, smtp
.SH KEYWORDS
ftp, internet, net, rfc 959
.SH CATEGORY
Networking

Added embedded/man/files/modules/ftpd/ftpd.n.

















































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ftpd/ftpd.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ftpd" n 1.2.6 tcllib "Tcl FTP Server Package"
.BS
.SH NAME
ftpd \- Tcl FTP server implementation
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBftpd  ?1.2.6?\fR
.sp
\fB::ftpd::server\fR ?\fImyaddr\fR?
.sp
\fB::ftpd::config\fR ?\fIoption value\fR? ?\fIoption value ...\fR?
.sp
\fIfsCmd\fR \fBappend\fR \fIpath\fR
.sp
\fIfsCmd\fR \fBdelete\fR \fIpath\fR \fIchannel\fR
.sp
\fIfsCmd\fR \fBdlist\fR \fIpath\fR \fIstyle\fR \fIchannel\fR
.sp
\fIfsCmd\fR \fBexists\fR \fIpath\fR
.sp
\fIfsCmd\fR \fBmkdir\fR \fIpath\fR \fIchannel\fR
.sp
\fIfsCmd\fR \fBmtime\fR \fIpath\fR \fIchannel\fR
.sp
\fIfsCmd\fR \fBpermissions\fR \fIpath\fR
.sp
\fIfsCmd\fR \fBrename\fR \fIpath\fR \fInewpath\fR \fIchannel\fR
.sp
\fIfsCmd\fR \fBretr\fR \fIpath\fR
.sp
\fIfsCmd\fR \fBrmdir\fR \fIpath\fR \fIchannel\fR
.sp
\fIfsCmd\fR \fBsize\fR \fIpath\fR \fIchannel\fR
.sp
\fIfsCmd\fR \fBstore\fR \fIpath\fR
.sp
.BE
.SH DESCRIPTION
The \fBftpd\fR package provides a simple Tcl-only server library
for the FTP protocol as specified in
RFC 959 (\fIhttp://www.rfc-editor.org/rfc/rfc959.txt\fR).
It works by listening on the standard FTP socket.  Most server errors
are returned as error messages with the appropriate code attached to
them.  Since the server code for the ftp daemon is executed in the
event loop, it is possible that a
\fBbgerror\fR will be thrown on the server if there are problems with
the code in the module.
.SH COMMANDS
.TP
\fB::ftpd::server\fR ?\fImyaddr\fR?
Open a listening socket to listen to and accept ftp connections.
myaddr is an optional argument.  \fImyaddr\fR is the domain-style name
or numerical IP address of the client-side network interface to use
for the connection.
.TP
\fB::ftpd::config\fR ?\fIoption value\fR? ?\fIoption value ...\fR?
The value is always the name of the command to call as the
callback. The option specifies which callback should be configured.
See section \fBCALLBACKS\fR for descriptions of the arguments and
return values for each of the callbacks.
.RS
.TP
-authIpCmd \fIproc\fR
Callback to authenticate new connections based on the ip-address of
the peer.
.TP
-authUsrCmd \fIproc\fR
Callback to authenticate new connections based on the user logging in
(and the users password).
.TP
-authFileCmd \fIproc\fR
Callback to accept or deny a users access to read and write to a
specific path or file.
.TP
-logCmd \fIproc\fR
Callback for log information generated by the FTP engine.
.TP
-fsCmd \fIproc\fR
Callback to connect the engine to the filesystem it operates on.
.TP
-closeCmd \fIproc\fR
Callback to be called when a connection is closed. This allows the
embedding application to perform its own cleanup operations.
.TP
-xferDoneCmd \fIproc\fR
Callback for transfer completion notification. In other words, it is
called whenever a transfer of data to or from the client has
completed.
.RE
.PP
.SH CALLBACKS
.TP
\fBauthIpCmd\fR callback
The authIpCmd receives the ip-address of the peer attempting to
connect to the ftp server as its argument. It returns a 1 to allow
users from the specified IP to attempt to login and a 0 to reject the
login attempt from the specified IP.
.TP
\fBauthUsrCmd\fR callback
The authUsrCmd receives the username and password as its two
arguments. It returns a 1 to accept the attempted login to the ftpd
and a 0 to reject the attempted login.
.TP
\fBauthFileCmd\fR callback
The authFileCmd receives the user (that is currently logged in), the
path or filename that is about to be read or written, and
\fBread\fR or \fBwrite\fR as its three arguments.  It returns a
1 to allow the path or filename to be read or written, and a 0 to
reject the attempted read or write with a permissions error code.
.TP
\fBlogCmd\fR callback
The logCmd receives a severity and a message as its two arguments.
The severities used within the ftpd package are \fBnote\fR,
\fBdebug\fR, and \fBerror\fR. The logCmd doesn't return
anything.
.TP
\fBfsCmd\fR callback
The fsCmd receives a subcommand, a filename or path, and optional
additional arguments (depending on the subcommand).
.sp
The subcommands supported by the fsCmd are:
.RS
.TP
\fIfsCmd\fR \fBappend\fR \fIpath\fR
The append subcommand receives the filename to append to as its
argument. It returns a writable tcl channel as its return value.
.TP
\fIfsCmd\fR \fBdelete\fR \fIpath\fR \fIchannel\fR
The delete subcommand receives the filename to delete, and a channel
to write to as its two arguments.  The file specified is deleted and
the appropriate ftp message is written to the channel that is passed
as the second argument.  The delete subcommand returns nothing.
.TP
\fIfsCmd\fR \fBdlist\fR \fIpath\fR \fIstyle\fR \fIchannel\fR
The dlist subcommand receives the path that it should list the files
that are in, the style in which the files should be listed which is
either \fBnlst\fR or \fBlist\fR, and a channel to write to as
its three arguments.  The files in the specified path are printed to
the specified channel one per line.  If the style is \fBnlst\fR
only the name of the file is printed to the channel.  If the style is
\fBlist\fR then the file permissions, number of links to the file,
the name of the user that owns the file, the name of the group that
owns the file, the size (in bytes) of the file, the modify time of the
file, and the filename are printed out to the channel in a formatted
space separated format.  The \fBdlist\fR subcommand returns
nothing.
.TP
\fIfsCmd\fR \fBexists\fR \fIpath\fR
The exists subcommand receives the name of a file to check the
existence of as its only argument.  The exists subcommand returns a 1
if the path specified exists and the path is not a directory.
.TP
\fIfsCmd\fR \fBmkdir\fR \fIpath\fR \fIchannel\fR
The mkdir subcommand receives the path of a directory to create and a
channel to write to as its two arguments.  The mkdir subcommand
creates the specified directory if necessary and possible.  The mkdir
subcommand then prints the appropriate success or failure message to
the channel.  The mkdir subcommand returns nothing.
.TP
\fIfsCmd\fR \fBmtime\fR \fIpath\fR \fIchannel\fR
The mtime subcommand receives the path of a file to check the modify
time on and a channel as its two arguments.  If the file exists the
mtime is printed to the channel in the proper FTP format, otherwise an
appropriate error message and code are printed to the channel.  The
mtime subcommand returns nothing.
.TP
\fIfsCmd\fR \fBpermissions\fR \fIpath\fR
The permissions subcommand receives the path of a file to retrieve the
permissions of.  The permissions subcommand returns the octal file
permissions of the specified file.  The file is expected to exist.
.TP
\fIfsCmd\fR \fBrename\fR \fIpath\fR \fInewpath\fR \fIchannel\fR
The rename subcommand receives the path of the current file, the new
file path, and a channel to write to as its three arguments.  The
rename subcommand renames the current file to the new file path if the
path to the new file exists, and then prints out the appropriate
message to the channel.  If the new file path doesn't exist the
appropriate error message is printed to the channel.  The rename
subcommand returns nothing.
.TP
\fIfsCmd\fR \fBretr\fR \fIpath\fR
The retr subcommand receives the path of a file to read as its only
argument.  The retr subcommand returns a readable channel that the
specified file can be read from.
.TP
\fIfsCmd\fR \fBrmdir\fR \fIpath\fR \fIchannel\fR
The rmdir subcommand receives the path of a directory to remove and a
channel to write to as its two arguments.  The rmdir subcommand
removes the specified directory (if possible) and prints the
appropriate message to the channel (which may be an error if the
specified directory does not exist or is not empty).  The rmdir
subcommand returns nothing.
.TP
\fIfsCmd\fR \fBsize\fR \fIpath\fR \fIchannel\fR
The size subcommand receives the path of a file to get the size (in
bytes) of and a channel to write to as its two arguments.  The size
subcommand prints the appropriate code and the size of the file if the
specified path is a file, otherwise an appropriate error code and
message are printed to the channel.  The size subcommand returns
nothing.
.TP
\fIfsCmd\fR \fBstore\fR \fIpath\fR
The store subcommand receives the path of a file to write as its only
argument.  The store subcommand returns a writable channel.
.RE
.TP
\fBcloseCmd\fR
The \fBcloseCmd\fR receives no arguments when it is invoked, and any
return value it may generate is discarded.
.TP
\fBxferDoneCmd\fR sock sock2 file bytes filename err
The \fBxferDoneCmd\fR receives six arguments when invoked. These are,
in this order, the channel handle of the control socket for the
connection, the channel handle of the data socket used for the
transfer (already closed), the handle of the channel containing the
transfered file, the number of bytes transfered, the path of the file
which was transfered, and a (possibly empty) error message.
Any return value it may generate is discarded.
.PP
.SH VARIABLES
.TP
\fB::ftpd::cwd\fR
The current working directory for a session when someone first
connects to the FTPD or when the \fBREIN\fR ftp command is received.
.TP
\fB::ftpd::contact\fR
The e-mail address of the person that is the contact for the ftp
server.  This address is printed out as part of the response to the
\fBFTP HELP\fR command.
.TP
\fB::ftpd::port\fR
The port that the ftp server should listen on.
If port is specified as zero, the operating system will allocate an
unused port for use as a server socket; afterwards, the variable will
contain the port number that was allocated.
.TP
\fB::ftpd::welcome\fR
The message that is printed out when the user first connects to the
ftp server.
.TP
\fB::ftpd::CurrentSocket\fR
Accessible to all callbacks and all filesystem commands (which are a
special form of callback) and contains the handle of the socket
channel which was active when the callback was invoked.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIftpd\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
ftp, ftpd, ftpserver, rfc 959, services
.SH CATEGORY
Networking

Added embedded/man/files/modules/fumagic/cfront.n.























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fumagic/cfront.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil::magic::cfront" n 1.0 tcllib "file utilities"
.BS
.SH NAME
fileutil::magic::cfront \- Generator core for compiler of magic(5) files
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBfileutil::magic::cfront  ?1.0?\fR
.sp
package require \fBfileutil::magic::cgen  ?1.0?\fR
.sp
package require \fBfileutil::magic::rt  ?1.0?\fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBfileutil \fR
.sp
\fB::fileutil::magic::cfront::compile\fR \fIpath\fR...
.sp
\fB::fileutil::magic::cfront::procdef\fR \fIprocname\fR \fIpath\fR...
.sp
\fB::fileutil::magic::cfront::install\fR \fIpath\fR...
.sp
.BE
.SH DESCRIPTION
.PP
This package provides the frontend of a compiler of magic(5) files
into recognizers based on the \fBfileutil::magic::rt\fR recognizer
runtime package. For the generator backed used by this compiler see
the package \fBfileutil::magic::cgen\fR.
.SH COMMANDS
.TP
\fB::fileutil::magic::cfront::compile\fR \fIpath\fR...
This command takes the paths of one or more files and directories and
compiles all the files, and the files in all the directories into a
single recognizer for all the file types specified in these files.
.sp
All the files have to be in the format specified by magic(5).
.sp
The result of the command is a Tcl script containing the generated
recognizer.
.TP
\fB::fileutil::magic::cfront::procdef\fR \fIprocname\fR \fIpath\fR...
This command behaves like \fB::fileutil::magic::cfront::compile\fR
with regard to the specified path arguments, then wraps the resulting
recognizer script into a procedure named \fIprocname\fR, puts code
setting up the namespace of \fIprocname\fR in front, and returns the
resulting script.
.TP
\fB::fileutil::magic::cfront::install\fR \fIpath\fR...
This command uses \fB::fileutil::magic::cfront::procdef\fR to compile
each of the paths into a recognizer procedure and installs the result
in the current interpreter.
.sp
The name of each new procedure is derived from the name of the
file/directory used in its creation, with file/directory "\fIFOO\fR"
causing the creation of procedure \fB::fileutil::magic::/FOO::run\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil :: magic\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
file(1), fileutil, magic(5)
.SH KEYWORDS
file recognition, file type, file utilities, mime, type
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/fumagic/cgen.n.
















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fumagic/cgen.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil::magic::cgen" n 1.0 tcllib "file utilities"
.BS
.SH NAME
fileutil::magic::cgen \- Generator core for compiler of magic(5) files
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBfileutil::magic::cgen  ?1.0?\fR
.sp
package require \fBfileutil::magic::rt  ?1.0?\fR
.sp
package require \fBstruct::tree \fR
.sp
package require \fBstruct::list \fR
.sp
\fB::fileutil::magic::cgen::2tree\fR \fIscript\fR
.sp
\fB::fileutil::magic::cgen::treedump\fR \fItree\fR
.sp
\fB::fileutil::magic::cgen::treegen\fR \fItree\fR \fInode\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides the generator backend for a compiler of magic(5)
files into recognizers based on the \fBfileutil::magic::rt\fR
recognizer runtime package. For the compiler frontend using this
generator see the package \fBfileutil::magic::cfront\fR.
.SH COMMANDS
.TP
\fB::fileutil::magic::cgen::2tree\fR \fIscript\fR
This command converts the recognizer specified by the \fIscript\fR
into a tree and returns the object command of that tree as its
result. It uses the package \fBstruct::tree\fR for the tree.
.sp
The \fIscript\fR is in the format specified by magic(5).
.TP
\fB::fileutil::magic::cgen::treedump\fR \fItree\fR
This command takes a \fItree\fR as generated by
\fB::fileutil::magic::cgen::2tree\fR and returns a string encoding the
tree for human consumption, to aid in debugging.
.TP
\fB::fileutil::magic::cgen::treegen\fR \fItree\fR \fInode\fR
This command takes a \fItree\fR as generated by
\fB::fileutil::magic::cgen::2tree\fR and returns a Tcl script, the
recognizer for the file types represented by the sub-tree rooted at
the \fInode\fR.
The generated script makes extensive use of the commands provided by
the recognizer runtime package \fBfileutil::magic::rt\fR to
perform its duties.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil :: magic\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
file(1), fileutil, magic(5)
.SH KEYWORDS
file recognition, file type, file utilities, mime, type
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/fumagic/filetypes.n.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fumagic/filetypes.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil::magic::filetype" n 1.0.2 tcllib "file utilities"
.BS
.SH NAME
fileutil::magic::filetype \- Procedures implementing file-type recognition
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBfileutil::magic::filetype  ?1.0.2?\fR
.sp
\fB::fileutil::magic::filetype\fR \fIfilename\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a command for the recognition of file types in
pure Tcl.
.PP
The core part of the recognizer was generated from a "magic(5)" file
containing the checks to perform to recognize files, and associated
file-types.
.PP
\fIBeware!\fR This recognizer is large, about 276 Kilobyte of
generated Tcl code.
.TP
\fB::fileutil::magic::filetype\fR \fIfilename\fR
This command is similar to the command \fBfileutil::fileType\fR.
.sp
The output of the command for the specified file is a string
describing the type of the file.
.sp
This list will be empty if the type of the file is not recognized.
.PP
.SH REFERENCES
.IP [1]
\fIFile(1) sources\fR [ftp://ftp.astron.com/pub/file/]
This site contains the current sources for the file command, including
the magic definitions used by it. The latter were used by us to
generate this recognizer.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil :: magic\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
file(1), fileutil, magic(5)
.SH KEYWORDS
file recognition, file type, file utilities, type
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/fumagic/mimetypes.n.


































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fumagic/mimetypes.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil::magic::mimetype" n 1.0.2 tcllib "file utilities"
.BS
.SH NAME
fileutil::magic::mimetype \- Procedures implementing mime-type recognition
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBfileutil::magic::mimetype  ?1.0.2?\fR
.sp
\fB::fileutil::magic::mimetype\fR \fIfilename\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a command for the recognition of file types in
pure Tcl. The output is standardized to mime-types.
.PP
The core part of the recognizer was generated from a "magic(5)" file
containing the checks to perform to recognize files, and associated
mime-types.
.TP
\fB::fileutil::magic::mimetype\fR \fIfilename\fR
This command is similar to the command \fBfileutil::fileType\fR.
.sp
The output of the command for the specified file is not a list of
attributes describing the type of the file, but a list of standard
mime-types the file may have.
.sp
This list will be empty if the type of the file is not recognized.
.PP
.SH REFERENCES
.IP [1]
\fIFile(1) sources\fR [ftp://ftp.astron.com/pub/file/]
This site contains the current sources for the file command, including
the magic definitions used by it. The latter were used by us to
generate this recognizer.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil :: magic\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
file(1), fileutil, magic(5)
.SH KEYWORDS
file recognition, file type, file utilities, mime, type
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/fumagic/rtcore.n.


















































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/fumagic/rtcore.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "fileutil::magic::rt" n 1.0 tcllib "file utilities"
.BS
.SH NAME
fileutil::magic::rt \- Runtime core for file type recognition engines written in pure Tcl
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBfileutil::magic::rt  ?1.0?\fR
.sp
\fB::fileutil::magic::rt::open\fR \fIfilename\fR
.sp
\fB::fileutil::magic::rt::close\fR
.sp
\fB::fileutil::magic::rt::file_start\fR \fIname\fR
.sp
\fB::fileutil::magic::rt::result\fR ?\fImsg\fR?
.sp
\fB::fileutil::magic::rt::resultv\fR ?\fImsg\fR?
.sp
\fB::fileutil::magic::rt::emit\fR \fImsg\fR
.sp
\fB::fileutil::magic::rt::offset\fR \fIwhere\fR
.sp
\fB::fileutil::magic::rt::Nv\fR \fItype\fR \fIoffset\fR ?\fIqual\fR?
.sp
\fB::fileutil::magic::rt::N\fR \fItype\fR \fIoffset\fR \fIcomp\fR \fIval\fR ?\fIqual\fR?
.sp
\fB::fileutil::magic::rt::Nvx\fR \fIatlevel\fR \fItype\fR \fIoffset\fR ?\fIqual\fR?
.sp
\fB::fileutil::magic::rt::Nx\fR \fIatlevel\fR \fItype\fR \fIoffset\fR \fIcomp\fR \fIval\fR ?\fIqual\fR?
.sp
\fB::fileutil::magic::rt::S\fR \fIoffset\fR \fIcomp\fR \fIval\fR ?\fIqual\fR?
.sp
\fB::fileutil::magic::rt::Sx\fR \fIatlevel\fR \fIoffset\fR \fIcomp\fR \fIval\fR ?\fIqual\fR?
.sp
\fB::fileutil::magic::rt::L\fR \fInewlevel\fR
.sp
\fB::fileutil::magic::rt::I\fR \fIbase\fR \fItype\fR \fIdelta\fR
.sp
\fB::fileutil::magic::rt::R\fR \fIoffset\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides the runtime core for file type recognition
engines written in pure Tcl and is thus used by all other packages in
this module, i.e. the two frontend packages
\fBfileutil::magic::mimetypes\fR and
\fBfileutil::magic::filetypes\fR, and the two engine compiler
packages \fBfileutil::magic::cgen\fR and
\fBfileutil::magic::cfront\fR.
.SH COMMANDS
.TP
\fB::fileutil::magic::rt::open\fR \fIfilename\fR
This command initializes the runtime and prepares the file
\fIfilename\fR for use by the system.
This command has to be invoked first, before any other command of this
package.
.sp
The command returns the channel handle of the opened file as its
result.
.TP
\fB::fileutil::magic::rt::close\fR
This command closes the last file opened via
\fB::fileutil::magic::rt::open\fR and shuts the runtime down.
This command has to be invoked last, after the file has been dealt
with completely.
Afterward another invokation of \fB::fileutil::magic::rt::open\fR  is
required to process another file.
.sp
This command returns the empty string as its result.
.TP
\fB::fileutil::magic::rt::file_start\fR \fIname\fR
This command marks the start of a magic file when debugging. It
returns the empty string as its result.
.TP
\fB::fileutil::magic::rt::result\fR ?\fImsg\fR?
This command returns the current result and stops processing.
.sp
If \fImsg\fR is specified its text is added to the result before it is
returned. See \fB::fileutil::magic::rt::emit\fR for the allowed
special character sequences.
.TP
\fB::fileutil::magic::rt::resultv\fR ?\fImsg\fR?
This command returns the current result.
In contrast to \fB::fileutil::magic::rt::result\fR processing
continues.
.sp
If \fImsg\fR is specified its text is added to the result before it is
returned. See \fB::fileutil::magic::rt::emit\fR for the allowed
special character sequences.
.TP
\fB::fileutil::magic::rt::emit\fR \fImsg\fR
This command adds the text \fImsg\fR to the result buffer. The
message may contain the following special character sequences. They
will be replaced with buffered values before the message is added to
the result. The command returns the empty string as its result.
.RS
.TP
\fB\\b\fR
This sequence is removed
.TP
\fB%s\fR
Replaced with the last buffered string value.
.TP
\fB%ld\fR
Replaced with the last buffered numeric value.
.TP
\fB%d\fR
See above.
.RE
.TP
\fB::fileutil::magic::rt::Nv\fR \fItype\fR \fIoffset\fR ?\fIqual\fR?
This command fetches the numeric value with \fItype\fR from the
absolute location \fIoffset\fR and returns it as its result. The
fetched value is further stored in the numeric buffer.
.sp
If \fIqual\fR is specified it is considered to be a mask and applied
to the fetched value before it is stored and returned. It has to have
the form of a partial Tcl bit-wise expression, i.e.
.CS


	& number

.CE
.IP
For example:
.CS


	Nv lelong 0 &0x8080ffff

.CE
.IP
For the possible types see section \fBNUMERIC TYPES\fR.
.TP
\fB::fileutil::magic::rt::N\fR \fItype\fR \fIoffset\fR \fIcomp\fR \fIval\fR ?\fIqual\fR?
This command behaves mostly like \fB::fileutil::magic::rt::Nv\fR,
except that it compares the fetched and masked value against \fIval\fR
as specified with \fIcomp\fR and returns the result of that
comparison.
.sp
The argument \fIcomp\fR has to contain one of Tcl's comparison
operators, and the comparison made will be
.CS


	<val> <comp> <fetched-and-masked-value>

.CE
.sp
The special comparison operator \fBx\fR signals that no comparison
should be done, or, in other words, that the fetched value will always
match \fIval\fR.
.TP
\fB::fileutil::magic::rt::Nvx\fR \fIatlevel\fR \fItype\fR \fIoffset\fR ?\fIqual\fR?
This command behaves like \fB::fileutil::magic::rt::Nv\fR, except that
it additionally remembers the location in the file after the fetch in
the calling context, for the level \fIatlevel\fR, for later use by
\fB::fileutil::magic::rt::R\fR.
.TP
\fB::fileutil::magic::rt::Nx\fR \fIatlevel\fR \fItype\fR \fIoffset\fR \fIcomp\fR \fIval\fR ?\fIqual\fR?
This command behaves like \fB::fileutil::magic::rt::N\fR, except that
it additionally remembers the location in the file after the fetch in
the calling context, for the level \fIatlevel\fR, for later use by
\fB::fileutil::magic::rt::R\fR.
.TP
\fB::fileutil::magic::rt::S\fR \fIoffset\fR \fIcomp\fR \fIval\fR ?\fIqual\fR?
This command behaves like \fB::fileutil::magic::rt::N\fR, except that
it fetches and compares strings, not numeric data. The fetched value
is also stored in the internal string buffer instead of the numeric
buffer.
.TP
\fB::fileutil::magic::rt::Sx\fR \fIatlevel\fR \fIoffset\fR \fIcomp\fR \fIval\fR ?\fIqual\fR?
This command behaves like \fB::fileutil::magic::rt::S\fR, except that
it additionally remembers the location in the file after the fetch in
the calling context, for the level \fIatlevel\fR, for later use by
\fB::fileutil::magic::rt::R\fR.
.TP
\fB::fileutil::magic::rt::L\fR \fInewlevel\fR
This command sets the current level in the calling context to
\fInewlevel\fR. The command returns the empty string as its result.
.TP
\fB::fileutil::magic::rt::I\fR \fIbase\fR \fItype\fR \fIdelta\fR
This command handles base locations specified indirectly through the
contents of the inspected file. It returns the sum of \fIdelta\fR and
the value of numeric \fItype\fR fetched from the absolute location
\fIbase\fR.
.sp
For the possible types see section \fBNUMERIC TYPES\fR.
.TP
\fB::fileutil::magic::rt::R\fR \fIoffset\fR
This command handles base locations specified relative to the end of
the last field one level above.
.sp
In other words, the command computes an absolute location in the file
based on the relative \fIoffset\fR and returns it as its result. The
base the offset is added to is the last location remembered for the
level in the calling context.
.PP
.SH "NUMERIC TYPES"
.TP
\fBbyte\fR
8-bit integer
.TP
\fBshort\fR
16-bit integer, stored in native endianess
.TP
\fBbeshort\fR
see above, stored in big endian
.TP
\fBleshort\fR
see above, stored in small/little endian
.TP
\fBlong\fR
32-bit integer, stored in native endianess
.TP
\fBbelong\fR
see above, stored in big endian
.TP
\fBlelong\fR
see above, stored in small/little endian
.PP
All of the types above exit in an unsigned form as well. The type
names are the same, with the character "u" added as prefix.
.TP
\fBdate\fR
32-bit integer timestamp, stored in native endianess
.TP
\fBbedate\fR
see above, stored in big endian
.TP
\fBledate\fR
see above, stored in small/little endian
.TP
\fBldate\fR
32-bit integer timestamp, stored in native endianess
.TP
\fBbeldate\fR
see above, stored in big endian
.TP
\fBleldate\fR
see above, stored in small/little endian
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIfileutil :: magic\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
file(1), fileutil, magic(5)
.SH KEYWORDS
file recognition, file type, file utilities, mime, type
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/generator/generator.n.




















































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/generator/generator.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "generator" n 0.1 tcllib "Tcl Generator Commands"
.BS
.SH NAME
generator \- Procedures for creating and using generators.
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBgenerator  ?0.1?\fR
.sp
\fBgenerator\fR \fBdefine\fR \fIname\fR \fIparams\fR \fIbody\fR
.sp
\fBgenerator\fR \fByield\fR \fIarg\fR ?\fIargs..\fR?
.sp
\fBgenerator\fR \fBforeach\fR \fIvarList\fR \fIgenerator\fR \fIvarList\fR \fIgenerator\fR ?...? \fIbody\fR
.sp
\fBgenerator\fR \fBnext\fR \fIgenerator\fR ?\fIvarName..\fR?
.sp
\fBgenerator\fR \fBexists\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBnames\fR
.sp
\fBgenerator\fR \fBdestroy\fR ?\fIgenerator..\fR?
.sp
\fBgenerator\fR \fBfinally\fR \fIcmd\fR ?\fIarg..\fR?
.sp
\fBgenerator\fR \fBfrom\fR \fIformat\fR \fIvalue\fR
.sp
\fBgenerator\fR \fBto\fR \fIformat\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBmap\fR \fIfunction\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBfilter\fR \fIpredicate\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBreduce\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBfoldl\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBfoldr\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBall\fR \fIpredicate\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBand\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBany\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBconcat\fR \fIgenerator\fR ?\fIgenerator..\fR?
.sp
\fBgenerator\fR \fBconcatMap\fR \fIfunction\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBdrop\fR \fIn\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBdropWhile\fR \fIpredicate\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBcontains\fR \fIelement\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBfoldl1\fR \fIfunction\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBfoldli\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBfoldri\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBhead\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBtail\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBinit\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBtakeList\fR \fIn\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBtake\fR \fIn\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBiterate\fR \fIfunction\fR \fIinit\fR
.sp
\fBgenerator\fR \fBlast\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBlength\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBor\fR \fIpredicate\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBproduct\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBrepeat\fR \fIn\fR \fIvalue..\fR
.sp
\fBgenerator\fR \fBsum\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBtakeWhile\fR \fIpredicate\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBsplitWhen\fR \fIpredicate\fR \fIgenerator\fR
.sp
\fBgenerator\fR \fBscanl\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBgenerator\fR package provides commands to define and iterate over
generator expressions. A \fIgenerator\fR is a command that returns a sequence
of values. However, unlike an ordinary command that returns a list, a
generator \fIyields\fR each value and then suspends, allowing subsequent
values to be fetched on-demand. As such, generators can be used to efficiently
iterate over a set of values, without having to generate all answers in-memory.
Generators can be used to iterate over elements of a data structure, or rows
in the result set of a database query, or to decouple producer/consumer software
designs such as parsers and tokenizers, or to implement sophisticated custom
control strategies such as backtracking search. Generators reduce the need to
implement custom control structures, as many such structures can be recast as
generators, leading to both a simpler implementation and a more standardised
interface. The generator mechanism is built on top of the Tcl 8.6 coroutine
mechanism.
.PP
The package exports a single ensemble command, \fBgenerator\fR. All
functionality is provided as subcommands of this command. The core subcommands
of the package are \fBdefine\fR, \fByield\fR, and \fBforeach\fR. The
\fBdefine\fR command works like Tcl's \fBproc\fR command, but creates a
generator procedure; that is, a procedure that returns a generator when called.
The generator itself is a command that can be called multiple times: each time
it returns the next value in the generated series. When the
series has been exhausted, the generator command returns an empty list and then
destroys itself. Rather than manually call a generator, however, the package
also provides a flexible \fBforeach\fR command that loops through the values of
one or more generators. This loop construct mimicks the functionality of the
built-in Tcl \fBforeach\fR command, including handling multiple return values
and looping over multiple generators at once. Writing a generator is also a
simple task, much like writing a normal procedure: simply use the \fBdefine\fR
command to define the generator, and then call \fByield\fR instead of \fBreturn\fR.
For example, we can define a generator for looping through the integers
in a particular range:
.PP
.CS


    generator define range {n m} {
        for {set i $n} {$i <= $m} {incr i} { generator yield $i }
    }
    generator foreach x [range 1 10] {
        puts "x = $x"
    }

.CE
.PP
The above example will print the numbers from 1 to 10 in sequence, as you would
expect. The difference from a normal loop over a list is that the numbers are
only generated as they are needed. If we insert a break into the loop then any
remaining numbers in the sequence would never be generated. To illustrate, we
can define a generator that produces the sequence of natural numbers: an
infinite series. A normal procedure would never return trying to produce this
series as a list. By using a generator we only have to generate those values
which are actually used:
.PP
.CS


    generator define nats {} {
        while 1 { generator yield [incr nat] }
    }
    generator foreach n [nats] {
        if {$n > 100} { break }
    }

.CE
.SH COMMANDS
.TP
\fBgenerator\fR \fBdefine\fR \fIname\fR \fIparams\fR \fIbody\fR
Creates a new generator procedure. The arguments to the command are identical to
those for \fBproc\fR: a \fIname\fR, a list of parameters, and a body. The
parameter list format is identical to a procedure. In particular, default values
and the ?args? syntax can be used as usual. Each time the resulting
generator procedure is called it creates a new generator command (coroutine)
that will yield a list of values on each call. Each result from a generator is
guaranteed to be a non-empty list of values. When a generator is exhausted it
returns an empty list and then destroys itself to free up resources. It is an
error to attempt to call an exhausted generator as the command no longer exists.
.TP
\fBgenerator\fR \fByield\fR \fIarg\fR ?\fIargs..\fR?
Used in the definition of a generator, this command returns the next set of
values to the consumer. Once the \fByield\fR command has been called the
generator will suspend to allow the consumer to process that value. When the
next value is requested, the generator will resume as if the yield command had
just returned, and can continue processing to yield the next result. The
\fByield\fR command must be called with at least one argument, but can be called with
multiple arguments, in which case this is equivalent to calling \fByield\fR
once for each argument.
.TP
\fBgenerator\fR \fBforeach\fR \fIvarList\fR \fIgenerator\fR \fIvarList\fR \fIgenerator\fR ?...? \fIbody\fR
Loops through one or more generators, assigning the next values to variables and
then executing the loop body. Works much like the built-in \fBforeach\fR
command, but working with generators rather than lists. Multiple generators can
be iterated over in parallel, and multiple results can be retrieved from a
single generator at once.  Like the built-in \fBforeach\fR, the loop will
continue until all of the generators have been exhausted: variables for
generators that are exhausted early will be set to the empty string.
.sp
The \fBforeach\fR command will automatically clean-up all of the generators
at the end of the loop, regardless of whether the loop terminated early or not.
This behaviour is provided as a convenience to avoid having to explicitly
clean up a generator in the usual cases. Generators can however be destroyed
before the end of the loop, in which case the loop will continue as normal until
all the other generators have been destroyed or exhausted.
.sp
The \fBforeach\fR command does not take a snapshot of the generator. Any
changes in the state of the generator made inside the loop or by other code will
affect the state of the loop. In particular, if the code in the loop invokes the
generator to manually retrieve the next element, this element will then be
excluded from the loop, and the next iteration will continue from the element
after that one. Care should be taken to avoid concurrent updates to generators
unless this behaviour is required (e.g., in argument processing).
.TP
\fBgenerator\fR \fBnext\fR \fIgenerator\fR ?\fIvarName..\fR?
Manually retrieves the next values from a generator. One value is retrieved for
each variable supplied and assigned to the corresponding variable. If the
generator becomes exhausted at any time then any remaining variables are set to
the empty string.
.TP
\fBgenerator\fR \fBexists\fR \fIgenerator\fR
Returns 1 if the generator (still) exists, or 0 otherwise.
.TP
\fBgenerator\fR \fBnames\fR
Returns a list of all currently existing generator commands.
.TP
\fBgenerator\fR \fBdestroy\fR ?\fIgenerator..\fR?
Destroys one or more generators, freeing any associated resources.
.TP
\fBgenerator\fR \fBfinally\fR \fIcmd\fR ?\fIarg..\fR?
Used in the definition of a generator procedure, this command arranges for a
resource to be cleaned up whenever the generator is destroyed, either explicitly
or implicitly when the generator is exhausted. This command can be used like a
\fBfinally\fR block in the \fBtry\fR command, except that it is tied to the
life-cycle of the generator rather than to a particular scope. For example, if
we create a generator to iterate over the lines in a text file, we can use
\fBfinally\fR to ensure that the file is closed whenever the generator is
destroyed:
.sp
.CS


    generator define lines file {
        set in [open $file]
        # Ensure file is always closed
        generator finally close $in
        while {[gets $in line] >= 0} {
            generator yield $line
        }
    }
    generator foreach line [lines /etc/passwd] {
        puts "[incr count]: $line"
        if {$count > 10} { break }
    }
    # File will be closed even on early exit

.CE
.sp
If you create a generator that consumes another generator (such as the standard
\fBmap\fR and \fBfilter\fR generators defined later), then you should use
a \fBfinally\fR command to ensure that this generator is destroyed when its
parent is. For example, the \fBmap\fR generator is defined as follows:
.sp
.CS


    generator define map {f xs} {
        generator finally generator destroy $xs
        generator foreach x $xs { generator yield [{*}$f $x] }
    }

.CE
.TP
\fBgenerator\fR \fBfrom\fR \fIformat\fR \fIvalue\fR
Creates a generator from a data structure. Currently, supported formats are
\fBlist\fR, \fBdict\fR, or \fBstring\fR. The list format yields each
element in turn. For dictionaries, each key and value are yielded separately.
Finally, strings are yielded a character at a time.
.TP
\fBgenerator\fR \fBto\fR \fIformat\fR \fIgenerator\fR
Converts a generator into a data structure. This is the reverse operation of the
\fBfrom\fR command, and supports the same data structures. The two operations
obey the following identity laws (where \fB=\fR is interpreted
appropriately):
.sp
.CS


    [generator to $fmt [generator from $fmt $value]] = $value
    [generator from $fmt [generator to $fmt $gen]]   = $gen


.CE
.PP
.SH PRELUDE
.PP
The following commands are provided as a standard library of generator
combinators and functions that perform convenience operations on generators. The
functions in this section are loosely modelled on the equivalent functions from
the Haskell Prelude. \fIWarning:\fR most of the functions in this prelude
destroy any generator arguments they are passed as a side-effect. If you want to
have persistent generators, see the streams library.
.TP
\fBgenerator\fR \fBmap\fR \fIfunction\fR \fIgenerator\fR
Apply a function to every element of a generator, returning a new generator of
the results. This is the classic map function from functional programming,
applied to generators. For example, we can generate all the square numbers using
the following code (where \fBnats\fR is defined as earlier):
.sp
.CS


    proc square x { expr {$x * $x} }
    generator foreach n [generator map square [nats]] {
        puts "n = $n"
        if {$n > 1000} { break }
    }

.CE
.TP
\fBgenerator\fR \fBfilter\fR \fIpredicate\fR \fIgenerator\fR
Another classic functional programming gem. This command returns a generator
that yields only those items from the argument generator that satisfy the
predicate (boolean function). For example, if we had a generator \fBemployees\fR
that returned a stream of dictionaries representing people, we could filter all
those whose salaries are above 100,000 dollars (or whichever currency you prefer)
using a simple filter:
.sp
.CS


    proc salary> {amount person} { expr {[dict get $person salary] > $amount} }
    set fat-cats [generator filter {salary> 100000} $employees]

.CE
.TP
\fBgenerator\fR \fBreduce\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
This is the classic left-fold operation. This command takes a function, an
initial value, and a generator of values. For each element in the generator it
applies the function to the current accumulator value (the \fIzero\fR argument
initially) and that element, and then uses the result as the new accumulator
value. This process is repeated through the entire generator (eagerly) and the
final accumulator value is then returned. If we consider the function to be a
binary operator, and the zero argument to be the left identity element of that
operation, then we can consider the \fBreduce\fR command as \fIfolding\fR
the operator between each successive pair of values in the generator in a
left-associative fashion. For example, the sum of a sequence of numbers can be
calculated by folding a \fB+\fR operator between them, with 0 as the identity:
.sp
.CS


    # sum xs          = reduce + 0 xs
    # sum [range 1 5] = reduce + 0 [range 1 5]
    #                 = reduce + [+ 0 1] [range 2 5]
    #                 = reduce + [+ 1 2] [range 3 5]
    #                 = ...
    #                 = reduce + [+ 10 5] <empty>
    #                 = ((((0+1)+2)+3)+4)+5
    #                 = 15
    proc + {a b} { expr {$a + $b} }
    proc sum gen { generator reduce + 0 $gen }
    puts [sum [range 1 10]]

.CE
.sp
The \fBreduce\fR operation is an extremely useful one, and a great variety of
different operations can be defined using it. For example, we can define a
factorial function as the product of a range using generators. This definition
is both very clear and also quite efficient (in both memory and running time):
.sp
.CS


    proc * {x y} { expr {$x * $y} }
    proc prod gen { generator reduce * 0 $gen }
    proc fac n { prod [range 1 $n] }

.CE
.sp
However, while the \fBreduce\fR operation is efficient for finite generators,
care should be taken not to apply it to an infinite generator, as this will
result in an infinite loop:
.sp
.CS


    sum [nats]; # Never returns

.CE
.TP
\fBgenerator\fR \fBfoldl\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
This is an alias for the \fBreduce\fR command.
.TP
\fBgenerator\fR \fBfoldr\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
This is the right-associative version of \fBreduce\fR. This operation is
generally inefficient, as the entire generator needs to be evaluated into memory
(as a list) before the reduction can commence. In an eagerly evaluated language
like Tcl, this operation has limited use, and should be avoided if possible.
.TP
\fBgenerator\fR \fBall\fR \fIpredicate\fR \fIgenerator\fR
Returns true if all elements of the generator satisfy the given predicate.
.TP
\fBgenerator\fR \fBand\fR \fIgenerator\fR
Returns true if all elements of the generator are true (i.e., takes the logical
conjunction of the elements).
.TP
\fBgenerator\fR \fBany\fR \fIgenerator\fR
Returns true if any of the elements of the generator are true (i.e., logical
disjunction).
.TP
\fBgenerator\fR \fBconcat\fR \fIgenerator\fR ?\fIgenerator..\fR?
Returns a generator which is the concatenation of each of the argument
generators.
.TP
\fBgenerator\fR \fBconcatMap\fR \fIfunction\fR \fIgenerator\fR
Given a function which maps a value to a series of values, and a generator of
values of that type, returns a generator of all of the results in one flat
series. Equivalent to \fBconcat\fR applied to the result of \fBmap\fR.
.TP
\fBgenerator\fR \fBdrop\fR \fIn\fR \fIgenerator\fR
Removes the given number of elements from the front of the generator and returns
the resulting generator with those elements removed.
.TP
\fBgenerator\fR \fBdropWhile\fR \fIpredicate\fR \fIgenerator\fR
Removes all elements from the front of the generator that satisfy the predicate.
.TP
\fBgenerator\fR \fBcontains\fR \fIelement\fR \fIgenerator\fR
Returns true if the generator contains the given element. Note that this will
destroy the generator!
.TP
\fBgenerator\fR \fBfoldl1\fR \fIfunction\fR \fIgenerator\fR
A version of \fBfoldl\fR that takes the \fIzero\fR argument from the first
element of the generator. Therefore this function is only valid on non-empty
generators.
.TP
\fBgenerator\fR \fBfoldli\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
A version of \fBfoldl\fR that supplies the integer index of each element as
the first argument to the function. The first element in the generator at this
point is given index 0.
.TP
\fBgenerator\fR \fBfoldri\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
Right-associative version of \fBfoldli\fR.
.TP
\fBgenerator\fR \fBhead\fR \fIgenerator\fR
Returns the first element of the generator.
.TP
\fBgenerator\fR \fBtail\fR \fIgenerator\fR
Removes the first element of the generator, returning the rest.
.TP
\fBgenerator\fR \fBinit\fR \fIgenerator\fR
Returns a new generator consisting of all elements except the last of the
argument generator.
.TP
\fBgenerator\fR \fBtakeList\fR \fIn\fR \fIgenerator\fR
Returns the next \fIn\fR elements of the generator as a list. If not enough
elements are left in the generator, then just the remaining elements are
returned.
.TP
\fBgenerator\fR \fBtake\fR \fIn\fR \fIgenerator\fR
Returns the next \fIn\fR elements of the generator as a new generator. The old
generator is destroyed.
.TP
\fBgenerator\fR \fBiterate\fR \fIfunction\fR \fIinit\fR
Returns an infinite generator formed by repeatedly applying the function to the
initial argument. For example, the Fibonacci numbers can be defined as follows:
.sp
.CS


    proc fst pair { lindex $pair 0 }
    proc snd pair { lindex $pair 1 }
    proc nextFib ab { list [snd $ab] [expr {[fst $ab] + [snd $ab]}] }
    proc fibs {} { generator map fst [generator iterate nextFib {0 1}] }

.CE
.TP
\fBgenerator\fR \fBlast\fR \fIgenerator\fR
Returns the last element of the generator (if it exists).
.TP
\fBgenerator\fR \fBlength\fR \fIgenerator\fR
Returns the length of the generator, destroying it in the process.
.TP
\fBgenerator\fR \fBor\fR \fIpredicate\fR \fIgenerator\fR
Returns 1 if any of the elements of the generator satisfy the predicate.
.TP
\fBgenerator\fR \fBproduct\fR \fIgenerator\fR
Returns the product of the numbers in a generator.
.TP
\fBgenerator\fR \fBrepeat\fR \fIn\fR \fIvalue..\fR
Returns a generator that consists of \fIn\fR copies of the given elements. The
special value \fIInf\fR can be used to generate an infinite sequence.
.TP
\fBgenerator\fR \fBsum\fR \fIgenerator\fR
Returns the sum of the values in the generator.
.TP
\fBgenerator\fR \fBtakeWhile\fR \fIpredicate\fR \fIgenerator\fR
Returns a generator of the first elements in the argument generator that satisfy
the predicate.
.TP
\fBgenerator\fR \fBsplitWhen\fR \fIpredicate\fR \fIgenerator\fR
Splits the generator into lists of elements using the predicate to identify
delimiters. The resulting lists are returned as a generator. Elements matching
the delimiter predicate are discarded. For example, to split up a generator
using the string "|" as a delimiter:
.sp
.CS


    set xs [generator from list {a | b | c}]
    generator split {string equal "|"} $xs ;# returns a then b then c

.CE
.TP
\fBgenerator\fR \fBscanl\fR \fIfunction\fR \fIzero\fR \fIgenerator\fR
Similar to \fBfoldl\fR, but returns a generator of all of the intermediate
values for the accumulator argument. The final element of this generator is
equivalent to \fBfoldl\fR called on the same arguments.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
Please report any errors in this document, or in the package it describes, to
\fINeil Madden\fR [mailto:[email protected]].
.SH KEYWORDS
control structure, coroutine, filter, foldl, foldr, foreach, generator, iterator, map, reduce, scanl

Added embedded/man/files/modules/gpx/gpx.n.





















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/gpx/gpx.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2010, Keith Vetter <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "gpx" n 0.9 tcllib "GPS eXchange Format (GPX)"
.BS
.SH NAME
gpx \- Extracts waypoints, tracks and routes from GPX files
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBgpx  ?0.9?\fR
.sp
\fB::gpx::Create\fR \fIgpxFilename\fR ?\fIrawXML\fR?
.sp
\fB::gpx::Cleanup\fR \fItoken\fR
.sp
\fB::gpx::GetGPXMetadata\fR \fItoken\fR
.sp
\fB::gpx::GetWaypointCount\fR \fItoken\fR
.sp
\fB::gpx::GetAllWaypoints\fR \fItoken\fR
.sp
\fB::gpx::GetTrackCount\fR \fItoken\fR
.sp
\fB::gpx::GetTrackMetadata\fR \fItoken\fR \fIwhichTrack\fR
.sp
\fB::gpx::GetTrackPoints\fR \fItoken\fR \fIwhichTrack\fR
.sp
\fB::gpx::GetRouteCount\fR \fItoken\fR
.sp
\fB::gpx::GetRouteMetadata\fR \fItoken\fR \fIwhichRoute\fR
.sp
\fB::gpx::GetRoutePoints\fR \fItoken\fR \fIwhichRoute\fR
.sp
.BE
.SH DESCRIPTION
.PP
This module parses and extracts waypoints, tracks, routes and
metadata from a GPX (GPS eXchange) file. Both GPX version 1.0
and 1.1 are supported.
.SH COMMANDS
.TP
\fB::gpx::Create\fR \fIgpxFilename\fR ?\fIrawXML\fR?
The \fB::gpx::Create\fR is the first command called to process GPX
data. It takes the GPX data from either the \fIrawXML\fR
parameter if present or from the contents of \fIgpxFilename\fR,
and parses it using \fItdom\fR. It returns a token value that is used
by all the other commands.
.TP
\fB::gpx::Cleanup\fR \fItoken\fR
This procedure cleans up resources associated with \fItoken\fR.
It is \fIstrongly\fR recommended that you call this
function after you are done with a given GPX file.
Not doing so will result in memory not being freed, and
if your app calls \fB::gpx::Create\fR enough times, the
memory leak could cause a performance hit...or worse.
.TP
\fB::gpx::GetGPXMetadata\fR \fItoken\fR
This procedure returns a dictionary of the metadata
associated with the GPX data identified by \fItoken\fR.
The format of the metadata dictionary is described
below, but keys \fIversion\fR and \fIcreator\fR
will always be present.
.TP
\fB::gpx::GetWaypointCount\fR \fItoken\fR
This procedure returns the number of waypoints defined in the GPX
data identified by \fItoken\fR.
.TP
\fB::gpx::GetAllWaypoints\fR \fItoken\fR
This procedure returns the a list of waypoints defined in the GPX
data identified by \fItoken\fR. The format of each waypoint item
is described below.
.TP
\fB::gpx::GetTrackCount\fR \fItoken\fR
This procedure returns the number of tracks defined in the GPX
data identified by \fItoken\fR.
.TP
\fB::gpx::GetTrackMetadata\fR \fItoken\fR \fIwhichTrack\fR
This procedure returns a dictionary of the metadata
associated track number \fIwhichTrack\fR (1 based) in
the GPX data identified by \fItoken\fR.
The format of the metadata dictionary is described below.
.TP
\fB::gpx::GetTrackPoints\fR \fItoken\fR \fIwhichTrack\fR
The procedure returns a list of track points comprising track
number \fIwhichTrack\fR (1 based) in the GPX data identified by
\fItoken\fR. The format of the metadata dictionary is described below.
.TP
\fB::gpx::GetRouteCount\fR \fItoken\fR
This procedure returns the number of routes defined in the GPX
data identified by \fItoken\fR.
.TP
\fB::gpx::GetRouteMetadata\fR \fItoken\fR \fIwhichRoute\fR
This procedure returns a dictionary of the metadata
associated route number \fIwhichRoute\fR (1 based) in
the GPX data identified by \fItoken\fR.
The format of the metadata dictionary is described below.
.TP
\fB::gpx::GetRoutePoints\fR \fItoken\fR \fIwhichRoute\fR
The procedure returns a list of route points comprising route
number \fIwhichRoute\fR (1 based) in the GPX data identified by
\fItoken\fR. The format of the metadata dictionary is described below.
.PP
.SH "DATA STRUCTURES"
.TP
metadata dictionary
The metadata associated with either the GPX document, a
track, a route, a waypoint, a track point or route
point is returned in a dictionary. The keys of that
dictionary will be whatever optional GPX elements are
present. The value for each key depends on the GPX schema
for that element. For example, the value for a version
key will be a string, while for a link key will be
a sub-dictionary with keys \fIhref\fR and optionally
\fItext\fR and \fItype\fR.
.TP
point item
Each item in a track or route list of points consists of
a list of three elements: \fIlatitude\fR, \fIlongitude\fR and
\fImetadata dictionary\fR. \fILatitude\fR and \fIlongitude\fR
are decimal numbers. The \fImetadata dictionary\fR format is
described above. For points in a track, typically there will
always be ele (elevation) and time metadata keys.
.PP
.SH EXAMPLE
.CS


% set token [::gpx::Create myGpxFile.gpx]
% set version [dict get [::gpx::GetGPXMetadata $token] version]
% set trackCnt [::gpx::GetTrackCount $token]
% set firstPoint [lindex [::gpx::GetTrackPoints $token 1] 0]
% lassign $firstPoint lat lon ptMetadata
% puts "first point in the first track is at $lat, $lon"
% if {[dict exists $ptMetadata ele]} {
     puts "at elevation [dict get $ptMetadata ele] meters"
  }
% ::gpx::Cleanup $token

.CE
.SH REFERENCES
.IP [1]
GPX: the GPS Exchange Format
(\fIhttp://www.topografix.com/gpx.asp\fR)
.IP [2]
GPX 1.1 Schema Documentation (\fIhttp://www.topografix.com/GPX/1/1/\fR)
.IP [3]
GPX 1.0 Developer's Manual (\fIhttp://www.topografix.com/gpx_manual.asp\fR)
.PP
.SH AUTHOR
Keith Vetter
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgpx\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
gps, gpx
.SH CATEGORY
File formats
.SH COPYRIGHT
.nf
Copyright (c) 2010, Keith Vetter <[email protected]>

.fi

Added embedded/man/files/modules/grammar_aycock/aycock.n.




















































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_aycock/aycock.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 by Kevin B. Kenny <[email protected]>
'\" Redistribution permitted under the terms of the Open Publication License <http://www.opencontent.org/openpub/>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::aycock" n 1.0 tcllib "Aycock-Horspool-Earley parser generator for Tcl"
.BS
.SH NAME
grammar::aycock \- Aycock-Horspool-Earley parser generator for Tcl
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBgrammar::aycock  ?1.0?\fR
.sp
\fB::aycock::parser\fR \fIgrammar\fR ?\fB-verbose\fR?
.sp
\fIparserName\fR \fBparse\fR \fIsymList\fR \fIvalList\fR ?\fIclientData\fR?
.sp
\fIparserName\fR \fBdestroy\fR
.sp
\fIparserName\fR \fBterminals\fR
.sp
\fIparserName\fR \fBnonterminals\fR
.sp
\fIparserName\fR \fBsave\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBgrammar::aycock\fR package
implements a parser generator for the class of parsers described
in John Aycock and R. Nigel Horspool. Practical Earley Parsing.
\fIThe Computer Journal,\fR \fI45\fR(6):620-630, 2002.
\fIhttp://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.12.4254\fR
.SH PROCEDURES
The \fBgrammar::aycock\fR package exports the single procedure:
.TP
\fB::aycock::parser\fR \fIgrammar\fR ?\fB-verbose\fR?
Generates a parser for the given \fIgrammar\fR, and returns its
name.  If the optional \fB-verbose\fR flag is given, dumps verbose
information relating to the generated parser to the standard output.
The returned parser is an object that accepts commands as shown in
\fBOBJECT COMMAND\fR below.
.PP
.SH "OBJECT COMMAND"
.TP
\fIparserName\fR \fBparse\fR \fIsymList\fR \fIvalList\fR ?\fIclientData\fR?
Invokes a parser returned from \fB::aycock::parser\fR. \fIsymList\fR is
a list of grammar symbols representing the terminals in an input
string, and \fIvalList\fR is a list of their semantic values. The
result is the semantic value of the entire string when parsed.
.TP
\fIparserName\fR \fBdestroy\fR
Destroys a parser constructed by \fB::aycock::parser\fR.
.TP
\fIparserName\fR \fBterminals\fR
Returns a list of terminal symbols that may be presented in the
\fIsymList\fR argument to the \fBparse\fR object command.
.TP
\fIparserName\fR \fBnonterminals\fR
Returns a list of nonterminal symbols that were defined in the
parser's grammar.
.TP
\fIparserName\fR \fBsave\fR
Returns a Tcl script that will reconstruct the parser without
needing all the mechanism of the parser generator at run time.
The reconstructed parser depends on a set of commands in the
package \fBgrammar::aycock::runtime\fR,
which is also automatically loaded
when the \fBgrammar::aycock\fR package is loaded.
.PP
.SH DESCRIPTION
The \fBgrammar::aycock::parser\fR command accepts a grammar expressed as
a Tcl list.  The list must be structured as the concatenation of a set
of \fIrule\fRs. Each \fIrule\fR comprises a variable number of
elements in the list:
.IP \(bu
The name of the nonterminal symbol that the rule reduces.
.IP \(bu
The literal string, \fB::=\fR
.IP \(bu
Zero or more names of terminal or nonterminal symbols that
comprise the right-hand-side of the rule.
.IP \(bu
Finally, a Tcl script to execute when the rule is reduced.
Within the given script, a variable called \fB_\fR contains a list of
the semantic values of the symbols on the right-hand side. The value
returned by the script is expected to be the semantic value of the
left-hand side.  If the \fIclientData\fR parameter was passed to the
\fBparse\fR method, it is available in a variable called
\fBclientData\fR.  It is permissible for the script to be the empty
string.  In this case, the semantic value of the rule will be the same
as the semantic value of the first symbol on the right-hand side.  If
the right-hand side is also empty, the semantic value will be the
empty string.
.PP
Parsing is done with an Earley parser, which is not terribly efficient
in speed or memory consumption, but which deals effectively with
ambiguous grammars.  For this reason, the \fBgrammar::aycock\fR package is
perhaps best adapted to natural-language processing or the parsing of
extraordinarily complex languages in which ambiguity can be tolerated.
.SH EXAMPLE
The following code demonstrates a trivial desk calculator, admitting
only \fB+\fR, \fB*\fR and parentheses as its operators.  It also
shows the format in which the lexical analyzer is expected to present
terminal symbols to the parser.
.CS


set p [aycock::parser {
    start ::= E {}
    E ::= E + T {expr {[lindex $_ 0] + [lindex $_ 2]}}
    E ::= T {}
    T ::= T * F {expr {[lindex $_ 0] * [lindex $_ 2]}}
    T ::= F {}
    F ::= NUMBER {}
    F ::= ( E ) {lindex $_ 1}
}]
puts [$p parse {(  NUMBER +  NUMBER )  *  ( NUMBER +  NUMBER ) }  {{} 2      {} 3      {} {} {} 7     {} 1      {}}]
$p destroy

.CE
The example, when run, prints \fB40\fR.
.SH KEYWORDS
Aycock, Earley, Horspool, parser, compiler
.SH KEYWORDS
ambiguous, aycock, earley, grammar, horspool, parser, parsing, transducer
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2006 by Kevin B. Kenny <[email protected]>
Redistribution permitted under the terms of the Open Publication License <http://www.opencontent.org/openpub/>

.fi

Added embedded/man/files/modules/grammar_fa/dacceptor.n.













































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_fa/dacceptor.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::fa::dacceptor" n 0.1.1 tcllib "Finite automaton operations and usage"
.BS
.SH NAME
grammar::fa::dacceptor \- Create and use deterministic acceptors
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit \fR
.sp
package require \fBstruct::set \fR
.sp
package require \fBgrammar::fa::dacceptor  ?0.1.1?\fR
.sp
\fB::grammar::fa::dacceptor\fR \fIdaName\fR \fIfa\fR ?\fB-any\fR \fIany\fR?
.sp
\fBdaName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIdaName\fR \fBdestroy\fR
.sp
\fIdaName\fR \fBaccept?\fR \fIsymbols\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a class for acceptors constructed from
deterministic \fIfinite automatons\fR (DFA). Acceptors are objects
which can be given a string of symbols and tell if the DFA they are
constructed from would \fIaccept\fR that string.
For the actual creation of the DFAs the acceptors are based on we have
the packages \fBgrammar::fa\fR and \fBgrammar::fa::op\fR.
.PP
.SH API
The package exports the API described here.
.TP
\fB::grammar::fa::dacceptor\fR \fIdaName\fR \fIfa\fR ?\fB-any\fR \fIany\fR?
Creates a new deterministic acceptor with an associated global Tcl command
whose name is \fIdaName\fR. This command may be used to invoke various
operations on the acceptor. It has the following general form:
.RS
.TP
\fBdaName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command. See section \fBACCEPTOR METHODS\fR for more explanations.
.sp
The acceptor will be based on the deterministic finite automaton
stored in the object \fIfa\fR. It will keep a copy of the relevant
data of the FA in its own storage, in a form easy to use for its
purposes. This also means that changes made to the \fIfa\fR after the
construction of the acceptor \fIwill not\fR influence the acceptor.
.sp
If \fIany\fR has been specified, then the acceptor will convert all
symbols in the input which are unknown to the base FA to that symbol
before proceeding with the processing.
.RE
.PP
.SH "ACCEPTOR METHODS"
.PP
All acceptors provide the following methods for their manipulation:
.TP
\fIdaName\fR \fBdestroy\fR
Destroys the automaton, including its storage space and associated
command.
.TP
\fIdaName\fR \fBaccept?\fR \fIsymbols\fR
Takes the list of \fIsymbols\fR and checks if the FA the acceptor is
based on would accept it. The result is a boolean value. \fBTrue\fR
is returned if the symbols are accepted, and \fBFalse\fR
otherwise. Note that bogus symbols in the input are either translated
to the \fIany\fR symbol (if specified), or cause the acceptance test
to simply fail. No errors will be thrown. The method will process only
just that prefix of the input which is enough to fully determine
(non-)acceptance.
.PP
.PP
.SH EXAMPLES
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_fa\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
acceptance, acceptor, automaton, finite automaton, grammar, parsing, regular expression, regular grammar, regular languages, state, transducer
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2004 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_fa/dexec.n.




















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_fa/dexec.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Andreas Kupries <[email protected]>
'\" Copyright (c) 2007 Bogdan <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::fa::dexec" n 0.2 tcllib "Finite automaton operations and usage"
.BS
.SH NAME
grammar::fa::dexec \- Execute deterministic finite automatons
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit \fR
.sp
package require \fBgrammar::fa::dexec  ?0.2?\fR
.sp
\fB::grammar::fa::dexec\fR \fIdaName\fR \fIfa\fR ?\fB-any\fR \fIany\fR? ?\fB-command\fR \fIcmdprefix\fR?
.sp
\fBdaName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIdaName\fR \fBdestroy\fR
.sp
\fIdaName\fR \fBput\fR \fIsymbol\fR
.sp
\fIdaName\fR \fBreset\fR
.sp
\fIdaName\fR \fBstate\fR
.sp
\fIcmdprefix\fR \fBerror\fR \fIcode\fR \fImessage\fR
.sp
\fIcmdprefix\fR \fBfinal\fR \fIstateid\fR
.sp
\fIcmdprefix\fR \fBreset\fR
.sp
\fIcmdprefix\fR \fBstate\fR \fIstateid\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a class for executors constructed from
deterministic \fIfinite automatons\fR (DFA). Executors are objects
which are given a string of symbols in a piecemal fashion, perform
state transitions and report back when they enter a final state, or
find an error in the input.
For the actual creation of the DFAs the executors are based on we have
the packages \fBgrammar::fa\fR and \fBgrammar::fa::op\fR.
.PP
The objects follow a push model. Symbols are pushed into the executor,
and when something important happens, i.e. error occurs, a state transition,
or a final state is entered this will be reported via the callback
specified via the option \fB-command\fR. Note that conversion of
this into a pull model where the environment retrieves messages from
the object and the object uses a callback to ask for more symbols is
a trivial thing.
.PP
\fISide note\fR:
The acceptor objects provided by \fBgrammar::fa::dacceptor\fR
could have been implemented on top of the executors provided here, but
were not, to get a bit more performance (we avoid a number of method
calls and the time required for their dispatch).
.PP
.SH API
The package exports the API described here.
.TP
\fB::grammar::fa::dexec\fR \fIdaName\fR \fIfa\fR ?\fB-any\fR \fIany\fR? ?\fB-command\fR \fIcmdprefix\fR?
Creates a new deterministic executor with an associated global Tcl
command whose name is \fIdaName\fR. This command may be used to invoke
various operations on the executor. It has the following general form:
.RS
.TP
\fBdaName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command. See section \fBEXECUTOR METHODS\fR for more
explanations.
.sp
The executor will be based on the deterministic finite automaton
stored in the object \fIfa\fR. It will keep a copy of the relevant
data of the FA in its own storage, in a form easy to use for its
purposes. This also means that changes made to the \fIfa\fR after the
construction of the executor \fIwill not\fR influence the executor.
.sp
If \fIany\fR has been specified, then the executor will convert all
symbols in the input which are unknown to the base FA to that symbol
before proceeding with the processing.
.RE
.PP
.SH "EXECUTOR METHODS"
.PP
All executors provide the following methods for their manipulation:
.TP
\fIdaName\fR \fBdestroy\fR
Destroys the automaton, including its storage space and associated
command.
.TP
\fIdaName\fR \fBput\fR \fIsymbol\fR
Takes the current state of the executor and the \fIsymbol\fR and
performs the appropriate state transition. Reports any errors
encountered via the command callback, as well as entering a final
state of the underlying FA.
.sp
When an error is reported all further invokations of \fBput\fR will
do nothing, until the error condition has been cleared via an
invokation of method \fBreset\fR.
.TP
\fIdaName\fR \fBreset\fR
Unconditionally sets the executor into the start state of the
underlying FA. This also clears any error condition  \fBput\fR may
have encountered.
.TP
\fIdaName\fR \fBstate\fR
Returns the current state of the underlying FA. This allow for
introspection without the need to pass data from the callback command.
.PP
.SH "EXECUTOR CALLBACK"
The callback command \fIcmdprefix\fR given to an executor via the
option \fB-command\fR will be executed by the object at the global
level, using the syntax described below. Note that \fIcmdprefix\fR is
not simply the name of a command, but a full command prefix. In other
words it may contain additional fixed argument words beyond the
command word.
.TP
\fIcmdprefix\fR \fBerror\fR \fIcode\fR \fImessage\fR
The executor has encountered an error, and \fImessage\fR contains a
human-readable text explaining the nature of the problem.
The \fIcode\fR on the other hand is a fixed machine-readable text.
The following error codes can be generated by executor objects.
.RS
.TP
\fBBADSYM\fR
An unknown symbol was found in the input. This can happen if and only
if no \fB-any\fR symbol was specified.
.TP
\fBBADTRANS\fR
The underlying FA has no transition for the current combination of
input symbol and state. In other words, the executor was not able to
compute a new state for this combination.
.RE
.TP
\fIcmdprefix\fR \fBfinal\fR \fIstateid\fR
The executor has entered the final state \fIstateid\fR.
.TP
\fIcmdprefix\fR \fBreset\fR
The executor was reset.
.TP
\fIcmdprefix\fR \fBstate\fR \fIstateid\fR
The FA changed state due to a transition. \fIstateid\fR is the new state.
.PP
.PP
.SH EXAMPLES
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_fa\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
automaton, execution, finite automaton, grammar, parsing, regular expression, regular grammar, regular languages, running, state, transducer
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2004 Andreas Kupries <[email protected]>
Copyright (c) 2007 Bogdan <[email protected]>

.fi

Added embedded/man/files/modules/grammar_fa/fa.n.


































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_fa/fa.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::fa" n 0.4 tcllib "Finite automaton operations and usage"
.BS
.SH NAME
grammar::fa \- Create and manipulate finite automatons
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit  1.3\fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBstruct::set \fR
.sp
package require \fBgrammar::fa::op  ?0.2?\fR
.sp
package require \fBgrammar::fa  ?0.4?\fR
.sp
\fB::grammar::fa\fR \fIfaName\fR ?\fB=\fR|\fB:=\fR|\fB<--\fR|\fBas\fR|\fBdeserialize\fR \fIsrc\fR|\fBfromRegex\fR \fIre\fR ?\fIover\fR??
.sp
\fBfaName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIfaName\fR \fBdestroy\fR
.sp
\fIfaName\fR \fBclear\fR
.sp
\fIfaName\fR \fB=\fR \fIsrcFA\fR
.sp
\fIfaName\fR \fB-->\fR \fIdstFA\fR
.sp
\fIfaName\fR \fBserialize\fR
.sp
\fIfaName\fR \fBdeserialize\fR \fIserialization\fR
.sp
\fIfaName\fR \fBstates\fR
.sp
\fIfaName\fR \fBstate\fR \fBadd\fR \fIs1\fR ?\fIs2\fR ...?
.sp
\fIfaName\fR \fBstate\fR \fBdelete\fR \fIs1\fR ?\fIs2\fR ...?
.sp
\fIfaName\fR \fBstate\fR \fBexists\fR \fIs\fR
.sp
\fIfaName\fR \fBstate\fR \fBrename\fR \fIs\fR \fIsnew\fR
.sp
\fIfaName\fR \fBstartstates\fR
.sp
\fIfaName\fR \fBstart\fR \fBadd\fR \fIs1\fR ?\fIs2\fR ...?
.sp
\fIfaName\fR \fBstart\fR \fBremove\fR \fIs1\fR ?\fIs2\fR ...?
.sp
\fIfaName\fR \fBstart?\fR \fIs\fR
.sp
\fIfaName\fR \fBstart?set\fR \fIstateset\fR
.sp
\fIfaName\fR \fBfinalstates\fR
.sp
\fIfaName\fR \fBfinal\fR \fBadd\fR \fIs1\fR ?\fIs2\fR ...?
.sp
\fIfaName\fR \fBfinal\fR \fBremove\fR \fIs1\fR ?\fIs2\fR ...?
.sp
\fIfaName\fR \fBfinal?\fR \fIs\fR
.sp
\fIfaName\fR \fBfinal?set\fR \fIstateset\fR
.sp
\fIfaName\fR \fBsymbols\fR
.sp
\fIfaName\fR \fBsymbols@\fR \fIs\fR ?\fId\fR?
.sp
\fIfaName\fR \fBsymbols@set\fR \fIstateset\fR
.sp
\fIfaName\fR \fBsymbol\fR \fBadd\fR \fIsym1\fR ?\fIsym2\fR ...?
.sp
\fIfaName\fR \fBsymbol\fR \fBdelete\fR \fIsym1\fR ?\fIsym2\fR ...?
.sp
\fIfaName\fR \fBsymbol\fR \fBrename\fR \fIsym\fR \fInewsym\fR
.sp
\fIfaName\fR \fBsymbol\fR \fBexists\fR \fIsym\fR
.sp
\fIfaName\fR \fBnext\fR \fIs\fR \fIsym\fR ?\fB-->\fR \fInext\fR?
.sp
\fIfaName\fR \fB!next\fR \fIs\fR \fIsym\fR ?\fB-->\fR \fInext\fR?
.sp
\fIfaName\fR \fBnextset\fR \fIstateset\fR \fIsym\fR
.sp
\fIfaName\fR \fBis\fR \fBdeterministic\fR
.sp
\fIfaName\fR \fBis\fR \fBcomplete\fR
.sp
\fIfaName\fR \fBis\fR \fBuseful\fR
.sp
\fIfaName\fR \fBis\fR \fBepsilon-free\fR
.sp
\fIfaName\fR \fBreachable_states\fR
.sp
\fIfaName\fR \fBunreachable_states\fR
.sp
\fIfaName\fR \fBreachable\fR \fIs\fR
.sp
\fIfaName\fR \fBuseful_states\fR
.sp
\fIfaName\fR \fBunuseful_states\fR
.sp
\fIfaName\fR \fBuseful\fR \fIs\fR
.sp
\fIfaName\fR \fBepsilon_closure\fR \fIs\fR
.sp
\fIfaName\fR \fBreverse\fR
.sp
\fIfaName\fR \fBcomplete\fR
.sp
\fIfaName\fR \fBremove_eps\fR
.sp
\fIfaName\fR \fBtrim\fR ?\fIwhat\fR?
.sp
\fIfaName\fR \fBdeterminize\fR ?\fImapvar\fR?
.sp
\fIfaName\fR \fBminimize\fR ?\fImapvar\fR?
.sp
\fIfaName\fR \fBcomplement\fR
.sp
\fIfaName\fR \fBkleene\fR
.sp
\fIfaName\fR \fBoptional\fR
.sp
\fIfaName\fR \fBunion\fR \fIfa\fR ?\fImapvar\fR?
.sp
\fIfaName\fR \fBintersect\fR \fIfa\fR ?\fImapvar\fR?
.sp
\fIfaName\fR \fBdifference\fR \fIfa\fR ?\fImapvar\fR?
.sp
\fIfaName\fR \fBconcatenate\fR \fIfa\fR ?\fImapvar\fR?
.sp
\fIfaName\fR \fBfromRegex\fR \fIregex\fR ?\fIover\fR?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a container class for
\fIfinite automatons\fR (Short: FA).
It allows the incremental definition of the automaton, its
manipulation and querying of the definition.
While the package provides complex operations on the automaton
(via package \fBgrammar::fa::op\fR), it does not have the
ability to execute a definition for a stream of symbols.
Use the packages
\fBgrammar::fa::dacceptor\fR and
\fBgrammar::fa::dexec\fR for that.
Another package related to this is \fBgrammar::fa::compiler\fR. It
turns a FA into an executor class which has the definition of the FA
hardwired into it. The output of this package is configurable to suit
a large number of different implementation languages and paradigms.
.PP
For more information about what a finite automaton is see section
\fBFINITE AUTOMATONS\fR.
.SH API
The package exports the API described here.
.TP
\fB::grammar::fa\fR \fIfaName\fR ?\fB=\fR|\fB:=\fR|\fB<--\fR|\fBas\fR|\fBdeserialize\fR \fIsrc\fR|\fBfromRegex\fR \fIre\fR ?\fIover\fR??
Creates a new finite automaton with an associated global Tcl command
whose name is \fIfaName\fR. This command may be used to invoke various
operations on the automaton. It has the following general form:
.RS
.TP
\fBfaName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command. See section \fBFA METHODS\fR for more explanations. The
new automaton will be empty if no \fIsrc\fR is specified. Otherwise
it will contain a copy of the definition contained in the \fIsrc\fR.
The \fIsrc\fR has to be a FA object reference for all operators except
\fBdeserialize\fR and \fBfromRegex\fR. The \fBdeserialize\fR
operator requires \fIsrc\fR to be the serialization of a FA instead,
and \fBfromRegex\fR takes a regular expression in the form a of a
syntax tree. See \fB::grammar::fa::op::fromRegex\fR for more detail on
that.
.RE
.PP
.SH "FA METHODS"
.PP
All automatons provide the following methods for their manipulation:
.TP
\fIfaName\fR \fBdestroy\fR
Destroys the automaton, including its storage space and associated
command.
.TP
\fIfaName\fR \fBclear\fR
Clears out the definition of the automaton contained in \fIfaName\fR,
but does \fInot\fR destroy the object.
.TP
\fIfaName\fR \fB=\fR \fIsrcFA\fR
Assigns the contents of the automaton contained
in \fIsrcFA\fR to \fIfaName\fR, overwriting any
existing definition.
This is the assignment operator for automatons. It copies the
automaton contained in the FA object \fIsrcFA\fR over the automaton
definition in \fIfaName\fR. The old contents of \fIfaName\fR are
deleted by this operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIfaName\fR \fBdeserialize\fR [\fIsrcFA\fR \fBserialize\fR]

.CE
.TP
\fIfaName\fR \fB-->\fR \fIdstFA\fR
This is the reverse assignment operator for automatons. It copies the
automation contained in the object \fIfaName\fR over the automaton
definition in the object \fIdstFA\fR.
The old contents of \fIdstFA\fR are deleted by this operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIdstFA\fR \fBdeserialize\fR [\fIfaName\fR \fBserialize\fR]

.CE
.TP
\fIfaName\fR \fBserialize\fR
This method serializes the automaton stored in \fIfaName\fR. In other
words it returns a tcl \fIvalue\fR completely describing that
automaton.
This allows, for example, the transfer of automatons over arbitrary
channels, persistence, etc.
This method is also the basis for both the copy constructor and the
assignment operator.
.sp
The result of this method has to be semantically identical over all
implementations of the \fBgrammar::fa\fR interface. This is what
will enable us to copy automatons between different implementations of
the same interface.
.sp
The result is a list of three elements with the following structure:
.RS
.IP [1]
The constant string \fBgrammar::fa\fR.
.IP [2]
A list containing the names of all known input symbols. The order of
elements in this list is not relevant.
.IP [3]
The last item in the list is a dictionary, however the order of the
keys is important as well. The keys are the states of the serialized
FA, and their order is the order in which to create the states when
deserializing. This is relevant to preserve the order relationship
between states.
.sp
The value of each dictionary entry is a list of three elements
describing the state in more detail.
.RS
.IP [1]
A boolean flag. If its value is \fBtrue\fR then the state is a
start state, otherwise it is not.
.IP [2]
A boolean flag. If its value is \fBtrue\fR then the state is a
final state, otherwise it is not.
.IP [3]
The last element is a dictionary describing the transitions for the
state. The keys are symbols (or the empty string), and the values are
sets of successor states.
.RE
.RE
.sp
Assuming the following FA (which describes the life of a truck driver
in a very simple way :)
.sp
.CS


    Drive -- yellow --> Brake -- red --> (Stop) -- red/yellow --> Attention -- green --> Drive
    (...) is the start state.

.CE
.sp
a possible serialization is
.sp
.CS


    grammar::fa \\\\
    {yellow red green red/yellow} \\\\
    {Drive     {0 0 {yellow     Brake}} \\\\
     Brake     {0 0 {red        Stop}} \\\\
     Stop      {1 0 {red/yellow Attention}} \\\\
     Attention {0 0 {green      Drive}}}

.CE
.sp
A possible one, because I did not care about creation order here
.TP
\fIfaName\fR \fBdeserialize\fR \fIserialization\fR
This is the complement to \fBserialize\fR. It replaces the
automaton definition in \fIfaName\fR with the automaton described by
the \fIserialization\fR value. The old contents of \fIfaName\fR are
deleted by this operation.
.TP
\fIfaName\fR \fBstates\fR
Returns the set of all states known to \fIfaName\fR.
.TP
\fIfaName\fR \fBstate\fR \fBadd\fR \fIs1\fR ?\fIs2\fR ...?
Adds the states \fIs1\fR, \fIs2\fR, et cetera to the FA definition in
\fIfaName\fR. The operation will fail any of the new states is already
declared.
.TP
\fIfaName\fR \fBstate\fR \fBdelete\fR \fIs1\fR ?\fIs2\fR ...?
Deletes the state \fIs1\fR, \fIs2\fR, et cetera, and all associated
information from the FA definition in \fIfaName\fR. The latter means
that the information about in- or outbound transitions is deleted as
well. If the deleted state was a start or final state then this
information is invalidated as well. The operation will fail if the
state \fIs\fR is not known to the FA.
.TP
\fIfaName\fR \fBstate\fR \fBexists\fR \fIs\fR
A predicate. It tests whether the state \fIs\fR is known to the FA in
\fIfaName\fR.
The result is a boolean value. It will be set to \fBtrue\fR if the
state \fIs\fR is known, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBstate\fR \fBrename\fR \fIs\fR \fIsnew\fR
Renames the state \fIs\fR to \fIsnew\fR. Fails if \fIs\fR is not a
known state. Also fails if \fIsnew\fR is already known as a state.
.TP
\fIfaName\fR \fBstartstates\fR
Returns the set of states which are marked as \fIstart\fR states,
also known as \fIinitial\fR states.
See \fBFINITE AUTOMATONS\fR for explanations what this means.
.TP
\fIfaName\fR \fBstart\fR \fBadd\fR \fIs1\fR ?\fIs2\fR ...?
Mark the states \fIs1\fR, \fIs2\fR, et cetera in the FA \fIfaName\fR
as \fIstart\fR (aka \fIinitial\fR).
.TP
\fIfaName\fR \fBstart\fR \fBremove\fR \fIs1\fR ?\fIs2\fR ...?
Mark the states \fIs1\fR, \fIs2\fR, et cetera in the FA \fIfaName\fR
as \fInot start\fR (aka \fInot accepting\fR).
.TP
\fIfaName\fR \fBstart?\fR \fIs\fR
A predicate. It tests if the state \fIs\fR in the FA \fIfaName\fR is
\fIstart\fR or not.
The result is a boolean value. It will be set to \fBtrue\fR if the
state \fIs\fR is \fIstart\fR, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBstart?set\fR \fIstateset\fR
A predicate. It tests if the set of states \fIstateset\fR contains at
least one start state. They operation will fail if the set contains an
element which is not a known state.
The result is a boolean value. It will be set to \fBtrue\fR if a
start state is present in \fIstateset\fR, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBfinalstates\fR
Returns the set of states which are marked as \fIfinal\fR states,
also known as \fIaccepting\fR states.
See \fBFINITE AUTOMATONS\fR for explanations what this means.
.TP
\fIfaName\fR \fBfinal\fR \fBadd\fR \fIs1\fR ?\fIs2\fR ...?
Mark the states \fIs1\fR, \fIs2\fR, et cetera in the FA \fIfaName\fR
as \fIfinal\fR (aka \fIaccepting\fR).
.TP
\fIfaName\fR \fBfinal\fR \fBremove\fR \fIs1\fR ?\fIs2\fR ...?
Mark the states \fIs1\fR, \fIs2\fR, et cetera in the FA \fIfaName\fR
as \fInot final\fR (aka \fInot accepting\fR).
.TP
\fIfaName\fR \fBfinal?\fR \fIs\fR
A predicate. It tests if the state \fIs\fR in the FA \fIfaName\fR is
\fIfinal\fR or not.
The result is a boolean value. It will be set to \fBtrue\fR if the
state \fIs\fR is \fIfinal\fR, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBfinal?set\fR \fIstateset\fR
A predicate. It tests if the set of states \fIstateset\fR contains at
least one final state. They operation will fail if the set contains an
element which is not a known state.
The result is a boolean value. It will be set to \fBtrue\fR if a
final state is present in \fIstateset\fR, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBsymbols\fR
Returns the set of all symbols known to the FA \fIfaName\fR.
.TP
\fIfaName\fR \fBsymbols@\fR \fIs\fR ?\fId\fR?
Returns the set of all symbols for which the state \fIs\fR has transitions.
If the empty symbol is present then \fIs\fR has epsilon transitions. If two
states are specified the result is the set of symbols which have transitions
from \fIs\fR to \fIt\fR. This set may be empty if there are no transitions
between the two specified states.
.TP
\fIfaName\fR \fBsymbols@set\fR \fIstateset\fR
Returns the set of all symbols for which at least one state in the set
of states \fIstateset\fR has transitions.
In other words, the union of [\fIfaName\fR \fBsymbols@\fR \fBs\fR]
for all states \fBs\fR in \fIstateset\fR.
If the empty symbol is present then at least one state contained in
\fIstateset\fR has epsilon transitions.
.TP
\fIfaName\fR \fBsymbol\fR \fBadd\fR \fIsym1\fR ?\fIsym2\fR ...?
Adds the symbols \fIsym1\fR, \fIsym2\fR, et cetera to the FA
definition in \fIfaName\fR. The operation will fail any of the symbols
is already declared. The empty string is not allowed as a value for the symbols.
.TP
\fIfaName\fR \fBsymbol\fR \fBdelete\fR \fIsym1\fR ?\fIsym2\fR ...?
Deletes the symbols \fIsym1\fR, \fIsym2\fR et cetera, and all
associated information from the FA definition in \fIfaName\fR. The
latter means that all transitions using the symbols are deleted as
well. The operation will fail if any of the symbols is not known to
the FA.
.TP
\fIfaName\fR \fBsymbol\fR \fBrename\fR \fIsym\fR \fInewsym\fR
Renames the symbol \fIsym\fR to \fInewsym\fR. Fails if \fIsym\fR is
not a known symbol. Also fails if \fInewsym\fR is already known as a
symbol.
.TP
\fIfaName\fR \fBsymbol\fR \fBexists\fR \fIsym\fR
A predicate. It tests whether the symbol \fIsym\fR is known to the FA
in \fIfaName\fR.
The result is a boolean value. It will be set to \fBtrue\fR if the
symbol \fIsym\fR is known, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBnext\fR \fIs\fR \fIsym\fR ?\fB-->\fR \fInext\fR?
Define or query transition information.
.sp
If \fInext\fR is specified, then the method will add a transition from
the state \fIs\fR to the \fIsuccessor\fR state \fInext\fR labeled with
the symbol \fIsym\fR to the FA contained in \fIfaName\fR. The
operation will fail if \fIs\fR, or \fInext\fR are not known states, or
if \fIsym\fR is not a known symbol. An exception to the latter is that
\fIsym\fR is allowed to be the empty string. In that case the new
transition is an \fIepsilon transition\fR which will not consume
input when traversed. The operation will also fail if the combination
of (\fIs\fR, \fIsym\fR, and \fInext\fR) is already present in the FA.
.sp
If \fInext\fR was not specified, then the method will return
the set of states which can be reached from \fIs\fR through
a single transition labeled with symbol \fIsym\fR.
.TP
\fIfaName\fR \fB!next\fR \fIs\fR \fIsym\fR ?\fB-->\fR \fInext\fR?
Remove one or more transitions from the Fa in \fIfaName\fR.
.sp
If \fInext\fR was specified then the single transition from the state
\fIs\fR to the state \fInext\fR labeled with the symbol \fIsym\fR is
removed from the FA. Otherwise \fIall\fR transitions originating in
state \fIs\fR and labeled with the symbol \fIsym\fR will be removed.
.sp
The operation will fail if \fIs\fR and/or \fInext\fR are not known as
states. It will also fail if a non-empty \fIsym\fR is not known as
symbol. The empty string is acceptable, and allows the removal of
epsilon transitions.
.TP
\fIfaName\fR \fBnextset\fR \fIstateset\fR \fIsym\fR
Returns the set of states which can be reached by a single transition
originating in a state in the set \fIstateset\fR and labeled with the
symbol \fIsym\fR.
.sp
In other words, this is the union of
[\fIfaName\fR next \fBs\fR \fIsymbol\fR]
for all states \fBs\fR in \fIstateset\fR.
.TP
\fIfaName\fR \fBis\fR \fBdeterministic\fR
A predicate. It tests whether the FA in \fIfaName\fR is a
deterministic FA or not.
The result is a boolean value. It will be set to \fBtrue\fR if the
FA is deterministic, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBis\fR \fBcomplete\fR
A predicate. It tests whether the FA in \fIfaName\fR is a complete FA
or not. A FA is complete if it has at least one transition per state
and symbol. This also means that a FA without symbols, or states is
also complete.
The result is a boolean value. It will be set to \fBtrue\fR if the
FA is deterministic, and \fBfalse\fR otherwise.
.sp
Note: When a FA has epsilon-transitions transitions over a symbol for
a state S can be indirect, i.e. not attached directly to S, but to a
state in the epsilon-closure of S. The symbols for such indirect
transitions count when computing completeness.
.TP
\fIfaName\fR \fBis\fR \fBuseful\fR
A predicate. It tests whether the FA in \fIfaName\fR is an useful FA
or not. A FA is useful if all states are \fIreachable\fR
and \fIuseful\fR.
The result is a boolean value. It will be set to \fBtrue\fR if the
FA is deterministic, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBis\fR \fBepsilon-free\fR
A predicate. It tests whether the FA in \fIfaName\fR is an
epsilon-free FA or not. A FA is epsilon-free if it has no epsilon
transitions. This definition means that all deterministic FAs are
epsilon-free as well, and epsilon-freeness is a necessary
pre-condition for deterministic'ness.
The result is a boolean value. It will be set to \fBtrue\fR if the
FA is deterministic, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBreachable_states\fR
Returns the set of states which are reachable from a start state by
one or more transitions.
.TP
\fIfaName\fR \fBunreachable_states\fR
Returns the set of states which are not reachable from any start state
by any number of transitions. This is
.sp
.CS


	 [faName states] - [faName reachable_states]

.CE
.TP
\fIfaName\fR \fBreachable\fR \fIs\fR
A predicate. It tests whether the state \fIs\fR in the FA \fIfaName\fR
can be reached from a start state by one or more transitions.
The result is a boolean value. It will be set to \fBtrue\fR if the
state can be reached, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBuseful_states\fR
Returns the set of states which are able to reach a final state by
one or more transitions.
.TP
\fIfaName\fR \fBunuseful_states\fR
Returns the set of states which are not able to reach a final state by
any number of transitions. This is
.sp
.CS


	 [faName states] - [faName useful_states]

.CE
.TP
\fIfaName\fR \fBuseful\fR \fIs\fR
A predicate. It tests whether the state \fIs\fR in the FA \fIfaName\fR
is able to reach a final state by one or more transitions.
The result is a boolean value. It will be set to \fBtrue\fR if the
state is useful, and \fBfalse\fR otherwise.
.TP
\fIfaName\fR \fBepsilon_closure\fR \fIs\fR
Returns the set of states which are reachable from the state \fIs\fR
in the FA \fIfaName\fR by one or more epsilon transitions, i.e
transitions over the empty symbol, transitions which do not consume
input. This is called the \fIepsilon closure\fR of \fIs\fR.
.TP
\fIfaName\fR \fBreverse\fR
.TP
\fIfaName\fR \fBcomplete\fR
.TP
\fIfaName\fR \fBremove_eps\fR
.TP
\fIfaName\fR \fBtrim\fR ?\fIwhat\fR?
.TP
\fIfaName\fR \fBdeterminize\fR ?\fImapvar\fR?
.TP
\fIfaName\fR \fBminimize\fR ?\fImapvar\fR?
.TP
\fIfaName\fR \fBcomplement\fR
.TP
\fIfaName\fR \fBkleene\fR
.TP
\fIfaName\fR \fBoptional\fR
.TP
\fIfaName\fR \fBunion\fR \fIfa\fR ?\fImapvar\fR?
.TP
\fIfaName\fR \fBintersect\fR \fIfa\fR ?\fImapvar\fR?
.TP
\fIfaName\fR \fBdifference\fR \fIfa\fR ?\fImapvar\fR?
.TP
\fIfaName\fR \fBconcatenate\fR \fIfa\fR ?\fImapvar\fR?
.TP
\fIfaName\fR \fBfromRegex\fR \fIregex\fR ?\fIover\fR?
These methods provide more complex operations on the FA.  Please see
the same-named commands in the package \fBgrammar::fa::op\fR for
descriptions of what they do.
.PP
.PP
.SH EXAMPLES
.PP
.SH "FINITE AUTOMATONS"
.PP
For the mathematically inclined, a FA is a 5-tuple (S,Sy,St,Fi,T) where
.IP \(bu
S is a set of \fIstates\fR,
.IP \(bu
Sy a set of \fIinput symbols\fR,
.IP \(bu
St is a subset of S, the set of \fIstart\fR states, also known as
\fIinitial\fR states.
.IP \(bu
Fi is a subset of S, the set of \fIfinal\fR states, also known as
\fIaccepting\fR.
.IP \(bu
T is a function from S x (Sy + epsilon) to {S}, the \fItransition function\fR.
Here \fBepsilon\fR denotes the empty input symbol and is distinct
from all symbols in Sy; and {S} is the set of subsets of S. In other
words, T maps a combination of State and Input (which can be empty) to
a set of \fIsuccessor states\fR.
.PP
.PP
In computer theory a FA is most often shown as a graph where the nodes
represent the states, and the edges between the nodes encode the
transition function: For all n in S' = T (s, sy) we have one edge
between the nodes representing s and n resp., labeled with sy. The
start and accepting states are encoded through distinct visual
markers, i.e. they are attributes of the nodes.
.PP
FA's are used to process streams of symbols over Sy.
.PP
A specific FA is said to \fIaccept\fR a finite stream sy_1 sy_2
... sy_n if there is a path in the graph of the FA beginning at a
state in St and ending at a state in Fi whose edges have the labels
sy_1, sy_2, etc. to sy_n.
The set of all strings accepted by the FA is the \fIlanguage\fR of
the FA. One important equivalence is that the set of languages which
can be accepted by an FA is the set of \fIregular languages\fR.
.PP
Another important concept is that of deterministic FAs. A FA is said
to be \fIdeterministic\fR if for each string of input symbols there
is exactly one path in the graph of the FA beginning at the start
state and whose edges are labeled with the symbols in the string.
While it might seem that non-deterministic FAs to have more power of
recognition, this is not so. For each non-deterministic FA we can
construct a deterministic FA which accepts the same language (-->
Thompson's subset construction).
.PP
While one of the premier applications of FAs is in \fIparsing\fR,
especially in the \fIlexer\fR stage (where symbols == characters),
this is not the only possibility by far.
.PP
Quite a lot of processes can be modeled as a FA, albeit with a
possibly large set of states. For these the notion of accepting states
is often less or not relevant at all. What is needed instead is the
ability to act to state changes in the FA, i.e. to generate some
output in response to the input.
This transforms a FA into a \fIfinite transducer\fR, which has an
additional set OSy of \fIoutput symbols\fR and also an additional
\fIoutput function\fR O which maps from "S x (Sy + epsilon)" to
"(Osy + epsilon)", i.e a combination of state and input, possibly
empty to an output symbol, or nothing.
.PP
For the graph representation this means that edges are additional
labeled with the output symbol to write when this edge is traversed
while matching input. Note that for an application "writing an output
symbol" can also be "executing some code".
.PP
Transducers are not handled by this package. They will get their own
package in the future.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_fa\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
automaton, finite automaton, grammar, parsing, regular expression, regular grammar, regular languages, state, transducer
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2004-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_fa/faop.n.






















































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_fa/faop.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::fa::op" n 0.4 tcllib "Finite automaton operations and usage"
.BS
.SH NAME
grammar::fa::op \- Operations on finite automatons
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit \fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBstruct::set \fR
.sp
package require \fBgrammar::fa::op  ?0.4.1?\fR
.sp
\fB::grammar::fa::op::constructor\fR \fIcmd\fR
.sp
\fB::grammar::fa::op::reverse\fR \fIfa\fR
.sp
\fB::grammar::fa::op::complete\fR \fIfa\fR ?\fIsink\fR?
.sp
\fB::grammar::fa::op::remove_eps\fR \fIfa\fR
.sp
\fB::grammar::fa::op::trim\fR \fIfa\fR ?\fIwhat\fR?
.sp
\fB::grammar::fa::op::determinize\fR \fIfa\fR ?\fImapvar\fR?
.sp
\fB::grammar::fa::op::minimize\fR \fIfa\fR ?\fImapvar\fR?
.sp
\fB::grammar::fa::op::complement\fR \fIfa\fR
.sp
\fB::grammar::fa::op::kleene\fR \fIfa\fR
.sp
\fB::grammar::fa::op::optional\fR \fIfa\fR
.sp
\fB::grammar::fa::op::union\fR \fIfa\fR \fIfb\fR ?\fImapvar\fR?
.sp
\fB::grammar::fa::op::intersect\fR \fIfa\fR \fIfb\fR ?\fImapvar\fR?
.sp
\fB::grammar::fa::op::difference\fR \fIfa\fR \fIfb\fR ?\fImapvar\fR?
.sp
\fB::grammar::fa::op::concatenate\fR \fIfa\fR \fIfb\fR ?\fImapvar\fR?
.sp
\fB::grammar::fa::op::fromRegex\fR \fIfa\fR \fIregex\fR ?\fIover\fR?
.sp
\fB::grammar::fa::op::toRegexp\fR \fIfa\fR
.sp
\fB::grammar::fa::op::toRegexp2\fR \fIfa\fR
.sp
\fB::grammar::fa::op::toTclRegexp\fR \fIregexp\fR \fIsymdict\fR
.sp
\fB::grammar::fa::op::simplifyRegexp\fR \fIregexp\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a number of complex operations on finite
automatons (Short: FA),
as provided by the package \fBgrammar::fa\fR.
The package does not provide the ability to create and/or manipulate
such FAs, nor the ability to execute a FA for a stream of symbols.
Use the packages \fBgrammar::fa\fR
and \fBgrammar::fa::interpreter\fR for that.
Another package related to this is \fBgrammar::fa::compiler\fR
which turns a FA into an executor class which has the definition of
the FA hardwired into it.
.PP
For more information about what a finite automaton is see section
\fIFINITE AUTOMATONS\fR in package \fBgrammar::fa\fR.
.SH API
The package exports the API described here.  All commands modify their
first argument. I.e. whatever FA they compute is stored back into
it. Some of the operations will construct an automaton whose states
are all new, but related to the states in the source
automaton(s). These operations take variable names as optional
arguments where they will store mappings which describe the
relationship(s).
The operations can be loosely partitioned into structural and language
operations. The latter are defined in terms of the language the
automaton(s) accept, whereas the former are defined in terms of the
structural properties of the involved automaton(s). Some operations
are both.
\fIStructure operations\fR
.TP
\fB::grammar::fa::op::constructor\fR \fIcmd\fR
This command has to be called by the user of the package before any other
operations is performed, to establish a command which can be used to
construct a FA container object. If this is not done several operations
will fail as they are unable to construct internal and transient containers
to hold state and/or partial results.
.sp
Any container class using this package for complex operations should set
its own class command as the constructor. See package \fBgrammar::fa\fR
for an example.
.TP
\fB::grammar::fa::op::reverse\fR \fIfa\fR
Reverses the \fIfa\fR. This is done by reversing the direction of all
transitions and swapping the sets of \fIstart\fR and \fIfinal\fR
states. The language of \fIfa\fR changes unpredictably.
.TP
\fB::grammar::fa::op::complete\fR \fIfa\fR ?\fIsink\fR?
Completes the \fIfa\fR \fIcomplete\fR, but nothing is done if the
\fIfa\fR is already \fIcomplete\fR. This implies that only the first
in a series of multiple consecutive complete operations on \fIfa\fR
will perform anything. The remainder will be null operations.
.sp
The language of \fIfa\fR is unchanged by this operation.
.sp
This is done by adding a single new state, the \fIsink\fR, and
transitions from all other states to that sink for all symbols they
have no transitions for. The sink itself is made complete by adding
loop transitions for all symbols.
.sp
Note: When a FA has epsilon-transitions transitions over a symbol for
a state S can be indirect, i.e. not attached directly to S, but to a
state in the epsilon-closure of S. The symbols for such indirect
transitions count when computing completeness of a state. In other
words, these indirectly reached symbols are \fInot\fR missing.
.sp
The argument \fIsink\fR provides the name for the new state and most
not be present in the \fIfa\fR if specified. If the name is not
specified the command will name the state "sink\fBn\fR", where \fBn\fR
is set so that there are no collisions with existing states.
.sp
Note that the sink state is \fInot useful\fR by definition.  In
other words, while the FA becomes complete, it is also
\fInot useful\fR in the strict sense as it has a state from which
no final state can be reached.
.TP
\fB::grammar::fa::op::remove_eps\fR \fIfa\fR
Removes all epsilon-transitions from the \fIfa\fR in such a manner the
the language of \fIfa\fR is unchanged. However nothing is done if the
\fIfa\fR is already \fIepsilon-free\fR.
This implies that only the first in a series of multiple consecutive
complete operations on \fIfa\fR will perform anything. The remainder
will be null operations.
.sp
\fINote:\fR This operation may cause states to become unreachable or
not useful. These states are not removed by this operation.
Use \fB::grammar::fa::op::trim\fR for that instead.
.TP
\fB::grammar::fa::op::trim\fR \fIfa\fR ?\fIwhat\fR?
Removes unwanted baggage from \fIfa\fR.
The legal values for \fIwhat\fR are listed below. The command defaults
to \fB!reachable|!useful\fR if no specific argument was given.
.RS
.TP
\fB!reachable\fR
Removes all states which are not reachable from a start state.
.TP
\fB!useful\fR
Removes all states which are unable to reach a final state.
.TP
\fB!reachable&!useful\fR
.TP
\fB!(reachable|useful)\fR
Removes all states which are not reachable from a start state and are
unable to reach a final state.
.TP
\fB!reachable|!useful\fR
.TP
\fB!(reachable&useful)\fR
Removes all states which are not reachable from a start state or are
unable to reach a final state.
.RE
.sp
.TP
\fB::grammar::fa::op::determinize\fR \fIfa\fR ?\fImapvar\fR?
Makes the \fIfa\fR deterministic without changing the language
accepted by the \fIfa\fR. However nothing is done if the \fIfa\fR is
already \fIdeterministic\fR. This implies that only the first in a
series of multiple consecutive complete operations on \fIfa\fR will
perform anything. The remainder will be null operations.
.sp
The command will store a dictionary describing the relationship
between the new states of the resulting dfa and the states of the
input nfa in \fImapvar\fR, if it has been specified. Keys of the
dictionary are the handles for the states of the resulting dfa, values
are sets of states from the input nfa.
.sp
\fINote\fR: An empty dictionary signals that the command was able to
make the \fIfa\fR deterministic without performing a full subset
construction, just by removing states and shuffling transitions around
(As part of making the FA epsilon-free).
.sp
\fINote\fR: The algorithm fails to make the FA deterministic in the
technical sense if the FA has no start state(s), because determinism
requires the FA to have exactly one start states.
In that situation we make a best effort; and the missing start state
will be the only condition preventing the generated result from being
\fIdeterministic\fR.
It should also be noted that in this case the possibilities for
trimming states from the FA are also severely reduced as we cannot
declare states unreachable.
.TP
\fB::grammar::fa::op::minimize\fR \fIfa\fR ?\fImapvar\fR?
Creates a FA which accepts the same language as \fIfa\fR, but has a
minimal number of states. Uses Brzozowski's method to accomplish this.
.sp
The command will store a dictionary describing the relationship
between the new states of the resulting minimal fa and the states of
the input fa in \fImapvar\fR, if it has been specified. Keys of the
dictionary are the handles for the states of the resulting minimal fa,
values are sets of states from the input fa.
.sp
\fINote\fR: An empty dictionary signals that the command was able to
minimize the \fIfa\fR without having to compute new states. This
should happen if and only if the input FA was already minimal.
.sp
\fINote\fR: If the algorithm has no start or final states to work
with then the result might be technically minimal, but have a very
unexpected structure.
It should also be noted that in this case the possibilities for
trimming states from the FA are also severely reduced as we cannot
declare states unreachable.
.PP
\fILanguage operations\fR
All operations in this section require that all input FAs have at
least one start and at least one final state. Otherwise the language of
the FAs will not be defined, making the operation senseless (as it
operates on the languages of the FAs in a defined manner).
.TP
\fB::grammar::fa::op::complement\fR \fIfa\fR
Complements \fIfa\fR. This is possible if and only if \fIfa\fR is
\fIcomplete\fR and \fIdeterministic\fR. The resulting FA accepts the
complementary language of \fIfa\fR. In other words, all inputs not
accepted by the input are accepted by the result, and vice versa.
.sp
The result will have all states and transitions of the input, and
different final states.
.TP
\fB::grammar::fa::op::kleene\fR \fIfa\fR
Applies Kleene's closure to \fIfa\fR.
The resulting FA accepts all strings \fBS\fR for which we can find a
natural number \fBn\fR (0 inclusive) and strings \fBA1\fR ... \fBAn\fR
in the language of \fIfa\fR such that \fBS\fR is the concatenation of
\fBA1\fR ... \fBAn\fR.
In other words, the language of the result is the infinite union over
finite length concatenations over the language of \fIfa\fR.
.sp
The result will have all states and transitions of the input, and new
start and final states.
.TP
\fB::grammar::fa::op::optional\fR \fIfa\fR
Makes the \fIfa\fR optional. In other words it computes the FA which
accepts the language of \fIfa\fR and the empty the word (epsilon) as
well.
.sp
The result will have all states and transitions of the input, and new
start and final states.
.TP
\fB::grammar::fa::op::union\fR \fIfa\fR \fIfb\fR ?\fImapvar\fR?
Combines the FAs \fIfa\fR and \fIfb\fR such that the resulting FA
accepts the union of the languages of the two FAs.
.sp
The result will have all states and transitions of the two input FAs,
and new start and final states. All states of \fIfb\fR which exist in
\fIfa\fR as well will be renamed, and the \fImapvar\fR will contain a
mapping from the old states of \fIfb\fR to the new ones, if present.
.sp
It should be noted that the result will be non-deterministic, even if
the inputs are deterministic.
.TP
\fB::grammar::fa::op::intersect\fR \fIfa\fR \fIfb\fR ?\fImapvar\fR?
Combines the FAs \fIfa\fR and \fIfb\fR such that the resulting FA
accepts the intersection of the languages of the two FAs. In other
words, the result will accept a word if and only if the word is
accepted by both \fIfa\fR and \fIfb\fR. The result will be useful, but
not necessarily deterministic or minimal.
.sp
The command will store a dictionary describing the relationship
between the new states of the resulting fa and the pairs of states of
the input FAs in \fImapvar\fR, if it has been specified. Keys of the
dictionary are the handles for the states of the resulting fa, values
are pairs of states from the input FAs. Pairs are represented by
lists. The first element in each pair will be a state in \fIfa\fR, the
second element will be drawn from \fIfb\fR.
.TP
\fB::grammar::fa::op::difference\fR \fIfa\fR \fIfb\fR ?\fImapvar\fR?
Combines the FAs \fIfa\fR and \fIfb\fR such that the resulting FA
accepts the difference of the languages of the two FAs. In other
words, the result will accept a word if and only if the word is
accepted by \fIfa\fR, but not by \fIfb\fR. This can also be expressed
as the intersection of \fIfa\fR with the complement of \fIfb\fR. The
result will be useful, but not necessarily deterministic or minimal.
.sp
The command will store a dictionary describing the relationship
between the new states of the resulting fa and the pairs of states of
the input FAs in \fImapvar\fR, if it has been specified. Keys of the
dictionary are the handles for the states of the resulting fa, values
are pairs of states from the input FAs. Pairs are represented by
lists. The first element in each pair will be a state in \fIfa\fR, the
second element will be drawn from \fIfb\fR.
.TP
\fB::grammar::fa::op::concatenate\fR \fIfa\fR \fIfb\fR ?\fImapvar\fR?
Combines the FAs \fIfa\fR and \fIfb\fR such that the resulting FA
accepts the cross-product of the languages of the two FAs. I.e. a word
W will be accepted by the result if there are two words A and B
accepted by \fIfa\fR, and \fIfb\fR resp. and W is the concatenation of
A and B.
.sp
The result FA will be non-deterministic.
.TP
\fB::grammar::fa::op::fromRegex\fR \fIfa\fR \fIregex\fR ?\fIover\fR?
Generates a non-deterministic FA which accepts the same language as
the regular expression \fIregex\fR. If the \fIover\fR is specified it
is treated as the set of symbols the regular expression and the
automaton are defined over. The command will compute the set from the
"S" constructors in \fIregex\fR when \fIover\fR was not
specified. This set is important if and only if the complement
operator "!" is used in \fIregex\fR as the complementary language of
an FA is quite different for different sets of symbols.
.sp
The regular expression is represented by a nested list, which forms
a syntax tree. The following structures are legal:
.RS
.TP
{S x}
Atomic regular expression. Everything else is constructed from
these. Accepts the \fBS\fRymbol "x".
.TP
{. A1 A2 ...}
Concatenation operator. Accepts the concatenation of the regular
expressions \fBA1\fR, \fBA2\fR, etc.
.sp
\fINote\fR that this operator accepts zero or more arguments. With zero
arguments the represented language is \fIepsilon\fR, the empty word.
.TP
{| A1 A2 ...}
Choice operator, also called "Alternative". Accepts all input accepted
by at least one of the regular expressions \fBA1\fR, \fBA2\fR, etc. In
other words, the union of \fBA1\fR, \fBA2\fR.
.sp
\fINote\fR that this operator accepts zero or more arguments. With zero
arguments the represented language is the \fIempty\fR language,
the language without words.
.TP
{& A1 A2 ...}
Intersection operator, logical and. Accepts all input accepted which
is accepted by all of the regular expressions \fBA1\fR, \fBA2\fR,
etc. In other words, the intersection of \fBA1\fR, \fBA2\fR.
.TP
{? A}
Optionality operator. Accepts the empty word and anything from the
regular expression \fBA\fR.
.TP
{* A}
Kleene closure. Accepts the empty word and any finite concatenation of
words accepted by the regular expression \fBA\fR.
.TP
{+ A}
Positive Kleene closure. Accepts any finite concatenation of words
accepted by the regular expression \fBA\fR, but not the empty word.
.TP
{! A}
Complement operator. Accepts any word not accepted by the regular
expression \fBA\fR. Note that the complement depends on the set of
symbol the result should run over. See the discussion of the argument
\fIover\fR before.
.RE
.TP
\fB::grammar::fa::op::toRegexp\fR \fIfa\fR
This command generates and returns a regular expression which accepts
the same language as the finite automaton \fIfa\fR. The regular
expression is in the format as described above, for
\fB::grammar::fa::op::fromRegex\fR.
.TP
\fB::grammar::fa::op::toRegexp2\fR \fIfa\fR
This command has the same functionality as \fB::grammar::fa::op::toRegexp\fR,
but uses a different algorithm to simplify the generated regular expressions.
.TP
\fB::grammar::fa::op::toTclRegexp\fR \fIregexp\fR \fIsymdict\fR
This command generates and returns a regular expression in Tcl syntax for the
regular expression \fIregexp\fR, if that is possible. \fIregexp\fR is in the
same format as expected by \fB::grammar::fa::op::fromRegex\fR.
.sp
The command will fail and throw an error if \fIregexp\fR contains
complementation and intersection operations.
.sp
The argument \fIsymdict\fR is a dictionary mapping symbol names to
pairs of \fIsyntactic type\fR and Tcl-regexp. If a symbol
occurring in the \fIregexp\fR is not listed in this dictionary then
single-character symbols are considered to designate themselves
whereas multiple-character symbols are considered to be a character
class name.
.TP
\fB::grammar::fa::op::simplifyRegexp\fR \fIregexp\fR
This command simplifies a regular expression by applying the following
algorithm first to the main expression and then recursively to all
sub-expressions:
.RS
.IP [1]
Convert the expression into a finite automaton.
.IP [2]
Minimize the automaton.
.IP [3]
Convert the automaton back to a regular expression.
.IP [4]
Choose the shorter of original expression and expression from
the previous step.
.RE
.PP
.PP
.SH EXAMPLES
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_fa\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
automaton, finite automaton, grammar, parsing, regular expression, regular grammar, regular languages, state, transducer
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2004-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_me/gasm.n.





































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_me/gasm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::me::cpu::gasm" n 0.1 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::me::cpu::gasm \- ME assembler
.SH SYNOPSIS
package require \fBgrammar::me::cpu::gasm  ?0.1?\fR
.sp
\fB::grammar::me::cpu::gasm::begin\fR \fIg\fR \fIn\fR ?\fImode\fR? ?\fInote\fR?
.sp
\fB::grammar::me::cpu::gasm::done\fR \fB-->\fR \fIt\fR
.sp
\fB::grammar::me::cpu::gasm::state\fR
.sp
\fB::grammar::me::cpu::gasm::state!\fR \fIs\fR
.sp
\fB::grammar::me::cpu::gasm::lift\fR \fIt\fR \fIdst\fR \fB=\fR \fIsrc\fR
.sp
\fB::grammar::me::cpu::gasm::Inline\fR \fIt\fR \fInode\fR \fIlabel\fR
.sp
\fB::grammar::me::cpu::gasm::Cmd\fR \fIcmd\fR ?\fIarg\fR...?
.sp
\fB::grammar::me::cpu::gasm::Bra\fR
.sp
\fB::grammar::me::cpu::gasm::Nop\fR \fItext\fR
.sp
\fB::grammar::me::cpu::gasm::Note\fR \fItext\fR
.sp
\fB::grammar::me::cpu::gasm::Jmp\fR \fIlabel\fR
.sp
\fB::grammar::me::cpu::gasm::Exit\fR
.sp
\fB::grammar::me::cpu::gasm::Who\fR \fIlabel\fR
.sp
\fB::grammar::me::cpu::gasm::/Label\fR \fIname\fR
.sp
\fB::grammar::me::cpu::gasm::/Clear\fR
.sp
\fB::grammar::me::cpu::gasm::/Ok\fR
.sp
\fB::grammar::me::cpu::gasm::/Fail\fR
.sp
\fB::grammar::me::cpu::gasm::/At\fR \fIname\fR
.sp
\fB::grammar::me::cpu::gasm::/CloseLoop\fR
.sp
.BE
.SH DESCRIPTION
This package provides a simple in-memory assembler. Its origin is that
of a support package for use by packages converting PEG and other
grammars into a corresponding matcher based on the ME virtual machine,
like \fBpage::compiler::peg::mecpu\fR. Despite that it is actually
mostly agnostic regarding the instructions, users can choose any
instruction set they like.
.PP
The program under construction is held in a graph structure (See
package \fBstruct::graph\fR) during assembly and subsequent
manipulation, with instructions represented by nodes, and the flow of
execution between instructions explicitly encoded in the arcs between
them.
.PP
In this model jumps are not encoded explicitly, they are implicit in
the arcs. The generation of explicit jumps is left to any code
converting the graph structure into a more conventional
representation. The same goes for branches. They are implicitly
encoded by all instructions which have two outgoing arcs, whereas all
other instructions have only one outgoing arc. Their conditonality is
handled by tagging their outgoing arcs with information about the
conditions under which they are taken.
.PP
While the graph the assembler operates on is supplied from the
outside, i.e. external, it does manage some internal state, namely:
.IP [1]
The handle of the graph node most assembler operations will
work on, the \fIanchor\fR.
.IP [2]
A mapping from arbitrary strings to instructions. I.e. it is
possible to \fIlabel\fR an instruction during assembly, and later
recall that instruction by its label.
.IP [3]
The condition code to use when creating arcs between
instructions, which is one of \fBalways\fR, \fBok\fR, and
\fBfail\fR.
.IP [4]
The current operation mode, one of \fBhalt\fR,
\fBokfail\fR, and \fB!okfail\fR.
.IP [5]
The name of a node in a tree. This, and the operation mode
above are the parts most heavily influenced by the needs of a grammar
compiler, as they assume some basic program structures (selected
through the operation mode), and intertwine the graph with a tree,
like the AST for the grammar to be compiled.
.PP
.SH DEFINITIONS
As the graph the assembler is operating on, and the tree it is
intertwined with, are supplied to the assembler from the outside it is
necessary to specify the API expected from them, and to describe the
structures expected and/or generated by the assembler in either.
.PP
.IP [1]
Any graph object command used by the assembler has to provide
the API as specified in the documentation for the package
\fBstruct::graph\fR.
.IP [2]
Any tree object command used by the assembler has to provide
the API as specified in the documentation for the package
\fBstruct::tree\fR.
.IP [3]
Any instruction (node) generated by the assembler in a graph
will have at least two, and at most three attributes:
.RS
.TP
\fBinstruction\fR
The value of this attribute is the name of
the instruction. The only names currently defined by the assembler are
the three pseudo-instructions
.RS
.TP
\fBNOP\fR
This instruction does nothing. Useful for fixed
framework nodes, unchanging jump destinations, and the like. No
arguments.
.TP
\fBC\fR
A .NOP to allow the insertion of arbitrary comments
into the instruction stream, i.e. a comment node. One argument, the
text of the comment.
.TP
\fBBRA\fR
A .NOP serving as explicitly coded conditional
branch. No arguments.
.RE
.IP
However we reserve the space of all instructions whose names begin
with a "." (dot) for future use by the assembler.
.TP
\fBarguments\fR
The value of this attribute is a list of
strings, the arguments of the instruction. The contents are dependent
on the actual instruction and the assembler doesn't know or care about
them. This means for example that it has no builtin knowledge about
what instruction need which arguments and thus doesn't perform any
type of checking.
.TP
\fBexpr\fR
This attribute is optional. When it is present its
value is the name of a node in the tree intertwined with the graph.
.RE
.IP [4]
Any arc between two instructions will have one attribute:
.RS
.TP
\fBcondition\fR
The value of this attribute determines under which
condition execution will take this arc. It is one of \fBalways\fR,
\fBok\fR, and \fBfail\fR. The first condition is used for all arcs
which are the single outgoing arc of an instruction. The other two are
used for the two outgoing arcs of an instruction which implicitly
encode a branch.
.RE
.IP [5]
A tree node given to the assembler for cross-referencing will
be written to and given the following attributes, some fixed, some
dependent on the operation mode. All values will be references to
nodes in the instruction graph. Some of the instruction will expect
some or specific sets of these attributes.
.RS
.TP
\fBgas::entry\fR
Always written.
.TP
\fBgas::exit\fR
Written for all modes but \fBokfail\fR.
.TP
\fBgas::exit::ok\fR
Written for mode \fBokfail\fR.
.TP
\fBgas::exit::fail\fR
Written for mode \fBokfail\fR.
.RE
.PP
.SH API
.TP
\fB::grammar::me::cpu::gasm::begin\fR \fIg\fR \fIn\fR ?\fImode\fR? ?\fInote\fR?
This command starts the assembly of an instruction sequence, and
(re)initializes the state of the assembler. After completion of the
instruction sequence use \fB::grammar::me::cpu::gasm::done\fR to
finalize the assembler.
.sp
It will operate on the graph \fIg\fR in the specified \fImode\fR
(Default is \fBokfail\fR). As part of the initialization it will
always create a standard .NOP instruction and label it "entry". The
creation of the remaining standard instructions is
\fImode\fR-dependent:
.RS
.TP
\fBhalt\fR
An "icf_halt" instruction labeled "exit/return".
.TP
\fB!okfail\fR
An "icf_ntreturn" instruction labeled "exit/return".
.TP
\fBokfail\fR
Two .NOP instructions labeled "exit/ok" and
"exit/fail" respectively.
.RE
.IP
The \fInote\fR, if specified (default is not), is given to the "entry" .NOP instruction.
.sp
The node reference \fIn\fR is simply stored for use by
\fB::grammar::me::cpu::gasm::done\fR. It has to refer to a node in the
tree \fIt\fR argument of that command.
.sp
After the initialization is done the "entry" instruction will be the
\fIanchor\fR, and the condition code will be set to \fBalways\fR.
.sp
The command returns the empy string as its result.
.TP
\fB::grammar::me::cpu::gasm::done\fR \fB-->\fR \fIt\fR
This command finalizes the creation of an instruction sequence and
then clears the state of the assembler.
\fINOTE\fR that this \fIdoes not\fR delete any of the created
instructions. They can be made available to future begin/done cycles.
Further assembly will be possible only after reinitialization of the
system via \fB::grammar::me::cpu::gasm::begin\fR.
.sp
Before the state is cleared selected references to selected
instructions will be written to attributes of the node \fIn\fR in the
tree \fIt\fR.
Which instructions are saved is \fImode\fR-dependent. Both \fImode\fR
and the destination node \fIn\fR were specified during invokation of
\fB::grammar::me::cpu::gasm::begin\fR.
.sp
Independent of the mode a reference to the instruction labeled "entry"
will be saved to the attribute \fBgas::entry\fR of \fIn\fR. The
reference to the node \fIn\fR will further be saved into the attribute
"expr" of the "entry" instruction. Beyond that
.RS
.TP
\fBhalt\fR
A reference to the instruction labeled
"exit/return" will be saved to the attribute \fBgas::exit\fR of
\fIn\fR.
.TP
\fBokfail\fR
See \fBhalt\fR.
.TP
\fB!okfail\fR
Reference to the two instructions labeled
"exit/ok" and "exit/fail" will be saved to the attributes
\fBgas::exit::ok\fR and \fBgas::exit::fail\fR of \fIn\fR
respectively.
.RE
.sp
The command returns the empy string as its result.
.TP
\fB::grammar::me::cpu::gasm::state\fR
This command returns the current state of the assembler. Its format is
not documented and considered to be internal to the package.
.TP
\fB::grammar::me::cpu::gasm::state!\fR \fIs\fR
This command takes a serialized assembler state \fIs\fR as returned by
\fB::grammar::me::cpu::gasm::state\fR and makes it the current state
of the assembler.
.sp
\fINote\fR that this may overwrite label definitions, however all
non-conflicting label definitions in the state before are not touched
and merged with \fIs\fR.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::lift\fR \fIt\fR \fIdst\fR \fB=\fR \fIsrc\fR
This command operates on the tree \fIt\fR. It copies the contents of
the attributes \fBgas::entry\fR, \fBgas::exit::ok\fR and
\fBgas::exit::fail\fR from the node \fIsrc\fR to the node \fIdst\fR.
It returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::Inline\fR \fIt\fR \fInode\fR \fIlabel\fR
This command links an instruction sequence created by an earlier
begin/done pair into the current instruction sequence.
.sp
To this end it
.RS
.IP [1]
reads the instruction references from the attributes
\fBgas::entry\fR, \fBgas::exit::ok\fR, and \fBgas::exit::fail\fR
from the node \fIn\fR of the tree \fIt\fR and makes them available to
assembler und the labels \fIlabel\fR/entry, \fIlabel\fR/exit::ok, and
\fIlabel\fR/exit::fail respectively.
.IP [2]
Creates an arc from the \fIanchor\fR to the node labeled
\fIlabel\fR/entry, and tags it with the current condition code.
.IP [3]
Makes the node labeled \fIlabel\fR/exit/ok the new \fIanchor\fR.
.RE
.IP
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::Cmd\fR \fIcmd\fR ?\fIarg\fR...?
This is the basic command to add instructions to the graph.
It creates a new instruction of type \fIcmd\fR with the given
arguments \fIarg\fR...
If the \fIanchor\fR was defined it will also create an arc from the
\fIanchor\fR to the new instruction using the current condition code.
After the call the new instruction will be the \fIanchor\fR and the
current condition code will be set to \fBalways\fR.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::Bra\fR
This is a convenience command to create a .BRA pseudo-instruction. It
uses \fB::grammar::me::cpu::gasm::Cmd\fR to actually create the
instruction and inherits its behaviour.
.TP
\fB::grammar::me::cpu::gasm::Nop\fR \fItext\fR
This is a convenience command to create a .NOP pseudo-instruction. It
uses \fB::grammar::me::cpu::gasm::Cmd\fR to actually create the
instruction and inherits its behaviour.
The \fItext\fR will be saved as the first and only argument of the new
instruction.
.TP
\fB::grammar::me::cpu::gasm::Note\fR \fItext\fR
This is a convenience command to create a .C pseudo-instruction,
i.e. a comment. It uses \fB::grammar::me::cpu::gasm::Cmd\fR to
actually create the instruction and inherits its behaviour.
The \fItext\fR will be saved as the first and only argument of the new
instruction.
.TP
\fB::grammar::me::cpu::gasm::Jmp\fR \fIlabel\fR
This command creates an arc from the \fIanchor\fR to the instruction
labeled with \fIlabel\fR, and tags with the the current condition
code.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::Exit\fR
This command creates an arc from the \fIanchor\fR to one of the exit
instructions, based on the operation mode (see
\fB::grammar::me::cpu::gasm::begin\fR), and tags it with current
condition code.
.sp
For mode \fBokfail\fR it links to the instruction labeled either
"exit/ok" or "exit/fail", depending on the current condition code, and
tagging it with the current condition code
For the other two modes it links to the instruction labeled
"exit/return", tagging it condition code \fBalways\fR, independent
the current condition code.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::Who\fR \fIlabel\fR
This command returns a reference to the instruction labeled with
\fIlabel\fR.
.TP
\fB::grammar::me::cpu::gasm::/Label\fR \fIname\fR
This command labels the \fIanchor\fR with \fIname\fR.
\fINote\fR that an instruction can have more than one label.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::/Clear\fR
This command clears the \fIanchor\fR, leaving it undefined, and
further resets the current condition code to \fBalways\fR.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::/Ok\fR
This command sets the current condition code to \fBok\fR.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::/Fail\fR
This command sets the current condition code to \fBfail\fR.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::/At\fR \fIname\fR
This command sets the \fIanchor\fR to the instruction labeled with
\fIname\fR, and further resets the current condition code to
\fBalways\fR.
.sp
The command returns the empty string as its result.
.TP
\fB::grammar::me::cpu::gasm::/CloseLoop\fR
This command marks the \fIanchor\fR as the last instruction in a loop
body, by creating the attribute \fBLOOP\fR.
.sp
The command returns the empty string as its result.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_me\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
assembler, grammar, graph, parsing, tree, virtual machine
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_me/me_ast.n.

























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_me/me_ast.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::me_ast" n 0.1 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::me_ast \- Various representations of ASTs
.SH DESCRIPTION
This document specifies various representations for the
\fIabstract syntax tree\fRs (short \fIAST\fR) generated by
instances of ME virtual machines, independent of variant.
Please go and read the document \fBgrammar::me_intro\fR first if
you do not know what a ME virtual machine is.
.PP
ASTs and all the representations we specify distinguish between two
types of nodes, namely:
.PP
.TP
Terminal
Terminal nodes refer to the terminal symbols found in the token
stream. They are always leaf nodes. I.e. terminal nodes never have
children.
.TP
Nonterminal
Nonterminal nodes represent a nonterminal symbol of the grammar used
during parsing. They can occur as leaf and inner nodes of the
tree.
.PP
.PP
Both types of nodes carry basic range information telling a user which
parts of the input are covered by the node by providing the location
of the first and last tokens found within the range. Locations are
provided as non-negative integer offsets from the beginning of the
token stream, with the first token found in the stream located at
offset 0 (zero).
.PP
The root of an AS tree can be either a terminal or nonterminal node.
.SH "AST VALUES"
This representation of ASTs is a Tcl list. The main list represents
the root node of the tree, with the representations of the children
nested within.
.PP
Each node is represented by a single Tcl list containing three or more
elements. The first element is either the empty string or the name of
a nonterminal symbol (which is never the empty string). The second and
third elements are then the locations of the first and last tokens.
Any additional elements after the third are then the representations
of the children, with the leftmost child first, i.e. as the fourth
element of the list representing the node.
.SH "AST OBJECTS"
In this representation an AST is represented by a Tcl object command
whose API is compatible to the tree objects provided by the package
\fBstruct::tree\fR. I.e it has to support at least all of the
methods described by that package, and may support more.
.PP
Because of this the remainder of the specifications is written using
the terms of \fBstruct::tree\fR.
.PP
Each node of the AST directly maps to a node in the tree object. All
data beyond the child nodes, i.e. node type and input locations, are
stored in attributes of the node in the tree object. They are:
.TP
type
The type of the AST node. The recognized values are \fBterminal\fR
and \fBnonterminal\fR.
.TP
range
The locations of the first and last token of the terminal data in the
input covered by the node. This is a list containing two locations.
.TP
detail
This attribute is present only for nonterminal nodes. It contains the
name of the nonterminal symbol stored in the node.
.PP
.SH "EXTENDED AST OBJECTS"
Extended AST objects are like AST objects, with additional
information.
.TP
detail
This attribute is now present at all nodes. Its contents are unchanged
for nonterminal nodes. For terminal nodes it contains a list
describing all tokens from the input which are covered by the node.
.sp
Each element of the list contains the token name, the associated
lexeme attribute, line number, and column index, in this order.
.TP
range_lc
This new attribute is defined for all nodes, and contains the
locations from attribute \fIrange\fR translated into line number and
column index. Lines are counted from 1, columns are counted from 0.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_me\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
AST, abstract syntax tree
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_me/me_cpu.n.



















































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_me/me_cpu.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005-2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::me::cpu" n 0.2 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::me::cpu \- Virtual machine implementation II for parsing token streams
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBgrammar::me::cpu  ?0.2?\fR
.sp
\fB::grammar::me::cpu\fR \fImeName\fR \fImatchcode\fR
.sp
\fBmeName\fR \fBoption\fR ?\fIarg arg ...\fR?
.sp
\fImeName\fR \fBlc\fR \fIlocation\fR
.sp
\fImeName\fR \fBtok\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fImeName\fR \fBpc\fR \fIstate\fR
.sp
\fImeName\fR \fBiseof\fR \fIstate\fR
.sp
\fImeName\fR \fBat\fR \fIstate\fR
.sp
\fImeName\fR \fBcc\fR \fIstate\fR
.sp
\fImeName\fR \fBsv\fR
.sp
\fImeName\fR \fBok\fR
.sp
\fImeName\fR \fBerror\fR
.sp
\fImeName\fR \fBlstk\fR \fIstate\fR
.sp
\fImeName\fR \fBastk\fR \fIstate\fR
.sp
\fImeName\fR \fBmstk\fR \fIstate\fR
.sp
\fImeName\fR \fBestk\fR \fIstate\fR
.sp
\fImeName\fR \fBrstk\fR \fIstate\fR
.sp
\fImeName\fR \fBnc\fR \fIstate\fR
.sp
\fImeName\fR \fBast\fR
.sp
\fImeName\fR \fBhalted\fR
.sp
\fImeName\fR \fBcode\fR
.sp
\fImeName\fR \fBeof\fR
.sp
\fImeName\fR \fBput\fR \fItok\fR \fIlex\fR \fIline\fR \fIcol\fR
.sp
\fImeName\fR \fBputstring\fR \fIstring\fR \fIlvar\fR \fIcvar\fR
.sp
\fImeName\fR \fBrun\fR ?\fIn\fR?
.sp
\fImeName\fR \fBpull\fR \fInextcmd\fR
.sp
\fImeName\fR \fBreset\fR
.sp
\fImeName\fR \fBdestroy\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides an implementation of the ME virtual machine.
Please go and read the document \fBgrammar::me_intro\fR first if
you do not know what a ME virtual machine is.
.PP
This implementation provides an object-based API and the machines are
not truly tied to Tcl. A C implementation of the same API is quite
possible.
.PP
Internally the package actually uses the value-based machine
manipulation commands as provided by the package
\fBgrammar::me::cpu::core\fR to perform its duties.
.SH API
.SS "CLASS API"
The package directly provides only a single command for the
construction of ME virtual machines.
.TP
\fB::grammar::me::cpu\fR \fImeName\fR \fImatchcode\fR
The command creates a new ME machine object with an associated global
Tcl command whose name is \fImeName\fR. This command may be used to
invoke various operations on the machine.
It has the following general form:
.RS
.TP
\fBmeName\fR \fBoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.RE
.sp
The argument \fImatchcode\fR contains the match instructions the
machine has to execute while parsing the input stream. Please read
section \fBMATCH CODE REPRESENTATION\fR of the
documentation for the package \fBgrammar::me::cpu::core\fR for
the specification of the structure of this value.
.sp
The \fItokmap\fR argument taken by the implementation provided by the
package \fBgrammar::me::tcl\fR is here hidden inside of the match
instructions and therefore not needed.
.PP
.PP
.SS "OBJECT API"
All ME virtual machine objects created by the class command specified
in section \fBCLASS API\fR support the methods listed below.
.PP
The machines provided by this package provide methods for operation in
both push- and pull-styles. Push-style means that tokens are pushed
into the machine state when they arrive, triggering further execution
until they are consumed. In other words, this allows the machine to be
suspended and resumed at will and an arbitrary number of times, the
quasi-parallel operation of several machines, and the operation as
part of the event loop.
.TP
\fImeName\fR \fBlc\fR \fIlocation\fR
This method converts the location of a token given as offset in the
input stream into the associated line number and column index. The
result of the command is a 2-element list containing the two values,
in the order mentioned in the previous sentence.
This allows higher levels to convert the location information found in
the error status and the generated AST into more human readable data.
.sp
\fINote\fR that the command is not able to convert locations which
have not been reached by the machine yet. In other words, if the
machine has read 7 tokens the command is able to convert the offsets
\fB0\fR to \fB6\fR, but nothing beyond that. This also shows that
it is not possible to convert offsets which refer to locations before
the beginning of the stream.
.TP
\fImeName\fR \fBtok\fR ?\fIfrom\fR ?\fIto\fR??
This method returns a Tcl list containing the part of the input stream
between the locations \fIfrom\fR and \fIto\fR (both inclusive). If
\fIto\fR is not specified it will default to the value of \fIfrom\fR.
If \fIfrom\fR is not specified either the whole input stream is returned.
.sp
Each element of the returned list is a list of four elements, the
token, its associated lexeme, line number, and column index, in this
order.
This command places the same restrictions on its location arguments as
the method \fBlc\fR.
.TP
\fImeName\fR \fBpc\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current value of the stored program counter.
.TP
\fImeName\fR \fBiseof\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current value of the stored eof flag.
.TP
\fImeName\fR \fBat\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current location in the input stream.
.TP
\fImeName\fR \fBcc\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current token.
.TP
\fImeName\fR \fBsv\fR
This command returns the current semantic value \fISV\fR stored in
the machine. This is an abstract syntax tree as specified in the
document \fBgrammar::me_ast\fR, section \fBAST VALUES\fR.
.TP
\fImeName\fR \fBok\fR
This method returns the current match status \fIOK\fR.
.TP
\fImeName\fR \fBerror\fR
This method returns the current error status \fIER\fR.
.TP
\fImeName\fR \fBlstk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the location stack.
.TP
\fImeName\fR \fBastk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the AST stack.
.TP
\fImeName\fR \fBmstk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the AST marker stack.
.TP
\fImeName\fR \fBestk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the error stack.
.TP
\fImeName\fR \fBrstk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the subroutine return stack.
.TP
\fImeName\fR \fBnc\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the nonterminal match cache as a dictionary.
.TP
\fImeName\fR \fBast\fR
This method returns the current top entry of the AST stack \fIAS\fR.
This is an abstract syntax tree as specified in the document
\fBgrammar::me_ast\fR, section \fBAST VALUES\fR.
.TP
\fImeName\fR \fBhalted\fR
This method returns a boolean value telling the caller whether the
engine has halted execution or not. Halt means that no further
matching is possible, and the information retrieved via the other
method is final. Attempts to \fBrun\fR the engine will be ignored,
until a \fBreset\fR is made.
.TP
\fImeName\fR \fBcode\fR
This method returns the \fIcode\fR information used to construct the
object. In other words, the match program executed by the machine.
.TP
\fImeName\fR \fBeof\fR
This method adds an end of file marker to the end of the input stream.
This signals the machine that the current contents of the input queue
are the final parts of the input and nothing will come after. Attempts
to put more characters into the queue will fail.
.TP
\fImeName\fR \fBput\fR \fItok\fR \fIlex\fR \fIline\fR \fIcol\fR
This method adds the token \fItok\fR to the end of the input stream,
with associated lexeme data \fIlex\fR and \fIline\fR/\fIcol\fRumn
information.
.TP
\fImeName\fR \fBputstring\fR \fIstring\fR \fIlvar\fR \fIcvar\fR
This method adds each individual character in the \fIstring\fR as a
token to the end of the input stream, from first to last. The lexemes
will be empty and the line/col information is computed based on the
characters encountered and the data in the variables \fIlvar\fR and
\fIcvar\fR.
.TP
\fImeName\fR \fBrun\fR ?\fIn\fR?
This methods causes the engine to execute match instructions until
either
.RS
.IP \(bu
\fIn\fR instructions have been executed, or
.IP \(bu
a halt instruction was executed, or
.IP \(bu
the input queue is empty and the code is asking for more tokens to
process.
.RE
.sp
If no limit \fIn\fR was set only the last two conditions are checked
for.
.TP
\fImeName\fR \fBpull\fR \fInextcmd\fR
This method implements pull-style operation of the machine. It causes
it to execute match instructions until either a halt instruction is
reached, or the command prefix
\fInextcmd\fR ceases to deliver more tokens.
.sp
The command prefix \fInextcmd\fR represents the input stream of
characters and is invoked by the machine whenever the a new character
from the stream is required. The instruction for handling this is
\fIict_advance\fR.
The callback has to return either the empty list, or a list of 4
elements containing the token, its lexeme attribute, and its location
as line number and column index, in this order.
The empty list is the signal that the end of the input stream has been
reached. The lexeme attribute is stored in the terminal cache, but
otherwise not used by the machine.
.sp
The end of the input stream for this method does not imply that method
\fBeof\fR is called for the machine as a whole. By avoiding this
and still asking for an explicit call of the method it is possible to
mix push- and pull-style operation during the lifetime of the machine.
.TP
\fImeName\fR \fBreset\fR
This method resets the machine to its initial state, discarding any
state it may have.
.TP
\fImeName\fR \fBdestroy\fR
This method deletes the object and releases all resurces it claimed.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_me\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
grammar, parsing, virtual machine
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005-2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_me/me_cpucore.n.




































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_me/me_cpucore.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005-2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::me::cpu::core" n 0.2 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::me::cpu::core \- ME virtual machine state manipulation
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBgrammar::me::cpu::core  ?0.2?\fR
.sp
\fB::grammar::me::cpu::core\fR \fBdisasm\fR \fIasm\fR
.sp
\fB::grammar::me::cpu::core\fR \fBasm\fR \fIasm\fR
.sp
\fB::grammar::me::cpu::core\fR \fBnew\fR \fIasm\fR
.sp
\fB::grammar::me::cpu::core\fR \fBlc\fR \fIstate\fR \fIlocation\fR
.sp
\fB::grammar::me::cpu::core\fR \fBtok\fR \fIstate\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fB::grammar::me::cpu::core\fR \fBpc\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBiseof\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBat\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBcc\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBsv\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBok\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBerror\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBlstk\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBastk\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBmstk\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBestk\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBrstk\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBnc\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBast\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBhalted\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBcode\fR \fIstate\fR
.sp
\fB::grammar::me::cpu::core\fR \fBeof\fR \fIstatevar\fR
.sp
\fB::grammar::me::cpu::core\fR \fBput\fR \fIstatevar\fR \fItok\fR \fIlex\fR \fIline\fR \fIcol\fR
.sp
\fB::grammar::me::cpu::core\fR \fBrun\fR \fIstatevar\fR ?\fIn\fR?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides an implementation of the ME virtual machine.
Please go and read the document \fBgrammar::me_intro\fR first if
you do not know what a ME virtual machine is.
.PP
This implementation represents each ME virtual machine as a Tcl value
and provides commands to manipulate and query such values to show the
effects of executing instructions, adding tokens, retrieving state,
etc.
.PP
The values fully follow the paradigm of Tcl that every value is a
string and while also allowing C implementations for a proper
Tcl_ObjType to keep all the important data in native data structures.
Because of the latter it is recommended to access the state values
\fIonly\fR through the commands of this package to ensure that
internal representation is not shimmered away.
.PP
The actual structure used by all state values is described in section
\fBCPU STATE\fR.
.SH API
The package directly provides only a single command, and all the
functionality is made available through its methods.
.TP
\fB::grammar::me::cpu::core\fR \fBdisasm\fR \fIasm\fR
This method returns a list containing a disassembly of the match
instructions in \fIasm\fR. The format of \fIasm\fR is specified in the
section \fBMATCH PROGRAM REPRESENTATION\fR.
.sp
Each element of the result contains instruction label, instruction
name, and the instruction arguments, in this order. The label can be
the empty string. Jump destinations are shown as labels, strings and
tokens unencoded. Token names are prefixed with their numeric id, if,
and only if a tokmap is defined. The two components are separated by a
colon.
.TP
\fB::grammar::me::cpu::core\fR \fBasm\fR \fIasm\fR
This method returns code in the format as specified in section
\fBMATCH PROGRAM REPRESENTATION\fR generated from ME assembly
code \fIasm\fR, which is in the format as returned by the method
\fBdisasm\fR.
.TP
\fB::grammar::me::cpu::core\fR \fBnew\fR \fIasm\fR
This method creates state value for a ME virtual machine in its
initial state and returns it as its result.
.sp
The argument \fImatchcode\fR contains a Tcl representation of the
match instructions the machine has to execute while parsing the input
stream. Its format is specified in the section
\fBMATCH PROGRAM REPRESENTATION\fR.
.sp
The \fItokmap\fR argument taken by the implementation provided by the
package \fBgrammar::me::tcl\fR is here hidden inside of the match
instructions and therefore not needed.
.TP
\fB::grammar::me::cpu::core\fR \fBlc\fR \fIstate\fR \fIlocation\fR
This method takes the state value of a ME virtual machine and uses it
to convert a location in the input stream (as offset) into a line
number and column index. The result of the method is a 2-element list
containing the two pieces in the order mentioned in the previous
sentence.
.sp
\fINote\fR that the method cannot convert locations which the machine
has not yet read from the input stream. In other words, if the machine
has read 7 characters so far it is possible to convert the offsets
\fB0\fR to \fB6\fR, but nothing beyond that. This also shows that
it is not possible to convert offsets which refer to locations before
the beginning of the stream.
.sp
This utility allows higher levels to convert the location offsets
found in the error status and the AST into more human readable data.
.TP
\fB::grammar::me::cpu::core\fR \fBtok\fR \fIstate\fR ?\fIfrom\fR ?\fIto\fR??
This method takes the state value of a ME virtual machine and returns
a Tcl list containing the part of the input stream between the
locations \fIfrom\fR and \fIto\fR (both inclusive). If \fIto\fR is not
specified it will default to the value of \fIfrom\fR. If \fIfrom\fR is
not specified either the whole input stream is returned.
.sp
This method places the same restrictions on its location arguments as
the method \fBlc\fR.
.TP
\fB::grammar::me::cpu::core\fR \fBpc\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current value of the stored program counter.
.TP
\fB::grammar::me::cpu::core\fR \fBiseof\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current value of the stored eof flag.
.TP
\fB::grammar::me::cpu::core\fR \fBat\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current location in the input stream.
.TP
\fB::grammar::me::cpu::core\fR \fBcc\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current token.
.TP
\fB::grammar::me::cpu::core\fR \fBsv\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current semantic value stored in it.
This is an abstract syntax tree as specified in the document
\fBgrammar::me_ast\fR, section \fBAST VALUES\fR.
.TP
\fB::grammar::me::cpu::core\fR \fBok\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the match status stored in it.
.TP
\fB::grammar::me::cpu::core\fR \fBerror\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current error status stored in it.
.TP
\fB::grammar::me::cpu::core\fR \fBlstk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the location stack.
.TP
\fB::grammar::me::cpu::core\fR \fBastk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the AST stack.
.TP
\fB::grammar::me::cpu::core\fR \fBmstk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the AST marker stack.
.TP
\fB::grammar::me::cpu::core\fR \fBestk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the error stack.
.TP
\fB::grammar::me::cpu::core\fR \fBrstk\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the subroutine return stack.
.TP
\fB::grammar::me::cpu::core\fR \fBnc\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the nonterminal match cache as a dictionary.
.TP
\fB::grammar::me::cpu::core\fR \fBast\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the abstract syntax tree currently at the top of the AST stack stored
in it.
This is an abstract syntax tree as specified in the document
\fBgrammar::me_ast\fR, section \fBAST VALUES\fR.
.TP
\fB::grammar::me::cpu::core\fR \fBhalted\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the current halt status stored in it, i.e. if the machine has stopped
or not.
.TP
\fB::grammar::me::cpu::core\fR \fBcode\fR \fIstate\fR
This method takes the state value of a ME virtual machine and returns
the code stored in it, i.e. the instructions executed by the machine.
.TP
\fB::grammar::me::cpu::core\fR \fBeof\fR \fIstatevar\fR
This method takes the state value of a ME virtual machine as stored in
the variable named by \fIstatevar\fR and modifies it so that the eof
flag inside is set. This signals to the machine that whatever token
are in the input queue are the last to be processed. There will be no
more.
.TP
\fB::grammar::me::cpu::core\fR \fBput\fR \fIstatevar\fR \fItok\fR \fIlex\fR \fIline\fR \fIcol\fR
This method takes the state value of a ME virtual machine as stored in
the variable named by \fIstatevar\fR and modifies it so that the token
\fItok\fR is added to the end of the input queue, with associated
lexeme data \fIlex\fR and \fIline\fR/\fIcol\fRumn information.
.sp
The operation will fail with an error if the eof flag of the machine
has been set through the method \fBeof\fR.
.TP
\fB::grammar::me::cpu::core\fR \fBrun\fR \fIstatevar\fR ?\fIn\fR?
This method takes the state value of a ME virtual machine as stored in
the variable named by \fIstatevar\fR, executes a number of
instructions and stores the state resulting from their modifications
back into the variable.
.sp
The execution loop will run until either
.RS
.IP \(bu
\fIn\fR instructions have been executed, or
.IP \(bu
a halt instruction was executed, or
.IP \(bu
the input queue is empty and the code is asking for more tokens to
process.
.RE
.sp
If no limit \fIn\fR was set only the last two conditions are checked
for.
.PP
.SS "MATCH PROGRAM REPRESENTATION"
A match program is represented by nested Tcl list. The first element,
\fIasm\fR, is a list of integer numbers, the instructions to execute,
and their arguments. The second element, \fIpool\fR, is a list of
strings, referenced by the instructions, for error messages, token
names, etc. The third element, \fItokmap\fR, provides ordering
information for the tokens, mapping their names to their numerical
rank. This element can be empty, forcing lexicographic comparison when
matching ranges.
.PP
All ME instructions are encoded as integer numbers, with the mapping
given below. A number of the instructions, those which handle error
messages, have been given an additional argument to supply that
message explicitly instead of having it constructed from token names,
etc. This allows the machine state to store only the message ids
instead of the full strings.
.PP
Jump destination arguments are absolute indices into the \fIasm\fR
element, refering to the instruction to jump to. Any string arguments
are absolute indices into the \fIpool\fR element. Tokens, characters,
messages, and token (actually character) classes to match are coded as
references into the \fIpool\fR as well.
.PP
.IP [1]
"\fBict_advance\fR \fImessage\fR"
.IP [2]
"\fBict_match_token\fR \fItok\fR \fImessage\fR"
.IP [3]
"\fBict_match_tokrange\fR \fItokbegin\fR \fItokend\fR \fImessage\fR"
.IP [4]
"\fBict_match_tokclass\fR \fIcode\fR \fImessage\fR"
.IP [5]
"\fBinc_restore\fR \fIbranchlabel\fR \fInt\fR"
.IP [6]
"\fBinc_save\fR \fInt\fR"
.IP [7]
"\fBicf_ntcall\fR \fIbranchlabel\fR"
.IP [8]
"\fBicf_ntreturn\fR"
.IP [9]
"\fBiok_ok\fR"
.IP [10]
"\fBiok_fail\fR"
.IP [11]
"\fBiok_negate\fR"
.IP [12]
"\fBicf_jalways\fR \fIbranchlabel\fR"
.IP [13]
"\fBicf_jok\fR \fIbranchlabel\fR"
.IP [14]
"\fBicf_jfail\fR \fIbranchlabel\fR"
.IP [15]
"\fBicf_halt\fR"
.IP [16]
"\fBicl_push\fR"
.IP [17]
"\fBicl_rewind\fR"
.IP [18]
"\fBicl_pop\fR"
.IP [19]
"\fBier_push\fR"
.IP [20]
"\fBier_clear\fR"
.IP [21]
"\fBier_nonterminal\fR \fImessage\fR"
.IP [22]
"\fBier_merge\fR"
.IP [23]
"\fBisv_clear\fR"
.IP [24]
"\fBisv_terminal\fR"
.IP [25]
"\fBisv_nonterminal_leaf\fR \fInt\fR"
.IP [26]
"\fBisv_nonterminal_range\fR \fInt\fR"
.IP [27]
"\fBisv_nonterminal_reduce\fR \fInt\fR"
.IP [28]
"\fBias_push\fR"
.IP [29]
"\fBias_mark\fR"
.IP [30]
"\fBias_mrewind\fR"
.IP [31]
"\fBias_mpop\fR"
.PP
.SH "CPU STATE"
A state value is a list containing the following elements, in the order listed below:
.IP [1]
\fIcode\fR: Match instructions, see \fBMATCH PROGRAM REPRESENTATION\fR.
.IP [2]
\fIpc\fR:   Program counter, \fIint\fR.
.IP [3]
\fIhalt\fR: Halt flag, \fIboolean\fR.
.IP [4]
\fIeof\fR:  Eof flag, \fIboolean\fR
.IP [5]
\fItc\fR:   Terminal cache, and input queue. Structure see below.
.IP [6]
\fIcl\fR:   Current location, \fIint\fR.
.IP [7]
\fIct\fR:   Current token, \fIstring\fR.
.IP [8]
\fIok\fR:   Match status, \fIboolean\fR.
.IP [9]
\fIsv\fR:   Semantic value, \fIlist\fR.
.IP [10]
\fIer\fR:   Error status, \fIlist\fR.
.IP [11]
\fIls\fR:   Location stack, \fIlist\fR.
.IP [12]
\fIas\fR:   AST stack, \fIlist\fR.
.IP [13]
\fIms\fR:   AST marker stack, \fIlist\fR.
.IP [14]
\fIes\fR:   Error stack, \fIlist\fR.
.IP [15]
\fIrs\fR:   Return stack, \fIlist\fR.
.IP [16]
\fInc\fR:   Nonterminal cache, \fIdictionary\fR.
.PP
.PP
\fItc\fR, the input queue of tokens waiting for processing and the
terminal cache containing the tokens already processing are one
unified data structure simply holding all tokens and their
information, with the current location separating that which has been
processed from that which is waiting.
Each element of the queue/cache is a list containing the token, its
lexeme information, line number, and column index, in this order.
.PP
All stacks have their top element aat the end, i.e. pushing an item is
equivalent to appending to the list representing the stack, and
popping it removes the last element.
.PP
\fIer\fR, the error status is either empty or a list of two elements,
a location in the input, and a list of messages, encoded as references
into the \fIpool\fR element of the \fIcode\fR.
.PP
\fInc\fR, the nonterminal cache is keyed by nonterminal name and
location, each value a four-element list containing current location,
match status, semantic value, and error status, in this order.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_me\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
grammar, parsing, virtual machine
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005-2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_me/me_intro.n.






















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_me/me_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::me_intro" n 0.1 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::me_intro \- Introduction to virtual machines for parsing token streams
.SH DESCRIPTION
This document is an introduction to and overview of the basic
facilities for the parsing and/or matching of \fItoken\fR
streams. One possibility often used for the token domain are
characters.
.PP
The packages themselves all provide variants of one
\fIvirtual machine\fR, called a \fImatch engine\fR (short
\fIME\fR), which has all the facilities needed for the matching and
parsing of a stream, and which are either controlled directly, or are
customized with a match program. The virtual machine is basically a
pushdown automaton, with additional elements for backtracking and/or
handling of semantic data and construction of abstract syntax trees
(\fIAST\fR).
.PP
Because of the high degree of similarity in the actual implementations
of the aforementioned virtual machine and the data structures they
receive and generate these common parts are specified in a separate
document which will be referenced by the documentation for packages
actually implementing it.
.PP
The relevant documents are:
.PP
.TP
\fBgrammar::me_vm\fR
Virtual machine specification.
.TP
\fBgrammar::me_ast\fR
Specification of various representations used for abstract syntax
trees.
.TP
\fBgrammar::me::util\fR
Utility commands.
.TP
\fBgrammar::me::tcl\fR
Singleton ME virtual machine implementation tied to Tcl for control
flow and stacks. Hardwired for pull operation. Uninteruptible during
processing.
.TP
\fBgrammar::me::cpu\fR
Object-based ME virtual machine implementation with explicit control
flow, and stacks, using bytecodes. Suspend/Resumable. Push/pull
operation.
.TP
\fBgrammar::me::cpu::core\fR
Core functionality for state manipulation and stepping used in the
bytecode based implementation of ME virtual machines.
.PP
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_me\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
CFG, CFL, LL(k), PEG, TPDL, context-free grammar, context-free languages, expression, grammar, matching, parsing, parsing expression grammar, push down automaton, recursive descent, top-down parsing languages, transducer, virtual machine
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_me/me_tcl.n.






















































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_me/me_tcl.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::me::tcl" n 0.1 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::me::tcl \- Virtual machine implementation I for parsing token streams
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBgrammar::me::tcl  ?0.1?\fR
.sp
\fB::grammar::me::tcl\fR \fBcmd\fR \fI...\fR
.sp
\fB::grammar::me::tcl\fR \fBinit\fR \fInextcmd\fR ?\fItokmap\fR?
.sp
\fB::grammar::me::tcl\fR \fBlc\fR \fIlocation\fR
.sp
\fB::grammar::me::tcl\fR \fBtok\fR \fIfrom\fR ?\fIto\fR?
.sp
\fB::grammar::me::tcl\fR \fBtokens\fR
.sp
\fB::grammar::me::tcl\fR \fBsv\fR
.sp
\fB::grammar::me::tcl\fR \fBast\fR
.sp
\fB::grammar::me::tcl\fR \fBastall\fR
.sp
\fB::grammar::me::tcl\fR \fBctok\fR
.sp
\fB::grammar::me::tcl\fR \fBnc\fR
.sp
\fB::grammar::me::tcl\fR \fBnext\fR
.sp
\fB::grammar::me::tcl\fR \fBord\fR
.sp
\fB::grammar::me::tcl::ict_advance\fR \fImessage\fR
.sp
\fB::grammar::me::tcl::ict_match_token\fR \fItok\fR \fImessage\fR
.sp
\fB::grammar::me::tcl::ict_match_tokrange\fR \fItokbegin\fR \fItokend\fR \fImessage\fR
.sp
\fB::grammar::me::tcl::ict_match_tokclass\fR \fIcode\fR \fImessage\fR
.sp
\fB::grammar::me::tcl::inc_restore\fR \fInt\fR
.sp
\fB::grammar::me::tcl::inc_save\fR \fInt\fR \fIstartlocation\fR
.sp
\fB::grammar::me::tcl::iok_ok\fR
.sp
\fB::grammar::me::tcl::iok_fail\fR
.sp
\fB::grammar::me::tcl::iok_negate\fR
.sp
\fB::grammar::me::tcl::icl_get\fR
.sp
\fB::grammar::me::tcl::icl_rewind\fR \fIoldlocation\fR
.sp
\fB::grammar::me::tcl::ier_get\fR
.sp
\fB::grammar::me::tcl::ier_clear\fR
.sp
\fB::grammar::me::tcl::ier_nonterminal\fR \fImessage\fR \fIlocation\fR
.sp
\fB::grammar::me::tcl::ier_merge\fR \fIolderror\fR
.sp
\fB::grammar::me::tcl::isv_clear\fR
.sp
\fB::grammar::me::tcl::isv_terminal\fR
.sp
\fB::grammar::me::tcl::isv_nonterminal_leaf\fR \fInt\fR \fIstartlocation\fR
.sp
\fB::grammar::me::tcl::isv_nonterminal_range\fR \fInt\fR \fIstartlocation\fR
.sp
\fB::grammar::me::tcl::isv_nonterminal_reduce\fR \fInt\fR \fIstartlocation\fR ?\fImarker\fR?
.sp
\fB::grammar::me::tcl::ias_push\fR
.sp
\fB::grammar::me::tcl::ias_mark\fR
.sp
\fB::grammar::me::tcl::ias_pop2mark\fR \fImarker\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides an implementation of the ME virtual machine.
Please go and read the document \fBgrammar::me_intro\fR first if
you do not know what a ME virtual machine is.
.PP
This implementation is tied very strongly to Tcl. All the stacks in
the machine state are handled through the Tcl stack, all control flow
is handled by Tcl commands, and the remaining machine instructions are
directly mapped to Tcl commands. Especially the matching of
nonterminal symbols is handled by Tcl procedures as well, essentially
extending the machine implementation with custom instructions.
.PP
Further on the implementation handles only a single machine which is
uninteruptible during execution and hardwired for pull operation. I.e.
it explicitly requests each new token through a callback, pulling them
into its state.
.PP
A related package is \fBgrammar::peg::interp\fR which provides a
generic interpreter / parser for parsing expression grammars (PEGs),
implemented on top of this implementation of the ME virtual machine.
.SH API
The commands documented in this section do not implement any of the
instructions of the ME virtual machine. They provide the facilities
for the initialization of the machine and the retrieval of important
information.
.TP
\fB::grammar::me::tcl\fR \fBcmd\fR \fI...\fR
This is an ensemble command providing access to the commands listed in
this section. See the methods themselves for detailed specifications.
.TP
\fB::grammar::me::tcl\fR \fBinit\fR \fInextcmd\fR ?\fItokmap\fR?
This command (re)initializes the machine. It returns the empty
string. This command has to be invoked before any other command of
this package.
.sp
The command prefix \fInextcmd\fR represents the input stream of
characters and is invoked by the machine whenever the a new character
from the stream is required. The instruction for handling this is
\fIict_advance\fR.
The callback has to return either the empty list, or a list of 4
elements containing the token, its lexeme attribute, and its location
as line number and column index, in this order.
The empty list is the signal that the end of the input stream has been
reached. The lexeme attribute is stored in the terminal cache, but
otherwise not used by the machine.
.sp
The optional dictionary \fItokmap\fR maps from tokens to integer
numbers. If present the numbers impose an order on the tokens, which
is subsequently used by \fIict_match_tokrange\fR to determine if a
token is in the specified range or not. If no token map is specified
the lexicographic order of th token names will be used instead. This
choice is especially asensible when using characters as tokens.
.TP
\fB::grammar::me::tcl\fR \fBlc\fR \fIlocation\fR
This command converts the location of a token given as offset in the
input stream into the associated line number and column index. The
result of the command is a 2-element list containing the two values,
in the order mentioned in the previous sentence.
This allows higher levels to convert the location information found in
the error status and the generated AST into more human readable data.
.sp
\fINote\fR that the command is not able to convert locations which
have not been reached by the machine yet. In other words, if the
machine has read 7 tokens the command is able to convert the offsets
\fB0\fR to \fB6\fR, but nothing beyond that. This also shows that
it is not possible to convert offsets which refer to locations before
the beginning of the stream.
.sp
After a call of \fBinit\fR the state used for the conversion is
cleared, making further conversions impossible until the machine has
read tokens again.
.TP
\fB::grammar::me::tcl\fR \fBtok\fR \fIfrom\fR ?\fIto\fR?
This command returns a Tcl list containing the part of the input
stream between the locations \fIfrom\fR and \fIto\fR (both
inclusive). If \fIto\fR is not specified it will default to the value
of \fIfrom\fR.
.sp
Each element of the returned list is a list of four elements, the
token, its associated lexeme, line number, and column index, in this
order.
In other words, each element has the same structure as the result of
the \fInextcmd\fR callback given to \fB::grammar::me::tcl::init\fR
.sp
This command places the same restrictions on its location arguments as
\fB::grammar::me::tcl::lc\fR.
.TP
\fB::grammar::me::tcl\fR \fBtokens\fR
This command returns the number of tokens currently known to the ME
virtual machine.
.TP
\fB::grammar::me::tcl\fR \fBsv\fR
This command returns the current semantic value \fISV\fR stored in
the machine. This is an abstract syntax tree as specified in the
document \fBgrammar::me_ast\fR, section \fBAST VALUES\fR.
.TP
\fB::grammar::me::tcl\fR \fBast\fR
This method returns the abstract syntax tree currently at the top of
the AST stack of the ME virtual machine. This is an abstract syntax
tree as specified in the document \fBgrammar::me_ast\fR, section
\fBAST VALUES\fR.
.TP
\fB::grammar::me::tcl\fR \fBastall\fR
This method returns the whole stack of abstract syntax trees currently
known to the ME virtual machine. Each element of the returned list is
an abstract syntax tree as specified in the document
\fBgrammar::me_ast\fR, section \fBAST VALUES\fR.
The top of the stack resides at the end of the list.
.TP
\fB::grammar::me::tcl\fR \fBctok\fR
This method returns the current token considered by the ME virtual
machine.
.TP
\fB::grammar::me::tcl\fR \fBnc\fR
This method returns the contents of the nonterminal cache as a
dictionary mapping from "\fBsymbol\fR,\fBlocation\fR" to match
information.
.TP
\fB::grammar::me::tcl\fR \fBnext\fR
This method returns the next token callback as specified during
initialization of the ME virtual machine.
.TP
\fB::grammar::me::tcl\fR \fBord\fR
This method returns a dictionary containing the \fItokmap\fR specified
during initialization of the ME virtual machine.
\fB\fB::grammar::me::tcl::ok\fR\fR
This variable contains the current match status \fIOK\fR. It is
provided as variable instead of a command because that makes access to
this information faster, and the speed of access is considered very
important here as this information is used constantly to determine the
control flow.
.PP
.PP
.SH "MACHINE STATE"
Please go and read the document \fBgrammar::me_vm\fR first for a
specification of the basic ME virtual machine and its state.
.PP
This implementation manages the state described in that document,
except for the stacks minus the AST stack. In other words, location
stack, error stack, return stack, and ast marker stack are implicitly
managed through standard Tcl scoping, i.e. Tcl variables in
procedures, outside of this implementation.
.SH "MACHINE INSTRUCTIONS"
Please go and read the document \fBgrammar::me_vm\fR first for a
specification of the basic ME virtual machine and its instruction set.
.PP
This implementation maps all instructions to Tcl commands in the
namespace "::grammar::me::tcl", except for the stack related commands,
nonterminal symbols and control flow.
Here we simply list the commands and explain the differences to the
specified instructions, if there are any. For their semantics see the
aforementioned specification. The machine commands are \fInot\fR
reachable through the ensemble command \fB::grammar::me::tcl\fR.
.PP
.TP
\fB::grammar::me::tcl::ict_advance\fR \fImessage\fR
No changes.
.TP
\fB::grammar::me::tcl::ict_match_token\fR \fItok\fR \fImessage\fR
No changes.
.TP
\fB::grammar::me::tcl::ict_match_tokrange\fR \fItokbegin\fR \fItokend\fR \fImessage\fR
If, and only if a token map was specified during initialization then
the arguments are the numeric representations of the smallest and
largest tokens in the range. Otherwise they are the relevant tokens
themselves and lexicographic comparison is used.
.TP
\fB::grammar::me::tcl::ict_match_tokclass\fR \fIcode\fR \fImessage\fR
No changes.
.TP
\fB::grammar::me::tcl::inc_restore\fR \fInt\fR
Instead of taking a branchlabel the command returns a boolean value.
The result will be \fBtrue\fR if and only if cached information was
found. The caller has to perform the appropriate branching.
.TP
\fB::grammar::me::tcl::inc_save\fR \fInt\fR \fIstartlocation\fR
The command takes the start location as additional argument, as it is
managed on the Tcl stack, and not in the machine state.
.TP
\fBicf_ntcall\fR \fIbranchlabel\fR
.TP
\fBicf_ntreturn\fR
These two instructions are not mapped to commands. They are control
flow instructions and handled in Tcl.
.TP
\fB::grammar::me::tcl::iok_ok\fR
No changes.
.TP
\fB::grammar::me::tcl::iok_fail\fR
No changes.
.TP
\fB::grammar::me::tcl::iok_negate\fR
No changes.
.TP
\fBicf_jalways\fR \fIbranchlabel\fR
.TP
\fBicf_jok\fR \fIbranchlabel\fR
.TP
\fBicf_jfail\fR \fIbranchlabel\fR
.TP
\fBicf_halt\fR
These four instructions are not mapped to commands. They are control
flow instructions and handled in Tcl.
.TP
\fB::grammar::me::tcl::icl_get\fR
This command returns the current location \fICL\fR in the input.
It replaces \fIicl_push\fR.
.TP
\fB::grammar::me::tcl::icl_rewind\fR \fIoldlocation\fR
The command takes the location as argument as it comes from the
Tcl stack, not the machine state.
.TP
\fBicl_pop\fR
Not mapped, the stacks are not managed by the package.
.TP
\fB::grammar::me::tcl::ier_get\fR
This command returns the current error state \fIER\fR.
It replaces \fIier_push\fR.
.TP
\fB::grammar::me::tcl::ier_clear\fR
No changes.
.TP
\fB::grammar::me::tcl::ier_nonterminal\fR \fImessage\fR \fIlocation\fR
The command takes the location as argument as it comes from the
Tcl stack, not the machine state.
.TP
\fB::grammar::me::tcl::ier_merge\fR \fIolderror\fR
The command takes the second error state to merge as argument as it
comes from the Tcl stack, not the machine state.
.TP
\fB::grammar::me::tcl::isv_clear\fR
No changes.
.TP
\fB::grammar::me::tcl::isv_terminal\fR
No changes.
.TP
\fB::grammar::me::tcl::isv_nonterminal_leaf\fR \fInt\fR \fIstartlocation\fR
The command takes the start location as argument as it comes from the
Tcl stack, not the machine state.
.TP
\fB::grammar::me::tcl::isv_nonterminal_range\fR \fInt\fR \fIstartlocation\fR
The command takes the start location as argument as it comes from the
Tcl stack, not the machine state.
.TP
\fB::grammar::me::tcl::isv_nonterminal_reduce\fR \fInt\fR \fIstartlocation\fR ?\fImarker\fR?
The command takes start location and marker as argument as it comes
from the Tcl stack, not the machine state.
.TP
\fB::grammar::me::tcl::ias_push\fR
No changes.
.TP
\fB::grammar::me::tcl::ias_mark\fR
This command returns a marker for the current state of the AST stack
\fIAS\fR. The marker stack is not managed by the machine.
.TP
\fB::grammar::me::tcl::ias_pop2mark\fR \fImarker\fR
The command takes the marker as argument as it comes from the
Tcl stack, not the machine state. It replaces \fIias_mpop\fR.
.PP
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_me\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
grammar, parsing, virtual machine
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_me/me_util.n.







































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_me/me_util.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::me::util" n 0.1 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::me::util \- AST utilities
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBgrammar::me::util  ?0.1?\fR
.sp
\fB::grammar::me::util::ast2tree\fR \fIast\fR \fItree\fR ?\fIroot\fR?
.sp
\fB::grammar::me::util::ast2etree\fR \fIast\fR \fImcmd\fR \fItree\fR ?\fIroot\fR?
.sp
\fBmcmd\fR \fBlc\fR \fIlocation\fR
.sp
\fBmcmd\fR \fBtok\fR \fIfrom\fR ?\fIto\fR?
.sp
\fB::grammar::me::util::tree2ast\fR \fItree\fR ?\fIroot\fR?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a number of utility command for the conversion
between the various representations of abstract syntax trees as
specified in the document \fBgrammar::me_ast\fR.
.TP
\fB::grammar::me::util::ast2tree\fR \fIast\fR \fItree\fR ?\fIroot\fR?
This command converts an \fIast\fR from value to object
representation. All nodes in the \fIast\fR will be converted into
nodes of this \fItree\fR, with the root of the AST a child of the node
\fIroot\fR. If this node is not explicitly specified the root of the
tree is used. Existing content of tree is not touched, i.e.  neither
removed nor changed, with the exception of the specified root node,
which will gain a new child.
.TP
\fB::grammar::me::util::ast2etree\fR \fIast\fR \fImcmd\fR \fItree\fR ?\fIroot\fR?
This command is like \fB::grammar::me::util::ast2tree\fR, except that
the result is in the extended object representation of the input AST.
The source of the extended information is the command prefix
\fImcmd\fR.
It has to understand two methods, \fBlc\fR, and \fBtok\fR, with
the semantics specified below.
.RS
.TP
\fBmcmd\fR \fBlc\fR \fIlocation\fR
Takes the location of a token given as offset in the input stream and
return a 2-element list containing the associated line number and
column index, in this order.
.TP
\fBmcmd\fR \fBtok\fR \fIfrom\fR ?\fIto\fR?
Takes one or two locations \fIfrom\fR and \fIto\fR as offset in the
input stream and returns a Tcl list containing the specified part of
the input stream. Both location are inclusive. If \fIto\fR is not
specified it will default to the value of \fIfrom\fR.
.sp
Each element of the returned list is a list containing the token, its
associated lexeme, the line number, and column index, in this order.
.RE
.sp
Both the ensemble command \fB::grammar::me::tcl\fR provided by the
package \fBgrammar::me::tcl\fR and the objects command created by
the package \fB::grammar::me::cpu\fR fit the above specification.
.TP
\fB::grammar::me::util::tree2ast\fR \fItree\fR ?\fIroot\fR?
This command converts an \fIast\fR in (extended) object representation
into a value and returns it.
If a \fIroot\fR node is specified the AST is generated from that node
downward. Otherwise the root of the tree object is used as the
starting point.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_me\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
abstract syntax tree, syntax tree, tree
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_me/me_vm.n.























































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_me/me_vm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::me_vm" n 0.1 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::me_vm \- Virtual machine for parsing token streams
.SH DESCRIPTION
Please go and read the document \fBgrammar::me_intro\fR first for
an overview of the various documents and their relations.
.PP
This document specifies a virtual machine for the controlled matching
and parsing of token streams, creating an
\fIabstract syntax tree\fR (short \fIAST\fR) reflecting the
structure of the input. Special machine features are the caching and
reuse of partial results, caching of the encountered input, and the
ability to backtrack in both input and AST creation.
.PP
These features make the specified virtual machine especially useful to
packrat parsers based on parsing expression grammars. It is however
not restricted to this type of parser. Normal LL and LR parsers can be
implemented with it as well.
.PP
The following sections will discuss first the abstract state kept by
ME virtual machines, and then their instruction set.
.SH "MACHINE STATE"
A ME virtual machine manages the following state:
.TP
\fICurrent token\fR CT
The token from the input under consideration by the machine.
.sp
This information is used and modified by the instructions defined in
the section
\fBTERMINAL MATCHING\fR.
.TP
\fICurrent location\fR CL
The location of the \fIcurrent token\fR in the input stream, as
offset relative to the beginning of the stream. The first token is
considered to be at offset \fB0\fR.
.sp
This information is implicitly used and modified by the instructions
defined in the sections
\fBTERMINAL MATCHING\fR and
\fBNONTERMINAL MATCHING\fR,
and can be directly queried and modified by the instructions defined
in section
\fBINPUT LOCATION HANDLING\fR.
.TP
\fILocation stack\fR LS
In addition to the above a stack of locations, for backtracking.
Locations can put on the stack, removed from it, and removed with
setting the current location.
.sp
This information is implicitly used and modified by the instructions
defined in the sections
\fBTERMINAL MATCHING\fR and
\fBNONTERMINAL MATCHING\fR,
and can be directly queried and modified by the instructions defined
in section
\fBINPUT LOCATION HANDLING\fR.
.TP
\fIMatch status\fR OK
A boolean value, the result of the last attempt at matching input.
It is set to \fBtrue\fR if that attempt was successful, and
\fBfalse\fR otherwise.
.sp
This information is influenced by the instructions defined in the
sections
\fBTERMINAL MATCHING\fR,
\fBNONTERMINAL MATCHING\fR, and
\fBUNCONDITIONAL MATCHING\fR.
It is queried by the instructions defined in the section
\fBCONTROL FLOW\fR.
.TP
\fISemantic value\fR SV
The semantic value associated with (generated by) the last attempt at
matching input. Contains either the empty string or a node for the
abstract syntax tree constructed from the input.
.sp
This information is influenced by the instructions defined in the
sections
\fBSEMANTIC VALUES\fR, and
\fBAST STACK HANDLING\fR.
.TP
\fIAST stack\fR AS
A stack of partial abstract syntax trees constructed by the machine
during matching.
.sp
This information is influenced by the instructions defined in the
sections
\fBSEMANTIC VALUES\fR, and
\fBAST STACK HANDLING\fR.
.TP
\fIAST Marker stack\fR MS
In addition to the above a stack of stacks, for backtracking. This is
actually a stack of markers into the AST stack, thus implicitly
snapshooting the state of the AST stack at some point in time. Markers
can be put on the stack, dropped from it, and used to roll back the
AST stack to an earlier state.
.sp
This information is influenced by the instructions defined in the
sections
\fBSEMANTIC VALUES\fR, and
\fBAST STACK HANDLING\fR.
.TP
\fIError status\fR ER
Error information associated with the last attempt at matching
input. Contains either the empty string or a list of 2 elements, a
location in the input and a list of error messages associated with
it, in this order.
.sp
\fINote\fR that error information can be set even if the last attempt
at matching input was successful. For example the *-operator (matching
a sub-expression zero or more times) in a parsing expression grammar
is always successful, even if it encounters a problem further in the
input and has to backtrack. Such problems must not be forgotten when
continuing to match.
.sp
This information is queried and influenced by the instructions defined
in the sections
\fBTERMINAL MATCHING\fR,
\fBNONTERMINAL MATCHING\fR, and
\fBERROR HANDLING\fR.
.TP
\fIError stack\fR ES
In addition to the above a stack of error information, to allow the
merging of current and older error information when performing
backtracking in choices after an unsucessful match.
.sp
This information is queried and influenced by the instructions defined
in the sections
\fBTERMINAL MATCHING\fR,
\fBNONTERMINAL MATCHING\fR, and
\fBERROR HANDLING\fR.
.TP
\fIReturn stack\fR RS
A stack of program counter values, i.e. locations in the code
controlling the virtual machine, for the management of subroutine
calls, i.e. the matching of nonterminal symbols.
.sp
This information is queried and influenced by the instructions defined
in the section
\fBNONTERMINAL MATCHING\fR.
.TP
\fINonterminal cache\fR NC
A cache of machine states (A 4-tuple containing a location in the
input, match status \fIOK\fR, semantic value \fISV\fR, and error
status \fIER\fR) keyed by name of nonterminal symbol and location in
the input stream.
.sp
The key location is where machine started the attempt to match the
named nonterminal symbol, and the location in the value is where
machine ended up after the attempt completed, independent of the
success of the attempt.
.sp
This status is queried and influenced by the instructions defined in
the section
\fBNONTERMINAL MATCHING\fR.
.PP
.SH "MACHINE INSTRUCTIONS"
With the machine state specified it is now possible to explain the
instruction set of ME virtual machines. They are grouped roughly by
the machine state they influence and/or query.
.SS "TERMINAL MATCHING"
First the instructions to match tokens from the input stream, and
by extension all terminal symbols.
.PP
These instructions are the only ones which may retrieve a new token
from the input stream. This is a \fImay\fR and not a \fIwill\fR
because the instructions will a retrieve new token if, and only if the
current location \fICL\fR is at the head of the stream.
If the machine has backtracked (see \fBicl_rewind\fR) the instructions
will retrieve the token to compare against from the internal cache.
.PP
.TP
\fBict_advance\fR \fImessage\fR
This instruction tries to advance to the next token in the input
stream, i.e. the one after the current location \fICL\fR. The
instruction will fail if, and only if the end of the input stream is
reached, i.e. if there is no next token.
.sp
The sucess/failure of the instruction is remembered in the match
status \fIOK\fR. In the case of failure the error status \fIER\fR is
set to the current location and the message \fImessage\fR.
In the case of success the error status \fIER\fR is cleared, the new
token is made the current token \fICT\fR, and the new location is
made the current location \fICL\fR.
.sp
The argument \fImessage\fR is a reference to the string to put into
the error status \fIER\fR, if such is needed.
.TP
\fBict_match_token\fR \fItok\fR \fImessage\fR
This instruction tests the current token \fICT\fR for equality
with the argument \fItok\fR and records the result in the match
status \fIOK\fR. The instruction fails if the current token is
not equal to \fItok\fR.
.sp
In case of failure the error status \fIER\fR is set to the current
location \fICL\fR and the message \fImessage\fR, and the
current location \fICL\fR is moved one token backwards.
Otherwise, i.e. upon success, the error status \fIER\fR is cleared
and the current location \fICL\fR is not touched.
.TP
\fBict_match_tokrange\fR \fItokbegin\fR \fItokend\fR \fImessage\fR
This instruction tests the current token \fICT\fR for being in
the range of tokens from \fItokbegin\fR to \fItokend\fR
(inclusive) and records the result in the match status \fIOK\fR. The
instruction fails if the current token is not inside the range.
.sp
In case of failure the error status \fIER\fR is set to the current
location \fICL\fR and the message \fImessage\fR, and the current location
\fICL\fR is moved one token backwards.
Otherwise, i.e. upon success, the error status \fIER\fR is cleared
and the current location \fICL\fR is not touched.
.TP
\fBict_match_tokclass\fR \fIcode\fR \fImessage\fR
This instruction tests the current token \fICT\fR for being a member
of the token class \fIcode\fR and records the result in the match
status \fIOK\fR. The instruction fails if the current token is not a
member of the specified class.
.sp
In case of failure the error status \fIER\fR is set to the current
location \fICL\fR and the message \fImessage\fR, and the
current location \fICL\fR is moved one token backwards.
Otherwise, i.e. upon success, the error status \fIER\fR is cleared
and the current location \fICL\fR is not touched.
.sp
Currently the following classes are legal:
.RS
.TP
alnum
A token is accepted if it is a unicode alphabetical character, or a digit.
.TP
alpha
A token is accepted if it is a unicode alphabetical character.
.TP
digit
A token is accepted if it is a unicode digit character.
.TP
xdigit
A token is accepted if it is a hexadecimal digit character.
.TP
punct
A token is accepted if it is a unicode punctuation character.
.TP
space
A token is accepted if it is a unicode space character.
.RE
.PP
.PP
.SS "NONTERMINAL MATCHING"
The instructions in this section handle the matching of nonterminal
symbols. They query the nonterminal cache \fINC\fR for saved
information, and put such information into the cache.
.PP
The usage of the cache is a performance aid for backtracking parsers,
allowing them to avoid an expensive rematch of complex nonterminal
symbols if they have been encountered before.
.PP
.TP
\fBinc_restore\fR \fIbranchlabel\fR \fInt\fR
This instruction checks if the nonterminal cache \fINC\fR contains
information about the nonterminal symbol \fInt\fR, at the current
location \fICL\fR. If that is the case the instruction will update
the machine state (current location \fICL\fR, match status \fIOK\fR,
semantic value \fISV\fR, and error status \fIER\fR) with the found
information and continue execution at the instruction refered to by
the \fIbranchlabel\fR. The new current location \fICL\fR will be the
last token matched by the nonterminal symbol, i.e. belonging to it.
.sp
If no information was found the instruction will continue execution at
the next instruction.
.sp
Together with \fBicf_ntcall\fR it is possible to generate code for
memoized and non-memoized matching of nonterminal symbols, either as
subroutine calls, or inlined in the caller.
.TP
\fBinc_save\fR \fInt\fR
This instruction saves the current state of the machine (current
location \fICL\fR, match status \fIOK\fR, semantic value \fISV\fR,
and error status \fIER\fR), to the nonterminal cache \fINC\fR. It
will also pop an entry from the location stack \fILS\fR and save it
as the start location of the match.
.sp
It is expected to be called at the end of matching a nonterminal
symbol, with \fInt\fR the name of the nonterminal symbol the code was
working on. This allows the instruction \fBinc_restore\fR to check for
and retrieve the data, should we have to match this nonterminal symbol
at the same location again, during backtracking.
.TP
\fBicf_ntcall\fR \fIbranchlabel\fR
This instruction invokes the code for matching the nonterminal symbol
\fInt\fR as a subroutine. To this end it stores the current program
counter \fIPC\fR on the return stack \fIRS\fR, the current location
\fICL\fR on the location stack \fILS\fR, and then continues
execution at the address \fIbranchlabel\fR.
.sp
The next matching \fBicf_ntreturn\fR will cause the execution to
continue at the instruction coming after the call.
.TP
\fBicf_ntreturn\fR
This instruction will pop an entry from the return stack \fIRS\fR,
assign it to the program counter \fIPC\fR, and then continue
execution at the new address.
.PP
.PP
.SS "UNCONDITIONAL MATCHING"
The instructions in this section are the remaining match
operators. They change the match status \fIOK\fR directly and
unconditionally.
.TP
\fBiok_ok\fR
This instruction sets the match status \fIOK\fR to \fBtrue\fR,
indicating a successful match.
.TP
\fBiok_fail\fR
This instruction sets the match status \fIOK\fR to \fBfalse\fR,
indicating a failed match.
.TP
\fBiok_negate\fR
This instruction negates the match status \fIOK\fR, turning a failure
into a success and vice versa.
.PP
.PP
.SS "CONTROL FLOW"
The instructions in this section implement both conditional and
unconditional control flow. The conditional jumps query the match
status \fIOK\fR.
.TP
\fBicf_jalways\fR \fIbranchlabel\fR
This instruction sets the program counter \fIPC\fR to the address
specified by \fIbranchlabel\fR and then continues execution from
there. This is an unconditional jump.
.TP
\fBicf_jok\fR \fIbranchlabel\fR
This instruction sets the program counter \fIPC\fR to the address
specified by \fIbranchlabel\fR. This happens if, and only if the match
status \fIOK\fR indicates a success. Otherwise it simply continues
execution at the next instruction. This is a conditional jump.
.TP
\fBicf_jfail\fR \fIbranchlabel\fR
This instruction sets the program counter \fIPC\fR to the address
specified by \fIbranchlabel\fR. This happens if, and only if the match
status \fIOK\fR indicates a failure. Otherwise it simply continues
execution at the next instruction. This is a conditional jump.
.TP
\fBicf_halt\fR
This instruction halts the machine and blocks any further execution.
.PP
.SS "INPUT LOCATION HANDLING"
The instructions in this section are for backtracking, they manipulate
the current location \fICL\fR of the machine state.
They allow a user of the machine to query and save locations in the
input, and to rewind the current location \fICL\fR to saved
locations, making them one of the components enabling the
implementation of backtracking parsers.
.TP
\fBicl_push\fR
This instruction pushes a copy of the current location \fICL\fR on
the location stack \fILS\fR.
.TP
\fBicl_rewind\fR
This instruction pops an entry from the location stack \fILS\fR and
then moves the current location \fICL\fR back to this point in the
input.
.TP
\fBicl_pop\fR
This instruction pops an entry from the location stack \fILS\fR and
discards it.
.PP
.PP
.SS "ERROR HANDLING"
The instructions in this section provide read and write access to the
error status \fIER\fR of the machine.
.TP
\fBier_push\fR
This instruction pushes a copy of the current error status \fIER\fR
on the error stack \fIES\fR.
.TP
\fBier_clear\fR
This instruction clears the error status \fIER\fR.
.TP
\fBier_nonterminal\fR \fImessage\fR
This instruction checks if the error status \fIER\fR contains an
error whose location is just past the location found in the top entry
of the location stack \fILS\fR.
Nothing happens if no such error is found.
Otherwise the found error is replaced by an error at the location
found on the stack, having the message \fImessage\fR.
.TP
\fBier_merge\fR
This instruction pops an entry from the error stack \fIES\fR, merges
it with the current error status \fIER\fR and stores the result of
the merge as the new error status \fIER\fR.
.sp
The merge is performed as described below:
.sp
If one of the two error states is empty the other is chosen. If
neither error state is empty, and refering to different locations,
then the error state with the location further in the input is
chosen. If both error states refer to the same location their messages
are merged (with removing duplicates).
.PP
.SS "SEMANTIC VALUES"
The instructions in this section manipulate the semantic value
\fISV\fR.
.TP
\fBisv_clear\fR
This instruction clears the semantic value \fISV\fR.
.TP
\fBisv_terminal\fR
This instruction creates a terminal AST node for the current token
\fICT\fR, makes it the semantic value \fISV\fR, and also pushes the
node on the AST stack \fIAS\fR.
.TP
\fBisv_nonterminal_leaf\fR \fInt\fR
This instruction creates a nonterminal AST node without any children
for the nonterminal \fInt\fR, and makes it the semantic value
\fISV\fR.
.sp
This instruction should be executed if, and only if the match status
\fIOK\fR indicates a success.
In the case of a failure \fBisv_clear\fR should be called.
.TP
\fBisv_nonterminal_range\fR \fInt\fR
This instruction creates a nonterminal AST node for the nonterminal
\fInt\fR, with a single terminal node as its child, and makes this AST
the semantic value \fISV\fR. The terminal node refers to the input
string from the location found on top of the location stack \fILS\fR
to the current location \fICL\fR (both inclusive).
.sp
This instruction should be executed if, and only if the match status
\fIOK\fR indicates a success.
In the case of a failure \fBisv_clear\fR should be called.
.TP
\fBisv_nonterminal_reduce\fR \fInt\fR
This instruction creates a nonterminal AST node for the nonterminal
\fInt\fR and makes it the semantic value \fISV\fR.
.sp
All entries on the AST stack \fIAS\fR above the marker found in the
top entry of the AST Marker stack \fIMS\fR become children of the new
node, with the entry at the stack top becoming the rightmost child. If
the AST Marker stack \fIMS\fR is empty the whole stack is used. The
AST marker stack \fIMS\fR is left unchanged.
.sp
This instruction should be executed if, and only if the match status
\fIOK\fR indicates a success.
In the case of a failure \fBisv_clear\fR should be called.
.PP
.PP
.SS "AST STACK HANDLING"
The instructions in this section manipulate the AST stack \fIAS\fR,
and the AST Marker stack \fIMS\fR.
.TP
\fBias_push\fR
This instruction pushes the semantic value \fISV\fR on the AST stack
\fIAS\fR.
.TP
\fBias_mark\fR
This instruction pushes a marker for the current state of the AST
stack \fIAS\fR on the AST Marker stack \fIMS\fR.
.TP
\fBias_mrewind\fR
This instruction pops an entry from the AST Marker stack \fIMS\fR and
then proceeds to pop entries from the AST stack \fIAS\fR until the
state represented by the popped marker has been reached again.
Nothing is done if the AST stack \fIAS\fR is already smaller than
indicated by the popped marker.
.TP
\fBias_mpop\fR
This instruction pops an entry from the AST Marker stack \fIMS\fR and
discards it.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_me\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
grammar, parsing, virtual machine
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_peg/peg.n.




















































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_peg/peg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::peg" n 0.1 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::peg \- Create and manipulate parsing expression grammars
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit \fR
.sp
package require \fBgrammar::peg  ?0.1?\fR
.sp
\fB::grammar::peg\fR \fIpegName\fR ?\fB=\fR|\fB:=\fR|\fB<--\fR|\fBas\fR|\fBdeserialize\fR \fIsrc\fR?
.sp
\fIpegName\fR \fBdestroy\fR
.sp
\fIpegName\fR \fBclear\fR
.sp
\fIpegName\fR \fB=\fR \fIsrcPEG\fR
.sp
\fIpegName\fR \fB-->\fR \fIdstPEG\fR
.sp
\fIpegName\fR \fBserialize\fR
.sp
\fIpegName\fR \fBdeserialize\fR \fIserialization\fR
.sp
\fIpegName\fR \fBis valid\fR
.sp
\fIpegName\fR \fBstart\fR ?\fIpe\fR?
.sp
\fIpegName\fR \fBnonterminals\fR
.sp
\fIpegName\fR \fBnonterminal add\fR \fInt\fR \fIpe\fR
.sp
\fIpegName\fR \fBnonterminal delete\fR \fInt1\fR ?\fInt2\fR ...?
.sp
\fIpegName\fR \fBnonterminal exists\fR \fInt\fR
.sp
\fIpegName\fR \fBnonterminal rename\fR \fInt\fR \fIntnew\fR
.sp
\fIpegName\fR \fBnonterminal mode\fR \fInt\fR ?\fImode\fR?
.sp
\fIpegName\fR \fBnonterminal rule\fR \fInt\fR
.sp
\fIpegName\fR \fBunknown nonterminals\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a container class for
\fIparsing expression grammars\fR (Short: PEG).
It allows the incremental definition of the grammar, its manipulation
and querying of the definition.
The package neither provides complex operations on the grammar, nor has
it the ability to execute a grammar definition for a stream of symbols.
Two packages related to this one are \fBgrammar::mengine\fR and
\fBgrammar::peg::interpreter\fR. The first of them defines a
general virtual machine for the matching of a character stream, and
the second implements an interpreter for parsing expression grammars
on top of that virtual machine.
.SS "TERMS & CONCEPTS"
PEGs are similar to context-free grammars, but not equivalent; in some
cases PEGs are strictly more powerful than context-free grammars (there
exist PEGs for some non-context-free languages).
The formal mathematical definition of parsing expressions and parsing
expression grammars can be found in section
\fBPARSING EXPRESSION GRAMMARS\fR.
.PP
In short, we have \fIterminal symbols\fR, which are the most basic
building blocks for \fIsentences\fR, and \fInonterminal symbols\fR
with associated \fIparsing expressions\fR, defining the grammatical
structure of the sentences. The two sets of symbols are distinctive,
and do not overlap. When speaking about symbols the word "symbol" is
often left out. The union of the sets of terminal and nonterminal
symbols is called the set of \fIsymbols\fR.
.PP
Here the set of \fIterminal symbols\fR is not explicitly managed,
but implicitly defined as the set of all characters. Note that this
means that we inherit from Tcl the ability to handle all of Unicode.
.PP
A pair of \fInonterminal\fR and \fIparsing expression\fR is also
called a \fIgrammatical rule\fR, or \fIrule\fR for short. In the
context of a rule the nonterminal is often called the left-hand-side
(LHS), and the parsing expression the right-hand-side (RHS).
.PP
The \fIstart expression\fR of a grammar is a parsing expression
from which all the sentences contained in the language specified by
the grammar are \fIderived\fR.
To make the understanding of this term easier let us assume for a
moment that the RHS of each rule, and the start expression, is either
a sequence of symbols, or a series of alternate parsing expressions.
In the latter case the rule can be seen as a set of rules, each
providing one alternative for the nonterminal.
A parsing expression A' is now a derivation of a parsing expression A
if we pick one of the nonterminals N in the expression, and one of the
alternative rules R for N, and then replace the nonterminal in A with
the RHS of the chosen rule. Here we can see why the terminal symbols
are called such. They cannot be expanded any further, thus terminate
the process of deriving new expressions.
An example
.PP
.CS


    Rules
      (1)  A <- a B c
      (2a) B <- d B
      (2b) B <- e

    Some derivations, using starting expression A.

      A -/1/-> a B c -/2a/-> a d B c -/2b/-> a d e c

.CE
.PP
A derived expression containing only terminal symbols is a
\fIsentence\fR. The set of all sentences which can be derived from
the start expression is the \fIlanguage\fR of the grammar.
.PP
Some definitions for nonterminals and expressions:
.IP [1]
A nonterminal A is called \fIreachable\fR if it is possible to derive
a parsing expression from the start expression which contains A.
.IP [2]
A nonterminal A is called \fIuseful\fR if it is possible to derive a
sentence from it.
.IP [3]
A nonterminal A is called \fIrecursive\fR if it is possible to derive
a parsing expression from it which contains A, again.
.IP [4]
The \fIFIRST set\fR of a nonterminal A contains all the symbols which
can occur of as the leftmost symbol in a parsing expression derived from
A. If the FIRST set contains A itself then that nonterminal is called
\fIleft-recursive\fR.
.IP [5]
The \fILAST set\fR of a nonterminal A contains all the symbols which
can occur of as the rightmost symbol in a parsing expression derived from
A. If the LAST set contains A itself then that nonterminal is called
\fIright-recursive\fR.
.IP [6]
The \fIFOLLOW set\fR of a nonterminal A contains all the symbols which
can occur after A in a parsing expression derived from the start
expression.
.IP [7]
A nonterminal (or parsing expression) is called \fInullable\fR if the
empty sentence can be derived from it.
.PP
.PP
And based on the above definitions for grammars:
.IP [1]
A grammar G is \fIrecursive\fR if and only if it contains a nonterminal
A which is recursive. The terms \fIleft-\fR and \fIright-recursive\fR,
and \fIuseful\fR are analogously defined.
.IP [2]
A grammar is \fIminimal\fR if it contains only \fIreachable\fR and
\fIuseful\fR nonterminals.
.IP [3]
A grammar is \fIwellformed\fR if it is not left-recursive. Such
grammars are also \fIcomplete\fR, which means that they always succeed
or fail on all input sentences. For an incomplete grammar on the
other hand input sentences exist for which an attempt to match them
against the grammar will not terminate.
.IP [4]
As we wish to allow ourselves to build a grammar incrementally in a
container object we will encounter stages where the RHS of one or more
rules reference symbols which are not yet known to the container. Such
a grammar we call \fIinvalid\fR.
We cannot use the term \fIincomplete\fR as this term is already
taken, see the last item.
.PP
.PP
.SS "CONTAINER CLASS API"
The package exports the API described here.
.TP
\fB::grammar::peg\fR \fIpegName\fR ?\fB=\fR|\fB:=\fR|\fB<--\fR|\fBas\fR|\fBdeserialize\fR \fIsrc\fR?
The command creates a new container object for a parsing expression
grammar and returns the fully qualified name of the object command as
its result. The API the returned command is following is described in
the section \fBCONTAINER OBJECT API\fR. It may be used to invoke
various operations on the container and the grammar within.
.sp
The new container, i.e. grammar will be empty if no \fIsrc\fR is
specified. Otherwise it will contain a copy of the grammar contained
in the \fIsrc\fR.
The \fIsrc\fR has to be a container object reference for all operators
except \fBdeserialize\fR.
The \fBdeserialize\fR operator requires \fIsrc\fR to be the
serialization of a parsing expression grammar instead.
.sp
An empty grammar has no nonterminal symbols, and the start expression
is the empty expression, i.e. epsilon. It is \fIvalid\fR, but not
\fIuseful\fR.
.PP
.SS "CONTAINER OBJECT API"
.PP
All grammar container objects provide the following methods for the
manipulation of their contents:
.TP
\fIpegName\fR \fBdestroy\fR
Destroys the grammar, including its storage space and associated
command.
.TP
\fIpegName\fR \fBclear\fR
Clears out the definition of the grammar contained in \fIpegName\fR,
but does \fInot\fR destroy the object.
.TP
\fIpegName\fR \fB=\fR \fIsrcPEG\fR
Assigns the contents of the grammar contained in \fIsrcPEG\fR to
\fIpegName\fR, overwriting any existing definition.
This is the assignment operator for grammars. It copies the grammar
contained in the grammar object \fIsrcPEG\fR over the grammar
definition in \fIpegName\fR. The old contents of \fIpegName\fR are
deleted by this operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIpegName\fR \fBdeserialize\fR [\fIsrcPEG\fR \fBserialize\fR]

.CE
.TP
\fIpegName\fR \fB-->\fR \fIdstPEG\fR
This is the reverse assignment operator for grammars. It copies the
automation contained in the object \fIpegName\fR over the grammar
definition in the object \fIdstPEG\fR.
The old contents of \fIdstPEG\fR are deleted by this operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIdstPEG\fR \fBdeserialize\fR [\fIpegName\fR \fBserialize\fR]

.CE
.TP
\fIpegName\fR \fBserialize\fR
This method serializes the grammar stored in \fIpegName\fR. In other
words it returns a tcl \fIvalue\fR completely describing that
grammar.
This allows, for example, the transfer of grammars over arbitrary
channels, persistence, etc.
This method is also the basis for both the copy constructor and the
assignment operator.
.sp
The result of this method has to be semantically identical over all
implementations of the \fBgrammar::peg\fR interface. This is what
will enable us to copy grammars between different implementations of
the same interface.
.sp
The result is a list of four elements with the following structure:
.RS
.IP [1]
The constant string \fBgrammar::peg\fR.
.IP [2]
A dictionary. Its keys are the names of all known nonterminal symbols,
and their associated values are the parsing expressions describing
their sentennial structure.
.IP [3]
A dictionary. Its keys are the names of all known nonterminal symbols,
and their associated values hints to a matcher regarding the semantic
values produced by the symbol.
.IP [4]
The last item is a parsing expression, the \fIstart expression\fR
of the grammar.
.RE
.sp
Assuming the following PEG for simple mathematical expressions
.sp
.CS


    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'
    Sign       <- '+' / '-'
    Number     <- Sign? Digit+
    Expression <- '(' Expression ')' / (Factor (MulOp Factor)*)
    MulOp      <- '*' / '/'
    Factor     <- Term (AddOp Term)*
    AddOp      <- '+'/'-'
    Term       <- Number

.CE
.sp
a possible serialization is
.sp
.CS


    grammar::peg \\\\
    {Expression {/ {x ( Expression )} {x Factor {* {x MulOp Factor}}}} \\\\
     Factor     {x Term {* {x AddOp Term}}} \\\\
     Term       Number \\\\
     MulOp      {/ * /} \\\\
     AddOp      {/ + -} \\\\
     Number     {x {? Sign} {+ Digit}} \\\\
     Sign       {/ + -} \\\\
     Digit      {/ 0 1 2 3 4 5 6 7 8 9} \\\\
    } \\\\
    {Expression value     Factor     value \\\\
     Term       value     MulOp      value \\\\
     AddOp      value     Number     value \\\\
     Sign       value     Digit      value \\\\
    }
    Expression

.CE
.sp
A possible one, because the order of the nonterminals in the
dictionary is not relevant.
.TP
\fIpegName\fR \fBdeserialize\fR \fIserialization\fR
This is the complement to \fBserialize\fR. It replaces the grammar
definition in \fIpegName\fR with the grammar described by the
\fIserialization\fR value. The old contents of \fIpegName\fR are
deleted by this operation.
.TP
\fIpegName\fR \fBis valid\fR
A predicate. It tests whether the PEG in \fIpegName\fR is \fIvalid\fR.
See section \fBTERMS & CONCEPTS\fR for the definition of this
grammar property.
The result is a boolean value. It will be set to \fBtrue\fR if
the PEG has the tested property, and \fBfalse\fR otherwise.
.TP
\fIpegName\fR \fBstart\fR ?\fIpe\fR?
This method defines the \fIstart expression\fR of the grammar. It
replaces the previously defined start expression with the parsing
expression \fIpe\fR.
The method fails and throws an error if \fIpe\fR does not contain a
valid parsing expression as specified in the section
\fBPARSING EXPRESSIONS\fR. In that case the existing start
expression is not changed.
The method returns the empty string as its result.
.sp
If the method is called without an argument it will return the currently
defined start expression.
.TP
\fIpegName\fR \fBnonterminals\fR
Returns the set of all nonterminal symbols known to the grammar.
.TP
\fIpegName\fR \fBnonterminal add\fR \fInt\fR \fIpe\fR
This method adds the nonterminal \fInt\fR and its associated parsing
expression \fIpe\fR to the set of nonterminal symbols and rules of the
PEG contained in the object \fIpegName\fR.
The method fails and throws an error if either the string \fInt\fR is
already known as a symbol of the grammar, or if \fIpe\fR does not
contain a valid parsing expression as specified in the section
\fBPARSING EXPRESSIONS\fR. In that case the current set of
nonterminal symbols and rules is not changed.
The method returns the empty string as its result.
.TP
\fIpegName\fR \fBnonterminal delete\fR \fInt1\fR ?\fInt2\fR ...?
This method removes the named symbols \fInt1\fR, \fInt2\fR from the
set of nonterminal symbols of the PEG contained in the object
\fIpegName\fR.
The method fails and throws an error if any of the strings is not
known as a nonterminal symbol. In that case the current set of
nonterminal symbols is not changed.
The method returns the empty string as its result.
.sp
The stored grammar becomes invalid if the deleted nonterminals are
referenced by the RHS of still-known rules.
.TP
\fIpegName\fR \fBnonterminal exists\fR \fInt\fR
A predicate. It tests whether the nonterminal symbol \fInt\fR is known
to the PEG in \fIpegName\fR.
The result is a boolean value. It will be set to \fBtrue\fR if the
symbol \fInt\fR is known, and \fBfalse\fR otherwise.
.TP
\fIpegName\fR \fBnonterminal rename\fR \fInt\fR \fIntnew\fR
This method renames the nonterminal symbol \fInt\fR to \fIntnew\fR.
The method fails and throws an error if either \fInt\fR is not known
as a nonterminal, or if \fIntnew\fR is a known symbol.
The method returns the empty string as its result.
.TP
\fIpegName\fR \fBnonterminal mode\fR \fInt\fR ?\fImode\fR?
This mode returns or sets the semantic mode associated with the
nonterminal symbol \fInt\fR. If no \fImode\fR is specified the
current mode of the nonterminal is returned. Otherwise the current
mode is set to \fImode\fR.
The method fails and throws an error if \fInt\fR is not known as a
nonterminal.
The grammar interpreter implemented by the package
\fBgrammar::peg::interpreter\fR recognizes the
following modes:
.RS
.TP
value
The semantic value of the nonterminal is the abstract syntax tree
created from the AST's of the RHS and a node for the nonterminal
itself.
.TP
match
The semantic value of the nonterminal is an the abstract syntax tree
consisting of single a node for the string matched by the RHS. The ASTs
generated by the RHS are discarded.
.TP
leaf
The semantic value of the nonterminal is an the abstract syntax tree
consisting of single a node for the nonterminal itself. The ASTs
generated by the RHS are discarded.
.TP
discard
The nonterminal has no semantic value. The ASTs generated by the RHS
are discarded (as well).
.RE
.TP
\fIpegName\fR \fBnonterminal rule\fR \fInt\fR
This method returns the parsing expression associated with the
nonterminal \fInt\fR.
The method fails and throws an error if \fInt\fR is not known as a
nonterminal.
.TP
\fIpegName\fR \fBunknown nonterminals\fR
This method returns a list containing the names of all nonterminal
symbols which are referenced on the RHS of a grammatical rule, but
have no rule definining their structure. In other words, a list of
the nonterminal symbols which make the grammar invalid. The grammar
is valid if this list is empty.
.PP
.PP
.SS "PARSING EXPRESSIONS"
.PP
Various methods of PEG container objects expect a parsing expression
as their argument, or will return such. This section specifies the
format such parsing expressions are in.
.PP
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBalnum\fR is an atomic parsing expression. It matches
any alphanumeric character.
.IP [3]
The string \fBalpha\fR is an atomic parsing expression. It matches
any alphabetical character.
.IP [4]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [5]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [6]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.IP [7]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [8]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [9]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [10]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [11]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [12]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [13]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.PP
.PP
Examples of parsing expressions where already shown, in the
description of the method \fBserialize\fR.
.SH "PARSING EXPRESSION GRAMMARS"
.PP
For the mathematically inclined, a PEG is a 4-tuple (VN,VT,R,eS) where
.IP \(bu
VN is a set of \fInonterminal symbols\fR,
.IP \(bu
VT is a set of \fIterminal symbols\fR,
.IP \(bu
R is a finite set of rules, where each rule is a pair (A,e), A in VN,
and \fIe\fR a \fIparsing expression\fR.
.IP \(bu
eS is a parsing expression, the \fIstart expression\fR.
.PP
.PP
Further constraints are
.IP \(bu
The intersection of VN and VT is empty.
.IP \(bu
For all A in VT exists exactly one pair (A,e) in R. In other words, R
is a function from nonterminal symbols to parsing expressions.
.PP
.PP
Parsing expression are inductively defined via
.IP \(bu
The empty string (epsilon) is a parsing expression.
.IP \(bu
A terminal symbol \fIa\fR is a parsing expression.
.IP \(bu
A nonterminal symbol \fIA\fR is a parsing expression.
.IP \(bu
\fIe1\fR\fIe2\fR is a parsing expression for parsing expressions
\fIe1\fR and \fI2\fR. This is called \fIsequence\fR.
.IP \(bu
\fIe1\fR/\fIe2\fR is a parsing expression for parsing expressions
\fIe1\fR and \fI2\fR. This is called \fIordered choice\fR.
.IP \(bu
\fIe\fR* is a parsing expression for parsing expression
\fIe\fR. This is called \fIzero-or-more repetitions\fR, also known
as \fIkleene closure\fR.
.IP \(bu
\fIe\fR+ is a parsing expression for parsing expression
\fIe\fR. This is called \fIone-or-more repetitions\fR, also known
as \fIpositive kleene closure\fR.
.IP \(bu
!\fIe\fR is a parsing expression for parsing expression
\fIe1\fR. This is called a \fInot lookahead predicate\fR.
.IP \(bu
&\fIe\fR is a parsing expression for parsing expression
\fIe1\fR. This is called an \fIand lookahead predicate\fR.
.PP
.PP
.PP
PEGs are used to define a grammatical structure for streams of symbols
over VT. They are a modern phrasing of older formalisms invented by
Alexander Birham. These formalisms were called TS (TMG recognition
scheme), and gTS (generalized TS). Later they were renamed to TPDL
(Top-Down Parsing Languages) and gTPDL (generalized TPDL).
.PP
They can be easily implemented by recursive descent parsers with
backtracking. This makes them relatives of LL(k) Context-Free
Grammars.
.SH REFERENCES
.IP [1]
\fIThe Packrat Parsing and Parsing Expression Grammars Page\fR [http://www.pdos.lcs.mit.edu/~baford/packrat/],
by Bryan Ford, Massachusetts Institute of Technology. This is the main
entry page to PEGs, and their realization through Packrat Parsers.
.IP [2]
\fIParsing Techniques - A Practical Guide \fR [http://www.cs.vu.nl/~dick/PTAPG.html], an online book
offering a clear, accessible, and thorough discussion of many
different parsing techniques with their interrelations and
applicabilities, including error recovery techniques.
.IP [3]
\fICompilers and Compiler Generators\fR [http://scifac.ru.ac.za/compilers/], an online book using
CoCo/R, a generator for recursive descent parsers.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_peg\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
LL(k), TDPL, context-free languages, expression, grammar, parsing, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/grammar_peg/peg_interp.n.




















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/grammar_peg/peg_interp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005-2011 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "grammar::peg::interp" n 0.1.1 tcllib "Grammar operations and usage"
.BS
.SH NAME
grammar::peg::interp \- Interpreter for parsing expression grammars
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBgrammar::mengine  ?0.1?\fR
.sp
package require \fBgrammar::peg::interp  ?0.1.1?\fR
.sp
\fB::grammar::peg::interp::setup\fR \fIpeg\fR
.sp
\fB::grammar::peg::interp::parse\fR \fInextcmd\fR \fIerrorvar\fR \fIastvar\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides commands for the controlled matching of a
character stream via a parsing expression grammar and the creation
of an abstract syntax tree for the stream and partials.
.PP
It is built on top of the virtual machine provided by the package
\fBgrammar::me::tcl\fR and directly interprets the parsing
expression grammar given to it.
In other words, the grammar is \fInot\fR pre-compiled but used as is.
.PP
The grammar to be interpreted is taken from a container object
following the interface specified by the package
\fBgrammar::peg::container\fR. Only the relevant parts
are copied into the state of this package.
.PP
It should be noted that the package provides exactly one instance
of the interpreter, and interpreting a second grammar requires
the user to either abort or complete a running interpretation, or
to put them into different Tcl interpreters.
.PP
Also of note is that the implementation assumes a pull-type
handling of the input. In other words, the interpreter pulls
characters from the input stream as it needs them. For usage
in a push environment, i.e. where the environment pushes new
characters as they come we have to put the engine into its
own thread.
.SH "THE INTERPRETER API"
The package exports the following API
.TP
\fB::grammar::peg::interp::setup\fR \fIpeg\fR
This command (re)initializes the interpreter. It returns the
empty string. This command has to be invoked first, before any
matching run.
.sp
Its argument \fIpeg\fR is the handle of an object containing the
parsing expression grammar to interpret. This grammar has to be
valid, or an error will be thrown.
.TP
\fB::grammar::peg::interp::parse\fR \fInextcmd\fR \fIerrorvar\fR \fIastvar\fR
This command interprets the loaded grammar and tries to match it
against the stream of characters represented by the command prefix
\fInextcmd\fR.
.sp
The command prefix \fInextcmd\fR represents the input stream of
characters and is invoked by the interpreter whenever the a new
character from the stream is required.
The callback has to return either the empty list, or a list of 4
elements containing the token, its lexeme attribute, and its location
as line number and column index, in this order.
The empty list is the signal that the end of the input stream has been
reached. The lexeme attribute is stored in the terminal cache, but
otherwise not used by the machine.
.sp
The result of the command is a boolean value indicating whether the
matching process was successful (\fBtrue\fR), or not
(\fBfalse\fR). In the case of a match failure error information will
be stored into the variable referenced by \fIerrorvar\fR. The variable
referenced by \fIastvar\fR will always contain the generated abstract
syntax tree, however in the case of an error it will be only partial
and possibly malformed.
.sp
The abstract syntax tree is represented by a nested list, as
described in section \fBAST VALUES\fR of
document \fIgrammar::me_ast\fR.
.PP
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIgrammar_peg\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
LL(k), TDPL, context-free languages, expression, grammar, matching, parsing, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer, virtual machine
.SH CATEGORY
Grammars and finite automata
.SH COPYRIGHT
.nf
Copyright (c) 2005-2011 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/hook/hook.n.


















































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/hook/hook.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2010, by William H. Duquette
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "hook" n 0.1 tcllib "Hooks"
.BS
.SH NAME
hook \- Hooks
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBhook  ?0.1?\fR
.sp
\fBhook\fR \fBbind\fR ?\fIsubject\fR? ?\fIhook\fR? ?\fIobserver\fR? ?\fIcmdPrefix\fR?
.sp
\fBhook\fR \fBcall\fR \fIsubject\fR \fIhook\fR ?\fIargs\fR...?
.sp
\fBhook\fR \fBforget\fR \fIobject\fR
.sp
\fBhook\fR \fBcget\fR \fIoption\fR
.sp
\fBhook\fR \fBconfigure\fR \fBoption\fR \fIvalue\fR ...
.sp
.BE
.SH DESCRIPTION
.PP
This package provides the \fBhook\fR ensemble command, which
implements the Subject/Observer pattern. It allows \fIsubjects\fR,
which may be \fImodules\fR, \fIobjects\fR, \fIwidgets\fR, and so
forth, to synchronously call \fIhooks\fR which may be bound to an
arbitrary number of subscribers, called \fIobservers\fR. A subject
may call any number of distinct hooks, and any number of observers can
bind callbacks to a particular hook called by a particular
subject. Hook bindings can be queried and deleted.
.PP
This man page is intended to be a reference only.
.SH CONCEPTS
.SS INTRODUCTION
Tcl modules usually send notifications to other modules in two ways:
via Tk events, and via callback options like the text widget's
\fB-yscrollcommand\fR option. Tk events are available only in Tk,
and callback options require tight coupling between the modules
sending and receiving the notification.
.PP
Loose coupling between sender and receiver is often desirable,
however.  In Model/View/Controller terms, a View can send a command
(stemming from user input) to the Controller, which updates the
Model. The Model can then call a hook \fIto which all relevant
Views subscribe.\fR The Model is decoupled from the Views, and indeed
need not know whether any Views actually exist.
At present, Tcl/Tk has no standard mechanism for implementing loose
coupling of this kind. This package defines a new command, \fBhook\fR,
which implements just such a mechanism.
.SS BINDINGS
The \fBhook\fR command manages a collection of hook bindings. A hook
binding has four elements:
.IP [1]
A \fIsubject\fR: the name of the entity that will be calling the
hook.
.IP [2]
The \fIhook\fR itself. A hook usually reflects some occurrence in the
life of the \fIsubject\fR that other entities might care to know
about. A \fIhook\fR has a name, and may also have arguments. Hook
names are arbitrary strings. Each \fIsubject\fR must document the
names and arguments of the hooks it can call.
.IP [3]
The name of the \fIobserver\fR that wishes to receive the \fIhook\fR
from the \fIsubject\fR.
.IP [4]
A command prefix to which the \fIhook\fR arguments will be appended
when the binding is executed.
.PP
.SS "SUBJECTS AND OBSERVERS"
For convenience, this document collectively refers to subjects and
observers as \fIobjects\fR, while placing no requirements on how
these \fIobjects\fR are actually implemented. An object can be a
\fBTclOO\fR or \fBSnit\fR or \fBXOTcl\fR object, a Tcl
command, a namespace, a module, a pseudo-object managed by some other
object (as tags are managed by the Tk text widget) or simply a
well-known name.
.PP
Subject and observer names are arbitrary strings; however, as
\fBhook\fR might be used at the package level, it's necessary to have
conventions that avoid name collisions between packages written by
different people.
.PP
Therefore, any subject or observer name used in core or package level
code should look like a Tcl command name, and should be defined in a
namespace owned by the package. Consider, for example, an ensemble
command \fB::foo\fR that creates a set of pseudo-objects and uses
\fBhook\fR to send notifications. The pseudo-objects have names
that are not commands and exist in their own namespace, rather like
file handles do. To avoid name collisions with subjects defined by
other packages, users of \fBhook\fR, these \fB::foo\fR handles
should have names like \fB::foo::1\fR, \fB::foo::2\fR, and so on.
.PP
Because object names are arbitrary strings, application code can use
whatever additional conventions are dictated by the needs of the
application.
.SH REFERENCE
Hook provides the following commands:
.TP
\fBhook\fR \fBbind\fR ?\fIsubject\fR? ?\fIhook\fR? ?\fIobserver\fR? ?\fIcmdPrefix\fR?
This subcommand is used to create, update, delete, and query hook
bindings.
.sp
Called with no arguments it returns a list of the subjects with
hooks to which observers are currently bound.
.sp
Called with one argument, a \fIsubject\fR, it returns a list of
the subject's hooks to which observers are currently bound.
.sp
Called with two arguments, a \fIsubject\fR and a \fIhook\fR, it
returns a list of the observers which are currently bound to this
\fIsubject\fR and \fIhook\fR.
.sp
Called with three arguments, a \fIsubject\fR, a \fIhook\fR, and
an \fIobserver\fR, it returns the binding proper, the command prefix
to be called when the hook is called, or the empty string if there is
no such binding.
.sp
Called with four arguments, it creates, updates, or deletes a
binding. If \fIcmdPrefix\fR is the empty string, it deletes any
existing binding for the \fIsubject\fR, \fIhook\fR, and
\fIobserver\fR; nothing is returned. Otherwise, \fIcmdPrefix\fR must
be a command prefix taking as many additional arguments as are
documented for the \fIsubject\fR and \fIhook\fR. The binding is added
or updated, and the observer is returned.
.sp
If the \fIobserver\fR is the empty string, "", it will create a
new binding using an automatically generated observer name of the form
\fB::hook::ob\fR<\fBnumber\fR>. The automatically generated name
will be returned, and can be used to query, update, and delete the
binding as usual. If automated observer names are always used, the
observer name effectively becomes a unique binding ID.
.sp
It is possible to call \fBhook bind\fR to create or delete a
binding to a \fIsubject\fR and \fIhook\fR while in an observer binding
for that same \fIsubject\fR and \fIhook\fR. The following rules
determine what happens when
.CS


    hook bind $s $h $o $binding

.CE
.IP
is called during the execution of
.CS


    hook call $s $h

.CE
.RS
.IP [1]
No binding is ever called after it is deleted.
.IP [2]
When a binding is called, the most recently given command prefix is
always used.
.IP [3]
The set of observers whose bindings are to be called is determined
when this method begins to execute, and does not change thereafter,
except that deleted bindings are not called.
.RE
.IP
In particular:
.RS
.IP [1]
If \fB$o\fRs binding to \fB$s\fR and \fB$h\fR is deleted, and
\fB$o\fRs binding has not yet been called during this execution of
.CS


    hook call $s $h

.CE
.IP
it will not be called. (Note that it might already have been called;
and in all likelihood, it is probably deleting itself.)
.IP [2]
If \fB$o\fR changes the command prefix that's bound to \fB$s\fR and
\fB$h\fR, and if \fB$o\fRs binding has not yet been called during
this execution of
.CS


    hook call $s $h

.CE
.IP
the new binding will be called when the time comes. (But again, it is
probably \fB$o\fRs binding that is is making the change.)
.IP [3]
If a new observer is bound to \fB$s\fR and \fB$h\fR, its binding will
not be called until the next invocation of
.CS


    hook call $s $h

.CE
.RE
.TP
\fBhook\fR \fBcall\fR \fIsubject\fR \fIhook\fR ?\fIargs\fR...?
This command is called when the named \fIsubject\fR wishes to call the
named \fIhook\fR. All relevant bindings are called with the specified
arguments in the global namespace. Note that the bindings are called
synchronously, before the command returns; this allows the \fIargs\fR
to include references to entities that will be cleaned up as soon as
the hook has been called.
.sp
The order in which the bindings are called is not guaranteed. If
sequence among observers must be preserved, define one observer and
have its bindings call the other callbacks directly in the proper
sequence.
.sp
Because the \fBhook\fR mechanism is intended to support loose
coupling, it is presumed that the \fIsubject\fR has no knowledge of
the observers, nor any expectation regarding return values. This has a
number of implications:
.RS
.IP [1]
\fBhook call\fR returns the empty string.
.IP [2]
Normal return values from observer bindings are ignored.
.IP [3]
Errors and other exceptional returns propagate normally by
default. This will rarely be what is wanted, because the subjects
usually have no knowledge of the observers and will therefore have no
particular competence at handling their errors. That makes it an
application issue, and so applications will usually want to define an
\fB-errorcommand\fR.
.RE
.IP
If the \fB-errorcommand\fR configuration option has a non-empty
value, its value will be invoked for all errors and other exceptional
returns in observer bindings. See \fBhook configure\fR, below, for
more information on configuration options.
.TP
\fBhook\fR \fBforget\fR \fIobject\fR
This command deletes any existing bindings in which the named
\fIobject\fR appears as either the \fIsubject\fR or the
\fIobserver\fR.
Bindings deleted by this method will never be called again. In
particular,
.RS
.IP [1]
If an observer is forgotten during a call to \fBhook call\fR, any
uncalled binding it might have had to the relevant subject and hook
will \fInot\fR be called subsequently.
.IP [2]
If a subject \fB$s\fR is forgotten during a call to
.CS

hook call $s $h
.CE
.IP
then \fBhook call\fR will return as soon as the current binding
returns.  No further bindings will be called.
.RE
.TP
\fBhook\fR \fBcget\fR \fIoption\fR
This command returns the value of one of the \fBhook\fR command's
configuration options.
.TP
\fBhook\fR \fBconfigure\fR \fBoption\fR \fIvalue\fR ...
This command sets the value of one or more of the \fBhook\fR command's
configuration options:
.RS
.TP
\fB-errorcommand\fR \fIcmdPrefix\fR
If the value of this option is the empty string, "", then errors
and other exception returns in binding scripts are propagated
normally. Otherwise, it must be a command prefix taking three
additional arguments:
.RS
.IP [1]
a 4-element list {subject hook arglist observer},
.IP [2]
the result string, and
.IP [3]
the return options dictionary.
.RE
.IP
Given this information, the \fB-errorcommand\fR can choose to log
the error, call \fBinterp bgerror\fR, delete the errant binding
(thus preventing the error from arising a second time) and so forth.
.TP
\fB-tracecommand\fR \fIcmdPrefix\fR
The option's value should be a command prefix taking four
arguments:
.RS
.IP [1]
a \fIsubject\fR,
.IP [2]
a \fIhook\fR,
.IP [3]
a list of the hook's argument values, and
.IP [4]
a list of \fIobjects\fR the hook was called for.
.RE
.IP
The command will be called for each hook that is called. This allows
the application to trace hook execution for debugging purposes.
.RE
.PP
.SH EXAMPLE
The \fB::model\fR module calls the <Update> hook in response to
commands that change the model's data:
.CS


     hook call ::model <Update>

.CE
The \fB.view\fR megawidget displays the model state, and needs to
know about model updates. Consequently, it subscribes to the ::model's
<Update> hook.
.CS


     hook bind ::model <Update> .view [list .view ModelUpdate]

.CE
When the \fB::model\fR calls the hook, the \fB.view\fRs
ModelUpdate subcommand will be called.
.PP
Later the \fB.view\fR megawidget is destroyed. In its destructor,
it tells the \fIhook\fR that it no longer exists:
.CS


     hook forget .view

.CE
All bindings involving \fB.view\fR are deleted.
.SH CREDITS
Hook has been designed and implemented by William H. Duquette.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIhook\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
uevent(n)
.SH KEYWORDS
callback, event, hook, observer, producer, publisher, subject, subscriber, uevent
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2010, by William H. Duquette

.fi

Added embedded/man/files/modules/html/html.n.




















































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/html/html.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "html" n 1.4 tcllib "HTML Generation"
.BS
.SH NAME
html \- Procedures to generate HTML structures
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBhtml  ?1.4?\fR
.sp
\fB::html::author\fR \fIauthor\fR
.sp
\fB::html::bodyTag\fR \fIargs\fR
.sp
\fB::html::cell\fR \fIparam value\fR ?\fItag\fR?
.sp
\fB::html::checkbox\fR \fIname value\fR
.sp
\fB::html::checkSet\fR \fIkey sep list\fR
.sp
\fB::html::checkValue\fR \fIname\fR ?\fIvalue\fR?
.sp
\fB::html::closeTag\fR
.sp
\fB::html::default\fR \fIkey\fR ?\fIparam\fR?
.sp
\fB::html::description\fR \fIdescription\fR
.sp
\fB::html::end\fR
.sp
\fB::html::eval\fR \fIarg\fR ?\fIargs\fR?
.sp
\fB::html::extractParam\fR \fIparam key\fR ?\fIvarName\fR?
.sp
\fB::html::font\fR \fIargs\fR
.sp
\fB::html::for\fR \fIstart test next body\fR
.sp
\fB::html::foreach\fR \fIvarlist1 list1\fR ?\fIvarlist2 list2 ...\fR? \fIbody\fR
.sp
\fB::html::formValue\fR \fIname\fR ?\fIdefvalue\fR?
.sp
\fB::html::getFormInfo\fR \fIargs\fR
.sp
\fB::html::getTitle\fR
.sp
\fB::html::h\fR \fIlevel string\fR ?\fIparam\fR?
.sp
\fB::html::h1\fR \fIstring\fR ?\fIparam\fR?
.sp
\fB::html::h2\fR \fIstring\fR ?\fIparam\fR?
.sp
\fB::html::h3\fR \fIstring\fR ?\fIparam\fR?
.sp
\fB::html::h4\fR \fIstring\fR ?\fIparam\fR?
.sp
\fB::html::h5\fR \fIstring\fR ?\fIparam\fR?
.sp
\fB::html::h6\fR \fIstring\fR ?\fIparam\fR?
.sp
\fB::html::hdrRow\fR \fIargs\fR
.sp
\fB::html::head\fR \fItitle\fR
.sp
\fB::html::headTag\fR \fIstring\fR
.sp
\fB::html::html_entities\fR \fIstring\fR
.sp
\fB::html::if\fR \fIexpr1 body1\fR ?\fBelseif\fR \fIexpr2 body2 ...\fR? ?\fBelse\fR \fIbodyN\fR?
.sp
\fB::html::init\fR ?\fIlist\fR?
.sp
\fB::html::keywords\fR \fIargs\fR
.sp
\fB::html::mailto\fR \fIemail\fR ?\fIsubject\fR?
.sp
\fB::html::meta\fR \fIargs\fR
.sp
\fB::html::minorList\fR \fIlist\fR ?\fIordered\fR?
.sp
\fB::html::minorMenu\fR \fIlist\fR ?\fIsep\fR?
.sp
\fB::html::nl2br\fR \fIstring\fR
.sp
\fB::html::openTag\fR \fItag\fR ?\fIparam\fR?
.sp
\fB::html::paramRow\fR \fIlist\fR ?\fIrparam\fR? ?\fIcparam\fR?
.sp
\fB::html::passwordInput\fR ?\fIname\fR?
.sp
\fB::html::passwordInputRow\fR \fIlabel\fR ?\fIname\fR?
.sp
\fB::html::quoteFormValue\fR \fIvalue\fR
.sp
\fB::html::radioSet\fR \fIkey sep list\fR
.sp
\fB::html::radioValue\fR \fIname value\fR
.sp
\fB::html::refresh\fR \fIseconds url\fR
.sp
\fB::html::row\fR \fIargs\fR
.sp
\fB::html::select\fR \fIname param choices\fR ?\fIcurrent\fR?
.sp
\fB::html::selectPlain\fR \fIname param choices\fR ?\fIcurrent\fR?
.sp
\fB::html::set\fR \fIvar val\fR
.sp
\fB::html::submit\fR \fIlabel\fR ?\fIname\fR?
.sp
\fB::html::tableFromArray\fR \fIarrname\fR ?\fIparam\fR? ?\fIpat\fR?
.sp
\fB::html::tableFromList\fR \fIquerylist\fR ?\fIparam\fR?
.sp
\fB::html::textarea\fR \fIname\fR ?\fIparam\fR? ?\fIcurrent\fR?
.sp
\fB::html::textInput\fR \fIname value args\fR
.sp
\fB::html::textInputRow\fR \fIlabel name value args\fR
.sp
\fB::html::varEmpty\fR \fIname\fR
.sp
\fB::html::while\fR \fItest body\fR
.sp
.BE
.SH DESCRIPTION
.PP
The package \fBhtml\fR provides commands that generate HTML.
These commands typically return an HTML string as their result. In
particular, they do not output their result to \fBstdout\fR.
.PP
The command \fB::html::init\fR should be called early to initialize
the module.  You can also use this procedure to define default values
for HTML tag parameters.
.TP
\fB::html::author\fR \fIauthor\fR
\fISide effect only\fR.  Call this before \fB::html::head\fR to
define an author for the page.  The author is noted in a comment in
the HEAD section.
.TP
\fB::html::bodyTag\fR \fIargs\fR
Generate a \fIbody\fR tag.  The tag parameters are taken from \fIargs\fR or
from the body.* attributes define with \fB::html::init\fR.
.TP
\fB::html::cell\fR \fIparam value\fR ?\fItag\fR?
Generate a \fItd\fR (or \fIth\fR) tag, a value, and a closing
\fItd\fR (or \fIth\fR) tag. The
tag parameters come from \fIparam\fR or TD.* attributes defined with
\fB::html::init\fR.  This uses \fB::html::font\fR to insert a standard
\fIfont\fR tag into the table cell. The \fItag\fR argument defaults to "td".
.TP
\fB::html::checkbox\fR \fIname value\fR
Generate a \fIcheckbox\fR form element with the specified name and value.
This uses \fB::html::checkValue\fR.
.TP
\fB::html::checkSet\fR \fIkey sep list\fR
Generate a set of \fIcheckbox\fR form elements and associated labels.  The
\fIlist\fR should contain an alternating list of labels and values.
This uses \fB::html::checkbox\fR. All the \fIcheckbox\fR buttons share the
same \fIkey\fR for their name. The \fIsep\fR is text used to separate
the elements.
.TP
\fB::html::checkValue\fR \fIname\fR ?\fIvalue\fR?
Generate the "name=\fIname\fR value=\fIvalue\fR for a \fIcheckbox\fR form
element.  If the CGI variable \fIname\fR has the value \fIvalue\fR,
then SELECTED is added to the return value. \fIvalue\fR defaults to
"1".
.TP
\fB::html::closeTag\fR
Pop a tag off the stack created by \fB::html::openTag\fR and generate
the corresponding close tag (e.g., </body>).
.TP
\fB::html::default\fR \fIkey\fR ?\fIparam\fR?
This procedure is used by \fB::html::tagParam\fR to generate the name,
value list of parameters for a tag.  The \fB::html::default\fR
procedure is used to generate default values for those items not
already in \fIparam\fR.  If the value identified by \fIkey\fR matches
a value in \fIparam\fR then this procedure returns the empty string.
Otherwise, it returns a "parameter=value" string for a form element
identified by \fIkey\fR.  The \fIkey\fR has the form "tag.parameter"
(e.g., body.bgcolor).  Use \fB::html::init\fR to register default
values. \fIparam\fR defaults to the empty string.
.TP
\fB::html::description\fR \fIdescription\fR
\fISide effect only\fR.  Call this before \fB::html::head\fR to
define a description \fImeta\fR tag for the page.  This tag is generated
later in the call to \fB::html::head\fR.
.TP
\fB::html::end\fR
Pop all open tags from the stack and generate the corresponding close
HTML tags, (e.g., </body></html>).
.TP
\fB::html::eval\fR \fIarg\fR ?\fIargs\fR?
This procedure is similar to the built-in Tcl \fBeval\fR command.  The
only difference is that it returns "" so it can be called from an HTML
template file without appending unwanted results.
.TP
\fB::html::extractParam\fR \fIparam key\fR ?\fIvarName\fR?
This is a parsing procedure that extracts the value of \fIkey\fR from
\fIparam\fR, which is a HTML-style "name=quotedvalue" list.
\fIvarName\fR is used as the name of a Tcl variable that is changed to
have the value found in the parameters.  The function returns 1 if the
parameter was found in \fIparam\fR, otherwise it returns 0.  If the
\fIvarName\fR is not specified, then \fIkey\fR is used as the variable
name.
.TP
\fB::html::font\fR \fIargs\fR
Generate a standard \fIfont\fR tag.  The parameters to the tag are taken
from \fIargs\fR and the HTML defaults defined with \fB::html::init\fR.
.TP
\fB::html::for\fR \fIstart test next body\fR
This procedure is similar to the built-in Tcl \fBfor\fR control
structure.  Rather than evaluating the body, it returns the subst'ed
\fIbody\fR. Each iteration of the loop causes another string to be
concatenated to the result value.
.TP
\fB::html::foreach\fR \fIvarlist1 list1\fR ?\fIvarlist2 list2 ...\fR? \fIbody\fR
This procedure is similar to the built-in Tcl \fBforeach\fR control
structure.  Rather than evaluating the body, it returns the subst'ed
\fIbody\fR.  Each iteration of the loop causes another string to be
concatenated to the result value.
.TP
\fB::html::formValue\fR \fIname\fR ?\fIdefvalue\fR?
Return a name and value pair, where the value is initialized from
existing CGI data, if any.  The result has this form:
.sp
.CS


  name="fred" value="freds value"

.CE
.TP
\fB::html::getFormInfo\fR \fIargs\fR
Generate hidden fields to capture form values.  If \fIargs\fR is
empty, then hidden fields are generated for all CGI values.  Otherwise
args is a list of string match patterns for form element names.
.TP
\fB::html::getTitle\fR
Return the title string, with out the surrounding \fItitle\fR tag,
set with a previous call to \fB::html::title\fR.
.TP
\fB::html::h\fR \fIlevel string\fR ?\fIparam\fR?
Generate a heading (e.g., \fIh\fBlevel\fR\fR) tag.  The \fIstring\fR is nested in the
heading, and \fIparam\fR is used for the tag parameters.
.TP
\fB::html::h1\fR \fIstring\fR ?\fIparam\fR?
Generate an \fIh1\fR tag.  See \fB::html::h\fR.
.TP
\fB::html::h2\fR \fIstring\fR ?\fIparam\fR?
Generate an \fIh2\fR tag.  See \fB::html::h\fR.
.TP
\fB::html::h3\fR \fIstring\fR ?\fIparam\fR?
Generate an \fIh3\fR tag.  See \fB::html::h\fR.
.TP
\fB::html::h4\fR \fIstring\fR ?\fIparam\fR?
Generate an \fIh4\fR tag.  See \fB::html::h\fR.
.TP
\fB::html::h5\fR \fIstring\fR ?\fIparam\fR?
Generate an \fIh5\fR tag.  See \fB::html::h\fR.
.TP
\fB::html::h6\fR \fIstring\fR ?\fIparam\fR?
Generate an \fIh6\fR tag.  See \fB::html::h\fR.
.TP
\fB::html::hdrRow\fR \fIargs\fR
Generate a table row, including \fItr\fR and \fIth\fR tags.
Each value in \fIargs\fR is place into its own table cell.
This uses \fB::html::cell\fR.
.TP
\fB::html::head\fR \fItitle\fR
Generate the \fIhead\fR section that includes the page \fItitle\fR.
If previous calls have been made to
\fB::html::author\fR,
\fB::html::keywords\fR,
\fB::html::description\fR,
or
\fB::html::meta\fR
then additional tags are inserted into the \fIhead\fR section.
This leaves an open \fIhtml\fR tag pushed on the stack with
\fB::html::openTag\fR.
.TP
\fB::html::headTag\fR \fIstring\fR
Save a tag for inclusion in the \fIhead\fR section generated by
\fB::html::head\fR.  The \fIstring\fR is everything in the tag except
the enclosing angle brackets, < >.
.TP
\fB::html::html_entities\fR \fIstring\fR
This command replaces all special characters in the \fIstring\fR with
their HTML entities and returns the modified text.
.TP
\fB::html::if\fR \fIexpr1 body1\fR ?\fBelseif\fR \fIexpr2 body2 ...\fR? ?\fBelse\fR \fIbodyN\fR?
This procedure is similar to the built-in Tcl \fBif\fR control
structure.  Rather than evaluating the body of the branch that is
taken, it returns the subst'ed \fIbody\fR.  Note that the syntax is
slightly more restrictive than that of the built-in Tcl \fBif\fR
control structure.
.TP
\fB::html::init\fR ?\fIlist\fR?
\fB::html::init\fR accepts a Tcl-style name-value list that defines
values for items with a name of the form "tag.parameter".  For
example, a default with key "body.bgcolor" defines the background
color for the \fIbody\fR tag.
.TP
\fB::html::keywords\fR \fIargs\fR
\fISide effect only\fR.  Call this before \fB::html::head\fR to
define a keyword \fImeta\fR tag for the page.  The \fImeta\fR tag
is included in the result of \fB::html::head\fR.
.TP
\fB::html::mailto\fR \fIemail\fR ?\fIsubject\fR?
Generate a hypertext link to a mailto: URL.
.TP
\fB::html::meta\fR \fIargs\fR
\fISide effect only\fR.  Call this before \fB::html::head\fR to
define a \fImeta\fR tag for the page.  The \fIargs\fR is a Tcl-style name,
value list that is used for the name= and value= parameters for the
\fImeta\fR tag.  The \fImeta\fR tag is included in the result of
\fB::html::head\fR.
.TP
\fB::html::minorList\fR \fIlist\fR ?\fIordered\fR?
Generate an ordered or unordered list of links.  The \fIlist\fR is a
Tcl-style name, value list of labels and urls for the links.
\fIordered\fR is a boolean used to choose between an ordered or
unordered list. It defaults to \fBfalse\fR.
.TP
\fB::html::minorMenu\fR \fIlist\fR ?\fIsep\fR?
Generate a series of hypertext links.  The \fIlist\fR is a Tcl-style
name, value list of labels and urls for the links.  The \fIsep\fR is
the text to put between each link. It defaults to " | ".
.TP
\fB::html::nl2br\fR \fIstring\fR
This command replaces all line-endings in the \fIstring\fR with a
\fIbr\fR tag and returns the modified text.
.TP
\fB::html::openTag\fR \fItag\fR ?\fIparam\fR?
Push \fItag\fR onto a stack and generate the opening tag for
\fItag\fR. Use \fB::html::closeTag\fR to pop the tag from the
stack. The second argument provides any tag arguments, as a
list whose elements are formatted to be in the form
"\fBkey\fR=\fBvalue\fR".
.TP
\fB::html::paramRow\fR \fIlist\fR ?\fIrparam\fR? ?\fIcparam\fR?
Generate a table row, including \fItr\fR and \fItd\fR tags. Each value in
\fIlist\fR is placed into its own table cell. This uses
\fB::html::cell\fR. The value of \fIrparam\fR is used as parameter for
the \fItr\fR tag. The value of \fIcparam\fR is passed to \fB::html::cell\fR
as parameter for the \fItd\fR tags.
.TP
\fB::html::passwordInput\fR ?\fIname\fR?
Generate an \fIinput\fR tag of type \fIpassword\fR. The \fIname\fR defaults to
"password".
.TP
\fB::html::passwordInputRow\fR \fIlabel\fR ?\fIname\fR?
Format a table row containing a label and an \fIinput\fR tag of type
\fIpassword\fR. The \fIname\fR defaults to "password".
.TP
\fB::html::quoteFormValue\fR \fIvalue\fR
Quote special characters in \fIvalue\fR by replacing them with HTML
entities for quotes, ampersand, and angle brackets.
.TP
\fB::html::radioSet\fR \fIkey sep list\fR
Generate a set of \fIinput\fR tags of type \fIradio\fR and an associated text
label.  All the radio buttons share the same \fIkey\fR for their name.
The \fIsep\fR is text used to separate the elements.  The \fIlist\fR
is a Tcl-style label, value list.
.TP
\fB::html::radioValue\fR \fIname value\fR
Generate the "name=\fIname\fR value=\fIvalue\fR for a \fIradio\fR form
element.  If the CGI variable \fIname\fR has the value \fIvalue\fR,
then SELECTED is added to the return value.
.TP
\fB::html::refresh\fR \fIseconds url\fR
Set up a refresh \fImeta\fR tag. Call this before \fB::html::head\fR and the
HEAD section will contain a \fImeta\fR tag that causes the document to
refresh in \fIseconds\fR seconds.  The \fIurl\fR is optional.  If
specified, it specifies a new page to load after the refresh interval.
.TP
\fB::html::row\fR \fIargs\fR
Generate a table row, including \fItr\fR and \fItd\fR tags.  Each value in
\fIargs\fR is place into its own table cell. This uses
\fB::html::cell\fR. Ignores any default information set up via
\fB::html::init\fR.
.TP
\fB::html::select\fR \fIname param choices\fR ?\fIcurrent\fR?
Generate a \fIselect\fR form element and nested \fIoption\fR tags. The \fIname\fR
and \fIparam\fR are used to generate the \fIselect\fR tag. The \fIchoices\fR
list is a Tcl-style name, value list.
.TP
\fB::html::selectPlain\fR \fIname param choices\fR ?\fIcurrent\fR?
Like \fB::html::select\fR except that \fIchoices\fR is a Tcl list of
values used for the \fIoption\fR tags.  The label and the value for each
\fIoption\fR are the same.
.TP
\fB::html::set\fR \fIvar val\fR
This procedure is similar to the built-in Tcl \fBset\fR command.  The
main difference is that it returns "" so it can be called from an HTML
template file without appending unwanted results.  The other
difference is that it must take two arguments.
.TP
\fB::html::submit\fR \fIlabel\fR ?\fIname\fR?
Generate an \fIinput\fR tag of type \fIsubmit\fR. \fIname\fR defaults to "submit".
.TP
\fB::html::tableFromArray\fR \fIarrname\fR ?\fIparam\fR? ?\fIpat\fR?
Generate a two-column \fItable\fR and nested rows to display a Tcl array. The
table gets a heading that matches the array name, and each generated row
contains a name, value pair. The array names are sorted (\fBlsort\fR without
special options). The argument \fIparam\fR is for the \fItable\fR tag and has
to contain a pre-formatted string. The \fIpat\fR is a \fBstring match\fR
pattern used to select the array elements to show in the table. It defaults to
\fB*\fR, i.e. the whole array is shown.
.TP
\fB::html::tableFromList\fR \fIquerylist\fR ?\fIparam\fR?
Generate a two-column \fItable\fR and nested rows to display \fIquerylist\fR,
which is a Tcl dictionary. Each generated row contains a name, value pair. The
information is shown in the same order as specified in the dictionary. The
argument \fIparam\fR is for the \fItable\fR tag  and has to contain a
pre-formatted string.
.TP
\fB::html::textarea\fR \fIname\fR ?\fIparam\fR? ?\fIcurrent\fR?
Generate a \fItextarea\fR tag wrapped around its current values.
.TP
\fB::html::textInput\fR \fIname value args\fR
Generate an \fIinput\fR form tag with type \fItext\fR.  This uses
\fB::html::formValue\fR.  The args is any additional tag attributes
you want to put into the \fIinput\fR tag.
.TP
\fB::html::textInputRow\fR \fIlabel name value args\fR
Generate an \fIinput\fR form tag with type \fItext\fR formatted into a table row
with an associated label.  The args is any additional tag attributes
you want to put into the \fIinput\fR tag.
.TP
\fB::html::varEmpty\fR \fIname\fR
This returns 1 if the named variable either does not exist or has the
empty string for its value.
.TP
\fB::html::while\fR \fItest body\fR
This procedure is similar to the built-in Tcl \fBwhile\fR control
structure.  Rather than evaluating the body, it returns the subst'ed
\fIbody\fR.  Each iteration of the loop causes another string to be
concatenated to the result value.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIhtml\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
htmlparse, ncgi
.SH KEYWORDS
checkbox, checkbutton, form, html, radiobutton, table
.SH CATEGORY
CGI programming

Added embedded/man/files/modules/htmlparse/htmlparse.n.























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/htmlparse/htmlparse.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "htmlparse" n 1.2.1 tcllib "HTML Parser"
.BS
.SH NAME
htmlparse \- Procedures to parse HTML strings
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::stack  1.3\fR
.sp
package require \fBcmdline  1.1\fR
.sp
package require \fBhtmlparse  ?1.2.1?\fR
.sp
\fB::htmlparse::parse\fR ?-cmd \fIcmd\fR? ?-vroot \fItag\fR? ?-split \fIn\fR? ?-incvar \fIvar\fR? ?-queue \fIq\fR? \fIhtml\fR
.sp
\fB::htmlparse::debugCallback\fR ?\fIclientdata\fR? \fItag slash param textBehindTheTag\fR
.sp
\fB::htmlparse::mapEscapes\fR \fIhtml\fR
.sp
\fB::htmlparse::2tree\fR \fIhtml tree\fR
.sp
\fB::htmlparse::removeVisualFluff\fR \fItree\fR
.sp
\fB::htmlparse::removeFormDefs\fR \fItree\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBhtmlparse\fR package provides commands that allow libraries
and applications to parse HTML in a string into a representation of
their choice.
.PP
The following commands are available:
.TP
\fB::htmlparse::parse\fR ?-cmd \fIcmd\fR? ?-vroot \fItag\fR? ?-split \fIn\fR? ?-incvar \fIvar\fR? ?-queue \fIq\fR? \fIhtml\fR
This command is the basic parser for HTML. It takes an HTML string,
parses it and invokes a command prefix for every tag encountered. It
is not necessary for the HTML to be valid for this parser to
function. It is the responsibility of the command invoked for every
tag to check this. Another responsibility of the invoked command is
the handling of tag attributes and character entities (escaped
characters). The parser provides the un-interpreted tag attributes to
the invoked command to aid in the former, and the package at large
provides a helper command, \fB::htmlparse::mapEscapes\fR, to aid in
the handling of the latter. The parser \fIdoes\fR ignore leading
DOCTYPE declarations and all valid HTML comments it encounters.
.sp
All information beyond the HTML string itself is specified via
options, these are explained below.
.sp
To help understand the options, some more background information about
the parser.
.sp
It is capable of detecting incomplete tags in the HTML string given to
it. Under normal circumstances this will cause the parser to throw an
error, but if the option \fI-incvar\fR is used to specify a global (or
namespace) variable, the parser will store the incomplete part of the
input into this variable instead. This will aid greatly in the
handling of incrementally arriving HTML, as the parser will handle
whatever it can and defer the handling of the incomplete part until
more data has arrived.
.sp
Another feature of the parser are its two possible modes of
operation. The normal mode is activated if the option \fI-queue\fR is
not present on the command line invoking the parser. If it is present,
the parser will go into the incremental mode instead.
.sp
The main difference is that a parser in normal mode will immediately
invoke the command prefix for each tag it encounters. In incremental
mode however the parser will generate a number of scripts which invoke
the command prefix for groups of tags in the HTML string and then
store these scripts in the specified queue. It is then the
responsibility of the caller of the parser to ensure the execution of
the scripts in the queue.
.sp
\fINote\fR: The queue object given to the parser has to provide the
same interface as the queue defined in tcllib -> struct. This means,
for example, that all queues created via that tcllib module can be
immediately used here. Still, the queue doesn't have to come from
tcllib -> struct as long as the same interface is provided.
.sp
In both modes the parser will return an empty string to the caller.
.sp
The \fI-split\fR option may be given to a parser in incremental mode to
specify the size of the groups it creates. In other words, -split 5
means that each of the generated scripts will invoke the command
prefix for 5 consecutive tags in the HTML string. A parser in normal
mode will ignore this option and its value.
.sp
The option \fI-vroot\fR specifies a virtual root tag. A parser in
normal mode will invoke the command prefix for it immediately before
and after it processes the tags in the HTML, thus simulating that the
HTML string is enclosed in a <vroot> </vroot> combination. In
incremental mode however the parser is unable to provide the closing
virtual root as it never knows when the input is complete. In this
case the first script generated by each invocation of the parser will
contain an invocation of the command prefix for the virtual root as
its first command.
The following options are available:
.RS
.TP
\fB-cmd\fR \fIcmd\fR
The command prefix to invoke for every tag in the HTML
string. Defaults to \fI::htmlparse::debugCallback\fR.
.TP
\fB-vroot\fR \fItag\fR
The virtual root tag to add around the HTML in normal mode. In
incremental mode it is the first tag in each chunk processed by the
parser, but there will be no closing tags. Defaults to
\fIhmstart\fR.
.TP
\fB-split\fR \fIn\fR
The size of the groups produced by an incremental mode parser. Ignored
when in normal mode. Defaults to 10. Values <= 0 are not allowed.
.TP
\fB-incvar\fR \fIvar\fR
The name of the variable where to store any incomplete HTML into. This
makes most sense for the incremental mode. The parser will throw an
error if it sees incomplete HTML and has no place to store it to. This
makes sense for the normal mode. Only incomplete tags are detected,
not missing tags.  Optional, defaults to 'no variable'.
.RE
.RS
.sp
.TP
\fIInterface to the command prefix\fR
In normal mode the parser will invoke the command prefix with four
arguments appended. See \fB::htmlparse::debugCallback\fR for a
description.
.sp
In incremental mode, however, the generated scripts will invoke the
command prefix with five arguments appended. The last four of these
are the same which were mentioned above. The first is a placeholder
string (\fB@win@\fR) for a clientdata value to be supplied later
during the actual execution of the generated scripts. This could be a
tk window path, for example. This allows the user of this package to
preprocess HTML strings without committing them to a specific window,
object, whatever during parsing. This connection can be made
later. This also means that it is possible to cache preprocessed
HTML. Of course, nothing prevents the user of the parser from
replacing the placeholder with an empty string.
.RE
.TP
\fB::htmlparse::debugCallback\fR ?\fIclientdata\fR? \fItag slash param textBehindTheTag\fR
This command is the standard callback used by the parser in
\fB::htmlparse::parse\fR if none was specified by the user. It simply
dumps its arguments to stdout.  This callback can be used for both
normal and incremental mode of the calling parser. In other words, it
accepts four or five arguments. The last four arguments are described
below. The optional fifth argument contains the clientdata value
passed to the callback by a parser in incremental mode. All callbacks
have to follow the signature of this command in the last four
arguments, and callbacks used in incremental parsing have to follow
this signature in the last five arguments.
.sp
The first argument, \fIclientdata\fR, is optional and present only if
this command is invoked by a parser in incremental mode. It contains
whatever the user of this package wishes.
.sp
The second argument, \fItag\fR, contains the name of the tag which is
currently processed by the parser.
.sp
The third argument, \fIslash\fR, is either empty or contains a slash
character. It allows the callback to distinguish between opening
(slash is empty) and closing tags (slash contains a slash character).
.sp
The fourth argument, \fIparam\fR, contains the un-interpreted list of
parameters to the tag.
.sp
The fifth and last argument, \fItextBehindTheTag\fR, contains the text
found by the parser behind the tag named in \fItag\fR.
.TP
\fB::htmlparse::mapEscapes\fR \fIhtml\fR
This command takes a HTML string, substitutes all escape sequences
with their actual characters and then returns the resulting string.
HTML strings which do not contain escape sequences are returned
unchanged.
.TP
\fB::htmlparse::2tree\fR \fIhtml tree\fR
This command is a wrapper around \fB::htmlparse::parse\fR which takes
an HTML string (in \fIhtml\fR) and converts it into a tree containing
the logical structure of the parsed document. The name of the tree is
given to the command as its second argument (\fItree\fR). The command
does \fBnot\fR generate the tree by itself but expects that the caller
provided it with an existing and empty tree. It also expects that the
specified tree object follows the same interface as the tree object in
tcllib -> struct. It doesn't have to be from tcllib -> struct, but it
must provide the same interface.
.sp
The internal callback does some basic checking of HTML validity and
tries to recover from the most basic errors. The command returns the
contents of its second argument. Side effects are the creation and
manipulation of a tree object.
.sp
Each node in the generated tree represent one tag in the input. The
name of the tag is stored in the attribute \fItype\fR of the
node. Any html attributes coming with the tag are stored unmodified in
the attribute \fIdata\fR of the tag. In other words, the command does
\fInot\fR parse html attributes into their names and values.
.sp
If a tag contains text its node will have children of type
\fIPCDATA\fR containing this text. The text will be stored in the
attribute \fIdata\fR of these children.
.TP
\fB::htmlparse::removeVisualFluff\fR \fItree\fR
This command walks a tree as generated by \fB::htmlparse::2tree\fR and
removes all the nodes which represent visual tags and not structural
ones. The purpose of the command is to make the tree easier to
navigate without getting bogged down in visual information not
relevant to the search. Its only argument is the name of the tree to
cut down.
.TP
\fB::htmlparse::removeFormDefs\fR \fItree\fR
Like \fB::htmlparse::removeVisualFluff\fR this command is here to cut
down on the size of the tree as generated by
\fB::htmlparse::2tree\fR. It removes all nodes representing forms and
form elements. Its only argument is the name of the tree to cut down.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIhtmlparse\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
struct::tree
.SH KEYWORDS
html, parsing, queue, tree
.SH CATEGORY
Text processing

Added embedded/man/files/modules/http/autoproxy.n.


















































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/http/autoproxy.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "autoproxy" n 1.5.3 tcllib "HTTP protocol helper modules"
.BS
.SH NAME
autoproxy \- Automatic HTTP proxy usage and authentication
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBhttp  ?2.0?\fR
.sp
package require \fBautoproxy  ?1.5.3?\fR
.sp
\fB::autoproxy::init\fR
.sp
\fB::autoproxy::cget\fR \fI-option\fR
.sp
\fB::autoproxy::configure\fR ?-option \fIvalue\fR?
.sp
\fB::autoproxy::tls_connect\fR \fIargs\fR
.sp
\fB::autoproxy::tunnel_connect\fR \fIargs\fR
.sp
\fB::autoproxy::tls_socket\fR \fIargs\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package attempts to automate the use of HTTP proxy servers in Tcl
HTTP client code. It tries to initialize the web access settings from
system standard locations and can be configured to negotiate
authentication with the proxy if required.
.PP
On Unix the standard for identifying the local HTTP proxy server
seems to be to use the environment variable http_proxy or ftp_proxy and
no_proxy to list those domains to be excluded from proxying.
On Windows we can retrieve the Internet Settings values from the registry
to obtain pretty much the same information.
With this information we can setup a suitable filter procedure for the
Tcl http package and arrange for automatic use of the proxy.
.PP
There seem to be a number of ways that the http_proxy environment
variable may be set up. Either a plain host:port or more commonly a
URL and sometimes the URL may contain authentication parameters or
these may be requested from the user or provided via http_proxy_user
and http_proxy_pass. This package attempts to deal with all these
schemes. It will do it's best to get the required parameters from the
environment or registry and if it fails can be reconfigured.
.SH COMMANDS
.TP
\fB::autoproxy::init\fR
Initialize the autoproxy package from system resources. Under unix
this means we look for environment variables. Under windows we look
for the same environment variables but also look at the registry
settings used by Internet Explorer.
.TP
\fB::autoproxy::cget\fR \fI-option\fR
Retrieve individual package configuration options. See \fBOPTIONS\fR.
.TP
\fB::autoproxy::configure\fR ?-option \fIvalue\fR?
Configure the autoproxy package. Calling \fBconfigure\fR with no
options will return a list of all option names and values.
See \fBOPTIONS\fR.
.TP
\fB::autoproxy::tls_connect\fR \fIargs\fR
Connect to a secure socket through a proxy. HTTP proxy servers permit
the use of the CONNECT HTTP command to open a link through the proxy
to the target machine. This function hides the details. For use with
the http package see \fBtls_socket\fR.
.sp
The \fIargs\fR list may contain any of the \fBtls\fR package options but
must end with the host and port as the last two items.
.TP
\fB::autoproxy::tunnel_connect\fR \fIargs\fR
Connect to a target host throught a proxy. This uses the same CONNECT
HTTP command as the \fBtls_connect\fR but does not promote the link
security once the connection is established.
.sp
The \fIargs\fR list may contain any of the \fBtls\fR package options but
must end with the host and port as the last two items.
.sp
Note that many proxy servers will permit CONNECT calls to a limited
set of ports - typically only port 443 (the secure HTTP port).
.TP
\fB::autoproxy::tls_socket\fR \fIargs\fR
This function is to be used to register a proxy-aware secure socket
handler for the https protocol. It may only be used with the Tcl http
package and should be registered using the http::register command (see
the examples below). The job of actually creating the tunnelled
connection is done by the tls_connect command and this may be used
when not registering with the http package.
.PP
.SH OPTIONS
.TP
\fB-host\fR hostname
.TP
\fB-proxy_host\fR hostname
Set the proxy hostname. This is normally set up by \fBinit\fR but may
be configured here as well.
.TP
\fB-port\fR number
.TP
\fB-proxy_port\fR number
Set the proxy port number. This is normally set up by \fBinit\fR.
e.g. \fBconfigure\fR \fB-port\fR \fI3128\fR
.TP
\fB-no_proxy\fR list
You may manipulate the \fBno_proxy\fR list that was setup by
\fBinit\fR. The value of this option is a tcl list of
strings that are matched against the http request host using the tcl
\fBstring match\fR command. Therefore glob patterns are permitted.
For instance, \fBconfigure\fR \fB-no_proxy\fR \fI*.localdomain\fR
.TP
\fB-authProc\fR procedure
This option may be used to set an application defined procedure to be
called when \fBconfigure\fR \fB-basic\fR is called with either no or
insufficient authentication details. This can be used to present a
dialog to the user to request the additional information.
.TP
\fB-basic\fR
Following options are for configuring the Basic authentication
scheme parameters. See \fBBasic Authentication\fR.
.PP
.SH "BASIC AUTHENTICATION"
Basic is the simplest and most commonly use HTTP proxy authentication
scheme. It is described in (1 section 11) and also in (2). It offers
no privacy whatsoever and its use should be discouraged in favour of
more secure alternatives like Digest. To perform Basic authentication
the client base64 encodes the username and plaintext password
separated by a colon. This encoded text is prefixed with the word
"Basic" and a space.
.PP
The following options exists for this scheme:
.TP
\fB-username\fR name
The username required to authenticate with the configured proxy.
.TP
\fB-password\fR password
The password required for the username specified.
.TP
\fB-realm\fR realm
This option is not used.
.PP
.SH EXAMPLES
.PP
.CS


package require autoproxy
autoproxy::init
autoproxy::configure -basic -username ME -password SEKRET
set tok [http::geturl http://wiki.tcl.tk/]
http::data $tok

.CE
.CS


package require http
package require tls
package require autoproxy
autoproxy::init
http::register https 443 autoproxy::tls_socket
set tok [http::geturl https://www.example.com/]

.CE
.SH REFERENCES
.IP [1]
Berners-Lee, T., Fielding R. and Frystyk, H.
"Hypertext Transfer Protocol -- HTTP/1.0",
RFC 1945, May 1996,
(\fIhttp://www.rfc-editor.org/rfc/rfc1945.txt\fR)
.IP [2]
Franks, J. et al.
"HTTP Authentication: Basic and Digest Access Authentication",
RFC 2617, June 1999
(\fIhttp://www.rfc-editor.org/rfc/rfc2617.txt\fR)
.PP
.SH BUGS
At this time only Basic authentication (1) (2) is supported. It is
planned to add support for Digest (2) and NTLM in the future.
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIhttp :: autoproxy\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
http(n)
.SH KEYWORDS
authentication, http, proxy
.SH CATEGORY
Networking

Added embedded/man/files/modules/ident/ident.n.











































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ident/ident.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Reinhard Max <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ident" n 0.42 tcllib "Identification protocol client"
.BS
.SH NAME
ident \- Ident protocol client
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBident  ?0.42?\fR
.sp
\fB::ident::query\fR \fIsocket\fR ?\fIcallback\fR?
.sp
.BE
.SH DESCRIPTION
The \fBident\fR package provides a client implementation of the ident
protocol as defined in
RFC 1413 (\fIhttp://www.rfc-editor.org/rfc/rfc1413.txt\fR).
.TP
\fB::ident::query\fR \fIsocket\fR ?\fIcallback\fR?
This command queries the ident daemon on the remote side of the given
socket, and returns the result of the query as a dictionary.
Interpreting the dictionary as list the first key will always be
\fBresp-type\fR, and can have one of the values \fBUSERID\fR,
\fBERROR\fR, and \fBFATAL\fR.  These \fIresponse types\fR have
the following meanings:
.RS
.TP
USERID
This indicates a successful response. Two more keys and associated
values are returned, \fBopsys\fR, and \fBuser-id\fR.
.TP
ERROR
This means the ident server has returned an error.  A second key named
\fBerror\fR is present whose value contains the \fBerror-type\fR
field from the server response.
.TP
FATAL
Fatal errors happen when no ident server is listening on the remote
side, or when the ident server gives a response that does not conform
to the RFC. A detailed error message is returned under the
\fBerror\fR key.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIident\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
ident, identification, rfc 1413
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2004 Reinhard Max <[email protected]>

.fi

Added embedded/man/files/modules/imap4/imap4.n.


























































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/imap4/imap4.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "imap4" n 0.4 tcllib "imap client"
.BS
.SH NAME
imap4 \- imap client-side tcl implementation of imap protocol
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBimap4  ?0.4?\fR
.sp
\fB::imap4::open\fR \fIhostname\fR ?\fIport\fR?
.sp
\fB::imap4::login\fR \fIchan\fR \fIuser\fR \fIpass\fR
.sp
\fB::imap4::folders\fR \fIchan\fR ?\fI-inline\fR? ?\fImboxref\fR? ?\fImboxname\fR?
.sp
\fB::imap4::select\fR \fIchan\fR ?\fImailbox\fR?
.sp
\fB::imap4::examine\fR \fIchan\fR ?\fImailbox\fR?
.sp
\fB::imap4::fetch\fR \fIchan\fR \fIrange\fR ?\fI-inline\fR? ?\fIattr ...\fR?
.sp
\fB::imap4::noop\fR \fIchan\fR
.sp
\fB::imap4::check\fR \fIchan\fR
.sp
\fB::imap4::folderinfo\fR \fIchan\fR ?\fIinfo\fR?
.sp
\fB::imap4::msginfo\fR \fIchan\fR \fImsgid\fR ?\fIinfo\fR? ?\fIdefval\fR?
.sp
\fB::imap4::mboxinfo\fR \fIchan\fR ?\fIinfo\fR?
.sp
\fB::imap4::isableto\fR \fIchan\fR ?\fIcapability\fR?
.sp
\fB::imap4::create\fR \fIchan\fR \fImailbox\fR
.sp
\fB::imap4::delete\fR \fIchan\fR \fImailbox\fR
.sp
\fB::imap4::rename\fR \fIchan\fR \fIoldname\fR \fInewname\fR
.sp
\fB::imap4::subscribe\fR \fIchan\fR \fImailbox\fR
.sp
\fB::imap4::unsubscribe\fR \fIchan\fR \fImailbox\fR
.sp
\fB::imap4::search\fR \fIchan\fR \fIexpr\fR ?\fI...\fR?
.sp
\fB::imap4::close\fR \fIchan\fR
.sp
\fB::imap4::cleanup\fR \fIchan\fR
.sp
\fB::imap4::debugmode\fR \fIchan\fR ?\fIerrormsg\fR?
.sp
\fB::imap4::store\fR \fIchan\fR \fIrange\fR \fIdata\fR \fIflaglist\fR
.sp
\fB::imap4::expunge\fR \fIchan\fR
.sp
\fB::imap4::logout\fR \fIchan\fR
.sp
.BE
.SH DESCRIPTION
The \fBimap4\fR library package provides the client side of the
\fIInternet Message Access Protocol\fR (IMAP) using standard
sockets or secure connection via TLS/SSL.
The package is fully implemented in Tcl.
.PP
This document describes the procedures and explains their usage.
.SH PROCEDURES
This package defines the following public procedures:
.TP
\fB::imap4::open\fR \fIhostname\fR ?\fIport\fR?
.sp
Open a new IMAP connection and initalize the handler,
the imap communication channel (handler) is returned.
.sp
\fIhostname\fR - mail server
.sp
\fIport\fR - connection port, defaults to 143
.sp
The namespace variable \fB::imap4::use_ssl\fR
can be used to establish to a secure connection
via TSL/SSL if set to true. In this case default connection port
defaults to 993.
.sp
\fINote:\fR
For connecting via SSL the Tcl module \fItls\fR must be already
loaded otherwise an error is raised.
.CS


    package require tls              ; # must be loaded for TLS/SSL
    set ::imap4::use_ssl 1           ; # request a secure connection
    set chan [::imap4::open $server] ; # default port is now 993
.CE
.TP
\fB::imap4::login\fR \fIchan\fR \fIuser\fR \fIpass\fR
.sp
Login using the IMAP LOGIN command, 0 is returned on successful login.
.sp
\fIchan\fR - imap channel
.sp
\fIuser\fR - username
.sp
\fIpass\fR - password
.TP
\fB::imap4::folders\fR \fIchan\fR ?\fI-inline\fR? ?\fImboxref\fR? ?\fImboxname\fR?
.sp
Get list of matching folders, 0 is returned on success.
.sp
Wildcards '*' as '%' are allowed for \fImboxref\fR and \fImboxname\fR,
command \fB::imap4::folderinfo\fR can be used to retrieve folder information.
.sp
\fIchan\fR - imap channel
.sp
\fImboxref\fR - mailbox reference, defaults to ""
.sp
\fImboxname\fR - mailbox name, defaults to "*"
.sp
If \fB-inline\fR is specified a compact folderlist is
returned instead of the result code. All flags are converted to
lowercase and leading special characters are removed.
.CS

{{Arc08 noselect} {Arc08/Private {noinferiors unmarked}} {INBOX noinferiors}}
.CE
.TP
\fB::imap4::select\fR \fIchan\fR ?\fImailbox\fR?
.sp
Select a mailbox, 0 is returned on success.
.sp
\fIchan\fR - imap channel
.sp
\fImailbox\fR - Path of the mailbox,  defaults to \fIINBOX\fR
.sp
Prior to examine/select an open mailbox must be closed - see: \fB::imap4::close\fR.
.TP
\fB::imap4::examine\fR \fIchan\fR ?\fImailbox\fR?
.sp
"Examines" a mailbox, read-only equivalent of \fB::imap4::select\fR.
.sp
\fIchan\fR - imap channel
.sp
\fImailbox\fR - mailbox name or path to mailbox,
defaults to \fIINBOX\fR
.sp
Prior to examine/select an open mailbox must be closed - see: \fB::imap4::close\fR.
.TP
\fB::imap4::fetch\fR \fIchan\fR \fIrange\fR ?\fI-inline\fR? ?\fIattr ...\fR?
.sp
Fetch attributes from messages.
.sp
The attributes are fetched and stored in the internal state
which can be retrieved with command \fB::imap4::msginfo\fR, 0 is returned
on success.
If \fB-inline\fR is specified, alle records are returned as list
in order as defined in the \fIattr\fR argument.
.sp
\fIchan\fR - imap channel
.sp
\fIrange\fR - message index in format \fIFROM\fR:\fITO\fR
.sp
\fIattr\fR - imap attributes to fetch
.sp
\fINote:\fR
If \fIFROM\fR is omitted, the 1st message is assumed,
if \fITO\fR is ommitted the last message is assumed.
All message index ranges are 1-based.
.TP
\fB::imap4::noop\fR \fIchan\fR
Send NOOP command to server. May get information as untagged data.
.sp
\fIchan\fR - imap channel
.TP
\fB::imap4::check\fR \fIchan\fR
Send CHECK command to server. Flush to disk.
.sp
\fIchan\fR - imap channel
.TP
\fB::imap4::folderinfo\fR \fIchan\fR ?\fIinfo\fR?
.sp
Get information on the recently selected folderlist.
If the \fIinfo\fR argument is omitted or a null string, the full list
of information available for the mailbox is returned.
.sp
If the required information name is suffixed with a ? character,
the command returns true if the information is available, or
false if it is not.
.sp
\fIchan\fR - imap channel
.sp
\fIinfo\fR - folderlist options to retrieve
.sp
Currently supported options:
\fIdelim\fR - hierarchy delimiter only,
\fImatch\fR - ref and mbox search patterns (see \fB::imap4::folders\fR),
\fInames\fR - list of folder names only,
\fIflags\fR - list of folder names with flags in format
\fI{ {name {flags}} ... }\fR (see also compact format in function
\fB::imap4::folders\fR).
.CS


{{Arc08 {{\\NoSelect}}} {Arc08/Private {{\\NoInferiors} {\\UnMarked}}} {INBOX {\\NoInferiors}}}

.CE
.TP
\fB::imap4::msginfo\fR \fIchan\fR \fImsgid\fR ?\fIinfo\fR? ?\fIdefval\fR?
.sp
Get information (from previously collected using fetch) from a given
\fImsgid\fR. If the 'info' argument is omitted or a null string,
the list of available information options for the given message is
returned.
.sp
If the required information name is suffixed with a ? character,
the command returns true if the information is available, or
false if it is not.
.sp
\fIchan\fR - imap channel
.sp
\fImsgid\fR - message number
.sp
\fIinfo\fR - imap keyword to retrieve
.sp
\fIdefval\fR - default value, returned if info is empty
.sp
\fINote:\fR
All message index ranges are 1-based.
.TP
\fB::imap4::mboxinfo\fR \fIchan\fR ?\fIinfo\fR?
.sp
Get information on the currently selected mailbox.
If the \fIinfo\fR argument is omitted or a null string, the list
of available information options for the mailbox is returned.
.sp
If the required information name is suffixed with a ? character,
the command returns true if the information is available, or
false if it is not.
.sp
\fIchan\fR - imap channel
.sp
\fIopt\fR - mailbox option to retrieve
.sp
Currently supported options:
\fIEXISTS\fR (noof msgs),
\fIRECENT\fR (noof 'recent' flagged msgs),
\fIFLAGS\fR
.sp
In conjunction with OK:
\fIPERMFLAGS\fR, \fIUIDNEXT\fR, \fIUIDVAL\fR, \fIUNSEEN\fR
.sp
Div. states:
\fICURRENT\fR, \fIFOUND\fR, \fIPERM\fR.
.CS


    ::imap4::select $chan INBOX
    puts "[::imap4::mboxinfo $chan exists] mails in INBOX"
.CE
.TP
\fB::imap4::isableto\fR \fIchan\fR ?\fIcapability\fR?
.sp
Test for capability.
It returns 1 if requested capability is supported, 0 otherwise.
If \fIcapability\fR is omitted all capability imap
codes are retured as list.
.sp
\fIchan\fR - imap channel
.sp
\fIinfo\fR - imap keyword to retrieve
.sp
\fINote:\fR
Use the capability command to ask the server if not
already done by the user.
.TP
\fB::imap4::create\fR \fIchan\fR \fImailbox\fR
.sp
Create a new mailbox.
.sp
\fIchan\fR - imap channel
.sp
\fImailbox\fR - mailbox name
.TP
\fB::imap4::delete\fR \fIchan\fR \fImailbox\fR
.sp
Delete a new mailbox.
.sp
\fIchan\fR - imap channel
.sp
\fImailbox\fR - mailbox name
.TP
\fB::imap4::rename\fR \fIchan\fR \fIoldname\fR \fInewname\fR
.sp
Rename a new mailbox.
.sp
\fIchan\fR - imap channel
.sp
\fImailbox\fR - old mailbox name
.sp
\fImailbox\fR - new mailbox name
.TP
\fB::imap4::subscribe\fR \fIchan\fR \fImailbox\fR
.sp
Subscribe a new mailbox.
.sp
\fIchan\fR - imap channel
.sp
\fImailbox\fR - mailbox name
.TP
\fB::imap4::unsubscribe\fR \fIchan\fR \fImailbox\fR
.sp
Unsubscribe a new mailbox.
.sp
\fIchan\fR - imap channel
.sp
\fImailbox\fR - mailbox name
.TP
\fB::imap4::search\fR \fIchan\fR \fIexpr\fR ?\fI...\fR?
.sp
Search for mails matching search criterions, 0 is returned on success.
.sp
\fIchan\fR - imap channel
.sp
\fIexpr\fR - imap search expression
.sp
\fINotes:\fR
Currently the following search expressions are handled:
.sp
\fIMail header flags:\fR
all mail header entries (ending with a colon ":"), like "From:", "Bcc:", ...
.sp
\fIImap message search flags:\fR
ANSWERED, DELETED, DRAFT, FLAGGED, RECENT,
SEEN, NEW, OLD, UNANSWERED, UNDELETED,
UNDRAFT, UNFLAGGED, UNSEEN, ALL
.sp
\fIImap header search flags:\fR
BODY, CC, FROM, SUBJECT, TEXT, KEYWORD, BCC
.sp
\fIImap conditional search flags:\fR
SMALLER, LARGER, ON, SENTBEFORE, SENTON, SENTSINCE, SINCE,
BEFORE (not implemented),
UID (not implemented)
.sp
\fILogical search conditions:\fR
OR, NOT
.CS

::imap4::search $chan larger 4000 seen
puts "Found messages: [::imap4::mboxinfo $chan found]"
Found messages: 1 3 6 7 8 9 13 14 15 19 20
.CE
.TP
\fB::imap4::close\fR \fIchan\fR
.sp
Close the mailbox. Permanently removes \\Deleted messages and
return to the AUTH state.
.sp
\fIchan\fR - imap channel
.TP
\fB::imap4::cleanup\fR \fIchan\fR
.sp
Destroy an IMAP connection and free the used space.
Close the mailbox. Permanently removes \\Deleted messages
and return to the AUTH state.
.sp
\fIchan\fR - imap channel
.TP
\fB::imap4::debugmode\fR \fIchan\fR ?\fIerrormsg\fR?
Switch client into command line debug mode.
.sp
This is a developers mode only that pass the control to the
programmer. Every line entered is sent verbatim to the
server (after the addition of the request identifier).
The ::imap4::debug variable is automatically set to '1' on enter.
.sp
It's possible to execute Tcl commands starting the line
with a slash.
.sp
\fIchan\fR - imap channel
.sp
\fIerrormsg\fR - optional error message to display
.TP
\fB::imap4::store\fR \fIchan\fR \fIrange\fR \fIdata\fR \fIflaglist\fR
.sp
Alters data associated with a message in the selected
mailbox.
.sp
\fIchan\fR - imap channel
.sp
\fIrange\fR - message index in format \fIFROM\fR:\fITO\fR
.sp
\fIflaglist\fR - Flags the \fIdata\fR operates on.
.sp
\fIdata\fR - The currently defined \fIdata\fR items that can be
stored are shown below. \fINote\fR that all of these data types may
also be suffixed with ".SILENT" to suppress the untagged FETCH
response.
.RS
.TP
FLAGS
Replace the flags for the message (other than \\Recent) with the
\fIflaglist\fR.
.TP
+FLAGS
Add the flags in \fIflaglist\fR to the existing flags for the message.
.TP
-FLAGS
Remove the flags in \fIflaglist\fR to the existing flags for the
message.
.RE
.IP
For example:
.CS


	::imap4::store $chan $start_msgid:$end_msgid +FLAGS "Deleted"

.CE
.TP
\fB::imap4::expunge\fR \fIchan\fR
.sp
Permanently removes all messages that have the \\Deleted flag
set from the currently selected mailbox, without the need to close the
connection.
.sp
\fIchan\fR - imap channel
.TP
\fB::imap4::logout\fR \fIchan\fR
.sp
Informs the server that the client is done with the connection
and closes the network connection. Permanently removes \\Deleted
messages.
.sp
A new connection will need to be established to login once
more.
.sp
\fIchan\fR - imap channel
.PP
.SH EXAMPLES
.CS


    set user myusername
    set pass xtremescrt
    set server imap.test.tld
    set FOLDER INBOX
    # Connect to server
    set imap [::imap4::open $server]
    ::imap4::login $imap $user $pass
    ::imap4::select $imap $FOLDER
    # Output all the information about that mailbox
    foreach info [::imap4::mboxinfo $imap] {
        puts "$info -> [::imap4::mboxinfo $imap $info]"
    }
    # fetch 3 records inline
    set fields {from: to: subject: size}
    foreach rec [::imap4::fetch $imap :3 -inline {*}$fields] {
        puts -nonewline "#[incr idx])"
        for {set j 0} {$j<[llength $fields]} {incr j} {
            puts "\\t[lindex $fields $j] [lindex $rec $j]"
        }
    }

    # Show all the information available about the message ID 1
    puts "Available info about message 1: [::imap4::msginfo $imap 1]"

    # Use the capability stuff
    puts "Capabilities: [::imap4::isableto $imap]"
    puts "Is able to imap4rev1? [::imap4::isableto $imap imap4rev1]"

    # Cleanup
    ::imap4::cleanup $imap

.CE
.SH REFERENCES
Mark R. Crispin, "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1",
RFC 3501, March 2003, \fIhttp://www.rfc-editor.org/rfc/rfc3501.txt\fR
.PP
OpenSSL, \fIhttp://www.openssl.org/\fR
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Only a small part of rfc3501 implemented.
.PP
Please report such in the category \fIimap4\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
ftp, http, imap, mime, pop3, tls
.SH KEYWORDS
email, imap, internet, mail, net, rfc3501, ssl, tls

Added embedded/man/files/modules/inifile/ini.n.

































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/inifile/ini.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "inifile" n 0.2.5 tcllib "Parsing of Windows INI files"
.BS
.SH NAME
inifile \- Parsing of Windows INI files
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBinifile  ?0.2.4?\fR
.sp
\fB::ini::open\fR \fIfile\fR ?\fIaccess\fR?
.sp
\fB::ini::close\fR \fIini\fR
.sp
\fB::ini::commit\fR \fIini\fR
.sp
\fB::ini::revert\fR \fIini\fR
.sp
\fB::ini::filename\fR \fIini\fR
.sp
\fB::ini::sections\fR \fIini\fR
.sp
\fB::ini::keys\fR \fIini\fR \fIsection\fR
.sp
\fB::ini::get\fR \fIini\fR \fIsection\fR
.sp
\fB::ini::exists\fR \fIini\fR \fIsection\fR ?\fIkey\fR?
.sp
\fB::ini::value\fR \fIini\fR \fIsection\fR \fIkey\fR ?\fIdefault\fR?
.sp
\fB::ini::set\fR \fIini\fR \fIsection\fR \fIkey\fR \fIvalue\fR
.sp
\fB::ini::delete\fR \fIini\fR \fIsection\fR ?\fIkey\fR?
.sp
\fB::ini::comment\fR \fIini\fR \fIsection\fR ?\fIkey\fR? ?\fItext\fR?
.sp
\fB::ini::commentchar\fR ?char?
.sp
.BE
.SH DESCRIPTION
This package provides an interface for easy manipulation of Windows INI files.
.PP
.TP
\fB::ini::open\fR \fIfile\fR ?\fIaccess\fR?
Opens an INI file and returns a handle that is used by other commands.
\fIaccess\fR is the same as the first form (non POSIX) of the \fBopen\fR
command, with the exception that mode \fBa\fR is not supported. The
default mode is \fBr+\fR.
.TP
\fB::ini::close\fR \fIini\fR
Close the specified handle. If any changes were made and not written by
\fBcommit\fR they are lost.
.TP
\fB::ini::commit\fR \fIini\fR
Writes the file and all changes to disk. The sections are written in
arbitrary order. The keys in a section are written in alphabetical
order. If the ini was opened in read only mode an error will be thrown.
.TP
\fB::ini::revert\fR \fIini\fR
Rolls all changes made to the inifile object back to the last
committed state.
.TP
\fB::ini::filename\fR \fIini\fR
Returns the name of the file the \fIini\fR object is associated with.
.TP
\fB::ini::sections\fR \fIini\fR
Returns a list of all the names of the existing sections in the file handle
specified.
.TP
\fB::ini::keys\fR \fIini\fR \fIsection\fR
Returns a list of all they key names in the section and file specified.
.TP
\fB::ini::get\fR \fIini\fR \fIsection\fR
Returns a list of key value pairs that exist in the section and file specified.
.TP
\fB::ini::exists\fR \fIini\fR \fIsection\fR ?\fIkey\fR?
Returns a boolean value indicating the existance of the specified section as a
whole or the specified key within that section.
.TP
\fB::ini::value\fR \fIini\fR \fIsection\fR \fIkey\fR ?\fIdefault\fR?
Returns the value of the named key and section. If specified,
the default value will be returned if the key does not exist. If the key does
not exist and no default is specified an error will be thrown.
.TP
\fB::ini::set\fR \fIini\fR \fIsection\fR \fIkey\fR \fIvalue\fR
Sets the value of the key in the specified section. If the section does not
exist then a new one is created.
.TP
\fB::ini::delete\fR \fIini\fR \fIsection\fR ?\fIkey\fR?
Removes the key or the entire section and all its keys. A section is not
automatically deleted when it has no remaining keys.
.TP
\fB::ini::comment\fR \fIini\fR \fIsection\fR ?\fIkey\fR? ?\fItext\fR?
Reads and modifies comments for sections and keys. To write a section comment use an
empty string for the \fIkey\fR. To remove all comments use an empty string for \fItext\fR.
\fItext\fR may consist of a list of lines or one single line. Any embedded newlines in
\fItext\fR are properly handled.  Comments may be written to nonexistant
sections or keys and will not return an error. Reading a comment from a nonexistant
section or key will return an empty string.
.TP
\fB::ini::commentchar\fR ?char?
Reads and sets the comment character. Lines that begin with this character are treated as
comments. When comments are written out each line is preceded by this character. The default
is \fB;\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIinifile\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH CATEGORY
Text processing

Added embedded/man/files/modules/interp/deleg_method.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/interp/deleg_method.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "deleg_method" n 0.2 tcllib "Interpreter utilities"
.BS
.SH NAME
deleg_method \- Creation of comm delegates (snit methods)
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBsnit  ?1.1?\fR
.sp
package require \fBinterp::delegate::method  ?0.2?\fR
.sp
\fB::interp::delegate::method\fR ?\fB-async\fR? \fIname\fR \fIarguments\fR \fIcomm\fR \fIid\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a single command for use within \fBsnit\fR
type definition (i.e. actually a \fBsnit::macro\fR) for the convenient
creation of methods which delegate the actual work to a remote
location via a "channel" created by the package \fBcomm\fR.
.SH API
.TP
\fB::interp::delegate::method\fR ?\fB-async\fR? \fIname\fR \fIarguments\fR \fIcomm\fR \fIid\fR
This commands creates a method which is named by \fIname\fR. All
invokations of this method will delegate the actual work to the remote
location identified by the comm channel \fIcomm\fR and the endpoint
\fIid\fR.
.sp
The name of the remote method invoked by the delegator is identical to
the name of the method itself.
.sp
Normally the generated method marshalls the \fIarguments\fR, and
returns the result from the remote method as its own result. If
however the option \fB-async\fR was specified then the generated
method will not wait for a result and return immediately.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIinterp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
comm, delegation, interpreter, method, snit
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/interp/deleg_proc.n.



































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/interp/deleg_proc.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "deleg_proc" n 0.2 tcllib "Interpreter utilities"
.BS
.SH NAME
deleg_proc \- Creation of comm delegates (procedures)
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBinterp::delegate::proc  ?0.2?\fR
.sp
\fB::interp::delegate::proc\fR ?\fB-async\fR? \fIname\fR \fIarguments\fR \fIcomm\fR \fIid\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a single command for the convenient creation of
procedures which delegate the actual work to a remote location via a
"channel" created by the package \fBcomm\fR.
.SH API
.TP
\fB::interp::delegate::proc\fR ?\fB-async\fR? \fIname\fR \fIarguments\fR \fIcomm\fR \fIid\fR
This commands creates a procedure which is named by \fIname\fR and
returns its fully-qualified name. All invokations of this procedure
will delegate the actual work to the remote location identified by the
comm channel \fIcomm\fR and the endpoint \fIid\fR.
.sp
The name of the remote procedure invoked by the delegator is
[namespace tail \fIname\fR]. I.e., namespace information is
stripped from the call.
.sp
Normally the generated procedure marshalls the \fIarguments\fR, and
returns the result from the remote procedure as its own result. If
however the option \fB-async\fR was specified then the generated
procedure will not wait for a result and return immediately.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIinterp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
comm, delegation, interpreter, procedure
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/interp/tcllib_interp.n.
























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/interp/tcllib_interp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "interp" n 0.1.2 tcllib "Interpreter utilities"
.BS
.SH NAME
interp \- Interp creation and aliasing
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBinterp  ?0.1.2?\fR
.sp
\fB::interp::createEmpty\fR ?\fIpath\fR?
.sp
\fB::interp::snitLink\fR \fIpath\fR \fImethodlist\fR
.sp
\fB::interp::snitDictLink\fR \fIpath\fR \fImethoddict\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a number of commands for the convenient creation
of Tcl interpreters for highly restricted execution.
.SH API
.TP
\fB::interp::createEmpty\fR ?\fIpath\fR?
This commands creates an empty Tcl interpreter and returns it
name. Empty means that the new interpreter has neither namespaces, nor
any commands. It is useful only for the creation of aliases.
.sp
If a \fIpath\fR is specified then it is taken as the name of the new
interpreter.
.TP
\fB::interp::snitLink\fR \fIpath\fR \fImethodlist\fR
This command assumes that it was called from within a method of a snit
object, and that the command \fBmymethod\fR is available.
.sp
It extends the interpreter specified by \fIpath\fR with aliases for
all methods found in the \fImethodlist\fR, with the alias directing
execution to the same-named method of the snit object invoking this
command.
Each element of \fImethodlist\fR is actually interpreted as a command
prefix, with the first word of each prefix the name of the method to
link to.
.sp
The result of the command is the empty string.
.TP
\fB::interp::snitDictLink\fR \fIpath\fR \fImethoddict\fR
This command behaves like \fB::interp::snitLink\fR, except that it
takes a dictionary mapping from commands to methods as its input, and
not a list of methods.
Like for \fB::interp::snitLink\fR the method references are actually
command prefixes.
This command allows the creation of more complex command-method
mappings than \fB::interp::snitLink\fR.
.sp
The result of the command is the empty string.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIinterp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
alias, empty interpreter, interpreter, method, snit
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/irc/irc.n.
























































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/irc/irc.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "irc" n 0.6.1 tcllib "Low Level Tcl IRC Interface"
.BS
.SH NAME
irc \- Create IRC connection and interface.
.SH SYNOPSIS
package require \fBTcl \fR
.sp
package require \fBirc  ?0.6.1?\fR
.sp
\fB::irc::config\fR ?key? ?value?
.sp
\fB::irc::connection\fR
.sp
\fB::irc::connections\fR
.sp
\fInet\fR \fBregisterevent\fR \fIevent\fR \fIscript\fR
.sp
\fInet\fR \fBgetevent\fR \fIevent\fR \fIscript\fR
.sp
\fInet\fR \fBeventexists\fR \fIevent\fR \fIscript\fR
.sp
\fInet\fR \fBconnect\fR \fIhostname\fR ?port?
.sp
\fInet\fR \fBconfig\fR ?key? ?value?
.sp
\fInet\fR \fBlog\fR \fIlevel\fR \fImessage\fR
.sp
\fInet\fR \fBlogname\fR
.sp
\fInet\fR \fBconnected\fR
.sp
\fInet\fR \fBsockname\fR
.sp
\fInet\fR \fBpeername\fR
.sp
\fInet\fR \fBsocket\fR
.sp
\fInet\fR \fBuser\fR \fIusername\fR \fIlocalhostname\fR \fIlocaldomainname\fR \fIuserinfo\fR
.sp
\fInet\fR \fBnick\fR \fInick\fR
.sp
\fInet\fR \fBping\fR \fItarget\fR
.sp
\fInet\fR \fBserverping\fR
.sp
\fInet\fR \fBjoin\fR \fIchannel\fR ?\fIkey\fR?
.sp
\fInet\fR \fBpart\fR \fIchannel\fR ?\fImessage\fR?
.sp
\fInet\fR \fBquit\fR ?\fImessage\fR?
.sp
\fInet\fR \fBprivmsg\fR \fItarget\fR \fImessage\fR
.sp
\fInet\fR \fBnotice\fR \fItarget\fR \fImessage\fR
.sp
\fInet\fR \fBctcp\fR \fItarget\fR \fImessage\fR
.sp
\fInet\fR \fBkick\fR \fIchannel\fR \fItarget\fR ?\fImessage\fR?
.sp
\fInet\fR \fBmode\fR \fItarget\fR \fIargs\fR
.sp
\fInet\fR \fBtopic\fR \fIchannel\fR \fImessage\fR
.sp
\fInet\fR \fBinvite\fR \fIchannel\fR \fItarget\fR
.sp
\fInet\fR \fBsend\fR \fItext\fR
.sp
\fInet\fR \fBdestroy\fR
.sp
\fBwho\fR ?\fBaddress\fR?
.sp
\fBaction\fR
.sp
\fBtarget\fR
.sp
\fBadditional\fR
.sp
\fBheader\fR
.sp
\fBmsg\fR
.sp
.BE
.SH DESCRIPTION
This package provides low-level commands to deal with the IRC protocol
(Internet Relay Chat) for immediate and interactive multi-cast
communication.
.PP
.TP
\fB::irc::config\fR ?key? ?value?
Sets configuration ?key? to ?value?. The configuration keys
currently defined are the boolean flags \fBlogger\fR and \fBdebug\fR.
\fBlogger\fR makes \fBirc\fR use the logger package for printing
error. \fBdebug\fR requires \fBlogger\fR and prints extra debug output.
If no ?key? or ?value? is given the current values are returned.
.TP
\fB::irc::connection\fR
The command creates a new object to deal with an IRC connection.
Creating this IRC object does not automatically create the network
connection.  It returns a new irc namespace command which can be used
to interact with the new IRC connection.  NOTE: the old form of the
connection command, which took a hostname and port as arguments, is
deprecated.  Use \fBconnect\fR instead to specify this information.
.TP
\fB::irc::connections\fR
Returns a list of all the current connections that were created with
\fBconnection\fR
.PP
.SH "PER-CONNECTION COMMANDS"
.PP
In the following list of available connection methods \fInet\fR
represents a connection command as returned by
\fB::irc::connection\fR.
.TP
\fInet\fR \fBregisterevent\fR \fIevent\fR \fIscript\fR
Registers a callback handler for the specific event.  Events available
are those described in RFC 1459
\fIhttp://www.rfc-editor.org/rfc/rfc1459.txt\fR.
In addition, there are several other events defined.
\fBdefaultcmd\fR adds a command that is called if no other callback
is present.  \fBEOF\fR is called if the connection signals an End of
File condition. The events \fBdefaultcmd\fR, \fBdefaultnumeric\fR,
\fBdefaultevent\fR, and \fBEOF\fR are required.
\fIscript\fR is executed in the connection namespace, which can take
advantage of several commands (see \fBCallback Commands\fR
below) to aid in the parsing of data.
.TP
\fInet\fR \fBgetevent\fR \fIevent\fR \fIscript\fR
Returns the current handler for the event if one exists. Otherwise an
empty string is returned.
.TP
\fInet\fR \fBeventexists\fR \fIevent\fR \fIscript\fR
Returns a boolean value indicating the existence of the event handler.
.TP
\fInet\fR \fBconnect\fR \fIhostname\fR ?port?
This causes the socket to be established.  \fB::irc::connection\fR
created the namespace and the commands to be used, but did not
actually open the socket. This is done here.  NOTE: the older form of
\'connect' did not require the user to specify a hostname and port,
which were specified with 'connection'.  That form is deprecated.
.TP
\fInet\fR \fBconfig\fR ?key? ?value?
The same as \fB::irc::config\fR but sets and gets options for the \fInet\fR
connection only.
.TP
\fInet\fR \fBlog\fR \fIlevel\fR \fImessage\fR
If logger is turned on by \fBconfig\fR this will write a log \fImessage\fR
at \fIlevel\fR.
.TP
\fInet\fR \fBlogname\fR
Returns the name of the logger instance if logger is turned on.
.TP
\fInet\fR \fBconnected\fR
Returns a boolean value indicating if this connection is connected to a server.
.TP
\fInet\fR \fBsockname\fR
Returns a 3 element list consisting of the ip address, the hostname, and the port
of the local end of the connection, if currently connected.
.TP
\fInet\fR \fBpeername\fR
Returns a 3 element list consisting of the ip address, the hostname, and the port
of the remote end of the connection, if currently connected.
.TP
\fInet\fR \fBsocket\fR
Return the Tcl channel for the socket used by the connection.
.TP
\fInet\fR \fBuser\fR \fIusername\fR \fIlocalhostname\fR \fIlocaldomainname\fR \fIuserinfo\fR
Sends USER command to server.  \fIusername\fR is the username you want
to appear.  \fIlocalhostname\fR is the host portion of your hostname, \fIlocaldomainname\fR
is your domain name, and \fIuserinfo\fR is a short description of who you are. The 2nd and 3rd
arguments are normally ignored by the IRC server.
.TP
\fInet\fR \fBnick\fR \fInick\fR
NICK command.  \fInick\fR is the nickname you wish to use for the
particular connection.
.TP
\fInet\fR \fBping\fR \fItarget\fR
Send a CTCP PING to \fItarget\fR.
.TP
\fInet\fR \fBserverping\fR
PING the server.
.TP
\fInet\fR \fBjoin\fR \fIchannel\fR ?\fIkey\fR?
\fIchannel\fR is the IRC channel to join.  IRC channels typically
begin with a hashmark ("#") or ampersand ("&").
.TP
\fInet\fR \fBpart\fR \fIchannel\fR ?\fImessage\fR?
Makes the client leave \fIchannel\fR. Some networks may support the optional
argument \fImessage\fR
.TP
\fInet\fR \fBquit\fR ?\fImessage\fR?
Instructs the IRC server to close the current connection. The package
will use a generic default if no \fImessage\fR was specified.
.TP
\fInet\fR \fBprivmsg\fR \fItarget\fR \fImessage\fR
Sends \fImessage\fR to \fItarget\fR, which can be either a channel, or
another user, in which case their nick is used.
.TP
\fInet\fR \fBnotice\fR \fItarget\fR \fImessage\fR
Sends a \fBnotice\fR with message \fImessage\fR to \fItarget\fR,
which can be either a channel, or another user, in which case their nick is used.
.TP
\fInet\fR \fBctcp\fR \fItarget\fR \fImessage\fR
Sends a CTCP of type \fImessage\fR to \fItarget\fR
.TP
\fInet\fR \fBkick\fR \fIchannel\fR \fItarget\fR ?\fImessage\fR?
Kicks the user \fItarget\fR from the channel \fIchannel\fR with a \fImessage\fR.
The latter can be left out.
.TP
\fInet\fR \fBmode\fR \fItarget\fR \fIargs\fR
Sets the mode \fIargs\fR on the target \fItarget\fR. \fItarget\fR may be a channel,
a channel user, or yourself.
.TP
\fInet\fR \fBtopic\fR \fIchannel\fR \fImessage\fR
Sets the topic on \fIchannel\fR to \fImessage\fR specifying an empty string
will remove the topic.
.TP
\fInet\fR \fBinvite\fR \fIchannel\fR \fItarget\fR
Invites \fItarget\fR to join the channel \fIchannel\fR
.TP
\fInet\fR \fBsend\fR \fItext\fR
Sends \fItext\fR to the IRC server.
.TP
\fInet\fR \fBdestroy\fR
Deletes the connection and its associated namespace and information.
.PP
.SH "CALLBACK COMMANDS"
.PP
These commands can be used within callbacks
.TP
\fBwho\fR ?\fBaddress\fR?
Returns the nick of the user who performed a command.  The optional
keyword \fBaddress\fR causes the command to return the user in the
format "username@address".
.TP
\fBaction\fR
Returns the action performed, such as KICK, PRIVMSG, MODE, etc...
Normally not useful, as callbacks are bound to a particular event.
.TP
\fBtarget\fR
Returns the target of a particular command, such as the channel or
user to whom a PRIVMSG is sent.
.TP
\fBadditional\fR
Returns a list of any additional arguments after the target.
.TP
\fBheader\fR
Returns the entire event header (everything up to the :) as a proper list.
.TP
\fBmsg\fR
Returns the message portion of the command (the part after the :).
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIirc\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
rfc 1459
.SH KEYWORDS
chat, irc
.SH CATEGORY
Networking

Added embedded/man/files/modules/irc/picoirc.n.


































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/irc/picoirc.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "picoirc" n 0.5 tcllib "Simple embeddable IRC interface"
.BS
.SH NAME
picoirc \- Small and simple embeddable IRC client.
.SH SYNOPSIS
package require \fBTcl \fR
.sp
package require \fBpicoirc  ?0.5?\fR
.sp
\fB::picoirc::connect\fR \fIcallback\fR \fInick\fR \fIurl\fR
.sp
\fB::picoirc::post\fR \fIcontext\fR \fIchannel\fR \fImessage\fR
.sp
\fB::picoirc::splituri\fR \fIuri\fR
.sp
\fB::picoirc::send\fR \fIcontext\fR \fIline\fR
.sp
.BE
.SH DESCRIPTION
This package provides a general purpose minimal IRC client suitable for
embedding in other applications. All communication with the parent
application is done via an application provided callback procedure.
Each connection has its own state so you can hook up multiple servers
in a single application instance.
.PP
To initiate an IRC connection you must call \fBpicoirc::connect\fR
with a callback procedure, a nick-name to use on IRC and the IRC URL
that describes the connection. This will return a variable name that
is the irc connection context. See \fBCALLBACK\fR for details.
.PP
This package is a fairly simple IRC client. If you need something with
more capability investigate the \fBirc\fR package.
.PP
.SH COMMANDS
.TP
\fB::picoirc::connect\fR \fIcallback\fR \fInick\fR \fIurl\fR
Create a new irc connection to the server specified by \fIurl\fR and
login using the \fInick\fR as the username. The \fIcallback\fR must be
as specified in \fBCALLBACK\fR. Returns a package-specific variable
that is used when calling other commands in this package.
.TP
\fB::picoirc::post\fR \fIcontext\fR \fIchannel\fR \fImessage\fR
This should be called to process user input and send it to the
server. A number of commands are recognised when prefixed with a
forward-slash (/). Such commands are converted to IRC command
sequences and then sent.
.TP
\fB::picoirc::splituri\fR \fIuri\fR
Splits an IRC scheme uniform resource indicator into its component
parts. Returns a list of server, port and channel. The default port is
6667 and there is no default channel.
.TP
\fB::picoirc::send\fR \fIcontext\fR \fIline\fR
This command is where all raw output to the server is handled. The
default action is to write the \fIline\fR to the irc socket. However,
before this happens the callback is called with "debug write". This
permits the application author to inspect the raw IRC data and if
desired to return a break error code to halt further processing. In
this way the application can override the default send via the
callback procedure.
.PP
.SH CALLBACK
The callback must look like:
.CS


proc Callback {context state args} {
}

.CE
where context is the irc context variable name (in case you need to pass
it back to a picoirc procedure). state is one of a number of states as
described below.
.TP
\fBinit\fR
called just before the socket is created
.TP
\fBconnect\fR
called once we have connected, before we join any channels
.TP
\fBclose\fR
called when the socket gets closed, before the context is deleted. If
an error occurs before we get connected the only argument will be the
socket error message.
.TP
\fBuserlist\fR \fIchannel\fR \fInicklist\fR
called to notify the application of an updated userlist. This is
generated when the output of the NAMES irc command is seen. The
package collects the entire output which can span a number of output
lines from the server and calls this callback when they have all been
received.
.TP
\fBchat\fR \fItarget\fR \fInick\fR \fImessage\fR \fItype\fR
called when a message arrives. \fItarget\fR is the identity that the
message was targetted for. This can be the logged in nick or a channel
name. \fInick\fR is the name of the sender of the message.
\fImessage\fR is the message text. \fItype\fR is set to "ACTION" if the
message was sent as a CTCP ACTION
.TP
\fBsystem\fR \fIchannel\fR \fImessage\fR
called when a system message is received
.TP
\fBtopic\fR \fIchannel\fR \fItopic\fR
called when the channel topic string is seen. \fItopic\fR is the text
of the channel topic.
.TP
\fBtraffic\fR \fIaction\fR \fIchannel\fR \fInick\fR ?\fInewnick\fR?
called when users join, leave or change names.
\fIaction\fR is either entered, left or nickchange and \fInick\fR
is the user doing the action. \fInewnick\fR is
the new name if \fIaction\fR is nickchange.
.sp
\fINOTE\fR: \fIchannel\fR is often empty for these messages as nick
activities are global for the irc server. You will have
to manage the nick for all connected channels yourself.
.TP
\fBversion\fR
This is called to request a version string to use to
override the internal version. If implemented, you should
return as colon delimited string as
.sp
Appname:Appversion:LibraryVersion
.sp
For example, the default is
.sp
PicoIRC:[package provide picoirc]:Tcl [info patchlevel]
.TP
\fBdebug\fR \fItype\fR \fIraw\fR
called when data is either being read or written to the network
socket. \fItype\fR is set to \fBread\fR when reading data and
\fBwrite\fR if the data is to be written. \fIraw\fR is the
unprocessed IRC protocol data.
.sp
In both cases the application can return a break error code to
interrupt further processing of the raw data. If this is a
\fBread\fR operation then the package will not handle this line. If
the operation is \fBwrite\fR then the package will not send the
data. This callback is intended for debugging protocol issues but
could be used to redirect all input and output if desired.
.PP
.SH "SEE ALSO"
rfc 1459
.SH KEYWORDS
chat, irc
.SH CATEGORY
Networking

Added embedded/man/files/modules/javascript/javascript.n.




















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/javascript/javascript.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "javascript" n 1.0.2 tcllib "HTML and Java Script Generation"
.BS
.SH NAME
javascript \- Procedures to generate HTML and Java Script structures.
.SH SYNOPSIS
package require \fBTcl  8\fR
.sp
package require \fBjavascript  ?1.0.2?\fR
.sp
\fB::javascript::makeSelectorWidget\fR \fIid leftLabel leftValueList rightLabel rightValueList rightNameList\fR ?\fIlength\fR? ?\fIminWidth\fR?
.sp
\fB::javascript::makeSubmitButton\fR \fIname value\fR
.sp
\fB::javascript::makeProtectedSubmitButton\fR \fIname value msg\fR
.sp
\fB::javascript::makeMasterButton\fR \fImaster value slavePattern boolean\fR
.sp
\fB::javascript::makeParentCheckbox\fR \fIparentName childName\fR
.sp
\fB::javascript::makeChildCheckbox\fR \fIparentName childName\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fB::javascript\fR package provides commands that generate
HTML and Java Script code.  These commands typically return an HTML
string as their result.  In particular, they do not output their
result to \fBstdout\fR.
.PP
.TP
\fB::javascript::makeSelectorWidget\fR \fIid leftLabel leftValueList rightLabel rightValueList rightNameList\fR ?\fIlength\fR? ?\fIminWidth\fR?
Construct HTML code to create a dual-multi-selection megawidget.  This
megawidget consists of two side-by-side multi-selection boxes
separated by a left arrow and a right arrow button.  The right arrow
button moves all items selected in the left box to the right box.  The
left arrow button moves all items selected in the right box to the
left box.  The \fIid\fR argument is the suffix of all HTML objects in
this megawidget.  The \fIleftLabel\fR argument is the text that
appears above the left selection box.  The \fIleftValueList\fR
argument is the values of items in the left selection box.  The
\fIleftNameList\fR argument is the names to appear in the left
selection box.  The \fIrightLabel\fR argument is the text that appears
above the right selection box.  The \fIrightValueList\fR argument is
the values of items in the right selection box.  The
\fIrightNameList\fR argument is the names to appear in the right
selection box.  The \fIlength\fR argument (optional) determines the
number of elts to show before adding a vertical scrollbar; it defaults
to 8.  The \fIminWidth\fR argument (optional) is the number of spaces
to determine the minimum box width; it defaults to 32.
.TP
\fB::javascript::makeSubmitButton\fR \fIname value\fR
Create an HTML submit button that resets a hidden field for each
registered multi-selection box.  The \fIname\fR argument is the name
of the HTML button object to create.  The \fIvalue\fR argument is the
label of the HTML button object to create.
.TP
\fB::javascript::makeProtectedSubmitButton\fR \fIname value msg\fR
Create an HTML submit button that prompts the user with a
continue/cancel shutdown warning before the form is submitted.  The
\fIname\fR argument is the name of the HTML button object to create.
The \fIvalue\fR argument is the label of the HTML button object to
create. The \fImsg\fR argument is the message to display when the
button is pressed.
.TP
\fB::javascript::makeMasterButton\fR \fImaster value slavePattern boolean\fR
Create an HTML button that sets its slave checkboxs to the boolean
value.  The \fImaster\fR argument is the name of the child's parent
html checkbox object.  The \fIvalue\fR argument is the value of the
master.  The \fIslaves\fR argument is the name of child html checkbox
object to create.  The \fIboolean\fR argument is the java script
boolean value that will be given to all the slaves; it must be "true"
or "false".
.TP
\fB::javascript::makeParentCheckbox\fR \fIparentName childName\fR
Create an HTML checkbox and tie its value to that of its child
checkbox.  If the parent is unchecked, the child is automatically
unchecked.  The \fIparentName\fR argument is the name of parent html
checkbox object to create. The \fIchildName\fR argument is the name of
the parent's child html checkbox object.
.TP
\fB::javascript::makeChildCheckbox\fR \fIparentName childName\fR
Create an HTML checkbox and tie its value to that of its parent
checkbox.  If the child is checked, the parent is automatically
checked.  The \fIparentName\fR argument is the name of the child's
parent html checkbox object.  The \fIchildName\fR argument is the name
of child html checkbox object to create.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIjavascript\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
html, ncgi
.SH KEYWORDS
checkbox, html, javascript, selectionbox, submitbutton
.SH CATEGORY
CGI programming

Added embedded/man/files/modules/jpeg/jpeg.n.




































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/jpeg/jpeg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004-2005, Code: Aaron Faupell <[email protected]>
'\" Copyright (c) 2007, Code: Andreas Kupries <[email protected]>
'\" Copyright (c) 2004-2009, Doc: Andreas Kupries <[email protected]>
'\" Copyright (c) 2011, Code: Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "jpeg" n 0.4.0 tcllib "JPEG image manipulation"
.BS
.SH NAME
jpeg \- JPEG querying and manipulation of meta data
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBjpeg  ?0.4.0?\fR
.sp
\fB::jpeg::isJPEG\fR \fIfile\fR
.sp
\fB::jpeg::imageInfo\fR \fIfile\fR
.sp
\fB::jpeg::dimensions\fR \fIfile\fR
.sp
\fB::jpeg::getThumbnail\fR \fIfile\fR
.sp
\fB::jpeg::getExif\fR \fIfile\fR ?\fIsection\fR?
.sp
\fB::jpeg::getExifFromChannel\fR \fIchannel\fR ?\fIsection\fR?
.sp
\fB::jpeg::formatExif\fR \fIkeys\fR
.sp
\fB::jpeg::exifKeys\fR
.sp
\fB::jpeg::removeExif\fR \fIfile\fR
.sp
\fB::jpeg::stripJPEG\fR \fIfile\fR
.sp
\fB::jpeg::getComments\fR \fIfile\fR
.sp
\fB::jpeg::addComment\fR \fIfile\fR \fItext\fR...
.sp
\fB::jpeg::removeComments\fR \fIfile\fR
.sp
\fB::jpeg::replaceComment\fR \fIfile\fR \fItext\fR
.sp
\fB::jpeg::debug\fR \fIfile\fR
.sp
\fB::jpeg::markers\fR \fIchannel\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides commands to query and modify JPEG images. JPEG
stands for \fIJoint Photography Experts Group\fR and is a standard
for the lossy compression of photographical images. It is specified at
\fILINK_HERE\fR.
.SH COMMANDS
.TP
\fB::jpeg::isJPEG\fR \fIfile\fR
Returns a boolean value indicating if \fIfile\fR is a
JPEG image.
.TP
\fB::jpeg::imageInfo\fR \fIfile\fR
Returns a dictionary with keys \fBversion\fR, \fBunits\fR,
\fBxdensity\fR, \fBydensity\fR, \fBxthumb\fR, and
\fBythumb\fR. The values are the associated properties of the JPEG
image in \fIfile\fR.
Throws an error if \fIfile\fR is not a JPEG image.
.TP
\fB::jpeg::dimensions\fR \fIfile\fR
Returns the dimensions of the JPEG \fIfile\fR as a list of the
horizontal and vertical pixel count.
Throws an error if \fIfile\fR is not a JPEG image.
.TP
\fB::jpeg::getThumbnail\fR \fIfile\fR
This procedure will return the binary thumbnail image data, if a JPEG
thumbnail is included in \fIfile\fR, and the empty string
otherwise. Note that it is possible to include thumbnails in formats
other than JPEG although that is not common. The command finds
thumbnails that are encoded in either the JFXX or EXIF segments of the
JPEG information. If both are present the EXIF thumbnail will take precedence.
Throws an error if \fIfile\fR is not a JPEG image.
.CS


    set fh [open thumbnail.jpg w+]
    fconfigure $fh -translation binary -encoding binary
    puts -nonewline $fh [::jpeg::getThumbnail photo.jpg]
    close $fh

.CE
.TP
\fB::jpeg::getExif\fR \fIfile\fR ?\fIsection\fR?
\fIsection\fR must be one of \fBmain\fR or \fBthumbnail\fR.
The default is \fBmain\fR.
Returns a dictionary containing the EXIF information for the specified section.
For example:
.sp
.CS


    set exif {
	Make     Canon
	Model    {Canon DIGITAL IXUS}
	DateTime {2001:06:09 15:17:32}
    }

.CE
.IP
Throws an error if \fIfile\fR is not a JPEG image.
.TP
\fB::jpeg::getExifFromChannel\fR \fIchannel\fR ?\fIsection\fR?
This command is as per \fB::jpeg::getExif\fR except that it uses a
previously opened channel.  \fIchannel\fR should be a seekable channel
and \fIsection\fR is as described in the documentation of
\fB::jpeg::getExif\fR
Note: the jpeg parser expects that the start of the channel is the
start of the image data. If working with an image embedded in a
container file format it may be necessary to read the jpeg data into
a temporary container: either a temporary file or a memory channel.
.TP
\fB::jpeg::formatExif\fR \fIkeys\fR
Takes a list of key-value pairs as returned by \fBgetExif\fR and formats
many of the values into a more human readable form. As few as one key-value
may be passed in, the entire exif is not required.
.CS


    foreach {key val} [::jpeg::formatExif [::jpeg::getExif photo.jpg]] {
        puts "$key: $val"
    }

.CE
.sp
.CS


    array set exif [::jpeg::getExif photo.jpg]
    puts "max f-stop: [::jpeg::formatExif [list MaxAperture $exif(MaxAperture)]]

.CE
.TP
\fB::jpeg::exifKeys\fR
Returns a list of the EXIF keys which are currently understood.
There may be keys present in \fBgetExif\fR data that are not understood.
Those keys will appear in a 4 digit hexadecimal format.
.TP
\fB::jpeg::removeExif\fR \fIfile\fR
Removes the Exif data segment from the specified file and replaces
it with a standard JFIF segment.
Throws an error if \fIfile\fR is not a JPEG image.
.TP
\fB::jpeg::stripJPEG\fR \fIfile\fR
Removes all metadata from the JPEG file leaving only
the image. This includes comments, EXIF segments, JFXX
segments, and application specific segments.
Throws an error if \fIfile\fR is not a JPEG image.
.TP
\fB::jpeg::getComments\fR \fIfile\fR
Returns a list containing all the JPEG comments found in
the \fIfile\fR.
Throws an error if \fIfile\fR is not a valid JPEG image.
.TP
\fB::jpeg::addComment\fR \fIfile\fR \fItext\fR...
Adds one or more plain \fItext\fR comments to the JPEG image
in \fIfile\fR.
Throws an error if \fIfile\fR is not a valid JPEG image.
.TP
\fB::jpeg::removeComments\fR \fIfile\fR
Removes all comments from the file specified.
Throws an error if \fIfile\fR is not a valid JPEG image.
.TP
\fB::jpeg::replaceComment\fR \fIfile\fR \fItext\fR
Replaces the first comment in the file with the new \fItext\fR.
This is merely a shortcut for \fB::jpeg::removeComments\fR
and \fB::jpeg::addComment\fR
Throws an error if \fIfile\fR is not a valid JPEG image.
.TP
\fB::jpeg::debug\fR \fIfile\fR
Prints everything we know about the given file in a nice format.
.TP
\fB::jpeg::markers\fR \fIchannel\fR
This is an internal helper command, we document it for use by advanced
users of the package. The argument \fIchannel\fR is an open file
handle positioned at the start of the first marker (usually 2
bytes). The command returns a list with one element for each JFIF
marker found in the file. Each element consists of a list of the
marker name, its offset in the file, and its length. The offset points
to the beginning of the sections data, not the marker itself.  The
length is the length of the data from the offset listed to the start
of the next marker.
.PP
.SH LIMITATIONS
can only work with files
cant write exif data
gps exif data not parsed
makernote data not yet implemented
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIjpeg\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
comment, exif, image, jfif, jpeg, thumbnail
.SH CATEGORY
File formats
.SH COPYRIGHT
.nf
Copyright (c) 2004-2005, Code: Aaron Faupell <[email protected]>
Copyright (c) 2007, Code:  Andreas Kupries <[email protected]>
Copyright (c) 2004-2009, Doc:  Andreas Kupries <[email protected]>
Copyright (c) 2011, Code: Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/json/json.n.






















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/json/json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 ActiveState Software Inc.
'\" Copyright (c) 2009 Thomas Maeder, Glue Software Engineering AG
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "json" n 1.1.2 tcllib "JSON"
.BS
.SH NAME
json \- JSON parser
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBjson  ?1.1.2?\fR
.sp
\fB::json::json2dict\fR \fItxt\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBjson\fR package provides a simple Tcl-only library for parsing the
JSON \fIhttp://www.json.org/\fR data exchange format as specified in RFC 4627
\fIhttp://www.ietf.org/rfc/rfc4627.txt\fR.
There is some ambiguity in parsing JSON because JSON has type information that
is not maintained by the Tcl conversion.  The \fBjson\fR package returns
data as a Tcl \fBdict\fR.  Either the \fBdict\fR package or Tcl 8.5 is
required for use.
.SH COMMANDS
.TP
\fB::json::json2dict\fR \fItxt\fR
Parse JSON formatted text \fItxt\fR into a Tcl dict and return the value.
.PP
.PP
.SH EXAMPLES
.PP
An example of a JSON array converted to Tcl.  A JSON array is returned as a
single item with multiple elements.
.PP
.CS

[
    {
       "precision": "zip",
       "Latitude":  37.7668,
       "Longitude": -122.3959,
       "Address":   "",
       "City":      "SAN FRANCISCO",
       "State":     "CA",
       "Zip":       "94107",
       "Country":   "US"
    },
    {
       "precision": "zip",
       "Latitude":  37.371991,
       "Longitude": -122.026020,
       "Address":   "",
       "City":      "SUNNYVALE",
       "State":     "CA",
       "Zip":       "94085",
       "Country":   "US"
    }
]
=>
{Country US Latitude 37.7668 precision zip State CA City {SAN FRANCISCO} Address {} Zip 94107 Longitude -122.3959} {Country US Latitude 37.371991 precision zip State CA City SUNNYVALE Address {} Zip 94085 Longitude -122.026020}

.CE
.PP
An example of a JSON object converted to Tcl.  A JSON object is returned as a
multi-element list (a dict).
.PP
.CS

{
    "Image": {
        "Width":  800,
        "Height": 600,
        "Title":  "View from 15th Floor",
        "Thumbnail": {
            "Url":    "http://www.example.com/image/481989943",
            "Height": 125,
            "Width":  "100"
        },
        "IDs": [116, 943, 234, 38793]
    }
}
=>
Image {IDs {116 943 234 38793} Thumbnail {Width 100 Height 125 Url http://www.example.com/image/481989943} Width 800 Height 600 Title {View from 15th Floor}}

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIjson\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
data exchange, exchange format, javascript, json
.SH CATEGORY
CGI programming
.SH COPYRIGHT
.nf
Copyright (c) 2006 ActiveState Software Inc.
Copyright (c) 2009 Thomas Maeder, Glue Software Engineering AG

.fi

Added embedded/man/files/modules/json/json_write.n.












































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/json/json_write.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009-2013 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "json::write" n 1.0.2 tcllib "JSON"
.BS
.SH NAME
json::write \- JSON generation
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBjson::write  ?1.0.2?\fR
.sp
\fB::json::write\fR \fBindented\fR
.sp
\fB::json::write\fR \fBindented\fR \fIflag\fR
.sp
\fB::json::write\fR \fBaligned\fR
.sp
\fB::json::write\fR \fBaligned\fR \fIflag\fR
.sp
\fB::json::write\fR \fBstring\fR \fIs\fR
.sp
\fB::json::write\fR \fBarray\fR \fIarg\fR...
.sp
\fB::json::write\fR \fBobject\fR \fIkey\fR \fIvalue\fR...
.sp
.BE
.SH DESCRIPTION
.PP
The \fBjson::write\fR package provides a simple Tcl-only library
for generation of text in the JSON \fIhttp://www.json.org/\fR data
exchange format as specified in
RFC 4627 \fIhttp://www.ietf.org/rfc/rfc4627.txt\fR.
.SH COMMANDS
.TP
\fB::json::write\fR \fBindented\fR
This method returns the current state of the indentation setting.
.TP
\fB::json::write\fR \fBindented\fR \fIflag\fR
This and the method \fBaligned\fR configure the layout of the JSON
generated by the package.
.sp
If this \fIflag\fR is set (default) the package will break the
generated JSON code across lines and indent it according to its inner
structure, with each key of an object on a separate line.
.sp
If this flag is not set, the whole JSON object will be written on a
single line, with minimum spacing between all elements.
.TP
\fB::json::write\fR \fBaligned\fR
This method returns the current state of the alignment setting.
.TP
\fB::json::write\fR \fBaligned\fR \fIflag\fR
This and the method \fBindented\fR configure the layout of the JSON
generated by the package.
.sp
If this \fIflag\fR is set (default) the package ensures that the
values for the keys in an object are vertically aligned with each
other, for a nice table effect. To make this work this also implies
that \fBindented\fR is set as well.
.sp
If this flag is not set, the output is formatted as per the value of
\fBindented\fR, without trying to align the values for object keys.
.TP
\fB::json::write\fR \fBstring\fR \fIs\fR
This method takes the string \fIs\fR and returns it properly quoted
for JSON as its result.
.TP
\fB::json::write\fR \fBarray\fR \fIarg\fR...
This method takes a series of JSON formatted arguments and returns
them as a properly formatted JSON array as its result.
.TP
\fB::json::write\fR \fBobject\fR \fIkey\fR \fIvalue\fR...
This method takes a series of key/value arguments, the values already
formatted for JSON, and returns them as a properly formatted JSON
object as its result, with the keys formatted as JSON strings.
.PP
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIjson\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
data exchange, exchange format, javascript, json
.SH CATEGORY
CGI programming
.SH COPYRIGHT
.nf
Copyright (c) 2009-2013 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/lambda/lambda.n.

















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/lambda/lambda.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries, BSD licensed
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "lambda" n 1 tcllib "Utility commands for anonymous procedures"
.BS
.SH NAME
lambda \- Utility commands for anonymous procedures
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBlambda  ?1?\fR
.sp
\fB::lambda\fR \fIarguments\fR \fIbody\fR ?\fIarg\fR...?
.sp
\fB::lambda@\fR \fInamespace\fR \fIarguments\fR \fIbody\fR ?\fIarg\fR...?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides two convenience commands to make the writing of
anonymous procedures, i.e. lambdas more \fBproc\fR-like. Instead of,
for example, to write
.CS


     set f {::apply {{x} {
        ....
     }}}

.CE
with its deep nesting of braces, or
.CS


     set f [list ::apply {{x y} {
        ....
     }} $value_for_x]

.CE
with a list command to insert some of the arguments of a partial
application, just write
.CS


     set f [lambda {x} {
        ....
     }]

.CE
and
.CS


     set f [lambda {x y} {
        ....
     } $value_for_x]

.CE
.SH COMMANDS
.TP
\fB::lambda\fR \fIarguments\fR \fIbody\fR ?\fIarg\fR...?
The command constructs an anonymous procedure from the list of
arguments, body script and (optional) predefined argument values and
returns a command prefix representing this anonymous procedure.
.sp
When invoked the \fIbody\fR is run in a new procedure scope
just underneath the global scope, with the arguments set to the values
supplied at both construction and invokation time.
.TP
\fB::lambda@\fR \fInamespace\fR \fIarguments\fR \fIbody\fR ?\fIarg\fR...?
The command constructs an anonymous procedure from the namespace name,
list of arguments, body script and (optional) predefined argument
values and returns a command prefix representing this anonymous
procedure.
.sp
When invoked the \fIbody\fR is run in a new procedure scope in
the \fInamespace\fR, with the arguments set to the values supplied at
both construction and invokation time.
.PP
.SH AUTHORS
Andreas Kupries
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIlambda\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
apply(n), proc(n)
.SH KEYWORDS
anonymous procedure, callback, command prefix, currying, lambda, partial application, proc
.SH CATEGORY
Utility
.SH COPYRIGHT
.nf
Copyright (c) 2011 Andreas Kupries, BSD licensed

.fi

Added embedded/man/files/modules/ldap/ldap.n.












































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ldap/ldap.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Andreas Kupries <[email protected]>
'\" Copyright (c) 2004 Jochen Loewer <[email protected]>
'\" Copyright (c) 2006 Michael Schlenker <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ldap" n 1.6.9 tcllib "LDAP client"
.BS
.SH NAME
ldap \- LDAP client
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBldap  ?1.8?\fR
.sp
\fB::ldap::connect\fR \fIhost\fR ?\fIport\fR?
.sp
\fB::ldap::secure_connect\fR \fIhost\fR ?\fIport\fR?
.sp
\fB::ldap::disconnect\fR \fIhandle\fR
.sp
\fB::ldap::starttls\fR \fIhandle\fR ?\fIcafile\fR? ?\fIcertfile\fR? ?\fIkeyfile\fR?
.sp
\fB::ldap::bind\fR \fIhandle\fR ?\fIname\fR? ?\fIpassword\fR?
.sp
\fB::ldap::bindSASL\fR \fIhandle\fR ?\fIname\fR? ?\fIpassword\fR?
.sp
\fB::ldap::unbind\fR \fIhandle\fR
.sp
\fB::ldap::search\fR \fIhandle\fR \fIbaseObject\fR \fIfilterString\fR \fIattributes\fR \fIoptions\fR
.sp
\fB::ldap::searchInit\fR \fIhandle\fR \fIbaseObject\fR \fIfilterString\fR \fIattributes\fR \fIoptions\fR
.sp
\fB::ldap::searchNext\fR \fIhandle\fR
.sp
\fB::ldap::searchEnd\fR \fIhandle\fR
.sp
\fB::ldap::modify\fR \fIhandle\fR \fIdn\fR \fIattrValToReplace\fR ?\fIattrToDelete\fR? ?\fIattrValToAdd\fR?
.sp
\fB::ldap::modifyMulti\fR \fIhandle\fR \fIdn\fR \fIattrValToReplace\fR ?\fIattrValToDelete\fR? ?\fIattrValToAdd\fR?
.sp
\fB::ldap::add\fR \fIhandle\fR \fIdn\fR \fIattrValueTuples\fR
.sp
\fB::ldap::addMulti\fR \fIhandle\fR \fIdn\fR \fIattrValueTuples\fR
.sp
\fB::ldap::delete\fR \fIhandle\fR \fIdn\fR
.sp
\fB::ldap::modifyDN\fR \fIhandle\fR \fIdn\fR \fInewrdn\fR ?\fIdeleteOld\fR? ?\fInewSuperior\fR?
.sp
\fB::ldap::info\fR \fBip\fR \fIhandle\fR
.sp
\fB::ldap::info\fR \fBbound\fR \fIhandle\fR
.sp
\fB::ldap::info\fR \fBbounduser\fR \fIhandle\fR
.sp
\fB::ldap::info\fR \fBconnections\fR
.sp
\fB::ldap::info\fR \fBtls\fR \fIhandle\fR
.sp
\fB::ldap::info\fR \fBsaslmechanisms\fR \fIhandle\fR
.sp
\fB::ldap::info\fR \fBcontrol\fR \fIhandle\fR
.sp
\fB::ldap::info\fR \fBextensions\fR \fIextensions\fR
.sp
\fB::ldap::info\fR \fBwhoami\fR \fIhandle\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBldap\fR package provides a Tcl-only client library
for the LDAPv3 protocol as specified in
RFC 4511 (\fIhttp://www.rfc-editor.org/rfc/rfc4511.txt\fR).
It works by opening the standard (or secure) LDAP socket on the
server, and then providing a Tcl API to access the LDAP protocol
commands.  All server errors are returned as Tcl errors (thrown) which
must be caught with the Tcl \fBcatch\fR command.
.SH COMMANDS
.TP
\fB::ldap::connect\fR \fIhost\fR ?\fIport\fR?
Opens a LDAPv3 connection to the specified \fIhost\fR, at the given
\fIport\fR, and returns a token for the connection. This token is the
\fIhandle\fR argument for all other commands. If no \fIport\fR is
specified it will default to \fB389\fR.
.sp
The command blocks until the connection has been established, or
establishment definitely failed.
.TP
\fB::ldap::secure_connect\fR \fIhost\fR ?\fIport\fR?
Like \fB::ldap::connect\fR, except that the created connection is
secured by SSL. The port defaults to \fB636\fR.  This command
depends on the availability of the package \fBTLS\fR, which is a
SSL binding for Tcl. If \fBTLS\fR is not available, then this
command will fail.
.sp
The command blocks until the connection has been established, or
establishment definitely failed.
.TP
\fB::ldap::disconnect\fR \fIhandle\fR
Closes the ldap connection refered to by the token
\fIhandle\fR. Returns the empty string as its result.
.TP
\fB::ldap::starttls\fR \fIhandle\fR ?\fIcafile\fR? ?\fIcertfile\fR? ?\fIkeyfile\fR?
Start TLS negotiation on the connection denoted by \fIhandle\fR.
This is currently experimental and subject to change, more control over the TLS details
will probably be exposed later, to allow users to fine tune the negotiation according
to their security needs.
.TP
\fB::ldap::bind\fR \fIhandle\fR ?\fIname\fR? ?\fIpassword\fR?
This command authenticates the ldap connection refered to by the token
in \fIhandle\fR, with a user name and associated password. It blocks
until a response from the ldap server arrives. Its result is the empty
string.
Both \fIname\fR and \fIpasswd\fR default to the empty string if they
are not specified.
By leaving out \fIname\fR and \fIpasswd\fR you can make an anonymous bind to
the ldap server.
You can issue \fB::ldap::bind\fR again to bind with different credentials.
.TP
\fB::ldap::bindSASL\fR \fIhandle\fR ?\fIname\fR? ?\fIpassword\fR?
This command uses SASL authentication mechanisms to do a multistage bind.
Its otherwise identical to the standard \fB::ldap::bind\fR.
This feature is currently experimental and subject to change. See the documentation
for the \fBSASL\fR and the "\fISASL.txt\fR" in the tcllib CVS repository for
details how to setup and use SASL with openldap.
.TP
\fB::ldap::unbind\fR \fIhandle\fR
This command asks the ldap server to release the last bind done for
the connection refered to by the token in \fIhandle\fR.
The \fIhandle\fR is invalid after the unbind, as the server closes the connection.
So this is effectivly just a more polite disconnect operation.
.TP
\fB::ldap::search\fR \fIhandle\fR \fIbaseObject\fR \fIfilterString\fR \fIattributes\fR \fIoptions\fR
This command performs a LDAP search below the \fIbaseObject\fR tree
using a complex LDAP search expression \fIfilterString\fR and returns
the specified \fIattributes\fR of all matching objects (DNs). If the
list of \fIattributes\fR was empty all attributes are returned. The
command blocks until it has received all results.
The valid \fIoptions\fR are identical to the options listed for \fB::ldap::searchInit\fR.
.sp
An example of a search expression is
.sp
.CS


    set filterString "|(cn=Linus*)(sn=Torvalds*)"

.CE
.sp
The return value of the command is a list of nested dictionaries. The
first level keys are object identifiers (DNs), second levels keys are
attribute names. In other words, it is in the form
.sp
.CS


    {dn1 {attr1 {val11 val12 ...} attr2 {val21...} ...}} {dn2 {a1 {v11 ...} ...}} ...

.CE
.sp
.TP
\fB::ldap::searchInit\fR \fIhandle\fR \fIbaseObject\fR \fIfilterString\fR \fIattributes\fR \fIoptions\fR
This command initiates a LDAP search below the \fIbaseObject\fR tree
using a complex LDAP search expression \fIfilterString\fR.
The search gets the specified \fIattributes\fR of all matching objects (DNs).
The command itself just starts the search, to retrieve the actual results, use
\fB::ldap::searchNext\fR.
A search can be terminated at any time by
\fB::ldap::searchEnd\fR. This informs the server that no further results should be sent by sending and ABANDON message
and cleans up the internal state of the search.
Only one \fB::ldap::search\fR can be active at a given time, this
includes the introspection commands \fB::ldap::info saslmechanisms\fR, \fBldap::info control\fR and
\fBldap::info extensions\fR, which invoke a search internally.
Error responses from the server due to wrong arguments or similar things are returned
with the first \fB::ldap::searchNext\fR call and should be checked and dealed with there.
If the list of requested \fIattributes\fR is empty all attributes will be returned.
The parameter \fIoptions\fR specifies the options to be used in the search,
and has the following format:
.sp
.CS


    {-option1 value1 -option2 value2 ... }

.CE
.sp
Following options are available:
.RS
.TP
\fB-scope\fR base one sub
Control the scope of the search to be one of \fBbase\fR, \fBone\fR, or \fBsub\fR,  to  specify  a  base
object,  one-level or  subtree  search.   The  default is \fBsub\fR.
.TP
\fB-derefaliases\fR never search find always
Control how aliases dereferencing is done.  Should be one of \fBnever\fR, \fBalways\fR, \fBsearch\fR,  or  \fBfind\fR  to
specify that aliases are never dereferenced, always dereferenced, dereferenced when searching, or
dereferenced only when locating the base object for the search.
The default is to never dereference aliases.
.TP
\fB-sizelimit\fR num
Determines the maximum number of entries to return in a search. If specified as
0 no limit is enforced. The server may enforce a configuration dependent sizelimit,
which may be lower than the one given by this option. The default is 0, no limit.
.TP
\fB-timelimit\fR seconds
Asks the server to use a timelimit of \fIseconds\fR for the search. Zero means no
limit. The default is 0, no limit.
.TP
\fB-attrsonly\fR boolean
If set to 1 only the attribute names but not the values will be present in the search result.
The default is to retrieve attribute names and values.
.TP
\fB-referencevar\fR varname
If set the search result reference LDAPURIs, if any, are returned in the given variable.
The caller can than decide to follow those references and query other LDAP servers for
further results.
.RE
.sp
.TP
\fB::ldap::searchNext\fR \fIhandle\fR
This command returns the next entry from a LDAP search initiated
by \fB::ldap::searchInit\fR. It returns only after a new result is received
or when no further results are available, but takes care to keep
the event loop alive.
The returned entry is a list with
two elements: the first is the DN of the entry, the second is the
list of attributes and values, under the format:
.sp
.CS


    dn {attr1 {val11 val12 ...} attr2 {val21...} ...}

.CE
.sp
The \fB::ldap::searchNext\fR command returns an empty list at the
end of the search.
.sp
.TP
\fB::ldap::searchEnd\fR \fIhandle\fR
This command terminates a LDAP search initiated
by \fB::ldap::searchInit\fR. It also cleans up
the internal state so a new search can be initiated.
If the client has not yet received all results, the client
sends an ABANDON message to inform the server that no
further results for the previous search should to be sent.
.sp
.TP
\fB::ldap::modify\fR \fIhandle\fR \fIdn\fR \fIattrValToReplace\fR ?\fIattrToDelete\fR? ?\fIattrValToAdd\fR?
This command modifies the object \fIdn\fR on the ldap server we are
connected to via \fIhandle\fR. It replaces attributes with new values,
deletes attributes, and adds new attributes with new values.
All arguments are dictionaries mapping attribute names to values. The
optional arguments default to the empty dictionary, which means that
no attributes will be deleted nor added.
.RS
.TP
dictionary \fIattrValToReplace\fR (in)
No attributes will be changed if this argument is empty. The
dictionary contains the new attributes and their values. They
\fIreplace all\fR attributes known to the object.
.TP
dictionary \fIattrToDelete\fR (in)
No attributes will be deleted if this argument is empty. The
dictionary values are restrictions on the deletion. An attribute
listed here will be deleted if and only if its current value at the
server matches the value specified in the dictionary, or if the value
in the dictionary is the empty string.
.TP
dictionary \fIattrValToAdd\fR (in)
No attributes will be added if this argument is empty. The dictionary
values are the values for the new attributes.
.RE
.sp
The command blocks until all modifications have completed. Its result
is the empty string.
.TP
\fB::ldap::modifyMulti\fR \fIhandle\fR \fIdn\fR \fIattrValToReplace\fR ?\fIattrValToDelete\fR? ?\fIattrValToAdd\fR?
This command modifies the object \fIdn\fR on the ldap server we are
connected to via \fIhandle\fR. It replaces attributes with new values,
deletes attributes, and adds new attributes with new values.
All arguments are lists with the format:
.sp
.CS


    attr1 {val11 val12 ...} attr2 {val21...} ...

.CE
.sp
where each value list may be empty for deleting all attributes.
The optional arguments default to empty lists of attributes to
delete and to add.
.RS
.TP
list \fIattrValToReplace\fR (in)
No attributes will be changed if this argument is empty. The
dictionary contains the new attributes and their values. They
\fIreplace all\fR attributes known to the object.
.TP
list \fIattrValToDelete\fR (in)
No attributes will be deleted if this argument is empty. If no
value is specified, the whole set of values for an attribute
will be deleted.
.TP
list \fIattrValToAdd\fR (in)
No attributes will be added if this argument is empty.
.RE
.sp
The command blocks until all modifications have completed. Its result
is the empty string.
.TP
\fB::ldap::add\fR \fIhandle\fR \fIdn\fR \fIattrValueTuples\fR
This command creates a new object using the specified \fIdn\fR. The
attributes of the new object are set to the values in the list
\fIattrValueTuples\fR.
Multiple valuated attributes may be specified using multiple tuples.
The command blocks until the operation has completed. Its result
is the empty string.
.TP
\fB::ldap::addMulti\fR \fIhandle\fR \fIdn\fR \fIattrValueTuples\fR
This command is the preferred one to create
a new object using the specified \fIdn\fR. The
attributes of the new object are set to the values in the dictionary
\fIattrValueTuples\fR (which is keyed by the attribute names).
Each tuple is a list containing multiple values.
The command blocks until the operation has completed. Its result
is the empty string.
.TP
\fB::ldap::delete\fR \fIhandle\fR \fIdn\fR
This command removes the object specified by \fIdn\fR, and all its
attributes from the server.
The command blocks until the operation has completed. Its result
is the empty string.
.TP
\fB::ldap::modifyDN\fR \fIhandle\fR \fIdn\fR \fInewrdn\fR ?\fIdeleteOld\fR? ?\fInewSuperior\fR?
]
This command moves or copies the object specified by \fIdn\fR
to a new location in the tree of object. This location is
specified by \fInewrdn\fR, a \fIrelative\fR designation,
or by \fInewrdn\fR and \fInewSuperior\fR, a \fIabsolute\fR designation.
The optional argument \fIdeleteOld\fR defaults to \fBtrue\fR,
i.e. a move operation. If \fIdeleteOld\fR is not set, then the
operation will create a copy of \fIdn\fR in the new location.
The optional argument \fInewSuperior\fR defaults an empty string,
meaning that the object must not be relocated in another branch of
the tree. If this argument is given, the argument \fIdeleteOld\fR
must be specified also.
The command blocks until the operation has completed. Its result
is the empty string.
.TP
\fB::ldap::info\fR \fBip\fR \fIhandle\fR
This command returns the IP address of the remote LDAP server the handle is connected to.
.TP
\fB::ldap::info\fR \fBbound\fR \fIhandle\fR
This command returns 1 if a handle has successfully completed a \fB::ldap::bind\fR.
If no bind was done or it failed, a 0 is returned.
.TP
\fB::ldap::info\fR \fBbounduser\fR \fIhandle\fR
This command returns the username used in the bind operation if a handle has successfully completed a \fB::ldap::bind\fR.
If no bound was done or it failed, an empty string is returned.
.TP
\fB::ldap::info\fR \fBconnections\fR
This command returns all currently existing ldap connection handles.
.TP
\fB::ldap::info\fR \fBtls\fR \fIhandle\fR
This command returns 1 if the ldap connection \fIhandle\fR used TLS/SSL for
connection via \fBldap::secure_connect\fR or completed \fBldap::starttls\fR, 0 otherwise.
.TP
\fB::ldap::info\fR \fBsaslmechanisms\fR \fIhandle\fR
Return the supported SASL mechanisms advertised by the server. Only valid in a
bound state (anonymous or other).
.TP
\fB::ldap::info\fR \fBcontrol\fR \fIhandle\fR
Return the supported controls advertised by the server as a list of OIDs. Only valid in a bound state.
This is currently experimental and subject to change.
.TP
\fB::ldap::info\fR \fBextensions\fR \fIextensions\fR
Returns the supported LDAP extensions as list of OIDs. Only valid in a bound state.
This is currently experimental and subject to change.
.TP
\fB::ldap::info\fR \fBwhoami\fR \fIhandle\fR
Returns authzId for the current connection. This implements the RFC 4532
protocol extension.
.PP
.PP
.SH EXAMPLES
.PP
A small example, extracted from the test application coming with this
code.
.PP
.CS


    package require ldap

    # Connect, bind, add a new object, modify it in various ways

    set handle [ldap::connect localhost 9009]

    set dn "cn=Manager, o=University of Michigan, c=US"
    set pw secret

    ldap::bind $handle $dn $pw

    set dn "cn=Test User,ou=People,o=University of Michigan,c=US"

    ldap::add $handle $dn {
	objectClass     OpenLDAPperson
	cn              {Test User}
	mail            [email protected]
	uid             testuid
	sn              User
	telephoneNumber +31415926535
	telephoneNumber +27182818285
    }

    set dn "cn=Another User,ou=People,o=University of Michigan,c=US"

    ldap::addMulti $handle $dn {
	objectClass     {OpenLDAPperson}
	cn              {{Anotther User}}
	mail            {[email protected]}
	uid             {testuid}
	sn              {User}
	telephoneNumber {+31415926535 +27182818285}
    }

    # Replace all attributes
    ldap::modify $handle $dn [list drink icetea uid JOLO]

    # Add some more
    ldap::modify $handle $dn {} {} [list drink water  drink orangeJuice pager "+1 313 555 7671"]

    # Delete
    ldap::modify $handle $dn {} [list drink water  pager ""]

    # Move
    ldap::modifyDN $handle $dn "cn=Tester"

    # Kill the test object, and shut the connection down.
    set dn "cn=Tester,ou=People,o=University of Michigan,c=US"
    ldap::delete $handle $dn

    ldap::unbind     $handle
    ldap::disconnect $handle

.CE
.PP
And a another example, a simple query, and processing the
results.
.PP
.CS


    package require ldap
    set handle [ldap::connect ldap.acme.com 389]
    ldap::bind $handle
    set results [ldap::search $handle "o=acme,dc=com" "(uid=jdoe)" {}]
    foreach result $results {
	foreach {object attributes} $result break

	# The processing here is similar to what 'parray' does.
	# I.e. finding the longest attribute name and then
	# generating properly aligned output listing all attributes
	# and their values.

	set width 0
	set sortedAttribs {}
	foreach {type values} $attributes {
	    if {[string length $type] > $width} {
		set width [string length $type]
	    }
	    lappend sortedAttribs [list $type $values]
	}

	puts "object='$object'"

	foreach sortedAttrib  $sortedAttribs {
	    foreach {type values} $sortedAttrib break
	    foreach value $values {
		regsub -all "\\[\\x01-\\x1f\\]" $value ? value
		puts [format "  %-${width}s %s" $type $value]
	    }
	}
	puts ""
    }
    ldap::unbind $handle
    ldap::disconnect $handle

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIldap\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
One know bug is the usage of \fBvwait\fR inside the dispatch mechanism, which makes
it currently unsafe to use this code in code that also enters the event loop.
.SH KEYWORDS
directory access, internet, ldap, ldap client, protocol, rfc 2251, rfc 4511, x.500
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2004 Andreas Kupries <[email protected]>
Copyright (c) 2004 Jochen Loewer <[email protected]>
Copyright (c) 2006 Michael Schlenker <[email protected]>

.fi

Added embedded/man/files/modules/ldap/ldapx.n.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ldap/ldapx.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Pierre David <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ldapx" n 0.2.5 tcllib "LDAP extended object interface"
.BS
.SH NAME
ldapx \- LDAP extended object interface
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBldapx  ?1.0?\fR
.sp
\fIe\fR \fBreset\fR
.sp
\fIe\fR \fBdn\fR ?\fInewdn\fR?
.sp
\fIe\fR \fBrdn\fR
.sp
\fIe\fR \fBsuperior\fR
.sp
\fIe\fR \fBprint\fR
.sp
\fIse\fR \fBisempty\fR
.sp
\fIse\fR \fBget\fR \fIattr\fR
.sp
\fIse\fR \fBget1\fR \fIattr\fR
.sp
\fIse\fR \fBset\fR \fIattr\fR \fIvalues\fR
.sp
\fIse\fR \fBset1\fR \fIattr\fR \fIvalue\fR
.sp
\fIse\fR \fBadd\fR \fIattr\fR \fIvalues\fR
.sp
\fIse\fR \fBadd1\fR \fIattr\fR \fIvalue\fR
.sp
\fIse\fR \fBdel\fR \fIattr\fR ?\fIvalues\fR?
.sp
\fIse\fR \fBdel1\fR \fIattr\fR \fIvalue\fR
.sp
\fIse\fR \fBgetattr\fR
.sp
\fIse\fR \fBgetall\fR
.sp
\fIse\fR \fBsetall\fR \fIavpairs\fR
.sp
\fIse\fR \fBbackup\fR ?\fIother\fR?
.sp
\fIse\fR \fBswap\fR
.sp
\fIse\fR \fBrestore\fR ?\fIother\fR?
.sp
\fIse\fR \fBapply\fR \fIcentry\fR
.sp
\fIce\fR \fBchange\fR ?\fInew\fR?
.sp
\fIce\fR \fBdiff\fR \fInew\fR ?\fIold\fR?
.sp
\fIla\fR \fBerror\fR ?\fInewmsg\fR?
.sp
\fIla\fR \fBconnect\fR \fIurl\fR ?\fIbinddn\fR? ?\fIbindpw\fR?
.sp
\fIla\fR \fBdisconnect\fR
.sp
\fIla\fR \fBtraverse\fR \fIbase\fR \fIfilter\fR \fIattrs\fR \fIentry\fR \fIbody\fR
.sp
\fIla\fR \fBsearch\fR \fIbase\fR \fIfilter\fR \fIattrs\fR
.sp
\fIla\fR \fBread\fR \fIbase\fR \fIfilter\fR \fIentry\fR ... \fIentry\fR
.sp
\fIla\fR \fBcommit\fR \fIentry\fR ... \fIentry\fR
.sp
\fIli\fR \fBchannel\fR \fIchan\fR
.sp
\fIli\fR \fBerror\fR ?\fInewmsg\fR?
.sp
\fIli\fR \fBread\fR \fIentry\fR
.sp
\fIli\fR \fBwrite\fR \fIentry\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBldapx\fR package provides an extended Tcl interface to
LDAP directores and LDIF files. The \fBldapx\fR package is built
upon the \fBldap\fR package in order to get low level LDAP access.
.PP
LDAP access is compatible with RFC 2251
(\fIhttp://www.rfc-editor.org/rfc/rfc2251.txt\fR).
LDIF access is compatible with RFC 2849
(\fIhttp://www.rfc-editor.org/rfc/rfc2849.txt\fR).
.SH OVERVIEW
The \fBldapx\fR package provides objects to interact with LDAP
directories and LDIF files with an easy to use programming interface.
It implements three \fBsnit\fR::type classes.
.PP
The first class, \fBentry\fR, is used to store individual entries.
Two different formats are available: the first one is the
\fIstandard\fR format, which represents an entry as read from the
directory. The second format is the \fIchange\fR format, which
stores differences between two standard entries.
.PP
With these entries, an application which wants to modify an entry
in a directory needs to read a (standard) entry from the directory,
create a fresh copy into a new (standard) entry, modify the new
copy, and then compute the differences between the two entries into
a new (change) entry, which may be commited to the directory.
.PP
Such kinds of modifications are so heavily used that standard entries
may contain their own copy of the original data. With such a copy,
the application described above reads a (standard) entry from the
directory, backs-up the original data, modifies the entry, and
computes the differences between the entry and its backup. These
differences are then commited to the directory.
.PP
Methods are provided to compute differences between two entries,
to apply differences to an entry in order to get a new entry, and
to get or set attributes in standard entries.
.PP
The second class is the \fBldap\fR class. It provides a method
to \fBconnect\fR and bind to the directory with a uniform access
to LDAP and LDAPS through an URL (ldap:// or ldaps://). The
\fBtraverse\fR control structure executes a body for each entry
found in the directory. The \fBcommit\fR method applies some
changes (represented as \fBentry\fR objects) to the directory.
Since some attributes are represented as UTF-8 strings, the option
\fB-utf8\fR controls which attributes must be converted and
which attributes must not be converted.
.PP
The last class is the \fBldif\fR class. It provides a method to
associate a standard Tcl \fIchannel\fR to an LDIF object. Then,
methods \fBread\fR and \fBwrite\fR read or write entries from
or to this channel. This class can make use of standard or change
entries, according to the type of the LDIF file which may contain
either standard entries or change entries (but not both at the same
time). The option \fB-utf8\fR works exactly as with the
\fBldap\fR class.
.SH "ENTRY CLASS"
.SS "ENTRY INSTANCE DATA"
An instance of the \fBentry\fR class keeps the following data:
.TP
dn
This is the DN of the entry, which includes (in LDAP
terminology) the RDN (relative DN) and the Superior parts.
.TP
format
The format may be \fIuninitialized\fR (entry not yet used),
\fIstandard\fR or \fIchange\fR. Most methods check the
format of the entry, which can be reset with the
\fBreset\fR method.
.TP
attrvals
In a \fIstandard\fR entry, this is where the attributes
and associated values are stored. Many methods provide
access to these informations. Attribute names are always
converted into lower case.
.TP
backup
In a \fIstandard\fR entry, the backup may contain a copy
of the dn and all attributes and values. Methods
\fBbackup\fR and \fBrestore\fR manipulate these data,
and method \fBdiff\fR may use this backup.
.TP
change
In a \fIchange\fR entry, these data represent the
modifications. Such modifications are handled by specialized
methods such as \fBapply\fR or \fBcommit\fR.
Detailed format should not be used directly by programs.
.sp
Internally, modifications are represented as a list of
elements, each element has one of the following formats
(which match the corresponding LDAP operations):
.RS
.IP [1]
{\fBadd\fR {attr1 {val1...valn} attr2 {...} ...}}
.sp
Addition of a new entry.
.IP [2]
{\fBmod\fR {modop {attr1 ?val1...valn?} attr2 ...} {modop ...} ...}
.sp
Modification of one or more attributes and/or values,
where <modop> can be \fBmodadd\fR, \fBmoddel\fR
or \fBmodrepl\fR (see the LDAP modify operation).
.IP [3]
{\fBdel\fR}
.sp
Deletion of an old entry.
.IP [4]
{\fBmodrdn\fR newrdn deleteoldrdn ?newsuperior?}
.sp
Renaming of an entry.
.RE
.PP
.SS "ENTRY OPTIONS"
No option is defined by this class.
.SS "METHODS FOR ALL KINDS OF ENTRIES"
.TP
\fIe\fR \fBreset\fR
This method resets the entry to an uninitialized state.
.TP
\fIe\fR \fBdn\fR ?\fInewdn\fR?
This method returns the current DN of the entry. If the
optional \fInewdn\fR is specified, it replaces the current
DN of the entry.
.TP
\fIe\fR \fBrdn\fR
This method returns the RDN part of the DN of the entry.
.TP
\fIe\fR \fBsuperior\fR
This method returns the superior part of the DN of the entry.
.TP
\fIe\fR \fBprint\fR
This method returns the entry as a string ready to be printed.
.PP
.PP
.SS "METHODS FOR STANDARD ENTRIES ONLY"
In all methods, attribute names are converted in lower case.
.TP
\fIse\fR \fBisempty\fR
This method returns 1 if the entry is empty (i.e. without
any attribute).
.TP
\fIse\fR \fBget\fR \fIattr\fR
This method returns all values of the attribute \fIattr\fR,
or the empty list if the attribute is not fond.
.TP
\fIse\fR \fBget1\fR \fIattr\fR
This method returns the first value of the attribute.
.TP
\fIse\fR \fBset\fR \fIattr\fR \fIvalues\fR
This method sets the values (list \fIvalues\fR) of the
attribute \fIattr\fR. If the list is empty, this method
deletes all
.TP
\fIse\fR \fBset1\fR \fIattr\fR \fIvalue\fR
This method sets the values of the attribute \fIattr\fR to
be an unique value \fIvalue\fR. Previous values, if any,
are replaced by the new value.
.TP
\fIse\fR \fBadd\fR \fIattr\fR \fIvalues\fR
This method adds all elements the list \fIvalues\fR to the
values of the attribute \fIattr\fR.
.TP
\fIse\fR \fBadd1\fR \fIattr\fR \fIvalue\fR
This method adds a single value given by the parameter
\fIvalue\fR to the attribute \fIattr\fR.
.TP
\fIse\fR \fBdel\fR \fIattr\fR ?\fIvalues\fR?
If the optional list \fIvalues\fR is specified, this method
deletes all specified values from the attribute \fIattr\fR.
If the argument \fIvalues\fR is not specified, this method
deletes all values.
.TP
\fIse\fR \fBdel1\fR \fIattr\fR \fIvalue\fR
This method deletes a unique \fIvalue\fR from the attribute
\fIattr\fR.
.TP
\fIse\fR \fBgetattr\fR
This method returns all attributes names.
.TP
\fIse\fR \fBgetall\fR
This method returns all attributes and values from the
entry, packed in a list of pairs <attribute, list of values>.
.TP
\fIse\fR \fBsetall\fR \fIavpairs\fR
This method sets at once all attributes and values. The
format of the \fIavpairs\fR argument is the same as the one
returned by method \fBgetall\fR.
.TP
\fIse\fR \fBbackup\fR ?\fIother\fR?
This method stores in an \fIother\fR standard entry object
a copy of the current DN and attributes/values. If the
optional \fIother\fR argument is not specified, copy is
done in the current entry (in a specific place, see section
\fBOVERVIEW\fR).
.TP
\fIse\fR \fBswap\fR
This method swaps the current and backup contexts of the
entry.
.TP
\fIse\fR \fBrestore\fR ?\fIother\fR?
If the optional argument \fIother\fR is given, which must
then be a \fIstandard\fR entry, this method restores the
current entry into the \fIother\fR entry. If the argument
\fIother\fR argument is not specified, this methods restores
the current entry from its internal backup (see section
\fBOVERVIEW\fR).
.TP
\fIse\fR \fBapply\fR \fIcentry\fR
This method applies changes defined in the \fIcentry\fR
argument, which must be a \fIchange\fR entry.
.PP
.SS "METHODS FOR CHANGE ENTRIES ONLY"
.TP
\fIce\fR \fBchange\fR ?\fInew\fR?
If the optional argument \fInew\fR is specified, this method
modifies the change list (see subsection \fBEntry Instance Data\fR for
the exact format). In both cases, current change list is
returned.
Warning: values returned by this method should only be used
by specialized methods such as \fBapply\fR or
\fBcommit\fR.
.TP
\fIce\fR \fBdiff\fR \fInew\fR ?\fIold\fR?
This method computes the differences between the \fInew\fR
and \fIold\fR entries under the form of a change list, and
stores this list into the current \fIchange\fR entry. If
the optional argument \fIold\fR is not specified, difference
is computed from the entry and its internal backup (see
section \fBOVERVIEW\fR). Return value is the computed
change list.
.PP
.SS "ENTRY EXAMPLE"
.CS


    package require ldapx

    #
    # Create an entry and fill it as a standard entry with
    # attributes and values
    #
    ::ldapx::entry create e
    e dn "uid=joe,ou=people,o=mycomp"
    e set1 "uid"             "joe"
    e set  "objectClass"     {person anotherObjectClass}
    e set1 "givenName"       "Joe"
    e set1 "sn"              "User"
    e set  "telephoneNumber" {+31415926535 +2182818}
    e set1 "anotherAttr"     "This is a beautiful day, isn't it?"

    puts stdout "e\\n[e print]"

    #
    # Create a second entry as a backup of the first, and
    # make some changes on it.
    # Entry is named automatically by snit.
    #

    set b [::ldapx::entry create %AUTO%]
    e backup $b

    puts stdout "$b\\n[$b print]"

    $b del  "anotherAttr"
    $b del1 "objectClass" "anotherObjectClass"

    #
    # Create a change entry, a compute differences between first
    # and second entry.
    #

    ::ldapx::entry create c
    c diff e $b

    puts stdout "$c\\n[$c print]"

    #
    # Apply changes to first entry. It should be the same as the
    # second entry, now.
    #

    e apply c

    ::ldapx::entry create nc
    nc diff e $b

    puts stdout "nc\\n[nc print]"

    #
    # Clean-up
    #

    e destroy
    $b destroy
    c destroy
    nc destroy

.CE
.SH "LDAP CLASS"
.SS "LDAP INSTANCE DATA"
An instance of the \fBldap\fR class keeps the following data:
.TP
channel
This is the channel used by the \fBldap\fR package for
communication with the LDAP server.
.TP
lastError
This variable contains the error message which appeared in
the last method of the \fBldap\fR class (this string is
modified in nearly all methods). The \fBerror\fR method
may be used to fetch this message.
.PP
.SS "LDAP OPTIONS"
A first set of options of the \fBldap\fR class is used during
search operations (methods \fBtraverse\fR, \fBsearch\fR and
\fBread\fR, see below).
.TP
\fB-scope\fR \fBbase\fR|\fBone\fR|\fBsub\fR
Specify the scope of the LDAP search to be one of
\fBbase\fR, \fBone\fR or \fBsub\fR to specify
a base object, one-level or subtree search.
.sp
The default is \fBsub\fR.
.TP
\fB-derefaliases\fR \fBnever\fR|\fBseach\fR|\fBfind\fR|\fBalways\fR
Specify how aliases dereferencing is handled:
\fBnever\fR is used to specify that aliases are never derefenced,
\fBalways\fR that aliases are always derefenced,
\fBsearch\fR that aliases are dereferenced when searching,
or \fBfind\fR that aliases are dereferenced only  when
locating  the  base object for the search.
.sp
The default is \fBnever\fR.
.TP
\fB-sizelimit\fR integer
Specify the maximum number of entries to be retreived
during a search. A value of \fB0\fR means no limit.
.sp
Default is \fB0\fR.
.TP
\fB-timelimit\fR integer
Specify the time limit for a search to complete.
A value of \fB0\fR means no limit.
.sp
Default is \fB0\fR.
.TP
\fB-attrsonly\fR \fB0\fR|\fB1\fR
Specify if only attribute names are to be retrieved (value
\fB1\fR). Normally (value \fB0\fR), attribute values
are also retrieved.
.sp
Default is \fB0\fR.
.PP
.PP
The last option is used when getting entries or committing changes
in the directory:
.TP
\fB-utf8\fR pattern-yes pattern-no
Specify which attribute values are encoded in UTF-8. This
information is specific to the LDAP schema in use by the
application, since some attributes such as jpegPhoto, for
example, are not encoded in UTF-8. This option takes the
form of a list with two regular expressions suitable for
the \fBregexp\fR command (anchored by ^ and $).
The first specifies which attribute names are to be UTF-8
encoded, and the second selects, among those, the attribute
names which will not be UTF-8 encoded.  It is thus possible
to say: convert all attributes, except jpegPhoto.
.sp
Default is {{.*} {}}, meaning: all attributes are converted,
without exception.
.PP
.SS "LDAP METHODS"
.TP
\fIla\fR \fBerror\fR ?\fInewmsg\fR?
This method returns the error message that occurred in the
last call to a \fBldap\fR class method. If the optional
argument \fInewmsg\fR is supplied, it becomes the last
error message.
.TP
\fIla\fR \fBconnect\fR \fIurl\fR ?\fIbinddn\fR? ?\fIbindpw\fR?
This method connects to the LDAP server using given URL
(which can be of the form \fIldap://host:port\fR or
\fIldaps://host:port\fR). If an optional \fIbinddn\fR
argument is given together with the \fIbindpw\fR argument,
the \fBconnect\fR binds to the LDAP server using the
specified DN and password.
.TP
\fIla\fR \fBdisconnect\fR
This method disconnects (and unbinds, if necessary) from
the LDAP server.
.TP
\fIla\fR \fBtraverse\fR \fIbase\fR \fIfilter\fR \fIattrs\fR \fIentry\fR \fIbody\fR
This method is a new control structure. It searches the
LDAP directory from the specified base DN (given by the
\fIbase\fR argument) and selects entries based on the
argument \fIfilter\fR. For each entry found, this method
fetches attributes specified by the \fIattrs\fR argument
(or all attributes if it is an empty list), stores them in
the \fIentry\fR instance of class \fBentry\fR and executes
the script defined by the argument \fIbody\fR. Options are
used to refine the search.
.sp
Caution: when this method is used, the script \fIbody\fR
cannot perform another LDAP search (methods \fBtraverse\fR,
\fBsearch\fR or \fBread\fR).
.TP
\fIla\fR \fBsearch\fR \fIbase\fR \fIfilter\fR \fIattrs\fR
This method searches the directory using the same way as
method \fBtraverse\fR. All found entries are stored in
newly created instances of class \fBentry\fR, which are
returned in a list. The newly created instances should be
destroyed when they are no longer used.
.TP
\fIla\fR \fBread\fR \fIbase\fR \fIfilter\fR \fIentry\fR ... \fIentry\fR
This method reads one or more entries, using the same search
criteria as methods \fBtraverse\fR and \fBsearch\fR.
All attributes are stored in the entries. This method
provides a quick way to read some entries. It returns the
number of entries found in the directory (which may be more
than the number of read entries). If called without any
\fIentry\fR argument, this method just returns the number
of entries found, without returning any data.
.TP
\fIla\fR \fBcommit\fR \fIentry\fR ... \fIentry\fR
This method commits the changes stored in the \fIentry\fR
arguments. Each \fIentry\fR may be either a \fIchange\fR
entry, or a \fIstandard\fR entry with a backup.
.sp
Note: in the future, this method should use the LDAP
transaction extension provided by OpenLDAP 2.3 and later.
.PP
.SS "LDAP EXAMPLE"
.CS


    package require ldapx

    #
    # Connects to the LDAP directory
    #

    ::ldapx::ldap create l
    set url "ldap://server.mycomp.com"
    if {! [l connect $url "cn=admin,o=mycomp" "mypasswd"]} then {
	puts stderr "error: [l error]"
	exit 1
    }

    #
    # Search all entries matching some criterion
    #

    l configure -scope one
    ::ldapx::ldap create e
    set n 0
    l traverse "ou=people,o=mycomp" "(sn=Joe*)" {sn givenName} e {
	puts "dn: [e dn]"
	puts "  sn:        [e get1 sn]"
	puts "  givenName: [e get1 givenName]"
	incr n
    }
    puts "$n entries found"
    e destroy

    #
    # Add a telephone number to some entries
    # Note this modification cannot be done in the "traverse" operation.
    #

    set lent [l search "ou=people,o=mycomp" "(sn=Joe*)" {}]
    ::ldapx::ldap create c
    foreach e $lent {
	$e backup
	$e add1 "telephoneNumber" "+31415926535"
	c diff $e
	if {! [l commit c]} then {
	    puts stderr "error: [l error]"
	    exit 1
	}
	$e destroy
    }

    l disconnect
    l destroy

.CE
.SH "LDIF CLASS"
.SS "LDIF INSTANCE DATA"
An instance of the \fBldif\fR class keeps the following data:
.TP
channel
This is the Tcl channel used to retrieve or store LDIF file
contents. The association between an instance and a channel
is made by the method \fBchannel\fR. There is no need
to disrupt this association when the LDIF file operation
has ended.
.TP
format
LDIF files may contain \fIstandard\fR entries or
\fIchange\fR entries, but not both. This variable contains
the detected format of the file (when reading) or the format
of entries written to the file (when writing).
.TP
lastError
This variable contains the error message which appeared in
the last method of the \fBldif\fR class (this string is
modified in nearly all methods). The \fBerror\fR method
may be used to fetch this message.
.TP
version
This is the version of the LDIF file. Only version 1 is
supported: the method \fBread\fR can only read from
version 1 files, and method \fBwrite\fR only creates
version 1 files.
.PP
.SS "LDIF OPTIONS"
This class defines two options:
.TP
\fB-ignore\fR list-of-attributes
This option is used to ignore certain attribute names on
reading. For example, to read OpenLDAP replica files (replog),
one must ignore \fBreplica\fR and \fBtime\fR attributes
since they do not conform to the RFC 2849 standard for LDIF
files.
.sp
Default is empty list: no attribute is ignored.
.TP
\fB-utf8\fR pattern-yes pattern-no
Specify which attribute values are encoded in UTF-8. This
information is specific to the LDAP schema in use by the
application, since some attributes such as jpegPhoto, for
example, are not encoded in UTF-8. This option takes the
form of a list with two regular expressions suitable for
the \fBregexp\fR command (anchored by ^ and $).
The first specifies which attribute names are to be UTF-8
encoded, and the second selects, among those, the attribute
names which will not be UTF-8 encoded.  It is thus possible
to say: convert all attributes, except jpegPhoto.
.sp
Default is {{.*} {}}, meaning: all attributes are converted,
without exception.
.PP
.SS "LDIF METHODS"
.TP
\fIli\fR \fBchannel\fR \fIchan\fR
This method associates the Tcl channel named \fIchan\fR
with the LDIF instance. It resets the type of LDIF object
to \fIuninitialized\fR.
.TP
\fIli\fR \fBerror\fR ?\fInewmsg\fR?
This method returns the error message that occurred in the
last call to a \fBldif\fR class method. If the optional
argument \fInewmsg\fR is supplied, it becomes the last
error message.
.TP
\fIli\fR \fBread\fR \fIentry\fR
This method reads the next entry from the LDIF file and
stores it in the \fIentry\fR object of class \fBentry\fR.
The entry may be a \fIstandard\fR or \fIchange\fR entry.
.TP
\fIli\fR \fBwrite\fR \fIentry\fR
This method writes the entry given in the argument
\fIentry\fR to the LDIF file.
.PP
.SS "LDIF EXAMPLE"
.CS


    package require ldapx

    # This examples reads a LDIF file containing entries,
    # compare them to a LDAP directory, and writes on standard
    # output an LDIF file containing changes to apply to the
    # LDAP directory to match exactly the LDIF file.

    ::ldapx::ldif create liin
    liin channel stdin

    ::ldapx::ldif create liout
    liout channel stdout

    ::ldapx::ldap create la
    if {! [la connect "ldap://server.mycomp.com"]} then {
	puts stderr "error: [la error]"
	exit 1
    }
    la configure -scope one

    # Reads LDIF file

    ::ldapx::entry create e1
    ::ldapx::entry create e2
    ::ldapx::entry create c

    while {[liin read e1] != 0} {
	set base [e1 superior]
	set id [e1 rdn]
	if {[la read $base "($id)" e2] == 0} then {
	    e2 reset
	}

	c diff e1 e2
	if {[llength [c change]] != 0} then {
	    liout write c
	}
    }

    la disconnect
    la destroy
    e1 destroy
    e2 destroy
    c destroy
    liout destroy
    liin destroy

.CE
.SH REFERENCES
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIldap\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
directory access, internet, ldap, ldap client, ldif, protocol, rfc 2251, rfc 2849
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2006 Pierre David <[email protected]>

.fi

Added embedded/man/files/modules/log/log.n.






















































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/log/log.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2001-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "log" n 1.3 tcllib "Logging facility"
.BS
.SH NAME
log \- Procedures to log messages of libraries and applications.
.SH SYNOPSIS
package require \fBTcl  8\fR
.sp
package require \fBlog  ?1.3?\fR
.sp
\fB::log::levels\fR
.sp
\fB::log::lv2longform\fR \fIlevel\fR
.sp
\fB::log::lv2color\fR \fIlevel\fR
.sp
\fB::log::lv2priority\fR \fIlevel\fR
.sp
\fB::log::lv2cmd\fR \fIlevel\fR
.sp
\fB::log::lv2channel\fR \fIlevel\fR
.sp
\fB::log::lvCompare\fR \fIlevel1\fR \fIlevel2\fR
.sp
\fB::log::lvSuppress\fR \fIlevel\fR {\fIsuppress\fR 1}
.sp
\fB::log::lvSuppressLE\fR \fIlevel\fR {\fIsuppress\fR 1}
.sp
\fB::log::lvIsSuppressed\fR \fIlevel\fR
.sp
\fB::log::lvCmd\fR \fIlevel\fR \fIcmd\fR
.sp
\fB::log::lvCmdForall\fR \fIcmd\fR
.sp
\fB::log::lvChannel\fR \fIlevel\fR \fIchan\fR
.sp
\fB::log::lvChannelForall\fR \fIchan\fR
.sp
\fB::log::lvColor\fR \fIlevel\fR \fIcolor\fR
.sp
\fB::log::lvColorForall\fR \fIcolor\fR
.sp
\fB::log::log\fR \fIlevel\fR \fItext\fR
.sp
\fB::log::logarray\fR \fIlevel\fR \fIarrayvar\fR ?\fIpattern\fR?
.sp
\fB::log::loghex\fR \fIlevel\fR \fItext\fR \fIdata\fR
.sp
\fB::log::logMsg\fR \fItext\fR
.sp
\fB::log::logError\fR \fItext\fR
.sp
\fB::log::Puts\fR \fIlevel\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBlog\fR package provides commands that allow libraries and
applications to selectively log information about their internal
operation and state.
.PP
To use the package just execute
.PP
.CS


    package require log
    log::log notice "Some message"

.CE
.PP
As can be seen above, each message given to the log facility is
associated with a \fIlevel\fR determining the importance of the
message. The user can then select which levels to log, what commands
to use for the logging of each level and the channel to write the
message to. In the following example the logging of all message with
level \fBdebug\fR is deactivated.
.PP
.CS


    package require log
    log::lvSuppress debug
    log::log debug "Unseen message" ; # No output

.CE
.PP
By default all messages associated with an error-level
(\fBemergency\fR, \fBalert\fR, \fBcritical\fR, and
\fBerror\fR) are written to \fBstderr\fR. Messages with any
other level are written to \fBstdout\fR. In the following example
the log module is reconfigured to write \fBdebug\fR messages to
\fBstderr\fR too.
.PP
.CS


    package require log
    log::lvChannel debug stderr
    log::log debug "Written to stderr"

.CE
.PP
Each message level is also associated with a command to use when
logging a message with that level. The behaviour above for example
relies on the fact that all message levels use by default the standard
command \fB::log::Puts\fR to log any message. In the following example
all messages of level \fBnotice\fR are given to the non-standard
command \fBtoText\fR for logging. This disables the channel setting
for such messages, assuming that \fBtoText\fR does not use it by
itself.
.PP
.CS


    package require log
    log::lvCmd notice toText
    log::log notice "Handled by \\"toText\\""

.CE
.PP
Another database maintained by this facility is a map from message
levels to colors. The information in this database has \fIno\fR
influence on the behaviour of the module. It is merely provided as a
convenience and in anticipation of the usage of this facility in
\fBtk\fR-based application which may want to colorize message
logs.
.SH API
.PP
The following commands are available:
.TP
\fB::log::levels\fR
Returns the names of all known levels, in alphabetical order.
.TP
\fB::log::lv2longform\fR \fIlevel\fR
Converts any unique abbreviation of a level name to the full level
name.
.TP
\fB::log::lv2color\fR \fIlevel\fR
Converts any level name including unique abbreviations to the
corresponding color.
.TP
\fB::log::lv2priority\fR \fIlevel\fR
Converts any level name including unique abbreviations to the
corresponding priority.
.TP
\fB::log::lv2cmd\fR \fIlevel\fR
Converts any level name including unique abbreviations to the command
prefix used to write messages with that level.
.TP
\fB::log::lv2channel\fR \fIlevel\fR
Converts any level name including unique abbreviations to the channel
used by \fB::log::Puts\fR to write messages with that level.
.TP
\fB::log::lvCompare\fR \fIlevel1\fR \fIlevel2\fR
Compares two levels (including unique abbreviations) with respect to
their priority. This command can be used by the -command option of
lsort. The result is one of -1, 0 or 1 or an error. A result of -1
signals that level1 is of less priority than level2. 0 signals that
both levels have the same priority. 1 signals that level1 has higher
priority than level2.
.TP
\fB::log::lvSuppress\fR \fIlevel\fR {\fIsuppress\fR 1}
]
(Un)suppresses the output of messages having the specified
level. Unique abbreviations for the level are allowed here too.
.TP
\fB::log::lvSuppressLE\fR \fIlevel\fR {\fIsuppress\fR 1}
]
(Un)suppresses the output of messages having the specified level or
one of lesser priority. Unique abbreviations for the level are allowed
here too.
.TP
\fB::log::lvIsSuppressed\fR \fIlevel\fR
Asks the package whether the specified level is currently
suppressed. Unique abbreviations of level names are allowed.
.TP
\fB::log::lvCmd\fR \fIlevel\fR \fIcmd\fR
Defines for the specified level with which command to write the
messages having this level. Unique abbreviations of level names are
allowed. The command is actually a command prefix and this facility
will append 2 arguments before calling it, the level of the message
and the message itself, in this order.
.TP
\fB::log::lvCmdForall\fR \fIcmd\fR
Defines for all known levels with which command to write the messages
having this level. The command is actually a command prefix and this
facility will append 2 arguments before calling it, the level of the
message and the message itself, in this order.
.TP
\fB::log::lvChannel\fR \fIlevel\fR \fIchan\fR
Defines for the specified level into which channel \fB::log::Puts\fR
(the standard command) shall write the messages having this
level. Unique abbreviations of level names are allowed. The command is
actually a command prefix and this facility will append 2 arguments
before calling it, the level of the message and the message itself, in
this order.
.TP
\fB::log::lvChannelForall\fR \fIchan\fR
Defines for all known levels with which which channel
\fB::log::Puts\fR (the standard command) shall write the messages
having this level. The command is actually a command prefix and this
facility will append 2 arguments before calling it, the level of the
message and the message itself, in this order.
.TP
\fB::log::lvColor\fR \fIlevel\fR \fIcolor\fR
Defines for the specified level the color to return for it in a call
to \fB::log::lv2color\fR. Unique abbreviations of level names are
allowed.
.TP
\fB::log::lvColorForall\fR \fIcolor\fR
Defines for all known levels the color to return for it in a call to
\fB::log::lv2color\fR. Unique abbreviations of level names are
allowed.
.TP
\fB::log::log\fR \fIlevel\fR \fItext\fR
Log a message according to the specifications for commands, channels
and suppression. In other words: The command will do nothing if the
specified level is suppressed. If it is not suppressed the actual
logging is delegated to the specified command. If there is no command
specified for the level the message won't be logged. The standard
command \fB::log::Puts\fR will write the message to the channel
specified for the given level. If no channel is specified for the
level the message won't be logged. Unique abbreviations of level names
are allowed. Errors in the actual logging command are \fInot\fR
caught, but propagated to the caller, as they may indicate
misconfigurations of the log facility or errors in the callers code
itself.
.TP
\fB::log::logarray\fR \fIlevel\fR \fIarrayvar\fR ?\fIpattern\fR?
Like \fB::log::log\fR, but logs the contents of the specified array
variable \fIarrayvar\fR, possibly restricted to entries matching the
\fIpattern\fR. The pattern defaults to \fB*\fR (i.e. all entries) if
none was specified.
.TP
\fB::log::loghex\fR \fIlevel\fR \fItext\fR \fIdata\fR
Like \fB::log::log\fR, but assumes that \fIdata\fR contains binary
data. It converts this into a mixed hex/ascii representation before
writing them to the log.
.TP
\fB::log::logMsg\fR \fItext\fR
Convenience wrapper around \fB::log::log\fR.
Equivalent to \fB::log::log info text\fR.
.TP
\fB::log::logError\fR \fItext\fR
Convenience wrapper around \fB::log::log\fR.
Equivalent to \fB::log::log error text\fR.
.TP
\fB::log::Puts\fR \fIlevel\fR \fItext\fR
The standard log command, it writes messages and their levels to
user-specified channels. Assumes that the suppression checks were done
by the caller. Expects full level names, abbreviations are
\fInot allowed\fR.
.PP
.SH LEVELS
The package currently defines the following log levels, the level of
highest importance listed first.
.IP \(bu
emergency
.IP \(bu
alert
.IP \(bu
critical
.IP \(bu
error
.IP \(bu
warning
.IP \(bu
notice
.IP \(bu
info
.IP \(bu
debug
.PP
\fINote\fR that by default all messages with levels \fBwarning\fR down to
\fBdebug\fR are suppressed. This is done intentionally, because (we believe
that) in most situations debugging output is not wanted. Most people wish to
have such output only when actually debugging an application.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIlog\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
log, log level, message, message level
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2001-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/log/logger.n.















































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/log/logger.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "logger" n 0.9.3 tcllib "Object Oriented logging facility"
.BS
.SH NAME
logger \- System to control logging of events.
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBlogger  ?0.9.3?\fR
.sp
\fBlogger::init\fR \fIservice\fR
.sp
\fBlogger::import\fR ?\fB-all\fR? ?\fB-force\fR? ?\fB-prefix\fR \fIprefix\fR? ?\fB-namespace\fR \fInamespace\fR? \fIservice\fR
.sp
\fBlogger::initNamespace\fR \fIns\fR ?\fIlevel\fR?
.sp
\fBlogger::services\fR
.sp
\fBlogger::enable\fR \fIlevel\fR
.sp
\fBlogger::disable\fR \fIlevel\fR
.sp
\fBlogger::setlevel\fR \fIlevel\fR
.sp
\fBlogger::levels\fR
.sp
\fBlogger::servicecmd\fR \fIservice\fR
.sp
\fB${log}::debug\fR \fImessage\fR
.sp
\fB${log}::info\fR \fImessage\fR
.sp
\fB${log}::notice\fR \fImessage\fR
.sp
\fB${log}::warn\fR \fImessage\fR
.sp
\fB${log}::error\fR \fImessage\fR
.sp
\fB${log}::critical\fR \fImessage\fR
.sp
\fB${log}::alert\fR \fImessage\fR
.sp
\fB${log}::emergency\fR \fImessage\fR
.sp
\fB${log}::setlevel\fR \fIlevel\fR
.sp
\fB${log}::enable\fR \fIlevel\fR
.sp
\fB${log}::disable\fR \fIlevel\fR
.sp
\fB${log}::lvlchangeproc\fR \fIcommand\fR
.sp
\fB${log}::lvlchangeproc\fR
.sp
\fB${log}::logproc\fR \fIlevel\fR
.sp
\fB${log}::logproc\fR \fIlevel\fR \fIcommand\fR
.sp
\fB${log}::logproc\fR \fIlevel\fR \fIargname\fR \fIbody\fR
.sp
\fB${log}::services\fR
.sp
\fB${log}::servicename\fR
.sp
\fB${log}::currentloglevel\fR
.sp
\fB${log}::delproc\fR \fIcommand\fR
.sp
\fB${log}::delproc\fR
.sp
\fB${log}::delete\fR
.sp
\fB${log}::trace\fR \fIcommand\fR
.sp
\fB${log}::trace\fR \fBon\fR
.sp
\fB${log}::trace\fR \fBoff\fR
.sp
\fB${log}::trace\fR \fBstatus\fR ?procName? ?...?
.sp
\fB${log}::trace\fR \fBadd\fR \fIprocName\fR ?...?
.sp
\fB${log}::trace\fR \fBadd\fR ?-ns? \fInsName\fR ?...?
.sp
\fB${log}::trace\fR \fBremove\fR \fIprocName\fR ?...?
.sp
\fB${log}::trace\fR \fBremove\fR ?-ns? \fInsName\fR ?...?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBlogger\fR package provides a flexible system for logging messages
from different services, at priority levels, with different commands.
.PP
To begin using the logger package, we do the following:
.PP
.CS


    package require logger
    set log [logger::init myservice]
    ${log}::notice "Initialized myservice logging"

    ... code ...

    ${log}::notice "Ending myservice logging"
    ${log}::delete

.CE
.PP
In the above code, after the package is loaded, the following things
happen:
.TP
\fBlogger::init\fR \fIservice\fR
Initializes the service \fIservice\fR for logging.  The service names
are actually Tcl namespace names, so they are separated with '::'.
The service name may not be the empty string or only ':'s.
When a logger service is initialized, it "inherits" properties from its
parents.  For instance, if there were a service \fIfoo\fR, and
we did a \fBlogger::init\fR \fIfoo::bar\fR (to create a \fIbar\fR
service underneath \fIfoo\fR), \fIbar\fR would copy the current
configuration of the \fIfoo\fR service, although it would of
course, also be possible to then separately configure \fIbar\fR.
If a logger service is initialized and the parent does not yet exist, the
parent is also created.
The new logger service is initialized with the default loglevel set
with \fBlogger::setlevel\fR.
.TP
\fBlogger::import\fR ?\fB-all\fR? ?\fB-force\fR? ?\fB-prefix\fR \fIprefix\fR? ?\fB-namespace\fR \fInamespace\fR? \fIservice\fR
Import the logger service commands into the current namespace. Without the \fB-all\fR option
only the commands corresponding to the log levels are imported. If \fB-all\fR is given,
all the \fB${log}::cmd\fR style commands are imported. If the import would overwrite a command
an error is returned and no command is imported. Use the \fB-force\fR option to force the import
and overwrite existing commands without complaining.
If the \fB-prefix\fR option is given, the commands are imported with the given \fIprefix\fR
prepended to their names.
If the \fB-namespace\fR option is given, the commands are imported into the given namespace. If the
namespace does not exist, it is created. If a namespace without a leading :: is given, it is interpreted as
a child namespace to the current namespace.
.TP
\fBlogger::initNamespace\fR \fIns\fR ?\fIlevel\fR?
Convenience command for setting up a namespace for logging. Creates a
logger service named after the namespace \fIns\fR (a :: prefix is
stripped), imports all the log commands into the namespace, and sets
the default logging level, either to the specified \fIlevel\fR, or the
default level, "warn".
.TP
\fBlogger::services\fR
Returns a list of all the available services.
.TP
\fBlogger::enable\fR \fIlevel\fR
Globally enables logging at and "above" the given level.  Levels are
\fBdebug\fR, \fBinfo\fR, \fBnotice\fR, \fBwarn\fR, \fBerror\fR,
\fBcritical\fR, \fBalert\fR, \fBemergency\fR.
.TP
\fBlogger::disable\fR \fIlevel\fR
Globally disables logging at and "below" the given level.  Levels are
those listed above.
.TP
\fBlogger::setlevel\fR \fIlevel\fR
Globally enable logging at and "above" the given level. Levels are those
listed above. This command changes the default loglevel for new loggers
created with \fBlogger::init\fR.
.TP
\fBlogger::levels\fR
Returns a list of the available log levels (also listed above under \fBenable\fR).
.TP
\fBlogger::servicecmd\fR \fIservice\fR
Returns the \fB${log}\fR token created by \fBlogger::init\fR for this service.
.TP
\fB${log}::debug\fR \fImessage\fR
.TP
\fB${log}::info\fR \fImessage\fR
.TP
\fB${log}::notice\fR \fImessage\fR
.TP
\fB${log}::warn\fR \fImessage\fR
.TP
\fB${log}::error\fR \fImessage\fR
.TP
\fB${log}::critical\fR \fImessage\fR
.TP
\fB${log}::alert\fR \fImessage\fR
.TP
\fB${log}::emergency\fR \fImessage\fR
These are the commands called to actually log a message about an
event.  \fB${log}\fR is the variable obtained from \fBlogger::init\fR.
.TP
\fB${log}::setlevel\fR \fIlevel\fR
Enable logging, in the service referenced by \fB${log}\fR, and its
children, at and above the level specified, and disable logging below
it.
.TP
\fB${log}::enable\fR \fIlevel\fR
Enable logging, in the service referenced by \fB${log}\fR, and its
children, at and above the level specified.  Note that this does \fInot\fR disable logging below this level, so you should probably use
\fBsetlevel\fR instead.
.TP
\fB${log}::disable\fR \fIlevel\fR
Disable logging, in the service referenced by \fB${log}\fR, and its
children, at and below the level specified. Note that this does \fInot\fR enable logging above this level,
so you should probably use \fBsetlevel\fR instead.
Disabling the loglevel \fBemergency\fR switches logging off for the service and its children.
.TP
\fB${log}::lvlchangeproc\fR \fIcommand\fR
.TP
\fB${log}::lvlchangeproc\fR
Set the script to call when the log instance in question changes its log level.
If called without a command it returns the currently registered command. The command gets two arguments
appended, the old and the new loglevel. The callback is invoked after all changes have been done.
If child loggers are affected, their callbacks are called before their parents callback.
.CS


 	proc lvlcallback {old new} {
 	    puts "Loglevel changed from $old to $new"
 	}
 	${log}::lvlchangeproc lvlcallback

.CE
.TP
\fB${log}::logproc\fR \fIlevel\fR
.TP
\fB${log}::logproc\fR \fIlevel\fR \fIcommand\fR
.TP
\fB${log}::logproc\fR \fIlevel\fR \fIargname\fR \fIbody\fR
This command comes in three forms - the third, older one is deprecated
and may be removed from future versions of the logger package.
The current set version takes one argument, a command to be executed when the
level is called.  The callback command takes on argument, the text to
be logged. If called only with a valid level \fBlogproc\fR returns the name of the command
currently registered as callback command.
\fBlogproc\fR specifies which command will perform the actual logging
for a given level.  The logger package ships with default commands for
all log levels, but with \fBlogproc\fR it is possible to replace them
with custom code.  This would let you send your logs over the network,
to a database, or anything else.  For example:
.CS


    proc logtoserver {txt} {
        variable socket
        puts $socket "Notice: $txt"
    }

    ${log}::logproc notice logtoserver

.CE
.IP
Trace logs are slightly different: instead of a plain text argument,
the argument provided to the logproc is a dictionary consisting of the
\fBenter\fR or \fBleave\fR keyword along with another dictionary of
details about the trace.  These include:
.RS
.IP \(bu
\fBproc\fR - Name of the procedure being traced.
.IP \(bu
\fBlevel\fR - The stack level for the procedure invocation
(from \fBinfo\fR \fBlevel\fR).
.IP \(bu
\fBscript\fR - The name of the file in which the procedure is
defined, or an empty string if defined in interactive mode.
.IP \(bu
\fBcaller\fR - The name of the procedure calling the procedure
being traced, or an empty string if the procedure was called from the
global scope (stack level 0).
.IP \(bu
\fBprocargs\fR - A dictionary consisting of the names of arguments
to the procedure paired with values given for those arguments (\fBenter\fR
traces only).
.IP \(bu
\fBstatus\fR - The Tcl return code (e.g. \fBok\fR,
\fBcontinue\fR, etc.) (\fBleave\fR traces only).
.IP \(bu
\fBresult\fR - The value returned by the procedure (\fBleave\fR
traces only).
.RE
.TP
\fB${log}::services\fR
Returns a list of the registered logging services which are children of this service.
.TP
\fB${log}::servicename\fR
Returns the name of this service.
.TP
\fB${log}::currentloglevel\fR
Returns the currently enabled log level for this service. If no logging is enabled returns \fBnone\fR.
.TP
\fB${log}::delproc\fR \fIcommand\fR
.TP
\fB${log}::delproc\fR
Set the script to call when the log instance in question is deleted.
If called without a command it returns the currently registered command.
For example:
.CS


    ${log}::delproc [list closesock $logsock]

.CE
.TP
\fB${log}::delete\fR
This command deletes a particular logging service, and its children.
You must call this to clean up the resources used by a service.
.TP
\fB${log}::trace\fR \fIcommand\fR
This command controls logging of enter/leave traces for specified procedures.
It is used to enable and disable tracing, query tracing status, and
specify procedures are to be traced.  Trace handlers are unregistered when
tracing is disabled.  As a result, there is not performance impact to a
library when tracing is disabled, just as with other log level commands.
.CS


  proc tracecmd { dict } {
      puts $dict
  }

  set log [::logger::init example]
  ${log}::logproc trace tracecmd

  proc foo { args } {
      puts "In foo"
      bar 1
      return "foo_result"
  }

  proc bar { x } {
      puts "In bar"
      return "bar_result"
  }

  ${log}::trace add foo bar
  ${log}::trace on

  foo

# Output:
enter {proc ::foo level 1 script {} caller {} procargs {args {}}}
In foo
enter {proc ::bar level 2 script {} caller ::foo procargs {x 1}}
In bar
leave {proc ::bar level 2 script {} caller ::foo status ok result bar_result}
leave {proc ::foo level 1 script {} caller {} status ok result foo_result}

.CE
.TP
\fB${log}::trace\fR \fBon\fR
Turns on trace logging for procedures registered through the \fBtrace\fR
\fBadd\fR command.  This is similar to the \fBenable\fR command for other
logging levels, but allows trace logging to take place at any level.
The trace logging mechanism takes advantage of the execution trace feature
of Tcl 8.4 and later.  The \fBtrace\fR \fBon\fR command will return an
error if called from earlier versions of Tcl.
.TP
\fB${log}::trace\fR \fBoff\fR
Turns off trace logging for procedures registered for trace logging
through the \fBtrace\fR \fBadd\fR command.  This is similar to the
\fBdisable\fR command for other logging levels, but allows trace logging
to take place at any level.
Procedures are not unregistered, so logging for them can be turned back
on with the \fBtrace\fR \fBon\fR command.  There is no overhead imposed
by trace registration when trace logging is disabled.
.TP
\fB${log}::trace\fR \fBstatus\fR ?procName? ?...?
This command returns a list of the procedures currently registered for
trace logging, or a flag indicating whether or not a trace is registered
for one or more specified procedures.
.TP
\fB${log}::trace\fR \fBadd\fR \fIprocName\fR ?...?
.TP
\fB${log}::trace\fR \fBadd\fR ?-ns? \fInsName\fR ?...?
This command registers one or more procedures for logging of entry/exit
traces.  Procedures can be specified via a list of procedure names or
namespace names (in which case all procedure within the namespace
are targeted by the operation).  By default, each name is first
interpreted as a procedure name or glob-style search pattern, and if
not found its interpreted as a namespace name.  The \fI-ns\fR option can
be used to force interpretation of all provided arguments as namespace names.
Procedures must be defined prior to registering them for tracing
through the \fBtrace\fR \fBadd\fR command.  Any procedure or namespace
names/patterns that don't match any existing procedures will be
silently ignored.
.TP
\fB${log}::trace\fR \fBremove\fR \fIprocName\fR ?...?
.TP
\fB${log}::trace\fR \fBremove\fR ?-ns? \fInsName\fR ?...?
This command unregisters one or more procedures so that they will no
longer have trace logging performed, with the same matching rules as
that of the \fBtrace\fR \fBadd\fR command.
.PP
.SH IMPLEMENTATION
The logger package is implemented in such a way as to optimize (for
Tcl 8.4 and newer) log procedures which are disabled.  They are
aliased to a proc which has no body, which is compiled to a no op in
bytecode.  This should make the peformance hit minimal.  If you really
want to pull out all the stops, you can replace the ${log} token in
your code with the actual namespace and command (${log}::warn becomes
::logger::tree::myservice::warn), so that no variable lookup is done.
This puts the performance of disabled logger commands very close to no
logging at all.
.PP
The "object orientation" is done through a hierarchy of namespaces.
Using an actual object oriented system would probably be a better way
of doing things, or at least provide for a cleaner implementation.
.PP
The service "object orientation" is done with namespaces.
.SH "LOGPROCS AND CALLSTACK"
The logger package takes extra care to keep the logproc out of the call stack.
This enables logprocs to execute code in the callers scope by using uplevel or
linking to local variables by using upvar. This may fire traces with all usual
side effects.
.CS


     # Print caller and current vars in the calling proc
     proc log_local_var {txt} {
          set caller [info level -1]
          set vars [uplevel 1 info vars]
          foreach var [lsort $vars] {
             if {[uplevel 1 [list array exists $var]] == 1} {
             	lappend val $var <Array>
             } else {
             	lappend val $var [uplevel 1 [list set $var]]
             }
          }
          puts "$txt"
          puts "Caller: $caller"
          puts "Variables in callers scope:"
          foreach {var value} $val {
          	puts "$var = $value"
          }
     }

     # install as logproc
     ${log}::logproc debug log_local_var

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIlogger\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
log, log level, logger, service
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/log/loggerAppender.n.














































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/log/loggerAppender.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Aamer Akhter <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "logger::appender" n 1.2 tcllib "Object Oriented logging facility"
.BS
.SH NAME
logger::appender \- Collection of predefined appenders for logger
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBlogger::appender  ?1.2?\fR
.sp
\fB::logger::appender::console\fR \fB-level\fR \fIlevel\fR \fB-service\fR \fIservice\fR ?\fIoptions\fR...?
.sp
\fB::logger::appender::colorConsole\fR \fB-level\fR \fIlevel\fR \fB-service\fR \fIservice\fR ?\fIoptions\fR...?
.sp
.BE
.SH DESCRIPTION
This package provides a predefined set of logger templates.
.TP
\fB::logger::appender::console\fR \fB-level\fR \fIlevel\fR \fB-service\fR \fIservice\fR ?\fIoptions\fR...?
.RS
.TP
\fB-level\fR level
Name of the level to fill in as "priority" in the log procedure.
.TP
\fB-service\fR service
Name of the service to fill in as "category" in the log procedure.
.TP
\fB-appenderArgs\fR appenderArgs
Any additional arguments for the log procedure in list form
.TP
\fB-conversionPattern\fR conversionPattern
The log pattern to use (see \fBlogger::utils::createLogProc\fR for the
allowed substitutions).
.TP
\fB-procName\fR procName
Explicitly set the name of the created procedure.
.TP
\fB-procNameVar\fR procNameVar
Name of the variable to set in the calling context. This variable will
contain the name of the procedure.
.RE
.TP
\fB::logger::appender::colorConsole\fR \fB-level\fR \fIlevel\fR \fB-service\fR \fIservice\fR ?\fIoptions\fR...?
See \fB::logger::appender::colorConsole\fR for a description of the
applicable options.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIlogger\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
appender, logger
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2005 Aamer Akhter <[email protected]>

.fi

Added embedded/man/files/modules/log/loggerUtils.n.












































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/log/loggerUtils.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Aamer Akhter <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "logger::utils" n 1.3 tcllib "Object Oriented logging facility"
.BS
.SH NAME
logger::utils \- Utilities for logger
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBlogger::utils  ?1.3?\fR
.sp
\fB::logger::utils::createFormatCmd\fR \fIformatString\fR
.sp
\fB::logger::utils::createLogProc\fR \fB-procName\fR \fIprocName\fR ?\fIoptions\fR...?
.sp
\fB::logger::utils::applyAppender\fR \fB-appender\fR \fIappenderType\fR ?\fIoptions\fR...?
.sp
\fB::logger::utils::autoApplyAppender\fR \fIcommand\fR \fIcommand-string\fR \fIlog\fR \fIop\fR \fIargs\fR...
.sp
.BE
.SH DESCRIPTION
This package adds template based \fIappenders\fR.
.TP
\fB::logger::utils::createFormatCmd\fR \fIformatString\fR
This command translates \fIformatString\fR into an expandable command
string.
The following strings are the known substitutions (from log4perl)
allowed to occur in the \fIformatString\fR:
.RS
.TP
%c
Category of the logging event
.TP
%C
Fully qualified name of logging event
.TP
%d
Current date in yyyy/MM/dd hh:mm:ss
.TP
%H
Hostname
.TP
%m
Message to be logged
.TP
%M
Method where logging event was issued
.TP
%p
Priority of logging event
.TP
%P
Pid of current process
.RE
.TP
\fB::logger::utils::createLogProc\fR \fB-procName\fR \fIprocName\fR ?\fIoptions\fR...?
This command ...
.RS
.TP
\fB-procName\fR procName
The name of the procedure to create.
.TP
\fB-conversionPattern\fR pattern
See \fB::logger::utils::createFormatCmd\fR for the substitutions
allowed in the \fIpattern\fR.
.TP
\fB-category\fR category
The category (service).
.TP
\fB-priority\fR priority
The priority (level).
.TP
\fB-outputChannel\fR channel
channel to output on (default stdout)
.RE
.TP
\fB::logger::utils::applyAppender\fR \fB-appender\fR \fIappenderType\fR ?\fIoptions\fR...?
This command will create an appender for the specified logger
services. If no service is specified then the appender will be added
as the default appender for the specified levels. If no levels are
specified, then all levels are assumed.
.sp
.RS
.TP
\fB-service\fR loggerservices
.TP
\fB-serviceCmd\fR loggerserviceCmds
Name of the logger instance to modify. \fB-serviceCmd\fR takes as
input the return of \fBlogger::init\fR.
.TP
\fB-appender\fR appenderType
Type of the appender to use.
One of \fBconsole\fR, \fBcolorConsole\fR.
.TP
\fB-conversionPattern\fR pattern
See \fB::logger::utils::createFormatCmd\fR for the
format of the pattern. If this option is not provided
the default pattern
.CS

[%d] [%c] [%M] [%p] %m
.CE
.IP
is used.
.TP
\fB-levels\fR levelList
The list of levels to apply this appender to. If not specified all
levels are assumed.
.RE
.sp
Example of usage:
.sp
.CS


   % set log [logger::init testLog]
   ::logger::tree::testLog
   % logger::utils::applyAppender -appender console -serviceCmd $log
   % ${log}::error "this is an error"
   [2005/08/22 10:14:13] [testLog] [global] [error] this is an error

.CE
.TP
\fB::logger::utils::autoApplyAppender\fR \fIcommand\fR \fIcommand-string\fR \fIlog\fR \fIop\fR \fIargs\fR...
This command is designed to be added via \fBtrace leave\fR to calls
of \fBlogger::init\fR. It will look at preconfigured state (via
\fB::logger::utils::applyAppender\fR) to autocreate appenders for
newly created logger instances.
It will return its argument \fIlog\fR.
.sp
Example of usage:
.sp
.CS


  logger::utils::applyAppender -appender console
  set log [logger::init applyAppender-3]
  ${log}::error "this is an error"

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIlogger\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
appender, logger
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2005 Aamer Akhter <[email protected]>

.fi

Added embedded/man/files/modules/map/map_geocode_nominatim.n.







































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/map/map_geocode_nominatim.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "map::geocode::nominatim" n 0.1 tcllib "Mapping utilities"
.BS
.SH NAME
map::geocode::nominatim \- Resolving geographical names with a Nominatim service
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBhttp \fR
.sp
package require \fBjson \fR
.sp
package require \fBuri \fR
.sp
package require \fBsnit \fR
.sp
package require \fBmap::geocode::nominatim  ?0.1?\fR
.sp
\fB::map::geocode::nominatim\fR \fIrequestor\fR ?\fB-baseurl\fR \fIurl\fR? ?\fB-callback\fR \fIcallback\fR? ?\fB-error\fR \fIerror callback\fR?
.sp
\fB$cmdprefix\fR \fIresult\fR
.sp
\fB$cmdprefix\fR \fIerrorstring\fR
.sp
\fIrequestor\fR \fBsearch\fR \fIquery\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for accessing geocoding services which implement
the \fINominatim\fR interface (see \fBReferences\fR)
.SH API
.TP
\fB::map::geocode::nominatim\fR \fIrequestor\fR ?\fB-baseurl\fR \fIurl\fR? ?\fB-callback\fR \fIcallback\fR? ?\fB-error\fR \fIerror callback\fR?
Creates a geocoding request object \fIrequestor\fR, which will send its requests to
the \fINominatim\fR server.
.sp
The result of the command is \fIname\fR.
.PP
.SS OPTIONS
.TP
\fB-baseurl\fR \fIurl\fR
The base URL of the \fINominatim\fR service. Default value is \fIOpenStreetMap's\fR service at
\fIhttp://nominatim.openstreetmap.org/search\fR A possible free alternative is at
\fIhttp://open.mapquestapi.com//nominatim/v1/search\fR
.TP
\fB-callback\fR \fIcmdprefix\fR
A command prefix to be invoked when search result become available.
The default setting, active when nothing was specified on object creation, is to print
the \fIresult\fR (see below) to \fIstdout\fR. The result of the command prefix is
ignored. Errors thrown by the command prefix are caught and cause the invokation of
the error callback (see option \fB-error\fR below), with the error message as argument.
.sp
The signature of the command prefix is:
.RS
.TP
\fB$cmdprefix\fR \fIresult\fR
The \fIresult\fR is a list of dictionaries, containing one item per hit.
Each dictionary will have the following entries:
.RS
.TP
place_id
The place ID (FIXME: what's this?)
.TP
licence
The data licence string
.TP
osm_type
The OSM type of the location
.TP
osm_id
FIXME
.TP
boundingbox
The coordinates of the bounding box (min and max latitude, min and max longitude)
.TP
lat
The location's latitude
.TP
lon
The location's longitude
.TP
display_name
the location's human readable name
.TP
class
FIXME
.TP
type
FIXME
.TP
icon
FIXME
.RE
.RE
.TP
\fB-error\fR \fIcmdprefix\fR
A command prefix to be invoked when encountering errors. Typically these are HTTP errors.
The default setting, active when nothing was specified on object creation, is to print
the \fIerrorstring\fR (see below) to \fIstderr\fR. The result of the command prefix is
ignored. Errors thrown by the command prefix are passed to higher levels.
.sp
The signature of the command prefix is:
.RS
.TP
\fB$cmdprefix\fR \fIerrorstring\fR
.RE
.PP
.SS METHODS
.TP
\fIrequestor\fR \fBsearch\fR \fIquery\fR
This method returns a list of dictionaries, one item per hit for the specified \fIquery\fR.
.PP
.SH REFERENCES
.IP [1]
\fIhttp://wiki.openstreetmap.org/wiki/Nominatim\fR
.IP [2]
\fIhttp://open.mapquestapi.com/nominatim/\fR
.PP
.SH KEYWORDS
geocoding, http, location, map, nominatim, server, url

Added embedded/man/files/modules/map/map_slippy.n.






































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/map/map_slippy.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "map::slippy" n 0.5 tcllib "Mapping utilities"
.BS
.SH NAME
map::slippy \- Common code for slippy based map packages
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBTk  8.4\fR
.sp
package require \fBmap::slippy  ?0.5?\fR
.sp
\fB::map::slippy\fR \fBlength\fR \fIlevel\fR
.sp
\fB::map::slippy\fR \fBtiles\fR \fIlevel\fR
.sp
\fB::map::slippy\fR \fBtile size\fR
.sp
\fB::map::slippy\fR \fBtile valid\fR \fItile\fR \fIlevels\fR ?\fImsgvar\fR?
.sp
\fB::map::slippy\fR \fBgeo 2tile\fR \fIgeo\fR
.sp
\fB::map::slippy\fR \fBgeo 2tile.float\fR \fIgeo\fR
.sp
\fB::map::slippy\fR \fBgeo 2point\fR \fIgeo\fR
.sp
\fB::map::slippy\fR \fBtile 2geo\fR \fItile\fR
.sp
\fB::map::slippy\fR \fBtile 2point\fR \fItile\fR
.sp
\fB::map::slippy\fR \fBpoint 2geo\fR \fIpoint\fR
.sp
\fB::map::slippy\fR \fBpoint 2tile\fR \fIpoint\fR
.sp
\fB::map::slippy\fR \fBfit geobox\fR \fIcanvdim\fR \fIgeobox\fR \fIzmin\fR \fIzmax\fR
.sp
.BE
.SH DESCRIPTION
This package provides a number of methods doing things needed by all
types of slippy-based map packages.
.SH API
.TP
\fB::map::slippy\fR \fBlength\fR \fIlevel\fR
This method returns the width/height of a slippy-based map at the
specified zoom \fIlevel\fR, in pixels. This is, in essence, the result
of
.CS


	expr { [tiles $level] * [tile size] }

.CE
.TP
\fB::map::slippy\fR \fBtiles\fR \fIlevel\fR
This method returns the width/height of a slippy-based map at the
specified zoom \fIlevel\fR, in \fItiles\fR.
.TP
\fB::map::slippy\fR \fBtile size\fR
This method returns the width/height of a tile in a slippy-based map,
in pixels.
.TP
\fB::map::slippy\fR \fBtile valid\fR \fItile\fR \fIlevels\fR ?\fImsgvar\fR?
This method checks whether \fItile\fR described a valid tile in a
slippy-based map containing that many zoom \fIlevels\fR. The result is
a boolean value, \fBtrue\fR if the tile is valid, and \fBfalse\fR
otherwise. For the latter a message is left in the variable named by
\fImsgvar\fR, should it be specified.
.sp
A tile identifier as stored in \fItile\fR is a list containing zoom
level, tile row, and tile column, in this order. The command
essentially checks this, i.e. the syntax, that the zoom level is
between 0 and "\fIlevels\fR-1", and that the row/col information is
within the boundaries for the zoom level, i.e. 0 ...
"[tiles $zoom]-1".
.TP
\fB::map::slippy\fR \fBgeo 2tile\fR \fIgeo\fR
Converts a geographical location at a zoom level (\fIgeo\fR, a list
containing zoom level, latitude, and longitude, in this order) to a
tile identifier (list containing zoom level, row, and column) at that
level. The tile identifier uses pure integer numbers for the tile
coordinates, for all geographic coordinates mapping to that tile.
.TP
\fB::map::slippy\fR \fBgeo 2tile.float\fR \fIgeo\fR
Converts a geographical location at a zoom level (\fIgeo\fR, a list
containing zoom level, latitude, and longitude, in this order) to a
tile identifier (list containing zoom level, row, and column) at that
level. The tile identifier uses floating point numbers for the tile
coordinates, representing not only the tile the geographic coordinates
map to, but also the fractional location inside of that tile.
.TP
\fB::map::slippy\fR \fBgeo 2point\fR \fIgeo\fR
Converts a geographical location at a zoom level (\fIgeo\fR, a list
containing zoom level, latitude, and longitude, in this order) to a
pixel position (list containing zoom level, y, and x) at that level.
.TP
\fB::map::slippy\fR \fBtile 2geo\fR \fItile\fR
Converts a tile identifier at a zoom level (\fItile\fR, list
containing zoom level, row, and column) to a geographical location
(list containing zoom level, latitude, and longitude, in this order)
at that level.
.TP
\fB::map::slippy\fR \fBtile 2point\fR \fItile\fR
Converts a tile identifier at a zoom level (\fItile\fR, a list
containing zoom level, row, and column, in this order) to a pixel
position (list containing zoom level, y, and x) at that level.
.TP
\fB::map::slippy\fR \fBpoint 2geo\fR \fIpoint\fR
Converts a pixel position at a zoom level (\fIpoint\fR, list
containing zoom level, y, and x) to a geographical location (list
containing zoom level, latitude, and longitude, in this order) at that
level.
.TP
\fB::map::slippy\fR \fBpoint 2tile\fR \fIpoint\fR
Converts a pixel position at a zoom level (\fIpoint\fR, a list
containing zoom level, y, and x, in this order) to a tile identifier
(list containing zoom level, row, and column) at that level.
.TP
\fB::map::slippy\fR \fBfit geobox\fR \fIcanvdim\fR \fIgeobox\fR \fIzmin\fR \fIzmax\fR
Calculates the zoom level (whithin the bounds \fIzmin\fR and
\fIzmax\fR) such that \fIgeobox\fR (a 4-element list containing the
latitudes and longitudes lat0, lat1, lon0 and lon1 of a geo box,
in this order) fits into a viewport given by \fIcanvdim\fR, a
2-element list containing the width and height of the viewport, in
this order.
.PP
.SH "COORDINATE SYSTEMS"
The commands of this package operate on three distinct coordinate
systems, which are explained below.
.SS GEOGRAPHIC
\fIGeographic\fRal coordinates are represented by \fILatitude\fR and
\fILongitude\fR, each of which is measured in degrees, as they are
essentially angles.
.PP
\fBZero\fR longitude is the \fIGreenwich meridian\fR, with
positive values going \fIeast\fR, and negative values going
\fIwest\fR, for a total range of +/- 180 degrees. Note that +180 and
-180 longitude are the same \fImeridian\fR, opposite to greenwich.
.PP
\fBzero\fR latitude the \fIEquator\fR, with positive values
going \fInorth\fR and negative values going \fIsouth\fR. While the
true range is +/- 90 degrees the projection used by the package
requires us to cap the range at +/- 85.05112877983284 degrees. This
means that north and south pole are not representable and not part of
any map.
.SS TILES
While \fBGeographic\fRal coordinates of the previous section are
independent of zoom level the \fItile coordinates\fR are not.
.PP
Generally the integer part of tile coordinates represent the
row and column number of the tile in question, wheras the fractional
parts signal how far inside the tile the location in question is, with
pure integer coordinates (no fractional part) representing the upper
left corner of the tile.
.PP
The zero point of the map is at the upper left corner,
regardless of zoom level, with larger coordinates going right (east)
and down (south), and smaller coordinates going left (west) and up
(north). Again regardless of zxoom level.
.PP
Negative tile coordinates are not allowed.
.PP
At zoom level 0 the whole map is represented by a single,
putting the geographic zero at 1/2, 1/2 of tile coordinates, and the
range of tile coordinates as [0...1].
.PP
To go from a zoom level N to the next deeper level N+1 each
tile of level N is split into its four quadrants, which then are the
tiles of level N+1.
.PP
This means that at zoom level N the map is sliced (horizontally
and vertically) into 2^N stripes, for a total of 4^N tiles, with tile
coordinates ranging from 0 to 2^N+1.
.SS PIXELS/POINTS
\fIpixel coordinates\fR, also called \fIpoint coordinates\fR are
in essence \fBtile coordinates\fR scaled by the size of
the image representing a tile. This tile size currently has a fixed
value, \fB256\fR.
.SH REFERENCES
.IP [1]
\fIhttp://wiki.openstreetmap.org/wiki/Main_Page\fR
.PP
.SH KEYWORDS
geodesy, geography, latitute, location, longitude, map, slippy, zoom

Added embedded/man/files/modules/map/map_slippy_cache.n.






































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/map/map_slippy_cache.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "map::slippy::cache" n 0.2 tcllib "Mapping utilities"
.BS
.SH NAME
map::slippy::cache \- Management of a tile cache in the local filesystem
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBTk  8.4\fR
.sp
package require \fBimg::png \fR
.sp
package require \fBmap::slippy \fR
.sp
package require \fBmap::slippy::cache  ?0.2?\fR
.sp
\fB::map::slippy::cache\fR \fIcacheName\fR \fIcachedir\fR \fIprovider\fR
.sp
\fIcacheName\fR \fBvalid\fR \fItile\fR ?\fImsgvar\fR?
.sp
\fIcacheName\fR \fBexists\fR \fItile\fR
.sp
\fIcacheName\fR \fBget\fR \fItile\fR \fIdonecmd\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for managing a cache of tiles for
slippy-based maps in the local filesystem.
.SH API
.TP
\fB::map::slippy::cache\fR \fIcacheName\fR \fIcachedir\fR \fIprovider\fR
Creates the cache \fIcacheName\fR and configures it with both the path
to the directory contaiing the locally cached tiles (\fIcachedir\fR),
and the command prefix from which it will pull tiles asked for and not
yet known to the cache itself (\fIprovider\fR).
.sp
The result of the command is \fIcacheName\fR.
.PP
.SS METHODS
.TP
\fIcacheName\fR \fBvalid\fR \fItile\fR ?\fImsgvar\fR?
This method checks the validity of a the given \fItile\fR identifier.
This is a convenience wrapper to \fB::map::slippy tile valid\fR and
has the same interface.
.TP
\fIcacheName\fR \fBexists\fR \fItile\fR
This methods tests whether the cache contains the specified \fItile\fR
or not. The result is a boolean value, \fBtrue\fR if the tile is
known, and \fBfalse\fR otherwise. The tile is identified by a list
containing three elements, zoom level, row, and column number, in this
order.
.TP
\fIcacheName\fR \fBget\fR \fItile\fR \fIdonecmd\fR
This is the main method of the cache, retrieving the image for the
specified \fItile\fR from the cache. The tile identifier is a list
containing three elements, the zoom level, row, and column number of
the tile, in this order.
.sp
The command refix \fIdonecmd\fR will be invoked when the cache
either knows the image for the tile or that no image will forthcoming.
It will be invoked with either 2 or 3 arguments, i.e.
.RS
.IP [1]
The string \fBset\fR, the \fItile\fR, and the image.
.IP [2]
The string \fBunset\fR, and the \fItile\fR.
.RE
.IP
These two possibilities are used to either signal the image for the
\fItile\fR, or that the \fItile\fR has no image defined for it.
.sp
When the cache has no information about the tile it will invoke the
\fIprovider\fR command prefix specified during its construction,
adding three arguments: The string \fBget\fR, the \fItile\fR, and a
callback into the cache. The latter will be invoked by the provider to
either transfer the image to the cache, or signal that the tile has no
image.
.sp
When multiple requests for the same tile are made only one request
will be issued to the provider.
.PP
.SH REFERENCES
.IP [1]
\fIhttp://wiki.openstreetmap.org/wiki/Main_Page\fR
.PP
.SH KEYWORDS
cache, filesystem, location, map, slippy, tile, zoom

Added embedded/man/files/modules/map/map_slippy_fetcher.n.



























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/map/map_slippy_fetcher.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "map::slippy::fetcher" n 0.3 tcllib "Mapping utilities"
.BS
.SH NAME
map::slippy::fetcher \- Accessing a server providing tiles for slippy-based maps
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBTk  8.4\fR
.sp
package require \fBimg::png \fR
.sp
package require \fBmap::slippy \fR
.sp
package require \fBmap::slippy::fetcher  ?0.3?\fR
.sp
\fB::map::slippy::fetcher\fR \fIfetcherName\fR \fIlevels\fR \fIurl\fR
.sp
\fIfetcherName\fR \fBlevels\fR
.sp
\fIfetcherName\fR \fBtileheight\fR
.sp
\fIfetcherName\fR \fBtilewidth\fR
.sp
\fIfetcherName\fR \fBget\fR \fItile\fR \fIdonecmd\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for accessing http servers providing
tiles for slippy-based maps.
.SH API
.TP
\fB::map::slippy::fetcher\fR \fIfetcherName\fR \fIlevels\fR \fIurl\fR
Creates the fetcher \fIfetcherName\fR and configures it with the
number of zoom \fIlevels\fR supported by the tile server, and the
\fIurl\fR it is listening on for tile requests.
.sp
The result of the command is \fIfetcherName\fR.
.PP
.SS METHODS
.TP
\fIfetcherName\fR \fBlevels\fR
This method returns the number of zoom levels supported by the fetcher
object, and the tile server it is accessing.
.TP
\fIfetcherName\fR \fBtileheight\fR
This method returns the height of tiles served, in pixels.
.TP
\fIfetcherName\fR \fBtilewidth\fR
This method returns the width of tiles served, in pixels.
.TP
\fIfetcherName\fR \fBget\fR \fItile\fR \fIdonecmd\fR
This is the main method of the fetcher, retrieving the image for the
specified \fItile\fR. The tile identifier is a list containing three
elements, the zoom level, row, and column number of the tile, in this
order.
.sp
The command refix \fIdonecmd\fR will be invoked when the fetcher
either knows the image for the tile or that no image will forthcoming.
It will be invoked with either 2 or 3 arguments, i.e.
.RS
.IP [1]
The string \fBset\fR, the \fItile\fR, and the image.
.IP [2]
The string \fBunset\fR, and the \fItile\fR.
.RE
.IP
These two possibilities are used to either signal the image for the
\fItile\fR, or that the \fItile\fR has no image defined for it.
.PP
.SH REFERENCES
.IP [1]
\fIhttp://wiki.openstreetmap.org/wiki/Main_Page\fR
.PP
.SH KEYWORDS
http, location, map, server, slippy, tile, url, zoom

Added embedded/man/files/modules/mapproj/mapproj.n.













































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/mapproj/mapproj.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Kevin B. Kenny <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "mapproj" n 0.1 tcllib "Tcl Library"
.BS
.SH NAME
mapproj \- Map projection routines
.SH SYNOPSIS
package require \fBTcl  ?8.4?\fR
.sp
package require \fBmath::interpolate  ?1.0?\fR
.sp
package require \fBmath::special  ?0.2.1?\fR
.sp
package require \fBmapproj  ?1.0?\fR
.sp
\fB::mapproj::toPlateCarree\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromPlateCarree\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toCylindricalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromCylindricalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toMercator\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromMercator\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toMillerCylindrical\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromMillerCylindrical\fR \fIlambda_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toSinusoidal\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromSinusoidal\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toMollweide\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromMollweide\fR \fIlambda_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toEckertIV\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromEckertIV\fR \fIlambda_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toEckertVI\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromEckertVI\fR \fIlambda_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toRobinson\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromRobinson\fR \fIlambda_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toCassini\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromCassini\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toPeirceQuincuncial\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromPeirceQuincuncial\fR \fIlambda_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toOrthographic\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromOrthographic\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toStereographic\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromStereographic\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toGnomonic\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromGnomonic\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toAzimuthalEquidistant\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromAzimuthalEquidistant\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toLambertAzimuthalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromLambertAzimuthalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toHammer\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromHammer\fR \fIlambda_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toConicEquidistant\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromConicEquidistant\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toAlbersEqualAreaConic\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromAlbersEqualAreaConic\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toLambertConformalConic\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromLambertConformalConic\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toLambertCylindricalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromLambertCylindricalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toBehrmann\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromBehrmann\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toTrystanEdwards\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromTrystanEdwards\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toHoboDyer\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromHoboDyer\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toGallPeters\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromGallPeters\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
\fB::mapproj::toBalthasart\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
.sp
\fB::mapproj::fromBalthasart\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
.sp
.BE
.SH DESCRIPTION
The \fBmapproj\fR package provides a set of procedures for
converting between world co-ordinates (latitude and longitude) and map
co-ordinates on a number of different map projections.
.SH COMMANDS
The following commands convert between world co-ordinates and
map co-ordinates:
.TP
\fB::mapproj::toPlateCarree\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the \fIplate carrée\fR (cylindrical equidistant)
projection.
.TP
\fB::mapproj::fromPlateCarree\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the \fIplate carrée\fR (cylindrical equidistant)
projection.
.TP
\fB::mapproj::toCylindricalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the cylindrical equal-area projection.
.TP
\fB::mapproj::fromCylindricalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the cylindrical equal-area projection.
.TP
\fB::mapproj::toMercator\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Mercator (cylindrical conformal) projection.
.TP
\fB::mapproj::fromMercator\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Mercator (cylindrical conformal) projection.
.TP
\fB::mapproj::toMillerCylindrical\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
Converts to the Miller Cylindrical projection.
.TP
\fB::mapproj::fromMillerCylindrical\fR \fIlambda_0\fR \fIx\fR \fIy\fR
Converts from the Miller Cylindrical projection.
.TP
\fB::mapproj::toSinusoidal\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the sinusoidal (Sanson-Flamsteed) projection.
projection.
.TP
\fB::mapproj::fromSinusoidal\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the sinusoidal (Sanson-Flamsteed) projection.
projection.
.TP
\fB::mapproj::toMollweide\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
Converts to the Mollweide projection.
.TP
\fB::mapproj::fromMollweide\fR \fIlambda_0\fR \fIx\fR \fIy\fR
Converts from the Mollweide projection.
.TP
\fB::mapproj::toEckertIV\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
Converts to the Eckert IV projection.
.TP
\fB::mapproj::fromEckertIV\fR \fIlambda_0\fR \fIx\fR \fIy\fR
Converts from the Eckert IV projection.
.TP
\fB::mapproj::toEckertVI\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
Converts to the Eckert VI projection.
.TP
\fB::mapproj::fromEckertVI\fR \fIlambda_0\fR \fIx\fR \fIy\fR
Converts from the Eckert VI projection.
.TP
\fB::mapproj::toRobinson\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
Converts to the Robinson projection.
.TP
\fB::mapproj::fromRobinson\fR \fIlambda_0\fR \fIx\fR \fIy\fR
Converts from the Robinson projection.
.TP
\fB::mapproj::toCassini\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Cassini (transverse cylindrical equidistant)
projection.
.TP
\fB::mapproj::fromCassini\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Cassini (transverse cylindrical equidistant)
projection.
.TP
\fB::mapproj::toPeirceQuincuncial\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
Converts to the Peirce Quincuncial Projection.
.TP
\fB::mapproj::fromPeirceQuincuncial\fR \fIlambda_0\fR \fIx\fR \fIy\fR
Converts from the Peirce Quincuncial Projection.
.TP
\fB::mapproj::toOrthographic\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the orthographic projection.
.TP
\fB::mapproj::fromOrthographic\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the orthographic projection.
.TP
\fB::mapproj::toStereographic\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the stereographic (azimuthal conformal) projection.
.TP
\fB::mapproj::fromStereographic\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the stereographic (azimuthal conformal) projection.
.TP
\fB::mapproj::toGnomonic\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the gnomonic projection.
.TP
\fB::mapproj::fromGnomonic\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the gnomonic projection.
.TP
\fB::mapproj::toAzimuthalEquidistant\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the azimuthal equidistant projection.
.TP
\fB::mapproj::fromAzimuthalEquidistant\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the azimuthal equidistant projection.
.TP
\fB::mapproj::toLambertAzimuthalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Lambert azimuthal equal-area projection.
.TP
\fB::mapproj::fromLambertAzimuthalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Lambert azimuthal equal-area projection.
.TP
\fB::mapproj::toHammer\fR \fIlambda_0\fR \fIlambda\fR \fIphi\fR
Converts to the Hammer projection.
.TP
\fB::mapproj::fromHammer\fR \fIlambda_0\fR \fIx\fR \fIy\fR
Converts from the Hammer projection.
.TP
\fB::mapproj::toConicEquidistant\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIlambda\fR \fIphi\fR
Converts to the conic equidistant projection.
.TP
\fB::mapproj::fromConicEquidistant\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIx\fR \fIy\fR
Converts from the conic equidistant projection.
.TP
\fB::mapproj::toAlbersEqualAreaConic\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIlambda\fR \fIphi\fR
Converts to the Albers equal-area conic projection.
.TP
\fB::mapproj::fromAlbersEqualAreaConic\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIx\fR \fIy\fR
Converts from the Albers equal-area conic projection.
.TP
\fB::mapproj::toLambertConformalConic\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIlambda\fR \fIphi\fR
Converts to the Lambert conformal conic projection.
.TP
\fB::mapproj::fromLambertConformalConic\fR \fIlambda_0\fR \fIphi_0\fR \fIphi_1\fR \fIphi_2\fR \fIx\fR \fIy\fR
Converts from the Lambert conformal conic projection.
.PP
Among the cylindrical equal-area projections, there are a number of
choices of standard parallels that have names:
.TP
\fB::mapproj::toLambertCylindricalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Lambert cylindrical equal area projection. (standard parallel
is the Equator.)
.TP
\fB::mapproj::fromLambertCylindricalEqualArea\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Lambert cylindrical equal area projection. (standard parallel
is the Equator.)
.TP
\fB::mapproj::toBehrmann\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Behrmann cylindrical equal area projection. (standard parallels
are 30 degrees North and South)
.TP
\fB::mapproj::fromBehrmann\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Behrmann cylindrical equal area projection. (standard parallels
are 30 degrees North and South.)
.TP
\fB::mapproj::toTrystanEdwards\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Trystan Edwards cylindrical equal area projection. (standard parallels
are 37.4 degrees North and South)
.TP
\fB::mapproj::fromTrystanEdwards\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Trystan Edwards cylindrical equal area projection. (standard parallels
are 37.4 degrees North and South.)
.TP
\fB::mapproj::toHoboDyer\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Hobo-Dyer cylindrical equal area projection. (standard parallels
are 37.5 degrees North and South)
.TP
\fB::mapproj::fromHoboDyer\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Hobo-Dyer cylindrical equal area projection. (standard parallels
are 37.5 degrees North and South.)
.TP
\fB::mapproj::toGallPeters\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Gall-Peters cylindrical equal area projection. (standard parallels
are 45 degrees North and South)
.TP
\fB::mapproj::fromGallPeters\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Gall-Peters cylindrical equal area projection. (standard parallels
are 45 degrees North and South.)
.TP
\fB::mapproj::toBalthasart\fR \fIlambda_0\fR \fIphi_0\fR \fIlambda\fR \fIphi\fR
Converts to the Balthasart cylindrical equal area projection. (standard parallels
are 50 degrees North and South)
.TP
\fB::mapproj::fromBalthasart\fR \fIlambda_0\fR \fIphi_0\fR \fIx\fR \fIy\fR
Converts from the Balthasart cylindrical equal area projection. (standard parallels
are 50 degrees North and South.)
.PP
.SH ARGUMENTS
The following arguments are accepted by the projection commands:
.TP
\fIlambda\fR
Longitude of the point to be projected, in degrees.
.TP
\fIphi\fR
Latitude of the point to be projected, in degrees.
.TP
\fIlambda_0\fR
Longitude of the center of the sheet, in degrees.  For many projections,
this figure is also the reference meridian of the projection.
.TP
\fIphi_0\fR
Latitude of the center of the sheet, in degrees.  For the azimuthal
projections, this figure is also the latitude of the center of the projection.
.TP
\fIphi_1\fR
Latitude of the first reference parallel, for projections that use reference
parallels.
.TP
\fIphi_2\fR
Latitude of the second reference parallel, for projections that use reference
parallels.
.TP
\fIx\fR
X co-ordinate of a point on the map, in units of Earth radii.
.TP
\fIy\fR
Y co-ordinate of a point on the map, in units of Earth radii.
.PP
.SH RESULTS
For all of the procedures whose names begin with 'to', the return value
is a list comprising an \fIx\fR co-ordinate and a \fIy\fR co-ordinate.
The co-ordinates are relative to the center of the map sheet to be drawn,
measured in Earth radii at the reference location on the map.
For all of the functions whose names begin with 'from', the return value
is a list comprising the longitude and latitude, in degrees.
.SH "CHOOSING A PROJECTION"
This package offers a great many projections, because no single projection
is appropriate to all maps.  This section attempts to provide guidance
on how to choose a projection.
.PP
First, consider the type of data that you intend to display on the map.
If the data are \fIdirectional\fR (\fIe.g.,\fR winds, ocean currents, or
magnetic fields) then you need to use a projection that preserves
angles; these are known as \fIconformal\fR projections.  Conformal
projections include the Mercator, the Albers azimuthal equal-area,
the stereographic, and the Peirce Quincuncial projection.  If the
data are \fIthematic\fR, describing properties of land or water, such
as temperature, population density, land use, or demographics; then
you need a projection that will show these data with the areas on the map
proportional to the areas in real life.  These so-called \fIequal area\fR
projections include the various cylindrical equal area projections,
the sinusoidal projection, the Lambert azimuthal equal-area projection,
the Albers equal-area conic projection, and several of the world-map
projections (Miller Cylindrical, Mollweide, Eckert IV, Eckert VI, Robinson,
and Hammer). If the significant factor in your data is distance from a
central point or line (such as air routes), then you will do best with
an \fIequidistant\fR projection such as \fIplate carrée\fR,
Cassini, azimuthal equidistant, or conic equidistant.  If direction from
a central point is a critical factor in your data (for instance,
air routes, radio antenna pointing), then you will almost surely want to
use one of the azimuthal projections. Appropriate choices are azimuthal
equidistant, azimuthal equal-area, stereographic, and perhaps orthographic.
.PP
Next, consider how much of the Earth your map will cover, and the general
shape of the area of interest.  For maps of the entire Earth,
the cylindrical equal area, Eckert IV and VI, Mollweide, Robinson, and Hammer
projections are good overall choices.  The Mercator projection is traditional,
but the extreme distortions of area at high latitudes make it
a poor choice unless a conformal projection is required. The Peirce
projection is a better choice of conformal projection, having less distortion
of landforms.  The Miller Cylindrical is a compromise designed to give
shapes similar to the traditional Mercator, but with less polar stretching.
The Peirce Quincuncial projection shows all the continents with acceptable
distortion if a reference meridian close to +20 degrees is chosen.
The Robinson projection yields attractive maps for things like political
divisions, but should be avoided in presenting scientific data, since other
projections have moe useful geometric properties.
.PP
If the map will cover a hemisphere, then choose stereographic,
azimuthal-equidistant, Hammer, or Mollweide projections; these all project
the hemisphere into a circle.
.PP
If the map will cover a large area (at least a few hundred km on a side),
but less than
a hemisphere, then you have several choices.  Azimuthal projections
are usually good (choose stereographic, azimuthal equidistant, or
Lambert azimuthal equal-area according to whether shapes, distances from
a central point, or areas are important).  Azimuthal projections (and possibly
the Cassini projection) are the only
really good choices for mapping the polar regions.
.PP
If the large area is in one of the temperate zones and is round or has
a primarily east-west extent, then the conic projections are good choices.
Choose the Lambert conformal conic, the conic equidistant, or the Albers
equal-area conic according to whether shape, distance, or area are the
most important parameters.  For any of these, the reference parallels
should be chosen at approximately 1/6 and 5/6 of the range of latitudes
to be displayed.  For instance, maps of the 48 coterminous United States
are attractive with reference parallels of 28.5 and 45.5 degrees.
.PP
If the large area is equatorial and is round or has a primarily east-west
extent, then the Mercator projection is a good choice for a conformal
projection; Lambert cylindrical equal-area and sinusoidal projections are
good equal-area projections; and the \fIplate carrée\fR is a
good equidistant projection.
.PP
Large areas having a primarily North-South aspect, particularly those
spanning the Equator, need some other choices.  The Cassini projection
is a good choice for an equidistant projection (for instance, a Cassini
projection with a central meridian of 80 degrees West produces an
attractive map of the Americas). The cylindrical equal-area, Albers
equal-area conic, sinusoidal, Mollweide and Hammer
projections are possible choices for equal-area projections.
A good conformal projection in this situation is the Transverse
Mercator, which alas, is not yet implemented.
.PP
Small areas begin to get into a realm where the ellipticity of the
Earth affects the map scale.  This package does not attempt to
handle accurate mapping for large-scale topographic maps.  If
slight scale errors are acceptable in your application, then any
of the projections appropriate to large areas should work for
small ones as well.
.PP
There are a few projections that are included for their special
properties.  The orthographic projection produces views of the
Earth as seen from space.  The gnomonic projection produces a
map on which all great circles (the shortest distance between
two points on the Earth's surface) are rendered as straight lines.
While this projection is useful for navigational planning, it
has extreme distortions of shape and area, and can display
only a limited area of the Earth (substantially less than a hemisphere).
.SH KEYWORDS
geodesy, map, projection
.SH COPYRIGHT
.nf
Copyright (c) 2007 Kevin B. Kenny <[email protected]>

.fi

Added embedded/man/files/modules/math/bigfloat.n.






















































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/bigfloat.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004-2008, by Stephane Arnold <stephanearnold at yahoo dot fr>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::bigfloat" n 2.0.1 tcllib "Tcl Math Library"
.BS
.SH NAME
math::bigfloat \- Arbitrary precision floating-point numbers
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBmath::bigfloat  ?2.0.1?\fR
.sp
\fBfromstr\fR \fInumber\fR ?\fItrailingZeros\fR?
.sp
\fBtostr\fR ?\fB-nosci\fR? \fInumber\fR
.sp
\fBfromdouble\fR \fIdouble\fR ?\fIdecimals\fR?
.sp
\fBtodouble\fR \fInumber\fR
.sp
\fBisInt\fR \fInumber\fR
.sp
\fBisFloat\fR \fInumber\fR
.sp
\fBint2float\fR \fIinteger\fR ?\fIdecimals\fR?
.sp
\fBadd\fR \fIx\fR \fIy\fR
.sp
\fBsub\fR \fIx\fR \fIy\fR
.sp
\fBmul\fR \fIx\fR \fIy\fR
.sp
\fBdiv\fR \fIx\fR \fIy\fR
.sp
\fBmod\fR \fIx\fR \fIy\fR
.sp
\fBabs\fR \fIx\fR
.sp
\fBopp\fR \fIx\fR
.sp
\fBpow\fR \fIx\fR \fIn\fR
.sp
\fBiszero\fR \fIx\fR
.sp
\fBequal\fR \fIx\fR \fIy\fR
.sp
\fBcompare\fR \fIx\fR \fIy\fR
.sp
\fBsqrt\fR \fIx\fR
.sp
\fBlog\fR \fIx\fR
.sp
\fBexp\fR \fIx\fR
.sp
\fBcos\fR \fIx\fR
.sp
\fBsin\fR \fIx\fR
.sp
\fBtan\fR \fIx\fR
.sp
\fBcotan\fR \fIx\fR
.sp
\fBacos\fR \fIx\fR
.sp
\fBasin\fR \fIx\fR
.sp
\fBatan\fR \fIx\fR
.sp
\fBcosh\fR \fIx\fR
.sp
\fBsinh\fR \fIx\fR
.sp
\fBtanh\fR \fIx\fR
.sp
\fBpi\fR \fIn\fR
.sp
\fBrad2deg\fR \fIradians\fR
.sp
\fBdeg2rad\fR \fIdegrees\fR
.sp
\fBround\fR \fIx\fR
.sp
\fBceil\fR \fIx\fR
.sp
\fBfloor\fR \fIx\fR
.sp
.BE
.SH DESCRIPTION
The bigfloat package provides arbitrary precision floating-point math
capabilities to the Tcl language. It is designed to work with Tcl 8.5,
but for Tcl 8.4 is provided an earlier version of this package.
See \fBWHAT ABOUT TCL 8.4 ?\fR for more explanations.
By convention, we will talk about the numbers treated in this library as :
.IP \(bu
BigFloat for floating-point numbers of arbitrary length.
.IP \(bu
integers for arbitrary length signed integers, just as basic integers since Tcl 8.5.
.PP
Each BigFloat is an interval, namely [\fIm-d, m+d\fR],
where \fIm\fR is the mantissa and \fId\fR the uncertainty, representing the
limitation of that number's precision.
This is why we call such mathematics \fIinterval computations\fR.
Just take an example in physics : when you measure a temperature, not all
digits you read are \fIsignificant\fR. Sometimes you just cannot trust all digits - not to mention if doubles (f.p. numbers) can handle all these digits.
BigFloat can handle this problem - trusting the digits you get - plus the ability to store numbers with an arbitrary precision.
BigFloats are internally represented at Tcl lists: this
package provides a set of procedures operating against
the internal representation in order to :
.IP \(bu
perform math operations on BigFloats and (optionnaly) with integers.
.IP \(bu
convert BigFloats from their internal representations to strings, and vice versa.
.PP
.SH INTRODUCTION
.TP
\fBfromstr\fR \fInumber\fR ?\fItrailingZeros\fR?
Converts \fInumber\fR into a BigFloat. Its precision
is at least the number of digits provided by \fInumber\fR.
If the \fInumber\fR contains only digits and eventually a minus sign, it is considered as
an integer. Subsequently, no conversion is done at all.
.sp
\fItrailingZeros\fR - the number of zeros to append at the end of the floating-point number
to get more precision. It cannot be applied to an integer.
.CS


# x and y are BigFloats : the first string contained a dot, and the second an e sign
set x [fromstr -1.000000]
set y [fromstr 2000e30]
# let's see how we get integers
set t 20000000000000
# the old way (package 1.2) is still supported for backwards compatibility :
set m [fromstr 10000000000]
# but we do not need fromstr for integers anymore
set n -39
# t, m and n are integers

.CE
.sp
The \fInumber\fR's last digit is considered by the procedure to be true at +/-1,
For example, 1.00 is the interval [0.99, 1.01],
and 0.43 the interval [0.42, 0.44].
The Pi constant may be approximated by the number "3.1415".
This string could be considered as the interval [3.1414 , 3.1416] by \fBfromstr\fR.
So, when you mean 1.0 as a double, you may have to write 1.000000 to get enough precision.
To learn more about this subject, see \fBPRECISION\fR.
.sp
For example :
.CS


set x [fromstr 1.0000000000]
# the next line does the same, but smarter
set y [fromstr 1. 10]

.CE
.TP
\fBtostr\fR ?\fB-nosci\fR? \fInumber\fR
Returns a string form of a BigFloat, in which all digits are exacts.
\fIAll exact digits\fR means a rounding may occur, for example to zero,
if the uncertainty interval does not clearly show the true digits.
\fInumber\fR may be an integer, causing the command to return exactly the input argument.
With the \fB-nosci\fR option, the number returned is never shown in scientific
notation, i.e. not like '3.4523e+5' but like '345230.'.
.CS


puts [tostr [fromstr 0.99999]] ;# 1.0000
puts [tostr [fromstr 1.00001]] ;# 1.0000
puts [tostr [fromstr 0.002]] ;# 0.e-2

.CE
.IP
See \fBPRECISION\fR for that matter.
See also \fBiszero\fR for how to detect zeros, which is useful when performing a division.
.TP
\fBfromdouble\fR \fIdouble\fR ?\fIdecimals\fR?
Converts a double (a simple floating-point value) to a BigFloat, with
exactly \fIdecimals\fR digits.  Without the \fIdecimals\fR argument,
it behaves like \fBfromstr\fR.
Here, the only important feature you might care of is the ability
to create BigFloats with a fixed number of \fIdecimals\fR.
.CS


tostr [fromstr 1.111 4]
# returns : 1.111000 (3 zeros)
tostr [fromdouble 1.111 4]
# returns : 1.111

.CE
.TP
\fBtodouble\fR \fInumber\fR
Returns a double, that may be used in \fIexpr\fR,
from a BigFloat.
.TP
\fBisInt\fR \fInumber\fR
Returns 1 if \fInumber\fR is an integer, 0 otherwise.
.TP
\fBisFloat\fR \fInumber\fR
Returns 1 if \fInumber\fR is a BigFloat, 0 otherwise.
.TP
\fBint2float\fR \fIinteger\fR ?\fIdecimals\fR?
Converts an integer to a BigFloat with \fIdecimals\fR trailing zeros.
The default, and minimal, number of \fIdecimals\fR is 1.
When converting back to string, one decimal is lost:
.CS


set n 10
set x [int2float $n]; # like fromstr 10.0
puts [tostr $x]; # prints "10."
set x [int2float $n 3]; # like fromstr 10.000
puts [tostr $x]; # prints "10.00"

.CE
.PP
.SH ARITHMETICS
.TP
\fBadd\fR \fIx\fR \fIy\fR
.TP
\fBsub\fR \fIx\fR \fIy\fR
.TP
\fBmul\fR \fIx\fR \fIy\fR
Return the sum, difference and product of \fIx\fR by \fIy\fR.
\fIx\fR - may be either a BigFloat or an integer
\fIy\fR - may be either a BigFloat or an integer
When both are integers, these commands behave like \fBexpr\fR.
.TP
\fBdiv\fR \fIx\fR \fIy\fR
.TP
\fBmod\fR \fIx\fR \fIy\fR
Return the quotient and the rest of \fIx\fR divided by \fIy\fR.
Each argument (\fIx\fR and \fIy\fR) can be either a BigFloat or an integer,
but you cannot divide an integer by a BigFloat
Divide by zero throws an error.
.TP
\fBabs\fR \fIx\fR
Returns the absolute value of \fIx\fR
.TP
\fBopp\fR \fIx\fR
Returns the opposite of \fIx\fR
.TP
\fBpow\fR \fIx\fR \fIn\fR
Returns \fIx\fR taken to the \fIn\fRth power.
It only works if \fIn\fR is an integer.
\fIx\fR might be a BigFloat or an integer.
.PP
.SH COMPARISONS
.TP
\fBiszero\fR \fIx\fR
Returns 1 if \fIx\fR is :
.RS
.IP \(bu
a BigFloat close enough to zero to raise "divide by zero".
.IP \(bu
the integer 0.
.RE
.IP
See here how numbers that are close to zero are converted to strings:
.CS


tostr [fromstr 0.001] ; # -> 0.e-2
tostr [fromstr 0.000000] ; # -> 0.e-5
tostr [fromstr -0.000001] ; # -> 0.e-5
tostr [fromstr 0.0] ; # -> 0.
tostr [fromstr 0.002] ; # -> 0.e-2

set a [fromstr 0.002] ; # uncertainty interval : 0.001, 0.003
tostr  $a ; # 0.e-2
iszero $a ; # false

set a [fromstr 0.001] ; # uncertainty interval : 0.000, 0.002
tostr  $a ; # 0.e-2
iszero $a ; # true

.CE
.TP
\fBequal\fR \fIx\fR \fIy\fR
Returns 1 if \fIx\fR and \fIy\fR are equal, 0 elsewhere.
.TP
\fBcompare\fR \fIx\fR \fIy\fR
Returns 0 if both BigFloat arguments are equal,
1 if \fIx\fR is greater than \fIy\fR,
and -1 if \fIx\fR is lower than \fIy\fR.
You would not be able to compare an integer to a BigFloat :
the operands should be both BigFloats, or both integers.
.PP
.SH ANALYSIS
.TP
\fBsqrt\fR \fIx\fR
.TP
\fBlog\fR \fIx\fR
.TP
\fBexp\fR \fIx\fR
.TP
\fBcos\fR \fIx\fR
.TP
\fBsin\fR \fIx\fR
.TP
\fBtan\fR \fIx\fR
.TP
\fBcotan\fR \fIx\fR
.TP
\fBacos\fR \fIx\fR
.TP
\fBasin\fR \fIx\fR
.TP
\fBatan\fR \fIx\fR
.TP
\fBcosh\fR \fIx\fR
.TP
\fBsinh\fR \fIx\fR
.TP
\fBtanh\fR \fIx\fR
The above functions return, respectively, the following :
square root, logarithm, exponential, cosine, sine,
tangent, cotangent, arc cosine, arc sine, arc tangent, hyperbolic
cosine, hyperbolic sine, hyperbolic tangent, of a BigFloat named \fIx\fR.
.TP
\fBpi\fR \fIn\fR
Returns a BigFloat representing the Pi constant with \fIn\fR digits after the dot.
\fIn\fR is a positive integer.
.TP
\fBrad2deg\fR \fIradians\fR
.TP
\fBdeg2rad\fR \fIdegrees\fR
\fIradians\fR - angle expressed in radians (BigFloat)
.sp
\fIdegrees\fR - angle expressed in degrees (BigFloat)
.sp
Convert an angle from radians to degrees, and \fIvice versa\fR.
.PP
.SH ROUNDING
.TP
\fBround\fR \fIx\fR
.TP
\fBceil\fR \fIx\fR
.TP
\fBfloor\fR \fIx\fR
The above functions return the \fIx\fR BigFloat,
rounded like with the same mathematical function in \fIexpr\fR,
and returns it as an integer.
.PP
.SH PRECISION
How do conversions work with precision ?
.IP \(bu
When a BigFloat is converted from string, the internal representation
holds its uncertainty as 1 at the level of the last digit.
.IP \(bu
During computations, the uncertainty of each result
is internally computed the closest to the reality, thus saving the memory used.
.IP \(bu
When converting back to string, the digits that are printed
are not subject to uncertainty. However, some rounding is done, as not doing so
causes severe problems.
.PP
Uncertainties are kept in the internal representation of the number ;
it is recommended to use \fBtostr\fR only for outputting data (on the screen or in a file),
and NEVER call \fBfromstr\fR with the result of \fBtostr\fR.
It is better to always keep operands in their internal representation.
Due to the internals of this library, the uncertainty interval may be slightly
wider than expected, but this should not cause false digits.
.PP
Now you may ask this question : What precision am I going to get
after calling add, sub, mul or div?
First you set a number from the string representation and,
by the way, its uncertainty is set:
.CS


set a [fromstr 1.230]
# $a belongs to [1.229, 1.231]
set a [fromstr 1.000]
# $a belongs to [0.999, 1.001]
# $a has a relative uncertainty of 0.1% : 0.001(the uncertainty)/1.000(the medium value)

.CE
The uncertainty of the sum, or the difference, of two numbers, is the sum
of their respective uncertainties.
.CS


set a [fromstr 1.230]
set b [fromstr 2.340]
set sum [add $a $b]]
# the result is : [3.568, 3.572] (the last digit is known with an uncertainty of 2)
tostr $sum ; # 3.57

.CE
But when, for example, we add or substract an integer to a BigFloat,
the relative uncertainty of the result is unchanged. So it is desirable
not to convert integers to BigFloats:
.CS


set a [fromstr 0.999999999]
# now something dangerous
set b [fromstr 2.000]
# the result has only 3 digits
tostr [add $a $b]

# how to keep precision at its maximum
puts [tostr [add $a 2]]

.CE
.PP
For multiplication and division, the relative uncertainties of the product
or the quotient, is the sum of the relative uncertainties of the operands.
Take care of division by zero : check each divider with \fBiszero\fR.
.CS


set num [fromstr 4.00]
set denom [fromstr 0.01]

puts [iszero $denom];# true
set quotient [div $num $denom];# error : divide by zero

# opposites of our operands
puts [compare $num [opp $num]]; # 1
puts [compare $denom [opp $denom]]; # 0 !!!
# No suprise ! 0 and its opposite are the same...

.CE
Effects of the precision of a number considered equal to zero
to the cos function:
.CS


puts [tostr [cos [fromstr 0. 10]]]; # -> 1.000000000
puts [tostr [cos [fromstr 0. 5]]]; # -> 1.0000
puts [tostr [cos [fromstr 0e-10]]]; # -> 1.000000000
puts [tostr [cos [fromstr 1e-10]]]; # -> 1.000000000

.CE
BigFloats with different internal representations may be converted
to the same string.
.PP
For most analysis functions (cosine, square root, logarithm, etc.), determining the precision
of the result is difficult.
It seems however that in many cases, the loss of precision in the result
is of one or two digits.
There are some exceptions : for example,
.CS


tostr [exp [fromstr 100.0 10]]
# returns : 2.688117142e+43 which has only 10 digits of precision, although the entry
# has 14 digits of precision.

.CE
.SH "WHAT ABOUT TCL 8.4 ?"
If your setup do not provide Tcl 8.5 but supports 8.4, the package can still be loaded,
switching back to \fImath::bigfloat\fR 1.2. Indeed, an important function introduced in Tcl 8.5
is required - the ability to handle bignums, that we can do with \fBexpr\fR.
Before 8.5, this ability was provided by several packages,
including the pure-Tcl \fImath::bignum\fR package provided by \fItcllib\fR.
In this case, all you need to know, is that arguments to the commands explained here,
are expected to be in their internal representation.
So even with integers, you will need to call \fBfromstr\fR
and \fBtostr\fR in order to convert them between string and internal representations.
.CS


#
# with Tcl 8.5
# ============
set a [pi 20]
# round returns an integer and 'everything is a string' applies to integers
# whatever big they are
puts [round [mul $a 10000000000]]
#
# the same with Tcl 8.4
# =====================
set a [pi 20]
# bignums (arbitrary length integers) need a conversion hook
set b [fromstr 10000000000]
# round returns a bignum:
# before printing it, we need to convert it with 'tostr'
puts [tostr [round [mul $a $b]]]

.CE
.SH "NAMESPACES AND OTHER PACKAGES"
We have not yet discussed about namespaces
because we assumed that you had imported public commands into the global namespace,
like this:
.CS


namespace import ::math::bigfloat::*

.CE
If you matter much about avoiding names conflicts,
I considere it should be resolved by the following :
.CS


package require math::bigfloat
# beware: namespace ensembles are not available in Tcl 8.4
namespace eval ::math::bigfloat {namespace ensemble create -command ::bigfloat}
# from now, the bigfloat command takes as subcommands all original math::bigfloat::* commands
set a [bigfloat sub [bigfloat fromstr 2.000] [bigfloat fromstr 0.530]]
puts [bigfloat tostr $a]

.CE
.SH EXAMPLES
Guess what happens when you are doing some astronomy. Here is an example :
.CS


# convert acurrate angles with a millisecond-rated accuracy
proc degree-angle {degrees minutes seconds milliseconds} {
    set result 0
    set div 1
    foreach factor {1 1000 60 60} var [list $milliseconds $seconds $minutes $degrees] {
        # we convert each entry var into milliseconds
        set div [expr {$div*$factor}]
        incr result [expr {$var*$div}]
    }
    return [div [int2float $result] $div]
}
# load the package
package require math::bigfloat
namespace import ::math::bigfloat::*
# work with angles : a standard formula for navigation (taking bearings)
set angle1 [deg2rad [degree-angle 20 30 40   0]]
set angle2 [deg2rad [degree-angle 21  0 50 500]]
set opposite3 [deg2rad [degree-angle 51  0 50 500]]
set sinProduct [mul [sin $angle1] [sin $angle2]]
set cosProduct [mul [cos $angle1] [cos $angle2]]
set angle3 [asin [add [mul $sinProduct [cos $opposite3]] $cosProduct]]
puts "angle3 : [tostr [rad2deg $angle3]]"

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: bignum :: float\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
computations, floating-point, interval, math, multiprecision, tcl
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004-2008, by Stephane Arnold <stephanearnold at yahoo dot fr>

.fi

Added embedded/man/files/modules/math/bignum.n.





























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/bignum.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Salvatore Sanfilippo <antirez at invece dot org>
'\" Copyright (c) 2004 Arjen Markus <arjenmarkus at users dot sourceforge dot net>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::bignum" n 3.1 tcllib "Tcl Math Library"
.BS
.SH NAME
math::bignum \- Arbitrary precision integer numbers
.SH SYNOPSIS
package require \fBTcl  ?8.4?\fR
.sp
package require \fBmath::bignum  ?3.1?\fR
.sp
\fB::math::bignum::fromstr\fR \fIstring\fR ?\fIradix\fR?
.sp
\fB::math::bignum::tostr\fR \fIbignum\fR ?\fIradix\fR?
.sp
\fB::math::bignum::sign\fR \fIbignum\fR
.sp
\fB::math::bignum::abs\fR \fIbignum\fR
.sp
\fB::math::bignum::cmp\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::iszero\fR \fIbignum\fR
.sp
\fB::math::bignum::lt\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::le\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::gt\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::ge\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::eq\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::ne\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::isodd\fR \fIbignum\fR
.sp
\fB::math::bignum::iseven\fR \fIbignum\fR
.sp
\fB::math::bignum::add\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::sub\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::mul\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::divqr\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::div\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::rem\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::mod\fR \fIn\fR \fIm\fR
.sp
\fB::math::bignum::pow\fR \fIbase\fR \fIexp\fR
.sp
\fB::math::bignum::powm\fR \fIbase\fR \fIexp\fR \fIm\fR
.sp
\fB::math::bignum::sqrt\fR \fIbignum\fR
.sp
\fB::math::bignum::rand\fR \fIbits\fR
.sp
\fB::math::bignum::lshift\fR \fIbignum\fR \fIbits\fR
.sp
\fB::math::bignum::rshift\fR \fIbignum\fR \fIbits\fR
.sp
\fB::math::bignum::bitand\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::bitor\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::bitxor\fR \fIa\fR \fIb\fR
.sp
\fB::math::bignum::setbit\fR \fIbignumVar\fR \fIbit\fR
.sp
\fB::math::bignum::clearbit\fR \fIbignumVar\fR \fIbit\fR
.sp
\fB::math::bignum::testbit\fR \fIbignum\fR \fIbit\fR
.sp
\fB::math::bignum::bits\fR \fIbignum\fR
.sp
.BE
.SH DESCRIPTION
.PP
The bignum package provides arbitrary precision integer math
(also known as "big numbers") capabilities to the Tcl language.
Big numbers are internally represented at Tcl lists: this
package provides a set of procedures operating against
the internal representation in order to:
.IP \(bu
perform math operations
.IP \(bu
convert bignums from the internal representation to a string in
the desired radix and vice versa.
.PP
But the two constants "0" and "1" are automatically converted to
the internal representation, in order to easily compare a number to zero,
or increment a big number.
.PP
The bignum interface is opaque, so
operations on bignums that are not returned by procedures
in this package (but created by hand) may lead to unspecified behaviours.
It's safe to treat bignums as pure values, so there is no need
to free a bignum, or to duplicate it via a special operation.
.SH EXAMPLES
This section shows some simple example. This library being just
a way to perform math operations, examples may be the simplest way
to learn how to work with it. Consult the API section of
this man page for information about individual procedures.
.PP
.CS


    package require math::bignum

    # Multiplication of two bignums
    set a [::math::bignum::fromstr 88888881111111]
    set b [::math::bignum::fromstr 22222220000000]
    set c [::math::bignum::mul $a $b]
    puts [::math::bignum::tostr $c] ; # => will output 1975308271604953086420000000
    set c [::math::bignum::sqrt $c]
    puts [::math::bignum::tostr $c] ; # => will output 44444440277777

    # From/To string conversion in different radix
    set a [::math::bignum::fromstr 1100010101010111001001111010111 2]
    puts [::math::bignum::tostr $a 16] ; # => will output 62ab93d7

    # Factorial example
    proc fact n {
        # fromstr is not needed for 0 and 1
        set z 1
        for {set i 2} {$i <= $n} {incr i} {
            set z [::math::bignum::mul $z [::math::bignum::fromstr $i]]
        }
        return $z
    }

    puts [::math::bignum::tostr [fact 100]]

.CE
.SH API
.TP
\fB::math::bignum::fromstr\fR \fIstring\fR ?\fIradix\fR?
Convert \fIstring\fR into a bignum. If \fIradix\fR is omitted or zero,
the string is interpreted in hex if prefixed with
\fI0x\fR, in octal if prefixed with \fIox\fR,
in binary if it's pefixed with \fIbx\fR, as a number in
radix 10 otherwise. If instead the \fIradix\fR argument
is specified in the range 2-36, the \fIstring\fR is interpreted
in the given radix. Please note that this conversion is
not needed for two constants : \fI0\fR and \fI1\fR. (see the example)
.TP
\fB::math::bignum::tostr\fR \fIbignum\fR ?\fIradix\fR?
Convert \fIbignum\fR into a string representing the number
in the specified radix. If \fIradix\fR is omitted, the
default is 10.
.TP
\fB::math::bignum::sign\fR \fIbignum\fR
Return the sign of the bignum.
The procedure returns 0 if the number is positive, 1 if it's negative.
.TP
\fB::math::bignum::abs\fR \fIbignum\fR
Return the absolute value of the bignum.
.TP
\fB::math::bignum::cmp\fR \fIa\fR \fIb\fR
Compare the two bignums a and b, returning \fI0\fR if \fIa == b\fR,
\fI1\fR if \fIa > b\fR, and \fI-1\fR if \fIa < b\fR.
.TP
\fB::math::bignum::iszero\fR \fIbignum\fR
Return true if \fIbignum\fR value is zero, otherwise false is returned.
.TP
\fB::math::bignum::lt\fR \fIa\fR \fIb\fR
Return true if \fIa < b\fR, otherwise false is returned.
.TP
\fB::math::bignum::le\fR \fIa\fR \fIb\fR
Return true if \fIa <= b\fR, otherwise false is returned.
.TP
\fB::math::bignum::gt\fR \fIa\fR \fIb\fR
Return true if \fIa > b\fR, otherwise false is returned.
.TP
\fB::math::bignum::ge\fR \fIa\fR \fIb\fR
Return true if \fIa >= b\fR, otherwise false is returned.
.TP
\fB::math::bignum::eq\fR \fIa\fR \fIb\fR
Return true if \fIa == b\fR, otherwise false is returned.
.TP
\fB::math::bignum::ne\fR \fIa\fR \fIb\fR
Return true if \fIa != b\fR, otherwise false is returned.
.TP
\fB::math::bignum::isodd\fR \fIbignum\fR
Return true if \fIbignum\fR is odd.
.TP
\fB::math::bignum::iseven\fR \fIbignum\fR
Return true if \fIbignum\fR is even.
.TP
\fB::math::bignum::add\fR \fIa\fR \fIb\fR
Return the sum of the two bignums \fIa\fR and \fIb\fR.
.TP
\fB::math::bignum::sub\fR \fIa\fR \fIb\fR
Return the difference of the two bignums \fIa\fR and \fIb\fR.
.TP
\fB::math::bignum::mul\fR \fIa\fR \fIb\fR
Return the product of the two bignums \fIa\fR and \fIb\fR.
The implementation uses Karatsuba multiplication if both
the numbers are bigger than a given threshold, otherwise
the direct algorith is used.
.TP
\fB::math::bignum::divqr\fR \fIa\fR \fIb\fR
Return a two-elements list containing as first element
the quotient of the division between the two bignums
\fIa\fR and \fIb\fR, and the remainder of the division as second element.
.TP
\fB::math::bignum::div\fR \fIa\fR \fIb\fR
Return the quotient of the division between the two
bignums \fIa\fR and \fIb\fR.
.TP
\fB::math::bignum::rem\fR \fIa\fR \fIb\fR
Return the remainder of the division between the two
bignums \fIa\fR and \fIb\fR.
.TP
\fB::math::bignum::mod\fR \fIn\fR \fIm\fR
Return \fIn\fR modulo \fIm\fR. This operation is
called modular reduction.
.TP
\fB::math::bignum::pow\fR \fIbase\fR \fIexp\fR
Return \fIbase\fR raised to the exponent \fIexp\fR.
.TP
\fB::math::bignum::powm\fR \fIbase\fR \fIexp\fR \fIm\fR
Return \fIbase\fR raised to the exponent \fIexp\fR,
modulo \fIm\fR. This function is often used in the field
of cryptography.
.TP
\fB::math::bignum::sqrt\fR \fIbignum\fR
Return the integer part of the square root of \fIbignum\fR
.TP
\fB::math::bignum::rand\fR \fIbits\fR
Return a random number of at most \fIbits\fR bits.
The returned number is internally generated using Tcl's \fIexpr rand()\fR
function and is not suitable where an unguessable and cryptographically
secure random number is needed.
.TP
\fB::math::bignum::lshift\fR \fIbignum\fR \fIbits\fR
Return the result of left shifting \fIbignum\fR's binary
representation of \fIbits\fR positions on the left.
This is equivalent to multiplying by 2^\fIbits\fR but much faster.
.TP
\fB::math::bignum::rshift\fR \fIbignum\fR \fIbits\fR
Return the result of right shifting \fIbignum\fR's binary
representation of \fIbits\fR positions on the right.
This is equivalent to dividing by \fI2^bits\fR but much faster.
.TP
\fB::math::bignum::bitand\fR \fIa\fR \fIb\fR
Return the result of doing a bitwise AND operation on a
and b. The operation is restricted to positive numbers,
including zero. When negative numbers are provided as
arguments the result is undefined.
.TP
\fB::math::bignum::bitor\fR \fIa\fR \fIb\fR
Return the result of doing a bitwise OR operation on a
and b. The operation is restricted to positive numbers,
including zero. When negative numbers are provided as
arguments the result is undefined.
.TP
\fB::math::bignum::bitxor\fR \fIa\fR \fIb\fR
Return the result of doing a bitwise XOR operation on a
and b. The operation is restricted to positive numbers,
including zero. When negative numbers are provided as
arguments the result is undefined.
.TP
\fB::math::bignum::setbit\fR \fIbignumVar\fR \fIbit\fR
Set the bit at \fIbit\fR position to 1 in the bignum stored
in the variable \fIbignumVar\fR. Bit 0 is the least significant.
.TP
\fB::math::bignum::clearbit\fR \fIbignumVar\fR \fIbit\fR
Set the bit at \fIbit\fR position to 0 in the bignum stored
in the variable \fIbignumVar\fR. Bit 0 is the least significant.
.TP
\fB::math::bignum::testbit\fR \fIbignum\fR \fIbit\fR
Return true if the bit at the \fIbit\fR position of \fIbignum\fR
is on, otherwise false is returned. If \fIbit\fR is out of
range, it is considered as set to zero.
.TP
\fB::math::bignum::bits\fR \fIbignum\fR
Return the number of bits needed to represent bignum in radix 2.
.PP
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: bignum\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
bignums, math, multiprecision, tcl
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Salvatore Sanfilippo <antirez at invece dot org>
Copyright (c) 2004 Arjen Markus <arjenmarkus at users dot sourceforge dot net>

.fi

Added embedded/man/files/modules/math/calculus.n.
















































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/calculus.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002,2003,2004 Arjen Markus
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::calculus" n 0.7.1 tcllib "Tcl Math Library"
.BS
.SH NAME
math::calculus \- Integration and ordinary differential equations
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmath::calculus  0.7.1\fR
.sp
\fB::math::calculus::integral\fR \fIbegin\fR \fIend\fR \fInosteps\fR \fIfunc\fR
.sp
\fB::math::calculus::integralExpr\fR \fIbegin\fR \fIend\fR \fInosteps\fR \fIexpression\fR
.sp
\fB::math::calculus::integral2D\fR \fIxinterval\fR \fIyinterval\fR \fIfunc\fR
.sp
\fB::math::calculus::integral2D_accurate\fR \fIxinterval\fR \fIyinterval\fR \fIfunc\fR
.sp
\fB::math::calculus::integral3D\fR \fIxinterval\fR \fIyinterval\fR \fIzinterval\fR \fIfunc\fR
.sp
\fB::math::calculus::integral3D_accurate\fR \fIxinterval\fR \fIyinterval\fR \fIzinterval\fR \fIfunc\fR
.sp
\fB::math::calculus::eulerStep\fR \fIt\fR \fItstep\fR \fIxvec\fR \fIfunc\fR
.sp
\fB::math::calculus::heunStep\fR \fIt\fR \fItstep\fR \fIxvec\fR \fIfunc\fR
.sp
\fB::math::calculus::rungeKuttaStep\fR \fIt\fR \fItstep\fR \fIxvec\fR \fIfunc\fR
.sp
\fB::math::calculus::boundaryValueSecondOrder\fR \fIcoeff_func\fR \fIforce_func\fR \fIleftbnd\fR \fIrightbnd\fR \fInostep\fR
.sp
\fB::math::calculus::solveTriDiagonal\fR \fIacoeff\fR \fIbcoeff\fR \fIccoeff\fR \fIdvalue\fR
.sp
\fB::math::calculus::newtonRaphson\fR \fIfunc\fR \fIderiv\fR \fIinitval\fR
.sp
\fB::math::calculus::newtonRaphsonParameters\fR \fImaxiter\fR \fItolerance\fR
.sp
\fB::math::calculus::regula_falsi\fR \fIf\fR \fIxb\fR \fIxe\fR \fIeps\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package implements several simple mathematical algorithms:
.IP \(bu
The integration of a function over an interval
.IP \(bu
The numerical integration of a system of ordinary differential
equations.
.IP \(bu
Estimating the root(s) of an equation of one variable.
.PP
.PP
The package is fully implemented in Tcl. No particular attention has
been paid to the accuracy of the calculations. Instead, well-known
algorithms have been used in a straightforward manner.
.PP
This document describes the procedures and explains their usage.
.SH PROCEDURES
This package defines the following public procedures:
.TP
\fB::math::calculus::integral\fR \fIbegin\fR \fIend\fR \fInosteps\fR \fIfunc\fR
Determine the integral of the given function using the Simpson
rule. The interval for the integration is [\fIbegin\fR, \fIend\fR].
The remaining arguments are:
.RS
.TP
\fInosteps\fR
Number of steps in which the interval is divided.
.TP
\fIfunc\fR
Function to be integrated. It should take one single argument.
.RE
.sp
.TP
\fB::math::calculus::integralExpr\fR \fIbegin\fR \fIend\fR \fInosteps\fR \fIexpression\fR
Similar to the previous proc, this one determines the integral of
the given \fIexpression\fR using the Simpson rule.
The interval for the integration is [\fIbegin\fR, \fIend\fR].
The remaining arguments are:
.RS
.TP
\fInosteps\fR
Number of steps in which the interval is divided.
.TP
\fIexpression\fR
Expression to be integrated. It should
use the variable "x" as the only variable (the "integrate")
.RE
.sp
.TP
\fB::math::calculus::integral2D\fR \fIxinterval\fR \fIyinterval\fR \fIfunc\fR
.TP
\fB::math::calculus::integral2D_accurate\fR \fIxinterval\fR \fIyinterval\fR \fIfunc\fR
The commands \fBintegral2D\fR and \fBintegral2D_accurate\fR calculate the
integral of a function of two variables over the rectangle given by the
first two arguments, each a list of three items, the start and
stop interval for the variable and the number of steps.
.sp
The command \fBintegral2D\fR evaluates the function at the centre of
each rectangle, whereas the command \fBintegral2D_accurate\fR uses a
four-point quadrature formula. This results in an exact integration of
polynomials of third degree or less.
.sp
The function must take two arguments and return the function
value.
.TP
\fB::math::calculus::integral3D\fR \fIxinterval\fR \fIyinterval\fR \fIzinterval\fR \fIfunc\fR
.TP
\fB::math::calculus::integral3D_accurate\fR \fIxinterval\fR \fIyinterval\fR \fIzinterval\fR \fIfunc\fR
The commands \fBintegral3D\fR and \fBintegral3D_accurate\fR are the
three-dimensional equivalent of \fBintegral2D\fR and \fBintegral3D_accurate\fR.
The function \fIfunc\fR takes three arguments and is integrated over the block in
3D space given by three intervals.
.TP
\fB::math::calculus::eulerStep\fR \fIt\fR \fItstep\fR \fIxvec\fR \fIfunc\fR
Set a single step in the numerical integration of a system of
differential equations. The method used is Euler's.
.RS
.TP
\fIt\fR
Value of the independent variable (typically time)
at the beginning of the step.
.TP
\fItstep\fR
Step size for the independent variable.
.TP
\fIxvec\fR
List (vector) of dependent values
.TP
\fIfunc\fR
Function of t and the dependent values, returning
a list of the derivatives of the dependent values. (The lengths of
xvec and the return value of "func" must match).
.RE
.sp
.TP
\fB::math::calculus::heunStep\fR \fIt\fR \fItstep\fR \fIxvec\fR \fIfunc\fR
Set a single step in the numerical integration of a system of
differential equations. The method used is Heun's.
.RS
.TP
\fIt\fR
Value of the independent variable (typically time)
at the beginning of the step.
.TP
\fItstep\fR
Step size for the independent variable.
.TP
\fIxvec\fR
List (vector) of dependent values
.TP
\fIfunc\fR
Function of t and the dependent values, returning
a list of the derivatives of the dependent values. (The lengths of
xvec and the return value of "func" must match).
.RE
.sp
.TP
\fB::math::calculus::rungeKuttaStep\fR \fIt\fR \fItstep\fR \fIxvec\fR \fIfunc\fR
Set a single step in the numerical integration of a system of
differential equations. The method used is Runge-Kutta 4th
order.
.RS
.TP
\fIt\fR
Value of the independent variable (typically time)
at the beginning of the step.
.TP
\fItstep\fR
Step size for the independent variable.
.TP
\fIxvec\fR
List (vector) of dependent values
.TP
\fIfunc\fR
Function of t and the dependent values, returning
a list of the derivatives of the dependent values. (The lengths of
xvec and the return value of "func" must match).
.RE
.sp
.TP
\fB::math::calculus::boundaryValueSecondOrder\fR \fIcoeff_func\fR \fIforce_func\fR \fIleftbnd\fR \fIrightbnd\fR \fInostep\fR
Solve a second order linear differential equation with boundary
values at two sides. The equation has to be of the form (the
"conservative" form):
.CS


         d      dy     d
         -- A(x)--  +  -- B(x)y + C(x)y  =  D(x)
         dx     dx     dx

.CE
.IP
Ordinarily, such an equation would be written as:
.CS


             d2y        dy
         a(x)---  + b(x)-- + c(x) y  =  D(x)
             dx2        dx

.CE
.IP
The first form is easier to discretise (by integrating over a
finite volume) than the second form. The relation between the two
forms is fairly straightforward:
.CS


         A(x)  =  a(x)
         B(x)  =  b(x) - a'(x)
         C(x)  =  c(x) - B'(x)  =  c(x) - b'(x) + a''(x)

.CE
.IP
Because of the differentiation, however, it is much easier to ask
the user to provide the functions A, B and C directly.
.RS
.TP
\fIcoeff_func\fR
Procedure returning the three coefficients
(A, B, C) of the equation, taking as its one argument the x-coordinate.
.TP
\fIforce_func\fR
Procedure returning the right-hand side
(D) as a function of the x-coordinate.
.TP
\fIleftbnd\fR
A list of two values: the x-coordinate of the
left boundary and the value at that boundary.
.TP
\fIrightbnd\fR
A list of two values: the x-coordinate of the
right boundary and the value at that boundary.
.TP
\fInostep\fR
Number of steps by which to discretise the
interval.
The procedure returns a list of x-coordinates and the approximated
values of the solution.
.RE
.sp
.TP
\fB::math::calculus::solveTriDiagonal\fR \fIacoeff\fR \fIbcoeff\fR \fIccoeff\fR \fIdvalue\fR
Solve a system of linear equations Ax = b with A a tridiagonal
matrix. Returns the solution as a list.
.RS
.TP
\fIacoeff\fR
List of values on the lower diagonal
.TP
\fIbcoeff\fR
List of values on the main diagonal
.TP
\fIccoeff\fR
List of values on the upper diagonal
.TP
\fIdvalue\fR
List of values on the righthand-side
.RE
.sp
.TP
\fB::math::calculus::newtonRaphson\fR \fIfunc\fR \fIderiv\fR \fIinitval\fR
Determine the root of an equation given by
.CS


    func(x) = 0

.CE
.IP
using the method of Newton-Raphson. The procedure takes the following
arguments:
.RS
.TP
\fIfunc\fR
Procedure that returns the value the function at x
.TP
\fIderiv\fR
Procedure that returns the derivative of the function at x
.TP
\fIinitval\fR
Initial value for x
.RE
.sp
.TP
\fB::math::calculus::newtonRaphsonParameters\fR \fImaxiter\fR \fItolerance\fR
Set the numerical parameters for the Newton-Raphson method:
.RS
.TP
\fImaxiter\fR
Maximum number of iteration steps (defaults to 20)
.TP
\fItolerance\fR
Relative precision (defaults to 0.001)
.RE
.TP
\fB::math::calculus::regula_falsi\fR \fIf\fR \fIxb\fR \fIxe\fR \fIeps\fR
Return an estimate of the zero or one of the zeros of the function
contained in the interval [xb,xe]. The error in this estimate is of the
order of eps*abs(xe-xb), the actual error may be slightly larger.
.sp
The method used is the so-called \fIregula falsi\fR or
\fIfalse position\fR method. It is a straightforward implementation.
The method is robust, but requires that the interval brackets a zero or
at least an uneven number of zeros, so that the value of the function at
the start has a different sign than the value at the end.
.sp
In contrast to Newton-Raphson there is no need for the computation of
the function's derivative.
.RS
.TP
command \fIf\fR
Name of the command that evaluates the function for
which the zero is to be returned
.TP
float \fIxb\fR
Start of the interval in which the zero is supposed
to lie
.TP
float \fIxe\fR
End of the interval
.TP
float \fIeps\fR
Relative allowed error (defaults to 1.0e-4)
.RE
.PP
.PP
\fINotes:\fR
.PP
Several of the above procedures take the \fInames\fR of procedures as
arguments. To avoid problems with the \fIvisibility\fR of these
procedures, the fully-qualified name of these procedures is determined
inside the calculus routines. For the user this has only one
consequence: the named procedure must be visible in the calling
procedure. For instance:
.CS


    namespace eval ::mySpace {
       namespace export calcfunc
       proc calcfunc { x } { return $x }
    }
    #
    # Use a fully-qualified name
    #
    namespace eval ::myCalc {
       proc detIntegral { begin end } {
          return [integral $begin $end 100 ::mySpace::calcfunc]
       }
    }
    #
    # Import the name
    #
    namespace eval ::myCalc {
       namespace import ::mySpace::calcfunc
       proc detIntegral { begin end } {
          return [integral $begin $end 100 calcfunc]
       }
    }

.CE
.PP
Enhancements for the second-order boundary value problem:
.IP \(bu
Other types of boundary conditions (zero gradient, zero flux)
.IP \(bu
Other schematisation of the first-order term (now central
differences are used, but upstream differences might be useful too).
.PP
.SH EXAMPLES
Let us take a few simple examples:
.PP
Integrate x over the interval [0,100] (20 steps):
.CS


proc linear_func { x } { return $x }
puts "Integral: [::math::calculus::integral 0 100 20 linear_func]"

.CE
For simple functions, the alternative could be:
.CS


puts "Integral: [::math::calculus::integralExpr 0 100 20 {$x}]"

.CE
Do not forget the braces!
.PP
The differential equation for a dampened oscillator:
.PP
.CS


x'' + rx' + wx = 0

.CE
.PP
can be split into a system of first-order equations:
.PP
.CS


x' = y
y' = -ry - wx

.CE
.PP
Then this system can be solved with code like this:
.PP
.CS


proc dampened_oscillator { t xvec } {
   set x  [lindex $xvec 0]
   set x1 [lindex $xvec 1]
   return [list $x1 [expr {-$x1-$x}]]
}

set xvec   { 1.0 0.0 }
set t      0.0
set tstep  0.1
for { set i 0 } { $i < 20 } { incr i } {
   set result [::math::calculus::eulerStep $t $tstep $xvec dampened_oscillator]
   puts "Result ($t): $result"
   set t      [expr {$t+$tstep}]
   set xvec   $result
}

.CE
.PP
Suppose we have the boundary value problem:
.PP
.CS


    Dy'' + ky = 0
    x = 0: y = 1
    x = L: y = 0

.CE
.PP
This boundary value problem could originate from the diffusion of a
decaying substance.
.PP
It can be solved with the following fragment:
.PP
.CS


   proc coeffs { x } { return [list $::Diff 0.0 $::decay] }
   proc force  { x } { return 0.0 }

   set Diff   1.0e-2
   set decay  0.0001
   set length 100.0

   set y [::math::calculus::boundaryValueSecondOrder \\
      coeffs force {0.0 1.0} [list $length 0.0] 100]

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: calculus\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
romberg
.SH KEYWORDS
calculus, differential equations, integration, math, roots
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2002,2003,2004 Arjen Markus

.fi

Added embedded/man/files/modules/math/combinatorics.n.




























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/combinatorics.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::combinatorics" n 1.2.3 tcllib "Tcl Math Library"
.BS
.SH NAME
math::combinatorics \- Combinatorial functions in the Tcl Math Library
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBmath  ?1.2.3?\fR
.sp
\fB::math::ln_Gamma\fR \fIz\fR
.sp
\fB::math::factorial\fR \fIx\fR
.sp
\fB::math::choose\fR \fIn k\fR
.sp
\fB::math::Beta\fR \fIz w\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBmath\fR package contains implementations of several
functions useful in combinatorial problems.
.SH COMMANDS
.TP
\fB::math::ln_Gamma\fR \fIz\fR
Returns the natural logarithm of the Gamma function for the argument
\fIz\fR.
.sp
The Gamma function is defined as the improper integral from zero to
positive infinity of
.CS


  t**(x-1)*exp(-t) dt

.CE
.sp
The approximation used in the Tcl Math Library is from Lanczos,
\fIISIAM J. Numerical Analysis, series B,\fR volume 1, p. 86.
For "\fBx\fR > 1", the absolute error of the result is claimed to be
smaller than 5.5*10**-10 -- that is, the resulting value of Gamma when
.CS


  exp( ln_Gamma( x) )

.CE
.IP
is computed is expected to be precise to better than nine significant
figures.
.TP
\fB::math::factorial\fR \fIx\fR
Returns the factorial of the argument \fIx\fR.
.sp
For integer \fIx\fR, 0 <= \fIx\fR <= 12, an exact integer result is
returned.
.sp
For integer \fIx\fR, 13 <= \fIx\fR <= 21, an exact floating-point
result is returned on machines with IEEE floating point.
.sp
For integer \fIx\fR, 22 <= \fIx\fR <= 170, the result is exact to 1
ULP.
.sp
For real \fIx\fR, \fIx\fR >= 0, the result is approximated by
computing \fIGamma(x+1)\fR using the \fB::math::ln_Gamma\fR
function, and the result is expected to be precise to better than nine
significant figures.
.sp
It is an error to present \fIx\fR <= -1 or \fIx\fR > 170, or a value
of \fIx\fR that is not numeric.
.TP
\fB::math::choose\fR \fIn k\fR
Returns the binomial coefficient \fIC(n, k)\fR
.CS


   C(n,k) = n! / k! (n-k)!

.CE
.IP
If both parameters are integers and the result fits in 32 bits, the
result is rounded to an integer.
.sp
Integer results are exact up to at least \fIn\fR = 34.  Floating point
results are precise to better than nine significant figures.
.TP
\fB::math::Beta\fR \fIz w\fR
Returns the Beta function of the parameters \fIz\fR and \fIw\fR.
.CS


   Beta(z,w) = Beta(w,z) = Gamma(z) * Gamma(w) / Gamma(z+w)

.CE
.IP
Results are returned as a floating point number precise to better than
nine significant digits provided that \fIw\fR and \fIz\fR are both at
least 1.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH CATEGORY
Mathematics

Added embedded/man/files/modules/math/constants.n.





























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/constants.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Arjen Markus <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::constants" n 1.0.1 tcllib "Tcl Math Library"
.BS
.SH NAME
math::constants \- Mathematical and numerical constants
.SH SYNOPSIS
package require \fBTcl  ?8.3?\fR
.sp
package require \fBmath::constants  ?1.0.1?\fR
.sp
\fB::math::constants::constants\fR \fIargs\fR
.sp
\fB::math::constants::print-constants\fR \fIargs\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package defines some common mathematical and numerical constants.
By using the package you get consistent values for numbers like pi and
ln(10).
.PP
It defines two commands:
.IP \(bu
One for importing the constants
.IP \(bu
One for reporting which constants are defined and what values they
actually have.
.PP
.PP
The motivation for this package is that quite often, with
(mathematical) computations, you need a good approximation to, say,
the ratio of degrees to radians. You can, of course, define this
like:
.CS


    variable radtodeg [expr {180.0/(4.0*atan(1.0))}]

.CE
and use the variable radtodeg whenever you need the conversion.
.PP
This has two drawbacks:
.IP \(bu
You need to remember the proper formula or value and that is
error-prone.
.IP \(bu
Especially with the use of mathematical functions like \fIatan\fR
you assume that they have been accurately implemented. This is seldom or
never the case and for each platform you can get subtle differences.
.PP
Here is the way you can do it with the \fImath::constants\fR package:
.CS


    package require math::constants
    ::math::constants::constants radtodeg degtorad

.CE
which creates two variables, radtodeg and (its reciprocal) degtorad
in the calling namespace.
.PP
Constants that have been defined (their values are mostly taken
from mathematical tables with more precision than usually can be
handled) include:
.IP \(bu
basic constants like pi, e, gamma (Euler's constant)
.IP \(bu
derived values like ln(10) and sqrt(2)
.IP \(bu
purely numerical values such as 1/3 that are included for convenience
and for the fact that certain seemingly trivial computations like:
.CS


    set value [expr {3.0*$onethird}]

.CE
.IP
give \fIexactly\fR the value you expect (if IEEE arithmetic is
available).
.PP
.SH PROCEDURES
The package defines the following public procedures:
.TP
\fB::math::constants::constants\fR \fIargs\fR
Import the constants whose names are given as arguments
.sp
.TP
\fB::math::constants::print-constants\fR \fIargs\fR
Print the constants whose names are given as arguments on the screen
(name, value and description) or, if no arguments are given, print all
defined constants. This is mainly a convenience procedure.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: constants\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
constants, degrees, e, math, pi, radians
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Arjen Markus <[email protected]>

.fi

Added embedded/man/files/modules/math/decimal.n.














































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/decimal.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Mark Alston <mark at beernut dot com>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::decimal" n 1.0.2 tcllib "Tcl Decimal Arithmetic Library"
.BS
.SH NAME
math::decimal \- General decimal arithmetic
.SH SYNOPSIS
package require \fBTcl  ?8.5?\fR
.sp
\fB::math::decimal::fromstr\fR \fIstring\fR
.sp
\fB::math::decimal::tostr\fR \fIdecimal\fR
.sp
\fB::math::decimal::setVariable\fR \fIvariable\fR \fIsetting\fR
.sp
\fB::math::decimal::add\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::+\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::subtract\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::-\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::multiply\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::*\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::divide\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::/\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::divideint\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::remainder\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::abs\fR \fIdecimal\fR
.sp
\fB::math::decimal::compare\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::max\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::maxmag\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::min\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::minmag\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::plus\fR \fIa\fR
.sp
\fB::math::decimal::minus\fR \fIa\fR
.sp
\fB::math::decimal::copynegate\fR \fIa\fR
.sp
\fB::math::decimal::copysign\fR \fIa\fR \fIb\fR
.sp
\fB::math::decimal::is-signed\fR \fIdecimal\fR
.sp
\fB::math::decimal::is-zero\fR \fIdecimal\fR
.sp
\fB::math::decimal::is-NaN\fR \fIdecimal\fR
.sp
\fB::math::decimal::is-infinite\fR \fIdecimal\fR
.sp
\fB::math::decimal::is-finite\fR \fIdecimal\fR
.sp
\fB::math::decimal::fma\fR \fIa\fR \fIb\fR \fIc\fR
.sp
\fB::math::decimal::round_half_even\fR \fIdecimal\fR \fIdigits\fR
.sp
\fB::math::decimal::round_half_up\fR \fIdecimal\fR \fIdigits\fR
.sp
\fB::math::decimal::round_half_down\fR \fIdecimal\fR \fIdigits\fR
.sp
\fB::math::decimal::round_down\fR \fIdecimal\fR \fIdigits\fR
.sp
\fB::math::decimal::round_up\fR \fIdecimal\fR \fIdigits\fR
.sp
\fB::math::decimal::round_floor\fR \fIdecimal\fR \fIdigits\fR
.sp
\fB::math::decimal::round_ceiling\fR \fIdecimal\fR \fIdigits\fR
.sp
\fB::math::decimal::round_05up\fR \fIdecimal\fR \fIdigits\fR
.sp
.BE
.SH DESCRIPTION
.PP
The decimal package provides decimal arithmetic support for both limited
precision floating point and arbitrary precision floating point.
Additionally, integer arithmetic is supported.
.PP
More information and the specifications on which this package depends can be
found on the general decimal arithmetic page at http://speleotrove.com/decimal
This package provides for:
.IP \(bu
A new data type decimal which is represented as a list containing sign,
mantissa and exponent.
.IP \(bu
Arithmetic operations on those decimal numbers such as addition, subtraction,
multiplication, etc...
.PP
.PP
Numbers are converted to decimal format using the operation ::math::decimal::fromstr.
.PP
Numbers are converted back to string format using the operation
::math::decimal::tostr.
.PP
.SH EXAMPLES
This section shows some simple examples. Since the purpose of this library
is to perform decimal math operations, examples may be the simplest way
to learn how to work with it and to see the difference between using this
package and sticking with expr. Consult the API section of
this man page for information about individual procedures.
.PP
.CS


    package require decimal

    # Various operations on two numbers.
    # We first convert them to decimal format.
    set a [::math::decimal::fromstr 8.2]
    set b [::math::decimal::fromstr .2]

    # Then we perform our operations. Here we multiply
    set c [::math::decimal::* $a $b]

    # Finally we convert back to string format for presentation to the user.
    puts [::math::decimal::tostr $c] ; # => will output 8.4

    # Other examples
    #
    # Subtraction
    set c [::math::decimal::- $a $b]
    puts [::math::decimal::tostr $c] ; # => will output 8.0

    # Why bother using this instead of simply expr?
    puts 8.399999999999999 ; # => will output 8.399999999999999
    puts 7.999999999999999 ; # => will output 7.999999999999999
    # See http://speleotrove.com/decimal to learn more about why this happens.

.CE
.SH API
.TP
\fB::math::decimal::fromstr\fR \fIstring\fR
Convert \fIstring\fR into a decimal.
.TP
\fB::math::decimal::tostr\fR \fIdecimal\fR
Convert \fIdecimal\fR into a string representing the number in base 10.
.TP
\fB::math::decimal::setVariable\fR \fIvariable\fR \fIsetting\fR
Sets the \fIvariable\fR to \fIsetting\fR. Valid variables are:
.RS
.IP \(bu
\fIrounding\fR - Method of rounding to use during rescale. Valid
methods are round_half_even, round_half_up, round_half_down,
round_down, round_up, round_floor, round_ceiling.
.IP \(bu
\fIprecision\fR - Maximum number of digits allowed in mantissa.
.IP \(bu
\fIextended\fR - Set to 1 for extended mode. 0 for simplified mode.
.IP \(bu
\fImaxExponent\fR - Maximum value for the exponent. Defaults to 999.
.IP \(bu
\fIminExponent\fR - Minimum value for the exponent. Default to -998.
.RE
.TP
\fB::math::decimal::add\fR \fIa\fR \fIb\fR
.TP
\fB::math::decimal::+\fR \fIa\fR \fIb\fR
Return the sum of the two decimals \fIa\fR and \fIb\fR.
.TP
\fB::math::decimal::subtract\fR \fIa\fR \fIb\fR
.TP
\fB::math::decimal::-\fR \fIa\fR \fIb\fR
Return the differnece of the two decimals \fIa\fR and \fIb\fR.
.TP
\fB::math::decimal::multiply\fR \fIa\fR \fIb\fR
.TP
\fB::math::decimal::*\fR \fIa\fR \fIb\fR
Return the product of the two decimals \fIa\fR and \fIb\fR.
.TP
\fB::math::decimal::divide\fR \fIa\fR \fIb\fR
.TP
\fB::math::decimal::/\fR \fIa\fR \fIb\fR
Return the quotient of the division between the two
decimals \fIa\fR and \fIb\fR.
.TP
\fB::math::decimal::divideint\fR \fIa\fR \fIb\fR
Return a the integer portion of the quotient of the division between
decimals \fIa\fR and \fIb\fR
.TP
\fB::math::decimal::remainder\fR \fIa\fR \fIb\fR
Return the remainder of the division between the two
decimals \fIa\fR and \fIb\fR.
.TP
\fB::math::decimal::abs\fR \fIdecimal\fR
Return the absolute value of the decimal.
.TP
\fB::math::decimal::compare\fR \fIa\fR \fIb\fR
Compare the two decimals a and b, returning \fI0\fR if \fIa == b\fR,
\fI1\fR if \fIa > b\fR, and \fI-1\fR if \fIa < b\fR.
.TP
\fB::math::decimal::max\fR \fIa\fR \fIb\fR
Compare the two decimals a and b, and return \fIa\fR if \fIa >= b\fR, and \fIb\fR if \fIa < b\fR.
.TP
\fB::math::decimal::maxmag\fR \fIa\fR \fIb\fR
Compare the two decimals a and b while ignoring their signs, and return \fIa\fR if \fIabs(a) >= abs(b)\fR, and \fIb\fR if \fIabs(a) < abs(b)\fR.
.TP
\fB::math::decimal::min\fR \fIa\fR \fIb\fR
Compare the two decimals a and b, and return \fIa\fR if \fIa <= b\fR, and \fIb\fR if \fIa > b\fR.
.TP
\fB::math::decimal::minmag\fR \fIa\fR \fIb\fR
Compare the two decimals a and b while ignoring their signs, and return \fIa\fR if \fIabs(a) <= abs(b)\fR, and \fIb\fR if \fIabs(a) > abs(b)\fR.
.TP
\fB::math::decimal::plus\fR \fIa\fR
Return the result from \fI::math::decimal::+ 0 $a\fR.
.TP
\fB::math::decimal::minus\fR \fIa\fR
Return the result from \fI::math::decimal::- 0 $a\fR.
.TP
\fB::math::decimal::copynegate\fR \fIa\fR
Returns \fIa\fR with the sign flipped.
.TP
\fB::math::decimal::copysign\fR \fIa\fR \fIb\fR
Returns \fIa\fR with the sign set to the sign of the \fIb\fR.
.TP
\fB::math::decimal::is-signed\fR \fIdecimal\fR
Return the sign of the decimal.
The procedure returns 0 if the number is positive, 1 if it's negative.
.TP
\fB::math::decimal::is-zero\fR \fIdecimal\fR
Return true if \fIdecimal\fR value is zero, otherwise false is returned.
.TP
\fB::math::decimal::is-NaN\fR \fIdecimal\fR
Return true if \fIdecimal\fR value is NaN (not a number), otherwise false is returned.
.TP
\fB::math::decimal::is-infinite\fR \fIdecimal\fR
Return true if \fIdecimal\fR value is Infinite, otherwise false is returned.
.TP
\fB::math::decimal::is-finite\fR \fIdecimal\fR
Return true if \fIdecimal\fR value is finite, otherwise false is returned.
.TP
\fB::math::decimal::fma\fR \fIa\fR \fIb\fR \fIc\fR
Return the result from first multiplying \fIa\fR by \fIb\fR and then adding \fIc\fR. Rescaling only occurs after completion of all operations. In this way the result may vary from that returned by performing the operations individually.
.TP
\fB::math::decimal::round_half_even\fR \fIdecimal\fR \fIdigits\fR
Rounds \fIdecimal\fR to \fIdigits\fR number of decimal points with the following rules: Round to the nearest. If equidistant, round so the final digit is even.
.TP
\fB::math::decimal::round_half_up\fR \fIdecimal\fR \fIdigits\fR
Rounds \fIdecimal\fR to \fIdigits\fR number of decimal points with the following rules: Round to the nearest. If equidistant, round up.
.TP
\fB::math::decimal::round_half_down\fR \fIdecimal\fR \fIdigits\fR
Rounds \fIdecimal\fR to \fIdigits\fR number of decimal points with the following rules: Round to the nearest. If equidistant, round down.
.TP
\fB::math::decimal::round_down\fR \fIdecimal\fR \fIdigits\fR
Rounds \fIdecimal\fR to \fIdigits\fR number of decimal points with the following rules: Round toward 0.  (Truncate)
.TP
\fB::math::decimal::round_up\fR \fIdecimal\fR \fIdigits\fR
Rounds \fIdecimal\fR to \fIdigits\fR number of decimal points with the following rules: Round away from 0
.TP
\fB::math::decimal::round_floor\fR \fIdecimal\fR \fIdigits\fR
Rounds \fIdecimal\fR to \fIdigits\fR number of decimal points with the following rules: Round toward -Infinity.
.TP
\fB::math::decimal::round_ceiling\fR \fIdecimal\fR \fIdigits\fR
Rounds \fIdecimal\fR to \fIdigits\fR number of decimal points with the following rules: Round toward Infinity
.TP
\fB::math::decimal::round_05up\fR \fIdecimal\fR \fIdigits\fR
Rounds \fIdecimal\fR to \fIdigits\fR number of decimal points with the following rules: Round zero or five away from 0. The same as round-up, except that rounding up only occurs if the digit to be rounded up is 0 or 5, and after overflow
the result is the same as for round-down.
.PP
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIDecimal\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
decimal, math, tcl
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2011 Mark Alston <mark at beernut dot com>

.fi

Added embedded/man/files/modules/math/fourier.n.



































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/fourier.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::fourier" n 1.0.2 tcllib "Tcl Math Library"
.BS
.SH NAME
math::fourier \- Discrete and fast fourier transforms
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmath::fourier  1.0.2\fR
.sp
\fB::math::fourier::dft\fR \fIin_data\fR
.sp
\fB::math::fourier::inverse_dft\fR \fIin_data\fR
.sp
\fB::math::fourier::lowpass\fR \fIcutoff\fR \fIin_data\fR
.sp
\fB::math::fourier::highpass\fR \fIcutoff\fR \fIin_data\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBmath::fourier\fR package implements two versions of discrete
Fourier transforms, the ordinary transform and the fast Fourier
transform. It also provides a few simple filter procedures as an
illustrations of how such filters can be implemented.
.PP
The purpose of this document is to describe the implemented procedures
and provide some examples of their usage. As there is ample literature
on the algorithms involved, we refer to relevant text books for more
explanations. We also refer to the original Wiki page on the subject
which describes some of the considerations behind the current
implementation.
.SH "GENERAL INFORMATION"
The two top-level procedures defined are
.IP \(bu
dft data-list
.IP \(bu
inverse_dft data-list
.PP
Both take a list of \fIcomplex numbers\fR and apply a Discrete Fourier
Transform (DFT) or its inverse respectively to these lists of numbers.
A "complex number" in this case is either (i) a pair (two element list) of
numbers, interpreted as the real and imaginary parts of the complex number,
or (ii) a single number, interpreted as the real part of a complex number
whose imaginary part is zero. The return value is always in the
first format. (The DFT generally produces complex results even if the
input is purely real.) Applying first one and then the other of these
procedures to a list of complex numbers will (modulo rounding errors
due to floating point arithmetic) return the original list of numbers.
.PP
If the input length N is a power of two then these procedures will
utilize the O(N log N) Fast Fourier Transform algorithm. If input
length is not a power of two then the DFT will instead be computed
using a the naive quadratic algorithm.
.PP
Some examples:
.CS


    % dft {1 2 3 4}
    {10 0.0} {-2.0 2.0} {-2 0.0} {-2.0 -2.0}
    % inverse_dft {{10 0.0} {-2.0 2.0} {-2 0.0} {-2.0 -2.0}}
    {1.0 0.0} {2.0 0.0} {3.0 0.0} {4.0 0.0}
    % dft {1 2 3 4 5}
    {15.0 0.0} {-2.5 3.44095480118} {-2.5 0.812299240582} {-2.5 -0.812299240582} {-2.5 -3.44095480118}
    % inverse_dft {{15.0 0.0} {-2.5 3.44095480118} {-2.5 0.812299240582} {-2.5 -0.812299240582} {-2.5 -3.44095480118}}
    {1.0 0.0} {2.0 8.881784197e-17} {3.0 4.4408920985e-17} {4.0 4.4408920985e-17} {5.0 -8.881784197e-17}

.CE
.PP
In the last case, the imaginary parts <1e-16 would have been zero in exact
arithmetic, but aren't here due to rounding errors.
.PP
Internally, the procedures use a flat list format where every even
index element of a list is a real part and every odd index element
is an imaginary part. This is reflected in the variable names by Re_
and Im_ prefixes.
.PP
The package includes two simple filters. They have an analogue
equivalent in a simple electronic circuit, a resistor and a capacitance
in series. Using these filters requires the
\fBmath::complexnumbers\fR package.
.SH PROCEDURES
The public Fourier transform procedures are:
.TP
\fB::math::fourier::dft\fR \fIin_data\fR
Determine the \fIFourier transform\fR of the given list of complex
numbers. The result is a list of complex numbers representing the
(complex) amplitudes of the Fourier components.
.RS
.TP
list \fIin_data\fR
List of data
.RE
.sp
.TP
\fB::math::fourier::inverse_dft\fR \fIin_data\fR
Determine the \fIinverse Fourier transform\fR of the given list of
complex numbers (interpreted as amplitudes). The result is a list of
complex numbers representing the original (complex) data
.RS
.TP
list \fIin_data\fR
List of data (amplitudes)
.RE
.sp
.TP
\fB::math::fourier::lowpass\fR \fIcutoff\fR \fIin_data\fR
Filter the (complex) amplitudes so that high-frequency components
are suppressed. The implemented filter is a first-order low-pass filter,
the discrete equivalent of a simple electronic circuit with a resistor
and a capacitance.
.RS
.TP
float \fIcutoff\fR
Cut-off frequency
.TP
list \fIin_data\fR
List of data (amplitudes)
.RE
.sp
.TP
\fB::math::fourier::highpass\fR \fIcutoff\fR \fIin_data\fR
Filter the (complex) amplitudes so that low-frequency components
are suppressed. The implemented filter is a first-order low-pass filter,
the discrete equivalent of a simple electronic circuit with a resistor
and a capacitance.
.RS
.TP
float \fIcutoff\fR
Cut-off frequency
.TP
list \fIin_data\fR
List of data (amplitudes)
.RE
.sp
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: fourier\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
FFT, Fourier transform, complex numbers, mathematics
.SH CATEGORY
Mathematics

Added embedded/man/files/modules/math/fuzzy.n.





































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/fuzzy.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::fuzzy" n 0.2 tcllib "Tcl Math Library"
.BS
.SH NAME
math::fuzzy \- Fuzzy comparison of floating-point numbers
.SH SYNOPSIS
package require \fBTcl  ?8.3?\fR
.sp
package require \fBmath::fuzzy  ?0.2?\fR
.sp
\fB::math::fuzzy::teq\fR \fIvalue1\fR \fIvalue2\fR
.sp
\fB::math::fuzzy::tne\fR \fIvalue1\fR \fIvalue2\fR
.sp
\fB::math::fuzzy::tge\fR \fIvalue1\fR \fIvalue2\fR
.sp
\fB::math::fuzzy::tle\fR \fIvalue1\fR \fIvalue2\fR
.sp
\fB::math::fuzzy::tlt\fR \fIvalue1\fR \fIvalue2\fR
.sp
\fB::math::fuzzy::tgt\fR \fIvalue1\fR \fIvalue2\fR
.sp
\fB::math::fuzzy::tfloor\fR \fIvalue\fR
.sp
\fB::math::fuzzy::tceil\fR \fIvalue\fR
.sp
\fB::math::fuzzy::tround\fR \fIvalue\fR
.sp
\fB::math::fuzzy::troundn\fR \fIvalue\fR \fIndigits\fR
.sp
.BE
.SH DESCRIPTION
.PP
The package Fuzzy is meant to solve common problems with floating-point
numbers in a systematic way:
.IP \(bu
Comparing two numbers that are "supposed" to be identical, like
1.0 and 2.1/(1.2+0.9) is not guaranteed to give the
intuitive result.
.IP \(bu
Rounding a number that is halfway two integer numbers can cause
strange errors, like int(100.0*2.8) != 28 but 27
.PP
.PP
The Fuzzy package is meant to help sorting out this type of problems
by defining "fuzzy" comparison procedures for floating-point numbers.
It does so by allowing for a small margin that is determined
automatically - the margin is three times the "epsilon" value, that is
three times the smallest number \fIeps\fR such that 1.0 and 1.0+$eps
canbe distinguished. In Tcl, which uses double precision floating-point
numbers, this is typically 1.1e-16.
.SH PROCEDURES
Effectively the package provides the following procedures:
.TP
\fB::math::fuzzy::teq\fR \fIvalue1\fR \fIvalue2\fR
Compares two floating-point numbers and returns 1 if their values
fall within a small range. Otherwise it returns 0.
.TP
\fB::math::fuzzy::tne\fR \fIvalue1\fR \fIvalue2\fR
Returns the negation, that is, if the difference is larger than
the margin, it returns 1.
.TP
\fB::math::fuzzy::tge\fR \fIvalue1\fR \fIvalue2\fR
Compares two floating-point numbers and returns 1 if their values
either fall within a small range or if the first number is larger
than the second. Otherwise it returns 0.
.TP
\fB::math::fuzzy::tle\fR \fIvalue1\fR \fIvalue2\fR
Returns 1 if the two numbers are equal according to
[teq] or if the first is smaller than the second.
.TP
\fB::math::fuzzy::tlt\fR \fIvalue1\fR \fIvalue2\fR
Returns the opposite of [tge].
.TP
\fB::math::fuzzy::tgt\fR \fIvalue1\fR \fIvalue2\fR
Returns the opposite of [tle].
.TP
\fB::math::fuzzy::tfloor\fR \fIvalue\fR
Returns the integer number that is lower or equal
to the given floating-point number, within a well-defined
tolerance.
.TP
\fB::math::fuzzy::tceil\fR \fIvalue\fR
Returns the integer number that is greater or equal to the given
floating-point number, within a well-defined tolerance.
.TP
\fB::math::fuzzy::tround\fR \fIvalue\fR
Rounds the floating-point number off.
.TP
\fB::math::fuzzy::troundn\fR \fIvalue\fR \fIndigits\fR
Rounds the floating-point number off to the
specified number of decimals (Pro memorie).
.PP
Usage:
.CS


if { [teq $x $y] } { puts "x == y" }
if { [tne $x $y] } { puts "x != y" }
if { [tge $x $y] } { puts "x >= y" }
if { [tgt $x $y] } { puts "x > y" }
if { [tlt $x $y] } { puts "x < y" }
if { [tle $x $y] } { puts "x <= y" }

set fx      [tfloor $x]
set fc      [tceil  $x]
set rounded [tround $x]
set roundn  [troundn $x $nodigits]

.CE
.SH "TEST CASES"
The problems that can occur with floating-point numbers are illustrated
by the test cases in the file "fuzzy.test":
.IP \(bu
Several test case use the ordinary comparisons, and they
fail invariably to produce understandable results
.IP \(bu
One test case uses [expr] without braces ({ and }). It too
fails.
.PP
The conclusion from this is that any expression should be surrounded by
braces, because otherwise very awkward things can happen if you need
accuracy. Furthermore, accuracy and understandable results are
enhanced by using these "tolerant" or fuzzy comparisons.
.PP
Note that besides the Tcl-only package, there is also a C-based version.
.SH REFERENCES
Original implementation in Fortran by dr. H.D. Knoble (Penn State
University).
.PP
P. E. Hagerty, "More on Fuzzy Floor and Ceiling,"
APL QUOTE QUAD 8(4):20-24, June 1978. Note that TFLOOR=FL5 took five
years of refereed evolution (publication).
.PP
L. M. Breed, "Definitions for Fuzzy Floor and Ceiling",
APL QUOTE QUAD 8(3):16-23, March 1978.
.PP
D. Knuth, Art of Computer Programming,
Vol. 1, Problem 1.2.4-5.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: fuzzy\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
floating-point, math, rounding
.SH CATEGORY
Mathematics

Added embedded/man/files/modules/math/interpolate.n.











































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/interpolate.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Arjen Markus <[email protected]>
'\" Copyright (c) 2004 Kevn B. Kenny <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::interpolate" n 1.0.2 tcllib "Tcl Math Library"
.BS
.SH NAME
math::interpolate \- Interpolation routines
.SH SYNOPSIS
package require \fBTcl  ?8.4?\fR
.sp
package require \fBstruct \fR
.sp
package require \fBmath::interpolate  ?1.0.2?\fR
.sp
\fB::math::interpolate::defineTable\fR \fIname\fR \fIcolnames\fR \fIvalues\fR
.sp
\fB::math::interpolate::interp-1d-table\fR \fIname\fR \fIxval\fR
.sp
\fB::math::interpolate::interp-table\fR \fIname\fR \fIxval\fR \fIyval\fR
.sp
\fB::math::interpolate::interp-linear\fR \fIxyvalues\fR \fIxval\fR
.sp
\fB::math::interpolate::interp-lagrange\fR \fIxyvalues\fR \fIxval\fR
.sp
\fB::math::interpolate::prepare-cubic-splines\fR \fIxcoord\fR \fIycoord\fR
.sp
\fB::math::interpolate::interp-cubic-splines\fR \fIcoeffs\fR \fIx\fR
.sp
\fB::math::interpolate::interp-spatial\fR \fIxyvalues\fR \fIcoord\fR
.sp
\fB::math::interpolate::interp-spatial-params\fR \fImax_search\fR \fIpower\fR
.sp
\fB::math::interpolate::neville\fR \fIxlist\fR \fIylist\fR \fIx\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package implements several interpolation algorithms:
.IP \(bu
Interpolation into a table (one or two independent variables), this is useful
for example, if the data are static, like with tables of statistical functions.
.IP \(bu
Linear interpolation into a given set of data (organised as (x,y) pairs).
.IP \(bu
Lagrange interpolation. This is mainly of theoretical interest, because there is
no guarantee about error bounds. One possible use: if you need a line or
a parabola through given points (it will calculate the values, but not return
the coefficients).
.sp
A variation is Neville's method which has better behaviour and error
bounds.
.IP \(bu
Spatial interpolation using a straightforward distance-weight method. This procedure
allows any number of spatial dimensions and any number of dependent variables.
.IP \(bu
Interpolation in one dimension using cubic splines.
.PP
.PP
This document describes the procedures and explains their usage.
.SH PROCEDURES
The interpolation package defines the following public procedures:
.TP
\fB::math::interpolate::defineTable\fR \fIname\fR \fIcolnames\fR \fIvalues\fR
Define a table with one or two independent variables (the distinction is implicit in
the data). The procedure returns the name of the table - this name is used whenever you
want to interpolate the values. \fINote:\fR this procedure is a convenient wrapper for the
struct::matrix procedure. Therefore you can access the data at any location in your program.
.RS
.TP
string \fIname\fR (in)
Name of the table to be created
.TP
list \fIcolnames\fR (in)
List of column names
.TP
list \fIvalues\fR (in)
List of values (the number of elements should be a
multiple of the number of columns. See \fBEXAMPLES\fR for more information on the
interpretation of the data.
.sp
The values must be sorted with respect to the independent variable(s).
.RE
.sp
.TP
\fB::math::interpolate::interp-1d-table\fR \fIname\fR \fIxval\fR
Interpolate into the one-dimensional table "name" and return a list of values, one for
each dependent column.
.RS
.TP
string \fIname\fR (in)
Name of an existing table
.TP
float \fIxval\fR (in)
Value of the independent \fIrow\fR variable
.RE
.sp
.TP
\fB::math::interpolate::interp-table\fR \fIname\fR \fIxval\fR \fIyval\fR
Interpolate into the two-dimensional table "name" and return the interpolated value.
.RS
.TP
string \fIname\fR (in)
Name of an existing table
.TP
float \fIxval\fR (in)
Value of the independent \fIrow\fR variable
.TP
float \fIyval\fR (in)
Value of the independent \fIcolumn\fR variable
.RE
.sp
.TP
\fB::math::interpolate::interp-linear\fR \fIxyvalues\fR \fIxval\fR
Interpolate linearly into the list of x,y pairs and return the interpolated value.
.RS
.TP
list \fIxyvalues\fR (in)
List of pairs of (x,y) values, sorted to increasing x.
They are used as the breakpoints of a piecewise linear function.
.TP
float \fIxval\fR (in)
Value of the independent variable for which the value of y
must be computed.
.RE
.sp
.TP
\fB::math::interpolate::interp-lagrange\fR \fIxyvalues\fR \fIxval\fR
Use the list of x,y pairs to construct the unique polynomial of lowest degree
that passes through all points and return the interpolated value.
.RS
.TP
list \fIxyvalues\fR (in)
List of pairs of (x,y) values
.TP
float \fIxval\fR (in)
Value of the independent variable for which the value of y
must be computed.
.RE
.sp
.TP
\fB::math::interpolate::prepare-cubic-splines\fR \fIxcoord\fR \fIycoord\fR
Returns a list of coefficients for the second routine
\fIinterp-cubic-splines\fR to actually interpolate.
.RS
.TP
list \fIxcoord\fR
List of x-coordinates for the value of the
function to be interpolated is known. The coordinates must be strictly
ascending. At least three points are required.
.TP
list \fIycoord\fR
List of y-coordinates (the values of the
function at the given x-coordinates).
.RE
.sp
.TP
\fB::math::interpolate::interp-cubic-splines\fR \fIcoeffs\fR \fIx\fR
Returns the interpolated value at coordinate x. The coefficients are
computed by the procedure \fIprepare-cubic-splines\fR.
.RS
.TP
list \fIcoeffs\fR
List of coefficients as returned by
prepare-cubic-splines
.TP
float \fIx\fR
x-coordinate at which to estimate the function. Must
be between the first and last x-coordinate for which values were given.
.RE
.sp
.TP
\fB::math::interpolate::interp-spatial\fR \fIxyvalues\fR \fIcoord\fR
Use a straightforward interpolation method with weights as function of the
inverse distance to interpolate in 2D and N-dimensional space
.sp
The list xyvalues is a list of lists:
.CS


    {   {x1 y1 z1 {v11 v12 v13 v14}}
	{x2 y2 z2 {v21 v22 v23 v24}}
	...
    }

.CE
.IP
The last element of each inner list is either a single number or a list in itself.
In the latter case the return value is a list with the same number of elements.
.sp
The method is influenced by the search radius and the power of the inverse distance
.RS
.TP
list \fIxyvalues\fR (in)
List of lists, each sublist being a list of coordinates and
of dependent values.
.TP
list \fIcoord\fR (in)
List of coordinates for which the values must be calculated
.RE
.sp
.TP
\fB::math::interpolate::interp-spatial-params\fR \fImax_search\fR \fIpower\fR
Set the parameters for spatial interpolation
.RS
.TP
float \fImax_search\fR (in)
Search radius (data points further than this are ignored)
.TP
integer \fIpower\fR (in)
Power for the distance (either 1 or 2; defaults to 2)
.RE
.TP
\fB::math::interpolate::neville\fR \fIxlist\fR \fIylist\fR \fIx\fR
Interpolates between the tabulated values of a function
whose abscissae are \fIxlist\fR
and whose ordinates are \fIylist\fR to produce an estimate for the value
of the function at \fIx\fR.  The result is a two-element list; the first
element is the function's estimated value, and the second is an estimate
of the absolute error of the result.  Neville's algorithm for polynomial
interpolation is used.  Note that a large table of values will use an
interpolating polynomial of high degree, which is likely to result in
numerical instabilities; one is better off using only a few tabulated
values near the desired abscissa.
.PP
.SH EXAMPLES
\fITODO\fR
Example of using the cubic splines:
.PP
Suppose the following values are given:
.CS


    x       y
  0.1     1.0
  0.3     2.1
  0.4     2.2
  0.8     4.11
  1.0     4.12

.CE
Then to estimate the values at 0.1, 0.2, 0.3, ... 1.0, you can use:
.CS


   set coeffs [::math::interpolate::prepare-cubic-splines  {0.1 0.3 0.4 0.8  1.0}  {1.0 2.1 2.2 4.11 4.12}]
   foreach x {0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0} {
      puts "$x: [::math::interpolate::interp-cubic-splines $coeffs $x]"
   }

.CE
to get the following output:
.CS


0.1: 1.0
0.2: 1.68044117647
0.3: 2.1
0.4: 2.2
0.5: 3.11221507353
0.6: 4.25242647059
0.7: 5.41804227941
0.8: 4.11
0.9: 3.95675857843
1.0: 4.12

.CE
As you can see, the values at the abscissae are reproduced perfectly.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: interpolate\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
interpolation, math, spatial interpolation
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Arjen Markus <[email protected]>
Copyright (c) 2004 Kevn B. Kenny <[email protected]>

.fi

Added embedded/man/files/modules/math/linalg.n.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/linalg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004-2008 Arjen Markus <[email protected]>
'\" Copyright (c) 2004 Ed Hume <http://www.hume.com/contact.us.htm>
'\" Copyright (c) 2008 Michael Buadin <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::linearalgebra" n 1.1 tcllib "Tcl Math Library"
.BS
.SH NAME
math::linearalgebra \- Linear Algebra
.SH SYNOPSIS
package require \fBTcl  ?8.4?\fR
.sp
package require \fBmath::linearalgebra  ?1.1?\fR
.sp
\fB::math::linearalgebra::mkVector\fR \fIndim\fR \fIvalue\fR
.sp
\fB::math::linearalgebra::mkUnitVector\fR \fIndim\fR \fIndir\fR
.sp
\fB::math::linearalgebra::mkMatrix\fR \fInrows\fR \fIncols\fR \fIvalue\fR
.sp
\fB::math::linearalgebra::getrow\fR \fImatrix\fR \fIrow\fR ?imin? ?imax?
.sp
\fB::math::linearalgebra::setrow\fR \fImatrix\fR \fIrow\fR \fInewvalues\fR ?imin? ?imax?
.sp
\fB::math::linearalgebra::getcol\fR \fImatrix\fR \fIcol\fR ?imin? ?imax?
.sp
\fB::math::linearalgebra::setcol\fR \fImatrix\fR \fIcol\fR \fInewvalues\fR ?imin? ?imax?
.sp
\fB::math::linearalgebra::getelem\fR \fImatrix\fR \fIrow\fR \fIcol\fR
.sp
\fB::math::linearalgebra::setelem\fR \fImatrix\fR \fIrow\fR ?col? \fInewvalue\fR
.sp
\fB::math::linearalgebra::swaprows\fR \fImatrix\fR \fIirow1\fR \fIirow2\fR ?imin? ?imax?
.sp
\fB::math::linearalgebra::swapcols\fR \fImatrix\fR \fIicol1\fR \fIicol2\fR ?imin? ?imax?
.sp
\fB::math::linearalgebra::show\fR \fIobj\fR ?format? ?rowsep? ?colsep?
.sp
\fB::math::linearalgebra::dim\fR \fIobj\fR
.sp
\fB::math::linearalgebra::shape\fR \fIobj\fR
.sp
\fB::math::linearalgebra::conforming\fR \fItype\fR \fIobj1\fR \fIobj2\fR
.sp
\fB::math::linearalgebra::symmetric\fR \fImatrix\fR ?eps?
.sp
\fB::math::linearalgebra::norm\fR \fIvector\fR \fItype\fR
.sp
\fB::math::linearalgebra::norm_one\fR \fIvector\fR
.sp
\fB::math::linearalgebra::norm_two\fR \fIvector\fR
.sp
\fB::math::linearalgebra::norm_max\fR \fIvector\fR ?index?
.sp
\fB::math::linearalgebra::normMatrix\fR \fImatrix\fR \fItype\fR
.sp
\fB::math::linearalgebra::dotproduct\fR \fIvect1\fR \fIvect2\fR
.sp
\fB::math::linearalgebra::unitLengthVector\fR \fIvector\fR
.sp
\fB::math::linearalgebra::normalizeStat\fR \fImv\fR
.sp
\fB::math::linearalgebra::axpy\fR \fIscale\fR \fImv1\fR \fImv2\fR
.sp
\fB::math::linearalgebra::add\fR \fImv1\fR \fImv2\fR
.sp
\fB::math::linearalgebra::sub\fR \fImv1\fR \fImv2\fR
.sp
\fB::math::linearalgebra::scale\fR \fIscale\fR \fImv\fR
.sp
\fB::math::linearalgebra::rotate\fR \fIc\fR \fIs\fR \fIvect1\fR \fIvect2\fR
.sp
\fB::math::linearalgebra::transpose\fR \fImatrix\fR
.sp
\fB::math::linearalgebra::matmul\fR \fImv1\fR \fImv2\fR
.sp
\fB::math::linearalgebra::angle\fR \fIvect1\fR \fIvect2\fR
.sp
\fB::math::linearalgebra::crossproduct\fR \fIvect1\fR \fIvect2\fR
.sp
\fB::math::linearalgebra::matmul\fR \fImv1\fR \fImv2\fR
.sp
\fB::math::linearalgebra::mkIdentity\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkDiagonal\fR \fIdiag\fR
.sp
\fB::math::linearalgebra::mkRandom\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkTriangular\fR \fIsize\fR ?uplo? ?value?
.sp
\fB::math::linearalgebra::mkHilbert\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkDingdong\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkOnes\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkMoler\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkFrank\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkBorder\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkWilkinsonW+\fR \fIsize\fR
.sp
\fB::math::linearalgebra::mkWilkinsonW-\fR \fIsize\fR
.sp
\fB::math::linearalgebra::solveGauss\fR \fImatrix\fR \fIbvect\fR
.sp
\fB::math::linearalgebra::solvePGauss\fR \fImatrix\fR \fIbvect\fR
.sp
\fB::math::linearalgebra::solveTriangular\fR \fImatrix\fR \fIbvect\fR ?uplo?
.sp
\fB::math::linearalgebra::solveGaussBand\fR \fImatrix\fR \fIbvect\fR
.sp
\fB::math::linearalgebra::solveTriangularBand\fR \fImatrix\fR \fIbvect\fR
.sp
\fB::math::linearalgebra::determineSVD\fR \fIA\fR \fIeps\fR
.sp
\fB::math::linearalgebra::eigenvectorsSVD\fR \fIA\fR \fIeps\fR
.sp
\fB::math::linearalgebra::leastSquaresSVD\fR \fIA\fR \fIy\fR \fIqmin\fR \fIeps\fR
.sp
\fB::math::linearalgebra::choleski\fR \fImatrix\fR
.sp
\fB::math::linearalgebra::orthonormalizeColumns\fR \fImatrix\fR
.sp
\fB::math::linearalgebra::orthonormalizeRows\fR \fImatrix\fR
.sp
\fB::math::linearalgebra::dger\fR \fImatrix\fR \fIalpha\fR \fIx\fR \fIy\fR ?scope?
.sp
\fB::math::linearalgebra::dgetrf\fR \fImatrix\fR
.sp
\fB::math::linearalgebra::det\fR \fImatrix\fR
.sp
\fB::math::linearalgebra::largesteigen\fR \fImatrix\fR \fItolerance\fR \fImaxiter\fR
.sp
\fB::math::linearalgebra::to_LA\fR \fImv\fR
.sp
\fB::math::linearalgebra::from_LA\fR \fImv\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package offers both low-level procedures and high-level algorithms
to deal with linear algebra problems:
.IP \(bu
robust solution of linear equations or least squares problems
.IP \(bu
determining eigenvectors and eigenvalues of symmetric matrices
.IP \(bu
various decompositions of general matrices or matrices of a specific
form
.IP \(bu
(limited) support for matrices in band storage, a common type of sparse
matrices
.PP
It arose as a re-implementation of Hume's LA package and the desire to
offer low-level procedures as found in the well-known BLAS library.
Matrices are implemented as lists of lists rather linear lists with
reserved elements, as in the original LA package, as it was found that
such an implementation is actually faster.
.PP
It is advisable, however, to use the procedures that are offered, such
as \fIsetrow\fR and \fIgetrow\fR, rather than rely on this
representation explicitly: that way it is to switch to a possibly even
faster compiled implementation that supports the same API.
.PP
\fINote:\fR When using this package in combination with Tk, there may
be a naming conflict, as both this package and Tk define a command
\fIscale\fR. See the \fBNAMING CONFLICT\fR section below.
.SH PROCEDURES
The package defines the following public procedures (several exist as
specialised procedures, see below):
.PP
\fIConstructing matrices and vectors\fR
.TP
\fB::math::linearalgebra::mkVector\fR \fIndim\fR \fIvalue\fR
Create a vector with ndim elements, each with the value \fIvalue\fR.
.RS
.TP
integer \fIndim\fR
Dimension of the vector (number of components)
.TP
double \fIvalue\fR
Uniform value to be used (default: 0.0)
.RE
.sp
.TP
\fB::math::linearalgebra::mkUnitVector\fR \fIndim\fR \fIndir\fR
Create a unit vector in \fIndim\fR-dimensional space, along the
\fIndir\fR-th direction.
.RS
.TP
integer \fIndim\fR
Dimension of the vector (number of components)
.TP
integer \fIndir\fR
Direction (0, ..., ndim-1)
.RE
.sp
.TP
\fB::math::linearalgebra::mkMatrix\fR \fInrows\fR \fIncols\fR \fIvalue\fR
Create a matrix with \fInrows\fR rows and \fIncols\fR columns. All
elements have the value \fIvalue\fR.
.RS
.TP
integer \fInrows\fR
Number of rows
.TP
integer \fIncols\fR
Number of columns
.TP
double \fIvalue\fR
Uniform value to be used (default: 0.0)
.RE
.sp
.TP
\fB::math::linearalgebra::getrow\fR \fImatrix\fR \fIrow\fR ?imin? ?imax?
Returns a single row of a matrix as a list
.RS
.TP
list \fImatrix\fR
Matrix in question
.TP
integer \fIrow\fR
Index of the row to return
.TP
integer \fIimin\fR
Minimum index of the column (default: 0)
.TP
integer \fIimax\fR
Maximum index of the column (default: ncols-1)
.RE
.sp
.TP
\fB::math::linearalgebra::setrow\fR \fImatrix\fR \fIrow\fR \fInewvalues\fR ?imin? ?imax?
Set a single row of a matrix to new values (this list must have the same
number of elements as the number of \fIcolumns\fR in the matrix)
.RS
.TP
list \fImatrix\fR
\fIname\fR of the matrix in question
.TP
integer \fIrow\fR
Index of the row to update
.TP
list \fInewvalues\fR
List of new values for the row
.TP
integer \fIimin\fR
Minimum index of the column (default: 0)
.TP
integer \fIimax\fR
Maximum index of the column (default: ncols-1)
.RE
.sp
.TP
\fB::math::linearalgebra::getcol\fR \fImatrix\fR \fIcol\fR ?imin? ?imax?
Returns a single column of a matrix as a list
.RS
.TP
list \fImatrix\fR
Matrix in question
.TP
integer \fIcol\fR
Index of the column to return
.TP
integer \fIimin\fR
Minimum index of the row (default: 0)
.TP
integer \fIimax\fR
Maximum index of the row (default: nrows-1)
.RE
.sp
.TP
\fB::math::linearalgebra::setcol\fR \fImatrix\fR \fIcol\fR \fInewvalues\fR ?imin? ?imax?
Set a single column of a matrix to new values (this list must have
the same number of elements as the number of \fIrows\fR in the matrix)
.RS
.TP
list \fImatrix\fR
\fIname\fR of the matrix in question
.TP
integer \fIcol\fR
Index of the column to update
.TP
list \fInewvalues\fR
List of new values for the column
.TP
integer \fIimin\fR
Minimum index of the row (default: 0)
.TP
integer \fIimax\fR
Maximum index of the row (default: nrows-1)
.RE
.sp
.TP
\fB::math::linearalgebra::getelem\fR \fImatrix\fR \fIrow\fR \fIcol\fR
Returns a single element of a matrix/vector
.RS
.TP
list \fImatrix\fR
Matrix or vector in question
.TP
integer \fIrow\fR
Row of the element
.TP
integer \fIcol\fR
Column of the element (not present for vectors)
.RE
.sp
.TP
\fB::math::linearalgebra::setelem\fR \fImatrix\fR \fIrow\fR ?col? \fInewvalue\fR
Set a single element of a matrix (or vector) to a new value
.RS
.TP
list \fImatrix\fR
\fIname\fR of the matrix in question
.TP
integer \fIrow\fR
Row of the element
.TP
integer \fIcol\fR
Column of the element (not present for vectors)
.RE
.sp
.TP
\fB::math::linearalgebra::swaprows\fR \fImatrix\fR \fIirow1\fR \fIirow2\fR ?imin? ?imax?
Swap two rows in a matrix completely or only a selected part
.RS
.TP
list \fImatrix\fR
\fIname\fR of the matrix in question
.TP
integer \fIirow1\fR
Index of first row
.TP
integer \fIirow2\fR
Index of second row
.TP
integer \fIimin\fR
Minimum column index (default: 0)
.TP
integer \fIimin\fR
Maximum column index (default: ncols-1)
.RE
.sp
.TP
\fB::math::linearalgebra::swapcols\fR \fImatrix\fR \fIicol1\fR \fIicol2\fR ?imin? ?imax?
Swap two columns in a matrix completely or only a selected part
.RS
.TP
list \fImatrix\fR
\fIname\fR of the matrix in question
.TP
integer \fIirow1\fR
Index of first column
.TP
integer \fIirow2\fR
Index of second column
.TP
integer \fIimin\fR
Minimum row index (default: 0)
.TP
integer \fIimin\fR
Maximum row index (default: nrows-1)
.RE
.PP
.PP
\fIQuerying matrices and vectors\fR
.TP
\fB::math::linearalgebra::show\fR \fIobj\fR ?format? ?rowsep? ?colsep?
Return a string representing the vector or matrix, for easy printing.
(There is currently no way to print fixed sets of columns)
.RS
.TP
list \fIobj\fR
Matrix or vector in question
.TP
string \fIformat\fR
Format for printing the numbers (default: %6.4f)
.TP
string \fIrowsep\fR
String to use for separating rows (default: newline)
.TP
string \fIcolsep\fR
String to use for separating columns (default: space)
.RE
.sp
.TP
\fB::math::linearalgebra::dim\fR \fIobj\fR
Returns the number of dimensions for the object (either 0 for a scalar,
1 for a vector and 2 for a matrix)
.RS
.TP
any \fIobj\fR
Scalar, vector, or matrix
.RE
.sp
.TP
\fB::math::linearalgebra::shape\fR \fIobj\fR
Returns the number of elements in each dimension for the object (either
an empty list for a scalar, a single number for a vector and a list of
the number of rows and columns for a matrix)
.RS
.TP
any \fIobj\fR
Scalar, vector, or matrix
.RE
.sp
.TP
\fB::math::linearalgebra::conforming\fR \fItype\fR \fIobj1\fR \fIobj2\fR
Checks if two objects (vector or matrix) have conforming shapes, that is
if they can be applied in an operation like addition or matrix
multiplication.
.RS
.TP
string \fItype\fR
Type of check:
.RS
.IP \(bu
"shape" - the two objects have the same shape (for all element-wise
operations)
.IP \(bu
"rows" - the two objects have the same number of rows (for use as A and
b in a system of linear equations \fIAx = b\fR
.IP \(bu
"matmul" - the first object has the same number of columns as the number
of rows of the second object. Useful for matrix-matrix or matrix-vector
multiplication.
.RE
.TP
list \fIobj1\fR
First vector or matrix (left operand)
.TP
list \fIobj2\fR
Second vector or matrix (right operand)
.RE
.sp
.TP
\fB::math::linearalgebra::symmetric\fR \fImatrix\fR ?eps?
Checks if the given (square) matrix is symmetric. The argument eps
is the tolerance.
.RS
.TP
list \fImatrix\fR
Matrix to be inspected
.TP
float \fIeps\fR
Tolerance for determining approximate equality
(defaults to 1.0e-8)
.RE
.PP
.PP
\fIBasic operations\fR
.TP
\fB::math::linearalgebra::norm\fR \fIvector\fR \fItype\fR
Returns the norm of the given vector. The type argument can be: 1,
2, inf or max, respectively the sum of absolute values, the ordinary
Euclidean norm or the max norm.
.RS
.TP
list \fIvector\fR
Vector, list of coefficients
.TP
string \fItype\fR
Type of norm (default: 2, the Euclidean norm)
.RE
.TP
\fB::math::linearalgebra::norm_one\fR \fIvector\fR
Returns the L1 norm of the given vector, the sum of absolute values
.RS
.TP
list \fIvector\fR
Vector, list of coefficients
.RE
.TP
\fB::math::linearalgebra::norm_two\fR \fIvector\fR
Returns the L2 norm of the given vector, the ordinary Euclidean norm
.RS
.TP
list \fIvector\fR
Vector, list of coefficients
.RE
.TP
\fB::math::linearalgebra::norm_max\fR \fIvector\fR ?index?
Returns the Linf norm of the given vector, the maximum absolute
coefficient
.RS
.TP
list \fIvector\fR
Vector, list of coefficients
.TP
integer \fIindex\fR
(optional) if non zero, returns a list made of the maximum
value and the index where that maximum was found.
if zero, returns the maximum value.
.RE
.sp
.TP
\fB::math::linearalgebra::normMatrix\fR \fImatrix\fR \fItype\fR
Returns the norm of the given matrix. The type argument can be: 1,
2, inf or max, respectively the sum of absolute values, the ordinary
Euclidean norm or the max norm.
.RS
.TP
list \fImatrix\fR
Matrix, list of row vectors
.TP
string \fItype\fR
Type of norm (default: 2, the Euclidean norm)
.RE
.sp
.TP
\fB::math::linearalgebra::dotproduct\fR \fIvect1\fR \fIvect2\fR
Determine the inproduct or dot product of two vectors. These must have
the same shape (number of dimensions)
.RS
.TP
list \fIvect1\fR
First vector, list of coefficients
.TP
list \fIvect2\fR
Second vector, list of coefficients
.RE
.sp
.TP
\fB::math::linearalgebra::unitLengthVector\fR \fIvector\fR
Return a vector in the same direction with length 1.
.RS
.TP
list \fIvector\fR
Vector to be normalized
.RE
.sp
.TP
\fB::math::linearalgebra::normalizeStat\fR \fImv\fR
Normalize the matrix or vector in a statistical sense: the mean of the
elements of the columns of the result is zero and the standard deviation
is 1.
.RS
.TP
list \fImv\fR
Vector or matrix to be normalized in the above sense
.RE
.sp
.TP
\fB::math::linearalgebra::axpy\fR \fIscale\fR \fImv1\fR \fImv2\fR
Return a vector or matrix that results from a "daxpy" operation, that
is: compute a*x+y (a a scalar and x and y both vectors or matrices of
the same shape) and return the result.
.sp
Specialised variants are: axpy_vect and axpy_mat (slightly faster,
but no check on the arguments)
.RS
.TP
double \fIscale\fR
The scale factor for the first vector/matrix (a)
.TP
list \fImv1\fR
First vector or matrix (x)
.TP
list \fImv2\fR
Second vector or matrix (y)
.RE
.sp
.TP
\fB::math::linearalgebra::add\fR \fImv1\fR \fImv2\fR
Return a vector or matrix that is the sum of the two arguments (x+y)
.sp
Specialised variants are: add_vect and add_mat (slightly faster,
but no check on the arguments)
.RS
.TP
list \fImv1\fR
First vector or matrix (x)
.TP
list \fImv2\fR
Second vector or matrix (y)
.RE
.sp
.TP
\fB::math::linearalgebra::sub\fR \fImv1\fR \fImv2\fR
Return a vector or matrix that is the difference of the two arguments
(x-y)
.sp
Specialised variants are: sub_vect and sub_mat (slightly faster,
but no check on the arguments)
.RS
.TP
list \fImv1\fR
First vector or matrix (x)
.TP
list \fImv2\fR
Second vector or matrix (y)
.RE
.sp
.TP
\fB::math::linearalgebra::scale\fR \fIscale\fR \fImv\fR
Scale a vector or matrix and return the result, that is: compute a*x.
.sp
Specialised variants are: scale_vect and scale_mat (slightly faster,
but no check on the arguments)
.RS
.TP
double \fIscale\fR
The scale factor for the vector/matrix (a)
.TP
list \fImv\fR
Vector or matrix (x)
.RE
.sp
.TP
\fB::math::linearalgebra::rotate\fR \fIc\fR \fIs\fR \fIvect1\fR \fIvect2\fR
Apply a planar rotation to two vectors and return the result as a list
of two vectors: c*x-s*y and s*x+c*y. In algorithms you can often easily
determine the cosine and sine of the angle, so it is more efficient to
pass that information directly.
.RS
.TP
double \fIc\fR
The cosine of the angle
.TP
double \fIs\fR
The sine of the angle
.TP
list \fIvect1\fR
First vector (x)
.TP
list \fIvect2\fR
Seocnd vector (x)
.RE
.sp
.TP
\fB::math::linearalgebra::transpose\fR \fImatrix\fR
Transpose a matrix
.RS
.TP
list \fImatrix\fR
Matrix to be transposed
.RE
.sp
.TP
\fB::math::linearalgebra::matmul\fR \fImv1\fR \fImv2\fR
Multiply a vector/matrix with another vector/matrix. The result is
a matrix, if both x and y are matrices or both are vectors, in
which case the "outer product" is computed. If one is a vector and the
other is a matrix, then the result is a vector.
.RS
.TP
list \fImv1\fR
First vector/matrix (x)
.TP
list \fImv2\fR
Second vector/matrix (y)
.RE
.sp
.TP
\fB::math::linearalgebra::angle\fR \fIvect1\fR \fIvect2\fR
Compute the angle between two vectors (in radians)
.RS
.TP
list \fIvect1\fR
First vector
.TP
list \fIvect2\fR
Second vector
.RE
.sp
.TP
\fB::math::linearalgebra::crossproduct\fR \fIvect1\fR \fIvect2\fR
Compute the cross product of two (three-dimensional) vectors
.RS
.TP
list \fIvect1\fR
First vector
.TP
list \fIvect2\fR
Second vector
.RE
.sp
.TP
\fB::math::linearalgebra::matmul\fR \fImv1\fR \fImv2\fR
Multiply a vector/matrix with another vector/matrix. The result is
a matrix, if both x and y are matrices or both are vectors, in
which case the "outer product" is computed. If one is a vector and the
other is a matrix, then the result is a vector.
.RS
.TP
list \fImv1\fR
First vector/matrix (x)
.TP
list \fImv2\fR
Second vector/matrix (y)
.RE
.PP
.PP
\fICommon matrices and test matrices\fR
.TP
\fB::math::linearalgebra::mkIdentity\fR \fIsize\fR
Create an identity matrix of dimension \fIsize\fR.
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkDiagonal\fR \fIdiag\fR
Create a diagonal matrix whose diagonal elements are the elements of the
vector \fIdiag\fR.
.RS
.TP
list \fIdiag\fR
Vector whose elements are used for the diagonal
.RE
.sp
.TP
\fB::math::linearalgebra::mkRandom\fR \fIsize\fR
Create a square matrix whose elements are uniformly distributed random
numbers between 0 and 1 of dimension \fIsize\fR.
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkTriangular\fR \fIsize\fR ?uplo? ?value?
Create a triangular matrix with non-zero elements in the upper or lower
part, depending on argument \fIuplo\fR.
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.TP
string \fIuplo\fR
Fill the upper (U) or lower part (L)
.TP
double \fIvalue\fR
Value to fill the matrix with
.RE
.sp
.TP
\fB::math::linearalgebra::mkHilbert\fR \fIsize\fR
Create a Hilbert matrix of dimension \fIsize\fR.
Hilbert matrices are very ill-conditioned with respect to
eigenvalue/eigenvector problems. Therefore they
are good candidates for testing the accuracy
of algorithms and implementations.
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkDingdong\fR \fIsize\fR
Create a "dingdong" matrix of dimension \fIsize\fR.
Dingdong matrices are imprecisely represented,
but have the property of being very stable in
such algorithms as Gauss elimination.
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkOnes\fR \fIsize\fR
Create a square matrix of dimension \fIsize\fR whose entries are all 1.
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkMoler\fR \fIsize\fR
Create a Moler matrix of size \fIsize\fR. (Moler matrices have
a very simple Choleski decomposition. It has one small eigenvalue
and it can easily upset elimination methods for systems of linear
equations.)
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkFrank\fR \fIsize\fR
Create a Frank matrix of size \fIsize\fR. (Frank matrices are
fairly well-behaved matrices)
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkBorder\fR \fIsize\fR
Create a bordered matrix of size \fIsize\fR. (Bordered matrices have
a very low rank and can upset certain specialised algorithms.)
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkWilkinsonW+\fR \fIsize\fR
Create a Wilkinson W+ of size \fIsize\fR. This kind of matrix
has pairs of eigenvalues that are very close together. Usually
the order (size) is odd.
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.sp
.TP
\fB::math::linearalgebra::mkWilkinsonW-\fR \fIsize\fR
Create a Wilkinson W- of size \fIsize\fR. This kind of matrix
has pairs of eigenvalues with opposite signs, when the order (size)
is odd.
.RS
.TP
integer \fIsize\fR
Dimension of the matrix
.RE
.PP
.PP
\fICommon algorithms\fR
.TP
\fB::math::linearalgebra::solveGauss\fR \fImatrix\fR \fIbvect\fR
Solve a system of linear equations (Ax=b) using Gauss elimination.
Returns the solution (x) as a vector or matrix of the same shape as
bvect.
.RS
.TP
list \fImatrix\fR
Square matrix (matrix A)
.TP
list \fIbvect\fR
Vector or matrix whose columns are the individual
b-vectors
.RE
.TP
\fB::math::linearalgebra::solvePGauss\fR \fImatrix\fR \fIbvect\fR
Solve a system of linear equations (Ax=b) using Gauss elimination with
partial pivoting. Returns the solution (x) as a vector or matrix of the
same shape as bvect.
.RS
.TP
list \fImatrix\fR
Square matrix (matrix A)
.TP
list \fIbvect\fR
Vector or matrix whose columns are the individual
b-vectors
.RE
.sp
.TP
\fB::math::linearalgebra::solveTriangular\fR \fImatrix\fR \fIbvect\fR ?uplo?
Solve a system of linear equations (Ax=b) by backward substitution. The
matrix is supposed to be upper-triangular.
.RS
.TP
list \fImatrix\fR
Lower or upper-triangular matrix (matrix A)
.TP
list \fIbvect\fR
Vector or matrix whose columns are the individual
b-vectors
.TP
string \fIuplo\fR
Indicates whether the matrix is lower-triangular
(L) or upper-triangular (U). Defaults to "U".
.RE
.TP
\fB::math::linearalgebra::solveGaussBand\fR \fImatrix\fR \fIbvect\fR
Solve a system of linear equations (Ax=b) using Gauss elimination,
where the matrix is stored as a band matrix (\fIcf.\fR \fBSTORAGE\fR).
Returns the solution (x) as a vector or matrix of the same shape as
bvect.
.RS
.TP
list \fImatrix\fR
Square matrix (matrix A; in band form)
.TP
list \fIbvect\fR
Vector or matrix whose columns are the individual
b-vectors
.RE
.sp
.TP
\fB::math::linearalgebra::solveTriangularBand\fR \fImatrix\fR \fIbvect\fR
Solve a system of linear equations (Ax=b) by backward substitution. The
matrix is supposed to be upper-triangular and stored in band form.
.RS
.TP
list \fImatrix\fR
Upper-triangular matrix (matrix A)
.TP
list \fIbvect\fR
Vector or matrix whose columns are the individual
b-vectors
.RE
.sp
.TP
\fB::math::linearalgebra::determineSVD\fR \fIA\fR \fIeps\fR
Determines the Singular Value Decomposition of a matrix: A = U S Vtrans.
Returns a list with the matrix U, the vector of singular values S and
the matrix V.
.RS
.TP
list \fIA\fR
Matrix to be decomposed
.TP
float \fIeps\fR
Tolerance (defaults to 2.3e-16)
.RE
.sp
.TP
\fB::math::linearalgebra::eigenvectorsSVD\fR \fIA\fR \fIeps\fR
Determines the eigenvectors and eigenvalues of a real
\fIsymmetric\fR matrix, using SVD. Returns a list with the matrix of
normalized eigenvectors and their eigenvalues.
.RS
.TP
list \fIA\fR
Matrix whose eigenvalues must be determined
.TP
float \fIeps\fR
Tolerance (defaults to 2.3e-16)
.RE
.sp
.TP
\fB::math::linearalgebra::leastSquaresSVD\fR \fIA\fR \fIy\fR \fIqmin\fR \fIeps\fR
Determines the solution to a least-sqaures problem Ax ~ y via singular
value decomposition. The result is the vector x.
.sp
Note that if you add a column of 1s to the matrix, then this column will
represent a constant like in: y = a*x1 + b*x2 + c. To force the
intercept to be zero, simply leave it out.
.RS
.TP
list \fIA\fR
Matrix of independent variables
.TP
list \fIy\fR
List of observed values
.TP
float \fIqmin\fR
Minimum singular value to be considered (defaults to 0.0)
.TP
float \fIeps\fR
Tolerance (defaults to 2.3e-16)
.RE
.sp
.TP
\fB::math::linearalgebra::choleski\fR \fImatrix\fR
Determine the Choleski decomposition of a symmetric positive
semidefinite matrix (this condition is not checked!). The result
is the lower-triangular matrix L such that L Lt = matrix.
.RS
.TP
list \fImatrix\fR
Matrix to be decomposed
.RE
.sp
.TP
\fB::math::linearalgebra::orthonormalizeColumns\fR \fImatrix\fR
Use the modified Gram-Schmidt method to orthogonalize and normalize
the \fIcolumns\fR of the given matrix and return the result.
.RS
.TP
list \fImatrix\fR
Matrix whose columns must be orthonormalized
.RE
.sp
.TP
\fB::math::linearalgebra::orthonormalizeRows\fR \fImatrix\fR
Use the modified Gram-Schmidt method to orthogonalize and normalize
the \fIrows\fR of the given matrix and return the result.
.RS
.TP
list \fImatrix\fR
Matrix whose rows must be orthonormalized
.RE
.sp
.TP
\fB::math::linearalgebra::dger\fR \fImatrix\fR \fIalpha\fR \fIx\fR \fIy\fR ?scope?
Perform the rank 1 operation A + alpha*x*y' inline (that is: the matrix A is adjusted).
For convenience the new matrix is also returned as the result.
.RS
.TP
list \fImatrix\fR
Matrix whose rows must be adjusted
.TP
double \fIalpha\fR
Scale factor
.TP
list \fIx\fR
A column vector
.TP
list \fIy\fR
A column vector
.TP
list \fIscope\fR
If not provided, the operation is performed on all rows/columns of A
if provided, it is expected to be the list {imin imax jmin jmax}
where:
.RS
.IP \(bu
\fIimin\fR Minimum row index
.IP \(bu
\fIimax\fR Maximum row index
.IP \(bu
\fIjmin\fR Minimum column index
.IP \(bu
\fIjmax\fR Maximum column index
.RE
.RE
.sp
.TP
\fB::math::linearalgebra::dgetrf\fR \fImatrix\fR
Computes an LU factorization of a general matrix, using partial,
pivoting with row interchanges. Returns the permutation vector.
.sp
The factorization has the form
.CS


   P * A = L * U

.CE
.IP
where P is a permutation matrix, L is lower triangular with unit
diagonal elements, and U is upper triangular.
Returns the permutation vector, as a list of length n-1.
The last entry of the permutation is not stored, since it is
implicitely known, with value n (the last row is not swapped
with any other row).
At index #i of the permutation is stored the index of the row #j
which is swapped with row #i at step #i. That means that each
index of the permutation gives the permutation at each step, not the
cumulated permutation matrix, which is the product of permutations.
.RS
.TP
list \fImatrix\fR
On entry, the matrix to be factored.
On exit, the factors L and U from the factorization
P*A = L*U; the unit diagonal elements of L are not stored.
.RE
.sp
.TP
\fB::math::linearalgebra::det\fR \fImatrix\fR
Returns the determinant of the given matrix, based on PA=LU
decomposition, i.e. Gauss partial pivotal.
.RS
.TP
list \fImatrix\fR
Square matrix (matrix A)
.TP
list \fIipiv\fR
The pivots (optionnal).
If the pivots are not provided, a PA=LU decomposition
is performed.
If the pivots are provided, we assume that it
contains the pivots and that the matrix A contains the
L and U factors, as provided by dgterf.
b-vectors
.RE
.sp
.TP
\fB::math::linearalgebra::largesteigen\fR \fImatrix\fR \fItolerance\fR \fImaxiter\fR
Returns a list made of the largest eigenvalue (in magnitude)
and associated eigenvector.
Uses iterative Power Method as provided as algorithm #7.3.3 of Golub & Van Loan.
This algorithm is used here for a dense matrix (but is usually
used for sparse matrices).
.RS
.TP
list \fImatrix\fR
Square matrix (matrix A)
.TP
double \fItolerance\fR
The relative tolerance of the eigenvalue (default:1.e-8).
.TP
integer \fImaxiter\fR
The maximum number of iterations (default:10).
.RE
.PP
.PP
\fICompability with the LA package\fR
Two procedures are provided for compatibility with Hume's LA package:
.TP
\fB::math::linearalgebra::to_LA\fR \fImv\fR
Transforms a vector or matrix into the format used by the original LA
package.
.RS
.TP
list \fImv\fR
Matrix or vector
.RE
.TP
\fB::math::linearalgebra::from_LA\fR \fImv\fR
Transforms a vector or matrix from the format used by the original LA
package into the format used by the present implementation.
.RS
.TP
list \fImv\fR
Matrix or vector as used by the LA package
.RE
.PP
.PP
.SH STORAGE
While most procedures assume that the matrices are given in full form,
the procedures \fIsolveGaussBand\fR and \fIsolveTriangularBand\fR
assume that the matrices are stored as \fIband matrices\fR. This
common type of "sparse" matrices is related to ordinary matrices as
follows:
.IP \(bu
"A" is a full-size matrix with N rows and M columns.
.IP \(bu
"B" is a band matrix, with m upper and lower diagonals and n rows.
.IP \(bu
"B" can be stored in an ordinary matrix of (2m+1) columns (one for
each off-diagonal and the main diagonal) and n rows.
.IP \(bu
Element i,j (i = -m,...,m; j =1,...,n) of "B" corresponds to element
k,j of "A" where k = M+i-1 and M is at least (!) n, the number of rows
in "B".
.IP \(bu
To set element (i,j) of matrix "B" use:
.CS


    setelem B $j [expr {$N+$i-1}] $value

.CE
.PP
(There is no convenience procedure for this yet)
.SH "REMARKS ON THE IMPLEMENTATION"
There is a difference between the original LA package by Hume and the
current implementation. Whereas the LA package uses a linear list, the
current package uses lists of lists to represent matrices. It turns out
that with this representation, the algorithms are faster and easier to
implement.
.PP
The LA package was used as a model and in fact the implementation of,
for instance, the SVD algorithm was taken from that package. The set of
procedures was expanded using ideas from the well-known BLAS library and
some algorithms were updated from the second edition of J.C. Nash's
book, Compact Numerical Methods for Computers, (Adam Hilger, 1990) that
inspired the LA package.
.PP
Two procedures are provided to make the transition between the two
implementations easier: \fIto_LA\fR and \fIfrom_LA\fR. They are
described above.
.SH TODO
Odds and ends: the following algorithms have not been implemented yet:
.IP \(bu
determineQR
.IP \(bu
certainlyPositive, diagonallyDominant
.PP
.SH "NAMING CONFLICT"
If you load this package in a Tk-enabled shell like wish, then the
command
.CS

namespace import ::math::linearalgebra
.CE
results in an error
message about "scale". This is due to the fact that Tk defines all
its commands in the global namespace. The solution is to import
the linear algebra commands in a namespace that is not the global one:
.CS


package require math::linearalgebra
namespace eval compute {
    namespace import ::math::linearalgebra::*
    ... use the linear algebra version of scale ...
}

.CE
To use Tk's scale command in that same namespace you can rename it:
.CS


namespace eval compute {
    rename ::scale scaleTk
    scaleTk .scale ...
}

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: linearalgebra\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
least squares, linear algebra, linear equations, math, matrices, matrix, vectors
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004-2008 Arjen Markus <[email protected]>
Copyright (c) 2004 Ed Hume <http://www.hume.com/contact.us.htm>
Copyright (c) 2008 Michael Buadin <[email protected]>

.fi

Added embedded/man/files/modules/math/machineparameters.n.



























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/machineparameters.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Michael Baudin <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tclrep/machineparameters" n 1.0 tcllib "tclrep"
.BS
.SH NAME
tclrep/machineparameters \- Compute double precision machine parameters.
.SH SYNOPSIS
package require \fBsnit \fR
.sp
\fBmachineparameters\fR create \fIobjectname\fR ?\fIoptions\fR...?
.sp
\fIobjectname\fR \fBconfigure\fR ?\fIoptions\fR...?
.sp
\fIobjectname\fR \fBcget\fR \fIopt\fR
.sp
\fIobjectname\fR \fBdestroy\fR
.sp
\fIobjectname\fR \fBcompute\fR
.sp
\fIobjectname\fR \fBget\fR \fIkey\fR
.sp
\fIobjectname\fR \fBtostring\fR
.sp
\fIobjectname\fR \fBprint\fR
.sp
.BE
.SH DESCRIPTION
The \fImath::machineparameters\fR package
is the Tcl equivalent of the DLAMCH LAPACK function.
In floating point systems, a floating point number is represented
by
.CS


x = +/- d1 d2 ... dt basis^e

.CE
where digits satisfy
.CS


0 <= di <= basis - 1, i = 1, t

.CE
with the convention :
.IP \(bu
t is the size of the mantissa
.IP \(bu
basis is the basis (the "radix")
.PP
.PP
The \fBcompute\fR method computes all machine parameters.
Then, the \fBget\fR method can be used to get each
parameter.
The \fBprint\fR method prints a report on standard output.
.SH EXAMPLE
In the following example, one compute the parameters of a desktop
under Linux with the following Tcl 8.4.19 properties :
.CS


% parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine)   = i686
tcl_platform(os)        = Linux
tcl_platform(osVersion) = 2.6.24-19-generic
tcl_platform(platform)  = unix
tcl_platform(tip,268)   = 1
tcl_platform(tip,280)   = 1
tcl_platform(user)      = <username>
tcl_platform(wordSize)  = 4

.CE
The following example creates a machineparameters object,
computes the properties and displays it.
.CS


     set pp [machineparameters create %AUTO%]
     $pp compute
     $pp print
     $pp destroy

.CE
This prints out :
.CS


     Machine parameters
     Epsilon : 1.11022302463e-16
     Beta : 2
     Rounding : proper
     Mantissa : 53
     Maximum exponent : 1024
     Minimum exponent : -1021
     Overflow threshold : 8.98846567431e+307
     Underflow threshold : 2.22507385851e-308

.CE
That compares well with the results produced by Lapack 3.1.1 :
.CS


     Epsilon                      =   1.11022302462515654E-016
     Safe minimum                 =   2.22507385850720138E-308
     Base                         =    2.0000000000000000
     Precision                    =   2.22044604925031308E-016
     Number of digits in mantissa =    53.000000000000000
     Rounding mode                =   1.00000000000000000
     Minimum exponent             =   -1021.0000000000000
     Underflow threshold          =   2.22507385850720138E-308
     Largest exponent             =    1024.0000000000000
     Overflow threshold           =   1.79769313486231571E+308
     Reciprocal of safe minimum   =   4.49423283715578977E+307

.CE
The following example creates a machineparameters object,
computes the properties and gets the epsilon for
the machine.
.CS


     set pp [machineparameters create %AUTO%]
     $pp compute
     set eps [$pp get -epsilon]
     $pp destroy

.CE
.SH REFERENCES
.IP \(bu
"Algorithms to Reveal Properties of Floating-Point Arithmetic", Michael A. Malcolm, Stanford University, Communications of the ACM, Volume 15 ,  Issue 11  (November 1972), Pages: 949 - 951
.IP \(bu
"More on Algorithms that Reveal Properties of Floating, Point Arithmetic Units", W. Morven Gentleman, University of Waterloo, Scott B. Marovich, Purdue University, Communications of the ACM, Volume 17 ,  Issue 5  (May 1974), Pages: 276 - 277
.PP
.SH "CLASS API"
.TP
\fBmachineparameters\fR create \fIobjectname\fR ?\fIoptions\fR...?
The command creates a new machineparameters object and returns the fully
qualified name of the object command as its result.
.RS
.TP
\fB-verbose\fR \fIverbose\fR
Set this option to 1 to enable verbose logging.
This option is mainly for debug purposes.
The default value of \fIverbose\fR is 0.
.RE
.PP
.SH "OBJECT API"
.TP
\fIobjectname\fR \fBconfigure\fR ?\fIoptions\fR...?
The command configure the options of the object \fIobjectname\fR. The options
are the same as the static method \fBcreate\fR.
.TP
\fIobjectname\fR \fBcget\fR \fIopt\fR
Returns the value of the option which name is \fIopt\fR. The options
are the same as the method \fBcreate\fR and \fBconfigure\fR.
.TP
\fIobjectname\fR \fBdestroy\fR
Destroys the object \fIobjectname\fR.
.TP
\fIobjectname\fR \fBcompute\fR
Computes the machine parameters.
.TP
\fIobjectname\fR \fBget\fR \fIkey\fR
Returns the value corresponding with given key.
The following is the list of available keys.
.RS
.IP \(bu
-epsilon : smallest value so that 1+epsilon>1 is false
.IP \(bu
-rounding : The rounding mode used on the machine.
The rounding occurs when more than t digits would be required to
represent the number.
Two modes can be determined with the current system :
"chop" means than only t digits are kept, no matter the value of the number
"proper" means that another rounding mode is used, be it "round to nearest",
"round up", "round down".
.IP \(bu
-basis : the basis of the floating-point representation.
The basis is usually 2, i.e. binary representation (for example IEEE 754 machines),
but some machines (like HP calculators for example) uses 10, or 16, etc...
.IP \(bu
-mantissa : the number of bits in the mantissa
.IP \(bu
-exponentmax :  the largest positive exponent before overflow occurs
.IP \(bu
-exponentmin : the largest negative exponent before (gradual) underflow occurs
.IP \(bu
-vmax : largest positive value before overflow occurs
.IP \(bu
-vmin : largest negative value before (gradual) underflow occurs
.RE
.TP
\fIobjectname\fR \fBtostring\fR
Return a report for machine parameters.
.TP
\fIobjectname\fR \fBprint\fR
Print machine parameters on standard output.
.PP
.SH COPYRIGHT
.nf
Copyright (c) 2008 Michael Baudin <[email protected]>

.fi

Added embedded/man/files/modules/math/math.n.

























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/math.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math" n 1.2.5 tcllib "Tcl Math Library"
.BS
.SH NAME
math \- Tcl Math Library
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBmath  ?1.2.5?\fR
.sp
\fB::math::cov\fR \fIvalue\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
\fB::math::integrate\fR \fIlist of xy value pairs\fR
.sp
\fB::math::fibonacci\fR \fIn\fR
.sp
\fB::math::max\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
\fB::math::mean\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
\fB::math::min\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
\fB::math::product\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
\fB::math::random\fR ?\fIvalue1\fR? ?\fIvalue2\fR?
.sp
\fB::math::sigma\fR \fIvalue\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
\fB::math::stats\fR \fIvalue\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
\fB::math::sum\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBmath\fR package provides utility math functions.
.PP
Besides a set of basic commands, available via the package \fImath\fR,
there are more specialised packages:
.IP \(bu
\fBmath::bigfloat\fR - Arbitrary-precision floating-point
arithmetic
.IP \(bu
\fBmath::bignum\fR - Arbitrary-precision integer arithmetic
.IP \(bu
\fBmath::calculus::romberg\fR - Robust integration methods for
functions of one variable, using Romberg integration
.IP \(bu
\fBmath::calculus\fR - Integration of functions, solving ordinary
differential equations
.IP \(bu
\fBmath::combinatorics\fR - Procedures for various combinatorial
functions (for instance the Gamma function and "k out of n")
.IP \(bu
\fBmath::complexnumbers\fR - Complex number arithmetic
.IP \(bu
\fBmath::constants\fR - A set of well-known mathematical
constants, such as Pi, E, and the golden ratio
.IP \(bu
\fBmath::fourier\fR - Discrete Fourier transforms
.IP \(bu
\fBmath::fuzzy\fR - Fuzzy comparisons of floating-point numbers
.IP \(bu
\fBmath::geometry\fR - 2D geometrical computations
.IP \(bu
\fBmath::interpolate\fR - Various interpolation methods
.IP \(bu
\fBmath::linearalgebra\fR - Linear algebra package
.IP \(bu
\fBmath::optimize\fR - Optimization methods
.IP \(bu
\fBmath::polynomials\fR - Polynomial arithmetic (includes families
of classical polynomials)
.IP \(bu
\fBmath::rationalfunctions\fR - Arithmetic of rational functions
.IP \(bu
\fBmath::roman\fR - Manipulation (including arithmetic) of Roman
numerals
.IP \(bu
\fBmath::special\fR - Approximations of special functions from
mathematical physics
.IP \(bu
\fBmath::statistics\fR - Statistical operations and tests
.PP
.SH "BASIC COMMANDS"
.TP
\fB::math::cov\fR \fIvalue\fR \fIvalue\fR ?\fIvalue ...\fR?
Return the coefficient of variation expressed as percent of two or
more numeric values.
.TP
\fB::math::integrate\fR \fIlist of xy value pairs\fR
Return the area under a "curve" defined by a set of x,y pairs and the
error bound as a list.
.TP
\fB::math::fibonacci\fR \fIn\fR
Return the \fIn\fR'th Fibonacci number.
.TP
\fB::math::max\fR \fIvalue\fR ?\fIvalue ...\fR?
Return the maximum of one or more numeric values.
.TP
\fB::math::mean\fR \fIvalue\fR ?\fIvalue ...\fR?
Return the mean, or "average" of one or more numeric values.
.TP
\fB::math::min\fR \fIvalue\fR ?\fIvalue ...\fR?
Return the minimum of one or more numeric values.
.TP
\fB::math::product\fR \fIvalue\fR ?\fIvalue ...\fR?
Return the product of one or more numeric values.
.TP
\fB::math::random\fR ?\fIvalue1\fR? ?\fIvalue2\fR?
Return a random number.  If no arguments are given, the number is a
floating point value between 0 and 1.  If one argument is given, the
number is an integer value between 0 and \fIvalue1\fR.  If two
arguments are given, the number is an integer value between
\fIvalue1\fR and \fIvalue2\fR.
.TP
\fB::math::sigma\fR \fIvalue\fR \fIvalue\fR ?\fIvalue ...\fR?
Return the population standard deviation of two or more numeric
values.
.TP
\fB::math::stats\fR \fIvalue\fR \fIvalue\fR ?\fIvalue ...\fR?
Return the mean, standard deviation, and coefficient of variation (as
percent) as a list.
.TP
\fB::math::sum\fR \fIvalue\fR ?\fIvalue ...\fR?
Return the sum of one or more numeric values.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
math, statistics
.SH CATEGORY
Mathematics

Added embedded/man/files/modules/math/math_geometry.n.





















































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/math_geometry.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2001 by Ideogramic ApS and other parties
'\" Copyright (c) 2004 by Arjen Markus
'\" Copyright (c) 2010 by Andreas Kupries
'\" Copyright (c) 2010 by Kevin Kenny
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::geometry" n 1.1.2 tcllib "Tcl Math Library"
.BS
.SH NAME
math::geometry \- Geometrical computations
.SH SYNOPSIS
package require \fBTcl  ?8.3?\fR
.sp
package require \fBmath::geometry  ?1.1.2?\fR
.sp
\fB::math::geometry::+\fR \fIpoint1\fR \fIpoint2\fR
.sp
\fB::math::geometry::-\fR \fIpoint1\fR \fIpoint2\fR
.sp
\fB::math::geometry::p\fR \fIx\fR \fIy\fR
.sp
\fB::math::geometry::distance\fR \fIpoint1\fR \fIpoint2\fR
.sp
\fB::math::geometry::length\fR \fIpoint\fR
.sp
\fB::math::geometry::s*\fR \fIfactor\fR \fIpoint\fR
.sp
\fB::math::geometry::direction\fR \fIangle\fR
.sp
\fB::math::geometry::h\fR \fIlength\fR
.sp
\fB::math::geometry::v\fR \fIlength\fR
.sp
\fB::math::geometry::between\fR \fIpoint1\fR \fIpoint2\fR \fIs\fR
.sp
\fB::math::geometry::octant\fR \fIpoint\fR
.sp
\fB::math::geometry::rect\fR \fInw\fR \fIse\fR
.sp
\fB::math::geometry::nwse\fR \fIrect\fR
.sp
\fB::math::geometry::angle\fR \fIline\fR
.sp
\fB::math::geometry::calculateDistanceToLine\fR \fIP\fR \fIline\fR
.sp
\fB::math::geometry::calculateDistanceToLineSegment\fR \fIP\fR \fIlinesegment\fR
.sp
\fB::math::geometry::calculateDistanceToPolyline\fR \fIP\fR \fIpolyline\fR
.sp
\fB::math::geometry::findClosestPointOnLine\fR \fIP\fR \fIline\fR
.sp
\fB::math::geometry::findClosestPointOnLineSegment\fR \fIP\fR \fIlinesegment\fR
.sp
\fB::math::geometry::findClosestPointOnPolyline\fR \fIP\fR \fIpolyline\fR
.sp
\fB::math::geometry::lengthOfPolyline\fR \fIpolyline\fR
.sp
\fB::math::geometry::movePointInDirection\fR \fIP\fR \fIdirection\fR \fIdist\fR
.sp
\fB::math::geometry::lineSegmentsIntersect\fR \fIlinesegment1\fR \fIlinesegment2\fR
.sp
\fB::math::geometry::findLineSegmentIntersection\fR \fIlinesegment1\fR \fIlinesegment2\fR
.sp
\fB::math::geometry::findLineIntersection\fR \fIline1\fR \fIline2\fR
.sp
\fB::math::geometry::polylinesIntersect\fR \fIpolyline1\fR \fIpolyline2\fR
.sp
\fB::math::geometry::polylinesBoundingIntersect\fR \fIpolyline1\fR \fIpolyline2\fR \fIgranularity\fR
.sp
\fB::math::geometry::intervalsOverlap\fR \fIy1\fR \fIy2\fR \fIy3\fR \fIy4\fR \fIstrict\fR
.sp
\fB::math::geometry::rectanglesOverlap\fR \fIP1\fR \fIP2\fR \fIQ1\fR \fIQ2\fR \fIstrict\fR
.sp
\fB::math::geometry::bbox\fR \fIpolyline\fR
.sp
\fB::math::geometry::pointInsidePolygon\fR \fIP\fR \fIpolyline\fR
.sp
\fB::math::geometry::rectangleInsidePolygon\fR \fIP1\fR \fIP2\fR \fIpolyline\fR
.sp
\fB::math::geometry::areaPolygon\fR \fIpolygon\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBmath::geometry\fR package is a collection of functions for
computations and manipulations on two-dimensional geometrical objects,
such as points, lines and polygons.
.PP
The geometrical objects are implemented as plain lists of coordinates.
For instance a line is defined by a list of four numbers, the x- and
y-coordinate of a first point and the x- and y-coordinates of a second
point on the line.
.PP
The various types of object are recognised by the number of coordinate
pairs and the context in which they are used: a list of four elements
can be regarded as an infinite line, a finite line segment but also
as a polyline of one segment and a point set of two points.
.PP
Currently the following types of objects are distinguished:
.IP \(bu
\fIpoint\fR - a list of two coordinates representing the x- and
y-coordinates respectively.
.IP \(bu
\fIline\fR - a list of four coordinates, interpreted as the x- and
y-coordinates of two distinct points on the line.
.IP \(bu
\fIline segment\fR - a list of four coordinates, interpreted as the
x- and y-coordinates of the first and the last points on the line
segment.
.IP \(bu
\fIpolyline\fR - a list of an even number of coordinates,
interpreted as the x- and y-coordinates of an ordered set of points.
.IP \(bu
\fIpolygon\fR - like a polyline, but the implicit assumption is that
the polyline is closed (if the first and last points do not coincide,
the missing segment is automatically added).
.IP \(bu
\fIpoint set\fR - again a list of an even number of coordinates, but
the points are regarded without any ordering.
.PP
.SH PROCEDURES
The package defines the following public procedures:
.TP
\fB::math::geometry::+\fR \fIpoint1\fR \fIpoint2\fR
Compute the sum of the two vectors given as points and return it.
The result is a vector as well.
.TP
\fB::math::geometry::-\fR \fIpoint1\fR \fIpoint2\fR
Compute the difference (point1 - point2) of the two vectors
given as points and return it. The result is a vector as well.
.TP
\fB::math::geometry::p\fR \fIx\fR \fIy\fR
Construct a point from its coordinates and return it as the
result of the command.
.TP
\fB::math::geometry::distance\fR \fIpoint1\fR \fIpoint2\fR
Compute the distance between the two points and return it as the
result of the command. This is in essence the same as
.CS


    math::geometry::length [math::geomtry::- point1 point2]

.CE
.TP
\fB::math::geometry::length\fR \fIpoint\fR
Compute the length of the vector and return it as the
result of the command.
.TP
\fB::math::geometry::s*\fR \fIfactor\fR \fIpoint\fR
Scale the vector by the factor and return it as the
result of the command. This is a vector as well.
.TP
\fB::math::geometry::direction\fR \fIangle\fR
Given the angle in degrees this command computes and returns
the unit vector pointing into this direction. The vector for
angle == 0 points to the right (up), and for angle == 90 up (north).
.TP
\fB::math::geometry::h\fR \fIlength\fR
Returns a horizontal vector on the X-axis of the specified length.
Positive lengths point to the right (east).
.TP
\fB::math::geometry::v\fR \fIlength\fR
Returns a vertical vector on the Y-axis of the specified length.
Positive lengths point down (south).
.TP
\fB::math::geometry::between\fR \fIpoint1\fR \fIpoint2\fR \fIs\fR
Compute the point which is at relative distance \fIs\fR between the two
points and return it as the result of the command. A relative distance of
\fB0\fR returns \fIpoint1\fR, the distance \fB1\fR returns \fIpoint2\fR.
Distances < 0 or > 1 extrapolate along the line between the two point.
.TP
\fB::math::geometry::octant\fR \fIpoint\fR
Compute the octant of the circle the point is in and return it as the result
of the command. The possible results are
.RS
.IP [1]
east
.IP [2]
northeast
.IP [3]
north
.IP [4]
northwest
.IP [5]
west
.IP [6]
southwest
.IP [7]
south
.IP [8]
southeast
.RE
.IP
Each octant is the arc of the circle +/- 22.5 degrees from the cardinal direction
the octant is named for.
.TP
\fB::math::geometry::rect\fR \fInw\fR \fIse\fR
Construct a rectangle from its northwest and southeast corners and return
it as the result of the command.
.TP
\fB::math::geometry::nwse\fR \fIrect\fR
Extract the northwest and southeast corners of the rectangle and return
them as the result of the command (a 2-element list containing the
points, in the named order).
.TP
\fB::math::geometry::angle\fR \fIline\fR
Calculate the angle from the positive x-axis to a given line
(in two dimensions only).
.RS
.TP
list \fIline\fR
Coordinates of the line
.RE
.sp
.TP
\fB::math::geometry::calculateDistanceToLine\fR \fIP\fR \fIline\fR
Calculate the distance of point P to the (infinite) line and return the
result
.RS
.TP
list \fIP\fR
List of two numbers, the coordinates of the point
.TP
list \fIline\fR
List of four numbers, the coordinates of two points
on the line
.RE
.sp
.TP
\fB::math::geometry::calculateDistanceToLineSegment\fR \fIP\fR \fIlinesegment\fR
Calculate the distance of point P to the (finite) line segment and
return the result.
.RS
.TP
list \fIP\fR
List of two numbers, the coordinates of the point
.TP
list \fIlinesegment\fR
List of four numbers, the coordinates of the
first and last points of the line segment
.RE
.sp
.sp
.TP
\fB::math::geometry::calculateDistanceToPolyline\fR \fIP\fR \fIpolyline\fR
Calculate the distance of point P to the polyline and
return the result.
.RS
.TP
list \fIP\fR
List of two numbers, the coordinates of the point
.TP
list \fIpolyline\fR
List of numbers, the coordinates of the
vertices of the polyline
.RE
.sp
.TP
\fB::math::geometry::findClosestPointOnLine\fR \fIP\fR \fIline\fR
Return the point on a line which is closest to a given point.
.RS
.TP
list \fIP\fR
List of two numbers, the coordinates of the point
.TP
list \fIline\fR
List of four numbers, the coordinates of two points
on the line
.RE
.sp
.TP
\fB::math::geometry::findClosestPointOnLineSegment\fR \fIP\fR \fIlinesegment\fR
Return the point on a \fIline segment\fR which is closest to a given
point.
.RS
.TP
list \fIP\fR
List of two numbers, the coordinates of the point
.TP
list \fIlinesegment\fR
List of four numbers, the first and last
points on the line segment
.RE
.sp
.TP
\fB::math::geometry::findClosestPointOnPolyline\fR \fIP\fR \fIpolyline\fR
Return the point on a \fIpolyline\fR which is closest to a given
point.
.RS
.TP
list \fIP\fR
List of two numbers, the coordinates of the point
.TP
list \fIpolyline\fR
List of numbers, the vertices of the polyline
.RE
.sp
.TP
\fB::math::geometry::lengthOfPolyline\fR \fIpolyline\fR
Return the length of the \fIpolyline\fR (note: it not regarded as a
polygon)
.RS
.TP
list \fIpolyline\fR
List of numbers, the vertices of the polyline
.RE
.sp
.TP
\fB::math::geometry::movePointInDirection\fR \fIP\fR \fIdirection\fR \fIdist\fR
Move a point over a given distance in a given direction and return the
new coordinates (in two dimensions only).
.RS
.TP
list \fIP\fR
Coordinates of the point to be moved
.TP
double \fIdirection\fR
Direction (in degrees; 0 is to the right, 90
upwards)
.TP
list \fIdist\fR
Distance over which to move the point
.RE
.sp
.TP
\fB::math::geometry::lineSegmentsIntersect\fR \fIlinesegment1\fR \fIlinesegment2\fR
Check if two line segments intersect or coincide. Returns 1 if that is
the case, 0 otherwise (in two dimensions only).
.RS
.TP
list \fIlinesegment1\fR
First line segment
.TP
list \fIlinesegment2\fR
Second line segment
.RE
.sp
.TP
\fB::math::geometry::findLineSegmentIntersection\fR \fIlinesegment1\fR \fIlinesegment2\fR
Find the intersection point of two line segments. Return the coordinates
or the keywords "coincident" or "none" if the line segments coincide or
have no points in common (in two dimensions only).
.RS
.TP
list \fIlinesegment1\fR
First line segment
.TP
list \fIlinesegment2\fR
Second line segment
.RE
.sp
.TP
\fB::math::geometry::findLineIntersection\fR \fIline1\fR \fIline2\fR
Find the intersection point of two (infinite) lines. Return the coordinates
or the keywords "coincident" or "none" if the lines coincide or
have no points in common (in two dimensions only).
.RS
.TP
list \fIline1\fR
First line
.TP
list \fIline2\fR
Second line
.RE
.IP
See section \fBReferences\fR for details on the algorithm and math behind it.
.sp
.TP
\fB::math::geometry::polylinesIntersect\fR \fIpolyline1\fR \fIpolyline2\fR
Check if two polylines intersect or not (in two dimensions only).
.RS
.TP
list \fIpolyline1\fR
First polyline
.TP
list \fIpolyline2\fR
Second polyline
.RE
.sp
.TP
\fB::math::geometry::polylinesBoundingIntersect\fR \fIpolyline1\fR \fIpolyline2\fR \fIgranularity\fR
Check whether two polylines intersect, but reduce
the correctness of the result to the given granularity.
Use this for faster, but weaker, intersection checking.
.sp
How it works:
.sp
Each polyline is split into a number of smaller polylines,
consisting of granularity points each. If a pair of those smaller
lines' bounding boxes intersect, then this procedure returns 1,
otherwise it returns 0.
.RS
.TP
list \fIpolyline1\fR
First polyline
.TP
list \fIpolyline2\fR
Second polyline
.TP
int \fIgranularity\fR
Number of points in each part (<=1 means check
every edge)
.RE
.sp
.TP
\fB::math::geometry::intervalsOverlap\fR \fIy1\fR \fIy2\fR \fIy3\fR \fIy4\fR \fIstrict\fR
Check if two intervals overlap.
.RS
.TP
double \fIy1,y2\fR
Begin and end of first interval
.TP
double \fIy3,y4\fR
Begin and end of second interval
.TP
logical \fIstrict\fR
Check for strict or non-strict overlap
.RE
.sp
.TP
\fB::math::geometry::rectanglesOverlap\fR \fIP1\fR \fIP2\fR \fIQ1\fR \fIQ2\fR \fIstrict\fR
Check if two rectangles overlap.
.RS
.TP
list \fIP1\fR
upper-left corner of the first rectangle
.TP
list \fIP2\fR
lower-right corner of the first rectangle
.TP
list \fIQ1\fR
upper-left corner of the second rectangle
.TP
list \fIQ2\fR
lower-right corner of the second rectangle
.TP
list \fIstrict\fR
choosing strict or non-strict interpretation
.RE
.sp
.TP
\fB::math::geometry::bbox\fR \fIpolyline\fR
Calculate the bounding box of a polyline. Returns a list of four
coordinates: the upper-left and the lower-right corner of the box.
.RS
.TP
list \fIpolyline\fR
The polyline to be examined
.RE
.sp
.TP
\fB::math::geometry::pointInsidePolygon\fR \fIP\fR \fIpolyline\fR
Determine if a point is completely inside a polygon. If the point
touches the polygon, then the point is not completely inside the
polygon.
.RS
.TP
list \fIP\fR
Coordinates of the point
.TP
list \fIpolyline\fR
The polyline to be examined
.RE
.sp
.TP
\fB::math::geometry::rectangleInsidePolygon\fR \fIP1\fR \fIP2\fR \fIpolyline\fR
Determine if a rectangle is completely inside a polygon. If polygon
touches the rectangle, then the rectangle is not complete inside the
polygon.
.RS
.TP
list \fIP1\fR
Upper-left corner of the rectangle
.TP
list \fIP2\fR
Lower-right corner of the rectangle
.sp
.TP
list \fIpolygon\fR
The polygon in question
.RE
.sp
.TP
\fB::math::geometry::areaPolygon\fR \fIpolygon\fR
Calculate the area of a polygon.
.RS
.TP
list \fIpolygon\fR
The polygon in question
.RE
.PP
.SH REFERENCES
.IP [1]
\fIPolygon Intersection\fR [http:/wiki.tcl.tk/12070]
.IP [2]
\fIhttp://en.wikipedia.org/wiki/Line-line_intersection\fR
.IP [3]
\fIhttp://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/\fR
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: geometry\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
angle, distance, line, math, plane geometry, point
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2001 by Ideogramic ApS and other parties
Copyright (c) 2004 by Arjen Markus
Copyright (c) 2010 by Andreas Kupries
Copyright (c) 2010 by Kevin Kenny

.fi

Added embedded/man/files/modules/math/numtheory.n.











































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/numtheory.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2010 Lars Hellström <Lars dot Hellstrom at residenset dot net>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::numtheory" n 1.0 tcllib "Tcl Math Library"
.BS
.SH NAME
math::numtheory \- Number Theory
.SH SYNOPSIS
package require \fBTcl  ?8.5?\fR
.sp
package require \fBmath::numtheory  ?1.0?\fR
.sp
\fBmath::numtheory::isprime\fR \fIN\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
.BE
.SH DESCRIPTION
.PP
This package is for collecting various number-theoretic operations,
though at the moment it only provides that of testing whether an
integer is a prime.
.TP
\fBmath::numtheory::isprime\fR \fIN\fR ?\fIoption\fR \fIvalue\fR ...?
The \fBisprime\fR command tests whether the integer \fIN\fR is a
prime, returning a boolean true value for prime \fIN\fR and a
boolean false value for non-prime \fIN\fR. The formal definition of
\'prime' used is the conventional, that the number being tested is
greater than 1 and only has trivial divisors.
.sp
To be precise, the return value is one of \fB0\fR (if \fIN\fR is
definitely not a prime), \fB1\fR (if \fIN\fR is definitely a
prime), and \fBon\fR (if \fIN\fR is probably prime); the latter
two are both boolean true values. The case that an integer may be
classified as "probably prime" arises because the Miller-Rabin
algorithm used in the test implementation is basically probabilistic,
and may if we are unlucky fail to detect that a number is in fact
composite. Options may be used to select the risk of such
"false positives" in the test. \fB1\fR is returned for "small"
\fIN\fR (which currently means \fIN\fR < 118670087467), where it is
known that no false positives are possible.
.sp
The only option currently defined is:
.RS
.TP
\fB-randommr\fR \fIrepetitions\fR
which controls how many times the Miller-Rabin test should be
repeated with randomly chosen bases. Each repetition reduces the
probability of a false positive by a factor at least 4. The
default for \fIrepetitions\fR is 4.
.RE
.IP
Unknown options are silently ignored.
.PP
.SH KEYWORDS
number theory, prime
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2010 Lars Hellström <Lars dot Hellstrom at residenset dot net>

.fi

Added embedded/man/files/modules/math/optimize.n.














































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/optimize.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Arjen Markus <[email protected]>
'\" Copyright (c) 2004,2005 Kevn B. Kenny <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::optimize" n 1.0 tcllib "Tcl Math Library"
.BS
.SH NAME
math::optimize \- Optimisation routines
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmath::optimize  ?1.0?\fR
.sp
\fB::math::optimize::minimum\fR \fIbegin\fR \fIend\fR \fIfunc\fR \fImaxerr\fR
.sp
\fB::math::optimize::maximum\fR \fIbegin\fR \fIend\fR \fIfunc\fR \fImaxerr\fR
.sp
\fB::math::optimize::min_bound_1d\fR \fIfunc\fR \fIbegin\fR \fIend\fR ?\fB-relerror\fR \fIreltol\fR? ?\fB-abserror\fR \fIabstol\fR? ?\fB-maxiter\fR \fImaxiter\fR? ?\fB-trace\fR \fItraceflag\fR?
.sp
\fB::math::optimize::min_unbound_1d\fR \fIfunc\fR \fIbegin\fR \fIend\fR ?\fB-relerror\fR \fIreltol\fR? ?\fB-abserror\fR \fIabstol\fR? ?\fB-maxiter\fR \fImaxiter\fR? ?\fB-trace\fR \fItraceflag\fR?
.sp
\fB::math::optimize::solveLinearProgram\fR \fIobjective\fR \fIconstraints\fR
.sp
\fB::math::optimize::linearProgramMaximum\fR \fIobjective\fR \fIresult\fR
.sp
\fB::math::optimize::nelderMead\fR \fIobjective\fR \fIxVector\fR ?\fB-scale\fR \fIxScaleVector\fR? ?\fB-ftol\fR \fIepsilon\fR? ?\fB-maxiter\fR \fIcount\fR? ??-trace? \fIflag\fR?
.sp
.BE
.SH DESCRIPTION
.PP
This package implements several optimisation algorithms:
.IP \(bu
Minimize or maximize a function over a given interval
.IP \(bu
Solve a linear program (maximize a linear function subject to linear
constraints)
.IP \(bu
Minimize a function of several variables given an initial guess for the
location of the minimum.
.PP
.PP
The package is fully implemented in Tcl. No particular attention has
been paid to the accuracy of the calculations. Instead, the
algorithms have been used in a straightforward manner.
.PP
This document describes the procedures and explains their usage.
.SH PROCEDURES
.PP
This package defines the following public procedures:
.TP
\fB::math::optimize::minimum\fR \fIbegin\fR \fIend\fR \fIfunc\fR \fImaxerr\fR
Minimize the given (continuous) function by examining the values in the
given interval. The procedure determines the values at both ends and in the
centre of the interval and then constructs a new interval of 1/2 length
that includes the minimum. No guarantee is made that the \fIglobal\fR
minimum is found.
.sp
The procedure returns the "x" value for which the function is minimal.
.sp
\fIThis procedure has been deprecated - use min_bound_1d instead\fR
.sp
\fIbegin\fR - Start of the interval
.sp
\fIend\fR - End of the interval
.sp
\fIfunc\fR - Name of the function to be minimized (a procedure taking
one argument).
.sp
\fImaxerr\fR - Maximum relative error (defaults to 1.0e-4)
.TP
\fB::math::optimize::maximum\fR \fIbegin\fR \fIend\fR \fIfunc\fR \fImaxerr\fR
Maximize the given (continuous) function by examining the values in the
given interval. The procedure determines the values at both ends and in the
centre of the interval and then constructs a new interval of 1/2 length
that includes the maximum. No guarantee is made that the \fIglobal\fR
maximum is found.
.sp
The procedure returns the "x" value for which the function is maximal.
.sp
\fIThis procedure has been deprecated - use max_bound_1d instead\fR
.sp
\fIbegin\fR - Start of the interval
.sp
\fIend\fR - End of the interval
.sp
\fIfunc\fR - Name of the function to be maximized (a procedure taking
one argument).
.sp
\fImaxerr\fR - Maximum relative error (defaults to 1.0e-4)
.TP
\fB::math::optimize::min_bound_1d\fR \fIfunc\fR \fIbegin\fR \fIend\fR ?\fB-relerror\fR \fIreltol\fR? ?\fB-abserror\fR \fIabstol\fR? ?\fB-maxiter\fR \fImaxiter\fR? ?\fB-trace\fR \fItraceflag\fR?
Miminizes a function of one variable in the given interval.  The procedure
uses Brent's method of parabolic interpolation, protected by golden-section
subdivisions if the interpolation is not converging.  No guarantee is made
that a \fIglobal\fR minimum is found.  The function to evaluate, \fIfunc\fR,
must be a single Tcl command; it will be evaluated with an abscissa appended
as the last argument.
.sp
\fIx1\fR and \fIx2\fR are the two bounds of
the interval in which the minimum is to be found.  They need not be in
increasing order.
.sp
\fIreltol\fR, if specified, is the desired upper bound
on the relative error of the result; default is 1.0e-7.  The given value
should never be smaller than the square root of the machine's floating point
precision, or else convergence is not guaranteed.  \fIabstol\fR, if specified,
is the desired upper bound on the absolute error of the result; default
is 1.0e-10.  Caution must be used with small values of \fIabstol\fR to
avoid overflow/underflow conditions; if the minimum is expected to lie
about a small but non-zero abscissa, you consider either shifting the
function or changing its length scale.
.sp
\fImaxiter\fR may be used to constrain the number of function evaluations
to be performed; default is 100.  If the command evaluates the function
more than \fImaxiter\fR times, it returns an error to the caller.
.sp
\fItraceFlag\fR is a Boolean value. If true, it causes the command to
print a message on the standard output giving the abscissa and ordinate
at each function evaluation, together with an indication of what type
of interpolation was chosen.  Default is 0 (no trace).
.TP
\fB::math::optimize::min_unbound_1d\fR \fIfunc\fR \fIbegin\fR \fIend\fR ?\fB-relerror\fR \fIreltol\fR? ?\fB-abserror\fR \fIabstol\fR? ?\fB-maxiter\fR \fImaxiter\fR? ?\fB-trace\fR \fItraceflag\fR?
Miminizes a function of one variable over the entire real number line.
The procedure uses parabolic extrapolation combined with golden-section
dilatation to search for a region where a minimum exists, followed by
Brent's method of parabolic interpolation, protected by golden-section
subdivisions if the interpolation is not converging.  No guarantee is made
that a \fIglobal\fR minimum is found.  The function to evaluate, \fIfunc\fR,
must be a single Tcl command; it will be evaluated with an abscissa appended
as the last argument.
.sp
\fIx1\fR and \fIx2\fR are two initial guesses at where the minimum
may lie.  \fIx1\fR is the starting point for the minimization, and
the difference between \fIx2\fR and \fIx1\fR is used as a hint at the
characteristic length scale of the problem.
.sp
\fIreltol\fR, if specified, is the desired upper bound
on the relative error of the result; default is 1.0e-7.  The given value
should never be smaller than the square root of the machine's floating point
precision, or else convergence is not guaranteed.  \fIabstol\fR, if specified,
is the desired upper bound on the absolute error of the result; default
is 1.0e-10.  Caution must be used with small values of \fIabstol\fR to
avoid overflow/underflow conditions; if the minimum is expected to lie
about a small but non-zero abscissa, you consider either shifting the
function or changing its length scale.
.sp
\fImaxiter\fR may be used to constrain the number of function evaluations
to be performed; default is 100.  If the command evaluates the function
more than \fImaxiter\fR times, it returns an error to the caller.
.sp
\fItraceFlag\fR is a Boolean value. If true, it causes the command to
print a message on the standard output giving the abscissa and ordinate
at each function evaluation, together with an indication of what type
of interpolation was chosen.  Default is 0 (no trace).
.TP
\fB::math::optimize::solveLinearProgram\fR \fIobjective\fR \fIconstraints\fR
Solve a \fIlinear program\fR in standard form using a straightforward
implementation of the Simplex algorithm. (In the explanation below: The
linear program has N constraints and M variables).
.sp
The procedure returns a list of M values, the values for which the
objective function is maximal or a single keyword if the linear program
is not feasible or unbounded (either "unfeasible" or "unbounded")
.sp
\fIobjective\fR - The M coefficients of the objective function
.sp
\fIconstraints\fR - Matrix of coefficients plus maximum values that
implement the linear constraints. It is expected to be a list of N lists
of M+1 numbers each, M coefficients and the maximum value.
.TP
\fB::math::optimize::linearProgramMaximum\fR \fIobjective\fR \fIresult\fR
Convenience function to return the maximum for the solution found by the
solveLinearProgram procedure.
.sp
\fIobjective\fR - The M coefficients of the objective function
.sp
\fIresult\fR - The result as returned by solveLinearProgram
.TP
\fB::math::optimize::nelderMead\fR \fIobjective\fR \fIxVector\fR ?\fB-scale\fR \fIxScaleVector\fR? ?\fB-ftol\fR \fIepsilon\fR? ?\fB-maxiter\fR \fIcount\fR? ??-trace? \fIflag\fR?
Minimizes, in unconstrained fashion, a function of several variable over all
of space.  The function to evaluate, \fIobjective\fR, must be a single Tcl
command. To it will be appended as many elements as appear in the initial guess at
the location of the minimum, passed in as a Tcl list, \fIxVector\fR.
.sp
\fIxScaleVector\fR is an initial guess at the problem scale; the first
function evaluations will be made by varying the co-ordinates in \fIxVector\fR
by the amounts in \fIxScaleVector\fR.  If \fIxScaleVector\fR is not supplied,
the co-ordinates will be varied by a factor of 1.0001 (if the co-ordinate
is non-zero) or by a constant 0.0001 (if the co-ordinate is zero).
.sp
\fIepsilon\fR is the desired relative error in the value of the function
evaluated at the minimum. The default is 1.0e-7, which usually gives three
significant digits of accuracy in the values of the x's.
.sp
pp
\fIcount\fR is a limit on the number of trips through the main loop of
the optimizer.  The number of function evaluations may be several times
this number.  If the optimizer fails to find a minimum to within \fIftol\fR
in \fImaxiter\fR iterations, it returns its current best guess and an
error status. Default is to allow 500 iterations.
.sp
\fIflag\fR is a flag that, if true, causes a line to be written to the
standard output for each evaluation of the objective function, giving
the arguments presented to the function and the value returned. Default is
false.
.sp
The \fBnelderMead\fR procedure returns a list of alternating keywords and
values suitable for use with \fBarray set\fR. The meaning of the keywords is:
.sp
\fIx\fR is the approximate location of the minimum.
.sp
\fIy\fR is the value of the function at \fIx\fR.
.sp
\fIyvec\fR is a vector of the best N+1 function values achieved, where
N is the dimension of \fIx\fR
.sp
\fIvertices\fR is a list of vectors giving the function arguments
corresponding to the values in \fIyvec\fR.
.sp
\fInIter\fR is the number of iterations required to achieve convergence or
fail.
.sp
\fIstatus\fR is 'ok' if the operation succeeded, or 'too-many-iterations'
if the maximum iteration count was exceeded.
.sp
\fBnelderMead\fR minimizes the given function using the downhill
simplex method of Nelder and Mead.  This method is quite slow - much
faster methods for minimization are known - but has the advantage of being
extremely robust in the face of problems where the minimum lies in
a valley of complex topology.
.sp
\fBnelderMead\fR can occasionally find itself "stuck" at a point where
it can make no further progress; it is recommended that the caller
run it at least a second time, passing as the initial guess the
result found by the previous call.  The second run is usually very
fast.
.sp
\fBnelderMead\fR can be used in some cases for constrained optimization.
To do this, add a large value to the objective function if the parameters
are outside the feasible region.  To work effectively in this mode,
\fBnelderMead\fR requires that the initial guess be feasible and
usually requires that the feasible region be convex.
.PP
.SH NOTES
.PP
Several of the above procedures take the \fInames\fR of procedures as
arguments. To avoid problems with the \fIvisibility\fR of these
procedures, the fully-qualified name of these procedures is determined
inside the optimize routines. For the user this has only one
consequence: the named procedure must be visible in the calling
procedure. For instance:
.CS


    namespace eval ::mySpace {
       namespace export calcfunc
       proc calcfunc { x } { return $x }
    }
    #
    # Use a fully-qualified name
    #
    namespace eval ::myCalc {
       puts [min_bound_1d ::myCalc::calcfunc $begin $end]
    }
    #
    # Import the name
    #
    namespace eval ::myCalc {
       namespace import ::mySpace::calcfunc
       puts [min_bound_1d calcfunc $begin $end]
    }

.CE
The simple procedures \fIminimum\fR and \fImaximum\fR have been
deprecated: the alternatives are much more flexible, robust and
require less function evaluations.
.SH EXAMPLES
.PP
Let us take a few simple examples:
.PP
Determine the maximum of f(x) = x^3 exp(-3x), on the interval (0,10):
.CS


proc efunc { x } { expr {$x*$x*$x * exp(-3.0*$x)} }
puts "Maximum at: [::math::optimize::max_bound_1d efunc 0.0 10.0]"

.CE
.PP
The maximum allowed error determines the number of steps taken (with
each step in the iteration the interval is reduced with a factor 1/2).
Hence, a maximum error of 0.0001 is achieved in approximately 14 steps.
.PP
An example of a \fIlinear program\fR is:
.PP
Optimise the expression 3x+2y, where:
.CS


   x >= 0 and y >= 0 (implicit constraints, part of the
                     definition of linear programs)

   x + y   <= 1      (constraints specific to the problem)
   2x + 5y <= 10

.CE
.PP
This problem can be solved as follows:
.CS



   set solution [::math::optimize::solveLinearProgram  { 3.0   2.0 }  { { 1.0   1.0   1.0 }
        { 2.0   5.0  10.0 } } ]

.CE
.PP
Note, that a constraint like:
.CS


   x + y >= 1

.CE
can be turned into standard form using:
.CS


   -x  -y <= -1

.CE
.PP
The theory of linear programming is the subject of many a text book and
the Simplex algorithm that is implemented here is the best-known
method to solve this type of problems, but it is not the only one.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: optimize\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
linear program, math, maximum, minimum, optimization
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Arjen Markus <[email protected]>
Copyright (c) 2004,2005 Kevn B. Kenny <[email protected]>

.fi

Added embedded/man/files/modules/math/polynomials.n.































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/polynomials.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Arjen Markus <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::polynomials" n 1.0.1 tcllib "Tcl Math Library"
.BS
.SH NAME
math::polynomials \- Polynomial functions
.SH SYNOPSIS
package require \fBTcl  ?8.3?\fR
.sp
package require \fBmath::polynomials  ?1.0.1?\fR
.sp
\fB::math::polynomials::polynomial\fR \fIcoeffs\fR
.sp
\fB::math::polynomials::polynCmd\fR \fIcoeffs\fR
.sp
\fB::math::polynomials::evalPolyn\fR \fIpolynomial\fR \fIx\fR
.sp
\fB::math::polynomials::addPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
.sp
\fB::math::polynomials::subPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
.sp
\fB::math::polynomials::multPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
.sp
\fB::math::polynomials::divPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
.sp
\fB::math::polynomials::remainderPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
.sp
\fB::math::polynomials::derivPolyn\fR \fIpolyn\fR
.sp
\fB::math::polynomials::primitivePolyn\fR \fIpolyn\fR
.sp
\fB::math::polynomials::degreePolyn\fR \fIpolyn\fR
.sp
\fB::math::polynomials::coeffPolyn\fR \fIpolyn\fR \fIindex\fR
.sp
\fB::math::polynomials::allCoeffsPolyn\fR \fIpolyn\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package deals with polynomial functions of one variable:
.IP \(bu
the basic arithmetic operations are extended to polynomials
.IP \(bu
computing the derivatives and primitives of these functions
.IP \(bu
evaluation through a general procedure or via specific procedures)
.PP
.SH PROCEDURES
The package defines the following public procedures:
.TP
\fB::math::polynomials::polynomial\fR \fIcoeffs\fR
Return an (encoded) list that defines the polynomial. A polynomial
.CS


   f(x) = a + b.x + c.x**2 + d.x**3

.CE
.IP
can be defined via:
.CS


   set f [::math::polynomials::polynomial [list $a $b $c $d]

.CE
.RS
.TP
list \fIcoeffs\fR
Coefficients of the polynomial (in ascending
order)
.RE
.sp
.TP
\fB::math::polynomials::polynCmd\fR \fIcoeffs\fR
Create a new procedure that evaluates the polynomial. The name of the
polynomial is automatically generated. Useful if you need to evualuate
the polynomial many times, as the procedure consists of a single
[expr] command.
.RS
.TP
list \fIcoeffs\fR
Coefficients of the polynomial (in ascending
order) or the polynomial definition returned by the \fIpolynomial\fR
command.
.RE
.sp
.TP
\fB::math::polynomials::evalPolyn\fR \fIpolynomial\fR \fIx\fR
Evaluate the polynomial at x.
.RS
.TP
list \fIpolynomial\fR
The polynomial's definition (as returned by
the polynomial command).
order)
.TP
float \fIx\fR
The coordinate at which to evaluate the polynomial
.RE
.sp
.TP
\fB::math::polynomials::addPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
Return a new polynomial which is the sum of the two others.
.RS
.TP
list \fIpolyn1\fR
The first polynomial operand
.TP
list \fIpolyn2\fR
The second polynomial operand
.RE
.sp
.TP
\fB::math::polynomials::subPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
Return a new polynomial which is the difference of the two others.
.RS
.TP
list \fIpolyn1\fR
The first polynomial operand
.TP
list \fIpolyn2\fR
The second polynomial operand
.RE
.sp
.TP
\fB::math::polynomials::multPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
Return a new polynomial which is the product of the two others. If one
of the arguments is a scalar value, the other polynomial is simply
scaled.
.RS
.TP
list \fIpolyn1\fR
The first polynomial operand or a scalar
.TP
list \fIpolyn2\fR
The second polynomial operand or a scalar
.RE
.sp
.TP
\fB::math::polynomials::divPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
Divide the first polynomial by the second polynomial and return the
result. The remainder is dropped
.RS
.TP
list \fIpolyn1\fR
The first polynomial operand
.TP
list \fIpolyn2\fR
The second polynomial operand
.RE
.sp
.TP
\fB::math::polynomials::remainderPolyn\fR \fIpolyn1\fR \fIpolyn2\fR
Divide the first polynomial by the second polynomial and return the
remainder.
.RS
.TP
list \fIpolyn1\fR
The first polynomial operand
.TP
list \fIpolyn2\fR
The second polynomial operand
.RE
.sp
.TP
\fB::math::polynomials::derivPolyn\fR \fIpolyn\fR
Differentiate the polynomial and return the result.
.RS
.TP
list \fIpolyn\fR
The polynomial to be differentiated
.RE
.sp
.TP
\fB::math::polynomials::primitivePolyn\fR \fIpolyn\fR
Integrate the polynomial and return the result. The integration
constant is set to zero.
.RS
.TP
list \fIpolyn\fR
The polynomial to be integrated
.RE
.sp
.TP
\fB::math::polynomials::degreePolyn\fR \fIpolyn\fR
Return the degree of the polynomial.
.RS
.TP
list \fIpolyn\fR
The polynomial to be examined
.RE
.sp
.TP
\fB::math::polynomials::coeffPolyn\fR \fIpolyn\fR \fIindex\fR
Return the coefficient of the term of the index'th degree of the
polynomial.
.RS
.TP
list \fIpolyn\fR
The polynomial to be examined
.TP
int \fIindex\fR
The degree of the term
.RE
.sp
.TP
\fB::math::polynomials::allCoeffsPolyn\fR \fIpolyn\fR
Return the coefficients of the polynomial (in ascending order).
.RS
.TP
list \fIpolyn\fR
The polynomial in question
.RE
.PP
.SH "REMARKS ON THE IMPLEMENTATION"
The implementation for evaluating the polynomials at some point uses
Horn's rule, which guarantees numerical stability and a minimum of
arithmetic operations.
To recognise that a polynomial definition is indeed a correct
definition, it consists of a list of two elements: the keyword
"POLYNOMIAL" and the list of coefficients in descending order. The
latter makes it easier to implement Horner's rule.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: polynomials\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
math, polynomial functions
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Arjen Markus <[email protected]>

.fi

Added embedded/man/files/modules/math/qcomplex.n.


























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/qcomplex.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Arjen Markus <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::complexnumbers" n 1.0.2 tcllib "Tcl Math Library"
.BS
.SH NAME
math::complexnumbers \- Straightforward complex number package
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBmath::complexnumbers  ?1.0.2?\fR
.sp
\fB::math::complexnumbers::+\fR \fIz1\fR \fIz2\fR
.sp
\fB::math::complexnumbers::-\fR \fIz1\fR \fIz2\fR
.sp
\fB::math::complexnumbers::*\fR \fIz1\fR \fIz2\fR
.sp
\fB::math::complexnumbers::/\fR \fIz1\fR \fIz2\fR
.sp
\fB::math::complexnumbers::conj\fR \fIz1\fR
.sp
\fB::math::complexnumbers::real\fR \fIz1\fR
.sp
\fB::math::complexnumbers::imag\fR \fIz1\fR
.sp
\fB::math::complexnumbers::mod\fR \fIz1\fR
.sp
\fB::math::complexnumbers::arg\fR \fIz1\fR
.sp
\fB::math::complexnumbers::complex\fR \fIreal\fR \fIimag\fR
.sp
\fB::math::complexnumbers::tostring\fR \fIz1\fR
.sp
\fB::math::complexnumbers::exp\fR \fIz1\fR
.sp
\fB::math::complexnumbers::sin\fR \fIz1\fR
.sp
\fB::math::complexnumbers::cos\fR \fIz1\fR
.sp
\fB::math::complexnumbers::tan\fR \fIz1\fR
.sp
\fB::math::complexnumbers::log\fR \fIz1\fR
.sp
\fB::math::complexnumbers::sqrt\fR \fIz1\fR
.sp
\fB::math::complexnumbers::pow\fR \fIz1\fR \fIz2\fR
.sp
.BE
.SH DESCRIPTION
.PP
The mathematical module \fIcomplexnumbers\fR provides a straightforward
implementation of complex numbers in pure Tcl. The philosophy is that
the user knows he or she is dealing with complex numbers in an abstract
way and wants as high a performance as can be had within the limitations
of an interpreted language.
.PP
Therefore the procedures defined in this package assume that the
arguments are valid (representations of) "complex numbers", that is,
lists of two numbers defining the real and imaginary part of a
complex number (though this is a mere detail: rely on the
\fIcomplex\fR command to construct a valid number.)
.PP
Most procedures implement the basic arithmetic operations or elementary
functions whereas several others convert to and from different
representations:
.PP
.CS


    set z [complex 0 1]
    puts "z = [tostring $z]"
    puts "z**2 = [* $z $z]

.CE
would result in:
.CS


    z = i
    z**2 = -1

.CE
.SH "AVAILABLE PROCEDURES"
The package implements all or most basic operations and elementary
functions.
.PP
\fIThe arithmetic operations are:\fR
.TP
\fB::math::complexnumbers::+\fR \fIz1\fR \fIz2\fR
Add the two arguments and return the resulting complex number
.RS
.TP
complex \fIz1\fR (in)
First argument in the summation
.TP
complex \fIz2\fR (in)
Second argument in the summation
.RE
.sp
.TP
\fB::math::complexnumbers::-\fR \fIz1\fR \fIz2\fR
Subtract the second argument from the first and return the
resulting complex number. If there is only one argument, the
opposite of z1 is returned (i.e. -z1)
.RS
.TP
complex \fIz1\fR (in)
First argument in the subtraction
.TP
complex \fIz2\fR (in)
Second argument in the subtraction (optional)
.RE
.sp
.TP
\fB::math::complexnumbers::*\fR \fIz1\fR \fIz2\fR
Multiply the two arguments and return the resulting complex number
.RS
.TP
complex \fIz1\fR (in)
First argument in the multiplication
.TP
complex \fIz2\fR (in)
Second argument in the multiplication
.RE
.sp
.TP
\fB::math::complexnumbers::/\fR \fIz1\fR \fIz2\fR
Divide the first argument by the second and return the resulting complex
number
.RS
.TP
complex \fIz1\fR (in)
First argument (numerator) in the division
.TP
complex \fIz2\fR (in)
Second argument (denominator) in the division
.RE
.sp
.TP
\fB::math::complexnumbers::conj\fR \fIz1\fR
Return the conjugate of the given complex number
.RS
.TP
complex \fIz1\fR (in)
Complex number in question
.RE
.sp
.PP
.PP
\fIConversion/inquiry procedures:\fR
.TP
\fB::math::complexnumbers::real\fR \fIz1\fR
Return the real part of the given complex number
.RS
.TP
complex \fIz1\fR (in)
Complex number in question
.RE
.sp
.TP
\fB::math::complexnumbers::imag\fR \fIz1\fR
Return the imaginary part of the given complex number
.RS
.TP
complex \fIz1\fR (in)
Complex number in question
.RE
.sp
.TP
\fB::math::complexnumbers::mod\fR \fIz1\fR
Return the modulus of the given complex number
.RS
.TP
complex \fIz1\fR (in)
Complex number in question
.RE
.sp
.TP
\fB::math::complexnumbers::arg\fR \fIz1\fR
Return the argument ("angle" in radians) of the given complex number
.RS
.TP
complex \fIz1\fR (in)
Complex number in question
.RE
.sp
.TP
\fB::math::complexnumbers::complex\fR \fIreal\fR \fIimag\fR
Construct the complex number "real + imag*i" and return it
.RS
.TP
float \fIreal\fR (in)
The real part of the new complex number
.TP
float \fIimag\fR (in)
The imaginary part of the new complex number
.RE
.sp
.TP
\fB::math::complexnumbers::tostring\fR \fIz1\fR
Convert the complex number to the form "real + imag*i" and return the
string
.RS
.TP
float \fIcomplex\fR (in)
The complex number to be converted
.RE
.sp
.PP
.PP
\fIElementary functions:\fR
.TP
\fB::math::complexnumbers::exp\fR \fIz1\fR
Calculate the exponential for the given complex argument and return the
result
.RS
.TP
complex \fIz1\fR (in)
The complex argument for the function
.RE
.sp
.TP
\fB::math::complexnumbers::sin\fR \fIz1\fR
Calculate the sine function for the given complex argument and return
the result
.RS
.TP
complex \fIz1\fR (in)
The complex argument for the function
.RE
.sp
.TP
\fB::math::complexnumbers::cos\fR \fIz1\fR
Calculate the cosine function for the given complex argument and return
the result
.RS
.TP
complex \fIz1\fR (in)
The complex argument for the function
.RE
.sp
.TP
\fB::math::complexnumbers::tan\fR \fIz1\fR
Calculate the tangent function for the given complex argument and
return the result
.RS
.TP
complex \fIz1\fR (in)
The complex argument for the function
.RE
.sp
.TP
\fB::math::complexnumbers::log\fR \fIz1\fR
Calculate the (principle value of the) logarithm for the given complex
argument and return the result
.RS
.TP
complex \fIz1\fR (in)
The complex argument for the function
.RE
.sp
.TP
\fB::math::complexnumbers::sqrt\fR \fIz1\fR
Calculate the (principle value of the) square root for the given complex
argument and return the result
.RS
.TP
complex \fIz1\fR (in)
The complex argument for the function
.RE
.sp
.TP
\fB::math::complexnumbers::pow\fR \fIz1\fR \fIz2\fR
Calculate "z1 to the power of z2" and return the result
.RS
.TP
complex \fIz1\fR (in)
The complex number to be raised to a power
.TP
complex \fIz2\fR (in)
The complex power to be used
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: complexnumbers\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
complex numbers, math
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Arjen Markus <[email protected]>

.fi

Added embedded/man/files/modules/math/rational_funcs.n.
































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/rational_funcs.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Arjen Markus <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::rationalfunctions" n 1.0.1 tcllib "Math"
.BS
.SH NAME
math::rationalfunctions \- Polynomial functions
.SH SYNOPSIS
package require \fBTcl  ?8.4?\fR
.sp
package require \fBmath::rationalfunctions  ?1.0.1?\fR
.sp
\fB::math::rationalfunctions::rationalFunction\fR \fInum\fR \fIden\fR
.sp
\fB::math::rationalfunctions::ratioCmd\fR \fInum\fR \fIden\fR
.sp
\fB::math::rationalfunctions::evalRatio\fR \fIrational\fR \fIx\fR
.sp
\fB::math::rationalfunctions::addRatio\fR \fIratio1\fR \fIratio2\fR
.sp
\fB::math::rationalfunctions::subRatio\fR \fIratio1\fR \fIratio2\fR
.sp
\fB::math::rationalfunctions::multRatio\fR \fIratio1\fR \fIratio2\fR
.sp
\fB::math::rationalfunctions::divRatio\fR \fIratio1\fR \fIratio2\fR
.sp
\fB::math::rationalfunctions::derivPolyn\fR \fIratio\fR
.sp
\fB::math::rationalfunctions::coeffsNumerator\fR \fIratio\fR
.sp
\fB::math::rationalfunctions::coeffsDenominator\fR \fIratio\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package deals with rational functions of one variable:
.IP \(bu
the basic arithmetic operations are extended to rational functions
.IP \(bu
computing the derivatives of these functions
.IP \(bu
evaluation through a general procedure or via specific procedures)
.PP
.SH PROCEDURES
The package defines the following public procedures:
.TP
\fB::math::rationalfunctions::rationalFunction\fR \fInum\fR \fIden\fR
Return an (encoded) list that defines the rational function. A
rational function
.CS


             1 + x^3
   f(x) = ------------
          1 + 2x + x^2

.CE
.IP
can be defined via:
.CS


   set f [::math::rationalfunctions::rationalFunction [list 1 0 0 1]  [list 1 2 1]]

.CE
.RS
.TP
list \fInum\fR
Coefficients of the numerator of the rational
function (in ascending order)
.sp
.TP
list \fIden\fR
Coefficients of the denominator of the rational
function (in ascending order)
.RE
.sp
.TP
\fB::math::rationalfunctions::ratioCmd\fR \fInum\fR \fIden\fR
Create a new procedure that evaluates the rational function. The name of the
function is automatically generated. Useful if you need to evaluate
the function many times, as the procedure consists of a single
[expr] command.
.RS
.TP
list \fInum\fR
Coefficients of the numerator of the rational
function (in ascending order)
.sp
.TP
list \fIden\fR
Coefficients of the denominator of the rational
function (in ascending order)
.RE
.sp
.TP
\fB::math::rationalfunctions::evalRatio\fR \fIrational\fR \fIx\fR
Evaluate the rational function at x.
.RS
.TP
list \fIrational\fR
The rational function's definition (as returned
by the rationalFunction command).
order)
.TP
float \fIx\fR
The coordinate at which to evaluate the function
.RE
.sp
.TP
\fB::math::rationalfunctions::addRatio\fR \fIratio1\fR \fIratio2\fR
Return a new rational function which is the sum of the two others.
.RS
.TP
list \fIratio1\fR
The first rational function operand
.TP
list \fIratio2\fR
The second rational function operand
.RE
.sp
.TP
\fB::math::rationalfunctions::subRatio\fR \fIratio1\fR \fIratio2\fR
Return a new rational function which is the difference of the two
others.
.RS
.TP
list \fIratio1\fR
The first rational function operand
.TP
list \fIratio2\fR
The second rational function operand
.RE
.sp
.TP
\fB::math::rationalfunctions::multRatio\fR \fIratio1\fR \fIratio2\fR
Return a new rational function which is the product of the two others.
If one of the arguments is a scalar value, the other rational function is
simply scaled.
.RS
.TP
list \fIratio1\fR
The first rational function operand or a scalar
.TP
list \fIratio2\fR
The second rational function operand or a scalar
.RE
.sp
.TP
\fB::math::rationalfunctions::divRatio\fR \fIratio1\fR \fIratio2\fR
Divide the first rational function by the second rational function and
return the result. The remainder is dropped
.RS
.TP
list \fIratio1\fR
The first rational function operand
.TP
list \fIratio2\fR
The second rational function operand
.RE
.sp
.TP
\fB::math::rationalfunctions::derivPolyn\fR \fIratio\fR
Differentiate the rational function and return the result.
.RS
.TP
list \fIratio\fR
The rational function to be differentiated
.RE
.sp
.TP
\fB::math::rationalfunctions::coeffsNumerator\fR \fIratio\fR
Return the coefficients of the numerator of the rational function.
.RS
.TP
list \fIratio\fR
The rational function to be examined
.RE
.sp
.TP
\fB::math::rationalfunctions::coeffsDenominator\fR \fIratio\fR
Return the coefficients of the denominator of the rational
function.
.RS
.TP
list \fIratio\fR
The rational function to be examined
.RE
.sp
.PP
.SH "REMARKS ON THE IMPLEMENTATION"
The implementation of the rational functions relies on the
math::polynomials package. For further remarks see the documentation on
that package.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: rationalfunctions\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
math, rational functions
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2005 Arjen Markus <[email protected]>

.fi

Added embedded/man/files/modules/math/roman.n.



















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/roman.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Kenneth Green <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::roman"  1.0 tcllib "Tcl Math Library"
.BS
.SH NAME
math::roman \- Tools for creating and manipulating roman numerals
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBmath::roman  ?1.0?\fR
.sp
\fB::math::roman::toroman\fR \fIi\fR
.sp
\fB::math::roman::tointeger\fR \fIr\fR
.sp
\fB::math::roman::sort\fR \fIlist\fR
.sp
\fB::math::roman::expr\fR \fIargs\fR
.sp
.BE
.SH DESCRIPTION
.PP
\fB::math::roman\fR is a pure-Tcl library for converting between integers
and roman numerals. It also provides utility functions for sorting and performing
arithmetic on roman numerals.
.PP
This code was originally harvested from the Tcler's wiki at
http://wiki.tcl.tk/1823 and as such is free for any use for
any purpose. Many thanks to the ingeneous folk who devised
these clever routines and generously contributed them to the
Tcl community.
.PP
While written and tested under Tcl 8.3, I expect this library
will work under all 8.x versions of Tcl.
.SH COMMANDS
.TP
\fB::math::roman::toroman\fR \fIi\fR
Convert an integer to roman numerals. The result is always in
upper case. The value zero is converted to an empty string.
.TP
\fB::math::roman::tointeger\fR \fIr\fR
Convert a roman numeral into an integer.
.TP
\fB::math::roman::sort\fR \fIlist\fR
Sort a list of roman numerals from smallest to largest.
.TP
\fB::math::roman::expr\fR \fIargs\fR
Evaluate an expression where the operands are all roman numerals.
.PP
Of these commands both \fItoroman\fR and \fItointeger\fR are exported
for easier use. The other two are not, as they could interfer or be
confused with existing Tcl commands.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: roman\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
conversion, integer, roman numeral
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2005 Kenneth Green <[email protected]>

.fi

Added embedded/man/files/modules/math/romberg.n.









































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/romberg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Kevin B. Kenny <[email protected]>. All rights reserved. Redistribution permitted under the terms of the Open Publication License <http://www.opencontent.org/openpub/>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::calculus::romberg" n 0.6 tcllib "Tcl Math Library"
.BS
.SH NAME
math::calculus::romberg \- Romberg integration
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBmath::calculus  0.6\fR
.sp
\fB::math::calculus::romberg\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
.sp
\fB::math::calculus::romberg_infinity\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
.sp
\fB::math::calculus::romberg_sqrtSingLower\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
.sp
\fB::math::calculus::romberg_sqrtSingUpper\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
.sp
\fB::math::calculus::romberg_powerLawLower\fR \fIgamma\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
.sp
\fB::math::calculus::romberg_powerLawUpper\fR \fIgamma\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
.sp
\fB::math::calculus::romberg_expLower\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
.sp
\fB::math::calculus::romberg_expUpper\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBromberg\fR procedures in the \fBmath::calculus\fR package
perform numerical integration of a function of one variable.  They
are intended to be of "production quality" in that they are robust,
precise, and reasonably efficient in terms of the number of function
evaluations.
.SH PROCEDURES
The following procedures are available for Romberg integration:
.TP
\fB::math::calculus::romberg\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
Integrates an analytic function over a given interval.
.TP
\fB::math::calculus::romberg_infinity\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
Integrates an analytic function over a half-infinite interval.
.TP
\fB::math::calculus::romberg_sqrtSingLower\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
Integrates a function that is expected to be analytic over an interval
except for the presence of an inverse square root singularity at the
lower limit.
.TP
\fB::math::calculus::romberg_sqrtSingUpper\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
Integrates a function that is expected to be analytic over an interval
except for the presence of an inverse square root singularity at the
upper limit.
.TP
\fB::math::calculus::romberg_powerLawLower\fR \fIgamma\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
Integrates a function that is expected to be analytic over an interval
except for the presence of a power law singularity at the
lower limit.
.TP
\fB::math::calculus::romberg_powerLawUpper\fR \fIgamma\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
Integrates a function that is expected to be analytic over an interval
except for the presence of a power law singularity at the
upper limit.
.TP
\fB::math::calculus::romberg_expLower\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
Integrates an exponentially growing function; the lower limit of the
region of integration may be arbitrarily large and negative.
.TP
\fB::math::calculus::romberg_expUpper\fR \fIf\fR \fIa\fR \fIb\fR ?\fI-option value\fR...?
Integrates an exponentially decaying function; the upper limit of the
region of integration may be arbitrarily large.
.PP
.SH PARAMETERS
.TP
\fIf\fR
Function to integrate.  Must be expressed as a single Tcl command,
to which will be appended a single argument, specifically, the
abscissa at which the function is to be evaluated. The first word
of the command will be processed with \fBnamespace which\fR in the
caller's scope prior to any evaluation. Given this processing, the
command may local to the calling namespace rather than needing to be
global.
.TP
\fIa\fR
Lower limit of the region of integration.
.TP
\fIb\fR
Upper limit of the region of integration.  For the
\fBromberg_sqrtSingLower\fR, \fBromberg_sqrtSingUpper\fR,
\fBromberg_powerLawLower\fR, \fBromberg_powerLawUpper\fR,
\fBromberg_expLower\fR, and \fBromberg_expUpper\fR procedures,
the lower limit must be strictly less than the upper.  For
the other procedures, the limits may appear in either order.
.TP
\fIgamma\fR
Power to use for a power law singularity; see section
\fBIMPROPER INTEGRALS\fR for details.
.PP
.SH OPTIONS
.TP
\fB-abserror\fR \fIepsilon\fR
Requests that the integration machinery proceed at most until
the estimated absolute error of the integral is less than
\fIepsilon\fR. The error may be seriously over- or underestimated
if the function (or any of its derivatives) contains singularities;
see section \fBIMPROPER INTEGRALS\fR for details. Default
is 1.0e-08.
.TP
\fB-relerror\fR \fIepsilon\fR
Requests that the integration machinery proceed at most until
the estimated relative error of the integral is less than
\fIepsilon\fR. The error may be seriously over- or underestimated
if the function (or any of its derivatives) contains singularities;
see section \fBIMPROPER INTEGRALS\fR for details.  Default is
1.0e-06.
.TP
\fB-maxiter\fR \fIm\fR
Requests that integration terminate after at most \fIn\fR triplings of
the number of evaluations performed.  In other words, given \fIn\fR
for \fB-maxiter\fR, the integration machinery will make at most
3**\fIn\fR evaluations of the function.  Default is 14, corresponding
to a limit approximately 4.8 million evaluations. (Well-behaved
functions will seldom require more than a few hundred evaluations.)
.TP
\fB-degree\fR \fId\fR
Requests that an extrapolating polynomial of degree \fId\fR be used
in Romberg integration; see section \fBDESCRIPTION\fR for
details. Default is 4.  Can be at most \fIm\fR-1.
.PP
.SH DESCRIPTION
The \fBromberg\fR procedure performs Romberg integration using
the modified midpoint rule. Romberg integration is an iterative
process.  At the first step, the function is evaluated at the
midpoint of the region of integration, and the value is multiplied by
the width of the interval for the coarsest possible estimate.
At the second step, the interval is divided into three parts,
and the function is evaluated at the midpoint of each part; the
sum of the values is multiplied by three.  At the third step,
nine parts are used, at the fourth twenty-seven, and so on,
tripling the number of subdivisions at each step.
.PP
Once the interval has been divided at least \fId\fR times,
a polynomial is fitted to the integrals estimated in the last
\fId\fR+1 divisions.  The integrals are considered to be a
function of the square of the width of the subintervals
(any good numerical analysis text will discuss this process
under "Romberg integration").  The polynomial is extrapolated
to a step size of zero, computing a value for the integral and
an estimate of the error.
.PP
This process will be well-behaved only if the function is analytic
over the region of integration; there may be removable singularities
at either end of the region provided that the limit of the function
(and of all its derivatives) exists as the ends are approached.
Thus, \fBromberg\fR may be used to integrate a function like
f(x)=sin(x)/x over an interval beginning or ending at zero.
.PP
Note that \fBromberg\fR will either fail to converge or else return
incorrect error estimates if the function, or any of its derivatives,
has a singularity anywhere in the region of integration (except for
the case mentioned above).  Care must be used, therefore, in
integrating a function like 1/(1-x**2) to avoid the places
where the derivative is singular.
.SH "IMPROPER INTEGRALS"
Romberg integration is also useful for integrating functions over
half-infinite intervals or functions that have singularities.
The trick is to make a change of variable to eliminate the
singularity, and to put the singularity at one end or the other
of the region of integration.  The \fBmath::calculus\fR package
supplies a number of \fBromberg\fR procedures to deal with the
commoner cases.
.TP
\fBromberg_infinity\fR
Integrates a function over a half-infinite interval; either
\fIa\fR or \fIb\fR may be infinite.  \fIa\fR and \fIb\fR must be
of the same sign; if you need to integrate across the axis,
say, from a negative value to positive infinity,
use \fBromberg\fR to integrate from the negative
value to a small positive value, and then \fBromberg_infinity\fR
to integrate from the positive value to positive infinity.  The
\fBromberg_infinity\fR procedure works by making the change of
variable u=1/x, so that the integral from a to b of f(x) is
evaluated as the integral from 1/a to 1/b of f(1/u)/u**2.
.TP
\fBromberg_powerLawLower\fR and \fBromberg_powerLawUpper\fR
Integrate a function that has an integrable power law singularity
at either the lower or upper bound of the region of integration
(or has a derivative with a power law singularity there).
These procedures take a first parameter, \fIgamma\fR, which gives
the power law.  The function or its first derivative are presumed to diverge as
(x-\fIa\fR)**(-\fIgamma\fR) or (\fIb\fR-x)**(-\fIgamma\fR).  \fIgamma\fR
must be greater than zero and less than 1.
.sp
These procedures are useful not only in integrating functions
that go to infinity at one end of the region of integration, but
also functions whose derivatives do not exist at the end of
the region.  For instance, integrating f(x)=pow(x,0.25) with the
origin as one end of the region will result in the \fBromberg\fR
procedure greatly underestimating the error in the integral.
The problem can be fixed by observing that the first derivative
of f(x), f'(x)=x**(-3/4)/4, goes to infinity at the origin.  Integrating
using \fBromberg_powerLawLower\fR with \fIgamma\fR set to 0.75
gives much more orderly convergence.
.sp
These procedures operate by making the change of variable
u=(x-a)**(1-gamma) (\fBromberg_powerLawLower\fR) or
u=(b-x)**(1-gamma) (\fBromberg_powerLawUpper\fR).
.sp
To summarize the meaning of gamma:
.RS
.IP \(bu
If f(x) ~ x**(-a) (0 < a < 1), use gamma = a
.IP \(bu
If f'(x) ~ x**(-b) (0 < b < 1), use gamma = b
.RE
.TP
\fBromberg_sqrtSingLower\fR and \fBromberg_sqrtSingUpper\fR
These procedures behave identically to \fBromberg_powerLawLower\fR and
\fBromberg_powerLawUpper\fR for the common case of \fIgamma\fR=0.5;
that is, they integrate a function with an inverse square root
singularity at one end of the interval.  They have a simpler
implementation involving square roots rather than arbitrary powers.
.TP
\fBromberg_expLower\fR and \fBromberg_expUpper\fR
These procedures are for integrating a function that grows or
decreases exponentially over a half-infinite interval.
\fBromberg_expLower\fR handles exponentially growing functions, and
allows the lower limit of integration to be an arbitrarily large
negative number.  \fBromberg_expUpper\fR handles exponentially
decaying functions and allows the upper limit of integration to
be an arbitrary large positive number.  The functions make the
change of variable u=exp(-x) and u=exp(x) respectively.
.PP
.SH "OTHER CHANGES OF VARIABLE"
If you need an improper integral other than the ones listed here,
a change of variable can be written in very few lines of Tcl.
Because the Tcl coding that does it is somewhat arcane,
we offer a worked example here.
.PP
Let's say that the function that we want to integrate is
f(x)=exp(x)/sqrt(1-x*x) (not a very natural
function, but a good example), and we want to integrate
it over the interval (-1,1).  The denominator falls to zero
at both ends of the interval. We wish to make a change of variable
from x to u
so that dx/sqrt(1-x**2) maps to du.  Choosing x=sin(u), we can
find that dx=cos(u)*du, and sqrt(1-x**2)=cos(u).  The integral
from a to b of f(x) is the integral from asin(a) to asin(b)
of f(sin(u))*cos(u).
.PP
We can make a function \fBg\fR that accepts an arbitrary function
\fBf\fR and the parameter u, and computes this new integrand.
.CS


proc g { f u } {
    set x [expr { sin($u) }]
    set cmd $f; lappend cmd $x; set y [eval $cmd]
    return [expr { $y / cos($u) }]
}

.CE
Now integrating \fBf\fR from \fIa\fR to \fIb\fR is the same
as integrating \fBg\fR from \fIasin(a)\fR to \fIasin(b)\fR.
It's a little tricky to get \fBf\fR consistently evaluated in
the caller's scope; the following procedure does it.
.CS


proc romberg_sine { f a b args } {
    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
    set f [list g $f]
    return [eval [linsert $args 0 romberg $f [expr { asin($a) }] [expr { asin($b) }]]]
}

.CE
This \fBromberg_sine\fR procedure will do any function with
sqrt(1-x*x) in the denominator. Our sample function is
f(x)=exp(x)/sqrt(1-x*x):
.CS


proc f { x } {
    expr { exp($x) / sqrt( 1. - $x*$x ) }
}

.CE
Integrating it is a matter of applying \fBromberg_sine\fR
as we would any of the other \fBromberg\fR procedures:
.CS


foreach { value error } [romberg_sine f -1.0 1.0] break
puts [format "integral is %.6g +/- %.6g" $value $error]

integral is 3.97746 +/- 2.3557e-010

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: calculus\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
math::calculus, math::interpolate
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Kevin B. Kenny <[email protected]>. All rights reserved. Redistribution permitted under the terms of the Open Publication License <http://www.opencontent.org/openpub/>

.fi

Added embedded/man/files/modules/math/special.n.







































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/special.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Arjen Markus <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::special" n 0.2 tcllib "Tcl Math Library"
.BS
.SH NAME
math::special \- Special mathematical functions
.SH SYNOPSIS
package require \fBTcl  ?8.3?\fR
.sp
package require \fBmath::special  ?0.2?\fR
.sp
\fB::math::special::Beta\fR \fIx\fR \fIy\fR
.sp
\fB::math::special::Gamma\fR \fIx\fR \fIy\fR
.sp
\fB::math::special::erf\fR \fIx\fR
.sp
\fB::math::special::erfc\fR \fIx\fR
.sp
\fB::math::special::J0\fR \fIx\fR
.sp
\fB::math::special::J1\fR \fIx\fR
.sp
\fB::math::special::Jn\fR \fIn\fR \fIx\fR
.sp
\fB::math::special::J1/2\fR \fIx\fR
.sp
\fB::math::special::J-1/2\fR \fIx\fR
.sp
\fB::math::special::I_n\fR \fIx\fR
.sp
\fB::math::special::cn\fR \fIu\fR \fIk\fR
.sp
\fB::math::special::dn\fR \fIu\fR \fIk\fR
.sp
\fB::math::special::sn\fR \fIu\fR \fIk\fR
.sp
\fB::math::special::elliptic_K\fR \fIk\fR
.sp
\fB::math::special::elliptic_E\fR \fIk\fR
.sp
\fB::math::special::exponential_Ei\fR \fIx\fR
.sp
\fB::math::special::exponential_En\fR \fIn\fR \fIx\fR
.sp
\fB::math::special::exponential_li\fR \fIx\fR
.sp
\fB::math::special::exponential_Ci\fR \fIx\fR
.sp
\fB::math::special::exponential_Si\fR \fIx\fR
.sp
\fB::math::special::exponential_Chi\fR \fIx\fR
.sp
\fB::math::special::exponential_Shi\fR \fIx\fR
.sp
\fB::math::special::fresnel_C\fR \fIx\fR
.sp
\fB::math::special::fresnel_S\fR \fIx\fR
.sp
\fB::math::special::sinc\fR \fIx\fR
.sp
\fB::math::special::legendre\fR \fIn\fR
.sp
\fB::math::special::chebyshev\fR \fIn\fR
.sp
\fB::math::special::laguerre\fR \fIalpha\fR \fIn\fR
.sp
\fB::math::special::hermite\fR \fIn\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package implements several so-called special functions, like
the Gamma function, the Bessel functions and such.
.PP
Each function is implemented by a procedure that bears its name (well,
in close approximation):
.IP \(bu
J0 for the zeroth-order Bessel function of the first kind
.IP \(bu
J1 for the first-order Bessel function of the first kind
.IP \(bu
Jn for the nth-order Bessel function of the first kind
.IP \(bu
J1/2 for the half-order Bessel function of the first kind
.IP \(bu
J-1/2 for the minus-half-order Bessel function of the first kind
.IP \(bu
I_n for the modified Bessel function of the first kind of order n
.IP \(bu
Gamma for the Gamma function, erf and erfc for the error function and
the complementary error function
.IP \(bu
fresnel_C and fresnel_S for the Fresnel integrals
.IP \(bu
elliptic_K and elliptic_E (complete elliptic integrals)
.IP \(bu
exponent_Ei and other functions related to the so-called exponential
integrals
.IP \(bu
legendre, hermite: some of the classical orthogonal polynomials.
.PP
.SH OVERVIEW
In the following table several characteristics of the functions in this
package are summarized: the domain for the argument, the values for the
parameters and error bounds.
.CS


Family       | Function    | Domain x    | Parameter   | Error bound
-------------+-------------+-------------+-------------+--------------
Bessel       | J0, J1,     | all of R    | n = integer |   < 1.0e-8
             | Jn          |             |             |  (|x|<20, n<20)
Bessel       | J1/2, J-1/2,|  x > 0      | n = integer |   exact
Bessel       | I_n         | all of R    | n = integer |   < 1.0e-6
             |             |             |             |
Elliptic     | cn          | 0 <= x <= 1 |     --      |   < 1.0e-10
functions    | dn          | 0 <= x <= 1 |     --      |   < 1.0e-10
             | sn          | 0 <= x <= 1 |     --      |   < 1.0e-10
Elliptic     | K           | 0 <= x < 1  |     --      |   < 1.0e-6
integrals    | E           | 0 <= x < 1  |     --      |   < 1.0e-6
             |             |             |             |
Error        | erf         |             |     --      |
functions    | erfc        |             |             |
             | ierfc_n     |             |             |
             |             |             |             |
Exponential  | Ei          |  x != 0     |     --      |   < 1.0e-10 (relative)
integrals    | En          |  x >  0     |     --      |   as Ei
             | li          |  x > 0      |     --      |   as Ei
             | Chi         |  x > 0      |     --      |   < 1.0e-8
             | Shi         |  x > 0      |     --      |   < 1.0e-8
             | Ci          |  x > 0      |     --      |   < 2.0e-4
             | Si          |  x > 0      |     --      |   < 2.0e-4
             |             |             |             |
Fresnel      | C           |  all of R   |     --      |   < 2.0e-3
integrals    | S           |  all of R   |     --      |   < 2.0e-3
             |             |             |             |
general      | Beta        | (see Gamma) |     --      |   < 1.0e-9
             | Gamma       |  x != 0,-1, |     --      |   < 1.0e-9
             |             |  -2, ...    |             |
             | sinc        |  all of R   |     --      |   exact
             |             |             |             |
orthogonal   | Legendre    |  all of R   | n = 0,1,... |   exact
polynomials  | Chebyshev   |  all of R   | n = 0,1,... |   exact
             | Laguerre    |  all of R   | n = 0,1,... |   exact
             |             |             | alpha el. R |
             | Hermite     |  all of R   | n = 0,1,... |   exact

.CE
\fINote:\fR Some of the error bounds are estimated, as no
"formal" bounds were available with the implemented approximation
method, others hold for the auxiliary functions used for estimating
the primary functions.
.PP
The following well-known functions are currently missing from the package:
.IP \(bu
Bessel functions of the second kind (Y_n, K_n)
.IP \(bu
Bessel functions of arbitrary order (and hence the Airy functions)
.IP \(bu
Chebyshev polynomials of the second kind (U_n)
.IP \(bu
The digamma function (psi)
.IP \(bu
The incomplete gamma and beta functions
.PP
.SH PROCEDURES
The package defines the following public procedures:
.TP
\fB::math::special::Beta\fR \fIx\fR \fIy\fR
Compute the Beta function for arguments "x" and "y"
.RS
.TP
float \fIx\fR
First argument for the Beta function
.TP
float \fIy\fR
Second argument for the Beta function
.RE
.sp
.TP
\fB::math::special::Gamma\fR \fIx\fR \fIy\fR
Compute the Gamma function for argument "x"
.RS
.TP
float \fIx\fR
Argument for the Gamma function
.RE
.sp
.TP
\fB::math::special::erf\fR \fIx\fR
Compute the error function for argument "x"
.RS
.TP
float \fIx\fR
Argument for the error function
.RE
.sp
.TP
\fB::math::special::erfc\fR \fIx\fR
Compute the complementary error function for argument "x"
.RS
.TP
float \fIx\fR
Argument for the complementary error function
.RE
.sp
.TP
\fB::math::special::J0\fR \fIx\fR
Compute the zeroth-order Bessel function of the first kind for the
argument "x"
.RS
.TP
float \fIx\fR
Argument for the Bessel function
.RE
.TP
\fB::math::special::J1\fR \fIx\fR
Compute the first-order Bessel function of the first kind for the
argument "x"
.RS
.TP
float \fIx\fR
Argument for the Bessel function
.RE
.TP
\fB::math::special::Jn\fR \fIn\fR \fIx\fR
Compute the nth-order Bessel function of the first kind for the
argument "x"
.RS
.TP
integer \fIn\fR
Order of the Bessel function
.TP
float \fIx\fR
Argument for the Bessel function
.RE
.TP
\fB::math::special::J1/2\fR \fIx\fR
Compute the half-order Bessel function of the first kind for the
argument "x"
.RS
.TP
float \fIx\fR
Argument for the Bessel function
.RE
.TP
\fB::math::special::J-1/2\fR \fIx\fR
Compute the minus-half-order Bessel function of the first kind for the
argument "x"
.RS
.TP
float \fIx\fR
Argument for the Bessel function
.RE
.TP
\fB::math::special::I_n\fR \fIx\fR
Compute the modified Bessel function of the first kind of order n for
the argument "x"
.RS
.TP
int \fIx\fR
Positive integer order of the function
.TP
float \fIx\fR
Argument for the function
.RE
.TP
\fB::math::special::cn\fR \fIu\fR \fIk\fR
Compute the elliptic function \fIcn\fR for the argument "u" and
parameter "k".
.RS
.TP
float \fIu\fR
Argument for the function
.TP
float \fIk\fR
Parameter
.RE
.TP
\fB::math::special::dn\fR \fIu\fR \fIk\fR
Compute the elliptic function \fIdn\fR for the argument "u" and
parameter "k".
.RS
.TP
float \fIu\fR
Argument for the function
.TP
float \fIk\fR
Parameter
.RE
.TP
\fB::math::special::sn\fR \fIu\fR \fIk\fR
Compute the elliptic function \fIsn\fR for the argument "u" and
parameter "k".
.RS
.TP
float \fIu\fR
Argument for the function
.TP
float \fIk\fR
Parameter
.RE
.TP
\fB::math::special::elliptic_K\fR \fIk\fR
Compute the complete elliptic integral of the first kind
for the argument "k"
.RS
.TP
float \fIk\fR
Argument for the function
.RE
.TP
\fB::math::special::elliptic_E\fR \fIk\fR
Compute the complete elliptic integral of the second kind
for the argument "k"
.RS
.TP
float \fIk\fR
Argument for the function
.RE
.TP
\fB::math::special::exponential_Ei\fR \fIx\fR
Compute the exponential integral of the second kind
for the argument "x"
.RS
.TP
float \fIx\fR
Argument for the function (x != 0)
.RE
.TP
\fB::math::special::exponential_En\fR \fIn\fR \fIx\fR
Compute the exponential integral of the first kind
for the argument "x" and order n
.RS
.TP
int \fIn\fR
Order of the integral (n >= 0)
.TP
float \fIx\fR
Argument for the function (x >= 0)
.RE
.TP
\fB::math::special::exponential_li\fR \fIx\fR
Compute the logarithmic integral for the argument "x"
.RS
.TP
float \fIx\fR
Argument for the function (x > 0)
.RE
.TP
\fB::math::special::exponential_Ci\fR \fIx\fR
Compute the cosine integral for the argument "x"
.RS
.TP
float \fIx\fR
Argument for the function (x > 0)
.RE
.TP
\fB::math::special::exponential_Si\fR \fIx\fR
Compute the sine integral for the argument "x"
.RS
.TP
float \fIx\fR
Argument for the function (x > 0)
.RE
.TP
\fB::math::special::exponential_Chi\fR \fIx\fR
Compute the hyperbolic cosine integral for the argument "x"
.RS
.TP
float \fIx\fR
Argument for the function (x > 0)
.RE
.TP
\fB::math::special::exponential_Shi\fR \fIx\fR
Compute the hyperbolic sine integral for the argument "x"
.RS
.TP
float \fIx\fR
Argument for the function (x > 0)
.RE
.TP
\fB::math::special::fresnel_C\fR \fIx\fR
Compute the Fresnel cosine integral for real argument x
.RS
.TP
float \fIx\fR
Argument for the function
.RE
.TP
\fB::math::special::fresnel_S\fR \fIx\fR
Compute the Fresnel sine integral for real argument x
.RS
.TP
float \fIx\fR
Argument for the function
.RE
.TP
\fB::math::special::sinc\fR \fIx\fR
Compute the sinc function for real argument x
.RS
.TP
float \fIx\fR
Argument for the function
.RE
.TP
\fB::math::special::legendre\fR \fIn\fR
Return the Legendre polynomial of degree n
(see \fBTHE ORTHOGONAL POLYNOMIALS\fR)
.RS
.TP
int \fIn\fR
Degree of the polynomial
.RE
.sp
.TP
\fB::math::special::chebyshev\fR \fIn\fR
Return the Chebyshev polynomial of degree n (of the first kind)
.RS
.TP
int \fIn\fR
Degree of the polynomial
.RE
.sp
.TP
\fB::math::special::laguerre\fR \fIalpha\fR \fIn\fR
Return the Laguerre polynomial of degree n with parameter alpha
.RS
.TP
float \fIalpha\fR
Parameter of the Laguerre polynomial
.TP
int \fIn\fR
Degree of the polynomial
.RE
.sp
.TP
\fB::math::special::hermite\fR \fIn\fR
Return the Hermite polynomial of degree n
.RS
.TP
int \fIn\fR
Degree of the polynomial
.RE
.sp
.PP
.SH "THE ORTHOGONAL POLYNOMIALS"
For dealing with the classical families of orthogonal polynomials, the
package relies on the \fImath::polynomials\fR package. To evaluate the
polynomial at some coordinate, use the \fIevalPolyn\fR command:
.CS


   set leg2 [::math::special::legendre 2]
   puts "Value at x=$x: [::math::polynomials::evalPolyn $leg2 $x]"

.CE
.PP
The return value from the \fIlegendre\fR and other commands is actually
the definition of the corresponding polynomial as used in that package.
.SH "REMARKS ON THE IMPLEMENTATION"
It should be noted, that the actual implementation of J0 and J1 depends
on straightforward Gaussian quadrature formulas. The (absolute) accuracy
of the results is of the order 1.0e-4 or better. The main reason to
implement them like that was that it was fast to do (the formulas are
simple) and the computations are fast too.
.PP
The implementation of J1/2 does not suffer from this: this function can
be expressed exactly in terms of elementary functions.
.PP
The functions J0 and J1 are the ones you will encounter most frequently
in practice.
.PP
The computation of I_n is based on Miller's algorithm for computing the
minimal function from recurrence relations.
.PP
The computation of the Gamma and Beta functions relies on the
combinatorics package, whereas that of the error functions relies on the
statistics package.
.PP
The computation of the complete elliptic integrals uses the AGM
algorithm.
.PP
Much information about these functions can be found in:
.PP
Abramowitz and Stegun: \fIHandbook of Mathematical Functions\fR
(Dover, ISBN 486-61272-4)
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: special\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
Bessel functions, error function, math, special functions
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Arjen Markus <[email protected]>

.fi

Added embedded/man/files/modules/math/statistics.n.








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/statistics.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::statistics" n 0.8 tcllib "Tcl Math Library"
.BS
.SH NAME
math::statistics \- Basic statistical functions and procedures
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBmath::statistics  0.8\fR
.sp
\fB::math::statistics::mean\fR \fIdata\fR
.sp
\fB::math::statistics::min\fR \fIdata\fR
.sp
\fB::math::statistics::max\fR \fIdata\fR
.sp
\fB::math::statistics::number\fR \fIdata\fR
.sp
\fB::math::statistics::stdev\fR \fIdata\fR
.sp
\fB::math::statistics::var\fR \fIdata\fR
.sp
\fB::math::statistics::pstdev\fR \fIdata\fR
.sp
\fB::math::statistics::pvar\fR \fIdata\fR
.sp
\fB::math::statistics::median\fR \fIdata\fR
.sp
\fB::math::statistics::basic-stats\fR \fIdata\fR
.sp
\fB::math::statistics::histogram\fR \fIlimits\fR \fIvalues\fR
.sp
\fB::math::statistics::corr\fR \fIdata1\fR \fIdata2\fR
.sp
\fB::math::statistics::interval-mean-stdev\fR \fIdata\fR \fIconfidence\fR
.sp
\fB::math::statistics::t-test-mean\fR \fIdata\fR \fIest_mean\fR \fIest_stdev\fR \fIconfidence\fR
.sp
\fB::math::statistics::test-normal\fR \fIdata\fR \fIconfidence\fR
.sp
\fB::math::statistics::lillieforsFit\fR \fIdata\fR
.sp
\fB::math::statistics::quantiles\fR \fIdata\fR \fIconfidence\fR
.sp
\fB::math::statistics::quantiles\fR \fIlimits\fR \fIcounts\fR \fIconfidence\fR
.sp
\fB::math::statistics::autocorr\fR \fIdata\fR
.sp
\fB::math::statistics::crosscorr\fR \fIdata1\fR \fIdata2\fR
.sp
\fB::math::statistics::mean-histogram-limits\fR \fImean\fR \fIstdev\fR \fInumber\fR
.sp
\fB::math::statistics::minmax-histogram-limits\fR \fImin\fR \fImax\fR \fInumber\fR
.sp
\fB::math::statistics::linear-model\fR \fIxdata\fR \fIydata\fR \fIintercept\fR
.sp
\fB::math::statistics::linear-residuals\fR \fIxdata\fR \fIydata\fR \fIintercept\fR
.sp
\fB::math::statistics::test-2x2\fR \fIn11\fR \fIn21\fR \fIn12\fR \fIn22\fR
.sp
\fB::math::statistics::print-2x2\fR \fIn11\fR \fIn21\fR \fIn12\fR \fIn22\fR
.sp
\fB::math::statistics::control-xbar\fR \fIdata\fR ?nsamples?
.sp
\fB::math::statistics::control-Rchart\fR \fIdata\fR ?nsamples?
.sp
\fB::math::statistics::test-xbar\fR \fIcontrol\fR \fIdata\fR
.sp
\fB::math::statistics::test-Rchart\fR \fIcontrol\fR \fIdata\fR
.sp
\fB::math::statistics::tstat\fR \fIdof\fR ?alpha?
.sp
\fB::math::statistics::mv-wls\fR \fIwt1\fR \fIweights_and_values\fR
.sp
\fB::math::statistics::mv-ols\fR \fIvalues\fR
.sp
\fB::math::statistics::pdf-normal\fR \fImean\fR \fIstdev\fR \fIvalue\fR
.sp
\fB::math::statistics::pdf-exponential\fR \fImean\fR \fIvalue\fR
.sp
\fB::math::statistics::pdf-uniform\fR \fIxmin\fR \fIxmax\fR \fIvalue\fR
.sp
\fB::math::statistics::pdf-gamma\fR \fIalpha\fR \fIbeta\fR \fIvalue\fR
.sp
\fB::math::statistics::pdf-poisson\fR \fImu\fR \fIk\fR
.sp
\fB::math::statistics::pdf-chisquare\fR \fIdf\fR \fIvalue\fR
.sp
\fB::math::statistics::pdf-student-t\fR \fIdf\fR \fIvalue\fR
.sp
\fB::math::statistics::pdf-beta\fR \fIa\fR \fIb\fR \fIvalue\fR
.sp
\fB::math::statistics::cdf-normal\fR \fImean\fR \fIstdev\fR \fIvalue\fR
.sp
\fB::math::statistics::cdf-exponential\fR \fImean\fR \fIvalue\fR
.sp
\fB::math::statistics::cdf-uniform\fR \fIxmin\fR \fIxmax\fR \fIvalue\fR
.sp
\fB::math::statistics::cdf-students-t\fR \fIdegrees\fR \fIvalue\fR
.sp
\fB::math::statistics::cdf-gamma\fR \fIalpha\fR \fIbeta\fR \fIvalue\fR
.sp
\fB::math::statistics::cdf-poisson\fR \fImu\fR \fIk\fR
.sp
\fB::math::statistics::cdf-beta\fR \fIa\fR \fIb\fR \fIvalue\fR
.sp
\fB::math::statistics::random-normal\fR \fImean\fR \fIstdev\fR \fInumber\fR
.sp
\fB::math::statistics::random-exponential\fR \fImean\fR \fInumber\fR
.sp
\fB::math::statistics::random-uniform\fR \fIxmin\fR \fIxmax\fR \fInumber\fR
.sp
\fB::math::statistics::random-gamma\fR \fIalpha\fR \fIbeta\fR \fInumber\fR
.sp
\fB::math::statistics::random-chisquare\fR \fIdf\fR \fInumber\fR
.sp
\fB::math::statistics::random-student-t\fR \fIdf\fR \fInumber\fR
.sp
\fB::math::statistics::random-beta\fR \fIa\fR \fIb\fR \fInumber\fR
.sp
\fB::math::statistics::histogram-uniform\fR \fIxmin\fR \fIxmax\fR \fIlimits\fR \fInumber\fR
.sp
\fB::math::statistics::incompleteGamma\fR \fIx\fR \fIp\fR ?tol?
.sp
\fB::math::statistics::incompleteBeta\fR \fIa\fR \fIb\fR \fIx\fR ?tol?
.sp
\fB::math::statistics::filter\fR \fIvarname\fR \fIdata\fR \fIexpression\fR
.sp
\fB::math::statistics::map\fR \fIvarname\fR \fIdata\fR \fIexpression\fR
.sp
\fB::math::statistics::samplescount\fR \fIvarname\fR \fIlist\fR \fIexpression\fR
.sp
\fB::math::statistics::subdivide\fR
.sp
\fB::math::statistics::test-Kruskal-Wallis\fR \fIconfidence\fR \fIargs\fR
.sp
\fB::math::statistics::analyse-Kruskal-Wallis\fR \fIargs\fR
.sp
\fB::math::statistics::group-rank\fR \fIargs\fR
.sp
\fB::math::statistics::test-Wilcoxon\fR \fIsample_a\fR \fIsample_b\fR
.sp
\fB::math::statistics::spearman-rank\fR \fIsample_a\fR \fIsample_b\fR
.sp
\fB::math::statistics::spearman-rank-extended\fR \fIsample_a\fR \fIsample_b\fR
.sp
\fB::math::statistics::plot-scale\fR \fIcanvas\fR \fIxmin\fR \fIxmax\fR \fIymin\fR \fIymax\fR
.sp
\fB::math::statistics::plot-xydata\fR \fIcanvas\fR \fIxdata\fR \fIydata\fR \fItag\fR
.sp
\fB::math::statistics::plot-xyline\fR \fIcanvas\fR \fIxdata\fR \fIydata\fR \fItag\fR
.sp
\fB::math::statistics::plot-tdata\fR \fIcanvas\fR \fItdata\fR \fItag\fR
.sp
\fB::math::statistics::plot-tline\fR \fIcanvas\fR \fItdata\fR \fItag\fR
.sp
\fB::math::statistics::plot-histogram\fR \fIcanvas\fR \fIcounts\fR \fIlimits\fR \fItag\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBmath::statistics\fR package contains functions and procedures for
basic statistical data analysis, such as:
.IP \(bu
Descriptive statistical parameters (mean, minimum, maximum, standard
deviation)
.IP \(bu
Estimates of the distribution in the form of histograms and quantiles
.IP \(bu
Basic testing of hypotheses
.IP \(bu
Probability and cumulative density functions
.PP
It is meant to help in developing data analysis applications or doing
ad hoc data analysis, it is not in itself a full application, nor is it
intended to rival with full (non-)commercial statistical packages.
.PP
The purpose of this document is to describe the implemented procedures
and provide some examples of their usage. As there is ample literature
on the algorithms involved, we refer to relevant text books for more
explanations.
The package contains a fairly large number of public procedures. They
can be distinguished in three sets: general procedures, procedures
that deal with specific statistical distributions, list procedures to
select or transform data and simple plotting procedures (these require
Tk).
\fINote:\fR The data that need to be analyzed are always contained in a
simple list. Missing values are represented as empty list elements.
.SH "GENERAL PROCEDURES"
The general statistical procedures are:
.TP
\fB::math::statistics::mean\fR \fIdata\fR
Determine the \fImean\fR value of the given list of data.
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::min\fR \fIdata\fR
Determine the \fIminimum\fR value of the given list of data.
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::max\fR \fIdata\fR
Determine the \fImaximum\fR value of the given list of data.
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::number\fR \fIdata\fR
Determine the \fInumber\fR of non-missing data in the given list
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::stdev\fR \fIdata\fR
Determine the \fIsample standard deviation\fR of the data in the
given list
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::var\fR \fIdata\fR
Determine the \fIsample variance\fR of the data in the given list
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::pstdev\fR \fIdata\fR
Determine the \fIpopulation standard deviation\fR of the data
in the given list
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::pvar\fR \fIdata\fR
Determine the \fIpopulation variance\fR of the data in the
given list
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::median\fR \fIdata\fR
Determine the \fImedian\fR of the data in the given list
(Note that this requires sorting the data, which may be a
costly operation)
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::basic-stats\fR \fIdata\fR
Determine a list of all the descriptive parameters: mean, minimum,
maximum, number of data, sample standard deviation, sample variance,
population standard deviation and population variance.
.sp
(This routine is called whenever either or all of the basic statistical
parameters are required. Hence all calculations are done and the
relevant values are returned.)
.RS
.TP
list \fIdata\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::histogram\fR \fIlimits\fR \fIvalues\fR
Determine histogram information for the given list of data. Returns a
list consisting of the number of values that fall into each interval.
(The first interval consists of all values lower than the first limit,
the last interval consists of all values greater than the last limit.
There is one more interval than there are limits.)
.RS
.TP
list \fIlimits\fR
- List of upper limits (in ascending order) for the
intervals of the histogram.
.TP
list \fIvalues\fR
- List of data
.RE
.sp
.TP
\fB::math::statistics::corr\fR \fIdata1\fR \fIdata2\fR
Determine the correlation coefficient between two sets of data.
.RS
.TP
list \fIdata1\fR
- First list of data
.TP
list \fIdata2\fR
- Second list of data
.RE
.sp
.TP
\fB::math::statistics::interval-mean-stdev\fR \fIdata\fR \fIconfidence\fR
Return the interval containing the mean value and one
containing the standard deviation with a certain
level of confidence (assuming a normal distribution)
.RS
.TP
list \fIdata\fR
- List of raw data values (small sample)
.TP
float \fIconfidence\fR
- Confidence level (0.95 or 0.99 for instance)
.RE
.sp
.TP
\fB::math::statistics::t-test-mean\fR \fIdata\fR \fIest_mean\fR \fIest_stdev\fR \fIconfidence\fR
Test whether the mean value of a sample is in accordance with the
estimated normal distribution with a certain level of confidence.
Returns 1 if the test succeeds or 0 if the mean is unlikely to fit
the given distribution.
.RS
.TP
list \fIdata\fR
- List of raw data values (small sample)
.TP
float \fIest_mean\fR
- Estimated mean of the distribution
.TP
float \fIest_stdev\fR
- Estimated stdev of the distribution
.TP
float \fIconfidence\fR
- Confidence level (0.95 or 0.99 for instance)
.RE
.sp
.TP
\fB::math::statistics::test-normal\fR \fIdata\fR \fIconfidence\fR
Test whether the given data follow a normal distribution
with a certain level of confidence.
Returns 1 if the data are normally distributed within the level of
confidence, returns 0 if not. The underlying test is the Lilliefors
test.
.RS
.TP
list \fIdata\fR
- List of raw data values
.TP
float \fIconfidence\fR
- Confidence level (one of 0.80, 0.90, 0.95 or 0.99)
.RE
.sp
.TP
\fB::math::statistics::lillieforsFit\fR \fIdata\fR
Returns the goodness of fit to a normal distribution according to
Lilliefors. The higher the number, the more likely the data are indeed
normally distributed. The test requires at least \fIfive\fR data
points.
.RS
.TP
list \fIdata\fR
- List of raw data values
.RE
.sp
.TP
\fB::math::statistics::quantiles\fR \fIdata\fR \fIconfidence\fR
Return the quantiles for a given set of data
.RS
.sp
.TP
list \fIdata\fR
- List of raw data values
.sp
.TP
float \fIconfidence\fR
- Confidence level (0.95 or 0.99 for instance)
.sp
.RE
.sp
.TP
\fB::math::statistics::quantiles\fR \fIlimits\fR \fIcounts\fR \fIconfidence\fR
Return the quantiles based on histogram information (alternative to the
call with two arguments)
.RS
.TP
list \fIlimits\fR
- List of upper limits from histogram
.TP
list \fIcounts\fR
- List of counts for for each interval in histogram
.TP
float \fIconfidence\fR
-  Confidence level (0.95 or 0.99 for instance)
.RE
.sp
.TP
\fB::math::statistics::autocorr\fR \fIdata\fR
Return the autocorrelation function as a list of values (assuming
equidistance between samples, about 1/2 of the number of raw data)
.sp
The correlation is determined in such a way that the first value is
always 1 and all others are equal to or smaller than 1. The number of
values involved will diminish as the "time" (the index in the list of
returned values) increases
.RS
.TP
list \fIdata\fR
- Raw data for which the autocorrelation must be determined
.RE
.sp
.TP
\fB::math::statistics::crosscorr\fR \fIdata1\fR \fIdata2\fR
Return the cross-correlation function as a list of values (assuming
equidistance between samples, about 1/2 of the number of raw data)
.sp
The correlation is determined in such a way that the values can never
exceed 1 in magnitude. The number of values involved will diminish
as the "time" (the index in the list of returned values) increases.
.RS
.TP
list \fIdata1\fR
- First list of data
.TP
list \fIdata2\fR
- Second list of data
.RE
.sp
.TP
\fB::math::statistics::mean-histogram-limits\fR \fImean\fR \fIstdev\fR \fInumber\fR
Determine reasonable limits based on mean and standard deviation
for a histogram
Convenience function - the result is suitable for the histogram function.
.RS
.TP
float \fImean\fR
- Mean of the data
.TP
float \fIstdev\fR
- Standard deviation
.TP
int \fInumber\fR
- Number of limits to generate (defaults to 8)
.RE
.sp
.TP
\fB::math::statistics::minmax-histogram-limits\fR \fImin\fR \fImax\fR \fInumber\fR
Determine reasonable limits based on a minimum and maximum for a histogram
.sp
Convenience function - the result is suitable for the histogram function.
.RS
.TP
float \fImin\fR
- Expected minimum
.TP
float \fImax\fR
- Expected maximum
.TP
int \fInumber\fR
- Number of limits to generate (defaults to 8)
.RE
.sp
.TP
\fB::math::statistics::linear-model\fR \fIxdata\fR \fIydata\fR \fIintercept\fR
Determine the coefficients for a linear regression between
two series of data (the model: Y = A + B*X). Returns a list of
parameters describing the fit
.RS
.TP
list \fIxdata\fR
- List of independent data
.TP
list \fIydata\fR
- List of dependent data to be fitted
.TP
boolean \fIintercept\fR
- (Optional) compute the intercept (1, default) or fit
to a line through the origin (0)
.sp
The result consists of the following list:
.RS
.IP \(bu
(Estimate of) Intercept A
.IP \(bu
(Estimate of) Slope B
.IP \(bu
Standard deviation of Y relative to fit
.IP \(bu
Correlation coefficient R2
.IP \(bu
Number of degrees of freedom df
.IP \(bu
Standard error of the intercept A
.IP \(bu
Significance level of A
.IP \(bu
Standard error of the slope B
.IP \(bu
Significance level of B
.RE
.RE
.sp
.TP
\fB::math::statistics::linear-residuals\fR \fIxdata\fR \fIydata\fR \fIintercept\fR
Determine the difference between actual data and predicted from
the linear model.
.sp
Returns a list of the differences between the actual data and the
predicted values.
.RS
.TP
list \fIxdata\fR
- List of independent data
.TP
list \fIydata\fR
- List of dependent data to be fitted
.TP
boolean \fIintercept\fR
- (Optional) compute the intercept (1, default) or fit
to a line through the origin (0)
.RE
.sp
.TP
\fB::math::statistics::test-2x2\fR \fIn11\fR \fIn21\fR \fIn12\fR \fIn22\fR
Determine if two set of samples, each from a binomial distribution,
differ significantly or not (implying a different parameter).
.sp
Returns the "chi-square" value, which can be used to the determine the
significance.
.RS
.TP
int \fIn11\fR
- Number of outcomes with the first value from the first sample.
.TP
int \fIn21\fR
- Number of outcomes with the first value from the second sample.
.TP
int \fIn12\fR
- Number of outcomes with the second value from the first sample.
.TP
int \fIn22\fR
- Number of outcomes with the second value from the second sample.
.RE
.sp
.TP
\fB::math::statistics::print-2x2\fR \fIn11\fR \fIn21\fR \fIn12\fR \fIn22\fR
Determine if two set of samples, each from a binomial distribution,
differ significantly or not (implying a different parameter).
.sp
Returns a short report, useful in an interactive session.
.RS
.TP
int \fIn11\fR
- Number of outcomes with the first value from the first sample.
.TP
int \fIn21\fR
- Number of outcomes with the first value from the second sample.
.TP
int \fIn12\fR
- Number of outcomes with the second value from the first sample.
.TP
int \fIn22\fR
- Number of outcomes with the second value from the second sample.
.RE
.sp
.TP
\fB::math::statistics::control-xbar\fR \fIdata\fR ?nsamples?
Determine the control limits for an xbar chart. The number of data
in each subsample defaults to 4. At least 20 subsamples are required.
.sp
Returns the mean, the lower limit, the upper limit and the number of
data per subsample.
.RS
.TP
list \fIdata\fR
- List of observed data
.TP
int \fInsamples\fR
- Number of data per subsample
.RE
.sp
.TP
\fB::math::statistics::control-Rchart\fR \fIdata\fR ?nsamples?
Determine the control limits for an R chart. The number of data
in each subsample (nsamples) defaults to 4. At least 20 subsamples are required.
.sp
Returns the mean range, the lower limit, the upper limit and the number
of data per subsample.
.RS
.TP
list \fIdata\fR
- List of observed data
.TP
int \fInsamples\fR
- Number of data per subsample
.RE
.sp
.TP
\fB::math::statistics::test-xbar\fR \fIcontrol\fR \fIdata\fR
Determine if the data exceed the control limits for the xbar chart.
.sp
Returns a list of subsamples (their indices) that indeed violate the
limits.
.RS
.TP
list \fIcontrol\fR
- Control limits as returned by the "control-xbar" procedure
.TP
list \fIdata\fR
- List of observed data
.RE
.sp
.TP
\fB::math::statistics::test-Rchart\fR \fIcontrol\fR \fIdata\fR
Determine if the data exceed the control limits for the R chart.
.sp
Returns a list of subsamples (their indices) that indeed violate the
limits.
.RS
.TP
list \fIcontrol\fR
- Control limits as returned by the "control-Rchart" procedure
.TP
list \fIdata\fR
- List of observed data
.RE
.sp
.PP
.SH "MULTIVARIATE LINEAR REGRESSION"
Besides the linear regression with a single independent variable, the
statistics package provides two procedures for doing ordinary
least squares (OLS) and weighted least squares (WLS) linear regression
with several variables. They were written by Eric Kemp-Benedict.
.PP
In addition to these two, it provides a procedure (tstat)
for calculating the value of the t-statistic for the specified number of
degrees of freedom that is required to demonstrate a given level of
significance.
.PP
Note: These procedures depend on the math::linearalgebra package.
.PP
\fIDescription of the procedures\fR
.TP
\fB::math::statistics::tstat\fR \fIdof\fR ?alpha?
Returns the value of the t-distribution t* satisfying
.CS


    P(t*)  =  1 - alpha/2
    P(-t*) =  alpha/2

.CE
.IP
for the number of degrees of freedom dof.
.sp
Given a sample of normally-distributed data x, with an
estimate xbar for the mean and sbar for the standard deviation,
the alpha confidence interval for the estimate of the mean can
be calculated as
.CS


      ( xbar - t* sbar , xbar + t* sbar)

.CE
.IP
The return values from this procedure can be compared to
an estimated t-statistic to determine whether the estimated
value of a parameter is significantly different from zero at
the given confidence level.
.RS
.TP
int \fIdof\fR
Number of degrees of freedom
.TP
float \fIalpha\fR
Confidence level of the t-distribution. Defaults to 0.05.
.RE
.sp
.TP
\fB::math::statistics::mv-wls\fR \fIwt1\fR \fIweights_and_values\fR
Carries out a weighted least squares linear regression for
the data points provided, with weights assigned to each point.
.sp
The linear model is of the form
.CS


    y = b0 + b1 * x1 + b2 * x2 ... + bN * xN + error

.CE
.IP
and each point satisfies
.CS


    yi = b0 + b1 * xi1 + b2 * xi2 + ... + bN * xiN + Residual_i

.CE
.sp
The procedure returns a list with the following elements:
.RS
.IP \(bu
The r-squared statistic
.IP \(bu
The adjusted r-squared statistic
.IP \(bu
A list containing the estimated coefficients b1, ... bN, b0
(The constant b0 comes last in the list.)
.IP \(bu
A list containing the standard errors of the coefficients
.IP \(bu
A list containing the 95% confidence bounds of the coefficients,
with each set of bounds returned as a list with two values
.RE
.IP
Arguments:
.RS
.TP
list \fIweights_and_values\fR
A list consisting of: the weight for the first observation, the data
for the first observation (as a sublist), the weight for the second
observation (as a sublist) and so on. The sublists of data are organised
as lists of the value of the dependent variable y and the independent
variables x1, x2 to xN.
.RE
.sp
.TP
\fB::math::statistics::mv-ols\fR \fIvalues\fR
Carries out an ordinary least squares linear regression for
the data points provided.
.sp
This procedure simply calls ::mvlinreg::wls with the weights
set to 1.0, and returns the same information.
.PP
\fIExample of the use:\fR
.CS


# Store the value of the unicode value for the "+/-" character
set pm "\\u00B1"

# Provide some data
set data {{  -.67  14.18  60.03 -7.5  }
          { 36.97  15.52  34.24 14.61 }
          {-29.57  21.85  83.36 -7.   }
          {-16.9   11.79  51.67 -6.56 }
          { 14.09  16.24  36.97 -12.84}
          { 31.52  20.93  45.99 -25.4 }
          { 24.05  20.69  50.27  17.27}
          { 22.23  16.91  45.07  -4.3 }
          { 40.79  20.49  38.92  -.73 }
          {-10.35  17.24  58.77  18.78}}

# Call the ols routine
set results [::math::statistics::mv-ols $data]

# Pretty-print the results
puts "R-squared: [lindex $results 0]"
puts "Adj R-squared: [lindex $results 1]"
puts "Coefficients $pm s.e. -- \\[95% confidence interval\\]:"
foreach val [lindex $results 2] se [lindex $results 3] bounds [lindex $results 4] {
    set lb [lindex $bounds 0]
    set ub [lindex $bounds 1]
    puts "   $val $pm $se -- \\[$lb to $ub\\]"
}

.CE
.SH "STATISTICAL DISTRIBUTIONS"
In the literature a large number of probability distributions can be
found. The statistics package supports:
.IP \(bu
The normal or Gaussian distribution
.IP \(bu
The uniform distribution - equal probability for all data within a given
interval
.IP \(bu
The exponential distribution - useful as a model for certain
extreme-value distributions.
.IP \(bu
The gamma distribution - based on the incomplete Gamma integral
.IP \(bu
The chi-square distribution
.IP \(bu
The student's T distribution
.IP \(bu
The Poisson distribution
.IP \(bu
PM - binomial,F.
.PP
In principle for each distribution one has procedures for:
.IP \(bu
The probability density (pdf-*)
.IP \(bu
The cumulative density (cdf-*)
.IP \(bu
Quantiles for the given distribution (quantiles-*)
.IP \(bu
Histograms for the given distribution (histogram-*)
.IP \(bu
List of random values with the given distribution (random-*)
.PP
The following procedures have been implemented:
.TP
\fB::math::statistics::pdf-normal\fR \fImean\fR \fIstdev\fR \fIvalue\fR
Return the probability of a given value for a normal distribution with
given mean and standard deviation.
.RS
.TP
float \fImean\fR
- Mean value of the distribution
.TP
float \fIstdev\fR
- Standard deviation of the distribution
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::pdf-exponential\fR \fImean\fR \fIvalue\fR
Return the probability of a given value for an exponential
distribution with given mean.
.RS
.TP
float \fImean\fR
- Mean value of the distribution
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::pdf-uniform\fR \fIxmin\fR \fIxmax\fR \fIvalue\fR
Return the probability of a given value for a uniform
distribution with given extremes.
.RS
.TP
float \fIxmin\fR
- Minimum value of the distribution
.TP
float \fIxmin\fR
- Maximum value of the distribution
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::pdf-gamma\fR \fIalpha\fR \fIbeta\fR \fIvalue\fR
Return the probability of a given value for a Gamma
distribution with given shape and rate parameters
.RS
.TP
float \fIalpha\fR
- Shape parameter
.TP
float \fIbeta\fR
- Rate parameter
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::pdf-poisson\fR \fImu\fR \fIk\fR
Return the probability of a given number of occurrences in the same
interval (k) for a Poisson distribution with given mean (mu)
.RS
.TP
float \fImu\fR
- Mean number of occurrences
.TP
int \fIk\fR
- Number of occurences
.RE
.sp
.TP
\fB::math::statistics::pdf-chisquare\fR \fIdf\fR \fIvalue\fR
Return the probability of a given value for a chi square
distribution with given degrees of freedom
.RS
.TP
float \fIdf\fR
- Degrees of freedom
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::pdf-student-t\fR \fIdf\fR \fIvalue\fR
Return the probability of a given value for a Student's t
distribution with given degrees of freedom
.RS
.TP
float \fIdf\fR
- Degrees of freedom
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::pdf-beta\fR \fIa\fR \fIb\fR \fIvalue\fR
Return the probability of a given value for a Beta
distribution with given shape parameters
.RS
.TP
float \fIa\fR
- First shape parameter
.TP
float \fIb\fR
- First shape parameter
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::cdf-normal\fR \fImean\fR \fIstdev\fR \fIvalue\fR
Return the cumulative probability of a given value for a normal
distribution with given mean and standard deviation, that is the
probability for values up to the given one.
.RS
.TP
float \fImean\fR
- Mean value of the distribution
.TP
float \fIstdev\fR
- Standard deviation of the distribution
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::cdf-exponential\fR \fImean\fR \fIvalue\fR
Return the cumulative probability of a given value for an exponential
distribution with given mean.
.RS
.TP
float \fImean\fR
- Mean value of the distribution
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::cdf-uniform\fR \fIxmin\fR \fIxmax\fR \fIvalue\fR
Return the cumulative probability of a given value for a uniform
distribution with given extremes.
.RS
.TP
float \fIxmin\fR
- Minimum value of the distribution
.TP
float \fIxmin\fR
- Maximum value of the distribution
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::cdf-students-t\fR \fIdegrees\fR \fIvalue\fR
Return the cumulative probability of a given value for a Student's t
distribution with given number of degrees.
.RS
.TP
int \fIdegrees\fR
- Number of degrees of freedom
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::cdf-gamma\fR \fIalpha\fR \fIbeta\fR \fIvalue\fR
Return the cumulative probability of a given value for a Gamma
distribution with given shape and rate parameters
.RS
.TP
float \fIalpha\fR
- Shape parameter
.TP
float \fIbeta\fR
- Rate parameter
.TP
float \fIvalue\fR
- Value for which the cumulative probability is required
.RE
.sp
.TP
\fB::math::statistics::cdf-poisson\fR \fImu\fR \fIk\fR
Return the cumulative probability of a given number of occurrences in
the same interval (k) for a Poisson distribution with given mean (mu)
.RS
.TP
float \fImu\fR
- Mean number of occurrences
.TP
int \fIk\fR
- Number of occurences
.RE
.sp
.TP
\fB::math::statistics::cdf-beta\fR \fIa\fR \fIb\fR \fIvalue\fR
Return the cumulative probability of a given value for a Beta
distribution with given shape parameters
.RS
.TP
float \fIa\fR
- First shape parameter
.TP
float \fIb\fR
- First shape parameter
.TP
float \fIvalue\fR
- Value for which the probability is required
.RE
.sp
.TP
\fB::math::statistics::random-normal\fR \fImean\fR \fIstdev\fR \fInumber\fR
Return a list of "number" random values satisfying a normal
distribution with given mean and standard deviation.
.RS
.TP
float \fImean\fR
- Mean value of the distribution
.TP
float \fIstdev\fR
- Standard deviation of the distribution
.TP
int \fInumber\fR
- Number of values to be returned
.RE
.sp
.TP
\fB::math::statistics::random-exponential\fR \fImean\fR \fInumber\fR
Return a list of "number" random values satisfying an exponential
distribution with given mean.
.RS
.TP
float \fImean\fR
- Mean value of the distribution
.TP
int \fInumber\fR
- Number of values to be returned
.RE
.sp
.TP
\fB::math::statistics::random-uniform\fR \fIxmin\fR \fIxmax\fR \fInumber\fR
Return a list of "number" random values satisfying a uniform
distribution with given extremes.
.RS
.TP
float \fIxmin\fR
- Minimum value of the distribution
.TP
float \fIxmax\fR
- Maximum value of the distribution
.TP
int \fInumber\fR
- Number of values to be returned
.RE
.sp
.TP
\fB::math::statistics::random-gamma\fR \fIalpha\fR \fIbeta\fR \fInumber\fR
Return a list of "number" random values satisfying
a Gamma distribution with given shape and rate parameters
.RS
.TP
float \fIalpha\fR
- Shape parameter
.TP
float \fIbeta\fR
- Rate parameter
.TP
int \fInumber\fR
- Number of values to be returned
.RE
.sp
.TP
\fB::math::statistics::random-chisquare\fR \fIdf\fR \fInumber\fR
Return a list of "number" random values satisfying
a chi square distribution with given degrees of freedom
.RS
.TP
float \fIdf\fR
- Degrees of freedom
.TP
int \fInumber\fR
- Number of values to be returned
.RE
.sp
.TP
\fB::math::statistics::random-student-t\fR \fIdf\fR \fInumber\fR
Return a list of "number" random values satisfying
a Student's t distribution with given degrees of freedom
.RS
.TP
float \fIdf\fR
- Degrees of freedom
.TP
int \fInumber\fR
- Number of values to be returned
.RE
.sp
.TP
\fB::math::statistics::random-beta\fR \fIa\fR \fIb\fR \fInumber\fR
Return a list of "number" random values satisfying
a Beta distribution with given shape parameters
.RS
.TP
float \fIa\fR
- First shape parameter
.TP
float \fIb\fR
- Second shape parameter
.TP
int \fInumber\fR
- Number of values to be returned
.RE
.sp
.TP
\fB::math::statistics::histogram-uniform\fR \fIxmin\fR \fIxmax\fR \fIlimits\fR \fInumber\fR
Return the expected histogram for a uniform distribution.
.RS
.TP
float \fIxmin\fR
- Minimum value of the distribution
.TP
float \fIxmax\fR
- Maximum value of the distribution
.TP
list \fIlimits\fR
- Upper limits for the buckets in the histogram
.TP
int \fInumber\fR
- Total number of "observations" in the histogram
.RE
.sp
.TP
\fB::math::statistics::incompleteGamma\fR \fIx\fR \fIp\fR ?tol?
Evaluate the incomplete Gamma integral
.CS


                    1       / x               p-1
      P(p,x) =  --------   |   dt exp(-t) * t
                Gamma(p)  / 0

.CE
.RS
.TP
float \fIx\fR
- Value of x (limit of the integral)
.TP
float \fIp\fR
- Value of p in the integrand
.TP
float \fItol\fR
- Required tolerance (default: 1.0e-9)
.RE
.sp
.TP
\fB::math::statistics::incompleteBeta\fR \fIa\fR \fIb\fR \fIx\fR ?tol?
Evaluate the incomplete Beta integral
.RS
.TP
float \fIa\fR
- First shape parameter
.TP
float \fIb\fR
- Second shape parameter
.TP
float \fIx\fR
- Value of x (limit of the integral)
.TP
float \fItol\fR
- Required tolerance (default: 1.0e-9)
.RE
.sp
.PP
TO DO: more function descriptions to be added
.SH "DATA MANIPULATION"
The data manipulation procedures act on lists or lists of lists:
.TP
\fB::math::statistics::filter\fR \fIvarname\fR \fIdata\fR \fIexpression\fR
Return a list consisting of the data for which the logical
expression is true (this command works analogously to the command \fBforeach\fR).
.RS
.TP
string \fIvarname\fR
- Name of the variable used in the expression
.TP
list \fIdata\fR
- List of data
.TP
string \fIexpression\fR
- Logical expression using the variable name
.RE
.sp
.TP
\fB::math::statistics::map\fR \fIvarname\fR \fIdata\fR \fIexpression\fR
Return a list consisting of the data that are transformed via the
expression.
.RS
.TP
string \fIvarname\fR
- Name of the variable used in the expression
.TP
list \fIdata\fR
- List of data
.TP
string \fIexpression\fR
- Expression to be used to transform (map) the data
.RE
.sp
.TP
\fB::math::statistics::samplescount\fR \fIvarname\fR \fIlist\fR \fIexpression\fR
Return a list consisting of the \fIcounts\fR of all data in the
sublists of the "list" argument for which the expression is true.
.RS
.TP
string \fIvarname\fR
- Name of the variable used in the expression
.TP
list \fIdata\fR
- List of sublists, each containing the data
.TP
string \fIexpression\fR
- Logical expression to test the data (defaults to
"true").
.RE
.sp
.TP
\fB::math::statistics::subdivide\fR
Routine \fIPM\fR - not implemented yet
.sp
.TP
\fB::math::statistics::test-Kruskal-Wallis\fR \fIconfidence\fR \fIargs\fR
Check if the population medians of two or more groups are equal with a
given confidence level, using the Kruskal-Wallis test.
.RS
.TP
float \fIconfidence\fR
- Confidence level to be used (0-1)
.TP
list \fIargs\fR
- Two or more lists of data
.RE
.sp
.TP
\fB::math::statistics::analyse-Kruskal-Wallis\fR \fIargs\fR
Compute the statistical parameters for the Kruskal-Wallis test.
Returns the Kruskal-Wallis statistic and the probability that that
value would occur assuming the medians of the populations are
equal.
.RS
.TP
list \fIargs\fR
- Two or more lists of data
.RE
.sp
.TP
\fB::math::statistics::group-rank\fR \fIargs\fR
Rank the groups of data with respect to the complete set.
Returns a list consisting of the group ID, the value and the rank
(possibly a rational number, in case of ties) for each data item.
.RS
.TP
list \fIargs\fR
- Two or more lists of data
.RE
.sp
.TP
\fB::math::statistics::test-Wilcoxon\fR \fIsample_a\fR \fIsample_b\fR
Compute the Wilcoxon test statistic to determine if two samples have the
same median or not. (The statistic can be regarded as standard normal, if the
sample sizes are both larger than 10. Returns the value of this statistic.
.RS
.TP
list \fIsample_a\fR
- List of data comprising the first sample
.TP
list \fIsample_b\fR
- List of data comprising the second sample
.RE
.sp
.TP
\fB::math::statistics::spearman-rank\fR \fIsample_a\fR \fIsample_b\fR
Return the Spearman rank correlation as an alternative to the ordinary (Pearson's) correlation
coefficient. The two samples should have the same number of data.
.RS
.TP
list \fIsample_a\fR
- First list of data
.TP
list \fIsample_b\fR
- Second list of data
.RE
.sp
.TP
\fB::math::statistics::spearman-rank-extended\fR \fIsample_a\fR \fIsample_b\fR
Return the Spearman rank correlation as an alternative to the ordinary (Pearson's) correlation
coefficient as well as additional data. The two samples should have the same number of data.
The procedure returns the correlation coefficient, the number of data pairs used and the
z-score, an approximately standard normal statistic, indicating the significance of the correlation.
.RS
.TP
list \fIsample_a\fR
- First list of data
.TP
list \fIsample_b\fR
- Second list of data
.RE
.PP
.SH "PLOT PROCEDURES"
The following simple plotting procedures are available:
.TP
\fB::math::statistics::plot-scale\fR \fIcanvas\fR \fIxmin\fR \fIxmax\fR \fIymin\fR \fIymax\fR
Set the scale for a plot in the given canvas. All plot routines expect
this function to be called first. There is no automatic scaling
provided.
.RS
.TP
widget \fIcanvas\fR
- Canvas widget to use
.TP
float \fIxmin\fR
- Minimum x value
.TP
float \fIxmax\fR
- Maximum x value
.TP
float \fIymin\fR
- Minimum y value
.TP
float \fIymax\fR
- Maximum y value
.RE
.sp
.TP
\fB::math::statistics::plot-xydata\fR \fIcanvas\fR \fIxdata\fR \fIydata\fR \fItag\fR
Create a simple XY plot in the given canvas - the data are
shown as a collection of dots. The tag can be used to manipulate the
appearance.
.RS
.TP
widget \fIcanvas\fR
- Canvas widget to use
.TP
float \fIxdata\fR
- Series of independent data
.TP
float \fIydata\fR
- Series of dependent data
.TP
string \fItag\fR
- Tag to give to the plotted data (defaults to xyplot)
.RE
.sp
.TP
\fB::math::statistics::plot-xyline\fR \fIcanvas\fR \fIxdata\fR \fIydata\fR \fItag\fR
Create a simple XY plot in the given canvas - the data are
shown as a line through the data points. The tag can be used to
manipulate the appearance.
.RS
.TP
widget \fIcanvas\fR
- Canvas widget to use
.TP
list \fIxdata\fR
- Series of independent data
.TP
list \fIydata\fR
- Series of dependent data
.TP
string \fItag\fR
- Tag to give to the plotted data (defaults to xyplot)
.RE
.sp
.TP
\fB::math::statistics::plot-tdata\fR \fIcanvas\fR \fItdata\fR \fItag\fR
Create a simple XY plot in the given canvas - the data are
shown as a collection of dots. The horizontal coordinate is equal to the
index. The tag can be used to manipulate the appearance.
This type of presentation is suitable for autocorrelation functions for
instance or for inspecting the time-dependent behaviour.
.RS
.TP
widget \fIcanvas\fR
- Canvas widget to use
.TP
list \fItdata\fR
- Series of dependent data
.TP
string \fItag\fR
- Tag to give to the plotted data (defaults to xyplot)
.RE
.sp
.TP
\fB::math::statistics::plot-tline\fR \fIcanvas\fR \fItdata\fR \fItag\fR
Create a simple XY plot in the given canvas - the data are
shown as a line. See plot-tdata for an explanation.
.RS
.TP
widget \fIcanvas\fR
- Canvas widget to use
.TP
list \fItdata\fR
- Series of dependent data
.TP
string \fItag\fR
- Tag to give to the plotted data (defaults to xyplot)
.RE
.sp
.TP
\fB::math::statistics::plot-histogram\fR \fIcanvas\fR \fIcounts\fR \fIlimits\fR \fItag\fR
Create a simple histogram in the given canvas
.RS
.TP
widget \fIcanvas\fR
- Canvas widget to use
.TP
list \fIcounts\fR
- Series of bucket counts
.TP
list \fIlimits\fR
- Series of upper limits for the buckets
.TP
string \fItag\fR
- Tag to give to the plotted data (defaults to xyplot)
.RE
.sp
.PP
.SH "THINGS TO DO"
The following procedures are yet to be implemented:
.IP \(bu
F-test-stdev
.IP \(bu
interval-mean-stdev
.IP \(bu
histogram-normal
.IP \(bu
histogram-exponential
.IP \(bu
test-histogram
.IP \(bu
test-corr
.IP \(bu
quantiles-*
.IP \(bu
fourier-coeffs
.IP \(bu
fourier-residuals
.IP \(bu
onepar-function-fit
.IP \(bu
onepar-function-residuals
.IP \(bu
plot-linear-model
.IP \(bu
subdivide
.PP
.SH EXAMPLES
The code below is a small example of how you can examine a set of
data:
.PP
.CS



# Simple example:
# - Generate data (as a cheap way of getting some)
# - Perform statistical analysis to describe the data
#
package require math::statistics

#
# Two auxiliary procs
#
proc pause {time} {
   set wait 0
   after [expr {$time*1000}] {set ::wait 1}
   vwait wait
}

proc print-histogram {counts limits} {
   foreach count $counts limit $limits {
      if { $limit != {} } {
         puts [format "<%12.4g\\t%d" $limit $count]
         set prev_limit $limit
      } else {
         puts [format ">%12.4g\\t%d" $prev_limit $count]
      }
   }
}

#
# Our source of arbitrary data
#
proc generateData { data1 data2 } {
   upvar 1 $data1 _data1
   upvar 1 $data2 _data2

   set d1 0.0
   set d2 0.0
   for { set i 0 } { $i < 100 } { incr i } {
      set d1 [expr {10.0-2.0*cos(2.0*3.1415926*$i/24.0)+3.5*rand()}]
      set d2 [expr {0.7*$d2+0.3*$d1+0.7*rand()}]
      lappend _data1 $d1
      lappend _data2 $d2
   }
   return {}
}

#
# The analysis session
#
package require Tk
console show
canvas .plot1
canvas .plot2
pack   .plot1 .plot2 -fill both -side top

generateData data1 data2

puts "Basic statistics:"
set b1 [::math::statistics::basic-stats $data1]
set b2 [::math::statistics::basic-stats $data2]
foreach label {mean min max number stdev var} v1 $b1 v2 $b2 {
   puts "$label\\t$v1\\t$v2"
}
puts "Plot the data as function of \\"time\\" and against each other"
::math::statistics::plot-scale .plot1  0 100  0 20
::math::statistics::plot-scale .plot2  0 20   0 20
::math::statistics::plot-tline .plot1 $data1
::math::statistics::plot-tline .plot1 $data2
::math::statistics::plot-xydata .plot2 $data1 $data2

puts "Correlation coefficient:"
puts [::math::statistics::corr $data1 $data2]

pause 2
puts "Plot histograms"
.plot2 delete all
::math::statistics::plot-scale .plot2  0 20 0 100
set limits         [::math::statistics::minmax-histogram-limits 7 16]
set histogram_data [::math::statistics::histogram $limits $data1]
::math::statistics::plot-histogram .plot2 $histogram_data $limits

puts "First series:"
print-histogram $histogram_data $limits

pause 2
set limits         [::math::statistics::minmax-histogram-limits 0 15 10]
set histogram_data [::math::statistics::histogram $limits $data2]
::math::statistics::plot-histogram .plot2 $histogram_data $limits d2
.plot2 itemconfigure d2 -fill red

puts "Second series:"
print-histogram $histogram_data $limits

puts "Autocorrelation function:"
set  autoc [::math::statistics::autocorr $data1]
puts [::math::statistics::map $autoc {[format "%.2f" $x]}]
puts "Cross-correlation function:"
set  crossc [::math::statistics::crosscorr $data1 $data2]
puts [::math::statistics::map $crossc {[format "%.2f" $x]}]

::math::statistics::plot-scale .plot1  0 100 -1  4
::math::statistics::plot-tline .plot1  $autoc "autoc"
::math::statistics::plot-tline .plot1  $crossc "crossc"
.plot1 itemconfigure autoc  -fill green
.plot1 itemconfigure crossc -fill yellow

puts "Quantiles: 0.1, 0.2, 0.5, 0.8, 0.9"
puts "First:  [::math::statistics::quantiles $data1 {0.1 0.2 0.5 0.8 0.9}]"
puts "Second: [::math::statistics::quantiles $data2 {0.1 0.2 0.5 0.8 0.9}]"


.CE
If you run this example, then the following should be clear:
.IP \(bu
There is a strong correlation between two time series, as displayed by
the raw data and especially by the correlation functions.
.IP \(bu
Both time series show a significant periodic component
.IP \(bu
The histograms are not very useful in identifying the nature of the time
series - they do not show the periodic nature.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: statistics\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
data analysis, mathematics, statistics
.SH CATEGORY
Mathematics

Added embedded/man/files/modules/math/symdiff.n.

















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/math/symdiff.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2010 by Kevin B. Kenny <[email protected]>
'\" Redistribution permitted under the terms of the Open Publication License <http://www.opencontent.org/openpub/>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "math::calculus::symdiff" n 1.0 tcllib "Symbolic differentiation for Tcl"
.BS
.SH NAME
math::calculus::symdiff \- Symbolic differentiation for Tcl
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBgrammar::aycock  1.0\fR
.sp
package require \fBmath::calculus::symdiff  1.0\fR
.sp
\fBmath::calculus::symdiff::symdiff\fR \fIexpression\fR \fIvariable\fR
.sp
\fBmath::calculus::jacobian\fR \fIvariableDict\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBmath::calculus::symdiff\fR package provides a symbolic differentiation
facility for Tcl math expressions. It is useful for providing derivatives
to packages that either require the Jacobian of a set of functions or else
are more efficient or stable when the Jacobian is provided.
.SH PROCEDURES
The \fBmath::calculus::symdiff\fR package exports the two procedures:
.TP
\fBmath::calculus::symdiff::symdiff\fR \fIexpression\fR \fIvariable\fR
Differentiates the given \fIexpression\fR with respect to the specified
\fIvariable\fR. (See \fBExpressions\fR below for a discussion of the
subset of Tcl math expressions that are acceptable to
\fBmath::calculus::symdiff\fR.)
The result is a Tcl expression that evaluates the derivative. Returns an
error if \fIexpression\fR is not a well-formed expression or is not
differentiable.
.TP
\fBmath::calculus::jacobian\fR \fIvariableDict\fR
Computes the Jacobian of a system of equations.
The system is given by the dictionary \fIvariableDict\fR, whose keys
are the names of variables in the system, and whose values are Tcl expressions
giving the values of those variables. (See \fBExpressions\fR below
for a discussion of the subset of Tcl math expressions that are acceptable
to \fBmath::calculus::symdiff\fR. The result is a list of lists:
the i'th element of the j'th sublist is the partial derivative of
the i'th variable with respect to the j'th variable. Returns an error if
any of the expressions cannot be differentiated, or if \fIvariableDict\fR
is not a well-formed dictionary.
.PP
.SH EXPRESSIONS
The \fBmath::calculus::symdiff\fR package accepts only a small subset of the expressions
that are acceptable to Tcl commands such as \fBexpr\fR or \fBif\fR.
Specifically, the only constructs accepted are:
.IP \(bu
Floating-point constants such as \fB5\fR or \fB3.14159e+00\fR.
.IP \(bu
References to Tcl variable using $-substitution. The variable names
must consist of alphanumerics and underscores: the \fB${...}\fR notation
is not accepted.
.IP \(bu
Parentheses.
.IP \(bu
The \fB+\fR, \fB-\fR, \fB*\fR, \fB/\fR. and \fB**\fR
operators.
.IP \(bu
Calls to the functions \fBacos\fR, \fBasin\fR, \fBatan\fR,
\fBatan2\fR, \fBcos\fR, \fBcosh\fR, \fBexp\fR, \fBhypot\fR, \fBlog\fR,
\fBlog10\fR, \fBpow\fR, \fBsin\fR, \fBsinh\fR. \fBsqrt\fR, \fBtan\fR,
and \fBtanh\fR.
.PP
Command substitution, backslash substitution, and argument expansion are
not accepted.
.SH EXAMPLES
.CS


math::calculus::symdiff::symdiff {($a*$x+$b)*($c*$x+$d)} x
==> (($c * (($a * $x) + $b)) + ($a * (($c * $x) + $d)))
math::calculus::symdiff::jacobian {x {$a * $x + $b * $y}
                         y {$c * $x + $d * $y}}
==> {{$a} {$b}} {{$c} {$d}}

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImath :: calculus\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
math::calculus, math::interpolate
.SH COPYRIGHT
.nf
Copyright (c) 2010 by Kevin B. Kenny <[email protected]>
Redistribution permitted under the terms of the Open Publication License <http://www.opencontent.org/openpub/>

.fi

Added embedded/man/files/modules/md4/md4.n.
















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/md4/md4.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "md4" n 1.0.5 tcllib "MD4 Message-Digest Algorithm"
.BS
.SH NAME
md4 \- MD4 Message-Digest Algorithm
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBmd4  ?1.0?\fR
.sp
\fB::md4::md4\fR ?\fI-hex\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::md4::hmac\fR ?\fI-hex\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::md4::MD4Init\fR
.sp
\fB::md4::MD4Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::md4::MD4Final\fR \fItoken\fR
.sp
\fB::md4::HMACInit\fR \fIkey\fR
.sp
\fB::md4::HMACUpdate\fR \fItoken\fR \fIdata\fR
.sp
\fB::md4::HMACFinal\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package is an implementation in Tcl of the MD4 message-digest
algorithm as described in RFC 1320 (1) and (2). This algorithm takes
an arbitrary quantity of data and generates a 128-bit message digest
from the input. The MD4 algorithm is faster but potentially weaker than
the related MD5 algorithm (3).
.PP
If you have \fBcritcl\fR and have built the \fBtcllibc\fR package
then the implementation of the hashing function will be performed by compiled
code. Alternatively if \fBcryptkit\fR is available this will be
used. If no accelerator package can be found then the pure-tcl
implementation is used. The programming interface remains the same in
all cases.
.SH COMMANDS
.TP
\fB::md4::md4\fR ?\fI-hex\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate the MD4 digest of the data given in string. This is returned
as a binary string by default. Giving the \fI-hex\fR option will
return a hexadecimal encoded version of the digest.
.sp
The data to be hashed can be specified either as a string argument to
the md4 command, or as a filename or a pre-opened channel. If the
\fI-filename\fR argument is given then the file is opened, the data read
and hashed and the file is closed. If the \fI-channel\fR argument is
given then data is read from the channel until the end of file. The
channel is not closed.
.sp
Only one of \fI-file\fR, \fI-channel\fR or \fIstring\fR should be given.
.TP
\fB::md4::hmac\fR ?\fI-hex\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate an Hashed Message Authentication digest (HMAC) using the MD4
digest algorithm. HMACs are described in RFC 2104 (4) and provide an MD4
digest that includes a key. All options other than \fI-key\fR are as
for the \fB::md4::md4\fR command.
.PP
.SH "PROGRAMMING INTERFACE"
For the programmer, the MD4 hash can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
derived from the data that was poured into the bucket. The programming
interface to the MD4 hash operates on a token (equivalent to the
bucket). You call \fBMD4Init\fR to obtain a token and then call
\fBMD4Update\fR as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call
\fBMD4Final\fR. An equivalent set of functions gives you a keyed digest (HMAC).
.TP
\fB::md4::MD4Init\fR
Begins a new MD4 hash. Returns a token ID that must be used for the
remaining functions.
.TP
\fB::md4::MD4Update\fR \fItoken\fR \fIdata\fR
Add data to the hash identified by token. Calling
\fIMD4Update $token "abcd"\fR is equivalent to calling
\fIMD4Update $token "ab"\fR followed by
\fIMD4Update $token "cb"\fR. See \fBEXAMPLES\fR.
.TP
\fB::md4::MD4Final\fR \fItoken\fR
Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 16 bytes representing the 128 bit MD4
digest value.
.TP
\fB::md4::HMACInit\fR \fIkey\fR
This is equivalent to the \fB::md4::MD4Init\fR command except that
it requires the key that will be included in the HMAC.
.TP
\fB::md4::HMACUpdate\fR \fItoken\fR \fIdata\fR
.TP
\fB::md4::HMACFinal\fR \fItoken\fR
These commands are identical to the MD4 equivalent commands.
.PP
.SH EXAMPLES
.CS


% md4::md4 -hex "Tcl does MD4"
858da9b31f57648a032230447bd15f25

.CE
.CS


% md4::hmac -hex -key Sekret "Tcl does MD4"
c324088e5752872689caedf2a0464758

.CE
.CS


% set tok [md4::MD4Init]
::md4::1
% md4::MD4Update $tok "Tcl "
% md4::MD4Update $tok "does "
% md4::MD4Update $tok "MD4"
% md4::Hex [md4::MD4Final $tok]
858da9b31f57648a032230447bd15f25

.CE
.SH REFERENCES
.IP [1]
Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT,
April 1992. (\fIhttp://www.rfc-editor.org/rfc/rfc1320.txt\fR)
.IP [2]
Rivest, R., "The MD4 message digest algorithm", in A.J.  Menezes
and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90
Proceedings, pages 303-311, Springer-Verlag, 1991.
.IP [3]
Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT and
RSA Data Security, Inc, April 1992.
(\fIhttp://www.rfc-editor.org/rfc/rfc1321.txt\fR)
.IP [4]
Krawczyk, H., Bellare, M. and Canetti, R. "HMAC: Keyed-Hashing for
Message Authentication", RFC 2104, February 1997.
(\fIhttp://www.rfc-editor.org/rfc/rfc2104.txt\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImd4\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
md5, sha1
.SH KEYWORDS
hashing, md4, message-digest, rfc 1320, rfc 1321, rfc 2104, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2003, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/md5/md5.n.






















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/md5/md5.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "md5" n 2.0.7 tcllib "MD5 Message-Digest Algorithm"
.BS
.SH NAME
md5 \- MD5 Message-Digest Algorithm
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBmd5  ?2.0.7?\fR
.sp
\fB::md5::md5\fR ?\fI-hex\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::md5::hmac\fR ?\fI-hex\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::md5::MD5Init\fR
.sp
\fB::md5::MD5Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::md5::MD5Final\fR \fItoken\fR
.sp
\fB::md5::HMACInit\fR \fIkey\fR
.sp
\fB::md5::HMACUpdate\fR \fItoken\fR \fIdata\fR
.sp
\fB::md5::HMACFinal\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package is an implementation in Tcl of the MD5 message-digest
algorithm as described in RFC 1321 (1). This algorithm takes
an arbitrary quantity of data and generates a 128-bit message digest
from the input. The MD5 algorithm is related to the MD4 algorithm (2)
but has been strengthened against certain types of potential
attack. MD5 should be used in preference to MD4 for new applications.
.PP
If you have \fBcritcl\fR and have built the \fBtcllibc\fR
package then the implementation of the hashing function will be
performed by compiled code. Alternatively if you have either
\fBcryptkit\fR or \fBTrf\fR then either of these can be used to
accelerate the digest computation. If no suitable compiled package is
available then the pure-Tcl implementation wil be used. The
programming interface remains the same in all cases.
.PP
\fINote\fR the previous version of this package always returned a
hex encoded string. This has been changed to simplify the programming
interface and to make this version more compatible with other
implementations. To obtain the previous usage, either explicitly
specify package version 1 or use the \fI-hex\fR option to the
\fBmd5\fR command.
.SH COMMANDS
.TP
\fB::md5::md5\fR ?\fI-hex\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate the MD5 digest of the data given in string. This is returned
as a binary string by default. Giving the \fI-hex\fR option will
return a hexadecimal encoded version of the digest.
.sp
The data to be hashed can be specified either as a string argument to
the \fBmd5\fR command, or as a filename or a pre-opened channel. If the
\fI-filename\fR argument is given then the file is opened, the data read
and hashed and the file is closed. If the \fI-channel\fR argument is
given then data is read from the channel until the end of file. The
channel is not closed.
.sp
Only one of \fI-file\fR, \fI-channel\fR or \fIstring\fR should be given.
.TP
\fB::md5::hmac\fR ?\fI-hex\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate an Hashed Message Authentication digest (HMAC) using the MD5
digest algorithm. HMACs are described in RFC 2104 (3) and provide an MD5
digest that includes a key. All options other than \fI-key\fR are as
for the \fB::md5::md5\fR command.
.PP
.SH "PROGRAMMING INTERFACE"
For the programmer, the MD5 hash can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
derived from the data that was poured into the bucket. The programming
interface to the MD5 hash operates on a token (equivalent to the
bucket). You call \fBMD5Init\fR to obtain a token and then call
\fBMD5Update\fR as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call
\fBMD5Final\fR. An equivalent set of functions gives you a keyed digest
(HMAC).
.TP
\fB::md5::MD5Init\fR
Begins a new MD5 hash. Returns a token ID that must be used for the
remaining functions.
.TP
\fB::md5::MD5Update\fR \fItoken\fR \fIdata\fR
Add data to the hash identified by token. Calling
\fIMD5Update $token "abcd"\fR is equivalent to calling
\fIMD5Update $token "ab"\fR followed by
\fIMD5Update $token "cb"\fR. See \fBEXAMPLES\fR.
.TP
\fB::md5::MD5Final\fR \fItoken\fR
Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 16 bytes representing the 128 bit MD5
digest value.
.TP
\fB::md5::HMACInit\fR \fIkey\fR
This is equivalent to the \fB::md5::MD5Init\fR command except that
it requires the key that will be included in the HMAC.
.TP
\fB::md5::HMACUpdate\fR \fItoken\fR \fIdata\fR
.TP
\fB::md5::HMACFinal\fR \fItoken\fR
These commands are identical to the MD5 equivalent commands.
.PP
.SH EXAMPLES
.CS


% md5::md5 -hex "Tcl does MD5"
8AAC1EE01E20BB347104FABB90310433

.CE
.CS


% md5::hmac -hex -key Sekret "Tcl does MD5"
35BBA244FD56D3EDF5F3C47474DACB5D

.CE
.CS


% set tok [md5::MD5Init]
::md5::1
% md5::MD5Update $tok "Tcl "
% md5::MD5Update $tok "does "
% md5::MD5Update $tok "MD5"
% md5::Hex [md5::MD5Final $tok]
8AAC1EE01E20BB347104FABB90310433

.CE
.SH REFERENCES
.IP [1]
Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT and
RSA Data Security, Inc, April 1992.
(\fIhttp://www.rfc-editor.org/rfc/rfc1321.txt\fR)
.IP [2]
Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT,
April 1992. (\fIhttp://www.rfc-editor.org/rfc/rfc1320.txt\fR)
.IP [3]
Krawczyk, H., Bellare, M. and Canetti, R. "HMAC: Keyed-Hashing for
Message Authentication", RFC 2104, February 1997.
(\fIhttp://www.rfc-editor.org/rfc/rfc2104.txt\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImd5\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
md4, sha1
.SH KEYWORDS
hashing, md5, message-digest, rfc 1320, rfc 1321, rfc 2104, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2003, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/md5crypt/md5crypt.n.














































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/md5crypt/md5crypt.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "md5crypt" n 1.1.0 tcllib "MD5-based password encryption"
.BS
.SH NAME
md5crypt \- MD5-based password encryption
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBmd5  2.0\fR
.sp
package require \fBmd5crypt  ?1.1.0?\fR
.sp
\fB::md5crypt::md5crypt\fR \fIpassword\fR \fIsalt\fR
.sp
\fB::md5crypt::aprcrypt\fR \fIpassword\fR \fIsalt\fR
.sp
\fB::md5crypt::salt\fR ?\fIlength\fR?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides an implementation of the MD5-crypt password
encryption algorithm as pioneered by FreeBSD and currently in use as a
replacement for the unix crypt(3) function in many modern
systems. An implementation of the closely related Apache MD5-crypt is
also available.
The output of these commands are compatible with the BSD and OpenSSL
implementation of md5crypt and the Apache 2 htpasswd program.
.SH COMMANDS
.TP
\fB::md5crypt::md5crypt\fR \fIpassword\fR \fIsalt\fR
Generate a BSD compatible md5-encoded password hash from the plaintext
password and a random salt (see SALT).
.TP
\fB::md5crypt::aprcrypt\fR \fIpassword\fR \fIsalt\fR
Generate an Apache compatible md5-encoded password hash from the plaintext
password and a random salt (see SALT).
.TP
\fB::md5crypt::salt\fR ?\fIlength\fR?
Generate a random salt string suitable for use with the \fBmd5crypt\fR and
\fBaprcrypt\fR commands.
.PP
.SH SALT
The salt passed to either of the encryption schemes implemented here
is checked to see if it begins with the encryption scheme magic string
(either "$1$" for MD5-crypt or "$apr1$" for Apache crypt). If so, this
is removed. The remaining characters up to the next $ and up to a
maximum of 8 characters are then used as the salt. The salt text
should probably be restricted the set of ASCII alphanumeric characters
plus "./" (dot and forward-slash) - this is to preserve maximum
compatability with the unix password file format.
.PP
If a password is being generated rather than checked from a password
file then the \fBsalt\fR command may be used to generate a random salt.
.SH EXAMPLES
.CS


% md5crypt::md5crypt password 01234567
$1$01234567$b5lh2mHyD2PdJjFfALlEz1

.CE
.CS


% md5crypt::aprcrypt password 01234567
$apr1$01234567$IXBaQywhAhc0d75ZbaSDp/

.CE
.CS


% md5crypt::md5crypt password [md5crypt::salt]
$1$dFmvyRmO$T.V3OmzqeEf3hqJp2WFcb.

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImd5crypt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
md5
.SH KEYWORDS
hashing, md5, md5crypt, message-digest, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2003, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/mime/mime.n.


























































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/mime/mime.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 1999-2000 Marshall T. Rose
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "mime" n 1.5.6 tcllib "Mime"
.BS
.SH NAME
mime \- Manipulation of MIME body parts
.SH SYNOPSIS
package require \fBTcl \fR
.sp
package require \fBmime  ?1.5.6?\fR
.sp
\fB::mime::initialize\fR ?\fB-canonical\fR \fItype/subtype\fR ?\fB-param\fR {\fIkey value\fR}...? ?\fB-encoding\fR \fIvalue\fR? ?\fB-header\fR {\fIkey value\fR}...?? (\fB-file\fR \fIname\fR | \fB-string\fR \fIvalue\fR | \fB-parts\fR {\fItoken1\fR ... \fItokenN\fR})
.sp
\fB::mime::finalize\fR \fItoken\fR ?\fB-subordinates\fR \fBall\fR | \fBdynamic\fR | \fBnone\fR?
.sp
\fB::mime::getproperty\fR \fItoken\fR ?\fIproperty\fR | \fB-names\fR?
.sp
\fB::mime::getheader\fR \fItoken\fR ?\fIkey\fR | \fB-names\fR?
.sp
\fB::mime::setheader\fR \fItoken\fR \fIkey value\fR ?\fB-mode\fR \fBwrite\fR | \fBappend\fR | \fBdelete\fR?
.sp
\fB::mime::getbody\fR \fItoken\fR ?\fB-decode\fR? ?\fB-command\fR \fIcallback\fR ?\fB-blocksize\fR \fIoctets\fR??
.sp
\fB::mime::copymessage\fR \fItoken\fR \fIchannel\fR
.sp
\fB::mime::buildmessage\fR \fItoken\fR
.sp
\fB::mime::parseaddress\fR \fIstring\fR
.sp
\fB::mime::parsedatetime\fR (\fIstring\fR | \fB-now\fR) \fIproperty\fR
.sp
\fB::mime::mapencoding\fR \fIencoding_name\fR
.sp
\fB::mime::reversemapencoding\fR \fIcharset_type\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBmime\fR library package provides the commands to create and
manipulate MIME body parts.
.TP
\fB::mime::initialize\fR ?\fB-canonical\fR \fItype/subtype\fR ?\fB-param\fR {\fIkey value\fR}...? ?\fB-encoding\fR \fIvalue\fR? ?\fB-header\fR {\fIkey value\fR}...?? (\fB-file\fR \fIname\fR | \fB-string\fR \fIvalue\fR | \fB-parts\fR {\fItoken1\fR ... \fItokenN\fR})
This command creates a MIME part and returns a token representing it.
.RS
.IP \(bu
If the \fB-canonical\fR option is present, then the body is in
canonical (raw) form and is found by consulting either the
\fB-file\fR, \fB-string\fR, or \fB-parts\fR option.
.sp
In addition, both the \fB-param\fR and \fB-header\fR options may
occur zero or more times to specify \fBContent-Type\fR parameters
(e.g., \fBcharset\fR) and header keyword/values (e.g.,
\fBContent-Disposition\fR), respectively.
.sp
Also, \fB-encoding\fR, if present, specifies the
\fBContent-Transfer-Encoding\fR when copying the body.
.IP \(bu
If the \fB-canonical\fR option is not present, then the MIME part
contained in either the \fB-file\fR or the \fB-string\fR option
is parsed, dynamically generating subordinates as appropriate.
.RE
.TP
\fB::mime::finalize\fR \fItoken\fR ?\fB-subordinates\fR \fBall\fR | \fBdynamic\fR | \fBnone\fR?
This command destroys the MIME part represented by \fItoken\fR. It
returns an empty string.
.sp
If the \fB-subordinates\fR option is present, it specifies which
subordinates should also be destroyed. The default value is
\fBdynamic\fR, destroying all subordinates which were created by
\fB::mime::initialize\fR together with the containing body part.
.TP
\fB::mime::getproperty\fR \fItoken\fR ?\fIproperty\fR | \fB-names\fR?
This command returns a string or a list of strings containing the
properties of a MIME part. If the command is invoked with the name of
a specific property, then the corresponding value is returned;
instead, if \fB-names\fR is specified, a list of all properties is
returned; otherwise, a serialized array of properties and values is
returned.
.sp
The possible properties are:
.RS
.TP
\fBcontent\fR
The type/subtype describing the content
.TP
\fBencoding\fR
The "Content-Transfer-Encoding"
.TP
\fBparams\fR
A list of "Content-Type" parameters
.TP
\fBparts\fR
A list of tokens for the part's subordinates.  This property is
present only if the MIME part has subordinates.
.TP
\fBsize\fR
The approximate size of the content (unencoded)
.RE
.TP
\fB::mime::getheader\fR \fItoken\fR ?\fIkey\fR | \fB-names\fR?
This command returns the header of a MIME part, as a list of strings.
.sp
A header consists of zero or more key/value pairs. Each value is a
list containing one or more strings.
.sp
If this command is invoked with the name of a specific \fIkey\fR, then
a list containing the corresponding value(s) is returned; instead, if
-names is specified, a list of all keys is returned; otherwise, a
serialized array of keys and values is returned. Note that when a key
is specified (e.g., "Subject"), the list returned usually contains
exactly one string; however, some keys (e.g., "Received") often occur
more than once in the header, accordingly the list returned usually
contains more than one string.
.TP
\fB::mime::setheader\fR \fItoken\fR \fIkey value\fR ?\fB-mode\fR \fBwrite\fR | \fBappend\fR | \fBdelete\fR?
This command writes, appends to, or deletes the \fIvalue\fR associated
with a \fIkey\fR in the header. It returns a list of strings
containing the previous value associated with the key.
.sp
The value for \fB-mode\fR is one of:
.RS
.TP
\fBwrite\fR
The \fIkey\fR/\fIvalue\fR is either created or overwritten (the default).
.TP
\fBappend\fR
A new \fIvalue\fR is appended for the \fIkey\fR (creating it as necessary).
.TP
\fBdelete\fR
All values associated with the key are removed (the \fIvalue\fR
parameter is ignored).
.RE
.TP
\fB::mime::getbody\fR \fItoken\fR ?\fB-decode\fR? ?\fB-command\fR \fIcallback\fR ?\fB-blocksize\fR \fIoctets\fR??
This command returns a string containing the body of the leaf MIME
part represented by \fItoken\fR in canonical form.
.sp
If the \fB-command\fR option is present, then it is repeatedly
invoked with a fragment of the body as this:
.CS


  uplevel #0 $callback [list "data" $fragment]

.CE
.sp
(The \fB-blocksize\fR option, if present, specifies the maximum
size of each fragment passed to the callback.)
.sp
When the end of the body is reached, the callback is invoked as:
.CS


    uplevel #0 $callback "end"

.CE
.sp
Alternatively, if an error occurs, the callback is invoked as:
.CS


    uplevel #0 $callback [list "error" reason]

.CE
.sp
Regardless, the return value of the final invocation of the callback
is propagated upwards by \fB::mime::getbody\fR.
.sp
If the \fB-command\fR option is absent, then the return value of
\fB::mime::getbody\fR is a string containing the MIME part's entire
body.
.sp
If the option \fB-decode\fR is absent the return value computed
above is returned as is. This means that it will be in the charset
specified for the token and not the usual utf-8.
If the option \fB-decode\fR is present however the command will use
the charset information associated with the token to convert the
string from its encoding into utf-8 before returning it.
.TP
\fB::mime::copymessage\fR \fItoken\fR \fIchannel\fR
This command copies the MIME represented by \fItoken\fR part to the
specified \fIchannel\fR. The command operates synchronously, and uses
fileevent to allow asynchronous operations to proceed
independently. It returns an empty string.
.TP
\fB::mime::buildmessage\fR \fItoken\fR
This command returns the MIME part represented by \fItoken\fR as a
string.  It is similar to \fB::mime::copymessage\fR, only it returns
the data as a return string instead of writing to a channel.
.TP
\fB::mime::parseaddress\fR \fIstring\fR
This command takes a string containing one or more 822-style address
specifications and returns a list of serialized arrays, one element
for each address specified in the argument. If the string contains
more than one address they will be separated by commas.
.sp
Each serialized array contains the properties below. Note that one or
more of these properties may be empty.
.RS
.TP
\fBaddress\fR
local@domain
.TP
\fBcomment\fR
822-style comment
.TP
\fBdomain\fR
the domain part (rhs)
.TP
\fBerror\fR
non-empty on a parse error
.TP
\fBgroup\fR
this address begins a group
.TP
\fBfriendly\fR
user-friendly rendering
.TP
\fBlocal\fR
the local part (lhs)
.TP
\fBmemberP\fR
this address belongs to a group
.TP
\fBphrase\fR
the phrase part
.TP
\fBproper\fR
822-style address specification
.TP
\fBroute\fR
822-style route specification (obsolete)
.RE
.TP
\fB::mime::parsedatetime\fR (\fIstring\fR | \fB-now\fR) \fIproperty\fR
This command takes a string containing an 822-style date-time
specification and returns the specified property as a serialized
array.
.sp
The list of properties and their ranges are:
.RS
.TP
\fBhour\fR
0 .. 23
.TP
\fBlmonth\fR
January, February, ..., December
.TP
\fBlweekday\fR
Sunday, Monday, ... Saturday
.TP
\fBmday\fR
1 .. 31
.TP
\fBmin\fR
0 .. 59
.TP
\fBmon\fR
1 .. 12
.TP
\fBmonth\fR
Jan, Feb, ..., Dec
.TP
\fBproper\fR
822-style date-time specification
.TP
\fBrclock\fR
elapsed seconds between then and now
.TP
\fBsec\fR
0 .. 59
.TP
\fBwday\fR
0 .. 6 (Sun .. Mon)
.TP
\fBweekday\fR
Sun, Mon, ..., Sat
.TP
\fByday\fR
1 .. 366
.TP
\fByear\fR
1900 ...
.TP
\fBzone\fR
-720 .. 720 (minutes east of GMT)
.RE
.TP
\fB::mime::mapencoding\fR \fIencoding_name\fR
This commansd maps tcl encodings onto the proper names for their MIME
charset type.  This is only done for encodings whose charset types
were known.  The remaining encodings return "" for now.
.TP
\fB::mime::reversemapencoding\fR \fIcharset_type\fR
This command maps MIME charset types onto tcl encoding names.  Those
that are unknown return "".
.PP
.SH "KNOWN BUGS"
.TP
SourceForge Tcllib Bug #447037
This problem affects only people which are using Tcl and Mime on a
64-bit system. The currently recommended fix for this problem is to
upgrade to Tcl version 8.4. This version has extended 64 bit support
and the bug does not appear anymore.
.sp
The problem could have been generally solved by requiring the use of
Tcl 8.4 for this package. We decided against this solution as it would
force a large number of unaffected users to upgrade their Tcl
interpreter for no reason.
.sp
See \fIhttp://sourceforge.net/tracker/?func=detail&aid=447037&group_id=12883&atid=112883\fR
for additional information.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImime\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
ftp, http, pop3, smtp
.SH KEYWORDS
email, internet, mail, mime, net, rfc 2045, rfc 2046, rfc 2049, rfc 821, rfc 822, smtp
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) 1999-2000 Marshall T. Rose

.fi

Added embedded/man/files/modules/mime/smtp.n.

























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/mime/smtp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 1999-2000 Marshall T. Rose and others
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "smtp" n 1.4.5 tcllib "smtp client"
.BS
.SH NAME
smtp \- Client-side tcl implementation of the smtp protocol
.SH SYNOPSIS
package require \fBTcl \fR
.sp
package require \fBmime  ?1.5.4?\fR
.sp
package require \fBsmtp  ?1.4.5?\fR
.sp
\fB::smtp::sendmessage\fR \fItoken\fR \fIoption\fR...
.sp
.BE
.SH DESCRIPTION
.PP
The \fBsmtp\fR library package provides the client side of the
Simple Mail Transfer Protocol (SMTP) (1) (2).
.TP
\fB::smtp::sendmessage\fR \fItoken\fR \fIoption\fR...
This command sends the MIME part (see package \fBmime\fR)
represented by \fItoken\fR to an SMTP server. \fIoptions\fR is a list
of options and their associated values.  The recognized options are:
.RS
.TP
\fB-servers\fR
A list of SMTP servers. The default is \fBlocalhost\fR.
.TP
\fB-ports\fR
A list of SMTP ports. The default is \fB25\fR.
.TP
\fB-client\fR
The name to use as our hostname when connecting to the server. By
default this is either localhost if one of the servers is localhost,
or is set to the string returned by \fBinfo hostname\fR.
.TP
\fB-queue\fR
Indicates that the SMTP server should be asked to queue the message
for later processing. A boolean value.
.TP
\fB-atleastone\fR
Indicates that the SMTP server must find at least one recipient
acceptable for the message to be sent. A boolean value.
.TP
\fB-originator\fR
A string containing an 822-style address specification. If present the
header isn't examined for an originator address.
.TP
\fB-recipients\fR
A string containing one or more 822-style address specifications. If
present the header isn't examined for recipient addresses). If the
string contains more than one address they will be separated by
commas.
.TP
\fB-header\fR
A list containing two elements, an smtp header and its associated
value (the -header option may occur zero or more times).
.TP
\fB-usetls\fR
This package supports the RFC 3207 TLS extension (3) by default provided the
tls package is available. You can turn this off with this boolean option.
.TP
\fB-tlspolicy\fR
This option lets you specify a command to be called if an error occurs
during TLS setup. The command is called with the SMTP code and diagnostic
message appended. The command should return 'secure' or 'insecure' where
insecure will cause the package to continue on the unencrypted channel.
Returning 'secure' will cause the socket to be closed and the next server
in the \fB-servers\fR list to be tried.
.TP
\fB-username\fR
.TP
\fB-password\fR
If your SMTP server requires authentication (RFC 2554 (4)) before
accepting mail you can use \fB-username\fR and \fB-password\fR
to provide your authentication details to the server. Currently this
package supports DIGEST-MD5, CRAM-MD5, LOGIN and PLAIN authentication
methods. The most secure method will be tried first and each method
tried in turn until we are either authorized or we run out of
methods. Note that if the server permits a TLS connection, then the
authorization will occur after we begin using the secure channel.
.sp
Please also read the section on \fBAuthentication\fR, it details
the necessary prequisites, i.e. packages needed to support these
options and authentication.
.RE
.sp
If the \fB-originator\fR option is not present, the originator
address is taken from \fBFrom\fR (or \fBResent-From\fR);
similarly, if the \fB-recipients\fR option is not present,
recipient addresses are taken from \fBTo\fR, \fBcc\fR, and
\fBBcc\fR (or \fBResent-To\fR, and so on). Note that the header
key/values supplied by the \fB-header\fR option (not those present
in the MIME part) are consulted. Regardless, header key/values are
added to the outgoing message as necessary to ensure that a valid
822-style message is sent.
.sp
The command returns a list indicating which recipients were
unacceptable to the SMTP server. Each element of the list is another
list, containing the address, an SMTP error code, and a textual
diagnostic. Depending on the \fB-atleastone\fR option and the
intended recipients, a non-empty list may still indicate that the
message was accepted by the server.
.PP
.SH AUTHENTICATION
Beware. SMTP authentication uses \fBSASL\fR. I.e. if the user
has to authenticate a connection, i.e. use the options \fB-user\fR
and \fB-password\fR (see above) it is necessary to have the
\fBsasl\fR package available so that \fBsmtp\fR can load it.
.PP
This is a soft dependency because not everybody requires authentication,
and \fBsasl\fR depends on a lot of the cryptographic (secure) hashes,
i.e. all of \fBmd5\fR, \fBotp\fR, \fBmd4\fR, \fBsha1\fR,
and \fBripemd160\fR.
.SH EXAMPLE
.CS


proc send_simple_message {recipient email_server subject body} {
    package require smtp
    package require mime

    set token [mime::initialize -canonical text/plain \\\\
	-string $body]
    mime::setheader $token Subject $subject
    smtp::sendmessage $token \\\\
	-recipients $recipient -servers $email_server
    mime::finalize $token
}

send_simple_message [email protected] localhost \\\\
    "This is the subject." "This is the message."

.CE
.SH REFERENCES
.IP [1]
Jonathan B. Postel, "SIMPLE MAIL TRANSFER PROTOCOL", RFC 821, August 1982.
(\fIhttp://www.rfc-editor.org/rfc/rfc821.txt\fR)
.IP [2]
J. Klensin, "Simple Mail Transfer Protocol", RFC 2821, April 2001.
(\fIhttp://www.rfc-editor.org/rfc/rfc2821.txt\fR)
.IP [3]
P. Hoffman, "SMTP Service Extension for Secure SMTP over Transport
Layer Security", RFC 3207, February 2002.
(\fIhttp://www.rfc-editor.org/rfc/rfc3207.txt\fR)
.IP [4]
J. Myers, "SMTP Service Extension for Authentication",
RFC 2554, March 1999.
(\fIhttp://www.rfc-editor.org/rfc/rfc2554.txt\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIsmtp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
ftp, http, mime, pop3
.SH KEYWORDS
email, internet, mail, mime, net, rfc 2554, rfc 2821, rfc 3207, rfc 821, rfc 822, smtp, tls
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 1999-2000 Marshall T. Rose and others

.fi

Added embedded/man/files/modules/multiplexer/multiplexer.n.























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/multiplexer/multiplexer.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "multiplexer" n 0.2 tcllib "One-to-many communication with sockets."
.BS
.SH NAME
multiplexer \- One-to-many communication with sockets.
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBlogger \fR
.sp
package require \fBmultiplexer  ?0.2?\fR
.sp
\fB::multiplexer::create\fR
.sp
\fB${multiplexer_instance}::Init\fR \fIport\fR
.sp
\fB${multiplexer_instance}::Config\fR \fIkey\fR \fIvalue\fR
.sp
\fB${multiplexer_instance}::AddFilter\fR \fIcmdprefix\fR
.sp
\fBcmdprefix\fR \fIdata\fR \fIchan\fR \fIclientaddress\fR \fIclientport\fR
.sp
\fB${multiplexer_instance}::AddAccessFilter\fR \fIcmdprefix\fR
.sp
\fBcmdprefix\fR \fIchan\fR \fIclientaddress\fR \fIclientport\fR
.sp
\fB${multiplexer_instance}::AddExitFilter\fR \fIcmdprefix\fR
.sp
\fBcmdprefix\fR \fIchan\fR \fIclientaddress\fR \fIclientport\fR
.sp
.BE
.SH DESCRIPTION
The \fBmultiplexer\fR package provides a generic system for one-to-many
communication utilizing sockets.  For example, think of a chat system
where one user sends a message which is then broadcast to all the
other connected users.
.PP
It is possible to have different multiplexers running concurrently.
.TP
\fB::multiplexer::create\fR
The \fBcreate\fR command creates a new multiplexer 'instance'.  For
example:
.CS

set mp [::multiplexer::create]
.CE
.IP
This instance can then be manipulated like so:
.CS

${mp}::Init 35100
.CE
.TP
\fB${multiplexer_instance}::Init\fR \fIport\fR
This starts the multiplexer listening on the specified port.
.TP
\fB${multiplexer_instance}::Config\fR \fIkey\fR \fIvalue\fR
Use \fBConfig\fR to configure the multiplexer instance.  Configuration
options currently include:
.RS
.TP
\fBsendtoorigin\fR
A boolean flag. If \fBtrue\fR, the sender will receive a copy of the
sent message.  Defaults to \fBfalse\fR.
.TP
\fBdebuglevel\fR
Sets the debug level to use for the multiplexer instance, according to
those specified by the \fBlogger\fR package (debug, info, notice,
warn, error, critical).
.RE
.TP
\fB${multiplexer_instance}::AddFilter\fR \fIcmdprefix\fR
Command to add a filter for data that passes through the multiplexer
instance.
The registered \fIcmdprefix\fR is called when data arrives at a
multiplexer instance. If there is more than one filter command
registered at the instance they will be called in the order of
registristation, and each filter will get the result of the preceding
filter as its argument. The first filter gets the incoming data as its
argument. The result returned by the last filter is the data which
will be broadcast to all clients of the multiplexer instance.
The command prefix is called as
.RS
.TP
\fBcmdprefix\fR \fIdata\fR \fIchan\fR \fIclientaddress\fR \fIclientport\fR
Takes the incoming \fIdata\fR, modifies it, and returns that as its
result. The last three arguments contain information about the client
which sent the data to filter: The channel connecting us to the
client, its ip-address, and its ip-port.
.RE
.TP
\fB${multiplexer_instance}::AddAccessFilter\fR \fIcmdprefix\fR
Command to add an access filter.
The registered \fIcmdprefix\fR is called when a new client socket
tries to connect to the multixer instance. If there is more than one
access filter command registered at the instance they will be called
in the order of registristation. If any of the called commands returns
\fB-1\fR the access to the multiplexer instance is denied and the
client channel is closed immediately. Any other result grants the
client access to the multiplexer instance.
The command prefix is called as
.RS
.TP
\fBcmdprefix\fR \fIchan\fR \fIclientaddress\fR \fIclientport\fR
The arguments contain information about the client which tries to
connected to the instance: The channel connecting us to the client,
its ip-address, and its ip-port.
.RE
.TP
\fB${multiplexer_instance}::AddExitFilter\fR \fIcmdprefix\fR
Adds filter to be run when client socket generates an EOF condition.
The registered \fIcmdprefix\fR is called when a client socket of the
multixer signals EOF. If there is more than one exit filter command
registered at the instance they will be called in the order of
registristation. Errors thrown by an exit filter are ignored, but
logged. Any result returned by an exit filter is ignored.
The command prefix is called as
.RS
.TP
\fBcmdprefix\fR \fIchan\fR \fIclientaddress\fR \fIclientport\fR
The arguments contain information about the client which signaled the
EOF: The channel connecting us to the client, its ip-address, and its
ip-port.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fImultiplexer\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
chat, multiplexer
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/namespacex/namespacex.n.







































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/namespacex/namespacex.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 200? Neil Madden (http://wiki.tcl.tk/12790)
'\" Copyright (c) 200? Various (http://wiki.tcl.tk/1489)
'\" Copyright (c) 2010 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "namespacex" n 0.1 tcllib "Namespace utility commands"
.BS
.SH NAME
namespacex \- Namespace utility commands
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBnamespacex  ?0.1?\fR
.sp
\fB::namespacex hook add\fR ?\fInamespace\fR? \fIcmdprefix\fR
.sp
\fB::namespacex hook proc\fR ?\fInamespace\fR? \fIarguments\fR \fIbody\fR
.sp
\fB::namespacex hook on\fR ?\fInamespace\fR? \fIguardcmdprefix\fR \fIactioncmdprefix\fR
.sp
\fB::namespacex hook next\fR \fIarg\fR...
.sp
\fB::namespacex info allchildren\fR \fInamespace\fR
.sp
\fB::namespacex info allvars\fR \fInamespace\fR
.sp
\fB::namespacex info vars\fR \fInamespace\fR ?\fIpattern\fR?
.sp
\fB::namespacex state get\fR \fInamespace\fR
.sp
\fB::namespacex state set\fR \fInamespace\fR \fIdict\fR
.sp
\fB::namespacex state drop\fR \fInamespace\fR
.sp
.BE
.SH DESCRIPTION
This package provides a number of utility commands for working with
namespaces.
.SH API
.TP
\fB::namespacex hook add\fR ?\fInamespace\fR? \fIcmdprefix\fR
.TP
\fB::namespacex hook proc\fR ?\fInamespace\fR? \fIarguments\fR \fIbody\fR
.TP
\fB::namespacex hook on\fR ?\fInamespace\fR? \fIguardcmdprefix\fR \fIactioncmdprefix\fR
.TP
\fB::namespacex hook next\fR \fIarg\fR...
.TP
\fB::namespacex info allchildren\fR \fInamespace\fR
This command returns a list containing the names of all child
namespaces in the specified \fInamespace\fR and its children. The
names are all fully qualified.
.TP
\fB::namespacex info allvars\fR \fInamespace\fR
This command returns a list containing the names of all variables in
the specified \fInamespace\fR and its children. The names are all
relative to \fInamespace\fR, and \fInot\fR fully qualified.
.TP
\fB::namespacex info vars\fR \fInamespace\fR ?\fIpattern\fR?
This command returns a list containing the names of all variables in
the specified \fInamespace\fR.
.TP
\fB::namespacex state get\fR \fInamespace\fR
This command returns a dictionary holding the names and values of all
variables in the specified \fInamespace\fR and its child namespaces.
.sp
Note that the names are all relative to \fInamespace\fR,
and \fInot\fR fully qualified.
.TP
\fB::namespacex state set\fR \fInamespace\fR \fIdict\fR
This command takes a dictionary holding the names and values for a set
of variables and replaces the current state of the specified
\fInamespace\fR and its child namespaces with this state.
The result of the command is the empty string.
.TP
\fB::namespacex state drop\fR \fInamespace\fR
This command unsets all variables in the specified \fInamespace\fR and
its child namespaces.
The result of the command is the empty string.
.PP
.SH KEYWORDS
extended namespace, info, namespace unknown, namespace utilities, state (de)serialization, unknown hooking, utilities
.SH COPYRIGHT
.nf
Copyright (c) 200? Neil Madden (http://wiki.tcl.tk/12790)
Copyright (c) 200? Various (http://wiki.tcl.tk/1489)
Copyright (c) 2010 Documentation, Andreas Kupries

.fi

Added embedded/man/files/modules/ncgi/ncgi.n.
















































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ncgi/ncgi.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ncgi" n 1.4.1 tcllib "CGI Support"
.BS
.SH NAME
ncgi \- Procedures to manipulate CGI values.
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBncgi  ?1.4.1?\fR
.sp
\fB::ncgi::cookie\fR \fIcookie\fR
.sp
\fB::ncgi::decode\fR \fIstr\fR
.sp
\fB::ncgi::empty\fR \fIname\fR
.sp
\fB::ncgi::exists\fR \fIname\fR
.sp
\fB::ncgi::encode\fR \fIstring\fR
.sp
\fB::ncgi::header\fR ?\fItype\fR? \fIargs\fR
.sp
\fB::ncgi::import\fR \fIcginame\fR ?\fItclname\fR?
.sp
\fB::ncgi::importAll\fR \fIargs\fR
.sp
\fB::ncgi::importFile\fR \fIcmd\fR \fIcginame\fR ?\fIfilename\fR?
.sp
\fB::ncgi::input\fR ?\fIfakeinput\fR? ?\fIfakecookie\fR?
.sp
\fB::ncgi::multipart\fR \fItype query\fR
.sp
\fB::ncgi::nvlist\fR
.sp
\fB::ncgi::names\fR
.sp
\fB::ncgi::parse\fR
.sp
\fB::ncgi::parseMimeValue\fR \fIvalue\fR
.sp
\fB::ncgi::query\fR
.sp
\fB::ncgi::redirect\fR \fIurl\fR
.sp
\fB::ncgi::reset\fR \fIquery type\fR
.sp
\fB::ncgi::setCookie\fR \fIargs\fR
.sp
\fB::ncgi::setDefaultValue\fR \fIkey defvalue\fR
.sp
\fB::ncgi::setDefaultValueList\fR \fIkey defvaluelist\fR
.sp
\fB::ncgi::setValue\fR \fIkey value\fR
.sp
\fB::ncgi::setValueList\fR \fIkey valuelist\fR
.sp
\fB::ncgi::type\fR
.sp
\fB::ncgi::urlStub\fR ?\fIurl\fR?
.sp
\fB::ncgi::value\fR \fIkey\fR ?\fIdefault\fR?
.sp
\fB::ncgi::valueList\fR \fIkey\fR ?\fIdefault\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBncgi\fR package provides commands that manipulate CGI
values.  These are values that come from Web forms and are processed
either by CGI scripts or web pages with embedded Tcl code.  Use the
\fBncgi\fR package to query these values, set and get cookies, and
encode and decode www-url-encoded values.
.PP
In the simplest case, a CGI script first calls \fB::ncgi::parse\fR and
then calls \fB::ncgi::value\fR to get different form values.  If a CGI
value is repeated, you should use \fB::ncgi::valueList\fR to get back
the complete list of values.
.PP
An alternative to \fB::ncgi::parse\fR is \fB::ncgi::input\fR, which
has semantics similar to Don Libes' \fBcgi_input\fR procedure.
\fB::ncgi::input\fR restricts repeated CGI values to have names that
end with "List".  In this case, \fB::ncgi::value\fR will return the
complete list of values, and \fB::ncgi::input\fR will raise errors if
it find repeated form elements without the right name.
.PP
The \fB::ncgi::reset\fR procedure can be used in test suites and Web
servers to initialize the source of the CGI values.  Otherwise the
values are read in from the CGI environment.
.PP
The complete set of procedures is described below.
.TP
\fB::ncgi::cookie\fR \fIcookie\fR
Return a list of values for \fIcookie\fR, if any.  It is possible that
more than one cookie with the same name can be present, so this
procedure returns a list.
.TP
\fB::ncgi::decode\fR \fIstr\fR
Decode strings in www-url-encoding, which represents special
characters with a %xx sequence, where xx is the character code in hex.
.TP
\fB::ncgi::empty\fR \fIname\fR
Returns 1 if the CGI variable \fIname\fR is not present or has the
empty string as its value.
.TP
\fB::ncgi::exists\fR \fIname\fR
The return value is a boolean. It returns \fB0\fR if the CGI
variable \fIname\fR is not present, and \fB1\fR otherwise.
.TP
\fB::ncgi::encode\fR \fIstring\fR
Encode \fIstring\fR into www-url-encoded format.
.TP
\fB::ncgi::header\fR ?\fItype\fR? \fIargs\fR
Output the CGI header to standard output.  This emits a Content-Type:
header and additional headers based on \fIargs\fR, which is a list of
header names and header values. The \fItype\fR defaults to
"text/html".
.TP
\fB::ncgi::import\fR \fIcginame\fR ?\fItclname\fR?
This creates a variable in the current scope with the value of the CGI
variable \fIcginame\fR.  The name of the variable is \fItclname\fR, or
\fIcginame\fR if \fItclname\fR is empty (default).
.TP
\fB::ncgi::importAll\fR \fIargs\fR
This imports several CGI variables as Tcl variables.  If \fIargs\fR is
empty, then every CGI value is imported.  Otherwise each CGI variable
listed in \fIargs\fR is imported.
.TP
\fB::ncgi::importFile\fR \fIcmd\fR \fIcginame\fR ?\fIfilename\fR?
This provides information about an uploaded file from a form input
field of type \fBfile\fR with name \fIcginame\fR.  \fIcmd\fR can be
one of \fB-server\fR \fB-client\fR, \fB-type\fR or
\fB-data\fR.
.RS
.TP
\fB-client\fR \fIcginame\fR
returns the filename as sent by the client.
.TP
\fB-type\fR \fIcginame\fR
returns the mime type of the uploaded file.
.TP
\fB-data\fR \fIcginame\fR
returns the contents of the file.
.TP
\fB-server\fR \fIcginame\fR \fIfilename\fR
writes the file contents to a local temporary file (or \fIfilename\fR
if supplied) and returns the name of the file. The caller is
responsible for deleting this file after use.
.RE
.TP
\fB::ncgi::input\fR ?\fIfakeinput\fR? ?\fIfakecookie\fR?
This reads and decodes the CGI values from the environment.  It
restricts repeated form values to have a trailing "List" in their
name.  The CGI values are obtained later with the \fB::ncgi::value\fR
procedure.
.TP
\fB::ncgi::multipart\fR \fItype query\fR
This procedure parses a multipart/form-data \fIquery\fR.  This is used
by \fB::ncgi::nvlist\fR and not normally called directly.  It returns
an alternating list of names and structured values.  Each structure
value is in turn a list of two elements.  The first element is
meta-data from the multipart/form-data structure.  The second element
is the form value.  If you use \fB::ncgi::value\fR you just get the
form value.  If you use \fB::ncgi::valueList\fR you get the structured
value with meta data and the value.
.sp
The \fItype\fR is the whole Content-Type, including the parameters
like \fIboundary\fR.  This returns a list of names and values that
describe the multipart data.  The values are a nested list structure
that has some descriptive information first, and the actual form value
second.  The descriptive information is list of header names and
values that describe the content.
.TP
\fB::ncgi::nvlist\fR
This returns all the query data as a name, value list.  In the case of
multipart/form-data, the values are structured as described in
\fB::ncgi::multipart\fR.
.TP
\fB::ncgi::names\fR
This returns all names found in the query data, as a list.
\fB::ncgi::multipart\fR.
.TP
\fB::ncgi::parse\fR
This reads and decodes the CGI values from the environment.  The CGI
values are obtained later with the \fB::ncgi::value\fR procedure.  IF
a CGI value is repeated, then you should use \fB::ncgi::valueList\fR
to get the complete list of values.
.TP
\fB::ncgi::parseMimeValue\fR \fIvalue\fR
This decodes the Content-Type and other MIME headers that have the
form of "primary value; param=val; p2=v2" It returns a list, where the
first element is the primary value, and the second element is a list
of parameter names and values.
.TP
\fB::ncgi::query\fR
This returns the raw query data.
.TP
\fB::ncgi::redirect\fR \fIurl\fR
Generate a response that causes a 302 redirect by the Web server.  The
\fIurl\fR is the new URL that is the target of the redirect.  The URL
will be qualified with the current server and current directory, if
necessary, to convert it into a full URL.
.TP
\fB::ncgi::reset\fR \fIquery type\fR
Set the query data and Content-Type for the current CGI session.  This
is used by the test suite and by Web servers to initialize the ncgi
module so it does not try to read standard input or use environment
variables to get its data.  If neither \fIquery\fR or \fItype\fR are
specified, then the \fBncgi\fR module will look in the standard
CGI environment for its data.
.TP
\fB::ncgi::setCookie\fR \fIargs\fR
Set a cookie value that will be returned as part of the reply.  This
must be done before \fB::ncgi::header\fR or \fB::ncgi::redirect\fR is
called in order for the cookie to be returned properly.  The
\fIargs\fR are a set of flags and values:
.RS
.TP
\fB-name\fR \fIname\fR
.TP
\fB-value\fR \fIvalue\fR
.TP
\fB-expires\fR \fIdate\fR
.TP
\fB-path\fR \fIpath restriction\fR
.TP
\fB-domain\fR \fIdomain restriction\fR
.RE
.TP
\fB::ncgi::setDefaultValue\fR \fIkey defvalue\fR
Set a CGI value if it does not already exists.  This affects future
calls to \fB::ncgi::value\fR (but not future calls to
\fB::ncgi::nvlist\fR).  If the CGI value already is present, then this
procedure has no side effects.
.TP
\fB::ncgi::setDefaultValueList\fR \fIkey defvaluelist\fR
Like \fB::ncgi::setDefaultValue\fR except that the value already has
list structure to represent multiple checkboxes or a multi-selection.
.TP
\fB::ncgi::setValue\fR \fIkey value\fR
Set a CGI value, overriding whatever was present in the CGI
environment already.  This affects future calls to \fB::ncgi::value\fR
(but not future calls to \fB::ncgi::nvlist\fR).
.TP
\fB::ncgi::setValueList\fR \fIkey valuelist\fR
Like \fB::ncgi::setValue\fR except that the value already has list
structure to represent multiple checkboxes or a multi-selection.
.TP
\fB::ncgi::type\fR
Returns the Content-Type of the current CGI values.
.TP
\fB::ncgi::urlStub\fR ?\fIurl\fR?
Returns the current URL, but without the protocol, server, and port.
If \fIurl\fR is specified, then it defines the URL for the current
session.  That value will be returned by future calls to
\fB::ncgi::urlStub\fR
.TP
\fB::ncgi::value\fR \fIkey\fR ?\fIdefault\fR?
Return the CGI value identified by \fIkey\fR.  If the CGI value is not
present, then the \fIdefault\fR value is returned instead. This value
defaults to the empty string.
.sp
If the form value \fIkey\fR is repeated, then there are two cases: if
\fB::ncgi::parse\fR was called, then \fB::ncgi::value\fR only returns
the first value associated with \fIkey\fR.  If \fB::ncgi::input\fR was
called, then \fB::ncgi::value\fR returns a Tcl list value and
\fIkey\fR must end in "List" (e.g., "skuList").  In the case of
multipart/form-data, this procedure just returns the value of the form
element.  If you want the meta-data associated with each form value,
then use \fB::ncgi::valueList\fR.
.TP
\fB::ncgi::valueList\fR \fIkey\fR ?\fIdefault\fR?
Like \fB::ncgi::value\fR, but this always returns a list of values
(even if there is only one value).  In the case of
multipart/form-data, this procedure returns a list of two elements.
The first element is meta-data in the form of a parameter, value list.
The second element is the form value.
.PP
.SH EXAMPLES
Uploading a file
.CS


HTML:
<html>
<form action="/cgi-bin/upload.cgi" method="POST" enctype="multipart/form-data">
Path: <input type="file" name="filedata"><br>
Name: <input type="text" name="filedesc"><br>
<input type="submit">
</form>
</html>

TCL: upload.cgi
#!/usr/local/bin/tclsh

::ncgi::parse
set filedata [::ncgi::value filedata]
set filedesc [::ncgi::value filedesc]

puts "<html> File uploaded at <a href=\\"/images/$filedesc\\">$filedesc</a> </html>"

set filename /www/images/$filedesc

set fh [open $filename w]
puts -nonewline $fh $filedata
close $fh

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIncgi\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
html
.SH KEYWORDS
CGI, cookie, form, html
.SH CATEGORY
CGI programming

Added embedded/man/files/modules/nmea/nmea.n.




























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/nmea/nmea.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006-2009, Aaron Faupell <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nmea" n 1.0.0 tcllib "NMEA protocol implementation"
.BS
.SH NAME
nmea \- Process NMEA data
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBnmea  ?1.0.0?\fR
.sp
\fB::nmea::input\fR \fIsentence\fR
.sp
\fB::nmea::open_port\fR \fIport\fR ?speed?
.sp
\fB::nmea::close_port\fR
.sp
\fB::nmea::configure_port\fR \fIsettings\fR
.sp
\fB::nmea::open_file\fR \fIfile\fR ?rate?
.sp
\fB::nmea::close_file\fR
.sp
\fB::nmea::do_line\fR
.sp
\fB::nmea::rate\fR
.sp
\fB::nmea::log\fR ?file?
.sp
\fB::nmea::checksum\fR \fIdata\fR
.sp
\fB::nmea::write\fR \fIsentence\fR \fIdata\fR
.sp
\fB::nmea::event\fR \fIsetence\fR ?command?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a standard interface for writing software which recieves
NMEA standard input data. It allows for reading data from COM ports, files,
or programmatic input. It also supports the checksumming and logging of incoming data.
After parsing, input is dispatched to user defined handler commands for processing.
To define a handler, see the \fBevent\fR command. There are no GPS specific functions
in this package. NMEA data consists of a sentence type, followed by a list of data.
.SH COMMANDS
.TP
\fB::nmea::input\fR \fIsentence\fR
Processes and dispatches the supplied sentence. If \fIsentence\fR contains no commas it is treated as a Tcl list, otherwise it must be standard comma delimited NMEA data, with an optional checksum and leading \fB$\fR.
.CS


nmea::input {$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39}
nmea::input [list GPGSA A 3 04 05  09 12 "" "" 24 "" "" ""  2.5 1.3 2.1]

.CE
.TP
\fB::nmea::open_port\fR \fIport\fR ?speed?
Open the specified COM port and read NMEA sentences when available. Port speed is set to
4800bps by default or to \fIspeed\fR.
.TP
\fB::nmea::close_port\fR
Close the com port connection if one is open.
.TP
\fB::nmea::configure_port\fR \fIsettings\fR
Changes the current port settings. \fIsettings\fR has the same format as fconfigure -mode.
.TP
\fB::nmea::open_file\fR \fIfile\fR ?rate?
Open file \fIfile\fR and read NMEA sentences, one per line, at the rate specified by ?rate? in milliseconds.
The file format may omit the leading \fB$\fR and/or the checksum. If rate is <= 0 (the default) then lines
will only be processed when a call to \fBdo_line\fR is made.
.TP
\fB::nmea::close_file\fR
Close the open file if one exists.
.TP
\fB::nmea::do_line\fR
If there is a currently open file, this command will read and process a single line from it.
Returns the number of lines read.
.TP
\fB::nmea::rate\fR
Sets the rate at which lines are processed from the open file, in milliseconds. The rate remains
consistant across files, there does not need to be a file currently open to use this command.
Set to 0 to disable automatic line processing.
.TP
\fB::nmea::log\fR ?file?
Starts or stops input logging. If a file name is specified then all NMEA data recieved on
the open port will be logged to the ?file? in append mode. If file is an empty string then
any logging will be stopped. If no file is specified then returns a boolean value indicating
if logging is currently enabled. Data written to the port by \fBwrite\fR,
data read from files, or input made using \fBinput\fR, is not logged.
.TP
\fB::nmea::checksum\fR \fIdata\fR
Returns the checksum of the supplied data.
.TP
\fB::nmea::write\fR \fIsentence\fR \fIdata\fR
If there is a currently open port, this command will write the specified sentence and data to the port
in proper NMEA checksummed format.
.TP
\fB::nmea::event\fR \fIsetence\fR ?command?
Registers a handler proc for a given NMEA \fIsentence\fR. There may be at most one handler per
sentence, any existing handler is replaced.
If no command is specified, returns the name of the current handler for the given \fIsetence\fR
or an empty string if none exists. In addition to the incoming sentences there are 2 builtin types,
EOF and DEFAULT. The handler for the DEFAULT setence is invoked if there is not a specific handler
for that sentence. The EOF handler is invoked when End Of File is reached on the open file or port.
.sp
The handler procedures, with the exception of the builtin types,must take exactly one argument,
which is a list of the data values.
The DEFAULT handler should have two arguments, the sentence type and the data values.
The EOF handler has no arguments.
.CS


nmea::event gpgsa parse_sat_detail
nmea::event default handle_unknown

proc parse_sat_detail {data} {
    puts [lindex $data 1]
}

proc handle_unknown {name data} {
    puts "unknown data type $name"
}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fInmea\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
gps, nmea
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2006-2009, Aaron Faupell <[email protected]>

.fi

Added embedded/man/files/modules/nns/nns_auto.n.






















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/nns/nns_auto.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nameserv::auto" n 0.3 tcllib "Name service facility"
.BS
.SH NAME
nameserv::auto \- Name service facility, Client Extension
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBnameserv::auto  ?0.3?\fR
.sp
package require \fBnameserv \fR
.sp
.BE
.SH DESCRIPTION
Please read the document \fIName service facility, introduction\fR
first.
.PP
This package provides the \fIexact\fR same API as is provided by
package \fBnameserv\fR, i.e the regular name service client. It
differs from the former by taking measures to ensure that longer-lived
data, i.e. bound names, continuous and unfulfilled async searches,
survive the loss of the connection to the name server as much as is
possible.
.PP
This means that the bound names and continuous and unfulfilled async
searches are remembered client-side and automatically re-entered into
the server when the connection comes back after its loss. For bound
names there is one important limitation to such restoration: It is
possible that a name of this client was bound by a different client
while the connection was gone. Such names are fully lost, and the best
the package can and will do is to inform the user of this.
.SH API
The user-visible API is mainly identical the API of \fBnameserv\fR
and is therefore not described here. Please read the documentation of
\fBnameserv\fR.
.PP
The differences are explained in the sections \fBOPTIONS\fR and
\fBEVENTS\fR.
.SH OPTIONS
This package supports all the option of package \fBnameserv\fR,
and one more. The additional option allows the user to specifies the
time interval between attempts to restore a lost connection.
.TP
\fB-delay\fR \fImilliseconds\fR
The value of this option is an integer value > 0 which specifies the
interval to wait between attempts to restore a lost connection, in
milliseconds. The default value is \fB1000\fR, i.e. one second.
.PP
.SH EVENTS
This package generates all of the events of package \fBnameserv\fR,
and two more. Both events are generated for the tag \fInameserv\fR.
.TP
\fIlost-name\fR
This event is generated when a bound name is truly lost, i.e. could
not be restored after the temporary loss of the connection to the name
server. It indicates that a different client took ownership of the
name while this client was out of contact.
.sp
The detail information of the event will be a Tcl dictionary
containing two keys, \fBname\fR, and \fBdata\fR. Their values hold
all the information about the lost name.
.TP
\fIre-connection\fR
This event is generated when the connection to the server is
restored. The remembered data has been restored when the event is
posted.
.sp
The event has no detail information.
.PP
.SH DESIGN
The package is implemented on top of the regular nameservice client,
i.e.  package \fBnameserv\fR. It detects the loss of the
connection by listening for \fIlost-connection\fR events, on the tag
\fInameserv\fR.
.PP
It reacts to such events by starting a periodic timer and trying to
reconnect to the server whenver this timer triggers. On success the
timer is canceled, a \fIre-connection\fR event generated, and the
package proceeds to re-enter the remembered bound names and continous
searches.
.PP
Another loss of the connection, be it during or after re-entering the
remembered information simply restarts the timer and subsequent
reconnection attempts.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
nameserv(n)
.SH KEYWORDS
automatic, client, name service, reconnect, restore
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2007-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/nns/nns_client.n.













































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/nns/nns_client.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nameserv" n 0.4.2 tcllib "Name service facility"
.BS
.SH NAME
nameserv \- Name service facility, Client
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBnameserv  ?0.4.2?\fR
.sp
package require \fBcomm \fR
.sp
package require \fBlogger \fR
.sp
\fB::nameserv::bind\fR \fIname\fR \fIdata\fR
.sp
\fB::nameserv::release\fR
.sp
\fB::nameserv::search\fR ?\fB-async\fR|\fB-continuous\fR? ?\fIpattern\fR?
.sp
\fB::nameserv::protocol\fR
.sp
\fB::nameserv::server_protocol\fR
.sp
\fB::nameserv::server_features\fR
.sp
\fB::nameserv::cget\fR \fB-option\fR
.sp
\fB::nameserv::configure\fR
.sp
\fB::nameserv::configure\fR \fB-option\fR
.sp
\fB::nameserv::configure\fR \fB-option\fR \fIvalue\fR...
.sp
\fB$result\fR \fBdestroy\fR
.sp
\fB$result\fR \fBfilled\fR
.sp
\fB$result\fR \fBget\fR \fIname\fR
.sp
\fB$result\fR \fBnames\fR
.sp
\fB$result\fR \fBsize\fR
.sp
\fB$result\fR \fBgetall\fR ?\fIpattern\fR?
.sp
.BE
.SH DESCRIPTION
Please read \fIName service facility, introduction\fR first.
.PP
This package provides a client for the name service facility
implemented by the package \fBnameserv::server\fR.
.PP
This service is built in top of and for the package \fBcomm\fR.
It has nothing to do with the Internet's Domain Name System. If the
reader is looking for a package dealing with that please see Tcllib's
packages \fBdns\fR and \fBresolv\fR.
.SH API
The package exports eight commands, as specified below:
.TP
\fB::nameserv::bind\fR \fIname\fR \fIdata\fR
The caller of this command registers the given \fIname\fR as its name
in the configured name service, and additionally associates a piece of
\fIdata\fR with it. The service does nothing with this information
beyond storing it and delivering it as part of search results. The
meaning is entirely up to the applications using the name service.
.sp
A generally useful choice would for example be an identifier for a
communication endpoint managed by the package \fBcomm\fR. Anybody
retrieving the name becomes immediately able to talk to this endpoint,
i.e. the registering application.
.sp
Of further importance is that a caller can register itself under more
than one name, and each name can have its own piece of \fIdata\fR.
.sp
Note that the name service, and thwerefore this command, will throw an
error if the chosen name is already registered.
.TP
\fB::nameserv::release\fR
Invoking this command releases all names (and their data) registered
by all previous calls to \fB::nameserv::bind\fR of this client. Note
that the name service will run this command implicitly when it loses
the connection to this client.
.TP
\fB::nameserv::search\fR ?\fB-async\fR|\fB-continuous\fR? ?\fIpattern\fR?
This command searches the name service for all registered names
matching the specified glob-\fIpattern\fR. If not specified the
pattern defaults to \fB*\fR, matching everything. The result of the
command is a dictionary mapping the matching names to the data
associated with them at \fIbind\fR-time.
.sp
If either option \fB-async\fR or \fB-continuous\fR were
specified the result of this command changes and becomes the Tcl
command of an object holding the actual result.
These two options are supported if and only if the service the client
is connected to supports the protocol feature
\fISearch/Continuous\fR.
.sp
For \fB-async\fR the result object is asynchronously filled with
the entries matching the pattern at the time of the search and then
not modified any more.
The option \fB-continuous\fR extends this behaviour by additionally
continuously monitoring the service for the addition and removal of
entries which match the pattern, and updating the object's contents
appropriately.
.sp
\fINote\fR that the caller is responsible for configuring the object
with a callback for proper notification when the current result (or
further changes) arrive.
.sp
For more information about this object see section
\fBASYNCHRONOUS AND CONTINUOUS SEARCHES\fR.
.TP
\fB::nameserv::protocol\fR
This command returns the highest version of the name service protocol
supported by the package.
.TP
\fB::nameserv::server_protocol\fR
This command returns the highest version of the name service protocol
supported by the name service the client is currently connected to.
.TP
\fB::nameserv::server_features\fR
This command returns a list containing the names of the features of
the name service protocol which are supported by the name service the
client is currently connected to.
.TP
\fB::nameserv::cget\fR \fB-option\fR
This command returns the currently configured value for the specified
\fB-option\fR. The list of supported options and their meaning can
be found in section \fBOPTIONS\fR.
.TP
\fB::nameserv::configure\fR
In this form the command returns a dictionary of all supported
options, and their current values. The list of supported options and
their meaning can be found in section \fBOPTIONS\fR.
.TP
\fB::nameserv::configure\fR \fB-option\fR
In this form the command is an alias for
"\fB::nameserv::cget\fR \fB-option\fR]".
The list of supported options and their meaning can be found in
section \fBOPTIONS\fR.
.TP
\fB::nameserv::configure\fR \fB-option\fR \fIvalue\fR...
In this form the command is used to configure one or more of the
supported options. At least one option has to be specified, and each
option is followed by its new value.
The list of supported options and their meaning can be found in
section \fBOPTIONS\fR.
.sp
This form can be used only as long as the client has not contacted the
name service yet. After contact has been made reconfiguration is not
possible anymore. This means that this form of the command is for the
initalization of the client before it use.
The command forcing a contact with the name service are
.RS
.TP
\fBbind\fR
.TP
\fBrelease\fR
.TP
\fBsearch\fR
.TP
\fBserver_protocol\fR
.TP
\fBserver_features\fR
.RE
.PP
.SH "CONNECTION HANDLING"
The client automatically connects to the service when one of the
commands below is run for the first time, or whenever one of the
commands is run after the connection was lost, when it was lost.
.PP
.TP
\fBbind\fR
.TP
\fBrelease\fR
.TP
\fBsearch\fR
.TP
\fBserver_protocol\fR
.TP
\fBserver_features\fR
.PP
.PP
Since version 0.2 of the client it will generate an event when the
connection is lost, allowing higher layers to perform additional
actions. This is done via the support package \fBuevent\fR. This
and all other name service related packages hereby reserve the
uevent-tag \fInameserv\fR. All their events will be posted to that
tag.
.SH EVENTS
This package generates only one event, \fIlost-connection\fR. The
detail information provided to that event is a Tcl dictionary. The
only key contained in the dictionnary is \fBreason\fR, and its value
will be a string describing why the connection was lost.
This string is supplied by the underlying communication package,
i.e. \fBcomm\fR.
.SH OPTIONS
The options supported by the client are for the specification of which
name service to contact, i.e. of the location of the name service.
They are:
.TP
\fB-host\fR \fIname\fR|\fIipaddress\fR
This option specifies the host name service to contact is running on,
either by \fIname\fR, or by \fIipaddress\fR. The initial default is
\fBlocalhost\fR, i.e. it is expected to contact a name service
running on the same host as the application using this package.
.TP
\fB-port\fR \fInumber\fR
This option specifies the port the name service to contact is
listening on. It has to be a positive integer number (> 0) not greater
than 65536 (unsigned short). The initial default is the number
returned by the command \fB::nameserv::common::port\fR, as provided by
the package \fB::nameserv::common\fR.
.PP
.SH "ASYNCHRONOUS AND CONTINUOUS SEARCHES"
Asynchronous and continuous searches are invoked by using either
option \fB-async\fR or \fB-continuous\fR as argument to the
command \fB::nameserv::search\fR.
.PP
\fINote\fR that these two options are supported if and only if the
service the client is connected to supports the protocol feature
\fISearch/Continuous\fR. The service provided by the package
\fB::nameserv::server\fR does this since version 0.3.
.PP
For such searches the result of the search command is the Tcl command
of an object holding the actual result. The API provided by these
objects is:
.TP
Options:
.RS
.TP
\fB-command\fR \fIcommand_prefix\fR
This option has to be set if a user of the result object wishes to get
asynchronous notifications when the search result or changes to it
arrive.
.sp
\fINote\fR that while it is possible to poll for the arrival of the
initial search result via the method \fBfilled\fR, and for
subsequent changes by comparing the output of method \fBgetall\fR
against a saved copy, this is not the recommended behaviour. Setting
the \fB-command\fR callback and processing the notifications as
they arrive is much more efficient.
.sp
The \fIcommand_prefix\fR is called with two arguments, the type of
change, and the data of the change. The type is either \fBadd\fR or
\fBremove\fR, indicating new data, or deleted data, respectively.
The data of the change is always a dictionary listing the
added/removed names and their associated data.
.sp
The first change reported for a search is always the set of matching
entries at the time of the search.
.RE
.TP
Methods:
.RS
.TP
\fB$result\fR \fBdestroy\fR
Destroys the object and cancels any continuous monitoring of the
service the object may have had active.
.TP
\fB$result\fR \fBfilled\fR
The result is a boolean value indicating whether the search result has
already arrived (\fBTrue\fR), or not (\fBFalse\fR).
.TP
\fB$result\fR \fBget\fR \fIname\fR
Returns the data associated with the given \fIname\fR at
\fIbind\fR-time.
.TP
\fB$result\fR \fBnames\fR
Returns a list containing all names known to the object at the time of
the invokation.
.TP
\fB$result\fR \fBsize\fR
Returns an integer value specifying the size of the result at the time
of the invokation.
.TP
\fB$result\fR \fBgetall\fR ?\fIpattern\fR?
Returns a dictionary containing the search result at the time of the
invokation, mapping the matching names to the data associated with
them at \fIbind\fR-time.
.RE
.PP
.SH HISTORY
.TP
0.3.1
Fixed SF Bug 1954771.
.TP
0.3
Extended the client with the ability to perform asynchronous and
continuous searches.
.TP
0.2
Extended the client with the ability to generate events when it loses
its connection to the name service. Based on package \fBuevent\fR.
.TP
0.1
Initial implementation of the client.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
nameserv::common(n), nameserv::server(n)
.SH KEYWORDS
client, name service
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2007-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/nns/nns_common.n.



































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/nns/nns_common.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nameserv::common" n 0.1 tcllib "Name service facility"
.BS
.SH NAME
nameserv::common \- Name service facility, shared definitions
.SH SYNOPSIS
package require \fBTcl  8\fR
.sp
package require \fBnameserv::common  ?0.1?\fR
.sp
\fB::nameserv::common::port\fR
.sp
.BE
.SH DESCRIPTION
Please read \fIName service facility, introduction\fR first.
.PP
This package is internal and of no interest to users. It provides the
commands of the name service facility which are shared by the client
and server implemented by the packages \fBnameserv::server\fR and
\fBnameserv\fR (the client).
.PP
This service is built in top of and for the package \fBcomm\fR.
It has nothing to do with the Internet's Domain Name System. If the
reader is looking for a package dealing with that please see Tcllib's
packages \fBdns\fR and \fBresolv\fR.
.SH API
The package exports a single command, as specified below:
.TP
\fB::nameserv::common::port\fR
The result returned by the command is the id of the default TCP/IP
port a nameservice server will listen on, and a name service client
will try to connect to.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
nameserv::client(n), nameserv::server(n)
.SH KEYWORDS
client, name service, server
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2007-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/nns/nns_intro.n.


















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/nns/nns_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nns_intro" n 1.0 tcllib "Name service facility"
.BS
.SH NAME
nns_intro \- Name service facility, introduction
.SH DESCRIPTION
.PP
\fInns\fR (short for \fInano nameservice\fR) is a facility built
for the package \fBcomm\fR, adding a simple name service to it.
It is also built on top of \fBcomm\fR, using it for the exchange
of messages between the client and server parts.
.PP
This name service facility has nothing to do with the Internet's
\fIDomain Name System\fR, otherwise known as \fIDNS\fR. If the
reader is looking for a package dealing with that please see either of
the packages \fBdns\fR and \fBresolv\fR, both found in Tcllib
too.
.PP
Tcllib provides 2 applications and 4 packages which are working
together and provide access to the facility at different levels.
.SH APPLICATIONS
The application \fBnnsd\fR provides a simple name server which can
be run by anybody anywhere on their system, as they see fit.
It is also an example on the use of the server-side package
\fBnameserv::server\fR.
.PP
Complementing this server is the \fBnns\fR client application.
A possible, but no very sensible use would be to enter name/port
bindings into a server from a shell script. Not sensible, as shell
scripts normally do not provide a \fBcomm\fR-based service.
.PP
The only case for this to make some sense would be in a shell script
wrapped around a Tcl script FOO which is using comm, to register the
listening port used by FOO.
However even there it would much more sensible to extend FOO to use
the nameservice directly. And in regard on how to that \fBnns\fR
can be used as both example and template.
Beyond that it may also be useful to perform nameservice queries from
shell scripts.
.PP
The third application, \fBnnslog\fR is a stripped down form of the
\fBnns\fR client application. It is reduced to perform a continuous
search for all changes and logs all received events to stdout.
.PP
Both clients use the \fBnameserv::auto\fR package to automatically
hande the loss and restoration of the connection to the server.
.SH PACKAGES
The two main packages implementing the service are \fBnameserv\fR
and \fBnameserv::server\fR, i.e. client and server. The latter has
not much of an API, just enough to start, stop, and configure it. See
the application \fBnnsd\fR on how to use it.
.PP
The basic client, in package \fBnameserv\fR, provides the main API
to manipulate and query the service. An example of its use is the
application \fBnns\fR.
.PP
The second client package, \fBnameserv::auto\fR is API compatible
to the basic client, but provides the additional functionality that it
will automatically restore data like bound names when the connection
to the name service was lost and then reestablished. I.e. it
automatically detects the loss of the server and re-enters the data
when the server comes back.
.PP
The package \fBnameserv::common\fR is of no interest to users. It
is an internal package containing code and definitions common to the
packages \fBnameserv\fR and \fBnameserv::server\fR.
.PP
All packages use the \fBuevent\fR package for the reporting of
special circumstances via events, and reserve the uevent-tag
\fInameserv\fR for their exclusive use. All their events will be
posted to that tag.
.SH INTERNALS
The document \fIName service facility, client/server protocol\fR
specifies the protocol used by the packages \fBnameserv\fR and
\fBnameserv::server\fR to talk to each other. It is of no interest
to users of either the packages or applications.
.PP
Developers wishing to modify and/or extend or to just understand the
internals of the nameservice facility however are strongly advised to
read it.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
Please also report any ideas for enhancements you may have.
.SH "SEE ALSO"
nameserv(n), nameserv::auto(n), nameserv::common(n), nameserv::protocol(n), nameserv::server(n), nnsd(n), nss(n)
.SH KEYWORDS
client, name service, server
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/nns/nns_protocol.n.














































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/nns/nns_protocol.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nameserv::protocol" n 0.1 tcllib "Name service facility"
.BS
.SH NAME
nameserv::protocol \- Name service facility, client/server protocol
.SH SYNOPSIS
\fBBind\fR \fIname\fR \fIdata\fR
.sp
\fBRelease\fR
.sp
\fBSearch\fR \fIpattern\fR
.sp
\fBProtocolVersion\fR
.sp
\fBProtocolFeatures\fR
.sp
\fBSearch/Continuous/Start\fR \fItag\fR \fIpattern\fR
.sp
\fBSearch/Continuous/Stop\fR \fItag\fR
.sp
\fBSearch/Continuous/Change\fR \fItag\fR \fBadd\fR|\fBremove\fR \fIresponse\fR
.sp
.BE
.SH DESCRIPTION
The packages \fBnameserv::server\fR, \fBnameserv\fR, and
\fBnameserv::common\fR provide a simple unprotected name service
facility for use in small trusted environments.
.PP
Please read \fIName service facility, introduction\fR first.
.PP
This document contains the specification of the network protocol which
is used by client and server to talk to each other, enabling
implementations of the same protocol in other languages.
.SH "NANO NAME SERVICE PROTOCOL VERSION 1"
This protocol defines the basic set of messages to be supported by a
name service, also called the \fICore\fR feature.
.SS "BASIC LAYER"
The basic communication between client and server is done using the
remote-execution protocol specified by the Tcl package \fBcomm\fR.
The relevant document specifying its on-the-wire protocol can be found
in \fIcomm_wire\fR.
.PP
All the scripts exchanged via this protocol are single commands in
list form and thus can be interpreted as plain messages instead of as
Tcl commands. The commands/messages specified in the next section are
the only commands understood by the server-side. Command and variable
substitutions are not allowed within the messages, i.e. arguments have
to be literal values.
.PP
The protocol is synchronous. I.e. for each message sent a response is
expected, and has to be generated. All messages are sent by the client.
The server does not sent messages, only responses to messages.
.SS "MESSAGE LAYER"
.TP
\fBBind\fR \fIname\fR \fIdata\fR
The client sends this message when it registers itself at the service
with a \fIname\fR and some associated \fIdata\fR. The server has to
send an error response if the \fIname\fR is already in use. Otherwise
the response has to be an empty string.
.sp
The server has to accept multiple names for the same client.
.TP
\fBRelease\fR
The client sends this message to unregister all names it is known
under at the service. The response has to be an empty string, always.
.TP
\fBSearch\fR \fIpattern\fR
The client sends this message to search the service for names matching
the glob-\fIpattern\fR. The response has to be a dictionary containing
the matching names as keys, and mapping them to the data associated
with it at \fBBind\fR-time.
.TP
\fBProtocolVersion\fR
The client sends this message to query the service for the highest
version of the name service protocol it supports. The response has to
be a positive integer number.
.sp
Servers supporting only \fINano Name Service Protocol Version 1\fR
have to return \fB1\fR.
.TP
\fBProtocolFeatures\fR
The client sends this message to query the service for the features of
the name service protocol it supports. The response has to be a
list containing feature names.
.sp
Servers supporting only \fINano Name Service Protocol Version 1\fR
have to return \fB{Core}\fR.
.PP
.SH "NANO NAME SERVICE PROTOCOL EXTENSION: CONTINUOUS SEARCH"
This protocol defines an extended set of messages to be supported by a
name service, also called the \fISearch/Continuous\fR feature. This
feature defines additional messages between client and server, and is
otherwise identical to version 1 of the protocol. See the last section
for the details of our foundation.
.PP
A service supporting this feature has to put the feature name
\fBSearch/Continuous\fR into the list of features returned by the
message \fIProtocolFeatures\fR.
.PP
For this extension the protocol is asynchronous. No direct response is
expected for any of the messages in the extension. Furthermore the
server will start sending messages on its own, instead of only
responses to messages, and the client has to be able to handle these
notifications.
.TP
\fBSearch/Continuous/Start\fR \fItag\fR \fIpattern\fR
The client sends this message to start searching the service for names
matching the glob-\fIpattern\fR.
In contrast to the regular \fISearch\fR request this one asks the
server to continuously monitor the database for the addition and
removal of matching entries and to notify the client of all such
changes. The particular search is identified by the \fItag\fR.
.sp
No direct response is expected, rather the clients expect to be
notified of changes via explicit \fISearch/Continuous/Result\fR
messages generated by the service.
.sp
It is further expected that the \fItag\fR information is passed
unchanged to the \fISearch/Continuous/Result\fR messages. This
tagging of the results enables clients to start multiple searches and
distinguish between the different results.
.TP
\fBSearch/Continuous/Stop\fR \fItag\fR
The client sends this message to stop the continuous search identified
by the \fItag\fR.
.TP
\fBSearch/Continuous/Change\fR \fItag\fR \fBadd\fR|\fBremove\fR \fIresponse\fR
This message is sent by the service to clients with active continuous
searches to transfer found changes. The first such message for a new
continuous search has to contains the current set of matching entries.
.sp
To ensure this a service has to generate an \fBadd\fR-message with
an empty \fIresponse\fR if there were no matching entries at the time.
.sp
The \fIresponse\fR has to be a dictionary containing the matching
names as keys, and mapping them to the data associated with it at
\fBBind\fR-time.
The argument coming before the response tells the client whether the
names in the response were added or removed from the service.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
comm_wire(n), nameserv(n), nameserv::server(n)
.SH KEYWORDS
comm, name service, protocol
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2007-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/nns/nns_server.n.































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/nns/nns_server.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nameserv::server" n 0.3.2 tcllib "Name service facility"
.BS
.SH NAME
nameserv::server \- Name service facility, Server
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBnameserv::server  ?0.3.2?\fR
.sp
package require \fBcomm \fR
.sp
package require \fBinterp \fR
.sp
package require \fBlogger \fR
.sp
\fB::nameserv::server::start\fR
.sp
\fB::nameserv::server::stop\fR
.sp
\fB::nameserv::server::active?\fR
.sp
\fB::nameserv::server::cget\fR \fB-option\fR
.sp
\fB::nameserv::server::configure\fR
.sp
\fB::nameserv::server::configure\fR \fB-option\fR
.sp
\fB::nameserv::server::configure\fR \fB-option\fR \fIvalue\fR...
.sp
.BE
.SH DESCRIPTION
Please read \fIName service facility, introduction\fR first.
.PP
This package provides an implementation of the serviver side of the
name service facility queried by the client provided by the package
\fBnameserv\fR. All information required by the server will be
held in memory. There is no persistent state.
.PP
This service is built in top of and for the package \fBcomm\fR.
It has nothing to do with the Internet's Domain Name System. If the
reader is looking for a package dealing with that please see Tcllib's
packages \fBdns\fR and \fBresolv\fR.
.PP
This server supports the \fICore\fR protocol feature, and since
version 0.3 the \fISearch/Continuous\fR feature as well.
.SH API
The package exports five commands, as specified below:
.TP
\fB::nameserv::server::start\fR
This command starts the server and causes it to listen on the
configured port. From now on clients are able to connect and make
requests. The result of the command is the empty string.
.sp
Note that any incoming requests will only be handled if the
application the server is part of does enter an event loop after this
command has been run.
.TP
\fB::nameserv::server::stop\fR
Invoking this command stops the server and releases all information it
had. Existing connections are shut down, and no new connections will
be accepted any longer. The result of the command is the empty string.
.TP
\fB::nameserv::server::active?\fR
This command returns a boolean value indicating the state of the
server. The result will be \fBtrue\fR if the server is active,
i.e. has been started, and \fBfalse\fR otherwise.
.TP
\fB::nameserv::server::cget\fR \fB-option\fR
This command returns the currently configured value for the specified
\fB-option\fR. The list of supported options and their meaning can
be found in section \fBOPTIONS\fR.
.TP
\fB::nameserv::server::configure\fR
In this form the command returns a dictionary of all supported
options, and their current values. The list of supported options and
their meaning can be found in section \fBOPTIONS\fR.
.TP
\fB::nameserv::server::configure\fR \fB-option\fR
In this form the command is an alias for
"\fB::nameserv::server::cget\fR \fB-option\fR]".
The list of supported options and their meaning can be found in
section \fBOPTIONS\fR.
.TP
\fB::nameserv::server::configure\fR \fB-option\fR \fIvalue\fR...
In this form the command is used to configure one or more of the
supported options. At least one option has to be specified, and each
option is followed by its new value.
The list of supported options and their meaning can be found in
section \fBOPTIONS\fR.
.sp
This form can be used only if the server is not active, i.e. has not
been started yet, or has been stopped. While the server is active it
cannot be reconfigured.
.PP
.SH OPTIONS
The options supported by the server are for the specification of the
TCP port to listen on, and whether to accept non-local connections or
not.
They are:
.TP
\fB-localonly\fR \fIbool\fR
This option specifies whether to accept only local connections
(-localonly 1) or remote connections as well (-localonly 0). The
default is to accept only local connections.
.TP
\fB-port\fR \fInumber\fR
This option specifies the port the name service will listen on after
it has been started. It has to be a positive integer number (> 0) not
greater than 65536 (unsigned short). The initial default is the number
returned by the command \fB::nameserv::server::common::port\fR, as
provided by the package \fB::nameserv::server::common\fR.
.PP
.SH HISTORY
.TP
0.3
Extended the server with the ability to perform asynchronous and
continuous searches.
.TP
0.2
Changed name of -local switch to -localonly.
.TP
0.1
Initial implementation of the server.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fInameserv\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
nameserv::client(n), nameserv::common(n)
.SH KEYWORDS
name service, server
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2007-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/nntp/nntp.n.





































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/nntp/nntp.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "nntp" n 1.5.1 tcllib "Tcl NNTP Client Library"
.BS
.SH NAME
nntp \- Tcl client for the NNTP protocol
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBnntp  ?0.2.1?\fR
.sp
\fB::nntp::nntp\fR ?\fIhost\fR? ?\fIport\fR? ?\fInntpName\fR?
.sp
\fInntpName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fInntpName\fR \fBarticle\fR ?\fImsgid\fR?
.sp
\fInntpName\fR \fBauthinfo\fR ?\fIuser\fR? ?\fIpass\fR?
.sp
\fInntpName\fR \fBbody\fR ?\fImsgid\fR?
.sp
\fInntpName\fR \fBconfigure\fR
.sp
\fInntpName\fR \fBconfigure\fR \fIoption\fR
.sp
\fInntpName\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR ...
.sp
\fInntpName\fR \fBcget\fR \fIoption\fR
.sp
\fInntpName\fR \fBdate\fR
.sp
\fInntpName\fR \fBgroup\fR ?\fIgroup\fR?
.sp
\fInntpName\fR \fBhead\fR ?\fImsgid\fR?
.sp
\fInntpName\fR \fBhelp\fR
.sp
\fInntpName\fR \fBlast\fR
.sp
\fInntpName\fR \fBlist\fR
.sp
\fInntpName\fR \fBlistgroup\fR ?\fIgroup\fR?
.sp
\fInntpName\fR \fBmode_reader\fR
.sp
\fInntpName\fR \fBnewgroups\fR \fIsince\fR
.sp
\fInntpName\fR \fBnewnews\fR
.sp
\fInntpName\fR \fBnewnews\fR \fIsince\fR
.sp
\fInntpName\fR \fBnewnews\fR \fIgroup\fR ?\fIsince\fR?
.sp
\fInntpName\fR \fBnext\fR
.sp
\fInntpName\fR \fBpost\fR \fIarticle\fR
.sp
\fInntpName\fR \fBslave\fR
.sp
\fInntpName\fR \fBstat\fR ?\fImsgid\fR?
.sp
\fInntpName\fR \fBquit\fR
.sp
\fInntpName\fR \fBxgtitle\fR ?\fIgroup_pattern\fR?
.sp
\fInntpName\fR \fBxhdr\fR \fIfield\fR ?\fIrange\fR?
.sp
\fInntpName\fR \fBxover\fR ?\fIrange\fR?
.sp
\fInntpName\fR \fBxpat\fR \fIfield\fR \fIrange\fR ?\fIpattern_list\fR?
.sp
.BE
.SH DESCRIPTION
The package \fBnntp\fR provides a simple Tcl-only client library
for the NNTP protocol.  It works by opening the standard NNTP socket
on the server, and then providing a Tcl API to access the NNTP
protocol commands.  All server errors are returned as Tcl errors
(thrown) which must be caught with the Tcl \fBcatch\fR command.
.SH COMMANDS
.TP
\fB::nntp::nntp\fR ?\fIhost\fR? ?\fIport\fR? ?\fInntpName\fR?
The command opens a socket connection to the specified NNTP server and
creates a new nntp object with an associated global Tcl command whose
name is \fInntpName\fR. This command may be used to access the various
NNTP protocol commands for the new connection. The default \fIport\fR
number is "119" and the default \fIhost\fR is "news". These defaults
can be overridden with the environment variables \fBNNTPPORT\fR and
\fBNNTPHOST\fR respectively.
.sp
Some of the commands supported by this package are not part of the
nntp rfc 977 (\fIhttp://www.rfc-editor.org/rfc/rfc977.txt\fR) and will
not be available (or implemented) on all nntp servers.
.sp
The access command \fInntpName\fR has the following general form:
.RS
.TP
\fInntpName\fR \fBmethod\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.RE
.TP
\fInntpName\fR \fBarticle\fR ?\fImsgid\fR?
Query the server for article \fImsgid\fR from the current group.  The article
is returned as a valid tcl list which contains the headers, followed by
a blank line, and then followed by the body of the article. Each element
in the list is one line of the article.
.TP
\fInntpName\fR \fBauthinfo\fR ?\fIuser\fR? ?\fIpass\fR?
Send authentication information (username and password) to the server.
.TP
\fInntpName\fR \fBbody\fR ?\fImsgid\fR?
Query the server for the body of the article \fImsgid\fR from the current
group.  The body of the article is returned as a valid tcl list. Each element
in the list is one line of the body of the article.
.TP
\fInntpName\fR \fBconfigure\fR
.TP
\fInntpName\fR \fBconfigure\fR \fIoption\fR
.TP
\fInntpName\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR ...
.TP
\fInntpName\fR \fBcget\fR \fIoption\fR
Query and configure options of the nntp connection object. Currently
only one option is supported, \fB-binary\fR. When set articles are
retrieved as binary data instead of text. The only methods affected by
this are \fBarticle\fR and \fBbody\fR.
.sp
One application of this option would be the download of articles
containing yEnc encoded images. Although encoded the data is still
mostly binary and retrieving it as text will corrupt the information.
.sp
See package \fByencode\fR for both encoder and decoder of such data.
.TP
\fInntpName\fR \fBdate\fR
Query the server for the servers current date.  The date is returned in the
format \fIYYYYMMDDHHMMSS\fR.
.TP
\fInntpName\fR \fBgroup\fR ?\fIgroup\fR?
Optionally set the current group, and retrieve information about the
currently selected group.  Returns the estimated number of articles in
the group followed by the number of the first article in the group, followed
by the last article in the group, followed by the name of the group.
.TP
\fInntpName\fR \fBhead\fR ?\fImsgid\fR?
Query the server for the headers of the article \fImsgid\fR from the current
group.  The headers of the article are returned as a valid tcl list. Each element
in the list is one line of the headers of the article.
.TP
\fInntpName\fR \fBhelp\fR
Retrieves a list of the commands that are supported by the news server that
is currently attached to.
.TP
\fInntpName\fR \fBlast\fR
Sets the current article pointer to point to the previous message (if there is
one) and returns the msgid of that message.
.TP
\fInntpName\fR \fBlist\fR
Returns a tcl list of valid newsgroups and associated information.  Each
newsgroup is returned as an element in the tcl list with the following format:
.CS


      group last first p

.CE
.IP
where <group> is the name of the newsgroup, <last> is the number of
the last known article currently in that newsgroup, <first> is the
number of the first article currently in the newsgroup, and <p> is
either 'y' or 'n' indicating whether posting to this newsgroup is
allowed ('y') or prohibited ('n').
.sp
The <first> and <last> fields will always be numeric.  They may have
leading zeros.  If the <last> field evaluates to less than the
<first> field, there are no articles currently on file in the
newsgroup.
.TP
\fInntpName\fR \fBlistgroup\fR ?\fIgroup\fR?
Query the server for a list of all the messages (message numbers) in the
group specified by the argument \fIgroup\fR or by the current group if
the \fIgroup\fR argument was not passed.
.TP
\fInntpName\fR \fBmode_reader\fR
Query the server for its nntp 'MODE READER' response string.
.TP
\fInntpName\fR \fBnewgroups\fR \fIsince\fR
Query the server for a list of all the new newsgroups created since the time
specified by the argument \fIsince\fR.  The argument \fIsince\fR can be any
time string that is understood by \fBclock scan\fR. The tcl list of newsgroups
is returned in a similar form to the list of groups returned by the
\fBnntpName list\fR command.  Each element of the list has the form:
.CS


      group last first p

.CE
.IP
where <group> is the name of the newsgroup, <last> is the number of
the last known article currently in that newsgroup, <first> is the
number of the first article currently in the newsgroup, and <p> is
either 'y' or 'n' indicating whether posting to this newsgroup is
allowed ('y') or prohibited ('n').
.TP
\fInntpName\fR \fBnewnews\fR
Query the server for a list of new articles posted to the current group in the
last day.
.TP
\fInntpName\fR \fBnewnews\fR \fIsince\fR
Query the server for a list of new articles posted to the current group since
the time specified by the argument \fIsince\fR.  The argument \fIsince\fR can
be any time string that is understood by \fBclock scan\fR.
.TP
\fInntpName\fR \fBnewnews\fR \fIgroup\fR ?\fIsince\fR?
Query the server for a list of new articles posted to the group specified by
the argument \fIgroup\fR since the time specified by the argument \fIsince\fR
(or in the past day if no \fIsince\fR argument is passed.  The argument
\fIsince\fR can be any time string that is understood by \fBclock scan\fR.
.TP
\fInntpName\fR \fBnext\fR
Sets the current article pointer to point to the next message (if there is
one) and returns the msgid of that message.
.TP
\fInntpName\fR \fBpost\fR \fIarticle\fR
Posts an article of the form specified in
RFC 1036 (\fIhttp://www.rfc-editor.org/rfc/rfc1036.txt\fR, successor
to RFC 850) to the current news group.
.TP
\fInntpName\fR \fBslave\fR
Identifies a connection as being made from a slave nntp server. This might
be used to indicate that the connection is serving multiple people and should
be given priority.  Actual use is entirely implementation dependent and may
vary from server to server.
.TP
\fInntpName\fR \fBstat\fR ?\fImsgid\fR?
The stat command is similar to the article command except that no
text is returned.  When selecting by message number within a group,
the stat command serves to set the current article pointer without
sending text. The returned acknowledgment response will contain the
message-id, which may be of some value.  Using the stat command to
select by message-id is valid but of questionable value, since a
selection by message-id does NOT alter the "current article pointer"
.TP
\fInntpName\fR \fBquit\fR
Gracefully close the connection after sending a NNTP QUIT command down
the socket.
.TP
\fInntpName\fR \fBxgtitle\fR ?\fIgroup_pattern\fR?
Returns a tcl list where each element is of the form:
.CS


newsgroup description

.CE
.IP
If a \fIgroup_pattern\fR is specified then only newsgroups that match
the pattern will have their name and description returned.
.TP
\fInntpName\fR \fBxhdr\fR \fIfield\fR ?\fIrange\fR?
Returns the specified header field value for the current message or for a
list of messages from the current group.  \fIfield\fR is the title of a
field in the header such as from, subject, date, etc.  If \fIrange\fR is
not specified or is "" then the current message is queried.  The command
returns a list of elements where each element has the form of:
.CS


    msgid value

.CE
.IP
Where msgid is the number of the message and value is the value set for the
queried field.  The \fIrange\fR argument can be in any of the following forms:
.RS
.TP
\fB""\fR
The current message is queried.
.TP
\fImsgid1\fR-\fImsgid2\fR
All messages between \fImsgid1\fR and \fImsgid2\fR
(including \fImsgid1\fR and \fImsgid2\fR) are queried.
.TP
\fImsgid1\fR \fImsgid2\fR
All messages between \fImsgid1\fR and \fImsgid2\fR
(including \fImsgid1\fR and \fImsgid2\fR) are queried.
.RE
.TP
\fInntpName\fR \fBxover\fR ?\fIrange\fR?
Returns header information for the current message or for a range of messages
from the current group.  The information is returned in a tcl list
where each element is of the form:
.CS


    msgid subject from date idstring bodysize headersize xref

.CE
.IP
If \fIrange\fR is not specified or is "" then the current message is queried.
The \fIrange\fR argument can be in any of the following forms:
.RS
.TP
\fB""\fR
The current message is queried.
.TP
\fImsgid1\fR-\fImsgid2\fR
All messages between \fImsgid1\fR and \fImsgid2\fR
(including \fImsgid1\fR and \fImsgid2\fR) are queried.
.TP
\fImsgid1\fR \fImsgid2\fR
All messages between \fImsgid1\fR and \fImsgid2\fR
(including \fImsgid1\fR and \fImsgid2\fR) are queried.
.RE
.TP
\fInntpName\fR \fBxpat\fR \fIfield\fR \fIrange\fR ?\fIpattern_list\fR?
Returns the specified header field value for a specified message or for a
list of messages from the current group where the messages match the
pattern(s) given in the pattern_list.  \fIfield\fR is the title of a
field in the header such as from, subject, date, etc.  The information is
returned in a tcl list where each element is of the form:
.CS


    msgid value

.CE
.IP
Where msgid is the number of the message and value is the value set for the
queried field.  The \fIrange\fR argument can be in any of the following forms:
.RS
.TP
\fImsgid\fR
The message specified by \fImsgid\fR is queried.
.TP
\fImsgid1\fR-\fImsgid2\fR
All messages between \fImsgid1\fR and \fImsgid2\fR
(including \fImsgid1\fR and \fImsgid2\fR) are queried.
.TP
\fImsgid1\fR \fImsgid2\fR
All messages between \fImsgid1\fR and \fImsgid2\fR
(including \fImsgid1\fR and \fImsgid2\fR) are queried.
.RE
.PP
.SH EXAMPLE
A bigger example for posting a single article.
.PP
.CS


    package require nntp
    set n [nntp::nntp NNTP_SERVER]
    $n post "From: [email protected] (USER_FULL)
    Path: COMPUTERNAME!USERNAME
    Newsgroups: alt.test
    Subject: Tcl test post -ignore
    Message-ID: <[pid][clock seconds]
    @COMPUTERNAME>
    Date: [clock format [clock seconds] -format "%a, %d %
    b %y %H:%M:%S GMT" -gmt true]

    Test message body"

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fInntp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
news, nntp, nntpclient, rfc 1036, rfc 977
.SH CATEGORY
Networking

Added embedded/man/files/modules/ntp/ntp_time.n.


















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ntp/ntp_time.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ntp_time" n 1.2.1 tcllib "Network Time Facilities"
.BS
.SH NAME
ntp_time \- Tcl Time Service Client
.SH SYNOPSIS
package require \fBTcl  8.0\fR
.sp
package require \fBtime  ?1.2.1?\fR
.sp
\fB::time::gettime\fR ?\fIoptions\fR? \fItimeserver\fR ?\fIport\fR?
.sp
\fB::time::getsntp\fR ?\fIoptions\fR? \fItimeserver\fR ?\fIport\fR?
.sp
\fB::time::configure\fR ?\fIoptions\fR?
.sp
\fB::time::cget\fR \fIname\fR
.sp
\fB::time::unixtime\fR \fItoken\fR
.sp
\fB::time::status\fR \fItoken\fR
.sp
\fB::time::error\fR \fItoken\fR
.sp
\fB::time::reset\fR \fItoken\fR \fI?reason?\fR
.sp
\fB::time::wait\fR \fItoken\fR
.sp
\fB::time::cleanup\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package implements a client for the RFC 868 TIME protocol
(\fIhttp://www.rfc-editor.org/rfc/rfc868.txt\fR) and also a minimal
client for the RFC 2030 Simple Network Time Protocol
(\fIhttp://www.rfc-editor.org/rfc/rfc2030.txt\fR).
RFC 868 returns the time in seconds since 1 January 1900
to either tcp or udp clients. RFC 2030 also gives this time but also
provides a fractional part which is not used in this client.
.SH COMMANDS
.TP
\fB::time::gettime\fR ?\fIoptions\fR? \fItimeserver\fR ?\fIport\fR?
Get the time from \fItimeserver\fR. You may specify any of the options
listed for the \fBconfigure\fR command here. This command returns a
token which must then be used with the remaining commands in this
package. Once you have finished, you should use \fBcleanup\fR to
release all resources. The default port is \fB37\fR.
.TP
\fB::time::getsntp\fR ?\fIoptions\fR? \fItimeserver\fR ?\fIport\fR?
Get the time from an SNTP server. This accepts exactly the same
arguments as \fB::time::gettime\fR except that the default port is
\fB123\fR. The result is a token as per \fB::time::gettime\fR and
should be handled in the same way.
.sp
Note that it is unlikely that any SNTP server will reply using tcp so
you will require the \fBtcludp\fR or the \fBceptcl\fR
package. If a suitable package can be loaded then the udp protocol
will be used by default.
.TP
\fB::time::configure\fR ?\fIoptions\fR?
Called with no arguments this command returns all the current
configuration options and values. Otherwise it should be called with
pairs of option name and value.
.RS
.TP
\fB-protocol\fR \fInumber\fR
Set the default network protocol. This defaults to udp if the tcludp
package is available. Otherwise it will use tcp.
.TP
\fB-port\fR \fInumber\fR
Set the default port to use. RFC 868 uses port \fB37\fR, RFC 2030 uses
port \fB123\fR.
.TP
\fB-timeout\fR \fInumber\fR
Set the default timeout value in milliseconds. The default is 10 seconds.
.TP
\fB-command\fR \fInumber\fR
Set a command procedure to be run when a reply is received. The
procedure is called with the time token appended to the argument list.
.TP
\fB-loglevel\fR \fInumber\fR
Set the logging level. The default is 'warning'.
.RE
.TP
\fB::time::cget\fR \fIname\fR
Get the current value for the named configuration option.
.TP
\fB::time::unixtime\fR \fItoken\fR
Format the returned time for the unix epoch. RFC 868 time defines
time 0 as 1 Jan 1900, while unix time defines time 0 as 1 Jan
1970. This command converts the reply to unix time.
.TP
\fB::time::status\fR \fItoken\fR
Returns the status flag. For a successfully completed query this will be
\fIok\fR. May be \fIerror\fR or \fItimeout\fR or \fIeof\fR.
See also \fB::time::error\fR
.TP
\fB::time::error\fR \fItoken\fR
Returns the error message provided for requests whose status is \fIerror\fR.
If there is no error message then an empty string is returned.
.TP
\fB::time::reset\fR \fItoken\fR \fI?reason?\fR
Reset or cancel the query optionally specfying the reason to record
for the \fBerror\fR command.
.TP
\fB::time::wait\fR \fItoken\fR
Wait for a query to complete and return the status upon completion.
.TP
\fB::time::cleanup\fR \fItoken\fR
Remove all state variables associated with the request.
.PP
.CS


% set tok [::time::gettime ntp2a.mcc.ac.uk]
% set t [::time::unixtime $tok]
% ::time::cleanup $tok

.CE
.CS


% set tok [::time::getsntp pool.ntp.org]
% set t [::time::unixtime $tok]
% ::time::cleanup $tok

.CE
.CS


proc on_time {token} {
   if {[time::status $token] eq "ok"} {
      puts [clock format [time::unixtime $token]]
   } else {
      puts [time::error $token]
   }
   time::cleanup $token
}
time::getsntp -command on_time pool.ntp.org

.CE
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIntp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
ntp
.SH KEYWORDS
NTP, SNTP, rfc 2030, rfc 868, time
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2002, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/ooutil/ooutil.n.



































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ooutil/ooutil.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011-2013 Andreas Kupries, BSD licensed
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "oo::util" n 1.1 tcllib "Utility commands for TclOO"
.BS
.SH NAME
oo::util \- Utility commands for TclOO
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBoo::util  ?1.1?\fR
.sp
\fBmymethod\fR \fImethod\fR ?\fIarg\fR...?
.sp
\fBclassmethod\fR \fIname\fR \fIarguments\fR \fIbody\fR
.sp
\fBclassvariable\fR ?\fIarg\fR...?
.sp
\fBooutil::singleton\fR ?\fIarg\fR...?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a convenience command for the easy specification
of instance methods as callback commands, like timers, file events, Tk
bindings, etc.
.SH COMMANDS
.TP
\fBmymethod\fR \fImethod\fR ?\fIarg\fR...?
This command is available within instance methods. It takes a method
name and, possibly, arguments for the method and returns a command
prefix which, when executed, will invoke the named method of the
object we are in, with the provided arguments, and any others supplied
at the time of actual invokation.
.sp
Note: The command is equivalent to and named after the command
provided by the OO package \fBsnit\fR for the same purpose.
.TP
\fBclassmethod\fR \fIname\fR \fIarguments\fR \fIbody\fR
This command is available within class definitions. It takes a method
name and, possibly, arguments for the method and creates a method on the
class, available to a user of the class and of derived classes.
.sp
Note: The command is equivalent to the command \fBtypemethod\fR
provided by the OO package \fBsnit\fR for the same purpose.
.sp
Example
.CS


oo::class create ActiveRecord {
    classmethod find args { puts "[self] called with arguments: $args" }
}
oo::class create Table {
    superclass ActiveRecord
}
puts [Table find foo bar]
# ======
# which will write
# ======
# ::Table called with arguments: foo bar

.CE
.TP
\fBclassvariable\fR ?\fIarg\fR...?
This command is available within instance methods. It takes a series
of variable names and makes them available in the method's scope. The
originating scope for the variables is the class (instance) the object
instance belongs to. In other words, the referenced variables are shared
between all instances of their class.
.sp
Note: The command is roughly equivalent to the command
\fBtypevariable\fR provided by the OO package \fBsnit\fR for the
same purpose. The difference is that it cannot be used in the class
definition itself.
.sp
Example:
.CS


% oo::class create Foo {
    method bar {z} {
        classvariable x y
        return [incr x $z],[incr y]
    }
}
::Foo
% Foo create a
::a
% Foo create b
::b
% a bar 2
2,1
% a bar 3
5,2
% b bar 7
12,3
% b bar -1
11,4
% a bar 0
11,5

.CE
.TP
\fBooutil::singleton\fR ?\fIarg\fR...?
This command is a meta-class, i.e. a variant of the builtin
\fBoo::class\fR which ensures that it creates only a single
instance of the classes defined with it.
.sp
Syntax and results are like for \fBoo::class\fR.
.sp
Example:
.CS


% oo::class create example {
   self mixin singleton
   method foo {} {self}
}
::example
% [example new] foo
::oo::Obj22
% [example new] foo
::oo::Obj22

.CE
.PP
.SH AUTHORS
Donal Fellows, Andreas Kupries
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIoo::util\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
snit(n)
.SH KEYWORDS
TclOO, callback, class methods, class variables, command prefix, currying, method reference, my method, singleton
.SH CATEGORY
Utility
.SH COPYRIGHT
.nf
Copyright (c) 2011-2013 Andreas Kupries, BSD licensed

.fi

Added embedded/man/files/modules/otp/otp.n.












































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/otp/otp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "otp" n 1.0.0 tcllib "RFC 2289 A One-Time Password System"
.BS
.SH NAME
otp \- One-Time Passwords
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBotp  ?1.0.0?\fR
.sp
\fB::otp::otp-md4\fR ?\fI-hex\fR? ?\fI-words\fR? \fI-seed seed\fR \fI-count count\fR \fIdata\fR
.sp
\fB::otp::otp-md5\fR ?\fI-hex\fR? ?\fI-words\fR? \fI-seed seed\fR \fI-count count\fR \fIdata\fR
.sp
\fB::otp::otp-sha1\fR ?\fI-hex\fR? ?\fI-words\fR? \fI-seed seed\fR \fI-count count\fR \fIdata\fR
.sp
\fB::otp::otp-rmd160\fR ?\fI-hex\fR? ?\fI-words\fR? \fI-seed seed\fR \fI-count count\fR \fIdata\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package is an implementation in Tcl of the One-Time Password
system as described in RFC 2289 (1). This system uses message-digest
algorithms to sequentially hash a passphrase to create single-use
passwords. The resulting data is then provided to the user as either
hexadecimal digits or encoded using a dictionary of 2048 words. This
system is used by OpenBSD for secure login and can be used as a SASL
mechanism for authenticating users.
.PP
In this implementation we provide support for four algorithms that are
included in the tcllib distribution: MD5 (2), MD4 (3), RIPE-MD160 (4)
and SHA-1 (5).
.SH COMMANDS
.TP
\fB::otp::otp-md4\fR ?\fI-hex\fR? ?\fI-words\fR? \fI-seed seed\fR \fI-count count\fR \fIdata\fR
.TP
\fB::otp::otp-md5\fR ?\fI-hex\fR? ?\fI-words\fR? \fI-seed seed\fR \fI-count count\fR \fIdata\fR
.TP
\fB::otp::otp-sha1\fR ?\fI-hex\fR? ?\fI-words\fR? \fI-seed seed\fR \fI-count count\fR \fIdata\fR
.TP
\fB::otp::otp-rmd160\fR ?\fI-hex\fR? ?\fI-words\fR? \fI-seed seed\fR \fI-count count\fR \fIdata\fR
.PP
.SH EXAMPLES
.CS


% otp::otp-md5 -count 99 -seed host67821 "My Secret Pass Phrase"
(binary gibberish)
% otp::otp-md5 -words -count 99 -seed host67821 "My Secret Pass Phrase"
SOON ARAB BURG LIMB FILE WAD
% otp::otp-md5 -hex -count 99 -seed host67821 "My Secret Pass Phrase"
e249b58257c80087

.CE
.SH REFERENCES
.IP [1]
Haller, N. et al., "A One-Time Password System", RFC 2289, February 1998.
\fIhttp://www.rfc-editor.org/rfc/rfc2289.txt\fR
.IP [2]
Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT and
RSA Data Security, Inc, April 1992.
(\fIhttp://www.rfc-editor.org/rfc/rfc1321.txt\fR)
.IP [3]
Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT,
April 1992. (\fIhttp://www.rfc-editor.org/rfc/rfc1320.txt\fR)
.IP [4]
H. Dobbertin, A. Bosselaers, B. Preneel,
"RIPEMD-160, a strengthened version of RIPEMD"
\fIhttp://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf\fR
.IP [5]
"Secure Hash Standard", National Institute of Standards
and Technology, U.S. Department Of Commerce, April 1995.
(\fIhttp://www.itl.nist.gov/fipspubs/fip180-1.htm\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIotp\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
SASL, md4, md5, ripemd160, sha1
.SH KEYWORDS
hashing, message-digest, password, rfc 2289, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2006, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/page/page_intro.n.




















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/page/page_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "page_intro" n 1.0 tcllib "Parser generator tools"
.BS
.SH NAME
page_intro \- page introduction
.SH DESCRIPTION
.PP
\fIpage\fR (short for \fIparser generator\fR) stands for a set of
related packages which help in the construction of parser generators,
and other utilities doing text processing.
.PP
They are mainly geared towards supporting the Tcllib application
\fBpage\fR, with the package \fBpage::pluginmgr\fR in a central
role as the plugin management for the application. The other packages
are performing low-level text processing and utility tasks geared
towards parser generation and mainly accessed by \fBpage\fR through
plugins.
.PP
The packages implementing the plugins are not documented as regular
packages, as they cannot be loaded into a general interpreter, like
tclsh, without extensive preparation of the interpreter. Preparation
which is done for them by the plugin manager.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIpage\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH KEYWORDS
page, parser generator, text processing
.SH CATEGORY
Page Parser Generator
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/page/page_pluginmgr.n.
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/page/page_pluginmgr.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "page_pluginmgr" n 1.0 tcllib "Parser generator tools"
.BS
.SH NAME
page_pluginmgr \- page plugin manager
.SH SYNOPSIS
package require \fBpage::pluginmgr  ?0.2?\fR
.sp
package require \fBfileutil \fR
.sp
\fB::page::pluginmgr::reportvia\fR \fIcmd\fR
.sp
\fB::page::pluginmgr::report\fR \fIlevel\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fB::page::pluginmgr::log\fR \fIcmd\fR
.sp
\fB::page::pluginmgr::configuration\fR \fIname\fR
.sp
\fB::page::pluginmgr::reader\fR \fIname\fR
.sp
\fB::page::pluginmgr::rconfigure\fR \fIdict\fR
.sp
\fB::page::pluginmgr::rtimeable\fR
.sp
\fB::page::pluginmgr::rtime\fR
.sp
\fB::page::pluginmgr::rgettime\fR
.sp
\fB::page::pluginmgr::rhelp\fR
.sp
\fB::page::pluginmgr::rlabel\fR
.sp
\fB::page::pluginmgr::read\fR \fIread\fR \fIeof\fR ?\fIcomplete\fR?
.sp
\fIread\fR \fInum\fR
.sp
\fIeof\fR
.sp
\fIdone\fR
.sp
\fB::page::pluginmgr::writer\fR \fIname\fR
.sp
\fB::page::pluginmgr::wconfigure\fR \fIdict\fR
.sp
\fB::page::pluginmgr::wtimeable\fR
.sp
\fB::page::pluginmgr::wtime\fR
.sp
\fB::page::pluginmgr::wgettime\fR
.sp
\fB::page::pluginmgr::whelp\fR
.sp
\fB::page::pluginmgr::wlabel\fR
.sp
\fB::page::pluginmgr::write\fR \fIchan\fR \fIdata\fR
.sp
\fB::page::pluginmgr::transform\fR \fIname\fR
.sp
\fB::page::pluginmgr::tconfigure\fR \fIid\fR \fIdict\fR
.sp
\fB::page::pluginmgr::ttimeable\fR \fIid\fR
.sp
\fB::page::pluginmgr::ttime\fR \fIid\fR
.sp
\fB::page::pluginmgr::tgettime\fR \fIid\fR
.sp
\fB::page::pluginmgr::thelp\fR \fIid\fR
.sp
\fB::page::pluginmgr::tlabel\fR \fIid\fR
.sp
\fB::page::pluginmgr::transform_do\fR \fIid\fR \fIdata\fR
.sp
\fBpage_cdefinition\fR
.sp
\fBpage_rfeature\fR \fIname\fR
.sp
\fBpage_rtime\fR
.sp
\fBpage_rgettime\fR
.sp
\fBpage_rlabel\fR
.sp
\fBpage_rhelp\fR
.sp
\fBpage_roptions\fR
.sp
\fBpage_rconfigure\fR \fIoption\fR \fIvalue\fR
.sp
\fBpage_rrun\fR
.sp
\fBpage_read\fR \fInum\fR
.sp
\fBpage_read_done\fR
.sp
\fBpage_eof\fR
.sp
\fBpage_info\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_warning\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_error\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_log_info\fR \fItext\fR
.sp
\fBpage_log_warning\fR \fItext\fR
.sp
\fBpage_log_error\fR \fItext\fR
.sp
\fBpage_wfeature\fR
.sp
\fBpage_wtime\fR
.sp
\fBpage_wgettime\fR
.sp
\fBpage_wlabel\fR
.sp
\fBpage_whelp\fR
.sp
\fBpage_woptions\fR
.sp
\fBpage_wconfigure\fR \fIoption\fR \fIvalue\fR
.sp
\fBpage_wrun\fR \fIchan\fR \fIdata\fR
.sp
\fBpage_info\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_warning\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_error\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_log_info\fR \fItext\fR
.sp
\fBpage_log_warning\fR \fItext\fR
.sp
\fBpage_log_error\fR \fItext\fR
.sp
\fBpage_tfeature\fR
.sp
\fBpage_ttime\fR
.sp
\fBpage_tgettime\fR
.sp
\fBpage_tlabel\fR
.sp
\fBpage_thelp\fR
.sp
\fBpage_toptions\fR
.sp
\fBpage_tconfigure\fR \fIoption\fR \fIvalue\fR
.sp
\fBpage_trun\fR \fIchan\fR \fIdata\fR
.sp
\fBpage_info\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_warning\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_error\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fBpage_log_info\fR \fItext\fR
.sp
\fBpage_log_warning\fR \fItext\fR
.sp
\fBpage_log_error\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides the plugin manager central to the \fBpage\fR
application. It manages the various reader, writer, configuration, and
transformation plugins which actually process the text (read,
transform, and write).
.PP
All plugins are loaded into slave interpreters specially prepared for
them. While implemented using packages they need this special
environment and are not usable in a plain interpreter, like
tclsh. Because of that they are only described in general terms in
section \fBPREDEFINED PLUGINS\fR, and not documented as regular
packages. It is expected that they follow the APIs specified in the
sections
.IP [1]
\fBCONFIG PLUGIN API\fR
.IP [2]
\fBREADER PLUGIN API\fR
.IP [3]
\fBWRITER PLUGIN API\fR
.IP [4]
\fBTRANSFORM PLUGIN API\fR
.PP
as per their type.
.SH API
.TP
\fB::page::pluginmgr::reportvia\fR \fIcmd\fR
This command defines the callback command used by
\fB::page::pluginmgr::report\fR (see below) to report input errors and
warnings. The default is to write such reports to the standard error
channel.
.TP
\fB::page::pluginmgr::report\fR \fIlevel\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
This command is used to report input errors and warnings. By default
such reports are written to the standard error. This can be changed by
setting a user-specific callback command with
\fB::page::pluginmgr::reportvia\fR (see above).
.sp
The arguments \fIlevel\fR and \fItext\fR specify both the importance
of the message, and the message itself. For the former see the package
\fBlogger\fR for the allowed values.
.sp
The optional argument \fIfrom\fR and \fIto\fR can be used by the
caller to indicate the location (or range) in the input where the
reported problem occured. Each is a list containing two elements, the
line and the column in the input, in this order.
.TP
\fB::page::pluginmgr::log\fR \fIcmd\fR
This command defines a log callback command to be used by loaded
plugins for the reporting of internal errors, warnings, and general
information. Specifying the empty string as callback disables logging.
.sp
Note: The \fIcmd\fR has to be created by the \fBlogger\fR package,
or follow the same API as such.
.sp
The command returns the empty string as its result.
.TP
\fB::page::pluginmgr::configuration\fR \fIname\fR
This command loads the named configuration plugin, retrieves the
options encoded in it, and then immediately unloads it again.
.sp
If the \fIname\fR is the path to a file, then this files will be tried
to be loaded as a plugin first, and, if that fails, opened and its
contents read as a list of options and their arguments, separated by
spaces, tabs and newlines, possibly quotes with single and double
quotes.
.sp
See section \fBCONFIG PLUGIN API\fR for the API expected of
configuration plugins.
.sp
The result of the command is the list of options retrieved.
.TP
\fB::page::pluginmgr::reader\fR \fIname\fR
This command loads the named reader plugin and initializes it. The
result of the command is a list of options the plugin understands.
.sp
Only a single reader plugin can be loaded. Loading another reader
plugin causes the previously loaded reader plugin to be de-initialized
and unloaded.
.sp
See section \fBREADER PLUGIN API\fR for the API expected of
reader plugins.
.TP
\fB::page::pluginmgr::rconfigure\fR \fIdict\fR
This commands configures the loaded reader plugin. The options and
their values are provided as a Tcl dictionary. The result of the
command is the empty string.
.TP
\fB::page::pluginmgr::rtimeable\fR
This commands checks if the loaded reader plugin is able to collect
timing statistics. The result of the command is a boolean flag. The
result is \fBtrue\fR if the plugin can be timed, and \fBfalse\fR
otherwise.
.TP
\fB::page::pluginmgr::rtime\fR
This command activates the collection of timing statistics in the
loaded reader plugin.
.TP
\fB::page::pluginmgr::rgettime\fR
This command retrieves the collected timing statistics of the loaded
reader plugin after it was executed.
.TP
\fB::page::pluginmgr::rhelp\fR
This command retrieves the help string of the loaded reader
plugin. This is expected to be in \fIdoctools\fR format.
.TP
\fB::page::pluginmgr::rlabel\fR
This command retrieves the human-readable name of the loaded reader
plugin.
.TP
\fB::page::pluginmgr::read\fR \fIread\fR \fIeof\fR ?\fIcomplete\fR?
This command invokes the loaded reader plugin to process the input,
and returns the results of the plugin as its own result. The input is
accessible through the callback commands \fIread\fR, and \fIeof\fR. The
optional \fIdone\fR can be used to intrecept when the plugin has
completed its processing. All arguments are command prefixes.
.sp
The plugin will invoke the various callbacks in the following
situations:
.RS
.TP
\fIread\fR \fInum\fR
is invoked whenever input to process is needed, with the number of
characters/bytes it asks for. The result is expected to be the input
the plugin is in need of.
.TP
\fIeof\fR
is invoked by the plugin to check if the input has reached the of the
stream. The result is expected to be a boolean flag, \fBtrue\fR when
the input has hit EOF, and \fBfalse\fR otherwise.
.TP
\fIdone\fR
is invoked when the plugin has completed the processing of the input.
.RE
.TP
\fB::page::pluginmgr::writer\fR \fIname\fR
This command loads the named writer plugin and initializes it. The
result of the command is a list of options the plugin understands.
.sp
Only a single reader plugin can be loaded. Loading another reader
plugin causes the previously loaded reader plugin to be de-initialized
and unloaded.
.sp
See section \fBWRITER PLUGIN API\fR for the API expected of
writer plugins.
.TP
\fB::page::pluginmgr::wconfigure\fR \fIdict\fR
This commands configures the loaded writer plugin. The options and
their values are provided as a Tcl dictionary. The result of the
command is the empty string.
.TP
\fB::page::pluginmgr::wtimeable\fR
This commands checks if the loaded writer plugin is able to measure
execution times. The result of the command is a boolean flag. The
result is \fBtrue\fR if the plugin can be timed, and \fBfalse\fR
otherwise.
.TP
\fB::page::pluginmgr::wtime\fR
This command activates the collection of timing statistics in the
loaded writer plugin.
.TP
\fB::page::pluginmgr::wgettime\fR
This command retrieves the collected timing statistics of the loaded
writer plugin after it was executed.
.TP
\fB::page::pluginmgr::whelp\fR
This command retrieves the help string of the loaded writer
plugin. This is expected to be in \fIdoctools\fR format.
.TP
\fB::page::pluginmgr::wlabel\fR
This command retrieves the human-readable name of the loaded writer
plugin.
.TP
\fB::page::pluginmgr::write\fR \fIchan\fR \fIdata\fR
The loaded writer plugin is invoked to generate the output. It is
given the \fIdata\fR to generate the outpout from, and the Tcl handle
\fIchan\fR of the channel to write the generated output to. The
command returns th empty string as its result.
.TP
\fB::page::pluginmgr::transform\fR \fIname\fR
This command loads the named transformation plugin and initializes
it. The result of the command is a 2-element list containing the
plugin id and a list of options the plugin understands, in this order.
.sp
Multiple transformations plugins can be loaded and are identified by
handles.
.sp
See section \fBTRANSFORM PLUGIN API\fR for the API expected of
transformation plugins.
.TP
\fB::page::pluginmgr::tconfigure\fR \fIid\fR \fIdict\fR
This commands configures the identified transformation plugin. The
options and their values are provided as a Tcl dictionary. The result
of the command is the empty string.
.TP
\fB::page::pluginmgr::ttimeable\fR \fIid\fR
This commands checks if the identified transformation plugin is able
to collect timing statistics. The result of the command is a boolean
flag. The result is \fBtrue\fR if the plugin can be timed, and
\fBfalse\fR otherwise.
.TP
\fB::page::pluginmgr::ttime\fR \fIid\fR
This command activates the collection of timing statistics in the
identified transformation plugin.
.TP
\fB::page::pluginmgr::tgettime\fR \fIid\fR
This command retrieves the collected timing statistics of the
identified transformation plugin after it was executed.
.TP
\fB::page::pluginmgr::thelp\fR \fIid\fR
This command retrieves the help string of the identified
transformation plugin. This is expected to be in \fIdoctools\fR
format.
.TP
\fB::page::pluginmgr::tlabel\fR \fIid\fR
This command retrieves the human-readable name of the identified
transformation plugin.
.TP
\fB::page::pluginmgr::transform_do\fR \fIid\fR \fIdata\fR
The identified transformation plugin is invoked to process the
specified \fIdata\fR. The result of the plugin is returned as the
result of the command.
.PP
.SH "CONFIG PLUGIN API"
Configuration plugins are expected to provide a single command,
described below.
.PP
.TP
\fBpage_cdefinition\fR
This command of a configuration plugin is called by the plugin manager
to execute it. Its result has to be a list of options and values to
process.
.PP
.PP
Configuration plugins do not expect the environment to provide any
special commands.
.PP
It is expected that a configuration plugin \fBFOO\fR is implemented
by the package \fBpage::config::\fBFOO\fR\fR.
.PP
Configuration plugins are loaded, executed, and unloaded in one step,
they are not kept in memory. The command for doing this is
\fB::page::pluginmgr::configuration\fR.
.SH "READER PLUGIN API"
Reader plugins are expected to provide the following commands,
described below.
.PP
.TP
\fBpage_rfeature\fR \fIname\fR
This command takes a feature \fIname\fR and returns a boolean flag
indicating whether the feature is supported by the plugin, or not.
The result has to be \fBtrue\fR if the feature is supported, and
\fBfalse\fR otherwise.
.sp
See section \fBFEATURES\fR for the possible features the plugin
manager will ask for.
.TP
\fBpage_rtime\fR
This command is invoked to activate the collection of timing
statistics.
.TP
\fBpage_rgettime\fR
This command is invoked to retrieve the collected timing statistics.
.TP
\fBpage_rlabel\fR
This command is invoked to retrieve a human-readable label for the
plugin.
.TP
\fBpage_rhelp\fR
This command is invoked to retrieve a help text for plugin. The text
is expected to be in \fIdoctools\fR format.
.TP
\fBpage_roptions\fR
This command is invoked to retrieve the options understood by the
plugin.
.TP
\fBpage_rconfigure\fR \fIoption\fR \fIvalue\fR
This command is invoked to reconfigure the plugin, specifically the
given \fIoption\fR is set to the new \fIvalue\fR.
.TP
\fBpage_rrun\fR
This command is invoked to process the input stream per the current
plugin configuration.  The result of the command is the result of the
processing.
.PP
.PP
Reader plugins expect the environment to provide the following special
commands.
.TP
\fBpage_read\fR \fInum\fR
This command is invoked to read \fInum\fR characters/bytes from the
input. Its result has to be read characters/bytes.
.TP
\fBpage_read_done\fR
This command is invoked to signal that the plugin has completed the
processing of the input.
.TP
\fBpage_eof\fR
This command is invoked to check if the input stream has reached its
end. Its result has to be a boolean flag, \fBtrue\fR when the input
has reached the end, \fBfalse\fR otherwise.
.TP
\fBpage_info\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report some information to the user. May indicate a
location or range in the input. Each piece of location data, if
provided, is a 2-element list containing line and column numbers.
.TP
\fBpage_warning\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report a warning to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.
.TP
\fBpage_error\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report an error to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.
.TP
\fBpage_log_info\fR \fItext\fR
Invoked to report some internal information.
.TP
\fBpage_log_warning\fR \fItext\fR
Invoked to report an internal warning.
.TP
\fBpage_log_error\fR \fItext\fR
Invoked to report an internal error.
.PP
.PP
It is expected that a reader plugin \fBFOO\fR is implemented
by the package \fBpage::reader::\fBFOO\fR\fR.
.PP
Reader plugins are loaded by the command
\fB::page::pluginmgr::reader\fR. At most one reader plugin can be kept
in memory.
.SH "WRITER PLUGIN API"
Writer plugins are expected to provide the following commands,
described below.
.PP
.TP
\fBpage_wfeature\fR
This command takes a feature \fIname\fR and returns a boolean flag
indicating whether the feature is supported by the plugin, or not.
The result has to be \fBtrue\fR if the feature is supported, and
\fBfalse\fR otherwise.
.sp
See section \fBFEATURES\fR for the possible features the plugin
manager will ask for.
.TP
\fBpage_wtime\fR
This command is invoked to activate the collection of timing
statistics.
.TP
\fBpage_wgettime\fR
This command is invoked to retrieve the collected timing statistics.
.TP
\fBpage_wlabel\fR
This command is invoked to retrieve a human-readable label for the
plugin.
.TP
\fBpage_whelp\fR
This command is invoked to retrieve a help text for plugin. The text
is expected to be in \fIdoctools\fR format.
.TP
\fBpage_woptions\fR
This command is invoked to retrieve the options understood by the
plugin.
.TP
\fBpage_wconfigure\fR \fIoption\fR \fIvalue\fR
This command is invoked to reconfigure the plugin, specifically the
given \fIoption\fR is set to the new \fIvalue\fR.
.TP
\fBpage_wrun\fR \fIchan\fR \fIdata\fR
This command is invoked to process the specified \fIdata\fR and write
it to the output stream \fIchan\fR. The latter is a Tcl channel handle
opened for writing. The result of the command is the empty string.
.PP
.PP
Writer plugins expect the environment to provide the following special
commands.
.TP
\fBpage_info\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report some information to the user. May indicate a
location or range in the input. Each piece of location data, if
provided, is a 2-element list containing line and column numbers.
.TP
\fBpage_warning\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report a warning to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.
.TP
\fBpage_error\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report an error to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.
.TP
\fBpage_log_info\fR \fItext\fR
Invoked to report some internal information.
.TP
\fBpage_log_warning\fR \fItext\fR
Invoked to report an internal warning.
.TP
\fBpage_log_error\fR \fItext\fR
Invoked to report an internal error.
.PP
.PP
It is expected that a writer plugin \fBFOO\fR is implemented
by the package \fBpage::writer::\fBFOO\fR\fR.
.PP
Writer plugins are loaded by the command
\fB::page::pluginmgr::writer\fR. At most one writer plugin can be kept
in memory.
.SH "TRANSFORM PLUGIN API" page::transform::*
Transformation plugins are expected to provide the following commands,
described below.
.PP
.TP
\fBpage_tfeature\fR
This command takes a feature \fIname\fR and returns a boolean flag
indicating whether the feature is supported by the plugin, or not.
The result has to be \fBtrue\fR if the feature is supported, and
\fBfalse\fR otherwise.
.sp
See section \fBFEATURES\fR for the possible features the plugin
manager will ask for.
.TP
\fBpage_ttime\fR
This command is invoked to activate the collection of timing
statistics.
.TP
\fBpage_tgettime\fR
This command is invoked to retrieve the collected timing statistics.
.TP
\fBpage_tlabel\fR
This command is invoked to retrieve a human-readable label for the
plugin.
.TP
\fBpage_thelp\fR
This command is invoked to retrieve a help text for plugin. The text
is expected to be in \fIdoctools\fR format.
.TP
\fBpage_toptions\fR
This command is invoked to retrieve the options understood by the
plugin.
.TP
\fBpage_tconfigure\fR \fIoption\fR \fIvalue\fR
This command is invoked to reconfigure the plugin, specifically the
given \fIoption\fR is set to the new \fIvalue\fR.
.TP
\fBpage_trun\fR \fIchan\fR \fIdata\fR
This command is invoked to process the specified \fIdata\fR and write
it to the output stream \fIchan\fR. The latter is a Tcl channel handle
opened for writing. The result of the command is the empty string.
.PP
.PP
Transformation plugins expect the environment to provide the following
special commands.
.TP
\fBpage_info\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report some information to the user. May indicate a
location or range in the input. Each piece of location data, if
provided, is a 2-element list containing line and column numbers.
.TP
\fBpage_warning\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report a warning to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.
.TP
\fBpage_error\fR \fItext\fR ?\fIfrom\fR ?\fIto\fR??
Invoked to report an error to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.
.TP
\fBpage_log_info\fR \fItext\fR
Invoked to report some internal information.
.TP
\fBpage_log_warning\fR \fItext\fR
Invoked to report an internal warning.
.TP
\fBpage_log_error\fR \fItext\fR
Invoked to report an internal error.
.PP
.PP
It is expected that a transformation plugin \fBFOO\fR is implemented
by the package \fBpage::transform::\fBFOO\fR\fR.
.PP
Transformation plugins are loaded by the command
\fB::page::pluginmgr::transform\fR. More than one transformation
plugin can be kept in memory.
.SH "PREDEFINED PLUGINS"
The following predefined plugins are known, i.e. provided by the page
module.
.TP
Configuration
.RS
.TP
peg
Returns a set of options to configure the \fBpage\fR application
for the processing of a PEG grammar and the generation of ME code. See
the packages \fBgrammar_peg\fR, \fBgrammar_me\fR and relations
for more details.
.RE
.TP
Reader
.RS
.TP
hb
Expects a so-called \fIhalf-baked PEG container\fR as input and
returns the equivalent abstract syntax tree. See the writer plugin
\fIhb\fR for the plugin generating this type of input.
.TP
lemon
Expects a grammar specification as understood by Richar Hipp's LEMON
parser generator and returns an abstract syntax tree for it.
.TP
peg
Expects a grammar specification in the form of a parsing expression
grammar (PEG) and returns an abstract syntax tree for it.
.TP
ser
Expect the serialized form of a parsing expression grammar as
generated by the package \fBgrammar::peg\fR as input, converts it
into an equivalent abstract syntax tree and returns that.
.TP
treeser
Expects the serialized form of a tree as generated by the package
\fBstruct::tree\fR as input and returns it, after validation.
.RE
.TP
Writer
.RS
.TP
hb
Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out in the form of a so-called
\fIhalf-baked PEG container\fR.
.TP
identity
Takes any input and writes it as is.
.TP
mecpu
Expects symbolic assembler code for the MatchEngine CPU (See the
package \fBgrammar::me::cpu\fR and relatives) and writes it out as
Tcl code for a parser.
.TP
me
Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out as Tcl code for the MatchEngine (See the
package \fBgrammar::me\fR and relatives) which parses input in
that grammar.
.TP
null
Takes any input and writes nothing. The logical equivalent of
/dev/null.
.TP
peg
Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out in the form of a canonical PEG which can be
read by the reader plugin \fIpeg\fR.
.TP
ser
Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out as a serialized PEG container which can be
read by the reader plugin \fIser\fR.
.TP
tpc
Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out as Tcl code initializing a PEG container as
provided by the package \fBgrammar::peg\fR.
.TP
tree
Takes any serialized tree (per package \fBstruct::tree\fR) as
input and writes it out in a generic indented format.
.RE
.TP
Transformation
.RS
.TP
mecpu
Takes an abstract syntax tree for a parsing expression grammer as
input, generates symbolic assembler code for the MatchEngine CPU, and
returns that as its result (See the package \fBgrammar::me::cpu\fR
and relatives).
.TP
reachable
Takes an abstract syntax tree for a parsing expression grammer as
input, performs a reachability analysis, and returns the modified and
annotated tree.
.TP
realizable
Takes an abstract syntax tree for a parsing expression grammer as
input, performs an analysis of realizability, and returns the modified
and annotated tree.
.RE
.PP
.SH FEATURES
The plugin manager currently checks the plugins for only one feature,
\fBtimeable\fR. A plugin supporting this feature is assumed to be
able to collect timing statistics on request.
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIpage\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH KEYWORDS
page, parser generator, text processing
.SH CATEGORY
Page Parser Generator
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/page/page_util_flow.n.








































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/page/page_util_flow.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "page_util_flow" n 1.0 tcllib "Parser generator tools"
.BS
.SH NAME
page_util_flow \- page dataflow/treewalker utility
.SH SYNOPSIS
package require \fBpage::util::flow  ?0.1?\fR
.sp
package require \fBsnit \fR
.sp
\fB::page::util::flow\fR \fIstart\fR \fIflowvar\fR \fInodevar\fR \fIscript\fR
.sp
\fIflow\fR \fBvisit\fR \fInode\fR
.sp
\fIflow\fR \fBvisitl\fR \fInodelist\fR
.sp
\fIflow\fR \fBvisita\fR \fInode\fR...
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a single utility command for easy dataflow based
manipulation of arbitrary data structures, especially abstract syntax
trees.
.SH API
.TP
\fB::page::util::flow\fR \fIstart\fR \fIflowvar\fR \fInodevar\fR \fIscript\fR
This command contains the core logic to drive the walking of an
arbitrary data structure which can partitioned into separate
parts. Examples of such structures are trees and graphs.
.sp
The command makes no assumptions at all about the API of the structure
to be walked, except that that its parts, here called \fInodes\fR,
are identified by strings. These strings are taken as is, from the
arguments, and the body, and handed back to the body, without
modification.
.sp
Access to the actual data structure, and all decisions regarding which
nodes to visit in what order are delegated to the body of the loop,
i.e. the \fIscript\fR.
.sp
The body is invoked first for the nodes in the start-set specified via
\fIstart\fR), and from then on for the nodes the body has requested to
be visited. The command stops when the set of nodes to visit becomes
empty. Note that a node can be visited more than once. The body has
complete control about this.
.sp
The body is invoked in the context of the caller. The variable named
by \fInodevar\fR will be set to the current node, and the variable
named by \fIflowvar\fR will be set to the command of the flow object
through which the body can request the nodes to visit next. The API
provided by this object is described in the next section,
\fBFLOW API\fR.
.sp
Note that the command makes no promises regarding the order in which
nodes are visited, excpt that the nodes requested to be visited by the
current iteration will be visited afterward, in some order.
.PP
.SH "FLOW API"
This section describes the API provided by the flow object made
accessible to the body script of \fB::page::util::flow\fR.
.TP
\fIflow\fR \fBvisit\fR \fInode\fR
Invoking this method requests that the node \fIn\fR is visited after
the current iteration.
.TP
\fIflow\fR \fBvisitl\fR \fInodelist\fR
Invoking this method requests that all the nodes found in the list
\fInodelist\fR are visited after the current iteration.
.TP
\fIflow\fR \fBvisita\fR \fInode\fR...
This is the variadic arguments form of the method \fBvisitl\fR, see
above.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIpage\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH KEYWORDS
dataflow, graph walking, page, parser generator, text processing, tree walking
.SH CATEGORY
Page Parser Generator
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/page/page_util_norm_lemon.n.




























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/page/page_util_norm_lemon.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "page_util_norm_lemon" n 1.0 tcllib "Parser generator tools"
.BS
.SH NAME
page_util_norm_lemon \- page AST normalization, LEMON
.SH SYNOPSIS
package require \fBpage::util::norm_lemon  ?0.1?\fR
.sp
package require \fBsnit \fR
.sp
\fB::page::util::norm::lemon\fR \fItree\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a single utility command which takes an AST for a
lemon  grammar and normalizes it in various ways. The result
is called a \fINormalized Lemon Grammar Tree\fR.
.PP
\fINote\fR that this package can only be used from within a plugin
managed by the package \fBpage::pluginmgr\fR.
.SH API
.TP
\fB::page::util::norm::lemon\fR \fItree\fR
This command assumes the \fItree\fR object contains for a lemon
grammar. It normalizes this tree in place. The result is called a
\fINormalized Lemon Grammar Tree\fR.
.sp
The exact operations performed are left undocumented for the moment.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIpage\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH KEYWORDS
graph walking, lemon, normalization, page, parser generator, text processing, tree walking
.SH CATEGORY
Page Parser Generator
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/page/page_util_norm_peg.n.













































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/page/page_util_norm_peg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "page_util_norm_peg" n 1.0 tcllib "Parser generator tools"
.BS
.SH NAME
page_util_norm_peg \- page AST normalization, PEG
.SH SYNOPSIS
package require \fBpage::util::norm_peg  ?0.1?\fR
.sp
package require \fBsnit \fR
.sp
\fB::page::util::norm::peg\fR \fItree\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a single utility command which takes an AST for a
parsing expression grammar and normalizes it in various ways. The result
is called a \fINormalized PE Grammar Tree\fR.
.PP
\fINote\fR that this package can only be used from within a plugin
managed by the package \fBpage::pluginmgr\fR.
.SH API
.TP
\fB::page::util::norm::peg\fR \fItree\fR
This command assumes the \fItree\fR object contains for a
parsing expression grammar. It normalizes this tree in place.
The result is called a  \fINormalized PE Grammar Tree\fR.
.sp
The following operations are performd
.RS
.IP [1]
The data for all terminals is stored in their grandparental
nodes. The terminal nodes and their parents are removed. Type
information is dropped.
.IP [2]
All nodes which have exactly one child are irrelevant and are
removed, with the exception of the root node. The immediate
child of the root is irrelevant as well, and removed as well.
.IP [3]
The name of the grammar is moved from the tree node it is stored
in to an attribute of the root node, and the tree node removed.
.sp
The node keeping the start expression separate is removed as
irrelevant and the root node of the start expression tagged with
a marker attribute, and its handle saved in an attribute of the
root node for quick access.
.IP [4]
Nonterminal hint information is moved from nodes into attributes,
and the now irrelevant nodes are deleted.
.sp
\fINote:\fR This transformation is dependent on the removal of all
nodes with exactly one child, as it removes the all 'Attribute'
nodes already. Otherwise this transformation would have to put
the information into the grandparental node.
.sp
The default mode given to the nonterminals is \fBvalue\fR.
.sp
Like with the global metadata definition specific information
is moved out out of nodes into attributes, the now irrelevant
nodes are deleted, and the root nodes of all definitions are
tagged with marker attributes. This provides us with a mapping
from nonterminal names to their defining nodes as well, which
is saved in an attribute of the root node for quick reference.
.sp
At last the range in the input covered by a definition is
computed. The left extent comes from the terminal for the
nonterminal symbol it defines. The right extent comes from
the rightmost child under the definition. While this not an
expression tree yet the location data is sound already.
.IP [5]
The remaining nodes under all definitions are transformed
into proper expression trees. First character ranges, followed
by unary operations, characters, and nonterminals. At last the
tree is flattened by the removal of superfluous inner nodes.
.sp
The order matters, to shed as much nodes as possible early, and
to avoid unnecessary work later.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIpage\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH KEYWORDS
PEG, graph walking, normalization, page, parser generator, text processing, tree walking
.SH CATEGORY
Page Parser Generator
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/page/page_util_peg.n.



































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/page/page_util_peg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "page_util_peg" n 1.0 tcllib "Parser generator tools"
.BS
.SH NAME
page_util_peg \- page PEG transformation utilities
.SH SYNOPSIS
package require \fBpage::util::peg  ?0.1?\fR
.sp
package require \fBsnit \fR
.sp
\fB::page::util::peg::symbolNodeOf\fR \fItree\fR \fInode\fR
.sp
\fB::page::util::peg::symbolOf\fR \fItree\fR \fInode\fR
.sp
\fB::page::util::peg::updateUndefinedDueRemoval\fR \fItree\fR
.sp
\fB::page::util::peg::flatten\fR \fItreequery\fR \fItree\fR
.sp
\fB::page::util::peg::getWarnings\fR \fItree\fR
.sp
\fB::page::util::peg::printWarnings\fR \fImsg\fR
.sp
\fB::page::util::peg::peOf\fR \fItree\fR \fIeroot\fR
.sp
\fB::page::util::peg::printTclExpr\fR \fIpe\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a few common operations to PEG transformations.
They assume a \fINormalized PE Grammar Tree\fR as input, see the
package \fBpage::util::norm::peg\fR, possibly augmented with
attributes coming from transformations not in conflict with the base
definition.
.PP
.SH API
.TP
\fB::page::util::peg::symbolNodeOf\fR \fItree\fR \fInode\fR
Given an arbitrary expression \fInode\fR in the AST \fItree\fR it
determines the node (itself or an ancestor) containing the name of the
nonterminal symbol the node belongs to, and returns its id. The result
is either the root of the tree (for the start expression), or a
definition node.
.TP
\fB::page::util::peg::symbolOf\fR \fItree\fR \fInode\fR
As \fB::page::util::peg::symbolNodeOf\fR, but returns the symbol name
instead of the node.
.TP
\fB::page::util::peg::updateUndefinedDueRemoval\fR \fItree\fR
The removal of nodes in the AST \fItree\fR can cause symbols to lose
one or more users.
.CS


	A used by B and C,
	B is reachable,
	C is not,

	so A now loses the node in the expression for C calling it,
	or rather, not calling it anymore.

.CE
.IP
This command updates the cross-references and which nonterminals are
now undefined.
.TP
\fB::page::util::peg::flatten\fR \fItreequery\fR \fItree\fR
This commands flattens nested sequence and choice operators in the AST
\fItree\fR, re-using the \fBtreeql\fR object \fItreequery\fR to
run the query determining which nodes to cut.
.TP
\fB::page::util::peg::getWarnings\fR \fItree\fR
This command looks at the attributes of the AST \fItree\fR for
problems with the grammar and issues warnings. They do not prevent us
from writing the grammar, but still represent problems with it the
user should be made aware of.
.sp
The result of the command is a dictionary mapping nonterminal names to
their associated warnings.
.TP
\fB::page::util::peg::printWarnings\fR \fImsg\fR
The argument of the command is a dictionary mapping nonterminal names
to their associated warnings, as generated by, for example, the
command \fB::page::util::peg::getWarnings\fR.
.sp
The warnings contained therein are formatted and then printed via the
log command \fBpage_info\fR. This means that this command can be used
only from within a plugin managed by the package
\fBpage::pluginmgr\fR.
.TP
\fB::page::util::peg::peOf\fR \fItree\fR \fIeroot\fR
This command converts the parsing expression starting at the node
\fIeroot\fR in the AST \fItree\fR into a nested list. The exact syntax
of this list specified by the package \fBgrammar::peg\fR.
.TP
\fB::page::util::peg::printTclExpr\fR \fIpe\fR
This command converts the parsing expression contained in the nested
list \fIpe\fR into a Tcl string which can be placed into a Tcl script.
See the package \fBgrammar::peg\fR for the exact syntax of
\fIpe\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIpage\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH KEYWORDS
PEG, page, parser generator, parsing expression grammar, text processing, transformation
.SH CATEGORY
Page Parser Generator
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/page/page_util_quote.n.





















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/page/page_util_quote.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "page_util_quote" n 1.0 tcllib "Parser generator tools"
.BS
.SH NAME
page_util_quote \- page character quoting utilities
.SH SYNOPSIS
package require \fBpage::util::quote  ?0.1?\fR
.sp
package require \fBsnit \fR
.sp
\fB::page::util::quote::unquote\fR \fIchar\fR
.sp
\fB::page::util::quote::quote'tcl\fR \fIchar\fR
.sp
\fB::page::util::quote::quote'tclstr\fR \fIchar\fR
.sp
\fB::page::util::quote::quote'tclcom\fR \fIchar\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a few utility commands to convert characters
into various forms.
.SH API
.TP
\fB::page::util::quote::unquote\fR \fIchar\fR
A character, as stored in an abstract syntax tree by a PEG processor
(See the packages \fBgrammar::peg::interpreter\fR,
\fBgrammar::me\fR, and their relations), i.e. in some quoted form,
is converted into the equivalent Tcl character. The character is returned
as the result of the command.
.TP
\fB::page::util::quote::quote'tcl\fR \fIchar\fR
This command takes a Tcl character (internal representation) and
converts it into a string which is accepted by the Tcl parser, will
regenerate the character in question and is 7bit ASCII. The string is
returned as the result of this command.
.TP
\fB::page::util::quote::quote'tclstr\fR \fIchar\fR
This command takes a Tcl character (internal representation) and
converts it into a string which is accepted by the Tcl parser and will
generate a human readable representation of the character in question.
The string is returned as the result of this command.
.sp
The string does not use any unprintable characters. It may use
backslash-quoting. High UTF characters are quoted to avoid problems
with the still prevalent ascii terminals. It is assumed that the
string will be used in a double-quoted environment.
.TP
\fB::page::util::quote::quote'tclcom\fR \fIchar\fR
This command takes a Tcl character (internal representation) and
converts it into a string which is accepted by the Tcl parser when
used within a Tcl comment. The string is returned as the result of
this command.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, will undoubtedly contain bugs and other problems.
Please report such in the category \fIpage\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have.
.SH KEYWORDS
page, parser generator, quoting, text processing
.SH CATEGORY
Page Parser Generator
.SH COPYRIGHT
.nf
Copyright (c) 2007 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pki/pki.n.



















































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pki/pki.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2010, 2011, 2012, 2013, Roy Keene, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pki" n 0.6 tcllib "public key encryption"
.BS
.SH NAME
pki \- Implementation of the public key cipher
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpki  ?0.6?\fR
.sp
\fB::pki::encrypt\fR ?\fI-binary\fR? ?\fI-hex\fR? ?\fI-pad\fR? ?\fI-nopad\fR? ?\fI-priv\fR? ?\fI-pub\fR? ?\fI--\fR? \fIinput\fR \fIkey\fR
.sp
\fB::pki::decrypt\fR ?\fI-binary\fR? ?\fI-hex\fR? ?\fI-unpad\fR? ?\fI-nounpad\fR? ?\fI-priv\fR? ?\fI-pub\fR? ?\fI--\fR? \fIinput\fR \fIkey\fR
.sp
\fB::pki::sign\fR \fIinput\fR \fIkey\fR ?\fIalgo\fR?
.sp
\fB::pki::verify\fR \fIsignedmessage\fR \fIplaintext\fR \fIkey\fR ?\fIalgo\fR?
.sp
\fB::pki::key\fR \fIkey\fR ?\fIpassword\fR? ?\fIencodePem\fR?
.sp
\fB::pki::pkcs::parse_key\fR \fIkey\fR ?\fIpassword\fR?
.sp
\fB::pki::x509::parse_cert\fR \fIcert\fR
.sp
\fB::pki::rsa::generate\fR \fIbitlength\fR ?\fIexponent\fR?
.sp
\fB::pki::x509::verify_cert\fR \fIcert\fR \fItrustedcerts\fR ?\fIintermediatecerts\fR?
.sp
\fB::pki::x509::validate_cert\fR \fIcert\fR ?\fB-sign_message\fR \fIdn_of_signer\fR? ?\fB-encrypt_message\fR \fIdn_of_signer\fR? ?\fB-sign_cert\fR \fIdn_to_be_signed\fR \fIca_depth\fR? ?\fB-ssl\fR \fIdn\fR?
.sp
\fB::pki::pkcs::create_csr\fR \fIkeylist\fR \fInamelist\fR ?\fIencodePem\fR? ?\fIalgo\fR?
.sp
\fB::pki::pkcs::parse_csr\fR \fIcsr\fR
.sp
\fB::pki::x509::create_cert\fR \fIsignreqlist\fR \fIcakeylist\fR \fIserial_number\fR \fInotBefore\fR \fInotAfter\fR \fIisCA\fR \fIextensions\fR ?\fIencodePem\fR? ?\fIalgo\fR?
.sp
.BE
.SH DESCRIPTION
.PP
.SH COMMANDS
.TP
\fB::pki::encrypt\fR ?\fI-binary\fR? ?\fI-hex\fR? ?\fI-pad\fR? ?\fI-nopad\fR? ?\fI-priv\fR? ?\fI-pub\fR? ?\fI--\fR? \fIinput\fR \fIkey\fR
Encrypt a message using PKI (probably RSA).
Requires the caller to specify either \fB-priv\fR to encrypt with
the private key or \fB-pub\fR to encrypt with the public key.  The
default option is to pad and return in hex.  One of \fB-pub\fR or
\fB-priv\fR must be specified.
The \fB-hex\fR option causes the data to be returned in encoded as
a hexidecimal string, while the \fB-binary\fR option causes the data
to be returned as a binary string.  If they are specified multiple
times, the last one specified is used.
The \fB-pad\fR option causes the data to be padded per PKCS#1 prior
to being encrypted.  The \fB-nopad\fR inhibits this behaviour.  If
they are specified multiple times, the last one specified is used.
The input to encrypt is specified as \fIinput\fR.
The \fIkey\fR parameter, holding the key to use, is a return value
from either
\fB::pki::pkcs::parse_key\fR,
\fB::pki::x509::parse_cert\fR, or
\fB::pki::rsa::generate\fR.
.sp
Mapping to OpenSSL's \fBopenssl\fR application:
.RS
.IP [1]
"openssl rsautl -encrypt" == "::pki::encrypt -binary -pub"
.IP [2]
"openssl rsautl -sign"    == "::pki::encrypt -binary -priv"
.RE
.TP
\fB::pki::decrypt\fR ?\fI-binary\fR? ?\fI-hex\fR? ?\fI-unpad\fR? ?\fI-nounpad\fR? ?\fI-priv\fR? ?\fI-pub\fR? ?\fI--\fR? \fIinput\fR \fIkey\fR
Decrypt a message using PKI (probably RSA). See \fB::pki::encrypt\fR for option handling.
.sp
Mapping to OpenSSL's \fBopenssl\fR application:
.RS
.IP [1]
"openssl rsautl -decrypt" == "::pki::decrypt -binary -priv"
.IP [2]
"openssl rsautl -verify"  == "::pki::decrypt -binary -pub"
.RE
.TP
\fB::pki::sign\fR \fIinput\fR \fIkey\fR ?\fIalgo\fR?
Digitally sign message \fIinput\fR using the private \fIkey\fR.  If \fIalgo\fR
is ommited "sha1" is assumed.  Possible values for \fIalgo\fR include
"md5", "sha1", "sha256", and "raw".  Specifyin "raw" for \fIalgo\fR will
inhibit the building of an ASN.1 structure to encode which hashing
algorithm was chosen.
The \fIinput\fR should be the plain text, hashing will be performed on it.
The \fIkey\fR should include the private key.
.TP
\fB::pki::verify\fR \fIsignedmessage\fR \fIplaintext\fR \fIkey\fR ?\fIalgo\fR?
Verify a digital signature using a public \fIkey\fR.  Returns true or false.
.TP
\fB::pki::key\fR \fIkey\fR ?\fIpassword\fR? ?\fIencodePem\fR?
Convert a key structure into a serialized PEM (default) or DER encoded private key suitable for other applications.  For RSA keys this means PKCS#1.
.TP
\fB::pki::pkcs::parse_key\fR \fIkey\fR ?\fIpassword\fR?
Convert a PKCS#1 private \fIkey\fR into a usable key, i.e. one which
can be used as argument for
\fB::pki::encrypt\fR,
\fB::pki::decrypt\fR,
\fB::pki::sign\fR, and
\fB::pki::verify\fR.
.TP
\fB::pki::x509::parse_cert\fR \fIcert\fR
Convert an X.509 certificate to a usable (public) key, i.e. one which
can be used as argument for
\fB::pki:encrypt\fR,
\fB::pki::decrypt\fR, and
\fB::pki::verify\fR.
The \fIcert\fR argument can be either PEM or DER encoded.
.TP
\fB::pki::rsa::generate\fR \fIbitlength\fR ?\fIexponent\fR?
Generate a new RSA key pair, the parts of which can be used as
argument for
\fB::pki::encrypt\fR,
\fB::pki::decrypt\fR,
\fB::pki::sign\fR, and
\fB::pki::verify\fR.
The \fIbitlength\fR argument is the length of the public key modulus.
The \fIexponent\fR argument should generally not be specified unless
you really know what you are doing.
.TP
\fB::pki::x509::verify_cert\fR \fIcert\fR \fItrustedcerts\fR ?\fIintermediatecerts\fR?
Verify that a trust can be found between the certificate specified in the
\fIcert\fR argument and one of the certificates specified in the list
of certificates in the \fItrustedcerts\fR argument.  (Eventually the
chain can be through untrusted certificates listed in the \fIintermediatecerts\fR
argument, but this is currently unimplemented).
The certificates specified in the \fIcert\fR and \fItrustedcerts\fR option
should be parsed (from \fB::pki::x509::parse_cert\fR).
.TP
\fB::pki::x509::validate_cert\fR \fIcert\fR ?\fB-sign_message\fR \fIdn_of_signer\fR? ?\fB-encrypt_message\fR \fIdn_of_signer\fR? ?\fB-sign_cert\fR \fIdn_to_be_signed\fR \fIca_depth\fR? ?\fB-ssl\fR \fIdn\fR?
Validate that a certificate is valid to be used in some capacity.  If
multiple options are specified they must all be met for this procedure
to return "true".
Currently, only the \fB-sign_cert\fR option is functional.
Arguments for the \fB-sign_cert\fR option are \fIdn_to_be_signed\fR
and \fIca_depth\fR.  The \fIdn_to_be_signed\fR is the distinguished from
the subject of a certificate to verify that the certificate specified in
the \fIcert\fR argument can sign.  The \fIca_depth\fR argument is used to
indicate at which depth the verification should be done at.  Some
certificates are limited to how far down the chain they can be used to
verify a given certificate.
.TP
\fB::pki::pkcs::create_csr\fR \fIkeylist\fR \fInamelist\fR ?\fIencodePem\fR? ?\fIalgo\fR?
Generate a certificate signing request from a key pair specified in
the \fIkeylist\fR argument.
The \fInamelist\fR argument is a list of "name" followed by "value"
pairs to encoding as the requested distinguished name in the CSR.
The \fIencodePem\fR option specifies whether or not the result should
be PEM encoded or DER encoded.  A "true" value results in the result
being PEM encoded, while any other value 9results in the the result
being DER encoded.  DER encoding is the default.
The \fIalgo\fR argument specifies the hashing algorithm we should use
to sign this certificate signing request with.  The default is "sha1".
Other possible values include "md5" and "sha256".
.TP
\fB::pki::pkcs::parse_csr\fR \fIcsr\fR
Parse a Certificate Signing Request.  The \fIcsr\fR argument can be
either PEM or DER encoded.
.TP
\fB::pki::x509::create_cert\fR \fIsignreqlist\fR \fIcakeylist\fR \fIserial_number\fR \fInotBefore\fR \fInotAfter\fR \fIisCA\fR \fIextensions\fR ?\fIencodePem\fR? ?\fIalgo\fR?
Sign a signing request (usually from \fB::pki::pkcs::create_csr\fR or
\fB::pki::pkcs::parse_csr\fR) with a Certificate Authority (CA) certificate.
The \fIsignreqlist\fR argument should be the parsed signing request.
The \fIcakeylist\fR argument should be the parsed CA certificate.
The \fIserial_number\fR argument should be a serial number unique to
this certificate from this certificate authority.
The \fInotBefore\fR and \fInotAfter\fR arguments should contain the
time before and after which (respectively) the certificate should
be considered invalid.  The time should be encoded as something
\fBclock format\fR will accept (i.e., the results of \fBclock seconds\fR
and \fBclock add\fR).
The \fIisCA\fR argument is a boolean argumen describing whether or not
the signed certificate should be a a CA certificate.  If specified as
true the "id-ce-basicConstraints" extension is added with the arguments
of "critical" being true, "allowCA" being true, and caDepth being
-1 (infinite).
The \fIextensions\fR argument is a list of extensions and their parameters
that should be encoded into the created certificate.   Currently only one
extension is understood ("id-ce-basicConstraints").  It accepts three
arguments \fIcritical\fR \fIallowCA\fR \fIcaDepth\fR.  The \fIcritical\fR
argument to this extension (and any extension) whether or not the
validator should reject the certificate as invalid if it does not
understand the extension (if set to "true") or should ignore the extension
(if set to "false").  The \fIallowCA\fR argument is used to specify
as a boolean value whether or not we can be used a certificate
authority (CA).  The \fIcaDepth\fR argument indicates how many children
CAs can be children of this CA in a depth-wise fashion.  A value of "0"
for the \fIcaDepth\fR argument means that this CA cannot sign a CA
certificate and have the result be valid.  A value of "-1" indicates
infinite depth.
.PP
.SH EXAMPLES
.CS



.CE
.CS



.CE
.SH REFERENCES
.IP [1]
.PP
.SH AUTHORS
Roy Keene
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIrsa\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
aes(n), blowfish(n), des(n), md5(n), sha1(n)
.SH KEYWORDS
cipher, data integrity, encryption, public key cipher, rsa, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2010, 2011, 2012, 2013, Roy Keene, Andreas Kupries

.fi

Added embedded/man/files/modules/pluginmgr/pluginmgr.n.
























































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pluginmgr/pluginmgr.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pluginmgr" n 0.3 tcllib "Plugin management"
.BS
.SH NAME
pluginmgr \- Manage a plugin
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBpluginmgr  ?0.3?\fR
.sp
\fB::pluginmgr\fR \fIobjectName\fR ?\fIoption value\fR...?
.sp
\fB::pluginmgr::paths\fR \fIobjectName\fR \fIname\fR...
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBclone\fR
.sp
\fIobjectName\fR \fBconfigure\fR
.sp
\fIobjectName\fR \fBconfigure\fR \fIoption\fR
.sp
\fIobjectName\fR \fBconfigure\fR \fB-option\fR \fIvalue\fR...
.sp
\fIobjectName\fR \fBcget\fR \fB-option\fR
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBdo\fR \fIarg\fR...
.sp
\fIobjectName\fR \fBinterpreter\fR
.sp
\fIobjectName\fR \fBplugin\fR
.sp
\fIobjectName\fR \fBload\fR \fIstring\fR
.sp
\fIobjectName\fR \fBunload\fR
.sp
\fIobjectName\fR \fBlist\fR
.sp
\fIobjectName\fR \fBpath\fR \fIpath\fR
.sp
\fIobjectName\fR \fBpaths\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands and objects for the generic management
of plugins which can be loaded into an application.
.PP
To avoid the implementation of yet another system to locate Tcl code
the system provides by this package is built on top of the regular
package management system. Each plugin is considered as a package and
a simple invokation of \fBpackage require\fR is enough to locate and
load it, if it exists. The only time we will need additional paths is
when a plugin manager is part of a wrapped application and has to be
able to search for plugins existing outside of that application. For
this situation the package provides a command to create a general set
of such paths based on names for the plugin manager and/or application
in question.
.PP
The main contribution of this package is a generic framework which
allows the easy declaration of
.IP [1]
How to translate a plugin name to the name of the package implementing
it, and vice versa.
.IP [2]
The list of commands a plugin has to provide as API, and also of more
complex checks as code.
.IP [3]
The list of commands expected by the plugin from the environment.
.PP
This then allows the easy generation of plugin managers customized to
particular types of plugins for an application.
.PP
It should be noted that all plugin code is considered untrusted and
will always be executed within a safe interpreter. The interpreter is
enabled enough to allow plugins the loading of all additional packages
they may need.
.SH "PUBLIC API"
.SS "PACKAGE COMMANDS"
.TP
\fB::pluginmgr\fR \fIobjectName\fR ?\fIoption value\fR...?
This command creates a new plugin manager object with an associated
Tcl command whose name is \fIobjectName\fR. This \fIobject\fR command
is explained in full detail in the sections \fBOBJECT COMMAND\fR
and \fBOBJECT METHODS\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.sp
The options and their values coming after the name of the object are
used to set the initial configuration of the mamager object,
specifying the applicable plugins and their API.
.TP
\fB::pluginmgr::paths\fR \fIobjectName\fR \fIname\fR...
This utility command adds a set of paths to the specified object,
based on the given \fIname\fRs.
It will search for:
.RS
.IP [1]
The environment variable \fB\fIname\fR_PLUGINS\fR. Its contents will
be interpreted as a list of package paths. The entries have to be
separated by either \fB:\fR (unix) or \fB;\fR (windows).
.sp
The name will be converted to upper-case letters.
.IP [2]
The registry entry "HKEY_LOCAL_MACHINE\\SOFTWARE\\\fIname\fR\\PLUGINS".
Its contents will be interpreted as a list of package paths. The
entries have to be separated by \fB;\fR. This item is considered
only when on Windows (tm).
.sp
The casing of letters is not changed.
.IP [3]
The registry entry "HKEY_CURRENT_USER\\SOFTWARE\\\fIname\fR\\PLUGINS".
Its contents will be interpreted as a list of package paths. The
entries have to be separated by \fB;\fR. This item is considered
only when on Windows (tm).
.sp
The casing of letters is not changed.
.IP [4]
The directory "\fI~/.\fIname\fR/plugin\fR".
.IP [5]
The directory "\fI~/.\fIname\fR/plugins\fR".
.sp
The casing of letters is not changed.
.RE
.sp
and add all the paths found that way to the list of package paths
maintained by the object.
.sp
If \fIname\fR is namespaced each item in the list will be repeated per
prefix of \fIname\fR, with conversion of :-sequences into the proper
separator (underscore for environment variables, backslash for
registry entries, and / for directories).
.sp
Examples:
.sp
.CS


    ::pluginmgr::paths ::obj docidx

    => env  DOCIDX_PLUGINS
       reg  HKEY_LOCAL_MACHINE\\SOFTWARE\\docidx\\PLUGINS
       reg  HKEY_CURRENT_USER\\SOFTWARE\\docidx\\PLUGINS
       path ~/.docidx/plugins

    ::pluginmgr::paths ::obj doctools::idx

    => env  DOCTOOLS_PLUGINS
       env  DOCTOOLS_IDX_PLUGINS
       reg  HKEY_LOCAL_MACHINE\\SOFTWARE\\doctools\\PLUGINS
       reg  HKEY_LOCAL_MACHINE\\SOFTWARE\\doctools\\idx\\PLUGINS
       reg  HKEY_CURRENT_USER\\SOFTWARE\\doctools\\PLUGINS
       reg  HKEY_CURRENT_USER\\SOFTWARE\\doctools\\idx\\PLUGINS
       path ~/.doctools/plugin
       path ~/.doctools/idx/plugin

.CE
.PP
.SS "OBJECT COMMAND"
All commands created by the command \fB::pluginmgr\fR (See section
\fBPACKAGE COMMANDS\fR) have the following general form and may
be used to invoke various operations on their plugin manager object.
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the exact
behavior of the command. See section \fBOBJECT METHODS\fR for
the detailed specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBclone\fR
This method creates a new plugin management object and returns the
associated object command. The generated object is a clone of the
object the method was invoked on. I.e. the new object will have the
same configuration as the current object. With regard to state, if the
current object has a plugin loaded then this plugin and all associated
state is moved to the generated clone and the current object is reset
into the base state (no plugin loaded). In this manner a configured
plugin manager is also a factory for loaded plugins.
.TP
\fIobjectName\fR \fBconfigure\fR
The method returns a list of all known options and their current
values when called without any arguments.
.TP
\fIobjectName\fR \fBconfigure\fR \fIoption\fR
The method behaves like the method \fBcget\fR when called with a
single argument and returns the value of the option specified by said
argument.
.TP
\fIobjectName\fR \fBconfigure\fR \fB-option\fR \fIvalue\fR...
The method reconfigures the specified \fBoption\fRs of the object,
setting them to the associated \fIvalue\fRs, when called with an even
number of arguments, at least two.
.sp
The legal options are described in the section
\fBOBJECT CONFIGURATION\fR.
.TP
\fIobjectName\fR \fBcget\fR \fB-option\fR
This method expects a legal configuration option as argument and will
return the current value of that option for the object the method was
invoked for.
.sp
The legal configuration options are described in section
\fBOBJECT CONFIGURATION\fR.
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBdo\fR \fIarg\fR...
This method interprets its list of arguments as the words of a command
and invokes this command in the execution context of the plugin.
The result of the invoked command is made the result of the method.
The call will fail with an error if no valid plugin has been loaded
into the manager object.
.TP
\fIobjectName\fR \fBinterpreter\fR
This method returns the handle of the safe interpreter the current
plugin is loaded into. An empty string as return value signals that
the manager currently has no valid plugin loaded.
.TP
\fIobjectName\fR \fBplugin\fR
This method returns the name of the plugin currently loaded. An empty
string as return value signals that the manager currently has no valid
plugin loaded.
.TP
\fIobjectName\fR \fBload\fR \fIstring\fR
This method loads, validates, and initializes a named plugin into the
manager object.
.sp
The algorithm to locate and load the plugin employed is:
.RS
.IP [1]
If the \fIstring\fR contains the path to an existing file then this
file is taken as the implementation of the plugin.
.IP [2]
Otherwise the plugin name is translated into a package name via the value
of the option \fB-pattern\fR and then loaded through the
regular package management.
.IP [3]
The load fails.
.RE
.sp
The algorithm to validate and initialize the loaded code is:
.RS
.IP [1]
If the option \fB-api\fR is non-empty introspection commands are
used to ascertain that the plugin provides the listed commands.
.IP [2]
If the option \fB-check\fR is non-empty the specified command
prefix is called.
.IP [3]
If either of the above fails the candidate plugin is unloaded again
.IP [4]
Otherwise all the commands specified via the option
\fB-cmds\fR are installed in the plugin.
.RE
.sp
A previously loaded plugin is discarded, but only if the new plugin
was found and sucessfully validated and initialized. Note that there
will be no intereference between old and new plugin as both will be
put into separate safe interpreters.
.TP
\fIobjectName\fR \fBunload\fR
This method unloads the currently loaded plugin. It returns the empty
string. The call will be silently ignored if no plugin is loaded at
all.
.TP
\fIobjectName\fR \fBlist\fR
This method uses the contents of the option \fB-pattern\fR to find
all packages which can be plugins under the purview of this manager
object. It translates their names into plugin names and returns a list
containing them.
.TP
\fIobjectName\fR \fBpath\fR \fIpath\fR
This methods adds the specified \fIpath\fR to the list of additional
package paths to look at when searching for a plugin. It returns the
empty string. Duplicate paths are ignored, i.e. each path is added
only once. Paths are made absolute, but are not normalized.
.TP
\fIobjectName\fR \fBpaths\fR
This method returns a list containing all additional paths which have
been added to the plugin manager object since its creation.
.PP
.SS "OBJECT CONFIGURATION"
All plugin manager objects understand the following configuration options:
.TP
\fB-pattern\fR \fIstring\fR
The value of this option is a glob pattern which has to contain
exactly one '*'-operator. All packages whose names match this pattern
are the plugins recognized by the manager object. And vice versa, the
replacement of the '*'-operator with a plugin name will yield the name
of the package implementing that plugin.
.sp
This option has no default, except if option \fB-name\fR was set.
It has to be set before attempting to load a plugin, either directly,
or through option \fB-name\fR.
.TP
\fB-api\fR \fIlist\fR
The value of this option is a list of command names, and any plugin
loaded has to provide these commands. Names which are not fully
qualified are considered to be rooted in the global namespace.
If empty no expectations are made on the plugin. The default value is
the empty list.
.TP
\fB-check\fR \fIcmdprefix\fR
The value of this option is interpreted as a command prefix.
Its purpose is to perform complex checks on a loaded plugin package to
validate it, which go beyond a simple list of provided commands.
.sp
It is called with the manager object command as the only argument and
has to return a boolean value. A value of \fBtrue\fR will be
interpreted to mean that the candidate plugin passed the test.
The call will happen if and only if the candidate plugin already
passed the basic API check specified through the option \fB-api\fR.
.sp
The default value is the empty list, which causes the manager object
to suppress the call and to assume the candidate plugin passes.
.TP
\fB-cmds\fR \fIdict\fR
The value of this option is a dictionary.  It specifies the commands
which will be made available to the plugin (as keys), and the trusted
commands in the environment which implement them (as values).
The trusted commands will be executed in the interpreter specified by
the option \fB-cmdip\fR.
The default value is the empty dictionary.
.TP
\fB-cmdip\fR \fIipspec\fR
The value of this option is the path of the interpreter where the
trusted commands given to the plugin will be executed in.
The default is the empty string, referring to the current interpreter.
.TP
\fB-setup\fR \fIcmdprefix\fR
The value of this option is interpreted as a command prefix.
.sp
It is called whenever a new safe interpreter for a plugin has been
created, but before a plugin is loaded. It is provided with the
manager object command and the interpreter handle as its only
arguments. Any return value will be ignored.
.sp
Its purpose is give a user of the plugin management the ability to
define commands, packages, etc. a chosen plugin may need while being
loaded.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpluginmgr\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
plugin management, plugin search
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2005 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/png/png.n.


















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/png/png.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004, Code: Aaron Faupell <[email protected]>
'\" Copyright (c) 2004, Doc: Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "png" n 0.1.2 tcllib "Image manipulation"
.BS
.SH NAME
png \- PNG querying and manipulation of meta data
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBcrc32 \fR
.sp
package require \fBpng  ?0.1.2?\fR
.sp
\fB::png::validate\fR \fIfile\fR
.sp
\fB::png::isPNG\fR \fIfile\fR
.sp
\fB::png::imageInfo\fR \fIfile\fR
.sp
\fB::png::getTimestamp\fR \fIfile\fR
.sp
\fB::png::setTimestamp\fR \fIfile\fR \fItime\fR
.sp
\fB::png::getComments\fR \fIfile\fR
.sp
\fB::png::removeComments\fR \fIfile\fR
.sp
\fB::png::addComment\fR \fIfile\fR \fIkeyword\fR \fItext\fR
.sp
\fB::png::addComment\fR \fIfile\fR \fIkeyword\fR \fIlang\fR \fIkeyword2\fR \fItext\fR
.sp
\fB::png::image\fR \fIfile\fR
.sp
\fB::png::write\fR \fIfile\fR \fIdata\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides commands to query and modify PNG images. PNG
stands for \fIPortable Network Graphics\fR and is specified at
\fIhttp://www.libpng.org/pub/png/spec/1.2\fR.
.SH COMMANDS
.TP
\fB::png::validate\fR \fIfile\fR
Returns a value indicating if \fIfile\fR is a valid PNG file. The file
is checked for PNG signature, each chunks checksum is verified,
existence of a data chunk is verified, first chunk is checked for
header, last chunk is checked for ending. Things \fInot\fR checked
for are: validity of values within a chunk, multiple header chunks,
noncontiguous data chunks, end chunk before actual eof. This procedure
can take lots of time.
.sp
Possible return values:
.RS
.TP
OK
File is a valid PNG file.
.TP
SIG
no/broken PNG signature.
.TP
BADLEN
corrupt chunk length.
.TP
EOF
premature end of file.
.TP
NOHDR
missing header chunk.
.TP
CKSUM
crc mismatch.
.TP
NODATA
missing data chunk(s).
.TP
NOEND
missing end marker.
.RE
.TP
\fB::png::isPNG\fR \fIfile\fR
Returns a boolean value indicating if the file \fIfile\fR starts with
a PNG signature. This is a much faster and less intensive check than
\fB::png::validate\fR as it does not check if the PNG data is valid.
.TP
\fB::png::imageInfo\fR \fIfile\fR
Returns a dictionary with keys \fBwidth\fR, \fBheight\fR,
\fBdepth\fR, \fBcolor\fR, \fBcompression\fR, \fBfilter\fR, and
\fBinterlace\fR. The values are the associated properties of the PNG
image in \fIfile\fR.
Throws an error if file is not a PNG image, or if the checksum of the
header is invalid. For information on interpreting the values for the
returned properties see
\fIhttp://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html\fR.
.TP
\fB::png::getTimestamp\fR \fIfile\fR
Returns the epoch time if a timestamp chunk is found in the PNG image
contained in the \fIfile\fR, otherwise returns the empty string. Does
not attempt to verify the checksum of the timestamp chunk.
Throws an error if the \fIfile\fR is not a valid PNG image.
.TP
\fB::png::setTimestamp\fR \fIfile\fR \fItime\fR
Writes a new timestamp to the \fIfile\fR, either replacing the old
timestamp, or adding one just before the data chunks if there was no
previous timestamp. \fItime\fR is the new time in the gmt epoch
format.
Throws an error if \fIfile\fR is not a valid PNG image.
.TP
\fB::png::getComments\fR \fIfile\fR
Currently supports only uncompressed comments. Does not attempt to
verify the checksums of the comment chunks. Returns a list where each
element is a comment. Each comment is itself a list. The list for a
plain text comment consists of 2 elements: the human readable keyword,
and the text data. A unicode (international) comment consists of 4
elements: the human readable keyword, the language identifier, the
translated keyword, and the unicode text data.
Throws an error if \fIfile\fR is not a valid PNG image.
.TP
\fB::png::removeComments\fR \fIfile\fR
Removes all comments from the PNG image in \fIfile\fR. Beware - This
uses memory equal to the file size minus comments, to hold the
intermediate result.
Throws an error if \fIfile\fR is not a valid PNG image.
.TP
\fB::png::addComment\fR \fIfile\fR \fIkeyword\fR \fItext\fR
Adds a plain \fItext\fR comment to the PNG image in \fIfile\fR, just
before the first data chunk. Will throw an error if no data chunk is
found. \fIkeyword\fR has to be less than 80 characters long to conform
to the PNG specification.
.TP
\fB::png::addComment\fR \fIfile\fR \fIkeyword\fR \fIlang\fR \fIkeyword2\fR \fItext\fR
Adds a unicode (international) comment to the PNG image in \fIfile\fR,
just before the first data chunk. Will throw an error if no data chunk
is found. \fIkeyword\fR has to be less than 80 characters long to
conform to the PNG specification. \fIkeyword2\fR is the translated
\fIkeyword\fR, in the language specified by the language identifier
\fIlang\fR.
.TP
\fB::png::image\fR \fIfile\fR
Given a PNG file returns the image in the list of scanlines format used by Tk_GetColor.
.TP
\fB::png::write\fR \fIfile\fR \fIdata\fR
Takes a list of scanlines in the Tk_GetColor format and writes the represented image
to \fIfile\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpng\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
comment, image, png, timestamp
.SH CATEGORY
File formats
.SH COPYRIGHT
.nf
Copyright (c) 2004, Code: Aaron Faupell <[email protected]>
Copyright (c) 2004, Doc:  Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pop3/pop3.n.


































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pop3/pop3.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pop3" n 1.9 tcllib "Tcl POP3 Client Library"
.BS
.SH NAME
pop3 \- Tcl client for POP3 email protocol
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBpop3  ?1.9?\fR
.sp
\fB::pop3::open\fR ?\fB-msex\fR 0|1? ?\fB-retr-mode\fR retr|list|slow? ?\fB-socketcmd\fR cmdprefix? ?\fB-stls\fR 0|1? ?\fB-tls-callback\fR stls-callback-command? \fIhost username password\fR ?\fIport\fR?
.sp
\fB::pop3::config\fR \fIchan\fR
.sp
\fB::pop3::status\fR \fIchan\fR
.sp
\fB::pop3::last\fR \fIchan\fR
.sp
\fB::pop3::retrieve\fR \fIchan startIndex\fR ?\fIendIndex\fR?
.sp
\fB::pop3::delete\fR \fIchan startIndex\fR ?\fIendIndex\fR?
.sp
\fB::pop3::list\fR \fIchan\fR ?\fImsg\fR?
.sp
\fB::pop3::top\fR \fIchan\fR \fImsg\fR \fIn\fR
.sp
\fB::pop3::uidl\fR \fIchan\fR ?\fImsg\fR?
.sp
\fB::pop3::capa\fR \fIchan\fR
.sp
\fB::pop3::close\fR \fIchan\fR
.sp
.BE
.SH DESCRIPTION
The \fBpop3\fR package provides a simple Tcl-only client library
for the POP3 email protocol as specified in
\fIRFC 1939\fR [http://www.rfc-editor.org/rfc/rfc1939.txt].
It works by opening the standard POP3 socket on the server,
transmitting the username and password, then providing a Tcl API to
access the POP3 protocol commands.  All server errors are returned as
Tcl errors (thrown) which must be caught with the Tcl \fBcatch\fR
command.
.SH API
.TP
\fB::pop3::open\fR ?\fB-msex\fR 0|1? ?\fB-retr-mode\fR retr|list|slow? ?\fB-socketcmd\fR cmdprefix? ?\fB-stls\fR 0|1? ?\fB-tls-callback\fR stls-callback-command? \fIhost username password\fR ?\fIport\fR?
Open a socket connection to the server specified by \fIhost\fR,
transmit the \fIusername\fR and \fIpassword\fR as login information to
the server.  The default port number is \fB110\fR, which can be
overridden using the optional \fIport\fR argument.  The return value
is a channel used by all of the other ::pop3 functions.
.sp
The command recognizes three options
.RS
.TP
\fB-msex\fR boolean
Setting this option tells the package that the server we are talking
to is an MS Exchange server (which has some oddities we have to work
around). The default is \fBFalse\fR.
.TP
\fB-retr-mode\fR retr|list|slow
The retrieval mode determines how exactly messages are read from the
server.
The allowed values are \fBretr\fR, \fBlist\fR and \fBslow\fR.
The default is \fBretr\fR. See \fB::pop3::retrieve\fR for more
information.
.TP
\fB-socketcmd\fR cmdprefix
This option allows the user to overide the use of the builtin
\fBsocket\fR command with any API-compatible command. The envisioned
main use is the securing of the new connection via SSL, through the
specification of the command \fBtls::socket\fR. This command is
specially recognized as well, changing the default port of the
connection to \fB995\fR.
.TP
\fB-stls\fR boolean
Setting this option tells the package to secure the connection using
SSL or TLS. It performs STARTTLS as described in IETF RFC 2595, it
first opens a normal, unencrypted connection and then negotiates a
SSLv3 or TLSv1 connection. If the connection cannot be secured, the
connection will be closed and an error will be returned
.TP
\fB-tls-callback\fR stls-callback-command
This option allows the user to overide the \fBtls::callback\fR used during
the \fB-stls\fR SSL/TLS handshake. See the TLS manual for details on how
to implement this callback.
.RE
.TP
\fB::pop3::config\fR \fIchan\fR
Returns the configuration of the pop3 connection identified by the
channel handle \fIchan\fR as a serialized array.
.TP
\fB::pop3::status\fR \fIchan\fR
Query the server for the status of the mail spool.  The status is
returned as a list containing two elements, the first is the number of
email messages on the server and the second is the size (in octets, 8
bit blocks) of the entire mail spool.
.TP
\fB::pop3::last\fR \fIchan\fR
Query the server for the last email message read from the spool.  This
value includes all messages read from all clients connecting to the
login account.  This command may not be supported by the email server,
in which case the server may return 0 or an error.
.TP
\fB::pop3::retrieve\fR \fIchan startIndex\fR ?\fIendIndex\fR?
Retrieve a range of messages from the server.  If the \fIendIndex\fR
is not specified, only one message will be retrieved.  The return
value is a list containing each message as a separate element.  See
the \fIstartIndex\fR and \fIendIndex\fR descriptions below.
.sp
The retrieval mode determines how exactly messages are read from the
server. The mode \fBretr\fR assumes that the RETR command delivers
the size of the message as part of the command status and uses this to
read the message efficiently. In mode \fBlist\fR RETR does not
deliver the size, but the LIST command does and we use this to
retrieve the message size before the actual retrieval, which can then
be done efficiently. In the last mode, \fBslow\fR, the system is
unable to obtain the size of the message to retrieve in any manner and
falls back to reading the message from the server line by line.
.sp
It should also be noted that the system checks upon the configured
mode and falls back to the slower modes if the above assumptions are
not true.
.TP
\fB::pop3::delete\fR \fIchan startIndex\fR ?\fIendIndex\fR?
Delete a range of messages from the server.  If the \fIendIndex\fR is
not specified, only one message will be deleted.  Note, the indices
are not reordered on the server, so if you delete message 1, then the
first message in the queue is message 2 (message index 1 is no longer
valid).  See the \fIstartIndex\fR and \fIendIndex\fR descriptions
below.
.RS
.TP
\fIstartIndex\fR
The \fIstartIndex\fR may be an index of a specific message starting
with the index 1, or it have any of the following values:
.RS
.TP
\fBstart\fR
This is a logical value for the first message in the spool, equivalent
to the value 1.
.TP
\fBnext\fR
The message immediately following the last message read, see
\fB::pop3::last\fR.
.TP
\fBend\fR
The most recent message in the spool (the end of the spool).  This is
useful to retrieve only the most recent message.
.RE
.TP
\fIendIndex\fR
The \fIendIndex\fR is an optional parameter and defaults to the value
"-1", which indicates to only retrieve the one message specified by
\fIstartIndex\fR.  If specified, it may be an index of a specific
message starting with the index "1", or it may have any of the
following values:
.RS
.TP
\fBlast\fR
The message is the last message read by a POP3 client, see
\fB::pop3::last\fR.
.TP
\fBend\fR
The most recent message in the spool (the end of the spool).
.RE
.RE
.TP
\fB::pop3::list\fR \fIchan\fR ?\fImsg\fR?
Returns the scan listing of the mailbox. If parameter \fImsg\fR is
given, then the listing only for that message is returned.
.TP
\fB::pop3::top\fR \fIchan\fR \fImsg\fR \fIn\fR
Optional POP3 command, not all servers may support this.
\fB::pop3::top\fR retrieves headers of a message, specified by
parameter \fImsg\fR, and number of \fIn\fR lines from the message
body.
.TP
\fB::pop3::uidl\fR \fIchan\fR ?\fImsg\fR?
Optional POP3 command, not all servers may support this.
\fB::pop3::uidl\fR returns the uid listing of the mailbox. If the
parameter \fImsg\fR is specified, then the listing only for that
message is returned.
.TP
\fB::pop3::capa\fR \fIchan\fR
Optional POP3 command, not all servers may support this.
\fB::pop3::capa\fR returns a list of the capabilities of the server.
TOP, SASL, UIDL, LOGIN-DELAY and STLS are typical capabilities.
See IETF RFC 2449.
.TP
\fB::pop3::close\fR \fIchan\fR
Gracefully close the connect after sending a POP3 QUIT command down
the socket.
.PP
.SH "SECURE MAIL TRANSFER"
A pop3 connection can be secured with SSL/TLS by requiring the package
\fBTLS\fR and then using either the option \fB-socketcmd\fR or
the option \fB-stls\fR of the command \fBpop3::open\fR.
The first method, option \fB-socketcmd\fR, will force the use
of the \fBtls::socket\fR command when opening the connection. This is
suitable for POP3 servers which expect SSL connections only. These will
generally be listening on port 995.
.CS


	package require tls
	tls::init -cafile /path/to/ca/cert -keyfile ...

	# Create secured pop3 channel
	pop3::open -socketcmd tls::socket \\\\
		$thehost $theuser $thepassword

	...

.CE
The second method, option \fB-stls\fR, will connect to the standard POP3
port and then perform an STARTTLS handshake. This will only work for POP3
servers which have this capability. The package will confirm that the
server supports STARTTLS and the handshake was performed correctly before
proceeding with authentication.
.CS


	package require tls
	tls::init -cafile /path/to/ca/cert -keyfile ...

	# Create secured pop3 channel
	pop3::open -stls 1 \\\\
		$thehost $theuser $thepassword

	...

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpop3\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
email, mail, pop, pop3, rfc 1939, secure, ssl, tls
.SH CATEGORY
Networking

Added embedded/man/files/modules/pop3d/pop3d.n.










































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pop3d/pop3d.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002-2009 Andreas Kupries <[email protected]>
'\" Copyright (c) 2005 Reinhard Max <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pop3d" n 1.1.0 tcllib "Tcl POP3 Server Package"
.BS
.SH NAME
pop3d \- Tcl POP3 server implementation
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBpop3d  ?1.1.0?\fR
.sp
\fB::pop3d::new\fR ?\fIserverName\fR?
.sp
\fBserverName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIserverName\fR \fBup\fR
.sp
\fIserverName\fR \fBdown\fR
.sp
\fIserverName\fR \fBdestroy\fR ?\fImode\fR?
.sp
\fIserverName\fR \fBconfigure\fR
.sp
\fIserverName\fR \fBconfigure\fR \fI-option\fR
.sp
\fIserverName\fR \fBconfigure\fR \fI-option value\fR...
.sp
\fIserverName\fR \fBcget\fR \fI-option\fR
.sp
\fIserverName\fR \fBconn\fR list
.sp
\fIserverName\fR \fBconn\fR state \fIid\fR
.sp
\fIauthCmd\fR \fBexists\fR \fIname\fR
.sp
\fIauthCmd\fR \fBlookup\fR \fIname\fR
.sp
\fIstorageCmd\fR \fBdele\fR \fImbox\fR \fImsgList\fR
.sp
\fIstorageCmd\fR \fBlock\fR \fImbox\fR
.sp
\fIstorageCmd\fR \fBunlock\fR \fImbox\fR
.sp
\fIstorageCmd\fR \fBsize\fR \fImbox\fR ?\fImsgId\fR?
.sp
\fIstorageCmd\fR \fBstat\fR \fImbox\fR
.sp
\fIstorageCmd\fR \fBget\fR \fImbox\fR \fImsgId\fR
.sp
.BE
.SH DESCRIPTION
.PP
.TP
\fB::pop3d::new\fR ?\fIserverName\fR?
This command creates a new server object with an associated global Tcl
command whose name is \fIserverName\fR.
.PP
The command \fBserverName\fR may be used to invoke various operations
on the server.  It has the following general form:
.TP
\fBserverName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.PP
.PP
A pop3 server can be started on any port the caller has permission for
from the operating system. The default port will be 110, which is the
port defined by the standard specified in
RFC 1939 (\fIhttp://www.rfc-editor.org/rfc/rfc1939.txt\fR).
After creating, configuring and starting a the server object will
listen for and accept connections on that port and handle them
according to the POP3 protocol.
.PP
\fINote:\fR The server provided by this module will handle only the
basic protocol by itself. For the higher levels of user authentication
and handling of the actual mailbox contents callbacks will be invoked.
.PP
The following commands are possible for server objects:
.TP
\fIserverName\fR \fBup\fR
After this call the server will listen for connections on its configured port.
.TP
\fIserverName\fR \fBdown\fR
After this call the server will stop listening for connections. This
does not affect existing connections.
.TP
\fIserverName\fR \fBdestroy\fR ?\fImode\fR?
Destroys the server object. Currently open connections are handled
depending on the chosen mode.
The provided \fImode\fRs are:
.RS
.TP
\fBkill\fR
Destroys the server immediately, and forcefully closes all currently
open connections. This is the default mode.
.TP
\fBdefer\fR
Stops the server from accepting new connections and will actually
destroy it only after the last of the currently open connections for
the server is closed.
.RE
.TP
\fIserverName\fR \fBconfigure\fR
Returns a list containing all options and their current values in a
format suitable for use by the command \fBarray set\fR. The options
themselves are described in section \fBOptions\fR.
.TP
\fIserverName\fR \fBconfigure\fR \fI-option\fR
Returns the current value of the specified option. This is an alias
for the method \fBcget\fR. The options themselves are described in
section \fBOptions\fR.
.TP
\fIserverName\fR \fBconfigure\fR \fI-option value\fR...
Sets the specified option to the provided value. The options
themselves are described in section \fBOptions\fR.
.TP
\fIserverName\fR \fBcget\fR \fI-option\fR
Returns the current value of the specified option. The options
themselves are described in section \fBOptions\fR.
.TP
\fIserverName\fR \fBconn\fR list
Returns a list containing the ids of all connections currently open.
.TP
\fIserverName\fR \fBconn\fR state \fIid\fR
Returns a list suitable for [\fBarray set\fR] containing the
state of the connection referenced by \fIid\fR.
.PP
.SH OPTIONS
The following options are available to pop3 server objects.
.TP
\fB-port\fR \fIport\fR
Defines the \fIport\fR to listen on for new connections. Default is
110. This option is a bit special. If \fIport\fR is set to "0" the
server, or rather the operating system, will select a free port on its
own. When querying \fB-port\fR the id of this chosen port will be
returned. Changing the port while the server is up will neither change
the returned value, nor will it change on which port the server is
listening on. Only after resetting the server via a call to
\fBdown\fR followed by a call to \fBup\fR will the new port take
effect. It is at that time that the value returned when querying
\fB-port\fR will change too.
.TP
\fB-auth\fR \fIcommand\fR
Defines a \fIcommand\fR prefix to call whenever the authentication of
a user is required. If no such command is specified the server will
reject all users. The interface which has to be provided by the
command prefix is described in section \fBAuthentication\fR.
.TP
\fB-storage\fR \fIcommand\fR
Defines a \fIcommand\fR prefix to call whenever the handling of
mailbox contents is required. If no such command is specified the
server will claim that all mailboxes are empty. The interface which
has to be provided by the command prefix is described in section
\fBMailboxes\fR.
.TP
\fB-socket\fR \fIcommand\fR
Defines a \fIcommand\fR prefix to call for opening the listening socket.
This can be used to make the pop3 server listen on a SSL socket
as provided by the \fBtls\fR package, see the command \fBtls::socket\fR.
.PP
.SH AUTHENTICATION
Here we describe the interface which has to be provided by the
authentication callback so that pop3 servers following the interface
of this module are able to use it.
.TP
\fIauthCmd\fR \fBexists\fR \fIname\fR
This method is given a user\fIname\fR and has to return a boolean
value telling whether or not the specified user exists.
.TP
\fIauthCmd\fR \fBlookup\fR \fIname\fR
This method is given a user\fIname\fR and has to return a two-element
list containing the password for this user and a storage reference, in
this order.
.sp
The storage reference is passed unchanged to the storage callback, see
sections \fBOptions\fR and \fBMailboxes\fR for either the
option defining it and or the interface to provide, respectively.
.PP
.SH MAILBOXES
Here we describe the interface which has to be provided by the storage
callback so that pop3 servers following the interface of this module
are able to use it. The \fImbox\fR argument is the storage reference
as returned by the \fBlookup\fR method of the authentication
command, see section \fBAuthentication\fR.
.TP
\fIstorageCmd\fR \fBdele\fR \fImbox\fR \fImsgList\fR
]
Deletes the messages whose numeric ids are contained in the
\fImsgList\fR from the mailbox specified via \fImbox\fR.
.TP
\fIstorageCmd\fR \fBlock\fR \fImbox\fR
This method locks the specified mailbox for use by a single connection
to the server. This is necessary to prevent havoc if several
connections to the same mailbox are open. The complementary method is
\fBunlock\fR. The command will return true if the lock could be set
successfully or false if not.
.TP
\fIstorageCmd\fR \fBunlock\fR \fImbox\fR
This is the complementary method to \fBlock\fR, it revokes the lock
on the specified mailbox.
.TP
\fIstorageCmd\fR \fBsize\fR \fImbox\fR ?\fImsgId\fR?
Determines the size of the message specified through its id in
\fImsgId\fR, in bytes, and returns this number. The command will
return the size of the whole maildrop if no message id was specified.
.TP
\fIstorageCmd\fR \fBstat\fR \fImbox\fR
Determines the number of messages in the specified mailbox and returns
this number.
.TP
\fIstorageCmd\fR \fBget\fR \fImbox\fR \fImsgId\fR
Returns a handle for the specified message. This handle is a mime
token following the interface described in the documentation of
package \fBmime\fR. The pop3 server will use the functionality of
the mime token to send the mail to the requestor at the other end of a
pop3 connection.
.PP
.SH "SECURE MAIL TRANSFER"
The option \fB-socket\fR (see \fBOptions\fR) enables users of
the package to override how the server opens its listening socket.
The envisioned main use is the specification of the \fBtls::socket\fR
command, see package \fBtls\fR, to secure the communication.
.CS


	package require tls
	tls::init \\\\
		...

	pop3d::new S -socket tls::socket
	...

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpop3d\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
internet, network, pop3, protocol, rfc 1939, secure, ssl, tls
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2002-2009 Andreas Kupries <[email protected]>
Copyright (c) 2005 Reinhard Max  <[email protected]>

.fi

Added embedded/man/files/modules/pop3d/pop3d_dbox.n.

























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pop3d/pop3d_dbox.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pop3d::dbox" n 1.0.2 tcllib "Tcl POP3 Server Package"
.BS
.SH NAME
pop3d::dbox \- Simple mailbox database for pop3d
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBpop3d::dbox  ?1.0.2?\fR
.sp
\fB::pop3d::dbox::new\fR ?\fIdbName\fR?
.sp
\fBdbName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIdbName\fR \fBdestroy\fR
.sp
\fIdbName\fR \fBbase\fR \fIbase\fR
.sp
\fIdbName\fR \fBadd\fR \fImbox\fR
.sp
\fIdbName\fR \fBremove\fR \fImbox\fR
.sp
\fIdbName\fR \fBmove\fR \fIold new\fR
.sp
\fIdbName\fR \fBlist\fR
.sp
\fIdbName\fR \fBexists\fR \fImbox\fR
.sp
\fIdbName\fR \fBlocked\fR \fImbox\fR
.sp
\fIdbName\fR \fBlock\fR \fImbox\fR
.sp
\fIdbName\fR \fBunlock\fR \fImbox\fR
.sp
\fIdbName\fR \fBstat\fR \fImbox\fR
.sp
\fIdbName\fR \fBsize\fR \fImbox\fR ?\fImsgId\fR?
.sp
\fIdbName\fR \fBdele\fR \fImbox msgList\fR
.sp
\fIstorageCmd\fR \fBget\fR \fImbox\fR \fImsgId\fR
.sp
.BE
.SH DESCRIPTION
.PP
The package \fBpop3d::dbox\fR provides simple/basic mailbox
management facilities. Each mailbox object manages a single base
directory whose subdirectories represent the managed mailboxes. Mails
in a mailbox are represented by files in a mailbox directory, where
each of these files contains a single mail, both headers and body, in
RFC 822 (\fIhttp://www.rfc-editor.org/rfc/rfc822.txt\fR) conformant
format.
.PP
Any mailbox object following the interface described below can be used
in conjunction with the pop3 server core provided by the package
\fBpop3d\fR. It is especially possible to directly use the objects
created by this package in the storage callback of pop3 servers
following the same interface as servers created by the package
\fBpop3d\fR.
.PP
.TP
\fB::pop3d::dbox::new\fR ?\fIdbName\fR?
This command creates a new database object with an associated global
Tcl command whose name is \fIdbName\fR.
.PP
The command \fBdbName\fR may be used to invoke various operations on
the database.  It has the following general form:
.TP
\fBdbName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.PP
.PP
The following commands are possible for database objects:
.TP
\fIdbName\fR \fBdestroy\fR
Destroys the mailbox database and all transient data. The directory
associated with the object is not destroyed.
.TP
\fIdbName\fR \fBbase\fR \fIbase\fR
Defines the base directory containing the mailboxes to manage. If this
method is not called none of the following methods will work.
.TP
\fIdbName\fR \fBadd\fR \fImbox\fR
Adds a mailbox of name \fImbox\fR to the database. The name must be a
valid path component.
.TP
\fIdbName\fR \fBremove\fR \fImbox\fR
Removes the mailbox specified through \fImbox\fR, and the mails
contained therein, from the database. This method will fail if the
specified mailbox is locked.
.TP
\fIdbName\fR \fBmove\fR \fIold new\fR
Changes the name of the mailbox \fIold\fR to \fInew\fR.
.TP
\fIdbName\fR \fBlist\fR
Returns a list containing the names of all mailboxes in the directory
associated with the database.
.TP
\fIdbName\fR \fBexists\fR \fImbox\fR
Returns true if the mailbox with name \fImbox\fR exists in the
database, or false if not.
.TP
\fIdbName\fR \fBlocked\fR \fImbox\fR
Checks if the mailbox specified through \fImbox\fR is currently locked.
.TP
\fIdbName\fR \fBlock\fR \fImbox\fR
This method locks the specified mailbox for use by a single connection
to the server. This is necessary to prevent havoc if several
connections to the same mailbox are open. The complementary method is
\fBunlock\fR. The command will return true if the lock could be set
successfully or false if not.
.TP
\fIdbName\fR \fBunlock\fR \fImbox\fR
This is the complementary method to \fBlock\fR, it revokes the lock
on the specified mailbox.
.TP
\fIdbName\fR \fBstat\fR \fImbox\fR
Determines the number of messages in the specified mailbox and returns
this number. This method fails if the mailbox \fImbox\fR is not
locked.
.TP
\fIdbName\fR \fBsize\fR \fImbox\fR ?\fImsgId\fR?
Determines the size of the message specified through its id in
\fImsgId\fR, in bytes, and returns this number. The command will
return the size of the whole maildrop if no message id was specified.
If specified the \fImsgId\fR has to be in the range "1 ... [\fIdbName\fR \fBstat\fR]"
or this call will fail. If \fBstat\fR was not called before this
call, \fBsize\fR will assume that there are zero messages in the
mailbox.
.TP
\fIdbName\fR \fBdele\fR \fImbox msgList\fR
Deletes the messages whose numeric ids are contained in the
\fImsgList\fR from the mailbox specified via \fImbox\fR.
The \fImsgList\fR must not be empty or this call will fail.
The numeric ids in \fImsgList\fR have to be in the range "1 ...
[\fIdbName\fR \fBstat\fR]" or this
call will fail. If \fBstat\fR was not called
before this call, \fBdele\fR will assume
that there are zero messages in the mailbox.
.TP
\fIstorageCmd\fR \fBget\fR \fImbox\fR \fImsgId\fR
Returns a handle for the specified message. This handle is a mime
token following the interface described in the documentation of
package \fBmime\fR. The token is \fIread-only\fR. In other
words, the caller is allowed to do anything with the token except to
modify it.
The \fImsgId\fR has to be in the range "1 ...
[\fIdbName\fR \fBstat\fR]" or this
call will fail. If \fBstat\fR was not called
before this call, \fBget\fR will assume
that there are zero messages in the mailbox.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpop3d\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
internet, network, pop3, protocol, rfc 822
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2002 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pop3d/pop3d_udb.n.






































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pop3d/pop3d_udb.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pop3d::udb" n 1.0.1 tcllib "Tcl POP3 Server Package"
.BS
.SH NAME
pop3d::udb \- Simple user database for pop3d
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBpop3d::udb  ?1.0.1?\fR
.sp
\fB::pop3d::udb::new\fR ?\fIdbName\fR?
.sp
\fBdbName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIdbName\fR \fBdestroy\fR
.sp
\fIdbName\fR \fBadd\fR \fIuser pwd storage\fR
.sp
\fIdbName\fR \fBremove\fR \fIuser\fR
.sp
\fIdbName\fR \fBrename\fR \fIuser newName\fR
.sp
\fIdbName\fR \fBlookup\fR \fIuser\fR
.sp
\fIdbName\fR \fBexists\fR \fIuser\fR
.sp
\fIdbName\fR \fBwho\fR
.sp
\fIdbName\fR \fBsave\fR ?\fIfile\fR?
.sp
\fIdbName\fR \fBread\fR \fIfile\fR
.sp
.BE
.SH DESCRIPTION
.PP
The package \fBpop3d::udb\fR provides simple in memory databases
which can be used in conjunction with the pop3 server core provided by
the package \fBpop3d\fR. The databases will use the names of users
as keys and associates passwords and storage references with them.
.PP
Objects created by this package can be directly used in the
authentication callback of pop3 servers following the same interface
as servers created by the package \fBpop3d\fR.
.PP
.TP
\fB::pop3d::udb::new\fR ?\fIdbName\fR?
This command creates a new database object with an associated global
Tcl command whose name is \fIdbName\fR.
.PP
The command \fBdbName\fR may be used to invoke various operations on
the database.  It has the following general form:
.TP
\fBdbName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.PP
.PP
The following commands are possible for database objects:
.TP
\fIdbName\fR \fBdestroy\fR
Destroys the database object.
.TP
\fIdbName\fR \fBadd\fR \fIuser pwd storage\fR
Add a new user or changes the data of an existing user. Stores
\fIpassword\fR and \fIstorage\fR reference for the given \fIuser\fR.
.TP
\fIdbName\fR \fBremove\fR \fIuser\fR
Removes the specified \fIuser\fR from the database.
.TP
\fIdbName\fR \fBrename\fR \fIuser newName\fR
Changes the name of the specified \fIuser\fR to \fInewName\fR.
.TP
\fIdbName\fR \fBlookup\fR \fIuser\fR
Searches the database for the specified \fIuser\fR and returns a
two-element list containing the associated password and storage
reference, in this order. Throws an error if the user could not be
found. This is the interface as expected by the authentication
callback of package \fBpop3d\fR.
.TP
\fIdbName\fR \fBexists\fR \fIuser\fR
Returns true if the specified \fIuser\fR is known to the database,
else false.
.TP
\fIdbName\fR \fBwho\fR
Returns a list of users known to the database.
.TP
\fIdbName\fR \fBsave\fR ?\fIfile\fR?
Saves the contents of the database into the given \fIfile\fR. If the
file is not specified the system will use the path last used in a call
to \fIdbName\fR \fBread\fR. The generated file can be read by the
\fBread\fR method.
.TP
\fIdbName\fR \fBread\fR \fIfile\fR
Reads the specified \fIfile\fR and adds the contained user definitions
to the database. As the file is actually \fBsource\fR'd a safe
interpreter is employed to safeguard against malicious code. This
interpreter knows the \fBadd\fR command for adding users and their
associated data to this database. This command has the same argument
signature as the method \fBadd\fR. The path of the \fIfile\fR is
remembered internally so that it can be used in the next call of
\fIdbName\fR \fBsave\fR without an argument.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpop3d\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
internet, network, pop3, protocol
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2002 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/profiler/profiler.n.





































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/profiler/profiler.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "profiler" n 0.3 tcllib "Tcl Profiler"
.BS
.SH NAME
profiler \- Tcl source code profiler
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBprofiler  ?0.3?\fR
.sp
\fB::profiler::init\fR
.sp
\fB::profiler::dump\fR \fIpattern\fR
.sp
\fB::profiler::print\fR ?\fIpattern\fR?
.sp
\fB::profiler::reset\fR ?\fIpattern\fR?
.sp
\fB::profiler::suspend\fR ?\fIpattern\fR?
.sp
\fB::profiler::resume\fR ?\fIpattern\fR?
.sp
\fB::profiler::sortFunctions\fR \fIkey\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBprofiler\fR package provides a simple Tcl source code
profiler.  It is a function-level profiler; that is, it collects only
function-level information, not the more detailed line-level
information.  It operates by redefining the Tcl \fBproc\fR command.
Profiling is initiated via the \fB::profiler::init\fR command.
.SH COMMANDS
.TP
\fB::profiler::init\fR
Initiate profiling.  All procedures created after this command is
called will be profiled.  To profile an entire application, this
command must be called before any other commands.
.TP
\fB::profiler::dump\fR \fIpattern\fR
Dump profiling information for the all functions matching
\fIpattern\fR.  If no pattern is specified, information for all
functions will be returned.  The result is a list of key/value pairs
that maps function names to information about that function.  The
information about each function is in turn a list of key/value pairs.
The keys used and their values are:
.RS
.TP
\fBtotalCalls\fR
The total number of times \fIfunctionName\fR was called.
.TP
\fBcallerDist\fR
A list of key/value pairs mapping each calling function that called
\fIfunctionName\fR to the number of times it called
\fIfunctionName\fR.
.TP
\fBcompileTime\fR
The runtime, in clock clicks, of \fIfunctionName\fR the first time
that it was called.
.TP
\fBtotalRuntime\fR
The sum of the runtimes of all calls of \fIfunctionName\fR.
.TP
\fBaverageRuntime\fR
Average runtime of \fIfunctionName\fR.
.TP
\fBdescendantTime\fR
Sum of the time spent in descendants of \fIfunctionName\fR.
.TP
\fBaverageDescendantTime\fR
Average time spent in descendants of \fIfunctionName\fR.
.RE
.TP
\fB::profiler::print\fR ?\fIpattern\fR?
Print profiling information for all functions matching \fIpattern\fR.
If no pattern is specified, information about all functions will be
displayed.  The return result is a human readable display of the
profiling information.
.TP
\fB::profiler::reset\fR ?\fIpattern\fR?
Reset profiling information for all functions matching \fIpattern\fR.
If no pattern is specified, information will be reset for all
functions.
.TP
\fB::profiler::suspend\fR ?\fIpattern\fR?
Suspend profiling for all functions matching \fIpattern\fR.  If no
pattern is specified, profiling will be suspended for all
functions. It stops gathering profiling information after this command
is issued. However, it does not erase any profiling information that
has been gathered previously.  Use resume command to re-enable
profiling.
.TP
\fB::profiler::resume\fR ?\fIpattern\fR?
Resume profiling for all functions matching \fIpattern\fR.  If no
pattern is specified, profiling will be resumed for all functions.
This command should be invoked after suspending the profiler in the
code.
.TP
\fB::profiler::sortFunctions\fR \fIkey\fR
Return a list of functions sorted by a particular profiling statistic.
Supported values for \fIkey\fR are: \fBcalls\fR,
\fBexclusiveTime\fR, \fBcompileTime\fR, \fBnonCompileTime\fR,
\fBtotalRuntime\fR, \fBavgExclusiveTime\fR, and
\fBavgRuntime\fR.  The return result is a list of lists, where each
sublist consists of a function name and the value of \fIkey\fR for
that function.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIprofiler\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
performance, profile, speed
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/pt/pt.n.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt \- Parser Tools Application
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
\fBpt\fR \fBgenerate\fR \fIresultformat\fR ?\fIoptions...\fR? \fIresultfile\fR \fIinputformat\fR \fIinputfile\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This document describes \fBpt\fR, the main application of the module,
a \fIparser generator\fR. Its intended audience are people who wish
to create a parser for some language of theirs. Should you wish to
modify the application instead, please see the section about the
application's \fBInternals\fR for the basic references.
.PP
It resides in the User Application Layer of Parser Tools.
.PP
IMAGE: arch_user_app
.PP
.SH "COMMAND LINE"
.TP
\fBpt\fR \fBgenerate\fR \fIresultformat\fR ?\fIoptions...\fR? \fIresultfile\fR \fIinputformat\fR \fIinputfile\fR
This sub-command of the application reads the parsing expression
grammar stored in the \fIinputfile\fR in the format \fIinputformat\fR,
converts it to the \fIresultformat\fR under the direction of the
(format-specific) set of options specified by the user and stores the
result in the \fIresultfile\fR.
.sp
The \fIinputfile\fR has to exist, while the \fIresultfile\fR may be
created, overwriting any pre-existing content of the file. Any missing
directory in the path to the \fIresultfile\fR will be created as well.
.sp
The exact form of the result for, and the set of options supported by
the known result-formats, are explained in the upcoming sections of
this document, with the list below providing an index mapping between
format name and its associated section. In alphabetical order:
.sp
.RS
.TP
\fBc\fR
A \fIresultformat\fR. See section \fBC Parser\fR.
.TP
\fBcontainer\fR
A \fIresultformat\fR. See section \fBGrammar Container\fR.
.TP
\fBcritcl\fR
A \fIresultformat\fR. See section \fBC Parser Embedded In Tcl\fR.
.TP
\fBjson\fR
A \fIinput\fR- and \fIresultformat\fR. See section \fBJSON Grammar Exchange\fR.
.TP
\fBoo\fR
A \fIresultformat\fR. See section \fBTclOO Parser\fR.
.TP
\fBpeg\fR
A \fIinput\fR- and \fIresultformat\fR. See section \fBPEG Specification Language\fR.
.TP
\fBsnit\fR
A \fIresultformat\fR. See section \fBSnit Parser\fR.
.RE
.PP
Of the seven possible results four are parsers outright (\fBc\fR,
\fBcritcl\fR, \fBoo\fR, and \fBsnit\fR), one (\fBcontainer\fR)
provides code which can be used in conjunction with a generic parser
(also known as a grammar interpreter), and the last two (\fBjson\fR
and \fBpeg\fR) are doing double-duty as input formats, allowing the
transformation of grammars for exchange, reformatting, and the like.
.PP
The created parsers fall into three categories:
.PP
.PS
.nf
                       + --- C ---> critcl, c
                       |
    + --- specialized -+
    |                  |
 ---+                  + --- Tcl -> snit, oo
    |
    + --- interpreted (Tcl) ------> container
.fi
.PE
.PP
.TP
\fBSpecialized parsers implemented in C\fR
The fastest parsers are created when using the result formats
\fBc\fR and \fBcritcl\fR. The first returns the raw C code for the
parser, while the latter wraps it into a Tcl package using
\fICriTcl\fR.
.sp
This makes the latter much easier to use than the former. On the other
hand, the former can be adapted to the users' requirements through a
multitude of options, allowing for things like usage of the parser
outside of a Tcl environment, something the \fBcritcl\fR format
doesn't support. As such the \fBc\fR format is meant for more
advanced users, or users with special needs.
.sp
A disadvantage of all the parsers in this section is the need to run
them through a C compiler to make them actually executable. This is
not something everyone has the necessary tools for. The parsers in the
next section are for people under such restrictions.
.TP
\fBSpecialized parsers implemented in Tcl\fR
As the parsers in this section are implemented in Tcl they are quite a
bit slower than anything from the previous section. On the other hand
this allows them to be used in pure-Tcl environments, or in
environments which allow only a limited set of binary packages. In the
latter case it will be advantageous to lobby for the inclusion of the
C-based runtime support (notes below) into the environment to reduce
the impact of Tcl's on the speed of these parsers.
.sp
The relevant formats are \fBsnit\fR and \fBoo\fR. Both place their
result into a Tcl package containing a \fBsnit::type\fR, or TclOO
\fBclass\fR respectively.
.sp
Of the supporting runtime, which is the package \fBpt::rde\fR, the
user has to know nothing but that it does exist and that the parsers
are dependent on it. Knowledge of the API exported by the runtime for
the parsers' consumption is \fInot\fR required by the parsers' users.
.TP
\fBInterpreted parsing implemented in Tcl\fR
The last category, grammar interpretation. This means that an
interpreter for parsing expression grammars takes the description of
the grammar to parse input for, and uses it guide the parsing process.
This is the slowest of the available options, as the interpreter has
to continually run through the configured grammar, whereas the
specialized parsers of the previous sections have the relevant
knowledge about the grammar baked into them.
.sp
The only places where using interpretation make sense is where the
grammar for some input may be changed interactively by the user, as
the interpretation allows for quick turnaround after each change,
whereas the previous methods require the generation of a whole new
parser, which is not as fast.
On the other hand, wherever the grammar to use is fixed, the previous
methods are much more advantageous as the time to generate the parser
is minuscule compared to the time the parser code is in use.
.sp
The relevant result format is \fBcontainer\fR.
It (quickly) generates grammar descriptions (instead of a full parser)
which match the API expected by ParserTools' grammar interpreter.
The latter is provided by the package \fBpt::peg::interp\fR.
.PP
All the parsers generated by \fBcritcl\fR, \fBsnit\fR, and
\fBoo\fR, and the grammar interpreter share a common API for access
to the actual parsing functionality, making them all
plug-compatible.
It is described in the \fIParser API\fR specification document.
.SH "PEG SPECIFICATION LANGUAGE"
\fBpeg\fR, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.
.PP
For either an introduction to or the formal specification of the
language, please go and read the \fIPEG Language Tutorial\fR.
.PP
When used as a result-format this format supports the following
options:
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-template\fR string
The value of this option is a string into which to put the generated
text and the values of the other options. The various locations for
user-data are expected to be specified with the placeholders listed
below. The default value is "\fB@code@\fR".
.RS
.TP
\fB@user@\fR
To be replaced with the value of the option \fB-user\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBPEG\fR.
.TP
\fB@file@\fR
To be replaced with the value of the option \fB-file\fR.
.TP
\fB@name@\fR
To be replaced with the value of the option \fB-name\fR.
.TP
\fB@code@\fR
To be replaced with the generated text.
.RE
.PP
.SH "JSON GRAMMAR EXCHANGE"
The \fBjson\fR format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.
.PP
For the formal specification of the JSON grammar exchange format,
please go and read \fIThe JSON Grammar Exchange Format\fR.
.PP
When used as a result-format this format supports the following
options:
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-indented\fR boolean
If this option is set the system will break the generated JSON across
lines and indent it according to its inner structure, with each key of
a dictionary on a separate line.
.sp
If the option is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.
.TP
\fB-aligned\fR boolean
If this option is set the system will ensure that the values for the
keys in a dictionary are vertically aligned with each other, for a
nice table effect.
To make this work this also implies that \fB-indented\fR is set.
.sp
If the option is not set (the default), the output is formatted as per
the value of \fBindented\fR, without trying to align the values for
dictionary keys.
.PP
.SH "C PARSER EMBEDDED IN TCL"
The \fBcritcl\fR format is executable code, a parser for the
grammar. It is a Tcl package with the actual parser implementation
written in C and embedded in Tcl via the \fBcritcl\fR package.
.PP
This result-format supports the following options:
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-class\fR string
The value of this option is the name of the class to generate, without
leading colons.
The default value is \fBCLASS\fR.
.sp
For a simple value \fBX\fR without colons, like CLASS, the parser
command will be \fBX\fR::\fBX\fR. Whereas for a namespaced value
\fBX::Y\fR the parser command will be \fBX::Y\fR.
.TP
\fB-package\fR string
The value of this option is the name of the package to generate.
The default value is \fBPACKAGE\fR.
.PP
.SH "C PARSER"
The \fBc\fR format is executable code, a parser for the grammar. The
parser implementation is written in C and can be tweaked to the users'
needs through a multitude of options.
.PP
The \fBcritcl\fR format, for example, is implemented as a canned
configuration of these options on top of the generator for \fBc\fR.
.PP
This result-format supports the following options:
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-template\fR string
The value of this option is a string into which to put
the generated text and the other configuration settings. The various
locations for user-data are expected to be specified with the
placeholders listed below. The default value is "\fB@code@\fR".
.RS
.TP
\fB@user@\fR
To be replaced with the value of the option \fB-user\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBC/PARAM\fR.
.TP
\fB@file@\fR
To be replaced with the value of the option \fB-file\fR.
.TP
\fB@name@\fR
To be replaced with the value of the option \fB-name\fR.
.TP
\fB@code@\fR
To be replaced with the generated Tcl code.
.RE
.IP
The following options are special, in that they will
occur within the generated code, and are replaced there as well.
.RS
.TP
\fB@statedecl@\fR
To be replaced with the value of the option \fBstate-decl\fR.
.TP
\fB@stateref@\fR
To be replaced with the value of the option \fBstate-ref\fR.
.TP
\fB@strings@\fR
To be replaced with the value of the option \fBstring-varname\fR.
.TP
\fB@self@\fR
To be replaced with the value of the option \fBself-command\fR.
.TP
\fB@def@\fR
To be replaced with the value of the option \fBfun-qualifier\fR.
.TP
\fB@ns@\fR
To be replaced with the value of the option \fBnamespace\fR.
.TP
\fB@main@\fR
To be replaced with the value of the option \fBmain\fR.
.TP
\fB@prelude@\fR
To be replaced with the value of the option \fBprelude\fR.
.RE
.TP
\fB-state-decl\fR string
A C string representing the argument declaration to use in the
generated parsing functions to refer to the parsing state. In essence
type and argument name.
The default value is the string \fBRDE_PARAM p\fR.
.TP
\fB-state-ref\fR string
A C string representing the argument named used in the generated
parsing functions to refer to the parsing state.
The default value is the string \fBp\fR.
.TP
\fB-self-command\fR string
A C string representing the reference needed to call the generated
parser function (methods ...) from another parser fonction, per the
chosen framework (template).
The default value is the empty string.
.TP
\fB-fun-qualifier\fR string
A C string containing the attributes to give to the generated
functions (methods ...), per the chosen framework (template).
The default value is \fBstatic\fR.
.TP
\fB-namespace\fR string
The name of the C namespace the parser functions (methods, ...) shall
reside in, or a general prefix to add to the function names.
The default value is the empty string.
.TP
\fB-main\fR string
The name of the main function (method, ...) to be called by the chosen
framework (template) to start parsing input.
The default value is \fB__main\fR.
.TP
\fB-string-varname\fR string
The name of the variable used for the table of strings used by the
generated parser, i.e. error messages, symbol names, etc.
The default value is \fBp_string\fR.
.TP
\fB-prelude\fR string
A snippet of code to be inserted at the head of each generated parsing
function.
The default value is the empty string.
.TP
\fB-indent\fR integer
The number of characters to indent each line of the generated code by.
The default value is \fB0\fR.
.PP
.SH "SNIT PARSER"
The \fBsnit\fR format is executable code, a parser for the
grammar. It is a Tcl package holding a \fBsnit::type\fR, i.e. a class,
whose instances are parsers for the input grammar.
.PP
This result-format supports the following options:
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-class\fR string
The value of this option is the name of the class to generate, without
leading colons. Note, it serves double-duty as the name of the package
to generate too, if option \fB-package\fR is not specified, see below.
The default value is \fBCLASS\fR, applying if neither option
\fB-class\fR nor \fB-package\fR were specified.
.TP
\fB-package\fR string
The value of this option is the name of the package to generate, without
leading colons. Note, it serves double-duty as the name of the class
to generate too, if option \fB-class\fR is not specified, see above.
The default value is \fBPACKAGE\fR, applying if neither option
\fB-package\fR nor \fB-class\fR were specified.
.PP
.SH "TCLOO PARSER"
The \fBoo\fR format is executable code, a parser for the grammar. It
is a Tcl package holding a \fBTclOO\fR class, whose instances are
parsers for the input grammar.
.PP
This result-format supports the following options:
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-class\fR string
The value of this option is the name of the class to generate, without
leading colons. Note, it serves double-duty as the name of the package
to generate too, if option \fB-package\fR is not specified, see below.
The default value is \fBCLASS\fR, applying if neither option
\fB-class\fR nor \fB-package\fR were specified.
.TP
\fB-package\fR string
The value of this option is the name of the package to generate, without
leading colons. Note, it serves double-duty as the name of the class
to generate too, if option \fB-class\fR is not specified, see above.
The default value is \fBPACKAGE\fR, applying if neither option
\fB-package\fR nor \fB-class\fR were specified.
.PP
.SH "GRAMMAR CONTAINER"
The \fBcontainer\fR format is another form of describing parsing
expression grammars. While data in this format is executable it does
not constitute a parser for the grammar. It always has to be used in
conjunction with the package \fBpt::peg::interp\fR, a grammar
interpreter.
.PP
The format represents grammars by a \fBsnit::type\fR, i.e. class,
whose instances are API-compatible to the instances of the
\fBpt::peg::container\fR package, and which are preloaded with the
grammar in question.
.PP
This result-format supports the following options:
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-mode\fR \fBbulk\fR|\fBincremental\fR
The value of this option controls which methods of
\fBpt::peg::container\fR instances are used to specify the
grammar, i.e. preload it into the container. There are two legal
values, as listed below. The default is \fBbulk\fR.
.RS
.TP
\fBbulk\fR
In this mode the methods \fBstart\fR, \fBadd\fR, \fBmodes\fR,
and \fBrules\fR are used to specify the grammar in a bulk manner,
i.e. as a set of nonterminal symbols, and two dictionaries mapping
from the symbols to their semantic modes and parsing expressions.
.sp
This mode is the default.
.TP
\fBincremental\fR
In this mode the methods \fBstart\fR, \fBadd\fR, \fBmode\fR,
and \fBrule\fR are used to specify the grammar piecemal, with each
nonterminal having its own block of defining commands.
.RE
.TP
\fB-template\fR string
The value of this option is a string into which to put the generated
code and the other configuration settings. The various locations for
user-data are expected to be specified with the placeholders listed
below. The default value is "\fB@code@\fR".
.RS
.TP
\fB@user@\fR
To be replaced with the value of the option \fB-user\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBCONTAINER\fR.
.TP
\fB@file@\fR
To be replaced with the value of the option \fB-file\fR.
.TP
\fB@name@\fR
To be replaced with the value of the option \fB-name\fR.
.TP
\fB@mode@\fR
To be replaced with the value of the option \fB-mode\fR.
.TP
\fB@code@\fR
To be replaced with the generated code.
.RE
.PP
.SH EXAMPLE
In this section we are working a complete example, starting with a PEG
grammar and ending with running the parser generated from it over some
input, following the outline shown in the figure below:
.PP
IMAGE: flow
.PP
Our grammar, assumed to the stored in the file "\fIcalculator.peg\fR"
is
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
From this we create a snit-based parser
via
.CS


pt generate snit calculator.tcl -class calculator -name calculator peg calculator.peg

.CE
which leaves us with the parser package and class written to the file
"\fIcalculator.tcl\fR".
Assuming that this package is then properly installed in a place where
Tcl can find it we can now use this class via a script like
.CS


    package require calculator

    lassign $argv input
    set channel [open $input r]

    set parser [calculator]
    set ast [$parser parse $channel]
    $parser destroy
    close $channel

    ... now process the returned abstract syntax tree ...

.CE
where the abstract syntax tree stored in the variable will look like
.PP
.CS


set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}

.CE
.PP
assuming that the input file and channel contained the text
.CS

 120+5
.CE
A more graphical representation of the tree would be
.PP
.PS
.nf
                                                           +- Digit 0 0 | 1
                                                           |            |
                               +- Term 0 2 --- Number 0 2 -+- Digit 1 1 | 2
                               |                           |            |
                               |                           +- Digit 2 2 | 0
                               |                                        |
Expression 0 4 --- Factor 0 4 -+----------------------------- AddOp 3 3 | +
                               |                                        |
                               +- Term 4 4 --- Number 4 4 --- Digit 4 4 | 5
.fi
.PE
.PP
Regardless, at this point it is the user's responsibility to work with
the tree to reach whatever goal she desires. I.e. analyze it,
transform it, etc. The package \fBpt::ast\fR should be of help
here, providing commands to walk such ASTs structures in various ways.
.PP
One important thing to note is that the parsers used here return a
data structure representing the structure of the input per the grammar
underlying the parser. There are \fIno\fR callbacks during the
parsing process, i.e. no \fIparsing actions\fR, as most other
parsers will have.
.PP
Going back to the last snippet of code, the execution of the parser
for some input, note how the parser instance follows the specified
\fIParser API\fR.
.SH INTERNALS
This section is intended for users of the application which wish to
modify or extend it. Users only interested in the generation of
parsers can ignore it.
.PP
The main functionality of the application is encapsulated in the
package \fBpt::pgen\fR. Please read it for more information.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_astree.n.















































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_astree.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::ast" n 1.1 tcllib "Parser Tools"
.BS
.SH NAME
pt::ast \- Abstract Syntax Tree Serialization
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::ast  ?1.1?\fR
.sp
\fB::pt::ast\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
.sp
\fB::pt::ast\fR \fBverify-as-canonical\fR \fIserial\fR
.sp
\fB::pt::ast\fR \fBcanonicalize\fR \fIserial\fR
.sp
\fB::pt::ast\fR \fBprint\fR \fIserial\fR
.sp
\fB::pt::ast\fR \fBbottomup\fR \fIcmdprefix\fR \fIast\fR
.sp
\fBcmdprefix\fR \fIast\fR
.sp
\fB::pt::ast\fR \fBtopdown\fR \fIcmdprefix\fR \fIpe\fR
.sp
\fB::pt::ast\fR \fBequal\fR \fIseriala\fR \fIserialb\fR
.sp
\fB::pt::ast\fR \fBterminal\fR \fIloc\fR
.sp
\fB::pt::ast\fR \fBnonterminal\fR \fIs\fR \fIstart\fR \fIend\fR ?\fIchild\fR...?
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides commands to work with the serializations of
abstract syntax trees as managed by the Parser Tools, and specified in
section \fBAST serialization format\fR.
.PP
This is a supporting package in the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_support
.PP
.SH API
.TP
\fB::pt::ast\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
This command verifies that the content of \fIserial\fR is a valid
serialization of an abstract syntax tree and will throw an error if
that is not the case. The result of the command is the empty string.
.sp
If the argument \fIcanonvar\fR is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if \fIserial\fR is a valid regular
serialization. Its value will be a boolean, with \fBTrue\fR
indicating that the serialization is not only valid, but also
\fIcanonical\fR. \fBFalse\fR will be written for a valid, but
non-canonical serialization.
.sp
For the specification of serializations see the section
\fBAST serialization format\fR.
.TP
\fB::pt::ast\fR \fBverify-as-canonical\fR \fIserial\fR
This command verifies that the content of \fIserial\fR is a valid
\fIcanonical\fR serialization of an abstract syntax tree and will
throw an error if that is not the case. The result of the command is
the empty string.
.sp
For the specification of canonical serializations see the section
\fBAST serialization format\fR.
.TP
\fB::pt::ast\fR \fBcanonicalize\fR \fIserial\fR
This command assumes that the content of \fIserial\fR is a valid
\fIregular\fR serialization of an abstract syntax and will throw an
error if that is not the case.
.sp
It will then convert the input into the \fIcanonical\fR serialization
of the contained tree and return it as its result. If the input is
already canonical it will be returned unchanged.
.sp
For the specification of regular and canonical serializations see the
section \fBAST serialization format\fR.
.TP
\fB::pt::ast\fR \fBprint\fR \fIserial\fR
This command assumes that the argument \fIserial\fR contains a valid
serialization of an abstract syntax tree and returns a string
containing that tree in a human readable form.
.sp
The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.
.sp
For the specification of serializations see the section
\fBAST serialization format\fR.
.TP
\fB::pt::ast\fR \fBbottomup\fR \fIcmdprefix\fR \fIast\fR
This command walks the abstract syntax tree \fIast\fR from the bottom
up to the root, invoking the command prefix \fIcmdprefix\fR for each
node. This implies that the children of a node N are handled before N.
.sp
The command prefix has the signature
.RS
.TP
\fBcmdprefix\fR \fIast\fR
I.e. it is invoked with the ast node the walk is currently at.
.sp
The result returned by the command prefix replaces \fIast\fR in the
node it was a child of, allowing transformations of the tree.
.sp
This also means that for all inner node the contents of the children
elements are the results of the command prefix invoked for the
children of this node.
.RE
.TP
\fB::pt::ast\fR \fBtopdown\fR \fIcmdprefix\fR \fIpe\fR
This command walks the abstract syntax tree \fIast\fR from the root
down to the leaves, invoking the command prefix \fIcmdprefix\fR for
each node. This implies that the children of a node N are handled
after N.
.sp
The command prefix has the same signature as for \fBbottomup\fR,
see above.
.sp
The result returned by the command prefix is \fIignored\fR.
.TP
\fB::pt::ast\fR \fBequal\fR \fIseriala\fR \fIserialb\fR
This command tests the two sbstract syntax trees \fIseriala\fR and
\fIserialb\fR for structural equality. The result of the command is a
boolean value. It will be set to \fBtrue\fR if the trees are
identical, and \fBfalse\fR otherwise.
.sp
String equality is usable only if we can assume that the two trees are
pure Tcl lists.
.TP
\fB::pt::ast\fR \fBterminal\fR \fIloc\fR
This command command constructs the ast for a terminal node refering
to the position \fIloc\fR in the input, and returns it as the result
of the command.
.TP
\fB::pt::ast\fR \fBnonterminal\fR \fIs\fR \fIstart\fR \fIend\fR ?\fIchild\fR...?
This command command constructs the ast for a nonterminal node
refering to the symbol \fIs\fR covering the range of positions
\fIstart\fR to \fIend\fR in the input, and the set of child nodes
\fIchild\fR ..., from left right. The latter may be empty. The
constructed node is returned as the result of the command.
.PP
.SH "AST SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Abstract Syntax Trees (ASTs) as immutable values for transport,
comparison, etc.
.PP
Each node in an AST represents a nonterminal symbol of a grammar, and
the range of tokens/characters in the input covered by it. ASTs do not
contain terminal symbols, i.e. tokens/characters. These can be
recovered from the input given a symbol's location.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a tree may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.IP [1]
The serialization of any AST is the serialization of its root node.
.IP [2]
The serialization of any node is a Tcl list containing at least three
elements.
.RS
.IP [1]
The first element is the name of the nonterminal symbol stored in the
node.
.IP [2]
The second and third element are the locations of the first and last
token in the token stream the node represents (covers).
.RS
.IP [1]
Locations are provided as non-negative integer offsets from the
beginning of the token stream, with the first token found in the
stream located at offset 0 (zero).
.IP [2]
The end location has to be equal to or larger than the start location.
.RE
.IP [3]
All elements after the first three represent the children of the node,
which are themselves nodes. This means that the serializations of
nodes without children, i.e. leaf nodes, have exactly three elements.
The children are stored in the list with the leftmost child first, and
the rightmost child last.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of an abstract syntax tree has the format
as specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this tree.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression grammar below
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
and the input string
.CS

 120+5
.CE
then a parser should deliver the abstract syntax tree below (except for whitespace)
.PP
.CS


set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}

.CE
.PP
Or, more graphical
.PP
.PS
.nf
                                                           +- Digit 0 0 | 1
                                                           |            |
                               +- Term 0 2 --- Number 0 2 -+- Digit 1 1 | 2
                               |                           |            |
                               |                           +- Digit 2 2 | 0
                               |                                        |
Expression 0 4 --- Factor 0 4 -+----------------------------- AddOp 3 3 | +
                               |                                        |
                               +- Term 4 4 --- Number 4 4 --- Digit 4 4 | 5
.fi
.PE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_cparam_config_critcl.n.















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_cparam_config_critcl.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::cparam::configuration::critcl" n 1.0.1 tcllib "Parser Tools"
.BS
.SH NAME
pt::cparam::configuration::critcl \- C/PARAM, Canned configuration, Critcl
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::cparam::configuration::critcl  ?1.0.1?\fR
.sp
\fB::pt::cparam::configuration::critcl\fR \fBdef\fR \fIname\fR \fIcmdprefix\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package is an adjunct to \fBpt::peg::to::cparam\fR, to make
the use of this highly configurable package easier by providing a
canned configuration. When applied this configuration causes the
package \fBpt::peg::to::cparam\fR to generate
\fBcritcl\fR-based parser packages.
.PP
It is a supporting package in the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_support
.PP
.SH API
.TP
\fB::pt::cparam::configuration::critcl\fR \fBdef\fR \fIname\fR \fIcmdprefix\fR
The command applies the configuration provided by this package to the
\fIcmdprefix\fR, causing the creation of \fBcritcl\fR-based parsers
whose class is \fIname\fR.
.sp
The use of a command prefix as API allows application of the
configuration to not only \fBpt::peg::to::cparam\fR
(\fBpt::peg::to::cparam configure\fR), but also export manager
instances and PEG containers (\fB$export configuration set\fR and
\fB[$container exporter] configuration set\fR respectively).
.sp
Or anything other command prefix accepting two arguments, option and
value.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_from_api.n.




































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_from_api.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt_import_api" i 1 tcllib "Parser Tools"
.BS
.SH NAME
pt_import_api \- Parser Tools Import API
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
\fBCONVERTER\fR \fBconvert\fR \fItext\fR
.sp
\fBIncludeFile\fR \fIcurrentfile\fR \fIpath\fR
.sp
\fB::import\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This document describes two APIs. First the API shared by all packages
for the conversion of some other format into Parsing Expression
Grammars , and then the API shared by the packages which implement the
import plugins sitting on top of the conversion packages.
.PP
Its intended audience are people who wish to create their own
converter for some type of input, and/or an import plugin for their or
some other converter.
.PP
It resides in the Import section of the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_import
.PP
.SH "CONVERTER API"
Any (grammar) import converter has to follow the rules set out below:
.IP [1]
A converter is a package. Its name is arbitrary, however it is
recommended to put it under the \fB::pt::peg::from\fR
namespace.
.IP [2]
The package provides either a single Tcl command following the
API outlined below, or a class command whose instances follow
the same API. The commands which follow the API are called
\fIconverter commands\fR.
.IP [3]
A converter command has to provide the following single method
with the given signature and semantic. Converter commands
are allowed to provide more methods of their own, but not
less, and they may not provide different semantics for the
standardized method.
.RS
.TP
\fBCONVERTER\fR \fBconvert\fR \fItext\fR
This method has to accept some \fItext\fR, a parsing expression
grammar in some format.
The result of the method has to be the canonical serialization of a
parsing expression grammar, as specified in section
\fBPEG serialization format\fR, the result of reading and
converting the input text.
.RE
.PP
.SH "PLUGIN API"
Any (grammar) import plugin has to follow the rules set out below:
.IP [1]
A plugin is a package.
.IP [2]
The name of a plugin package has the form
pt::peg::import::\fBFOO\fR,
where \fBFOO\fR is the name of the format the plugin will
accept input for.
.IP [3]
The plugin can expect that the package
\fBpt::peg::import::plugin\fR is present, as
indicator that it was invoked from a genuine plugin manager.
.sp
It is recommended that a plugin does check for the presence of
this package.
.IP [4]
The plugin can expect that a command named \fBIncludeFile\fR
is present, with the signature
.RS
.TP
\fBIncludeFile\fR \fIcurrentfile\fR \fIpath\fR
This command has to be invoked by the plugin when it has to process an
included file, if the format has the concept of such.
.sp
The plugin has to supply the following arguments
.RS
.TP
string \fIcurrentfile\fR
The path of the file it is currently processing. This may be the empty
string if no such is known.
.TP
string \fIpath\fR
The path of the include file as specified in the include directive
being processed.
.RE
.IP
The result of the command will be a 5-element list containing
.RS
.IP [1]
A boolean flag indicating the success (\fBTrue\fR) or failure
(\fBFalse\fR) of the operation.
.IP [2]
In case of success the contents of the included file, and the
empty string otherwise.
.IP [3]
The resolved, i.e. absolute path of the included file, if
possible, or the unchanged \fIpath\fR argument. This is for
display in an error message, or as the \fIcurrentfile\fR
argument of another call to \fBIncludeFile\fR should this file
contain more files.
.IP [4]
In case of success an empty string, and for failure a code
indicating the reason for it, one of
.RS
.TP
notfound
The specified file could not be found.
.TP
notread
The specified file was found, but not be read into memory.
.RE
.IP [5]
An empty string in case of success of a \fBnotfound\fR
failure, and an additional error message describing the reason
for a \fBnotread\fR error in more detail.
.RE
.RE
.IP [5]
A plugin has to provide a single command, in the global
namespace, with the signature shown below. Plugins are allowed
to provide more commands of their own, but not less, and they
may not provide different semantics for the standardized
command.
.RS
.TP
\fB::import\fR \fItext\fR
This command has to accept the a text containing a parsing expression
grammar in some format. The result of the command has to be the result
of the converter invoked by the plugin for the input grammar, the
canonical serialization of the parsing expression grammar contained in
the input.
.RS
.TP
string \fItext\fR
This argument will contain the parsing expression grammar for which to
generate the serialization.
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBPEG serialization format\fR.
.RE
.RE
.IP [6]
A single usage cycle of a plugin consists of an invokation of
the command \fBimport\fR. This call has to leave the plugin in
a state where another usage cycle can be run without problems.
.PP
.SH USAGE
To use a converter do
.CS


    # Get the converter (single command here, not class)
    package require the-converter-package

    # Perform the conversion
    set serial [theconverter convert $thegrammartext]

    ... process the result ...

.CE
To use a plugin \fBFOO\fR do
.CS


    # Get an import plugin manager
    package require pt::peg::import
    pt::peg::import I

    # Run the plugin, and the converter inside.
    set serial [I import serial $thegrammartext FOO]

    ... process the result ...

.CE
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_introduction.n.




























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_introduction.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt_introduction" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt_introduction \- Introduction to Parser Tools
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
.BE
.SH DESCRIPTION
Welcome to the Parser Tools, a system for the creation and
manipulation of parsers and the grammars driving them.
.PP
What are your goals which drove you here ?
.IP [1]
Do you simply wish to create a parser for some language ?
.sp
In that case have a look at our parser generator application,
\fBpt\fR, or, for a slightly deeper access, the package underneath it,
\fBpt::pgen\fR.
.IP [2]
Do you wish to know more about the architecture of the system ?
.sp
This is described in the section
\fBParser Tools Architecture\fR, below
.IP [3]
Is your interest in the theoretical background upon which the packages
and tools are build ?
.sp
See the \fIIntroduction to Parsing Expression Grammars\fR.
.PP
.SH "PARSER TOOLS ARCHITECTURE"
The system can be split into roughly three layers, as seen in the
figure below
.PP
IMAGE: architecture
.PP
These layers are, from high to low:
.IP [1]
At the top we have the application and the packages using the packages
of the layer below to implement common usecases. One example is the
aforementioned \fBpt::pgen\fR which provides a parser generator.
.sp
The list of packages belonging to this layer can be found in section
\fBUser Packages\fR
.IP [2]
In this layer we have the packages which provide the core of the
functionality for the whole system. They are, in essence, a set of
blocks which can be combined in myriad ways, like Lego (tm). The
packages in the previous level are 'just' pre-fabricated combinations
to cover the most important use cases.
.sp
The list of packages belonging to this layer can be found in section
\fBCore Packages\fR
.IP [3]
Last, but not least is the layer containing support packages providing
generic functionality which not necessarily belong into the module.
.sp
The list of packages belonging to this layer can be found in section
\fBSupport Packages\fR
.PP
.SS "USER PACKAGES"
.TP
\fBpt::pgen\fR
.PP
.SS "CORE PACKAGES"
This layer is further split into six sections handling the storage,
import, export, transformation, and execution of grammars, plus
grammar specific support packages.
.TP
Storage
.RS
.TP
\fBpt::peg::container\fR
.RE
.TP
Export
.RS
.TP
\fBpt::peg::export\fR
.TP
\fBpt::peg::export::container\fR
.TP
\fBpt::peg::export::json\fR
.TP
\fBpt::peg::export::peg\fR
.TP
\fBpt::peg::to::container\fR
.TP
\fBpt::peg::to::json\fR
.TP
\fBpt::peg::to::peg\fR
.TP
\fBpt::peg::to::param\fR
.TP
\fBpt::peg::to::tclparam\fR
.TP
\fBpt::peg::to::cparam\fR
.RE
.TP
Import
.RS
.TP
\fBpt::peg::import\fR
.TP
\fBpt::peg::import::container\fR
.TP
\fBpt::peg::import::json\fR
.TP
\fBpt::peg::import::peg\fR
.TP
\fBpt::peg::from::container\fR
.TP
\fBpt::peg::from::json\fR
.TP
\fBpt::peg::from::peg\fR
.RE
.TP
Transformation
.TP
Execution
.RS
.TP
\fBpt::peg::interp\fR
.TP
\fBpt::rde\fR
.RE
.TP
Support
.RS
.TP
\fBpt::tclparam::configuration::snit\fR
.TP
\fBpt::tclparam::configuration::tcloo\fR
.TP
\fBpt::cparam::configuration::critcl\fR
.TP
\fBpt::ast\fR
.TP
\fBpt::pe\fR
.TP
\fBpt::peg\fR
.RE
.PP
.SS "SUPPORT PACKAGES"
.TP
\fBpt::peg::container::peg\fR
.TP
\fBtext::write\fR
.TP
\fBconfiguration\fR
.TP
\fBpaths\fR
.TP
\fBchar\fR
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_json_language.n.





























































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_json_language.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::json_language" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::json_language \- The JSON Grammar Exchange Format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
The \fBjson\fR format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.
.PP
It is formally specified by the rules below:
.IP [1]
The JSON of any PEG is a JSON object.
.IP [2]
This object holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section \fBPE serialization format\fR.
.TP
\fBmode\fR
The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
\fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.PP
.PP
As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
\fBPEG serialization format\fR, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
a JSON serialization for it is
.PP
.CS


{
    "pt::grammar::peg" : {
        "rules" : {
            "AddOp"     : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Digit"     : {
                "is"   : "\\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}",
                "mode" : "value"
            },
            "Expression" : {
                "is"   : "\\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}",
                "mode" : "value"
            },
            "Factor"    : {
                "is"   : "x {n Term} {* {x {n AddOp} {n Term}}}",
                "mode" : "value"
            },
            "MulOp"     : {
                "is"   : "\\/ {t *} {t \\/}",
                "mode" : "value"
            },
            "Number"    : {
                "is"   : "x {? {n Sign}} {+ {n Digit}}",
                "mode" : "value"
            },
            "Sign"      : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Term"      : {
                "is"   : "n Number",
                "mode" : "value"
            }
        },
        "start" : "n Expression"
    }
}

.CE
.PP
and a Tcl serialization of the same is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
The similarity of the latter to the JSON should be quite obvious.
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_param.n.






















































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_param.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::param" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::param \- PackRat Machine Specification
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
Welcome to the PackRat Machine (short: \fIPARAM\fR), a virtual
machine geared towards the support of recursive descent parsers,
especially packrat parsers. Towards this end it has features like the
caching and reuse of partial results, the caching of the encountered
input, and the ability to backtrack in both input and AST creation.
.PP
This document specifies the machine in terms of its architectural
state and instruction set.
.SH "ARCHITECTURAL STATE"
Any PARAM implementation has to manage at least the following state:
.TP
\fIInput\fR (IN)
This is the channel the characters to process are read from.
.sp
This part of the machine's state is used and modified by the
instructions defined in the section \fBInput Handling\fR.
.TP
\fICurrent Character\fR (CC)
The character from the \fIinput\fR currently tested against its
possible alternatives.
.sp
This part of the machine's state is used and modified by the
instructions defined in the section \fBCharacter Processing\fR.
.TP
\fICurrent Location\fR (CL)
The location of the \fIcurrent character\fR in the \fIinput\fR, as
offset relative to the beginning of the input. Character offsets are
counted from \fB0\fR.
.sp
This part of the machine's state is used and modified by the
instructions defined in the sections \fBCharacter Processing\fR,
\fBLocation Handling\fR, and \fBNonterminal Execution\fR.
.TP
\fILocation Stack\fR (LS)
A stack of locations in the \fIinput\fR, saved for possible
backtracking.
.sp
This part of the machine's state is used and modified by the
instructions defined in the sections \fBCharacter Processing\fR,
\fBLocation Handling\fR, and \fBNonterminal Execution\fR.
.TP
\fIStatus\fR (ST)
The status of the last attempt of testing the \fIinput\fR, indicating
either success or failure.
.sp
This part of the machine's state is used and modified by the
instructions defined in the sections \fBStatus Control\fR,
\fBCharacter Processing\fR, and \fBNonterminal Execution\fR.
.TP
\fISemantic Value\fR (SV)
The current semantic value, either empty, or a node for AST
constructed from the input.
.sp
This part of the machine's state is used and modified by the
instructions defined in the sections \fBValue Construction\fR, and
\fBAST Construction\fR.
.TP
\fIAST Reduction Stack\fR (ARS)
The stack of partial ASTs constructed during the processing of
nonterminal symbols.
.sp
This part of the machine's state is used and modified by the
instructions defined in the sections \fBValue Construction\fR, and
\fBAST Construction\fR.
.TP
\fIAST Stack\fR (AS)
The stack of reduction stacks, saved for possible backtracking.
.sp
This part of the machine's state is used and modified by the
instructions defined in the sections \fBValue Construction\fR, and
\fBAST Construction\fR.
.TP
\fIError Status\fR (ER)
The machine's current knowledge of errors. This is either empty, or
set to a pair of location in the input and the set of messages for
that location.
.sp
\fINote\fR that this part of the machine's state can be set even if
the last test of the \fIcurrent character\fR was successful. For
example, the *-operator (matching a sub-expression zero or more times)
in a PEG is always successful, even if it encounters a problem further
in the input and has to backtrack. Such problems must not be forgotten
when continuing the parsing.
.sp
This part of the machine's state is used and modified by the
instructions defined in the sections \fBError Handling\fR,
\fBCharacter Processing\fR, and \fBNonterminal Execution\fR.
.TP
\fIError Stack\fR (ES)
The stack of error stati, saved for backtracking. This enables the
machine to merge current and older error stati when performing
backtracking in choices after an failed match.
.sp
This part of the machine's state is used and modified by the
instructions defined in the sections \fBError Handling\fR,
\fBCharacter Processing\fR, and \fBNonterminal Execution\fR.
.TP
\fINonterminal Cache\fR (NC)
A cache of machine states keyed by pairs name of nonterminal symbol
and location in the input. Each pair (N, L) is associated with a
4-tuple holding the values to use for CL, ST, SV, and ER after the
nonterminal N was parsed starting from the location L.
It is a performance aid for backtracking parsers, allowing them to
avoid an expensive reparsing of complex nonterminal symbols if they
have been encountered before at a given location.
.sp
The key location is where machine started the attempt to match the
named nonterminal symbol, and the location in the saved 4-tuple is
where machine ended up after the attempt completed, independent of the
success of the attempt.
.sp
This part of the machine's state is used and modified by the
instructions defined in the section \fBNonterminal Execution\fR.
.TP
\fITerminal Cache\fR (TC)
A cache of characters read from IN, with their location in IN as pair
of line and column, keyed by the location in IN, this time as
character offset from the beginning of IN.
It is a performance aid for backtracking parsers, allowing them to
avoid a possibly expensive rereading of characters from IN, or even
enabling backtracking at, i.e. in the case of IN not randomly
seekable.
.sp
This part of the machine's state is used and modified by the
instructions defined in the section \fBInput Handling\fR.
.PP
.SH "INSTRUCTION SET"
With the machine's architectural state specified it is now possible to
specify the instruction set operating on that state and to be
implemented by any realization of the PARAM. The 37 instructions are
grouped roughly by the state they influence and/or query during their
execution.
.SS "INPUT HANDLING"
The instructions in this section mainly access IN, pulling the
characters to process into the machine.
.TP
\fBinput_next\fR \fImsg\fR
This method reads the next character, i.e. the character after CL,
from IN. If successful this character becomes CC, CL is advanced by
one, ES is cleared, and the operation is recorded as a success in ST.
.sp
The operation may read the character from IN if the next character
is not yet known to TC. If successful the new character is stored in
TC, with its location (line, column), and the operation otherwise
behaves as specified above. Future reads from the same location,
possible due to backtracking, will then be satisfied from TC instead
of IN.
.sp
If, on the other hand, the end of IN was reached, the operation is
recorded as failed in ST, CL is left unchanged, and the pair of CL and
\fImsg\fR becomes the new ES.
.PP
.SS "CHARACTER PROCESSING"
The instructions in this section mainly access CC, testing it against
character classes, ranges, and individual characters.
.TP
\fBtest_alnum\fR
This instruction implements the special PE operator "alnum", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_alpha\fR
This instruction implements the special PE operator "alpha", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_ascii\fR
This instruction implements the special PE operator "ascii", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_char\fR \fIchar\fR
This instruction implements the character matching operator, i.e. it
checks if CC is \fIchar\fR.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_ddigit\fR
This instruction implements the special PE operator "ddigit", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_digit\fR
This instruction implements the special PE operator "digit", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_graph\fR
This instruction implements the special PE operator "graph", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_lower\fR
This instruction implements the special PE operator "lower", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_print\fR
This instruction implements the special PE operator "print", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_punct\fR
This instruction implements the special PE operator "punct", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_range\fR \fIchars\fR \fIchare\fR
This instruction implements the range matching operator, i.e. it
checks if CC falls into the interval of characters spanned up by the
two characters from \fIchars\fR to \fIchare\fR, both inclusive.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_space\fR
This instruction implements the special PE operator "space", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_upper\fR
This instruction implements the special PE operator "upper", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_wordchar\fR
This instruction implements the special PE operator "wordchar", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.TP
\fBtest_xdigit\fR
This instruction implements the special PE operator "xdigit", which
checks if CC falls into the character class of the same name, or not.
.sp
Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.
.PP
.SS "ERROR HANDLING"
The instructions in this section mainly access ER and ES.
.TP
\fBerror_clear\fR
This instruction clears ER.
.TP
\fBerror_push\fR
This instruction makes a copy of ER and pushes it on ES.
.TP
\fBerror_pop_merge\fR
This instruction takes the topmost entry of ES and merges the error
status it contains with ES, making the result the new ES.
.sp
The merge is governed by four rules, with the merge result
.RS
.IP [1]
Empty if both states are empty.
.IP [2]
The non-empty state if only one of the two states is non-empty.
.IP [3]
The state with the larger location, if the two states specify
different locations.
.IP [4]
The pair of the location shared by the two states, and the set-union
of their messages for states at the same location.
.RE
.TP
\fBerror_nonterminal\fR \fIsymbol\fR
This is a guarded instruction. It does nothing if either ES is empty,
or if the location in ES is not just past the last location saved in
LS. Otherwise it sets the pair of that location and the nonterminal
\fIsymbol\fR as the new ES.
.sp
\fINote\fR: In the above "just past" means "that location plus one",
or also "the location of the next character after that location".
.PP
.SS "STATUS CONTROL"
The instructions in this section directly manipulate ST.
.TP
\fBstatus_ok\fR
This instruction sets ST to \fBtrue\fR, recording a success.
.TP
\fBstatus_fail\fR
This instruction sets ST to \fBfalse\fR, recording a failure.
.TP
\fBstatus_negate\fR
This instruction negates ST, turning a failure into a success and vice
versa.
.PP
.SS "LOCATION HANDLING"
The instructions in this section access CL and LS.
.TP
\fBloc_push\fR
This instruction makes a copy of CL and pushes it on LS.
.TP
\fBloc_pop_discard\fR
This instructions pops the last saved location from LS.
.TP
\fBloc_pop_rewind\fR
This instruction pops the last saved location from LS and restores it
as CL.
.PP
.SS "NONTERMINAL EXECUTION"
The instructions in this section access and manipulate NC.
.TP
\fBsymbol_restore\fR \fIsymbol\fR
This instruction checks if NC contains data for the nonterminal
\fIsymbol\fR at CL, or not. The result of the instruction is a boolean
flag, with \fBTrue\fR indicating that data was found in the
cache. In that case the instruction has further updated the
architectural state of the machine with the cached information, namely
CL, ST, ER, and SV.
.sp
The method with which the instruction's result is transformed into
control flow is left undefined and the responsibility of the
implementation.
.TP
\fBsymbol_save\fR \fIsymbol\fR
This instructions saves the current settings of CL, ST, ER, and SV in
NC, using the pair of nonterminal \fIsymbol\fR and the last location
saved in LS as key.
.PP
.SS "VALUE CONSTRUCTION"
The instructions in this section manipulate SV.
.TP
\fBvalue_clear\fR
This instruction clears SV.
.TP
\fBvalue_leaf\fR \fIsymbol\fR
This instruction constructs an AST node for \fIsymbol\fR covering the
range of IN from one character after the last location saved on LS to
CL and stores it in SV. ...
.TP
\fBvalue_reduce\fR \fIsymbol\fR
This instruction generally behaves like \fBvalue_nonterminal_leaf\fR,
except that it takes all AST nodes on ARS, if any, and makes them the
children of the new node, with the last node saved on ARS becoming the
right-most / last child. Note that ARS is not modfied by this
operation.
.PP
.SS "AST CONSTRUCTION"
The instructions in this section manipulate ARS and AS.
.TP
\fBast_value_push\fR
This instruction makes a copy of SV and pushes it on ARS.
.TP
\fBast_push\fR
This instruction pushes the current state of ARS on AS and then clears
ARS.
.TP
\fBast_pop_rewind\fR
This instruction pops the last entry saved on AS and restores it as
the new state of ARS.
.TP
\fBast_pop_discard\fR
This instruction pops the last entry saved on AS.
.PP
.SS "CONTROL FLOW"
Normally this section would contain the specifications of the control
flow instructions of the PARAM, i.e. (un)conditional jumps and the
like. However, this part of the PARAM is intentionally left
unspecified. This allows the implementations to freely choose how to
implement control flow.
.PP
The implementation of this machine in Parser Tools, i.e the package
\fBpt::rde\fR, is not only coded in Tcl, but also relies on Tcl
commands to provide it with control flow (instructions).
.SH "INTERACTION OF THE INSTRUCTIONS WITH THE ARCHITECTURAL STATE"
.CS


Instruction		Inputs				Outputs
======================= =======================		====================
ast_pop_discard		AS			->	AS
ast_pop_rewind		AS			->	AS, ARS
ast_push		ARS, AS			->	AS
ast_value_push		SV, ARS			->	ARS
======================= =======================		====================
error_clear		-			->	ER
error_nonterminal sym	ER, LS			->	ER
error_pop_merge   	ES, ER			->	ER
error_push		ES, ER			->	ES
======================= =======================		====================
input_next msg		IN			->	TC, CL, CC, ST, ER
======================= =======================		====================
loc_pop_discard		LS			->	LS
loc_pop_rewind		LS			->	LS, CL
loc_push		CL, LS			->	LS
======================= =======================		====================
status_fail		-			->	ST
status_negate		ST			->	ST
status_ok		-			->	ST
======================= =======================		====================
symbol_restore sym	NC			->	CL, ST, ER, SV
symbol_save    sym	CL, ST, ER, SV LS	->	NC
======================= =======================		====================
test_alnum  		CC			->	ST, ER
test_alpha		CC			->	ST, ER
test_ascii		CC			->	ST, ER
test_char char		CC			->	ST, ER
test_ddigit		CC			->	ST, ER
test_digit		CC			->	ST, ER
test_graph		CC			->	ST, ER
test_lower		CC			->	ST, ER
test_print		CC			->	ST, ER
test_punct		CC			->	ST, ER
test_range chars chare	CC			->	ST, ER
test_space		CC			->	ST, ER
test_upper		CC			->	ST, ER
test_wordchar		CC			->	ST, ER
test_xdigit		CC			->	ST, ER
======================= =======================		====================
value_clear		-			->	SV
value_leaf symbol	LS, CL			->	SV
value_reduce symbol	ARS, LS, CL		->	SV
======================= =======================		====================

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer, virtual machine
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_parser_api.n.
















































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_parser_api.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt_parser_api" i 1 tcllib "Parser Tools"
.BS
.SH NAME
pt_parser_api \- Parser API
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
\fBclassName\fR ?\fIobjectName\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBparse\fR \fIchan\fR
.sp
\fIobjectName\fR \fBparset\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This document describes the API shared by the grammar interpreter
provided by the package \fBpt::peg::interp\fR and the parsers
generated by the \fBpt\fR application for the result formats
\fBcritcl\fR, \fBsnit\fR, and \fBoo\fR regarding access
to the actual parsing functionality.
.PP
Its intended audience are people who wish to create a parser for some
language of theirs and then use that parser within a Tcl-based package
or application.
.PP
It resides in the User Layer of Parser Tools.
.PP
IMAGE: arch_user_pkg
.PP
.SH "CLASS API"
.TP
\fBclassName\fR ?\fIobjectName\fR?
The class command constructs parser instances, i.e. objects. The
result of the command is the fully-qualified name of the instance
command.
.sp
If no \fIobjectName\fR is specified the class will generate and use an
automatic name. If the \fIobjectName\fR was specified, but is not
fully qualified the command will be created in the curent namespace.
.PP
.SH "INSTANCE API"
All parser instances provide at least the methods shown below:
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the parser instance, releasing all claimed memory
and other resources, and deleting the instance command.
.sp
The result of the command is the empty string.
.TP
\fIobjectName\fR \fBparse\fR \fIchan\fR
This method runs the parser using the contents of \fIchan\fR as input
(starting at the current location in the channel), until parsing is
not possible anymore, either because parsing has completed, or run
into a syntax error.
.sp
Note here that the Parser Tools are based on Tcl 8.5+. In other words,
the channel argument is not restricted to files, sockets, etc. We have
the full power of \fIreflected channels\fR available.
.sp
It should also be noted that the parser pulls the characters from the
input stream as it needs them. If a parser created by this package has
to be operated in a push aka event-driven manner it will be necessary
to go to Tcl 8.6+ and use the \fBcoroutine::auto\fR to wrap it
into a coroutine where \fBread\fR is properly changed for
push-operation.
.sp
Upon successful completion the command returns an abstract syntax tree
as its result.
This AST is in the form specified in section
\fBAST serialization format\fR.
As a plain nested Tcl-list it can then be processed with any Tcl
commands the user likes, doing transformations, semantic checks, etc.
To help in this the package \fBpt::ast\fR provides a set of
convenience commands for validation of the tree's basic structure,
printing it for debugging, and walking it either from the bottom up,
or top down.
.sp
When encountering a syntax error the command will throw an error instead.
This error will be a 4-element Tcl-list, containing, in the order
listed below:
.RS
.IP [1]
The string \fBpt::rde\fR identifying it as parser runtime error.
.IP [2]
The location of the parse error, as character offset from the
beginning of the parsed input.
.IP [3]
The location of parse error, now as a 2-element list containing
line-number and column in the line.
.IP [4]
A set of atomic parsing expressions indicating encoding the characters
and/or nonterminal symbols the parser expected to see at the location
of the parse error, but did not get.
For the specification of atomic parsing expressions please see the
section \fBPE serialization format\fR.
.RE
.TP
\fIobjectName\fR \fBparset\fR \fItext\fR
This method runs the parser using the string in \fItext\fR as input.
In all other ways it behaves like the method \fBparse\fR, shown
above.
.PP
.SH USAGE
A generated parser is used like this
.CS


    package require the-parser-package ;# Generated by result-formats 'critcl', 'snit' or 'oo' of 'pt'.
    set parser [the-parser-class]

    set ast [$parser parse $channel]
    ... process the abstract syntax tree ...

.CE
When using a grammar interpreter for parsing some differences creep in
.CS


    package require the-grammar-package ;# Generated by result-format 'container' of 'pt'.
    set grammar [the-grammar-class]

    package require pt::peg::interp
    set parser [pt::peg::interp]

    $parser use $grammar

    set ast [$parser parse $channel]
    $parser destroy

    ... process the abstract syntax tree ...

.CE
.SH "AST SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Abstract Syntax Trees (ASTs) as immutable values for transport,
comparison, etc.
.PP
Each node in an AST represents a nonterminal symbol of a grammar, and
the range of tokens/characters in the input covered by it. ASTs do not
contain terminal symbols, i.e. tokens/characters. These can be
recovered from the input given a symbol's location.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a tree may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.IP [1]
The serialization of any AST is the serialization of its root node.
.IP [2]
The serialization of any node is a Tcl list containing at least three
elements.
.RS
.IP [1]
The first element is the name of the nonterminal symbol stored in the
node.
.IP [2]
The second and third element are the locations of the first and last
token in the token stream the node represents (covers).
.RS
.IP [1]
Locations are provided as non-negative integer offsets from the
beginning of the token stream, with the first token found in the
stream located at offset 0 (zero).
.IP [2]
The end location has to be equal to or larger than the start location.
.RE
.IP [3]
All elements after the first three represent the children of the node,
which are themselves nodes. This means that the serializations of
nodes without children, i.e. leaf nodes, have exactly three elements.
The children are stored in the list with the leftmost child first, and
the rightmost child last.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of an abstract syntax tree has the format
as specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this tree.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression grammar below
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
and the input string
.CS

 120+5
.CE
then a parser should deliver the abstract syntax tree below (except for whitespace)
.PP
.CS


set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}

.CE
.PP
Or, more graphical
.PP
.PS
.nf
                                                           +- Digit 0 0 | 1
                                                           |            |
                               +- Term 0 2 --- Number 0 2 -+- Digit 1 1 | 2
                               |                           |            |
                               |                           +- Digit 2 2 | 0
                               |                                        |
Expression 0 4 --- Factor 0 4 -+----------------------------- AddOp 3 3 | +
                               |                                        |
                               +- Term 4 4 --- Number 4 4 --- Digit 4 4 | 5
.fi
.PE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_container.n.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_container.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::container" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::container \- PEG Storage
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBsnit \fR
.sp
package require \fBpt::peg::container  ?1?\fR
.sp
\fB::pt::peg\fR \fIobjectName\fR ?\fB=\fR|\fB:=\fR|\fB<--\fR|\fBas\fR|\fBdeserialize\fR \fIsrc\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBclear\fR
.sp
\fIobjectName\fR \fBimporter\fR
.sp
\fIobjectName\fR \fBimporter\fR \fIobject\fR
.sp
\fIobjectName\fR \fBexporter\fR
.sp
\fIobjectName\fR \fBexporter\fR \fIobject\fR
.sp
\fIobjectName\fR \fB=\fR \fIsource\fR
.sp
\fIobjectName\fR \fB-->\fR \fIdestination\fR
.sp
\fIobjectName\fR \fBserialize\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBdeserialize =\fR \fIdata\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBdeserialize +=\fR \fIdata\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBstart\fR
.sp
\fIobjectName\fR \fBstart\fR \fIpe\fR
.sp
\fIobjectName\fR \fBnonterminals\fR
.sp
\fIobjectName\fR \fBmodes\fR
.sp
\fIobjectName\fR \fBmodes\fR \fIdict\fR
.sp
\fIobjectName\fR \fBrules\fR
.sp
\fIobjectName\fR \fBrules\fR \fIdict\fR
.sp
\fIobjectName\fR \fBadd\fR ?\fInt\fR...?
.sp
\fIobjectName\fR \fBremove\fR ?\fInt\fR...?
.sp
\fIobjectName\fR \fBexists\fR \fInt\fR
.sp
\fIobjectName\fR \fBrename\fR \fIntold\fR \fIntnew\fR
.sp
\fIobjectName\fR \fBmode\fR \fInt\fR
.sp
\fIobjectName\fR \fBmode\fR \fInt\fR \fImode\fR
.sp
\fIobjectName\fR \fBrule\fR \fInt\fR
.sp
\fIobjectName\fR \fBrule\fR \fInt\fR \fIpe\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides a container class for parsing expression
grammars, with each instance storing a single grammar and allowing the
user to manipulate and query its definition.
.PP
It resides in the Storage section of the Core Layer of Parser Tools,
and is one of the three pillars the management of parsing expression
grammars resides on.
.PP
IMAGE: arch_core_container
.PP
The other two pillars are, as shown above
.IP [1]
\fIPEG Import\fR, and
.IP [2]
\fIPEG Export\fR
.PP
.PP
Packages related to this are:
.TP
\fBpt::rde\fR
This package provides an implementation of PARAM, a virtual machine
for the parsing of a channel, geared towards the needs of handling
PEGs.
.TP
\fBpt::peg::interp\fR
This package implements an interpreter for PEGs on top of the virtual
machine provided by \fBpt::peg::rde\fR
.PP
.SS "CLASS API"
The package exports the API described here.
.TP
\fB::pt::peg\fR \fIobjectName\fR ?\fB=\fR|\fB:=\fR|\fB<--\fR|\fBas\fR|\fBdeserialize\fR \fIsrc\fR?
The command creates a new container object for a parsing expression
grammar and returns the fully qualified name of the object command as
its result. The API of this object command is described in the section
\fBObject API\fR. It may be used to invoke various operations on
the object.
.sp
The new container will be empty if no \fIsrc\fR is specified. Otherwise
it will contain a copy of the grammar contained in the \fIsrc\fR.
All operators except \fBdeserialize\fR interpret \fIsrc\fR as a
container object command. The \fBdeserialize\fR operator interprets
\fIsrc\fR as the serialization of a parsing expression grammar
instead, as specified in section \fBPEG serialization format\fR.
.sp
An empty grammar has no nonterminal symbols, and the start expression
is the empty expression, i.e. epsilon. It is \fIvalid\fR, but not
\fIuseful\fR.
.PP
.SS "OBJECT API"
.PP
All objects created by this package provide the following methods for
the manipulation and querying of their contents:
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object, releasing all claimed memory, and
deleting the associated object command.
.TP
\fIobjectName\fR \fBclear\fR
This method resets the object to contain the empty grammar. It does
\fInot\fR destroy the object itself.
.TP
\fIobjectName\fR \fBimporter\fR
This method returns the import manager object currently attached to
the container, if any.
.TP
\fIobjectName\fR \fBimporter\fR \fIobject\fR
This method attaches the \fIobject\fR as import manager to the
container, and returns it as the result of the command.
Note that the \fIobject\fR is \fInot\fR put into ownership of the
container. I.e., destruction of the container will \fInot\fR destroy
the \fIobject\fR.
.sp
It is expected that \fIobject\fR provides a method named
\fBimport text\fR which takes a text and a format name, and
returns the canonical serialization of the table of contents contained in
the text, assuming the given format.
.TP
\fIobjectName\fR \fBexporter\fR
This method returns the export manager object currently attached to
the container, if any.
.TP
\fIobjectName\fR \fBexporter\fR \fIobject\fR
This method attaches the \fIobject\fR as export manager to the
container, and returns it as the result of the command.
Note that the \fIobject\fR is \fInot\fR put into ownership of the
container. I.e., destruction of the container will \fInot\fR destroy
the \fIobject\fR.
.sp
It is expected that \fIobject\fR provides a method named
\fBexport object\fR which takes the container and a format name,
and returns a text encoding table of contents stored in the container, in
the given format. It is further expected that the \fIobject\fR will
use the container's method \fBserialize\fR to obtain the
serialization of the table of contents from which to generate the text.
.TP
\fIobjectName\fR \fB=\fR \fIsource\fR
This method assigns the contents of the PEG object \fIsource\fR to
ourselves, overwriting the existing definition. This is the assignment
operator for grammars.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIobjectName\fR \fBdeserialize =\fR [\fIsource\fR \fBserialize\fR]

.CE
.TP
\fIobjectName\fR \fB-->\fR \fIdestination\fR
This method assigns our contents to the PEG object \fIdestination\fR,
overwriting the existing definition. This is the reverse assignment
operator for grammars.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIdestination\fR \fBdeserialize =\fR [\fIobjectName\fR \fBserialize\fR]

.CE
.TP
\fIobjectName\fR \fBserialize\fR ?\fIformat\fR?
This method returns our grammar in some textual form usable for
transfer, persistent storage, etc. If no \fIformat\fR is not specified
the returned result is the canonical serialization of the grammar, as
specified in the section \fBPEG serialization format\fR.
.sp
Otherwise the object will use the attached export manager to convert
the data to the specified format. In that case the method will fail
with an error if the container has no export manager attached to it.
.TP
\fIobjectName\fR \fBdeserialize =\fR \fIdata\fR ?\fIformat\fR?
This is the complementary method to \fBserialize\fR.
It replaces the current definition with the grammar contained in the
\fIdata\fR. If no \fIformat\fR was specified it is assumed to be the
regular serialization of a grammar, as specified in the section
\fBPEG serialization format\fR
.sp
Otherwise the object will use the attached import manager to convert
the data from the specified format to a serialization it can handle.
In that case the method will fail with an error if the container has
no import manager attached to it.
.sp
The result of the method is the empty string.
.TP
\fIobjectName\fR \fBdeserialize +=\fR \fIdata\fR ?\fIformat\fR?
This method behaves like \fBdeserialize =\fR in its essentials,
except that it merges the grammar in the \fIdata\fR to its
contents instead of replacing it.
The method will fail with an error and leave the grammar unchanged if
merging is not possible, i.e. would produce an invalid grammar.
.sp
The result of the method is the empty string.
.TP
\fIobjectName\fR \fBstart\fR
This method returns the current start expression of the grammar.
.TP
\fIobjectName\fR \fBstart\fR \fIpe\fR
This method defines the \fIstart expression\fR of the grammar. It
replaces the current start expression with the parsing expression
\fIpe\fR, and returns the new start expression.
.sp
The method will fail with an error and leave the grammar unchanged if
\fIpe\fR does not contain a valid parsing expression as specified in
the section \fBPE serialization format\fR.
.TP
\fIobjectName\fR \fBnonterminals\fR
This method returns the set of all nonterminal symbols known to the
grammar.
.TP
\fIobjectName\fR \fBmodes\fR
This method returns a dictionary mapping the set of all nonterminal
symbols known to the grammar to their semantic modes.
.TP
\fIobjectName\fR \fBmodes\fR \fIdict\fR
This method takes a dictionary mapping a set of nonterminal symbols
known to the grammar to their semantic modes, and returns the new full
mapping of nonterminal symbols to semantic modes.
.sp
The method will fail with an error if any of the nonterminal symbols
in the dictionary is not known to the grammar, or the empty string,
i.e. an invalid nonterminal symbol, or if any the chosen \fImode\fRs
is not one of the legal values.
.TP
\fIobjectName\fR \fBrules\fR
This method returns a dictionary mapping the set of all nonterminal
symbols known to the grammar to their parsing expressions (right-hand
sides).
.TP
\fIobjectName\fR \fBrules\fR \fIdict\fR
This method takes a dictionary mapping a set of nonterminal symbols
known to the grammar to their parsing expressions (right-hand sides),
and returns the new full mapping of nonterminal symbols to parsing
expressions.
.sp
The method will fail with an error any of the nonterminal symbols in
the dictionary is not known to the grammar, or the empty string,
i.e. an invalid nonterminal symbol, or any of the chosen parsing
expressions is not a valid parsing expression as specified in the
section \fBPE serialization format\fR.
.TP
\fIobjectName\fR \fBadd\fR ?\fInt\fR...?
This method adds the nonterminal symbols \fInt\fR, etc. to the
grammar, and defines default semantic mode and expression for it
(\fBvalue\fR and \fBepsilon\fR respectively).
The method returns the empty string as its result.
.sp
The method will fail with an error and leaves the grammar unchanged if
any of the nonterminal symbols are either already defined in our
grammar, or are the empty string (an invalid nonterminal symbol).
.sp
The method does nothing if no symbol was specified as argument.
.TP
\fIobjectName\fR \fBremove\fR ?\fInt\fR...?
This method removes the named nonterminal symbols \fInt\fR, etc. from
the set of nonterminal symbols known to our grammar.
The method returns the empty string as its result.
.sp
The method will fail with an error and leave the grammar unchanged if
any of the nonterminal symbols is not known to the grammar, or is the
empty string, i.e. an invalid nonterminal symbol.
.TP
\fIobjectName\fR \fBexists\fR \fInt\fR
This method tests whether the nonterminal symbol \fInt\fR is known
to our grammar or not.
The result is a boolean value. It will be set to \fBtrue\fR if
\fInt\fR is known, and \fBfalse\fR otherwise.
.sp
The method will fail with an error if \fInt\fR is the empty string,
i.e. an invalid nonterminal symbol.
.TP
\fIobjectName\fR \fBrename\fR \fIntold\fR \fIntnew\fR
This method renames the nonterminal symbol \fIntold\fR to \fIntnew\fR.
The method returns the empty string as its result.
.sp
The method will fail with an error and leave the grammar unchanged if
either \fIntold\fR is not known to the grammar, or \fIntnew\fR is
already known, or any of them is the empty string, i.e. an invalid
nonterminal symbol.
.TP
\fIobjectName\fR \fBmode\fR \fInt\fR
This method returns the current semantic mode for the nonterminal
symbol \fInt\fR.
.sp
The method will fail with an error if \fInt\fR is not known to the
grammar, or the empty string, i.e. an invalid nonterminal symbol.
.TP
\fIobjectName\fR \fBmode\fR \fInt\fR \fImode\fR
This mode sets the semantic mode for the nonterminal symbol \fInt\fR,
and returns the new mode.
The method will fail with an error if \fInt\fR is not known to the
grammar, or the empty string, i.e. an invalid nonterminal symbol, or
the chosen \fImode\fR is not one of the legal values.
.sp
The following modes are legal:
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.TP
\fIobjectName\fR \fBrule\fR \fInt\fR
This method returns the current parsing expression (right-hand side)
for the nonterminal symbol \fInt\fR.
.sp
The method will fail with an error if \fInt\fR is not known to the
grammar, or the empty string, i.e. an invalid nonterminal symbol.
.TP
\fIobjectName\fR \fBrule\fR \fInt\fR \fIpe\fR
This method set the parsing expression (right-hand side) of the
nonterminal \fInt\fR to \fIpe\fR, and returns the new parsing
expression.
.sp
The method will fail with an error if \fInt\fR is not known to the
grammar, or the empty string, i.e. an invalid nonterminal symbol, or
\fIpe\fR does not contain a valid parsing expression as specified in
the section \fBPE serialization format\fR.
.PP
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_container_peg.n.






























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_container_peg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::container::peg" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::container::peg \- PEG Storage. Canned PEG grammar specification
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBsnit \fR
.sp
package require \fBpt::peg::container::peg  ?1?\fR
.sp
package require \fBpt::peg::container \fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides a sub-type of \fBpt::peg::container\fR which
is preloaded with a parsing expression grammar describing a textual
format for parsing expression grammars.
.PP
The sub-type provides the exact same API as
\fBpt::peg::container\fR. Instead of duplicating its contents the
reader is asked to read the referenced document.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_export.n.






































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_export.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::export" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::export \- PEG Export
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBsnit \fR
.sp
package require \fBconfiguration \fR
.sp
package require \fBpt::peg \fR
.sp
package require \fBpluginmgr \fR
.sp
package require \fBpt::peg::export  ?1?\fR
.sp
\fB::pt::peg::export\fR \fIobjectName\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBexport serial\fR \fIserial\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBexport object\fR \fIobject\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBconfiguration names\fR
.sp
\fIobjectName\fR \fBconfiguration get\fR
.sp
\fIobjectName\fR \fBconfiguration set\fR \fIname\fR ?\fIvalue\fR?
.sp
\fIobjectName\fR \fBconfiguration unset\fR \fIpattern\fR...
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides a manager for parsing expression grammars, with
each instance handling a set of plugins for the export of them to
other formats, i.e. their conversion to, for example \fInroff\fR,
\fIHTML\fR, etc.
.PP
It resides in the Export section of the Core Layer of Parser Tools,
and is one of the three pillars the management of parsing expression
grammars resides on.
.PP
IMAGE: arch_core_export
.PP
The other two pillars are, as shown above
.IP [1]
\fIPEG Import\fR, and
.IP [2]
\fIPEG Storage\fR
.PP
.PP
For information about the data structure which is the major input to
the manager objects provided by this package see the section
\fBPEG serialization format\fR.
.PP
The plugin system of this class is based on the package
\fBpluginmgr\fR, and configured to look for plugins using
.IP [1]
the environment variable \fBGRAMMAR_PEG_EXPORT_PLUGINS\fR,
.IP [2]
the environment variable \fBGRAMMAR_PEG_PLUGINS\fR,
.IP [3]
the environment variable \fBGRAMMAR_PLUGINS\fR,
.IP [4]
the path "\fI~/.grammar/peg/export/plugin\fR"
.IP [5]
the path "\fI~/.grammar/peg/plugin\fR"
.IP [6]
the path "\fI~/.grammar/plugin\fR"
.IP [7]
the path "\fI~/.grammar/peg/export/plugins\fR"
.IP [8]
the path "\fI~/.grammar/peg/plugins\fR"
.IP [9]
the path "\fI~/.grammar/plugins\fR"
.IP [10]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\GRAMMAR\\PEG\\EXPORT\\PLUGINS"
.IP [11]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\GRAMMAR\\PEG\\PLUGINS"
.IP [12]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\GRAMMAR\\PLUGINS"
.PP
The last three are used only when the package is run on a machine
using the Windows(tm) operating system.
.PP
The whole system is delivered with three predefined export plugins,
namely
.TP
container
See \fIPEG Export Plugin. To CONTAINER format\fR for details.
.TP
json
See \fIPEG Export Plugin. To JSON format\fR for details.
.TP
peg
See \fIPEG Export Plugin. To PEG format\fR for details.
.PP
.PP
For readers wishing to write their own export plugin for some format,
i.e. \fIplugin writer\fRs, reading and understanding the
\fIParser Tools Export API\fR specification is an absolute
necessity, as it documents the interaction between this package and
its plugins in detail.
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fB::pt::peg::export\fR \fIobjectName\fR
This command creates a new export manager object with an associated
Tcl command whose name is \fIobjectName\fR. This \fIobject\fR command
is explained in full detail in the sections \fBObject command\fR
and \fBObject methods\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::pt::peg::export\fR command have
the following general form:
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBexport serial\fR \fIserial\fR ?\fIformat\fR?
This method takes the canonical serialization of a parsing expression
grammar stored in \fIserial\fR and converts it to the specified
\fIformat\fR, using the export plugin for the format. This will fail
with an error if no plugin could be found for the format.
The string generated by the conversion process is returned as
the result of this method.
.sp
If no format is specified the method defaults to \fBtext\fR.
.sp
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBPEG serialization format\fR.
.sp
The plugin has to conform to the interface documented in the
\fIParser Tools Export API\fR specification.
.TP
\fIobjectName\fR \fBexport object\fR \fIobject\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBexport serial\fR
method described by the previous item.
It expects that \fIobject\fR is an object command supporting a
\fBserialize\fR method returning the canonical serialization of a
parsing expression grammar. It invokes that method, feeds the result
into \fBexport serial\fR and returns the resulting string as its
own result.
.TP
\fIobjectName\fR \fBconfiguration names\fR
This method returns a list containing the names of all configuration
options currently known to the object.
.TP
\fIobjectName\fR \fBconfiguration get\fR
This method returns a dictionary containing the names and values of
all configuration options currently known to the object.
.TP
\fIobjectName\fR \fBconfiguration set\fR \fIname\fR ?\fIvalue\fR?
This method sets the configuration option \fIname\fR to the
specified \fIvalue\fR and returns the new value of the option.
.sp
If no value is specified it simply returns the current value, without
changing it.
.sp
Note that these configuration options and their values are simply
passed to a plugin when the actual export is performed. It is the
plugin which checks the validity, not the manager.
.TP
\fIobjectName\fR \fBconfiguration unset\fR \fIpattern\fR...
This method unsets all configuration options matching the specified
glob \fIpattern\fRs. If no pattern is specified it will unset all
currently defined configuration options.
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_export_container.n.






































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_export_container.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::export::container" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::export::container \- PEG Export Plugin. Write CONTAINER format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::export::container  ?1?\fR
.sp
package require \fBpt::peg::to::container \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the parsing expression grammar export plugin
for the generation of CONTAINER markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools and
is intended to be used by \fBpt::peg::export\fR, the export
manager, sitting between it and the corresponding core conversion
functionality provided by \fBpt::peg::to::container\fR.
.PP
IMAGE: arch_core_eplugins
.PP
.PP
While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:
.IP [1]
In an untrusted environment the proper access is through the package
\fBpt::peg::export\fR and the export manager objects it
provides.
.IP [2]
In a trusted environment however simply use the package
\fBpt::peg::to::container\fR and access the core
conversion functionality directly.
.PP
.SH API
The API provided by this package satisfies the specification of the
Plugin API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates CONTAINER markup encoding the grammar.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The CONTAINER export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
enum \fImode\fR
The value of this configuration variable controls which methods of
\fBpt::peg\fR instances the plugin will use to specify the
grammar. There are two legal values
.RS
.TP
\fBbulk\fR
In this mode the methods \fBstart\fR, \fBadd\fR, \fBmodes\fR,
and \fBrules\fR are used to specify the grammar in a bulk manner,
i.e. as a set of nonterminal symbols, and two dictionaries mapping
from the symbols to their semantic modes and parsing expressions.
.sp
This mode is the default.
.TP
\fBincremental\fR
In this mode the methods \fBstart\fR, \fBadd\fR, \fBmode\fR,
and \fBrule\fR are used to specify the grammar piecemal, with each
nonterminal having its own block of defining commands.
.RE
.TP
string \fItemplate\fR
If this configuration variable is set it is assumed to contain a
string into which to put the generated code and other configuration
data. The various locations are expected to be specified with the
following placeholders:
.RS
.TP
\fB@user@\fR
To be replaced with the value of the configuration variable \fBuser\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBCONTAINER\fR.
.TP
\fB@file@\fR
To be replaced with the value of the configuration variable \fBfile\fR.
.TP
\fB@name@\fR
To be replaced with the value of the configuration variable \fBname\fR.
.TP
\fB@mode@\fR
To be replaced with the value of the configuration variable \fBmode\fR.
.TP
\fB@code@\fR
To be replaced with the generated code.
.RE
.sp
If this configuration variable is not set, or empty, then the plugin
falls back to a standard template, which is defined as "\fB@code@\fR".
.PP
\fINote\fR that this plugin may ignore the standard configuration
variables \fBuser\fR, \fBformat\fR, \fBfile\fR, and their values,
depending on the chosen template.
.PP
The content of the standard configuration variable \fBname\fR, if set,
is used as name of the grammar in the output. Otherwise the plugin
falls back to the default name \fBa_pe_grammar\fR.
.SH "GRAMMAR CONTAINER"
The \fBcontainer\fR format is another form of describing parsing
expression grammars. While data in this format is executable it does
not constitute a parser for the grammar. It always has to be used in
conjunction with the package \fBpt::peg::interp\fR, a grammar
interpreter.
.PP
The format represents grammars by a \fBsnit::type\fR, i.e. class,
whose instances are API-compatible to the instances of the
\fBpt::peg::container\fR package, and which are preloaded with the
grammar in question.
.PP
It has no direct formal specification beyond what was said above.
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
one possible CONTAINER serialization for it is
.PP
.CS


snit::type a_pe_grammar {
    constructor {} {
        install myg using pt::peg::container ${selfns}::G
        $myg start {n Expression}
        $myg add   AddOp Digit Expression Factor MulOp Number Sign Term
        $myg modes {
            AddOp      value
            Digit      value
            Expression value
            Factor     value
            MulOp      value
            Number     value
            Sign       value
            Term       value
        }
        $myg rules {
            AddOp      {/ {t -} {t +}}
            Digit      {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}
            Expression {/ {x {t \\50} {n Expression} {t \\51}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}}
            Factor     {x {n Term} {* {x {n AddOp} {n Term}}}}
            MulOp      {/ {t *} {t /}}
            Number     {x {? {n Sign}} {+ {n Digit}}}
            Sign       {/ {t -} {t +}}
            Term       {n Number}
        }
        return
    }

    component myg
    delegate method * to myg
}

.CE
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
CONTAINER, EBNF, LL(k), PEG, TDPL, context-free languages, export, expression, grammar, matching, parser, parsing expression, parsing expression grammar, plugin, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_export_json.n.

































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_export_json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::export::json" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::export::json \- PEG Export Plugin. Write JSON format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::export::json  ?1?\fR
.sp
package require \fBpt::peg::to::json \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the parsing expression grammar export plugin
for the generation of JSON markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools and
is intended to be used by \fBpt::peg::export\fR, the export
manager, sitting between it and the corresponding core conversion
functionality provided by \fBpt::peg::to::json\fR.
.PP
IMAGE: arch_core_eplugins
.PP
.PP
While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:
.IP [1]
In an untrusted environment the proper access is through the package
\fBpt::peg::export\fR and the export manager objects it
provides.
.IP [2]
In a trusted environment however simply use the package
\fBpt::peg::to::json\fR and access the core
conversion functionality directly.
.PP
.SH API
The API provided by this package satisfies the specification of the
Plugin API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates JSON markup encoding the grammar.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The JSON export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
boolean \fIindented\fR
If this flag is set the plugin will break the generated JSON code
across lines and indent it according to its inner structure, with each
key of a dictionary on a separate line.
.sp
If this flag is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.
.TP
boolean \fIaligned\fR
If this flag is set the generator ensures that the values for the keys
in a dictionary are vertically aligned with each other, for a nice
table effect. To make this work this also implies that \fBindented\fR
is set.
.sp
If this flag is not set (the default), the output is formatted as per
the value of \fBindented\fR, without trying to align the values for
dictionary keys.
.PP
\fINote\fR that this plugin ignores the standard configuration
variables \fBuser\fR, \fBformat\fR, \fBfile\fR, and \fBname\fR, and
their values.
.SH "JSON GRAMMAR EXCHANGE FORMAT"
The \fBjson\fR format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.
.PP
It is formally specified by the rules below:
.IP [1]
The JSON of any PEG is a JSON object.
.IP [2]
This object holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section \fBPE serialization format\fR.
.TP
\fBmode\fR
The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
\fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.PP
.PP
As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
\fBPEG serialization format\fR, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
a JSON serialization for it is
.PP
.CS


{
    "pt::grammar::peg" : {
        "rules" : {
            "AddOp"     : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Digit"     : {
                "is"   : "\\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}",
                "mode" : "value"
            },
            "Expression" : {
                "is"   : "\\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}",
                "mode" : "value"
            },
            "Factor"    : {
                "is"   : "x {n Term} {* {x {n AddOp} {n Term}}}",
                "mode" : "value"
            },
            "MulOp"     : {
                "is"   : "\\/ {t *} {t \\/}",
                "mode" : "value"
            },
            "Number"    : {
                "is"   : "x {? {n Sign}} {+ {n Digit}}",
                "mode" : "value"
            },
            "Sign"      : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Term"      : {
                "is"   : "n Number",
                "mode" : "value"
            }
        },
        "start" : "n Expression"
    }
}

.CE
.PP
and a Tcl serialization of the same is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
The similarity of the latter to the JSON should be quite obvious.
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, JSON, LL(k), PEG, TDPL, context-free languages, export, expression, grammar, matching, parser, parsing expression, parsing expression grammar, plugin, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_export_peg.n.


























































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_export_peg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::export::peg" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::export::peg \- PEG Export Plugin. Write PEG format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::export::peg  ?1?\fR
.sp
package require \fBpt::peg::to::peg \fR
.sp
\fBexport\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the parsing expression grammar export plugin
for the generation of PEG markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools and
is intended to be used by \fBpt::peg::export\fR, the export
manager, sitting between it and the corresponding core conversion
functionality provided by \fBpt::peg::to::peg\fR.
.PP
IMAGE: arch_core_eplugins
.PP
.PP
While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:
.IP [1]
In an untrusted environment the proper access is through the package
\fBpt::peg::export\fR and the export manager objects it
provides.
.IP [2]
In a trusted environment however simply use the package
\fBpt::peg::to::peg\fR and access the core
conversion functionality directly.
.PP
.SH API
The API provided by this package satisfies the specification of the
Plugin API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBexport\fR \fIserial\fR \fIconfiguration\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, the \fIconfiguration\fR, a dictionary,
and generates PEG markup encoding the grammar.
The created string is then returned as the result of the command.
.PP
.SH CONFIGURATION
The PEG export plugin recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
string \fItemplate\fR
If this configuration variable is set it is assumed to contain a
string into which to put the generated text and other configuration
data. The various locations are expected to be specified with the
following placeholders:
.RS
.TP
\fB@user@\fR
To be replaced with the value of the configuration variable \fBuser\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBPEG\fR.
.TP
\fB@file@\fR
To be replaced with the value of the configuration variable \fBfile\fR.
.TP
\fB@name@\fR
To be replaced with the value of the configuration variable \fBname\fR.
.TP
\fB@code@\fR
To be replaced with the generated text.
.RE
.sp
If this configuration variable is not set, or empty, then the plugin
falls back to a standard template, which is defined as "\fB@code@\fR".
.PP
\fINote\fR that this plugin may ignore the standard configuration
variables \fBuser\fR, \fBformat\fR, \fBfile\fR, and their values,
depending on the chosen template.
.PP
The content of the standard configuration variable \fBname\fR, if set,
is used as name of the grammar in the output. Otherwise the plugin
falls back to the default name \fBa_pe_grammar\fR.
.SH "PEG SPECIFICATION LANGUAGE"
\fBpeg\fR, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.
.PP
It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the \fIPEG Language Tutorial\fR.
.PP
.CS


PEG pe-grammar-for-peg (Grammar)

	# --------------------------------------------------------------------
        # Syntactical constructs

        Grammar         <- WHITESPACE Header Definition* Final EOF ;

        Header          <- PEG Identifier StartExpr ;
        Definition      <- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       <- (VOID / LEAF) COLON ;
        Expression      <- Sequence (SLASH Sequence)* ;
        Sequence        <- Prefix+ ;
        Prefix          <- (AND / NOT)? Suffix ;
        Suffix          <- Primary (QUESTION / STAR / PLUS)? ;
        Primary         <- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         <- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           <- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           <- Char TO Char / Char ;

        StartExpr       <- OPEN Expression CLOSE ;
void:   Final           <- END SEMICOLON WHITESPACE ;

        # --------------------------------------------------------------------
        # Lexing constructs

        Identifier      <- Ident WHITESPACE ;
leaf:   Ident           <- ('_' / ':' / <alpha>) ('_' / ':' / <alnum>)* ;
        Char            <- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;

leaf:   CharSpecial     <- "\\\\" [nrt'"\\[\\]\\\\] ;
leaf:   CharOctalFull   <- "\\\\" [0-2][0-7][0-7] ;
leaf:   CharOctalPart   <- "\\\\" [0-7][0-7]? ;
leaf:   CharUnicode     <- "\\\\" 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   <- !"\\\\" . ;

void:   HexDigit        <- [0-9a-fA-F] ;

void:   TO              <- '-'           ;
void:   OPENB           <- "["           ;
void:   CLOSEB          <- "]"           ;
void:   APOSTROPH       <- "'"           ;
void:   DAPOSTROPH      <- '"'           ;
void:   PEG             <- "PEG"   WHITESPACE ;
void:   IS              <- "<-"    WHITESPACE ;
leaf:   VOID            <- "void"  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            <- "leaf"  WHITESPACE ; # Implies that definition has no terminals.
void:   END             <- "END"   WHITESPACE ;
void:   SEMICOLON       <- ";"     WHITESPACE ;
void:   COLON           <- ":"     WHITESPACE ;
void:   SLASH           <- "/"     WHITESPACE ;
leaf:   AND             <- "&"     WHITESPACE ;
leaf:   NOT             <- "!"     WHITESPACE ;
leaf:   QUESTION        <- "?"     WHITESPACE ;
leaf:   STAR            <- "*"     WHITESPACE ;
leaf:   PLUS            <- "+"     WHITESPACE ;
void:   OPEN            <- "("     WHITESPACE ;
void:   CLOSE           <- ")"     WHITESPACE ;
leaf:   DOT             <- "."     WHITESPACE ;

leaf:   ALNUM           <- "<alnum>"    WHITESPACE ;
leaf:   ALPHA           <- "<alpha>"    WHITESPACE ;
leaf:   ASCII           <- "<ascii>"    WHITESPACE ;
leaf:   CONTROL         <- "<control>"  WHITESPACE ;
leaf:   DDIGIT          <- "<ddigit>"   WHITESPACE ;
leaf:   DIGIT           <- "<digit>"    WHITESPACE ;
leaf:   GRAPH           <- "<graph>"    WHITESPACE ;
leaf:   LOWER           <- "<lower>"    WHITESPACE ;
leaf:   PRINTABLE       <- "<print>"    WHITESPACE ;
leaf:   PUNCT           <- "<punct>"    WHITESPACE ;
leaf:   SPACE           <- "<space>"    WHITESPACE ;
leaf:   UPPER           <- "<upper>"    WHITESPACE ;
leaf:   WORDCHAR        <- "<wordchar>" WHITESPACE ;
leaf:   XDIGIT          <- "<xdigit>"   WHITESPACE ;

void:   WHITESPACE      <- (" " / "\\t" / EOL / COMMENT)* ;
void:   COMMENT         <- '#' (!EOL .)* EOL ;
void:   EOL             <- "\\n\\r" / "\\n" / "\\r" ;
void:   EOF             <- !. ;

        # --------------------------------------------------------------------
END;

.CE
.SS EXAMPLE
Our example specifies the grammar for a basic 4-operation calculator.
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as
.PP
.CS


PEG calculator (Expression)
    Sign       <- [-+] 						;
    Number     <- Sign? <ddigit>+				;
    Expression <- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      <- [*/]						;
    Factor     <- Term (AddOp Term)*				;
    AddOp      <- [-+]						;
    Term       <- Number					;
END;

.CE
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, export, expression, grammar, matching, parser, parsing expression, parsing expression grammar, plugin, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_from_container.n.
























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_from_container.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::from::container" n 0 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::from::container \- PEG Conversion. From CONTAINER format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package does not exist.
There is no need for it.
The CONTAINER format for parsing expression grammars is a piece of Tcl
code which, then sourced, provides a class whose instances have the
grammar we wish to import loaded.
Another way of looking at this is, the CONTAINER output is its own
import package.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_from_json.n.































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_from_json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::from::json" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::from::json \- PEG Conversion. Read JSON format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::from::json  ?1?\fR
.sp
package require \fBpt::peg \fR
.sp
package require \fBjson \fR
.sp
\fBpt::peg::from::json\fR \fBconvert\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the converter from JSON markup to
parsing expression grammars.
.PP
It resides in the Import section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the import manager provided by
\fBpt::peg::import\fR. The latter is intented for use in untrusted
environments and done through the corresponding import plugin
\fBpt::peg::import::json\fR sitting between converter
and import manager.
.PP
IMAGE: arch_core_iplugins
.PP
.SH API
The API provided by this package satisfies the specification of the
Converter API found in the \fIParser Tools Import API\fR
specification.
.TP
\fBpt::peg::from::json\fR \fBconvert\fR \fItext\fR
This command takes the JSON markup encoding a parsing
expression grammar and contained in \fItext\fR, and generates the
canonical serialization of said grammar, as specified in section
\fBPEG serialization format\fR.
The created value is then returned as the result of the command.
.PP
.SH "JSON GRAMMAR EXCHANGE FORMAT"
The \fBjson\fR format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.
.PP
It is formally specified by the rules below:
.IP [1]
The JSON of any PEG is a JSON object.
.IP [2]
This object holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section \fBPE serialization format\fR.
.TP
\fBmode\fR
The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
\fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.PP
.PP
As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
\fBPEG serialization format\fR, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
a JSON serialization for it is
.PP
.CS


{
    "pt::grammar::peg" : {
        "rules" : {
            "AddOp"     : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Digit"     : {
                "is"   : "\\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}",
                "mode" : "value"
            },
            "Expression" : {
                "is"   : "\\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}",
                "mode" : "value"
            },
            "Factor"    : {
                "is"   : "x {n Term} {* {x {n AddOp} {n Term}}}",
                "mode" : "value"
            },
            "MulOp"     : {
                "is"   : "\\/ {t *} {t \\/}",
                "mode" : "value"
            },
            "Number"    : {
                "is"   : "x {? {n Sign}} {+ {n Digit}}",
                "mode" : "value"
            },
            "Sign"      : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Term"      : {
                "is"   : "n Number",
                "mode" : "value"
            }
        },
        "start" : "n Expression"
    }
}

.CE
.PP
and a Tcl serialization of the same is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
The similarity of the latter to the JSON should be quite obvious.
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, JSON, LL(k), PEG, TDPL, context-free languages, conversion, expression, format conversion, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_from_peg.n.








































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_from_peg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::from::peg" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::from::peg \- PEG Conversion. Read PEG format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::from::peg  ?1?\fR
.sp
\fBpt::peg::from::peg\fR \fBconvert\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the converter from PEG markup to
parsing expression grammars.
.PP
It resides in the Import section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the import manager provided by
\fBpt::peg::import\fR. The latter is intented for use in untrusted
environments and done through the corresponding import plugin
\fBpt::peg::import::peg\fR sitting between converter
and import manager.
.PP
IMAGE: arch_core_iplugins
.PP
.SH API
The API provided by this package satisfies the specification of the
Converter API found in the \fIParser Tools Import API\fR
specification.
.TP
\fBpt::peg::from::peg\fR \fBconvert\fR \fItext\fR
This command takes the PEG markup encoding a parsing
expression grammar and contained in \fItext\fR, and generates the
canonical serialization of said grammar, as specified in section
\fBPEG serialization format\fR.
The created value is then returned as the result of the command.
.PP
.SH "PEG SPECIFICATION LANGUAGE"
\fBpeg\fR, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.
.PP
It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the \fIPEG Language Tutorial\fR.
.PP
.CS


PEG pe-grammar-for-peg (Grammar)

	# --------------------------------------------------------------------
        # Syntactical constructs

        Grammar         <- WHITESPACE Header Definition* Final EOF ;

        Header          <- PEG Identifier StartExpr ;
        Definition      <- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       <- (VOID / LEAF) COLON ;
        Expression      <- Sequence (SLASH Sequence)* ;
        Sequence        <- Prefix+ ;
        Prefix          <- (AND / NOT)? Suffix ;
        Suffix          <- Primary (QUESTION / STAR / PLUS)? ;
        Primary         <- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         <- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           <- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           <- Char TO Char / Char ;

        StartExpr       <- OPEN Expression CLOSE ;
void:   Final           <- END SEMICOLON WHITESPACE ;

        # --------------------------------------------------------------------
        # Lexing constructs

        Identifier      <- Ident WHITESPACE ;
leaf:   Ident           <- ('_' / ':' / <alpha>) ('_' / ':' / <alnum>)* ;
        Char            <- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;

leaf:   CharSpecial     <- "\\\\" [nrt'"\\[\\]\\\\] ;
leaf:   CharOctalFull   <- "\\\\" [0-2][0-7][0-7] ;
leaf:   CharOctalPart   <- "\\\\" [0-7][0-7]? ;
leaf:   CharUnicode     <- "\\\\" 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   <- !"\\\\" . ;

void:   HexDigit        <- [0-9a-fA-F] ;

void:   TO              <- '-'           ;
void:   OPENB           <- "["           ;
void:   CLOSEB          <- "]"           ;
void:   APOSTROPH       <- "'"           ;
void:   DAPOSTROPH      <- '"'           ;
void:   PEG             <- "PEG"   WHITESPACE ;
void:   IS              <- "<-"    WHITESPACE ;
leaf:   VOID            <- "void"  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            <- "leaf"  WHITESPACE ; # Implies that definition has no terminals.
void:   END             <- "END"   WHITESPACE ;
void:   SEMICOLON       <- ";"     WHITESPACE ;
void:   COLON           <- ":"     WHITESPACE ;
void:   SLASH           <- "/"     WHITESPACE ;
leaf:   AND             <- "&"     WHITESPACE ;
leaf:   NOT             <- "!"     WHITESPACE ;
leaf:   QUESTION        <- "?"     WHITESPACE ;
leaf:   STAR            <- "*"     WHITESPACE ;
leaf:   PLUS            <- "+"     WHITESPACE ;
void:   OPEN            <- "("     WHITESPACE ;
void:   CLOSE           <- ")"     WHITESPACE ;
leaf:   DOT             <- "."     WHITESPACE ;

leaf:   ALNUM           <- "<alnum>"    WHITESPACE ;
leaf:   ALPHA           <- "<alpha>"    WHITESPACE ;
leaf:   ASCII           <- "<ascii>"    WHITESPACE ;
leaf:   CONTROL         <- "<control>"  WHITESPACE ;
leaf:   DDIGIT          <- "<ddigit>"   WHITESPACE ;
leaf:   DIGIT           <- "<digit>"    WHITESPACE ;
leaf:   GRAPH           <- "<graph>"    WHITESPACE ;
leaf:   LOWER           <- "<lower>"    WHITESPACE ;
leaf:   PRINTABLE       <- "<print>"    WHITESPACE ;
leaf:   PUNCT           <- "<punct>"    WHITESPACE ;
leaf:   SPACE           <- "<space>"    WHITESPACE ;
leaf:   UPPER           <- "<upper>"    WHITESPACE ;
leaf:   WORDCHAR        <- "<wordchar>" WHITESPACE ;
leaf:   XDIGIT          <- "<xdigit>"   WHITESPACE ;

void:   WHITESPACE      <- (" " / "\\t" / EOL / COMMENT)* ;
void:   COMMENT         <- '#' (!EOL .)* EOL ;
void:   EOL             <- "\\n\\r" / "\\n" / "\\r" ;
void:   EOF             <- !. ;

        # --------------------------------------------------------------------
END;

.CE
.SS EXAMPLE
Our example specifies the grammar for a basic 4-operation calculator.
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as
.PP
.CS


PEG calculator (Expression)
    Sign       <- [-+] 						;
    Number     <- Sign? <ddigit>+				;
    Expression <- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      <- [*/]						;
    Factor     <- Term (AddOp Term)*				;
    AddOp      <- [-+]						;
    Term       <- Number					;
END;

.CE
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, conversion, expression, format conversion, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_import.n.


























































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_import.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::import" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::import \- PEG Import
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBsnit \fR
.sp
package require \fBconfiguration \fR
.sp
package require \fBpt::peg \fR
.sp
package require \fBpluginmgr \fR
.sp
package require \fBpt::peg::import  ?1?\fR
.sp
\fB::pt::peg::import\fR \fIobjectName\fR
.sp
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBimport text\fR \fItext\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport file\fR \fIpath\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport object text\fR \fIobject\fR \fItext\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBimport object file\fR \fIobject\fR \fIpath\fR ?\fIformat\fR?
.sp
\fIobjectName\fR \fBincludes\fR
.sp
\fIobjectName\fR \fBinclude add\fR \fIpath\fR
.sp
\fIobjectName\fR \fBinclude remove\fR \fIpath\fR
.sp
\fIobjectName\fR \fBinclude clear\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides a manager for parsing expression grammars, with
each instance handling a set of plugins for the import of them from
other formats, i.e. their conversion from, for example \fIpeg\fR,
\fIcontainer\fR, \fIjson\fR, etc.
.PP
It resides in the Import section of the Core Layer of Parser Tools,
and is one of the three pillars the management of parsing expression
grammars resides on.
.PP
IMAGE: arch_core_import
.PP
The other two pillars are, as shown above
.IP [1]
\fIPEG Export\fR, and
.IP [2]
\fIPEG Storage\fR
.PP
.PP
For information about the data structure which is the major output of
the manager objects provided by this package see the section
\fBPEG serialization format\fR.
.PP
The plugin system of our class is based on the package
\fBpluginmgr\fR, and configured to look for plugins using
.IP [1]
the environment variable \fBGRAMMAR_PEG_IMPORT_PLUGINS\fR,
.IP [2]
the environment variable \fBGRAMMAR_PEG_PLUGINS\fR,
.IP [3]
the environment variable \fBGRAMMAR_PLUGINS\fR,
.IP [4]
the path "\fI~/.grammar/peg/import/plugin\fR"
.IP [5]
the path "\fI~/.grammar/peg/plugin\fR"
.IP [6]
the path "\fI~/.grammar/plugin\fR"
.IP [7]
the path "\fI~/.grammar/peg/import/plugins\fR"
.IP [8]
the path "\fI~/.grammar/peg/plugins\fR"
.IP [9]
the path "\fI~/.grammar/plugins\fR"
.IP [10]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\GRAMMAR\\PEG\\IMPORT\\PLUGINS"
.IP [11]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\GRAMMAR\\PEG\\PLUGINS"
.IP [12]
the registry entry "HKEY_CURRENT_USER\\SOFTWARE\\GRAMMAR\\PLUGINS"
.PP
The last three are used only when the package is run on a machine
using the Windows(tm) operating system.
.PP
The whole system is delivered with three predefined import plugins,
namely
.TP
container
See \fIPEG Import Plugin. From CONTAINER format\fR for details.
.TP
json
See \fIPEG Import Plugin. From JSON format\fR for details.
.TP
peg
See \fIPEG Import Plugin. From PEG format\fR for details.
.PP
.PP
For readers wishing to write their own import plugin for some format,
i.e. \fIplugin writer\fRs, reading and understanding the
\fIParser Tools Impport API\fR specification is an absolute
necessity, as it documents the interaction between this package and
its plugins in detail.
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fB::pt::peg::import\fR \fIobjectName\fR
This command creates a new import manager object with an associated
Tcl command whose name is \fIobjectName\fR. This \fIobject\fR command
is explained in full detail in the sections \fBObject command\fR
and \fBObject methods\fR. The object command will be created
under the current namespace if the \fIobjectName\fR is not fully
qualified, and in the specified namespace otherwise.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::pt::peg::import\fR command have
the following general form:
.TP
\fBobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object it is invoked for.
.TP
\fIobjectName\fR \fBimport text\fR \fItext\fR ?\fIformat\fR?
This method takes the \fItext\fR and converts it from the specified
\fIformat\fR to the canonical serialization of a parsing expression
grammar using the import plugin for the format. An error is thrown if
no plugin could be found for the format.
The serialization generated by the conversion process is returned as
the result of this method.
.sp
If no format is specified the method defaults to \fBtext\fR.
.sp
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBPEG serialization format\fR.
.sp
The plugin has to conform to the interface documented in the
\fIParser Tools Import API\fR specification.
.TP
\fIobjectName\fR \fBimport file\fR \fIpath\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBimport text\fR
method described by the previous item.
It reads the contents of the specified file into memory, feeds the
result into \fBimport text\fR and returns the resulting
serialization as its own result.
.TP
\fIobjectName\fR \fBimport object text\fR \fIobject\fR \fItext\fR ?\fIformat\fR?
This method is a convenient wrapper around the \fBimport text\fR
method described by the previous item.
It expects that \fIobject\fR is an object command supporting a
\fBdeserialize\fR method expecting the canonical serialization of a
parsing expression grammar.
It imports the text using \fBimport text\fR and then feeds the
resulting serialization into the \fIobject\fR via \fBdeserialize\fR.
This method returns the empty string as it result.
.TP
\fIobjectName\fR \fBimport object file\fR \fIobject\fR \fIpath\fR ?\fIformat\fR?
This method behaves like \fBimport object text\fR, except that it
reads the text to convert from the specified file instead of being
given it as argument.
.TP
\fIobjectName\fR \fBincludes\fR
This method returns a list containing the currently specified paths to
use to search for include files when processing input.
The order of paths in the list corresponds to the order in which they
are used, from first to last, and also corresponds to the order in
which they were added to the object.
.TP
\fIobjectName\fR \fBinclude add\fR \fIpath\fR
This methods adds the specified \fIpath\fR to the list of paths to use
to search for include files when processing input. The path is added
to the end of the list, causing it to be searched after all previously
added paths. The result of the command is the empty string.
.sp
The method does nothing if the path is already known.
.TP
\fIobjectName\fR \fBinclude remove\fR \fIpath\fR
This methods removes the specified \fIpath\fR from the list of paths
to use to search for include files when processing input. The result
of the command is the empty string.
.sp
The method does nothing if the path is not known.
.TP
\fIobjectName\fR \fBinclude clear\fR
This method clears the list of paths to use to search for include
files when processing input. The result of the command is the empty
string.
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_import_container.n.
























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_import_container.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::import::container" n 0 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::import::container \- PEG Import Plugin. From CONTAINER format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package does not exist.
There is no need for it.
The CONTAINER format for parsing expression grammars is a piece of Tcl
code which, then sourced, provides a class whose instances have the
grammar we wish to import loaded.
Another way of looking at this is, the CONTAINER output is its own
import package.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_import_json.n.








































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_import_json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::import::json" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::import::json \- PEG Import Plugin. Read JSON format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::import::json  ?1?\fR
.sp
package require \fBpt::peg::to::json \fR
.sp
\fBimport\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the parsing expression grammar import plugin
processing JSON markup.
.PP
It resides in the Import section of the Core Layer of Parser Tools and
is intended to be used by \fBpt::peg::import\fR, the import
manager, sitting between it and the corresponding core conversion
functionality provided by \fBpt::peg::from::json\fR.
.PP
IMAGE: arch_core_iplugins
.PP
.PP
While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:
.IP [1]
In an untrusted environment the proper access is through the package
\fBpt::peg::import\fR and the import manager objects it
provides.
.IP [2]
In a trusted environment however simply use the package
\fBpt::peg::from::json\fR and access the core
conversion functionality directly.
.PP
.SH API
The API provided by this package satisfies the specification of the
Plugin API found in the \fIParser Tools Import API\fR
specification.
.TP
\fBimport\fR \fItext\fR
This command takes the JSON markup encoding a parsing
expression grammar and contained in \fItext\fR, and generates the
canonical serialization of said grammar, as specified in section
\fBPEG serialization format\fR.
The created value is then returned as the result of the command.
.PP
.SH "JSON GRAMMAR EXCHANGE FORMAT"
The \fBjson\fR format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.
.PP
It is formally specified by the rules below:
.IP [1]
The JSON of any PEG is a JSON object.
.IP [2]
This object holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section \fBPE serialization format\fR.
.TP
\fBmode\fR
The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
\fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.PP
.PP
As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
\fBPEG serialization format\fR, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
a JSON serialization for it is
.PP
.CS


{
    "pt::grammar::peg" : {
        "rules" : {
            "AddOp"     : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Digit"     : {
                "is"   : "\\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}",
                "mode" : "value"
            },
            "Expression" : {
                "is"   : "\\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}",
                "mode" : "value"
            },
            "Factor"    : {
                "is"   : "x {n Term} {* {x {n AddOp} {n Term}}}",
                "mode" : "value"
            },
            "MulOp"     : {
                "is"   : "\\/ {t *} {t \\/}",
                "mode" : "value"
            },
            "Number"    : {
                "is"   : "x {? {n Sign}} {+ {n Digit}}",
                "mode" : "value"
            },
            "Sign"      : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Term"      : {
                "is"   : "n Number",
                "mode" : "value"
            }
        },
        "start" : "n Expression"
    }
}

.CE
.PP
and a Tcl serialization of the same is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
The similarity of the latter to the JSON should be quite obvious.
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, JSON, LL(k), PEG, TDPL, context-free languages, expression, grammar, import, matching, parser, parsing expression, parsing expression grammar, plugin, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_import_peg.n.





















































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_import_peg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::import::peg" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::import::peg \- PEG Import Plugin. Read PEG format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::import::peg  ?1?\fR
.sp
package require \fBpt::peg::to::peg \fR
.sp
\fBimport\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the parsing expression grammar import plugin
processing PEG markup.
.PP
It resides in the Import section of the Core Layer of Parser Tools and
is intended to be used by \fBpt::peg::import\fR, the import
manager, sitting between it and the corresponding core conversion
functionality provided by \fBpt::peg::from::peg\fR.
.PP
IMAGE: arch_core_iplugins
.PP
.PP
While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:
.IP [1]
In an untrusted environment the proper access is through the package
\fBpt::peg::import\fR and the import manager objects it
provides.
.IP [2]
In a trusted environment however simply use the package
\fBpt::peg::from::peg\fR and access the core
conversion functionality directly.
.PP
.SH API
The API provided by this package satisfies the specification of the
Plugin API found in the \fIParser Tools Import API\fR
specification.
.TP
\fBimport\fR \fItext\fR
This command takes the PEG markup encoding a parsing
expression grammar and contained in \fItext\fR, and generates the
canonical serialization of said grammar, as specified in section
\fBPEG serialization format\fR.
The created value is then returned as the result of the command.
.PP
.SH "PEG SPECIFICATION LANGUAGE"
\fBpeg\fR, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.
.PP
It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the \fIPEG Language Tutorial\fR.
.PP
.CS


PEG pe-grammar-for-peg (Grammar)

	# --------------------------------------------------------------------
        # Syntactical constructs

        Grammar         <- WHITESPACE Header Definition* Final EOF ;

        Header          <- PEG Identifier StartExpr ;
        Definition      <- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       <- (VOID / LEAF) COLON ;
        Expression      <- Sequence (SLASH Sequence)* ;
        Sequence        <- Prefix+ ;
        Prefix          <- (AND / NOT)? Suffix ;
        Suffix          <- Primary (QUESTION / STAR / PLUS)? ;
        Primary         <- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         <- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           <- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           <- Char TO Char / Char ;

        StartExpr       <- OPEN Expression CLOSE ;
void:   Final           <- END SEMICOLON WHITESPACE ;

        # --------------------------------------------------------------------
        # Lexing constructs

        Identifier      <- Ident WHITESPACE ;
leaf:   Ident           <- ('_' / ':' / <alpha>) ('_' / ':' / <alnum>)* ;
        Char            <- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;

leaf:   CharSpecial     <- "\\\\" [nrt'"\\[\\]\\\\] ;
leaf:   CharOctalFull   <- "\\\\" [0-2][0-7][0-7] ;
leaf:   CharOctalPart   <- "\\\\" [0-7][0-7]? ;
leaf:   CharUnicode     <- "\\\\" 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   <- !"\\\\" . ;

void:   HexDigit        <- [0-9a-fA-F] ;

void:   TO              <- '-'           ;
void:   OPENB           <- "["           ;
void:   CLOSEB          <- "]"           ;
void:   APOSTROPH       <- "'"           ;
void:   DAPOSTROPH      <- '"'           ;
void:   PEG             <- "PEG"   WHITESPACE ;
void:   IS              <- "<-"    WHITESPACE ;
leaf:   VOID            <- "void"  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            <- "leaf"  WHITESPACE ; # Implies that definition has no terminals.
void:   END             <- "END"   WHITESPACE ;
void:   SEMICOLON       <- ";"     WHITESPACE ;
void:   COLON           <- ":"     WHITESPACE ;
void:   SLASH           <- "/"     WHITESPACE ;
leaf:   AND             <- "&"     WHITESPACE ;
leaf:   NOT             <- "!"     WHITESPACE ;
leaf:   QUESTION        <- "?"     WHITESPACE ;
leaf:   STAR            <- "*"     WHITESPACE ;
leaf:   PLUS            <- "+"     WHITESPACE ;
void:   OPEN            <- "("     WHITESPACE ;
void:   CLOSE           <- ")"     WHITESPACE ;
leaf:   DOT             <- "."     WHITESPACE ;

leaf:   ALNUM           <- "<alnum>"    WHITESPACE ;
leaf:   ALPHA           <- "<alpha>"    WHITESPACE ;
leaf:   ASCII           <- "<ascii>"    WHITESPACE ;
leaf:   CONTROL         <- "<control>"  WHITESPACE ;
leaf:   DDIGIT          <- "<ddigit>"   WHITESPACE ;
leaf:   DIGIT           <- "<digit>"    WHITESPACE ;
leaf:   GRAPH           <- "<graph>"    WHITESPACE ;
leaf:   LOWER           <- "<lower>"    WHITESPACE ;
leaf:   PRINTABLE       <- "<print>"    WHITESPACE ;
leaf:   PUNCT           <- "<punct>"    WHITESPACE ;
leaf:   SPACE           <- "<space>"    WHITESPACE ;
leaf:   UPPER           <- "<upper>"    WHITESPACE ;
leaf:   WORDCHAR        <- "<wordchar>" WHITESPACE ;
leaf:   XDIGIT          <- "<xdigit>"   WHITESPACE ;

void:   WHITESPACE      <- (" " / "\\t" / EOL / COMMENT)* ;
void:   COMMENT         <- '#' (!EOL .)* EOL ;
void:   EOL             <- "\\n\\r" / "\\n" / "\\r" ;
void:   EOF             <- !. ;

        # --------------------------------------------------------------------
END;

.CE
.SS EXAMPLE
Our example specifies the grammar for a basic 4-operation calculator.
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as
.PP
.CS


PEG calculator (Expression)
    Sign       <- [-+] 						;
    Number     <- Sign? <ddigit>+				;
    Expression <- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      <- [*/]						;
    Factor     <- Term (AddOp Term)*				;
    AddOp      <- [-+]						;
    Term       <- Number					;
END;

.CE
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, import, matching, parser, parsing expression, parsing expression grammar, plugin, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_interp.n.








































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_interp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::interp" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::interp \- Interpreter for parsing expression grammars
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::interp  ?1?\fR
.sp
package require \fBpt::rde  ?1?\fR
.sp
package require \fBsnit \fR
.sp
\fB::pt::peg::interpreter\fR \fIobjectName\fR \fIgrammar\fR
.sp
\fIobjectName\fR \fBuse\fR \fIgrammar\fR
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBparse\fR \fIchan\fR
.sp
\fIobjectName\fR \fBparset\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides a class whose instances are Packrat parsers
configurable with a parsing expression grammar. The grammar is
executed directly, i.e. interpreted, with the underlying runtime
provided by the package \fBpt::rde\fR, basing everything on the
PARAM.
.PP
Like the supporting runtime this package resides in the Execution
section of the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_transform
.PP
.PP
The interpreted grammar is copied from an instance of \fBpt::peg::container\fR, or anything providing the same API, like the
container classes created by \fBpt::peg::to::container\fR or the
associated export plugin \fBpt::peg::export::container\fR.
.SS "CLASS API"
The package exports the API described here.
.TP
\fB::pt::peg::interpreter\fR \fIobjectName\fR \fIgrammar\fR
The command creates a new parser object and returns the fully
qualified name of the object command as its result. The API of this
object command is described in the section \fBObject API\fR. It
may be used to invoke various operations on the object.
.sp
This new parser is configured for the execution of an empty PEG. To
configure the object for any other PEG use the method \fBuse\fR of
the \fBObject API\fR.
.PP
.SS "OBJECT API"
All objects created by this package provide the following methods.
.TP
\fIobjectName\fR \fBuse\fR \fIgrammar\fR
This method configures the grammar interpreter / parser for the
execution of the PEG stored in \fIgrammar\fR, an object which is
API-compatible to instances of \fBpt::peg::container\fR. The
parser copies the relevant information of the grammar, and does
\fInot\fR take ownership of the object.
.sp
The information of any previously used grammar is overwritten.
.sp
The result of the method the empty string.
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the parser instance, releasing all claimed memory
and other resources, and deleting the instance command.
.sp
The result of the command is the empty string.
.TP
\fIobjectName\fR \fBparse\fR \fIchan\fR
This method runs the parser using the contents of \fIchan\fR as input
(starting at the current location in the channel), until parsing is
not possible anymore, either because parsing has completed, or run
into a syntax error.
.sp
Note here that the Parser Tools are based on Tcl 8.5+. In other words,
the channel argument is not restricted to files, sockets, etc. We have
the full power of \fIreflected channels\fR available.
.sp
It should also be noted that the parser pulls the characters from the
input stream as it needs them. If a parser created by this package has
to be operated in a push aka event-driven manner it will be necessary
to go to Tcl 8.6+ and use the \fBcoroutine::auto\fR to wrap it
into a coroutine where \fBread\fR is properly changed for
push-operation.
.sp
Upon successful completion the command returns an abstract syntax tree
as its result.
This AST is in the form specified in section
\fBAST serialization format\fR.
As a plain nested Tcl-list it can then be processed with any Tcl
commands the user likes, doing transformations, semantic checks, etc.
To help in this the package \fBpt::ast\fR provides a set of
convenience commands for validation of the tree's basic structure,
printing it for debugging, and walking it either from the bottom up,
or top down.
.sp
When encountering a syntax error the command will throw an error instead.
This error will be a 4-element Tcl-list, containing, in the order
listed below:
.RS
.IP [1]
The string \fBpt::rde\fR identifying it as parser runtime error.
.IP [2]
The location of the parse error, as character offset from the
beginning of the parsed input.
.IP [3]
The location of parse error, now as a 2-element list containing
line-number and column in the line.
.IP [4]
A set of atomic parsing expressions indicating encoding the characters
and/or nonterminal symbols the parser expected to see at the location
of the parse error, but did not get.
For the specification of atomic parsing expressions please see the
section \fBPE serialization format\fR.
.RE
.TP
\fIobjectName\fR \fBparset\fR \fItext\fR
This method runs the parser using the string in \fItext\fR as input.
In all other ways it behaves like the method \fBparse\fR, shown
above.
.PP
.SH "AST SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Abstract Syntax Trees (ASTs) as immutable values for transport,
comparison, etc.
.PP
Each node in an AST represents a nonterminal symbol of a grammar, and
the range of tokens/characters in the input covered by it. ASTs do not
contain terminal symbols, i.e. tokens/characters. These can be
recovered from the input given a symbol's location.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a tree may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.IP [1]
The serialization of any AST is the serialization of its root node.
.IP [2]
The serialization of any node is a Tcl list containing at least three
elements.
.RS
.IP [1]
The first element is the name of the nonterminal symbol stored in the
node.
.IP [2]
The second and third element are the locations of the first and last
token in the token stream the node represents (covers).
.RS
.IP [1]
Locations are provided as non-negative integer offsets from the
beginning of the token stream, with the first token found in the
stream located at offset 0 (zero).
.IP [2]
The end location has to be equal to or larger than the start location.
.RE
.IP [3]
All elements after the first three represent the children of the node,
which are themselves nodes. This means that the serializations of
nodes without children, i.e. leaf nodes, have exactly three elements.
The children are stored in the list with the leftmost child first, and
the rightmost child last.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of an abstract syntax tree has the format
as specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this tree.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression grammar below
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
and the input string
.CS

 120+5
.CE
then a parser should deliver the abstract syntax tree below (except for whitespace)
.PP
.CS


set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}

.CE
.PP
Or, more graphical
.PP
.PS
.nf
                                                           +- Digit 0 0 | 1
                                                           |            |
                               +- Term 0 2 --- Number 0 2 -+- Digit 1 1 | 2
                               |                           |            |
                               |                           +- Digit 2 2 | 0
                               |                                        |
Expression 0 4 --- Factor 0 4 -+----------------------------- AddOp 3 3 | +
                               |                                        |
                               +- Term 4 4 --- Number 4 4 --- Digit 4 4 | 5
.fi
.PE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_introduction.n.


























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_introduction.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::pegrammar" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::pegrammar \- Introduction to Parsing Expression Grammars
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
Welcome to the introduction to \fIParsing Expression Grammar\fRs
(short: \fIPEG\fR), the formalism used by the Parser Tools.
It is assumed that the reader has a basic knowledge of parsing theory,
i.e. \fIContext-Free Grammars\fR (short: \fICFG\fR),
\fIlanguages\fR, and associated terms like \fILL(k)\fR,
\fILR(k)\fR, \fIterminal\fR and \fInonterminal\fR \fIsymbols\fR,
etc.
We do not intend to recapitulate such basic definitions or terms like
\fIuseful\fR, \fIreachable\fR, (left/right) \fIrecursive\fR,
\fInullable\fR, first/last/follow sets, etc.
Please see the \fBReferences\fR at the end instead if you are in
need of places and books which provide such background information.
.PP
PEGs are formally very similar to CFGs, with terminal and nonterminal
symbols, start symbol, and rules defining the structure of each
nonterminal symbol.
The main difference lies in the choice(sic!) of \fIchoice\fR
operators. Where CFGs use an \fIunordered choice\fR to represent
alternatives PEGs use \fIprioritized choice\fR. Which is fancy way
of saying that a parser has to try the first alternative first and can
try the other alternatives if only if it fails for the first, and so
on.
.PP
On the CFG side this gives rise to LL(k) and LR(k) for making the
choice \fIdeterministic\fR with a bounded \fIlookahead\fR of k
terminal symbols, where LL is in essence \fItopdown\fR aka
\fIrecursive descent\fR parsing, and LR \fIbottomup\fR aka
\fIshift reduce\fR parsing.
.PP
On the PEG side we can parse input with recursive descent and
\fIbacktracking\fR of failed choices, the latter of which amounts to
unlimited lookahead.
By additionally recording the success or failure of nonterminals at
the specific locations they were tried at and reusing this information
after backtracking we can avoid the exponential blowup of running time
usually associated with backtracking and keep the parsing linear. The
memory requirements are of course higher due to this cache, as we are
trading space for time.
.PP
This is the basic concept behind \fIpackrat parsers\fR.
.PP
A limitation pure PEGs share with LL(k) CFGs is that
\fIleft-recursive\fR grammars cannot be parsed, with the associated
recursive descent parser entering an infinite recursion.
This limitation is usually overcome by extending pure PEGs with
explicit operators to specify repetition, zero or more, and one or
more, or, formally spoken, for the \fIkleene closure\fR and
\fIpositive kleene closure\fR.
This is what the Parser Tools are doing.
.PP
Another extension, specific to Parser Tools, is a set of operators
which map more or less directly to various character classes built
into Tcl, i.e. the classes reachable via \fBstring is\fR.
.PP
The remainder of this document consists of the formal definition of
PEGs for the mathematically inclined, and an appendix listing
references to places with more information on PEGs specifically, and
parsing in general.
.SH "FORMAL DEFINITION"
.PP
For the mathematically inclined, a Parsing Expression Grammar is a
4-tuple (VN,VT,R,eS) where
.IP \(bu
VN is a set of \fInonterminal symbols\fR,
.IP \(bu
VT is a set of \fIterminal symbols\fR,
.IP \(bu
R is a finite set of rules, where each rule is a pair (A,e), A in VN,
and \fIe\fR a \fIparsing expression\fR.
.IP \(bu
eS is a parsing expression, the \fIstart expression\fR.
.PP
.PP
Further constraints are
.IP \(bu
The intersection of VN and VT is empty.
.IP \(bu
For all A in VT exists exactly one pair (A,e) in R. In other words, R
is a function from nonterminal symbols to parsing expressions.
.PP
.PP
Parsing expressions are inductively defined via
.IP \(bu
The empty string (epsilon) is a parsing expression.
.IP \(bu
A terminal symbol \fIa\fR is a parsing expression.
.IP \(bu
A nonterminal symbol \fIA\fR is a parsing expression.
.IP \(bu
\fIe1\fR\fIe2\fR is a parsing expression for parsing expressions
\fIe1\fR and \fI2\fR. This is called \fIsequence\fR.
.IP \(bu
\fIe1\fR/\fIe2\fR is a parsing expression for parsing expressions
\fIe1\fR and \fI2\fR. This is called \fIordered choice\fR.
.IP \(bu
\fIe\fR* is a parsing expression for parsing expression
\fIe\fR. This is called \fIzero-or-more repetitions\fR, also known
as \fIkleene closure\fR.
.IP \(bu
\fIe\fR+ is a parsing expression for parsing expression
\fIe\fR. This is called \fIone-or-more repetitions\fR, also known
as \fIpositive kleene closure\fR.
.IP \(bu
!\fIe\fR is a parsing expression for parsing expression
\fIe1\fR. This is called a \fInot lookahead predicate\fR.
.IP \(bu
&\fIe\fR is a parsing expression for parsing expression
\fIe1\fR. This is called an \fIand lookahead predicate\fR.
.PP
.PP
.PP
PEGs are used to define a grammatical structure for streams of symbols
over VT. They are a modern phrasing of older formalisms invented by
Alexander Birham. These formalisms were called TS (TMG recognition
scheme), and gTS (generalized TS). Later they were renamed to TPDL
(Top-Down Parsing Languages) and gTPDL (generalized TPDL).
.PP
They can be easily implemented by recursive descent parsers with
backtracking. This makes them relatives of LL(k) Context-Free
Grammars.
.SH REFERENCES
.IP [1]
\fIThe Packrat Parsing and Parsing Expression Grammars Page\fR [http://www.pdos.lcs.mit.edu/~baford/packrat/],
by Bryan Ford, Massachusetts Institute of Technology. This is the main
entry page to PEGs, and their realization through Packrat Parsers.
.IP [2]
\fIhttp://en.wikipedia.org/wiki/Parsing_expression_grammar\fR
Wikipedia's entry about Parsing Expression Grammars.
.IP [3]
\fIParsing Techniques - A Practical Guide \fR [http://www.cs.vu.nl/~dick/PTAPG.html], an online book
offering a clear, accessible, and thorough discussion of many
different parsing techniques with their interrelations and
applicabilities, including error recovery techniques.
.IP [4]
\fICompilers and Compiler Generators\fR [http://scifac.ru.ac.za/compilers/], an online book using
CoCo/R, a generator for recursive descent parsers.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_language.n.





















































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_language.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg_language" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg_language \- PEG Language Tutorial
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
Welcome to the tutorial / introduction for the
\fBPEG Specification Language\fR.
If you are already familiar with the language we are about to discuss,
and only wish to refresh your memory you can, of course, skip ahead to
the aforementioned section and just read the full formal specification.
.SH "WHAT IS IT?"
\fBpeg\fR, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.
.SH "THE ELEMENTS OF THE LANGUAGE"
.SS "BASIC STRUCTURE"
The general outline of a textual PEG is
.CS


PEG <<name>> (<<start-expression>>)
   <<rules>>
END;

.CE
\fINote\fR: We are using text in double angle-brackets as
place-holders for things not yet explained.
.SS NAMES
Names are mostly used to identify the nonterminal symbols of the
grammar, i.e. that which occurs on the left-hand side of a <rule>.
The exception to that is the name given after the keyword \fBPEG\fR
(see previous section), which is the name of the whole grammar itself.
.PP
The structure of a name is simple:
.IP [1]
It begins with a letter, underscore, or colon, followed by
.IP [2]
zero or more letters, digits, underscores, or colons.
.PP
Or, in formal textual notation:
.CS


    ([_:] / <alpha>) ([_:] / <alnum>)*

.CE
Examples of names:
.CS


    Hello
    ::world
    _:submarine55_

.CE
Examples of text which are \fInot\fR names:
.CS


    12
    .bogus
    0wrong
    @location

.CE
.SS RULES
The main body of the text of a grammar specification is taken up by
the rules. Each rule defines the sentence structure of one nonterminal
symbol. Their basic structure is
.CS


     <<name>>  <-  <<expression>> ;

.CE
The <name> specifies the nonterminal symbol to be defined, the
<expression> after the arrow (<-) then declares its structure.
.PP
Note that each rule ends in a single semicolon, even the last.
I.e. the semicolon is a rule \fIterminator\fR, not a separator.
.PP
We can have as many rules as we like, as long as we define each
nonterminal symbol at most once, and have at least one rule for each
nonterminal symbol which occured in an expression, i.e. in either the
start expression of the grammar, or the right-hande side of a rule.
.SS EXPRESSIONS
The \fIparsing\fR expressions are the meat of any specification. They
declare the structure of the whole document (<<start-expression>>),
and of all nonterminal symbols.
.PP
All expressions are made up out of \fIatomic expressions\fR and
\fIoperators\fR combining them. We have operators for choosing
between alternatives, repetition of parts, and for look-ahead
constraints. There is no explicit operator for the sequencing (also
known as \fIconcatenation\fR) of parts however. This is specified by
simply placing the parts adjacent to each other.
.PP
Here are the operators, from highest to lowest priority (i.e. strength
of binding):
.CS


    # Binary operators.

    <<expression-1>>     <<expression-2>>  # sequence. parse 1, then 2.
    <<expression-1>>  /  <<expression-2>>  # alternative. try to parse 1, and parse 2 if 1 failed to parse.

    # Prefix operators. Lookahead constraints. Same priority.

    & <<expression>>  # Parse expression, ok on successful parse.
    ! <<expression>>  # Ditto, except ok on failure to parse.

    # Suffix operators. Repetition. Same priority.

    <<expression>> ?  # Parse expression none, or once (repeat 0 or 1).
    <<expression>> *  # Parse expression zero or more times.
    <<expression>> +  # Parse expression one or more times.

    # Expression nesting

    ( <<expression>> ) # Put an expression in parens to change its priority.

.CE
With this we can now deconstruct the formal expression for names given
in section \fBNames\fR:
.CS


    ([_:] / <alpha>) ([_:] / <alnum>)*

.CE
It is a sequence of two parts,
.CS

    [_:] / <alpha>
.CE
and
.CS

    ([_:] / <alnum>)*
.CE
The parentheses around the parts kept their inner alternatives bound
together against the normally higher priority of the sequence. Each of
the two parts is an alternative, with the second part additionally
repeated zero or more times, leaving us with the three atomic
expressions
.CS


    [_:]
    <alpha>
    <alnum>

.CE
And \fIatomic expressions\fR are our next topic. They
fall into three classes:
.IP [1]
names, i.e. nonterminal symbols,
.IP [2]
string literals, and
.IP [3]
character classes.
.PP
Names we know about already, or see section \fBNames\fR for a
refresher.
.PP
String literals are simple. They are delimited by (i.e. start and end
with) either a single or double-apostroph, and in between the
delimiters we can have any character but the delimiter itself. They
can be empty as well. Examples of strings are
.CS


    ''
    ""
    'hello'
    "umbra"
    "'"
    '"'

.CE
The last two examples show how to place any of the delimiters into a
string.
.PP
For the last, but not least of our atomic expressions, character
classes, we have a number of predefined classes, shown below, and the
ability to construct or own. The predefined classes are:
.CS


    <alnum>    # Any unicode alphabet or digit character (string is alnum).
    <alpha>    # Any unicode alphabet character (string is alpha).
    <ascii>    # Any unicode character below codepoint 0x80 (string is ascii).
    <control>  # Any unicode control character (string is control).
    <ddigit>   # The digit characters [0-9].
    <digit>    # Any unicode digit character (string is digit).
    <graph>    # Any unicode printing character, except space (string is graph).
    <lower>    # Any unicode lower-case alphabet character (string is lower).
    <print>    # Any unicode printing character, incl. space (string is print).
    <punct>    # Any unicode punctuation character (string is punct).
    <space>    # Any unicode space character (string is space).
    <upper>    # Any unicode upper-case alphabet character (string is upper).
    <wordchar> # Any unicode word character (string is wordchar).
    <xdigit>   # The hexadecimal digit characters [0-9a-fA-F].
    .          # Any character, except end of input.

.CE
And the syntax of custom-defined character classes is
.CS


    [ <<range>>* ]

.CE
where each range is either a single character, or of the form
.CS


   <<character>> - <character>>

.CE
Examples for character classes we have seen already in the course of
this introduction are
.CS


    [_:]
    [0-9]
    [0-9a-fA-F]

.CE
We are nearly done with expressions. The only piece left is to tell
how the characters in character classes and string literals are
specified.
.PP
Basically characters in the input stand for themselves, and in
addition to that we several types of escape syntax to to repesent
control characters, or characters outside of the encoding the text is
in.
.PP
All the escaped forms are started with a backslash character ('\\',
unicode codepoint 0x5C). This is then followed by a series of octal
digits, or 'u' and hexedecimal digits, or a regular character from a
fixed set for various control characters. Some examples:
.CS


    \\n \\r \\t \\' \\" \\[ \\] \\\\ #
    \\000 up to \\277         # octal escape, all ascii character, leading 0's can be removed.
    \\u2CA7                  # hexadecimal escape, all unicode characters.
    #                       # Here 2ca7 <=> Koptic Small Letter Tau

.CE
.SS "WHITESPACE AND COMMENTS"
One issue not touched upon so far is whitespace and comments.
.PP
Whitespace is any unicode space character, i.e. anything in the
character class <space>, and comments. The latter are sequences of
characters starting with a '#' (hash, unicode codepoint 0x23) and
ending at the next end-of-line.
.PP
Whitespace can be freely used between all syntactical elements of a
grammar specification. It cannot be used inside of syntactical
elements, like names, string literals, predefined character classes,
etc.
.SS "NONTERMINAL ATTRIBUTES"
Lastly, a more advanced topic. In the section \fBRules\fR we gave
the structure of a rule as
.CS


     <<name>>  <-  <<expression>> ;

.CE
This is not quite true. It is possible to associate a semantic mode
with the nonterminal in the rule, by writing it before the name,
separated from it by a colon, i.e. writing
.CS


    <<mode>> : <<name>>  <-  <<expression>> ;

.CE
is also allowed. This mode is optional. The known modes and their
meanings are:
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.PP
Of these three modes only \fBleaf\fR and \fBvoid\fR can be
specified directly. \fBvalue\fR is implicitly specified by the
absence of a mode before the nonterminal.
.PP
Now, with all the above under our belt it should be possible to not
only read, but understand the formal specification of the text
representation shown in the next section, written in itself.
.SH "PEG SPECIFICATION LANGUAGE"
\fBpeg\fR, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.
.PP
It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the \fIPEG Language Tutorial\fR.
.PP
.CS


PEG pe-grammar-for-peg (Grammar)

	# --------------------------------------------------------------------
        # Syntactical constructs

        Grammar         <- WHITESPACE Header Definition* Final EOF ;

        Header          <- PEG Identifier StartExpr ;
        Definition      <- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       <- (VOID / LEAF) COLON ;
        Expression      <- Sequence (SLASH Sequence)* ;
        Sequence        <- Prefix+ ;
        Prefix          <- (AND / NOT)? Suffix ;
        Suffix          <- Primary (QUESTION / STAR / PLUS)? ;
        Primary         <- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         <- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           <- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           <- Char TO Char / Char ;

        StartExpr       <- OPEN Expression CLOSE ;
void:   Final           <- END SEMICOLON WHITESPACE ;

        # --------------------------------------------------------------------
        # Lexing constructs

        Identifier      <- Ident WHITESPACE ;
leaf:   Ident           <- ('_' / ':' / <alpha>) ('_' / ':' / <alnum>)* ;
        Char            <- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;

leaf:   CharSpecial     <- "\\\\" [nrt'"\\[\\]\\\\] ;
leaf:   CharOctalFull   <- "\\\\" [0-2][0-7][0-7] ;
leaf:   CharOctalPart   <- "\\\\" [0-7][0-7]? ;
leaf:   CharUnicode     <- "\\\\" 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   <- !"\\\\" . ;

void:   HexDigit        <- [0-9a-fA-F] ;

void:   TO              <- '-'           ;
void:   OPENB           <- "["           ;
void:   CLOSEB          <- "]"           ;
void:   APOSTROPH       <- "'"           ;
void:   DAPOSTROPH      <- '"'           ;
void:   PEG             <- "PEG"   WHITESPACE ;
void:   IS              <- "<-"    WHITESPACE ;
leaf:   VOID            <- "void"  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            <- "leaf"  WHITESPACE ; # Implies that definition has no terminals.
void:   END             <- "END"   WHITESPACE ;
void:   SEMICOLON       <- ";"     WHITESPACE ;
void:   COLON           <- ":"     WHITESPACE ;
void:   SLASH           <- "/"     WHITESPACE ;
leaf:   AND             <- "&"     WHITESPACE ;
leaf:   NOT             <- "!"     WHITESPACE ;
leaf:   QUESTION        <- "?"     WHITESPACE ;
leaf:   STAR            <- "*"     WHITESPACE ;
leaf:   PLUS            <- "+"     WHITESPACE ;
void:   OPEN            <- "("     WHITESPACE ;
void:   CLOSE           <- ")"     WHITESPACE ;
leaf:   DOT             <- "."     WHITESPACE ;

leaf:   ALNUM           <- "<alnum>"    WHITESPACE ;
leaf:   ALPHA           <- "<alpha>"    WHITESPACE ;
leaf:   ASCII           <- "<ascii>"    WHITESPACE ;
leaf:   CONTROL         <- "<control>"  WHITESPACE ;
leaf:   DDIGIT          <- "<ddigit>"   WHITESPACE ;
leaf:   DIGIT           <- "<digit>"    WHITESPACE ;
leaf:   GRAPH           <- "<graph>"    WHITESPACE ;
leaf:   LOWER           <- "<lower>"    WHITESPACE ;
leaf:   PRINTABLE       <- "<print>"    WHITESPACE ;
leaf:   PUNCT           <- "<punct>"    WHITESPACE ;
leaf:   SPACE           <- "<space>"    WHITESPACE ;
leaf:   UPPER           <- "<upper>"    WHITESPACE ;
leaf:   WORDCHAR        <- "<wordchar>" WHITESPACE ;
leaf:   XDIGIT          <- "<xdigit>"   WHITESPACE ;

void:   WHITESPACE      <- (" " / "\\t" / EOL / COMMENT)* ;
void:   COMMENT         <- '#' (!EOL .)* EOL ;
void:   EOL             <- "\\n\\r" / "\\n" / "\\r" ;
void:   EOF             <- !. ;

        # --------------------------------------------------------------------
END;

.CE
.SS EXAMPLE
Our example specifies the grammar for a basic 4-operation calculator.
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as
.PP
.CS


PEG calculator (Expression)
    Sign       <- [-+] 						;
    Number     <- Sign? <ddigit>+				;
    Expression <- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      <- [*/]						;
    Factor     <- Term (AddOp Term)*				;
    AddOp      <- [-+]						;
    Term       <- Number					;
END;

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_to_container.n.





























































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_to_container.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::to::container" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::to::container \- PEG Conversion. Write CONTAINER format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::to::container  ?1?\fR
.sp
package require \fBpt::peg \fR
.sp
package require \fBtext::write \fR
.sp
package require \fBchar \fR
.sp
\fBpt::peg::to::container\fR \fBreset\fR
.sp
\fBpt::peg::to::container\fR \fBconfigure\fR
.sp
\fBpt::peg::to::container\fR \fBconfigure\fR \fIoption\fR
.sp
\fBpt::peg::to::container\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fBpt::peg::to::container\fR \fBconvert\fR \fIserial\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the converter from parsing expression grammars
to CONTAINER markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
\fBpt::peg::export\fR. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
\fBpt::peg::export::container\fR sitting between converter
and export manager.
.PP
IMAGE: arch_core_eplugins
.PP
.SH API
The API provided by this package satisfies the specification of the
Converter API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBpt::peg::to::container\fR \fBreset\fR
This command resets the configuration of the package to its default
settings.
.TP
\fBpt::peg::to::container\fR \fBconfigure\fR
This command returns a dictionary containing the current configuration
of the package.
.TP
\fBpt::peg::to::container\fR \fBconfigure\fR \fIoption\fR
This command returns the current value of the specified configuration
\fIoption\fR of the package. For the set of legal options, please read
the section \fBOptions\fR.
.TP
\fBpt::peg::to::container\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
This command sets the given configuration \fIoption\fRs of the
package, to the specified \fIvalue\fRs. For the set of legal options,
please read the section \fBOptions\fR.
.TP
\fBpt::peg::to::container\fR \fBconvert\fR \fIserial\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, and generates CONTAINER markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.
.PP
.SH OPTIONS
The converter to the CONTAINER format recognizes the following options
and changes its behaviour as they specify.
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-mode\fR \fBbulk\fR|\fBincremental\fR
The value of this option controls which methods of
\fBpt::peg::container\fR instances are used to specify the
grammar, i.e. preload it into the container. There are two legal
values, as listed below. The default is \fBbulk\fR.
.RS
.TP
\fBbulk\fR
In this mode the methods \fBstart\fR, \fBadd\fR, \fBmodes\fR,
and \fBrules\fR are used to specify the grammar in a bulk manner,
i.e. as a set of nonterminal symbols, and two dictionaries mapping
from the symbols to their semantic modes and parsing expressions.
.sp
This mode is the default.
.TP
\fBincremental\fR
In this mode the methods \fBstart\fR, \fBadd\fR, \fBmode\fR,
and \fBrule\fR are used to specify the grammar piecemal, with each
nonterminal having its own block of defining commands.
.RE
.TP
\fB-template\fR string
The value of this option is a string into which to put the generated
code and the other configuration settings. The various locations for
user-data are expected to be specified with the placeholders listed
below. The default value is "\fB@code@\fR".
.RS
.TP
\fB@user@\fR
To be replaced with the value of the option \fB-user\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBCONTAINER\fR.
.TP
\fB@file@\fR
To be replaced with the value of the option \fB-file\fR.
.TP
\fB@name@\fR
To be replaced with the value of the option \fB-name\fR.
.TP
\fB@mode@\fR
To be replaced with the value of the option \fB-mode\fR.
.TP
\fB@code@\fR
To be replaced with the generated code.
.RE
.PP
.SH "GRAMMAR CONTAINER"
The \fBcontainer\fR format is another form of describing parsing
expression grammars. While data in this format is executable it does
not constitute a parser for the grammar. It always has to be used in
conjunction with the package \fBpt::peg::interp\fR, a grammar
interpreter.
.PP
The format represents grammars by a \fBsnit::type\fR, i.e. class,
whose instances are API-compatible to the instances of the
\fBpt::peg::container\fR package, and which are preloaded with the
grammar in question.
.PP
It has no direct formal specification beyond what was said above.
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
one possible CONTAINER serialization for it is
.PP
.CS


snit::type a_pe_grammar {
    constructor {} {
        install myg using pt::peg::container ${selfns}::G
        $myg start {n Expression}
        $myg add   AddOp Digit Expression Factor MulOp Number Sign Term
        $myg modes {
            AddOp      value
            Digit      value
            Expression value
            Factor     value
            MulOp      value
            Number     value
            Sign       value
            Term       value
        }
        $myg rules {
            AddOp      {/ {t -} {t +}}
            Digit      {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}
            Expression {/ {x {t \\50} {n Expression} {t \\51}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}}
            Factor     {x {n Term} {* {x {n AddOp} {n Term}}}}
            MulOp      {/ {t *} {t /}}
            Number     {x {? {n Sign}} {+ {n Digit}}}
            Sign       {/ {t -} {t +}}
            Term       {n Number}
        }
        return
    }

    component myg
    delegate method * to myg
}

.CE
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
CONTAINER, EBNF, LL(k), PEG, TDPL, context-free languages, conversion, expression, format conversion, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_to_cparam.n.

















































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_to_cparam.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::to::cparam" n 1.0.1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::to::cparam \- PEG Conversion. Write CPARAM format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::to::cparam  ?1.0.1?\fR
.sp
\fBpt::peg::to::cparam\fR \fBreset\fR
.sp
\fBpt::peg::to::cparam\fR \fBconfigure\fR
.sp
\fBpt::peg::to::cparam\fR \fBconfigure\fR \fIoption\fR
.sp
\fBpt::peg::to::cparam\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fBpt::peg::to::cparam\fR \fBconvert\fR \fIserial\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the converter from parsing expression grammars
to CPARAM markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
\fBpt::peg::export\fR. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
\fBpt::peg::export::cparam\fR sitting between converter
and export manager.
.PP
IMAGE: arch_core_eplugins
.PP
.SH API
The API provided by this package satisfies the specification of the
Converter API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBpt::peg::to::cparam\fR \fBreset\fR
This command resets the configuration of the package to its default
settings.
.TP
\fBpt::peg::to::cparam\fR \fBconfigure\fR
This command returns a dictionary containing the current configuration
of the package.
.TP
\fBpt::peg::to::cparam\fR \fBconfigure\fR \fIoption\fR
This command returns the current value of the specified configuration
\fIoption\fR of the package. For the set of legal options, please read
the section \fBOptions\fR.
.TP
\fBpt::peg::to::cparam\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
This command sets the given configuration \fIoption\fRs of the
package, to the specified \fIvalue\fRs. For the set of legal options,
please read the section \fBOptions\fR.
.TP
\fBpt::peg::to::cparam\fR \fBconvert\fR \fIserial\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, and generates CPARAM markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.
.PP
.SH OPTIONS
The converter to C code recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-template\fR string
The value of this option is a string into which to put
the generated text and the other configuration settings. The various
locations for user-data are expected to be specified with the
placeholders listed below. The default value is "\fB@code@\fR".
.RS
.TP
\fB@user@\fR
To be replaced with the value of the option \fB-user\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBC/PARAM\fR.
.TP
\fB@file@\fR
To be replaced with the value of the option \fB-file\fR.
.TP
\fB@name@\fR
To be replaced with the value of the option \fB-name\fR.
.TP
\fB@code@\fR
To be replaced with the generated Tcl code.
.RE
.IP
The following options are special, in that they will
occur within the generated code, and are replaced there as well.
.RS
.TP
\fB@statedecl@\fR
To be replaced with the value of the option \fBstate-decl\fR.
.TP
\fB@stateref@\fR
To be replaced with the value of the option \fBstate-ref\fR.
.TP
\fB@strings@\fR
To be replaced with the value of the option \fBstring-varname\fR.
.TP
\fB@self@\fR
To be replaced with the value of the option \fBself-command\fR.
.TP
\fB@def@\fR
To be replaced with the value of the option \fBfun-qualifier\fR.
.TP
\fB@ns@\fR
To be replaced with the value of the option \fBnamespace\fR.
.TP
\fB@main@\fR
To be replaced with the value of the option \fBmain\fR.
.TP
\fB@prelude@\fR
To be replaced with the value of the option \fBprelude\fR.
.RE
.TP
\fB-state-decl\fR string
A C string representing the argument declaration to use in the
generated parsing functions to refer to the parsing state. In essence
type and argument name.
The default value is the string \fBRDE_PARAM p\fR.
.TP
\fB-state-ref\fR string
A C string representing the argument named used in the generated
parsing functions to refer to the parsing state.
The default value is the string \fBp\fR.
.TP
\fB-self-command\fR string
A C string representing the reference needed to call the generated
parser function (methods ...) from another parser fonction, per the
chosen framework (template).
The default value is the empty string.
.TP
\fB-fun-qualifier\fR string
A C string containing the attributes to give to the generated
functions (methods ...), per the chosen framework (template).
The default value is \fBstatic\fR.
.TP
\fB-namespace\fR string
The name of the C namespace the parser functions (methods, ...) shall
reside in, or a general prefix to add to the function names.
The default value is the empty string.
.TP
\fB-main\fR string
The name of the main function (method, ...) to be called by the chosen
framework (template) to start parsing input.
The default value is \fB__main\fR.
.TP
\fB-string-varname\fR string
The name of the variable used for the table of strings used by the
generated parser, i.e. error messages, symbol names, etc.
The default value is \fBp_string\fR.
.TP
\fB-prelude\fR string
A snippet of code to be inserted at the head of each generated parsing
function.
The default value is the empty string.
.TP
\fB-indent\fR integer
The number of characters to indent each line of the generated code by.
The default value is \fB0\fR.
.PP
While the high parameterizability of this converter, as shown by the
multitude of options it supports, is an advantage to the advanced
user, allowing her to customize the output of the converter as needed,
a novice user will likely not see the forest for the trees.
.PP
To help these latter users an adjunct package is provided, containing
a canned configuration which will generate immediately useful full
parsers. It is
.TP
\fBpt::cparam::configuration::critcl\fR
Generated parsers are embedded into a \fBCritcl\fR-based framework.
.PP
.SH "C/PARAM CODE REPRESENTATION OF PARSING EXPRESSION GRAMMARS"
The \fBc\fR format is executable code, a parser for the grammar. The
parser implementation is written in C and can be tweaked to the users'
needs through a multitude of options.
.PP
The \fBcritcl\fR format, for example, is implemented as a canned
configuration of these options on top of the generator for \fBc\fR.
.PP
The bulk of such a framework has to be specified through the option
\fB-template\fR. The additional options
.TP
\fB-fun-qualifier\fR string
.TP
\fB-indent\fR integer
.TP
\fB-main\fR string
.TP
\fB-namespace\fR string
.TP
\fB-prelude\fR string
.TP
\fB-self-command\fR string
.TP
\fB-state-decl\fR string
.TP
\fB-state-ref\fR string
.TP
\fB-string-varname\fR string
.PP
provide code snippets which help to glue framework and generated code
together. Their placeholders are in the \fIgenerated\fR code.
.SS EXAMPLE
We are forgoing an example of this representation, with apologies.
It would be way to large for this document.
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
CPARAM, EBNF, LL(k), PEG, TDPL, context-free languages, conversion, expression, format conversion, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_to_json.n.





























































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_to_json.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::to::json" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::to::json \- PEG Conversion. Write JSON format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::to::json  ?1?\fR
.sp
package require \fBpt::peg \fR
.sp
package require \fBjson::write \fR
.sp
\fBpt::peg::to::json\fR \fBreset\fR
.sp
\fBpt::peg::to::json\fR \fBconfigure\fR
.sp
\fBpt::peg::to::json\fR \fBconfigure\fR \fIoption\fR
.sp
\fBpt::peg::to::json\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fBpt::peg::to::json\fR \fBconvert\fR \fIserial\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the converter from parsing expression grammars
to JSON markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
\fBpt::peg::export\fR. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
\fBpt::peg::export::json\fR sitting between converter
and export manager.
.PP
IMAGE: arch_core_eplugins
.PP
.SH API
The API provided by this package satisfies the specification of the
Converter API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBpt::peg::to::json\fR \fBreset\fR
This command resets the configuration of the package to its default
settings.
.TP
\fBpt::peg::to::json\fR \fBconfigure\fR
This command returns a dictionary containing the current configuration
of the package.
.TP
\fBpt::peg::to::json\fR \fBconfigure\fR \fIoption\fR
This command returns the current value of the specified configuration
\fIoption\fR of the package. For the set of legal options, please read
the section \fBOptions\fR.
.TP
\fBpt::peg::to::json\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
This command sets the given configuration \fIoption\fRs of the
package, to the specified \fIvalue\fRs. For the set of legal options,
please read the section \fBOptions\fR.
.TP
\fBpt::peg::to::json\fR \fBconvert\fR \fIserial\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, and generates JSON markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.
.PP
.SH OPTIONS
The converter to the JSON grammar exchange format recognizes the
following configuration variables and changes its behaviour as they
specify.
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-indented\fR boolean
If this option is set the system will break the generated JSON across
lines and indent it according to its inner structure, with each key of
a dictionary on a separate line.
.sp
If the option is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.
.TP
\fB-aligned\fR boolean
If this option is set the system will ensure that the values for the
keys in a dictionary are vertically aligned with each other, for a
nice table effect.
To make this work this also implies that \fB-indented\fR is set.
.sp
If the option is not set (the default), the output is formatted as per
the value of \fBindented\fR, without trying to align the values for
dictionary keys.
.PP
.SH "JSON GRAMMAR EXCHANGE FORMAT"
The \fBjson\fR format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.
.PP
It is formally specified by the rules below:
.IP [1]
The JSON of any PEG is a JSON object.
.IP [2]
This object holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section \fBPE serialization format\fR.
.TP
\fBmode\fR
The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
\fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.PP
.PP
As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
\fBPEG serialization format\fR, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
a JSON serialization for it is
.PP
.CS


{
    "pt::grammar::peg" : {
        "rules" : {
            "AddOp"     : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Digit"     : {
                "is"   : "\\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}",
                "mode" : "value"
            },
            "Expression" : {
                "is"   : "\\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}",
                "mode" : "value"
            },
            "Factor"    : {
                "is"   : "x {n Term} {* {x {n AddOp} {n Term}}}",
                "mode" : "value"
            },
            "MulOp"     : {
                "is"   : "\\/ {t *} {t \\/}",
                "mode" : "value"
            },
            "Number"    : {
                "is"   : "x {? {n Sign}} {+ {n Digit}}",
                "mode" : "value"
            },
            "Sign"      : {
                "is"   : "\\/ {t -} {t +}",
                "mode" : "value"
            },
            "Term"      : {
                "is"   : "n Number",
                "mode" : "value"
            }
        },
        "start" : "n Expression"
    }
}

.CE
.PP
and a Tcl serialization of the same is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
The similarity of the latter to the JSON should be quite obvious.
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, JSON, LL(k), PEG, TDPL, context-free languages, conversion, expression, format conversion, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_to_param.n.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_to_param.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::to::param" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::to::param \- PEG Conversion. Write PARAM format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::to::param  ?1?\fR
.sp
package require \fBpt::peg \fR
.sp
package require \fBpt::pe \fR
.sp
\fBpt::peg::to::param\fR \fBreset\fR
.sp
\fBpt::peg::to::param\fR \fBconfigure\fR
.sp
\fBpt::peg::to::param\fR \fBconfigure\fR \fIoption\fR
.sp
\fBpt::peg::to::param\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fBpt::peg::to::param\fR \fBconvert\fR \fIserial\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the converter from parsing expression grammars
to PARAM markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
\fBpt::peg::export\fR. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
\fBpt::peg::export::param\fR sitting between converter
and export manager.
.PP
IMAGE: arch_core_eplugins
.PP
.SH API
The API provided by this package satisfies the specification of the
Converter API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBpt::peg::to::param\fR \fBreset\fR
This command resets the configuration of the package to its default
settings.
.TP
\fBpt::peg::to::param\fR \fBconfigure\fR
This command returns a dictionary containing the current configuration
of the package.
.TP
\fBpt::peg::to::param\fR \fBconfigure\fR \fIoption\fR
This command returns the current value of the specified configuration
\fIoption\fR of the package. For the set of legal options, please read
the section \fBOptions\fR.
.TP
\fBpt::peg::to::param\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
This command sets the given configuration \fIoption\fRs of the
package, to the specified \fIvalue\fRs. For the set of legal options,
please read the section \fBOptions\fR.
.TP
\fBpt::peg::to::param\fR \fBconvert\fR \fIserial\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, and generates PARAM markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.
.PP
.SH OPTIONS
The converter to PARAM markup recognizes the following configuration
variables and changes its behaviour as they specify.
.TP
\fB-template\fR string
The value of this configuration variable is a string into which to put
the generated text and the other configuration settings. The various
locations for user-data are expected to be specified with the
placeholders listed below. The default value is "\fB@code@\fR".
.RS
.TP
\fB@user@\fR
To be replaced with the value of the configuration variable \fB-user\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBPARAM\fR.
.TP
\fB@file@\fR
To be replaced with the value of the configuration variable \fB-file\fR.
.TP
\fB@name@\fR
To be replaced with the value of the configuration variable \fB-name\fR.
.TP
\fB@code@\fR
To be replaced with the generated text.
.RE
.TP
\fB-name\fR string
The value of this configuration variable is the name of the grammar
for which the conversion is run. The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this configuration variable is the name of the user for
which the conversion is run. The default value is \fBunknown\fR.
.TP
\fB-file\fR string
The value of this configuration variable is the name of the file or
other entity from which the grammar came, for which the conversion is
run. The default value is \fBunknown\fR.
.PP
.SH "PARAM CODE REPRESENTATION OF PARSING EXPRESSION GRAMMARS"
The PARAM code representation of parsing expression grammars is
assembler-like text using the instructions of the virtual machine
documented in the \fIPackRat Machine Specification\fR, plus a
few more for control flow (jump ok, jump fail, call symbol, return).
.PP
It is not really useful, except possibly as a tool demonstrating how a
grammar is compiled in general, without getting distracted by the
incidentials of a framework, i.e. like the supporting C and Tcl code
generated by the other PARAM-derived formats.
.PP
It has no direct formal specification beyond what was said above.
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
one possible PARAM serialization for it is
.PP
.CS


# -*- text -*-
# Parsing Expression Grammar 'TEMPLATE'.
# Generated for unknown, from file 'TEST'

#
# Grammar Start Expression
#

<<MAIN>>:
         call              sym_Expression
         halt

#
# value Symbol 'AddOp'
#

sym_AddOp:
# /
#     '-'
#     '+'

         symbol_restore    AddOp
  found! jump              found_7
         loc_push

         call              choice_5

   fail! value_clear
     ok! value_leaf        AddOp
         symbol_save       AddOp
         error_nonterminal AddOp
         loc_pop_discard

found_7:
     ok! ast_value_push
         return

choice_5:
# /
#     '-'
#     '+'

         error_clear

         loc_push
         error_push

         input_next        "t -"
     ok! test_char         "-"

         error_pop_merge
     ok! jump              oknoast_4

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t +"
     ok! test_char         "+"

         error_pop_merge
     ok! jump              oknoast_4

         loc_pop_rewind
         status_fail
         return

oknoast_4:
         loc_pop_discard
         return
#
# value Symbol 'Digit'
#

sym_Digit:
# /
#     '0'
#     '1'
#     '2'
#     '3'
#     '4'
#     '5'
#     '6'
#     '7'
#     '8'
#     '9'

         symbol_restore    Digit
  found! jump              found_22
         loc_push

         call              choice_20

   fail! value_clear
     ok! value_leaf        Digit
         symbol_save       Digit
         error_nonterminal Digit
         loc_pop_discard

found_22:
     ok! ast_value_push
         return

choice_20:
# /
#     '0'
#     '1'
#     '2'
#     '3'
#     '4'
#     '5'
#     '6'
#     '7'
#     '8'
#     '9'

         error_clear

         loc_push
         error_push

         input_next        "t 0"
     ok! test_char         "0"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 1"
     ok! test_char         "1"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 2"
     ok! test_char         "2"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 3"
     ok! test_char         "3"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 4"
     ok! test_char         "4"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 5"
     ok! test_char         "5"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 6"
     ok! test_char         "6"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 7"
     ok! test_char         "7"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 8"
     ok! test_char         "8"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t 9"
     ok! test_char         "9"

         error_pop_merge
     ok! jump              oknoast_19

         loc_pop_rewind
         status_fail
         return

oknoast_19:
         loc_pop_discard
         return
#
# value Symbol 'Expression'
#

sym_Expression:
# /
#     x
#         '\\('
#         (Expression)
#         '\\)'
#     x
#         (Factor)
#         *
#             x
#                 (MulOp)
#                 (Factor)

         symbol_restore    Expression
  found! jump              found_46
         loc_push
         ast_push

         call              choice_44

   fail! value_clear
     ok! value_reduce      Expression
         symbol_save       Expression
         error_nonterminal Expression
         ast_pop_rewind
         loc_pop_discard

found_46:
     ok! ast_value_push
         return

choice_44:
# /
#     x
#         '\\('
#         (Expression)
#         '\\)'
#     x
#         (Factor)
#         *
#             x
#                 (MulOp)
#                 (Factor)

         error_clear

         ast_push
         loc_push
         error_push

         call              sequence_27

         error_pop_merge
     ok! jump              ok_43

         ast_pop_rewind
         loc_pop_rewind
         ast_push
         loc_push
         error_push

         call              sequence_40

         error_pop_merge
     ok! jump              ok_43

         ast_pop_rewind
         loc_pop_rewind
         status_fail
         return

ok_43:
         ast_pop_discard
         loc_pop_discard
         return

sequence_27:
# x
#     '\\('
#     (Expression)
#     '\\)'

         loc_push
         error_clear

         error_push

         input_next        "t ("
     ok! test_char         "("

         error_pop_merge
   fail! jump              failednoast_29
         ast_push
         error_push

         call              sym_Expression

         error_pop_merge
   fail! jump              failed_28
         error_push

         input_next        "t )"
     ok! test_char         ")"

         error_pop_merge
   fail! jump              failed_28

         ast_pop_discard
         loc_pop_discard
         return

failed_28:
         ast_pop_rewind

failednoast_29:
         loc_pop_rewind
         return

sequence_40:
# x
#     (Factor)
#     *
#         x
#             (MulOp)
#             (Factor)

         ast_push
         loc_push
         error_clear

         error_push

         call              sym_Factor

         error_pop_merge
   fail! jump              failed_41
         error_push

         call              kleene_37

         error_pop_merge
   fail! jump              failed_41

         ast_pop_discard
         loc_pop_discard
         return

failed_41:
         ast_pop_rewind
         loc_pop_rewind
         return

kleene_37:
# *
#     x
#         (MulOp)
#         (Factor)

         loc_push
         error_push

         call              sequence_34

         error_pop_merge
   fail! jump              failed_38
         loc_pop_discard
         jump              kleene_37

failed_38:
         loc_pop_rewind
         status_ok
         return

sequence_34:
# x
#     (MulOp)
#     (Factor)

         ast_push
         loc_push
         error_clear

         error_push

         call              sym_MulOp

         error_pop_merge
   fail! jump              failed_35
         error_push

         call              sym_Factor

         error_pop_merge
   fail! jump              failed_35

         ast_pop_discard
         loc_pop_discard
         return

failed_35:
         ast_pop_rewind
         loc_pop_rewind
         return
#
# value Symbol 'Factor'
#

sym_Factor:
# x
#     (Term)
#     *
#         x
#             (AddOp)
#             (Term)

         symbol_restore    Factor
  found! jump              found_60
         loc_push
         ast_push

         call              sequence_57

   fail! value_clear
     ok! value_reduce      Factor
         symbol_save       Factor
         error_nonterminal Factor
         ast_pop_rewind
         loc_pop_discard

found_60:
     ok! ast_value_push
         return

sequence_57:
# x
#     (Term)
#     *
#         x
#             (AddOp)
#             (Term)

         ast_push
         loc_push
         error_clear

         error_push

         call              sym_Term

         error_pop_merge
   fail! jump              failed_58
         error_push

         call              kleene_54

         error_pop_merge
   fail! jump              failed_58

         ast_pop_discard
         loc_pop_discard
         return

failed_58:
         ast_pop_rewind
         loc_pop_rewind
         return

kleene_54:
# *
#     x
#         (AddOp)
#         (Term)

         loc_push
         error_push

         call              sequence_51

         error_pop_merge
   fail! jump              failed_55
         loc_pop_discard
         jump              kleene_54

failed_55:
         loc_pop_rewind
         status_ok
         return

sequence_51:
# x
#     (AddOp)
#     (Term)

         ast_push
         loc_push
         error_clear

         error_push

         call              sym_AddOp

         error_pop_merge
   fail! jump              failed_52
         error_push

         call              sym_Term

         error_pop_merge
   fail! jump              failed_52

         ast_pop_discard
         loc_pop_discard
         return

failed_52:
         ast_pop_rewind
         loc_pop_rewind
         return
#
# value Symbol 'MulOp'
#

sym_MulOp:
# /
#     '*'
#     '/'

         symbol_restore    MulOp
  found! jump              found_67
         loc_push

         call              choice_65

   fail! value_clear
     ok! value_leaf        MulOp
         symbol_save       MulOp
         error_nonterminal MulOp
         loc_pop_discard

found_67:
     ok! ast_value_push
         return

choice_65:
# /
#     '*'
#     '/'

         error_clear

         loc_push
         error_push

         input_next        "t *"
     ok! test_char         "*"

         error_pop_merge
     ok! jump              oknoast_64

         loc_pop_rewind
         loc_push
         error_push

         input_next        "t /"
     ok! test_char         "/"

         error_pop_merge
     ok! jump              oknoast_64

         loc_pop_rewind
         status_fail
         return

oknoast_64:
         loc_pop_discard
         return
#
# value Symbol 'Number'
#

sym_Number:
# x
#     ?
#         (Sign)
#     +
#         (Digit)

         symbol_restore    Number
  found! jump              found_80
         loc_push
         ast_push

         call              sequence_77

   fail! value_clear
     ok! value_reduce      Number
         symbol_save       Number
         error_nonterminal Number
         ast_pop_rewind
         loc_pop_discard

found_80:
     ok! ast_value_push
         return

sequence_77:
# x
#     ?
#         (Sign)
#     +
#         (Digit)

         ast_push
         loc_push
         error_clear

         error_push

         call              optional_70

         error_pop_merge
   fail! jump              failed_78
         error_push

         call              poskleene_73

         error_pop_merge
   fail! jump              failed_78

         ast_pop_discard
         loc_pop_discard
         return

failed_78:
         ast_pop_rewind
         loc_pop_rewind
         return

optional_70:
# ?
#     (Sign)

         loc_push
         error_push

         call              sym_Sign

         error_pop_merge
   fail! loc_pop_rewind
     ok! loc_pop_discard
         status_ok
         return

poskleene_73:
# +
#     (Digit)

         loc_push

         call              sym_Digit

   fail! jump              failed_74

loop_75:
         loc_pop_discard
         loc_push
         error_push

         call              sym_Digit

         error_pop_merge
     ok! jump              loop_75
         status_ok

failed_74:
         loc_pop_rewind
         return
#
# value Symbol 'Sign'
#

sym_Sign:
# /
#     '-'
#     '+'

         symbol_restore    Sign
  found! jump              found_86
         loc_push

         call              choice_5

   fail! value_clear
     ok! value_leaf        Sign
         symbol_save       Sign
         error_nonterminal Sign
         loc_pop_discard

found_86:
     ok! ast_value_push
         return
#
# value Symbol 'Term'
#

sym_Term:
# (Number)

         symbol_restore    Term
  found! jump              found_89
         loc_push
         ast_push

         call              sym_Number

   fail! value_clear
     ok! value_reduce      Term
         symbol_save       Term
         error_nonterminal Term
         ast_pop_rewind
         loc_pop_discard

found_89:
     ok! ast_value_push
         return

#
#

.CE
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PARAM, PEG, TDPL, context-free languages, conversion, expression, format conversion, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_to_peg.n.
















































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_to_peg.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::to::peg" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::to::peg \- PEG Conversion. Write PEG format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::to::peg  ?1?\fR
.sp
package require \fBpt::peg \fR
.sp
package require \fBpt::pe \fR
.sp
package require \fBtext::write \fR
.sp
\fBpt::peg::to::peg\fR \fBreset\fR
.sp
\fBpt::peg::to::peg\fR \fBconfigure\fR
.sp
\fBpt::peg::to::peg\fR \fBconfigure\fR \fIoption\fR
.sp
\fBpt::peg::to::peg\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fBpt::peg::to::peg\fR \fBconvert\fR \fIserial\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the converter from parsing expression grammars
to PEG markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
\fBpt::peg::export\fR. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
\fBpt::peg::export::peg\fR sitting between converter
and export manager.
.PP
IMAGE: arch_core_eplugins
.PP
.SH API
The API provided by this package satisfies the specification of the
Converter API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBpt::peg::to::peg\fR \fBreset\fR
This command resets the configuration of the package to its default
settings.
.TP
\fBpt::peg::to::peg\fR \fBconfigure\fR
This command returns a dictionary containing the current configuration
of the package.
.TP
\fBpt::peg::to::peg\fR \fBconfigure\fR \fIoption\fR
This command returns the current value of the specified configuration
\fIoption\fR of the package. For the set of legal options, please read
the section \fBOptions\fR.
.TP
\fBpt::peg::to::peg\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
This command sets the given configuration \fIoption\fRs of the
package, to the specified \fIvalue\fRs. For the set of legal options,
please read the section \fBOptions\fR.
.TP
\fBpt::peg::to::peg\fR \fBconvert\fR \fIserial\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, and generates PEG markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.
.PP
.SH OPTIONS
The converter to the PEG language recognizes the following options and
changes its behaviour as they specify.
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.TP
\fB-template\fR string
The value of this option is a string into which to put the generated
text and the values of the other options. The various locations for
user-data are expected to be specified with the placeholders listed
below. The default value is "\fB@code@\fR".
.RS
.TP
\fB@user@\fR
To be replaced with the value of the option \fB-user\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBPEG\fR.
.TP
\fB@file@\fR
To be replaced with the value of the option \fB-file\fR.
.TP
\fB@name@\fR
To be replaced with the value of the option \fB-name\fR.
.TP
\fB@code@\fR
To be replaced with the generated text.
.RE
.PP
.SH "PEG SPECIFICATION LANGUAGE"
\fBpeg\fR, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.
.PP
It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the \fIPEG Language Tutorial\fR.
.PP
.CS


PEG pe-grammar-for-peg (Grammar)

	# --------------------------------------------------------------------
        # Syntactical constructs

        Grammar         <- WHITESPACE Header Definition* Final EOF ;

        Header          <- PEG Identifier StartExpr ;
        Definition      <- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       <- (VOID / LEAF) COLON ;
        Expression      <- Sequence (SLASH Sequence)* ;
        Sequence        <- Prefix+ ;
        Prefix          <- (AND / NOT)? Suffix ;
        Suffix          <- Primary (QUESTION / STAR / PLUS)? ;
        Primary         <- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         <- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           <- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           <- Char TO Char / Char ;

        StartExpr       <- OPEN Expression CLOSE ;
void:   Final           <- END SEMICOLON WHITESPACE ;

        # --------------------------------------------------------------------
        # Lexing constructs

        Identifier      <- Ident WHITESPACE ;
leaf:   Ident           <- ('_' / ':' / <alpha>) ('_' / ':' / <alnum>)* ;
        Char            <- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;

leaf:   CharSpecial     <- "\\\\" [nrt'"\\[\\]\\\\] ;
leaf:   CharOctalFull   <- "\\\\" [0-2][0-7][0-7] ;
leaf:   CharOctalPart   <- "\\\\" [0-7][0-7]? ;
leaf:   CharUnicode     <- "\\\\" 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   <- !"\\\\" . ;

void:   HexDigit        <- [0-9a-fA-F] ;

void:   TO              <- '-'           ;
void:   OPENB           <- "["           ;
void:   CLOSEB          <- "]"           ;
void:   APOSTROPH       <- "'"           ;
void:   DAPOSTROPH      <- '"'           ;
void:   PEG             <- "PEG"   WHITESPACE ;
void:   IS              <- "<-"    WHITESPACE ;
leaf:   VOID            <- "void"  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            <- "leaf"  WHITESPACE ; # Implies that definition has no terminals.
void:   END             <- "END"   WHITESPACE ;
void:   SEMICOLON       <- ";"     WHITESPACE ;
void:   COLON           <- ":"     WHITESPACE ;
void:   SLASH           <- "/"     WHITESPACE ;
leaf:   AND             <- "&"     WHITESPACE ;
leaf:   NOT             <- "!"     WHITESPACE ;
leaf:   QUESTION        <- "?"     WHITESPACE ;
leaf:   STAR            <- "*"     WHITESPACE ;
leaf:   PLUS            <- "+"     WHITESPACE ;
void:   OPEN            <- "("     WHITESPACE ;
void:   CLOSE           <- ")"     WHITESPACE ;
leaf:   DOT             <- "."     WHITESPACE ;

leaf:   ALNUM           <- "<alnum>"    WHITESPACE ;
leaf:   ALPHA           <- "<alpha>"    WHITESPACE ;
leaf:   ASCII           <- "<ascii>"    WHITESPACE ;
leaf:   CONTROL         <- "<control>"  WHITESPACE ;
leaf:   DDIGIT          <- "<ddigit>"   WHITESPACE ;
leaf:   DIGIT           <- "<digit>"    WHITESPACE ;
leaf:   GRAPH           <- "<graph>"    WHITESPACE ;
leaf:   LOWER           <- "<lower>"    WHITESPACE ;
leaf:   PRINTABLE       <- "<print>"    WHITESPACE ;
leaf:   PUNCT           <- "<punct>"    WHITESPACE ;
leaf:   SPACE           <- "<space>"    WHITESPACE ;
leaf:   UPPER           <- "<upper>"    WHITESPACE ;
leaf:   WORDCHAR        <- "<wordchar>" WHITESPACE ;
leaf:   XDIGIT          <- "<xdigit>"   WHITESPACE ;

void:   WHITESPACE      <- (" " / "\\t" / EOL / COMMENT)* ;
void:   COMMENT         <- '#' (!EOL .)* EOL ;
void:   EOL             <- "\\n\\r" / "\\n" / "\\r" ;
void:   EOF             <- !. ;

        # --------------------------------------------------------------------
END;

.CE
.SS EXAMPLE
Our example specifies the grammar for a basic 4-operation calculator.
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as
.PP
.CS


PEG calculator (Expression)
    Sign       <- [-+] 						;
    Number     <- Sign? <ddigit>+				;
    Expression <- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      <- [*/]						;
    Factor     <- Term (AddOp Term)*				;
    AddOp      <- [-+]						;
    Term       <- Number					;
END;

.CE
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, conversion, expression, format conversion, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_peg_to_tclparam.n.

































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_peg_to_tclparam.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg::to::tclparam" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg::to::tclparam \- PEG Conversion. Write TCLPARAM format
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg::to::tclparam  ?1?\fR
.sp
\fBpt::peg::to::tclparam\fR \fBreset\fR
.sp
\fBpt::peg::to::tclparam\fR \fBconfigure\fR
.sp
\fBpt::peg::to::tclparam\fR \fBconfigure\fR \fIoption\fR
.sp
\fBpt::peg::to::tclparam\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fBpt::peg::to::tclparam\fR \fBconvert\fR \fIserial\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package implements the converter from parsing expression grammars
to TCLPARAM markup.
.PP
It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
\fBpt::peg::export\fR. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
\fBpt::peg::export::tclparam\fR sitting between converter
and export manager.
.PP
IMAGE: arch_core_eplugins
.PP
.SH API
The API provided by this package satisfies the specification of the
Converter API found in the \fIParser Tools Export API\fR
specification.
.TP
\fBpt::peg::to::tclparam\fR \fBreset\fR
This command resets the configuration of the package to its default
settings.
.TP
\fBpt::peg::to::tclparam\fR \fBconfigure\fR
This command returns a dictionary containing the current configuration
of the package.
.TP
\fBpt::peg::to::tclparam\fR \fBconfigure\fR \fIoption\fR
This command returns the current value of the specified configuration
\fIoption\fR of the package. For the set of legal options, please read
the section \fBOptions\fR.
.TP
\fBpt::peg::to::tclparam\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
This command sets the given configuration \fIoption\fRs of the
package, to the specified \fIvalue\fRs. For the set of legal options,
please read the section \fBOptions\fR.
.TP
\fBpt::peg::to::tclparam\fR \fBconvert\fR \fIserial\fR
This command takes the canonical serialization of a parsing expression
grammar, as specified in section \fBPEG serialization format\fR,
and contained in \fIserial\fR, and generates TCLPARAM markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.
.PP
.SH OPTIONS
The converter to Tcl/PARAM markup recognizes the following
configuration variables and changes its behaviour as they specify.
.TP
\fB-template\fR string
The value of this configuration variable is a string into which to put
the generated text and the other configuration settings. The various
locations for user-data are expected to be specified with the
placeholders listed below. The default value is "\fB@code@\fR".
.RS
.TP
\fB@user@\fR
To be replaced with the value of the configuration variable \fB-user\fR.
.TP
\fB@format@\fR
To be replaced with the the constant \fBTcl/PARAM\fR.
.TP
\fB@file@\fR
To be replaced with the value of the configuration variable \fB-file\fR.
.TP
\fB@name@\fR
To be replaced with the value of the configuration variable \fB-name\fR.
.TP
\fB@code@\fR
To be replaced with the generated Tcl code.
.RE
.IP
The following configuration variables are special, in that they will
occur within the generated code, and are replaced there as well.
.RS
.TP
\fB@runtime@\fR
To be replaced with the value of the configuration variable \fBruntime-command\fR.
.TP
\fB@self@\fR
To be replaced with the value of the configuration variable \fBself-command\fR.
.TP
\fB@def@\fR
To be replaced with the value of the configuration variable \fBproc-command\fR.
.TP
\fB@ns@\fR
To be replaced with the value of the configuration variable \fBnamespace\fR.
.TP
\fB@main@\fR
To be replaced with the value of the configuration variable \fBmain\fR.
.TP
\fB@prelude@\fR
To be replaced with the value of the configuration variable \fBprelude\fR.
.RE
.TP
\fB-name\fR string
The value of this configuration variable is the name of the grammar
for which the conversion is run. The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this configuration variable is the name of the user for
which the conversion is run. The default value is \fBunknown\fR.
.TP
\fB-file\fR string
The value of this configuration variable is the name of the file or
other entity from which the grammar came, for which the conversion is
run. The default value is \fBunknown\fR.
.TP
\fB-runtime-command\fR string
A Tcl string representing the Tcl command or reference to it used to
call PARAM instruction from parser procedures, per the chosen
framework (template).
The default value is the empty string.
.TP
\fB-self-command\fR string
A Tcl string representing the Tcl command or reference to it used to
call the parser procedures (methods ...) from another parser
procedure, per the chosen framework (template).
The default value is the empty string.
.TP
\fB-proc-command\fR string
The name of the Tcl command used to define procedures (methods ...),
per the chosen framework (template).
The default value is \fBproc\fR.
.TP
\fB-namespace\fR string
The name of the namespace the parser procedures (methods, ...) shall
reside in, including the trailing '::' needed to separate it from the
actual procedure name.
The default value is \fB::\fR.
.TP
\fB-main\fR string
The name of the main procedure (method, ...) to be called by the
chosen framework (template) to start parsing input.
The default value is \fB__main\fR.
.TP
\fB-prelude\fR string
A snippet of code to be insert at the head of each generated parsing
command.
The default value is the empty string.
.TP
\fB-indent\fR integer
The number of characters to indent each line of the generated code by.
The default value is \fB0\fR.
.PP
While the high parameterizability of this converter, as shown by the
multitude of options it supports, is an advantage to the advanced
user, allowing her to customize the output of the converter as needed,
a novice user will likely not see the forest for the trees.
.PP
To help these latter users two adjunct packages are provided, each
containing a canned configuration which will generate immediately
useful full parsers. These are
.TP
\fBpt::tclparam::configuration::snit\fR
Generated parsers are classes based on the \fBsnit\fR package,
i.e. snit::type's.
.TP
\fBpt::tclparam::configuration::tcloo\fR
Generated parsers are classes based on the \fBOO\fR package.
.PP
.SH "TCL/PARAM CODE REPRESENTATION OF PARSING EXPRESSION GRAMMARS"
The Tcl/PARAM representation of parsing expression grammars is Tcl
code whose execution will parse input per the grammar. The code is
based on the virtual machine documented in the
\fIPackRat Machine Specification\fR, using its instructions
and a few more to handle control flow.
.PP
Note that the generated code by itself is not functional. It expects
to be embedded into a framework which provides services like the PARAM
state, implementations for the PARAM instructions, etc.
The bulk of such a framework has to be specified through the option
\fB-template\fR. The additional options
.TP
\fB-indent\fR integer
.TP
\fB-main\fR string
.TP
\fB-namespace\fR string
.TP
\fB-prelude\fR string
.TP
\fB-proc-command\fR string
.TP
\fB-runtime-command\fR string
.TP
\fB-self-command\fR string
.PP
provide code snippets which help to glue framework and generated code
together. Their placeholders are in the \fIgenerated\fR code.
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TCLPARAM, TDPL, context-free languages, conversion, expression, format conversion, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, serialization, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_pegrammar.n.







































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_pegrammar.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::peg" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::peg \- Parsing Expression Grammar Serialization
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::peg  ?1?\fR
.sp
package require \fBpt::pe \fR
.sp
\fB::pt::peg\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
.sp
\fB::pt::peg\fR \fBverify-as-canonical\fR \fIserial\fR
.sp
\fB::pt::peg\fR \fBcanonicalize\fR \fIserial\fR
.sp
\fB::pt::peg\fR \fBprint\fR \fIserial\fR
.sp
\fB::pt::peg\fR \fBmerge\fR \fIseriala\fR \fIserialb\fR
.sp
\fB::pt::peg\fR \fBequal\fR \fIseriala\fR \fIserialb\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides commands to work with the serializations of
parsing expression grammars as managed by the Parser Tools, and
specified in section \fBPEG serialization format\fR.
.PP
This is a supporting package in the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_support
.PP
.SH API
.TP
\fB::pt::peg\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
This command verifies that the content of \fIserial\fR is a valid
serialization of a parsing expression and will throw an error if that
is not the case. The result of the command is the empty string.
.sp
If the argument \fIcanonvar\fR is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if \fIserial\fR is a valid regular
serialization. Its value will be a boolean, with \fBTrue\fR
indicating that the serialization is not only valid, but also
\fIcanonical\fR. \fBFalse\fR will be written for a valid, but
non-canonical serialization.
.sp
For the specification of serializations see the section
\fBPE serialization format\fR.
.TP
\fB::pt::peg\fR \fBverify-as-canonical\fR \fIserial\fR
This command verifies that the content of \fIserial\fR is a valid
\fIcanonical\fR serialization of a PEG and will throw an error if
that is not the case. The result of the command is the empty string.
.sp
For the specification of canonical serializations see the section
\fBPEG serialization format\fR.
.TP
\fB::pt::peg\fR \fBcanonicalize\fR \fIserial\fR
This command assumes that the content of \fIserial\fR is a valid
\fIregular\fR serialization of a PEG and will throw an error if that
is not the case.
.sp
It will then convert the input into the \fIcanonical\fR serialization
of the contained PEG and return it as its result. If the input is
already canonical it will be returned unchanged.
.sp
For the specification of regular and canonical serializations see the
section \fBPEG serialization format\fR.
.TP
\fB::pt::peg\fR \fBprint\fR \fIserial\fR
This command assumes that the argument \fIserial\fR contains a valid
serialization of a parsing expression and returns a string containing
that PE in a human readable form.
.sp
The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.
.sp
For the specification of serializations see the section
\fBPEG serialization format\fR.
.TP
\fB::pt::peg\fR \fBmerge\fR \fIseriala\fR \fIserialb\fR
This command accepts the regular serializations of two grammars and
uses them to create their union.  The result of the command is the
canonical serialization of this unified grammar.
.sp
A merge errors occurs if for any nonterminal symbol S occuring in both
input grammars the two input grammars specify different semantic
modes.
.sp
The semantic mode of each nonterminal symbol S is the semantic mode of
S in any of its input grammars. The previous rule made sure that for
symbols occuring in both grammars these values are identical.
.sp
The right-hand side of each nonterminal symbol S occuring in both
input grammars is the choice between the right-hand sides of S in the
input grammars, with the parsing expression of S in \fIseriala\fR
coming first, except if both expressions are identical. In that case
the first expression is taken.
.sp
The right-hand side of each nonterminal symbol S occuring in only one
of the input grammars is the right-hand side of S in its input
grammar.
.sp
The start expression of the unified grammar is the choice between the
start expressions of the input grammars, with the start expression of
\fIseriala\fR coming first, except if both expressions are identical.
In that case the first expression is taken
.TP
\fB::pt::peg\fR \fBequal\fR \fIseriala\fR \fIserialb\fR
This command tests the two grammars \fIseriala\fR and \fIserialb\fR
for structural equality. The result of the command is a boolean
value. It will be set to \fBtrue\fR if the expressions are
identical, and \fBfalse\fR otherwise.
.sp
String equality is usable only if we can assume that the two grammars
are pure Tcl lists and dictionaries.
.PP
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_pexpr_op.n.






























































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_pexpr_op.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::pe::op" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::pe::op \- Parsing Expression Utilities
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::pe::op  ?1?\fR
.sp
package require \fBpt::pe  ?1?\fR
.sp
package require \fBstruct::set \fR
.sp
\fB::pt::pe::op\fR \fBdrop\fR \fIdropset\fR \fIpe\fR
.sp
\fB::pt::pe::op\fR \fBrename\fR \fInt\fR \fIntnew\fR \fIpe\fR
.sp
\fB::pt::pe::op\fR \fBcalled\fR \fIpe\fR
.sp
\fB::pt::pe::op\fR \fBflatten\fR \fIpe\fR
.sp
\fB::pt::pe::op\fR \fBfusechars\fR \fIpe\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides additional commands to work with the
serializations of parsing expressions as managed by the PEG and
related packages, and specified in section
\fBPE serialization format\fR.
.PP
This is an internal package, for use by the higher level packages
handling PEGs, their conversion into and out of various other formats,
or other uses.
.SH API
.TP
\fB::pt::pe::op\fR \fBdrop\fR \fIdropset\fR \fIpe\fR
This command removes all occurences of any of the nonterminals symbols
in the set \fIdropset\fR from the parsing expression \fIpe\fR, and
simplifies it. This may result in the expression becoming "epsilon",
i.e. matching nothing.
.TP
\fB::pt::pe::op\fR \fBrename\fR \fInt\fR \fIntnew\fR \fIpe\fR
This command renames all occurences of the nonterminal \fInt\fR in the
parsing expression \fIpe\fR into \fIntnew\fR.
.TP
\fB::pt::pe::op\fR \fBcalled\fR \fIpe\fR
This command extracts the set of all nonterminal symbols used,
i.e. 'called', in the parsing expression \fIpe\fR.
.TP
\fB::pt::pe::op\fR \fBflatten\fR \fIpe\fR
This command transforms the parsing expression by eliminating
sequences nested in sequences, and choices in choices, lifting the
children of the nested expression into the parent. It further
eliminates all sequences and choices with only one child, as these are
redundant.
.sp
The resulting parsing expression is returned as the result of the
command.
.TP
\fB::pt::pe::op\fR \fBfusechars\fR \fIpe\fR
This command transforms the parsing expression by fusing adjacent
terminals in sequences and adjacent terminals and ranges in choices,
it (re)constructs highlevel \fIstrings\fR and
\fIcharacter classes\fR.
.sp
The resulting pseudo-parsing expression is returned as the result of
the command and may contain the pseudo-operators \fBstr\fR for
character sequences, aka strings, and \fBcl\fR for character
choices, aka character classes.
.sp
The result is called a \fIpseudo-parsing expression\fR because it
is not a true parsing expression anymore, and will fail a check with
\fB::pt::peg verify\fR if the new pseudo-operators
are present in the result, but is otherwise of sound structure for a
parsing expression.
Notably, the commands \fB::pt::peg bottomup\fR and
\fB::pt::peg topdown\fR will process them without
trouble.
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_pexpression.n.

































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_pexpression.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::pe" n 1 tcllib "Parser Tools"
.BS
.SH NAME
pt::pe \- Parsing Expression Serialization
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::pe  ?1?\fR
.sp
package require \fBchar \fR
.sp
\fB::pt::pe\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
.sp
\fB::pt::pe\fR \fBverify-as-canonical\fR \fIserial\fR
.sp
\fB::pt::pe\fR \fBcanonicalize\fR \fIserial\fR
.sp
\fB::pt::pe\fR \fBprint\fR \fIserial\fR
.sp
\fB::pt::pe\fR \fBbottomup\fR \fIcmdprefix\fR \fIpe\fR
.sp
\fBcmdprefix\fR \fIpe\fR \fIop\fR \fIarguments\fR
.sp
\fB::pt::pe\fR \fBtopdown\fR \fIcmdprefix\fR \fIpe\fR
.sp
\fB::pt::pe\fR \fBequal\fR \fIseriala\fR \fIserialb\fR
.sp
\fB::pt::pe\fR \fBepsilon\fR
.sp
\fB::pt::pe\fR \fBdot\fR
.sp
\fB::pt::pe\fR \fBalnum\fR
.sp
\fB::pt::pe\fR \fBalpha\fR
.sp
\fB::pt::pe\fR \fBascii\fR
.sp
\fB::pt::pe\fR \fBcontrol\fR
.sp
\fB::pt::pe\fR \fBdigit\fR
.sp
\fB::pt::pe\fR \fBgraph\fR
.sp
\fB::pt::pe\fR \fBlower\fR
.sp
\fB::pt::pe\fR \fBprint\fR
.sp
\fB::pt::pe\fR \fBpunct\fR
.sp
\fB::pt::pe\fR \fBspace\fR
.sp
\fB::pt::pe\fR \fBupper\fR
.sp
\fB::pt::pe\fR \fBwordchar\fR
.sp
\fB::pt::pe\fR \fBxdigit\fR
.sp
\fB::pt::pe\fR \fBddigit\fR
.sp
\fB::pt::pe\fR \fBterminal\fR \fIt\fR
.sp
\fB::pt::pe\fR \fBrange\fR \fIta\fR \fItb\fR
.sp
\fB::pt::pe\fR \fBnonterminal\fR \fInt\fR
.sp
\fB::pt::pe\fR \fBchoice\fR \fIpe\fR...
.sp
\fB::pt::pe\fR \fBsequence\fR \fIpe\fR...
.sp
\fB::pt::pe\fR \fBrepeat0\fR \fIpe\fR
.sp
\fB::pt::pe\fR \fBrepeat1\fR \fIpe\fR
.sp
\fB::pt::pe\fR \fBoptional\fR \fIpe\fR
.sp
\fB::pt::pe\fR \fBahead\fR \fIpe\fR
.sp
\fB::pt::pe\fR \fBnotahead\fR \fIpe\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides commands to work with the serializations of
parsing expressions as managed by the Parser Tools, and specified in
section \fBPE serialization format\fR.
.PP
This is a supporting package in the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_support
.PP
.SH API
.TP
\fB::pt::pe\fR \fBverify\fR \fIserial\fR ?\fIcanonvar\fR?
This command verifies that the content of \fIserial\fR is a valid
serialization of a parsing expression and will throw an error if that
is not the case. The result of the command is the empty string.
.sp
If the argument \fIcanonvar\fR is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if \fIserial\fR is a valid regular
serialization. Its value will be a boolean, with \fBTrue\fR
indicating that the serialization is not only valid, but also
\fIcanonical\fR. \fBFalse\fR will be written for a valid, but
non-canonical serialization.
.sp
For the specification of serializations see the section
\fBPE serialization format\fR.
.TP
\fB::pt::pe\fR \fBverify-as-canonical\fR \fIserial\fR
This command verifies that the content of \fIserial\fR is a valid
\fIcanonical\fR serialization of a parsing expression and will throw
an error if that is not the case. The result of the command is the
empty string.
.sp
For the specification of canonical serializations see the section
\fBPE serialization format\fR.
.TP
\fB::pt::pe\fR \fBcanonicalize\fR \fIserial\fR
This command assumes that the content of \fIserial\fR is a valid
\fIregular\fR serialization of a parsing expression and will throw an
error if that is not the case.
.sp
It will then convert the input into the \fIcanonical\fR serialization
of this parsing expression and return it as its result. If the input
is already canonical it will be returned unchanged.
.sp
For the specification of regular and canonical serializations see the
section \fBPE serialization format\fR.
.TP
\fB::pt::pe\fR \fBprint\fR \fIserial\fR
This command assumes that the argument \fIserial\fR contains a valid
serialization of a parsing expression and returns a string containing
that PE in a human readable form.
.sp
The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.
.sp
For the specification of serializations see the section
\fBPE serialization format\fR.
.TP
\fB::pt::pe\fR \fBbottomup\fR \fIcmdprefix\fR \fIpe\fR
This command walks the parsing expression \fIpe\fR from the bottom up
to the root, invoking the command prefix \fIcmdprefix\fR for each
partial expression. This implies that the children of a parsing
expression PE are handled before PE.
.sp
The command prefix has the signature
.RS
.TP
\fBcmdprefix\fR \fIpe\fR \fIop\fR \fIarguments\fR
I.e. it is invoked with the parsing expression \fIpe\fR the walk is
currently at, the \fIop\fR'erator in the \fIpe\fR, and the operator's
\fIarguments\fR.
.sp
The result returned by the command prefix replaces \fIpe\fR in the
parsing expression it was a child of, allowing transformations of the
expression tree.
.sp
This also means that for all inner parsing expressions the contents of
\fIarguments\fR are the results of the command prefix invoked for the
children of this inner parsing expression.
.RE
.TP
\fB::pt::pe\fR \fBtopdown\fR \fIcmdprefix\fR \fIpe\fR
This command walks the parsing expression \fIpe\fR from the root down
to the leaves, invoking the command prefix \fIcmdprefix\fR for each
partial expression. This implies that the children of a parsing
expression PE are handled after PE.
.sp
The command prefix has the same signature as for \fBbottomup\fR,
see above.
.sp
The result returned by the command prefix is \fIignored\fR.
.TP
\fB::pt::pe\fR \fBequal\fR \fIseriala\fR \fIserialb\fR
This command tests the two parsing expressions \fIseriala\fR and
\fIserialb\fR for structural equality. The result of the command is a
boolean value. It will be set to \fBtrue\fR if the expressions are
identical, and \fBfalse\fR otherwise.
.sp
String equality is usable only if we can assume that the two parsing
expressions are pure Tcl lists.
.TP
\fB::pt::pe\fR \fBepsilon\fR
This command constructs the atomic parsing expression for epsilon.
.TP
\fB::pt::pe\fR \fBdot\fR
This command constructs the atomic parsing expression for dot.
.TP
\fB::pt::pe\fR \fBalnum\fR
This command constructs the atomic parsing expression for alnum.
.TP
\fB::pt::pe\fR \fBalpha\fR
This command constructs the atomic parsing expression for alpha.
.TP
\fB::pt::pe\fR \fBascii\fR
This command constructs the atomic parsing expression for ascii.
.TP
\fB::pt::pe\fR \fBcontrol\fR
This command constructs the atomic parsing expression for control.
.TP
\fB::pt::pe\fR \fBdigit\fR
This command constructs the atomic parsing expression for digit.
.TP
\fB::pt::pe\fR \fBgraph\fR
This command constructs the atomic parsing expression for graph.
.TP
\fB::pt::pe\fR \fBlower\fR
This command constructs the atomic parsing expression for lower.
.TP
\fB::pt::pe\fR \fBprint\fR
This command constructs the atomic parsing expression for print.
.TP
\fB::pt::pe\fR \fBpunct\fR
This command constructs the atomic parsing expression for punct.
.TP
\fB::pt::pe\fR \fBspace\fR
This command constructs the atomic parsing expression for space.
.TP
\fB::pt::pe\fR \fBupper\fR
This command constructs the atomic parsing expression for upper.
.TP
\fB::pt::pe\fR \fBwordchar\fR
This command constructs the atomic parsing expression for wordchar.
.TP
\fB::pt::pe\fR \fBxdigit\fR
This command constructs the atomic parsing expression for xdigit.
.TP
\fB::pt::pe\fR \fBddigit\fR
This command constructs the atomic parsing expression for ddigit.
.TP
\fB::pt::pe\fR \fBterminal\fR \fIt\fR
This command constructs the atomic parsing expression for the terminal
symbol \fIt\fR.
.TP
\fB::pt::pe\fR \fBrange\fR \fIta\fR \fItb\fR
This command constructs the atomic parsing expression for the range of
terminal symbols \fIta\fR ... \fItb\fR.
.TP
\fB::pt::pe\fR \fBnonterminal\fR \fInt\fR
This command constructs the atomic parsing expression for the
nonterminal symbol \fInt\fR.
.TP
\fB::pt::pe\fR \fBchoice\fR \fIpe\fR...
This command constructs the parsing expression representing the
ordered or prioritized choice between the argument parsing
expressions. The first argument has the highest priority.
.TP
\fB::pt::pe\fR \fBsequence\fR \fIpe\fR...
This command constructs the parsing expression representing the
sequence of the argument parsing expression. The first argument is the
first element of the sequence.
.TP
\fB::pt::pe\fR \fBrepeat0\fR \fIpe\fR
This command constructs the parsing expression representing the zero
or more repetition of the argument parsing expression \fIpe\fR, also
known as the kleene closure.
.TP
\fB::pt::pe\fR \fBrepeat1\fR \fIpe\fR
This command constructs the parsing expression representing the one or
more repetition of the argument parsing expression \fIpe\fR, also
known as the positive kleene closure.
.TP
\fB::pt::pe\fR \fBoptional\fR \fIpe\fR
This command constructs the parsing expression representing the
optionality of the argument parsing expression \fIpe\fR.
.TP
\fB::pt::pe\fR \fBahead\fR \fIpe\fR
This command constructs the parsing expression representing the
positive lookahead of the argument parsing expression \fIpe\fR.
.TP
\fB::pt::pe\fR \fBnotahead\fR \fIpe\fR
This command constructs the parsing expression representing the
negative lookahead of the argument parsing expression \fIpe\fR.
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_pgen.n.























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_pgen.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::pgen" n 1.0.1 tcllib "Parser Tools"
.BS
.SH NAME
pt::pgen \- Parser Generator
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::pgen  ?1.0.1?\fR
.sp
\fB::pt::pgen\fR \fIinputformat\fR \fItext\fR \fIresultformat\fR ?\fIoptions...\fR?
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides a command implementing a
\fIparser generator\fR
taking parsing expression grammars as input.
.PP
It is the implementation of method \fBgenerate\fR of \fBpt\fR, the
\fIParser Tools Application\fR.
.PP
As such the intended audience of this document are people wishing to
modify and/or extend this part of \fBpt\fR's functionality. Users of
\fBpt\fR on the other hand are hereby refered to the applications'
manpage, i.e. \fIParser Tools Application\fR.
.PP
It resides in the User Package Layer of Parser Tools.
.PP
IMAGE: arch_user_pkg
.PP
.SH API
.TP
\fB::pt::pgen\fR \fIinputformat\fR \fItext\fR \fIresultformat\fR ?\fIoptions...\fR?
This command takes the parsing expression grammar in \fItext\fR (in
the format specified by \fIinputformat\fR), and returns the same
grammar in the format \fIresultformat\fR as the result of the command.
.sp
The two known input formats are \fBpeg\fR and \fBjson\fR.
Introductions to them, including their formal specifications, can be
found in the \fIPEG Language Tutorial\fR and
\fIThe JSON Grammar Exchange Format\fR. The packages used to
parse these formats are
.RS
.TP
\fBpeg\fR
\fBpt::peg::from::peg\fR
.TP
\fBjson\fR
\fBpt::peg::from::json\fR
.RE
.sp
On the output side the known formats, and the packages used to
generate them are
.RS
.TP
\fBc\fR
\fBpt::peg::to::cparam\fR
.TP
\fBcontainer\fR
\fBpt::peg::to::container\fR
.TP
\fBcritcl\fR
\fBpt::peg::to::cparam\fR +
\fBpt::cparam::configuration::critcl\fR
.TP
\fBjson\fR
\fBpt::peg::to::json\fR
.TP
\fBoo\fR
\fBpt::peg::to::tclparam\fR +
\fBpt::tclparam::configuration::tcloo\fR
.TP
\fBpeg\fR
\fBpt::peg::to::peg\fR
.TP
\fBsnit\fR
\fBpt::peg::to::tclparam\fR +
\fBpt::tclparam::configuration::snit\fR
.RE
.IP
The options supported by each of these formats are documented
with their respective packages.
.PP
.SH EXAMPLE
In this section we are working a complete example, starting with a PEG
grammar and ending with running the parser generated from it over some
input, following the outline shown in the figure below:
.PP
IMAGE: flow
.PP
Our grammar, assumed to the stored in the file "\fIcalculator.peg\fR"
is
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
From this we create a snit-based parser
using the script "\fIgen\fR"
.CS


package require Tcl 8.5
package require fileutil
package require pt::pgen

lassign $argv name
set grammar [fileutil::cat $name.peg]
set pclass  [pt::pgen peg $gr snit -class $name -file  $name.peg -name  $name]
fileutil::writeFile $name.tcl $pclass
exit 0

.CE
calling it like
.CS

 tclsh8.5 gen calculator
.CE
which leaves us with the parser package and class written to the file
"\fIcalculator.tcl\fR".
Assuming that this package is then properly installed in a place where
Tcl can find it we can now use this class via a script like
.CS


    package require calculator

    lassign $argv input
    set channel [open $input r]

    set parser [calculator]
    set ast [$parser parse $channel]
    $parser destroy
    close $channel

    ... now process the returned abstract syntax tree ...

.CE
where the abstract syntax tree stored in the variable will look like
.PP
.CS


set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}

.CE
.PP
assuming that the input file and channel contained the text
.CS

 120+5
.CE
A more graphical representation of the tree would be
.PP
.PS
.nf
                                                           +- Digit 0 0 | 1
                                                           |            |
                               +- Term 0 2 --- Number 0 2 -+- Digit 1 1 | 2
                               |                           |            |
                               |                           +- Digit 2 2 | 0
                               |                                        |
Expression 0 4 --- Factor 0 4 -+----------------------------- AddOp 3 3 | +
                               |                                        |
                               +- Term 4 4 --- Number 4 4 --- Digit 4 4 | 5
.fi
.PE
.PP
Regardless, at this point it is the user's responsibility to work with
the tree to reach whatever goal she desires. I.e. analyze it,
transform it, etc. The package \fBpt::ast\fR should be of help
here, providing commands to walk such ASTs structures in various ways.
.PP
One important thing to note is that the parsers used here return a
data structure representing the structure of the input per the grammar
underlying the parser. There are \fIno\fR callbacks during the
parsing process, i.e. no \fIparsing actions\fR, as most other
parsers will have.
.PP
Going back to the last snippet of code, the execution of the parser
for some input, note how the parser instance follows the specified
\fIParser API\fR.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_rdengine.n.






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_rdengine.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::rde" n 1.0.2 tcllib "Parser Tools"
.BS
.SH NAME
pt::rde \- Parsing Runtime Support, PARAM based
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::rde  ?1.0.2?\fR
.sp
package require \fBsnit \fR
.sp
package require \fBstruct::stack  1.4\fR
.sp
package require \fBpt::ast  1.1\fR
.sp
\fB::pt::rde\fR \fIobjectName\fR
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBreset\fR \fIchan\fR
.sp
\fIobjectName\fR \fBcomplete\fR
.sp
\fIobjectName\fR \fBchan\fR
.sp
\fIobjectName\fR \fBline\fR
.sp
\fIobjectName\fR \fBcolumn\fR
.sp
\fIobjectName\fR \fBcurrent\fR
.sp
\fIobjectName\fR \fBlocation\fR
.sp
\fIobjectName\fR \fBlocations\fR
.sp
\fIobjectName\fR \fBok\fR
.sp
\fIobjectName\fR \fBvalue\fR
.sp
\fIobjectName\fR \fBerror\fR
.sp
\fIobjectName\fR \fBerrors\fR
.sp
\fIobjectName\fR \fBtokens\fR ?\fIfrom\fR ?\fIto\fR??
.sp
\fIobjectName\fR \fBsymbols\fR
.sp
\fIobjectName\fR \fBknown\fR
.sp
\fIobjectName\fR \fBreducible\fR
.sp
\fIobjectName\fR \fBasts\fR
.sp
\fIobjectName\fR \fBast\fR
.sp
\fIobjectName\fR \fBposition\fR \fIloc\fR
.sp
\fIobjectName\fR \fBi_input_next\fR \fImsg\fR
.sp
\fIobjectName\fR \fBi_test_alnum\fR
.sp
\fIobjectName\fR \fBi_test_alpha\fR
.sp
\fIobjectName\fR \fBi_test_ascii\fR
.sp
\fIobjectName\fR \fBi_test_char\fR \fIchar\fR
.sp
\fIobjectName\fR \fBi_test_ddigit\fR
.sp
\fIobjectName\fR \fBi_test_digit\fR
.sp
\fIobjectName\fR \fBi_test_graph\fR
.sp
\fIobjectName\fR \fBi_test_lower\fR
.sp
\fIobjectName\fR \fBi_test_print\fR
.sp
\fIobjectName\fR \fBi_test_punct\fR
.sp
\fIobjectName\fR \fBi_test_range\fR \fIchars\fR \fIchare\fR
.sp
\fIobjectName\fR \fBi_test_space\fR
.sp
\fIobjectName\fR \fBi_test_upper\fR
.sp
\fIobjectName\fR \fBi_test_wordchar\fR
.sp
\fIobjectName\fR \fBi_test_xdigit\fR
.sp
\fIobjectName\fR \fBi_error_clear\fR
.sp
\fIobjectName\fR \fBi_error_push\fR
.sp
\fIobjectName\fR \fBi_error_pop_merge\fR
.sp
\fIobjectName\fR \fBi_error_nonterminal\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBi_status_ok\fR
.sp
\fIobjectName\fR \fBi_status_fail\fR
.sp
\fIobjectName\fR \fBi_status_negate\fR
.sp
\fIobjectName\fR \fBi_loc_push\fR
.sp
\fIobjectName\fR \fBi_loc_pop_discard\fR
.sp
\fIobjectName\fR \fBi_loc_pop_rewind\fR
.sp
\fIobjectName\fR \fBi:ok_loc_pop_rewind\fR
.sp
\fIobjectName\fR \fBi_loc_pop_rewind/discard\fR
.sp
\fIobjectName\fR \fBi_symbol_restore\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBi_symbol_save\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBi_value_clear\fR
.sp
\fIobjectName\fR \fBi_value_clear/leaf\fR
.sp
\fIobjectName\fR \fBi_value_clear/reduce\fR
.sp
\fIobjectName\fR \fBi:ok_ast_value_push\fR
.sp
\fIobjectName\fR \fBi_ast_push\fR
.sp
\fIobjectName\fR \fBi_ast_pop_rewind\fR
.sp
\fIobjectName\fR \fBi:fail_ast_pop_rewind\fR
.sp
\fIobjectName\fR \fBi_ast_pop_rewind/discard\fR
.sp
\fIobjectName\fR \fBi_ast_pop_discard\fR
.sp
\fIobjectName\fR \fBi_ast_pop_discard/rewind\fR
.sp
\fIobjectName\fR \fBi:ok_continue\fR
.sp
\fIobjectName\fR \fBi:fail_continue\fR
.sp
\fIobjectName\fR \fBi:fail_return\fR
.sp
\fIobjectName\fR \fBi:ok_return\fR
.sp
\fIobjectName\fR \fBsi:void_state_push\fR
.sp
\fIobjectName\fR \fBsi:void2_state_push\fR
.sp
\fIobjectName\fR \fBsi:value_state_push\fR
.sp
\fIobjectName\fR \fBsi:void_state_merge\fR
.sp
\fIobjectName\fR \fBsi:void_state_merge_ok\fR
.sp
\fIobjectName\fR \fBsi:value_state_merge\fR
.sp
\fIobjectName\fR \fBsi:value_notahead_start\fR
.sp
\fIobjectName\fR \fBsi:void_notahead_exit\fR
.sp
\fIobjectName\fR \fBsi:value_notahead_exit\fR
.sp
\fIobjectName\fR \fBsi:kleene_abort\fR
.sp
\fIobjectName\fR \fBsi:kleene_close\fR
.sp
\fIobjectName\fR \fBsi:voidvoid_branch\fR
.sp
\fIobjectName\fR \fBsi:voidvalue_branch\fR
.sp
\fIobjectName\fR \fBsi:valuevoid_branch\fR
.sp
\fIobjectName\fR \fBsi:valuevalue_branch\fR
.sp
\fIobjectName\fR \fBsi:voidvoid_part\fR
.sp
\fIobjectName\fR \fBsi:voidvalue_part\fR
.sp
\fIobjectName\fR \fBsi:valuevalue_part\fR
.sp
\fIobjectName\fR \fBsi:value_symbol_start\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:value_void_symbol_start\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:void_symbol_start\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:void_void_symbol_start\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:reduce_symbol_end\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:void_leaf_symbol_end\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:value_leaf_symbol_end\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:value_clear_symbol_end\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:void_clear_symbol_end\fR \fIsymbol\fR
.sp
\fIobjectName\fR \fBsi:next_char\fR \fItok\fR
.sp
\fIobjectName\fR \fBsi:next_range\fR \fItoks\fR \fItoke\fR
.sp
\fIobjectName\fR \fBsi:next_alnum\fR
.sp
\fIobjectName\fR \fBsi:next_alpha\fR
.sp
\fIobjectName\fR \fBsi:next_ascii\fR
.sp
\fIobjectName\fR \fBsi:next_ddigit\fR
.sp
\fIobjectName\fR \fBsi:next_digit\fR
.sp
\fIobjectName\fR \fBsi:next_graph\fR
.sp
\fIobjectName\fR \fBsi:next_lower\fR
.sp
\fIobjectName\fR \fBsi:next_print\fR
.sp
\fIobjectName\fR \fBsi:next_punct\fR
.sp
\fIobjectName\fR \fBsi:next_space\fR
.sp
\fIobjectName\fR \fBsi:next_upper\fR
.sp
\fIobjectName\fR \fBsi:next_wordchar\fR
.sp
\fIobjectName\fR \fBsi:next_xdigit\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package provides a class whose instances provide the runtime
support for recursive descent parsers with backtracking, as is needed
for the execution of, for example, parsing expression grammars. It
implements the \fIPackRat Machine Specification\fR, as such that
document is \fIrequired\fR reading to understand both this manpage,
and the package itself. The description below does make numerous
shorthand references to the PARAM's instructions and the various parts
of its architectural state.
.PP
The package resides in the Execution section of the Core Layer of
Parser Tools.
.PP
IMAGE: arch_core_transform
.PP
.PP
Note: This package not only has the standard Tcl implementation, but
also an accelerator, i.e. a C implementation, based on Critcl.
.PP
.SS "CLASS API"
The package exports the API described here.
.TP
\fB::pt::rde\fR \fIobjectName\fR
The command creates a new runtime object for a recursive descent
parser with backtracking and returns the fully qualified name of the
object command as its result. The API of this object command is
described in the section \fBObject API\fR. It may be used to
invoke various operations on the object.
.PP
.SS "OBJECT API"
All objects created by this package provide the following 63 methods
for the manipulation and querying of their state, which is, in essence
the architectural state of a PARAM.
.PP
First some general methods and the state accessors.
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object, releasing all claimed memory, and
deleting the associated object command.
.TP
\fIobjectName\fR \fBreset\fR \fIchan\fR
This method resets the state of the runtme to its defaults, preparing
it for the parsing of the character in the channel \fIchan\fR, which
becomes IN.
.sp
Note here that the Parser Tools are based on Tcl 8.5+. In other words,
the channel argument is not restricted to files, sockets, etc. We have
the full power of \fIreflected channels\fR available.
.sp
It should also be noted that the parser pulls the characters from the
input stream as it needs them. If a parser created by this package has
to be operated in a push aka event-driven manner it will be necessary
to go to Tcl 8.6+ and use the \fBcoroutine::auto\fR to wrap it
into a coroutine where \fBread\fR is properly changed for
push-operation.
.TP
\fIobjectName\fR \fBcomplete\fR
This method completes parsing, either returning the AST made from the
elements of ARS, or throwing an error containing the current ER.
.TP
\fIobjectName\fR \fBchan\fR
This method returns the handle of the channel which is IN.
.TP
\fIobjectName\fR \fBline\fR
This method returns the line number for the position IN is currently
at. Note that this may not match with the line number for CL, due to
backtracking.
.TP
\fIobjectName\fR \fBcolumn\fR
This method returns the column for the position IN is currently
at. Note that this may not match with the column for CL, due to
backtracking.
.TP
\fIobjectName\fR \fBcurrent\fR
This method returns CC.
.TP
\fIobjectName\fR \fBlocation\fR
This method returns CL.
.TP
\fIobjectName\fR \fBlocations\fR
This method returns the LS. The topmost entry of the stack will be the
first element of the returned list.
.TP
\fIobjectName\fR \fBok\fR
This method returns ST.
.TP
\fIobjectName\fR \fBvalue\fR
This method returns SV.
.TP
\fIobjectName\fR \fBerror\fR
This method returns ER. This is either the empty string for an empty
ER, or a list of 2 elements, the location the error is for, and a set
of messages which specify which symbols were expected at the
location. The messages are encoded as one of the possible atomic
parsing expressions (special operators, terminal, range, and
nonterminal operator).
.TP
\fIobjectName\fR \fBerrors\fR
This method returns ES. The topmost entry of the stack will be the
first element of the returned list. Each entry is encoded as described
for \fBerror\fR.
.TP
\fIobjectName\fR \fBtokens\fR ?\fIfrom\fR ?\fIto\fR??
This method returns the part of TC for the range of locations of IN
starting at \fIfrom\fR and ending at \fIto\fR. If \fIto\fR is not
specified it is taken as identical to \fIfrom\fR. If neither argument
is specified the whole of TC is returned.
.sp
Each token in the returned list is a list of three elements itself,
containing the character at the location, and the associated line and
column numbers, in this order.
.TP
\fIobjectName\fR \fBsymbols\fR
This method returns a dictionary containing NC. Keys are two-element
lists containing nonterminal symbol and location, in this order. The
values are 4-tuples containing CL, ST, ER, and SV, in this order. ER
is encoded as specified for the method \fBerror\fR.
.TP
\fIobjectName\fR \fBknown\fR
This method returns a list containing the keys of SC. They are
encoded in the same manner as is done by method \fBsymbols\fR.
.TP
\fIobjectName\fR \fBreducible\fR
This method returns ARS. The topmost entry of the stack will be the
first element of the returned list
.TP
\fIobjectName\fR \fBasts\fR
This method returns AS. The topmost entry of the stack will be the
first element of the returned list
.TP
\fIobjectName\fR \fBast\fR
This is a convenience method returning the topmost element of ARS.
.TP
\fIobjectName\fR \fBposition\fR \fIloc\fR
This method returns the line and column numbers for the specified
location of IN, assuming that this location has already been reached
during the parsing process.
.PP
The following methods implement all PARAM instructions. They all have
the prefix "i_".
.PP
The control flow is mainly provided by Tcl's builtin commands, like
\fBif\fR, \fBwhile\fR, etc., plus a few guarded variants of PARAM
instructions and Tcl commands.. That means that these instruction
variants will do nothing if their guard condition is not
fulfilled. They can be recognized by the prefix "i:ok_" and "i:fail_",
which denote the value ST has to have for the instruction to execute.
.PP
The instructions are listed in the same order they occur in the
\fIPackRat Machine Specification\fR, with the guard variants
listed after their regular implementation, if any, or in their place.
.TP
\fIobjectName\fR \fBi_input_next\fR \fImsg\fR
This method implements the PARAM instruction \fBinput_next\fR.
.TP
\fIobjectName\fR \fBi_test_alnum\fR
This method implements the PARAM instruction \fBtest_alnum\fR.
.TP
\fIobjectName\fR \fBi_test_alpha\fR
This method implements the PARAM instruction \fBtest_alpha\fR.
.TP
\fIobjectName\fR \fBi_test_ascii\fR
This method implements the PARAM instruction \fBtest_ascii\fR.
.TP
\fIobjectName\fR \fBi_test_char\fR \fIchar\fR
This method implements the PARAM instruction \fBtest_char\fR.
.TP
\fIobjectName\fR \fBi_test_ddigit\fR
This method implements the PARAM instruction \fBtest_ddigit\fR.
.TP
\fIobjectName\fR \fBi_test_digit\fR
This method implements the PARAM instruction \fBtest_digit\fR.
.TP
\fIobjectName\fR \fBi_test_graph\fR
This method implements the PARAM instruction \fBtest_graph\fR.
.TP
\fIobjectName\fR \fBi_test_lower\fR
This method implements the PARAM instruction \fBtest_lower\fR.
.TP
\fIobjectName\fR \fBi_test_print\fR
This method implements the PARAM instruction \fBtest_print\fR.
.TP
\fIobjectName\fR \fBi_test_punct\fR
This method implements the PARAM instruction \fBtest_punct\fR.
.TP
\fIobjectName\fR \fBi_test_range\fR \fIchars\fR \fIchare\fR
This method implements the PARAM instruction \fBtest_range\fR.
.TP
\fIobjectName\fR \fBi_test_space\fR
This method implements the PARAM instruction \fBtest_space\fR.
.TP
\fIobjectName\fR \fBi_test_upper\fR
This method implements the PARAM instruction \fBtest_upper\fR.
.TP
\fIobjectName\fR \fBi_test_wordchar\fR
This method implements the PARAM instruction \fBtest_wordchar\fR.
.TP
\fIobjectName\fR \fBi_test_xdigit\fR
This method implements the PARAM instruction \fBtest_xdigit\fR.
.TP
\fIobjectName\fR \fBi_error_clear\fR
This method implements the PARAM instruction \fBerror_clear\fR.
.TP
\fIobjectName\fR \fBi_error_push\fR
This method implements the PARAM instruction \fBerror_push\fR.
.TP
\fIobjectName\fR \fBi_error_pop_merge\fR
This method implements the PARAM instruction \fBerror_pop_merge\fR.
.TP
\fIobjectName\fR \fBi_error_nonterminal\fR \fIsymbol\fR
This method implements the PARAM instruction \fBerror_nonterminal\fR.
.TP
\fIobjectName\fR \fBi_status_ok\fR
This method implements the PARAM instruction \fBstatus_ok\fR.
.TP
\fIobjectName\fR \fBi_status_fail\fR
This method implements the PARAM instruction \fBstatus_fail\fR.
.TP
\fIobjectName\fR \fBi_status_negate\fR
This method implements the PARAM instruction \fBstatus_negate\fR.
.TP
\fIobjectName\fR \fBi_loc_push\fR
This method implements the PARAM instruction \fBloc_push\fR.
.TP
\fIobjectName\fR \fBi_loc_pop_discard\fR
This method implements the PARAM instruction \fBloc_pop_discard\fR.
.TP
\fIobjectName\fR \fBi_loc_pop_rewind\fR
This method implements the PARAM instruction \fBloc_pop_rewind\fR.
.TP
\fIobjectName\fR \fBi:ok_loc_pop_rewind\fR
This guarded method, a variant of \fBi_loc_pop_rewind\fR, executes only
for "ST == ok".
.TP
\fIobjectName\fR \fBi_loc_pop_rewind/discard\fR
This method is a convenient combination of control flow and the two
PARAM instructions \fBloc_pop_rewind\fR and \fBloc_pop_discard\fR. The former
is executed for "ST == fail", the latter for "ST == ok".
.TP
\fIobjectName\fR \fBi_symbol_restore\fR \fIsymbol\fR
This method implements the PARAM instruction \fBsymbol_restore\fR.
.sp
The boolean result of the check is returned as the result of
the method and can be used with standard Tcl control flow commands.
.TP
\fIobjectName\fR \fBi_symbol_save\fR \fIsymbol\fR
This method implements the PARAM instruction \fBsymbol_save\fR.
.TP
\fIobjectName\fR \fBi_value_clear\fR
This method implements the PARAM instruction \fBvalue_clear\fR.
.TP
\fIobjectName\fR \fBi_value_clear/leaf\fR
This method is a convenient combination of control flow and the two
PARAM instructions \fBvalue_clear\fR and \fBvalue_leaf\fR. The former
is executed for "ST == fail", the latter for "ST == ok".
.TP
\fIobjectName\fR \fBi_value_clear/reduce\fR
This method is a convenient combination of control flow and the two
PARAM instructions \fBvalue_clear\fR and \fBvalue_reduce\fR. The former
is executed for "ST == fail", the latter for "ST == ok".
.TP
\fIobjectName\fR \fBi:ok_ast_value_push\fR
This method implements a guarded variant of the the PARAM instruction
\fBast_value_push\fR, which executes only for "ST == ok".
.TP
\fIobjectName\fR \fBi_ast_push\fR
This method implements the PARAM instruction \fBast_push\fR.
.TP
\fIobjectName\fR \fBi_ast_pop_rewind\fR
This method implements the PARAM instruction \fBast_pop_rewind\fR.
.TP
\fIobjectName\fR \fBi:fail_ast_pop_rewind\fR
This guarded method, a variant of \fBi_ast_pop_rewind\fR, executes only
for "ST == fail".
.TP
\fIobjectName\fR \fBi_ast_pop_rewind/discard\fR
This method is a convenient combination of control flow and the two
PARAM instructions \fBast_pop_rewind\fR and \fBast_pop_discard\fR. The former
is executed for "ST == fail", the latter for "ST == ok".
.TP
\fIobjectName\fR \fBi_ast_pop_discard\fR
This method implements the PARAM instruction \fBast_pop_discard\fR.
.TP
\fIobjectName\fR \fBi_ast_pop_discard/rewind\fR
This method is a convenient combination of control flow and the two
PARAM instructions \fBast_pop_discard\fR and \fBast_pop_rewind\fR. The former
is executed for "ST == fail", the latter for "ST == ok".
.TP
\fIobjectName\fR \fBi:ok_continue\fR
This guarded method executes only for "ST == ok". Then it aborts the
current iteration of the innermost loop in the calling Tcl procedure.
.TP
\fIobjectName\fR \fBi:fail_continue\fR
This guarded method executes only for "ST == fail". Then it aborts the
current iteration of the innermost loop in the calling Tcl procedure.
.TP
\fIobjectName\fR \fBi:fail_return\fR
This guarded method executes only for "ST == fail". Then it aborts the
calling Tcl procedure.
.TP
\fIobjectName\fR \fBi:ok_return\fR
This guarded method executes only for "ST == ok". Then it aborts the
calling Tcl procedure.
.PP
.PP
The next set of methods are \fIsuper instructions\fR, meaning that
each implements a longer sequence of instructions commonly used in
parsers. The combinated instructions of the previous set, i.e. those
with names matching the pattern "i_*/*", are actually super
instructions as well, albeit with limited scope, handling 2
instructions with their control flow. The upcoming set is much broader
in scope, folding as much as six or more PARAM instructions into a
single method call.
.PP
In this we can see the reasoning behind their use well:
.IP [1]
By using less instructions the generated parsers become smaller, as
the common parts are now truly part of the common runtime, and not
explicitly written in the parser's code over and over again.
.IP [2]
Using less instructions additionally reduces the overhead associated
with calls into the runtime, i.e. the cost of method dispatch and of
setting up the variable context.
.IP [3]
Another effect of the super instructions is that their internals can
be optimized as well, especially regarding control flow, and stack
use, as the runtime internals are accessible to all instructions
folded into the sequence.
.PP
.PP
.TP
\fIobjectName\fR \fBsi:void_state_push\fR
This method combines
.CS


i_loc_push
i_error_clear
i_error_push

.CE
.IP
Parsers use it at the beginning of \fIvoid\fR sequences and choices
with a \fIvoid\fR initial branch.
.TP
\fIobjectName\fR \fBsi:void2_state_push\fR
This method combines
.CS


i_loc_push
i_error_clear
i_error_push

.CE
.IP
Parsers use it at the beginning of optional and repeated expressions.
.TP
\fIobjectName\fR \fBsi:value_state_push\fR
This method combines
.CS


i_ast_push
i_loc_push
i_error_clear
i_error_push

.CE
.IP
Parsers use it at the beginning of sequences generating an AST and
choices with an initial branch generating an AST.
.TP
\fIobjectName\fR \fBsi:void_state_merge\fR
This method combines
.CS


i_error_pop_merge
i_loc_pop_rewind/discard

.CE
.IP
Parsers use it at the end of void sequences and choices whose last
branch is void.
.TP
\fIobjectName\fR \fBsi:void_state_merge_ok\fR
This method combines
.CS


i_error_pop_merge
i_loc_pop_rewind/discard
i_status_ok

.CE
.IP
Parsers use it at the end of optional expressions
.TP
\fIobjectName\fR \fBsi:value_state_merge\fR
This method combines
.CS


i_error_pop_merge
i_ast_pop_rewind/discard
i_loc_pop_rewind/discard

.CE
.IP
Parsers use it at the end of sequences generating ASTs and choices
whose last branch generates an AST
.TP
\fIobjectName\fR \fBsi:value_notahead_start\fR
This method combines
.CS


i_loc_push
i_ast_push

.CE
.IP
Parsers use it at the beginning of negative lookahead predicates which
generate ASTs.
.TP
\fIobjectName\fR \fBsi:void_notahead_exit\fR
This method combines
.CS


i_loc_pop_rewind
i_status_negate

.CE
.IP
Parsers use it at the end of void negative lookahead predicates.
.TP
\fIobjectName\fR \fBsi:value_notahead_exit\fR
This method combines
.CS


i_ast_pop_discard/rewind
i_loc_pop_rewind
i_status_negate

.CE
.IP
Parsers use it at the end of negative lookahead predicates which
generate ASTs.
.TP
\fIobjectName\fR \fBsi:kleene_abort\fR
This method combines
.CS


i_loc_pop_rewind/discard
i:fail_return

.CE
.IP
Parsers use it to stop a positive repetition when its first, required, expression fails.
.TP
\fIobjectName\fR \fBsi:kleene_close\fR
This method combines
.CS


i_error_pop_merge
i_loc_pop_rewind/discard
i:fail_status_ok
i:fail_return

.CE
.IP
Parsers use it at the end of repetitions.
.TP
\fIobjectName\fR \fBsi:voidvoid_branch\fR
This method combines
.CS


i_error_pop_merge
i:ok_loc_pop_discard
i:ok_return
i_loc_rewind
i_error_push

.CE
.IP
Parsers use it when transiting between branches of a choice when both are void.
.TP
\fIobjectName\fR \fBsi:voidvalue_branch\fR
This method combines
.CS


i_error_pop_merge
i:ok_loc_pop_discard
i:ok_return
i_ast_push
i_loc_rewind
i_error_push

.CE
.IP
Parsers use it when transiting between branches of a choice when the
failing branch is void, and the next to test generates an AST.
.TP
\fIobjectName\fR \fBsi:valuevoid_branch\fR
This method combines
.CS


i_error_pop_merge
i_ast_pop_rewind/discard
i:ok_loc_pop_discard
i:ok_return
i_loc_rewind
i_error_push

.CE
.IP
Parsers use it when transiting between branches of a choice when the
failing branch generates an AST, and the next to test is void.
.TP
\fIobjectName\fR \fBsi:valuevalue_branch\fR
This method combines
.CS


i_error_pop_merge
i_ast_pop_discard
i:ok_loc_pop_discard
i:ok_return
i_ast_rewind
i_loc_rewind
i_error_push

.CE
.IP
Parsers use it when transiting between branches of a choice when both
generate ASTs.
.TP
\fIobjectName\fR \fBsi:voidvoid_part\fR
This method combines
.CS


i_error_pop_merge
i:fail_loc_pop_rewind
i:fail_return
i_error_push

.CE
.IP
Parsers use it when transiting between parts of a sequence and both
are void.
.TP
\fIobjectName\fR \fBsi:voidvalue_part\fR
This method combines
.CS


i_error_pop_merge
i:fail_loc_pop_rewind
i:fail_return
i_ast_push
i_error_push

.CE
.IP
Parsers use it when transiting between parts of a sequence and the
sucessfully matched part is void, and after it an AST is generated.
.TP
\fIobjectName\fR \fBsi:valuevalue_part\fR
This method combines
.CS


i_error_pop_merge
i:fail_ast_pop_rewind
i:fail_loc_pop_rewind
i:fail_return
i_error_push

.CE
.IP
Parsers use it when transiting between parts of a sequence and both
parts generate ASTs.
.TP
\fIobjectName\fR \fBsi:value_symbol_start\fR \fIsymbol\fR
This method combines
.CS


if/found? i_symbol_restore $symbol
i:found:ok_ast_value_push
i:found_return
i_loc_push
i_ast_push

.CE
.IP
Parsers use it at the beginning of a nonterminal symbol generating an
AST, whose right-hand side may have generated an AST as well.
.TP
\fIobjectName\fR \fBsi:value_void_symbol_start\fR \fIsymbol\fR
This method combines
.CS


if/found? i_symbol_restore $symbol
i:found:ok_ast_value_push
i:found_return
i_loc_push
i_ast_push

.CE
.IP
Parsers use it at the beginning of a void nonterminal symbol whose
right-hand side may generate an AST.
.TP
\fIobjectName\fR \fBsi:void_symbol_start\fR \fIsymbol\fR
This method combines
.CS


if/found? i_symbol_restore $symbol
i:found_return
i_loc_push
i_ast_push

.CE
.IP
Parsers use it at the beginning of a nonterminal symbol generating an
AST whose right-hand side is void.
.TP
\fIobjectName\fR \fBsi:void_void_symbol_start\fR \fIsymbol\fR
This method combines
.CS


if/found? i_symbol_restore $symbol
i:found_return
i_loc_push

.CE
.IP
Parsers use it at  the beginning of a void nonterminal symbol whose
right-hand side is void as well.
.TP
\fIobjectName\fR \fBsi:reduce_symbol_end\fR \fIsymbol\fR
This method combines
.CS


i_value_clear/reduce $symbol
i_symbol_save        $symbol
i_error_nonterminal  $symbol
i_ast_pop_rewind
i_loc_pop_discard
i:ok_ast_value_push

.CE
.IP
Parsers use it at the end of a non-terminal symbol generating an AST
using the AST generated by the right-hand side as child.
.TP
\fIobjectName\fR \fBsi:void_leaf_symbol_end\fR \fIsymbol\fR
This method combines
.CS


i_value_clear/leaf  $symbol
i_symbol_save       $symbol
i_error_nonterminal $symbol
i_loc_pop_discard
i:ok_ast_value_push

.CE
.IP
Parsers use it at the end of a non-terminal symbol generating an AST
whose right-hand side is void.
.TP
\fIobjectName\fR \fBsi:value_leaf_symbol_end\fR \fIsymbol\fR
This method combines
.CS


i_value_clear/leaf  $symbol
i_symbol_save       $symbol
i_error_nonterminal $symbol
i_loc_pop_discard
i_ast_pop_rewind
i:ok_ast_value_push

.CE
.IP
Parsers use it at the end of a non-terminal symbol generating an AST
discarding the AST generated by the right-hand side.
.TP
\fIobjectName\fR \fBsi:value_clear_symbol_end\fR \fIsymbol\fR
This method combines
.CS


i_value_clear
i_symbol_save       $symbol
i_error_nonterminal $symbol
i_loc_pop_discard
i_ast_pop_rewind

.CE
.IP
Parsers use it at the end of a void non-terminal symbol, discarding
the AST generated by the right-hand side.
.TP
\fIobjectName\fR \fBsi:void_clear_symbol_end\fR \fIsymbol\fR
This method combines
.CS


i_value_clear
i_symbol_save       $symbol
i_error_nonterminal $symbol
i_loc_pop_discard

.CE
.IP
Parsers use it at the end of a void non-terminal symbol with a void
right-hand side.
.TP
\fIobjectName\fR \fBsi:next_char\fR \fItok\fR
.TP
\fIobjectName\fR \fBsi:next_range\fR \fItoks\fR \fItoke\fR
.TP
\fIobjectName\fR \fBsi:next_alnum\fR
.TP
\fIobjectName\fR \fBsi:next_alpha\fR
.TP
\fIobjectName\fR \fBsi:next_ascii\fR
.TP
\fIobjectName\fR \fBsi:next_ddigit\fR
.TP
\fIobjectName\fR \fBsi:next_digit\fR
.TP
\fIobjectName\fR \fBsi:next_graph\fR
.TP
\fIobjectName\fR \fBsi:next_lower\fR
.TP
\fIobjectName\fR \fBsi:next_print\fR
.TP
\fIobjectName\fR \fBsi:next_punct\fR
.TP
\fIobjectName\fR \fBsi:next_space\fR
.TP
\fIobjectName\fR \fBsi:next_upper\fR
.TP
\fIobjectName\fR \fBsi:next_wordchar\fR
.TP
\fIobjectName\fR \fBsi:next_xdigit\fR
These methods all combine
.CS


i_input_next $msg
i:fail_return

.CE
.IP
with the appropriate \fBi_test_xxx\fR instruction. Parsers use them for
handling atomic expressions.
.PP
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_tclparam_config_snit.n.















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_tclparam_config_snit.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::tclparam::configuration::snit" n 1.0.1 tcllib "Parser Tools"
.BS
.SH NAME
pt::tclparam::configuration::snit \- Tcl/PARAM, Canned configuration, Snit
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::tclparam::configuration::snit  ?1.0.1?\fR
.sp
\fB::pt::tclparam::configuration::snit\fR \fBdef\fR \fIname\fR \fIcmdprefix\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package is an adjunct to \fBpt::peg::to::tclparam\fR, to make
the use of this highly configurable package easier by providing a
canned configuration. When applied this configuration causes the
package \fBpt::peg::to::tclparam\fR to generate
\fBsnit\fR-based parser packages.
.PP
It is a supporting package in the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_support
.PP
.SH API
.TP
\fB::pt::tclparam::configuration::snit\fR \fBdef\fR \fIname\fR \fIcmdprefix\fR
The command applies the configuration provided by this package to the
\fIcmdprefix\fR, causing the creation of \fBsnit\fR-based parsers
whose class is \fIname\fR.
.sp
The use of a command prefix as API allows application of the
configuration to not only \fBpt::peg::to::tclparam\fR
(\fBpt::peg::to::tclparam configure\fR), but also export manager
instances and PEG containers (\fB$export configuration set\fR and
\fB[$container exporter] configuration set\fR respectively).
.sp
Or anything other command prefix accepting two arguments, option and
value.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_tclparam_config_tcloo.n.















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_tclparam_config_tcloo.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt::tclparam::configuration::tcloo" n 1.0.1 tcllib "Parser Tools"
.BS
.SH NAME
pt::tclparam::configuration::tcloo \- Tcl/PARAM, Canned configuration, Tcloo
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBpt::tclparam::configuration::tcloo  ?1.0.1?\fR
.sp
\fB::pt::tclparam::configuration::tcloo\fR \fBdef\fR \fIname\fR \fIcmdprefix\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This package is an adjunct to \fBpt::peg::to::tclparam\fR, to make
the use of this highly configurable package easier by providing a
canned configuration. When applied this configuration causes the
package \fBpt::peg::to::tclparam\fR to generate
\fBOO\fR-based parser packages.
.PP
It is a supporting package in the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_support
.PP
.SH API
.TP
\fB::pt::tclparam::configuration::tcloo\fR \fBdef\fR \fIname\fR \fIcmdprefix\fR
The command applies the configuration provided by this package to the
\fIcmdprefix\fR, causing the creation of \fBOO\fR-based parsers
whose class is \fIname\fR.
.sp
The use of a command prefix as API allows application of the
configuration to not only \fBpt::peg::to::tclparam\fR
(\fBpt::peg::to::tclparam configure\fR), but also export manager
instances and PEG containers (\fB$export configuration set\fR and
\fB[$container exporter] configuration set\fR respectively).
.sp
Or anything other command prefix accepting two arguments, option and
value.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/pt/pt_to_api.n.




















































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/pt/pt_to_api.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "pt_export_api" i 1 tcllib "Parser Tools"
.BS
.SH NAME
pt_export_api \- Parser Tools Export API
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
\fBCONVERTER\fR \fBreset\fR
.sp
\fBCONVERTER\fR \fBconfigure\fR
.sp
\fBCONVERTER\fR \fBconfigure\fR \fIoption\fR
.sp
\fBCONVERTER\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fBCONVERTER\fR \fBconvert\fR \fIserial\fR
.sp
\fB::export\fR \fIserial\fR \fIconfiguration\fR
.sp
.BE
.SH DESCRIPTION
.PP
Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
\fIIntroduction to Parser Tools\fR. This document is the
entrypoint to the whole system the current package is a part of.
.PP
This document describes two APIs. First the API shared by all packages
for the conversion of Parsing Expression Grammars into some other
format, and then the API shared by the packages which implement the
export plugins sitting on top of the conversion packages.
.PP
Its intended audience are people who wish to create their own
converter for some type of output, and/or an export plugin for
their or some other converter.
.PP
It resides in the Export section of the Core Layer of Parser Tools.
.PP
IMAGE: arch_core_export
.PP
.SH "CONVERTER API"
Any (grammar) export converter has to follow the rules set out below:
.IP [1]
A converter is a package. Its name is arbitrary, however it is
recommended to put it under the \fB::pt::peg::to\fR
namespace.
.IP [2]
The package provides either a single Tcl command following the
API outlined below, or a class command whose instances follow
the same API. The commands which follow the API are called
\fIconverter commands\fR.
.IP [3]
A converter command has to provide the following three methods
with the given signatures and semantics. Converter commands
are allowed to provide more methods of their own, but not
less, and they may not provide different semantics for the
standardized methods.
.RS
.TP
\fBCONVERTER\fR \fBreset\fR
This method has to reset the configuration of the converter to its
default settings. The result of the method has to be the empty
string.
.TP
\fBCONVERTER\fR \fBconfigure\fR
This method, in this form, has to return a dictionary containing the
current configuration of the converter.
.TP
\fBCONVERTER\fR \fBconfigure\fR \fIoption\fR
This method, in this form, has to return the current value of the
specified configuration \fIoption\fR of the converter.
.sp
Please read the section \fBOptions\fR for the set of standard
options any converter has to accept.
Any other options accepted by a specific converter will be described
in its manpage.
.TP
\fBCONVERTER\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
This command, in this form, sets the specified \fIoption\fRs of the
converter to the given \fIvalue\fRs.
.sp
Please read the section \fBOptions\fR for the set of standard
options a converter has to accept.
Any other options accepted by a specific converter will be described
in its manpage.
.TP
\fBCONVERTER\fR \fBconvert\fR \fIserial\fR
This method has to accept the canonical serialization of a parsing
expression grammar, as specified in section
\fBPEG serialization format\fR, and contained in \fIserial\fR.
The result of the method has to be the result of converting the input
grammar into whatever the converter is for, per its configuration.
.RE
.PP
.SH "PLUGIN API"
Any (grammar) export plugin has to follow the rules set out below:
.IP [1]
A plugin is a package.
.IP [2]
The name of a plugin package has the form
pt::peg::export::\fBFOO\fR,
where \fBFOO\fR is the name of the format the plugin will
generate output for.
.IP [3]
The plugin can expect that the package
\fBpt::peg::export::plugin\fR is present, as
indicator that it was invoked from a genuine plugin manager.
.sp
It is recommended that a plugin does check for the presence of
this package.
.IP [4]
A plugin has to provide a single command, in the global
namespace, with the signature shown below. Plugins are allowed
to provide more command of their own, but not less, and they
may not provide different semantics for the standardized
command.
.RS
.TP
\fB::export\fR \fIserial\fR \fIconfiguration\fR
This command has to accept the canonical serialization of a parsing
expression grammar and the configuration for the converter invoked by
the plugin. The result of the command has to be the result of the
converter invoked by the plugin for th input grammar and
configuration.
.RS
.TP
string \fIserial\fR
This argument will contain the \fIcanonical\fR serialization of the
parsing expression grammar for which to generate the output.
The specification of what a \fIcanonical\fR serialization is can be
found in the section \fBPEG serialization format\fR.
.TP
dictionary \fIconfiguration\fR
This argument will contain the configuration to configure the
converter with before invoking it, as a dictionary mapping from
options to values.
.sp
Please read the section \fBOptions\fR for the set of standard
options any converter has to accept, and thus any plugin as well.
Any other options accepted by a specific plugin will be described in
its manpage.
.RE
.RE
.IP [5]
A single usage cycle of a plugin consists of an invokation of
the command \fBexport\fR. This call has to leave the plugin in
a state where another usage cycle can be run without problems.
.PP
.SH OPTIONS
Each export converter and plugin for an export converter has to accept
the options below in their \fBconfigure\fR method. Converters are
allowed to ignore the contents of these options when performing a
conversion, but they must not reject them. Plugins are expected to
pass the options given to them to the converter they are invoking.
.TP
\fB-file\fR string
The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is \fBunknown\fR.
.TP
\fB-name\fR string
The value of this option is the name of the grammar we are processing.
The default value is \fBa_pe_grammar\fR.
.TP
\fB-user\fR string
The value of this option is the name of the user for which the command
is run. The default value is \fBunknown\fR.
.PP
.SH USAGE
To use a converter do
.CS


    # Get the converter (single command here, not class)
    package require the-converter-package

    # Provide a configuration
    theconverter configure ...

    # Perform the conversion
    set result [theconverter convert $thegrammarserial]

    ... process the result ...

.CE
To use a plugin \fBFOO\fR do
.CS


    # Get an export plugin manager
    package require pt::peg::export
    pt::peg::export E

    # Provide a configuration
    E configuration set ...

    # Run the plugin, and the converter inside.
    set result [E export serial $grammarserial FOO]

    ... process the result ...

.CE
.SH "PEG SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be \fIcanonical\fR.
.TP
regular serialization
.RS
.IP [1]
The serialization of any PEG is a nested Tcl dictionary.
.IP [2]
This dictionary holds a single key, \fBpt::grammar::peg\fR, and its
value. This value holds the contents of the grammar.
.IP [3]
The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are
.RS
.TP
\fBrules\fR
The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.
.RS
.IP [1]
Each nonterminal symbol may occur only once.
.IP [2]
The empty string is not a legal nonterminal symbol.
.IP [3]
The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are
.RS
.TP
\fBis\fR
The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
\fBPE serialization format\fR.
.TP
\fBmode\fR
The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.
.RS
.TP
\fBvalue\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.
.TP
\fBleaf\fR
The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.
.TP
\fBvoid\fR
The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).
.RE
.RE
.RE
.TP
\fBstart\fR
The value is the serialization of the start parsing expression of the
grammar, as specified in the section \fBPE serialization format\fR.
.RE
.IP [4]
The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.
.RE
.TP
canonical serialization
The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.
.RS
.IP [1]
The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
\fBlsort -increasing -dict\fR.
.IP [2]
The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.
.RE
.PP
.SS EXAMPLE
Assuming the following PEG for simple mathematical expressions
.PP
.CS


PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}

.CE
.PP
.SH "PE SERIALIZATION FORMAT"
Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.
.PP
We distinguish between \fIregular\fR and \fIcanonical\fR
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be \fIcanonical\fR.
.TP
Regular serialization
.RS
.TP
\fBAtomic Parsing Expressions\fR
.RS
.IP [1]
The string \fBepsilon\fR is an atomic parsing expression. It matches
the empty string.
.IP [2]
The string \fBdot\fR is an atomic parsing expression. It matches
any character.
.IP [3]
The string \fBalnum\fR is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command \fBstring is\fR.
.IP [4]
The string \fBalpha\fR is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [5]
The string \fBascii\fR is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [6]
The string \fBcontrol\fR is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [7]
The string \fBdigit\fR is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [8]
The string \fBgraph\fR is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [9]
The string \fBlower\fR is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [10]
The string \fBprint\fR is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [11]
The string \fBpunct\fR is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [12]
The string \fBspace\fR is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command \fBstring is\fR.
.IP [13]
The string \fBupper\fR is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command \fBstring is\fR.
.IP [14]
The string \fBwordchar\fR is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command \fBstring is\fR.
.IP [15]
The string \fBxdigit\fR is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command \fBstring is\fR.
.IP [16]
The string \fBddigit\fR is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command \fBregexp\fR.
.IP [17]
The expression
[list t \fBx\fR]
is an atomic parsing expression. It matches the terminal string \fBx\fR.
.IP [18]
The expression
[list n \fBA\fR]
is an atomic parsing expression. It matches the nonterminal \fBA\fR.
.RE
.TP
\fBCombined Parsing Expressions\fR
.RS
.IP [1]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list / \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIordered choice\fR, aka \fIprioritized choice\fR.
.IP [2]
For parsing expressions \fBe1\fR, \fBe2\fR, ... the result of
[list x \fBe1\fR \fBe2\fR ... ]
is a parsing expression as well.
This is the \fIsequence\fR.
.IP [3]
For a parsing expression \fBe\fR the result of
[list * \fBe\fR]
is a parsing expression as well.
This is the \fIkleene closure\fR, describing zero or more
repetitions.
.IP [4]
For a parsing expression \fBe\fR the result of
[list + \fBe\fR]
is a parsing expression as well.
This is the \fIpositive kleene closure\fR, describing one or more
repetitions.
.IP [5]
For a parsing expression \fBe\fR the result of
[list & \fBe\fR]
is a parsing expression as well.
This is the \fIand lookahead predicate\fR.
.IP [6]
For a parsing expression \fBe\fR the result of
[list ! \fBe\fR]
is a parsing expression as well.
This is the \fInot lookahead predicate\fR.
.IP [7]
For a parsing expression \fBe\fR the result of
[list ? \fBe\fR]
is a parsing expression as well.
This is the \fIoptional input\fR.
.RE
.RE
.TP
Canonical serialization
The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.
.RS
.IP [1]
The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.
.IP [2]
Terminals are \fInot\fR encoded as ranges (where start and end of the
range are identical).
.RE
.PP
.PP
.SS EXAMPLE
Assuming the parsing expression shown on the right-hand side of the
rule
.PP
.CS


    Expression <- Term (AddOp Term)*

.CE
.PP
then its canonical serialization (except for whitespace) is
.PP
.CS


    {x {n Term} {* {x {n AddOp} {n Term}}}}

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIpt\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer
.SH CATEGORY
Parsing and Grammars
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/rc4/rc4.n.



































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/rc4/rc4.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "rc4" n 1.1.0 tcllib "RC4 Stream Cipher"
.BS
.SH NAME
rc4 \- Implementation of the RC4 stream cipher
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBrc4  ?1.1.0?\fR
.sp
\fB::rc4::rc4\fR ?\fI-hex\fR? \fI-key keyvalue\fR ?\fI-command lst\fR? ?\fI-out channel\fR? [ \fI-in channel\fR | \fI-infile filename\fR | \fIstring\fR ]
.sp
\fB::rc4::RC4Init\fR \fIkeydata\fR
.sp
\fB::rc4::RC4\fR \fIKey\fR \fIdata\fR
.sp
\fB::rc4::RC4Final\fR \fIKey\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package is an implementation in Tcl of the RC4 stream cipher
developed by Ron Rivest of RSA Data Security Inc. The cipher was a
trade secret of RSA but was reverse-engineered and published to the
internet in 1994. It is used in a number of network protocols for
securing communications. To evade trademark restrictions this cipher
is sometimes known as ARCFOUR.
.SH COMMANDS
.TP
\fB::rc4::rc4\fR ?\fI-hex\fR? \fI-key keyvalue\fR ?\fI-command lst\fR? ?\fI-out channel\fR? [ \fI-in channel\fR | \fI-infile filename\fR | \fIstring\fR ]
Perform the RC4 algorithm on either the data provided by the argument
or on the data read from the \fI-in\fR channel. If an \fI-out\fR
channel is given then the result will be written to this channel.
Giving the \fI-hex\fR option will return a hexadecimal encoded
version of the result if not using an \fI-out\fR channel.
.sp
The data to be processes can be specified either as a string argument to
the rc4 command, or as a filename or a pre-opened channel. If the
\fI-infile\fR argument is given then the file is opened, the data read
and processed and the file is closed. If the \fI-in\fR argument is
given then data is read from the channel until the end of file. The
channel is not closed. If the \fI-out\fR argument is given then the
processing result is written to this channel.
.sp
If \fI-command\fR is provided then the rc4 command does not return
anything. Instead the command provided is called with the rc4 result data
appended as the final parameter. This is most useful when reading from Tcl
channels as a fileevent is setup on the channel and the data processed in
chunks
.sp
Only one of \fI-infile\fR, \fI-in\fR or \fIstring\fR should be given.
.PP
.SH "PROGRAMMING INTERFACE"
.TP
\fB::rc4::RC4Init\fR \fIkeydata\fR
Initialize a new RC4 key. The \fIkeydata\fR is any amount of binary
data and is used to initialize the cipher internal state.
.TP
\fB::rc4::RC4\fR \fIKey\fR \fIdata\fR
Encrypt or decrypt the input data using the key obtained by calling
\fBRC4Init\fR.
.TP
\fB::rc4::RC4Final\fR \fIKey\fR
This should be called to clean up resources associated with
\fIKey\fR. Once this function has been called the key is destroyed.
.PP
.SH EXAMPLES
.CS


% set keydata [binary format H* 0123456789abcdef]
% rc4::rc4 -hex -key $keydata HelloWorld
3cf1ae8b7f1c670b612f
% rc4::rc4 -hex -key $keydata [binary format H* 3cf1ae8b7f1c670b612f]
HelloWorld

.CE
.CS


 set Key [rc4::RC4Init "key data"]
 append ciphertext [rc4::RC4 $Key $plaintext]
 append ciphertext [rc4::RC4 $Key $additional_plaintext]
 rc4::RC4Final $Key

.CE
.CS


 proc ::Finish {myState data} {
     DoStuffWith $myState $data
 }
 rc4::rc4 -in $socket -command [list ::Finish $ApplicationState]

.CE
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIrc4\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
aes(n), blowfish(n), des(n)
.SH KEYWORDS
arcfour, data integrity, encryption, rc4, security, stream cipher
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2003, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/rcs/rcs.n.









































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/rcs/rcs.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005, Andreas Kupries <[email protected]>
'\" Copyright (c) 2005, Colin McCormack <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "rcs" n 2.0.2 tcllib "RCS low level utilities"
.BS
.SH NAME
rcs \- RCS low level utilities
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBrcs  ?0.1?\fR
.sp
\fB::rcs::text2dict\fR \fItext\fR
.sp
\fB::rcs::dict2text\fR \fIdict\fR
.sp
\fB::rcs::file2dict\fR \fIfilename\fR
.sp
\fB::rcs::dict2file\fR \fIfilename\fR \fIdict\fR
.sp
\fB::rcs::decodeRcsPatch\fR \fItext\fR
.sp
\fB::rcs::encodeRcsPatch\fR \fIpcmds\fR
.sp
\fB::rcs::applyRcsPatch\fR \fItext\fR \fIpcmds\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fIRevision Control System\fR, short \fIRCS\fR, is a set of
applications and related data formats which allow a system to persist
the history of changes to a text. It, and its relative SCCS are the
basis for many other such systems, like \fICVS\fR, etc.
.PP
This package \fIdoes not\fR implement RCS.
.PP
It only provides a number of low level commands which should be useful
in the implementation of any revision management system, namely:
.IP [1]
The conversion of texts into and out of a data structures which allow
the easy modification of such text by \fIpatches\fR, i.e. sequences
of instructions for the transformation of one text into an other.
.IP [2]
And the conversion of one particular format for patches, the so-called
\fIRCS patches\fR, into and out of data structures which allow
their easy application to texts.
.PP
.SH COMMANDS
.TP
\fB::rcs::text2dict\fR \fItext\fR
Converts the argument \fItext\fR into a dictionary containing and
representing the same text in an indexed form and returns that
dictionary as its result.
More information about the format of the result can be found in
section \fBTEXT DICT DATA STRUCTURE\fR. This command returns the
\fIcanonical\fR representation of the input.
.TP
\fB::rcs::dict2text\fR \fIdict\fR
This command provides the complementary operation to
\fB::rcs::text2dict\fR. It converts a dictionary in the form described
in section \fBTEXT DICT DATA STRUCTURE\fR back into a text and
returns that text as its result. The command does accept non-canonical
representations of the text as its input.
.TP
\fB::rcs::file2dict\fR \fIfilename\fR
This command is identical to \fB::rcs::text2dict\fR, except that it
reads the text to convert from the file with path \fIfilename\fR. The
file has to exist and must be readable as well.
.TP
\fB::rcs::dict2file\fR \fIfilename\fR \fIdict\fR
This command is identical to \fB::rcs::2dict2text\fR, except that it
stores the resulting text in the file with path \fIfilename\fR. The
file is created if it did not exist, and must be writable. The result
of the command is the empty string.
.TP
\fB::rcs::decodeRcsPatch\fR \fItext\fR
Converts the \fItext\fR argument into a patch command list (PCL) as
specified in the section \fBRCS PATCH COMMAND LIST\fR and
returns this list as its result.
It is assumed that the input text is in \fIdiff -n format\fR, also
known as \fIRCS patch\fR format, as specified in the section
\fBRCS PATCH FORMAT\fR.
Please note that the command ignores no-ops in the input, in other
words the resulting PCL contains only instructions doing something.
.TP
\fB::rcs::encodeRcsPatch\fR \fIpcmds\fR
This command provides the complementary operation to
\fB::rcs::decodeRcsPatch\fR. It convert a patch comand list (PCL) list
as specified in the section \fBRCS PATCH COMMAND LIST\fR back
into a text in \fBRCS PATCH FORMAT\fR and returns that text as its result.
.sp
Note that this command and \fB::rcs::decodeRcsPatch\fR are not exactly
complementary, as the latter strips no-ops from its input, which the
encoder cannot put back anymore into the generated RCS patch. In other
words, the result of a decode/encode step may not match the original
input at the character level, but it will match it at the functional
level.
.TP
\fB::rcs::applyRcsPatch\fR \fItext\fR \fIpcmds\fR
This operation applies a patch in the form of a PCL to a text given in
the form of a dictionary and returns the modified text, again as
dictionary, as its result.
.sp
To handle actual text use the commands \fB::rcs::text2dict\fR (or
equivalent) and \fB::rcs::decodeRcsPatch\fR to transform the inputs
into data structures acceptable to this command. Analogously use the
command \fB::rcs::dict2text\fR (or equivalent) to transform the
result of this command into actuall text as required.
.PP
.SH "TEXT DICT DATA STRUCTURE"
A text dictionary is a dictionary whose keys are integer numbers and
text strings as the associated values. The keys represent the line
numbers of a text and the values the text of that line.  Note that one
text can have many representations as a dictionary, as the index
values only have to be properly ordered for reconstruction, their
exact values do not matter. Similarly the strings may actually span
multiple physical lines.
.PP
The text
.PP
.CS

Hello World,
how are you ?
Fine, and you ?
.CE
.PP
for example can be represented by
.PP
.CS

{{1 {Hello World,}} {2 {how are you ?}} {3 {Fine, and you ?}}}
.CE
.PP
or
.PP
.CS

{{5 {Hello World,}} {8 {how are you ?}} {9 {Fine, and you ?}}}
.CE
.PP
or
.PP
.CS

{{-1 {Hello World,
how are you ?}} {4 {Fine, and you ?}}}
.CE
.PP
The first dictionary is the \fIcanonical\fR representation of the
text, with line numbers starting at \fB1\fR, increasing in steps of
\fB1\fR and without gaps, and each value representing exactly one
physical line.
.PP
All the commands creating dictionaries from text will return the
canonical representation of their input text. The commands taking a
dictionary and returning text will generally accept all
representations, canonical or not.
.PP
The result of applying a patch to a text dictionary will in general
cause the dictionary to become non-canonical.
.SH "RCS PATCH FORMAT"
A \fIpatch\fR is in general a series of instructions how to transform
an input text T into a different text T', and also encoded in text
form as well.
.PP
The text format for patches understood by this package is a very
simple one, known under the names \fIRCS patch\fR or
\fIdiff -n format\fR.
.PP
Patches in this format contain only two different commands, for the
deletion of old text, and addition of new text. The replacement of
some text by a different text is handled as combination of a deletion
following by an addition.
.PP
The format is line oriented, with each line containing either a
command or text data associated with the preceding command.
The first line of a \fIRCS patch\fR is always a command line.
.PP
The commands are:
.TP
""
The empty line is a command which does nothing.
.TP
"a\fBstart\fR \fBn\fR"
A line starting with the character \fBa\fR is a command for the
addition of text to the output. It is followed by \fBn\fR lines of
text data. When applying the patch the data is added just between the
lines \fBstart\fR and \fBstart\fR+1. The same effect is had by
appending the data to the existing text on line \fBstart\fR. A
non-existing line \fBstart\fR is created.
.TP
"d\fBstart\fR \fBn\fR"
A line starting with the character \fBd\fR is a command for the
deletion of text from the output. When applied it deletes \fBn\fR
lines of text, and the first line deleted is at index \fBstart\fR.
.PP
Note that the line indices \fBstart\fR always refer to the text which
is transformed as it is in its original state, without taking the
precending changes into account.
.PP
Note also that the instruction have to be applied in the order they
occur in the patch, or in a manner which produces the same result as
in-order application.
.PP
This is the format of results returned by the command
\fB::rcs::decodeRcsPatch\fR and accepted by the commands
\fB::rcs::encodeRcsPatch\fR and \fB::rcs::appplyRcsPatch\fR
resp.
Note however that the decoder will strip no-op commands, and the
encoder will not generate no-ops, making them not fully complementary
at the textual level, only at the functional level.
.PP
And example of a RCS patch is
.PP
.CS

d1 2
d4 1
a4 2
The named is the mother of all things.

a11 3
They both may be called deep and profound.
Deeper and more profound,
The door of all subtleties!
.CE
.SH "RCS PATCH COMMAND LIST"
Patch command lists (sort: PCL's) are the data structures generated by
patch decoder command and accepted by the patch encoder and applicator
commands. They represent RCS patches in the form of Tcl data
structures.
.PP
A PCL is a list where each element represents a single patch
instruction, either an addition, or a deletion. The elements are lists
themselves, where the first item specifies the command and the
remainder represent the arguments of the command.
.TP
a
This is the instruction for the addition of text. It has two
arguments, the index of the line where to add the text, and the text
to add, in this order.
.TP
d
This is the instruction for the deletion of text. It has two
arguments, the index of the line where to start deleting text, and the
number of lines to delete, in this order.
.PP
.PP
This is the format returned by the patch decoder command and accepted
as input by the patch encoder and applicator commands.
.PP
An example for a patch command is shown below, it represents the
example RCS patch found in section \fBRCS PATCH FORMAT\fR.
.PP
.CS

{{d 1 2} {d 4 1} {a 4 {The named is the mother of all things.

}} {a 11 {They both may be called deep and profound.
Deeper and more profound,
The door of all subtleties!}}}
.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIrcs\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
struct, textutil
.SH KEYWORDS
CVS, RCS, RCS patch, SCCS, diff -n format, patching, text conversion, text differences
.SH CATEGORY
Text processing
.SH COPYRIGHT
.nf
Copyright (c) 2005, Andreas Kupries <[email protected]>
Copyright (c) 2005, Colin McCormack <[email protected]>

.fi

Added embedded/man/files/modules/report/report.n.





























































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/report/report.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "report" n 0.3.1 tcllib "Matrix reports"
.BS
.SH NAME
report \- Create and manipulate report objects
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBreport  ?0.3.1?\fR
.sp
\fB::report::report\fR \fIreportName\fR \fIcolumns\fR ?\fBstyle\fR \fIstyle arg...\fR?
.sp
\fBreportName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fB::report::defstyle\fR \fIstyleName arguments script\fR
.sp
\fB::report::rmstyle\fR \fIstyleName\fR
.sp
\fB::report::stylearguments\fR \fIstyleName\fR
.sp
\fB::report::stylebody\fR \fIstyleName\fR
.sp
\fB::report::styles\fR
.sp
\fIreportName\fR \fBdestroy\fR
.sp
\fIreportName\fR \fItemplatecode\fR \fBdisable\fR|\fBenable\fR
.sp
\fIreportName\fR \fItemplatecode\fR \fBenabled\fR
.sp
\fIreportName\fR \fItemplatecode\fR \fBget\fR
.sp
\fIreportName\fR \fItemplatecode\fR \fBset\fR \fItemplatedata\fR
.sp
\fIreportName\fR \fBtcaption\fR ?\fIsize\fR?
.sp
\fIreportName\fR \fBbcaption\fR \fIsize\fR
.sp
\fIreportName\fR \fBsize\fR \fIcolumn\fR ?\fInumber\fR|\fBdyn\fR?
.sp
\fIreportName\fR \fBsizes\fR ?\fIsize-list\fR?
.sp
\fIreportName\fR \fBpad\fR \fIcolumn\fR ?\fBleft\fR|\fBright\fR|\fBboth\fR ?\fIpadstring\fR??
.sp
\fIreportName\fR \fBjustify\fR \fIcolumn\fR ?\fBleft\fR|\fBright\fR|\fBcenter\fR?
.sp
\fIreportName\fR \fBprintmatrix\fR \fImatrix\fR
.sp
\fIreportName\fR \fBprintmatrix2channel\fR \fImatrix chan\fR
.sp
\fIreportName\fR \fBcolumns\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides report objects which can be used by the
formatting methods of matrix objects to generate tabular reports of
the matrix in various forms. The report objects defined here break
each report down into three \fBREGIONS\fR and ten classes of
\fIlines\fR (various separator- and data-lines). See the following
section for more detailed explanations.
.TP
\fB::report::report\fR \fIreportName\fR \fIcolumns\fR ?\fBstyle\fR \fIstyle arg...\fR?
Creates a new report object for a report having \fIcolumns\fR columns
with an associated global Tcl command whose name is
\fIreportName\fR. This command may be used to invoke various
configuration operations on the report. It has the following general
form:
.RS
.TP
\fBreportName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command. See section \fBREPORT METHODS\fR for more
explanations. If no \fBstyle\fR is specified the report will use
the builtin style \fBplain\fR as its default configuration.
.RE
.TP
\fB::report::defstyle\fR \fIstyleName arguments script\fR
Defines the new style \fIstyleName\fR. See section \fBSTYLES\fR
for more information.
.TP
\fB::report::rmstyle\fR \fIstyleName\fR
Deletes the style \fIstyleName\fR. Trying to delete an unknown or
builtin style will result in an error. Beware, this command will not
check that there are no other styles depending on the deleted
one. Deleting a style which is still used by another style FOO will
result in a runtime error when FOO is applied to a newly instantiated
report.
.TP
\fB::report::stylearguments\fR \fIstyleName\fR
This introspection command returns the list of arguments associated
with the style \fIstyleName\fR.
.TP
\fB::report::stylebody\fR \fIstyleName\fR
This introspection command returns the script associated with the
style \fIstyleName\fR.
.TP
\fB::report::styles\fR
This introspection command returns a list containing the names of all
styles known to the package at the time of the call. The order of the
names in the list reflects the order in which the styles were
created. In other words, the first item is the predefined style
\fBplain\fR, followed by the first style defined by the user, and
so on.
.PP
.SH REGIONS
.PP
The three regions are the \fItop caption\fR,
\fIdata area\fR and \fIbottom caption\fR. These are,
roughly speaking, the title, the values to report and a title at the
bottom. The size of the caption regions can be specified by the user
as the number of rows they occupy in the matrix to format. The size of
the data area is specified implicitly.
.SH LINES
.PP
\fBTEMPLATES\fR are associated with each of the ten line classes,
defining the formatting for this kind of line. The user is able to
enable and disable the separator lines at will, but not the data
lines. Their usage is solely determined by the number of rows
contained in the three regions. Data lines and all enabled separators
must have a template associated with them.
.PP
Note that the data-lines in a report and the rows in the matrix the
report was generated from are \fInot\fR in a 1:1 relationship if
any row in the matrix has a height greater than one.
.PP
The different kinds of lines and the codes used by the report methods
to address them are:
.TP
\fBtop\fR
The topmost line of a report. Separates the report from anything which
came before it. The user can enable the usage of this line at will.
.TP
\fBtopdatasep\fR
This line is used to separate the data rows in the top caption region,
if it contains more than one row and the user enabled its usage.
.TP
\fBtopcapsep\fR
This line is used to separate the top caption and data regions, if the
top caption is not empty and the user enabled its usage.
.TP
\fBdatasep\fR
This line is used to separate the data rows in the data region, if it
contains more than one row and the user enabled its usage.
.TP
\fBbotcapsep\fR
This line is used to separate the data and bottom caption regions, if
the bottom caption is not empty and the user enabled its usage.
.TP
\fBbotdatasep\fR
This line is used to separate the data rows in the bottom caption
region, if it contains more than one row and the user enabled its
usage.
.TP
\fBbottom\fR
The bottommost line of a report. Separates the report from anything
which comes after it. The user can enable the usage of this line at
will.
.TP
\fBtopdata\fR
This line defines the format of data lines in the top caption region
of the report.
.TP
\fBdata\fR
This line defines the format of data lines in the data region of the
report.
.TP
\fBbotdata\fR
This line defines the format of data lines in the bottom caption
region of the report.
.PP
.SH TEMPLATES
.PP
Each template is a list of strings used to format the line it is
associated with. For a report containing \fBn\fR columns a template
for a data line has to contain "\fBn\fR+1" items and a template for a
separator line "2*\fBn\fR+1" items.
.PP
The items in a data template specify the strings used to separate the
column information. Together with the corresponding items in the
separator templates they form the vertical lines in the report.
.PP
\fINote\fR that the corresponding items in all defined templates
have to be of equal length. This will be checked by the report
object. The first item defines the leftmost vertical line and the last
item defines the rightmost vertical line. The item at index \fBk\fR
("1",...,"\fBn\fR-2") separates the information in the columns
"\fBk\fR-1" and "\fBk\fR".
.PP
The items in a separator template having an even-numbered index
("0","2",...)  specify the column separators. The item at index
"2*\fBk\fR" ("0","2",...,"2*\fBn\fR") corresponds to the items at
index "\fBk\fR" in the data templates.
.PP
The items in a separator template having an odd-numbered index
("1","3",...) specify the strings used to form the horizontal lines in
the separator lines. The item at index "2*\fBk\fR+1"
("1","3",...,"2*\fBn\fR+1") corresponds to column "\fBk\fR". When
generating the horizontal lines the items are replicated to be at
least as long as the size of their column and then cut to the exact
size.
.SH STYLES
.PP
Styles are a way for the user of this package to define common
configurations for report objects and then use them later during the
actual instantiation of report objects. They are defined as tcl
scripts which when executed configure the report object into the
requested configuration.
.PP
The command to define styles is \fB::report::defstyle\fR. Its last
argument is the tcl \fBscript\fR performing the actual
reconfiguration of the report object to obtain the requested style.
.PP
In this script the names of all previously defined styles are
available as commands, as are all commands found in a safe interpreter
and the configuration methods of report objects. The latter implicitly
operate on the object currently executing the style script. The
\fBarguments\fR declared here are available in the \fBscript\fR as
variables. When calling the command of a previously declared style all
the arguments expected by it have to be defined in the call.
.SH "REPORT METHODS"
.PP
The following commands are possible for report objects:
.TP
\fIreportName\fR \fBdestroy\fR
Destroys the report, including its storage space and associated
command.
.TP
\fIreportName\fR \fItemplatecode\fR \fBdisable\fR|\fBenable\fR
Enables or disables the usage of the template addressed by the
\fItemplatecode\fR. Only the codes for separator lines are allowed
here. It is not possible to enable or disable data lines.
.sp
Enabling a template causes the report to check all used templates for
inconsistencies in the definition of the vertical lines (See section
\fBTEMPLATES\fR).
.TP
\fIreportName\fR \fItemplatecode\fR \fBenabled\fR
Returns the whether the template addressed by the \fItemplatecode\fR
is currently enabled or not.
.TP
\fIreportName\fR \fItemplatecode\fR \fBget\fR
Returns the template currently associated with the kind of line
addressed by the \fItemplatecode\fR. All known templatecodes are
allowed here.
.TP
\fIreportName\fR \fItemplatecode\fR \fBset\fR \fItemplatedata\fR
Sets the template associated with the kind of line addressed by the
\fItemplatecode\fR to the new value in \fItemplatedata\fR. See section
\fBTEMPLATES\fR for constraints on the length of templates.
.TP
\fIreportName\fR \fBtcaption\fR ?\fIsize\fR?
Specifies the \fIsize\fR of the top caption region as the number rows
it occupies in the matrix to be formatted. Only numbers greater than
or equal to zero are allowed. If no \fIsize\fR is specified the
command will return the current size instead.
.sp
Setting the size of the top caption to a value greater than zero
enables the corresponding data template and causes the report to check
all used templates for inconsistencies in the definition of the
vertical lines (See section \fBTEMPLATES\fR).
.TP
\fIreportName\fR \fBbcaption\fR \fIsize\fR
Specifies the \fIsize\fR of the bottom caption region as the number
rows it occupies in the matrix to be formatted. Only numbers greater
than or equal to zero are allowed. If no \fIsize\fR is specified the
command will return the current size instead.
.sp
Setting the size of the bottom caption to a value greater than zero
enables the corresponding data template and causes the report to check
all used templates for inconsistencies in the definition of the
vertical lines (See section \fBTEMPLATES\fR).
.TP
\fIreportName\fR \fBsize\fR \fIcolumn\fR ?\fInumber\fR|\fBdyn\fR?
Specifies the size of the \fIcolumn\fR in the output. The value
\fBdyn\fR means that the columnwidth returned by the matrix to be
formatted for the specified column shall be used. The formatting of
the column is dynamic. If a fixed \fInumber\fR is used instead of
\fBdyn\fR it means that the column has a width of that many
characters (padding excluded). Only numbers greater than zero are
allowed here.
.sp
If no size specification is given the command will return the current
size of the \fIcolumn\fR instead.
.TP
\fIreportName\fR \fBsizes\fR ?\fIsize-list\fR?
This method allows the user to specify the sizes of all columns in one
call. Its argument is a list containing the sizes to associate with
the columns. The first item is associated with column 0, the next with
column 1, and so on.
.sp
If no \fIsize-list\fR is specified the command will return a list
containing the currently set sizes instead.
.TP
\fIreportName\fR \fBpad\fR \fIcolumn\fR ?\fBleft\fR|\fBright\fR|\fBboth\fR ?\fIpadstring\fR??
This method allows the user to specify padding on the left, right or
both sides of a \fIcolumn\fR. If the \fIpadstring\fR is not specified
it defaults to a single space character. \fINote\fR: An alternative
way of specifying the padding is to use vertical separator strings
longer than one character in the templates (See section
\fBTEMPLATES\fR).
.sp
If no pad specification is given at all the command will return the
current state of padding for the column instead. This will be a list
containing two elements, the first element the left padding, the
second describing the right padding.
.TP
\fIreportName\fR \fBjustify\fR \fIcolumn\fR ?\fBleft\fR|\fBright\fR|\fBcenter\fR?
Declares how the cell values for a \fIcolumn\fR are filled into the
report given the specified size of a column in the report.
.sp
For \fBleft\fR and \fBright\fR justification a cell value
shorter than the width of the column is bound with its named edge to
the same edge of the column. The other side is filled with spaces. In
the case of \fBcenter\fR the spaces are placed to both sides of the
value and the left number of spaces is at most one higher than the
right number of spaces.
.sp
For a value longer than the width of the column the value is cut at
the named edge. This means for \fBleft\fR justification that the
\fItail\fR (i.e. the \fBright\fR part) of the value is made
visible in the output. For \fBcenter\fR the value is cut at both
sides to fit into the column and the number of characters cut at the
left side of the value is at most one less than the number of
characters cut from the right side.
.sp
If no justification was specified the command will return the current
justification for the column instead.
.TP
\fIreportName\fR \fBprintmatrix\fR \fImatrix\fR
Formats the \fImatrix\fR according to the configuration of the report
and returns the resulting string. The matrix has to have the same
number of columns as the report. The matrix also has to have enough
rows so that the top and bottom caption regions do not overlap. The
data region is allowed to be empty.
.TP
\fIreportName\fR \fBprintmatrix2channel\fR \fImatrix chan\fR
Formats the \fImatrix\fR according to the configuration of the report
and writes the result into the channel \fIchan\fR. The matrix has to
have the same number of columns as the report. The matrix also has to
have enough rows so that the top and bottom caption regions do not
overlap. The data region is allowed to be empty.
.TP
\fIreportName\fR \fBcolumns\fR
Returns the number of columns in the report.
.PP
.PP
The methods \fBsize\fR, \fBpad\fR and \fBjustify\fR all take
a column index as their first argument. This index is allowed to use
all the forms of an index as accepted by the \fBlindex\fR command. The
allowed range for indices is
"0,...,[\fBreportName\fR columns]-1".
.SH EXAMPLES
.PP
Our examples define some generally useful report styles.
.PP
A simple table with lines surrounding all information and vertical
separators, but without internal horizontal separators.
.PP
.CS


    ::report::defstyle simpletable {} {
	data	set [split "[string repeat "| "   [columns]]|"]
	top	set [split "[string repeat "+ - " [columns]]+"]
	bottom	set [top get]
	top	enable
	bottom	enable
    }

.CE
.PP
An extension of a \fBsimpletable\fR, see above, with a title area.
.PP
.CS


    ::report::defstyle captionedtable {{n 1}} {
	simpletable
	topdata   set [data get]
	topcapsep set [top get]
	topcapsep enable
	tcaption $n
    }

.CE
.PP
Given the definitions above now an example which actually formats a
matrix into a tabular report. It assumes that the matrix actually
contains useful data.
.PP
.CS


    % ::struct::matrix m
    % # ... fill m with data, assume 5 columns
    % ::report::report r 5 style captionedtable 1
    % r printmatrix m
    +---+-------------------+-------+-------+--------+
    |000|VERSIONS:          |2:8.4a3|1:8.4a3|1:8.4a3%|
    +---+-------------------+-------+-------+--------+
    |001|CATCH return ok    |7      |13     |53.85   |
    |002|CATCH return error |68     |91     |74.73   |
    |003|CATCH no catch used|7      |14     |50.00   |
    |004|IF if true numeric |12     |33     |36.36   |
    |005|IF elseif          |15     |47     |31.91   |
    |   |true numeric       |       |       |        |
    +---+-------------------+-------+-------+--------+
    %
    % # alternate way of doing the above
    % m format 2string r

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIreport\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
matrix, report, table
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/rest/rest.n.

















































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/rest/rest.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "rest" n 1.0 tcllib "A framework for RESTful web services"
.BS
.SH NAME
rest \- define REST web APIs and call them inline or asychronously
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBrest  ?1.0?\fR
.sp
\fB::rest::simple\fR \fIurl\fR \fIquery\fR ?config? ?body?
.sp
\fB::rest::get\fR \fIurl\fR \fIquery\fR ?config? ?body?
.sp
\fB::rest::post\fR \fIurl\fR \fIquery\fR ?config? ?body?
.sp
\fB::rest::head\fR \fIurl\fR \fIquery\fR ?config? ?body?
.sp
\fB::rest::put\fR \fIurl\fR \fIquery\fR ?config? ?body?
.sp
\fB::rest::delete\fR \fIurl\fR \fIquery\fR ?config? ?body?
.sp
\fB::rest::save\fR \fIname\fR \fIfile\fR
.sp
\fB::rest::describe\fR \fIname\fR
.sp
\fB::rest::parameters\fR \fIurl\fR ?args?
.sp
\fB::rest::parse_opts\fR \fIstatic\fR \fIrequired\fR \fIoptional\fR \fIstring\fR
.sp
\fB::rest::substitute\fR \fIstring\fR ?var?
.sp
\fB::rest::create_interface\fR \fIname\fR
.sp
describe
.sp
uplevel token token
.sp
upvar body body
.sp
uplevel token token
.sp
uplevel token token
.sp
.BE
.SH DESCRIPTION
.PP
There are 2 types of usage this package supports: simple calls, and complete interfaces. In an interface you specify a set of rules and then the package builds commands which correspond to the REST methods. These commands can have many options such as input and output transformations and data type specific formatting. This results in a cleaner and simpler script. On the other hand, a simple call is easier and quicker to implement but less featureful. It takes the url and a few options on the command and returns the result directly. Any formatting or checking is up to rest of the script.
Simple usage
In simple usage you make calls using http method procedures and then check or process the returned data yourself
.TP
\fB::rest::simple\fR \fIurl\fR \fIquery\fR ?config? ?body?
.TP
\fB::rest::get\fR \fIurl\fR \fIquery\fR ?config? ?body?
.TP
\fB::rest::post\fR \fIurl\fR \fIquery\fR ?config? ?body?
.TP
\fB::rest::head\fR \fIurl\fR \fIquery\fR ?config? ?body?
.TP
\fB::rest::put\fR \fIurl\fR \fIquery\fR ?config? ?body?
.TP
\fB::rest::delete\fR \fIurl\fR \fIquery\fR ?config? ?body?
.PP
The above commands are all equivalent except for the http method used. If you use \fBsimple\fR then the method should be specified as an option in the ?config? dict, otherwise it defaults to \fBget\fR. If a body is needed then the config dict must be present, however it may be empty.
.CS


    set appid APPID
    set search tcl
    set res [rest::get http://boss.yahooapis.com/ysearch/web/v1/$search [list appid $appid]]
    set res [rest::format_json $res]

.CE
.CS


    set res [rest::simple http://twitter.com/statuses/update.json  [list status $text]  {
          method post
          auth {basic user password}
          format json
        }
    ]

.CE
the options supported in the config dict are as follows
headers
cookie
auth
format
method
content-type
Interface usage
An interface to a REST API consists of a series of definitions of REST calls contained in an array. The array name becomes a namespace containing the defined commands. Each array element defines the name of the call and takes the form of a dict, aka key/value pairs. These keys are the defined configuration options below.
After creating the definitions simply call rest::create_interface on the array to create the commands.
.CS


package require rest

set yweather(forecast) {
   url http://weather.yahooapis.com/forecastrss
   req_args { p: }
   opt_args { u: }
}

rest::create_interface yweather

puts [yweather::forecast -p 94089]

.CE
::${name}::basic_auth \fIu\fR \fIp\fR
::${name}::set_static_args ?args?]
.TP
\fB::rest::save\fR \fIname\fR \fIfile\fR
saves a copy of the dynamically created procs to a file for later loading
.TP
\fB::rest::describe\fR \fIname\fR
print a description of defined api calls
.TP
\fB::rest::parameters\fR \fIurl\fR ?args?
parse a url query string into a dict
.TP
\fB::rest::parse_opts\fR \fIstatic\fR \fIrequired\fR \fIoptional\fR \fIstring\fR
.TP
\fB::rest::substitute\fR \fIstring\fR ?var?
take a string and substitute real values for any option identifiers
.TP
\fB::rest::create_interface\fR \fIname\fR
TOKENS
the value is substituted into the url at call time. tokens in the form of %name:default_value% will be an optional argument with a default value.
url
the target of the http request
description
a string which describes the call. used only for
.TP
describe
body
indicates if arguments are required for the request body or not. should
be one of none, optional, required, argument or mime_multipart. default is optional.
if \fBargument\fR is used then the option is parsed as a list where the second value is the name
of a option. the body will then be used as the value for that option.
if the value is \fBmime_multipart\fR then the body is required and interpreted as each argument
representing one part of a mime multipart document. each argument should be a 2 item list with the first being
a list of header keys and values, and the second being the mime part body.
.CS


set ygeo(parse) {
    url http://wherein.yahooapis.com/v1/document
    method post
    body { arg documentContent }
}
ygeo::parse "san jose ca"
# "san jose ca" will be interpreted as if it were specified as the -documentContent option

.CE
.CS


set gdocs(upload) {
    url http://docs.google.com/feeds/default/private/full
    body mime_multipart
}
gdocs::upload [list {Content-Type application/atom+xml} $xml] [list {Content-Type image/jpeg} $filedata]

.CE
.IP
method
The HTTP method to call on the url. The default is GET.
copy
this copies the definition of a previously defined call. after copying you can override selected options by defining them again.
unset
removes the named option. useful when using copy of another definition.
headers
the value must be another dict containing header fields and their values. The default is to not add any additional headers.
content-type
Specifies the content type for the request data.
req_args
a list of the required arguments. names ending in a colon will require a value.
opt_args
arguments that may be present but are not required.
static_args
arguments that are always the same. no sense in troubling the user with these. A leading - is allowed but not required to maintain consistancy with the command line.
auth
should be one of basic or sign. if basic is used you can configure basic auth with the proc auth_basic which takes 2 arguments, the username and password.
if sign is specified then the value must be a list with the second element being the name of a proc which will be called to perform the request signing.
.CS


set delicious(updated) {
    url https://api.del.icio.us/v1/posts/update
    auth basic
}

rest::create_interface flickr

flickr::basic_auth username password

.CE
.CS


set flickr(auth.getToken) {
   url http://api.flickr.com/services/rest/
   req_args { api_key: secret: }
   auth { sign do_signature }
}

rest::create_interface flickr

proc ::flickr::do_signature {query} {
    # perform some operations on the query here
    return $query
}

.CE
.IP
callback
If this option is present then the method will be created as an async call. An async call will return immediately with the value of the http token. The event loop must be active to use this option. The value of this option is the name of a proc which is invoked when the HTTP call is complete. The proc receives three arguments, the name of the calling procedure, the status of the result (one of OK or ERROR), and the data associated with the result.
the http request header is available via
.TP
uplevel token token
cookie
a list of cookies to be passed in the http header. this is just a shortcut to the headers option
input_transform
commands which take the variable $query and transform it in some manner before returning a new value. return value must be a dict which will be passed to http::formatQuery
the request body is accessible via
.TP
upvar body body
format or result
defines the format of the returned data. should be one of discard, raw, json, xml, or tdom. the default is auto which should auto detect between xml and json. rss is formated as
a special case of xml.
pre_transform
this value takes the form of a proc which should perform some action on $result and return a value. it is run on the result before the output (xml/json/etc) transformation is done.
the http request header is available via
.TP
uplevel token token
result
may have the value xml, json, tdom, raw, or auto. the default is auto and should auto detect json or xml results and transform them into a tcl list. this is here if you want to specify it explicitly.
post_transform
this value takes the form of a proc which should perform some action on $result and return a value. it is run on the result after the output transformation but before returning the value to the calling procedure.
the http request header is available via
.TP
uplevel token token
check_result
this value should be a list of 2 expressions either of which may be empty. the first expression is checks the OK condition, it must return true when the result is satisfactory. the second expression is the error condition, it must return false unless there is an error.
.PP
.SH INCLUDED
functional but incomplete implementations are included for the following services:
flickr
twitter
yahoo boss
yahoo weather
google calendar
facebook
del.icio.us
read the file or source it and use \fBdescribe\fR for more information. also see the
developers documentation on the respective sites.

Added embedded/man/files/modules/ripemd/ripemd128.n.
































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ripemd/ripemd128.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ripemd128" n 1.0.3 tcllib "RIPEMD Message-Digest Algorithm"
.BS
.SH NAME
ripemd128 \- RIPEMD-128 Message-Digest Algorithm
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBripemd128  ?1.0.3?\fR
.sp
\fB::ripemd::ripemd128\fR ?\fI-hex\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::ripemd::hmac128\fR ?\fI-hex\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::ripemd::RIPEMD128Init\fR
.sp
\fB::ripemd::RIPEMD128Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::ripemd::RIPEMD128Final\fR \fItoken\fR
.sp
\fB::ripemd::RIPEHMAC128Init\fR \fIkey\fR
.sp
\fB::ripemd::RIPEHMAC128Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::ripemd::RIPEHMAC128Final\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package is an implementation in Tcl of the RIPEMD-128 message-digest
algorithm (1). This algorithm takes an arbitrary quantity of data and
generates a 128-bit message digest from the input. The RIPEMD-128
algorithm is based upon the MD4 algorithm (2, 4) but has been
cryptographically strengthened against weaknesses that have been found
in MD4 (4). RIPEMD-128 has been designed to be a drop-in replacement
for MD4 and MD5 (5). If security is the major consideration, then
RIPEMD-160 or SHA1 should be considered.
.PP
This package will use \fBTrf\fR to
accelerate the digest computation if available. In
the absence of an accelerator package the pure-Tcl implementation will
be used.
.SH COMMANDS
.TP
\fB::ripemd::ripemd128\fR ?\fI-hex\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate the RIPEMD-128 digest of the data given in string. This is
returned as a binary string by default. Giving the \fI-hex\fR option
will return a hexadecimal encoded version of the digest.
.sp
The data to be hashed can be specified either as a string argument to
the ripemd128 command, or as a filename or a pre-opened channel. If the
\fI-filename\fR argument is given then the file is opened, the data read
and hashed and the file is closed. If the \fI-channel\fR argument is
given then data is read from the channel until the end of file. The
channel is not closed.
.sp
Only one of \fI-file\fR, \fI-channel\fR or \fIstring\fR should be given.
.TP
\fB::ripemd::hmac128\fR ?\fI-hex\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate an Hashed Message Authentication digest (HMAC) using the
RIPEMD-128 digest algorithm. HMACs are described in RFC 2104 (6) and
provide a RIPEMD-128 digest that includes a key. All options other
than \fI-key\fR are as for the \fB::ripemd::ripemd128\fR command.
.PP
.SH "PROGRAMMING INTERFACE"
For the programmer, hash functions can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
uniquely derived from the data that was poured into the bucket. The
programming interface to the hash operates on a token (equivalent to the
bucket). You call \fBRIPEMD128Init\fR to obtain a token and then call
\fBRIPEMD128Update\fR as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call
\fBRIPEMD128Final\fR. An equivalent set of functions gives you a keyed
digest (HMAC).
.PP
If you have \fBcritcl\fR and have built the \fBtcllibc\fR
package then the implementation of the hashing function will be
performed by compiled code. Alternatively if both the Trf and Memchan
extensions are available then these will be used. Finally the package
will revert to a pure-Tcl implementation.  The programming interface
remains the same, however.
.TP
\fB::ripemd::RIPEMD128Init\fR
Begins a new RIPEMD-128 hash. Returns a token ID that must be used for the
remaining functions.
.TP
\fB::ripemd::RIPEMD128Update\fR \fItoken\fR \fIdata\fR
Add data to the hash identified by token. Calling
\fIRIPEMD128Update $token "abcd"\fR is equivalent to calling
\fIRIPEMD128Update $token "ab"\fR followed by
\fIRIPEMD128Update $token "cb"\fR. See \fBEXAMPLES\fR.
.TP
\fB::ripemd::RIPEMD128Final\fR \fItoken\fR
Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 16 bytes representing the 128 bit
RIPEMD-128 digest value.
.TP
\fB::ripemd::RIPEHMAC128Init\fR \fIkey\fR
This is equivalent to the \fB::ripemd::RIPEMD128Init\fR command
except that it requires the key that will be included in the HMAC.
.TP
\fB::ripemd::RIPEHMAC128Update\fR \fItoken\fR \fIdata\fR
.TP
\fB::ripemd::RIPEHMAC128Final\fR \fItoken\fR
These commands are identical to the RIPEMD128 equivalent commands.
.PP
.SH EXAMPLES
.CS


% ripemd::ripemd128 -hex "Tcl does RIPEMD-128"
3cab177bae65205d81e7978f63556c63

.CE
.CS


% ripemd::hmac128 -hex -key Sekret "Tcl does RIPEMD-128"
b359dc5971a05beea0be7b106b30e389

.CE
.CS


% set tok [ripemd::RIPEMD128Init]
::ripemd::1
% ripemd::RIPEMD128Update $tok "Tcl "
% ripemd::RIPEMD128Update $tok "does "
% ripemd::RIPEMD128Update $tok "RIPEMD-128"
% ripemd::Hex [ripemd::RIPEMD128Final $tok]
3cab177bae65205d81e7978f63556c63

.CE
.SH REFERENCES
.IP [1]
H. Dobbertin, A. Bosselaers, B. Preneel,
"RIPEMD-160, a strengthened version of RIPEMD"
\fIhttp://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf\fR
.IP [2]
Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT,
April 1992. (\fIhttp://www.rfc-editor.org/rfc/rfc1320.txt\fR)
.IP [3]
Rivest, R., "The MD4 message digest algorithm", in A.J.  Menezes
and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90
Proceedings, pages 303-311, Springer-Verlag, 1991.
.IP [4]
Dobbertin, H., "Cryptanalysis of MD4", Journal of Cryptology
vol 11 (4), pp. 253-271 (1998)
.IP [5]
Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT and
RSA Data Security, Inc, April 1992.
(\fIhttp://www.rfc-editor.org/rfc/rfc1321.txt\fR)
.IP [6]
Krawczyk, H., Bellare, M. and Canetti, R. "HMAC: Keyed-Hashing for
Message Authentication", RFC 2104, February 1997.
(\fIhttp://www.rfc-editor.org/rfc/rfc2104.txt\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIripemd\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
md4, md5, ripemd160, sha1
.SH KEYWORDS
RIPEMD, hashing, md4, message-digest, rfc 1320, rfc 1321, rfc 2104, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2004, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/ripemd/ripemd160.n.



















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/ripemd/ripemd160.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "ripemd160" n 1.0.3 tcllib "RIPEMD Message-Digest Algorithm"
.BS
.SH NAME
ripemd160 \- RIPEMD-160 Message-Digest Algorithm
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBripemd160  ?1.0.3?\fR
.sp
\fB::ripemd::ripemd160\fR ?\fI-hex\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::ripemd::hmac160\fR ?\fI-hex\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::ripemd::RIPEMD160Init\fR
.sp
\fB::ripemd::RIPEMD160Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::ripemd::RIPEMD160Final\fR \fItoken\fR
.sp
\fB::ripemd::RIPEHMAC160Init\fR \fIkey\fR
.sp
\fB::ripemd::RIPEHMAC160Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::ripemd::RIPEHMAC160Final\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package is an implementation in Tcl of the RIPEMD-160 message-digest
algorithm (1). This algorithm takes an arbitrary quantity of data and
generates a 160-bit message digest from the input. The RIPEMD-160
algorithm is based upon the MD4 algorithm (2, 4) but has been
cryptographically strengthened against weaknesses that have been found
in MD4 (4).
.PP
This package will use \fBcryptkit\fR or \fBTrf\fR to
accelerate the digest computation if either package is available. In
the absence of an accelerator package the pure-Tcl implementation will
be used.
.SH COMMANDS
.TP
\fB::ripemd::ripemd160\fR ?\fI-hex\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate the RIPEMD-160 digest of the data given in string. This is
returned as a binary string by default. Giving the \fI-hex\fR option
will return a hexadecimal encoded version of the digest.
.sp
The data to be hashed can be specified either as a string argument to
the ripemd160 command, or as a filename or a pre-opened channel. If the
\fI-filename\fR argument is given then the file is opened, the data read
and hashed and the file is closed. If the \fI-channel\fR argument is
given then data is read from the channel until the end of file. The
channel is not closed.
.sp
Only one of \fI-file\fR, \fI-channel\fR or \fIstring\fR should be given.
.TP
\fB::ripemd::hmac160\fR ?\fI-hex\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate an Hashed Message Authentication digest (HMAC) using the
RIPEMD-160 digest algorithm. HMACs are described in RFC 2104 (5) and
provide a RIPEMD-160 digest that includes a key. All options other
than \fI-key\fR are as for the \fB::ripemd::ripemd160\fR command.
.PP
.SH "PROGRAMMING INTERFACE"
For the programmer, hash functions can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
uniquely derived from the data that was poured into the bucket. The
programming interface to the hash operates on a token (equivalent to the
bucket). You call \fBRIPEMD160Init\fR to obtain a token and then call
\fBRIPEMD160Update\fR as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call
\fBRIPEMD160Final\fR. An equivalent set of functions gives you a keyed
digest (HMAC).
.TP
\fB::ripemd::RIPEMD160Init\fR
Begins a new RIPEMD-160 hash. Returns a token ID that must be used for the
remaining functions.
.TP
\fB::ripemd::RIPEMD160Update\fR \fItoken\fR \fIdata\fR
Add data to the hash identified by token. Calling
\fIRIPEMD160Update $token "abcd"\fR is equivalent to calling
\fIRIPEMD160Update $token "ab"\fR followed by
\fIRIPEMD160Update $token "cb"\fR. See \fBEXAMPLES\fR.
.TP
\fB::ripemd::RIPEMD160Final\fR \fItoken\fR
Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 16 bytes representing the 160 bit
RIPEMD-160 digest value.
.TP
\fB::ripemd::RIPEHMAC160Init\fR \fIkey\fR
This is equivalent to the \fB::ripemd::RIPEMD160Init\fR command
except that it requires the key that will be included in the HMAC.
.TP
\fB::ripemd::RIPEHMAC160Update\fR \fItoken\fR \fIdata\fR
.TP
\fB::ripemd::RIPEHMAC160Final\fR \fItoken\fR
These commands are identical to the RIPEMD160 equivalent commands.
.PP
.SH EXAMPLES
.CS


% ripemd::ripemd160 -hex "Tcl does RIPEMD-160"
0829dea75a1a7074c702896723fe37763481a0a7

.CE
.CS


% ripemd::hmac160 -hex -key Sekret "Tcl does RIPEMD-160"
bf0c927231733686731dddb470b64a9c23f7f53b

.CE
.CS


% set tok [ripemd::RIPEMD160Init]
::ripemd::1
% ripemd::RIPEMD160Update $tok "Tcl "
% ripemd::RIPEMD160Update $tok "does "
% ripemd::RIPEMD160Update $tok "RIPEMD-160"
% ripemd::Hex [ripemd::RIPEMD160Final $tok]
0829dea75a1a7074c702896723fe37763481a0a7

.CE
.SH REFERENCES
.IP [1]
H. Dobbertin, A. Bosselaers, B. Preneel,
"RIPEMD-160, a strengthened version of RIPEMD"
\fIhttp://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf\fR
.IP [2]
Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT,
April 1992. (\fIhttp://www.rfc-editor.org/rfc/rfc1320.txt\fR)
.IP [3]
Rivest, R., "The MD4 message digest algorithm", in A.J.  Menezes
and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90
Proceedings, pages 303-311, Springer-Verlag, 1991.
.IP [4]
Dobbertin, H., "Cryptanalysis of MD4", Journal of Cryptology
vol 11 (4), pp. 253-271 (1998)
.IP [5]
Krawczyk, H., Bellare, M. and Canetti, R. "HMAC: Keyed-Hashing for
Message Authentication", RFC 2104, February 1997.
(\fIhttp://www.rfc-editor.org/rfc/rfc2104.txt\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIripemd\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
md4, md5, ripemd128, sha1
.SH KEYWORDS
RIPEMD, hashing, md4, message-digest, rfc 1320, rfc 1321, rfc 2104, security
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2004, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/sasl/sasl.n.




























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/sasl/sasl.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005-2006, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "SASL" n 1.3.0 tcllib "Simple Authentication and Security Layer (SASL)"
.BS
.SH NAME
SASL \- Implementation of SASL mechanisms for Tcl
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBSASL  ?1.3?\fR
.sp
\fB::SASL::new\fR \fIoption value ?...?\fR
.sp
\fB::SASL::configure\fR \fIoption value\fR ?\fI...\fR?
.sp
\fB::SASL::step\fR \fIcontext\fR \fIchallenge\fR ?\fI...\fR?
.sp
\fB::SASL::response\fR \fIcontext\fR
.sp
\fB::SASL::reset\fR \fIcontext\fR
.sp
\fB::SASL::cleanup\fR \fIcontext\fR
.sp
\fB::SASL::mechanisms\fR ?\fItype\fR? ?\fIminimum\fR?
.sp
\fB::SASL::register\fR \fImechanism\fR \fIpreference\fR \fIclientproc\fR ?\fIserverproc\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The Simple Authentication and Security Layer (SASL) is a framework
for providing authentication and authorization to comunications
protocols. The SASL framework is structured to permit negotiation
among a number of authentication mechanisms. SASL may be used in
SMTP, IMAP and HTTP authentication. It is also in use in XMPP, LDAP
and BEEP. See \fBMECHANISMS\fR for the set of available SASL
mechanisms provided with tcllib.
.PP
The SASL framework operates using a simple multi-step challenge
response mechanism. All the mechanisms work the same way although the
number of steps may vary. In this implementation a callback procedure
must be provided from which the SASL framework will obtain users
details. See \fBCALLBACK PROCEDURE\fR for details of this
procedure.
.SH COMMANDS
.TP
\fB::SASL::new\fR \fIoption value ?...?\fR
Contruct a new SASL context. See \fBOPTIONS\fR for details of the
possible options to this command. A context token is required for most
of the SASL procedures.
.TP
\fB::SASL::configure\fR \fIoption value\fR ?\fI...\fR?
Modify and inspect the SASL context option. See \fBOPTIONS\fR for
further details.
.TP
\fB::SASL::step\fR \fIcontext\fR \fIchallenge\fR ?\fI...\fR?
This is the core procedure for using the SASL framework. The
\fBstep\fR procedure should be called until it returns 0. Each step takes a
server challenge string and the response is calculated and stored in
the context. Each mechanism may require one or more steps. For some
steps there may be no server challenge required in which case an empty
string should be provided for this parameter. All mechanisms should accept
an initial empty challenge.
.TP
\fB::SASL::response\fR \fIcontext\fR
Returns the next response string that should be sent to the server.
.TP
\fB::SASL::reset\fR \fIcontext\fR
Re-initialize the SASL context. Discards any internal state and
permits the token to be reused.
.TP
\fB::SASL::cleanup\fR \fIcontext\fR
Release all resources associated with the SASL context. The context
token may not be used again after this procedure has been called.
.TP
\fB::SASL::mechanisms\fR ?\fItype\fR? ?\fIminimum\fR?
Returns a list of all the available SASL mechanisms. The list is
sorted by the mechanism preference value (see \fBregister\fR) with the
preferred mechanisms and the head of the list. Any mechanism with a
preference value less than the\fIminimum\fR (which defaults to 0) is removed
from the returned list. This permits a security threshold to be set. Mechanisms
with a preference less that 25 transmit authentication are particularly
susceptible to eavesdropping and should not be provided unless a secure
channel is in use (eg: tls).
.sp
The \fItype\fR parameter
may be one of \fIclient\fR or \fIserver\fR and defaults to \fIclient\fR.
Only mechanisms that have an implementation matching the \fItype\fR are
returned (this permits servers to correctly declare support only for
mechanisms that actually provide a server implementation).
.TP
\fB::SASL::register\fR \fImechanism\fR \fIpreference\fR \fIclientproc\fR ?\fIserverproc\fR?
New mechanisms can be added to the package by registering the
mechanism name and the implementing procedures. The server procedure
is optional. The preference value is an integer that is used to order
the list returned by the \fBmechanisms\fR command. Higher values
indicate a preferred mechanism. If the mechanism is already registered
then the recorded values are updated.
.PP
.SH OPTIONS
.TP
\fB-callback\fR
Specify a command to be evaluated when the SASL mechanism requires
information about the user. The command is called with the current
SASL context and a name specifying the information desired. See
\fBEXAMPLES\fR.
.TP
\fB-mechanism\fR
Set the SASL mechanism to be used. See \fBmechanisms\fR for a list of
supported authentication mechanisms.
.TP
\fB-service\fR
Set the service type for this context. Some mechanisms may make use of
this parameter (eg DIGEST-MD5, GSSAPI and Kerberos). If not set it
defaults to an empty string. If the \fB-type\fR is set to 'server'
then this option should be set to a valid service identity. Some
examples of valid service names are smtp, ldap, beep and xmpp.
.TP
\fB-server\fR
This option is used to set the server name used in SASL challenges
when operating as a SASL server.
.TP
\fB-type\fR
The context type may be one of 'client' or 'server'. The default is to
operate as a client application and respond to server
challenges. Mechanisms may be written to support server-side SASL and
setting this option will cause each \fBstep\fR to issue the next
challenge. A new context must be created for each incoming client
connection when in server mode.
.PP
.SH "CALLBACK PROCEDURE"
When the SASL framework requires any user details it will call the
procedure provided when the context was created with an argument that
specfies the item of information required.
.PP
In all cases a single response string should be returned.
.TP
login
The callback procedure should return the users authorization identity.
Return an empty string unless this is to be different to the authentication
identity. Read [1] for a discussion about the specific meaning of
authorization and authentication identities within SASL.
.TP
username
The callback procedure should return the users authentication identity.
Read [1] for a discussion about the specific meaning of
authorization and authentication identities within SASL.
.TP
password
The callback procedure should return the password that matches the
authentication identity as used within the current realm.
.sp
For server mechanisms the password callback should always be called with
the authentication identity and the realm as the first two parameters.
.TP
realm
Some SASL mechanisms use realms to partition authentication identities.
The realm string is protocol dependent and is often the current DNS
domain or in the case of the NTLM mechanism it is the Windows NT domain name.
.TP
hostname
Returns the client host name - typically [info host].
.PP
.SH MECHANISMS
.TP
ANONYMOUS
As used in FTP this mechanism only passes an email address for
authentication. The ANONYMOUS mechanism is specified in [2].
.TP
PLAIN
This is the simplest mechanism. The users authentication details are
transmitted in plain text. This mechanism should not be provided
unless an encrypted link is in use - typically after SSL or TLS has
been negotiated.
.TP
LOGIN
The LOGIN [1] mechanism transmits the users details with base64
encoding. This is no more secure than PLAIN and likewise should not be
used without a secure link.
.TP
CRAM-MD5
This mechanism avoids sending the users password over the network in
plain text by hashing the password with a server provided random value
(known as a nonce). A disadvantage of this mechanism is that the
server must maintain a database of plaintext passwords for
comparison. CRAM-MD5 was defined in [4].
.TP
DIGEST-MD5
This mechanism improves upon the CRAM-MD5 mechanism by avoiding the
need for the server to store plaintext passwords. With digest
authentication the server needs to store the MD5 digest of the users
password which helps to make the system more secure. As in CRAM-MD5
the password is hashed with a server nonce and other data before being
transmitted across the network. Specified in [3].
.TP
OTP
OTP is the One-Time Password system described in RFC 2289 [6].
This mechanism is secure against replay attacks and also avoids storing
password or password equivalents on the server. Only a digest of a seed
and a passphrase is ever transmitted across the network. Requires the
\fBotp\fR package from tcllib and one or more of the cryptographic
digest packages (md5 or sha-1 are the most commonly used).
.TP
NTLM
This is a proprietary protocol developed by Microsoft [5] and is
in common use for authenticating users in a Windows network
environment. NTLM uses DES encryption and MD4 digests of the users
password to authenticate a connection. Certain weaknesses have been
found in NTLM and thus there are a number of versions of the protocol.
As this mechanism has additional dependencies it is made available as
a separate sub-package. To enable this mechanism your application must
load the SASL::NTLM package.
.TP
X-GOOGLE-TOKEN
This is a proprietary protocol developed by Google and used for
authenticating users for the Google Talk service. This mechanism makes
a pair of HTTP requests over an SSL channel and so this mechanism
depends upon the availability of the tls and http packages. To enable
this mechanism your application must load the SASL::XGoogleToken package.
In addition you are recommended to make use of the autoproxy package to
handle HTTP proxies reasonably transparently.
.PP
.SH EXAMPLES
See the examples subdirectory for more complete samples using SASL
with network protocols. The following should give an idea how the SASL
commands are to be used. In reality this should be event
driven. Each time the \fBstep\fR command is called, the last server
response should be provided as the command argument so that the SASL
mechanism can take appropriate action.
.CS


proc ClientCallback {context command args} {
    switch -exact -- $command {
        login    { return "" }
        username { return $::tcl_platform(user) }
        password { return "SecRet" }
        realm    { return "" }
        hostname { return [info host] }
        default  { return -code error unxpected }
    }
}

proc Demo {{mech PLAIN}} {
    set ctx [SASL::new -mechanism $mech -callback ClientCallback]
    set challenge ""
    while {1} {
        set more_steps [SASL::step $ctx challenge]
        puts "Send '[SASL::response $ctx]'"
        puts "Read server response into challenge var"
        if {!$more_steps} {break}
    }
    SASL::cleanup $ctx
}

.CE
.SH REFERENCES
.IP [1]
Myers, J. "Simple Authentication and Security Layer (SASL)",
RFC 2222, October 1997.
(\fIhttp://www.ietf.org/rfc/rfc2222.txt\fR)
.IP [2]
Newman, C. "Anonymous SASL Mechanism",
RFC 2245, November 1997.
(\fIhttp://www.ietf.org/rfc/rfc2245.txt\fR)
.IP [3]
Leach, P., Newman, C. "Using Digest Authentication as a SASL
Mechanism", RFC 2831, May 2000,
(\fIhttp://www.ietf.org/rfc/rfc2831.txt\fR)
.IP [4]
Klensin, J., Catoe, R. and Krumviede, P.,
"IMAP/POP AUTHorize Extension for Simple Challenge/Response"
RFC 2195, September 1997.
(\fIhttp://www.ietf.org/rfc/rfc2195.txt\fR)
.IP [5]
No official specification is available. However,
\fIhttp://davenport.sourceforge.net/ntlm.html\fR provides a good
description.
.IP [6]
Haller, N. et al., "A One-Time Password System",
RFC 2289, February 1998,
(\fIhttp://www.ieft.org/rfc/rfc2289.txt\fR)
.PP
.SH AUTHORS
Pat Thoyts
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIsasl\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
SASL, authentication
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) 2005-2006, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/sha1/sha1.n.
























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/sha1/sha1.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "sha1" n 2.0.3 tcllib "SHA-x Message-Digest Algorithm"
.BS
.SH NAME
sha1 \- SHA1 Message-Digest Algorithm
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBsha1  ?2.0.3?\fR
.sp
\fB::sha1::sha1\fR ?\fI-hex|-bin\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::sha1::hmac\fR \fIkey\fR \fIstring\fR
.sp
\fB::sha1::hmac\fR ?\fI-hex|-bin\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::sha1::SHA1Init\fR
.sp
\fB::sha1::SHA1Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::sha1::SHA1Final\fR \fItoken\fR
.sp
\fB::sha1::HMACInit\fR \fIkey\fR
.sp
\fB::sha1::HMACUpdate\fR \fItoken\fR \fIdata\fR
.sp
\fB::sha1::HMACFinal\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides an implementation in Tcl of the SHA1
message-digest algorithm as specified by FIPS PUB 180-1 (1). This
algorithm takes a message and generates a 160-bit digest from the
input. The SHA1 algorithm is related to the MD4 algorithm (2) but has
been strengthend against certain types of cryptographic attack. SHA1
should be used in preference to MD4 or MD5 in new applications.
.PP
This package also includes support for creating keyed message-digests
using the HMAC algorithm from RFC 2104 (3) with SHA1 as the
message-digest.
.SH COMMANDS
.TP
\fB::sha1::sha1\fR ?\fI-hex|-bin\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
The command takes a message and returns the SHA1 digest of this message
as a hexadecimal string. You may request the result as binary data by
giving \fI-bin\fR.
.sp
The data to be hashed can be specified either as a string argument to
the \fBsha1\fR command, or as a filename or a pre-opened channel. If the
\fI-filename\fR argument is given then the file is opened, the data read
and hashed and the file is closed. If the \fI-channel\fR argument is
given then data is read from the channel until the end of file. The
channel is not closed. \fINOTE\fR use of the channel or filename
options results in the internal use of \fBvwait\fR. To avoid nested
event loops in Tk or tclhttpd applications you should use the
incremental programming API (see below).
.sp
Only one of \fI-file\fR, \fI-channel\fR or \fIstring\fR should be given.
.TP
\fB::sha1::hmac\fR \fIkey\fR \fIstring\fR
.TP
\fB::sha1::hmac\fR ?\fI-hex|-bin\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate an Hashed Message Authentication digest (HMAC) using the SHA1
digest algorithm. HMACs are described in RFC 2104 (3) and provide an SHA1
digest that includes a key. All options other than \fI-key\fR are as
for the \fB::sha1::sha1\fR command.
.PP
.SH "PROGRAMMING INTERFACE"
For the programmer, the SHA1 hash can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
derived from the data that was poured into the bucket. The programming
interface to the SHA1 hash operates on a token (equivalent to the
bucket). You call \fBSHA1Init\fR to obtain a token and then call
\fBSHA1Update\fR as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call
\fBSHA1Final\fR. An equivalent set of functions gives you a keyed digest
(HMAC).
.PP
If you have \fBcritcl\fR and have built the \fBtcllibc\fR package
then the implementation of the hashing function will be performed by compiled
code. Failing that if you have the \fBTrf\fR package then this can
be used otherwise there is a pure-tcl equivalent. The programming
interface remains the same in all cases.
.TP
\fB::sha1::SHA1Init\fR
Begins a new SHA1 hash. Returns a token ID that must be used for the
remaining functions.
.TP
\fB::sha1::SHA1Update\fR \fItoken\fR \fIdata\fR
Add data to the hash identified by token. Calling
\fISHA1Update $token "abcd"\fR is equivalent to calling
\fISHA1Update $token "ab"\fR followed by
\fISHA1Update $token "cb"\fR. See \fBEXAMPLES\fR.
.TP
\fB::sha1::SHA1Final\fR \fItoken\fR
Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 20 bytes representing the 160 bit SHA1
digest value.
.TP
\fB::sha1::HMACInit\fR \fIkey\fR
This is equivalent to the \fB::sha1::SHA1Init\fR command except that
it requires the key that will be included in the HMAC.
.TP
\fB::sha1::HMACUpdate\fR \fItoken\fR \fIdata\fR
.TP
\fB::sha1::HMACFinal\fR \fItoken\fR
These commands are identical to the SHA1 equivalent commands.
.PP
.SH EXAMPLES
.CS


% sha1::sha1 "Tcl does SHA1"
285a6a91c45a9066bf39fcf24425796ef0b2a8bf

.CE
.CS


% sha1::hmac Sekret "Tcl does SHA1"
ae6251fa51b95b18cba2be95eb031d07475ff03c

.CE
.CS


% set tok [sha1::SHA1Init]
::sha1::1
% sha1::SHA1Update $tok "Tcl "
% sha1::SHA1Update $tok "does "
% sha1::SHA1Update $tok "SHA1"
% sha1::Hex [sha1::SHA1Final $tok]
285a6a91c45a9066bf39fcf24425796ef0b2a8bf

.CE
.SH REFERENCES
.IP [1]
"Secure Hash Standard", National Institute of Standards
and Technology, U.S. Department Of Commerce, April 1995.
(\fIhttp://www.itl.nist.gov/fipspubs/fip180-1.htm\fR)
.IP [2]
Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT,
April 1992. (\fIhttp://www.rfc-editor.org/rfc/rfc1320.txt\fR)
.IP [3]
Krawczyk, H., Bellare, M. and Canetti, R. "HMAC: Keyed-Hashing for
Message Authentication", RFC 2104, February 1997.
(\fIhttp://www.rfc-editor.org/rfc/rfc2104.txt\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIsha1\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
md4, md5, ripemd128, ripemd160
.SH KEYWORDS
FIPS 180-1, hashing, message-digest, rfc 2104, security, sha1
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2005, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/sha1/sha256.n.





































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/sha1/sha256.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008, Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "sha256" n 1.0.3 tcllib "SHA-x Message-Digest Algorithm"
.BS
.SH NAME
sha256 \- SHA256 Message-Digest Algorithm
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBsha256  ?1.0.3?\fR
.sp
\fB::sha2::sha256\fR ?\fI-hex|-bin\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::sha2::sha224\fR ?\fI-hex|-bin\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::sha2::hmac\fR \fIkey\fR \fIstring\fR
.sp
\fB::sha2::hmac\fR ?\fI-hex|-bin\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
.sp
\fB::sha2::SHA256Init\fR
.sp
\fB::sha2::SHA224Init\fR
.sp
\fB::sha2::SHA256Update\fR \fItoken\fR \fIdata\fR
.sp
\fB::sha2::SHA256Final\fR \fItoken\fR
.sp
\fB::sha2::SHA224Final\fR \fItoken\fR
.sp
\fB::sha2::HMACInit\fR \fIkey\fR
.sp
\fB::sha2::HMACUpdate\fR \fItoken\fR \fIdata\fR
.sp
\fB::sha2::HMACFinal\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides an implementation in Tcl of the SHA256 and
SHA224 message-digest algorithms as specified by FIPS PUB 180-1
(1). These algorithms take a message and generates a 256-bit (224-bit)
digest from the input. The SHA2 algorithms are related to the SHA1
algorithm.
.PP
This package also includes support for creating keyed message-digests
using the HMAC algorithm from RFC 2104 (3) with SHA256 as the
message-digest.
.SH COMMANDS
.TP
\fB::sha2::sha256\fR ?\fI-hex|-bin\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
The command takes a message and returns the SHA256 digest of this
message as a hexadecimal string. You may request the result as binary
data by giving \fI-bin\fR.
.sp
The data to be hashed can be specified either as a string argument to
the \fBsha256\fR command, or as a filename or a pre-opened channel. If the
\fI-filename\fR argument is given then the file is opened, the data read
and hashed and the file is closed. If the \fI-channel\fR argument is
given then data is read from the channel until the end of file. The
channel is not closed. \fINOTE\fR use of the channel or filename
options results in the internal use of \fBvwait\fR. To avoid nested
event loops in Tk or tclhttpd applications you should use the
incremental programming API (see below).
.sp
Only one of \fI-file\fR, \fI-channel\fR or \fIstring\fR should be given.
.TP
\fB::sha2::sha224\fR ?\fI-hex|-bin\fR? [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Like \fB::sha2::sha256\fR, except that the SHA224 digest is returned.
.TP
\fB::sha2::hmac\fR \fIkey\fR \fIstring\fR
.TP
\fB::sha2::hmac\fR ?\fI-hex|-bin\fR? \fI-key key\fR [ \fI-channel channel\fR | \fI-file filename\fR | \fIstring\fR ]
Calculate an Hashed Message Authentication digest (HMAC) using the
SHA256 digest algorithm. HMACs are described in RFC 2104 (3) and
provide an SHA256 digest that includes a key. All options other than
\fI-key\fR are as for the \fB::sha2::sha256\fR command.
.PP
.SH "PROGRAMMING INTERFACE"
For the programmer, the SHA256 hash can be viewed as a bucket into
which one pours data. When you have finished, you extract a value that
is derived from the data that was poured into the bucket. The
programming interface to the SHA256 hash operates on a token
(equivalent to the bucket). You call \fBSHA256Init\fR to obtain a
token and then call \fBSHA256Update\fR as many times as required to
add data to the hash. To release any resources and obtain the hash
value, you then call \fBSHA256Final\fR. An equivalent set of
functions gives you a keyed digest (HMAC).
.PP
If you have \fBcritcl\fR and have built the \fBtcllibc\fR
package then the implementation of the hashing function will be
performed by compiled code. Failing that there is a pure-tcl
equivalent. The programming interface remains the same in all cases.
.TP
\fB::sha2::SHA256Init\fR
.TP
\fB::sha2::SHA224Init\fR
Begins a new SHA256/SHA224 hash. Returns a token ID that must be used
for the remaining functions.
.TP
\fB::sha2::SHA256Update\fR \fItoken\fR \fIdata\fR
Add data to the hash identified by token. Calling
\fISHA256Update $token "abcd"\fR is equivalent to calling
\fISHA256Update $token "ab"\fR followed by
\fISHA256Update $token "cb"\fR. See \fBEXAMPLES\fR.
Note that this command is used for both SHA256 and SHA224. Only the
initialization and finalization commands of both hashes differ.
.TP
\fB::sha2::SHA256Final\fR \fItoken\fR
.TP
\fB::sha2::SHA224Final\fR \fItoken\fR
Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 32/28 bytes representing the 256/224 bit
SHA256 / SHA224 digest value.
.TP
\fB::sha2::HMACInit\fR \fIkey\fR
This is equivalent to the \fB::sha2::SHA256Init\fR command except
that it requires the key that will be included in the HMAC.
.TP
\fB::sha2::HMACUpdate\fR \fItoken\fR \fIdata\fR
.TP
\fB::sha2::HMACFinal\fR \fItoken\fR
These commands are identical to the SHA256 equivalent commands.
.PP
.SH EXAMPLES
.CS


% sha2::sha256 "Tcl does SHA256"
0b91043ee484abd83c3e4b08d6034d71b937026379f0f59bda6e625e6e214789

.CE
.CS


% sha2::hmac Sekret "Tcl does SHA256"
4f9352c64d655e8a36abe73e6163a9d7a54039877c1c92ec90b07d48d4e854e0

.CE
.CS


% set tok [sha2::SHA256Init]
::sha2::1
% sha2::SHA256Update $tok "Tcl "
% sha2::SHA256Update $tok "does "
% sha2::SHA256Update $tok "SHA256"
% sha2::Hex [sha2::SHA256Final $tok]
0b91043ee484abd83c3e4b08d6034d71b937026379f0f59bda6e625e6e214789

.CE
.SH REFERENCES
.IP [1]
"Secure Hash Standard", National Institute of Standards
and Technology, U.S. Department Of Commerce, April 1995.
(\fIhttp://www.itl.nist.gov/fipspubs/fip180-1.htm\fR)
.IP [2]
Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT,
April 1992. (\fIhttp://www.rfc-editor.org/rfc/rfc1320.txt\fR)
.IP [3]
Krawczyk, H., Bellare, M. and Canetti, R. "HMAC: Keyed-Hashing for
Message Authentication", RFC 2104, February 1997.
(\fIhttp://www.rfc-editor.org/rfc/rfc2104.txt\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIsha1\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
md4, md5, ripemd128, ripemd160, sha1
.SH KEYWORDS
FIPS 180-1, hashing, message-digest, rfc 2104, security, sha256
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2008, Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/simulation/annealing.n.

































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/simulation/annealing.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Arjen Markus <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "simulation::annealing" n 0.2 tcllib "Tcl Simulation Tools"
.BS
.SH NAME
simulation::annealing \- Simulated annealing
.SH SYNOPSIS
package require \fBTcl  ?8.4?\fR
.sp
package require \fBsimulation::annealing  0.2\fR
.sp
\fB::simulation::annealing::getOption\fR \fIkeyword\fR
.sp
\fB::simulation::annealing::hasOption\fR \fIkeyword\fR
.sp
\fB::simulation::annealing::setOption\fR \fIkeyword\fR \fIvalue\fR
.sp
\fB::simulation::annealing::findMinimum\fR \fIargs\fR
.sp
\fB::simulation::annealing::findCombinatorialMinimum\fR \fIargs\fR
.sp
.BE
.SH DESCRIPTION
.PP
The technique of \fIsimulated annealing\fR provides methods to
estimate the global optimum of a function. It is described in some
detail on the Wiki \fIhttp://wiki.tcl.tk/...\fR. The idea is simple:
.IP \(bu
randomly select points within a given search space
.IP \(bu
evaluate the function to be optimised for each of these
points and select the point that has the lowest (or highest)
function value or - sometimes - accept a point that has a less optimal
value. The chance by which such a non-optimal point is accepted diminishes over
time.
.IP \(bu
Accepting less optimal points means the method does not necessarily get
stuck in a local optimum and theoretically it is capable of finding the
global optimum within the search space.
.PP
The method resembles the cooling of material, hence the name.
.PP
The package \fIsimulation::annealing\fR offers the command \fIfindMinimum\fR:
.CS


    puts [::simulation::annealing::findMinimum  -trials 300  -parameters {x -5.0 5.0 y -5.0 5.0}  -function {$x*$x+$y*$y+sin(10.0*$x)+4.0*cos(20.0*$y)}]

.CE
prints the estimated minimum value of the function f(x,y) =
\fIx**2+y**2+sin(10*x)+4*cos(20*y)\fR and the values of x and y where
the minimum was attained:
.CS


result -4.9112922923 x -0.181647676593 y 0.155743646974

.CE
.SH PROCEDURES
The package defines the following auxiliary procedures:
.TP
\fB::simulation::annealing::getOption\fR \fIkeyword\fR
Get the value of an option given as part of the \fIfindMinimum\fR
command.
.RS
.TP
string \fIkeyword\fR
Given keyword (without leading minus)
.RE
.sp
.TP
\fB::simulation::annealing::hasOption\fR \fIkeyword\fR
Returns 1 if the option is available, 0 if not.
.RS
.TP
string \fIkeyword\fR
Given keyword (without leading minus)
.RE
.sp
.TP
\fB::simulation::annealing::setOption\fR \fIkeyword\fR \fIvalue\fR
Set the value of the given option.
.RS
.TP
string \fIkeyword\fR
Given keyword (without leading minus)
.TP
string \fIvalue\fR
(New) value for the option
.RE
.PP
The main procedures are \fIfindMinimum\fR and \fIfindCombinatorialMinimum\fR:
.TP
\fB::simulation::annealing::findMinimum\fR \fIargs\fR
Find the minimum of a function using simulated annealing. The function
and the method's parameters is given via a list of
keyword-value pairs.
.RS
.TP
int \fIn\fR
List of keyword-value pairs, all of which are available
during the execution via the \fIgetOption\fR command.
.RE
.TP
\fB::simulation::annealing::findCombinatorialMinimum\fR \fIargs\fR
Find the minimum of a function of discrete variables using simulated
annealing. The function and the method's parameters is given via a list of
keyword-value pairs.
.RS
.TP
int \fIn\fR
List of keyword-value pairs, all of which are available
during the execution via the \fIgetOption\fR command.
.RE
.PP
The \fIfindMinimum\fR command predefines the following options:
.IP \(bu
\fI-parameters list\fR: triples defining parameters and ranges
.IP \(bu
\fI-function expr\fR: expression defining the function
.IP \(bu
\fI-code body\fR: body of code to define the function (takes
precedence over \fI-function\fR). The code should set the variable
"result"
.IP \(bu
\fI-init code\fR: code to be run at start up
\fI-final code\fR: code to be run at the end
\fI-trials n\fR: number of trials before reducing the temperature
\fI-reduce factor\fR: reduce the temperature by this factor (between 0 and 1)
\fI-initial-temp t\fR: initial temperature
\fI-scale s\fR: scale of the function (order of magnitude of the values)
\fI-estimate-scale y/n\fR: estimate the scale (only if \fI-scale\fR
is not present)
\fI-verbose y/n\fR: print detailed information on progress to the
report file (1) or not (0)
\fI-reportfile file\fR: opened file to print to (defaults to stdout)
.PP
Any other options can be used via the getOption procedure
in the body.
The \fIfindCombinatorialMinimum\fR command predefines the following
options:
.IP \(bu
\fI-number-params n\fR: number of binary parameters (the solution
space consists of lists of 1s and 0s). This is a required option.
.IP \(bu
\fI-initial-values\fR: list of 1s and 0s constituting the start of
the search.
.PP
The other predefined options are identical to those of \fIfindMinimum\fR.
.SH TIPS
The procedure \fIfindMinimum\fR works by constructing a temporary
procedure that does the actual work. It loops until the point
representing the estimated optimum does not change anymore within the
given number of trials. As the temperature gets lower and lower the
chance of accepting a point with a higher value becomes lower too, so
the procedure will in practice terminate.
.PP
It is possible to optimise over a non-rectangular region, but some care
must be taken:
.IP \(bu
If the point is outside the region of interest, you can specify a very
high value.
.IP \(bu
This does mean that the automatic determination of a scale factor is
out of the question - the high function values that force the point
inside the region would distort the estimation.
.PP
Here is an example of finding an optimum inside a circle:
.CS


    puts [::simulation::annealing::findMinimum  -trials 3000  -reduce 0.98  -parameters {x -5.0 5.0 y -5.0 5.0}  -code {
            if { hypot($x-5.0,$y-5.0) < 4.0 } {
                set result [expr {$x*$x+$y*$y+sin(10.0*$x)+4.0*cos(20.0*$y)}]
            } else {
                set result 1.0e100
            }
        }]

.CE
The method is theoretically capable of determining the global optimum,
but often you need to use a large number of trials and a slow reduction
of temperature to get reliable and repeatable estimates.
.PP
You can use the \fI-final\fR option to use a deterministic optimization
method, once you are sure you are near the required optimum.
.PP
The \fIfindCombinatorialMinimum\fR procedure is suited for situations
where the parameters have the values 0 or 1 (and there can be many of
them). Here is an example:
.IP \(bu
We have a function that attains an absolute minimum if the first ten
numbers are 1 and the rest is 0:
.CS


proc cost {params} {
    set cost 0
    foreach p [lrange $params 0 9] {
        if { $p == 0 } {
            incr cost
        }
    }
    foreach p [lrange $params 10 end] {
        if { $p == 1 } {
            incr cost
        }
    }
    return $cost
}

.CE
.IP \(bu
We want to find the solution that gives this minimum for various lengths
of the solution vector \fIparams\fR:
.CS


foreach n {100 1000 10000} {
    break
    puts "Problem size: $n"
    puts [::simulation::annealing::findCombinatorialMinimum  -trials 300  -verbose 0  -number-params $n  -code {set result [cost $params]}]
}

.CE
.IP \(bu
As the vector grows, the computation time increases, but the procedure
will stop if some kind of equilibrium is reached. To achieve a useful
solution you may want to try different values of the trials parameter
for instance. Also ensure that the function to be minimized depends on
all or most parameters - see the source code for a counter example and
run that.
.PP
.SH KEYWORDS
math, optimization, simulated annealing
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2008 Arjen Markus <[email protected]>

.fi

Added embedded/man/files/modules/simulation/montecarlo.n.















































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/simulation/montecarlo.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Arjen Markus <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "simulation::montecarlo" n 0.1 tcllib "Tcl Simulation Tools"
.BS
.SH NAME
simulation::montecarlo \- Monte Carlo simulations
.SH SYNOPSIS
package require \fBTcl  ?8.4?\fR
.sp
package require \fBsimulation::montecarlo  0.1\fR
.sp
package require \fBsimulation::random \fR
.sp
package require \fBmath::statistics \fR
.sp
\fB::simulation::montecarlo::getOption\fR \fIkeyword\fR
.sp
\fB::simulation::montecarlo::hasOption\fR \fIkeyword\fR
.sp
\fB::simulation::montecarlo::setOption\fR \fIkeyword\fR \fIvalue\fR
.sp
\fB::simulation::montecarlo::setTrialResult\fR \fIvalues\fR
.sp
\fB::simulation::montecarlo::setExpResult\fR \fIvalues\fR
.sp
\fB::simulation::montecarlo::getTrialResults\fR
.sp
\fB::simulation::montecarlo::getExpResult\fR
.sp
\fB::simulation::montecarlo::transposeData\fR \fIvalues\fR
.sp
\fB::simulation::montecarlo::integral2D\fR \fI...\fR
.sp
\fB::simulation::montecarlo::singleExperiment\fR \fIargs\fR
.sp
.BE
.SH DESCRIPTION
.PP
The technique of \fIMonte Carlo simulations\fR is basically simple:
.IP \(bu
generate random values for one or more parameters.
.IP \(bu
evaluate the model of some system you are interested in and record the
interesting results for each realisation of these parameters.
.IP \(bu
after a suitable number of such trials, deduce an overall characteristic
of the model.
.PP
You can think of a model of a network of computers, an ecosystem of some
kind or in fact anything that can be quantitatively described and has
some stochastic element in it.
.PP
The package \fIsimulation::montecarlo\fR offers a basic framework for
such a modelling technique:
.CS


#
# MC experiments:
# Determine the mean and median of a set of points and compare them
#
::simulation::montecarlo::singleExperiment -init {
    package require math::statistics

    set prng [::simulation::random::prng_Normal 0.0 1.0]
} -loop {
    set numbers {}
    for { set i 0 } { $i < [getOption samples] } { incr i } {
        lappend numbers [$prng]
    }
    set mean   [::math::statistics::mean $numbers]
    set median [::math::statistics::median $numbers] ;# ? Exists?
    setTrialResult [list $mean $median]
} -final {
    set result [getTrialResults]
    set means   {}
    set medians {}
    foreach r $result {
        foreach {m M} $r break
        lappend means   $m
        lappend medians $M
    }
    puts [getOption reportfile] "Correlation: [::math::statistics::corr $means $medians]"

} -trials 100 -samples 10 -verbose 1 -columns {Mean Median}

.CE
This example attemps to find out how well the median value and the mean
value of a random set of numbers correlate. Sometimes a median value is
a more robust characteristic than a mean value - especially if you have
a statistical distribution with "fat" tails.
.SH PROCEDURES
The package defines the following auxiliary procedures:
.TP
\fB::simulation::montecarlo::getOption\fR \fIkeyword\fR
Get the value of an option given as part of the \fIsingeExperiment\fR command.
.RS
.TP
string \fIkeyword\fR
Given keyword (without leading minus)
.RE
.sp
.TP
\fB::simulation::montecarlo::hasOption\fR \fIkeyword\fR
Returns 1 if the option is available, 0 if not.
.RS
.TP
string \fIkeyword\fR
Given keyword (without leading minus)
.RE
.sp
.TP
\fB::simulation::montecarlo::setOption\fR \fIkeyword\fR \fIvalue\fR
Set the value of the given option.
.RS
.TP
string \fIkeyword\fR
Given keyword (without leading minus)
.TP
string \fIvalue\fR
(New) value for the option
.RE
.sp
.TP
\fB::simulation::montecarlo::setTrialResult\fR \fIvalues\fR
Store the results of the trial for later analysis
.RS
.TP
list \fIvalues\fR
List of values to be stored
.RE
.sp
.TP
\fB::simulation::montecarlo::setExpResult\fR \fIvalues\fR
Set the results of the entire experiment (typically used in the final
phase).
.RS
.TP
list \fIvalues\fR
List of values to be stored
.RE
.sp
.TP
\fB::simulation::montecarlo::getTrialResults\fR
Get the results of all individual trials for analysis (typically used in
the final phase or after completion of the command).
.sp
.TP
\fB::simulation::montecarlo::getExpResult\fR
Get the results of the entire experiment (typically used in the final
phase or even after completion of the \fIsingleExperiment\fR command).
.sp
.TP
\fB::simulation::montecarlo::transposeData\fR \fIvalues\fR
Interchange columns and rows of a list of lists and return the result.
.RS
.TP
list \fIvalues\fR
List of lists of values
.RE
.PP
There are two main procedures: \fIintegral2D\fR and \fIsingleExperiment\fR.
.TP
\fB::simulation::montecarlo::integral2D\fR \fI...\fR
Integrate a function over a two-dimensional region using a Monte Carlo
approach.
.sp
Arguments PM
.sp
.TP
\fB::simulation::montecarlo::singleExperiment\fR \fIargs\fR
Iterate code over a number of trials and store the results. The
iteration is gouverned by parameters given via a list of
keyword-value pairs.
.RS
.TP
int \fIn\fR
List of keyword-value pairs, all of which are available
during the execution via the \fIgetOption\fR command.
.RE
.PP
The \fIsingleExperiment\fR command predefines the following
options:
.IP \(bu
\fI-init code\fR: code to be run at start up
.IP \(bu
\fI-loop body\fR: body of code that defines the computation to
be run time and again. The code should use \fIsetTrialResult\fR
to store the results of each trial (typically a list of numbers,
but the interpretation is up to the implementation). Note: Required keyword.
.IP \(bu
\fI-final code\fR: code to be run at the end
.IP \(bu
\fI-trials n\fR: number of trials in the experiment (required)
.IP \(bu
\fI-reportfile file\fR: opened file to send the output to (default: stdout)
.IP \(bu
\fI-verbose\fR: write the intermediate results (1) or not (0) (default: 0)
.IP \(bu
\fI-analysis proc\fR: either "none" (no automatic analysis), standard
(basic statistics of the trial results and a correlation matrix) or the
name of a procedure that will take care of the analysis.
.IP \(bu
\fI-columns list\fR: list of column names, useful for verbose output
and the analysis
.PP
Any other options can be used via the getOption procedure
in the body.
.SH TIPS
The procedure \fIsingleExperiment\fR works by constructing a
temporary procedure that does the actual work. It loops for the given
number of trials.
.PP
As it constructs a temporary procedure, local variables defined at the
start continue to exist in the loop.
.SH KEYWORDS
math, montecarlo simulation, stochastic modelling
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2008 Arjen Markus <[email protected]>

.fi

Added embedded/man/files/modules/simulation/simulation_random.n.





































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/simulation/simulation_random.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Arjen Markus <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "simulation::random" n 0.1 tcllib "Tcl Simulation Tools"
.BS
.SH NAME
simulation::random \- Pseudo-random number generators
.SH SYNOPSIS
package require \fBTcl  ?8.4?\fR
.sp
package require \fBsimulation::random  0.1\fR
.sp
\fB::simulation::random::prng_Bernoulli\fR \fIp\fR
.sp
\fB::simulation::random::prng_Discrete\fR \fIn\fR
.sp
\fB::simulation::random::prng_Poisson\fR \fIlambda\fR
.sp
\fB::simulation::random::prng_Uniform\fR \fImin\fR \fImax\fR
.sp
\fB::simulation::random::prng_Exponential\fR \fImin\fR \fImean\fR
.sp
\fB::simulation::random::prng_Normal\fR \fImean\fR \fIstdev\fR
.sp
\fB::simulation::random::prng_Pareto\fR \fImin\fR \fIsteep\fR
.sp
\fB::simulation::random::prng_Gumbel\fR \fImin\fR \fIf\fR
.sp
\fB::simulation::random::prng_chiSquared\fR \fIdf\fR
.sp
\fB::simulation::random::prng_Disk\fR \fIrad\fR
.sp
\fB::simulation::random::prng_Sphere\fR \fIrad\fR
.sp
\fB::simulation::random::prng_Ball\fR \fIrad\fR
.sp
\fB::simulation::random::prng_Rectangle\fR \fIlength\fR \fIwidth\fR
.sp
\fB::simulation::random::prng_Block\fR \fIlength\fR \fIwidth\fR \fIdepth\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package consists of commands to generate pseudo-random number
generators. These new commands deliver
.IP \(bu
numbers that are distributed normally, uniformly, according to a
Pareto or Gumbel distribution and so on
.IP \(bu
coordinates of points uniformly spread inside a sphere or a rectangle
.PP
For example:
.CS


    set p [::simulation::random::prng_Normal -1.0 10.0]

.CE
produces a new command (whose name is stored in the variable "p") that
generates normally distributed numbers with a mean of -1.0 and a
standard deviation of 10.0.
.SH PROCEDURES
The package defines the following public procedures for \fIdiscrete\fR
distributions:
.TP
\fB::simulation::random::prng_Bernoulli\fR \fIp\fR
Create a command (PRNG) that generates numbers with a Bernoulli
distribution: the value is either 1 or 0, with a chance p to be 1
.RS
.TP
float \fIp\fR
Chance the outcome is 1
.RE
.sp
.TP
\fB::simulation::random::prng_Discrete\fR \fIn\fR
Create a command (PRNG) that generates numbers 0 to n-1 with equal
probability.
.RS
.TP
int \fIn\fR
Number of different values (ranging from 0 to n-1)
.RE
.sp
.TP
\fB::simulation::random::prng_Poisson\fR \fIlambda\fR
Create a command (PRNG) that generates numbers according to the Poisson
distribution.
.RS
.TP
float \fIlambda\fR
Mean number per time interval
.RE
.PP
The package defines the following public procedures for \fIcontinuous\fR distributions:
.TP
\fB::simulation::random::prng_Uniform\fR \fImin\fR \fImax\fR
Create a command (PRNG) that generates uniformly distributed numbers
between "min" and "max".
.RS
.TP
float \fImin\fR
Minimum number that will be generated
.TP
float \fImax\fR
Maximum number that will be generated
.RE
.sp
.TP
\fB::simulation::random::prng_Exponential\fR \fImin\fR \fImean\fR
Create a command (PRNG) that generates exponentially distributed numbers
with a given minimum value and a given mean value.
.RS
.TP
float \fImin\fR
Minimum number that will be generated
.TP
float \fImean\fR
Mean value for the numbers
.RE
.sp
.TP
\fB::simulation::random::prng_Normal\fR \fImean\fR \fIstdev\fR
Create a command (PRNG) that generates normally distributed numbers
with a given mean value and a given standard deviation.
.RS
.TP
float \fImean\fR
Mean value for the numbers
.TP
float \fIstdev\fR
Standard deviation
.RE
.sp
.TP
\fB::simulation::random::prng_Pareto\fR \fImin\fR \fIsteep\fR
Create a command (PRNG) that generates numbers distributed according to
Pareto with a given minimum value and a given distribution steepness.
.RS
.TP
float \fImin\fR
Minimum number that will be generated
.TP
float \fIsteep\fR
Steepness of the distribution
.RE
.sp
.TP
\fB::simulation::random::prng_Gumbel\fR \fImin\fR \fIf\fR
Create a command (PRNG) that generates numbers distributed according to
Gumbel with a given minimum value and a given scale factor. The
probability density function is:
.CS


     P(v) = exp( -exp(f*(v-min)))

.CE
.RS
.TP
float \fImin\fR
Minimum number that will be generated
.TP
float \fIf\fR
Scale factor for the values
.RE
.sp
.TP
\fB::simulation::random::prng_chiSquared\fR \fIdf\fR
Create a command (PRNG) that generates numbers distributed according to
the chi-squared distribution with df degrees of freedom. The mean is 0
and the standard deviation is 1.
.RS
.TP
float \fIdf\fR
Degrees of freedom
.RE
.PP
The package defines the following public procedures for random point sets:
.TP
\fB::simulation::random::prng_Disk\fR \fIrad\fR
Create a command (PRNG) that generates (x,y)-coordinates for points
uniformly spread over a disk of given radius.
.RS
.TP
float \fIrad\fR
Radius of the disk
.RE
.sp
.TP
\fB::simulation::random::prng_Sphere\fR \fIrad\fR
Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread over the surface of a sphere of given radius.
.RS
.TP
float \fIrad\fR
Radius of the disk
.RE
.sp
.TP
\fB::simulation::random::prng_Ball\fR \fIrad\fR
Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread within a ball of given radius.
.RS
.TP
float \fIrad\fR
Radius of the ball
.RE
.sp
.TP
\fB::simulation::random::prng_Rectangle\fR \fIlength\fR \fIwidth\fR
Create a command (PRNG) that generates (x,y)-coordinates for points
uniformly spread over a rectangle.
.RS
.TP
float \fIlength\fR
Length of the rectangle (x-direction)
.TP
float \fIwidth\fR
Width of the rectangle (y-direction)
.RE
.sp
.TP
\fB::simulation::random::prng_Block\fR \fIlength\fR \fIwidth\fR \fIdepth\fR
Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread over a block
.RS
.TP
float \fIlength\fR
Length of the block (x-direction)
.TP
float \fIwidth\fR
Width of the block (y-direction)
.TP
float \fIdepth\fR
Depth of the block (z-direction)
.RE
.PP
.SH KEYWORDS
math, random numbers, simulation, statistical distribution
.SH CATEGORY
Mathematics
.SH COPYRIGHT
.nf
Copyright (c) 2004 Arjen Markus <[email protected]>

.fi

Added embedded/man/files/modules/smtpd/smtpd.n.

















































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/smtpd/smtpd.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "smtpd" n 1.5 tcllib "Tcl SMTP Server Package"
.BS
.SH NAME
smtpd \- Tcl SMTP server implementation
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBsmtpd  ?1.5?\fR
.sp
\fB::smtpd::start\fR ?\fImyaddr\fR? ?\fIport\fR?
.sp
\fB::smtpd::stop\fR
.sp
\fB::smptd::configure\fR ?\fIoption\fR \fIvalue\fR? ?\fIoption\fR \fIvalue\fR \fI...\fR?
.sp
\fB::smtpd::cget\fR ?\fIoption\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBsmtpd\fR package provides a simple Tcl-only server library
for the Simple Mail Transfer Protocol as described in
RFC  821 (\fIhttp://www.rfc-editor.org/rfc/rfc821.txt\fR) and
RFC 2821 (\fIhttp://www.rfc-editor.org/rfc/rfc2821.txt\fR).
By default the server will bind to the default network address and the
standard SMTP port (25).
.PP
This package was designed to permit testing of Mail User Agent code
from a developers workstation. \fIIt does not attempt to deliver  mail to your mailbox.\fR Instead users of this package are expected to
write a procedure that will be called when mail arrives. Once this
procedure returns, the server has nothing further to do with the mail.
.SH SECURITY
On Unix platforms binding to the SMTP port requires root privileges. I
would not recommend running any script-based server as root unless
there is some method for dropping root privileges immediately after
the socket is bound. Under Windows platforms, it is not necessary to
have root or administrator privileges to bind low numbered
sockets. However, security on these platforms is weak anyway.
.PP
In short, this code should probably not be used as a permanently
running Mail Transfer Agent on an Internet connected server, even
though we are careful not to evaluate remote user input. There are
many other well tested and security audited programs that can be used
as mail servers for internet connected hosts.
.SH COMMANDS
.TP
\fB::smtpd::start\fR ?\fImyaddr\fR? ?\fIport\fR?
Start the service listening on \fIport\fR or the default port 25. If
\fImyaddr\fR is given as a domain-style name or numerical
dotted-quad IP address then the server socket will be bound to that
network interface. By default the server is bound to all network
interfaces. For example:
.sp
.CS


  set sock [::smtpd::start [info hostname] 0]

.CE
.sp
will bind to the hosts internet interface on the first available port.
.sp
At present the package only supports a single instance of a SMTP
server. This could be changed if required at the cost of making the
package a little more complicated to read. If there is a good reason
for running multiple SMTP services then it will only be necessary to
fix the \fBoptions\fR array and the \fB::smtpd::stopped\fR variable
usage.
.sp
As the server code uses \fBfileevent\fR(n) handlers to process the
input on sockets you will need to run the event loop. This means
either you should be running from within \fBwish\fR(1) or you
should \fBvwait\fR(n) on the \fB::smtpd::stopped\fR variable which is
set when the server is stopped.
.TP
\fB::smtpd::stop\fR
Halt the server and release the listening socket. If the server has
not been started then this command does nothing.
The \fB::smtpd::stopped\fR variable is set for use with
\fBvwait\fR(n).
.sp
It should be noted that stopping the server does not disconnect any
currently active sessions as these are operating over an independent
channel. Only explicitly tracking and closing these sessions, or
exiting the server process will close down all the running
sessions. This is similar to the usual unix daemon practice where the
server performs a \fBfork\fR(2) and the client session continues on
the child process.
.TP
\fB::smptd::configure\fR ?\fIoption\fR \fIvalue\fR? ?\fIoption\fR \fIvalue\fR \fI...\fR?
Set configuration options for the SMTP server. Most values are the
name of a callback procedure to be called at various points in the
SMTP protocol. See the \fBCALLBACKS\fR section for details of the
procedures.
.RS
.TP
\fB-banner\fR \fItext\fR
Text of a custom banner message. The default banner is "tcllib smtpd 1.5".
Note that changing the banner does not affect the bracketing text
in the full greeting, printing status 220, server-address, and timestamp.
.TP
\fB-validate_host\fR \fIproc\fR
Callback to authenticate new connections based on the ip-address of
the client.
.TP
\fB-validate_sender\fR \fIproc\fR
Callback to authenticate new connections based on the senders email
address.
.TP
\fB-validate_recipient\fR \fIproc\fR
Callback to validate and authorize a recipient email address
.TP
\fB-deliverMIME\fR \fIproc\fR
Callback used to deliver mail as a mime token created by the tcllib
\fBmime\fR package.
.TP
\fB-deliver\fR \fIproc\fR
Callback used to deliver email. This option has no effect if
the \fB-deliverMIME\fR option has been set.
.RE
.TP
\fB::smtpd::cget\fR ?\fIoption\fR?
If no \fIoption\fR is specified the command will return a list of all
options and their current values. If an option is specified it will
return the value of that option.
.PP
.SH CALLBACKS
.TP
\fBvalidate_host\fR callback
This procedure is called with the clients ip address as soon as a
connection request has been accepted and before any protocol commands
are processed. If you wish to deny access to a specific host then an
error should be returned by this callback. For example:
.sp
.CS


 proc validate_host {ipnum} {
    if {[string match "192.168.1.*" $ipnum]} {
       error "go away!"
    }
 }

.CE
.sp
If access is denied the client will receive a standard message that
includes the text of your error, such as:
.sp
.CS


 550 Access denied: I hate you.

.CE
.sp
As per the SMTP protocol, the connection is not closed but we wait for
the client to send a QUIT command. Any other commands cause a
\fB503 Bad Sequence\fR error.
.TP
\fBvalidate_sender\fR callback
The validate_sender callback is called with the senders mail address
during processing of a MAIL command to allow you to accept or reject
mail based upon the declared sender. To reject mail you should throw
an error. For example, to reject mail from user "denied":
.sp
.CS


 proc validate_sender {address} {
    eval array set addr [mime::parseaddress $address]
    if {[string match "denied" $addr(local)]} {
         error "mailbox $addr(local) denied"
    }
    return
 }

.CE
.sp
The content of any error message will not be passed back to the client.
.TP
\fBvalidate_recipient\fR callback
The validate_recipient callback is similar to the validate_sender
callback and permits you to verify a local mailbox and accept mail for
a local user address during RCPT command handling. To reject mail,
throw an error as above. The error message is ignored.
.TP
\fBdeliverMIME\fR callback
]
The deliverMIME callback is called once a mail message has been
successfully passed to the server. A mime token is constructed from
the sender, recipients and data and the users procedure it called with
this single argument. When the call returns, the mime token is cleaned
up so if the user wishes to preserve the data she must make a copy.
.sp
.CS


 proc deliverMIME {token} {
     set sender [lindex [mime::getheader $token From] 0]
     set recipients [lindex [mime::getheader $token To] 0]
     set mail "From $sender [clock format [clock seconds]]"
     append mail "\\n" [mime::buildmessage $token]
     puts $mail
 }

.CE
.TP
\fBdeliver\fR callback
The deliver callback is called once a mail message has been
successfully passed to the server and there is no -deliverMIME option
set. The procedure is called with the sender, a list of recipients and
the text of the mail as a list of lines. For example:
.sp
.CS


 proc deliver {sender recipients data} {
    set mail "From $sender  [clock format [clock seconds]]"
    append mail "\\n" [join $data "\\n"]
    puts "$mail"
 }

.CE
.sp
Note that the DATA command will return an error if no sender or
recipient has yet been defined.
.PP
.SH VARIABLES
.TP
\fB::smtpd::stopped\fR
This variable is set to \fBtrue\fR during the \fB::smtpd::stop\fR
command to permit the use of the \fBvwait\fR(n) command.
.PP
.SH AUTHOR
Written by Pat Thoyts \fImailto:[email protected]\fR.
.SH LICENSE
This software is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file
"\fIlicense.terms\fR" for more details.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIsmtpd\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
rfc 2821, rfc 821, services, smtp, smtpd, socket, vwait
.SH CATEGORY
Networking
.SH COPYRIGHT
.nf
Copyright (c) Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/snit/snit.n.


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/snit/snit.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003-2009, by William H. Duquette
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "snit" n 2.3.2 tcllib "Snit's Not Incr Tcl, OO system"
.BS
.SH NAME
snit \- Snit's Not Incr Tcl
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBsnit  ?2.3.2?\fR
.sp
\fBsnit::type\fR \fIname\fR \fIdefinition\fR
.sp
\fBtypevariable\fR \fIname\fR ?\fB-array\fR? ?\fIvalue\fR?
.sp
\fBtypemethod\fR \fIname\fR \fIarglist\fR \fIbody\fR
.sp
\fBtypeconstructor\fR \fIbody\fR
.sp
\fBvariable\fR \fIname\fR ?\fB-array\fR? ?\fIvalue\fR?
.sp
\fBmethod\fR \fIname\fR \fIarglist\fR \fIbody\fR
.sp
\fBoption\fR \fInamespec\fR ?\fIdefaultValue\fR?
.sp
\fBoption\fR \fInamespec\fR ?\fIoptions...\fR?
.sp
\fBconstructor\fR \fIarglist\fR \fIbody\fR
.sp
\fBdestructor\fR \fIbody\fR
.sp
\fBproc\fR \fIname\fR \fIargs\fR \fIbody\fR
.sp
\fBdelegate\fR \fBmethod\fR \fIname\fR \fBto\fR \fIcomp\fR ?\fBas\fR \fItarget\fR?
.sp
\fBdelegate\fR \fBmethod\fR \fIname\fR ?\fBto\fR \fIcomp\fR? \fBusing\fR \fIpattern\fR
.sp
\fBdelegate\fR \fBmethod\fR \fB*\fR ?\fBto\fR \fIcomp\fR? ?\fBusing\fR \fIpattern\fR? ?\fBexcept\fR \fIexceptions\fR?
.sp
\fBdelegate\fR \fBoption\fR \fInamespec\fR \fBto\fR \fIcomp\fR
.sp
\fBdelegate\fR \fBoption\fR \fInamespec\fR \fBto\fR \fIcomp\fR \fBas\fR \fItarget\fR
.sp
\fBdelegate\fR \fBoption\fR \fB*\fR \fBto\fR \fIcomp\fR
.sp
\fBdelegate\fR \fBoption\fR \fB*\fR \fBto\fR \fIcomp\fR \fBexcept\fR \fIexceptions\fR
.sp
\fBcomponent\fR \fIcomp\fR ?\fB-public\fR \fImethod\fR? ?\fB-inherit\fR \fIflag\fR?
.sp
\fBdelegate\fR \fBtypemethod\fR \fIname\fR \fBto\fR \fIcomp\fR ?\fBas\fR \fItarget\fR?
.sp
\fBdelegate\fR \fBtypemethod\fR \fIname\fR ?\fBto\fR \fIcomp\fR? \fBusing\fR \fIpattern\fR
.sp
\fBdelegate\fR \fBtypemethod\fR \fB*\fR ?\fBto\fR \fIcomp\fR? ?\fBusing\fR \fIpattern\fR? ?\fBexcept\fR \fIexceptions\fR?
.sp
\fBtypecomponent\fR \fIcomp\fR ?\fB-public\fR \fItypemethod\fR? ?\fB-inherit\fR \fIflag\fR?
.sp
\fBpragma\fR ?\fIoptions...\fR?
.sp
\fBexpose\fR \fIcomp\fR
.sp
\fBexpose\fR \fIcomp\fR \fBas\fR \fImethod\fR
.sp
\fBonconfigure\fR \fIname\fR \fIarglist\fR \fIbody\fR
.sp
\fBoncget\fR \fIname\fR \fIbody\fR
.sp
\fBsnit::widget\fR \fIname\fR \fIdefinition\fR
.sp
\fBwidgetclass\fR \fIname\fR
.sp
\fBhulltype\fR \fItype\fR
.sp
\fBsnit::widgetadaptor\fR \fIname\fR \fIdefinition\fR
.sp
\fBsnit::typemethod\fR \fItype\fR \fIname\fR \fIarglist\fR \fIbody\fR
.sp
\fBsnit::method\fR \fItype\fR \fIname\fR \fIarglist\fR \fIbody\fR
.sp
\fBsnit::macro\fR \fIname\fR \fIarglist\fR \fIbody\fR
.sp
\fBsnit::compile\fR \fIwhich\fR \fItype\fR \fIbody\fR
.sp
\fB$type\fR \fItypemethod\fR \fIargs\fR...
.sp
\fB$type\fR \fBcreate\fR \fIname\fR ?\fIoption\fR \fIvalue\fR ...?
.sp
\fB$type\fR \fBinfo typevars\fR ?\fIpattern\fR?
.sp
\fB$type\fR \fBinfo typemethods\fR ?\fIpattern\fR?
.sp
\fB$type\fR \fBinfo args\fR \fImethod\fR
.sp
\fB$type\fR \fBinfo body\fR \fImethod\fR
.sp
\fB$type\fR \fBinfo default\fR \fImethod\fR \fIaname\fR \fIvarname\fR
.sp
\fB$type\fR \fBinfo instances\fR ?\fIpattern\fR?
.sp
\fB$type\fR \fBdestroy\fR
.sp
\fB$object\fR \fImethod\fR \fIargs...\fR
.sp
\fB$object\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue\fR? ...
.sp
\fB$object\fR \fBconfigurelist\fR \fIoptionlist\fR
.sp
\fB$object\fR \fBcget\fR \fIoption\fR
.sp
\fB$object\fR \fBdestroy\fR
.sp
\fB$object\fR \fBinfo type\fR
.sp
\fB$object\fR \fBinfo vars\fR ?\fIpattern\fR?
.sp
\fB$object\fR \fBinfo typevars\fR ?\fIpattern\fR?
.sp
\fB$object\fR \fBinfo typemethods\fR ?\fIpattern\fR?
.sp
\fB$object\fR \fBinfo options\fR ?\fIpattern\fR?
.sp
\fB$object\fR \fBinfo methods\fR ?\fIpattern\fR?
.sp
\fB$object\fR \fBinfo args\fR \fImethod\fR
.sp
\fB$object\fR \fBinfo body\fR \fImethod\fR
.sp
\fB$object\fR \fBinfo default\fR \fImethod\fR \fIaname\fR \fIvarname\fR
.sp
\fBmymethod\fR \fIname\fR ?\fIargs...\fR?
.sp
\fBmytypemethod\fR \fIname\fR ?\fIargs...\fR?
.sp
\fBmyproc\fR \fIname\fR ?\fIargs...\fR?
.sp
\fBmyvar\fR \fIname\fR
.sp
\fBmytypevar\fR \fIname\fR
.sp
\fBfrom\fR \fIargvName\fR \fIoption\fR ?\fIdefvalue\fR?
.sp
\fBinstall\fR \fIcompName\fR \fBusing\fR \fIobjType\fR \fIobjName\fR \fIargs...\fR
.sp
\fBinstallhull\fR \fBusing\fR \fIwidgetType\fR \fIargs...\fR
.sp
\fBinstallhull\fR \fIname\fR
.sp
\fBvariable\fR \fIname\fR
.sp
\fBtypevariable\fR \fIname\fR
.sp
\fBvarname\fR \fIname\fR
.sp
\fBtypevarname\fR \fIname\fR
.sp
\fBcodename\fR \fIname\fR
.sp
\fBsnit::boolean\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::boolean\fR \fIname\fR
.sp
\fBsnit::double\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::double\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
.sp
\fBsnit::enum\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::enum\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
.sp
\fBsnit::fpixels\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::fpixels\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
.sp
\fBsnit::integer\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::integer\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
.sp
\fBsnit::listtype\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::listtype\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
.sp
\fBsnit::pixels\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::pixels\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
.sp
\fBsnit::stringtype\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::stringtype\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
.sp
\fBsnit::window\fR \fBvalidate\fR ?\fIvalue\fR?
.sp
\fBsnit::window\fR \fIname\fR
.sp
.BE
.SH DESCRIPTION
.PP
Snit is a pure Tcl object and megawidget system.  It's
unique among Tcl object systems in that it's based not on inheritance
but on delegation.  Object systems based on inheritance only allow you
to inherit from classes defined using the same system, which is
limiting.  In Tcl, an object is
anything that acts like an object; it shouldn't matter how the object
was implemented.  Snit is intended to help you build applications out of
the materials at hand; thus, Snit is designed to be able to
incorporate and build on any object, whether it's a hand-coded object,
a \fBTk\fR widget, an \fBIncr Tcl\fR object,
a \fBBWidget\fR or almost anything else.
.PP
This man page is intended to be a reference only; see the accompanying
\fBsnitfaq\fR for a gentler, more tutorial introduction to Snit
concepts.
.SH "SNIT VERSIONS"
This man page covers both Snit 2.2 and Snit 1.3.  The primary
difference between the two versions is simply that Snit 2.2 contains
speed optimizations based on new features of Tcl 8.5; Snit 1.3
supports all of Tcl 8.3, 8.4 and Tcl 8.5.  There are a few minor
inconsistencies; they are flagged in the body of the man page with the
label "Snit 1.x Incompatibility"; they are also discussed in the \fBsnitfaq\fR.
.PP
.SH REFERENCE
.SS "TYPE AND WIDGET DEFINITIONS"
Snit provides the following commands for defining new types:
.TP
\fBsnit::type\fR \fIname\fR \fIdefinition\fR
Defines a new abstract data type called \fIname\fR.  If \fIname\fR is
not a fully qualified command name, it is assumed to be a name in the
namespace in which the \fBsnit::type\fR command was called (usually the
global namespace).  It returns the fully qualified name of the new type.
.sp
The type name is then a command that is used to create objects of the
new type, along with other activities.
.sp
The \fBsnit::type\fR \fIdefinition\fR block is a script that may
contain the following definitions:
.RS
.TP
\fBtypevariable\fR \fIname\fR ?\fB-array\fR? ?\fIvalue\fR?
Defines a type variable with the specified \fIname\fR, and optionally
the specified \fIvalue\fR.  Type variables are shared by all instances
of the type.  If the \fB-array\fR option is included, then
\fIvalue\fR should be a dictionary; it will be
assigned to the variable using \fBarray set\fR.
.TP
\fBtypemethod\fR \fIname\fR \fIarglist\fR \fIbody\fR
Defines a type method, a subcommand of the new type command,
with the specified name, argument list, and
body.  The \fIarglist\fR is a normal Tcl argument list and may contain
default arguments and the \fBargs\fR argument; however, it may not
contain the argument names \fBtype\fR, \fBself\fR, \fBselfns\fR, or
\fBwin\fR.
.sp
The variable \fBtype\fR is automatically defined in the \fIbody\fR to
the type's fully-qualified name.  In addition,
type variables are automatically visible in the \fIbody\fR
of every type method.
.sp
If the \fIname\fR consists of two or more tokens, Snit handles it specially:
.CS

    typemethod {a b} {arg} { puts "Got $arg" }

.CE
.IP
This statement implicitly defines a type method called \fBa\fR which
has a subcommand \fBb\fR.  \fBb\fR is called like this:
.CS

    $type a b "Hello, world!"

.CE
.IP
\fBa\fR may have any number of subcommands.  This makes it possible
to define a hierarchical command structure; see \fBmethod\fR, below,
for more examples.
.sp
Type methods can call commands from the namespace in which the type is
defined without importing them, e.g., if the type name is
\fB::parentns::typename\fR, then the type's type methods can call
\fB::parentns::someproc\fR just as \fBsomeproc\fR.
\fISnit 1.x Incompatibility:\fR This does not work in Snit 1.x, as
it depends on \fBnamespace path\fR, a new command in Tcl 8.5.
.sp
\fISnit 1.x Incompatibility:\fR In Snit 1.x, the following
following two calls to this type method are equivalent:
.CS

    $type a b "Hello, world!"
    $type {a b} "Hello, world!"

.CE
.IP
In Snit 2.2, the second form is invalid.
.TP
\fBtypeconstructor\fR \fIbody\fR
The type constructor's \fIbody\fR is executed once when the
type is first defined; it is typically used to
initialize array-valued type variables and to add
entries to \fBThe Tk Option Database\fR.
.sp
The variable \fBtype\fR is automatically defined in the \fIbody\fR,
and contains the type's fully-qualified name.  In addition,
type variables are automatically visible in the \fIbody\fR of the type
constructor.
.sp
A type may define at most one type constructor.
.sp
The type constructor can call commands from the namespace in which the type is
defined without importing them, e.g., if the type name is
\fB::parentns::typename\fR, then the type constructor can call
\fB::parentns::someproc\fR just as \fBsomeproc\fR.
\fISnit 1.x Incompatibility:\fR This does not work in Snit 1.x, as
it depends on \fBnamespace path\fR, a new command in Tcl 8.5.
.TP
\fBvariable\fR \fIname\fR ?\fB-array\fR? ?\fIvalue\fR?
Defines an instance variable, a private variable associated with each
instance of this type, and optionally its initial value.
If the \fB-array\fR option is included, then
\fIvalue\fR should be a dictionary; it will be
assigned to the variable using \fBarray set\fR.
.TP
\fBmethod\fR \fIname\fR \fIarglist\fR \fIbody\fR
Defines an instance method, a subcommand of each instance of this
type, with the specified name, argument list and body.
The \fIarglist\fR is a normal Tcl argument list and may contain
default arguments and the \fBargs\fR argument.
.sp
The method is implicitly passed the following arguments as well:
\fBtype\fR, which contains the fully-qualified type name; \fBself\fR,
which contains the current instance command name; \fBselfns\fR, which
contains the name of the instance's private namespace; and \fBwin\fR,
which contains the original instance name.
Consequently, the \fIarglist\fR may not contain the argument names
\fBtype\fR, \fBself\fR, \fBselfns\fR, or \fBwin\fR.
.sp
An instance method defined in this way is said to be
\fIlocally defined\fR.
.sp
Type and instance variables are
automatically visible in all instance methods.  If the type has
locally defined options, the \fBoptions\fR array is also visible.
.sp
If the \fIname\fR consists of two or more tokens, Snit handles it specially:
.CS

    method {a b} {} { ... }

.CE
.IP
This statement implicitly defines a method called \fBa\fR which
has a subcommand \fBb\fR.  \fBb\fR is called like this:
.CS

    $self a b "Hello, world!"

.CE
.IP
\fBa\fR may have any number of subcommands.  This makes it possible
to define a hierarchical command structure:
.CS

% snit::type dog {
    method {tail wag}   {} {return "Wag, wag"}
    method {tail droop} {} {return "Droop, droop"}
}
::dog
% dog spot
::spot
% spot tail wag
Wag, wag
% spot tail droop
Droop, droop
%

.CE
.IP
What we've done is implicitly defined a "tail" method with subcommands
"wag" and "droop".  Consequently, it's an error to define "tail"
explicitly.
.sp
Methods can call commands from the namespace in which the type is
defined without importing them, e.g., if the type name is
\fB::parentns::typename\fR, then the type's methods can call
\fB::parentns::someproc\fR just as \fBsomeproc\fR.
\fISnit 1.x Incompatibility:\fR This does not work in Snit 1.x, as
it depends on \fBnamespace path\fR, a new command in Tcl 8.5.
.sp
\fISnit 1.x Incompatibility:\fR In Snit 1.x, the following
following two calls to this method are equivalent:
.CS

    $self a b "Hello, world!"
    $self {a b} "Hello, world!"

.CE
.IP
In Snit 2.2, the second form is invalid.
.TP
\fBoption\fR \fInamespec\fR ?\fIdefaultValue\fR?
.TP
\fBoption\fR \fInamespec\fR ?\fIoptions...\fR?
Defines an option for instances of this type, and optionally gives it
an initial value.  The initial value defaults to the empty string if
no \fIdefaultValue\fR is specified.
.sp
An option defined in this way is said to be \fIlocally defined\fR.
.sp
The \fInamespec\fR is a list defining the option's
name, resource name, and class name, e.g.:
.CS

    option {-font font Font} {Courier 12}

.CE
.IP
The option name must begin with a hyphen, and must not contain any
upper case letters. The resource name and class name are optional; if
not specified, the resource name defaults to the option name, minus
the hyphen, and the class name defaults to the resource name with the
first letter capitalized.  Thus, the following statement is equivalent
to the previous example:
.CS

    option -font {Courier 12}

.CE
.IP
See \fBThe Tk Option Database\fR for more information about
resource and class names.
.sp
Options are normally set and retrieved using the standard
instance methods \fBconfigure\fR and \fBcget\fR; within instance code
(method bodies, etc.), option values are available through the
\fBoptions\fR array:
.CS

    set myfont $options(-font)

.CE
.IP
If the type defines any option handlers (e.g., \fB-configuremethod\fR),
then it should probably use \fBconfigure\fR and \fBcget\fR to
access its options to avoid subtle errors.
.sp
The \fBoption\fR statement may include the following options:
.RS
.TP
\fB-default\fR \fIdefvalue\fR
Defines the option's default value; the option's default value
will be "" otherwise.
.TP
\fB-readonly\fR \fIflag\fR
The \fIflag\fR can be any Boolean value recognized by Tcl.
If \fIflag\fR is true, then the option is read-only--it can only
be set using \fBconfigure\fR or \fBconfigurelist\fR
at creation time, i.e., in the type's constructor.
.TP
\fB-type\fR \fItype\fR
Every locally-defined option may define its validation type, which may
be either the name of a validation type or a specification for a
validation subtype
.sp
For example, an option may declare that its value must be an integer
by specifying \fBsnit::integer\fR as its validation type:
.CS

    option -number -type snit::integer

.CE
.IP
It may also declare that its value is an integer between 1 and 10
by specifying a validation subtype:
.CS

    option -number -type {snit::integer -min 1 -max 10}

.CE
.IP
If a validation type or subtype is defined for an option, then
it will be used to validate the option's value whenever it is
changed by the object's \fBconfigure\fR or
\fBconfigurelist\fR methods.  In addition, all such options
will have their values validated automatically immediately
after the constructor executes.
.sp
Snit defines a family of validation types and subtypes, and it's
quite simple to define new ones.  See
\fBValidation Types\fR for the complete list, and
\fBDefining Validation Types\fR for an explanation of how
to define your own.
.TP
\fB-cgetmethod\fR \fImethodName\fR
Every locally-defined option may define a \fB-cgetmethod\fR;
it is called when the option's value is retrieved using the
\fBcget\fR method.  Whatever the method's \fIbody\fR returns will
be the return value of the call to \fBcget\fR.
.sp
The named method must take one argument, the option name.
For example, this code is equivalent to (though slower than)
Snit's default handling of \fBcget\fR:
.CS

    option -font -cgetmethod GetOption
    method GetOption {option} {
        return $options($option)
    }

.CE
.IP
Note that it's possible for any number of options to share a
\fB-cgetmethod\fR.
.TP
\fB-configuremethod\fR \fImethodName\fR
Every locally-defined option may define a \fB-configuremethod\fR;
it is called when the option's value is set using the
\fBconfigure\fR or \fBconfigurelist\fR methods.  It is the
named method's responsibility to save the option's value; in other
words, the value will not be saved to the \fBoptions()\fR array unless
the method saves it there.
.sp
The named method must take two arguments, the option name and
its new value.  For example, this code is equivalent to
(though slower than) Snit's default handling of \fBconfigure\fR:
.CS

    option -font -configuremethod SetOption
    method SetOption {option value} {
        set options($option) $value
    }

.CE
.IP
Note that it's possible for any number of options to share a
single \fB-configuremethod\fR.
.TP
\fB-validatemethod\fR \fImethodName\fR
Every locally-defined option may define a \fB-validatemethod\fR;
it is called when the option's value is set using the
\fBconfigure\fR or \fBconfigurelist\fR methods, just before
the \fB-configuremethod\fR (if any).  It is the
named method's responsibility to validate the option's new value,
and to throw an error if the value is invalid.
.sp
The named method must take two arguments, the option name and
its new value.  For example, this code verifies that
\fB-flag\fR's value is a valid Boolean value:
.CS

    option -font -validatemethod CheckBoolean
    method CheckBoolean {option value} {
        if {![string is boolean -strict $value]} {
            error "option $option must have a boolean value."
        }
    }

.CE
.IP
Note that it's possible for any number of options to share a
single \fB-validatemethod\fR.
.RE
.TP
\fBconstructor\fR \fIarglist\fR \fIbody\fR
The constructor definition specifies a \fIbody\fR of code to be
executed when a new instance is created.  The \fIarglist\fR is a
normal Tcl argument list and may contain default arguments and
the \fBargs\fR argument.
.sp
As with methods, the arguments \fBtype\fR, \fBself\fR, \fBselfns\fR,
and \fBwin\fR are defined implicitly, and all type and instance
variables are automatically visible in its \fIbody\fR.
.sp
If the \fIdefinition\fR doesn't explicitly define the constructor,
Snit defines one implicitly.  If the type declares at least one option
(whether locally or by delegation), the default constructor will
be defined as follows:
.CS

    constructor {args} {
        $self configurelist $args
    }

.CE
.IP
For standard Tk widget behavior, the argument list should be
the single name \fBargs\fR, as shown.
.sp
If the \fIdefinition\fR defines neither a constructor nor
any options, the default constructor is defined as follows:
.CS

    constructor {} {}

.CE
.IP
As with methods, the constructor can call commands from the namespace
in which the type is
defined without importing them, e.g., if the type name is
\fB::parentns::typename\fR, then the constructor can call
\fB::parentns::someproc\fR just as \fBsomeproc\fR.
\fISnit 1.x Incompatibility:\fR This does not work in Snit 1.x, as
it depends on \fBnamespace path\fR, a new command in Tcl 8.5.
.TP
\fBdestructor\fR \fIbody\fR
The destructor is used to code any actions that must take place when
an instance of the type is destroyed: typically, the destruction of
anything created in the constructor.
.sp
The destructor takes no explicit arguments; as with methods, the
arguments \fBtype\fR, \fBself\fR, \fBselfns\fR, and \fBwin\fR, are
defined implicitly, and all type and instance
variables are automatically visible in its \fIbody\fR.
As with methods, the destructor can call commands from the namespace
in which the type is
defined without importing them, e.g., if the type name is
\fB::parentns::typename\fR, then the destructor can call
\fB::parentns::someproc\fR just as \fBsomeproc\fR.
\fISnit 1.x Incompatibility:\fR This does not work in Snit 1.x, as
it depends on \fBnamespace path\fR, a new command in Tcl 8.5.
.TP
\fBproc\fR \fIname\fR \fIargs\fR \fIbody\fR
Defines a new Tcl procedure in the type's namespace.
.sp
The defined proc differs from a normal Tcl proc in that all type
variables are automatically visible.  The proc can access
instance variables as well, provided that it is passed
\fBselfns\fR (with precisely that name) as one of its arguments.
.sp
Although they are not implicitly defined for procs, the argument names
\fBtype\fR, \fBself\fR, and \fBwin\fR should be avoided.
.sp
As with methods and typemethods, procs can call commands from the namespace
in which the type is
defined without importing them, e.g., if the type name is
\fB::parentns::typename\fR, then the proc can call
\fB::parentns::someproc\fR just as \fBsomeproc\fR.
\fISnit 1.x Incompatibility:\fR This does not work in Snit 1.x, as
it depends on \fBnamespace path\fR, a new command in Tcl 8.5.
.TP
\fBdelegate\fR \fBmethod\fR \fIname\fR \fBto\fR \fIcomp\fR ?\fBas\fR \fItarget\fR?
Delegates method \fIname\fR to component \fIcomp\fR.  That is, when
method \fIname\fR is called on an instance of this type, the method
and its arguments will be passed to the named component's command
instead.  That is, the following statement
.CS

    delegate method wag to tail

.CE
.IP
is roughly equivalent to this explicitly defined method:
.CS

    method wag {args} {
        uplevel $tail wag $args
    }

.CE
.IP
As with methods, the \fIname\fR may have multiple tokens; in this
case, the last token of the name is assumed to be the name of the
component's method.
.sp
The optional \fBas\fR clause allows you to specify the delegated
method name and possibly add some arguments:
.CS

    delegate method wagtail to tail as "wag briskly"

.CE
.sp
A method cannot be both locally defined and delegated.
.sp
\fBNote:\fR All forms of \fBdelegate method\fR can delegate to
both instance components and type components.
.TP
\fBdelegate\fR \fBmethod\fR \fIname\fR ?\fBto\fR \fIcomp\fR? \fBusing\fR \fIpattern\fR
In this form of the \fBdelegate\fR statement, the \fBusing\fR clause
is used to specify the precise form of the command to which method
\fIname\fR name is delegated.  In this form, the \fBto\fR clause is
optional, since the chosen command might not involve any particular
component.
.sp
The value of the \fBusing\fR clause is a list that may contain
any or all of the following substitution codes; these codes are
substituted with the described value to build the delegated command
prefix.  Note that the following two statements are equivalent:
.CS

    delegate method wag to tail
    delegate method wag to tail using "%c %m"

.CE
.IP
Each element of the list becomes a single element of the delegated
command--it is never reparsed as a string.
.sp
Substitutions:
.RS
.TP
\fB%%\fR
This is replaced with a single "%".  Thus, to pass the string "%c"
to the command as an argument, you'd write "%%c".
.TP
\fB%c\fR
This is replaced with the named component's command.
.TP
\fB%m\fR
This is replaced with the final token of the method \fIname\fR; if
the method \fIname\fR has one token, this is identical to \fB%M\fR.
.TP
\fB%M\fR
This is replaced by the method \fIname\fR; if the \fIname\fR consists
of multiple tokens, they are joined by space characters.
.TP
\fB%j\fR
This is replaced by the method \fIname\fR; if the \fIname\fR consists
of multiple tokens, they are joined by underscores ("_").
.TP
\fB%t\fR
This is replaced with the fully qualified type name.
.TP
\fB%n\fR
This is replaced with the name of the instance's private namespace.
.TP
\fB%s\fR
This is replaced with the name of the instance command.
.TP
\fB%w\fR
This is replaced with the original name of the instance command; for
Snit widgets and widget adaptors, it will be the Tk window name.
It remains constant, even if the instance command is renamed.
.RE
.TP
\fBdelegate\fR \fBmethod\fR \fB*\fR ?\fBto\fR \fIcomp\fR? ?\fBusing\fR \fIpattern\fR? ?\fBexcept\fR \fIexceptions\fR?
The form \fBdelegate method *\fR delegates all unknown method names to the
specified \fIcomp\fRonent.  The \fBexcept\fR clause can be used to
specify a list of \fIexceptions\fR, i.e., method names that will not
be so delegated. The \fBusing\fR clause is defined as given above.
In this form, the statement must contain the \fBto\fR clause, the
\fBusing\fR clause, or both.
.sp
In fact, the "*" can be a list of two or more tokens whose last
element is "*", as in the following example:
.CS

    delegate method {tail *} to tail

.CE
.IP
This implicitly defines the method \fBtail\fR whose subcommands will
be delegated to the \fBtail\fR component.
.TP
\fBdelegate\fR \fBoption\fR \fInamespec\fR \fBto\fR \fIcomp\fR
.TP
\fBdelegate\fR \fBoption\fR \fInamespec\fR \fBto\fR \fIcomp\fR \fBas\fR \fItarget\fR
.TP
\fBdelegate\fR \fBoption\fR \fB*\fR \fBto\fR \fIcomp\fR
.TP
\fBdelegate\fR \fBoption\fR \fB*\fR \fBto\fR \fIcomp\fR \fBexcept\fR \fIexceptions\fR
Defines a delegated option; the \fInamespec\fR is defined as for the
\fBoption\fR statement.
When the \fBconfigure\fR, \fBconfigurelist\fR, or \fBcget\fR
instance method is used to set or retrieve the option's value, the
equivalent \fBconfigure\fR or \fBcget\fR command will be applied
to the component as though the option was defined with the following
\fB-configuremethod\fR and \fB-cgetmethod\fR:
.CS

    method ConfigureMethod {option value} {
        $comp configure $option $value
    }

    method CgetMethod {option} {
        return [$comp cget $option]
    }

.CE
.IP
Note that delegated options never appear in the \fBoptions\fR array.
.sp
If the \fBas\fR clause is specified, then the \fItarget\fR option
name is used in place of \fIname\fR.
.sp
The form \fBdelegate option *\fR delegates all unknown options to the
specified \fIcomp\fRonent.  The \fBexcept\fR clause can be used to
specify a list of \fIexceptions\fR, i.e., option names that will not
be so delegated.
.sp
Warning: options can only be delegated to a component if it supports
the \fBconfigure\fR and \fBcget\fR instance methods.
.sp
An option cannot be both locally defined and delegated.
TBD: Continue from here.
.TP
\fBcomponent\fR \fIcomp\fR ?\fB-public\fR \fImethod\fR? ?\fB-inherit\fR \fIflag\fR?
Explicitly declares a component called \fIcomp\fR, and automatically
defines the component's instance variable.
.sp
If the \fB-public\fR option is specified, then the option is made
public by defining a \fImethod\fR whose subcommands are delegated
to the component e.g., specifying \fB-public mycomp\fR is
equivalent to the following:
.CS

    component mycomp
    delegate method {mymethod *} to mycomp

.CE
.IP
If the \fB-inherit\fR option is specified, then \fIflag\fR must be a
Boolean value; if \fIflag\fR is true then all unknown methods and
options will be delegated to this component.  The name \fB-inherit\fR
implies that instances of this new type inherit, in a sense, the
methods and options of the component. That is, \fB-inherit yes\fR is
equivalent to:
.CS

    component mycomp
    delegate option * to mycomp
    delegate method * to mycomp

.CE
.TP
\fBdelegate\fR \fBtypemethod\fR \fIname\fR \fBto\fR \fIcomp\fR ?\fBas\fR \fItarget\fR?
Delegates type method \fIname\fR to type component \fIcomp\fR.  That is, when
type method \fIname\fR is called on this type, the type method
and its arguments will be passed to the named type component's command
instead.  That is, the following statement
.CS

    delegate typemethod lostdogs to pound

.CE
.IP
is roughly equivalent to this explicitly defined method:
.CS

    typemethod lostdogs {args} {
        uplevel $pound lostdogs $args
    }

.CE
.IP
As with type methods, the \fIname\fR may have multiple tokens; in this
case, the last token of the name is assumed to be the name of the
component's method.
.sp
The optional \fBas\fR clause allows you to specify the delegated
method name and possibly add some arguments:
.CS

    delegate typemethod lostdogs to pound as "get lostdogs"

.CE
.sp
A type method cannot be both locally defined and delegated.
.TP
\fBdelegate\fR \fBtypemethod\fR \fIname\fR ?\fBto\fR \fIcomp\fR? \fBusing\fR \fIpattern\fR
In this form of the \fBdelegate\fR statement, the \fBusing\fR clause
is used to specify the precise form of the command to which type method
\fIname\fR name is delegated.  In this form, the \fBto\fR clause is
optional, since the chosen command might not involve any particular
type component.
.sp
The value of the \fBusing\fR clause is a list that may contain
any or all of the following substitution codes; these codes are
substituted with the described value to build the delegated command
prefix.  Note that the following two statements are equivalent:
.CS

    delegate typemethod lostdogs to pound
    delegate typemethod lostdogs to pound using "%c %m"

.CE
.IP
Each element of the list becomes a single element of the delegated
command--it is never reparsed as a string.
.sp
Substitutions:
.RS
.TP
\fB%%\fR
This is replaced with a single "%".  Thus, to pass the string "%c"
to the command as an argument, you'd write "%%c".
.TP
\fB%c\fR
This is replaced with the named type component's command.
.TP
\fB%m\fR
This is replaced with the final token of the type method \fIname\fR; if
the type method \fIname\fR has one token, this is identical to \fB%M\fR.
.TP
\fB%M\fR
This is replaced by the type method \fIname\fR; if the \fIname\fR consists
of multiple tokens, they are joined by space characters.
.TP
\fB%j\fR
This is replaced by the type method \fIname\fR; if the \fIname\fR consists
of multiple tokens, they are joined by underscores ("_").
.TP
\fB%t\fR
This is replaced with the fully qualified type name.
.RE
.TP
\fBdelegate\fR \fBtypemethod\fR \fB*\fR ?\fBto\fR \fIcomp\fR? ?\fBusing\fR \fIpattern\fR? ?\fBexcept\fR \fIexceptions\fR?
The form \fBdelegate typemethod *\fR delegates all unknown type
method names to the
specified type component.  The \fBexcept\fR clause can be used to
specify a list of \fIexceptions\fR, i.e., type method names that will not
be so delegated. The \fBusing\fR clause is defined as given above.
In this form, the statement must contain the \fBto\fR clause, the
\fBusing\fR clause, or both.
.sp
\fBNote:\fR By default, Snit interprets \fB$type foo\fR, where
\fBfoo\fR is
not a defined type method, as equivalent to \fB$type create foo\fR, where
\fBfoo\fR is the name of a new instance of the type.  If you
use \fBdelegate typemethod *\fR, then the \fBcreate\fR type
method must always be used explicitly.
.sp
The "*" can be a list of two or more tokens whose last
element is "*", as in the following example:
.CS

    delegate typemethod {tail *} to tail

.CE
.IP
This implicitly defines the type method \fBtail\fR whose subcommands will
be delegated to the \fBtail\fR type component.
.TP
\fBtypecomponent\fR \fIcomp\fR ?\fB-public\fR \fItypemethod\fR? ?\fB-inherit\fR \fIflag\fR?
Explicitly declares a type component called \fIcomp\fR, and automatically
defines the component's type variable.  A type component is an arbitrary
command to which type methods and instance methods can be delegated;
the command's name is stored in a type variable.
.sp
If the \fB-public\fR option is specified, then the type component is made
public by defining a \fItypemethod\fR whose subcommands are delegated to
the type component, e.g., specifying \fB-public mytypemethod\fR
is equivalent to the following:
.CS

    typecomponent mycomp
    delegate typemethod {mytypemethod *} to mycomp

.CE
.IP
If the \fB-inherit\fR option is specified, then \fIflag\fR must be a
Boolean value; if \fIflag\fR is true then all unknown type methods
will be delegated to this type component. (See the note on "delegate
typemethod *", above.) The name \fB-inherit\fR
implies that this type inherits, in a sense, the behavior of
the type component. That is, \fB-inherit yes\fR is equivalent to:
.CS

    typecomponent mycomp
    delegate typemethod * to mycomp

.CE
.TP
\fBpragma\fR ?\fIoptions...\fR?
The \fBpragma\fR statement provides control over how Snit generates a
type.  It takes the following options; in each case, \fIflag\fR must
be a Boolean value recognized by Tcl, e.g., \fB0\fR, \fB1\fR,
\fByes\fR, \fBno\fR, and so
on.
.sp
By setting the \fB-hastypeinfo\fR, \fB-hastypedestroy\fR, and
\fB-hasinstances\fR pragmas to false and defining appropriate
type methods, you can create an ensemble command without any extraneous
behavior.
.RS
.TP
\fB-canreplace\fR \fIflag\fR
If false (the default) Snit will not create an instance of a
\fBsnit::type\fR that has the same name as an existing command; this
prevents subtle errors.  Setting this pragma to true restores the
behavior of Snit V0.93 and earlier versions.
.TP
\fB-hastypeinfo\fR \fIflag\fR
If true (the default), the generated type will have a type method
called \fBinfo\fR that is used for type introspection; the \fBinfo\fR
type method is documented below.  If false, it will not.
.TP
\fB-hastypedestroy\fR \fIflag\fR
If true (the default), the generated type will have a type method
called \fBdestroy\fR that is used to destroy the type and all of its
instances.  The \fBdestroy\fR type method is documented below.  If
false, it will not.
.TP
\fB-hastypemethods\fR \fIflag\fR
If true (the default), the generated type's type command will have
subcommands (type methods) as usual.  If false, the type command
will serve only to create instances of the type; the first argument
is the instance name.
.sp
This pragma and \fB-hasinstances\fR cannot both be set false.
.TP
\fB-hasinstances\fR \fIflag\fR
If true (the default), the generated type will have a type method
called \fBcreate\fR that is used to create instances of the type,
along with a variety of instance-related features.  If false, it will
not.
.sp
This pragma and \fB-hastypemethods\fR cannot both be set false.
.TP
\fB-hasinfo\fR \fIflag\fR
If true (the default), instances of the generated type will have
an instance method called \fBinfo\fR that is used for
instance introspection; the \fBinfo\fR
method is documented below.  If false, it will not.
.TP
\fB-simpledispatch\fR \fIflag\fR
This pragma is intended to make simple, heavily-used abstract
data types (e.g., stacks and queues) more efficient.
.sp
If false (the default), instance methods are dispatched normally.  If
true, a faster dispatching scheme is used instead.
The speed comes at a price; with \fB-simpledispatch yes\fR you
get the following limitations:
.RS
.IP \(bu
Methods cannot be delegated.
.IP \(bu
\fBuplevel\fR and \fBupvar\fR do not work as expected: the
caller's scope is two levels up rather than one.
.IP \(bu
The option-handling methods
(\fBcget\fR, \fBconfigure\fR, and \fBconfigurelist\fR) are very
slightly slower.
.RE
.RE
.TP
\fBexpose\fR \fIcomp\fR
.TP
\fBexpose\fR \fIcomp\fR \fBas\fR \fImethod\fR
\fBDeprecated.\fR  To expose component \fIcomp\fR publicly, use
\fBcomponent\fR's \fB-public\fR option.
.TP
\fBonconfigure\fR \fIname\fR \fIarglist\fR \fIbody\fR
\fBDeprecated.\fR  Define \fBoption\fR's \fB-configuremethod\fR
option instead.
.sp
As of version 0.95, the following definitions,
.CS

    option -myoption
    onconfigure -myoption {value} {
        # Code to save the option's value
    }

.CE
.IP
are implemented as follows:
.CS

    option -myoption -configuremethod _configure-myoption
    method _configure-myoption {_option value} {
        # Code to save the option's value
    }

.CE
.TP
\fBoncget\fR \fIname\fR \fIbody\fR
\fBDeprecated.\fR  Define \fBoption\fR's \fB-cgetmethod\fR
option instead.
.sp
As of version 0.95, the following definitions,
.CS

    option -myoption
    oncget -myoption {
        # Code to return the option's value
    }

.CE
.IP
are implemented as follows:
.CS

    option -myoption -cgetmethod _cget-myoption
    method _cget-myoption {_option} {
        # Code to return the option's value
    }

.CE
.RE
.TP
\fBsnit::widget\fR \fIname\fR \fIdefinition\fR
This command defines a Snit megawidget type with the specified
\fIname\fR.  The \fIdefinition\fR is defined as for \fBsnit::type\fR.
A \fBsnit::widget\fR differs from a \fBsnit::type\fR
in these ways:
.RS
.IP \(bu
Every instance of a \fBsnit::widget\fR has an automatically-created
component called \fBhull\fR, which is normally a Tk frame widget.
Other widgets created as part of the megawidget will be created within
this widget.
.sp
The hull component is initially created with the requested widget
name; then Snit does some magic, renaming the hull component and
installing its own instance command in its place.
The hull component's new name is saved in an instance variable called
\fBhull\fR.
.IP \(bu
The name of an instance must be valid Tk window name, and the parent
window must exist.
.RE
.IP
A \fBsnit::widget\fR definition can include any of statements allowed
in a \fBsnit::type\fR definition, and may also include the following:
.RS
.TP
\fBwidgetclass\fR \fIname\fR
Sets the \fBsnit::widget\fR's widget class to \fIname\fR, overriding
the default.  See \fBThe Tk Option Database\fR for more
information.
.TP
\fBhulltype\fR \fItype\fR
Determines the kind of widget used as the \fBsnit::widget\fR's hull.
The \fItype\fR may be \fBframe\fR (the default), \fBtoplevel\fR,
\fBlabelframe\fR; the qualified equivalents of these,
\fBtk::frame\fR, \fBtk::toplevel\fR, and \fBtk::labelframe\fR;
or, if available, the equivalent Tile widgets:
\fBttk::frame\fR, \fBttk::toplevel\fR, and
\fBttk::labelframe\fR.  In practice, any widget that supports the
\fB-class\fR option can be used as a hull widget by
\fBlappend\fR'ing its name to the variable \fBsnit::hulltypes\fR.
.RE
.TP
\fBsnit::widgetadaptor\fR \fIname\fR \fIdefinition\fR
This command defines a Snit megawidget type with the specified name.
It differs from \fBsnit::widget\fR in that the instance's \fBhull\fR
component is not created automatically, but is created in the
constructor and installed using the \fBinstallhull\fR command.  Once
the hull is installed, its instance command is renamed and replaced as
with normal \fBsnit::widget\fRs.  The original command is again
accessible in the instance variable \fBhull\fR.
.sp
Note that in general it is not possible to change the
\fIwidget class\fR of a \fBsnit::widgetadaptor\fR's hull widget.
.sp
See \fBThe Tk Option Database\fR for information on how
\fBsnit::widgetadaptor\fRs interact with the option database.
.TP
\fBsnit::typemethod\fR \fItype\fR \fIname\fR \fIarglist\fR \fIbody\fR
Defines a new type method (or redefines an existing type method)
for a previously existing \fItype\fR.
.TP
\fBsnit::method\fR \fItype\fR \fIname\fR \fIarglist\fR \fIbody\fR
Defines a new instance method (or redefines an existing instance
method) for a previously existing \fItype\fR.  Note that delegated
instance methods can't be redefined.
.TP
\fBsnit::macro\fR \fIname\fR \fIarglist\fR \fIbody\fR
Defines a Snit macro with the specified \fIname\fR, \fIarglist\fR, and
\fIbody\fR.  Macros are used to define new type and widget
definition statements in terms of the statements defined in this man
page.
.sp
A macro is simply a Tcl proc that is defined in the slave interpreter
used to compile type and widget definitions.  Thus, macros have
access to all of the type and widget definition statements.  See
\fBMacros and Meta-programming\fR for more details.
.sp
The macro \fIname\fR cannot be the same as any standard Tcl command,
or any Snit type or widget definition statement, e.g., you can't
redefine the \fBmethod\fR or \fBdelegate\fR statements, or the
standard \fBset\fR, \fBlist\fR, or \fBstring\fR commands.
.TP
\fBsnit::compile\fR \fIwhich\fR \fItype\fR \fIbody\fR
Snit defines a type, widget, or widgetadaptor by "compiling" the
definition into a Tcl script; this script is then evaluated in the
Tcl interpreter, which actually defines the new type.
.sp
This command exposes the "compiler".  Given a definition \fIbody\fR
for the named \fItype\fR, where \fIwhich\fR is \fBtype\fR,
\fBwidget\fR, or \fBwidgetadaptor\fR, \fBsnit::compile\fR returns a list
of two elements.  The first element is the fully qualified type name;
the second element is the definition script.
.sp
\fBsnit::compile\fR is useful when additional processing
must be done on the Snit-generated code--if it must be instrumented,
for example, or run through the TclDevKit compiler.  In addition, the
returned script could be saved in a ".tcl" file and used to define the
type as part of an application or library, thus saving the compilation
overhead at application start-up.  Note that the
same version of Snit must be used at run-time as at compile-time.
.PP
.SS "THE TYPE COMMAND"
A type or widget definition creates a type command, which is used to
create instances of the type.  The type command has this form:
.PP
.TP
\fB$type\fR \fItypemethod\fR \fIargs\fR...
The \fItypemethod\fR can be any of the
\fBStandard Type Methods\fR (e.g., \fBcreate\fR),
or any type method defined in the type
definition.
The subsequent \fIargs\fR depend on the specific \fItypemethod\fR
chosen.
.sp
The type command is most often used to create new instances of the
type; hence, the \fBcreate\fR method is assumed if the first
argument to the type command doesn't name a valid type method, unless
the type definition includes \fBdelegate typemethod *\fR or the
\fB-hasinstances\fR pragma is set to false.
.sp
Furthermore, if the \fB-hastypemethods\fR pragma is false, then
Snit type commands can be called with no arguments at
all; in this case, the type command creates an instance with an
automatically generated name.  In other words, provided that the
\fB-hastypemethods\fR pragma is false and the type
has instances, the following commands are equivalent:
.CS

snit::type dog { ... }

set mydog [dog create %AUTO%]
set mydog [dog %AUTO%]
set mydog [dog]

.CE
.IP
This doesn't work for Snit widgets, for obvious reasons.
.sp
\fISnit 1.x Incompatibility:\fR In Snit 1.x, the above behavior is
available whether \fB-hastypemethods\fR is true (the default) or false.
.PP
.SS "STANDARD TYPE METHODS"
In addition to any type methods in the type's definition, all type and
widget commands will usually have at least the following subcommands:
.PP
.TP
\fB$type\fR \fBcreate\fR \fIname\fR ?\fIoption\fR \fIvalue\fR ...?
Creates a new instance of the type, giving it the specified \fIname\fR
and calling the type's constructor.
.sp
For \fBsnit::type\fRs, if \fIname\fR is not a fully-qualified command
name, it is assumed to be a name in the namespace in which the call to
\fBsnit::type\fR appears.  The method returns the fully-qualified
instance name.
.sp
For \fBsnit::widget\fRs and \fBsnit::widgetadaptor\fRs, \fIname\fR
must be a valid widget name; the method returns the widget name.
.sp
So long as \fIname\fR does not conflict with any defined type method
name the \fBcreate\fR keyword may be omitted, unless
the type definition includes \fBdelegate typemethod *\fR or the
\fB-hasinstances\fR pragma is set to false.
.sp
If the \fIname\fR includes the string \fB%AUTO%\fR, it will be
replaced with the string \fB$type$counter\fR where \fB$type\fR is
the type name and \fB$counter\fR is a counter that increments each
time \fB%AUTO%\fR is used for this type.
.sp
By default, any arguments following the \fIname\fR will be a list of
\fIoption\fR names and their \fIvalue\fRs; however, a type's
constructor can specify a different argument list.
.sp
As of Snit V0.95, \fBcreate\fR will throw an error if the \fIname\fR
is the same as any existing command--note that this was always true
for \fBsnit::widget\fRs and \fBsnit::widgetadaptor\fRs.  You can
restore the previous behavior using the \fB-canreplace\fR pragma.
.TP
\fB$type\fR \fBinfo typevars\fR ?\fIpattern\fR?
Returns a list of the type's type variables (excluding Snit internal
variables); all variable names are fully-qualified.
.sp
If \fIpattern\fR is given, it's used as a \fBstring match\fR
pattern; only names that match the pattern are returned.
.TP
\fB$type\fR \fBinfo typemethods\fR ?\fIpattern\fR?
Returns a list of the names of the  type's type methods.
If the type has hierarchical
type methods, whether locally-defined or delegated, only the first
word of each will be included in the list.
.sp
If the type
definition includes \fBdelegate typemethod *\fR, the list will
include only the names of those implicitly delegated type methods
that have been called at least once and are still in the type method cache.
.sp
If \fIpattern\fR is given, it's used as a \fBstring match\fR
pattern; only names that match the pattern are returned.
.TP
\fB$type\fR \fBinfo args\fR \fImethod\fR
Returns a list containing the names of the arguments to the type's
\fImethod\fR, in order. This method cannot be applied to delegated
type methods.
.TP
\fB$type\fR \fBinfo body\fR \fImethod\fR
Returns the body of typemethod \fImethod\fR. This method cannot be
applied to delegated type methods.
.TP
\fB$type\fR \fBinfo default\fR \fImethod\fR \fIaname\fR \fIvarname\fR
Returns a boolean value indicating whether the argument \fIaname\fR of
the type's \fImethod\fR has a default value (\fBtrue\fR) or not
(\fBfalse\fR). If the argument has a default its value is placed into
the variable \fIvarname\fR.
.TP
\fB$type\fR \fBinfo instances\fR ?\fIpattern\fR?
Returns a list of the type's instances.  For \fBsnit::type\fRs, it
will be a list of fully-qualified instance names;
for \fBsnit::widget\fRs, it will be a list of Tk widget names.
.sp
If \fIpattern\fR is given, it's used as a \fBstring match\fR
pattern; only names that match the pattern are returned.
.sp
\fISnit 1.x Incompatibility:\fR  In Snit 1.x, the full multi-word
names of hierarchical type methods are included in the return value.
.TP
\fB$type\fR \fBdestroy\fR
Destroys the type's instances, the type's namespace, and the type
command itself.
.PP
.SS "THE INSTANCE COMMAND"
A Snit type or widget's \fBcreate\fR type method creates objects of
the type; each object has a unique name that is also a Tcl command.
This command is used to access the object's methods and data, and has
this form:
.PP
.TP
\fB$object\fR \fImethod\fR \fIargs...\fR
The \fImethod\fR can be any of the
\fBStandard Instance Methods\fR, or any instance method
defined in the type definition.
The subsequent \fIargs\fR depend on the specific \fImethod\fR chosen.
.PP
.SS "STANDARD INSTANCE METHODS"
In addition to any delegated or locally-defined instance methods in
the type's definition, all Snit objects will have at least the
following subcommands:
.PP
.TP
\fB$object\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue\fR? ...
Assigns new values to one or more options.  If called with one
argument, an \fIoption\fR name, returns a list describing the option,
as Tk widgets do; if called with no arguments, returns a list of lists
describing all options, as Tk widgets do.
.sp
Warning: This information will be available for delegated options only
if the component to which they are delegated has a \fBconfigure\fR
method that returns this same kind of information.
.sp
Note: Snit defines this method only if the type has at least one
option.
.TP
\fB$object\fR \fBconfigurelist\fR \fIoptionlist\fR
Like \fBconfigure\fR, but takes one argument, a list of options and
their values.  It's mostly useful in the type constructor, but can be
used anywhere.
.sp
Note: Snit defines this method only if the type has at least one
option.
.TP
\fB$object\fR \fBcget\fR \fIoption\fR
Returns the option's value.
.sp
Note: Snit defines this method only if the type has at least one
option.
.TP
\fB$object\fR \fBdestroy\fR
Destroys the object, calling the \fBdestructor\fR and freeing all
related memory.
.sp
\fINote:\fR
The \fBdestroy\fR method isn't defined for \fBsnit::widget\fR or
\fBsnit::widgetadaptor\fR objects; instances of these are destroyed by
calling \fBTk\fR's \fBdestroy\fR command, just as normal
widgets are.
.TP
\fB$object\fR \fBinfo type\fR
Returns the instance's type.
.TP
\fB$object\fR \fBinfo vars\fR ?\fIpattern\fR?
Returns a list of the object's instance variables (excluding Snit
internal variables).  The names are fully qualified.
.sp
If \fIpattern\fR is given, it's used as a \fBstring match\fR
pattern; only names that match the pattern are returned.
.TP
\fB$object\fR \fBinfo typevars\fR ?\fIpattern\fR?
Returns a list of the object's type's type variables (excluding Snit
internal variables).  The names are fully qualified.
.sp
If \fIpattern\fR is given, it's used as a \fBstring match\fR
pattern; only names that match the pattern are returned.
.TP
\fB$object\fR \fBinfo typemethods\fR ?\fIpattern\fR?
Returns a list of the names of the  type's type methods.
If the type has hierarchical
type methods, whether locally-defined or delegated, only the first
word of each will be included in the list.
.sp
If the type
definition includes \fBdelegate typemethod *\fR, the list will
include only the names of those implicitly delegated type methods
that have been called at least once and are still in the type method cache.
.sp
If \fIpattern\fR is given, it's used as a \fBstring match\fR
pattern; only names that match the pattern are returned.
.sp
\fISnit 1.x Incompatibility:\fR  In Snit 1.x, the full multi-word
names of hierarchical type methods are included in the return value.
.TP
\fB$object\fR \fBinfo options\fR ?\fIpattern\fR?
Returns a list of the object's option names.  This always includes
local options and explicitly delegated options.  If unknown options
are delegated as well, and if the component to which they are
delegated responds to \fB$object configure\fR like Tk widgets do,
then the result will include all possible unknown options that can
be delegated to the component.
.sp
If \fIpattern\fR is given, it's used as a \fBstring match\fR
pattern; only names that match the pattern are returned.
.sp
Note that the return value might be different for different instances
of the same type, if component object types can vary from one instance
to another.
.TP
\fB$object\fR \fBinfo methods\fR ?\fIpattern\fR?
Returns a list of the names of the instance's methods.
If the type has hierarchical methods, whether locally-defined or
delegated, only the first word of each will be included in the list.
.sp
If the type
definition includes \fBdelegate method *\fR, the list will
include only the names of those implicitly delegated methods that have
been called at least once and are still in the method cache.
.sp
If \fIpattern\fR is given, it's used as a \fBstring match\fR
pattern; only names that match the pattern are returned.
.sp
\fISnit 1.x Incompatibility:\fR  In Snit 1.x, the full multi-word
names of hierarchical type methods are included in the return value.
.TP
\fB$object\fR \fBinfo args\fR \fImethod\fR
Returns a list containing the names of the arguments to the instance's
\fImethod\fR, in order. This method cannot be applied to delegated methods.
.TP
\fB$object\fR \fBinfo body\fR \fImethod\fR
Returns the body of the instance's method \fImethod\fR. This method
cannot be applied to delegated methods.
.TP
\fB$object\fR \fBinfo default\fR \fImethod\fR \fIaname\fR \fIvarname\fR
Returns a boolean value indicating whether the argument \fIaname\fR of
the instance's \fImethod\fR has a default value (\fBtrue\fR) or not
(\fBfalse\fR). If the argument has a default its value is placed into
the variable \fIvarname\fR.
.PP
.SS "COMMANDS FOR USE IN OBJECT CODE"
Snit defines the following commands for use in your object code:
that is, for use in type methods, instance methods, constructors,
destructors, onconfigure handlers, oncget handlers, and procs.
They do not reside in the ::snit:: namespace; instead, they are
created with the type, and can be used without qualification.
.TP
\fBmymethod\fR \fIname\fR ?\fIargs...\fR?
The \fBmymethod\fR command is used for formatting callback commands to
be passed to other objects.  It returns a command that when called
will invoke method \fIname\fR with the specified arguments, plus of
course any arguments added by the caller.  In other words, both of the
following commands will cause the object's
\fBdosomething\fR method to be called when the \fB$button\fR is pressed:
.CS

    $button configure -command [list $self dosomething myargument]

    $button configure -command [mymethod dosomething myargument]

.CE
.IP
The chief distinction between the two is that the latter form will not
break if the object's command is renamed.
.TP
\fBmytypemethod\fR \fIname\fR ?\fIargs...\fR?
The \fBmytypemethod\fR command is used for formatting callback commands to
be passed to other objects.  It returns a command that when called
will invoke type method \fIname\fR with the specified arguments, plus of
course any arguments added by the caller.  In other words, both of the
following commands will cause the object's \fBdosomething\fR type method
to be called when \fB$button\fR is pressed:
.CS

    $button configure -command [list $type dosomething myargument]

    $button configure -command [mytypemethod dosomething myargument]

.CE
.IP
Type commands cannot be renamed, so in practice there's little
difference between the two forms.  \fBmytypemethod\fR is provided for
parallelism with \fBmymethod\fR.
.TP
\fBmyproc\fR \fIname\fR ?\fIargs...\fR?
The \fBmyproc\fR command is used for formatting callback commands to
be passed to other objects.  It returns a command that when called
will invoke the type proc \fIname\fR with the specified arguments, plus of
course any arguments added by the caller.  In other words, both of the
following commands will cause the object's \fBdosomething\fR proc
to be called when \fB$button\fR is pressed:
.CS

    $button configure -command [list ${type}::dosomething myargument]

    $button configure -command [myproc dosomething myargument]

.CE
.TP
\fBmyvar\fR \fIname\fR
Given an instance variable name, returns the fully qualified name.
Use this if you're passing the variable to some other object, e.g., as
a \fB-textvariable\fR to a Tk label widget.
.TP
\fBmytypevar\fR \fIname\fR
Given an type variable name, returns the fully qualified name.  Use
this if you're passing the variable to some other object, e.g., as a
\fB-textvariable\fR to a Tk label widget.
.TP
\fBfrom\fR \fIargvName\fR \fIoption\fR ?\fIdefvalue\fR?
The \fBfrom\fR command plucks an option value from a list of options
and their values, such as is passed into a type's \fBconstructor\fR.
\fIargvName\fR must be the name of a variable containing such a list;
\fIoption\fR is the name of the specific option.
.sp
\fBfrom\fR looks for \fIoption\fR in the option list.  If it is found,
it and its value are removed from the list, and the value is returned.
If \fIoption\fR doesn't appear in the list, then the \fIdefvalue\fR is
returned.
If the option is locally-defined option, and \fIdefvalue\fR is
not specified, then the option's default value as specified in the
type definition will be returned instead.
.TP
\fBinstall\fR \fIcompName\fR \fBusing\fR \fIobjType\fR \fIobjName\fR \fIargs...\fR
Creates a new object of type \fIobjType\fR called \fIobjName\fR
and installs it as component \fIcompName\fR,
as described in \fBComponents and Delegation\fR.  Any additional
\fIargs...\fR are passed along with the name to the \fIobjType\fR
command.
If this is a \fBsnit::type\fR, then the following two commands are
equivalent:
.CS

    install myComp using myObjType $self.myComp args...

    set myComp [myObjType $self.myComp args...]

.CE
.IP
Note that whichever method is used, \fIcompName\fR must still be
declared in the type definition using \fBcomponent\fR, or must be
referenced in at least one \fBdelegate\fR statement.
.sp
If this is a \fBsnit::widget\fR or \fBsnit::widgetadaptor\fR, and if
options have been delegated to component \fIcompName\fR, then those
options will receive default values from the Tk option database.  Note
that it doesn't matter whether the component to be installed is a
widget or not.  See \fBThe Tk Option Database\fR for more
information.
.sp
\fBinstall\fR cannot be used to install type components; just assign
the type component's command name to the type component's variable
instead.
.TP
\fBinstallhull\fR \fBusing\fR \fIwidgetType\fR \fIargs...\fR
.TP
\fBinstallhull\fR \fIname\fR
The constructor of a \fBsnit::widgetadaptor\fR must create a widget to
be the object's hull component; the widget is installed as the hull
component using this command.  Note that the installed widget's name
must be \fB$win\fR.
This command has two forms.
.sp
The first form specifies the \fIwidgetType\fR and the \fIargs...\fR
(that is, the hardcoded option list) to use in creating the hull.
Given this form, \fBinstallhull\fR creates the hull widget, and
initializes any options delegated to the hull from the Tk option
database.
.sp
In the second form, the hull widget has already been created; note
that its name must be "$win".  In this case, the Tk option database is
\fInot\fR queried for any options delegated to the hull.
The longer form is preferred; however, the shorter form allows the
programmer to adapt a widget created elsewhere, which is sometimes
useful.  For example, it can be used to adapt a "page" widget created
by a \fBBWidgets\fR tabbed notebook or pages manager widget.
.sp
See \fBThe Tk Option Database\fR for more information
about \fBsnit::widgetadaptor\fRs and the option database.
.TP
\fBvariable\fR \fIname\fR
Normally, instance variables are defined in the type definition along
with the options, methods, and so forth; such instance variables are
automatically visible in all instance code (e.g., method bodies).  However,
instance code can use the \fBvariable\fR command to declare instance variables
that don't appear in the type definition, and also to bring variables
from other namespaces into scope in the usual way.
.sp
It's generally clearest to define all instance variables in the type
definition, and omit declaring them in methods and so forth.
.sp
Note that this is an instance-specific version of the standard Tcl
\fB::variable\fR command.
.TP
\fBtypevariable\fR \fIname\fR
Normally, type variables are defined in the type definition, along
with the instance variables; such type variables are automatically
visible in all of the type's code.  However, type methods, instance
methods and so forth can use \fBtypevariable\fR to declare type
variables that don't appear in the type definition.
.sp
It's generally clearest to declare all type variables in the type
definition, and omit declaring them in methods, type methods, etc.
.TP
\fBvarname\fR \fIname\fR
\fBDeprecated.\fR  Use \fBmyvar\fR instead.
.sp
Given an instance variable name, returns the fully qualified name.
Use this if you're passing the variable to some other object, e.g., as
a \fB-textvariable\fR to a Tk label widget.
.TP
\fBtypevarname\fR \fIname\fR
\fBDeprecated.\fR  Use \fBmytypevar\fR instead.
.sp
Given a type variable name, returns the fully qualified name.  Use
this if you're passing the type variable to some other object, e.g., as a
\fB-textvariable\fR to a Tk label widget.
.TP
\fBcodename\fR \fIname\fR
\fBDeprecated.\fR  Use \fBmyproc\fR instead.
Given the name of a proc (but not a type or instance method), returns
the fully-qualified command name, suitable for passing as a callback.
.PP
.PP
.SS "COMPONENTS AND DELEGATION"
When an object includes other objects, as when a toolbar contains
buttons or a GUI object contains an object that references a database,
the included object is called a component.  The standard way to handle
component objects owned by a Snit object is to declare them using
\fBcomponent\fR, which creates a component instance variable.
In the following example, a \fBdog\fR object has a
\fBtail\fR object:
.PP
.CS

    snit::type dog {
        component mytail

        constructor {args} {
            set mytail [tail %AUTO% -partof $self]
            $self configurelist $args
        }

        method wag {} {
            $mytail wag
        }
    }

    snit::type tail {
        option -length 5
        option -partof
        method wag {} { return "Wag, wag, wag."}
    }

.CE
.PP
Because the \fBtail\fR object's name is stored in an instance
variable, it's easily accessible in any method.
.PP
The \fBinstall\fR command provides an alternate way
to create and install the component:
.PP
.CS

    snit::type dog {
        component mytail

        constructor {args} {
            install mytail using tail %AUTO% -partof $self
            $self configurelist $args
        }

        method wag {} {
            $mytail wag
        }
    }

.CE
.PP
For \fBsnit::type\fRs, the two methods are equivalent; for
\fBsnit::widget\fRs and \fBsnit::widgetadaptor\fRs, the \fBinstall\fR
command properly initializes the widget's options by querying
\fBThe Tk Option Database\fR.
.PP
In the above examples, the \fBdog\fR object's \fBwag\fR method
simply calls the \fBtail\fR component's \fBwag\fR method.  In OO
jargon, this is called delegation.  Snit provides an easier way to do
this:
.PP
.CS

    snit::type dog {
        delegate method wag to mytail

        constructor {args} {
            install mytail using tail %AUTO% -partof $self
            $self configurelist $args
        }
    }

.CE
.PP
The \fBdelegate\fR statement in the type definition implicitly defines
the instance variable \fBmytail\fR to hold the component's name
(though it's good form to use \fBcomponent\fR to declare it explicitly); it
also defines the \fBdog\fR object's \fBwag\fR method, delegating it
to the \fBmytail\fR component.
.PP
If desired, all otherwise unknown methods can be delegated to a
specific component:
.PP
.CS


    snit::type dog {
	delegate method * to mytail

	constructor {args} {
	    set mytail [tail %AUTO% -partof $self]
	    $self configurelist $args
	}

	method bark { return "Bark, bark, bark!" }
    }

.CE
.PP
In this case, a \fBdog\fR object will handle its own \fBbark\fR
method; but \fBwag\fR will be passed along to \fBmytail\fR.  Any
other method, being recognized by neither \fBdog\fR nor \fBtail\fR,
will simply raise an error.
.PP
Option delegation is similar to method delegation, except for the
interactions with the Tk option database; this is described in
\fBThe Tk Option Database\fR.
.SS "TYPE COMPONENTS AND DELEGATION"
The relationship between type components and instance components is
identical to that between type variables and instance variables, and
that between type methods and instance methods.  Just as an instance
component is an instance variable that holds the name of a command, so
a type component is a type variable that holds the name of a command.
In essence, a type component is a component that's shared by every
instance of the type.
.PP
Just as \fBdelegate method\fR can be used to delegate methods to
instance components, as described in
\fBComponents and Delegation\fR, so \fBdelegate typemethod\fR
can be used to delegate type methods to type components.
.PP
Note also that as of Snit 0.95 \fBdelegate method\fR can delegate
methods to both instance components and type components.
.SS "THE TK OPTION DATABASE"
This section describes how Snit interacts with the Tk option database,
and assumes the reader has a working knowledge of the option database
and its uses.  The book \fIPractical Programming in Tcl and Tk\fR
by Welch et al has a good introduction to the option database, as does
\fIEffective Tcl/Tk Programming\fR.
.PP
Snit is implemented so that most of the time it will simply do the
right thing with respect to the option database, provided that the
widget developer does the right thing by Snit.  The body of this
section goes into great deal about what Snit requires.  The following
is a brief statement of the requirements, for reference.
.PP
.IP \(bu
If the \fBsnit::widget\fR's default widget class is not what is desired, set it
explicitly using \fBwidgetclass\fR in the widget definition.
.IP \(bu
When defining or delegating options, specify the resource and class
names explicitly when if the defaults aren't what you want.
.IP \(bu
Use \fBinstallhull using\fR to install the hull for
\fBsnit::widgetadaptor\fRs.
.IP \(bu
Use \fBinstall\fR to install all other components.
.PP
.PP
The interaction of Tk widgets with the option database is a complex
thing; the interaction of Snit with the option database is even more
so, and repays attention to detail.
.PP
\fBSetting the widget class:\fR Every Tk widget has a widget class.
For Tk widgets, the widget class name is the just the widget type name
with an initial capital letter, e.g., the widget class for
\fBbutton\fR widgets is "Button".
.PP
Similarly, the widget class of a \fBsnit::widget\fR defaults to the
unqualified type name with the first letter capitalized.  For example,
the widget class of
.PP
.CS

    snit::widget ::mylibrary::scrolledText { ... }
.CE
.PP
is "ScrolledText".  The widget class can also be set explicitly using
the \fBwidgetclass\fR statement within the \fBsnit::widget\fR
definition.
.PP
Any widget can be used as the \fBhulltype\fR provided that it supports
the \fB-class\fR option for changing its widget class name.  See
the discussion of the \fBhulltype\fR command, above.  The user may pass
\fB-class\fR to the widget at instantion.
.PP
The widget class of a \fBsnit::widgetadaptor\fR is just the widget
class of its hull widget; this cannot be changed unless the hull
widget supports \fB-class\fR, in which case it will
usually make more sense to use \fBsnit::widget\fR rather than
\fBsnit::widgetadaptor\fR.
.PP
\fBSetting option resource names and classes:\fR In Tk, every
option has three names: the option name, the resource name, and the
class name.  The option name begins with a hyphen and is all lowercase;
it's used when creating widgets, and with the \fBconfigure\fR and
\fBcget\fR commands.
.PP
The resource and class names are used to initialize option default
values by querying the Tk option database.  The resource name is
usually just the option name minus the hyphen, but may contain
uppercase letters at word boundaries; the class name is usually just
the resource name with an initial capital, but not always.  For
example, here are the option, resource, and class names for several
\fBtext\fR widget options:
.PP
.CS

    -background         background         Background
    -borderwidth        borderWidth        BorderWidth
    -insertborderwidth  insertBorderWidth  BorderWidth
    -padx               padX               Pad

.CE
.PP
As is easily seen, sometimes the resource and class names can be
inferred from the option name, but not always.
.PP
Snit options also have a resource name and a class name.  By default,
these names follow the rule given above: the resource name is the
option name without the hyphen, and the class name is the resource
name with an initial capital.  This is true for both locally-defined
options and explicitly delegated options:
.PP
.CS

    snit::widget mywidget {
        option -background
        delegate option -borderwidth to hull
        delegate option * to text
	# ...
    }

.CE
.PP
In this case, the widget class name is "Mywidget".  The widget has the
following options: \fB-background\fR, which is locally defined, and
\fB-borderwidth\fR, which is explicitly delegated; all other widgets are
delegated to a component called "text", which is probably a Tk
\fBtext\fR widget.  If so, \fBmywidget\fR has all the same options as
a \fBtext\fR widget.  The option, resource, and class names are as
follows:
.PP
.CS

    -background  background  Background
    -borderwidth borderwidth Borderwidth
    -padx        padX        Pad

.CE
.PP
Note that the locally defined option, \fB-background\fR, happens to have
the same three names as the standard Tk \fB-background\fR option; and
\fB-pad\fR, which is delegated implicitly to the \fBtext\fR
component, has the
same three names for \fBmywidget\fR as it does for the \fBtext\fR
widget.  \fB-borderwidth\fR, on the other hand, has different resource and
class names than usual, because the internal word "width" isn't
capitalized.  For consistency, it should be; this is done as follows:
.PP
.CS

    snit::widget mywidget {
	option -background
	delegate option {-borderwidth borderWidth} to hull
	delegate option * to text
	# ...
    }

.CE
.PP
The class name will default to "BorderWidth", as expected.
.PP
Suppose, however, that \fBmywidget\fR also delegated
\fB-padx\fR and
\fB-pady\fR to the hull.  In this case, both the resource name and the
class name must be specified explicitly:
.PP
.CS

    snit::widget mywidget {
	option -background
	delegate option {-borderwidth borderWidth} to hull
	delegate option {-padx padX Pad} to hull
	delegate option {-pady padY Pad} to hull
	delegate option * to text
	# ...
    }

.CE
.PP
\fBQuerying the option database:\fR If you set your widgetclass and
option names as described above, Snit will query the option database
when each instance is created, and will generally do the right thing
when it comes to querying the option database.  The remainder of this
section goes into the gory details.
.PP
\fBInitializing locally defined options:\fR
When an instance of a snit::widget is created, its locally defined
options are initialized as follows: each option's resource and class
names are used to query the Tk option database.  If the result is
non-empty, it is used as the option's default; otherwise, the default
hardcoded in the type definition is used.  In either case, the default
can be overridden by the caller.  For example,
.PP
.CS

    option add *Mywidget.texture pebbled

    snit::widget mywidget {
	option -texture smooth
	# ...
    }

    mywidget .mywidget -texture greasy

.CE
.PP
Here, \fB-texture\fR would normally default to "smooth", but because of
the entry added to the option database it defaults to "pebbled".
However, the caller has explicitly overridden the default, and so the
new widget will be "greasy".
.PP
\fBInitializing options delegated to the hull:\fR
A \fBsnit::widget\fR's hull is a widget, and given that its class has
been set it is expected to query the option database for itself.  The
only exception concerns options that are delegated to it with a
different name.  Consider the following code:
.PP
.CS

    option add *Mywidget.borderWidth 5
    option add *Mywidget.relief sunken
    option add *Mywidget.hullbackground red
    option add *Mywidget.background green

    snit::widget mywidget {
	delegate option -borderwidth to hull
	delegate option -hullbackground to hull as -background
	delegate option * to hull
	# ...
    }

    mywidget .mywidget

    set A [.mywidget cget -relief]
    set B [.mywidget cget -hullbackground]
    set C [.mywidget cget -background]
    set D [.mywidget cget -borderwidth]

.CE
.PP
The question is, what are the values of variables A, B, C and D?
.PP
The value of A is "sunken".  The hull is a Tk frame that has been
given the widget class "Mywidget"; it will automatically query the
option database and pick up this value.  Since the \fB-relief\fR
option is implicitly delegated to the hull, Snit takes no action.
.PP
The value of B is "red".  The hull will automatically pick up the
value "green" for its \fB-background\fR option, just as it picked up the
\fB-relief\fR value.  However, Snit knows that
\fB-hullbackground\fR is mapped to
the hull's \fB-background\fR option; hence, it queries the option database
for \fB-hullbackground\fR and gets "red" and updates the hull
accordingly.
.PP
The value of C is also "red", because \fB-background\fR is implicitly
delegated to the hull; thus, retrieving it is the same as retrieving
\fB-hullbackground\fR.  Note that this case is unusual; in practice,
\fB-background\fR would probably be explicitly delegated to some other
component.
.PP
The value of D is "5", but not for the reason you think.  Note that as
it is defined above, the resource name for \fB-borderwidth\fR
defaults to "borderwidth", whereas the option database entry is
"borderWidth".  As with \fB-relief\fR, the hull picks up its
own \fB-borderwidth\fR option before Snit does anything.  Because the
option is delegated under its own name, Snit assumes that the correct
thing has happened, and doesn't worry about it any further.
.PP
For \fBsnit::widgetadaptor\fRs, the case is somewhat altered.  Widget
adaptors retain the widget class of their hull, and the hull is not
created automatically by Snit.  Instead, the \fBsnit::widgetadaptor\fR
must call \fBinstallhull\fR in its constructor.  The normal way to do
this is as follows:
.PP
.CS

    snit::widgetadaptor mywidget {
	# ...
	constructor {args} {
	    # ...
	    installhull using text -foreground white
	    #
	}
	#...
    }

.CE
.PP
In this case, the \fBinstallhull\fR command will create the hull using
a command like this:
.PP
.CS

    set hull [text $win -foreground white]

.CE
.PP
The hull is a \fBtext\fR widget, so its widget class is "Text".  Just
as with \fBsnit::widget\fR hulls, Snit assumes that it will pick up
all of its normal option values automatically; options delegated from
a different name are initialized from the option database in the same
way.
.PP
\fBInitializing options delegated to other components:\fR
Non-hull components are matched against the option database in two
ways.  First, a component widget remains a widget still, and therefore
is initialized from the option database in the usual way.
Second, the option database is queried for all options delegated to
the component, and the component is initialized accordingly--provided
that the \fBinstall\fR command is used to create it.
.PP
Before option database support was added to Snit, the usual way to
create a component was to simply create it in the constructor and
assign its command name to the component variable:
.PP
.CS

    snit::widget mywidget {
	delegate option -background to myComp

	constructor {args} {
	    set myComp [text $win.text -foreground black]
	}
    }

.CE
.PP
The drawback of this method is that Snit has no opportunity to
initialize the component properly.  Hence, the following approach is
now used:
.PP
.CS

    snit::widget mywidget {
	delegate option -background to myComp

	constructor {args} {
	    install myComp using text $win.text -foreground black
	}
    }

.CE
.PP
The \fBinstall\fR command does the following:
.PP
.IP \(bu
Builds a list of the options explicitly included in the \fBinstall\fR
command -- in this case, \fB-foreground\fR.
.IP \(bu
Queries the option database for all options delegated explicitly to
the named component.
.IP \(bu
Creates the component using the specified command, after inserting
into it a list of options and values read from the option database.
Thus, the explicitly included options (\fB-foreground\fR) will override
anything read from the option database.
.IP \(bu
If the widget definition implicitly delegated options to the component
using \fBdelegate option *\fR, then Snit calls the newly created
component's \fBconfigure\fR method to receive a list of all of the
component's options.  From this Snit builds a list of options
implicitly delegated to the component that were not explicitly
included in the \fBinstall\fR command.  For all such options, Snit
queries the option database and configures the component accordingly.
.PP
.PP
\fBNon-widget components:\fR The option database is never queried
for \fBsnit::type\fRs, since it can only be queried given a Tk widget
name.
However, \fBsnit::widget\fRs can have non-widget components.  And if
options are delegated to those components, and if the \fBinstall\fR
command is used to install those components, then they will be
initialized from the option database just as widget components are.
.PP
.SS "MACROS AND META-PROGRAMMING"
The \fBsnit::macro\fR command enables a certain amount of
meta-programming with Snit classes.  For example, suppose you like to
define properties: instance variables that have set/get methods.  Your
code might look like this:
.CS

    snit::type dog {
        variable mood happy

        method getmood {} {
            return $mood
        }

        method setmood {newmood} {
            set mood $newmood
        }
    }

.CE
That's nine lines of text per property.  Or, you could define the
following \fBsnit::macro\fR:
.CS

    snit::macro property {name initValue} {
        variable $name $initValue

        method get$name {} "return $name"

        method set$name {value} "set $name \\$value"
    }

.CE
Note that a \fBsnit::macro\fR is just a normal Tcl proc defined in
the slave interpreter used to compile type and widget definitions; as
a result, it has access to all the commands used to define types and
widgets.
.PP
Given this new macro, you can define a property in one line of code:
.CS

    snit::type dog {
        property mood happy
    }

.CE
Within a macro, the commands \fBvariable\fR and \fBproc\fR refer to
the Snit type-definition commands, not the standard Tcl commands.  To
get the standard Tcl commands, use \fB_variable\fR and \fB_proc\fR.
.PP
Because a single slave interpreter is used for compiling all Snit
types and widgets in the application, there's the possibility of macro
name collisions.  If you're writing a reuseable package using Snit,
and you use some \fBsnit::macro\fRs, define them in your package
namespace:
.CS

    snit::macro mypkg::property {name initValue} { ... }

    snit::type dog {
        mypkg::property mood happy
    }

.CE
This leaves the global namespace open for application authors.
.PP
.SS "VALIDATION TYPES"
A validation type is an object that can be used to validate
Tcl values of a particular kind.  For example,
\fBsnit::integer\fR is used to validate that a Tcl value is
an integer.
.PP
Every validation type has a \fBvalidate\fR method which is used to
do the validation. This method must take a single argument, the value
to be validated; further, it must do nothing if the value is valid,
but throw an error if the value is invalid:
.CS

    snit::integer validate 5     ;# Does nothing
    snit::integer validate 5.0   ;# Throws an error (not an integer!)

.CE
.PP
The \fBvalidate\fR method will always return the validated value on success,
and throw the \fB-errorcode\fR INVALID on error.
.PP
Snit defines a family of validation types, all of which are
implemented as \fBsnit::type\fR's.  They can be used as is;
in addition, their instances serve as parameterized
subtypes.  For example, a probability is a number between 0.0 and 1.0
inclusive:
.CS

    snit::double probability -min 0.0 -max 1.0

.CE
The example above creates an instance of \fBsnit::double\fR--a
validation subtype--called
\fBprobability\fR, which can be used to validate probability values:
.CS

    probability validate 0.5   ;# Does nothing
    probability validate 7.9   ;# Throws an error

.CE
Validation subtypes can be defined explicitly, as in the above
example; when a locally-defined option's \fB-type\fR is specified,
they may also be created on the fly:
.CS

    snit::enum ::dog::breed -values {mutt retriever sheepdog}

    snit::type dog {
        # Define subtypes on the fly...
        option -breed -type {
            snit::enum -values {mutt retriever sheepdog}
        }

        # Or use predefined subtypes...
        option -breed -type ::dog::breed
    }

.CE
.PP
Any object that has a \fBvalidate\fR method with the semantics
described above can be used as a validation type; see
\fBDefining Validation Types\fR for information on how to define
new ones.
.PP
Snit defines the following validation types:
.TP
\fBsnit::boolean\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::boolean\fR \fIname\fR
Validates Tcl boolean values: 1, 0, \fBon\fR, \fBoff\fR,
\fByes\fR, \fBno\fR, \fBtrue\fR, \fBfalse\fR.
It's possible to define subtypes--that is, instances--of
\fBsnit::boolean\fR, but as it has no options there's no reason to do
so.
.TP
\fBsnit::double\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::double\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
Validates floating-point values.  Subtypes may be created with the
following options:
.RS
.TP
\fB-min\fR \fImin\fR
Specifies a floating-point minimum bound; a value is invalid if it is strictly
less than \fImin\fR.
.TP
\fB-max\fR \fImax\fR
Specifies a floating-point maximum bound; a value is invalid if it is strictly
greater than \fImax\fR.
.RE
.TP
\fBsnit::enum\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::enum\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
Validates that a value comes from an enumerated list.  The base
type is of little use by itself, as only subtypes actually have
an enumerated list to validate against.  Subtypes may be created
with the following options:
.RS
.TP
\fB-values\fR \fIlist\fR
Specifies a list of valid values.  A value is valid if and only if
it's included in the list.
.RE
.TP
\fBsnit::fpixels\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::fpixels\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
\fITk programs only.\fR Validates screen distances, in any of the
forms accepted by \fBwinfo fpixels\fR. Subtypes may be created with the
following options:
.RS
.TP
\fB-min\fR \fImin\fR
Specifies a minimum bound; a value is invalid if it is strictly
less than \fImin\fR.  The bound may be expressed in any of the
forms accepted by \fBwinfo fpixels\fR.
.TP
\fB-max\fR \fImax\fR
Specifies a maximum bound; a value is invalid if it is strictly
greater than \fImax\fR.  The bound may be expressed in any of the
forms accepted by \fBwinfo fpixels\fR.
.RE
.TP
\fBsnit::integer\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::integer\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
Validates integer values.  Subtypes may be created with the
following options:
.RS
.TP
\fB-min\fR \fImin\fR
Specifies an integer minimum bound; a value is invalid if it is strictly
less than \fImin\fR.
.TP
\fB-max\fR \fImax\fR
Specifies an integer maximum bound; a value is invalid if it is strictly
greater than \fImax\fR.
.RE
.TP
\fBsnit::listtype\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::listtype\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
Validates Tcl lists. Subtypes may be created with the
following options:
.RS
.TP
\fB-minlen\fR \fImin\fR
Specifies a minimum list length; the value is invalid if it has
fewer than \fImin\fR elements.  Defaults to 0.
.TP
\fB-maxlen\fR \fImax\fR
Specifies a maximum list length; the value is invalid if it
more than \fImax\fR elements.
.TP
\fB-type\fR \fItype\fR
Specifies the type of the list elements; \fItype\fR must be
the name of a validation type or subtype.  In the
following example, the value of \fB-numbers\fR must be a list
of integers.
.CS

    option -numbers -type {snit::listtype -type snit::integer}

.CE
.IP
Note that this option doesn't support defining new validation subtypes
on the fly; that is, the following code will not work (yet, anyway):
.CS

    option -numbers -type {
        snit::listtype -type {snit::integer -min 5}
    }

.CE
.IP
Instead, define the subtype explicitly:
.CS

    snit::integer gt4 -min 5

    snit::type mytype {
        option -numbers -type {snit::listtype -type gt4}
    }

.CE
.RE
.TP
\fBsnit::pixels\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::pixels\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
\fITk programs only.\fR Validates screen distances, in any of the
forms accepted by \fBwinfo pixels\fR. Subtypes may be created with the
following options:
.RS
.TP
\fB-min\fR \fImin\fR
Specifies a minimum bound; a value is invalid if it is strictly
less than \fImin\fR.  The bound may be expressed in any of the
forms accepted by \fBwinfo pixels\fR.
.TP
\fB-max\fR \fImax\fR
Specifies a maximum bound; a value is invalid if it is strictly
greater than \fImax\fR.  The bound may be expressed in any of the
forms accepted by \fBwinfo pixels\fR.
.RE
.TP
\fBsnit::stringtype\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::stringtype\fR \fIname\fR ?\fIoption\fR \fIvalue\fR...?
Validates Tcl strings. The base type is of little use by itself,
since very Tcl value is also a valid string.  Subtypes may be created with the
following options:
.RS
.TP
\fB-minlen\fR \fImin\fR
Specifies a minimum string length; the value is invalid if it has
fewer than \fImin\fR characters.  Defaults to 0.
.TP
\fB-maxlen\fR \fImax\fR
Specifies a maximum string length; the value is invalid if it has
more than \fImax\fR characters.
.TP
\fB-glob\fR \fIpattern\fR
Specifies a \fBstring match\fR pattern; the value is invalid
if it doesn't match the pattern.
.TP
\fB-regexp\fR \fIregexp\fR
Specifies a regular expression; the value is invalid if it doesn't
match the regular expression.
.TP
\fB-nocase\fR \fIflag\fR
By default, both \fB-glob\fR and \fB-regexp\fR matches are
case-sensitive.  If \fB-nocase\fR is set to true, then both
\fB-glob\fR and \fB-regexp\fR matches are case-insensitive.
.RE
.TP
\fBsnit::window\fR \fBvalidate\fR ?\fIvalue\fR?
.TP
\fBsnit::window\fR \fIname\fR
\fITk programs only.\fR  Validates Tk window names.  The value must
cause \fBwinfo exists\fR to return true; otherwise, the value is
invalid.  It's possible to define subtypes--that is, instances--of
\fBsnit::window\fR, but as it has no options at present there's no
reason to do so.
.PP
.PP
.SS "DEFINING VALIDATION TYPES"
There are three ways to define a new validation type: as a subtype of
one of Snit's validation types, as a validation type command, and as
a full-fledged validation type similar to those provided by Snit.
Defining subtypes of Snit's validation types is described above,
under \fBValidation Types\fR.
.PP
The next simplest way to create a new validation type is as a
validation type command.  A validation type is simply an
object that has a \fBvalidate\fR method; the \fBvalidate\fR
method must take one argument, a value, return the value if it is
valid, and throw an error with \fB-errorcode\fR INVALID if the
value is invalid.  This can be done with a simple \fBproc\fR.  For
example, the \fBsnit::boolean\fR validate type could have been
implemented like this:
.CS

    proc ::snit::boolean {"validate" value} {
        if {![string is boolean -strict $value]} {
            return -code error -errorcode INVALID \\
                "invalid boolean \\"$value\\", should be one of: 1, 0, ..."
        }

        return $value
    }

.CE
A validation type defined in this way cannot be subtyped, of course;
but for many applications this will be sufficient.
.PP
Finally, one can define a full-fledged, subtype-able validation type
as a \fBsnit::type\fR.  Here's a skeleton to get you started:
.CS

    snit::type myinteger {
        # First, define any options you'd like to use to define
        # subtypes.  Give them defaults such that they won't take
        # effect if they aren't used, and marked them "read-only".
        # After all, you shouldn't be changing their values after
        # a subtype is defined.
        #
        # For example:

        option -min -default "" -readonly 1
        option -max -default "" -readonly 1

        # Next, define a "validate" type method which should do the
        # validation in the basic case.  This will allow the
        # type command to be used as a validation type.

        typemethod validate {value} {
            if {![string is integer -strict $value]} {
                return -code error -errorcode INVALID \\
                    "invalid value \\"$value\\", expected integer"
            }

            return $value
        }

        # Next, the constructor should validate the subtype options,
        # if any.  Since they are all readonly, we don't need to worry
        # about validating the options on change.

        constructor {args} {
            # FIRST, get the options
            $self configurelist $args

            # NEXT, validate them.

            # I'll leave this to your imagination.
        }

        # Next, define a "validate" instance method; its job is to
        # validate values for subtypes.

        method validate {value} {
            # First, call the type method to do the basic validation.
            $type validate $value

            # Now we know it's a valid integer.

            if {("" != $options(-min) && $value < $options(-min))  ||
                ("" != $options(-max) && $value > $options(-max))} {
                # It's out of range; format a detailed message about
                # the error, and throw it.

                set msg "...."

                return -code error -errorcode INVALID $msg
            }

            # Otherwise, if it's valid just return it.
            return $valid
        }
    }

.CE
And now you have a type that can be subtyped.
.PP
The file "validate.tcl" in the Snit distribution defines all of Snit's
validation types; you can find the complete implementation for
\fBsnit::integer\fR and the other types there, to use as examples for
your own types.
.PP
.SH CAVEATS
If you have problems, find bugs, or new ideas you are hereby cordially
invited to submit a report of your problem, bug, or idea at the
SourceForge trackers for tcllib, which can be found at
\fIhttp://sourceforge.net/projects/tcllib/\fR.
The relevant category is \fIsnit\fR.
.PP
Additionally, you might wish to join the Snit mailing list;
see \fIhttp://www.wjduquette.com/snit\fR for details.
.PP
One particular area to watch is using \fBsnit::widgetadaptor\fR to
adapt megawidgets created by other megawidget packages; correct
widget destruction depends on the order of the <Destroy> bindings.
The wisest course is simply not to do this.
.SH "KNOWN BUGS"
.IP \(bu
Error stack traces returned by Snit 1.x are extremely ugly and typically
contain far too much information about Snit internals.  The error
messages are much improved in Snit 2.2.
.IP \(bu
Also see the SourceForge Trackers at
\fIhttp://sourceforge.net/projects/tcllib/\fR, category \fIsnit\fR.
.PP
.SH HISTORY
During the course of developing Notebook
(See \fIhttp://www.wjduquette.com/notebook\fR), my Tcl-based personal
notebook application, I found I was writing it as a collection of
objects.  I wasn't using any particular object-oriented framework; I
was just writing objects in pure Tcl following the guidelines in my
Guide to Object Commands
(see \fIhttp://www.wjduquette.com/tcl/objects.html\fR), along with a
few other tricks I'd picked up since.  And though it was working well,
it quickly became tiresome because of the amount of boilerplate
code associated with each new object type.
.PP
So that was one thing--tedium is a powerful motivator.  But the other
thing I noticed is that I wasn't using inheritance at all, and I
wasn't missing it.  Instead, I was using delegation: objects that
created other objects and delegated methods to them.
.PP
And I said to myself, "This is getting tedious...there has got to be a
better way."  And one afternoon, on a whim, I started working on Snit,
an object system that works the way Tcl works.  Snit doesn't support
inheritance, but it's great at delegation, and it makes creating
megawidgets easy.
.PP
If you have any comments or suggestions (or bug reports!) don't
hesitate to send me e-mail at \[email protected]\fR.  In addition,
there's a Snit mailing list; you can find out more about it at the
Snit home page (see \fIhttp://www.wjduquette.com/snit\fR).
.PP
.SH CREDITS
Snit has been designed and implemented from the very beginning by
William H. Duquette.  However, much credit belongs to the following
people for using Snit and providing me with valuable feedback: Rolf
Ade, Colin McCormack, Jose Nazario, Jeff Godfrey, Maurice Diamanti,
Egon Pasztor, David S. Cargo, Tom Krehbiel, Michael Cleverly,
Andreas Kupries, Marty Backe, Andy Goth, Jeff Hobbs, Brian
Griffin, Donal Fellows, Miguel Sofer, Kenneth Green,
and Anton Kovalenko.
If I've forgotten anyone, my apologies; let me know and I'll add
your name to the list.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIsnit\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
BWidget, C++, Incr Tcl, Snit, adaptors, class, mega widget, object, object oriented, type, widget, widget adaptors
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2003-2009, by William H. Duquette

.fi

Added embedded/man/files/modules/snit/snitfaq.n.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/snit/snitfaq.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003-2006, by William H. Duquette
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "snitfaq" n 2.2 tcllib "Snit's Not Incr Tcl, OO system"
.BS
.SH NAME
snitfaq \- Snit Frequently Asked Questions
.SH DESCRIPTION
.PP
.SH OVERVIEW
.SS "WHAT IS THIS DOCUMENT?"
This is an atypical FAQ list, in that few of the questions are
frequently asked.  Rather, these are the questions I think a newcomer
to Snit should be asking.  This file is not a complete reference to
Snit, however; that information is in the \fBsnit\fR man page.
.SS "WHAT IS SNIT?"
Snit is a framework for defining abstract data types and megawidgets
in pure Tcl.  The name "Snit" stands for "Snit's Not Incr Tcl",
signifying that Snit takes a different approach to defining objects
than does Incr Tcl, the best known object framework for Tcl.  Had
I realized that Snit would become at all popular, I'd probably have
chosen something else.
.PP
The primary purpose of Snit is to be \fIobject glue\fR--to help you
compose diverse objects from diverse sources into types and
megawidgets with clean, convenient interfaces so that you can more
easily build your application.
.PP
Snit isn't about theoretical purity or minimalist design; it's about
being able to do powerful things easily and consistently without
having to think about them--so that you can concentrate on building
your application.
.PP
Snit isn't about implementing thousands of nearly identical
carefully-specified lightweight thingamajigs--not as individual Snit
objects.  Traditional Tcl methods will be much faster, and not much
more complicated.  But Snit \fIis\fR about implementing a clean interface
to manage a collection of thousands of nearly identical
carefully-specified lightweight thingamajigs (e.g., think of the text
widget and text tags, or the canvas widget and canvas objects).  Snit
lets you hide the details of just how those thingamajigs are
stored--so that you can ignore it, and concentrate on building your
application.
.PP
Snit isn't a way of life, a silver bullet, or the Fountain of
Youth. It's just a way of managing complexity--and of managing some of
the complexity of managing complexity--so that you can concentrate on
building your application.
.SS "WHAT VERSION OF TCL DOES SNIT REQUIRE?"
Snit 1.3 requires Tcl 8.3 or later; Snit 2.2 requires Tcl 8.5 or
later.  See \fBSNIT VERSIONS\fR for the differences between Snit
1.3 and Snit 2.2.
.SS "WHERE CAN I DOWNLOAD SNIT?"
Snit is part of Tcllib, the standard Tcl library, so you might already
have it.  It's also available at the Snit Home Page,
\fIhttp://www.wjduquette.com/snit\fR.
.SS "WHAT ARE SNIT'S GOALS?"
.PP
.IP \(bu
A Snit object should be at least as efficient as a hand-coded Tcl
object (see \fIhttp://www.wjduquette.com/tcl/objects.html\fR).
.IP \(bu
The fact that Snit was used in an object's implementation should be
transparent (and irrelevant) to clients of that object.
.IP \(bu
Snit should be able to encapsulate objects from other sources,
particularly Tk widgets.
.IP \(bu
Snit megawidgets should be (to the extent possible) indistinguishable
in interface from Tk widgets.
.IP \(bu
Snit should be Tclish--that is, rather than trying to emulate C++,
Smalltalk, or anything else, it should try to emulate Tcl itself.
.IP \(bu
It should have a simple, easy-to-use, easy-to-remember syntax.
.PP
.SS "HOW IS SNIT DIFFERENT FROM OTHER OO FRAMEWORKS?"
Snit is unique among Tcl object systems in that
it is based not on inheritance but on delegation.  Object
systems based on inheritance only allow you to inherit from classes
defined using the same system, and that's a shame.  In Tcl, an object
is anything that acts like an object; it shouldn't matter how the
object was implemented.  I designed Snit to help me build applications
out of the materials at hand; thus, Snit is designed to be able to
incorporate and build on any object, whether it's a hand-coded object,
a Tk widget, an Incr Tcl object, a BWidget or almost anything else.
.PP
Note that you can achieve the effect of inheritance using
\fBCOMPONENTS\fR and \fBDELEGATION\fR--and you can inherit
from anything that looks like a Tcl object.
.SS "WHAT CAN I DO WITH SNIT?"
Using Snit, a programmer can:
.IP \(bu
Create abstract data types and Tk megawidgets.
.IP \(bu
Define instance variables, type variables, and Tk-style options.
.IP \(bu
Define constructors, destructors, instance methods, type methods, procs.
.IP \(bu
Assemble a type out of component types.  Instance methods and options
can be delegated to the component types automatically.
.PP
.SH "SNIT VERSIONS"
.SS "WHICH VERSION OF SNIT SHOULD I USE?"
The current Snit distribution includes two versions, Snit 1.3 and Snit
2.2.  The reason that both are included is that Snit 2.2 takes
advantage of a number of new features of Tcl 8.5 to improve run-time
efficiency; as a side-effect, the ugliness of Snit's error messages
and stack traces has been reduced considerably.  The cost of using
Snit 2.2, of course, is that you must target Tcl 8.5.
.PP
Snit 1.3, on the other hand, lacks Snit 2.2's optimizations, but
requires only Tcl 8.3 and later.
.PP
In short, if you're targetting Tcl 8.3 or 8.4 you should use Snit 1.3.  If
you can afford to target Tcl 8.5, you should definitely use Snit 2.2.
If you will be targetting both, you can use Snit 1.3 exclusively, or
(if your code is unaffected by the minor incompatibilities between the
two versions) you can use Snit 1.3 for Tcl 8.4 and Snit 2.2 for Tcl
8.5.
.SS "HOW DO I SELECT THE VERSION OF SNIT I WANT TO USE?"
To always use Snit 1.3 (or a later version of Snit 1.x), invoke Snit
as follows:
.CS

package require snit 1.3

.CE
To always use Snit 2.2 (or a later version of Snit 2.x), say this
instead:
.CS

package require snit 2.2

.CE
Note that if you request Snit 2.2 explicitly, your application will
halt with Tcl 8.4, since Snit 2.2 is unavailable for Tcl 8.4.
.PP
If you wish your application to always use the latest available
version of Snit, don't specify a version number:
.CS

package require snit

.CE
Tcl will find and load the latest version that's available relative to
the version of Tcl being used.  In this case, be careful to avoid
using any incompatible features.
.SS "HOW ARE SNIT 1.3 AND SNIT 2.2 INCOMPATIBLE?"
To the extent possible, Snit 2.2 is intended to be a drop-in
replacement for Snit 1.3. Unfortunately, some incompatibilities were
inevitable because Snit 2.2 uses Tcl 8.5's new
\fBnamespace ensemble\fR mechanism to implement subcommand dispatch.
This approach is much faster than the mechanism used in Snit 1.3, and
also results in much better error messages; however, it also places
new constraints on the implementation.
.PP
There are four specific incompatibilities between Snit 1.3 and Snit 2.2.
.PP
.IP \(bu
Snit 1.3 supports implicit naming of objects.  Suppose you define a
new \fBsnit::type\fR called \fBdog\fR.  You can create instances of
\fBdog\fR in three ways:
.CS

dog spot               ;# Explicit naming
set obj1 [dog %AUTO%]  ;# Automatic naming
set obj2 [dog]         ;# Implicit naming

.CE
.IP
In Snit 2.2, type commands are defined using the \fBnamespace ensemble\fR
mechanism; and \fBnamespace ensemble\fR doesn't allow an ensemble command
to be called without a subcommand.  In short, using
\fBnamespace ensemble\fR there's no way to support implicit naming.
.sp
All is not lost, however.  If the type has no type methods, then the
type command is a simple command rather than an ensemble, and
\fBnamespace ensemble\fR is not used.  In this case, implicit naming
is still possible.
.sp
In short, you can have implicit naming if you're willing to do without
type methods (including the standard type methods, like
\fB$type info\fR).  To do so, use the \fB-hastypemethods\fR pragma:
.CS

pragma -hastypemethods 0
.CE
.IP \(bu
Hierarchical methods and type methods are implemented differently in
Snit 2.2.
.sp
A hierarchical method is an instance method which has
subcommands; these subcommands are themselves methods.  The Tk text
widget's \fBtag\fR command and its subcommands are examples of
hierarchical methods.  You can implement such subcommands in Snit
simply by including multiple words in the method names:
.CS

method {tag configure} {tag args} { ... }

method {tag cget} {tag option} {...}

.CE
.IP
Here we've implicitly defined a \fBtag\fR method which has two
subcommands, \fBconfigure\fR and \fBcget\fR.
.sp
In Snit 1.3, hierarchical methods could be called in two ways:
.CS

$obj tag cget -myoption      ;# The good way
$obj {tag cget} -myoption    ;# The weird way

.CE
.IP
In the second call, we see that a hierarchical method or type method
is simply one whose name contains multiple words.
.sp
In Snit 2.2 this is no longer the case, and the "weird" way of calling
hierarchical methods and type methods no longer works.
.IP \(bu
The third incompatibility derives from the second.  In Snit 1.3,
hierarchical methods were also simply methods whose name contains
multiple words.  As a result, \fB$obj info methods\fR returned the
full names of all hierarchical methods.  In the example above,
the list returned by \fB$obj info methods\fR would include
\fBtag configure\fR and \fBtag cget\fR but not \fBtag\fR, since
\fBtag\fR is defined only implicitly.
.sp
In Snit 2.2, hierarchical methods and type methods are no longer
simply ones whose
name contains multiple words; in the above example, the list returned
by \fB$obj info methods\fR would include \fBtag\fR but not
\fBtag configure\fR or \fBtag cget\fR.
.IP \(bu
The fourth incompatibility is due to a new feature.  Snit 2.2 uses
the new \fBnamespace path\fR command so that a type's code can
call any command defined in the type's parent namespace without
qualification or importation.  For example, suppose you have a
package called \fBmypackage\fR which defines a number of commands
including a type, \fB::mypackage::mytype\fR.  Thanks to
\fBnamespace path\fR, the type's code can call any of the other
commands defined in \fB::mypackage::\fR.
.sp
This is extremely convenient.  However, it also means that commands
defined in the parent namespace, \fB::mypackage::\fR can block the
type's access to identically named commands in the global namespace.
This can lead to bugs.  For example, Tcllib includes a type called
\fB::tie::std::file\fR.  This type's code calls the standard
\fBfile\fR command.  When run with Snit 2.2, the code broke--
the type's command, \fB::tie::std::file\fR, is itself a command
in the type's parent namespace, and so instead of calling
the standard \fBfile\fR command, the type found itself calling
itself.
.PP
.SS "ARE THERE OTHER DIFFERENCES BETWEEN SNIT 1.X AND SNIT 2.2?"
Yes.
.IP \(bu
Method dispatch is considerably faster.
.IP \(bu
Many error messages and stack traces are cleaner.
.IP \(bu
The \fB-simpledispatch\fR pragma is obsolete, and ignored if
present. In Snit 1.x, \fB-simpledispatch\fR substitutes a faster
mechanism for method dispatch, at the cost of losing certain features.
Snit 2.2 method dispatch is faster still in all cases, so
\fB-simpledispatch\fR is no longer needed.
.IP \(bu
In Snit 2.2, a type's code (methods, type methods, etc.) can call commands
from the type's parent namespace without qualifying or importing
them, i.e., type \fB::parentns::mytype\fR's code can call
\fB::parentns::someproc\fR as just \fBsomeproc\fR.
.sp
This is extremely useful when a type is defined as part of a larger
package, and shares a parent namespace with the rest of the package;
it means that the type can call other commands defined by the
package without any extra work.
.sp
This feature depends on the new Tcl 8.5 \fBnamespace path\fR command,
which is why it hasn't been implemented for V1.x.  V1.x code can
achieve something similar by placing
.CS

namespace import [namespace parent]::*
.CE
.IP
in a type constructor.  This is less useful, however, as it picks up
only those commands which have already been exported by the parent
namespace at the time the type is defined.
.PP
.SH OBJECTS
.SS "WHAT IS AN OBJECT?"
A full description of object-oriented programming is beyond
the scope of this FAQ, obviously.  In simple terms, an object is an instance of
an abstract data type--a coherent bundle of code and data.
There are many ways to represent objects in Tcl/Tk; the best known
examples are the Tk widgets.
.PP
A Tk widget is an object; it is represented by a Tcl command.
The object's methods are subcommands of the Tcl command.  The object's
properties are options accessed using the \fBconfigure\fR and
\fBcget\fR methods.  Snit uses the same conventions as Tk widgets do.
.SS "WHAT IS AN ABSTRACT DATA TYPE?"
In computer science terms, an abstract data type is a complex data
structure along with a set of operations--a stack, a queue, a
binary tree, etc--that is to say, in modern terms, an object.  In systems
that include some form of inheritance the word \fIclass\fR is
usually used instead of \fIabstract data type\fR, but as Snit
doesn't implement inheritance as it's ordinarily understood
the older term seems more appropriate.  Sometimes this is called
\fIobject-based\fR programming as opposed to object-oriented
programming.  Note that you can easily create the effect of
inheritance using \fBCOMPONENTS\fR and \fBDELEGATION\fR.
.PP
In Snit, as in Tk, a \fItype\fR is a command that creates instances
-- objects -- which belong to the type.  Most types define some number
of \fIoptions\fR which can be set at creation time, and usually can be
changed later.
.PP
Further, an \fIinstance\fR is also a Tcl command--a command that
gives access to the operations which are defined for that abstract
data type.  Conventionally, the operations are defined as subcommands
of the instance command.  For example, to insert
text into a Tk text widget, you use the text widget's \fBinsert\fR
subcommand:
.PP
.CS

    # Create a text widget and insert some text in it.
    text .mytext -width 80 -height 24
    .mytext insert end "Howdy!"

.CE
.PP
In this example, \fBtext\fR is the \fItype\fR command and \fB.mytext\fR is the \fIinstance\fR command.
.PP
In Snit, object subcommands are generally called
\fBINSTANCE METHODS\fR.
.SS "WHAT KINDS OF ABSTRACT DATA TYPES DOES SNIT PROVIDE?"
Snit allows you to define three kinds of abstract data type:
.PP
.IP \(bu
\fBsnit::type\fR
.IP \(bu
\fBsnit::widget\fR
.IP \(bu
\fBsnit::widgetadaptor\fR
.PP
.SS "WHAT IS A SNIT::TYPE?"
A \fBsnit::type\fR is a non-GUI abstract data type, e.g., a stack or a
queue.  \fBsnit::type\fRs are defined using the \fBsnit::type\fR
command.  For example, if you were designing a kennel management
system for a dog breeder, you'd need a dog type.
.PP
.CS

% snit::type dog {
    # ...
}
::dog
%

.CE
.PP
This definition defines a new command (\fB::dog\fR, in this case)
that can be used to define dog objects.
.PP
An instance of a \fBsnit::type\fR can have \fBINSTANCE METHODS\fR,
\fBINSTANCE VARIABLES\fR, \fBOPTIONS\fR, and \fBCOMPONENTS\fR.
The type itself can have \fBTYPE METHODS\fR,
\fBTYPE VARIABLES\fR, \fBTYPE COMPONENTS\fR, and
\fBPROCS\fR.
.SS "WHAT IS A SNIT::WIDGET?, THE SHORT STORY"
A \fBsnit::widget\fR is a Tk megawidget built using Snit; it is very
similar to a \fBsnit::type\fR.  See \fBWIDGETS\fR.
.SS "WHAT IS A SNIT::WIDGETADAPTOR?, THE SHORT STORY"
A \fBsnit::widgetadaptor\fR uses Snit to wrap an existing widget type
(e.g., a Tk label), modifying its interface to a lesser or greater
extent.  It is very similar to a \fBsnit::widget\fR.
See \fBWIDGET ADAPTORS\fR.
.SS "HOW DO I CREATE AN INSTANCE OF A SNIT::TYPE?"
You create an instance of a \fBsnit::type\fR by passing the new
instance's name to the type's create method.  In the following
example, we create a \fBdog\fR object called \fBspot\fR.
.PP
.CS

% snit::type dog {
    # ....
}
::dog
% dog create spot
::spot
%

.CE
.PP
In general, the \fBcreate\fR method name can be omitted so long as
the instance name doesn't conflict with any defined
\fBTYPE METHODS\fR. (See \fBTYPE COMPONENTS\fR for the
special case in which this doesn't work.)
So the following example is identical to the
previous example:
.PP
.CS

% snit::type dog {
    # ....
}
::dog
% dog spot
::spot
%

.CE
.PP
This document generally uses the shorter form.
.PP
If the \fBdog\fR type defines \fBOPTIONS\fR, these can usually be
given defaults at creation time:
.PP
.CS

% snit::type dog {
    option -breed mongrel
    option -color brown

    method bark {} { return "$self barks." }
}
::dog
% dog create spot -breed dalmation -color spotted
::spot
% spot cget -breed
dalmation
% spot cget -color
spotted
%

.CE
.PP
Once created, the instance name now names a new Tcl command that is used
to manipulate the object.  For example, the following code makes the
dog bark:
.PP
.CS

% spot bark
::spot barks.
%

.CE
.PP
.SS "HOW DO I REFER TO AN OBJECT INDIRECTLY?"
Some programmers prefer to save the object name in a variable, and
reference it that way.  For example,
.PP
.CS

% snit::type dog { ... }
::dog
% set d [dog spot -breed dalmation -color spotted]
::spot
% $d cget -breed
dalmation
% $d bark
::spot barks.
%

.CE
.PP
If you prefer this style, you might prefer to have Snit
generate the instance's name automatically.
.SS "HOW CAN I GENERATE THE OBJECT NAME AUTOMATICALLY?"
If you'd like Snit to generate an object name for you,
use the \fB%AUTO%\fR keyword as the requested name:
.PP
.CS

% snit::type dog { ... }
::dog
% set d [dog %AUTO%]
::dog2
% $d bark
::dog2 barks.
%

.CE
.PP
The \fB%AUTO%\fR keyword can be embedded in a longer string:
.PP
.CS

% set d [dog obj_%AUTO%]
::obj_dog4
% $d bark
::obj_dog4 barks.
%

.CE
.PP
.SS "CAN TYPES BE RENAMED?"
Tcl's \fBrename\fR command renames other commands.  It's a common
technique in Tcl to modify an existing command by renaming it and
defining a new command with the original name; the new command usually
calls the renamed command.
.PP
\fBsnit::type\fR commands, however, should never be renamed; to do so breaks
the connection between the type and its objects.
.SS "CAN OBJECTS BE RENAMED?"
Tcl's \fBrename\fR command renames other commands.  It's a common
technique in Tcl to modify an existing command by renaming it and
defining a new command with the original name; the new command usually
calls the renamed command.
.PP
All Snit objects (including \fIwidgets\fR and \fIwidgetadaptors\fR)
can be renamed, though this flexibility has some consequences:
.PP
.IP \(bu
In an instance method, the implicit argument \fBself\fR will always
contain the object's current name, so instance methods can always call
other instance methods using \fB$self\fR.
.IP \(bu
If the object is renamed, however, then \fB$self\fR's value will change.
Therefore, don't use \fB$self\fR for anything that will break if
\fB$self\fR changes. For example, don't pass a callback command to
another object like this:
.CS


    .btn configure -command [list $self ButtonPress]

.CE
.IP
You'll get an error if \fB.btn\fR calls your command after your object is
renamed.
.IP \(bu
Instead, your object should define its callback command like this:
.CS


    .btn configure -command [mymethod ButtonPress]

.CE
.IP
The \fBmymethod\fR command returns code that will call the desired
method safely; the caller of the callback can add additional
arguments to the end of the command as usual.
.IP \(bu
Every object has a private namespace; the name of this namespace is
available in method bodies, etc., as the value of the implicit
argument \fBselfns\fR.  This value is constant for the life of the
object.  Use \fB$selfns\fR instead of \fB$self\fR if you need a
unique token to identify the object.
.IP \(bu
When a \fBsnit::widget\fR's instance command is renamed, its Tk window
name remains the same -- and is still extremely
important. Consequently, the Tk window name is available in
method bodies as the value of the implicit argument \fBwin\fR.
This value is constant for the
life of the object.  When creating child windows, it's best to use
\fB$win.child\fR rather than \fB$self.child\fR as the name of the
child window.
.PP
.SS "HOW DO I DESTROY A SNIT OBJECT?"
Any Snit object of any type can be destroyed by renaming
it to the empty string using the Tcl \fBrename\fR command.
.PP
Snit megawidgets (i.e., instances of \fBsnit::widget\fR and
\fBsnit::widgetadaptor\fR) can be destroyed like any other widget: by
using the Tk \fBdestroy\fR command on the widget or on one of its
ancestors in the window hierarchy.
.PP
Every instance of a \fBsnit::type\fR has a \fBdestroy\fR method:
.PP
.CS

% snit::type dog { ... }
::dog
% dog spot
::spot
% spot bark
::spot barks.
% spot destroy
% spot barks
invalid command name "spot"
%

.CE
.PP
Finally, every Snit type has a type method called \fBdestroy\fR; calling it
destroys the type and all of its instances:
.CS

% snit::type dog { ... }
::dog
% dog spot
::spot
% spot bark
::spot barks.
% dog destroy
% spot bark
invalid command name "spot"
% dog fido
invalid command name "dog"
%

.CE
.SH "INSTANCE METHODS"
.SS "WHAT IS AN INSTANCE METHOD?"
An instance method is a procedure associated with a specific object
and called as a subcommand of the object's command.  It is given free
access to all of the object's type variables, instance variables, and
so forth.
.SS "HOW DO I DEFINE AN INSTANCE METHOD?"
Instance methods are defined in the type definition using
the \fBmethod\fR statement.  Consider the following code that might be
used to add dogs to a computer simulation:
.PP
.CS

% snit::type dog {
    method bark {} {
        return "$self barks."
    }

    method chase {thing} {
        return "$self chases $thing."
    }
}
::dog
%

.CE
.PP
A dog can bark, and it can chase things.
.PP
The \fBmethod\fR statement looks just like a normal Tcl \fBproc\fR,
except that it appears in a \fBsnit::type\fR definition.  Notice that
every instance method gets an implicit argument called \fBself\fR;
this argument contains the object's name.  (There's more on
implicit method arguments below.)
.SS "HOW DOES A CLIENT CALL AN INSTANCE METHOD?"
The method name becomes a subcommand of the object.  For example,
let's put a simulated dog through its paces:
.PP
.CS

% dog spot
::spot
% spot bark
::spot barks.
% spot chase cat
::spot chases cat.
%

.CE
.PP
.SS "HOW DOES AN INSTANCE METHOD CALL ANOTHER INSTANCE METHOD?"
If method A needs to call method B on the same object, it does so just
as a client does: it calls method B as a subcommand of the object
itself, using the object name stored in the implicit argument \fBself\fR.
.PP
Suppose, for example, that our dogs never chase anything without
barking at them:
.PP
.CS

% snit::type dog {
    method bark {} {
        return "$self barks."
    }

    method chase {thing} {
        return "$self chases $thing.  [$self bark]"
    }
}
::dog
% dog spot
::spot
% spot bark
::spot barks.
% spot chase cat
::spot chases cat.  ::spot barks.
%

.CE
.PP
.SS "ARE THERE ANY LIMITATIONS ON INSTANCE METHOD NAMES?"
Not really, so long as you avoid the standard instance method names:
\fBconfigure\fR, \fBconfigurelist\fR, \fBcget\fR,
\fBdestroy\fR, and \fBinfo\fR.  Also, method names consisting of
multiple words define hierarchical methods.
.SS "WHAT IS A HIERARCHICAL METHOD?"
An object's methods are subcommands of the object's instance command.
Hierarchical methods allow an object's methods to have subcommands of
their own; and these can in turn have subcommands, and so on.  This
allows the programmer to define a tree-shaped command structure, such
as is used by many of the Tk widgets--the subcommands of the
Tk \fBtext\fR widget's \fBtag\fR method are hierarchical methods.
.SS "HOW DO I DEFINE A HIERARCHICAL METHOD?"
Define methods whose names consist of multiple words.  These words
define the hierarchy implicitly.  For example, the following code
defines a \fBtag\fR method with subcommands \fBcget\fR and
\fBconfigure\fR:
.CS

snit::widget mytext {
    method {tag configure} {tag args} { ... }

    method {tag cget} {tag option} {...}
}

.CE
Note that there is no explicit definition for the \fBtag\fR method;
it is implicit in the definition of \fBtag configure\fR and
\fBtag cget\fR.  If you tried to define \fBtag\fR explicitly in this
example, you'd get an error.
.SS "HOW DO I CALL HIERARCHICAL METHODS?"
As subcommands of subcommands.
.CS

% mytext .text
.text
% .text tag configure redtext -foreground red -background black
% .text tag cget redtext -foreground
red
%

.CE
.SS "HOW DO I MAKE AN INSTANCE METHOD PRIVATE?"
It's often useful to define private methods, that is, instance methods
intended to be called only by other methods of the same object.
.PP
Snit doesn't implement any access control on instance methods, so all
methods are \fIde facto\fR public.  Conventionally, though, the
names of public methods begin with a lower-case letter, and the names
of private methods begin with an upper-case letter.
.PP
For example, suppose our simulated dogs only bark in response to other
stimuli; they never bark just for fun.  So the \fBbark\fR method
becomes \fBBark\fR to indicate that it is private:
.PP
.CS

% snit::type dog {
    # Private by convention: begins with uppercase letter.
    method Bark {} {
        return "$self barks."
    }

    method chase {thing} {
        return "$self chases $thing. [$self Bark]"
    }
}
::dog
% dog fido
::fido
% fido chase cat
::fido chases cat. ::fido barks.
%

.CE
.PP
.SS "ARE THERE ANY LIMITATIONS ON INSTANCE METHOD ARGUMENTS?"
Method argument lists are defined just like normal Tcl \fBproc\fR argument
lists; in particular, they can include arguments with default values
and the \fBargs\fR argument.
.PP
However, every method also has a number of implicit arguments
provided by Snit in addition to those explicitly defined.  The names
of these implicit arguments may not used to name explicit arguments.
.SS "WHAT IMPLICIT ARGUMENTS ARE PASSED TO EACH INSTANCE METHOD?"
The arguments implicitly passed to every method are \fBtype\fR,
\fBselfns\fR, \fBwin\fR, and \fBself\fR.
.SS "WHAT IS $TYPE?"
The implicit argument \fBtype\fR contains the fully qualified name of
the object's type:
.PP
.CS

% snit::type thing {
    method mytype {} {
        return $type
    }
}
::thing
% thing something
::something
% something mytype
::thing
%

.CE
.PP
.SS "WHAT IS $SELF?"
The implicit argument \fBself\fR contains the object's fully
qualified name.
.PP
If the object's command is renamed, then \fB$self\fR will change to
match in subsequent calls.  Thus, your code should not assume that
\fB$self\fR is constant unless you know for sure that the object
will never be renamed.
.PP
.CS

% snit::type thing {
    method myself {} {
        return $self
    }
}
::thing
% thing mutt
::mutt
% mutt myself
::mutt
% rename mutt jeff
% jeff myself
::jeff
%

.CE
.PP
.SS "WHAT IS $SELFNS?"
Each Snit object has a private namespace in which to store its
\fBINSTANCE VARIABLES\fR and \fBOPTIONS\fR.  The implicit argument
\fBselfns\fR contains the name of this namespace; its value never changes, and
is constant for the life of the object, even if the object's name
changes:
.PP
.CS

% snit::type thing {
    method myNameSpace {} {
        return $selfns
    }
}
::thing
% thing jeff
::jeff
% jeff myNameSpace
::thing::Snit_inst3
% rename jeff mutt
% mutt myNameSpace
::thing::Snit_inst3
%

.CE
.PP
The above example reveals how Snit names an instance's private
namespace; however, you should not write code that depends on the
specific naming convention, as it might change in future releases.
.SS "WHAT IS $WIN?"
The implicit argument \fBwin\fR is defined for all Snit methods,
though it really makes sense only for those of
\fBWIDGETS\fR and \fBWIDGET ADAPTORS\fR.  \fB$win\fR is simply
the original name of the object, whether it's been renamed or not.
For widgets and widgetadaptors, it is also therefore the name of a Tk
window.
.PP
When a \fBsnit::widgetadaptor\fR is used to modify the interface of a
widget or megawidget, it must rename the widget's original command and
replace it with its own.
.PP
Thus, using \fBwin\fR whenever the Tk window name is called for
means that a \fBsnit::widget\fR or \fBsnit::widgetadaptor\fR can be
adapted by a \fBsnit::widgetadaptor\fR.  See \fBWIDGETS\fR for
more information.
.SS "HOW DO I PASS AN INSTANCE METHOD AS A CALLBACK?"
It depends on the context.
.PP
Suppose in my application I have a \fBdog\fR object named \fBfido\fR,
and I want \fBfido\fR to bark when a Tk button called \fB.bark\fR is
pressed.  In this case, I create the callback command in the usual
way, using \fBlist\fR:
.PP
.CS

    button .bark -text "Bark!" -command [list fido bark]

.CE
.PP
In typical Tcl style, we use a callback to hook two independent
components together.  But suppose that the \fBdog\fR object has
a graphical interface and owns the button itself?  In this case,
the \fBdog\fR must pass one of its own instance methods to the
button it owns.  The obvious thing to do is this:
.PP
.CS

% snit::widget dog {
    constructor {args} {
        #...
        button $win.barkbtn -text "Bark!" -command [list $self bark]
        #...
    }
}
::dog
%

.CE
.PP
(Note that in this example, our \fBdog\fR
becomes a \fBsnit::widget\fR, because it has GUI behavior.  See
\fBWIDGETS\fR for more.)  Thus, if we create a \fBdog\fR called \fB.spot\fR, it will create a Tk button called \fB.spot.barkbtn\fR;
when pressed, the button will call \fB$self bark\fR.
.PP
Now, this will work--provided that \fB.spot\fR is never renamed to
something else.  But surely renaming widgets is
abnormal?  And so it is--unless \fB.spot\fR is the hull component of a
\fBsnit::widgetadaptor\fR.  If it is, then it will be renamed, and \fB.spot\fR will become the name of the \fBsnit::widgetadaptor\fR
object.  When the button is pressed, the command \fB$self bark\fR
will be handled by the \fBsnit::widgetadaptor\fR, which might or might
not do the right thing.
.PP
There's a safer way to do it, and it looks like this:
.PP
.CS

% snit::widget dog {
    constructor {args} {
        #...
        button $win.barkbtn -text "Bark!" -command [mymethod bark]
        #...
    }
}
::dog
%

.CE
.PP
The command \fBmymethod\fR takes any number of arguments, and can be
used like \fBlist\fR to build up a callback command; the only
difference is that \fBmymethod\fR returns a
form of the command that won't change even if the instance's name
changes.
.PP
On the other hand, you might prefer to allow a widgetadaptor to
override a method such that your renamed widget will call the
widgetadaptor's method instead of its own.  In this case,
using \fB[list $self bark]\fR will do what you want...but
this is a technique which should be used only in carefully controlled
circumstances.
.SS "HOW DO I DELEGATE INSTANCE METHODS TO A COMPONENT?"
See \fBDELEGATION\fR.
.SH "INSTANCE VARIABLES"
.SS "WHAT IS AN INSTANCE VARIABLE?"
An instance variable is a private variable associated with some
particular Snit object.  Instance variables can be scalars or arrays.
.SS "HOW IS A SCALAR INSTANCE VARIABLE DEFINED?"
Scalar instance variables are defined in the type definition using the
\fBvariable\fR statement.  You can simply name it, or you can
initialize it with a value:
.PP
.CS

snit::type mytype {
    # Define variable "greeting" and initialize it with "Howdy!"
    variable greeting "Howdy!"
}

.CE
.PP
.SS "HOW IS AN ARRAY INSTANCE VARIABLE DEFINED?"
Array instance variables are also defined in the type definition
using the \fBvariable\fR command.  You can initialize them at the same
time by specifying the \fB-array\fR option:
.PP
.CS

snit::type mytype {
    # Define array variable "greetings"
    variable greetings -array {
        formal "Good Evening"
        casual "Howdy!"
    }
}

.CE
.PP
.SS "WHAT HAPPENS IF I DON'T INITIALIZE AN INSTANCE VARIABLE?"
Variables do not really exist until they are given values.  If you
do not initialize a variable when you define it, then you must be
sure to assign a value to it (in the constructor, say, or in some
method) before you reference it.
.SS "ARE THERE ANY LIMITATIONS ON INSTANCE VARIABLE NAMES?"
Just a few.
.PP
First, every Snit object has a built-in instance variable called
\fBoptions\fR, which should never be redefined.
.PP
Second, all names beginning with "Snit_" are reserved for
use by Snit internal code.
.PP
Third, instance variable names containing the namespace delimiter
(\fB::\fR) are likely to cause great confusion.
.SS "DO I NEED TO DECLARE MY INSTANCE VARIABLES IN MY METHODS?"
No. Once you've defined an instance variable in the type definition,
it can be used in any instance code (instance methods, the
constructor, and the destructor) without declaration.  This differs
from normal Tcl practice, in which all non-local variables in a proc
need to be declared.
.PP
There is a speed penalty to having all instance variables implicitly
available in all instance code.  Even though your code need not
declare the variables explicitly, Snit must still declare them,
and that takes time.  If you have ten instance variables, a method
that uses none of them must still pay the declaration penalty for
all ten.  In most cases, the additional runtime cost is negligible.
If extreme cases, you might wish to avoid it; there are two methods
for doing so.
.PP
The first is to define a single instance variable, an array, and store
all of your instance data in the array.  This way, you're only paying
the declaration penalty for one variable--and you probably need the
variable most of the time anyway.  This method breaks down if your
instance variables include multiple arrays; in Tcl 8.5, however,
the \fBdict\fR command might come to your rescue.
.PP
The second method is to declare your instance variables explicitly
in your instance code, while \fInot\fR including them in the type
definition:
.CS

snit::type dog {
    constructor {} {
        variable mood

        set mood happy
    }

    method setmood {newMood} {
        variable mood

        set mood $newMood
    }

    method getmood {} {
        variable mood

        return $mood
    }
}

.CE
This allows you to ensure that only the required variables are
included in each method, at the cost of longer code and run-time
errors when you forget to declare a variable you need.
.SS "HOW DO I PASS AN INSTANCE VARIABLE'S NAME TO ANOTHER OBJECT?"
In Tk, it's common to pass a widget a variable name; for example, Tk
label widgets have a \fB-textvariable\fR option which names the
variable which will contain the widget's text.  This allows the
program to update the label's value just by assigning a new value to
the variable.
.PP
If you naively pass the instance variable name to the label widget,
you'll be confused by the result; Tk will assume that the name names a
global variable.  Instead, you need to provide a fully-qualified
variable name.  From within an instance method or a constructor, you
can fully qualify the variable's name using the \fBmyvar\fR command:
.PP
.CS

snit::widget mywidget {
    variable labeltext ""

    constructor {args} {
        # ...

        label $win.label -textvariable [myvar labeltext]

        # ...
    }
}

.CE
.PP
.SS "HOW DO I MAKE AN INSTANCE VARIABLE PUBLIC?"
Practically speaking, you don't.  Instead, you'll implement public
variables as \fBOPTIONS\fR.
Alternatively, you can write \fBINSTANCE METHODS\fR to set and get
the variable's value.
.SH OPTIONS
.SS "WHAT IS AN OPTION?"
A type's options are the equivalent of what other object-oriented
languages would call public member variables or properties: they are
data values which can be retrieved and (usually) set by the clients of
an object.
.PP
Snit's implementation of options follows the Tk model fairly exactly,
except that \fBsnit::type\fR objects usually don't interact with
\fBTHE TK OPTION DATABASE\fR; \fBsnit::widget\fR and
\fBsnit::widgetadaptor\fR objects, on the other hand, always do.
.SS "HOW DO I DEFINE AN OPTION?"
Options are defined in the type definition using the \fBoption\fR
statement.  Consider the following type, to be used in an application
that manages a list of dogs for a pet store:
.PP
.CS

snit::type dog {
    option -breed -default mongrel
    option -color -default brown
    option -akc   -default 0
    option -shots -default 0
}

.CE
.PP
According to this, a dog has four notable properties: a
breed, a color, a flag that says whether it's pedigreed with the
American Kennel Club, and another flag that says whether it has had
its shots.  The default dog, evidently, is a brown mutt.
.PP
There are a number of options you can specify when defining an option;
if \fB-default\fR is the only one, you can omit the word
\fB-default\fR as follows:
.PP
.CS

snit::type dog {
    option -breed mongrel
    option -color brown
    option -akc   0
    option -shots 0
}

.CE
.PP
If no \fB-default\fR value is specified, the option's default value
will be the empty string (but see \fBTHE TK OPTION DATABASE\fR).
.PP
The Snit man page refers to options like these as "locally defined" options.
.SS "HOW CAN A CLIENT SET OPTIONS AT OBJECT CREATION?"
The normal convention is that the client may pass any number of
options and their values after the object's name at object creation.
For example, the \fB::dog\fR command defined in the previous answer can now
be used to create individual dogs.  Any or all of the options may be
set at creation time.
.PP
.CS

% dog spot -breed beagle -color "mottled" -akc 1 -shots 1
::spot
% dog fido -shots 1
::fido
%

.CE
.PP
So \fB::spot\fR is a pedigreed beagle; \fB::fido\fR is a typical mutt,
but his owners evidently take care of him, because he's had his shots.
.PP
\fINote:\fR If the type defines a constructor, it can specify a
different object-creation syntax.  See \fBCONSTRUCTORS\fR for more
information.
.SS "HOW CAN A CLIENT RETRIEVE AN OPTION'S VALUE?"
Retrieve option values using the \fBcget\fR method:
.PP
.CS

% spot cget -color
mottled
% fido cget -breed
mongrel
%

.CE
.PP
.SS "HOW CAN A CLIENT SET OPTIONS AFTER OBJECT CREATION?"
Any number of options may be set at one time using the
\fBconfigure\fR instance method.  Suppose that closer inspection
shows that ::fido is not a brown mongrel, but rather a rare Arctic Boar
Hound of a lovely dun color:
.PP
.CS

% fido configure -color dun -breed "Arctic Boar Hound"
% fido cget -color
dun
% fido cget -breed
Arctic Boar Hound

.CE
.PP
Alternatively, the \fBconfigurelist\fR method takes a list of
options and values; occasionally this is more convenient:
.PP
.CS

% set features [list -color dun -breed "Arctic Boar Hound"]
-color dun -breed {Arctic Boar Hound}
% fido configurelist $features
% fido cget -color
dun
% fido cget -breed
Arctic Boar Hound
%

.CE
.PP
In Tcl 8.5, the \fB*\fR keyword can be used with
\fBconfigure\fR in this case:
.PP
.CS

% set features [list -color dun -breed "Arctic Boar Hound"]
-color dun -breed {Arctic Boar Hound}
% fido configure {*}$features
% fido cget -color
dun
% fido cget -breed
Arctic Boar Hound
%

.CE
.PP
The results are the same.
.SS "HOW SHOULD AN INSTANCE METHOD ACCESS AN OPTION VALUE?"
There are two ways an instance method can set and retrieve an option's
value.  One is to use the \fBconfigure\fR and \fBcget\fR
methods, as shown below.
.PP
.CS

% snit::type dog {
    option -weight 10

    method gainWeight {} {
        set wt [$self cget -weight]
        incr wt
        $self configure -weight $wt
    }
}
::dog
% dog fido
::fido
% fido cget -weight
10
% fido gainWeight
% fido cget -weight
11
%

.CE
.PP
Alternatively, Snit provides a built-in array instance variable called
\fBoptions\fR.  The indices are the option names; the values are the
option values.  The method \fBgainWeight\fR can thus be rewritten as
follows:
.PP
.CS


    method gainWeight {} {
        incr options(-weight)
    }

.CE
.PP
As you can see, using the \fBoptions\fR variable involves considerably
less typing and is the usual way to do it.  But if you use
\fB-configuremethod\fR or \fB-cgetmethod\fR (described in the following
answers), you might wish to use the \fBconfigure\fR and
\fBcget\fR methods anyway, just so that any special processing you've
implemented is sure to get done.  Also, if the option is delegated to
a component then \fBconfigure\fR and \fBcget\fR are the only way
to access it without accessing the component directly.  See
\fBDELEGATION\fR for more information.
.SS "HOW CAN I MAKE AN OPTION READ-ONLY?"
Define the option with \fB-readonly yes\fR.
.PP
Suppose you've got an option that determines how
instances of your type are constructed; it must be set at creation
time, after which it's constant.  For example, a dog never changes its
breed; it might or might not have had its shots, and if not can have
them at a later time.  \fB-breed\fR should be read-only, but
\fB-shots\fR should not be.
.PP
.CS

% snit::type dog {
    option -breed -default mongrel -readonly yes
    option -shots -default no
}
::dog
% dog fido -breed retriever
::fido
% fido configure -shots yes
% fido configure -breed terrier
option -breed can only be set at instance creation
%

.CE
.PP
.SS "HOW CAN I CATCH ACCESSES TO AN OPTION'S VALUE?"
Define a \fB-cgetmethod\fR for the option.
.SS "WHAT IS A -CGETMETHOD?"
A \fB-cgetmethod\fR is a method that's called whenever the related
option's value is queried via the
\fBcget\fR instance method.  The handler can compute the option's
value, retrieve it from a database, or do anything else you'd like it to do.
.PP
Here's what the default behavior would look like if
written using a \fB-cgetmethod\fR:
.PP
.CS

snit::type dog {
    option -color -default brown -cgetmethod GetOption

    method GetOption {option} {
        return $options($option)
    }
}

.CE
.PP
Any instance method can be used, provided that it takes one argument,
the name of the option whose value is to be retrieved.
.SS "HOW CAN I CATCH CHANGES TO AN OPTION'S VALUE?"
Define a \fB-configuremethod\fR for the option.
.SS "WHAT IS A -CONFIGUREMETHOD?"
A \fB-configuremethod\fR is a method that's called whenever the
related option is given a new value via the \fBconfigure\fR or
\fBconfigurelist\fR instance methods. The method can
pass the value on to some other object, store it in a database, or do
anything else you'd like it to do.
.PP
Here's what the default configuration behavior would look like if
written using a \fB-configuremethod\fR:
.PP
.CS

snit::type dog {
    option -color -default brown -configuremethod SetOption

    method SetOption {option value} {
        set options($option) $value
    }
}

.CE
.PP
Any instance method can be used, provided that it takes two arguments,
the name of the option and the new value.
.PP
Note that if your method doesn't store the value in the \fBoptions\fR
array, the \fBoptions\fR array won't get updated.
.SS "HOW CAN I VALIDATE AN OPTION'S VALUE?"
Define a \fB-validatemethod\fR.
.SS "WHAT IS A -VALIDATEMETHOD?"
A \fB-validatemethod\fR is a method that's called whenever the
related option is given a new value via the \fBconfigure\fR or
\fBconfigurelist\fR instance methods.  It's the method's
responsibility to determine whether the new value is valid, and throw
an error if it isn't.  The \fB-validatemethod\fR, if any, is called
before the value is stored in the \fBoptions\fR array; in particular,
it's called before the \fB-configuremethod\fR, if any.
.PP
For example, suppose an option always takes a Boolean value.  You can
ensure that the value is in fact a valid Boolean like this:
.CS

% snit::type dog {
    option -shots -default no -validatemethod BooleanOption

    method BooleanOption {option value} {
        if {![string is boolean -strict $value]} {
            error "expected a boolean value, got \\"$value\\""
        }
    }
}
::dog
% dog fido
% fido configure -shots yes
% fido configure -shots NotABooleanValue
expected a boolean value, got "NotABooleanValue"
%

.CE
Note that the same \fB-validatemethod\fR can be used to validate any number
of boolean options.
.PP
Any method can be a \fB-validatemethod\fR provided that it takes
two arguments, the option name and the new option value.
.SH "TYPE VARIABLES"
.SS "WHAT IS A TYPE VARIABLE?"
A type variable is a private variable associated with a Snit type
rather than with a particular instance of the type.  In C++ and Java,
the term \fIstatic member variable\fR is used for the same notion.
Type variables can be scalars or arrays.
.SS "HOW IS A SCALAR TYPE VARIABLE DEFINED?"
Scalar type variables are defined in the type definition using the
\fBtypevariable\fR statement.  You can simply name it, or you can
initialize it with a value:
.PP
.CS


snit::type mytype {
    # Define variable "greeting" and initialize it with "Howdy!"
    typevariable greeting "Howdy!"
}

.CE
.PP
Every object of type \fBmytype\fR now has access to a single variable
called \fBgreeting\fR.
.SS "HOW IS AN ARRAY-VALUED TYPE VARIABLE DEFINED?"
Array-valued type variables are also defined using the
\fBtypevariable\fR command; to initialize them, include the
\fB-array\fR option:
.PP
.CS

snit::type mytype {
    # Define typearray variable "greetings"
    typevariable greetings -array {
        formal "Good Evening"
        casual "Howdy!"
    }
}

.CE
.PP
.SS "WHAT HAPPENS IF I DON'T INITIALIZE A TYPE VARIABLE?"
Variables do not really exist until they are given values.  If you
do not initialize a variable when you define it, then you must be
sure to assign a value to it (in the type constructor, say)
before you reference it.
.SS "ARE THERE ANY LIMITATIONS ON TYPE VARIABLE NAMES?"
Type variable names have the same restrictions as
the names of \fBINSTANCE VARIABLES\fR do.
.SS "DO I NEED TO DECLARE MY TYPE VARIABLES IN MY METHODS?"
No. Once you've defined a type variable in the type definition, it can
be used in \fBINSTANCE METHODS\fR or \fBTYPE METHODS\fR without
declaration.  This differs from normal Tcl practice, in which all
non-local variables in a proc need to be declared.
.PP
Type variables are subject to the same speed/readability tradeoffs
as instance variables; see
\fBDo I need to declare my instance variables in my methods?\fR
.SS "HOW DO I PASS A TYPE VARIABLE'S NAME TO ANOTHER OBJECT?"
In Tk, it's common to pass a widget a variable name; for example, Tk
label widgets have a \fB-textvariable\fR option which names the
variable which will contain the widget's text.  This allows the
program to update the label's value just by assigning a new value to
the variable.
.PP
If you naively pass a type variable name to the label widget, you'll
be confused by the result; Tk will assume that the name names a global
variable.  Instead, you need to provide a fully-qualified variable
name.  From within an instance method or a constructor, you can fully
qualify the type variable's name using the \fBmytypevar\fR command:
.PP
.CS

snit::widget mywidget {
    typevariable labeltext ""

    constructor {args} {
        # ...

        label $win.label -textvariable [mytypevar labeltext]

        # ...
    }
}

.CE
.PP
.SS "HOW DO I MAKE A TYPE VARIABLE PUBLIC?"
There are two ways to do this.  The preferred way is to write a pair
of \fBTYPE METHODS\fR to set and query the type variable's value.
.PP
Type variables are stored in the type's namespace, which has
the same name as the type itself.  Thus, you can also
publicize the type variable's name in your
documentation so that clients can access it directly.  For example,
.PP
.CS

snit::type mytype {
    typevariable myvariable
}

set ::mytype::myvariable "New Value"

.CE
.PP
.SH "TYPE METHODS"
.SS "WHAT IS A TYPE METHOD?"
A type method is a procedure associated with the type itself rather
than with any specific instance of the type, and called as a
subcommand of the type command.
.SS "HOW DO I DEFINE A TYPE METHOD?"
Type methods are defined in the type definition using the
\fBtypemethod\fR statement:
.PP
.CS

snit::type dog {
    # List of pedigreed dogs
    typevariable pedigreed

    typemethod pedigreedDogs {} {
        return $pedigreed
    }
}

.CE
.PP
Suppose the \fBdog\fR type maintains a list of the names of the dogs
that have pedigrees.  The \fBpedigreedDogs\fR type method returns this
list.
.PP
The \fBtypemethod\fR statement looks just like a normal Tcl
\fBproc\fR, except that it appears in a \fBsnit::type\fR definition.
Notice that every type method gets an implicit argument called
\fBtype\fR, which contains the fully-qualified type name.
.SS "HOW DOES A CLIENT CALL A TYPE METHOD?"
The type method name becomes a subcommand of the type's command.  For
example, assuming that the constructor adds each pedigreed dog to the
list of \fBpedigreedDogs\fR,
.PP
.CS

snit::type dog {
    option -pedigreed 0

    # List of pedigreed dogs
    typevariable pedigreed

    typemethod pedigreedDogs {} {
        return $pedigreed
    }

    # ...
}

dog spot -pedigreed 1
dog fido

foreach dog [dog pedigreedDogs] { ... }

.CE
.PP
.SS "ARE THERE ANY LIMITATIONS ON TYPE METHOD NAMES?"
Not really, so long as you avoid the standard type method names:
\fBcreate\fR, \fBdestroy\fR, and \fBinfo\fR.
.SS "HOW DO I MAKE A TYPE METHOD PRIVATE?"
It's sometimes useful to define private type methods, that is, type
methods intended to be called only by other type or instance methods
of the same object.
.PP
Snit doesn't implement any access control on type methods; by
convention, the names of public methods begin with a lower-case
letter, and the names of private methods begin with an upper-case
letter.
.PP
Alternatively, a Snit \fBproc\fR can be used as a private type method; see
\fBPROCS\fR.
.SS "ARE THERE ANY LIMITATIONS ON TYPE METHOD ARGUMENTS?"
Method argument lists are defined just like normal Tcl proc argument
lists; in particular, they can include arguments with default values
and the \fBargs\fR argument.
.PP
However, every type method is called with an implicit argument called
\fBtype\fR that contains the name of the type command.  In addition,
type methods should by convention avoid using the names of the
arguments implicitly defined for \fBINSTANCE METHODS\fR.
.SS "HOW DOES AN INSTANCE OR TYPE METHOD CALL A TYPE METHOD?"
If an instance or type method needs to call a type method, it should
use \fB$type\fR to do so:
.PP
.CS

snit::type dog {

    typemethod pedigreedDogs {} { ... }

    typemethod printPedigrees {} {
        foreach obj [$type pedigreedDogs] { ... }
    }
}

.CE
.PP
.SS "HOW DO I PASS A TYPE METHOD AS A CALLBACK?"
It's common in Tcl to pass a snippet of code to another object, for it
to call later.  Because types cannot be renamed, you can just
use the type name, or, if the callback is registered from within
a type method, \fBtype\fR.  For example, suppose we want to print a
list of pedigreed dogs when a Tk button is pushed:
.PP
.CS


button .btn -text "Pedigrees" -command [list dog printPedigrees]
pack .btn

.CE
Alternatively, from a method or type method you can use the
\fBmytypemethod\fR command, just as you would use \fBmymethod\fR
to define a callback command for \fBINSTANCE METHODS\fR.
.SS "CAN TYPE METHODS BE HIERARCHICAL?"
Yes, you can define hierarchical type methods in just the same way as
you can define hierarchical instance methods.  See
\fBINSTANCE METHODS\fR for more.
.SH PROCS
.SS "WHAT IS A PROC?"
A Snit \fBproc\fR is really just a Tcl proc defined within the type's
namespace.  You can use procs for private code that isn't related to
any particular instance.
.SS "HOW DO I DEFINE A PROC?"
Procs are defined by including a \fBproc\fR statement in the type
definition:
.PP
.CS

snit::type mytype {
    # Pops and returns the first item from the list stored in the
    # listvar, updating the listvar
   proc pop {listvar} { ... }

   # ...
}

.CE
.PP
.SS "ARE THERE ANY LIMITATIONS ON PROC NAMES?"
Any name can be used, so long as it does not begin with \fBSnit_\fR;
names beginning with \fBSnit_\fR are reserved for Snit's own use.
However, the wise programmer will avoid \fBproc\fR names (\fBset\fR,
\fBlist\fR, \fBif\fR, etc.) that would shadow standard Tcl
command names.
.PP
\fBproc\fR names, being private, should begin with a capital letter according
to convention; however, as there are typically no public \fBproc\fRs
in the type's namespace it doesn't matter much either way.
.SS "HOW DOES A METHOD CALL A PROC?"
Just like it calls any Tcl command.  For example,
.PP
.CS

snit::type mytype {
    # Pops and returns the first item from the list stored in the
    # listvar, updating the listvar
    proc pop {listvar} { ... }

    variable requestQueue {}

    # Get one request from the queue and process it.
    method processRequest {} {
        set req [pop requestQueue]
    }
}

.CE
.PP
.SS "HOW CAN I PASS A PROC TO ANOTHER OBJECT AS A CALLBACK?"
The \fBmyproc\fR command returns a callback command for the
\fBproc\fR, just as \fBmymethod\fR does for a method.
.SH "TYPE CONSTRUCTORS"
.SS "WHAT IS A TYPE CONSTRUCTOR?"
A type constructor is a body of code that initializes the type as a
whole, rather like a C++ static initializer.  The body of a type
constructor is executed once when the type is defined, and never
again.
.PP
A type can have at most one type constructor.
.SS "HOW DO I DEFINE A TYPE CONSTRUCTOR?"
A type constructor is defined by using the \fBtypeconstructor\fR
statement in the type definition.  For example, suppose the type uses
an array-valued type variable as a look-up table, and the values in
the array have to be computed at start-up.
.PP
.CS

% snit::type mytype {
    typevariable lookupTable

    typeconstructor {
        array set lookupTable {key value...}
    }
}

.CE
.PP
.SH CONSTRUCTORS
.SS "WHAT IS A CONSTRUCTOR?"
In object-oriented programming, an object's constructor is responsible
for initializing the object completely at creation time. The constructor
receives the list of options passed to the \fBsnit::type\fR command's
\fBcreate\fR method and can then do whatever it likes.  That might include
computing instance variable values, reading data from files, creating
other objects, updating type and instance variables, and so forth.
.PP
The constructor's return value is ignored (unless it's an
error, of course).
.SS "HOW DO I DEFINE A CONSTRUCTOR?"
A constructor is defined by using the \fBconstructor\fR statement in
the type definition.  Suppose that it's desired to keep a list of all
pedigreed dogs.  The list can be maintained in a
type variable and retrieved by a type method.  Whenever a dog is
created, it can add itself to the list--provided that it's registered
with the American Kennel Club.
.PP
.CS

% snit::type dog {
    option -akc 0

    typevariable akcList {}

    constructor {args} {
        $self configurelist $args

        if {$options(-akc)} {
            lappend akcList $self
        }
    }

    typemethod akclist {} {
        return $akcList
    }
}
::dog
% dog spot -akc 1
::spot
% dog fido
::fido
% dog akclist
::spot
%

.CE
.PP
.SS "WHAT DOES THE DEFAULT CONSTRUCTOR DO?"
If you don't provide a constructor explicitly, you get the default
constructor, which is identical to the explicitly-defined
constructor shown here:
.PP
.CS

snit::type dog {
    constructor {args} {
        $self configurelist $args
    }
}

.CE
.PP
When the constructor is called, \fBargs\fR will be set to the list of
arguments that follow the object's name.  The constructor is allowed
to interpret this list any way it chooses; the normal convention is
to assume that it's a list of option names and values, as shown in the
example above.  If you simply want to save the option values, you
should use the \fBconfigurelist\fR method, as shown.
.SS "CAN I CHOOSE A DIFFERENT SET OF ARGUMENTS FOR THE CONSTRUCTOR?"
Yes, you can.  For example, suppose we wanted to be sure that the
breed was explicitly stated for every dog at creation time, and
couldn't be changed thereafter.  One way to do that is as follows:
.PP
.CS

% snit::type dog {
    variable breed

    option -color brown
    option -akc 0

    constructor {theBreed args} {
        set breed $theBreed
        $self configurelist $args
    }

    method breed {} { return $breed }
}
::dog
% dog spot dalmatian -color spotted -akc 1
::spot
% spot breed
dalmatian

.CE
.PP
The drawback is that this syntax is non-standard, and may
limit the compatibility of your new type with other people's code.
For example, Snit assumes that it can create
\fBCOMPONENTS\fR using the standard creation syntax.
.SS "ARE THERE ANY LIMITATIONS ON CONSTRUCTOR ARGUMENTS?"
Constructor argument lists are subject to the same limitations
as those on instance method argument lists.  It has the
same implicit arguments, and can contain default values and the
\fBargs\fR argument.
.SS "IS THERE ANYTHING SPECIAL ABOUT WRITING THE CONSTRUCTOR?"
Yes.  Writing the constructor can be tricky if you're delegating
options to components, and there are specific issues relating to
\fBsnit::widget\fRs and \fBsnit::widgetadaptor\fRs.  See
\fBDELEGATION\fR, \fBWIDGETS\fR,
\fBWIDGET ADAPTORS\fR, and \fBTHE TK OPTION DATABASE\fR.
.SH DESTRUCTORS
.SS "WHAT IS A DESTRUCTOR?"
A destructor is a special kind of method that's called when an object
is destroyed.  It's responsible for doing any necessary clean-up when
the object goes away: destroying \fBCOMPONENTS\fR, closing files,
and so forth.
.SS "HOW DO I DEFINE A DESTRUCTOR?"
Destructors are defined by using the \fBdestructor\fR statement in the
type definition.
.PP
Suppose we're maintaining a list of pedigreed dogs;
then we'll want to remove dogs from it when they are destroyed.
.PP
.CS

snit::type dog {
    option -akc 0

    typevariable akcList {}

    constructor {args} {
        $self configurelist $args

        if {$options(-akc)} {
            lappend akcList $self
        }
    }

    destructor {
        set ndx [lsearch $akcList $self]

        if {$ndx != -1} {
            set akcList [lreplace $akcList $ndx $ndx]
        }
    }

    typemethod akclist {} {
        return $akcList
    }
}

.CE
.PP
.SS "ARE THERE ANY LIMITATIONS ON DESTRUCTOR ARGUMENTS?"
Yes; a destructor has no explicit arguments.
.SS "WHAT IMPLICIT ARGUMENTS ARE PASSED TO THE DESTRUCTOR?"
The destructor gets the same implicit arguments that are passed to
\fBINSTANCE METHODS\fR: \fBtype\fR, \fBselfns\fR, \fBwin\fR, and
\fBself\fR.
.SS "MUST COMPONENTS BE DESTROYED EXPLICITLY?"
Yes and no.
.PP
Any Tk widgets created by a \fBsnit::widget\fR or
\fBsnit::widgetadaptor\fR will be destroyed automatically by Tk
when the megawidget is destroyed, in keeping with normal Tk behavior
(destroying a parent widget destroys the whole tree).
.PP
Components of normal \fBsnit::types\fR, on the other hand,
are never destroyed automatically, nor are non-widget components
of Snit megawidgets.  If your object creates them in its
constructor, then it should generally destroy them in its destructor.
.SS "IS THERE ANY SPECIAL ABOUT WRITING A DESTRUCTOR?"
Yes.  If an object's constructor throws an error, the object's
destructor will be called to clean up; this means that the object
might not be completely constructed when the destructor is called.
This can cause the destructor to throw its own error; the result
is usually misleading, confusing, and unhelpful.  Consequently, it's
important to write your destructor so that it's fail-safe.
.PP
For example, a \fBdog\fR might create a \fBtail\fR component; the
component will need to be destroyed.  But suppose there's an error
while processing the creation options--the destructor will be called,
and there will be no \fBtail\fR to destroy.  The simplest solution is
generally to catch and ignore any errors while destroying components.
.CS

snit::type dog {
    component tail

    constructor {args} {
        $self configurelist $args

        set tail [tail %AUTO%]
    }

    destructor {
        catch {$tail destroy}
    }
}

.CE
.SH COMPONENTS
.SS "WHAT IS A COMPONENT?"
Often an object will create and manage a number of other objects.  A
Snit megawidget, for example, will often create a number of Tk
widgets.  These objects are part of the main object; it is composed
of them, so they are called components of the object.
.PP
But Snit also has a more precise meaning for
\fBCOMPONENT\fR.  The components of a Snit object are those
objects to which methods or options can be delegated.
(See \fBDELEGATION\fR for more information about delegation.)
.SS "HOW DO I DECLARE A COMPONENT?"
First, you must decide what role a component plays within your object,
and give the role a name.  Then, you declare the component using its
role name and the \fBcomponent\fR statement.  The \fBcomponent\fR
statement declares an \fIinstance variable\fR which is used to
store the component's command name when the component is created.
.PP
For example, suppose your \fBdog\fR object
creates a \fBtail\fR object (the better to wag with, no doubt):
.PP
.CS

snit::type dog {
    component mytail

    constructor {args} {
        # Create and save the component's command
        set mytail [tail %AUTO% -partof $self]
        $self configurelist $args
    }

    method wag {} {
        $mytail wag
    }
}

.CE
.PP
As shown here, it doesn't matter what the \fBtail\fR object's real
name is; the \fBdog\fR object refers to it by its component name.
.PP
The above example shows one way to delegate the \fBwag\fR method to
the \fBmytail\fR component; see \fBDELEGATION\fR for an easier way.
.SS "HOW IS A COMPONENT NAMED?"
A component has two names.  The first name is that of the component
variable; this represents the role the component object plays within
the Snit object.  This is the component name proper, and is the name
used to refer to the component within Snit code.  The second name is
the name of the actual component object created by the Snit object's
constructor.  This second name is always a Tcl command name, and is
referred to as the component's object name.
.PP
In the example in the previous question, the component name is
\fBmytail\fR; the \fBmytail\fR component's object name is chosen
automatically by Snit since \fB%AUTO%\fR was used when the component
object was created.
.SS "ARE THERE ANY LIMITATIONS ON COMPONENT NAMES?"
Yes.  \fBsnit::widget\fR and \fBsnit::widgetadaptor\fR objects have a special
component called the \fBhull\fR component; thus, the name \fBhull\fR
should be used for no other purpose.
.PP
Otherwise, since component names are in fact instance variable names
they must follow the rules for \fBINSTANCE VARIABLES\fR.
.SS "WHAT IS AN OWNED COMPONENT?"
An \fIowned\fR component is a component whose object command's
lifetime is controlled by the \fBsnit::type\fR or \fBsnit::widget\fR.
.PP
As stated above, a component is an object to
which our object can delegate methods or options.  Under this
definition, our object will usually create its component objects,
but not necessarily.  Consider the following: a dog object has a tail
component; but tail knows that it's part of the dog:
.CS

snit::type dog {
    component mytail

    constructor {args} {
        set mytail [tail %AUTO% -partof $self]
        $self configurelist $args
    }

    destructor {
        catch {$mytail destroy}
    }

    delegate method wagtail to mytail as wag

    method bark {} {
        return "$self barked."
    }
}

 snit::type tail {
     component mydog
     option -partof -readonly yes

     constructor {args} {
         $self configurelist $args
         set mydog $options(-partof)
     }

     method wag {} {
         return "Wag, wag."
     }

     method pull {} {
         $mydog bark
     }
 }

.CE
Thus, if you ask a dog to wag its tail, it tells its tail to wag;
and if you pull the dog's tail, the tail tells the dog to bark.  In
this scenario, the tail is a component of the dog, and the dog is a
component of the tail, but the dog owns the tail and not the other way
around.
.SS "WHAT DOES THE INSTALL COMMAND DO?"
The \fBinstall\fR command creates an owned component using a specified
command, and assigns the result to the component's instance variable.
For example:
.CS

snit::type dog {
    component mytail

    constructor {args} {
        # set mytail [tail %AUTO% -partof $self]
        install mytail using tail %AUTO% -partof $self
        $self configurelist $args
    }
}

.CE
In a \fBsnit::type\fR's code, the \fBinstall\fR
command shown above is equivalent to the \fBset mytail\fR command
that's commented out.  In a \fBsnit::widget\fR's or
\fBsnit::widgetadaptor\fR's, code, however, the
\fBinstall\fR command also queries \fBTHE TK OPTION DATABASE\fR
and initializes the new component's options accordingly.  For consistency,
it's a good idea to get in the habit of using \fBinstall\fR for all
owned components.
.SS "MUST OWNED COMPONENTS BE CREATED IN THE CONSTRUCTOR?"
No, not necessarily.  In fact, there's no reason why an
object can't destroy and recreate a component multiple times over
its own lifetime.
.SS "ARE THERE ANY LIMITATIONS ON COMPONENT OBJECT NAMES?"
Yes.
.PP
Component objects which are Tk widgets or megawidgets must have valid
Tk window names.
.PP
Component objects which are not widgets or megawidgets must have
fully-qualified command names, i.e., names which include the full
namespace of the command.  Note that Snit always creates objects with
fully qualified names.
.PP
Next, the object names of components and owned by your object
must be unique.  This is no problem for widget components, since
widget names are always unique; but consider the following code:
.PP
.CS

snit::type tail { ... }

snit::type dog {
    delegate method wag to mytail

    constructor {} {
        install mytail using tail mytail
    }
}

.CE
.PP
This code uses the component name, \fBmytail\fR, as the component object
name.  This is not good, and here's why: Snit instance code executes
in the Snit type's namespace.  In this case, the \fBmytail\fR component is
created in the \fB::dog::\fR namespace, and will thus have the name
\fB::dog::mytail\fR.
.PP
Now, suppose you create two dogs.  Both dogs will attempt to
create a tail called \fB::dog::mytail\fR.  The first will succeed,
and the second will fail, since Snit won't let you create an object if
its name is already a command.  Here are two ways to avoid this situation:
.PP
First, if the component type is a \fBsnit::type\fR you can
specify \fB%AUTO%\fR as its name, and be guaranteed to get a unique name.
This is the safest thing to do:
.PP
.CS


    install mytail using tail %AUTO%

.CE
.PP
If the component type isn't a \fBsnit::type\fR you can create
the component in the object's instance namespace:
.PP
.CS


    install mytail using tail ${selfns}::mytail

.CE
.PP
Make sure you pick a unique name within the instance namespace.
.SS "MUST I DESTROY THE COMPONENTS I OWN?"
That depends.  When a parent widget is destroyed, all child widgets
are destroyed automatically. Thus, if your object is a \fBsnit::widget\fR
or \fBsnit::widgetadaptor\fR you don't need to destroy any components
that are widgets, because they will generally be children or
descendants of your megawidget.
.PP
If your object is an instance of \fBsnit::type\fR, though, none of its
owned components will be destroyed automatically, nor will be
non-widget components of a \fBsnit::widget\fR be destroyed
automatically.  All such owned components must be destroyed
explicitly, or they won't be destroyed at all.
.SS "CAN I EXPOSE A COMPONENT'S OBJECT COMMAND AS PART OF MY INTERFACE?"
Yes, and there are two ways to do it.  The most appropriate way is
usually to use \fBDELEGATION\fR.  Delegation allows you to pass
the options and methods you specify along to particular components.
This effectively hides the components from the users of your type, and
ensures good encapsulation.
.PP
However, there are times when it's appropriate, not to mention
simpler, just to make the entire component part of your type's public
interface.
.SS "HOW DO I EXPOSE A COMPONENT'S OBJECT COMMAND?"
When you declare the component, specify the \fBcomponent\fR
statement's \fB-public\fR option.  The value of this option is the
name of a method which will be delegated to your component's object
command.
.PP
For example, supposed you've written a combobox megawidget which owns
a listbox widget, and you want to make the listbox's entire interface
public.  You can do it like this:
.PP
.CS

snit::widget combobox {
     component listbox -public listbox

     constructor {args} {
         install listbox using listbox $win.listbox ....
     }
}

combobox .mycombo
.mycombo listbox configure -width 30

.CE
.PP
Your comobox widget, \fB.mycombo\fR, now has a \fBlistbox\fR method
which has all of the same subcommands as the listbox widget itself.
Thus, the above code sets the listbox component's width to 30.
.PP
Usually you'll let the method name be the same as the component name;
however, you can name it anything you like.
.SH "TYPE COMPONENTS"
.SS "WHAT IS A TYPE COMPONENT?"
A type component is a component that belongs to the type itself
instead of to a particular instance of the type.  The relationship
between components and type components is the same as the
relationship between \fBINSTANCE VARIABLES\fR and
\fBTYPE VARIABLES\fR.  Both \fBINSTANCE METHODS\fR and
\fBTYPE METHODS\fR can be delegated to type components.
.PP
Once you understand \fBCOMPONENTS\fR and
\fBDELEGATION\fR, type components are just more of the same.
.SS "HOW DO I DECLARE A TYPE COMPONENT?"
Declare a type component using the \fBtypecomponent\fR statement.  It
takes the same options (\fB-inherit\fR and \fB-public\fR) as the
\fBcomponent\fR statement does, and defines a type variable to hold
the type component's object command.
.PP
Suppose in your model you've got many dogs, but only one
veterinarian.  You might make the veterinarian a type component.
.CS

snit::type veterinarian { ... }

snit::type dog {
    typecomponent vet

    # ...
}

.CE
.SS "HOW DO I INSTALL A TYPE COMPONENT?"
Just use the \fBset\fR command to assign the component's object
command to the type component.  Because types
(even \fBsnit::widget\fR types) are not widgets, and do not have
options anyway, the extra features of the \fBinstall\fR command are
not needed.
.PP
You'll usually install type components in the type constructor, as
shown here:
.CS

snit::type veterinarian { ... }

snit::type dog {
    typecomponent vet

    typeconstructor {
        set vet [veterinarian %AUTO%]
    }
}

.CE
.SS "ARE THERE ANY LIMITATIONS ON TYPE COMPONENT NAMES?"
Yes, the same as on \fBINSTANCE VARIABLES\fR,
\fBTYPE VARIABLES\fR, and normal \fBCOMPONENTS\fR.
.SH DELEGATION
.SS "WHAT IS DELEGATION?"
Delegation, simply put, is when you pass a task you've been given to
one of your assistants.  (You do have assistants, don't you?)  Snit
objects can do the same thing.  The following example shows one way in
which the \fBdog\fR object can delegate its \fBwag\fR method and its
\fB-taillength\fR option to its \fBtail\fR component.
.PP
.CS

snit::type dog {
    variable mytail

    option -taillength -configuremethod SetTailOption -cgetmethod GetTailOption


    method SetTailOption {option value} {
         $mytail configure $option $value
    }

    method GetTailOption {option} {
         $mytail cget $option
    }

    method wag {} {
        $mytail wag
    }

    constructor {args} {
        install mytail using tail %AUTO% -partof $self
        $self configurelist $args
    }

}

.CE
.PP
This is the hard way to do it, by it demonstrates what delegation is
all about.  See the following answers for the easy way to do it.
.PP
Note that the constructor calls the \fBconfigurelist\fR method
\fBafter\fR it creates its \fBtail\fR; otherwise,
if \fB-taillength\fR appeared in the list of \fBargs\fR we'd get an
error.
.SS "HOW CAN I DELEGATE A METHOD TO A COMPONENT OBJECT?"
Delegation occurs frequently enough that Snit makes it easy. Any
method can be delegated to any component or type component
by placing a single \fBdelegate\fR statement in the type definition.
(See \fBCOMPONENTS\fR and \fBTYPE COMPONENTS\fR
for more information about component names.)
.PP
For example, here's a much better way to delegate the \fBdog\fR
object's \fBwag\fR method:
.PP
.CS

% snit::type dog {
    delegate method wag to mytail

    constructor {} {
        install mytail using tail %AUTO%
    }
}
::dog
% snit::type tail {
    method wag {} { return "Wag, wag, wag."}
}
::tail
% dog spot
::spot
% spot wag
Wag, wag, wag.

.CE
.PP
This code has the same effect as the code shown under the previous
question: when a \fBdog\fR's \fBwag\fR method is called, the call and
its arguments are passed along automatically to the \fBtail\fR object.
.PP
Note that when a component is mentioned in a \fBdelegate\fR statement,
the component's instance variable is defined implicitly.  However,
it's still good practice to declare it explicitly using the
\fBcomponent\fR statement.
.PP
Note also that you can define a method name using the \fBmethod\fR
statement, or you can define it using \fBdelegate\fR; you can't do
both.
.SS "CAN I DELEGATE TO A METHOD WITH A DIFFERENT NAME?"
Suppose you wanted to delegate the \fBdog\fR's \fBwagtail\fR method to
the \fBtail\fR's \fBwag\fR method.  After all you wag the tail, not
the dog.  It's easily done:
.PP
.CS

snit::type dog {
    delegate method wagtail to mytail as wag

    constructor {args} {
        install mytail using tail %AUTO% -partof $self
        $self configurelist $args
    }
}

.CE
.PP
.SS "CAN I DELEGATE TO A METHOD WITH ADDITIONAL ARGUMENTS?"
Suppose the \fBtail\fR's \fBwag\fR method takes as an argument the
number of times the tail should be wagged.  You want to delegate the
\fBdog\fR's \fBwagtail\fR method to the \fBtail\fR's \fBwag\fR
method, specifying that the tail should be wagged exactly three times.
This is easily done, too:
.PP
.CS

snit::type dog {
    delegate method wagtail to mytail as {wag 3}
    # ...
}

snit::type tail {
    method wag {count} {
        return [string repeat "Wag " $count]
    }
    # ...
}

.CE
.PP
.SS "CAN I DELEGATE A METHOD TO SOMETHING OTHER THAN AN OBJECT?"
Normal method delegation assumes that you're delegating a method (a
subcommand of an object command) to a method of another object (a
subcommand of a different object command).  But not all Tcl objects
follow Tk conventions, and not everything you'd to which you'd like
to delegate a method is necessary an object.  Consequently, Snit makes
it easy to delegate a method to pretty much anything you like using
the \fBdelegate\fR statement's \fBusing\fR clause.
.PP
Suppose your dog simulation stores dogs in a database, each dog as a
single record.  The database API you're using provides a number of
commands to manage records; each takes the record ID (a string you
choose) as its first argument.  For example, \fBsaverec\fR
saves a record.  If you let the record ID be the name of the dog
object, you can delegate the dog's \fBsave\fR method to the
\fBsaverec\fR command as follows:
.CS

snit::type dog {
    delegate method save using {saverec %s}
}

.CE
The \fB%s\fR is replaced with the instance name when the
\fBsave\fR method is called; any additional arguments are the
appended to the resulting command.
.PP
The \fBusing\fR clause understands a number of other %-conversions;
in addition to the instance name, you can substitute in the method
name (\fB%m\fR), the type name (\fB%t\fR), the instance
namespace (\fB%n\fR), the Tk window name (\fB%w\fR), and,
if a component or typecomponent name was given in the
\fBdelegate\fR statement, the component's object command
(\fB%c\fR).
.SS "HOW CAN I DELEGATE A METHOD TO A TYPE COMPONENT OBJECT?"
Just exactly as you would to a component object.  The
\fBdelegate method\fR statement accepts both component and type
component names in its \fBto\fR clause.
.SS "HOW CAN I DELEGATE A TYPE METHOD TO A TYPE COMPONENT OBJECT?"
Use the \fBdelegate typemethod\fR statement.  It works like
\fBdelegate method\fR, with these differences: first, it defines
a type method instead of an instance method; second, the
\fBusing\fR clause ignores the \fB%s\fR, \fB%n\fR,
and \fB%w\fR %-conversions.
.PP
Naturally, you can't delegate a type method to an instance
component...Snit wouldn't know which instance should receive it.
.SS "HOW CAN I DELEGATE AN OPTION TO A COMPONENT OBJECT?"
The first question in this section (see \fBDELEGATION\fR) shows
one way to delegate an option to a component; but this pattern occurs
often enough that Snit makes it easy.  For example, every \fBtail\fR
object has a \fB-length\fR option; we want to allow the creator of
a \fBdog\fR object to set the tail's length.  We can do this:
.PP
.CS

% snit::type dog {
    delegate option -length to mytail

    constructor {args} {
        install mytail using tail %AUTO% -partof $self
        $self configurelist $args
    }
}
::dog
% snit::type tail {
    option -partof
    option -length 5
}
::tail
% dog spot -length 7
::spot
% spot cget -length
7

.CE
.PP
This produces nearly the same result as the \fB-configuremethod\fR and
\fB-cgetmethod\fR shown under the first question in this
section: whenever a \fBdog\fR object's \fB-length\fR option is set
or retrieved, the underlying \fBtail\fR object's option is set or
retrieved in turn.
.PP
Note that you can define an option name using the \fBoption\fR
statement, or you can define it using \fBdelegate\fR; you can't do
both.
.SS "CAN I DELEGATE TO AN OPTION WITH A DIFFERENT NAME?"
In the previous answer we delegated the \fBdog\fR's \fB-length\fR
option down to its \fBtail\fR.  This is, of course, wrong.  The dog
has a length, and the tail has a length, and they are different.  What
we'd really like to do is give the \fBdog\fR a \fB-taillength\fR
option, but delegate it to the \fBtail\fR's \fB-length\fR option:
.PP
.CS

snit::type dog {
    delegate option -taillength to mytail as -length

    constructor {args} {
        set mytail [tail %AUTO% -partof $self]
        $self configurelist $args
    }
}

.CE
.PP
.SS "HOW CAN I DELEGATE ANY UNRECOGNIZED METHOD OR OPTION TO A COMPONENT OBJECT?"
It may happen that a Snit object gets most of its behavior from one of
its components.  This often happens with \fBsnit::widgetadaptors\fR,
for example, where we wish to slightly the modify the behavior of an
existing widget.  To carry on with our \fBdog\fR example, however, suppose
that we have a \fBsnit::type\fR called \fBanimal\fR that implements a
variety of animal behaviors--moving, eating, sleeping, and so forth.
We want our \fBdog\fR objects to inherit these same behaviors, while
adding dog-like behaviors of its own.
Here's how we can give a \fBdog\fR methods and options of its own
while delegating all other methods and options to its \fBanimal\fR
component:
.PP
.CS

snit::type dog {
    delegate option * to animal
    delegate method * to animal

    option -akc 0

    constructor {args} {
        install animal using animal %AUTO% -name $self
        $self configurelist $args
    }

    method wag {} {
        return "$self wags its tail"
    }
}

.CE
.PP
That's it.  A \fBdog\fR is now an \fBanimal\fR that has a
\fB-akc\fR option and can \fBwag\fR its tail.
.PP
Note that we don't need to specify the full list of method names or
option names that \fBanimal\fR will receive.
It gets anything \fBdog\fR doesn't recognize--and if it doesn't
recognize it either, it will simply throw an error, just as it should.
.PP
You can also delegate all unknown type methods to a type component
using \fBdelegate typemethod *\fR.
.SS "HOW CAN I DELEGATE ALL BUT CERTAIN METHODS OR OPTIONS TO A COMPONENT?"
In the previous answer, we said that every \fBdog\fR is
an \fBanimal\fR by delegating all unknown methods and options to the
\fBanimal\fR component. But what if the \fBanimal\fR type has some
methods or options that we'd like to suppress?
.PP
One solution is to explicitly delegate all the options and methods,
and forgo the convenience of \fBdelegate method *\fR and
\fBdelegate option *\fR.  But if we wish to suppress only a few
options or methods, there's an easier way:
.PP
.CS

snit::type dog {
    delegate option * to animal except -numlegs
    delegate method * to animal except {fly climb}

    # ...

    constructor {args} {
        install animal using animal %AUTO% -name $self -numlegs 4
        $self configurelist $args
    }

    # ...
}

.CE
.PP
Dogs have four legs, so we specify that explicitly when we create the
\fBanimal\fR component, and explicitly exclude \fB-numlegs\fR from the
set of delegated options.  Similarly, dogs can neither
\fBfly\fR nor \fBclimb\fR,
so we exclude those \fBanimal\fR methods as shown.
.SS "CAN A HIERARCHICAL METHOD BE DELEGATED?"
Yes; just specify multiple words in the delegated method's name:
.PP
.CS

snit::type tail {
    method wag {} {return "Wag, wag"}
    method droop {} {return "Droop, droop"}
}


snit::type dog {
    delegate method {tail wag} to mytail
    delegate method {tail droop} to mytail

    # ...

    constructor {args} {
        install mytail using tail %AUTO%
        $self configurelist $args
    }

    # ...
}

.CE
.PP
Unrecognized hierarchical methods can also be delegated; the following
code delegates all subcommands of the "tail" method to the "mytail"
component:
.PP
.CS

snit::type dog {
    delegate method {tail *} to mytail

    # ...
}

.CE
.PP
.SH WIDGETS
.SS "WHAT IS A SNIT::WIDGET?"
A \fBsnit::widget\fR is the Snit version of what Tcl programmers
usually call a \fImegawidget\fR: a widget-like object usually
consisting of one or more Tk widgets all contained within a Tk frame.
.PP
A \fBsnit::widget\fR is also a special kind of \fBsnit::type\fR.  Just
about everything in this FAQ list that relates to \fBsnit::types\fR
also applies to \fBsnit::widgets\fR.
.SS "HOW DO I DEFINE A SNIT::WIDGET?"
\fBsnit::widgets\fR are defined using the \fBsnit::widget\fR command,
just as \fBsnit::types\fR are defined by the \fBsnit::type\fR command.
.PP
The body of the definition can contain all of the same kinds of
statements, plus a couple of others which will be mentioned below.
.SS "HOW DO SNIT::WIDGETS DIFFER FROM SNIT::TYPES?"
.IP \(bu
The name of an instance of a \fBsnit::type\fR can be any valid Tcl
command name, in any namespace.
The name of an instance of a \fBsnit::widget\fR must be a valid Tk
widget name, and its parent widget must already exist.
.IP \(bu
An instance of a \fBsnit::type\fR can be destroyed by calling
its \fBdestroy\fR method.  Instances of a \fBsnit::widget\fR have no
destroy method; use the Tk \fBdestroy\fR command instead.
.IP \(bu
Every instance of a \fBsnit::widget\fR has one predefined component
called its \fBhull\fR component.
The hull is usually a Tk \fBframe\fR or \fBtoplevel\fR widget; any other
widgets created as part of the \fBsnit::widget\fR will usually be
contained within the hull.
.IP \(bu
\fBsnit::widget\fRs can have their options receive default values from
\fBTHE TK OPTION DATABASE\fR.
.PP
.SS "WHAT IS A HULL COMPONENT?"
Snit can't create a Tk widget object; only Tk can do that.
Thus, every instance of a \fBsnit::widget\fR must be wrapped around a
genuine Tk widget; this Tk widget is called the \fIhull component\fR.
Snit effectively piggybacks the behavior you define (methods, options,
and so forth) on top of the hull component so that the whole thing
behaves like a standard Tk widget.
.PP
For \fBsnit::widget\fRs the hull component must be a Tk widget that
defines the \fB-class\fR option.
.PP
\fBsnit::widgetadaptor\fRs differ from \fBsnit::widget\fRs chiefly in
that any kind of widget can be used as the hull component; see
\fBWIDGET ADAPTORS\fR.
.SS "HOW CAN I SET THE HULL TYPE FOR A SNIT::WIDGET?"
A \fBsnit::widget\fR's hull component will usually be a Tk \fBframe\fR
widget; however, it may be any Tk widget that defines the
\fB-class\fR option.  You can
explicitly choose the hull type you prefer by including the \fBhulltype\fR
command in the widget definition:
.PP
.CS

snit::widget mytoplevel {
    hulltype toplevel

    # ...
}

.CE
.PP
If no \fBhulltype\fR command appears, the hull will be a \fBframe\fR.
.PP
By default, Snit recognizes the following hull types: the Tk widgets
\fBframe\fR, \fBlabelframe\fR, \fBtoplevel\fR, and the Tile widgets
\fBttk::frame\fR, \fBttk::labelframe\fR, and \fBttk::toplevel\fR.  To
enable the use of some other kind of widget as the hull type, you can
\fBlappend\fR the widget command to the variable \fBsnit::hulltypes\fR (always
provided the widget defines the \fB-class\fR option.  For example,
suppose Tk gets a new widget type called a \fBprettyframe\fR:
.PP
.CS

lappend snit::hulltypes prettyframe

snit::widget mywidget {
    hulltype prettyframe

    # ...
}

.CE
.PP
.SS "HOW SHOULD I NAME WIDGETS WHICH ARE COMPONENTS OF A SNIT::WIDGET?"
Every widget, whether a genuine Tk widget or a Snit megawidget, has to
have a valid Tk window name.  When a \fBsnit::widget\fR is first
created, its instance name, \fBself\fR, is a Tk window name;
however, if the \fBsnit::widget\fR is used as the hull component by a
\fBsnit::widgetadaptor\fR its instance name will be changed to
something else.  For this reason, every \fBsnit::widget\fR method,
constructor, destructor, and so forth is passed another implicit
argument, \fBwin\fR, which is the window name of the megawidget.  Any
children should be named using \fBwin\fR as the root.
.PP
Thus, suppose you're writing a toolbar widget, a frame consisting of a
number of buttons placed side-by-side.  It might look something like
this:
.PP
.CS

snit::widget toolbar {
    delegate option * to hull

    constructor {args} {
        button $win.open -text Open -command [mymethod open]
        button $win.save -text Save -command [mymethod save]

        # ....

        $self configurelist $args

    }
}

.CE
.PP
See also the question on renaming objects, toward the top of this
file.
.SH "WIDGET ADAPTORS"
.SS "WHAT IS A SNIT::WIDGETADAPTOR?"
A \fBsnit::widgetadaptor\fR is a kind of \fBsnit::widget\fR.  Whereas
a \fBsnit::widget\fR's hull is automatically created and is always a
Tk frame, a \fBsnit::widgetadaptor\fR can be based on any Tk
widget--or on any Snit megawidget, or even (with luck) on megawidgets
defined using some other package.
.PP
It's called a \fIwidget adaptor\fR because it allows you to take an
existing widget and customize its behavior.
.SS "HOW DO I DEFINE A SNIT::WIDGETADAPTOR?"
Use the \fBsnit::widgetadaptor\fR command.  The definition for a
\fBsnit::widgetadaptor\fR looks just like that for a \fBsnit::type\fR
or \fBsnit::widget\fR, except that the constructor must create and
install the hull component.
.PP
For example, the following code creates a read-only text widget by the
simple device of turning its \fBinsert\fR and \fBdelete\fR
methods into no-ops.  Then, we define new methods, \fBins\fR and
\fBdel\fR,
which get delegated to the hull component as \fBinsert\fR and
\fBdelete\fR.  Thus, we've adapted the text widget and given it new
behavior while still leaving it fundamentally a text widget.
.PP
.CS

::snit::widgetadaptor rotext {

    constructor {args} {
        # Create the text widget; turn off its insert cursor
        installhull using text -insertwidth 0

        # Apply any options passed at creation time.
        $self configurelist $args
    }

    # Disable the text widget's insert and delete methods, to
    # make this readonly.
    method insert {args} {}
    method delete {args} {}

    # Enable ins and del as synonyms, so the program can insert and
    # delete.
    delegate method ins to hull as insert
    delegate method del to hull as delete

    # Pass all other methods and options to the real text widget, so
    # that the remaining behavior is as expected.
    delegate method * to hull
    delegate option * to hull
}

.CE
.PP
The most important part is in the constructor.
Whereas \fBsnit::widget\fR creates the hull for you,
\fBsnit::widgetadaptor\fR cannot -- it doesn't know what kind of
widget you want.  So the first thing the constructor does is create
the hull component (a Tk text widget in this case), and then installs
it using the \fBinstallhull\fR command.
.PP
\fINote:\fR There is no instance command until you create one by
installing a hull component.  Any attempt to pass methods to \fB$self\fR
prior to calling \fBinstallhull\fR will fail.
.SS "CAN I ADAPT A WIDGET CREATED ELSEWHERE IN THE PROGRAM?"
Yes.
.PP
At times, it can be convenient to adapt a pre-existing widget instead
of creating your own.
For example, the Bwidget \fBPagesManager\fR widget manages a
set of \fBframe\fR widgets, only one of which is visible at a time.
The application chooses which \fBframe\fR is visible.  All of the
These \fBframe\fRs are created by the \fBPagesManager\fR itself, using
its \fBadd\fR method.  It's convenient to adapt these frames to
do what we'd like them to do.
.PP
In a case like this, the Tk widget will already exist when the
\fBsnit::widgetadaptor\fR is created.  Snit provides an alternate form
of the \fBinstallhull\fR command for this purpose:
.PP
.CS

snit::widgetadaptor pageadaptor {
    constructor {args} {
        # The widget already exists; just install it.
        installhull $win

        # ...
    }
}

.CE
.SS "CAN I ADAPT ANOTHER MEGAWIDGET?"
Maybe. If the other megawidget is a \fBsnit::widget\fR or
\fBsnit::widgetadaptor\fR, then yes.  If it isn't then, again, maybe.
You'll have to try it and see.  You're most likely to have trouble
with widget destruction--you have to make sure that your
megawidget code receives the \fB<Destroy>\fR event before the
megawidget you're adapting does.
.SH "THE TK OPTION DATABASE"
.SS "WHAT IS THE TK OPTION DATABASE?"
The Tk option database is a database of default option values
maintained by Tk itself; every Tk application has one.  The concept of
the option database derives from something called the X Windows
resource database; however, the option database is available in every
Tk implementation, including those which do not use the X Windows
system (e.g., Microsoft Windows).
.PP
Full details about the Tk option database are beyond the scope of this
document; both \fIPractical Programming in Tcl and Tk\fR by Welch,
Jones, and Hobbs, and \fIEffective Tcl/Tk Programming\fR by
Harrison and McClennan., have good introductions to it.
.PP
Snit is implemented so that most of the time it will simply do the
right thing with respect to the option database, provided that the
widget developer does the right thing by Snit.  The body of this
section goes into great deal about what Snit requires.  The following
is a brief statement of the requirements, for reference.
.PP
.IP \(bu
If the widget's default widget class is not what is desired, set it
explicitly using the \fBwidgetclass\fR statement in the widget
definition.
.IP \(bu
When defining or delegating options, specify the resource and class
names explicitly when necessary.
.IP \(bu
Use the \fBinstallhull using\fR command to create and install the
hull for \fBsnit::widgetadaptor\fRs.
.IP \(bu
Use the \fBinstall\fR command to create and install all
components which are widgets.
.IP \(bu
Use the \fBinstall\fR command to create and install
components which aren't widgets if you'd like them to
receive option values from the option database.
.PP
.PP
The interaction of Tk widgets with the option database is a complex
thing; the interaction of Snit with the option database is even more
so, and repays attention to detail.
.SS "DO SNIT::TYPES USE THE TK OPTION DATABASE?"
No, they don't; querying the option database requires a Tk window
name, and \fBsnit::type\fRs don't have one.
.PP
If you create an instance of a \fBsnit::type\fR as a
component of a \fBsnit::widget\fR or \fBsnit::widgetadaptor\fR, on the
other hand, and if any options are delegated to the component,
and if you use \fBinstall\fR to create and install it, then
the megawidget will query the option database on the
\fBsnit::type\fR's behalf.  This might or might not be what you
want, so take care.
.SS "WHAT IS MY SNIT::WIDGET'S WIDGET CLASS?"
Every Tk widget has a "widget class": a name that is used when adding
option settings to the database.  For Tk widgets, the widget class is
the same as the widget command name with an initial capital.  For
example, the widget class of the Tk \fBbutton\fR widget is
\fBButton\fR.
.PP
Similarly, the widget class of a \fBsnit::widget\fR defaults to the
unqualified type name with the first letter capitalized.  For example,
the widget class of
.PP
.CS

snit::widget ::mylibrary::scrolledText { ... }

.CE
.PP
is \fBScrolledText\fR.
.PP
The widget class can also be set explicitly using the
\fBwidgetclass\fR statement within the \fBsnit::widget\fR definition:
.PP
.CS

snit::widget ::mylibrary::scrolledText {
    widgetclass Text

    # ...
}

.CE
.PP
The above definition says that a \fBscrolledText\fR megawidget has the
same widget class as an ordinary \fBtext\fR widget.  This might or
might not be a good idea, depending on how the rest of the megawidget
is defined, and how its options are delegated.
.SS "WHAT IS MY SNIT::WIDGETADAPTOR'S WIDGET CLASS?"
The widget class of a \fBsnit::widgetadaptor\fR is just the widget
class of its hull widget; Snit has no control over this.
.PP
Note that the widget class can be changed only for \fBframe\fR and
\fBtoplevel\fR widgets, which is why these are the valid hull types
for \fBsnit::widget\fRs.
.PP
Try to use \fBsnit::widgetadaptor\fRs only to make small modifications
to another widget's behavior.  Then, it will usually not make sense to
change the widget's widget class anyway.
.SS "WHAT ARE OPTION RESOURCE AND CLASS NAMES?"
Every Tk widget option has three names: the option name, the resource
name, and the class name.
The option name begins with a hyphen and is all lowercase; it's used
when creating widgets, and with the \fBconfigure\fR and \fBcget\fR
commands.
.PP
The resource and class names are used to initialize option
default values by querying the option database.
The resource name is usually just the option
name minus the hyphen, but may contain uppercase letters at word
boundaries; the class name is usually just the resource
name with an initial capital, but not always.  For example, here are
the option, resource, and class names for several Tk \fBtext\fR
widget options:
.PP
.CS

    -background         background         Background
    -borderwidth        borderWidth        BorderWidth
    -insertborderwidth  insertBorderWidth  BorderWidth
    -padx               padX               Pad

.CE
.PP
As is easily seen, sometimes the resource and class names can be
inferred from the option name, but not always.
.SS "WHAT ARE THE RESOURCE AND CLASS NAMES FOR MY MEGAWIDGET'S OPTIONS?"
For options implicitly delegated to a component using
\fBdelegate option *\fR, the resource and class names will be
exactly those defined by the component.  The \fBconfigure\fR method
returns these names, along with the option's default and current
values:
.PP
.CS

% snit::widget mytext {
    delegate option * to text

    constructor {args} {
        install text using text .text
        # ...
    }

    # ...
}
::mytext
% mytext .text
.text
% .text configure -padx
-padx padX Pad 1 1
%

.CE
.PP
For all other options (whether locally defined or explicitly
delegated), the resource and class names can be defined explicitly, or
they can be allowed to have default values.
.PP
By default, the resource name is just the option name minus the
hyphen; the the class name is just the option name with an initial
capital letter.  For example, suppose we explicitly delegate "-padx":
.PP
.CS

% snit::widget mytext {
    option -myvalue 5

    delegate option -padx to text
    delegate option * to text

    constructor {args} {
        install text using text .text
        # ...
    }

    # ...
}
::mytext
% mytext .text
.text
% .text configure -myvalue
-myvalue myvalue Myvalue 5 5
% .text configure -padx
-padx padx Padx 1 1
%

.CE
.PP
Here the resource and class names are chosen using the default rules.
Often these rules are sufficient, but in the case of "-padx" we'd most
likely prefer that the option's resource and class names are the same
as for the built-in Tk widgets.  This is easily done:
.PP
.CS

% snit::widget mytext {
    delegate option {-padx padX Pad} to text

    # ...
}
::mytext
% mytext .text
.text
% .text configure -padx
-padx padX Pad 1 1
%

.CE
.SS "HOW DOES SNIT INITIALIZE MY MEGAWIDGET'S LOCALLY-DEFINED OPTIONS?"
The option database is queried for each of the megawidget's
locally-defined options, using the option's resource and class name.
If the result isn't "", then it replaces the default value given in
widget definition.  In either case, the default can be overridden by
the caller.  For example,
.PP
.CS

option add *Mywidget.texture pebbled

snit::widget mywidget {
    option -texture smooth
    # ...
}

mywidget .mywidget -texture greasy

.CE
.PP
Here, \fB-texture\fR would normally default to "smooth", but because of
the entry added to the option database it defaults to "pebbled".
However, the caller has explicitly overridden the default, and so the
new widget will be "greasy".
.SS "HOW DOES SNIT INITIALIZE DELEGATED OPTIONS?"
That depends on whether the options are delegated to the hull, or to
some other component.
.SS "HOW DOES SNIT INITIALIZE OPTIONS DELEGATED TO THE HULL?"
A \fBsnit::widget\fR's hull is a widget, and given that its class has
been set it is expected to query the option database for itself.  The
only exception concerns options that are delegated to it with a
different name.  Consider the following code:
.PP
.CS

option add *Mywidget.borderWidth 5
option add *Mywidget.relief sunken
option add *Mywidget.hullbackground red
option add *Mywidget.background green

snit::widget mywidget {
    delegate option -borderwidth to hull
    delegate option -hullbackground to hull as -background
    delegate option * to hull
    # ...
}

mywidget .mywidget

set A [.mywidget cget -relief]
set B [.mywidget cget -hullbackground]
set C [.mywidget cget -background]
set D [.mywidget cget -borderwidth]

.CE
.PP
The question is, what are the values of variables A, B, C and D?
.PP
The value of A is "sunken".  The hull is a Tk frame which has been
given the widget class \fBMywidget\fR; it will automatically query the
option database and pick up this value.  Since the \fB-relief\fR option is
implicitly delegated to the hull, Snit takes no action.
.PP
The value of B is "red".  The hull will automatically pick up the
value "green" for its \fB-background\fR option, just as it picked up the
\fB-relief\fR value.  However, Snit knows that \fB-hullbackground\fR
is mapped to the hull's \fB-background\fR option; hence, it queries
the option database for \fB-hullbackground\fR and gets "red" and
updates the hull accordingly.
.PP
The value of C is also "red", because \fB-background\fR is implicitly
delegated to the hull; thus, retrieving it is the same as retrieving
\fB-hullbackground\fR.  Note that this case is unusual; the
\fB-background\fR option should probably have been excluded using the delegate
statement's \fBexcept\fR clause, or (more likely) delegated to some other
component.
.PP
The value of D is "5", but not for the reason you think.  Note that as
it is defined above, the resource name for \fB-borderwidth\fR defaults to
\fBborderwidth\fR, whereas the option database entry is
\fBborderWidth\fR, in
accordance with the standard Tk naming for this option.  As with
\fB-relief\fR, the hull picks up its own \fB-borderwidth\fR
option before Snit
does anything.  Because the option is delegated under its own name,
Snit assumes that the correct thing has happened, and doesn't worry
about it any further.  To avoid confusion, the
\fB-borderwidth\fR option
should have been delegated like this:
.PP
.CS

    delegate option {-borderwidth borderWidth BorderWidth} to hull

.CE
.PP
For \fBsnit::widgetadaptor\fRs, the case is somewhat altered.  Widget
adaptors retain the widget class of their hull, and the hull is not
created automatically by Snit.  Instead, the \fBsnit::widgetadaptor\fR
must call \fBinstallhull\fR in its constructor.  The normal way
to do this is as follows:
.PP
.CS

snit::widgetadaptor mywidget {
    # ...
    constructor {args} {
        # ...
        installhull using text -foreground white
        # ...
    }
    # ...
}

.CE
.PP
In this case, the \fBinstallhull\fR command will create the hull using
a command like this:
.PP
.CS

    set hull [text $win -foreground white]

.CE
.PP
The hull is a \fBtext\fR widget, so its widget class is \fBText\fR.  Just
as with \fBsnit::widget\fR hulls, Snit assumes that it will pick up
all of its normal option values automatically, without help from Snit.
Options delegated from a different name are initialized from the
option database in the same way as described above.
.PP
In earlier versions of Snit, \fBsnit::widgetadaptor\fRs were expected
to call \fBinstallhull\fR like this:
.PP
.CS

    installhull [text $win -foreground white]

.CE
.PP
This form still works--but Snit will not query the option database as
described above.
.SS "HOW DOES SNIT INITIALIZE OPTIONS DELEGATED TO OTHER COMPONENTS?"
For hull components, Snit assumes that Tk will do most of the work
automatically.  Non-hull components are somewhat more complicated, because
they are matched against the option database twice.
.PP
A component widget remains a widget still, and is therefore
initialized from the option database in the usual way.  A \fBtext\fR
widget remains a \fBtext\fR widget whether it is a component of a
megawidget or not, and will be created as such.
.PP
But then, the option database is queried for all options delegated to
the component, and the component is initialized accordingly--provided
that the \fBinstall\fR command is used to create it.
.PP
Before option database support was added to Snit, the usual way to
create a component was to simply create it in the constructor and
assign its command name to the component variable:
.PP
.CS

snit::widget mywidget {
    delegate option -background to myComp

    constructor {args} {
        set myComp [text $win.text -foreground black]
    }
}

.CE
.PP
The drawback of this method is that Snit has no opportunity to
initialize the component properly.  Hence, the following approach is
now used:
.PP
.CS

snit::widget mywidget {
    delegate option -background to myComp

    constructor {args} {
        install myComp using text $win.text -foreground black
    }
}

.CE
.PP
The \fBinstall\fR command does the following:
.PP
.IP \(bu
Builds a list of the options explicitly included in the \fBinstall\fR
command--in this case, \fB-foreground\fR.
.IP \(bu
Queries the option database for all options delegated explicitly to
the named component.
.IP \(bu
Creates the component using the specified command, after inserting
into it a list of options and values read from the option database.
Thus, the explicitly included options (like \fB-foreground\fR) will
override anything read from the option database.
.IP \(bu
If the widget definition implicitly delegated options to the component
using \fBdelegate option *\fR, then Snit calls the newly created
component's \fBconfigure\fR method to receive a list of all of the
component's options.  From this Snit builds a list of options
implicitly delegated to the component which were not explicitly
included in the \fBinstall\fR command.  For all such options, Snit
queries the option database and configures the component accordingly.
.PP
You don't really need to know all of this; just use \fBinstall\fR to
install your components, and Snit will try to do the right thing.
.SS "WHAT HAPPENS IF I INSTALL A NON-WIDGET AS A COMPONENT OF WIDGET?"
A \fBsnit::type\fR never queries the option database.
However, a \fBsnit::widget\fR can have non-widget components.  And if
options are delegated to those components, and if the \fBinstall\fR
command is used to install those components, then they will be
initialized from the option database just as widget components are.
.PP
However, when used within a megawidget, \fBinstall\fR assumes that the
created component uses a reasonably standard widget-like creation
syntax.  If it doesn't, don't use \fBinstall\fR.
.SH "ENSEMBLE COMMANDS"
.SS "WHAT IS AN ENSEMBLE COMMAND?"
An ensemble command is a command with subcommands.  Snit objects are
all ensemble commands; however, the term more usually refers to
commands like the standard Tcl commands \fBstring\fR, \fBfile\fR,
and \fBclock\fR.  In a sense, these are singleton objects--there's
only one instance of them.
.SS "HOW CAN I CREATE AN ENSEMBLE COMMAND USING SNIT?"
There are two ways--as a \fBsnit::type\fR, or as an instance of
a \fBsnit::type\fR.
.SS "HOW CAN I CREATE AN ENSEMBLE COMMAND USING AN INSTANCE OF A SNIT::TYPE?"
Define a type whose \fBINSTANCE METHODS\fR are the subcommands
of your ensemble command.  Then, create an instance of the type with
the desired name.
.PP
For example, the following code uses \fBDELEGATION\fR to create
a work-alike for the standard \fBstring\fR command:
.CS

snit::type ::mynamespace::mystringtype {
    delegate method * to stringhandler

    constructor {} {
        set stringhandler string
    }
}

::mynamespace::mystringtype mystring

.CE
We create the type in a namespace, so that the type command is hidden;
then we create a single instance with the desired name--
\fBmystring\fR, in this case.
.PP
This method has two drawbacks.  First, it leaves the type command
floating about.  More seriously, your shiny new ensemble
command will have \fBinfo\fR and \fBdestroy\fR subcommands that
you probably have no use for.  But read on.
.SS "HOW CAN I CREATE AN ENSEMBLE COMMAND USING A SNIT::TYPE?"
Define a type whose \fBTYPE METHODS\fR are the subcommands
of your ensemble command.
.PP
For example, the following code uses \fBDELEGATION\fR to create
a work-alike for the standard \fBstring\fR command:
.CS

snit::type mystring {
    delegate typemethod * to stringhandler

    typeconstructor {
        set stringhandler string
    }
}

.CE
Now the type command itself is your ensemble command.
.PP
This method has only one drawback, and though it's major, it's
also surmountable.  Your new ensemble command will have
\fBcreate\fR, \fBinfo\fR and \fBdestroy\fR subcommands
you don't want.  And worse yet, since the \fBcreate\fR method
can be implicit, users of your command will accidentally be creating
instances of your \fBmystring\fR type if they should mispell one
of the subcommands.  The command will succeed--the first time--but
won't do what's wanted.  This is very bad.
.PP
The work around is to set some \fBPRAGMAS\fR, as shown here:
.CS

snit::type mystring {
    pragma -hastypeinfo    no
    pragma -hastypedestroy no
    pragma -hasinstances   no

    delegate typemethod * to stringhandler

    typeconstructor {
        set stringhandler string
    }
}

.CE
Here we've used the \fBpragma\fR statement to tell Snit that we don't
want the \fBinfo\fR typemethod or the \fBdestroy\fR typemethod,
and that our type has no instances; this eliminates the
\fBcreate\fR typemethod and all related code.  As
a result, our ensemble command will be well-behaved, with no
unexpected subcommands.
.SH PRAGMAS
.SS "WHAT IS A PRAGMA?"
A pragma is an option you can set in your type definitions that
affects how the type is defined and how it works once it is defined.
.SS "HOW DO I SET A PRAGMA?"
Use the \fBpragma\fR statement.  Each pragma is an option with a
value; each time you use the \fBpragma\fR statement you can set one or
more of them.
.SS "HOW CAN I GET RID OF THE "INFO" TYPE METHOD?"
Set the \fB-hastypeinfo\fR pragma to \fBno\fR:
.CS

snit::type dog {
    pragma -hastypeinfo no
    # ...
}

.CE
Snit will refrain from defining the \fBinfo\fR type method.
.SS "HOW CAN I GET RID OF THE "DESTROY" TYPE METHOD?"
Set the \fB-hastypedestroy\fR pragma to \fBno\fR:
.CS

snit::type dog {
    pragma -hastypedestroy no
    # ...
}

.CE
Snit will refrain from defining the \fBdestroy\fR type method.
.SS "HOW CAN I GET RID OF THE "CREATE" TYPE METHOD?"
Set the \fB-hasinstances\fR pragma to \fBno\fR:
.CS

snit::type dog {
    pragma -hasinstances no
    # ...
}

.CE
Snit will refrain from defining the \fBcreate\fR type method;
if you call the type command with an unknown method name, you'll get
an error instead of a new instance of the type.
.PP
This is useful if you wish to use a \fBsnit::type\fR to define
an ensemble command rather than a type with instances.
.PP
Pragmas \fB-hastypemethods\fR and \fB-hasinstances\fR cannot
both be false (or there'd be nothing left).
.SS "HOW CAN I GET RID OF TYPE METHODS ALTOGETHER?"
Normal Tk widget type commands don't have subcommands; all they do is
create widgets--in Snit terms, the type command calls the
\fBcreate\fR type method directly.  To get the same behavior from
Snit, set the \fB-hastypemethods\fR pragma to \fBno\fR:
.CS

snit::type dog {
    pragma -hastypemethods no
    #...
}

# Creates ::spot
dog spot

# Tries to create an instance called ::create
dog create spot

.CE
Pragmas \fB-hastypemethods\fR and \fB-hasinstances\fR cannot
both be false (or there'd be nothing left).
.SS "WHY CAN'T I CREATE AN OBJECT THAT REPLACES AN OLD OBJECT WITH THE SAME NAME?"
Up until Snit 0.95, you could use any name for an instance of a
\fBsnit::type\fR, even if the name was already in use by some other
object or command.  You could do the following, for example:
.CS

snit::type dog { ... }

dog proc

.CE
You now have a new dog named "proc", which is probably not something
that you really wanted to do.  As a result, Snit now throws an error
if your chosen instance name names an existing command.  To restore
the old behavior, set the \fB-canreplace\fR pragma to \fByes\fR:
.CS

snit::type dog {
    pragma -canreplace yes
    # ...
}

.CE
.SS "HOW CAN I MAKE MY SIMPLE TYPE RUN FASTER?"
In Snit 1.x, you can set the \fB-simpledispatch\fR pragma to \fByes\fR.
.PP
Snit 1.x method dispatch is both flexible and fast, but the flexibility
comes with a price.  If your type doesn't require the flexibility, the
\fB-simpledispatch\fR pragma allows you to substitute a simpler
dispatch mechanism that runs quite a bit faster.  The limitations
are these:
.IP \(bu
Methods cannot be delegated.
.IP \(bu
\fBuplevel\fR and \fBupvar\fR do not work as expected: the
caller's scope is two levels up rather than one.
.IP \(bu
The option-handling methods
(\fBcget\fR, \fBconfigure\fR, and \fBconfigurelist\fR) are very
slightly slower.
.PP
In Snit 2.2, the \fB-simpledispatch\fR macro is obsolete, and
ignored; all Snit 2.2 method dispatch is faster than Snit 1.x's
\fB-simpledispatch\fR.
.SH MACROS
.SS "WHAT IS A MACRO?"
A Snit macro is nothing more than a Tcl proc that's defined in the
Tcl interpreter used to compile Snit type definitions.
.SS "WHAT ARE MACROS GOOD FOR?"
You can use Snit macros to define new type definition syntax, and to
support conditional compilation.
.SS "HOW DO I DO CONDITIONAL COMPILATION?"
Suppose you want your type to use a fast C extension if it's
available; otherwise, you'll fallback to a slower Tcl implementation.
You want to define one set of methods in the first case, and another
set in the second case.  But how can your type definition know whether
the fast C extension is available or not?
.PP
It's easily done.  Outside of any type definition, define a macro that
returns 1 if the extension is available, and 0 otherwise:
.CS

if {$gotFastExtension} {
    snit::macro fastcode {} {return 1}
} else {
    snit::macro fastcode {} {return 0}
}

.CE
Then, use your macro in your type definition:
.CS

snit::type dog {

    if {[fastcode]} {
        # Fast methods
        method bark {} {...}
        method wagtail {} {...}
    } else {
        # Slow methods
        method bark {} {...}
        method wagtail {} {...}
    }
}

.CE
.SS "HOW DO I DEFINE NEW TYPE DEFINITION SYNTAX?"
Use a macro.  For example, your \fBsnit::widget\fR's
\fB-background\fR option should be propagated to a number
of component widgets.  You could implement that like this:
.CS

snit::widget mywidget {
    option -background -default white -configuremethod PropagateBackground

    method PropagateBackground {option value} {
        $comp1 configure $option $value
        $comp2 configure $option $value
        $comp3 configure $option $value
    }
}

.CE
For one option, this is fine; if you've got a number of options, it
becomes tedious and error prone.  So package it as a macro:
.CS

snit::macro propagate {option "to" components} {
    option $option -configuremethod Propagate$option

    set body "\\n"

    foreach comp $components {
        append body "\\$$comp configure $option \\$value\\n"
    }

    method Propagate$option {option value} $body
}

.CE
Then you can use it like this:
.CS

snit::widget mywidget {
    option -background default -white
    option -foreground default -black

    propagate -background to {comp1 comp2 comp3}
    propagate -foreground to {comp1 comp2 comp3}
}

.CE
.SS "ARE THERE ARE RESTRICTIONS ON MACRO NAMES?"
Yes, there are.  You can't redefine any standard Tcl commands or Snit
type definition statements.  You can use any other command name,
including the name of a previously defined macro.
.PP
If you're using Snit macros in your application, go ahead and name
them in the global namespace, as shown above.  But if you're using
them to define types or widgets for use by others, you should define
your macros in the same namespace as your types or widgets.  That way,
they won't conflict with other people's macros.
.PP
If my fancy \fBsnit::widget\fR is called \fB::mylib::mywidget\fR,
for example, then I should define my \fBpropagate\fR macro as
\fB::mylib::propagate\fR:
.CS

snit::macro mylib::propagate {option "to" components} { ... }

snit::widget ::mylib::mywidget {
    option -background default -white
    option -foreground default -black

    mylib::propagate -background to {comp1 comp2 comp3}
    mylib::propagate -foreground to {comp1 comp2 comp3}
}

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIsnit\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
BWidget, C++, Incr Tcl, adaptors, class, mega widget, object, object oriented, widget, widget adaptors
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2003-2006, by William H. Duquette

.fi

Added embedded/man/files/modules/soundex/soundex.n.






































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/soundex/soundex.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) ????, Algorithm: Donald E. Knuth
'\" Copyright (c) 2003, Documentation: Andreas Kupries <[email protected]>
'\" Copyright (c) 1998, Tcl port: Evan Rempel <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "soundex" n 1.0 tcllib "Soundex"
.BS
.SH NAME
soundex \- Soundex
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBsoundex  ?1.0?\fR
.sp
\fB::soundex::knuth\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides soundex algorithms which allow the
comparison of words based on their phonetic likeness.
.PP
Currently only an algorithm by Knuth is provided, which
is tuned to english names and words.
.TP
\fB::soundex::knuth\fR \fIstring\fR
Computes the soundex code of the input \fIstring\fR using
Knuth's algorithm and returns it as the result of the
command.
.PP
.SH EXAMPLES
.CS


    % ::soundex::knuth Knuth
    K530

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIsoundex\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
knuth, soundex, text comparison, text likeness
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) ????, Algorithm: Donald E. Knuth
Copyright (c) 2003, Documentation: Andreas Kupries <[email protected]>
Copyright (c) 1998, Tcl port: Evan Rempel <[email protected]>

.fi

Added embedded/man/files/modules/stooop/stooop.n.
































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/stooop/stooop.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "stooop" n 4.4.1 tcllib "Simple Tcl Only Object Oriented Programming"
.BS
.SH NAME
stooop \- Object oriented extension.
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBstooop  ?4.4.1?\fR
.sp
\fB::stooop::class\fR \fIname body\fR
.sp
\fB::stooop::new\fR \fIclass\fR ?\fIarg arg ...\fR?
.sp
\fB::stooop::delete\fR \fIobject\fR ?\fIobject ...\fR?
.sp
\fB::stooop::virtual\fR \fBproc\fR \fIname\fR {\fBthis\fR ?\fIarg arg ...\fR?} ?\fIbody\fR?
.sp
\fB::stooop::classof\fR \fIobject\fR
.sp
\fB::stooop::new\fR \fIobject\fR
.sp
\fB::stooop::printObjects\fR ?\fIpattern\fR?
.sp
\fB::stooop::record\fR
.sp
\fB::stooop::report\fR ?\fIpattern\fR?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides commands to extend Tcl in an object oriented
manner, using a familiar C++ like syntax and behaviour. Stooop only
introduces a few new commands: \fBclass\fR, \fBnew\fR, \fBdelete\fR,
\fBvirtual\fR and \fBclassof\fR. Along with a few coding conventions,
that is basically all you need to know to use stooop. Stooop is meant
to be as simple to use as possible.
.PP
This manual is very succinct and is to be used as a quick reminder for
the programmer, who should have read the thorough \fIstooop_man.html\fR
HTML documentation at this point.
.TP
\fB::stooop::class\fR \fIname body\fR
This command creates a class. The body, similar in contents to a Tcl
namespace (which a class actually also is), contains member procedure
definitions. Member procedures can also be defined outside the class
body, by prefixing their name with \fBclass::\fR, as you would
proceed with namespace procedures.
.RS
.TP
\fBproc\fR \fIclass\fR {\fBthis\fR ?\fIarg arg ...\fR?} ?\fIbase\fR {?\fIarg arg ...\fR?} ...? \fIbody\fR
This is the constructor procedure for the class. It is invoked
following a \fBnew\fR invocation on the class. It must have the same
name as the class and a first argument named \fBthis\fR. Any number
of base classes specifications, including arguments to be passed to
their constructor, are allowed before the actual body of the
procedure.
.TP
\fBproc\fR ~\fIclass\fR {\fBthis\fR} \fIbody\fR
This is the destructor procedure for the class. It is invoked
following a \fBdelete\fR invocation. Its name must be the
concatenation of a single \fB~\fR character followed by the class
name (as in C++). It must have a single argument named \fBthis\fR.
.TP
\fBproc\fR \fIname\fR {\fBthis\fR ?\fIarg arg ...\fR?} \fIbody\fR
This is a member procedure of the class, as its first argument is
named \fBthis\fR. It allows a simple access of member data for the
object referenced by \fBthis\fR inside the procedure. For example:
.CS


   set ($this,data) 0

.CE
.TP
\fBproc\fR \fIname\fR {?\fIarg arg ...\fR?} \fIbody\fR
This is a static (as in C++) member procedure of the class, as its
first argument is not named \fBthis\fR. Static (global) class data
can be accessed as in:
.CS


   set (data) 0

.CE
.TP
\fBproc\fR \fIclass\fR {\fBthis copy\fR} \fIbody\fR
This is the optional copy procedure for the class. It must have the
same name as the class and exactly 2 arguments named \fBthis\fR and
\fBcopy\fR. It is invoked following a \fBnew\fR invocation on an
existing object of the class.
.RE
.TP
\fB::stooop::new\fR \fIclass\fR ?\fIarg arg ...\fR?
This command is used to create an object. The first argument is the
class name and is followed by the arguments needed by the
corresponding class constructor. A unique identifier for the object
just created is returned.
.TP
\fB::stooop::delete\fR \fIobject\fR ?\fIobject ...\fR?
This command is used to delete one or several objects. It takes one or
more object identifiers as argument(s).
.TP
\fB::stooop::virtual\fR \fBproc\fR \fIname\fR {\fBthis\fR ?\fIarg arg ...\fR?} ?\fIbody\fR?
The \fBvirtual\fR specifier may be used on member procedures to
achieve dynamic binding. A procedure in a base class can then be
redefined (overloaded) in the derived class(es). If the base class
procedure is invoked on an object, it is actually the derived class
procedure which is invoked, if it exists. If the base class procedure
has no body, then it is considered to be a pure virtual and the
derived class procedure is always invoked.
.TP
\fB::stooop::classof\fR \fIobject\fR
This command returns the class of the existing object passed as single
parameter.
.TP
\fB::stooop::new\fR \fIobject\fR
This command is used to create an object by copying an existing
object. The copy constructor of the corresponding class is invoked if
it exists, otherwise a simple copy of the copied object data members
is performed.
.PP
.SH DEBUGGING
.TP
Environment variables
.RS
.TP
\fBSTOOOPCHECKDATA\fR
Setting this variable to any true value will cause stooop to check for
invalid member or class data access.
.TP
\fBSTOOOPCHECKPROCEDURES\fR
Setting this variable to any true value will cause stooop to check for
invalid member procedure arguments and pure interface classes
instanciation.
.TP
\fBSTOOOPCHECKALL\fR
Setting this variable to any true value will cause stooop to activate
both procedure and data member checking.
.TP
\fBSTOOOPCHECKOBJECTS\fR
Setting this variable to any true value will cause stooop to activate
object checking. The following stooop namespace procedures then become
available for debugging: \fBprintObjects\fR, \fBrecord\fR and
\fBreport\fR.
.TP
\fBSTOOOPTRACEPROCEDURES\fR
Setting this environment variable to either \fBstdout\fR,
\fBstderr\fR or a file name, activates procedure tracing. The
stooop library will then output to the specified channel 1 line of
informational text for each member procedure invocation.
.TP
\fBSTOOOPTRACEPROCEDURESFORMAT\fR
Defines the trace procedures output format. Defaults to
\fB"class: %C, procedure: %p, object: %O, arguments: %a"\fR.
.TP
\fBSTOOOPTRACEDATA\fR
Setting this environment variable to either \fBstdout\fR,
\fBstderr\fR or a file name, activates data tracing. The stooop
library will then output to the specified channel 1 line of
informational text for each member data access.
.TP
\fBSTOOOPTRACEDATAFORMAT\fR
Defines the trace data output format. Defaults to
\fB"class: %C, procedure: %p, array: %A, object: %O, member: %m, operation: %o, value: %v"\fR.
.TP
\fBSTOOOPTRACEDATAOPERATIONS\fR
When tracing data output, by default, all read, write and unsetting
accesses are reported, but the user can set this variable to any
combination of the letters \fBr\fR, \fBw\fR, and \fBu\fR for
more specific tracing (please refer to the \fBtrace\fR Tcl manual page
for more information).
.TP
\fBSTOOOPTRACEALL\fR
Setting this environment variable to either \fBstdout\fR,
\fBstderr\fR or a file name, enables both procedure and data
tracing.
.RE
.TP
\fB::stooop::printObjects\fR ?\fIpattern\fR?
Prints an ordered list of existing objects, in creation order, oldest
first. Each output line contains the class name, object identifier and
the procedure within which the creation occurred. The optional pattern
argument (as in the Tcl \fBstring match\fR command) can be used to
limit the output to matching class names.
.TP
\fB::stooop::record\fR
When invoked, a snapshot of all existing stooop objects is
taken. Reporting can then be used at a later time to see which objects
were created or deleted in the interval.
.TP
\fB::stooop::report\fR ?\fIpattern\fR?
Prints the created and deleted objects since the \fB::stooop::record\fR
procedure was invoked last. If present, the pattern argument limits
the output to matching class names.
.PP
.SH EXAMPLES
Please see the full HTML documentation in \fIstooop_man.html\fR.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstooop\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
C++, class, object, object oriented
.SH CATEGORY
Programming tools

Added embedded/man/files/modules/stringprep/stringprep.n.







































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/stringprep/stringprep.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2009, Sergei Golovan <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "stringprep" n 1.0.1 tcllib "Preparation of Internationalized Strings"
.BS
.SH NAME
stringprep \- Implementation of stringprep
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBstringprep  1.0.1\fR
.sp
\fB::stringprep::register\fR \fIprofile\fR ?\fI-mapping list\fR? ?\fI-normalization form\fR? ?\fI-prohibited list\fR? ?\fI-prohibitedList list\fR? ?\fI-prohibitedCommand command\fR? ?\fI-prohibitedBidi boolean\fR?
.sp
\fB::stringprep::stringprep\fR \fIprofile\fR \fIstring\fR
.sp
\fB::stringprep::compare\fR \fIprofile\fR \fIstring1\fR \fIstring2\fR
.sp
.BE
.SH DESCRIPTION
.PP
This is an implementation in Tcl of the Preparation of Internationalized
Strings ("stringprep"). It allows to define stringprep profiles and use
them to prepare Unicode strings for comparison as defined in RFC-3454.
.SH COMMANDS
.TP
\fB::stringprep::register\fR \fIprofile\fR ?\fI-mapping list\fR? ?\fI-normalization form\fR? ?\fI-prohibited list\fR? ?\fI-prohibitedList list\fR? ?\fI-prohibitedCommand command\fR? ?\fI-prohibitedBidi boolean\fR?
Register the \fBstringprep\fR profile named \fIprofile\fR. Options
are the following.
.sp
Option \fI-mapping\fR specifies \fBstringprep\fR mapping tables.
This parameter takes list of tables from appendix B of RFC-3454. The usual
list values are {B.1 B.2} or {B.1 B.3} where B.1 contains characters which
commonly map to nothing, B.3 specifies case folding, and B.2 is used in
profiles with unicode normalization form KC. Defult value is {} which means
no mapping.
.sp
Option \fI-normalization\fR takes a string and if it is nonempty then it
uses as a name of Unicode normalization form. Any value of "D", "C", "KD"
or "KC" may be used, though RFC-3454 defines only two options: no
normalization or normalization using form KC.
.sp
Option \fI-prohibited\fR takes a list of RFC-3454 tables with prohibited
characters. Current version does allow to prohibit either all tables from
C.3 to C.9 or neither of them. An example of this list for RFC-3491 is
{A.1 C.1.2 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}.
.sp
Option \fI-prohibitedList\fR specifies a list of additional prohibited
characters. The list contains not characters themselves but their Unicode
numbers. For example, Nodeprep specification from RFC-3920 forbids the
following codes: {0x22 0x26 0x27 0x2f 0x3a 0x3c 0x3e 0x40} (\\" \\& \\' / : < > @).
.sp
Option \fI-prohibitedCommand\fR specifies a command which is called for
every character code in mapped and normalized string. If the command returns
true then the character is considered prohibited. This option is useful when
a list for \fI-prohibitedList\fR is too large.
.sp
Option \fI-prohibitedBidi\fR takes boolean value and if it is true then the
bidirectional character processing rules defined in section 6 of RFC-3454 are
used.
.TP
\fB::stringprep::stringprep\fR \fIprofile\fR \fIstring\fR
Performs \fBstringprep\fR operations defined in profile \fIprofile\fR
to string \fIstring\fR. Result is a prepared string or one of the following
errors: \fIinvalid_profile\fR (profile \fIprofile\fR is not defined),
\fIprohibited_character\fR (string \fIstring\fR contains a prohibited character)
or \fIprohibited_bidi\fR (string \fIstring\fR contains a prohibited bidirectional
sequence).
.TP
\fB::stringprep::compare\fR \fIprofile\fR \fIstring1\fR \fIstring2\fR
Compares two unicode strings prepared accordingly to \fBstringprep\fR
profile \fIprofile\fR. The command returns 0 if prepared strings are equal,
-1 if \fIstring1\fR is lexicographically less than \fIstring2\fR, or
1 if \fIstring1\fR is lexicographically greater than \fIstring2\fR.
.PP
.SH EXAMPLES
Nameprep profile definition (see RFC-3491):
.CS


::stringprep::register nameprep  -mapping {B.1 B.2}  -normalization KC  -prohibited {A.1 C.1.2 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}  -prohibitedBidi 1

.CE
Nodeprep and resourceprep profile definitions (see RFC-3920):
.CS


::stringprep::register nodeprep  -mapping {B.1 B.2}  -normalization KC  -prohibited {A.1 C.1.1 C.1.2 C.2.1 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}  -prohibitedList {0x22 0x26 0x27 0x2f 0x3a 0x3c 0x3e 0x40}  -prohibitedBidi 1

::stringprep::register resourceprep  -mapping {B.1}  -normalization KC  -prohibited {A.1 C.1.2 C.2.1 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}  -prohibitedBidi 1

.CE
.SH REFERENCES
.IP [1]
"Preparation of Internationalized Strings ('stringprep')",
(\fIhttp://www.ietf.org/rfc/rfc3454.txt\fR)
.IP [2]
"Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)",
(\fIhttp://www.ietf.org/rfc/rfc3491.txt\fR)
.IP [3]
"Extensible Messaging and Presence Protocol (XMPP): Core",
(\fIhttp://www.ietf.org/rfc/rfc3920.txt\fR)
.PP
.SH AUTHORS
Sergei Golovan
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstringprep\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
unicode(n)
.SH KEYWORDS
stringprep, unicode
.SH COPYRIGHT
.nf
Copyright (c) 2007-2009, Sergei Golovan <[email protected]>

.fi

Added embedded/man/files/modules/stringprep/stringprep_data.n.
















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/stringprep/stringprep_data.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2009, Sergei Golovan <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "stringprep::data" n 1.0.1 tcllib "Preparation of Internationalized Strings"
.BS
.SH NAME
stringprep::data \- stringprep data tables, generated, internal
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBstringprep::data  1.0.1\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBstringprep::data\fR package is a helper for
\fBstringprep\fR, providing it with the data tables needed to
perform its functions. It is an \fIinternal\fR package which should
not be accessed on its own. Because of that it has no publicly
documented API either. Its implementation is generated by a script.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstringprep\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
stringprep, unicode
.SH COPYRIGHT
.nf
Copyright (c) 2007-2009, Sergei Golovan <[email protected]>

.fi

Added embedded/man/files/modules/stringprep/unicode.n.







































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/stringprep/unicode.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007, Sergei Golovan <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "unicode" n 1.0.0 tcllib "Unicode normalization"
.BS
.SH NAME
unicode \- Implementation of Unicode normalization
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBunicode  1.0\fR
.sp
\fB::unicode::fromstring\fR \fIstring\fR
.sp
\fB::unicode::tostring\fR \fIuclist\fR
.sp
\fB::unicode::normalize\fR \fIform\fR \fIuclist\fR
.sp
\fB::unicode::normalizeS\fR \fIform\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
.PP
This is an implementation in Tcl of the Unicode normalization forms.
.SH COMMANDS
.TP
\fB::unicode::fromstring\fR \fIstring\fR
Converts \fIstring\fR to list of integer Unicode character codes which
is used in \fBunicode\fR for internal string representation.
.TP
\fB::unicode::tostring\fR \fIuclist\fR
Converts list of integers \fIuclist\fR back to Tcl string.
.TP
\fB::unicode::normalize\fR \fIform\fR \fIuclist\fR
Normalizes Unicode characters list \fIulist\fR according to \fIform\fR
and returns the normalized list. Form \fIform\fR takes one of the following
values: \fID\fR (canonical decomposition), \fIC\fR (canonical decomposition, followed
by canonical composition), \fIKD\fR (compatibility decomposition), or \fIKC\fR
(compatibility decomposition, followed by canonical composition).
.TP
\fB::unicode::normalizeS\fR \fIform\fR \fIstring\fR
A shortcut to
::unicode::tostring [unicode::normalize \\$form [::unicode::fromstring \\$string]].
Normalizes Tcl string and returns normalized string.
.PP
.SH EXAMPLES
.CS


% ::unicode::fromstring "\\u0410\\u0411\\u0412\\u0413"
1040 1041 1042 1043
% ::unicode::tostring {49 50 51 52 53}
12345
%

.CE
.CS


% ::unicode::normalize D {7692 775}
68 803 775
% ::unicode::normalizeS KD "\\u1d2c"
A
%

.CE
.SH REFERENCES
.IP [1]
"Unicode Standard Annex #15: Unicode Normalization Forms",
(\fIhttp://unicode.org/reports/tr15/\fR)
.PP
.SH AUTHORS
Sergei Golovan
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstringprep\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
stringprep(n)
.SH KEYWORDS
normalization, unicode
.SH COPYRIGHT
.nf
Copyright (c) 2007, Sergei Golovan <[email protected]>

.fi

Added embedded/man/files/modules/stringprep/unicode_data.n.
















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/stringprep/unicode_data.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007, Sergei Golovan <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "unicode::data" n 1.0.0 tcllib "Preparation of Internationalized Strings"
.BS
.SH NAME
unicode::data \- unicode data tables, generated, internal
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBunicode::data  1.0.0\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBunicode::data\fR package is a helper for
\fBunicode\fR, providing it with the data tables needed to
perform its functions. It is an \fIinternal\fR package which should
not be accessed on its own. Because of that it has no publicly
documented API either. Its implementation is generated by a script.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstringprep\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
stringprep, unicode
.SH COPYRIGHT
.nf
Copyright (c) 2007, Sergei Golovan <[email protected]>

.fi

Added embedded/man/files/modules/struct/disjointset.n.








































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/disjointset.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::disjointset" n 1.0 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::disjointset \- Disjoint set data structure
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBstruct::disjointset  ?1.0?\fR
.sp
\fB::struct::disjointset\fR \fIdisjointsetName\fR
.sp
\fIdisjointsetName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIdisjointsetName\fR \fBadd-partition\fR \fIelements\fR
.sp
\fIdisjointsetName\fR \fBpartitions\fR
.sp
\fIdisjointsetName\fR \fBnum-partitions\fR
.sp
\fIdisjointsetName\fR \fBequal\fR \fIa\fR \fIb\fR
.sp
\fIdisjointsetName\fR \fBmerge\fR \fIa\fR \fIb\fR
.sp
\fIdisjointsetName\fR \fBfind\fR \fIe\fR
.sp
\fIdisjointsetName\fR \fBdestroy\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides \fIdisjoint sets\fR. An alternative name for
this kind of structure is \fImerge-find\fR.
.PP
Normally when dealing with sets and their elements the question is "Is
this element E contained in this set S?", with both E and S known.
.PP
Here the question is "Which of several sets contains the element
E?". I.e. while the element is known, the set is not, and we wish to
find it quickly. It is not quite the inverse of the original question,
but close.
Another operation which is often wanted is that of quickly merging two
sets into one, with the result still fast for finding elements. Hence
the alternative term \fImerge-find\fR for this.
.PP
Why now is this named a \fIdisjoint-set\fR ?
Because another way of describing the whole situation is that we have
.IP \(bu
a finite \fIset\fR S, containing
.IP \(bu
a number of \fIelements\fR E, split into
.IP \(bu
a set of \fIpartitions\fR P. The latter term
applies, because the intersection of each pair P, P' of
partitions is empty, with the union of all partitions
covering the whole set.
.IP \(bu
An alternative name for the \fIpartitions\fR would be
\fIequvalence classes\fR, and all elements in the same
class are considered as equal.
.PP
Here is a pictorial representation of the concepts listed above:
.CS


	+-----------------+ The outer lines are the boundaries of the set S.
	|           /     | The inner regions delineated by the skewed lines
	|  *       /   *  | are the partitions P. The *'s denote the elements
	|      *  / \\     | E in the set, each in a single partition, their
	|*       /   \\    | equivalence class.
	|       /  *  \\   |
	|      / *   /    |
	| *   /\\  * /     |
	|    /  \\  /      |
	|   /    \\/  *    |
	|  / *    \\       |
	| /     *  \\      |
	+-----------------+

.CE
.PP
For more information see \fIhttp://en.wikipedia.org/wiki/Disjoint_set_data_structure\fR.
.SH API
The package exports a single command, \fB::struct::disjointset\fR. All
functionality provided here can be reached through a subcommand of
this command.
.PP
.TP
\fB::struct::disjointset\fR \fIdisjointsetName\fR
Creates a new disjoint set object with an associated global Tcl
command whose name is \fIdisjointsetName\fR. This command may be used
to invoke various operations on the disjointset. It has the following
general form:
.RS
.TP
\fIdisjointsetName\fR \fIoption\fR ?\fIarg arg ...\fR?
The \fBoption\fR and the \fIarg\fRs determine the exact behavior of
the command. The following commands are possible for disjointset
objects:
.RE
.TP
\fIdisjointsetName\fR \fBadd-partition\fR \fIelements\fR
Creates a new partition in specified disjoint set, and fills it with
the values found in the set of \fIelements\fR. The command maintains
the integrity of the disjoint set, i.e. it verifies that none of the
\fIelements\fR are already part of the disjoint set and throws an
error otherwise.
.sp
The result of the command is the empty string.
.TP
\fIdisjointsetName\fR \fBpartitions\fR
Returns the set of partitions the named disjoint set currently
consists of.
.TP
\fIdisjointsetName\fR \fBnum-partitions\fR
Returns the number of partitions the named disjoint set currently
consists of.
.TP
\fIdisjointsetName\fR \fBequal\fR \fIa\fR \fIb\fR
Determines if the two elements \fIa\fR and \fIb\fR of the disjoint set
belong to the same partition. The result of the method is a boolean
value, \fBTrue\fR if the two elements are contained in the same
partition, and \fBFalse\fR otherwise.
.sp
An error will be thrown if either \fIa\fR or \fIb\fR are not elements
of the disjoint set.
.TP
\fIdisjointsetName\fR \fBmerge\fR \fIa\fR \fIb\fR
Determines the partitions the elements \fIa\fR and \fIb\fR are
contained in and merges them into a single partition.  If the two
elements were already contained in the same partition nothing will
change.
.sp
The result of the method is the empty string.
.TP
\fIdisjointsetName\fR \fBfind\fR \fIe\fR
Returns the partition of the disjoint set which contains the element
\fIe\fR.
.TP
\fIdisjointsetName\fR \fBdestroy\fR
Destroys the disjoint set object and all associated memory.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: disjointset\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
disjoint set, equivalence class, find, merge find, partition, partitioned set, union
.SH CATEGORY
Data structures

Added embedded/man/files/modules/struct/graph.n.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/graph.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::graph" n 2.4 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::graph \- Create and manipulate directed graph objects
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBstruct::graph  ?2.4?\fR
.sp
package require \fBstruct::list  ?1.5?\fR
.sp
package require \fBstruct::set  ?2.2.3?\fR
.sp
\fB::struct::graph\fR ?\fIgraphName\fR? ?\fB=\fR|\fB:=\fR|\fBas\fR|\fBdeserialize\fR \fIsource\fR?
.sp
\fBgraphName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIgraphName\fR \fB=\fR \fIsourcegraph\fR
.sp
\fIgraphName\fR \fB-->\fR \fIdestgraph\fR
.sp
\fIgraphName\fR \fBappend\fR \fIkey\fR \fIvalue\fR
.sp
\fIgraphName\fR \fBdeserialize\fR \fIserialization\fR
.sp
\fIgraphName\fR \fBdestroy\fR
.sp
\fIgraphName\fR \fBarc append\fR \fIarc\fR \fIkey\fR \fIvalue\fR
.sp
\fIgraphName\fR \fBarc attr\fR \fIkey\fR
.sp
\fIgraphName\fR \fBarc attr\fR \fIkey\fR \fB-arcs\fR \fIlist\fR
.sp
\fIgraphName\fR \fBarc attr\fR \fIkey\fR \fB-glob\fR \fIglobpattern\fR
.sp
\fIgraphName\fR \fBarc attr\fR \fIkey\fR \fB-regexp\fR \fIrepattern\fR
.sp
\fIgraphName\fR \fBarc delete\fR \fIarc\fR ?\fIarc\fR ...?
.sp
\fIgraphName\fR \fBarc exists\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc flip\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc get\fR \fIarc\fR \fIkey\fR
.sp
\fIgraphName\fR \fBarc getall\fR \fIarc\fR ?\fIpattern\fR?
.sp
\fIgraphName\fR \fBarc getunweighted\fR
.sp
\fIgraphName\fR \fBarc getweight\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc keys\fR \fIarc\fR ?\fIpattern\fR?
.sp
\fIgraphName\fR \fBarc keyexists\fR \fIarc\fR \fIkey\fR
.sp
\fIgraphName\fR \fBarc insert\fR \fIstart\fR \fIend\fR ?\fIchild\fR?
.sp
\fIgraphName\fR \fBarc lappend\fR \fIarc\fR \fIkey\fR \fIvalue\fR
.sp
\fIgraphName\fR \fBarc rename\fR \fIarc\fR \fInewname\fR
.sp
\fIgraphName\fR \fBarc set\fR \fIarc\fR \fIkey\fR ?\fIvalue\fR?
.sp
\fIgraphName\fR \fBarc setunweighted\fR ?\fIweight\fR?
.sp
\fIgraphName\fR \fBarc setweight\fR \fIarc\fR \fIweight\fR
.sp
\fIgraphName\fR \fBarc unsetweight\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc hasweight\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc source\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc target\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc nodes\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc move-source\fR \fIarc\fR \fInewsource\fR
.sp
\fIgraphName\fR \fBarc move-target\fR \fIarc\fR \fInewtarget\fR
.sp
\fIgraphName\fR \fBarc move\fR \fIarc\fR \fInewsource\fR \fInewtarget\fR
.sp
\fIgraphName\fR \fBarc unset\fR \fIarc\fR \fIkey\fR
.sp
\fIgraphName\fR \fBarc weights\fR
.sp
\fIgraphName\fR \fBarcs\fR ?-key \fIkey\fR? ?-value \fIvalue\fR? ?-filter \fIcmdprefix\fR? ?-in|-out|-adj|-inner|-embedding \fInode node...\fR?
.sp
\fIgraphName\fR \fBlappend\fR \fIkey\fR \fIvalue\fR
.sp
\fIgraphName\fR \fBnode append\fR \fInode\fR \fIkey\fR \fIvalue\fR
.sp
\fIgraphName\fR \fBnode attr\fR \fIkey\fR
.sp
\fIgraphName\fR \fBnode attr\fR \fIkey\fR \fB-nodes\fR \fIlist\fR
.sp
\fIgraphName\fR \fBnode attr\fR \fIkey\fR \fB-glob\fR \fIglobpattern\fR
.sp
\fIgraphName\fR \fBnode attr\fR \fIkey\fR \fB-regexp\fR \fIrepattern\fR
.sp
\fIgraphName\fR \fBnode degree\fR ?-in|-out? \fInode\fR
.sp
\fIgraphName\fR \fBnode delete\fR \fInode\fR ?\fInode\fR...?
.sp
\fIgraphName\fR \fBnode exists\fR \fInode\fR
.sp
\fIgraphName\fR \fBnode get\fR \fInode\fR \fIkey\fR
.sp
\fIgraphName\fR \fBnode getall\fR \fInode\fR ?\fIpattern\fR?
.sp
\fIgraphName\fR \fBnode keys\fR \fInode\fR ?\fIpattern\fR?
.sp
\fIgraphName\fR \fBnode keyexists\fR \fInode\fR \fIkey\fR
.sp
\fIgraphName\fR \fBnode insert\fR ?\fInode\fR...?
.sp
\fIgraphName\fR \fBnode lappend\fR \fInode\fR \fIkey\fR \fIvalue\fR
.sp
\fIgraphName\fR \fBnode opposite\fR \fInode\fR \fIarc\fR
.sp
\fIgraphName\fR \fBnode rename\fR \fInode\fR \fInewname\fR
.sp
\fIgraphName\fR \fBnode set\fR \fInode\fR \fIkey\fR ?\fIvalue\fR?
.sp
\fIgraphName\fR \fBnode unset\fR \fInode\fR \fIkey\fR
.sp
\fIgraphName\fR \fBnodes\fR ?-key \fIkey\fR? ?-value \fIvalue\fR? ?-filter \fIcmdprefix\fR? ?-in|-out|-adj|-inner|-embedding \fInode\fR \fInode\fR...?
.sp
\fIgraphName\fR \fBget\fR \fIkey\fR
.sp
\fIgraphName\fR \fBgetall\fR ?\fIpattern\fR?
.sp
\fIgraphName\fR \fBkeys\fR ?\fIpattern\fR?
.sp
\fIgraphName\fR \fBkeyexists\fR \fIkey\fR
.sp
\fIgraphName\fR \fBserialize\fR ?\fInode\fR...?
.sp
\fIgraphName\fR \fBset\fR \fIkey\fR ?\fIvalue\fR?
.sp
\fIgraphName\fR \fBswap\fR \fInode1\fR \fInode2\fR
.sp
\fIgraphName\fR \fBunset\fR \fIkey\fR
.sp
\fIgraphName\fR \fBwalk\fR \fInode\fR ?-order \fIorder\fR? ?-type \fItype\fR? ?-dir \fIdirection\fR? -command \fIcmd\fR
.sp
.BE
.SH DESCRIPTION
.PP
A directed graph is a structure containing two collections of
elements, called \fInodes\fR and \fIarcs\fR respectively, together
with a relation ("connectivity") that places a general structure upon
the nodes and arcs.
.PP
Each arc is connected to two nodes, one of which is called the
\fIsource\fR and the other the \fItarget\fR. This imposes a
direction upon the arc, which is said to go from the source to the
target. It is allowed that source and target of an arc are the same
node. Such an arc is called a \fIloop\fR.
Whenever a node is either the source or target of an arc both are said
to be \fIadjacent\fR. This extends into a relation between nodes,
i.e. if two nodes are connected through at least one arc they are said
to be \fIadjacent\fR too.
.PP
Each node can be the source and target for any number of arcs. The
former are called the \fIoutgoing arcs\fR of the node, the latter
the \fIincoming arcs\fR of the node. The number of arcs in either
set is called the \fIin-degree\fR resp. the \fIout-degree\fR of the
node.
.PP
In addition to maintaining the node and arc relationships, this graph
implementation allows any number of named \fIattributes\fR to be
associated with the graph itself, and each node or arc.
.PP
\fINote:\fR The major version of the package \fBstruct\fR has
been changed to version 2.0, due to backward incompatible changes in
the API of this module. Please read the section
\fBChanges for 2.0\fR for a full list of all changes,
incompatible and otherwise.
.PP
\fINote:\fR A C-implementation of the command can be had from the
location \fIhttp://www.purl.org/NET/schlenker/tcl/cgraph\fR. See also
\fIhttp://wiki.tcl.tk/cgraph\fR.  This implementation uses a bit less
memory than the tcl version provided here directly, and is faster. Its
support is limited to versions of the package before 2.0.
.PP
As of version 2.2 of this package a critcl based C implementation is
available from here as well. This implementation however requires Tcl
8.4 to run.
.PP
The main command of the package is:
.TP
\fB::struct::graph\fR ?\fIgraphName\fR? ?\fB=\fR|\fB:=\fR|\fBas\fR|\fBdeserialize\fR \fIsource\fR?
The command creates a new graph object with an associated global Tcl
command whose name is \fIgraphName\fR.  This command may be used to
invoke various operations on the graph.  It has the following general
form:
.RS
.TP
\fBgraphName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.RE
.sp
If \fIgraphName\fR is not specified a unique name will be generated by
the package itself. If a \fIsource\fR is specified the new graph will
be initialized to it. For the operators \fB=\fR, \fB:=\fR, and
\fBas\fR the \fIsource\fR argument is interpreted as the name of
another graph object, and the assignment operator \fB=\fR will be
executed. For the operator \fBdeserialize\fR the \fIsource\fR is a
serialized graph object and \fBdeserialize\fR will be executed.
.sp
In other words
.sp
.CS


    ::struct::graph mygraph = b

.CE
.sp
is equivalent to
.sp
.CS


    ::struct::graph mygraph
    mygraph = b

.CE
.sp
and
.sp
.CS


    ::struct::graph mygraph deserialize $b

.CE
.sp
is equivalent to
.sp
.CS


    ::struct::graph mygraph
    mygraph deserialize $b

.CE
.PP
.PP
The following commands are possible for graph objects:
.TP
\fIgraphName\fR \fB=\fR \fIsourcegraph\fR
This is the \fIassignment\fR operator for graph objects. It copies
the graph contained in the graph object \fIsourcegraph\fR over the
graph data in \fIgraphName\fR. The old contents of \fIgraphName\fR are
deleted by this operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIgraphName\fR \fBdeserialize\fR [\fIsourcegraph\fR \fBserialize\fR]

.CE
.sp
The operation assumes that the \fIsourcegraph\fR provides the method
\fBserialize\fR and that this method returns a valid graph
serialization.
.TP
\fIgraphName\fR \fB-->\fR \fIdestgraph\fR
This is the \fIreverse assignment\fR operator for graph objects. It
copies the graph contained in the graph object \fIgraphName\fR over
the graph data in the object \fIdestgraph\fR.
The old contents of \fIdestgraph\fR are deleted by this operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIdestgraph\fR \fBdeserialize\fR [\fIgraphName\fR \fBserialize\fR]

.CE
.sp
The operation assumes that the \fIdestgraph\fR provides the method
\fBdeserialize\fR and that this method takes a graph serialization.
.TP
\fIgraphName\fR \fBappend\fR \fIkey\fR \fIvalue\fR
Appends a \fIvalue\fR to one of the keyed values associated with the graph.
Returns the new value given to the attribute \fIkey\fR.
.TP
\fIgraphName\fR \fBdeserialize\fR \fIserialization\fR
This is the complement to \fBserialize\fR. It replaces the graph
data in \fIgraphName\fR with the graph described by the
\fIserialization\fR value. The old contents of \fIgraphName\fR are
deleted by this operation.
.TP
\fIgraphName\fR \fBdestroy\fR
Destroys the graph, including its storage space and associated command.
.TP
\fIgraphName\fR \fBarc append\fR \fIarc\fR \fIkey\fR \fIvalue\fR
Appends a \fIvalue\fR to one of the keyed values associated with an
\fIarc\fR. Returns the new value given to the attribute \fIkey\fR.
.TP
\fIgraphName\fR \fBarc attr\fR \fIkey\fR
.TP
\fIgraphName\fR \fBarc attr\fR \fIkey\fR \fB-arcs\fR \fIlist\fR
.TP
\fIgraphName\fR \fBarc attr\fR \fIkey\fR \fB-glob\fR \fIglobpattern\fR
.TP
\fIgraphName\fR \fBarc attr\fR \fIkey\fR \fB-regexp\fR \fIrepattern\fR
This method retrieves the value of the attribute named \fIkey\fR, for
all arcs in the graph (matching the restriction specified via one of
the possible options) and having the specified attribute.
.sp
The result is a dictionary mapping from arc names to the value of
attribute \fIkey\fR at that arc.
Arcs not having the attribute \fIkey\fR, or not passing a
specified restriction, are not listed in the result.
.sp
The possible restrictions are:
.RS
.TP
\fB-arcs\fR
The value is a list of arcs. Only the arcs mentioned in this list
are searched for the attribute.
.TP
\fB-glob\fR
The value is a glob pattern. Only the arcs in the graph whose names
match this pattern are searched for the attribute.
.TP
\fB-regexp\fR
The value is a regular expression. Only the arcs in the graph whose
names match this pattern are searched for the attribute.
.RE
.sp
.TP
\fIgraphName\fR \fBarc delete\fR \fIarc\fR ?\fIarc\fR ...?
Remove the specified arcs from the graph.
.TP
\fIgraphName\fR \fBarc exists\fR \fIarc\fR
Return true if the specified \fIarc\fR exists in the graph.
.TP
\fIgraphName\fR \fBarc flip\fR \fIarc\fR
Reverses the direction of the named \fIarc\fR, i.e. the source and
target nodes of the arc are exchanged with each other.
.TP
\fIgraphName\fR \fBarc get\fR \fIarc\fR \fIkey\fR
Returns the value associated with the key \fIkey\fR for the \fIarc\fR.
.TP
\fIgraphName\fR \fBarc getall\fR \fIarc\fR ?\fIpattern\fR?
Returns a dictionary (suitable for use with [\fBarray set\fR])
for the \fIarc\fR.
If the \fIpattern\fR is specified only the attributes whose names
match the pattern will be part of the returned dictionary. The pattern
is a \fBglob\fR pattern.
.TP
\fIgraphName\fR \fBarc getunweighted\fR
Returns a list containing the names of all arcs in the graph which
have no weight associated with them.
.TP
\fIgraphName\fR \fBarc getweight\fR \fIarc\fR
Returns the weight associated with the \fIarc\fR. Throws an error if
the arc has no weight associated with it.
.TP
\fIgraphName\fR \fBarc keys\fR \fIarc\fR ?\fIpattern\fR?
Returns a list of keys for the \fIarc\fR.
If the \fIpattern\fR is specified only the attributes whose names
match the pattern will be part of the returned list. The pattern is a
\fBglob\fR pattern.
.TP
\fIgraphName\fR \fBarc keyexists\fR \fIarc\fR \fIkey\fR
Return true if the specified \fIkey\fR exists for the \fIarc\fR.
.TP
\fIgraphName\fR \fBarc insert\fR \fIstart\fR \fIend\fR ?\fIchild\fR?
Insert an arc named \fIchild\fR into the graph beginning at the node
\fIstart\fR and ending at the node \fIend\fR. If the name of the new
arc is not specified the system will generate a unique name of the
form \fIarc\fR\fIx\fR.
.TP
\fIgraphName\fR \fBarc lappend\fR \fIarc\fR \fIkey\fR \fIvalue\fR
Appends a \fIvalue\fR (as a list) to one of the keyed values
associated with an \fIarc\fR. Returns the new value given to the
attribute \fIkey\fR.
.TP
\fIgraphName\fR \fBarc rename\fR \fIarc\fR \fInewname\fR
Renames the arc \fIarc\fR to \fInewname\fR. An error is thrown if
either the arc does not exist, or a arc with name \fInewname\fR does
exist. The result of the command is the new name of the arc.
.TP
\fIgraphName\fR \fBarc set\fR \fIarc\fR \fIkey\fR ?\fIvalue\fR?
Set or get one of the keyed values associated with an arc.
An arc may have any number of keyed values associated with it.
If \fIvalue\fR is not specified, this command returns the current value assigned to the key;
if \fIvalue\fR is specified, this command assigns that value to the key, and returns
that value.
.TP
\fIgraphName\fR \fBarc setunweighted\fR ?\fIweight\fR?
Sets the weight of all arcs without a weight to \fIweight\fR. Returns
the empty string as its result. If not present \fIweight\fR defaults
to \fB0\fR.
.TP
\fIgraphName\fR \fBarc setweight\fR \fIarc\fR \fIweight\fR
Sets the weight of the \fIarc\fR to \fIweight\fR. Returns \fIweight\fR.
.TP
\fIgraphName\fR \fBarc unsetweight\fR \fIarc\fR
Removes the weight of the \fIarc\fR, if present. Does nothing
otherwise. Returns the empty string.
.TP
\fIgraphName\fR \fBarc hasweight\fR \fIarc\fR
Determines if the \fIarc\fR has a weight associated with it.  The
result is a boolean value, \fBTrue\fR if a weight is defined, and
\fBFalse\fR otherwise.
.TP
\fIgraphName\fR \fBarc source\fR \fIarc\fR
Return the node the given \fIarc\fR begins at.
.TP
\fIgraphName\fR \fBarc target\fR \fIarc\fR
Return the node the given \fIarc\fR ends at.
.TP
\fIgraphName\fR \fBarc nodes\fR \fIarc\fR
Return the nodes the given \fIarc\fR begins and ends at,
as a two-element list.
.TP
\fIgraphName\fR \fBarc move-source\fR \fIarc\fR \fInewsource\fR
Changes the source node of the arc to \fInewsource\fR. It can be said
that the arc rotates around its target node.
.TP
\fIgraphName\fR \fBarc move-target\fR \fIarc\fR \fInewtarget\fR
Changes the target node of the arc to \fInewtarget\fR. It can be said
that the arc rotates around its source node.
.TP
\fIgraphName\fR \fBarc move\fR \fIarc\fR \fInewsource\fR \fInewtarget\fR
Changes both source and target nodes of the arc to \fInewsource\fR,
and \fInewtarget\fR resp.
.TP
\fIgraphName\fR \fBarc unset\fR \fIarc\fR \fIkey\fR
Remove a keyed value from the arc \fIarc\fR. The method will do
nothing if the \fIkey\fR does not exist.
.TP
\fIgraphName\fR \fBarc weights\fR
Returns a dictionary whose keys are the names of all arcs which have a
weight associated with them, and the values are these weights.
.TP
\fIgraphName\fR \fBarcs\fR ?-key \fIkey\fR? ?-value \fIvalue\fR? ?-filter \fIcmdprefix\fR? ?-in|-out|-adj|-inner|-embedding \fInode node...\fR?
Returns a list of arcs in the graph. If no restriction is specified a
list containing all arcs is returned. Restrictions can limit the list
of returned arcs based on the nodes that are connected by the arc, on
the keyed values associated with the arc, or both. A general filter
command can be used as well. The restrictions that involve connected
nodes take a variable number of nodes as argument, specified after the
name of the restriction itself.
.sp
The restrictions imposed by either \fB-in\fR, \fB-out\fR,
\fB-adj\fR, \fB-inner\fR, or \fB-embedded\fR are applied
first. Specifying more than one of them is illegal.
.sp
After that the restrictions set via \fB-key\fR (and
\fB-value\fR) are applied. Specifying more than one \fB-key\fR
(and \fB-value\fR) is illegal. Specifying \fB-value\fR alone,
without \fB-key\fR is illegal as well.
.sp
Any restriction set through \fB-filter\fR is applied
last. Specifying more than one \fB-filter\fR is illegal.
.sp
Coming back to the restrictions based on a set of nodes, the command
recognizes the following switches:
.RS
.TP
\fB-in\fR
Return a list of all arcs whose target is one of the nodes in the set
of nodes. I.e. it computes the union of all incoming arcs of the nodes
in the set.
.TP
\fB-out\fR
Return a list of all arcs whose source is one of the nodes in the set
of nodes. I.e. it computes the union of all outgoing arcs of the nodes
in the set.
.TP
\fB-adj\fR
Return a list of all arcs adjacent to at least one of the nodes in the
set. This is the union of the nodes returned by \fB-in\fR and
\fB-out\fR.
.TP
\fB-inner\fR
Return a list of all arcs which are adjacent to two of the nodes in
the set. This is the set of arcs in the subgraph spawned by the
specified nodes.
.TP
\fB-embedding\fR
Return a list of all arcs adjacent to exactly one of the nodes in the
set. This is the set of arcs connecting the subgraph spawned by the
specified nodes to the rest of the graph.
.TP
\fB-key\fR \fIkey\fR
Limit the list of arcs that are returned to those arcs that have an
associated key \fIkey\fR.
.TP
\fB-value\fR \fIvalue\fR
This restriction can only be used in combination with
\fB-key\fR. It limits the list of arcs that are returned to those
arcs whose associated key \fIkey\fR has the value \fIvalue\fR.
.TP
\fB-filter\fR \fIcmdrefix\fR
Limit the list of arcs that are returned to those arcs that pass the
test. The command in \fIcmdprefix\fR is called with two arguments, the
name of the graph object, and the name of the arc in question. It is
executed in the context of the caller and has to return a boolean
value. Arcs for which the command returns \fBfalse\fR are removed
from the result list before it is returned to the caller.
.RE
.TP
\fIgraphName\fR \fBlappend\fR \fIkey\fR \fIvalue\fR
Appends a \fIvalue\fR (as a list) to one of the keyed values
associated with the graph. Returns the new value given to the
attribute \fIkey\fR.
.TP
\fIgraphName\fR \fBnode append\fR \fInode\fR \fIkey\fR \fIvalue\fR
Appends a \fIvalue\fR to one of the keyed values associated with an
\fInode\fR. Returns the new value given to the attribute \fIkey\fR.
.TP
\fIgraphName\fR \fBnode attr\fR \fIkey\fR
.TP
\fIgraphName\fR \fBnode attr\fR \fIkey\fR \fB-nodes\fR \fIlist\fR
.TP
\fIgraphName\fR \fBnode attr\fR \fIkey\fR \fB-glob\fR \fIglobpattern\fR
.TP
\fIgraphName\fR \fBnode attr\fR \fIkey\fR \fB-regexp\fR \fIrepattern\fR
This method retrieves the value of the attribute named \fIkey\fR, for
all nodes in the graph (matching the restriction specified via one of
the possible options) and having the specified attribute.
.sp
The result is a dictionary mapping from node names to the value of
attribute \fIkey\fR at that node.
Nodes not having the attribute \fIkey\fR, or not passing a
specified restriction, are not listed in the result.
.sp
The possible restrictions are:
.RS
.TP
\fB-nodes\fR
The value is a list of nodes. Only the nodes mentioned in this list
are searched for the attribute.
.TP
\fB-glob\fR
The value is a glob pattern. Only the nodes in the graph whose names
match this pattern are searched for the attribute.
.TP
\fB-regexp\fR
The value is a regular expression. Only the nodes in the graph whose
names match this pattern are searched for the attribute.
.RE
.sp
.TP
\fIgraphName\fR \fBnode degree\fR ?-in|-out? \fInode\fR
Return the number of arcs adjacent to the specified \fInode\fR. If one
of the restrictions \fB-in\fR or \fB-out\fR is given only the
incoming resp. outgoing arcs are counted.
.TP
\fIgraphName\fR \fBnode delete\fR \fInode\fR ?\fInode\fR...?
Remove the specified nodes from the graph.  All of the nodes' arcs
will be removed as well to prevent unconnected arcs.
.TP
\fIgraphName\fR \fBnode exists\fR \fInode\fR
Return true if the specified \fInode\fR exists in the graph.
.TP
\fIgraphName\fR \fBnode get\fR \fInode\fR \fIkey\fR
Return the value associated with the key \fIkey\fR for the \fInode\fR.
.TP
\fIgraphName\fR \fBnode getall\fR \fInode\fR ?\fIpattern\fR?
Returns a dictionary (suitable for use with [\fBarray set\fR])
for the \fInode\fR.
If the \fIpattern\fR is specified only the attributes whose names
match the pattern will be part of the returned dictionary. The pattern
is a \fBglob\fR pattern.
.TP
\fIgraphName\fR \fBnode keys\fR \fInode\fR ?\fIpattern\fR?
Returns a list of keys for the \fInode\fR.
If the \fIpattern\fR is specified only the attributes whose names
match the pattern will be part of the returned list. The pattern is a
\fBglob\fR pattern.
.TP
\fIgraphName\fR \fBnode keyexists\fR \fInode\fR \fIkey\fR
Return true if the specified \fIkey\fR exists for the \fInode\fR.
.TP
\fIgraphName\fR \fBnode insert\fR ?\fInode\fR...?
Insert one or more nodes into the graph. The new nodes have no arcs
connected to them. If no node is specified one node will be inserted,
and the system will generate a unique name of the form
\fInode\fR\fIx\fR for it.
.TP
\fIgraphName\fR \fBnode lappend\fR \fInode\fR \fIkey\fR \fIvalue\fR
Appends a \fIvalue\fR (as a list) to one of the keyed values
associated with an \fInode\fR. Returns the new value given to the
attribute \fIkey\fR.
.TP
\fIgraphName\fR \fBnode opposite\fR \fInode\fR \fIarc\fR
Return the node at the other end of the specified \fIarc\fR, which has
to be adjacent to the given \fInode\fR.
.TP
\fIgraphName\fR \fBnode rename\fR \fInode\fR \fInewname\fR
Renames the node \fInode\fR to \fInewname\fR. An error is thrown if
either the node does not exist, or a node with name \fInewname\fR does
exist. The result of the command is the new name of the node.
.TP
\fIgraphName\fR \fBnode set\fR \fInode\fR \fIkey\fR ?\fIvalue\fR?
Set or get one of the keyed values associated with a node. A node may have any
number of keyed values associated with it.  If \fIvalue\fR is not
specified, this command returns the current value assigned to the key;
if \fIvalue\fR is specified, this command assigns that value to the
key.
.TP
\fIgraphName\fR \fBnode unset\fR \fInode\fR \fIkey\fR
Remove a keyed value from the node \fInode\fR. The method will do
nothing if the \fIkey\fR does not exist.
.TP
\fIgraphName\fR \fBnodes\fR ?-key \fIkey\fR? ?-value \fIvalue\fR? ?-filter \fIcmdprefix\fR? ?-in|-out|-adj|-inner|-embedding \fInode\fR \fInode\fR...?
Return a list of nodes in the graph. Restrictions can limit the list
of returned nodes based on neighboring nodes, or based on the keyed
values associated with the node. The restrictions that involve
neighboring nodes have a list of nodes as argument, specified after
the name of the restriction itself.
.sp
The possible restrictions are the same as for method
\fBarcs\fR. The exact meanings change slightly, as they operate on
nodes instead of arcs. The command recognizes:
.RS
.TP
\fB-in\fR
Return a list of all nodes with at least one outgoing arc ending in a
node found in the specified set of nodes. Alternatively specified as
the set of source nodes for the \fB-in\fR arcs of the node set. The
\fIincoming neighbours\fR.
.TP
\fB-out\fR
Return a list of all nodes with at least one incoming arc starting in
a node found in the specified set of nodes. Alternatively specified as
the set of target nodes for the \fB-out\fR arcs of the node
set. The \fIoutgoing neighbours\fR.
.TP
\fB-adj\fR
This is the union of the nodes returned by \fB-in\fR and
\fB-out\fR. The \fIneighbours\fR.
.TP
\fB-inner\fR
The set of neighbours (see \fB-adj\fR above) which are also in the
set of nodes. I.e. the intersection between the set of nodes and the
neighbours per \fB-adj\fR.
.TP
\fB-embedding\fR
The set of neighbours (see \fB-adj\fR above) which are not in the
set of nodes. I.e. the difference between the neighbours as per
\fB-adj\fR, and the set of nodes.
.TP
\fB-key\fR \fIkey\fR
Limit the list of nodes that are returned to those nodes that have an
associated key \fIkey\fR.
.TP
\fB-value\fR \fIvalue\fR
This restriction can only be used in combination with
\fB-key\fR. It limits the list of nodes that are returned to those
nodes whose associated key \fIkey\fR has the value \fIvalue\fR.
.TP
\fB-filter\fR \fIcmdrefix\fR
Limit the list of nodes that are returned to those nodes that pass the
test. The command in \fIcmdprefix\fR is called with two arguments, the
name of the graph object, and the name of the node in question. It is
executed in the context of the caller and has to return a boolean
value. Nodes for which the command returns \fBfalse\fR are removed
from the result list before it is returned to the caller.
.RE
.TP
\fIgraphName\fR \fBget\fR \fIkey\fR
Return the value associated with the key \fIkey\fR for the graph.
.TP
\fIgraphName\fR \fBgetall\fR ?\fIpattern\fR?
Returns a dictionary (suitable for use with [\fBarray set\fR])
for the whole graph.
If the \fIpattern\fR is specified only the attributes whose names
match the pattern will be part of the returned dictionary. The pattern
is a \fBglob\fR pattern.
.TP
\fIgraphName\fR \fBkeys\fR ?\fIpattern\fR?
Returns a list of keys for the whole graph.
If the \fIpattern\fR is specified only the attributes whose names
match the pattern will be part of the returned list. The pattern is a
\fBglob\fR pattern.
.TP
\fIgraphName\fR \fBkeyexists\fR \fIkey\fR
Return true if the specified \fIkey\fR exists for the whole graph.
.TP
\fIgraphName\fR \fBserialize\fR ?\fInode\fR...?
This method serializes the sub-graph spanned up by the \fInode\fRs. In
other words it returns a tcl value completely describing that
graph. If no nodes are specified the whole graph will be serialized.
This allows, for example, the transfer of graph objects (or parts
thereof) over arbitrary channels, persistence, etc.
This method is also the basis for both the copy constructor and
the assignment operator.
.sp
The result of this method has to be semantically identical over all
implementations of the graph interface. This is what will enable us to
copy graph data between different implementations of the same
interface.
.sp
The result is a list containing a multiple of three items, plus one!
In other words, '[llength $serial] % 3 == 1'. Valid values
include 1, 4, 7, ...
.sp
The last element of the list is a dictionary containing the attributes
associated with the whole graph.
Regarding the other elements; each triple consists of
.RS
.IP [1]
The name of the node to be described,
.IP [2]
A dictionary containing the attributes associated with the node,
.IP [3]
And a list describing all the arcs starting at that node.
.RE
.sp
The elements of the arc list are lists containing three or four
elements each, i.e.
.RS
.IP [1]
The name of the arc described by the element,
.IP [2]
A reference to the destination node of the arc. This reference is an
integer number given the index of that node in the main serialization
list. As that it is greater than or equal to zero, less than the
length of the serialization, and a multiple of three.
\fINote:\fR For internal consistency no arc name may be used twice,
whether in the same node, or at some other node. This is a global
consistency requirement for the serialization.
.IP [3]
And a dictionary containing the attributes associated with the arc.
.IP [4]
The weight associated with the arc. This value is optional. Its
non-presence means that the arc in question has no weight associated
with it.
.sp
\fINote:\fR This information is new, compared to the
serialization of \fBgraph\fR 2.3 and earlier. By making it an
optional element the new format is maximally compatible with the
old. This means that any graph not using weights will generate a
serialization which is still understood by the older graph package. A
serialization will not be understood any longer by the older packages
if, and only if the graph it was generated from actually has arcs with
weights.
.RE
.sp
For all attribute dictionaries they keys are the names of the
attributes, and the values are the values for each name.
.sp
\fINote:\fR The order of the nodes in the serialization has no
relevance, nor has the order of the arcs per node.
.CS


    # A possible serialization for the graph structure
    #
    #        d -----> %2
    #       /         ^ \\\\
    #      /         /   \\\\
    #     /         b     \\\\
    #    /         /       \\\\
    #  %1 <- a - %0         e
    #    ^         \\\\      /
    #     \\\\        c     /
    #      \\\\        \\\\  /
    #       \\\\        v v
    #        f ------ %3
    # is
    #
    # %3 {} {{f 6 {}}} %0 {} {{a 6 {}} {b 9 {}} {c 0 {}}} %1 {} {{d 9 {}}} %2 {} {{e 0 {}}} {}
    #
    # This assumes that the graph has neither attribute data nor weighted arcs.

.CE
.sp
.TP
\fIgraphName\fR \fBset\fR \fIkey\fR ?\fIvalue\fR?
Set or get one of the keyed values associated with a graph. A graph
may have any number of keyed values associated with it. If \fIvalue\fR
is not specified, this command returns the current value assigned to
the key; if \fIvalue\fR is specified, this command assigns that value
to the key.
.TP
\fIgraphName\fR \fBswap\fR \fInode1\fR \fInode2\fR
Swap the position of \fInode1\fR and \fInode2\fR in the graph.
.TP
\fIgraphName\fR \fBunset\fR \fIkey\fR
Remove a keyed value from the graph. The method will do nothing if the
\fIkey\fR does not exist.
.TP
\fIgraphName\fR \fBwalk\fR \fInode\fR ?-order \fIorder\fR? ?-type \fItype\fR? ?-dir \fIdirection\fR? -command \fIcmd\fR
Perform a breadth-first or depth-first walk of the graph starting at
the node \fInode\fR going in either the direction of outgoing or
opposite to the incoming arcs.
.sp
The type of walk, breadth-first or depth-first, is determined by the
value of \fItype\fR; \fBbfs\fR indicates breadth-first,
\fBdfs\fR indicates depth-first.  Depth-first is the default.
.sp
The order of the walk, pre-order, post-order or both-order is
determined by the value of \fIorder\fR; \fBpre\fR indicates
pre-order, \fBpost\fR indicates post-order, \fBboth\fR indicates
both-order. Pre-order is the default. Pre-order walking means that a
node is visited before any of its neighbors (as defined by the
\fIdirection\fR, see below). Post-order walking means that a parent is
visited after any of its neighbors. Both-order walking means that a
node is visited before \fIand\fR after any of its neighbors. The
combination of a breadth-first walk with post- or both-order is illegal.
.sp
The direction of the walk is determined by the value of \fIdir\fR;
\fBbackward\fR indicates the direction opposite to the incoming
arcs, \fBforward\fR indicates the direction of the outgoing arcs.
.sp
As the walk progresses, the command \fIcmd\fR will be evaluated at
each node, with the mode of the call (\fBenter\fR or
\fBleave\fR) and values \fIgraphName\fR and the name of the current
node appended. For a pre-order walk, all nodes are \fBenter\fRed, for a
post-order all nodes are left. In a both-order walk the first visit of
a node \fBenter\fRs it, the second visit \fBleave\fRs it.
.PP
.SH "CHANGES FOR 2.0"
The following noteworthy changes have occurred:
.IP [1]
The API for accessing attributes and their values has been
simplified.
.sp
All functionality regarding the default attribute "data" has been
removed. This default attribute does not exist anymore. All accesses
to attributes have to specify the name of the attribute in
question. This backward \fIincompatible\fR change allowed us to
simplify the signature of all methods handling attributes.
.sp
Especially the flag \fB-key\fR is not required anymore, even more,
its use is now forbidden. Please read the documentation for the arc
and node methods \fBset\fR, \fBget\fR, \fBgetall\fR,
\fBunset\fR, \fBappend\fR, \fBlappend\fR, \fBkeyexists\fR
and \fBkeys\fR for a description of the new API's.
.IP [2]
The methods \fBkeys\fR and \fBgetall\fR now take an optional
pattern argument and will return only attribute data for keys matching
this pattern.
.IP [3]
Arcs and nodes can now be renamed. See the documentation for the
methods \fBarc rename\fR and \fBnode rename\fR.
.IP [4]
The structure has been extended with API's for the serialization and
deserialization of graph objects, and a number of operations based on
them (graph assignment, copy construction).
.sp
Please read the documentation for the methods \fBserialize\fR,
\fBdeserialize\fR, \fB=\fR, and \fB-->\fR, and the
documentation on the construction of graph objects.
.sp
Beyond the copying of whole graph objects these new API's also enable
the transfer of graph objects over arbitrary channels and for easy
persistence.
.IP [5]
A new method, \fBattr\fR, was added to both \fBarc\fR and
\fBnode\fR allowing the query and retrieval of attribute data
without regard to arc and node relationships.
.IP [6]
Both methods \fBarcs\fR and \fBnodes\fR have been extended with
the ability to select arcs and nodes based on an arbitrary filtering
criterium.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: graph\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
adjacent, arc, cgraph, degree, edge, graph, loop, neighbour, node, serialization, subgraph, vertex
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/struct/graph1.n.













































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/graph1.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::graph_v1" n 1.2.1 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::graph_v1 \- Create and manipulate directed graph objects
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::graph  ?1.2.1?\fR
.sp
\fBgraphName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIgraphName\fR \fBdestroy\fR
.sp
\fIgraphName\fR \fBarc append\fR \fIarc\fR ?-key \fIkey\fR? \fIvalue\fR
.sp
\fIgraphName\fR \fBarc delete\fR \fIarc\fR ?\fIarc\fR ...?
.sp
\fIgraphName\fR \fBarc exists\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc get\fR \fIarc\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBarc getall\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc keys\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc keyexists\fR \fIarc\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBarc insert\fR \fIstart\fR \fIend\fR ?\fIchild\fR?
.sp
\fIgraphName\fR \fBarc lappend\fR \fIarc\fR ?-key \fIkey\fR? \fIvalue\fR
.sp
\fIgraphName\fR \fBarc set\fR \fIarc\fR ?-key \fIkey\fR? ?\fIvalue\fR?
.sp
\fIgraphName\fR \fBarc source\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc target\fR \fIarc\fR
.sp
\fIgraphName\fR \fBarc unset\fR \fIarc\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBarcs\fR ?-key \fIkey\fR? ?-value \fIvalue\fR? ?-in|-out|-adj|-inner|-embedding \fInodelist\fR?
.sp
\fIgraphName\fR \fBnode append\fR \fInode\fR ?-key \fIkey\fR? \fIvalue\fR
.sp
\fIgraphName\fR \fBnode degree\fR ?-in|-out? \fInode\fR
.sp
\fIgraphName\fR \fBnode delete\fR \fInode\fR ?\fInode\fR ...?
.sp
\fIgraphName\fR \fBnode exists\fR \fInode\fR
.sp
\fIgraphName\fR \fBnode get\fR \fInode\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBnode getall\fR \fInode\fR
.sp
\fIgraphName\fR \fBnode keys\fR \fInode\fR
.sp
\fIgraphName\fR \fBnode keyexists\fR \fInode\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBnode insert\fR ?\fIchild\fR?
.sp
\fIgraphName\fR \fBnode lappend\fR \fInode\fR ?-key \fIkey\fR? \fIvalue\fR
.sp
\fIgraphName\fR \fBnode opposite\fR \fInode\fR \fIarc\fR
.sp
\fIgraphName\fR \fBnode set\fR \fInode\fR ?-key \fIkey\fR? ?\fIvalue\fR?
.sp
\fIgraphName\fR \fBnode unset\fR \fInode\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBnodes\fR ?-key \fIkey\fR? ?-value \fIvalue\fR? ?-in|-out|-adj|-inner|-embedding \fInodelist\fR?
.sp
\fIgraphName\fR \fBget\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBgetall\fR
.sp
\fIgraphName\fR \fBkeys\fR
.sp
\fIgraphName\fR \fBkeyexists\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBset\fR ?-key \fIkey\fR? ?\fIvalue\fR?
.sp
\fIgraphName\fR \fBswap\fR \fInode1\fR \fInode2\fR
.sp
\fIgraphName\fR \fBunset\fR ?-key \fIkey\fR?
.sp
\fIgraphName\fR \fBwalk\fR \fInode\fR ?-order \fIorder\fR? ?-type \fItype\fR? ?-dir \fIdirection\fR? -command \fIcmd\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fB::struct::graph\fR command creates a new graph object with an
associated global Tcl command whose name is \fIgraphName\fR.  This
command may be used to invoke various operations on the graph.  It has
the following general form:
.TP
\fBgraphName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.PP
.PP
A directed graph is a structure containing two collections of
elements, called \fInodes\fR and \fIarcs\fR respectively, together
with a relation ("connectivity") that places a general structure upon
the nodes and arcs.
.PP
Each arc is connected to two nodes, one of which is called the
\fIsource\fR and the other the \fItarget\fR. This imposes a
direction upon the arc, which is said to go from the source to the
target. It is allowed that source and target of an arc are the same
node. Such an arc is called a \fIloop\fR. Whenever a node is source
or target of an arc both are said to be \fIadjacent\fR. This extends
into a relation between nodes, i.e. if two nodes are connected through
at least one arc they are said to be \fIadjacent\fR too.
.PP
Each node can be the source and target for any number of arcs. The
former are called the \fIoutgoing arcs\fR of the node, the latter
the \fIincoming arcs\fR of the node. The number of edges in either
set is called the \fIin-\fR resp. the \fIout-degree\fR of the node.
.PP
In addition to maintaining the node and arc relationships, this graph
implementation allows any number of keyed values to be associated with
each node and arc.
.PP
The following commands are possible for graph objects:
.TP
\fIgraphName\fR \fBdestroy\fR
Destroy the graph, including its storage space and associated command.
.TP
\fIgraphName\fR \fBarc append\fR \fIarc\fR ?-key \fIkey\fR? \fIvalue\fR
Appends a \fIvalue\fR to one of the keyed values associated with an
\fIarc\fR. If no \fIkey\fR is specified, the key \fBdata\fR is
assumed.
.TP
\fIgraphName\fR \fBarc delete\fR \fIarc\fR ?\fIarc\fR ...?
Remove the specified arcs from the graph.
.TP
\fIgraphName\fR \fBarc exists\fR \fIarc\fR
Return true if the specified \fIarc\fR exists in the graph.
.TP
\fIgraphName\fR \fBarc get\fR \fIarc\fR ?-key \fIkey\fR?
Return the value associated with the key \fIkey\fR for the \fIarc\fR.
If no key is specified, the key \fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBarc getall\fR \fIarc\fR
Returns a serialized list of key/value pairs (suitable for use with
[\fBarray set\fR]) for the \fIarc\fR.
.TP
\fIgraphName\fR \fBarc keys\fR \fIarc\fR
Returns a list of keys for the \fIarc\fR.
.TP
\fIgraphName\fR \fBarc keyexists\fR \fIarc\fR ?-key \fIkey\fR?
Return true if the specified \fIkey\fR exists for the \fIarc\fR. If no
\fIkey\fR is specified, the key \fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBarc insert\fR \fIstart\fR \fIend\fR ?\fIchild\fR?
Insert an arc named \fIchild\fR into the graph beginning at the node
\fIstart\fR and ending at the node \fIend\fR. If the name of the new
arc is not specified the system will generate a unique name of the
form \fIarc\fR\fIx\fR.
.TP
\fIgraphName\fR \fBarc lappend\fR \fIarc\fR ?-key \fIkey\fR? \fIvalue\fR
Appends a \fIvalue\fR (as a list) to one of the keyed values
associated with an \fIarc\fR.  If no \fIkey\fR is specified, the key
\fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBarc set\fR \fIarc\fR ?-key \fIkey\fR? ?\fIvalue\fR?
Set or get one of the keyed values associated with an arc.  If no key
is specified, the key \fBdata\fR is assumed.  Each arc that is
added to a graph has the empty string assigned to the key
\fBdata\fR automatically.  An arc may have any number of keyed
values associated with it.  If \fIvalue\fR is not specified, this
command returns the current value assigned to the key; if \fIvalue\fR
is specified, this command assigns that value to the key.
.TP
\fIgraphName\fR \fBarc source\fR \fIarc\fR
Return the node the given \fIarc\fR begins at.
.TP
\fIgraphName\fR \fBarc target\fR \fIarc\fR
Return the node the given \fIarc\fR ends at.
.TP
\fIgraphName\fR \fBarc unset\fR \fIarc\fR ?-key \fIkey\fR?
Remove a keyed value from the arc \fIarc\fR.  If no key is specified,
the key \fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBarcs\fR ?-key \fIkey\fR? ?-value \fIvalue\fR? ?-in|-out|-adj|-inner|-embedding \fInodelist\fR?
Return a list of arcs in the graph. If no restriction is specified a
list containing all arcs is returned. Restrictions can limit the list
of returned arcs based on the nodes that are connected by the arc, on
the keyed values associated with the arc, or both. The restrictions
that involve connected nodes have a list of nodes as argument,
specified after the name of the restriction itself.
.RS
.TP
\fB-in\fR
Return a list of all arcs whose target is one of the nodes in the
\fInodelist\fR.
.TP
\fB-out\fR
Return a list of all arcs whose source is one of the nodes in the
\fInodelist\fR.
.TP
\fB-adj\fR
Return a list of all arcs adjacent to at least one of the nodes in the
\fInodelist\fR. This is the union of the nodes returned by
\fB-in\fR and \fB-out\fR.
.TP
\fB-inner\fR
Return a list of all arcs adjacent to two of the nodes in the
\fInodelist\fR. This is the set of arcs in the subgraph spawned by the
specified nodes.
.TP
\fB-embedding\fR
Return a list of all arcs adjacent to exactly one of the nodes in the
\fInodelist\fR. This is the set of arcs connecting the subgraph
spawned by the specified nodes to the rest of the graph.
.TP
\fB-key\fR \fIkey\fR
Limit the list of arcs that are returned to those arcs that have an
associated key \fIkey\fR.
.TP
\fB-value\fR \fIvalue\fR
This restriction can only be used in combination with
\fB-key\fR. It limits the list of arcs that are returned to those
arcs whose associated key \fIkey\fR has the value \fIvalue\fR.
.RE
.sp
The restrictions imposed by either \fB-in\fR, \fB-out\fR,
\fB-adj\fR, \fB-inner\fR, or \fB-embedded\fR are applied
first. Specifying more than one of them is illegal.
At last the restrictions set via \fB-key\fR (and \fB-value\fR)
are applied.
Specifying more than one \fB-key\fR (and \fB-value\fR) is
illegal.
.TP
\fIgraphName\fR \fBnode append\fR \fInode\fR ?-key \fIkey\fR? \fIvalue\fR
Appends a \fIvalue\fR to one of the keyed values associated with an
\fInode\fR. If no \fIkey\fR is specified, the key \fBdata\fR is
assumed.
.TP
\fIgraphName\fR \fBnode degree\fR ?-in|-out? \fInode\fR
Return the number of arcs adjacent to the specified \fInode\fR. If one
of the restrictions \fB-in\fR or \fB-out\fR is given only the
incoming resp. outgoing arcs are counted.
.TP
\fIgraphName\fR \fBnode delete\fR \fInode\fR ?\fInode\fR ...?
Remove the specified nodes from the graph.  All of the nodes' arcs
will be removed as well to prevent unconnected arcs.
.TP
\fIgraphName\fR \fBnode exists\fR \fInode\fR
Return true if the specified \fInode\fR exists in the graph.
.TP
\fIgraphName\fR \fBnode get\fR \fInode\fR ?-key \fIkey\fR?
Return the value associated with the key \fIkey\fR for the \fInode\fR.
If no key is specified, the key \fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBnode getall\fR \fInode\fR
Returns a serialized list of key/value pairs (suitable for use with
[\fBarray set\fR]) for the \fInode\fR.
.TP
\fIgraphName\fR \fBnode keys\fR \fInode\fR
Returns a list of keys for the \fInode\fR.
.TP
\fIgraphName\fR \fBnode keyexists\fR \fInode\fR ?-key \fIkey\fR?
Return true if the specified \fIkey\fR exists for the \fInode\fR. If
no \fIkey\fR is specified, the key \fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBnode insert\fR ?\fIchild\fR?
Insert a node named \fIchild\fR into the graph. The nodes has no arcs
connected to it. If the name of the new child is not specified the
system will generate a unique name of the form \fInode\fR\fIx\fR.
.TP
\fIgraphName\fR \fBnode lappend\fR \fInode\fR ?-key \fIkey\fR? \fIvalue\fR
Appends a \fIvalue\fR (as a list) to one of the keyed values
associated with an \fInode\fR. If no \fIkey\fR is specified, the key
\fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBnode opposite\fR \fInode\fR \fIarc\fR
Return the node at the other end of the specified \fIarc\fR, which has
to be adjacent to the given \fInode\fR.
.TP
\fIgraphName\fR \fBnode set\fR \fInode\fR ?-key \fIkey\fR? ?\fIvalue\fR?
Set or get one of the keyed values associated with a node.  If no key
is specified, the key \fBdata\fR is assumed.  Each node that is
added to a graph has the empty string assigned to the key
\fBdata\fR automatically.  A node may have any number of keyed
values associated with it.  If \fIvalue\fR is not specified, this
command returns the current value assigned to the key; if \fIvalue\fR
is specified, this command assigns that value to the key.
.TP
\fIgraphName\fR \fBnode unset\fR \fInode\fR ?-key \fIkey\fR?
Remove a keyed value from the node \fInode\fR.  If no key is
specified, the key \fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBnodes\fR ?-key \fIkey\fR? ?-value \fIvalue\fR? ?-in|-out|-adj|-inner|-embedding \fInodelist\fR?
Return a list of nodes in the graph. Restrictions can limit the list
of returned nodes based on neighboring nodes, or based on the keyed
values associated with the node. The restrictions that involve
neighboring nodes have a list of nodes as argument, specified after
the name of the restriction itself.
.sp
The possible restrictions are the same as for method
\fBarcs\fR. The set of nodes to return is computed as the union of
all source and target nodes for all the arcs satisfying the
restriction as defined for \fBarcs\fR.
.TP
\fIgraphName\fR \fBget\fR ?-key \fIkey\fR?
Return the value associated with the key \fIkey\fR for the graph. If
no key is specified, the key \fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBgetall\fR
Returns a serialized list of key/value pairs (suitable for use with
[\fBarray set\fR]) for the whole graph.
.TP
\fIgraphName\fR \fBkeys\fR
Returns a list of keys for the whole graph.
.TP
\fIgraphName\fR \fBkeyexists\fR ?-key \fIkey\fR?
Return true if the specified \fIkey\fR exists for the whole graph. If no
\fIkey\fR is specified, the key \fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBset\fR ?-key \fIkey\fR? ?\fIvalue\fR?
Set or get one of the keyed values associated with a graph. If no key
is specified, the key \fBdata\fR is assumed. Each graph has the
empty string assigned to the key \fBdata\fR automatically. A graph
may have any number of keyed values associated with it. If \fIvalue\fR
is not specified, this command returns the current value assigned to
the key; if \fIvalue\fR is specified, this command assigns that value
to the key.
.TP
\fIgraphName\fR \fBswap\fR \fInode1\fR \fInode2\fR
Swap the position of \fInode1\fR and \fInode2\fR in the graph.
.TP
\fIgraphName\fR \fBunset\fR ?-key \fIkey\fR?
Remove a keyed value from the graph. If no key is specified, the key
\fBdata\fR is assumed.
.TP
\fIgraphName\fR \fBwalk\fR \fInode\fR ?-order \fIorder\fR? ?-type \fItype\fR? ?-dir \fIdirection\fR? -command \fIcmd\fR
Perform a breadth-first or depth-first walk of the graph starting at
the node \fInode\fR going in either the direction of outgoing or
opposite to the incoming arcs.
.sp
The type of walk, breadth-first or depth-first, is determined by the
value of \fItype\fR; \fBbfs\fR indicates breadth-first,
\fBdfs\fR indicates depth-first.  Depth-first is the default.
.sp
The order of the walk, pre-order, post-order or both-order is
determined by the value of \fIorder\fR; \fBpre\fR indicates
pre-order, \fBpost\fR indicates post-order, \fBboth\fR indicates
both-order. Pre-order is the default. Pre-order walking means that a
node is visited before any of its neighbors (as defined by the
\fIdirection\fR, see below). Post-order walking means that a parent is
visited after any of its neighbors. Both-order walking means that a
node is visited before \fIand\fR after any of its neighbors. The
combination of a bread-first walk with post- or both-order is illegal.
.sp
The direction of the walk is determined by the value of \fIdir\fR;
\fBbackward\fR indicates the direction opposite to the incoming
arcs, \fBforward\fR indicates the direction of the outgoing arcs.
.sp
As the walk progresses, the command \fIcmd\fR will be evaluated at
each node, with the mode of the call (\fBenter\fR or
\fBleave\fR) and values \fIgraphName\fR and the name of the current
node appended. For a pre-order walk, all nodes are \fBenter\fRed, for a
post-order all nodes are left. In a both-order walk the first visit of
a node \fBenter\fRs it, the second visit \fBleave\fRs it.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: graph\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
cgraph, graph
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/struct/graphops.n.






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/graphops.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Alejandro Paz <[email protected]>
'\" Copyright (c) 2008 (docs) Andreas Kupries <[email protected]>
'\" Copyright (c) 2009 Michal Antoniewski <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::graph::op" n 0.11.3 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::graph::op \- Operation for (un)directed graph objects
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBstruct::graph::op  ?0.11.3?\fR
.sp
\fBstruct::graph::op::toAdjacencyMatrix\fR \fIg\fR
.sp
\fBstruct::graph::op::toAdjacencyList\fR \fIG\fR ?\fIoptions\fR...?
.sp
\fBstruct::graph::op::kruskal\fR \fIg\fR
.sp
\fBstruct::graph::op::prim\fR \fIg\fR
.sp
\fBstruct::graph::op::isBipartite?\fR \fIg\fR ?\fIbipartvar\fR?
.sp
\fBstruct::graph::op::tarjan\fR \fIg\fR
.sp
\fBstruct::graph::op::connectedComponents\fR \fIg\fR
.sp
\fBstruct::graph::op::connectedComponentOf\fR \fIg\fR \fIn\fR
.sp
\fBstruct::graph::op::isConnected?\fR \fIg\fR
.sp
\fBstruct::graph::op::isCutVertex?\fR \fIg\fR \fIn\fR
.sp
\fBstruct::graph::op::isBridge?\fR \fIg\fR \fIa\fR
.sp
\fBstruct::graph::op::isEulerian?\fR \fIg\fR ?\fItourvar\fR?
.sp
\fBstruct::graph::op::isSemiEulerian?\fR \fIg\fR ?\fIpathvar\fR?
.sp
\fBstruct::graph::op::dijkstra\fR \fIg\fR \fIstart\fR ?\fIoptions\fR...?
.sp
\fBstruct::graph::op::distance\fR \fIg\fR \fIorigin\fR \fIdestination\fR ?\fIoptions\fR...?
.sp
\fBstruct::graph::op::eccentricity\fR \fIg\fR \fIn\fR ?\fIoptions\fR...?
.sp
\fBstruct::graph::op::radius\fR \fIg\fR ?\fIoptions\fR...?
.sp
\fBstruct::graph::op::diameter\fR \fIg\fR ?\fIoptions\fR...?
.sp
\fBstruct::graph::op::BellmanFord\fR \fIG\fR \fIstartnode\fR
.sp
\fBstruct::graph::op::Johnsons\fR \fIG\fR ?\fIoptions\fR...?
.sp
\fBstruct::graph::op::FloydWarshall\fR \fIG\fR
.sp
\fBstruct::graph::op::MetricTravellingSalesman\fR \fIG\fR
.sp
\fBstruct::graph::op::Christofides\fR \fIG\fR
.sp
\fBstruct::graph::op::GreedyMaxMatching\fR \fIG\fR
.sp
\fBstruct::graph::op::MaxCut\fR \fIG\fR \fIU\fR \fIV\fR
.sp
\fBstruct::graph::op::UnweightedKCenter\fR \fIG\fR \fIk\fR
.sp
\fBstruct::graph::op::WeightedKCenter\fR \fIG\fR \fInodeWeights\fR \fIW\fR
.sp
\fBstruct::graph::op::GreedyMaxIndependentSet\fR \fIG\fR
.sp
\fBstruct::graph::op::GreedyWeightedMaxIndependentSet\fR \fIG\fR \fInodeWeights\fR
.sp
\fBstruct::graph::op::VerticesCover\fR \fIG\fR
.sp
\fBstruct::graph::op::EdmondsKarp\fR \fIG\fR \fIs\fR \fIt\fR
.sp
\fBstruct::graph::op::BusackerGowen\fR \fIG\fR \fIdesiredFlow\fR \fIs\fR \fIt\fR
.sp
\fBstruct::graph::op::ShortestsPathsByBFS\fR \fIG\fR \fIs\fR \fIoutputFormat\fR
.sp
\fBstruct::graph::op::BFS\fR \fIG\fR \fIs\fR ?\fIoutputFormat\fR...?
.sp
\fBstruct::graph::op::MinimumDiameterSpanningTree\fR \fIG\fR
.sp
\fBstruct::graph::op::MinimumDegreeSpanningTree\fR \fIG\fR
.sp
\fBstruct::graph::op::MaximumFlowByDinic\fR \fIG\fR \fIs\fR \fIt\fR \fIblockingFlowAlg\fR
.sp
\fBstruct::graph::op::BlockingFlowByDinic\fR \fIG\fR \fIs\fR \fIt\fR
.sp
\fBstruct::graph::op::BlockingFlowByMKM\fR \fIG\fR \fIs\fR \fIt\fR
.sp
\fBstruct::graph::op::createResidualGraph\fR \fIG\fR \fIf\fR
.sp
\fBstruct::graph::op::createAugmentingNetwork\fR \fIG\fR \fIf\fR \fIpath\fR
.sp
\fBstruct::graph::op::createLevelGraph\fR \fIGf\fR \fIs\fR
.sp
\fBstruct::graph::op::TSPLocalSearching\fR \fIG\fR \fIC\fR
.sp
\fBstruct::graph::op::TSPLocalSearching3Approx\fR \fIG\fR \fIC\fR
.sp
\fBstruct::graph::op::createSquaredGraph\fR \fIG\fR
.sp
\fBstruct::graph::op::createCompleteGraph\fR \fIG\fR \fIoriginalEdges\fR
.sp
.BE
.SH DESCRIPTION
.PP
The package described by this document, \fBstruct::graph::op\fR,
is a companion to the package \fBstruct::graph\fR. It provides a
series of common operations and algorithms applicable to (un)directed
graphs.
.PP
Despite being a companion the package is not directly dependent on
\fBstruct::graph\fR, only on the API defined by that
package. I.e. the operations of this package can be applied to any and
all graph objects which provide the same API as the objects created
through \fBstruct::graph\fR.
.SH OPERATIONS
.TP
\fBstruct::graph::op::toAdjacencyMatrix\fR \fIg\fR
This command takes the graph \fIg\fR and returns a nested list
containing the adjacency matrix of \fIg\fR.
.sp
The elements of the outer list are the rows of the matrix, the inner
elements are the column values in each row. The matrix has "\fBn\fR+1"
rows and columns, with the first row and column (index 0) containing
the name of the node the row/column is for. All other elements are
boolean values, \fBTrue\fR if there is an arc between the 2 nodes
of the respective row and column, and \fBFalse\fR otherwise.
.sp
Note that the matrix is symmetric. It does not represent the
directionality of arcs, only their presence between nodes. It is also
unable to represent parallel arcs in \fIg\fR.
.TP
\fBstruct::graph::op::toAdjacencyList\fR \fIG\fR ?\fIoptions\fR...?
Procedure creates for input graph \fIG\fR, it's representation as \fIAdjacency List\fR.
It handles both directed and undirected graphs (default is undirected).
It returns dictionary that for each node (key) returns list of nodes adjacent
to it. When considering weighted version, for each adjacent node there is also
weight of the edge included.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph object \fIG\fR (input)
A graph to convert into an \fIAdjacency List\fR.
.RE
.TP
Options:
.RS
.TP
\fB-directed\fR
By default \fIG\fR is operated as if it were an \fIUndirected graph\fR.
Using this option tells the command to handle \fIG\fR as the directed graph it is.
.TP
\fB-weights\fR
By default any weight information the graph \fIG\fR may have is ignored.
Using this option tells the command to put weight information into the result.
In that case it is expected that all arcs have a proper weight, and an error
is thrown if that is not the case.
.RE
.RE
.TP
\fBstruct::graph::op::kruskal\fR \fIg\fR
This command takes the graph \fIg\fR and returns a list containing the
names of the arcs in \fIg\fR which span up a minimum weight spanning tree
(MST), or, in the case of an un-connected graph, a minimum weight spanning
forest (except for the 1-vertex components). Kruskal's algorithm is used
to compute the tree or forest.
This algorithm has a time complexity of \fIO(E*log E)\fR or \fIO(E* log V)\fR,
where \fIV\fR is the number of vertices and \fIE\fR is the number of edges
in graph \fIg\fR.
.sp
The command will throw an error if one or more arcs in \fIg\fR have no
weight associated with them.
.sp
A note regarding the result, the command refrains from explicitly
listing the nodes of the MST as this information is implicitly
provided in the arcs already.
.TP
\fBstruct::graph::op::prim\fR \fIg\fR
This command takes the graph \fIg\fR and returns a list containing the
names of the arcs in \fIg\fR which span up a minimum weight spanning tree
(MST), or, in the case of an un-connected graph, a minimum weight spanning
forest (except for the 1-vertex components). Prim's algorithm is used to
compute the tree or forest.
This algorithm has a time complexity between \fIO(E+V*log V)\fR and \fIO(V*V)\fR,
depending on the implementation (Fibonacci heap + Adjacency list versus
Adjacency Matrix).  As usual \fIV\fR is the number of vertices and
\fIE\fR the number of edges in graph \fIg\fR.
.sp
The command will throw an error if one or more arcs in \fIg\fR have no
weight associated with them.
.sp
A note regarding the result, the command refrains from explicitly
listing the nodes of the MST as this information is implicitly
provided in the arcs already.
.TP
\fBstruct::graph::op::isBipartite?\fR \fIg\fR ?\fIbipartvar\fR?
This command takes the graph \fIg\fR and returns a boolean value
indicating whether it is bipartite (\fBtrue\fR) or not
(\fBfalse\fR). If the variable \fIbipartvar\fR is specified the two
partitions of the graph are there as a list, if, and only if the graph
is bipartit. If it is not the variable, if specified, is not touched.
.TP
\fBstruct::graph::op::tarjan\fR \fIg\fR
This command computes the set of \fIstrongly connected\fR
components (SCCs) of the graph \fIg\fR. The result of the command is a
list of sets, each of which contains the nodes for one of the SCCs of
\fIg\fR. The union of all SCCs covers the whole graph, and no two SCCs
intersect with each other.
.sp
The graph \fIg\fR is \fIacyclic\fR if all SCCs in the result contain
only a single node. The graph \fIg\fR is \fIstrongly connected\fR
if the result contains only a single SCC containing all nodes of
\fIg\fR.
.TP
\fBstruct::graph::op::connectedComponents\fR \fIg\fR
This command computes the set of \fIconnected\fR components (CCs) of
the graph \fIg\fR. The result of the command is a list of sets, each
of which contains the nodes for one of the CCs of \fIg\fR. The union
of all CCs covers the whole graph, and no two CCs intersect with each
other.
.sp
The graph \fIg\fR is \fIconnected\fR if the result contains only a
single SCC containing all nodes of \fIg\fR.
.TP
\fBstruct::graph::op::connectedComponentOf\fR \fIg\fR \fIn\fR
This command computes the \fIconnected\fR component (CC) of the graph
\fIg\fR containing the node \fIn\fR. The result of the command is a
sets which contains the nodes for the CC of \fIn\fR in \fIg\fR.
.sp
The command will throw an error if \fIn\fR is not a node of the graph
\fIg\fR.
.TP
\fBstruct::graph::op::isConnected?\fR \fIg\fR
This is a convenience command determining whether the graph \fIg\fR is
\fIconnected\fR or not.  The result is a boolean value, \fBtrue\fR
if the graph is connected, and \fBfalse\fR otherwise.
.TP
\fBstruct::graph::op::isCutVertex?\fR \fIg\fR \fIn\fR
This command determines whether the node \fIn\fR in the graph \fIg\fR
is a \fIcut vertex\fR (aka \fIarticulation point\fR). The result
is a boolean value, \fBtrue\fR if the node is a cut vertex, and
\fBfalse\fR otherwise.
.sp
The command will throw an error if \fIn\fR is not a node of the graph
\fIg\fR.
.TP
\fBstruct::graph::op::isBridge?\fR \fIg\fR \fIa\fR
This command determines whether the arc \fIa\fR in the graph \fIg\fR
is a \fIbridge\fR (aka \fIcut edge\fR, or \fIisthmus\fR). The
result is a boolean value, \fBtrue\fR if the arc is a bridge, and
\fBfalse\fR otherwise.
.sp
The command will throw an error if \fIa\fR is not an arc of the graph
\fIg\fR.
.TP
\fBstruct::graph::op::isEulerian?\fR \fIg\fR ?\fItourvar\fR?
This command determines whether the graph \fIg\fR is \fIeulerian\fR
or not.  The result is a boolean value, \fBtrue\fR if the graph is
eulerian, and \fBfalse\fR otherwise.
.sp
If the graph is eulerian and \fItourvar\fR is specified then an euler
tour is computed as well and stored in the named variable. The tour is
represented by the list of arcs traversed, in the order of traversal.
.TP
\fBstruct::graph::op::isSemiEulerian?\fR \fIg\fR ?\fIpathvar\fR?
This command determines whether the graph \fIg\fR is
\fIsemi-eulerian\fR or not.  The result is a boolean value, \fBtrue\fR
if the graph is semi-eulerian, and \fBfalse\fR otherwise.
.sp
If the graph is semi-eulerian and \fIpathvar\fR is specified then an
euler path is computed as well and stored in the named variable. The
path is represented by the list of arcs traversed, in the order of
traversal.
.TP
\fBstruct::graph::op::dijkstra\fR \fIg\fR \fIstart\fR ?\fIoptions\fR...?
This command determines distances in the weighted \fIg\fR from the
node \fIstart\fR to all other nodes in the graph. The options specify
how to traverse graphs, and the format of the result.
.sp
Two options are recognized
.RS
.TP
\fB-arcmode\fR mode
The accepted mode values are \fBdirected\fR and \fBundirected\fR.
For directed traversal all arcs are traversed from source to
target. For undirected traversal all arcs are traversed in the
opposite direction as well. Undirected traversal is the default.
.TP
\fB-outputformat\fR format
The accepted format values are \fBdistances\fR and \fBtree\fR. In
both cases the result is a dictionary keyed by the names of all nodes
in the graph. For \fBdistances\fR the value is the distance of the
node to \fIstart\fR, whereas for \fBtree\fR the value is the path
from the node to \fIstart\fR, excluding the node itself, but including
\fIstart\fR. Tree format is the default.
.RE
.TP
\fBstruct::graph::op::distance\fR \fIg\fR \fIorigin\fR \fIdestination\fR ?\fIoptions\fR...?
This command determines the (un)directed distance between the two
nodes \fIorigin\fR and \fIdestination\fR in the graph \fIg\fR. It
accepts the option \fB-arcmode\fR of \fBstruct::graph::op::dijkstra\fR.
.TP
\fBstruct::graph::op::eccentricity\fR \fIg\fR \fIn\fR ?\fIoptions\fR...?
This command determines the (un)directed \fIeccentricity\fR of the
node \fIn\fR in the graph \fIg\fR. It accepts the option
\fB-arcmode\fR of \fBstruct::graph::op::dijkstra\fR.
.sp
The (un)directed \fIeccentricity\fR of a node is the maximal
(un)directed distance between the node and any other node in the
graph.
.TP
\fBstruct::graph::op::radius\fR \fIg\fR ?\fIoptions\fR...?
This command determines the (un)directed \fIradius\fR of the graph
\fIg\fR. It accepts the option \fB-arcmode\fR of \fBstruct::graph::op::dijkstra\fR.
.sp
The (un)directed \fIradius\fR of a graph is the minimal (un)directed
\fIeccentricity\fR of all nodes in the graph.
.TP
\fBstruct::graph::op::diameter\fR \fIg\fR ?\fIoptions\fR...?
This command determines the (un)directed \fIdiameter\fR of the graph
\fIg\fR. It accepts the option \fB-arcmode\fR of \fBstruct::graph::op::dijkstra\fR.
.sp
The (un)directed \fIdiameter\fR of a graph is the maximal (un)directed
\fIeccentricity\fR of all nodes in the graph.
.TP
\fBstruct::graph::op::BellmanFord\fR \fIG\fR \fIstartnode\fR
Searching for \fBshortests paths\fR between chosen node and all other nodes in graph \fIG\fR. Based
on relaxation method. In comparison to \fBstruct::graph::op::dijkstra\fR it doesn't need assumption that all weights
on edges in input graph \fIG\fR have to be positive.
.sp
That generality sets the complexity of algorithm to - \fIO(V*E)\fR, where \fIV\fR is the number of vertices
and \fIE\fR is number of edges in graph \fIG\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph object \fIG\fR (input)
Directed, connected and edge weighted graph \fIG\fR, without any negative cycles ( presence of cycles with the negative sum
of weight means that there is no shortest path, since the total weight becomes lower each time the cycle is
traversed ). Negative weights on edges are allowed.
.TP
Node \fIstartnode\fR (input)
The node for which we find all shortest paths to each other node in graph \fIG\fR.
.RE
.TP
Result:
Dictionary containing for each node (key) distances to each other node in graph \fIG\fR.
.RE
.sp
\fINote:\fR If algorithm finds a negative cycle, it will return error message.
.TP
\fBstruct::graph::op::Johnsons\fR \fIG\fR ?\fIoptions\fR...?
Searching for \fBshortest paths\fR between all pairs of vertices in graph. For sparse graphs
asymptotically quicker than \fBstruct::graph::op::FloydWarshall\fR algorithm. Johnson's algorithm
uses \fBstruct::graph::op::BellmanFord\fR and \fBstruct::graph::op::dijkstra\fR as subprocedures.
.sp
Time complexity: \fIO(n**2*log(n) +n*m)\fR, where \fIn\fR is the number of nodes and \fIm\fR is
the number of edges in graph \fIG\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph object \fIG\fR (input)
Directed graph \fIG\fR, weighted on edges and not containing
any cycles with negative sum of weights ( the presence of such cycles means
there is no shortest path, since the total weight becomes lower each time the
cycle is traversed ). Negative weights on edges are allowed.
.RE
.TP
Options:
.RS
.TP
\fB-filter\fR
Returns only existing distances, cuts all \fIInf\fR values for
non-existing connections between pairs of nodes.
.RE
.TP
Result:
Dictionary containing distances between all pairs of vertices.
.RE
.TP
\fBstruct::graph::op::FloydWarshall\fR \fIG\fR
Searching for \fBshortest paths\fR between all pairs of edges in weighted graphs.
.sp
Time complexity: \fIO(V^3)\fR - where \fIV\fR is number of vertices.
.sp
Memory complexity: \fIO(V^2)\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph object \fIG\fR (input)
Directed and weighted graph \fIG\fR.
.RE
.TP
Result:
Dictionary containing shortest distances to each node from each node.
.RE
.IP
\fINote:\fR Algorithm finds solutions dynamically. It compares all possible paths through the graph
between each pair of vertices. Graph shouldn't possess any cycle with negative
sum of weights (the presence of such cycles means there is no shortest path,
since the total weight becomes lower each time the cycle is traversed).
.sp
On the other hand algorithm can be used to find those cycles - if any shortest distance
found by algorithm for any nodes \fIv\fR and \fIu\fR (when \fIv\fR is the same node as \fIu\fR) is negative,
that node surely belong to at least one negative cycle.
.TP
\fBstruct::graph::op::MetricTravellingSalesman\fR \fIG\fR
Algorithm for solving a metric variation of \fBTravelling salesman problem\fR.
\fITSP problem\fR is \fINP-Complete\fR, so there is no efficient algorithm to solve it. Greedy methods
are getting extremely slow, with the increase in the set of nodes.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph object \fIG\fR (input)
Undirected, weighted graph \fIG\fR.
.RE
.TP
Result:
Approximated solution of minimum \fIHamilton Cycle\fR - closed path visiting all nodes,
each exactly one time.
.RE
.IP
\fINote:\fR \fBIt's 2-approximation algorithm.\fR
.TP
\fBstruct::graph::op::Christofides\fR \fIG\fR
Another algorithm for solving \fBmetric \fITSP problem\fR\fR.
Christofides implementation uses \fIMax Matching\fR for reaching better approximation factor.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Undirected, weighted graph \fIG\fR.
.RE
.TP
Result:
Approximated solution of minimum \fIHamilton Cycle\fR - closed path visiting all nodes,
each exactly one time.
.RE
.sp
\fINote:\fR \fBIt's is a 3/2 approximation algorithm. \fR
.TP
\fBstruct::graph::op::GreedyMaxMatching\fR \fIG\fR
\fIGreedy Max Matching\fR procedure, which finds \fBmaximal matching\fR (not maximum)
for given graph \fIG\fR. It adds edges to solution, beginning from edges with the
lowest cost.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Undirected graph \fIG\fR.
.RE
.TP
Result:
Set of edges - the max matching for graph \fIG\fR.
.RE
.TP
\fBstruct::graph::op::MaxCut\fR \fIG\fR \fIU\fR \fIV\fR
Algorithm solving a \fBMaximum Cut Problem\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
The graph to cut.
.TP
List \fIU\fR (output)
Variable storing first set of nodes (cut) given by solution.
.TP
List \fIV\fR (output)
Variable storing second set of nodes (cut) given by solution.
.RE
.TP
Result:
Algorithm returns number of edges between found two sets of nodes.
.RE
.IP
\fINote:\fR \fIMaxCut\fR is a \fB2-approximation algorithm.\fR
.TP
\fBstruct::graph::op::UnweightedKCenter\fR \fIG\fR \fIk\fR
Approximation algorithm that solves a \fBk-center problem\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Undirected complete graph \fIG\fR, which satisfies triangle inequality.
.sp
.TP
Integer \fIk\fR (input)
Positive integer that sets the number of nodes that will be included in \fIk-center\fR.
.RE
.TP
Result:
Set of nodes - \fIk\fR center for graph \fIG\fR.
.RE
.IP
\fINote:\fR \fIUnweightedKCenter\fR is a \fB2-approximation algorithm.\fR
.TP
\fBstruct::graph::op::WeightedKCenter\fR \fIG\fR \fInodeWeights\fR \fIW\fR
Approximation algorithm that solves a weighted version of \fBk-center problem\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Undirected complete graph \fIG\fR, which satisfies triangle inequality.
.TP
Integer \fIW\fR (input)
Positive integer that sets the maximum possible weight of \fIk-center\fR found by algorithm.
.TP
List \fInodeWeights\fR (input)
List of nodes and its weights in graph \fIG\fR.
.RE
.TP
Result:
Set of nodes, which is solution found by algorithm.
.RE
.IP
\fINote:\fR\fIWeightedKCenter\fR is a \fB3-approximation algorithm.\fR
.TP
\fBstruct::graph::op::GreedyMaxIndependentSet\fR \fIG\fR
A \fImaximal independent set\fR is an \fIindependent set\fR such that adding any other node
to the set forces the set to contain an edge.
.sp
Algorithm for input graph \fIG\fR returns set of nodes (list), which are contained in Max Independent
Set found by algorithm.
.TP
\fBstruct::graph::op::GreedyWeightedMaxIndependentSet\fR \fIG\fR \fInodeWeights\fR
Weighted variation of \fIMaximal Independent Set\fR. It takes as an input argument
not only graph \fIG\fR but also set of weights for all vertices in graph \fIG\fR.
.sp
\fINote:\fR
Read also \fIMaximal Independent Set\fR description for more info.
.TP
\fBstruct::graph::op::VerticesCover\fR \fIG\fR
\fIVertices cover\fR is a set of vertices such that each edge of the graph is incident to
at least one vertex of the set. This 2-approximation algorithm searches for minimum
\fIvertices cover\fR, which is a classical optimization problem in computer science and
is a typical example of an \fINP-hard\fR optimization problem that has an approximation
algorithm.
For input graph \fIG\fR algorithm returns the set of edges (list), which is Vertex Cover found by algorithm.
.TP
\fBstruct::graph::op::EdmondsKarp\fR \fIG\fR \fIs\fR \fIt\fR
Improved Ford-Fulkerson's algorithm, computing the \fBmaximum flow\fR in given flow network \fIG\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Weighted and directed graph. Each edge should have set integer attribute considered as
maximum throughputs that can be carried by that link (edge).
.TP
Node \fIs\fR (input)
The node that is a source for graph \fIG\fR.
.TP
Node \fIt\fR (input)
The node that is a sink for graph \fIG\fR.
.RE
.TP
Result:
Procedure returns the dictionary containing throughputs for all edges. For
each key ( the edge between nodes \fIu\fR and \fIv\fR in the form of \fIlist u v\fR ) there is
a value that is a throughput for that key. Edges where throughput values
are equal to 0 are not returned ( it is like there was no link in the flow network
between nodes connected by such edge).
.RE
.sp
The general idea of algorithm is finding the shortest augumenting paths in graph \fIG\fR, as long
as they exist, and for each path updating the edge's weights along that path,
with maximum possible throughput. The final (maximum) flow is found
when there is no other augumenting path from source to sink.
.sp
\fINote:\fR Algorithm complexity : \fIO(V*E)\fR, where \fIV\fR is the number of nodes and \fIE\fR is the number
of edges in graph \fIG\fR.
.TP
\fBstruct::graph::op::BusackerGowen\fR \fIG\fR \fIdesiredFlow\fR \fIs\fR \fIt\fR
Algorithm finds solution for a \fBminimum cost flow problem\fR. So, the goal is to find a flow,
whose max value can be \fIdesiredFlow\fR, from source node \fIs\fR to sink node \fIt\fR in given flow network \fIG\fR.
That network except throughputs at edges has also defined a non-negative cost on each edge - cost of using that edge when
directing flow with that edge ( it can illustrate e.g. fuel usage, time or any other measure dependent on usages ).
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Flow network (directed graph), each edge in graph should have two integer attributes: \fIcost\fR and \fIthroughput\fR.
.TP
Integer \fIdesiredFlow\fR (input)
Max value of the flow for that network.
.TP
Node \fIs\fR (input)
The source node for graph \fIG\fR.
.TP
Node \fIt\fR (input)
The sink node for graph \fIG\fR.
.RE
.TP
Result:
Dictionary containing values of used throughputs for each edge ( key ).
found by algorithm.
.RE
.IP
\fINote:\fR Algorithm complexity : \fIO(V**2*desiredFlow)\fR, where \fIV\fR is the number of nodes in graph \fIG\fR.
.TP
\fBstruct::graph::op::ShortestsPathsByBFS\fR \fIG\fR \fIs\fR \fIoutputFormat\fR
Shortest pathfinding algorithm using BFS method. In comparison to \fBstruct::graph::op::dijkstra\fR it can
work with negative weights on edges. Of course negative cycles are not allowed. Algorithm is better than dijkstra
for sparse graphs, but also there exist some pathological cases (those cases generally don't appear in practise) that
make time complexity increase exponentially with the growth of the number of nodes.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Input graph.
.TP
Node \fIs\fR (input)
Source node for which all distances to each other node in graph \fIG\fR are computed.
.RE
.TP
Options and result:
.RS
.TP
\fBdistances\fR
When selected \fIoutputFormat\fR is \fBdistances\fR - procedure returns dictionary containing
distances between source node \fIs\fR and each other node in graph \fIG\fR.
.TP
\fBpaths\fR
When selected \fIoutputFormat\fR is \fBpaths\fR - procedure returns dictionary containing
for each node \fIv\fR, a list of nodes, which is a path between source node \fIs\fR and node \fIv\fR.
.RE
.RE
.TP
\fBstruct::graph::op::BFS\fR \fIG\fR \fIs\fR ?\fIoutputFormat\fR...?
Breadth-First Search - algorithm creates the BFS Tree.
Memory and time complexity: \fIO(V + E)\fR, where \fIV\fR is the number of nodes and \fIE\fR
is number of edges.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Input graph.
.TP
Node \fIs\fR (input)
Source node for BFS procedure.
.RE
.TP
Options and result:
.RS
.TP
\fBgraph\fR
When selected \fBoutputFormat\fR is \fBgraph\fR - procedure returns a graph structure (\fBstruct::graph\fR),
which is equivalent to BFS tree found by algorithm.
.TP
\fBtree\fR
When selected \fBoutputFormat\fR is \fBtree\fR - procedure returns a tree structure (\fBstruct::tree\fR),
which is equivalent to BFS tree found by algorithm.
.RE
.RE
.TP
\fBstruct::graph::op::MinimumDiameterSpanningTree\fR \fIG\fR
The goal is to find for input graph \fIG\fR, the \fIspanning tree\fR that
has the minimum \fIdiameter\fR value.
.sp
General idea of algorithm is to run \fIBFS\fR over all vertices in graph
\fIG\fR. If the diameter \fId\fR of the tree is odd, then we are sure that tree
given by \fIBFS\fR is minimum (considering diameter value). When, diameter \fId\fR
is even, then optimal tree can have minimum \fIdiameter\fR equal to \fId\fR or
\fId-1\fR.
.sp
In that case, what algorithm does is rebuilding the tree given by \fIBFS\fR, by
adding a vertice between root node and root's child node (nodes), such that
subtree created with child node as root node is the greatest one (has the
greatests height). In the next step for such rebuilded tree, we run again \fIBFS\fR
with new node as root node. If the height of the tree didn't changed, we have found
a better solution.
.sp
For input graph \fIG\fR algorithm returns the graph structure (\fBstruct::graph\fR) that is
a spanning tree with minimum diameter found by algorithm.
.TP
\fBstruct::graph::op::MinimumDegreeSpanningTree\fR \fIG\fR
Algorithm finds for input graph \fIG\fR, a spanning tree \fIT\fR with the minimum possible
degree. That problem is \fINP-hard\fR, so algorithm is an approximation algorithm.
.sp
Let \fIV\fR be the set of nodes for graph \fIG\fR and let \fIW\fR be any subset of \fIV\fR. Lets
assume also that \fIOPT\fR is optimal solution and \fIALG\fR is solution found by algorithm for input
graph \fIG\fR.
.sp
It can be proven that solution found with the algorithm must fulfil inequality:
.sp
\fI((|W| + k - 1) / |W|) <= ALG <= 2*OPT + log2(n) + 1\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Undirected simple graph.
.RE
.TP
Result:
Algorithm returns graph structure, which is equivalent to spanning tree \fIT\fR found by algorithm.
.RE
.TP
\fBstruct::graph::op::MaximumFlowByDinic\fR \fIG\fR \fIs\fR \fIt\fR \fIblockingFlowAlg\fR
Algorithm finds \fBmaximum flow\fR for the flow network represented by graph \fIG\fR. It is based on
the blocking-flow finding methods, which give us different complexities what makes a better fit for
different graphs.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Directed graph \fIG\fR representing the flow network. Each edge should have attribute
\fIthroughput\fR set with integer value.
.TP
Node \fIs\fR (input)
The source node for the flow network \fIG\fR.
.TP
Node \fIt\fR (input)
The sink node for the flow network \fIG\fR.
.RE
.TP
Options:
.RS
.TP
\fBdinic\fR
Procedure will find maximum flow for flow network \fIG\fR using Dinic's algorithm (\fBstruct::graph::op::BlockingFlowByDinic\fR)
for blocking flow computation.
.TP
\fBmkm\fR
Procedure will find maximum flow for flow network \fIG\fR using Malhotra, Kumar and Maheshwari's algorithm (\fBstruct::graph::op::BlockingFlowByMKM\fR)
for blocking flow computation.
.RE
.TP
Result:
Algorithm returns dictionary containing it's flow value for each edge (key) in network \fIG\fR.
.RE
.sp
\fINote:\fR \fBstruct::graph::op::BlockingFlowByDinic\fR gives \fIO(m*n^2)\fR complexity and
\fBstruct::graph::op::BlockingFlowByMKM\fR gives \fIO(n^3)\fR complexity, where \fIn\fR is the number of nodes
and \fIm\fR is the number of edges in flow network \fIG\fR.
.TP
\fBstruct::graph::op::BlockingFlowByDinic\fR \fIG\fR \fIs\fR \fIt\fR
Algorithm for given network \fIG\fR with source \fIs\fR and sink \fIt\fR, finds a \fBblocking
flow\fR, which can be used to obtain a \fImaximum flow\fR for that network \fIG\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Directed graph \fIG\fR representing the flow network. Each edge should have attribute
\fIthroughput\fR set with integer value.
.TP
Node \fIs\fR (input)
The source node for the flow network \fIG\fR.
.TP
Node \fIt\fR (input)
The sink node for the flow network \fIG\fR.
.RE
.TP
Result:
Algorithm returns dictionary containing it's blocking flow value for each edge (key) in network \fIG\fR.
.RE
.IP
\fINote:\fR Algorithm's complexity is \fIO(n*m)\fR, where \fIn\fR is the number of nodes
and \fIm\fR is the number of edges in flow network \fIG\fR.
.TP
\fBstruct::graph::op::BlockingFlowByMKM\fR \fIG\fR \fIs\fR \fIt\fR
Algorithm for given network \fIG\fR with source \fIs\fR and sink \fIt\fR, finds a \fBblocking
flow\fR, which can be used to obtain a \fImaximum flow\fR for that \fInetwork\fR \fIG\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Directed graph \fIG\fR representing the flow network. Each edge should have attribute
\fIthroughput\fR set with integer value.
.TP
Node \fIs\fR (input)
The source node for the flow network \fIG\fR.
.TP
Node \fIt\fR (input)
The sink node for the flow network \fIG\fR.
.RE
.TP
Result:
Algorithm returns dictionary containing it's blocking flow value for each edge (key) in network \fIG\fR.
.RE
.IP
\fINote:\fR Algorithm's complexity is \fIO(n^2)\fR, where \fIn\fR is the number of nodes in flow network \fIG\fR.
.TP
\fBstruct::graph::op::createResidualGraph\fR \fIG\fR \fIf\fR
Procedure creates a \fIresidual graph\fR (or \fBresidual network\fR ) for network \fIG\fR and given
flow \fIf\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Flow network (directed graph where each edge has set attribute: \fIthroughput\fR ).
.TP
dictionary \fIf\fR (input)
Current flows in flow network \fIG\fR.
.RE
.TP
Result:
Procedure returns graph structure that is a \fIresidual graph\fR created from input flow
network \fIG\fR.
.RE
.TP
\fBstruct::graph::op::createAugmentingNetwork\fR \fIG\fR \fIf\fR \fIpath\fR
Procedure creates an \fBaugmenting network\fR for a given residual network \fIG\fR
, flow \fIf\fR and augmenting path \fIpath\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Residual network (directed graph), where for every edge there are set two attributes: throughput and cost.
.TP
Dictionary \fIf\fR (input)
Dictionary which contains for every edge (key), current value of the flow on that edge.
.TP
List \fIpath\fR (input)
Augmenting path, set of edges (list) for which we create the network modification.
.RE
.TP
Result:
Algorithm returns graph structure containing the modified augmenting network.
.RE
.TP
\fBstruct::graph::op::createLevelGraph\fR \fIGf\fR \fIs\fR
For given residual graph \fIGf\fR procedure finds the \fBlevel graph\fR.
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIGf\fR (input)
Residual network, where each edge has it's attribute \fIthroughput\fR set with certain value.
.TP
Node \fIs\fR (input)
The source node for the residual network \fIGf\fR.
.RE
.TP
Result:
Procedure returns a \fIlevel graph\fR created from input \fIresidual network\fR.
.RE
.TP
\fBstruct::graph::op::TSPLocalSearching\fR \fIG\fR \fIC\fR
Algorithm is a \fIheuristic of local searching\fR for \fITravelling Salesman Problem\fR. For some
solution of \fITSP problem\fR, it checks if it's possible to find a better solution. As \fITSP\fR
is well known NP-Complete problem, so algorithm is a approximation algorithm (with 2 approximation factor).
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Undirected and complete graph with attributes "weight" set on each single edge.
.TP
List \fIC\fR (input)
A list of edges being \fIHamiltonian cycle\fR, which is solution of \fITSP Problem\fR for graph \fIG\fR.
.RE
.TP
Result:
Algorithm returns the best solution for \fITSP problem\fR, it was able to find.
.RE
.IP
\fINote:\fR The solution depends on the choosing of the beginning cycle \fIC\fR. It's not true that better cycle
assures that better solution will be found, but practise shows that we should give starting cycle with as small
sum of weights as possible.
.TP
\fBstruct::graph::op::TSPLocalSearching3Approx\fR \fIG\fR \fIC\fR
Algorithm is a \fIheuristic of local searching\fR for \fITravelling Salesman Problem\fR. For some
solution of \fITSP problem\fR, it checks if it's possible to find a better solution. As \fITSP\fR
is well known NP-Complete problem, so algorithm is a approximation algorithm (with 3 approximation factor).
.sp
.RS
.TP
Arguments:
.RS
.TP
Graph Object \fIG\fR (input)
Undirected and complete graph with attributes "weight" set on each single edge.
.TP
List \fIC\fR (input)
A list of edges being \fIHamiltonian cycle\fR, which is solution of \fITSP Problem\fR for graph \fIG\fR.
.RE
.TP
Result:
Algorithm returns the best solution for \fITSP problem\fR, it was able to find.
.RE
.IP
\fINote:\fR In practise 3-approximation algorithm turns out to be far more effective than 2-approximation, but it gives
worser approximation factor. Further heuristics of local searching (e.g. 4-approximation) doesn't give enough boost to
square the increase of approximation factor, so 2 and 3 approximations are mainly used.
.TP
\fBstruct::graph::op::createSquaredGraph\fR \fIG\fR
X-Squared graph is a graph with the same set of nodes as input graph \fIG\fR, but a different set of edges. X-Squared graph
has edge \fI(u,v)\fR, if and only if, the distance between \fIu\fR and \fIv\fR nodes is not greater than X and \fIu != v\fR.
.sp
Procedure for input graph \fIG\fR, returns its two-squared graph.
.sp
\fINote:\fR Distances used in choosing new set of edges are considering the number of edges, not the sum of weights at edges.
.TP
\fBstruct::graph::op::createCompleteGraph\fR \fIG\fR \fIoriginalEdges\fR
For input graph \fIG\fR procedure adds missing arcs to make it a \fIcomplete graph\fR. It also holds in
variable \fIoriginalEdges\fR the set of arcs that graph \fIG\fR possessed before that operation.
.PP
.SH "BACKGROUND THEORY AND TERMS"
.SS "SHORTEST PATH PROBLEM"
.TP
Definition (\fIsingle-pair shortest path problem\fR):
Formally, given a weighted graph (let \fIV\fR be the set of vertices, and \fIE\fR a set of edges),
and one vertice \fIv\fR of \fIV\fR, find a path \fIP\fR from \fIv\fR to a \fIv'\fR of V so that
the sum of weights on edges along the path is minimal among all paths connecting v to v'.
.TP
Generalizations:
.RS
.IP \(bu
\fIThe single-source shortest path problem\fR, in which we have to find shortest paths from a source vertex v to all other vertices in the graph.
.IP \(bu
\fIThe single-destination shortest path problem\fR, in which we have to find shortest paths from all vertices in the graph to a single destination vertex v. This can be reduced to the single-source shortest path problem by reversing the edges in the graph.
.IP \(bu
\fIThe all-pairs shortest path problem\fR, in which we have to find shortest paths between every pair of vertices v, v' in the graph.
.RE
.IP
\fINote:\fR
The result of \fIShortest Path problem\fR can be \fIShortest Path tree\fR, which is a subgraph of a given (possibly weighted) graph constructed so that the
distance between a selected root node and all other nodes is minimal. It is a tree because if there are two paths between the root node and some
vertex v (i.e. a cycle), we can delete the last edge of the longer path without increasing the distance from the root node to any node in the subgraph.
.PP
.SS "TRAVELLING SALESMAN PROBLEM"
.TP
Definition:
For given edge-weighted (weights on edges should be positive) graph the goal is to find the cycle that visits each node in graph
exactly once (\fIHamiltonian cycle\fR).
.TP
Generalizations:
.RS
.IP \(bu
\fIMetric TSP\fR - A very natural restriction of the \fITSP\fR is to require that the distances between cities form a \fImetric\fR, i.e.,
they satisfy \fIthe triangle inequality\fR. That is, for any 3 cities \fIA\fR, \fIB\fR and \fIC\fR, the distance between \fIA\fR and \fIC\fR
must be at most the distance from \fIA\fR to \fIB\fR plus the distance from \fIB\fR to \fIC\fR. Most natural instances of \fITSP\fR
satisfy this constraint.
.IP \(bu
\fIEuclidean TSP\fR - Euclidean TSP, or \fIplanar TSP\fR, is the \fITSP\fR with the distance being the ordinary \fIEuclidean distance\fR.
\fIEuclidean TSP\fR is a particular case of \fITSP\fR with \fItriangle inequality\fR, since distances in plane obey triangle inequality. However,
it seems to be easier than general \fITSP\fR with \fItriangle inequality\fR. For example, \fIthe minimum spanning tree\fR of the graph associated
with an instance of \fIEuclidean TSP\fR is a \fIEuclidean minimum spanning tree\fR, and so can be computed in expected \fIO(n log n)\fR time for
\fIn\fR points (considerably less than the number of edges). This enables the simple \fI2-approximation algorithm\fR for TSP with triangle
inequality above to operate more quickly.
.IP \(bu
\fIAsymmetric TSP\fR - In most cases, the distance between two nodes in the \fITSP\fR network is the same in both directions.
The case where the distance from \fIA\fR to \fIB\fR is not equal to the distance from \fIB\fR to \fIA\fR is called \fIasymmetric TSP\fR.
A practical application of an \fIasymmetric TSP\fR is route optimisation using street-level routing (asymmetric due to one-way streets,
slip-roads and motorways).
.RE
.PP
.SS "MATCHING PROBLEM"
.TP
Definition:
Given a graph \fIG = (V,E)\fR, a matching or \fIedge-independent set\fR \fIM\fR in \fIG\fR is a set of pairwise non-adjacent edges,
that is, no two edges share a common vertex. A vertex is \fImatched\fR if it is incident to an edge in the \fImatching M\fR.
Otherwise the vertex is \fIunmatched\fR.
.TP
Generalizations:
.RS
.IP \(bu
\fIMaximal matching\fR - a matching \fIM\fR of a graph G with the property that if any edge not in \fIM\fR is added to \fIM\fR,
it is no longer a \fImatching\fR, that is, \fIM\fR is maximal if it is not a proper subset of any other \fImatching\fR in graph G.
In other words, a \fImatching M\fR of a graph G is maximal if every edge in G has a non-empty intersection with at least one edge in \fIM\fR.
.IP \(bu
\fIMaximum matching\fR - a matching that contains the largest possible number of edges. There may be many \fImaximum matchings\fR.
The \fImatching number\fR of a graph G is the size of a \fImaximum matching\fR. Note that every \fImaximum matching\fR is \fImaximal\fR,
but not every \fImaximal matching\fR is a \fImaximum matching\fR.
.IP \(bu
\fIPerfect matching\fR - a matching which matches all vertices of the graph. That is, every vertex of the graph is incident to exactly one
edge of the matching. Every \fIperfect matching\fR is \fImaximum\fR and hence \fImaximal\fR. In some literature, the term \fIcomplete matching\fR
is used. A \fIperfect matching\fR is also a \fIminimum-size edge cover\fR. Moreover, the size of a \fImaximum matching\fR is no larger than the
size of a \fIminimum edge cover\fR.
.IP \(bu
\fINear-perfect matching\fR - a matching in which exactly one vertex is unmatched. This can only occur when the graph has an odd number of vertices,
and such a \fImatching\fR must be \fImaximum\fR. If, for every vertex in a graph, there is a near-perfect matching that omits only that vertex, the graph
is also called \fIfactor-critical\fR.
.RE
.TP
Related terms:
.RS
.IP \(bu
\fIAlternating path\fR - given a matching \fIM\fR, an \fIalternating path\fR is a path in which the edges belong alternatively
to the matching and not to the matching.
.IP \(bu
\fIAugmenting path\fR - given a matching \fIM\fR, an \fIaugmenting path\fR is an \fIalternating path\fR that starts from
and ends on free (unmatched) vertices.
.RE
.PP
.SS "CUT PROBLEMS"
.TP
Definition:
A \fIcut\fR is a partition of the vertices of a graph into two \fIdisjoint subsets\fR. The \fIcut-set\fR of the \fIcut\fR is the
set of edges whose end points are in different subsets of the partition. Edges are said to be crossing the cut if they are in its \fIcut-set\fR.
.sp
Formally:
.RS
.IP \(bu
a \fIcut\fR \fIC = (S,T)\fR is a partition of \fIV\fR of a graph \fIG = (V, E)\fR.
.IP \(bu
an \fIs-t cut\fR \fIC = (S,T)\fR of a \fIflow network\fR \fIN = (V, E)\fR is a cut of \fIN\fR such that \fIs\fR is included in \fIS\fR
and \fIt\fR is included in \fIT\fR, where \fIs\fR and \fIt\fR are the \fIsource\fR and the \fIsink\fR of \fIN\fR respectively.
.IP \(bu
The \fIcut-set\fR of a \fIcut C = (S,T)\fR is such set of edges from graph \fIG = (V, E)\fR that each edge \fI(u, v)\fR satisfies
condition that \fIu\fR is included in \fIS\fR and \fIv\fR is included in \fIT\fR.
.RE
.sp
In an \fIunweighted undirected\fR graph, the size or weight of a cut is the number of edges crossing the cut. In a \fIweighted graph\fR,
the same term is defined by the sum of the weights of the edges crossing the cut.
.sp
In a \fIflow network\fR, an \fIs-t cut\fR is a cut that requires the \fIsource\fR and the \fIsink\fR to be in different subsets,
and its \fIcut-set\fR only consists of edges going from the \fIsource's\fR side to the \fIsink's\fR side. The capacity of an \fIs-t cut\fR
is defined by the sum of capacity of each edge in the \fIcut-set\fR.
.sp
The \fIcut\fR of a graph can sometimes refer to its \fIcut-set\fR instead of the partition.
.TP
Generalizations:
.RS
.IP \(bu
\fIMinimum cut\fR - A cut is minimum if the size of the cut is not larger than the size of any other cut.
.IP \(bu
\fIMaximum cut\fR - A cut is maximum if the size of the cut is not smaller than the size of any other cut.
.IP \(bu
\fISparsest cut\fR - The \fISparsest cut problem\fR is to bipartition the vertices so as to minimize the ratio of the number
of edges across the cut divided by the number of vertices in the smaller half of the partition.
.RE
.PP
.SS "K-CENTER PROBLEM"
.TP
Definitions:
.RS
.TP
\fIUnweighted K-Center\fR
For any set \fIS\fR ( which is subset of \fIV\fR ) and node \fIv\fR, let the \fIconnect(v,S)\fR be the
cost of cheapest edge connecting \fIv\fR with any node in \fIS\fR. The goal is to find
such \fIS\fR, that \fI|S| = k\fR and \fImax_v{connect(v,S)}\fR is possibly small.
.sp
In other words, we can use it i.e. for finding best locations in the city ( nodes
of input graph ) for placing k buildings, such that those buildings will be as close
as possible to all other locations in town.
.sp
.TP
\fIWeighted K-Center\fR
The variation of \fIunweighted k-center problem\fR. Besides the fact graph is edge-weighted,
there are also weights on vertices of input graph \fIG\fR. We've got also restriction
\fIW\fR. The goal is to choose such set of nodes \fIS\fR ( which is a subset of \fIV\fR ), that it's
total weight is not greater than \fIW\fR and also function: \fImax_v { min_u { cost(u,v) }}\fR
has the smallest possible worth ( \fIv\fR is a node in \fIV\fR and \fIu\fR is a node in \fIS\fR ).
.RE
.PP
.SS "FLOW PROBLEMS"
.TP
Definitions:
.RS
.IP \(bu
\fIthe maximum flow problem\fR - the goal is to find a feasible flow through a single-source, single-sink flow network that is maximum.
The \fImaximum flow problem\fR can be seen as a special case of more complex network flow problems, such as the \fIcirculation problem\fR.
The maximum value of an \fIs-t flow\fR is equal to the minimum capacity of an \fIs-t cut\fR in the network, as stated in the
\fImax-flow min-cut theorem\fR.
.sp
More formally for flow network \fIG = (V,E)\fR, where for each edge \fI(u, v)\fR we have its throuhgput \fIc(u,v)\fR defined. As \fIflow\fR
\fIF\fR we define set of non-negative integer attributes \fIf(u,v)\fR assigned to edges, satisfying such conditions:
.RS
.IP [1]
for each edge \fI(u, v)\fR in \fIG\fR such condition should be satisfied:      0 <= f(u,v) <= c(u,v)
.IP [2]
Network \fIG\fR has source node \fIs\fR such that the flow \fIF\fR is equal to the sum of outcoming flow decreased by the sum of incoming flow from that source node \fIs\fR.
.IP [3]
Network \fIG\fR has sink node \fIt\fR such that the the \fI-F\fR value is equal to the sum of the incoming flow decreased by the sum of outcoming flow from that sink node \fIt\fR.
.IP [4]
For each node that is not a \fIsource\fR or \fIsink\fR the sum of incoming flow and sum of outcoming flow should be equal.
.RE
.IP \(bu
\fIthe minimum cost flow problem\fR - the goal is finding the cheapest possible way of sending a certain amount of flow through a \fIflow network\fR.
.IP \(bu
\fIblocking flow\fR - a \fIblocking flow\fR for a \fIresidual network\fR \fIGf\fR we name such flow \fIb\fR in \fIGf\fR that:
.RS
.IP [1]
Each path from \fIsink\fR to \fIsource\fR is the shortest path in \fIGf\fR.
.IP [2]
Each shortest path in \fIGf\fR contains an edge with fully used throughput in \fIGf+b\fR.
.RE
.IP \(bu
\fIresidual network\fR - for a flow network \fIG\fR and flow \fIf\fR \fIresidual network\fR is built with those edges, which can
send larger flow. It contains only those edges, which can send flow larger than 0.
.IP \(bu
\fIlevel network\fR - it has the same set of nodes as \fIresidual graph\fR, but has only those edges \fI(u,v)\fR from \fIGf\fR
for which such equality is satisfied: \fIdistance(s,u)+1 = distance(s,v)\fR.
.IP \(bu
\fIaugmenting network\fR - it is a modification of \fIresidual network\fR considering the new
flow values. Structure stays unchanged but values of throughputs and costs at edges
are different.
.RE
.PP
.SS "APPROXIMATION ALGORITHM"
.TP
k-approximation algorithm:
Algorithm is a k-approximation, when for \fIALG\fR (solution returned by algorithm) and
\fIOPT\fR (optimal solution), such inequality is true:
.RS
.IP \(bu
for minimalization problems: \fIALG/OPT <= k\fR
.IP \(bu
for maximalization problems: \fIOPT/ALG <= k\fR
.RE
.PP
.SH REFERENCES
.IP [1]
\fIAdjacency matrix\fR [http://en.wikipedia.org/wiki/Adjacency_matrix]
.IP [2]
\fIAdjacency list\fR [http://en.wikipedia.org/wiki/Adjacency_list]
.IP [3]
\fIKruskal's algorithm\fR [http://en.wikipedia.org/wiki/Kruskal%27s_algorithm]
.IP [4]
\fIPrim's algorithm\fR [http://en.wikipedia.org/wiki/Prim%27s_algorithm]
.IP [5]
\fIBipartite graph\fR [http://en.wikipedia.org/wiki/Bipartite_graph]
.IP [6]
\fIStrongly connected components\fR [http://en.wikipedia.org/wiki/Strongly_connected_components]
.IP [7]
\fITarjan's strongly connected components algorithm\fR [http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm]
.IP [8]
\fICut vertex\fR [http://en.wikipedia.org/wiki/Cut_vertex]
.IP [9]
\fIBridge\fR [http://en.wikipedia.org/wiki/Bridge_(graph_theory)]
.IP [10]
\fIBellman-Ford's algorithm\fR [http://en.wikipedia.org/wiki/Bellman-Ford_algorithm]
.IP [11]
\fIJohnson's algorithm\fR [http://en.wikipedia.org/wiki/Johnson_algorithm]
.IP [12]
\fIFloyd-Warshall's algorithm\fR [http://en.wikipedia.org/wiki/Floyd-Warshall_algorithm]
.IP [13]
\fITravelling Salesman Problem\fR [http://en.wikipedia.org/wiki/Travelling_salesman_problem]
.IP [14]
\fIChristofides Algorithm\fR [http://en.wikipedia.org/wiki/Christofides_algorithm]
.IP [15]
\fIMax Cut\fR [http://en.wikipedia.org/wiki/Maxcut]
.IP [16]
\fIMatching\fR [http://en.wikipedia.org/wiki/Matching]
.IP [17]
\fIMax Independent Set\fR [http://en.wikipedia.org/wiki/Maximal_independent_set]
.IP [18]
\fIVertex Cover\fR [http://en.wikipedia.org/wiki/Vertex_cover_problem]
.IP [19]
\fIFord-Fulkerson's algorithm\fR [http://en.wikipedia.org/wiki/Ford-Fulkerson_algorithm]
.IP [20]
\fIMaximum Flow problem\fR [http://en.wikipedia.org/wiki/Maximum_flow_problem]
.IP [21]
\fIBusacker-Gowen's algorithm\fR [http://en.wikipedia.org/wiki/Minimum_cost_flow_problem]
.IP [22]
\fIDinic's algorithm\fR [http://en.wikipedia.org/wiki/Dinic's_algorithm]
.IP [23]
\fIK-Center problem\fR [http://www.csc.kth.se/~viggo/wwwcompendium/node128.html]
.IP [24]
\fIBFS\fR [http://en.wikipedia.org/wiki/Breadth-first_search]
.IP [25]
\fIMinimum Degree Spanning Tree\fR [http://en.wikipedia.org/wiki/Degree-constrained_spanning_tree]
.IP [26]
\fIApproximation algorithm\fR [http://en.wikipedia.org/wiki/Approximation_algorithm]
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: graph\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
adjacency list, adjacency matrix, adjacent, approximation algorithm, arc, articulation point, augmenting network, augmenting path, bfs, bipartite, blocking flow, bridge, complete graph, connected component, cut edge, cut vertex, degree, degree constrained spanning tree, diameter, dijkstra, distance, eccentricity, edge, flow network, graph, heuristic, independent set, isthmus, level graph, local searching, loop, matching, max cut, maximum flow, minimal spanning tree, minimum cost flow, minimum degree spanning tree, minimum diameter spanning tree, neighbour, node, radius, residual graph, shortest path, squared graph, strongly connected component, subgraph, travelling salesman, vertex, vertex cover
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2008 Alejandro Paz <[email protected]>
Copyright (c) 2008 (docs) Andreas Kupries <[email protected]>
Copyright (c) 2009 Michal Antoniewski <[email protected]>

.fi

Added embedded/man/files/modules/struct/matrix.n.













































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/matrix.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::matrix" n 2.0.1 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::matrix \- Create and manipulate matrix objects
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::matrix  ?2.0.1?\fR
.sp
\fB::struct::matrix\fR ?\fImatrixName\fR? ?\fB=\fR|\fB:=\fR|\fBas\fR|\fBdeserialize\fR \fIsource\fR?
.sp
\fBmatrixName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fImatrixName\fR \fB=\fR \fIsourcematrix\fR
.sp
\fImatrixName\fR \fB-->\fR \fIdestmatrix\fR
.sp
\fImatrixName\fR \fBadd column\fR ?\fIvalues\fR?
.sp
\fImatrixName\fR \fBadd row\fR ?\fIvalues\fR?
.sp
\fImatrixName\fR \fBadd columns\fR \fIn\fR
.sp
\fImatrixName\fR \fBadd rows\fR \fIn\fR
.sp
\fImatrixName\fR \fBcells\fR
.sp
\fImatrixName\fR \fBcellsize\fR \fIcolumn row\fR
.sp
\fImatrixName\fR \fBcolumns\fR
.sp
\fImatrixName\fR \fBcolumnwidth\fR \fIcolumn\fR
.sp
\fImatrixName\fR \fBdelete column\fR \fIcolumn\fR
.sp
\fImatrixName\fR \fBdelete columns\fR \fIn\fR
.sp
\fImatrixName\fR \fBdelete row\fR \fIrow\fR
.sp
\fImatrixName\fR \fBdelete rows\fR \fIn\fR
.sp
\fImatrixName\fR \fBdeserialize\fR \fIserialization\fR
.sp
\fImatrixName\fR \fBdestroy\fR
.sp
\fImatrixName\fR \fBformat 2string\fR ?\fIreport\fR?
.sp
\fImatrixName\fR \fBformat 2chan\fR ??\fIreport\fR? \fIchannel\fR?
.sp
\fImatrixName\fR \fBget cell\fR \fIcolumn row\fR
.sp
\fImatrixName\fR \fBget column\fR \fIcolumn\fR
.sp
\fImatrixName\fR \fBget rect\fR \fIcolumn_tl row_tl column_br row_br\fR
.sp
\fImatrixName\fR \fBget row\fR \fIrow\fR
.sp
\fImatrixName\fR \fBinsert column\fR \fIcolumn\fR ?\fIvalues\fR?
.sp
\fImatrixName\fR \fBinsert row\fR \fIrow\fR ?\fIvalues\fR?
.sp
\fImatrixName\fR \fBlink\fR ?-transpose? \fIarrayvar\fR
.sp
\fImatrixName\fR \fBlinks\fR
.sp
\fImatrixName\fR \fBrowheight\fR \fIrow\fR
.sp
\fImatrixName\fR \fBrows\fR
.sp
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBall\fR \fIpattern\fR
.sp
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBcolumn\fR \fIcolumn pattern\fR
.sp
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBrow\fR \fIrow pattern\fR
.sp
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBrect\fR \fIcolumn_tl row_tl column_br row_br pattern\fR
.sp
\fImatrixName\fR \fBserialize\fR ?\fIcolumn_tl row_tl column_br row_br\fR?
.sp
\fImatrixName\fR \fBset cell\fR \fIcolumn row value\fR
.sp
\fImatrixName\fR \fBset column\fR \fIcolumn values\fR
.sp
\fImatrixName\fR \fBset rect\fR \fIcolumn row values\fR
.sp
\fImatrixName\fR \fBset row\fR \fIrow values\fR
.sp
\fImatrixName\fR \fBsort columns\fR ?\fB-increasing\fR|\fB-decreasing\fR? \fIrow\fR
.sp
\fImatrixName\fR \fBsort rows\fR ?\fB-increasing\fR|\fB-decreasing\fR? \fIcolumn\fR
.sp
\fImatrixName\fR \fBswap columns\fR \fIcolumn_a column_b\fR
.sp
\fImatrixName\fR \fBswap rows\fR \fIrow_a row_b\fR
.sp
\fImatrixName\fR \fBtranspose\fR
.sp
\fImatrixName\fR \fBunlink\fR \fIarrayvar\fR
.sp
.BE
.SH DESCRIPTION
.PP
A matrix is a rectangular collection of cells, i.e. organized in rows
and columns. Each cell contains exactly one value of arbitrary
form. The cells in the matrix are addressed by pairs of integer
numbers, with the first (left) number in the pair specifying the
column and the second (right) number specifying the row the cell is
in. These indices are counted from 0 upward. The special non-numeric
index \fBend\fR refers to the last row or column in the matrix,
depending on the context. Indices of the form
\fBend\fR-\fBnumber\fR are counted from the end of the row or
column, like they are for standard Tcl lists. Trying to access
non-existing cells causes an error.
.PP
The matrices here are created empty, i.e. they have neither rows nor
columns. The user then has to add rows and columns as needed by his
application. A specialty of this structure is the ability to export an
array-view onto its contents. Such can be used by tkTable, for
example, to link the matrix into the display.
.PP
The main command of the package is:
.TP
\fB::struct::matrix\fR ?\fImatrixName\fR? ?\fB=\fR|\fB:=\fR|\fBas\fR|\fBdeserialize\fR \fIsource\fR?
The command creates a new matrix object with an associated global Tcl
command whose name is \fImatrixName\fR.  This command may be used to
invoke various operations on the matrix.  It has the following general
form:
.RS
.TP
\fBmatrixName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.RE
.sp
If \fImatrixName\fR is not specified a unique name will be generated
by the package itself. If a \fIsource\fR is specified the new matrix
will be initialized to it. For the operators \fB=\fR, \fB:=\fR,
and \fBas\fR the argument \fIsource\fR is interpreted as the name of
another matrix object, and the assignment operator \fB=\fR will be
executed. For \fBdeserialize\fR the \fIsource\fR is a serialized
matrix object and \fBdeserialize\fR will be executed.
.sp
In other words
.sp
.CS


    ::struct::matrix mymatrix = b

.CE
.sp
is equivalent to
.sp
.CS


    ::struct::matrix mymatrix
    mymatrix = b

.CE
.sp
and
.sp
.CS


    ::struct::matrix mymatrix deserialize $b

.CE
.sp
is equivalent to
.sp
.CS


    ::struct::matrix mymatrix
    mymatrix deserialize $b

.CE
.PP
.PP
The following commands are possible for matrix objects:
.TP
\fImatrixName\fR \fB=\fR \fIsourcematrix\fR
This is the assignment operator for matrix objects. It copies the matrix
contained in the matrix object \fIsourcematrix\fR over the matrix data in
\fImatrixName\fR. The old contents of \fImatrixName\fR are deleted by
this operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fImatrixName\fR \fBdeserialize\fR [\fIsourcematrix\fR \fBserialize\fR]

.CE
.TP
\fImatrixName\fR \fB-->\fR \fIdestmatrix\fR
This is the reverse assignment operator for matrix objects. It copies
the matrix contained in the matrix object \fImatrixName\fR over the matrix
data in the object \fIdestmatrix\fR.
The old contents of \fIdestmatrix\fR are deleted by this operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIdestmatrix\fR \fBdeserialize\fR [\fImatrixName\fR \fBserialize\fR]

.CE
.TP
\fImatrixName\fR \fBadd column\fR ?\fIvalues\fR?
Extends the matrix by one column and then acts like \fBset column\fR
(see below) on this new column if there were \fIvalues\fR
supplied. Without \fIvalues\fR the new cells will be set to the empty
string. The new column is appended immediately behind the last
existing column.
.TP
\fImatrixName\fR \fBadd row\fR ?\fIvalues\fR?
Extends the matrix by one row and then acts like \fBset row\fR (see
below) on this new row if there were \fIvalues\fR supplied. Without
\fIvalues\fR the new cells will be set to the empty string. The new
row is appended immediately behind the last existing row.
.TP
\fImatrixName\fR \fBadd columns\fR \fIn\fR
Extends the matrix by \fIn\fR columns. The new cells will be set to
the empty string. The new columns are appended immediately behind the
last existing column. A value of \fIn\fR equal to or smaller than 0 is
not allowed.
.TP
\fImatrixName\fR \fBadd rows\fR \fIn\fR
Extends the matrix by \fIn\fR rows. The new cells will be set to the
empty string. The new rows are appended immediately behind the last
existing row. A value of \fIn\fR equal to or smaller than 0 is not
allowed.
.TP
\fImatrixName\fR \fBcells\fR
Returns the number of cells currently managed by the matrix. This is
the product of \fBrows\fR and \fBcolumns\fR.
.TP
\fImatrixName\fR \fBcellsize\fR \fIcolumn row\fR
Returns the length of the string representation of the value currently
contained in the addressed cell.
.TP
\fImatrixName\fR \fBcolumns\fR
Returns the number of columns currently managed by the matrix.
.TP
\fImatrixName\fR \fBcolumnwidth\fR \fIcolumn\fR
Returns the length of the longest string representation of all the
values currently contained in the cells of the addressed column if
these are all spanning only one line. For cell values spanning
multiple lines the length of their longest line goes into the
computation.
.TP
\fImatrixName\fR \fBdelete column\fR \fIcolumn\fR
Deletes the specified column from the matrix and shifts all columns
with higher indices one index down.
.TP
\fImatrixName\fR \fBdelete columns\fR \fIn\fR
Deletes \fIn\fR columns from the right of the matrix. The value of
\fIn\fR has to satisfy the constraint
"0 < \fIn\fR < [\fBmatrixName\fR \fBcolumns\fR]"
.TP
\fImatrixName\fR \fBdelete row\fR \fIrow\fR
Deletes the specified row from the matrix and shifts all row with
higher indices one index down.
.TP
\fImatrixName\fR \fBdelete rows\fR \fIn\fR
Deletes \fIn\fR rows from the bottom of the matrix. The value of
\fIn\fR has to satisfy the constraint
"0 < \fIn\fR < [\fBmatrixName\fR \fBrows\fR]"
.TP
\fImatrixName\fR \fBdeserialize\fR \fIserialization\fR
This is the complement to \fBserialize\fR. It replaces matrix data
in \fImatrixName\fR with the matrix described by the \fIserialization\fR
value. The old contents of \fImatrixName\fR are deleted by this
operation.
.TP
\fImatrixName\fR \fBdestroy\fR
Destroys the matrix, including its storage space and associated
command.
.TP
\fImatrixName\fR \fBformat 2string\fR ?\fIreport\fR?
Formats the matrix using the specified report object and returns the
string containing the result of this operation. The report has to
support the \fBprintmatrix\fR method. If no \fIreport\fR is
specified the system will use an internal report definition to format
the matrix.
.TP
\fImatrixName\fR \fBformat 2chan\fR ??\fIreport\fR? \fIchannel\fR?
Formats the matrix using the specified report object and writes the
string containing the result of this operation into the channel. The
report has to support the \fBprintmatrix2channel\fR method.  If no
\fIreport\fR is specified the system will use an internal report
definition to format the matrix. If no \fIchannel\fR is specified the
system will use \fBstdout\fR.
.TP
\fImatrixName\fR \fBget cell\fR \fIcolumn row\fR
Returns the value currently contained in the cell identified by row
and column index.
.TP
\fImatrixName\fR \fBget column\fR \fIcolumn\fR
Returns a list containing the values from all cells in the column
identified by the index. The contents of the cell in row 0 are stored
as the first element of this list.
.TP
\fImatrixName\fR \fBget rect\fR \fIcolumn_tl row_tl column_br row_br\fR
Returns a list of lists of cell values. The values stored in the
result come from the sub-matrix whose top-left and bottom-right cells
are specified by \fIcolumn_tl, row_tl\fR and
\fIcolumn_br, row_br\fR resp. Note that the following equations have
to be true: "\fIcolumn_tl\fR <= \fIcolumn_br\fR" and "\fIrow_tl\fR <=
\fIrow_br\fR". The result is organized as follows: The outer list is
the list of rows, its elements are lists representing a single
row. The row with the smallest index is the first element of the outer
list. The elements of the row lists represent the selected cell
values. The cell with the smallest index is the first element in each
row list.
.TP
\fImatrixName\fR \fBget row\fR \fIrow\fR
Returns a list containing the values from all cells in the row
identified by the index. The contents of the cell in column 0 are
stored as the first element of this list.
.TP
\fImatrixName\fR \fBinsert column\fR \fIcolumn\fR ?\fIvalues\fR?
Extends the matrix by one column and then acts like \fBset column\fR
(see below) on this new column if there were \fIvalues\fR
supplied. Without \fIvalues\fR the new cells will be set to the empty
string. The new column is inserted just before the column specified by
the given index. This means, if \fIcolumn\fR is less than or equal to
zero, then the new column is inserted at the beginning of the matrix,
before the first column. If \fIcolumn\fR has the value \fBend\fR,
or if it is greater than or equal to the number of columns in the
matrix, then the new column is appended to the matrix, behind the last
column. The old column at the chosen index and all columns with higher
indices are shifted one index upward.
.TP
\fImatrixName\fR \fBinsert row\fR \fIrow\fR ?\fIvalues\fR?
Extends the matrix by one row and then acts like \fBset row\fR (see
below) on this new row if there were \fIvalues\fR supplied. Without
\fIvalues\fR the new cells will be set to the empty string. The new
row is inserted just before the row specified by the given index. This
means, if \fIrow\fR is less than or equal to zero, then the new row is
inserted at the beginning of the matrix, before the first row. If
\fIrow\fR has the value \fBend\fR, or if it is greater than or
equal to the number of rows in the matrix, then the new row is
appended to the matrix, behind the last row. The old row at that index
and all rows with higher indices are shifted one index upward.
.TP
\fImatrixName\fR \fBlink\fR ?-transpose? \fIarrayvar\fR
Links the matrix to the specified array variable. This means that the
contents of all cells in the matrix is stored in the array too, with
all changes to the matrix propagated there too. The contents of the
cell \fI(column,row)\fR is stored in the array using the key
\fIcolumn,row\fR. If the option \fB-transpose\fR is specified the
key \fIrow,column\fR will be used instead. It is possible to link the
matrix to more than one array. Note that the link is bidirectional,
i.e. changes to the array are mirrored in the matrix too.
.TP
\fImatrixName\fR \fBlinks\fR
Returns a list containing the names of all array variables the matrix
was linked to through a call to method \fBlink\fR.
.TP
\fImatrixName\fR \fBrowheight\fR \fIrow\fR
Returns the height of the specified row in lines. This is the highest
number of lines spanned by a cell over all cells in the row.
.TP
\fImatrixName\fR \fBrows\fR
Returns the number of rows currently managed by the matrix.
.TP
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBall\fR \fIpattern\fR
Searches the whole matrix for cells matching the \fIpattern\fR and
returns a list with all matches. Each item in the aforementioned list
is a list itself and contains the column and row index of the matching
cell, in this order. The results are ordered by column first and row
second, both times in ascending order. This means that matches to the
left and the top of the matrix come before matches to the right and
down.
.sp
The type of the pattern (string, glob, regular expression) is
determined by the option after the \fBsearch\fR keyword. If no
option is given it defaults to \fB-exact\fR.
.sp
If the option \fB-nocase\fR is specified the search will be
case-insensitive.
.TP
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBcolumn\fR \fIcolumn pattern\fR
Like \fBsearch all\fR, but the search is restricted to the
specified column.
.TP
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBrow\fR \fIrow pattern\fR
Like \fBsearch all\fR, but the search is restricted to the
specified row.
.TP
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBrect\fR \fIcolumn_tl row_tl column_br row_br pattern\fR
Like \fBsearch all\fR, but the search is restricted to the
specified rectangular area of the matrix.
.TP
\fImatrixName\fR \fBserialize\fR ?\fIcolumn_tl row_tl column_br row_br\fR?
This method serializes the sub-matrix spanned up by the rectangle
specification. In other words it returns a tcl \fIvalue\fR completely
describing that matrix. If no rectangle is specified the whole matrix
will be serialized.
This allows, for example, the transfer of matrix objects (or parts
thereof) over arbitrary channels, persistence, etc.
This method is also the basis for both the copy constructor and the
assignment operator.
.sp
The result of this method has to be semantically identical over all
implementations of the matrix interface. This is what will enable us
to copy matrix data between different implementations of the same
interface.
.sp
The result is a list containing exactly three items.
.sp
The first two elements of the list specify the number of rows and
columns of the matrix, in that order. The values integer numbers
greater than or equal to zero.
.sp
The last element of the list contains the values of the matrix cells
we have serialized, in the form of a value like it is returned by the
\fBget rect\fR. However empty cells to the right and bottom of
the matrix can be left out of that value as the size information in
the serialization allows the receiver the creation of a matrix with
the proper size despite the missing values.
.CS


    # A possible serialization for the matrix structure
    #
    # | a b d g |
    # | c e     |
    # | f       |
    #
    # is
    #
    # 3 4 {{a b d g} {c e} {f}}

.CE
.sp
.TP
\fImatrixName\fR \fBset cell\fR \fIcolumn row value\fR
Sets the value in the cell identified by row and column index to the
data in the third argument.
.TP
\fImatrixName\fR \fBset column\fR \fIcolumn values\fR
Sets the values in the cells identified by the column index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in row 0 and then upward. If there are less values in the
list than there are rows the remaining rows are set to the empty
string. If there are more values in the list than there are rows the
superfluous elements are ignored. The matrix is not extended by this
operation.
.TP
\fImatrixName\fR \fBset rect\fR \fIcolumn row values\fR
Takes a list of lists of cell values and writes them into the
submatrix whose top-left cell is specified by the two indices. If the
sublists of the outerlist are not of equal length the shorter sublists
will be filled with empty strings to the length of the longest
sublist. If the submatrix specified by the top-left cell and the
number of rows and columns in the \fIvalues\fR extends beyond the
matrix we are modifying the over-extending parts of the values are
ignored, i.e. essentially cut off. This subcommand expects its input
in the format as returned by \fBgetrect\fR.
.TP
\fImatrixName\fR \fBset row\fR \fIrow values\fR
Sets the values in the cells identified by the row index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in column 0 and then upward. If there are less values in the
list than there are columns the remaining columns are set to the empty
string. If there are more values in the list than there are columns
the superfluous elements are ignored. The matrix is not extended by
this operation.
.TP
\fImatrixName\fR \fBsort columns\fR ?\fB-increasing\fR|\fB-decreasing\fR? \fIrow\fR
Sorts the columns in the matrix using the data in the specified
\fIrow\fR as the key to sort by. The options \fB-increasing\fR
and \fB-decreasing\fR have the same meaning as for \fBlsort\fR.
If no option is specified \fB-increasing\fR is assumed.
.TP
\fImatrixName\fR \fBsort rows\fR ?\fB-increasing\fR|\fB-decreasing\fR? \fIcolumn\fR
Sorts the rows in the matrix using the data in the specified
\fIcolumn\fR as the key to sort by. The options \fB-increasing\fR
and \fB-decreasing\fR have the same meaning as for \fBlsort\fR.
If no option is specified \fB-increasing\fR is assumed.
.TP
\fImatrixName\fR \fBswap columns\fR \fIcolumn_a column_b\fR
Swaps the contents of the two specified columns.
.TP
\fImatrixName\fR \fBswap rows\fR \fIrow_a row_b\fR
Swaps the contents of the two specified rows.
.TP
\fImatrixName\fR \fBtranspose\fR
Transposes the contents of the matrix, i.e. swaps rows for columns and
vice versa.
.TP
\fImatrixName\fR \fBunlink\fR \fIarrayvar\fR
Removes the link between the matrix and the specified arrayvariable,
if there is one.
.PP
.SH EXAMPLES
.PP
The examples below assume a 5x5 matrix M with the first row containing
the values 1 to 5, with 1 in the top-left cell. Each other row
contains the contents of the row above it, rotated by one cell to the
right.
.PP
.CS


 % M getrect 0 0 4 4
 {{1 2 3 4 5} {5 1 2 3 4} {4 5 1 2 3} {3 4 5 1 2} {2 3 4 5 1}}

.CE
.PP
.CS


 % M setrect 1 1 {{0 0 0} {0 0 0} {0 0 0}}
 % M getrect 0 0 4 4
 {{1 2 3 4 5} {5 0 0 0 4} {4 0 0 0 3} {3 0 0 0 2} {2 3 4 5 1}}

.CE
.PP
Assuming that the style definitions in the example section of the
manpage for the package \fBreport\fR are loaded into the
interpreter now an example which formats a matrix into a tabular
report. The code filling the matrix with data is not shown.  contains
useful data.
.PP
.CS


    % ::struct::matrix m
    % # ... fill m with data, assume 5 columns
    % ::report::report r 5 style captionedtable 1
    % m format 2string r
    +---+-------------------+-------+-------+--------+
    |000|VERSIONS:          |2:8.4a3|1:8.4a3|1:8.4a3%|
    +---+-------------------+-------+-------+--------+
    |001|CATCH return ok    |7      |13     |53.85   |
    |002|CATCH return error |68     |91     |74.73   |
    |003|CATCH no catch used|7      |14     |50.00   |
    |004|IF if true numeric |12     |33     |36.36   |
    |005|IF elseif          |15     |47     |31.91   |
    |   |true numeric       |       |       |        |
    +---+-------------------+-------+-------+--------+
    %
    % # alternate way of doing the above
    % r printmatrix m

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: matrix\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
matrix
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/struct/matrix1.n.













































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/matrix1.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::matrix_v1" n 1.2.1 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::matrix_v1 \- Create and manipulate matrix objects
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::matrix  ?1.2.1?\fR
.sp
\fBmatrixName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fImatrixName\fR \fBadd column\fR ?\fIvalues\fR?
.sp
\fImatrixName\fR \fBadd row\fR ?\fIvalues\fR?
.sp
\fImatrixName\fR \fBadd columns\fR \fIn\fR
.sp
\fImatrixName\fR \fBadd rows\fR \fIn\fR
.sp
\fImatrixName\fR \fBcells\fR
.sp
\fImatrixName\fR \fBcellsize\fR \fIcolumn row\fR
.sp
\fImatrixName\fR \fBcolumns\fR
.sp
\fImatrixName\fR \fBcolumnwidth\fR \fIcolumn\fR
.sp
\fImatrixName\fR \fBdelete column\fR \fIcolumn\fR
.sp
\fImatrixName\fR \fBdelete row\fR \fIrow\fR
.sp
\fImatrixName\fR \fBdestroy\fR
.sp
\fImatrixName\fR \fBformat 2string\fR ?\fIreport\fR?
.sp
\fImatrixName\fR \fBformat 2chan\fR ??\fIreport\fR? \fIchannel\fR?
.sp
\fImatrixName\fR \fBget cell\fR \fIcolumn row\fR
.sp
\fImatrixName\fR \fBget column\fR \fIcolumn\fR
.sp
\fImatrixName\fR \fBget rect\fR \fIcolumn_tl row_tl column_br row_br\fR
.sp
\fImatrixName\fR \fBget row\fR \fIrow\fR
.sp
\fImatrixName\fR \fBinsert column\fR \fIcolumn\fR ?\fIvalues\fR?
.sp
\fImatrixName\fR \fBinsert row\fR \fIrow\fR ?\fIvalues\fR?
.sp
\fImatrixName\fR \fBlink\fR ?-transpose? \fIarrayvar\fR
.sp
\fImatrixName\fR \fBlinks\fR
.sp
\fImatrixName\fR \fBrowheight\fR \fIrow\fR
.sp
\fImatrixName\fR \fBrows\fR
.sp
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBall\fR \fIpattern\fR
.sp
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBcolumn\fR \fIcolumn pattern\fR
.sp
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBrow\fR \fIrow pattern\fR
.sp
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBrect\fR \fIcolumn_tl row_tl column_br row_br pattern\fR
.sp
\fImatrixName\fR \fBset cell\fR \fIcolumn row value\fR
.sp
\fImatrixName\fR \fBset column\fR \fIcolumn values\fR
.sp
\fImatrixName\fR \fBset rect\fR \fIcolumn row values\fR
.sp
\fImatrixName\fR \fBset row\fR \fIrow values\fR
.sp
\fImatrixName\fR \fBsort columns\fR ?\fB-increasing\fR|\fB-decreasing\fR? \fIrow\fR
.sp
\fImatrixName\fR \fBsort rows\fR ?\fB-increasing\fR|\fB-decreasing\fR? \fIcolumn\fR
.sp
\fImatrixName\fR \fBswap columns\fR \fIcolumn_a column_b\fR
.sp
\fImatrixName\fR \fBswap rows\fR \fIrow_a row_b\fR
.sp
\fImatrixName\fR \fBunlink\fR \fIarrayvar\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fB::struct::matrix\fR command creates a new matrix object with an
associated global Tcl command whose name is \fImatrixName\fR.  This
command may be used to invoke various operations on the matrix.  It has
the following general form:
.TP
\fBmatrixName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.PP
.PP
A matrix is a rectangular collection of cells, i.e. organized in rows
and columns. Each cell contains exactly one value of arbitrary
form. The cells in the matrix are addressed by pairs of integer
numbers, with the first (left) number in the pair specifying the
column and the second (right) number specifying the row the cell is
in. These indices are counted from 0 upward. The special non-numeric
index \fBend\fR refers to the last row or column in the matrix,
depending on the context. Indices of the form
\fBend\fR-\fBnumber\fR are counted from the end of the row or
column, like they are for standard Tcl lists. Trying to access
non-existing cells causes an error.
.PP
The matrices here are created empty, i.e. they have neither rows nor
columns. The user then has to add rows and columns as needed by his
application. A specialty of this structure is the ability to export an
array-view onto its contents. Such can be used by tkTable, for
example, to link the matrix into the display.
.PP
The following commands are possible for matrix objects:
.TP
\fImatrixName\fR \fBadd column\fR ?\fIvalues\fR?
Extends the matrix by one column and then acts like \fBsetcolumn\fR
(see below) on this new column if there were \fIvalues\fR
supplied. Without \fIvalues\fR the new cells will be set to the empty
string. The new column is appended immediately behind the last
existing column.
.TP
\fImatrixName\fR \fBadd row\fR ?\fIvalues\fR?
Extends the matrix by one row and then acts like \fBsetrow\fR (see
below) on this new row if there were \fIvalues\fR supplied. Without
\fIvalues\fR the new cells will be set to the empty string. The new
row is appended immediately behind the last existing row.
.TP
\fImatrixName\fR \fBadd columns\fR \fIn\fR
Extends the matrix by \fIn\fR columns. The new cells will be set to
the empty string. The new columns are appended immediately behind the
last existing column. A value of \fIn\fR equal to or smaller than 0 is
not allowed.
.TP
\fImatrixName\fR \fBadd rows\fR \fIn\fR
Extends the matrix by \fIn\fR rows. The new cells will be set to the
empty string. The new rows are appended immediately behind the last
existing row. A value of \fIn\fR equal to or smaller than 0 is not
allowed.
.TP
\fImatrixName\fR \fBcells\fR
Returns the number of cells currently managed by the matrix. This is
the product of \fBrows\fR and \fBcolumns\fR.
.TP
\fImatrixName\fR \fBcellsize\fR \fIcolumn row\fR
Returns the length of the string representation of the value currently
contained in the addressed cell.
.TP
\fImatrixName\fR \fBcolumns\fR
Returns the number of columns currently managed by the matrix.
.TP
\fImatrixName\fR \fBcolumnwidth\fR \fIcolumn\fR
Returns the length of the longest string representation of all the
values currently contained in the cells of the addressed column if
these are all spanning only one line. For cell values spanning
multiple lines the length of their longest line goes into the
computation.
.TP
\fImatrixName\fR \fBdelete column\fR \fIcolumn\fR
Deletes the specified column from the matrix and shifts all columns
with higher indices one index down.
.TP
\fImatrixName\fR \fBdelete row\fR \fIrow\fR
Deletes the specified row from the matrix and shifts all row with
higher indices one index down.
.TP
\fImatrixName\fR \fBdestroy\fR
Destroys the matrix, including its storage space and associated
command.
.TP
\fImatrixName\fR \fBformat 2string\fR ?\fIreport\fR?
Formats the matrix using the specified report object and returns the
string containing the result of this operation. The report has to
support the \fBprintmatrix\fR method. If no \fIreport\fR is
specified the system will use an internal report definition to format
the matrix.
.TP
\fImatrixName\fR \fBformat 2chan\fR ??\fIreport\fR? \fIchannel\fR?
Formats the matrix using the specified report object and writes the
string containing the result of this operation into the channel. The
report has to support the \fBprintmatrix2channel\fR method.  If no
\fIreport\fR is specified the system will use an internal report
definition to format the matrix. If no \fIchannel\fR is specified the
system will use \fBstdout\fR.
.TP
\fImatrixName\fR \fBget cell\fR \fIcolumn row\fR
Returns the value currently contained in the cell identified by row
and column index.
.TP
\fImatrixName\fR \fBget column\fR \fIcolumn\fR
Returns a list containing the values from all cells in the column
identified by the index. The contents of the cell in row 0 are stored
as the first element of this list.
.TP
\fImatrixName\fR \fBget rect\fR \fIcolumn_tl row_tl column_br row_br\fR
Returns a list of lists of cell values. The values stored in the
result come from the sub-matrix whose top-left and bottom-right cells
are specified by \fIcolumn_tl, row_tl\fR and
\fIcolumn_br, row_br\fR resp. Note that the following equations have
to be true: "\fIcolumn_tl\fR <= \fIcolumn_br\fR" and "\fIrow_tl\fR <=
\fIrow_br\fR". The result is organized as follows: The outer list is
the list of rows, its elements are lists representing a single
row. The row with the smallest index is the first element of the outer
list. The elements of the row lists represent the selected cell
values. The cell with the smallest index is the first element in each
row list.
.TP
\fImatrixName\fR \fBget row\fR \fIrow\fR
Returns a list containing the values from all cells in the row
identified by the index. The contents of the cell in column 0 are
stored as the first element of this list.
.TP
\fImatrixName\fR \fBinsert column\fR \fIcolumn\fR ?\fIvalues\fR?
Extends the matrix by one column and then acts like \fBsetcolumn\fR
(see below) on this new column if there were \fIvalues\fR
supplied. Without \fIvalues\fR the new cells will be set to the empty
string. The new column is inserted just before the column specified by
the given index. This means, if \fIcolumn\fR is less than or equal to
zero, then the new column is inserted at the beginning of the matrix,
before the first column. If \fIcolumn\fR has the value \fBend\fR,
or if it is greater than or equal to the number of columns in the
matrix, then the new column is appended to the matrix, behind the last
column. The old column at the chosen index and all columns with higher
indices are shifted one index upward.
.TP
\fImatrixName\fR \fBinsert row\fR \fIrow\fR ?\fIvalues\fR?
Extends the matrix by one row and then acts like \fBsetrow\fR (see
below) on this new row if there were \fIvalues\fR supplied. Without
\fIvalues\fR the new cells will be set to the empty string. The new
row is inserted just before the row specified by the given index. This
means, if \fIrow\fR is less than or equal to zero, then the new row is
inserted at the beginning of the matrix, before the first row. If
\fIrow\fR has the value \fBend\fR, or if it is greater than or
equal to the number of rows in the matrix, then the new row is
appended to the matrix, behind the last row. The old row at that index
and all rows with higher indices are shifted one index upward.
.TP
\fImatrixName\fR \fBlink\fR ?-transpose? \fIarrayvar\fR
Links the matrix to the specified array variable. This means that the
contents of all cells in the matrix is stored in the array too, with
all changes to the matrix propagated there too. The contents of the
cell \fI(column,row)\fR is stored in the array using the key
\fIcolumn,row\fR. If the option \fB-transpose\fR is specified the
key \fIrow,column\fR will be used instead. It is possible to link the
matrix to more than one array. Note that the link is bidirectional,
i.e. changes to the array are mirrored in the matrix too.
.TP
\fImatrixName\fR \fBlinks\fR
Returns a list containing the names of all array variables the matrix
was linked to through a call to method \fBlink\fR.
.TP
\fImatrixName\fR \fBrowheight\fR \fIrow\fR
Returns the height of the specified row in lines. This is the highest
number of lines spanned by a cell over all cells in the row.
.TP
\fImatrixName\fR \fBrows\fR
Returns the number of rows currently managed by the matrix.
.TP
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBall\fR \fIpattern\fR
Searches the whole matrix for cells matching the \fIpattern\fR and
returns a list with all matches. Each item in the aforementioned list
is a list itself and contains the column and row index of the matching
cell, in this order. The results are ordered by column first and row
second, both times in ascending order. This means that matches to the
left and the top of the matrix come before matches to the right and
down.
.sp
The type of the pattern (string, glob, regular expression) is
determined by the option after the \fBsearch\fR keyword. If no
option is given it defaults to \fB-exact\fR.
.sp
If the option \fB-nocase\fR is specified the search will be
case-insensitive.
.TP
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBcolumn\fR \fIcolumn pattern\fR
Like \fBsearch all\fR, but the search is restricted to the
specified column.
.TP
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBrow\fR \fIrow pattern\fR
Like \fBsearch all\fR, but the search is restricted to the
specified row.
.TP
\fImatrixName\fR \fBsearch\fR ?-nocase? ?-exact|-glob|-regexp? \fBrect\fR \fIcolumn_tl row_tl column_br row_br pattern\fR
Like \fBsearch all\fR, but the search is restricted to the
specified rectangular area of the matrix.
.TP
\fImatrixName\fR \fBset cell\fR \fIcolumn row value\fR
Sets the value in the cell identified by row and column index to the
data in the third argument.
.TP
\fImatrixName\fR \fBset column\fR \fIcolumn values\fR
Sets the values in the cells identified by the column index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in row 0 and then upward. If there are less values in the
list than there are rows the remaining rows are set to the empty
string. If there are more values in the list than there are rows the
superfluous elements are ignored. The matrix is not extended by this
operation.
.TP
\fImatrixName\fR \fBset rect\fR \fIcolumn row values\fR
Takes a list of lists of cell values and writes them into the
submatrix whose top-left cell is specified by the two indices. If the
sublists of the outerlist are not of equal length the shorter sublists
will be filled with empty strings to the length of the longest
sublist. If the submatrix specified by the top-left cell and the
number of rows and columns in the \fIvalues\fR extends beyond the
matrix we are modifying the over-extending parts of the values are
ignored, i.e. essentially cut off. This subcommand expects its input
in the format as returned by \fBgetrect\fR.
.TP
\fImatrixName\fR \fBset row\fR \fIrow values\fR
Sets the values in the cells identified by the row index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in column 0 and then upward. If there are less values in the
list than there are columns the remaining columns are set to the empty
string. If there are more values in the list than there are columns
the superfluous elements are ignored. The matrix is not extended by
this operation.
.TP
\fImatrixName\fR \fBsort columns\fR ?\fB-increasing\fR|\fB-decreasing\fR? \fIrow\fR
Sorts the columns in the matrix using the data in the specified
\fIrow\fR as the key to sort by. The options \fB-increasing\fR
and \fB-decreasing\fR have the same meaning as for \fBlsort\fR.
If no option is specified \fB-increasing\fR is assumed.
.TP
\fImatrixName\fR \fBsort rows\fR ?\fB-increasing\fR|\fB-decreasing\fR? \fIcolumn\fR
Sorts the rows in the matrix using the data in the specified
\fIcolumn\fR as the key to sort by. The options \fB-increasing\fR
and \fB-decreasing\fR have the same meaning as for \fBlsort\fR.
If no option is specified \fB-increasing\fR is assumed.
.TP
\fImatrixName\fR \fBswap columns\fR \fIcolumn_a column_b\fR
Swaps the contents of the two specified columns.
.TP
\fImatrixName\fR \fBswap rows\fR \fIrow_a row_b\fR
Swaps the contents of the two specified rows.
.TP
\fImatrixName\fR \fBunlink\fR \fIarrayvar\fR
Removes the link between the matrix and the specified arrayvariable,
if there is one.
.PP
.SH EXAMPLES
.PP
The examples below assume a 5x5 matrix M with the first row containing
the values 1 to 5, with 1 in the top-left cell. Each other row
contains the contents of the row above it, rotated by one cell to the
right.
.PP
.CS


 % M getrect 0 0 4 4
 {{1 2 3 4 5} {5 1 2 3 4} {4 5 1 2 3} {3 4 5 1 2} {2 3 4 5 1}}

.CE
.PP
.CS


 % M setrect 1 1 {{0 0 0} {0 0 0} {0 0 0}}
 % M getrect 0 0 4 4
 {{1 2 3 4 5} {5 0 0 0 4} {4 0 0 0 3} {3 0 0 0 2} {2 3 4 5 1}}

.CE
.PP
Assuming that the style definitions in the example section of the
manpage for the package \fBreport\fR are loaded into the
interpreter now an example which formats a matrix into a tabular
report. The code filling the matrix with data is not shown.  contains
useful data.
.PP
.CS


    % ::struct::matrix m
    % # ... fill m with data, assume 5 columns
    % ::report::report r 5 style captionedtable 1
    % m format 2string r
    +---+-------------------+-------+-------+--------+
    |000|VERSIONS:          |2:8.4a3|1:8.4a3|1:8.4a3%|
    +---+-------------------+-------+-------+--------+
    |001|CATCH return ok    |7      |13     |53.85   |
    |002|CATCH return error |68     |91     |74.73   |
    |003|CATCH no catch used|7      |14     |50.00   |
    |004|IF if true numeric |12     |33     |36.36   |
    |005|IF elseif          |15     |47     |31.91   |
    |   |true numeric       |       |       |        |
    +---+-------------------+-------+-------+--------+
    %
    % # alternate way of doing the above
    % r printmatrix m

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: matrix\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
matrix
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/struct/pool.n.


































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/pool.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Erik Leunissen <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::pool" n 1.2.1 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::pool \- Create and manipulate pool objects (of discrete items)
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::pool  ?1.2.1?\fR
.sp
\fB::struct::pool\fR ?\fIpoolName\fR? ?\fImaxsize\fR?
.sp
\fBpoolName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIpoolName\fR \fBadd\fR \fIitemName1\fR ?\fIitemName2 itemName3 ...\fR?
.sp
\fIpoolName\fR \fBclear\fR ?\fB-force\fR?
.sp
\fIpoolName\fR \fBdestroy\fR ?\fB-force\fR?
.sp
\fIpoolName\fR \fBinfo\fR \fItype\fR ?\fIarg\fR?
.sp
\fIpoolName\fR \fBmaxsize\fR ?\fImaxsize\fR?
.sp
\fIpoolName\fR \fBrelease\fR \fIitemName\fR
.sp
\fIpoolName\fR \fBremove\fR \fIitemName\fR ?\fB-force\fR?
.sp
\fIpoolName\fR \fBrequest\fR itemVar ?options?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides pool objects which can be used to manage
finite collections of discrete items.
.TP
\fB::struct::pool\fR ?\fIpoolName\fR? ?\fImaxsize\fR?
Creates a new pool object. If no \fIpoolName\fR is supplied, then the
new pool will be named pool\fBX\fR, where X is a positive integer.
The optional second argument \fImaxsize\fR has to be a positive
integer indicating the maximum size of the pool; this is the maximum
number of items the pool may hold. The default for this value is
\fB10\fR.
.sp
The pool object has an associated global Tcl command whose name is
\fIpoolName\fR. This command may be used to invoke various
configuration operations on the report. It has the following general
form:
.RS
.TP
\fBpoolName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command. See section \fBPOOL OBJECT COMMAND\fR for a detailed
list of options and their behaviour.
.RE
.PP
.PP
.SH "POOLS AND ALLOCATION"
The purpose of the pool command and the pool object command that it
generates, is to manage pools of discrete items.
Examples of a pool of discrete items are:
.IP \(bu
the seats in a cinema, theatre, train etc.. for which visitors/travelers can  make a reservation;
.IP \(bu
the dynamic IP-addresses that an ISP can dole out  to subscribers;
.IP \(bu
a car rental's collection of cars, which can be rented by customers;
.IP \(bu
the class rooms in a school building, which need to be scheduled;
.IP \(bu
the database connections available to client-threads in a web-server application;
.IP \(bu
the books in a library that customers can borrow;
.IP \(bu
etc ...
.PP
.PP
The common denominator in the examples is that there is a more or less
fixed number of items (seats, IP-addresses, cars, ...) that are
supposed to be allocated on a more or less regular basis. An item can
be allocated only once at a time. An item that is allocated, must be
released before it can be re-allocated.  While several items in a pool
are being allocated and released continuously, the total number of
items in the pool remains constant.
.PP
Keeping track of which items are allocated, and by whom, is the
purpose of the pool command and its subordinates.
.PP
\fIPool parlance\fR: If we say that an item is
\fIallocated\fR, it means that the item is \fIbusy\fR,
\fIowned\fR or \fIoccupied\fR; it is not available anymore. If
an item is \fIfree\fR, it is \fIavailable\fR. Deallocating an
item is equivalent to setting free or releasing an item. The person or
entity to which the item has been allotted is said to own the item.
.SH ITEMS
\fIDiscrete items\fR
.PP
The \fBpool\fR command is designed for
\fIdiscrete items only\fR. Note that there are pools where
allocation occurs on a non-discrete basis, for example computer
memory. There are also pools from which the shares that are doled out
are not expected to be returned, for example a charity fund or a pan
of soup from which you may receive a portion. Finally, there are even
pools from which nothing is ever allocated or returned, like a
swimming pool or a cesspool.
.PP
\fIUnique item names\fR
.PP
A pool cannot manage duplicate item names. Therefore, items in a pool
must have unique names.
.PP
\fIItem equivalence\fR
.PP
From the point of view of the manager of a pool, items are
equivalent. The manager of a pool is indifferent about which
entity/person occupies a given item. However, clients may have
preferences for a particular item, based on some item property they
know.
.PP
\fIPreferences\fR
.PP
A future owner may have a preference for a particular item. Preference
based allocation is supported (see the \fB-prefer\fR option to the
request subcommand). A preference for a particular item is most likely
to result from variability among features associated with the
items. Note that the pool commands themselves are not designed to
manage such item properties. If item properties play a role in an
application, they should be managed separately.
.SH "POOL OBJECT COMMAND"
The following subcommands and corresponding arguments are available to
any pool object command.
.TP
\fIpoolName\fR \fBadd\fR \fIitemName1\fR ?\fIitemName2 itemName3 ...\fR?
This command adds the items on the command line to the pool. If
duplicate item names occur on the command line, an error is raised. If
one or more of the items already exist in the pool, this also is
considered an error.
.TP
\fIpoolName\fR \fBclear\fR ?\fB-force\fR?
Removes all items from the pool. If there are any allocated items at
the time when the command is invoked, an error is raised. This
behaviour may be modified through the \fB-force\fR argument. If it
is supplied on the command line, the pool will be cleared regardless
the allocation state of its items.
.TP
\fIpoolName\fR \fBdestroy\fR ?\fB-force\fR?
Destroys the pool data structure, all associated variables and the
associated pool object command. By default, the command checks whether
any items are still allocated and raises an error if such is the
case. This behaviour may be modified through the argument
\fB-force\fR. If it is supplied on the command line, the pool data
structure will be destroyed regardless allocation state of its items.
.TP
\fIpoolName\fR \fBinfo\fR \fItype\fR ?\fIarg\fR?
Returns various information about the pool for further programmatic
use. The \fItype\fR argument indicates the type of information
requested. Only the type \fBallocID\fR uses an additional argument.
.RS
.TP
\fBallocID\fR \fIitemName\fR
returns the allocID of the item whose name is \fIitemName\fR. Free
items have an allocation id of \fB-1\fR.
.TP
\fBallitems\fR
returns a list of all items in the pool.
.TP
\fBallocstate\fR
Returns a list of key-value pairs, where the keys are the items and
the values are the corresponding allocation id's. Free items have an
allocation id of \fB-1\fR.
.TP
\fBcursize\fR
returns the current pool size, i.e. the number of items in the pool.
.TP
\fBfreeitems\fR
returns a list of items that currently are not allocated.
.TP
\fBmaxsize\fR
returns the maximum size of the pool.
.RE
.sp
.TP
\fIpoolName\fR \fBmaxsize\fR ?\fImaxsize\fR?
Sets or queries the maximum size of the pool, depending on whether the
\fImaxsize\fR argument is supplied or not. If \fImaxsize\fR is
supplied, the maximum size of the pool will be set to that value. If
no argument is supplied, the current maximum size of the pool is
returned. In this variant, the command is an alias for:
.sp
\fBpoolName info maxsize\fR.
.sp
The \fImaxsize\fR argument has to be a positive integer.
.TP
\fIpoolName\fR \fBrelease\fR \fIitemName\fR
Releases the item whose name is \fIitemName\fR that was allocated
previously. An error is raised if the item was not allocated at the
time when the command was issued.
.TP
\fIpoolName\fR \fBremove\fR \fIitemName\fR ?\fB-force\fR?
Removes the item whose name is \fIitemName\fR from the pool. If the
item was allocated at the time when the command was invoked, an error
is raised. This behaviour may be modified through the optional
argument \fB-force\fR. If it is supplied on the command line, the
item will be removed regardless its allocation state.
.TP
\fIpoolName\fR \fBrequest\fR itemVar ?options?
Handles a request for an item, taking into account a possible
preference for a particular item. There are two possible outcomes
depending on the availability of items:
.RS
.IP [1]
The request is honoured, an item is allocated and the variable whose
name is passed with the argument \fIitemVar\fR will be set to the name
of the item that was allocated. The command returns 1.
.IP [2]
The request is denied. No item is allocated. The variable whose name
is itemVar is not set.  Attempts to read \fIitemVar\fR may raise an
error if the variable was not defined before issuing the request. The
command returns 0.
.RE
.sp
The return values from this command are meant to be inspected. The
examples below show how to do this. Failure to check the return value
may result in erroneous behaviour. If no preference for a particular
item is supplied through the option \fB-prefer\fR (see below), then
all requests are honoured as long as items are available.
.sp
The following options are supported:
.RS
.TP
\fB-allocID\fR \fIallocID\fR
If the request is honoured, an item will be allocated to the entity
identified by allocID. If the allocation state of an item is queried,
it is this allocation ID that will be returned. If the option
\fB-allocID\fR is not supplied, the item will be given to and owned
by \fBdummyID\fR. Allocation id's may be anything except the value
-1, which is reserved for free items.
.TP
\fB-prefer\fR \fIpreferredItem\fR
This option modifies the allocation strategy as follows: If the item
whose name is \fIpreferredItem\fR is not allocated at the time when
the command is invoked, the request is honoured (return value is
1). If the item was allocated at the time when the command was
invoked, the request is denied (return value is 0).
.RE
.PP
.SH EXAMPLES
Two examples are provided. The first one mimics a step by step
interactive tclsh session, where each step is explained. The second
example shows the usage in a server application that talks to a
back-end application.
.PP
\fIExample 1\fR
.PP
This example presents an interactive tclsh session which considers the
case of a Car rental's collection of cars. Ten steps explain its usage
in chronological order, from the creation of the pool, via the most
important stages in the usage of a pool, to the final destruction.
.PP
\fINote aside:\fR
.PP
In this example, brand names are used to label the various
items. However, a brand name could be regarded as a property of an
item. Because the pool command is not designed to manage properties of
items, they need to be managed separately. In the latter case the
items should be labeled with more neutral names such as: car1, car2,
car3 , etc ... and a separate database or array should hold the brand
names associated with the car labels.
.PP
.CS


     1. Load the package into an interpreter
     % package require pool
     0.1

     2. Create a pool object called `CarPool' with a maximum size of 55 items (cars):
     % pool CarPool 55
     CarPool

     4. Add items to the pool:
     % CarPool add Toyota Trabant Chrysler1 Chrysler2 Volkswagen

     5. Somebody crashed the Toyota. Remove it from the pool as follows:
     % CarPool remove Toyota

     6. Acquired a new car for the pool. Add it as follows:
     % CarPool add Nissan

     7. Check whether the pool was adjusted correctly:
     % CarPool info allitems
     Trabant Chrysler1 Chrysler2 Volkswagen Nissan

.CE
.PP
Suspend the interactive session temporarily, and show the programmatic
use of the request subcommand:
.PP
.CS


     # Mrs. Swift needs a car. She doesn't have a preference for a
     # particular car. We'll issue a request on her behalf as follows:
     if { [CarPool request car -allocID "Mrs. Swift"] }  {
         # request was honoured, process the variable `car'
         puts "$car has been allocated to [CarPool info allocID $car]."
     } else {
         # request was denied
          puts "No car available."
     }

.CE
.PP
Note how the \fBif\fR command uses the value returned by the
\fBrequest\fR subcommand.
.PP
.CS


     # Suppose Mr. Wiggly has a preference for the Trabant:
     if { [CarPool request car -allocID "Mr. Wiggly" -prefer Trabant] }  {
         # request was honoured, process the variable `car'
         puts "$car has been allocated to [CarPool info allocID $car]."
     } else {
         # request was denied
          puts "The Trabant was not available."
     }

.CE
.PP
Resume the interactive session:
.PP
.CS


     8. When the car is returned then you can render it available by:
     % CarPool release Trabant

     9. When done, you delete the pool.
     % CarPool destroy
     Couldn't destroy `CarPool' because some items are still allocated.

     Oops, forgot that Mrs. Swift still occupies a car.

     10. We force the destruction of the pool as follows:
     % CarPool destroy -force

.CE
.PP
\fIExample 2\fR
.PP
This example describes the case from which the author's need for pool
management originated. It is an example of a server application that
receives requests from client applications. The client requests are
dispatched onto a back-end application before being returned to the
client application. In many cases there are a few equivalent instances
of back-end applications to which a client request may be passed
along. The file descriptors that identify the channels to these
back-end instances make up a pool of connections. A particular
connection may be allocated to just one client request at a time.
.PP
.CS


     # Create the pool of connections (pipes)
     set maxpipes 10
     pool Pipes $maxpipes
     for {set i 0} {$i < $maxpipes} {incr i} {
         set fd [open "|backendApplication" w+]
         Pipes add $fd
     }

     # A client request comes in. The request is identified as `clientX'.
     # Dispatch it onto an instance of a back-end application
     if { [Pipes request fd -allocID clientX] } {
         # a connection was allocated
         # communicate to the back-end application via the variable `fd'
         puts $fd "someInstruction"
         # ...... etc.
     } else {
         # all connections are currently occupied
         # store the client request in a queue for later processing,
         # or return a 'Server busy' message to the client.
     }

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: pool\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
discrete items, finite, pool, struct
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002, Erik Leunissen <[email protected]>

.fi

Added embedded/man/files/modules/struct/prioqueue.n.








































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/prioqueue.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003 Michael Schlenker <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::prioqueue" n 1.4 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::prioqueue \- Create and manipulate prioqueue objects
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::prioqueue  ?1.4?\fR
.sp
\fB::struct::prioqueue\fR ?\fB-ascii|-dictionary|-integer|-real\fR? ?\fIprioqueueName\fR?
.sp
\fIprioqueueName\fR \fBoption\fR ?\fIarg arg ...\fR?
.sp
\fIprioqueueName\fR \fBclear\fR
.sp
\fIprioqueueName\fR \fBremove\fR \fIitem\fR
.sp
\fIprioqueueName\fR \fBdestroy\fR
.sp
\fIprioqueueName\fR \fBget\fR ?\fIcount\fR?
.sp
\fIprioqueueName\fR \fBpeek\fR ?\fIcount\fR?
.sp
\fIprioqueueName\fR \fBpeekpriority\fR ?\fIcount\fR?
.sp
\fIprioqueueName\fR \fBput\fR \fIitem prio\fR ?\fIitem prio ...\fR?
.sp
\fIprioqueueName\fR \fBsize\fR
.sp
.BE
.SH DESCRIPTION
This package implements a simple priority queue using nested tcl lists.
.PP
The command \fB::struct::prioqueue\fR creates a new priority queue
with default priority key type \fI-integer\fR. This means that keys
given to the \fBput\fR subcommand must have this type.
.PP
This also sets the priority ordering. For key types \fI-ascii\fR and
\fI-dictionary\fR the data is sorted in ascending order (as with
\fBlsort\fR \fI-increasing\fR), thereas for \fI-integer\fR and
\fI-real\fR the data is sorted in descending order (as with
\fBlsort\fR \fI-decreasing\fR).
.PP
Prioqueue names are unrestricted, but may be recognized as options if
no priority type is given.
.TP
\fB::struct::prioqueue\fR ?\fB-ascii|-dictionary|-integer|-real\fR? ?\fIprioqueueName\fR?
The \fB::struct::prioqueue\fR command creates a new prioqueue object
with an associated global Tcl command whose name is
\fIprioqueueName\fR. This command may be used to invoke various
operations on the prioqueue.  It has the following general form:
.TP
\fIprioqueueName\fR \fBoption\fR ?\fIarg arg ...\fR?
\fBoption\fR and the \fIarg\fRs determine the exact behavior of the
command.  The following commands are possible for prioqueue objects:
.TP
\fIprioqueueName\fR \fBclear\fR
Remove all items from the prioqueue.
.TP
\fIprioqueueName\fR \fBremove\fR \fIitem\fR
Remove the selected item from this priority queue.
.TP
\fIprioqueueName\fR \fBdestroy\fR
Destroy the prioqueue, including its storage space and associated
command.
.TP
\fIprioqueueName\fR \fBget\fR ?\fIcount\fR?
Return the front \fIcount\fR items of the prioqueue (but not their
priorities) and remove them from the prioqueue.
If \fIcount\fR is not specified, it defaults to 1.  If \fIcount\fR is
1, the result is a simple string; otherwise, it is a list.  If
specified, \fIcount\fR must be greater than or equal to 1.  If there
are no or too few items in the prioqueue, this command will throw an
error.
.TP
\fIprioqueueName\fR \fBpeek\fR ?\fIcount\fR?
Return the front \fIcount\fR items of the prioqueue (but not their
priorities), without removing them from the prioqueue.
If \fIcount\fR is not specified, it defaults to 1.  If \fIcount\fR is
1, the result is a simple string; otherwise, it is a list.  If
specified, \fIcount\fR must be greater than or equal to 1.  If there
are no or too few items in the queue, this command will throw an
error.
.TP
\fIprioqueueName\fR \fBpeekpriority\fR ?\fIcount\fR?
Return the front \fIcount\fR items priority keys, without removing
them from the prioqueue.
If \fIcount\fR is not specified, it defaults to 1.  If \fIcount\fR is
1, the result is a simple string; otherwise, it is a list.  If
specified, \fIcount\fR must be greater than or equal to 1.  If there
are no or too few items in the queue, this command will throw an
error.
.TP
\fIprioqueueName\fR \fBput\fR \fIitem prio\fR ?\fIitem prio ...\fR?
Put the \fIitem\fR or items specified into the prioqueue. \fIprio\fR
must be a valid priority key for this type of prioqueue, otherwise an
error is thrown and no item is added.  Items are inserted at their
priority ranking. Items with equal priority are added in the order
they were added.
.TP
\fIprioqueueName\fR \fBsize\fR
Return the number of items in the prioqueue.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: prioqueue\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
ordered list, prioqueue, priority queue
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2003 Michael Schlenker <[email protected]>

.fi

Added embedded/man/files/modules/struct/queue.n.












































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/queue.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::queue" n 1.4.4 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::queue \- Create and manipulate queue objects
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBstruct::queue  ?1.4.4?\fR
.sp
\fIqueueName\fR \fBoption\fR ?\fIarg arg ...\fR?
.sp
\fIqueueName\fR \fBclear\fR
.sp
\fIqueueName\fR \fBdestroy\fR
.sp
\fIqueueName\fR \fBget\fR ?\fIcount\fR?
.sp
\fIqueueName\fR \fBpeek\fR ?\fIcount\fR?
.sp
\fIqueueName\fR \fBput\fR \fIitem\fR ?\fIitem ...\fR?
.sp
\fIqueueName\fR \fBunget\fR \fIitem\fR
.sp
\fIqueueName\fR \fBsize\fR
.sp
.BE
.SH DESCRIPTION
The \fB::struct\fR namespace contains a commands for processing
finite queues.
.PP
It exports a single command, \fB::struct::queue\fR. All functionality
provided here can be reached through a subcommand of this command.
.PP
\fINote:\fR As of version 1.4.1 of this package a critcl based C
implementation is available. This implementation however requires Tcl
8.4 to run.
.PP
The \fB::struct::queue\fR command creates a new queue object with an
associated global Tcl command whose name is \fIqueueName\fR.  This
command may be used to invoke various operations on the queue.  It has
the following general form:
.TP
\fIqueueName\fR \fBoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.  The following commands are possible for queue objects:
.TP
\fIqueueName\fR \fBclear\fR
Remove all items from the queue.
.TP
\fIqueueName\fR \fBdestroy\fR
Destroy the queue, including its storage space and associated command.
.TP
\fIqueueName\fR \fBget\fR ?\fIcount\fR?
Return the front \fIcount\fR items of the queue and remove them from
the queue.  If \fIcount\fR is not specified, it defaults to 1.  If
\fIcount\fR is 1, the result is a simple string; otherwise, it is a
list.  If specified, \fIcount\fR must be greater than or equal to 1.
If there are not enough items in the queue to fulfull the request,
this command will throw an error.
.TP
\fIqueueName\fR \fBpeek\fR ?\fIcount\fR?
Return the front \fIcount\fR items of the queue, without removing them
from the queue.  If \fIcount\fR is not specified, it defaults to 1.
If \fIcount\fR is 1, the result is a simple string; otherwise, it is a
list.  If specified, \fIcount\fR must be greater than or equal to 1.
If there are not enough items in the queue to fulfull the request,
this command will throw an error.
.TP
\fIqueueName\fR \fBput\fR \fIitem\fR ?\fIitem ...\fR?
Put the \fIitem\fR or items specified into the queue.  If more than
one \fIitem\fR is given, they will be added in the order they are
listed.
.TP
\fIqueueName\fR \fBunget\fR \fIitem\fR
Put the \fIitem\fR into the queue, at the front, i.e. before any other
items already in the queue. This makes this operation the complement
to the method \fBget\fR.
.TP
\fIqueueName\fR \fBsize\fR
Return the number of items in the queue.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: queue\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
graph, list, matrix, pool, prioqueue, record, set, skiplist, stack, tree
.SH CATEGORY
Data structures

Added embedded/man/files/modules/struct/record.n.












































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/record.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002, Brett Schwarz <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::record" n 1.2.1 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::record \- Define and create records (similar to 'C' structures)
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::record  ?1.2.1?\fR
.sp
\fBrecord define\fR \fIrecordName\fR \fIrecordMembers\fR ?\fIinstanceName1 instanceName2 ...\fR?
.sp
\fBrecord show\fR \fIrecord\fR
.sp
\fBrecord show\fR \fIinstances\fR \fIrecordName\fR
.sp
\fBrecord show\fR \fImembers\fR \fIrecordName\fR
.sp
\fBrecord show\fR \fIvalues\fR \fIinstanceName\fR
.sp
\fBrecord exists\fR \fIrecord\fR \fIrecordName\fR
.sp
\fBrecord exists\fR \fIinstance\fR \fIinstanceName\fR
.sp
\fBrecord delete\fR \fIrecord\fR \fIrecordName\fR
.sp
\fBrecord delete\fR \fIinstance\fR \fIinstanceName\fR
.sp
\fIrecordName\fR \fB\fIinstanceName|#auto\fR\fR ?\fI-member1 value1 -member2 value2 ...\fR?
.sp
\fIinstanceName\fR \fBcget\fR ?\fI-member1 -member2 ...\fR?
.sp
\fIinstanceName\fR \fBconfigure\fR ?\fI-member1 value1 -member2 value2 ...\fR?
.sp
.BE
.SH DESCRIPTION
The \fB::struct::record\fR package provides a mechanism to group variables together
as one data structure, similar to a 'C' structure. The members of a
record can be variables or other records. However, a record can not contain circular
record, i.e. records that contain the same record as a
member.
.PP
This package was structured so that it is very similar to how Tk objects work. Each record
definition creates a record object that encompasses that definition. Subsequently, that
record object can create instances of that record. These instances can then
be manipulated with the \fBcget\fR and \fBconfigure\fR methods.
.PP
The package only contains one top level command, but several sub commands (see below). It also obeys the namespace in which the record was define, hence the objects returned are fully qualified.
.TP
\fBrecord define\fR \fIrecordName\fR \fIrecordMembers\fR ?\fIinstanceName1 instanceName2 ...\fR?
Defines a record. \fIrecordName\fR is the name of the record, and is also
used as an object command. This object command is used to create instances of the
record definition. \fIrecordMembers\fR are the members of
the record that make up the record definition. These are variables
and other record. If optional \fIinstanceName\fR args are given, then an instance
is generated after the definition is created for each \fIinstanceName\fR.
.TP
\fBrecord show\fR \fIrecord\fR
Returns a list of records that have been defined.
.TP
\fBrecord show\fR \fIinstances\fR \fIrecordName\fR
Returns the instances that have been instantiated by
\fIrecordName\fR.
.TP
\fBrecord show\fR \fImembers\fR \fIrecordName\fR
Returns the members that are defined for
record \fIrecordName\fR. It returns the same format as how the
records were defined.
.TP
\fBrecord show\fR \fIvalues\fR \fIinstanceName\fR
Returns a list of values that are set for the instance
\fIinstanceName\fR. The output is a list of key/value pairs. If there
are nested records, then the values of the nested records will
itself be a list.
.TP
\fBrecord exists\fR \fIrecord\fR \fIrecordName\fR
Tests for the existence of a \fIrecord\fR with the
name \fIrecordName\fR.
.TP
\fBrecord exists\fR \fIinstance\fR \fIinstanceName\fR
Tests for the existence of a \fIinstance\fR with the
name \fIinstanceName\fR.
.TP
\fBrecord delete\fR \fIrecord\fR \fIrecordName\fR
Deletes \fIrecordName\fR, and all instances of \fIrecordName\fR. It will return
an error if the record does not exist.
.TP
\fBrecord delete\fR \fIinstance\fR \fIinstanceName\fR
Deletes \fIinstance\fR with the name of \fIinstanceName\fR. It
will return an error if the instance does not exist.
.PP
.PP
.SH "RECORD MEMBERS"
Record members can either be variables, or other records, However, the
same record can not be nested witin itself (circular). To define a
nested record, you need to specify the \fBrecord\fR keyword, along
the with name of the record, and the name of the instance of that
nested record. For example, it would look like this:
.PP
.CS


# this is the nested record
record define mynestedrecord {
    nest1
    nest2
}

# This is the main record
record define myrecord {
    mem1
    mem2
    {record mynestedrecord mem3}
}


.CE
You can also assign default or initial values to the members of a record,
by enclosing the member entry in braces:
.PP
.CS



record define myrecord {
    mem1
    {mem2 5}
}


.CE
All instances created from this record definition, will initially have 5 as
the value for \fImem2\fR. If no default is given, then the value will be the empty string.
.PP
\fIGetting Values\fR
.PP
To get a value of a member, there are several ways to do this.
.IP [1]
To get a member value, then use the instance built-in \fBcget\fR method:
.sp
\fIinstanceName\fR \fBcget\fR -mem1
.IP [2]
To get multiple member values, you can specify them all in one command:
.sp
\fIinstanceName\fR \fBcget\fR -mem1 -mem2
.IP [3]
To get a list of the key/value of all of the members, there are 3 ways:
.sp
- \fIinstanceName\fR \fBcget\fR
.sp
- \fIinstanceName\fR \fBconfigure\fR
.sp
- \fIinstanceName\fR
.IP [4]
To get a value of a nested member, then use the dot notation:
.sp
\fIinstanceName\fR \fBcget\fR -mem3.nest1
.PP
.PP
\fISetting Values\fR
.PP
To set a value of a member, there are several ways to do this.
.IP [1]
To set a member value, then use the instance built-in \fBconfigure\fR method:
.sp
\fIinstanceName\fR \fBconfigure\fR -mem1 val1
.IP [2]
To set multiple member values, you can specify them all in one command:
.sp
\fIinstanceName\fR \fBconfigure\fR -mem1 va1 -mem2 val2
.IP [3]
To set a value of a nested member, then use the dot notation:
.sp
\fIinstanceName\fR \fBconfigure\fR -mem3.nest1 value
.PP
.PP
\fIAlias access\fR
.PP
In the original implementation, access was done by using dot notation similar to how 'C' structures are accessed. However,
there was a concensus to make the interface more Tcl like, which made sense. However, the original alias access still
exists. It might prove to be helpful to some.
.PP
Basically, for every member of every instance, an alias is created. This alias is used to get and set values for that
member. An example will illustrate the point, using the above defined records:
.PP
.CS


# Create an instance first
% myrecord inst1
::inst1
% # To get a member of an instance, just use the
% # alias (it behaves like a Tcl command):
% inst1.mem1
%
% # To set a member via the alias, just include
% # a value (optionally the equal sign - syntactic sugar)
% inst1.mem1 = 5
5
% inst1.mem1
5
% # For nested records, just continue with the
% # dot notation (note no equal sign)
% inst1.mem3.nest1 10
10
% inst1.mem3.nest1
10
% # just the instance by itself gives all
% # member/values pairs for that instance
% inst1
-mem1 5 -mem2 {} -mem3 {-nest1 10 -nest2 {}}
% # and to get all members within the nested record
% inst1.mem3
-nest1 10 -nest2 {}
%


.CE
.SH "RECORD COMMAND"
The following subcommands and corresponding arguments are available to any
record command:
.TP
\fIrecordName\fR \fB\fIinstanceName|#auto\fR\fR ?\fI-member1 value1 -member2 value2 ...\fR?
Using the \fIrecordName\fR object command that was created from the record definition,
instances of the record definition can be created. Once a instance is
created, then it inherits the members of the record definition, very
similar to how objects work. During instance generation, an object command for the instance
is created as well, using \fIinstanceName\fR. This object command is used
to access the data members of the instance. During the instantiation, values for
that instance can be given, \fIbut\fR all values must be given, and be given
in key/value pairs. Nested records, need to be in list format.
.sp
Optionally, \fI#auto\fR can be used in place of \fIinstanceName\fR. When #auto is used,
then a instance name will automatically be generated, of the form recordName<integer>, where
<integer> is a unique integer (starting at 0) that is generated.
.PP
.PP
.SH "INSTANCE COMMAND"
The following subcommands and corresponding arguments are available to
any record instance command:
.TP
\fIinstanceName\fR \fBcget\fR ?\fI-member1 -member2 ...\fR?
Each instance has the sub command \fBcget\fR associated with it. This
is very similar to how Tk widget's cget command works. It queries
the values of the member for that particular instance. If
no arguments are given, then a key/value list is returned.
.TP
\fIinstanceName\fR \fBconfigure\fR ?\fI-member1 value1 -member2 value2 ...\fR?
Each instance has the sub command \fBconfigure\fR associated with it. This
is very similar to how Tk widget's configure command works. It sets
the values of the particular member for that particular instance. If
no arguments are given, then a key/value list is returned.
.PP
.SH EXAMPLES
Two examples are provided to give an good illustration on how to use
this package.
.PP
\fIExample 1\fR
.PP
Probably the most obvious example would be to hold contact information,
such as addresses, phone numbers, comments, etc. Since a person can have
multiple phone numbers, multiple email addresses, etc, we will use nested
records to define these. So, the first thing we do is define the nested
records:
.PP
.CS



##
##  This is an interactive example, to see what is
##  returned by each command as well.
##

% namespace import ::struct::record::*

% # define a nested record. Notice that country has default 'USA'.
% record define locations {
    street
    street2
    city
    state
    zipcode
    {country USA}
    phone
}
::locations
% # Define the main record. Notice that it uses the location record twice.
% record define contacts {
    first
    middle
    last
    {record locations home}
    {record locations work}
}
::contacts
% # Create an instance for the contacts record.
% contacts cont1
::cont1
% # Display some introspection values
% record show records
::contacts ::locations
% #
% record show values cont1
-first {} -middle {} -last {} -home {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}} -work {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}}
% #
% record show instances contacts
::cont1
% #
% cont1 config
-first {} -middle {} -last {} -home {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}} -work {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}}
% #
% cont1 cget
-first {} -middle {} -last {} -home {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}} -work {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}}
% # copy one record to another record
% record define contacts2 [record show members contacts]
::contacts2
% record show members contacts2
first middle last {record locations home} {record locations work}
% record show members contacts
first middle last {record locations home} {record locations work}
%

.CE
.PP
\fIExample 1\fR
.PP
This next example just illustrates a simple linked list
.PP
.CS



% # define a very simple record for linked list
% record define llist {
    value
    next
}
::llist
% llist lstart
::lstart
% lstart config -value 1 -next [llist #auto]
% [lstart cget -next] config -value 2 -next [llist #auto]
% [[lstart cget -next] cget -next] config -value 3 -next "end"
% set next lstart
lstart
% while 1 {
lappend values [$next cget -value]
set next [$next cget -next]
if {[string match "end" $next]} {break}
}
% puts "$values"
1 2 3
% # cleanup linked list
% # We could just use delete record llist also
% foreach I [record show instances llist] {
record delete instance $I
}
% record show instances llist
%


.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: record\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
data structures, record, struct
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002, Brett Schwarz <[email protected]>

.fi

Added embedded/man/files/modules/struct/skiplist.n.











































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/skiplist.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2000 Keith Vetter
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::skiplist" n 1.3 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::skiplist \- Create and manipulate skiplists
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::skiplist  ?1.3?\fR
.sp
\fBskiplistName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fIskiplistName\fR \fBdelete\fR \fInode\fR ?\fInode\fR...?
.sp
\fIskiplistName\fR \fBdestroy\fR
.sp
\fIskiplistName\fR \fBinsert\fR \fIkey value\fR
.sp
\fIskiplistName\fR \fBsearch\fR \fInode\fR ?\fB-key\fR \fIkey\fR?
.sp
\fIskiplistName\fR \fBsize\fR
.sp
\fIskiplistName\fR \fBwalk\fR \fIcmd\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fB::struct::skiplist\fR command creates a new skiplist object
with an associated global Tcl command whose name is
\fIskiplistName\fR. This command may be used to invoke various
operations on the skiplist. It has the following general form:
.TP
\fBskiplistName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.PP
.PP
Skip lists are an alternative data structure to binary trees. They can
be used to maintain ordered lists over any sequence of insertions and
deletions. Skip lists use randomness to achieve probabilistic
balancing, and as a result the algorithms for insertion and deletion
in skip lists are much simpler and faster than those for binary trees.
.PP
To read more about skip lists see Pugh, William.
\fISkip lists: a probabilistic alternative to balanced trees\fR
In: Communications of the ACM, June 1990, 33(6) 668-676.
.PP
Currently, the key can be either a number or a string, and comparisons
are performed with the built in greater than operator.
The following commands are possible for skiplist objects:
.TP
\fIskiplistName\fR \fBdelete\fR \fInode\fR ?\fInode\fR...?
Remove the specified nodes from the skiplist.
.TP
\fIskiplistName\fR \fBdestroy\fR
Destroy the skiplist, including its storage space and associated command.
.TP
\fIskiplistName\fR \fBinsert\fR \fIkey value\fR
Insert a node with the given \fIkey\fR and \fIvalue\fR into the
skiplist. If a node with that key already exists, then the that node's
value is updated and its node level is returned. Otherwise a new node
is created and 0 is returned.
.TP
\fIskiplistName\fR \fBsearch\fR \fInode\fR ?\fB-key\fR \fIkey\fR?
Search for a given key in a skiplist. If not found then 0 is returned.
If found, then a two element list of 1 followed by the node's value is retuned.
.TP
\fIskiplistName\fR \fBsize\fR
Return a count of the number of nodes in the skiplist.
.TP
\fIskiplistName\fR \fBwalk\fR \fIcmd\fR
Walk the skiplist from the first node to the last. At each node, the
command \fIcmd\fR will be evaluated with the key and value of the
current node appended.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: skiplist\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
skiplist
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2000 Keith Vetter

.fi

Added embedded/man/files/modules/struct/stack.n.



































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/stack.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::stack" n 1.5.3 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::stack \- Create and manipulate stack objects
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBstruct::stack  ?1.5.3?\fR
.sp
\fIstackName\fR \fBoption\fR ?\fIarg arg ...\fR?
.sp
\fIstackName\fR \fBclear\fR
.sp
\fIstackName\fR \fBdestroy\fR
.sp
\fIstackName\fR \fBget\fR
.sp
\fIstackName\fR \fBgetr\fR
.sp
\fIstackName\fR \fBpeek\fR ?\fIcount\fR?
.sp
\fIstackName\fR \fBpeekr\fR ?\fIcount\fR?
.sp
\fIstackName\fR \fBtrim\fR ?\fInewsize\fR?
.sp
\fIstackName\fR \fBtrim*\fR ?\fInewsize\fR?
.sp
\fIstackName\fR \fBpop\fR ?\fIcount\fR?
.sp
\fIstackName\fR \fBpush\fR \fIitem\fR ?\fIitem...\fR?
.sp
\fIstackName\fR \fBsize\fR
.sp
.BE
.SH DESCRIPTION
The \fB::struct\fR namespace contains a commands for processing
finite stacks.
.PP
It exports a single command, \fB::struct::stack\fR. All functionality
provided here can be reached through a subcommand of this command.
.PP
\fINote:\fR As of version 1.3.3 of this package a critcl based C
implementation is available. This implementation however requires Tcl
8.4 to run.
.PP
The \fB::struct::stack\fR command creates a new stack object with an
associated global Tcl command whose name is \fIstackName\fR.  This
command may be used to invoke various operations on the stack.  It has
the following general form:
.TP
\fIstackName\fR \fBoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.  The following commands are possible for stack objects:
.TP
\fIstackName\fR \fBclear\fR
Remove all items from the stack.
.TP
\fIstackName\fR \fBdestroy\fR
Destroy the stack, including its storage space and associated command.
.TP
\fIstackName\fR \fBget\fR
Returns the whole contents of the stack as a list, without removing
them from the stack.
.TP
\fIstackName\fR \fBgetr\fR
A variant of \fBget\fR, which returns the contents in reversed order.
.TP
\fIstackName\fR \fBpeek\fR ?\fIcount\fR?
Return the top \fIcount\fR items of the stack, without removing them from
the stack.  If \fIcount\fR is not specified, it defaults to 1.  If
\fIcount\fR is 1, the result is a simple string; otherwise, it is a
list.  If specified, \fIcount\fR must be greater than or equal to 1.
If there are not enoughs items on the stack to fulfull the request,
this command will throw an error.
.TP
\fIstackName\fR \fBpeekr\fR ?\fIcount\fR?
A variant of \fBpeek\fR, which returns the items in reversed order.
.TP
\fIstackName\fR \fBtrim\fR ?\fInewsize\fR?
Shrinks the stack to contain at most \fInewsize\fR elements and
returns a list containing the elements which were removed. Nothing is
done if the stack is already at the specified size, or smaller. In
that case the result is the empty list.
.TP
\fIstackName\fR \fBtrim*\fR ?\fInewsize\fR?
A variant of \fBtrim\fR which performs the shrinking, but does not
return the removed elements.
.TP
\fIstackName\fR \fBpop\fR ?\fIcount\fR?
Return the top \fIcount\fR items of the stack, and remove them
from the stack.  If \fIcount\fR is not specified, it defaults to 1.
If \fIcount\fR is 1, the result is a simple string; otherwise, it is a
list.  If specified, \fIcount\fR must be greater than or equal to 1.
If there are not enoughs items on the stack to fulfull the request,
this command will throw an error.
.TP
\fIstackName\fR \fBpush\fR \fIitem\fR ?\fIitem...\fR?
Push the \fIitem\fR or items specified onto the stack.  If more than
one \fIitem\fR is given, they will be pushed in the order they are
listed.
.TP
\fIstackName\fR \fBsize\fR
Return the number of items on the stack.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: stack\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
graph, matrix, queue, tree
.SH CATEGORY
Data structures

Added embedded/man/files/modules/struct/struct_list.n.












































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/struct_list.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2003-2005 by Kevin B. Kenny. All rights reserved
'\" Copyright (c) 2003-2012 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::list" n 1.8.2 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::list \- Procedures for manipulating lists
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBstruct::list  ?1.8.2?\fR
.sp
\fB::struct::list\fR \fBlongestCommonSubsequence\fR \fIsequence1\fR \fIsequence2\fR ?\fImaxOccurs\fR?
.sp
\fB::struct::list\fR \fBlongestCommonSubsequence2\fR \fIsequence1 sequence2\fR ?\fImaxOccurs\fR?
.sp
\fB::struct::list\fR \fBlcsInvert\fR \fIlcsData\fR \fIlen1\fR \fIlen2\fR
.sp
\fB::struct::list\fR \fBlcsInvert2\fR \fIlcs1\fR \fIlcs2\fR \fIlen1\fR \fIlen2\fR
.sp
\fB::struct::list\fR \fBlcsInvertMerge\fR \fIlcsData\fR \fIlen1\fR \fIlen2\fR
.sp
\fB::struct::list\fR \fBlcsInvertMerge2\fR \fIlcs1\fR \fIlcs2\fR \fIlen1\fR \fIlen2\fR
.sp
\fB::struct::list\fR \fBreverse\fR \fIsequence\fR
.sp
\fB::struct::list\fR \fBshuffle\fR \fIlist\fR
.sp
\fB::struct::list\fR \fBassign\fR \fIsequence\fR \fIvarname\fR ?\fIvarname\fR?...
.sp
\fB::struct::list\fR \fBflatten\fR ?\fB-full\fR? ?\fB--\fR? \fIsequence\fR
.sp
\fB::struct::list\fR \fBmap\fR \fIsequence\fR \fIcmdprefix\fR
.sp
\fB::struct::list\fR \fBmapfor\fR \fIvar\fR \fIsequence\fR \fIscript\fR
.sp
\fB::struct::list\fR \fBfilter\fR \fIsequence\fR \fIcmdprefix\fR
.sp
\fB::struct::list\fR \fBfilterfor\fR \fIvar\fR \fIsequence\fR \fIexpr\fR
.sp
\fB::struct::list\fR \fBsplit\fR \fIsequence\fR \fIcmdprefix\fR ?\fIpassVar\fR \fIfailVar\fR?
.sp
\fB::struct::list\fR \fBfold\fR \fIsequence\fR \fIinitialvalue\fR \fIcmdprefix\fR
.sp
\fB::struct::list\fR \fBshift\fR \fIlistvar\fR
.sp
\fB::struct::list\fR \fBiota\fR \fIn\fR
.sp
\fB::struct::list\fR \fBequal\fR \fIa\fR \fIb\fR
.sp
\fB::struct::list\fR \fBrepeat\fR \fIsize\fR \fIelement1\fR ?\fIelement2\fR \fIelement3\fR...?
.sp
\fB::struct::list\fR \fBrepeatn\fR \fIvalue\fR \fIsize\fR...
.sp
\fB::struct::list\fR \fBdbJoin\fR ?\fB-inner\fR|\fB-left\fR|\fB-right\fR|\fB-full\fR? ?\fB-keys\fR \fIvarname\fR? {\fIkeycol\fR \fItable\fR}...
.sp
\fB::struct::list\fR \fBdbJoinKeyed\fR ?\fB-inner\fR|\fB-left\fR|\fB-right\fR|\fB-full\fR? ?\fB-keys\fR \fIvarname\fR? \fItable\fR...
.sp
\fB::struct::list\fR \fBswap\fR \fIlistvar\fR \fIi\fR \fIj\fR
.sp
\fB::struct::list\fR \fBfirstperm\fR \fIlist\fR
.sp
\fB::struct::list\fR \fBnextperm\fR \fIperm\fR
.sp
\fB::struct::list\fR \fBpermutations\fR \fIlist\fR
.sp
\fB::struct::list\fR \fBforeachperm\fR \fIvar\fR \fIlist\fR \fIbody\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fB::struct::list\fR namespace contains several useful commands
for processing Tcl lists. Generally speaking, they implement
algorithms more complex or specialized than the ones provided by Tcl
itself.
.PP
It exports only a single command, \fBstruct::list\fR. All
functionality provided here can be reached through a subcommand of
this command.
.SH COMMANDS
.TP
\fB::struct::list\fR \fBlongestCommonSubsequence\fR \fIsequence1\fR \fIsequence2\fR ?\fImaxOccurs\fR?
Returns the longest common subsequence of elements in the two lists
\fIsequence1\fR and \fIsequence2\fR. If the \fImaxOccurs\fR parameter
is provided, the common subsequence is restricted to elements that
occur no more than \fImaxOccurs\fR times in \fIsequence2\fR.
.sp
The return value is a list of two lists of equal length. The first
sublist is of indices into \fIsequence1\fR, and the second sublist is
of indices into \fIsequence2\fR.  Each corresponding pair of indices
corresponds to equal elements in the sequences; the sequence returned
is the longest possible.
.TP
\fB::struct::list\fR \fBlongestCommonSubsequence2\fR \fIsequence1 sequence2\fR ?\fImaxOccurs\fR?
Returns an approximation to the longest common sequence of elements in
the two lists \fIsequence1\fR and \fIsequence2\fR.
If the \fImaxOccurs\fR parameter is omitted, the subsequence computed
is exactly the longest common subsequence; otherwise, the longest
common subsequence is approximated by first determining the longest
common sequence of only those elements that occur no more than
\fImaxOccurs\fR times in \fIsequence2\fR, and then using that result
to align the two lists, determining the longest common subsequences of
the sublists between the two elements.
.sp
As with \fBlongestCommonSubsequence\fR, the return value is a list
of two lists of equal length.  The first sublist is of indices into
\fIsequence1\fR, and the second sublist is of indices into
\fIsequence2\fR.  Each corresponding pair of indices corresponds to
equal elements in the sequences.  The sequence approximates the
longest common subsequence.
.TP
\fB::struct::list\fR \fBlcsInvert\fR \fIlcsData\fR \fIlen1\fR \fIlen2\fR
This command takes a description of a longest common subsequence
(\fIlcsData\fR), inverts it, and returns the result. Inversion means
here that as the input describes which parts of the two sequences are
identical the output describes the differences instead.
.sp
To be fully defined the lengths of the two sequences have to be known
and are specified through \fIlen1\fR and \fIlen2\fR.
.sp
The result is a list where each element describes one chunk of the
differences between the two sequences. This description is a list
containing three elements, a type and two pairs of indices into
\fIsequence1\fR and \fIsequence2\fR respectively, in this order.
The type can be one of three values:
.RS
.TP
\fBadded\fR
Describes an addition. I.e. items which are missing in \fIsequence1\fR
can be found in \fIsequence2\fR.
The pair of indices into \fIsequence1\fR describes where the added
range had been expected to be in \fIsequence1\fR. The first index
refers to the item just before the added range, and the second index
refers to the item just after the added range.
The pair of indices into \fIsequence2\fR describes the range of items
which has been added to it. The first index refers to the first item
in the range, and the second index refers to the last item in the
range.
.TP
\fBdeleted\fR
Describes a deletion. I.e. items which are in \fIsequence1\fR are
missing from \fIsequence2\fR.
The pair of indices into \fIsequence1\fR describes the range of items
which has been deleted. The first index refers to the first item in
the range, and the second index refers to the last item in the range.
The pair of indices into \fIsequence2\fR describes where the deleted
range had been expected to be in \fIsequence2\fR. The first index
refers to the item just before the deleted range, and the second index
refers to the item just after the deleted range.
.TP
\fBchanged\fR
Describes a general change. I.e a range of items in \fIsequence1\fR
has been replaced by a different range of items in \fIsequence2\fR.
The pair of indices into \fIsequence1\fR describes the range of items
which has been replaced. The first index refers to the first item in
the range, and the second index refers to the last item in the range.
The pair of indices into \fIsequence2\fR describes the range of items
replacing the original range. Again the first index refers to the
first item in the range, and the second index refers to the last item
in the range.
.RE
.sp
.CS


    sequence 1 = {a b r a c a d a b r a}
    lcs 1      =   {1 2   4 5     8 9 10}
    lcs 2      =   {0 1   3 4     5 6 7}
    sequence 2 =   {b r i c a     b r a c}

    Inversion  = {{deleted  {0  0} {-1 0}}
                  {changed  {3  3}  {2 2}}
                  {deleted  {6  7}  {4 5}}
                  {added   {10 11}  {8 8}}}

.CE
.IP
\fINotes:\fR
.sp
.RS
.IP \(bu
An index of \fB-1\fR in a \fIdeleted\fR chunk refers to just before
the first element of the second sequence.
.IP \(bu
Also an index equal to the length of the first sequence in an
\fIadded\fR chunk refers to just behind the end of the sequence.
.RE
.TP
\fB::struct::list\fR \fBlcsInvert2\fR \fIlcs1\fR \fIlcs2\fR \fIlen1\fR \fIlen2\fR
Similar to \fBlcsInvert\fR. Instead of directly taking the result
of a call to \fBlongestCommonSubsequence\fR this subcommand expects
the indices for the two sequences in two separate lists.
.TP
\fB::struct::list\fR \fBlcsInvertMerge\fR \fIlcsData\fR \fIlen1\fR \fIlen2\fR
Similar to \fBlcsInvert\fR. It returns essentially the same
structure as that command, except that it may contain chunks of type
\fBunchanged\fR too.
.sp
These new chunks describe the parts which are unchanged between the
two sequences. This means that the result of this command describes
both the changed and unchanged parts of the two sequences in one
structure.
.sp
.CS


    sequence 1 = {a b r a c a d a b r a}
    lcs 1      =   {1 2   4 5     8 9 10}
    lcs 2      =   {0 1   3 4     5 6 7}
    sequence 2 =   {b r i c a     b r a c}

    Inversion/Merge  = {{deleted   {0  0} {-1 0}}
                        {unchanged {1  2}  {0 1}}
                        {changed   {3  3}  {2 2}}
                        {unchanged {4  5}  {3 4}}
                        {deleted   {6  7}  {4 5}}
                        {unchanged {8 10}  {5 7}}
                        {added    {10 11}  {8 8}}}

.CE
.TP
\fB::struct::list\fR \fBlcsInvertMerge2\fR \fIlcs1\fR \fIlcs2\fR \fIlen1\fR \fIlen2\fR
Similar to \fBlcsInvertMerge\fR. Instead of directly taking the
result of a call to \fBlongestCommonSubsequence\fR this subcommand
expects the indices for the two sequences in two separate lists.
.TP
\fB::struct::list\fR \fBreverse\fR \fIsequence\fR
The subcommand takes a single \fIsequence\fR as argument and returns a new
sequence containing the elements of the input sequence in reverse
order.
.TP
\fB::struct::list\fR \fBshuffle\fR \fIlist\fR
The subcommand takes a \fIlist\fR and returns a copy of that list
with the elements it contains in random order. Every possible
ordering of elements is equally likely to be generated. The
Fisher-Yates shuffling algorithm is used internally.
.TP
\fB::struct::list\fR \fBassign\fR \fIsequence\fR \fIvarname\fR ?\fIvarname\fR?...
The subcommand assigns the first \fBn\fR elements of the input
\fIsequence\fR to the one or more variables whose names were listed
after the sequence, where \fBn\fR is the number of specified
variables.
.sp
If there are more variables specified than there are elements in the
\fIsequence\fR the empty string will be assigned to the superfluous
variables.
.sp
If there are more elements in the \fIsequence\fR than variable names
specified the subcommand returns a list containing the unassigned
elements. Else an empty list is returned.
.CS


    tclsh> ::struct::list assign {a b c d e} foo bar
    c d e
    tclsh> set foo
    a
    tclsh> set bar
    b

.CE
.TP
\fB::struct::list\fR \fBflatten\fR ?\fB-full\fR? ?\fB--\fR? \fIsequence\fR
The subcommand takes a single \fIsequence\fR and returns a new
sequence where one level of nesting was removed from the input
sequence. In other words, the sublists in the input sequence are
replaced by their elements.
.sp
The subcommand will remove any nesting it finds if the option
\fB-full\fR is specified.
.CS


    tclsh> ::struct::list flatten {1 2 3 {4 5} {6 7} {{8 9}} 10}
    1 2 3 4 5 6 7 {8 9} 10
    tclsh> ::struct::list flatten -full {1 2 3 {4 5} {6 7} {{8 9}} 10}
    1 2 3 4 5 6 7 8 9 10

.CE
.TP
\fB::struct::list\fR \fBmap\fR \fIsequence\fR \fIcmdprefix\fR
The subcommand takes a \fIsequence\fR to operate on and a command
prefix (\fIcmdprefix\fR) specifying an operation, applies the command
prefix to each element of the sequence and returns a sequence
consisting of the results of that application.
.sp
The command prefix will be evaluated with a single word appended to
it. The evaluation takes place in the context of the caller of the
subcommand.
.sp
.CS


    tclsh> # squaring all elements in a list

    tclsh> proc sqr {x} {expr {$x*$x}}
    tclsh> ::struct::list map {1 2 3 4 5} sqr
    1 4 9 16 25

    tclsh> # Retrieving the second column from a matrix
    tclsh> # given as list of lists.

    tclsh> proc projection {n list} {::lindex $list $n}
    tclsh> ::struct::list map {{a b c} {1 2 3} {d f g}} {projection 1}
    b 2 f

.CE
.TP
\fB::struct::list\fR \fBmapfor\fR \fIvar\fR \fIsequence\fR \fIscript\fR
The subcommand takes a \fIsequence\fR to operate on and a tcl \fIscript\fR,
applies the script to each element of the sequence and returns a sequence
consisting of the results of that application.
.sp
The script will be evaluated as is, and has access to the current list element
through the specified iteration variable \fIvar\fR. The evaluation takes place
in the context of the caller of the subcommand.
.sp
.CS


    tclsh> # squaring all elements in a list

    tclsh> ::struct::list mapfor x {1 2 3 4 5} {
	expr {$x * $x}
    }
    1 4 9 16 25

    tclsh> # Retrieving the second column from a matrix
    tclsh> # given as list of lists.

    tclsh> ::struct::list mapfor x {{a b c} {1 2 3} {d f g}} {
	lindex $x 1
    }
    b 2 f

.CE
.TP
\fB::struct::list\fR \fBfilter\fR \fIsequence\fR \fIcmdprefix\fR
The subcommand takes a \fIsequence\fR to operate on and a command
prefix (\fIcmdprefix\fR) specifying an operation, applies the command
prefix to each element of the sequence and returns a sequence
consisting of all elements of the \fIsequence\fR for which the command
prefix returned \fBtrue\fR.
In other words, this command filters out all elements of the input
\fIsequence\fR which fail the test the \fIcmdprefix\fR represents, and
returns the remaining elements.
.sp
The command prefix will be evaluated with a single word appended to
it. The evaluation takes place in the context of the caller of the
subcommand.
.sp
.CS


    tclsh> # removing all odd numbers from the input

    tclsh> proc even {x} {expr {($x % 2) == 0}}
    tclsh> ::struct::list filter {1 2 3 4 5} even
    2 4

.CE
.sp
\fINote:\fR The \fBfilter\fR is a specialized application of
\fBfold\fR where the result is extended with the current item or
not, depending o nthe result of the test.
.TP
\fB::struct::list\fR \fBfilterfor\fR \fIvar\fR \fIsequence\fR \fIexpr\fR
The subcommand takes a \fIsequence\fR to operate on and a tcl expression
(\fIexpr\fR) specifying a condition, applies the conditionto each element
of the sequence and returns a sequence consisting of all elements of the
\fIsequence\fR for which the expression returned \fBtrue\fR.
In other words, this command filters out all elements of the input
\fIsequence\fR which fail the test the condition \fIexpr\fR represents, and
returns the remaining elements.
.sp
The expression will be evaluated as is, and has access to the current list
element through the specified iteration variable \fIvar\fR. The evaluation
takes place in the context of the caller of the subcommand.
.sp
.CS


    tclsh> # removing all odd numbers from the input

    tclsh> ::struct::list filterfor x {1 2 3 4 5} {($x % 2) == 0}
    2 4

.CE
.TP
\fB::struct::list\fR \fBsplit\fR \fIsequence\fR \fIcmdprefix\fR ?\fIpassVar\fR \fIfailVar\fR?
This is a variant of method \fBfilter\fR, see above. Instead of
returning just the elements passing the test we get lists of both
passing and failing elements.
.sp
If no variable names are specified then the result of the command will
be a list containing the list of passing elements, and the list of
failing elements, in this order. Otherwise the lists of passing and
failing elements are stored into the two specified variables, and the
result will be a list containing two numbers, the number of elements
passing the test, and the number of elements failing, in this order.
.sp
The interface to the test is the same as used by \fBfilter\fR.
.TP
\fB::struct::list\fR \fBfold\fR \fIsequence\fR \fIinitialvalue\fR \fIcmdprefix\fR
The subcommand takes a \fIsequence\fR to operate on, an arbitrary
string \fIinitial value\fR and a command prefix (\fIcmdprefix\fR)
specifying an operation.
.sp
The command prefix will be evaluated with two words appended to
it. The second of these words will always be an element of the
sequence. The evaluation takes place in the context of the caller of
the subcommand.
.sp
It then reduces the sequence into a single value through repeated
application of the command prefix and returns that value. This
reduction is done by
.RS
.TP
\fB1\fR
Application of the command to the initial value and the first element
of the list.
.TP
\fB2\fR
Application of the command to the result of the last call and the
second element of the list.
.TP \fB...\fR
.TP
\fBi\fR
Application of the command to the result of the last call and the
\fBi\fR'th element of the list.
.TP \fB...\fR
.TP
\fBend\fR
Application of the command to the result of the last call and the last
element of the list. The result of this call is returned as the result
of the subcommand.
.RE
.sp
.CS


    tclsh> # summing the elements in a list.
    tclsh> proc + {a b} {expr {$a + $b}}
    tclsh> ::struct::list fold {1 2 3 4 5} 0 +
    15

.CE
.TP
\fB::struct::list\fR \fBshift\fR \fIlistvar\fR
The subcommand takes the list contained in the variable named by
\fIlistvar\fR and shifts it down one element.
After the call \fIlistvar\fR will contain a list containing the second
to last elements of the input list. The first element of the ist is
returned as the result of the command. Shifting the empty list does
nothing.
.TP
\fB::struct::list\fR \fBiota\fR \fIn\fR
The subcommand returns a list containing the integer numbers
in the range \fB[0,n)\fR. The element at index \fBi\fR
of the list contain the number \fBi\fR.
.sp
For "\fIn\fR == \fB0\fR" an empty list will be returned.
.TP
\fB::struct::list\fR \fBequal\fR \fIa\fR \fIb\fR
The subcommand compares the two lists \fIa\fR and \fIb\fR for
equality. In other words, they have to be of the same length and have
to contain the same elements in the same order. If an element is a
list the same definition of equality applies recursively.
.sp
A boolean value will be returned as the result of the command.
This value will be \fBtrue\fR if the two lists are equal, and
\fBfalse\fR else.
.TP
\fB::struct::list\fR \fBrepeat\fR \fIsize\fR \fIelement1\fR ?\fIelement2\fR \fIelement3\fR...?
The subcommand creates a list of length
"\fIsize\fR * \fInumber of elements\fR" by repeating \fIsize\fR
times the sequence of elements
\fIelement1\fR \fIelement2\fR \fI...\fR.
\fIsize\fR must be a positive integer, \fIelement\fR\fBn\fR can be any
Tcl value.
Note that \fBrepeat 1 arg ...\fR  is identical to
\fBlist arg ...\fR, though the \fIarg\fR is required
with \fBrepeat\fR.
.sp
\fIExamples:\fR
.sp
.CS


    tclsh> ::struct::list repeat 3 a
    a a a
    tclsh> ::struct::list repeat 3 [::struct::list repeat 3 0]
    {0 0 0} {0 0 0} {0 0 0}
    tclsh> ::struct::list repeat 3 a b c
    a b c a b c a b c
    tclsh> ::struct::list repeat 3 [::struct::list repeat 2 a] b c
    {a a} b c {a a} b c {a a} b c

.CE
.TP
\fB::struct::list\fR \fBrepeatn\fR \fIvalue\fR \fIsize\fR...
The subcommand creates a (nested) list containing the \fIvalue\fR in
all positions. The exact size and degree of nesting is determined by
the \fIsize\fR arguments, all of which have to be integer numbers
greater than or equal to zero.
.sp
A single argument \fIsize\fR which is a list of more than one element
will be treated as if more than argument \fIsize\fR was specified.
.sp
If only one argument \fIsize\fR is present the returned list will not
be nested, of length \fIsize\fR and contain \fIvalue\fR in all
positions.
If more than one \fIsize\fR argument is present the returned
list will be nested, and of the length specified by the last
\fIsize\fR argument given to it. The elements of that list
are defined as the result of \fBRepeat\fR for the same arguments,
but with the last \fIsize\fR value removed.
.sp
An empty list will be returned if no \fIsize\fR arguments are present.
.sp
.CS


    tclsh> ::struct::list repeatn  0 3 4
    {0 0 0} {0 0 0} {0 0 0} {0 0 0}
    tclsh> ::struct::list repeatn  0 {3 4}
    {0 0 0} {0 0 0} {0 0 0} {0 0 0}
    tclsh> ::struct::list repeatn  0 {3 4 5}
    {{0 0 0} {0 0 0} {0 0 0} {0 0 0}} {{0 0 0} {0 0 0} {0 0 0} {0 0 0}} {{0 0 0} {0 0 0} {0 0 0} {0 0 0}} {{0 0 0} {0 0 0} {0 0 0} {0 0 0}} {{0 0 0} {0 0 0} {0 0 0} {0 0 0}}

.CE
.TP
\fB::struct::list\fR \fBdbJoin\fR ?\fB-inner\fR|\fB-left\fR|\fB-right\fR|\fB-full\fR? ?\fB-keys\fR \fIvarname\fR? {\fIkeycol\fR \fItable\fR}...
The method performs a table join according to relational algebra. The
execution of any of the possible outer join operation is triggered by
the presence of either option \fB-left\fR, \fB-right\fR, or
\fB-full\fR. If none of these options is present a regular inner
join will be performed. This can also be triggered by specifying
\fB-inner\fR. The various possible join operations are explained in
detail in section \fBTABLE JOIN\fR.
.sp
If the \fB-keys\fR is present its argument is the name of a
variable to store the full list of found keys into. Depending on the
exact nature of the input table and the join mode the output table may
not contain all the keys by default. In such a case the caller can
declare a variable for this information and then insert it into the
output table on its own, as she will have more information about the
placement than this command.
.sp
What is left to explain is the format of the arguments.
.sp
The \fIkeycol\fR arguments are the indices of the columns in the
tables which contain the key values to use for the joining. Each
argument applies to the table following immediately after it. The
columns are counted from \fB0\fR, which references the first
column. The table associated with the column index has to have at
least \fIkeycol\fR+1 columns. An error will be thrown if there are
less.
.sp
The \fItable\fR arguments represent a table or matrix of rows and
columns of values. We use the same representation as generated and
consumed by the methods \fBget rect\fR and \fBset rect\fR of
\fBmatrix\fR objects. In other words, each argument is a list,
representing the whole matrix.  Its elements are lists too, each
representing a single rows of the matrix. The elements of the
row-lists are the column values.
.sp
The table resulting from the join operation is returned as the result
of the command. We use the same representation as described above for
the input \fItable\fRs.
.TP
\fB::struct::list\fR \fBdbJoinKeyed\fR ?\fB-inner\fR|\fB-left\fR|\fB-right\fR|\fB-full\fR? ?\fB-keys\fR \fIvarname\fR? \fItable\fR...
The operations performed by this method are the same as described
above for \fBdbJoin\fR. The only difference is in the specification
of the keys to use. Instead of using column indices separate from the
table here the keys are provided within the table itself. The row
elements in each \fItable\fR are not the lists of column values, but a
two-element list where the second element is the regular list of
column values and the first element is the key to use.
.TP
\fB::struct::list\fR \fBswap\fR \fIlistvar\fR \fIi\fR \fIj\fR
The subcommand exchanges the elements at the indices \fIi\fR and
\fIj\fR in the list stored in the variable named by \fIlistvar\fR. The
list is modified in place, and also returned as the result of the
subcommand.
.TP
\fB::struct::list\fR \fBfirstperm\fR \fIlist\fR
This subcommand returns the lexicographically first permutation of the
input \fIlist\fR.
.TP
\fB::struct::list\fR \fBnextperm\fR \fIperm\fR
This subcommand accepts a permutation of a set of elements (provided
by \fIperm\fR) and returns the next permutatation in lexicographic
sequence.
.sp
The algorithm used here is by Donal E. Knuth, see section
\fBREFERENCES\fR for details.
.TP
\fB::struct::list\fR \fBpermutations\fR \fIlist\fR
This subcommand returns a list containing all permutations of the
input \fIlist\fR in lexicographic order.
.TP
\fB::struct::list\fR \fBforeachperm\fR \fIvar\fR \fIlist\fR \fIbody\fR
This subcommand executes the script \fIbody\fR once for each
permutation of the specified \fIlist\fR. The permutations are visited
in lexicographic order, and the variable \fIvar\fR is set to the
permutation for which \fIbody\fR is currently executed. The result of
the loop command is the empty string.
.PP
.SH "LONGEST COMMON SUBSEQUENCE AND FILE COMPARISON"
.PP
The \fBlongestCommonSubsequence\fR subcommand forms the core of a
flexible system for doing differential comparisons of files, similar
to the capability offered by the Unix command \fBdiff\fR.
While this procedure is quite rapid for many tasks of file comparison,
its performance degrades severely if \fIsequence2\fR contains many
equal elements (as, for instance, when using this procedure to compare
two files, a quarter of whose lines are blank.  This drawback is
intrinsic to the algorithm used (see the Reference for details).
.PP
One approach to dealing with the performance problem that is sometimes
effective in practice is arbitrarily to exclude elements that appear
more than a certain number of times.
This number is provided as the \fImaxOccurs\fR parameter.  If frequent
lines are excluded in this manner, they will not appear in the common
subsequence that is computed; the result will be the longest common
subsequence of infrequent elements.
The procedure \fBlongestCommonSubsequence2\fR implements this
heuristic.
It functions as a wrapper around \fBlongestCommonSubsequence\fR; it
computes the longest common subsequence of infrequent elements, and
then subdivides the subsequences that lie between the matches to
approximate the true longest common subsequence.
.SH "TABLE JOIN"
This is an operation from relational algebra for relational databases.
.PP
The easiest way to understand the regular inner join is that it
creates the cartesian product of all the tables involved first and
then keeps only all those rows in the resulting table for which the
values in the specified key columns are equal to each other.
.PP
Implementing this description naively, i.e. as described above will
generate a \fIhuge\fR intermediate result. To avoid this the
cartesian product and the filtering of row are done at the same
time. What is required is a fast way to determine if a key is present
in a table. In a true database this is done through indices. Here we
use arrays internally.
.PP
An \fIouter\fR join is an extension of the inner join for two
tables. There are three variants of outerjoins, called \fIleft\fR,
\fIright\fR, and \fIfull\fR outer joins. Their result always
contains all rows from an inner join and then some additional rows.
.IP [1]
For the left outer join the additional rows are all rows from the left
table for which there is no key in the right table. They are joined to
an empty row of the right table to fit them into the result.
.IP [2]
For the right outer join the additional rows are all rows from the right
table for which there is no key in the left table. They are joined to
an empty row of the left table to fit them into the result.
.IP [3]
The full outer join combines both left and right outer join. In other
words, the additional rows are as defined for left outer join, and
right outer join, combined.
.PP
.PP
We extend all the joins from two to \fBn\fR tables (\fBn\fR > 2) by
executing
.CS


    (...((table1 join table2) join table3) ...) join tableN

.CE
.PP
Examples for all the joins:
.CS


    Inner Join

    {0 foo}              {0 bagel}    {0 foo   0 bagel}
    {1 snarf} inner join {1 snatz}  = {1 snarf 1 snatz}
    {2 blue}             {3 driver}

    Left Outer Join

    {0 foo}                   {0 bagel}    {0 foo   0 bagel}
    {1 snarf} left outer join {1 snatz}  = {1 snarf 1 snatz}
    {2 blue}                  {3 driver}   {2 blue  {} {}}

    Right Outer Join

    {0 foo}                    {0 bagel}    {0 foo   0 bagel}
    {1 snarf} right outer join {1 snatz}  = {1 snarf 1 snatz}
    {2 blue}                   {3 driver}   {{} {}   3 driver}

    Full Outer Join

    {0 foo}                   {0 bagel}    {0 foo   0 bagel}
    {1 snarf} full outer join {1 snatz}  = {1 snarf 1 snatz}
    {2 blue}                  {3 driver}   {2 blue  {} {}}
                                           {{} {}   3 driver}

.CE
.SH REFERENCES
.IP [1]
J. W. Hunt and M. D. McIlroy, "An algorithm for differential
file comparison," Comp. Sci. Tech. Rep. #41, Bell Telephone
Laboratories (1976). Available on the Web at the second
author's personal site: \fIhttp://www.cs.dartmouth.edu/~doug/\fR
.IP [2]
Donald E. Knuth, "Fascicle 2b of 'The Art of Computer Programming'
volume 4". Available on the Web at the author's personal site:
\fIhttp://www-cs-faculty.stanford.edu/~knuth/fasc2b.ps.gz\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: list\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
Fisher-Yates, assign, common, comparison, diff, differential, equal, equality, filter, first permutation, flatten, folding, full outer join, generate permutations, inner join, join, left outer join, list, longest common subsequence, map, next permutation, outer join, permutation, reduce, repeating, repetition, reshuffle, reverse, right outer join, shuffle, subsequence, swapping
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2003-2005 by Kevin B. Kenny. All rights reserved
Copyright (c) 2003-2012 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/struct/struct_set.n.































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/struct_set.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::set" n 2.2.3 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::set \- Procedures for manipulating sets
.SH SYNOPSIS
package require \fBTcl  8.0\fR
.sp
package require \fBstruct::set  ?2.2.3?\fR
.sp
\fB::struct::set\fR \fBempty\fR \fIset\fR
.sp
\fB::struct::set\fR \fBsize\fR \fIset\fR
.sp
\fB::struct::set\fR \fBcontains\fR \fIset\fR \fIitem\fR
.sp
\fB::struct::set\fR \fBunion\fR ?\fIset1\fR...?
.sp
\fB::struct::set\fR \fBintersect\fR ?\fIset1\fR...?
.sp
\fB::struct::set\fR \fBdifference\fR \fIset1\fR \fIset2\fR
.sp
\fB::struct::set\fR \fBsymdiff\fR \fIset1\fR \fIset2\fR
.sp
\fB::struct::set\fR \fBintersect3\fR \fIset1\fR \fIset2\fR
.sp
\fB::struct::set\fR \fBequal\fR \fIset1\fR \fIset2\fR
.sp
\fB::struct::set\fR \fBinclude\fR \fIsvar\fR \fIitem\fR
.sp
\fB::struct::set\fR \fBexclude\fR \fIsvar\fR \fIitem\fR
.sp
\fB::struct::set\fR \fBadd\fR \fIsvar\fR \fIset\fR
.sp
\fB::struct::set\fR \fBsubtract\fR \fIsvar\fR \fIset\fR
.sp
\fB::struct::set\fR \fBsubsetof\fR \fIA\fR \fIB\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fB::struct::set\fR namespace contains several useful commands for
processing finite sets.
.PP
It exports only a single command, \fBstruct::set\fR. All
functionality provided here can be reached through a subcommand of
this command.
.PP
\fINote:\fR As of version 2.2 of this package a critcl based C
implementation is available. This implementation however requires Tcl
8.4 to run.
.SH COMMANDS
.TP
\fB::struct::set\fR \fBempty\fR \fIset\fR
Returns a boolean value indicating if the \fIset\fR is
empty (\fBtrue\fR), or not (\fBfalse\fR).
.TP
\fB::struct::set\fR \fBsize\fR \fIset\fR
Returns an integer number greater than or equal to zero. This is the
number of elements in the \fIset\fR. In other words, its cardinality.
.TP
\fB::struct::set\fR \fBcontains\fR \fIset\fR \fIitem\fR
Returns a boolean value indicating if the \fIset\fR contains the
element \fIitem\fR (\fBtrue\fR), or not (\fBfalse\fR).
.TP
\fB::struct::set\fR \fBunion\fR ?\fIset1\fR...?
Computes the set containing the union of \fIset1\fR, \fIset2\fR,
etc., i.e. "\fIset1\fR + \fIset2\fR + ...", and returns this set
as the result of the command.
.TP
\fB::struct::set\fR \fBintersect\fR ?\fIset1\fR...?
Computes the set containing the intersection of \fIset1\fR,
\fIset2\fR, etc., i.e. "\fIset1\fR * \fIset2\fR * ...", and
returns this set as the result of the command.
.TP
\fB::struct::set\fR \fBdifference\fR \fIset1\fR \fIset2\fR
Computes the set containing the difference of \fIset1\fR and
\fIset2\fR, i.e. ("\fIset1\fR - \fIset2\fR") and returns this
set as the result of the command.
.TP
\fB::struct::set\fR \fBsymdiff\fR \fIset1\fR \fIset2\fR
Computes the set containing the symmetric difference of \fIset1\fR and
\fIset2\fR, i.e. ("(\fIset1\fR - \fIset2\fR) + (\fIset2\fR - \fIset1\fR)")
and returns this set as the result of the command.
.TP
\fB::struct::set\fR \fBintersect3\fR \fIset1\fR \fIset2\fR
This command is a combination of the methods \fBintersect\fR and
\fBdifference\fR.
It returns a three-element list containing "\fIset1\fR*\fIset2\fR",
"\fIset1\fR-\fIset2\fR", and "\fIset2\fR-\fIset1\fR", in this
order. In other words, the intersection of the two parameter sets, and
their differences.
.TP
\fB::struct::set\fR \fBequal\fR \fIset1\fR \fIset2\fR
Returns a boolean value indicating if the two sets are equal
(\fBtrue\fR) or not (\fBfalse\fR).
.TP
\fB::struct::set\fR \fBinclude\fR \fIsvar\fR \fIitem\fR
The element \fIitem\fR is added to the set specified by the variable
name in \fIsvar\fR. The return value of the command is empty. This is
the equivalent of \fBlappend\fR for sets. If the variable named by
\fIsvar\fR does not exist it will be created.
.TP
\fB::struct::set\fR \fBexclude\fR \fIsvar\fR \fIitem\fR
The element \fIitem\fR is removed from the set specified by the
variable name in \fIsvar\fR. The return value of the command is
empty. This is a near-equivalent of \fBlreplace\fR for sets.
.TP
\fB::struct::set\fR \fBadd\fR \fIsvar\fR \fIset\fR
All the element of \fIset\fR are added to the set specified by the
variable name in \fIsvar\fR. The return value of the command is
empty. This is like the method \fBinclude\fR, but for the addition
of a whole set. If the variable named by \fIsvar\fR does not exist it
will be created.
.TP
\fB::struct::set\fR \fBsubtract\fR \fIsvar\fR \fIset\fR
All the element of \fIset\fR are removed from the set specified by the
variable name in \fIsvar\fR. The return value of the command is
empty. This is like the method \fBexclude\fR, but for the removal
of a whole set.
.TP
\fB::struct::set\fR \fBsubsetof\fR \fIA\fR \fIB\fR
Returns a boolean value indicating if the set \fIA\fR is a true
subset of or equal to the set \fIB\fR (\fBtrue\fR), or not
(\fBfalse\fR).
.PP
.SH REFERENCES
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: set\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
cardinality, difference, emptiness, exclusion, inclusion, intersection, membership, set, symmetric difference, union
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2004-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/struct/struct_tree.n.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/struct_tree.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002-2004,2012 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::tree" n 2.1.1 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::tree \- Create and manipulate tree objects
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::tree  ?2.1.1?\fR
.sp
package require \fBstruct::list  ?1.5?\fR
.sp
\fB::struct::tree\fR ?\fItreeName\fR? ?\fB=\fR|\fB:=\fR|\fBas\fR|\fBdeserialize\fR \fIsource\fR?
.sp
\fBtreeName\fR \fBoption\fR ?\fIarg arg ...\fR?
.sp
\fB::struct::tree::prune\fR
.sp
\fItreeName\fR \fB=\fR \fIsourcetree\fR
.sp
\fItreeName\fR \fB-->\fR \fIdesttree\fR
.sp
\fItreeName\fR \fBancestors\fR \fInode\fR
.sp
\fItreeName\fR \fBappend\fR \fInode\fR \fIkey\fR \fIvalue\fR
.sp
\fItreeName\fR \fBattr\fR \fIkey\fR
.sp
\fItreeName\fR \fBattr\fR \fIkey\fR \fB-nodes\fR \fIlist\fR
.sp
\fItreeName\fR \fBattr\fR \fIkey\fR \fB-glob\fR \fIglobpattern\fR
.sp
\fItreeName\fR \fBattr\fR \fIkey\fR \fB-regexp\fR \fIrepattern\fR
.sp
\fItreeName\fR \fBchildren\fR ?\fB-all\fR? \fInode\fR ?\fBfilter\fR \fIcmdprefix\fR?
.sp
\fItreeName\fR \fBcut\fR \fInode\fR
.sp
\fItreeName\fR \fBdelete\fR \fInode\fR ?\fInode\fR ...?
.sp
\fItreeName\fR \fBdepth\fR \fInode\fR
.sp
\fItreeName\fR \fBdescendants\fR \fInode\fR ?\fBfilter\fR \fIcmdprefix\fR?
.sp
\fItreeName\fR \fBdeserialize\fR \fIserialization\fR
.sp
\fItreeName\fR \fBdestroy\fR
.sp
\fItreeName\fR \fBexists\fR \fInode\fR
.sp
\fItreeName\fR \fBget\fR \fInode\fR \fIkey\fR
.sp
\fItreeName\fR \fBgetall\fR \fInode\fR ?\fIpattern\fR?
.sp
\fItreeName\fR \fBkeys\fR \fInode\fR ?\fIpattern\fR?
.sp
\fItreeName\fR \fBkeyexists\fR \fInode\fR \fIkey\fR
.sp
\fItreeName\fR \fBindex\fR \fInode\fR
.sp
\fItreeName\fR \fBinsert\fR \fIparent\fR \fIindex\fR ?\fIchild\fR ?\fIchild\fR ...??
.sp
\fItreeName\fR \fBisleaf\fR \fInode\fR
.sp
\fItreeName\fR \fBlappend\fR \fInode\fR \fIkey\fR \fIvalue\fR
.sp
\fItreeName\fR \fBleaves\fR
.sp
\fItreeName\fR \fBmove\fR \fIparent\fR \fIindex\fR \fInode\fR ?\fInode\fR ...?
.sp
\fItreeName\fR \fBnext\fR \fInode\fR
.sp
\fItreeName\fR \fBnumchildren\fR \fInode\fR
.sp
\fItreeName\fR \fBnodes\fR
.sp
\fItreeName\fR \fBparent\fR \fInode\fR
.sp
\fItreeName\fR \fBprevious\fR \fInode\fR
.sp
\fItreeName\fR \fBrename\fR \fInode\fR \fInewname\fR
.sp
\fItreeName\fR \fBrootname\fR
.sp
\fItreeName\fR \fBserialize\fR ?\fInode\fR?
.sp
\fItreeName\fR \fBset\fR \fInode\fR \fIkey\fR ?\fIvalue\fR?
.sp
\fItreeName\fR \fBsize\fR ?\fInode\fR?
.sp
\fItreeName\fR \fBsplice\fR \fIparent\fR \fIfrom\fR ?\fIto\fR? ?\fIchild\fR?
.sp
\fItreeName\fR \fBswap\fR \fInode1\fR \fInode2\fR
.sp
\fItreeName\fR \fBunset\fR \fInode\fR \fIkey\fR
.sp
\fItreeName\fR \fBwalk\fR \fInode\fR ?\fB-order\fR \fIorder\fR? ?\fB-type\fR \fItype\fR? \fIloopvar\fR \fIscript\fR
.sp
\fItreeName\fR \fBwalkproc\fR \fInode\fR ?\fB-order\fR \fIorder\fR? ?\fB-type\fR \fItype\fR? \fIcmdprefix\fR
.sp
.BE
.SH DESCRIPTION
.PP
A tree is a collection of named elements, called nodes, one of which is
distinguished as a root, along with a relation ("parenthood") that
places a hierarchical structure on the nodes. (Data Structures and
Algorithms; Aho, Hopcroft and Ullman; Addison-Wesley, 1987).  In
addition to maintaining the node relationships, this tree
implementation allows any number of keyed values to be associated with
each node.
.PP
The element names can be arbitrary strings.
.PP
A tree is thus similar to an array, but with three important
differences:
.IP [1]
Trees are accessed through an object command, whereas arrays are
accessed as variables. (This means trees cannot be local to a procedure.)
.IP [2]
Trees have a hierarchical structure, whereas an array is just an
unordered collection.
.IP [3]
Each node of a tree has a separate collection of attributes and
values. This is like an array where every value is a dictionary.
.PP
.PP
\fINote:\fR The major version of the package \fBstruct\fR has
been changed to version 2.0, due to backward incompatible changes in
the API of this module. Please read the section
\fBChanges for 2.0\fR for a full list of all changes,
incompatible and otherwise.
.PP
.SH API
.SS "TREE CLASS API"
The main commands of the package are:
.TP
\fB::struct::tree\fR ?\fItreeName\fR? ?\fB=\fR|\fB:=\fR|\fBas\fR|\fBdeserialize\fR \fIsource\fR?
The command creates a new tree object with an associated global Tcl
command whose name is \fItreeName\fR. This command may be used to
invoke various operations on the tree.
It has the following general form:
.RS
.TP
\fBtreeName\fR \fBoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.RE
.sp
If \fItreeName\fR is not specified a unique name will be generated by
the package itself. If a \fIsource\fR is specified the new tree will
be initialized to it. For the operators \fB=\fR, \fB:=\fR, and
\fBas\fR \fIsource\fR is interpreted as the name of another tree
object, and the assignment operator \fB=\fR will be executed. For
\fBdeserialize\fR the \fIsource\fR is a serialized tree object and
\fBdeserialize\fR will be executed.
.sp
In other words
.sp
.CS


    ::struct::tree mytree = b

.CE
.sp
is equivalent to
.sp
.CS


    ::struct::tree mytree
    mytree = b

.CE
.sp
and
.sp
.CS


    ::struct::tree mytree deserialize $b

.CE
.sp
is equivalent to
.sp
.CS


    ::struct::tree mytree
    mytree deserialize $b

.CE
.TP
\fB::struct::tree::prune\fR
This command is provided outside of the tree methods, as it is not a
tree method per se. It however interacts tightly with the method
\fBwalk\fR. When used in the walk script it causes the traversal to
ignore the children of the node we are currently at.
This command cannot be used with the traversal modes which look at
children before their parent, i.e. \fBpost\fR and \fBin\fR. The
only applicable orders of traversal are \fBpre\fR and
\fBboth\fR. An error is thrown if the command and chosen order of
traversal do not fit.
.PP
.PP
.SS "TREE OBJECT API"
Two general observations beforehand:
.IP [1]
The root node of the tree can be used in most places where a node is
asked for. The default name of the rootnode is "root", but this can be
changed with the method \fBrename\fR (see below). Whatever the
current name for the root node of the tree is, it can be retrieved by
calling the method \fBrootname\fR.
.IP [2]
The method \fBinsert\fR is the only way to create new nodes, and
they are automatically added to a parent. A tree object cannot have
nodes without a parent, save the root node.
.PP
.PP
And now the methods supported by tree objects created by this package:
.TP
\fItreeName\fR \fB=\fR \fIsourcetree\fR
This is the assignment operator for tree objects. It copies the tree
contained in the tree object \fIsourcetree\fR over the tree data in
\fItreeName\fR. The old contents of \fItreeName\fR are deleted by this
operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fItreeName\fR \fBdeserialize\fR [\fIsourcetree\fR \fBserialize\fR]

.CE
.TP
\fItreeName\fR \fB-->\fR \fIdesttree\fR
This is the reverse assignment operator for tree objects. It copies the tree
contained in the tree object \fItreeName\fR over the tree data in the object
\fIdesttree\fR. The old contents of \fIdesttree\fR are deleted by this
operation.
.sp
This operation is in effect equivalent to
.sp
.CS


    \fIdesttree\fR \fBdeserialize\fR [\fItreeName\fR \fBserialize\fR]

.CE
.TP
\fItreeName\fR \fBancestors\fR \fInode\fR
This method extends the method \fBparent\fR and returns a list
containing all ancestor nodes to the specified \fInode\fR. The
immediate ancestor, in other words, parent node, is the first element
in that list, its parent the second element, and so on until the root
node is reached, making it the last element of the returned list.
.TP
\fItreeName\fR \fBappend\fR \fInode\fR \fIkey\fR \fIvalue\fR
Appends a \fIvalue\fR to one of the keyed values associated with an
node. Returns the new value given to the attribute \fIkey\fR.
.TP
\fItreeName\fR \fBattr\fR \fIkey\fR
.TP
\fItreeName\fR \fBattr\fR \fIkey\fR \fB-nodes\fR \fIlist\fR
.TP
\fItreeName\fR \fBattr\fR \fIkey\fR \fB-glob\fR \fIglobpattern\fR
.TP
\fItreeName\fR \fBattr\fR \fIkey\fR \fB-regexp\fR \fIrepattern\fR
This method retrieves the value of the attribute named \fIkey\fR, for
all nodes in the tree (matching the restriction specified via one of
the possible options) and having the specified attribute.
.sp
The result is a dictionary mapping from node names to the value of
attribute \fIkey\fR at that node.
Nodes not having the attribute \fIkey\fR, or not passing a
specified restriction, are not listed in the result.
.sp
The possible restrictions are:
.RS
.TP
\fB-nodes\fR
The value is a list of nodes. Only the nodes mentioned in this list
are searched for the attribute.
.TP
\fB-glob\fR
The value is a glob pattern. Only the nodes in the tree whose names
match this pattern are searched for the attribute.
.TP
\fB-regexp\fR
The value is a regular expression. Only the nodes in the tree whose
names match this pattern are searched for the attribute.
.RE
.sp
.TP
\fItreeName\fR \fBchildren\fR ?\fB-all\fR? \fInode\fR ?\fBfilter\fR \fIcmdprefix\fR?
Return a list of the children of \fInode\fR.
If the option \fB-all\fR is specified, then not only the direct
children, but their children, and so on are returned in the result.
If a filter command is specified only those nodes are listed in the
final result which pass the test. The command in \fIcmdprefix\fR is
called with two arguments, the name of the tree object, and the name
of the node in question. It is executed in the context of the caller
and has to return a boolean value. Nodes for which the command returns
\fBfalse\fR are removed from the result list before it is returned
to the caller.
.sp
Some examples:
.sp
.CS


    mytree insert root end 0 ; mytree set 0 volume 30
    mytree insert root end 1
    mytree insert root end 2
    mytree insert 0    end 3
    mytree insert 0    end 4
    mytree insert 4    end 5 ; mytree set 5 volume 50
    mytree insert 4    end 6

    proc vol {t n} {
	$t keyexists $n volume
    }
    proc vgt40 {t n} {
	if {![$t keyexists $n volume]} {return 0}
	expr {[$t get $n volume] > 40}
    }

    tclsh> lsort [mytree children -all root filter vol]
    0 5

    tclsh> lsort [mytree children -all root filter vgt40]
    5

    tclsh> lsort [mytree children root filter vol]
    0

    tclsh> puts ([lsort [mytree children root filter vgt40]])
    ()

.CE
.TP
\fItreeName\fR \fBcut\fR \fInode\fR
Removes the node specified by \fInode\fR from the tree, but not its
children.  The children of \fInode\fR are made children of the parent
of the \fInode\fR, at the index at which \fInode\fR was located.
.TP
\fItreeName\fR \fBdelete\fR \fInode\fR ?\fInode\fR ...?
Removes the specified nodes from the tree.  All of the nodes' children
will be removed as well to prevent orphaned nodes.
.TP
\fItreeName\fR \fBdepth\fR \fInode\fR
Return the number of steps from node \fInode\fR to the root node.
.TP
\fItreeName\fR \fBdescendants\fR \fInode\fR ?\fBfilter\fR \fIcmdprefix\fR?
This method extends the method \fBchildren\fR and returns a list
containing all nodes descending from \fInode\fR, and passing the
filter, if such was specified.
.sp
This is actually the same as
"\fItreeName\fR \fBchildren\fR \fB-all\fR".
\fBdescendants\fR should be prefered, and "children -all"
will be deprecated sometime in the future.
.TP
\fItreeName\fR \fBdeserialize\fR \fIserialization\fR
This is the complement to \fBserialize\fR. It replaces tree data in
\fItreeName\fR with the tree described by the \fIserialization\fR
value. The old contents of \fItreeName\fR are deleted by this
operation.
.TP
\fItreeName\fR \fBdestroy\fR
Destroy the tree, including its storage space and associated command.
.TP
\fItreeName\fR \fBexists\fR \fInode\fR
Returns true if the specified node exists in the tree.
.TP
\fItreeName\fR \fBget\fR \fInode\fR \fIkey\fR
Returns the value associated with the key \fIkey\fR for the node
\fInode\fR.
.TP
\fItreeName\fR \fBgetall\fR \fInode\fR ?\fIpattern\fR?
Returns a dictionary (suitable for use with [\fBarray set\fR])
containing the attribute data for the \fInode\fR.
If the glob \fIpattern\fR is specified only the attributes whose names
match the pattern will be part of the dictionary.
.TP
\fItreeName\fR \fBkeys\fR \fInode\fR ?\fIpattern\fR?
Returns a list of keys for the \fInode\fR.
If the \fIpattern\fR is specified only the attributes whose names
match the pattern will be part of the returned list. The pattern is a
\fBglob\fR pattern.
.TP
\fItreeName\fR \fBkeyexists\fR \fInode\fR \fIkey\fR
Return true if the specified \fIkey\fR exists for the \fInode\fR.
.TP
\fItreeName\fR \fBindex\fR \fInode\fR
Returns the index of \fInode\fR in its parent's list of children.  For
example, if a node has \fInodeFoo\fR, \fInodeBar\fR, and
\fInodeBaz\fR as children, in that order, the index of
\fInodeBar\fR is 1.
.TP
\fItreeName\fR \fBinsert\fR \fIparent\fR \fIindex\fR ?\fIchild\fR ?\fIchild\fR ...??
Insert one or more nodes into the tree as children of the node
\fIparent\fR. The nodes will be added in the order they are given. If
\fIparent\fR is \fBroot\fR, it refers to the root of the tree. The
new nodes will be added to the \fIparent\fR node's child list at the
index given by \fIindex\fR. The \fIindex\fR can be \fBend\fR in
which case the new nodes will be added after the current last child.
Indices of the form "end-\fBn\fR" are accepted as well.
.sp
If any of the specified children already exist in \fItreeName\fR,
those nodes will be moved from their original location to the new
location indicated by this command.
.sp
If no \fIchild\fR is specified, a single node will be added, and a
name will be generated for the new node. The generated name is of the
form \fInode\fR\fBx\fR, where \fBx\fR is a number. If names are
specified they must neither contain whitespace nor colons (":").
.sp
The return result from this command is a list of nodes added.
.TP
\fItreeName\fR \fBisleaf\fR \fInode\fR
Returns true if \fInode\fR is a leaf of the tree (if \fInode\fR has no
children), false otherwise.
.TP
\fItreeName\fR \fBlappend\fR \fInode\fR \fIkey\fR \fIvalue\fR
Appends a \fIvalue\fR (as a list) to one of the keyed values
associated with an \fInode\fR. Returns the new value given to the
attribute \fIkey\fR.
.TP
\fItreeName\fR \fBleaves\fR
Return a list containing all leaf nodes known to the tree.
.TP
\fItreeName\fR \fBmove\fR \fIparent\fR \fIindex\fR \fInode\fR ?\fInode\fR ...?
Make the specified nodes children of \fIparent\fR, inserting them into
the parent's child list at the index given by \fIindex\fR. Note that
the command will take all nodes out of the tree before inserting them
under the new parent, and that it determines the position to place
them into after the removal, before the re-insertion. This behaviour
is important when it comes to moving one or more nodes to a different
index without changing their parent node.
.TP
\fItreeName\fR \fBnext\fR \fInode\fR
Return the right sibling of \fInode\fR, or the empty string if
\fInode\fR was the last child of its parent.
.TP
\fItreeName\fR \fBnumchildren\fR \fInode\fR
Return the number of immediate children of \fInode\fR.
.TP
\fItreeName\fR \fBnodes\fR
Return a list containing all nodes known to the tree.
.TP
\fItreeName\fR \fBparent\fR \fInode\fR
Return the parent of \fInode\fR.
.TP
\fItreeName\fR \fBprevious\fR \fInode\fR
Return the left sibling of \fInode\fR, or the empty string if
\fInode\fR was the first child of its parent.
.TP
\fItreeName\fR \fBrename\fR \fInode\fR \fInewname\fR
Renames the node \fInode\fR to \fInewname\fR. An error is thrown if
either the node does not exist, or a node with name \fInewname\fR does
exist. The result of the command is the new name of the node.
.TP
\fItreeName\fR \fBrootname\fR
Returns the name of the root node of the tree.
.TP
\fItreeName\fR \fBserialize\fR ?\fInode\fR?
This method serializes the sub-tree starting at \fInode\fR. In other
words it returns a tcl \fIvalue\fR completely describing the tree
starting at \fInode\fR.
This allows, for example, the transfer of tree objects (or parts
thereof) over arbitrary channels, persistence, etc.
This method is also the basis for both the copy constructor and
the assignment operator.
.sp
The result of this method has to be semantically identical over all
implementations of the tree interface. This is what will enable us to
copy tree data between different implementations of the same
interface.
.sp
The result is a list containing containing a multiple of three
elements. It is like a serialized array except that there are two
values following each key. They are the names of the nodes in the
serialized tree. The two values are a reference to the parent node and
the attribute data, in this order.
.sp
The reference to the parent node is the empty string for the root node
of the tree. For all other nodes it is the index of the parent node in
the list. This means that they are integers, greater than or equal to
zero, less than the length of the list, and multiples of three.
The order of the nodes in the list is important insofar as it is used
to reconstruct the lists of children for each node. The children of a
node have to be listed in the serialization in the same order as they
are listed in their parent in the tree.
.sp
The attribute data of a node is a dictionary, i.e. a list of even
length containing a serialized array. For a node without attribute
data the dictionary is the empty list.
.sp
\fINote:\fR While the current implementation returns the root node as
the first element of the list, followed by its children and their
children in a depth-first traversal this is not necessarily true for
other implementations.
The only information a reader of the serialized data can rely on for
the structure of the tree is that the root node is signaled by the
empty string for the parent reference, that all other nodes refer to
their parent through the index in the list, and that children occur in
the same order as in their parent.
.sp
.CS


 A possible serialization for the tree structure

             +- d
       +- a -+
 root -+- b  +- e
       +- c
 is

 {root {} {} a 0 {} d 3 {} e 3 {} b 0 {} c 0 {}}

 The above assumes that none of the nodes have attributes.

.CE
.TP
\fItreeName\fR \fBset\fR \fInode\fR \fIkey\fR ?\fIvalue\fR?
Set or get one of the keyed values associated with a node. A node may
have any number of keyed values associated with it.  If \fIvalue\fR is
not specified, this command returns the current value assigned to the
key; if \fIvalue\fR is specified, this command assigns that value to
the key, and returns it.
.TP
\fItreeName\fR \fBsize\fR ?\fInode\fR?
Return a count of the number of descendants of the node \fInode\fR; if
no node is specified, \fBroot\fR is assumed.
.TP
\fItreeName\fR \fBsplice\fR \fIparent\fR \fIfrom\fR ?\fIto\fR? ?\fIchild\fR?
Insert a node named \fIchild\fR into the tree as a child of the node
\fIparent\fR. If \fIparent\fR is \fBroot\fR, it refers to the root
of the tree. The new node will be added to the parent node's child
list at the index given by \fIfrom\fR.  The children of \fIparent\fR
which are in the range of the indices \fIfrom\fR and \fIto\fR are made
children of \fIchild\fR.  If the value of \fIto\fR is not specified it
defaults to \fBend\fR.  If no name is given for \fIchild\fR, a name
will be generated for the new node.  The generated name is of the form
\fInode\fR\fBx\fR, where \fBx\fR is a number.  The return result
from this command is the name of the new node.
.sp
The arguments \fIfrom\fR and \fIto\fR are regular list indices, i.e.
the form "end-\fBn\fR" is accepted as well.
.TP
\fItreeName\fR \fBswap\fR \fInode1\fR \fInode2\fR
Swap the position of \fInode1\fR and \fInode2\fR in the tree.
.TP
\fItreeName\fR \fBunset\fR \fInode\fR \fIkey\fR
Removes a keyed value from the node \fInode\fR. The method will do
nothing if the \fIkey\fR does not exist.
.TP
\fItreeName\fR \fBwalk\fR \fInode\fR ?\fB-order\fR \fIorder\fR? ?\fB-type\fR \fItype\fR? \fIloopvar\fR \fIscript\fR
Perform a breadth-first or depth-first walk of the tree starting at
the node \fInode\fR.  The type of walk, breadth-first or depth-first,
is determined by the value of \fItype\fR; \fBbfs\fR indicates
breadth-first, \fBdfs\fR indicates depth-first.  Depth-first is the
default. The order of the walk, pre-, post-, both- or in-order is
determined by the value of \fIorder\fR; \fBpre\fR indicates
pre-order, \fBpost\fR indicates post-order, \fBboth\fR indicates
both-order and \fBin\fR indicates in-order. Pre-order is the
default.
.sp
Pre-order walking means that a parent node is visited before any of
its children.  For example, a breadth-first search starting from the
root will visit the root, followed by all of the root's children,
followed by all of the root's grandchildren. Post-order walking means
that a parent node is visited after any of its children. Both-order
walking means that a parent node is visited before \fIand\fR after
any of its children. In-order walking means that a parent node is
visited after its first child and before the second. This is a
generalization of in-order walking for binary trees and will do the
right thing if a binary tree is walked. The combination of a breadth-first
walk with in-order is illegal.
.sp
As the walk progresses, the \fIscript\fR will be evaluated at each
node. The evaluation takes place in the context of the caller of the
method.
Regarding loop variables, these are listed in \fIloopvar\fR. If one
only one variable is specified it will be set to the id of the
node. When two variables are specified, i.e. \fIloopvar\fR is a true
list, then the first variable will be set to the action performed at
the node, and the other to the id of the node itself.
All loop variables are created in the context of the caller.
.sp
There are three possible actions: \fBenter\fR, \fBleave\fR,
or \fBvisit\fR.  \fBenter\fR actions occur during pre-order
walks; \fBleave\fR actions occur during post-order walks;
\fBvisit\fR actions occur during in-order walks.  In a both-order
walk, the command will be evaluated twice for each node; the action is
\fBenter\fR for the first evaluation, and \fBleave\fR for the
second.
.sp
\fINote\fR: The \fBenter\fR action for a node is always performed
before the walker will look at the children of that node. This means
that changes made by the \fIscript\fR to the children of the node
will immediately influence the walker and the steps it will take.
.sp
Any other manipulation, for example of nodes higher in the tree (i.e
already visited), or upon leaving will have undefined results. They
may succeed, error out, silently compute the wrong result, or anything
in between.
.sp
At last a small table showing the relationship between the various
options and the possible actions.
.sp
.CS


 order       type    actions         notes
 -----       ----    -----           -----
 pre         dfs     enter           parent before children
 post        dfs     leave           parent after children
 in          dfs     visit           parent between first and second child.
 both        dfs     enter, leave    parent before and after children
 -----       ----    -----           -----
 pre         bfs     enter           parent before children
 post        bfs     leave           parent after children
 in          bfs             -- illegal --
 both        bfs     enter, leave    parent before and after children
 -----       ----    -----           -----

.CE
.sp
Note the command \fB::struct::tree::prune\fR. This command can be used
in the walk script to force the command to ignore the children of the
node we are currently at. It will throw an error if the order of
traversal is either \fBpost\fR or \fBin\fR as these modes visit
the children before their parent, making pruning non-sensical.
.TP
\fItreeName\fR \fBwalkproc\fR \fInode\fR ?\fB-order\fR \fIorder\fR? ?\fB-type\fR \fItype\fR? \fIcmdprefix\fR
This method is like method \fBwalk\fR in all essentials, except the
interface to the user code. This method invokes a command prefix with
three additional arguments (tree, node, and action), instead of
evaluating a script and passing the node via a loop variable.
.PP
.SS "CHANGES FOR 2.0"
The following noteworthy changes have occurred:
.IP [1]
The API for accessing attributes and their values has been
simplified.
.sp
All functionality regarding the default attribute "data" has been
removed. This default attribute does not exist anymore. All accesses
to attributes have to specify the name of the attribute in
question. This backward \fIincompatible\fR change allowed us to
simplify the signature of all methods handling attributes.
.sp
Especially the flag \fB-key\fR is not required anymore, even more,
its use is now forbidden. Please read the documentation for the
methods \fBset\fR, \fBget\fR, \fBgetall\fR, \fBunset\fR,
\fBappend\fR, \fBlappend\fR, \fBkeyexists\fR
and \fBkeys\fR for a description of the new API's.
.IP [2]
The methods \fBkeys\fR and \fBgetall\fR now take an optional
pattern argument and will return only attribute data for keys matching
this pattern.
.IP [3]
Nodes can now be renamed. See the documentation for the method
\fBrename\fR.
.IP [4]
The structure has been extended with API's for the serialization and
deserialization of tree objects, and a number of operations based on
them (tree assignment, copy construction).
.sp
Please read the documentation for the methods \fBserialize\fR,
\fBdeserialize\fR, \fB=\fR, and \fB-->\fR, and the
documentation on the construction of tree objects.
.sp
Beyond the copying of whole tree objects these new API's also enable
the transfer of tree objects over arbitrary channels and for easy
persistence.
.IP [5]
The walker API has been streamlined and made more similar to the
command \fBforeach\fR. In detail:
.RS
.IP \(bu
The superfluous option \fB-command\fR has been removed.
.IP \(bu
Ditto for the place holders. Instead of the placeholders two loop
variables have to be specified to contain node and action information.
.IP \(bu
The old command argument has been documented as a script now, which it
was in the past too.
.IP \(bu
The fact that \fBenter\fR actions are called before the walker looks
at the children of a node has been documented now. In other words it
is now officially allowed to manipulate the list of children for a
node under \fIthese\fR circumstances. It has been made clear that
changes under any other circumstances will have undefined results,
from silently computing the wrong result to erroring out.
.RE
.IP [6]
A new method, \fBattr\fR, was added allowing the query and
retrieval of attribute data without regard to the node relationship.
.IP [7]
The method \fBchildren\fR has been extended with the ability to
select from the children of the node based on an arbitrary filtering
criterium. Another extension is the ability to look not only at the
immediate children of the node, but the whole tree below it.
.PP
.SH EXAMPLES
The following example demonstrates the creation of new nodes:
.CS


    mytree insert root end 0   ; # Create node 0, as child of the root
    mytree insert root end 1 2 ; # Ditto nodes 1 & 2
    mytree insert 0    end 3   ; # Now create node 3 as child of node 0
    mytree insert 0    end     ; # Create another child of 0, with a
    #                              generated name. The name is returned
    #                              as the result of the command.

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: tree\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
breadth-first, depth-first, in-order, node, post-order, pre-order, serialization, tree
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002-2004,2012 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/struct/struct_tree1.n.























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/struct/struct_tree1.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2002 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "struct::tree_v1" n 1.2.2 tcllib "Tcl Data Structures"
.BS
.SH NAME
struct::tree_v1 \- Create and manipulate tree objects
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBstruct::tree  ?1.2.2?\fR
.sp
\fBtreeName\fR \fBoption\fR ?\fIarg arg ...\fR?
.sp
\fItreeName\fR \fBappend\fR \fInode\fR ?-key \fIkey\fR? \fIvalue\fR
.sp
\fItreeName\fR \fBchildren\fR \fInode\fR
.sp
\fItreeName\fR \fBcut\fR \fInode\fR
.sp
\fItreeName\fR \fBdelete\fR \fInode\fR ?\fInode\fR ...?
.sp
\fItreeName\fR \fBdepth\fR \fInode\fR
.sp
\fItreeName\fR \fBdestroy\fR
.sp
\fItreeName\fR \fBexists\fR \fInode\fR
.sp
\fItreeName\fR \fBget\fR \fInode\fR ?\fB-key\fR \fIkey\fR?
.sp
\fItreeName\fR \fBgetall\fR \fInode\fR
.sp
\fItreeName\fR \fBkeys\fR \fInode\fR
.sp
\fItreeName\fR \fBkeyexists\fR \fInode\fR ?-key \fIkey\fR?
.sp
\fItreeName\fR \fBindex\fR \fInode\fR
.sp
\fItreeName\fR \fBinsert\fR \fIparent\fR \fIindex\fR ?\fIchild\fR ?\fIchild\fR ...??
.sp
\fItreeName\fR \fBisleaf\fR \fInode\fR
.sp
\fItreeName\fR \fBlappend\fR \fInode\fR ?-key \fIkey\fR? \fIvalue\fR
.sp
\fItreeName\fR \fBmove\fR \fIparent\fR \fIindex\fR \fInode\fR ?\fInode\fR ...?
.sp
\fItreeName\fR \fBnext\fR \fInode\fR
.sp
\fItreeName\fR \fBnumchildren\fR \fInode\fR
.sp
\fItreeName\fR \fBparent\fR \fInode\fR
.sp
\fItreeName\fR \fBprevious\fR \fInode\fR
.sp
\fItreeName\fR \fBset\fR \fInode\fR ?\fB-key\fR \fIkey\fR? ?\fIvalue\fR?
.sp
\fItreeName\fR \fBsize\fR ?\fInode\fR?
.sp
\fItreeName\fR \fBsplice\fR \fIparent\fR \fIfrom\fR ?\fIto\fR? ?\fIchild\fR?
.sp
\fItreeName\fR \fBswap\fR \fInode1\fR \fInode2\fR
.sp
\fItreeName\fR \fBunset\fR \fInode\fR ?\fB-key\fR \fIkey\fR?
.sp
\fItreeName\fR \fBwalk\fR \fInode\fR ?\fB-order\fR \fIorder\fR? ?\fB-type\fR \fItype\fR? \fB-command\fR \fIcmd\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fB::struct::tree\fR command creates a new tree object with an
associated global Tcl command whose name is \fItreeName\fR. This
command may be used to invoke various operations on the tree. It has
the following general form:
.TP
\fBtreeName\fR \fBoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.PP
.PP
A tree is a collection of named elements, called nodes, one of which is
distinguished as a root, along with a relation ("parenthood") that
places a hierarchical structure on the nodes. (Data Structures and
Algorithms; Aho, Hopcroft and Ullman; Addison-Wesley, 1987).  In
addition to maintaining the node relationships, this tree
implementation allows any number of keyed values to be associated with
each node.
.PP
The element names can be arbitrary strings.
.PP
A tree is thus similar to an array, but with three important
differences:
.IP [1]
Trees are accessed through an object command, whereas arrays are
accessed as variables. (This means trees cannot be local to a procedure.)
.IP [2]
Trees have a hierarchical structure, whereas an array is just an
unordered collection.
.IP [3]
Each node of a tree has a separate collection of attributes and
values. This is like an array where every value is a dictionary.
.PP
.PP
The following commands are possible for tree objects:
.TP
\fItreeName\fR \fBappend\fR \fInode\fR ?-key \fIkey\fR? \fIvalue\fR
Appends a \fIvalue\fR to one of the keyed values associated with an
node. If no \fIkey\fR is specified, the key \fBdata\fR is assumed.
.TP
\fItreeName\fR \fBchildren\fR \fInode\fR
Return a list of the children of \fInode\fR.
.TP
\fItreeName\fR \fBcut\fR \fInode\fR
Removes the node specified by \fInode\fR from the tree, but not its
children.  The children of \fInode\fR are made children of the parent
of the \fInode\fR, at the index at which \fInode\fR was located.
.TP
\fItreeName\fR \fBdelete\fR \fInode\fR ?\fInode\fR ...?
Removes the specified nodes from the tree.  All of the nodes' children
will be removed as well to prevent orphaned nodes.
.TP
\fItreeName\fR \fBdepth\fR \fInode\fR
Return the number of steps from node \fInode\fR to the root node.
.TP
\fItreeName\fR \fBdestroy\fR
Destroy the tree, including its storage space and associated command.
.TP
\fItreeName\fR \fBexists\fR \fInode\fR
Returns true if the specified node exists in the tree.
.TP
\fItreeName\fR \fBget\fR \fInode\fR ?\fB-key\fR \fIkey\fR?
Return the value associated with the key \fIkey\fR for the node
\fInode\fR. If no key is specified, the key \fBdata\fR is assumed.
.TP
\fItreeName\fR \fBgetall\fR \fInode\fR
Returns a serialized list of key/value pairs (suitable for use with
[\fBarray set\fR]) for the \fInode\fR.
.TP
\fItreeName\fR \fBkeys\fR \fInode\fR
Returns a list of keys for the \fInode\fR.
.TP
\fItreeName\fR \fBkeyexists\fR \fInode\fR ?-key \fIkey\fR?
Return true if the specified \fIkey\fR exists for the \fInode\fR. If
no \fIkey\fR is specified, the key \fBdata\fR is assumed.
.TP
\fItreeName\fR \fBindex\fR \fInode\fR
Returns the index of \fInode\fR in its parent's list of children.  For
example, if a node has \fInodeFoo\fR, \fInodeBar\fR, and
\fInodeBaz\fR as children, in that order, the index of
\fInodeBar\fR is 1.
.TP
\fItreeName\fR \fBinsert\fR \fIparent\fR \fIindex\fR ?\fIchild\fR ?\fIchild\fR ...??
Insert one or more nodes into the tree as children of the node
\fIparent\fR. The nodes will be added in the order they are given. If
\fIparent\fR is \fBroot\fR, it refers to the root of the tree. The
new nodes will be added to the \fIparent\fR node's child list at the
index given by \fIindex\fR. The \fIindex\fR can be \fBend\fR in
which case the new nodes will be added after the current last child.
.sp
If any of the specified children already exist in \fItreeName\fR,
those nodes will be moved from their original location to the new
location indicated by this command.
.sp
If no \fIchild\fR is specified, a single node will be added, and a
name will be generated for the new node. The generated name is of the
form \fInode\fR\fBx\fR, where \fBx\fR is a number. If names are
specified they must neither contain whitespace nor colons (":").
.sp
The return result from this command is a list of nodes added.
.TP
\fItreeName\fR \fBisleaf\fR \fInode\fR
Returns true if \fInode\fR is a leaf of the tree (if \fInode\fR has no
children), false otherwise.
.TP
\fItreeName\fR \fBlappend\fR \fInode\fR ?-key \fIkey\fR? \fIvalue\fR
Appends a \fIvalue\fR (as a list) to one of the keyed values
associated with an \fInode\fR. If no \fIkey\fR is specified, the key
\fBdata\fR is assumed.
.TP
\fItreeName\fR \fBmove\fR \fIparent\fR \fIindex\fR \fInode\fR ?\fInode\fR ...?
Make the specified nodes children of \fIparent\fR, inserting them into
the parent's child list at the index given by \fIindex\fR. Note that
the command will take all nodes out of the tree before inserting them
under the new parent, and that it determines the position to place
them into after the removal, before the re-insertion. This behaviour
is important when it comes to moving one or more nodes to a different
index without changing their parent node.
.TP
\fItreeName\fR \fBnext\fR \fInode\fR
Return the right sibling of \fInode\fR, or the empty string if
\fInode\fR was the last child of its parent.
.TP
\fItreeName\fR \fBnumchildren\fR \fInode\fR
Return the number of immediate children of \fInode\fR.
.TP
\fItreeName\fR \fBparent\fR \fInode\fR
Return the parent of \fInode\fR.
.TP
\fItreeName\fR \fBprevious\fR \fInode\fR
Return the left sibling of \fInode\fR, or the empty string if
\fInode\fR was the first child of its parent.
.TP
\fItreeName\fR \fBset\fR \fInode\fR ?\fB-key\fR \fIkey\fR? ?\fIvalue\fR?
Set or get one of the keyed values associated with a node. If no key
is specified, the key \fBdata\fR is assumed.  Each node that is
added to a tree has the value "" assigned to the key \fBdata\fR
automatically.  A node may have any number of keyed values associated
with it.  If \fIvalue\fR is not specified, this command returns the
current value assigned to the key; if \fIvalue\fR is specified, this
command assigns that value to the key.
.TP
\fItreeName\fR \fBsize\fR ?\fInode\fR?
Return a count of the number of descendants of the node \fInode\fR; if
no node is specified, \fBroot\fR is assumed.
.TP
\fItreeName\fR \fBsplice\fR \fIparent\fR \fIfrom\fR ?\fIto\fR? ?\fIchild\fR?
Insert a node named \fIchild\fR into the tree as a child of the node
\fIparent\fR. If \fIparent\fR is \fBroot\fR, it refers to the root
of the tree. The new node will be added to the parent node's child
list at the index given by \fIfrom\fR.  The children of \fIparent\fR
which are in the range of the indices \fIfrom\fR and \fIto\fR are made
children of \fIchild\fR.  If the value of \fIto\fR is not specified it
defaults to \fBend\fR.  If no name is given for \fIchild\fR, a name
will be generated for the new node.  The generated name is of the form
\fInode\fR\fBx\fR, where \fBx\fR is a number.  The return result
from this command is the name of the new node.
.TP
\fItreeName\fR \fBswap\fR \fInode1\fR \fInode2\fR
Swap the position of \fInode1\fR and \fInode2\fR in the tree.
.TP
\fItreeName\fR \fBunset\fR \fInode\fR ?\fB-key\fR \fIkey\fR?
Removes a keyed value from the node \fInode\fR.  If no key is
specified, the key \fBdata\fR is assumed.
.TP
\fItreeName\fR \fBwalk\fR \fInode\fR ?\fB-order\fR \fIorder\fR? ?\fB-type\fR \fItype\fR? \fB-command\fR \fIcmd\fR
Perform a breadth-first or depth-first walk of the tree starting at
the node \fInode\fR.  The type of walk, breadth-first or depth-first,
is determined by the value of \fItype\fR; \fBbfs\fR indicates
breadth-first, \fBdfs\fR indicates depth-first.  Depth-first is the
default. The order of the walk, pre-, post-, both- or in-order is
determined by the value of \fIorder\fR; \fBpre\fR indicates
pre-order, \fBpost\fR indicates post-order, \fBboth\fR indicates
both-order and \fBin\fR indicates in-order. Pre-order is the
default.
.sp
Pre-order walking means that a parent node is visited before any of
its children.  For example, a breadth-first search starting from the
root will visit the root, followed by all of the root's children,
followed by all of the root's grandchildren. Post-order walking means
that a parent node is visited after any of its children. Both-order
walking means that a parent node is visited before \fIand\fR after
any of its children. In-order walking means that a parent node is
visited after its first child and before the second. This is a
generalization of in-order walking for binary trees and will do the
right thing if a binary is walked. The combination of a breadth-first
walk with in-order is illegal.
.sp
As the walk progresses, the command \fIcmd\fR will be evaluated at
each node.  Percent substitution will be performed on \fIcmd\fR before
evaluation, just as in a \fBbind\fR script.  The following
substitutions are recognized:
.RS
.TP
\fB%%\fR
Insert the literal % character.
.TP
\fB%t\fR
Name of the tree object.
.TP
\fB%n\fR
Name of the current node.
.TP
\fB%a\fR
Name of the action occurring; one of \fBenter\fR, \fBleave\fR,
or \fBvisit\fR.  \fBenter\fR actions occur during pre-order
walks; \fBleave\fR actions occur during post-order walks;
\fBvisit\fR actions occur during in-order walks.  In a both-order
walk, the command will be evaluated twice for each node; the action is
\fBenter\fR for the first evaluation, and \fBleave\fR for the
second.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIstruct :: tree\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
tree
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2002 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/tar/tar.n.








































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/tar/tar.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tar" n 0.7 tcllib "Tar file handling"
.BS
.SH NAME
tar \- Tar file creation, extraction & manipulation
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBtar  ?0.7?\fR
.sp
\fB::tar::contents\fR \fItarball\fR ?\fB-chan\fR?
.sp
\fB::tar::stat\fR \fItarball\fR ?file? ?\fB-chan\fR?
.sp
\fB::tar::untar\fR \fItarball\fR \fIargs\fR
.sp
\fB::tar::get\fR \fItarball\fR \fIfileName\fR ?\fB-chan\fR?
.sp
\fB::tar::create\fR \fItarball\fR \fIfiles\fR \fIargs\fR
.sp
\fB::tar::add\fR \fItarball\fR \fIfiles\fR \fIargs\fR
.sp
\fB::tar::remove\fR \fItarball\fR \fIfiles\fR
.sp
.BE
.SH DESCRIPTION
.PP
.TP
\fB::tar::contents\fR \fItarball\fR ?\fB-chan\fR?
Returns a list of the files contained in \fItarball\fR. The order is not sorted and depends on the order
files were stored in the archive.
.sp
If the option \fB-chan\fR is present \fItarball\fR is interpreted as an open channel.
It is assumed that the channel was opened for reading, and configured for binary input.
The command will \fInot\fR close the channel.
.TP
\fB::tar::stat\fR \fItarball\fR ?file? ?\fB-chan\fR?
Returns a nested dict containing information on the named ?file? in \fItarball\fR,
or all files if none is specified. The top level are pairs of filename and info. The info is a dict with the keys
"\fBmode\fR \fBuid\fR \fBgid\fR \fBsize\fR \fBmtime\fR \fBtype\fR \fBlinkname\fR \fBuname\fR \fBgname\fR
\fBdevmajor\fR \fBdevminor\fR"
.CS


% ::tar::stat tarball.tar
foo.jpg {mode 0644 uid 1000 gid 0 size 7580 mtime 811903867 type file linkname {} uname user gname wheel devmajor 0 devminor 0}

.CE
.sp
If the option \fB-chan\fR is present \fItarball\fR is interpreted as an open channel.
It is assumed that the channel was opened for reading, and configured for binary input.
The command will \fInot\fR close the channel.
.TP
\fB::tar::untar\fR \fItarball\fR \fIargs\fR
Extracts \fItarball\fR. \fI-file\fR and \fI-glob\fR limit the extraction
to files which exactly match or pattern match the given argument. No error is
thrown if no files match. Returns a list of filenames extracted and the file
size. The size will be null for non regular files. Leading path seperators are
stripped so paths will always be relative.
.RS
.TP
\fB-dir\fR dirName
Directory to extract to. Uses \fBpwd\fR if none is specified
.TP
\fB-file\fR fileName
Only extract the file with this name. The name is matched against the complete path
stored in the archive including directories.
.TP
\fB-glob\fR pattern
Only extract files patching this glob style pattern. The pattern is matched against the complete path
stored in the archive.
.TP
\fB-nooverwrite\fR
Dont overwrite files that already exist
.TP
\fB-nomtime\fR
Leave the file modification time as the current time instead of setting it to the value in the archive.
.TP
\fB-noperms\fR
In Unix, leave the file permissions as the current umask instead of setting them to the values in the archive.
.TP
\fB-chan\fR
If this option is present \fItarball\fR is interpreted as an open channel.
It is assumed that the channel was opened for reading, and configured for binary input.
The command will \fInot\fR close the channel.
.RE
.sp
.CS


% foreach {file size} [::tar::untar tarball.tar -glob *.jpg] {
puts "Extracted $file ($size bytes)"
}

.CE
.TP
\fB::tar::get\fR \fItarball\fR \fIfileName\fR ?\fB-chan\fR?
Returns the contents of \fIfileName\fR from the \fItarball\fR
.sp
.CS


% set readme [::tar::get tarball.tar doc/README] {
% puts $readme
}

.CE
.sp
If the option \fB-chan\fR is present \fItarball\fR is interpreted as an open channel.
It is assumed that the channel was opened for reading, and configured for binary input.
The command will \fInot\fR close the channel.
.TP
\fB::tar::create\fR \fItarball\fR \fIfiles\fR \fIargs\fR
Creates a new tar file containing the \fIfiles\fR. \fIfiles\fR must be specified
as a single argument which is a proper list of filenames.
.RS
.TP
\fB-dereference\fR
Normally \fBcreate\fR will store links as an actual link pointing at a file that may
or may not exist in the archive. Specifying this option will cause the actual file point to
by the link to be stored instead.
.TP
\fB-chan\fR
If this option is present \fItarball\fR is interpreted as an open channel.
It is assumed that the channel was opened for writing, and configured for binary output.
The command will \fInot\fR close the channel.
.RE
.sp
.CS


% ::tar::create new.tar [glob -nocomplain file*]
% ::tar::contents new.tar
file1 file2 file3

.CE
.TP
\fB::tar::add\fR \fItarball\fR \fIfiles\fR \fIargs\fR
Appends \fIfiles\fR to the end of the existing \fItarball\fR. \fIfiles\fR must be specified
as a single argument which is a proper list of filenames.
.RS
.TP
\fB-dereference\fR
Normally \fBadd\fR will store links as an actual link pointing at a file that may
or may not exist in the archive. Specifying this option will cause the actual file point to
by the link to be stored instead.
.TP
\fB-prefix\fR string
Normally \fBadd\fR will store files under exactly the name specified as
argument. Specifying a ?-prefix? causes the \fIstring\fR to be
prepended to every name.
.TP
\fB-quick\fR
The only sure way to find the position in the \fItarball\fR where new
files can be added is to read it from start, but if \fItarball\fR was
written with a "blocksize" of 1 (as this package does) then one can
alternatively find this position by seeking from the end. The
?-quick? option tells \fBadd\fR to do the latter.
.RE
.sp
.TP
\fB::tar::remove\fR \fItarball\fR \fIfiles\fR
Removes \fIfiles\fR from the \fItarball\fR. No error will result if the file does not exist in the
tarball. Directory write permission and free disk space equivalent to at least the size of the tarball
will be needed.
.CS


% ::tar::remove new.tar {file2 file3}
% ::tar::contents new.tar
file3

.CE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItar\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
archive, tape archive, tar
.SH CATEGORY
File formats

Added embedded/man/files/modules/tepam/tepam_argument_dialogbox.n.








































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/tepam/tepam_argument_dialogbox.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009/2010, Andreas Drollinger
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tepam::argument_dialogbox" n 0.4.0 tcllib "Tcl's Enhanced Procedure and Argument Manager"
.BS
.SH NAME
tepam::argument_dialogbox \- TEPAM argument_dialogbox, reference manual
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBTk  8.3\fR
.sp
package require \fBtepam  ?0.4?\fR
.sp
\fBtepam::argument_dialogbox\fR \fIitem_name item_attributes ?item_name item_attributes? ?...?\fR
.sp
\fBtepam::argument_dialogbox\fR {\fIitem_name item_attributes ?item_name item_attributes? ?...?\fR}
.sp
.BE
.SH DESCRIPTION
.SH "ARGUMENT DIALOGBOX CALL"
TEPAM's \fBargument_dialogbox\fR is a flexible and easily usable data entry form generator. Each data entry element of a form is defined via a \fIdata entry item\fR that can be provided to \fBargument_dialogbox\fR in two formats:
.TP
\fBtepam::argument_dialogbox\fR \fIitem_name item_attributes ?item_name item_attributes? ?...?\fR
Using this first format, each \fIdata entry item\fR is defined via a pair of two arguments. The first one is the \fIitem name\fR that defines the entry widget that has to be used in the form. The second argument, called \fIitem attributes\fR, specifies the variable which is attributed to the data entry element as well as eventual formatting and context information.
.sp
The \fBargument_dialogbox\fR returns \fBok\fR if the entered data have been acknowledged (via the \fIOK\fR button) and validated by a data checker. If the entered data have been rejected (via the \fICancel\fR button) the \fBargument_dialogbox\fR returns \fBcancel\fR.
.sp
A small example illustrates how the \fBargument_dialogbox\fR can be employed:
.CS

set DialogResult [\fBtepam::argument_dialogbox\fR \\
   \fB-title\fR "Itinerary selection" \\
   \fB-file\fR {\fI-label "Itinerary report" -variable report_file\fR} \\
   \fB-frame\fR {\fI-label "Itinerary start"\fR} \\
      \fB-comment\fR {\fI-text "Specify your itinerary start location"\fR} \\
      \fB-entry\fR {\fI-label "City" -variable start_city -type string\fR} \\
      \fB-entry\fR {\fI-label "Street" -variable start_street -type string -optional 1\fR} \\
      \fB-entry\fR {\fI-label "Street number" -variable start_street_nbr -type integer -optional 1\fR} \\
   \fB-frame\fR {\fI-label "Itinerary destination"\fR} \\
      \fB-comment\fR {\fI-text "Specify your itinerary destination"\fR} \\
      \fB-entry\fR {\fI-label "City" -variable dest_city -type string\fR} \\
      \fB-entry\fR {\fI-label "Street" -variable dest_street -type string -optional 1\fR} \\
      \fB-entry\fR {\fI-label "Street number" -variable dest_street_nbr -type integer -optional 1\fR} \\
   \fB-frame\fR {} \\
   \fB-checkbutton\fR {\fI-label "Don't use highways" -variable no_highway\fR}]
.CE
.IP
This example opens a dialog box that has the title \fIItinerary selection\fR. A first entry widget in this box allows selecting a report file. It follows two frames to define respectively an itinerary start and end location. Each of these locations that are described with a comment has three entry widgets to specify respectively the city, street and the street number. Bellow the second frame there is a check button that allows specifying if eventual highways should be ignored.
.TP
\fBtepam::argument_dialogbox\fR {\fIitem_name item_attributes ?item_name item_attributes? ?...?\fR}
Sometimes it is simpler to provide all the data entry item definitions in form of a single list to \fBargument_dialogbox\fR, and not as individual arguments. The second format that is supported by \fBargument_dialogbox\fR corresponds exactly to the first one, except that all item definitions are packed into a single list that is provided to \fBargument_dialogbox\fR. The previous example can therefore also be written in the following way:
.CS

set DialogResult [\fBtepam::argument_dialogbox {\fR
   \fB-title\fR "Itinerary selection"
   \fB-file\fR {\fI-label "Itinerary report" -variable report_file\fR}
   ...
   \fB-checkbutton\fR {\fI-label "Don't use highways" -variable no_highway\fR} \fB}\fR]
.CE
.PP
The commands \fBargument_dialogbox\fR as well as \fBprocedure\fR are exported from the namespace \fBtepam\fR. To use these commands without the \fBtepam::\fR namespace prefix, it is sufficient to import them into the main namespace:
.CS

\fBnamespace import tepam::*\fR

set DialogResult [\fBargument_dialogbox\fR \\
   -title "Itinerary selection"
   ...
.CE
The following subsections explain the different argument item types that are accepted by the \fBargument_dialogbox\fR, classified into three groups. The first data entry item definition format will be used in the remaining document, knowing that this format can always be transformed into the second format by putting all arguments into a single list that is then provided to \fBargument_dialogbox\fR.
.SS "CONTEXT DEFINITION ITEMS"
The first item group allows specifying some context aspects of an argument dialog box. These items are taking a simple character string as item attribute:
.CS

tepam::argument_dialogbox \\
   \fB-<argument_name>\fR \fIstring\fR \\
   ...
.CE
The following items are classified into this group:
.TP
-title \fIstring\fR
The dialog box window's title which is by default \fIDialog\fR can be changed with the \fI-title\fR item:
.CS

tepam::argument_dialogbox \\
   \fB-title\fR "System configuration" \\
   ...
.CE
.TP
-window \fIstring\fR
The argument dialog box uses by default \fI.dialog\fR as dialog top level window. This path can be changed with the \fI-window\fR item:
.CS

tepam::argument_dialogbox \\
   \fB-window\fR .dialog \\
   ...
.CE
.TP
-parent \fIstring\fR
By defining a parent window, the argument dialog box will be displayed beside this one. Without explicit parent window definition, the top-level window will be considered as parent window.
.CS

tepam::argument_dialogbox \\
   \fB-parent\fR .my_appl \\
   ...
.CE
.TP
-context \fIstring\fR
If a context is defined the dialog box's state, e.g. the entered data as well as the window size and position, is saved and restored then the next time the argument dialog box is called. The assignment of a context allows saving the dialog box' state in its context to distinguish between different usages of the argument dialog box.
.CS

tepam::argument_dialogbox \\
   \fB-context\fR destination_definitions \\
   ...
.CE
.PP
.SS "FORMATTING AND DISPLAY OPTIONS"
Especially for big, complex forms it becomes important that the different data entry widgets are graphically well organized and commented to provide an immediate and clear overview to the user. A couple of items allow structuring and commenting the dialog boxes.
.PP
The items of this classification group require as item attributes a definition list, which contains itself attribute name and value pairs:
.CS

tepam::argument_dialogbox \\
   ...
   \fB-<argument_name>\fR { \fI
      ?-<attribute_name> <attribute_value>?
      ?-<attribute_name> <attribute_value>?
      ?...?\fR
   }
   ...
.CE
The following items are classified into this group:
.TP
-frame \fIlist\fR
The \fI-frame\fR item allows packing all following entry widgets into a labeled frame, until a next frame item is defined or until the last entry widget has been defined. It recognizes the following attributes inside the item attribute list:
.RS
.TP
-label \fIstring\fR
An optional frame label can be specified with the \fI-label\fR statement.
.RE
.IP
Example:
.CS

tepam::argument_dialogbox \\
   ...
   \fB-frame\fR {\fI-label "Destination address"\fR}
   ...
.CE
.IP
To close an open frame without opening a new one, an empty list has to be provided to the \fI-frame\fR statement.
.CS

tepam::argument_dialogbox \\
   ...
   \fB-frame\fR {}
   ...
.CE
.TP
-sep [const {{}}]
Entry widgets can be separated with the \fI-sep\fR statement which doesn't require additional definitions. The related definition list has to exist, but its content is ignored.
.CS

tepam::argument_dialogbox \\
   ...
   \fB-sep\fR {}
   ...
.CE
.TP
-comment \fIstring\fR
Comments and descriptions can be added with the \fI-text\fR attribute of the \fI-comment\fR item. Please note that each entry widget itself can also contain a \fI-text\fR attribute for comments and descriptions. But the \fI-comment\fR item allows for example adding a description between two frames.
.CS

tepam::argument_dialogbox \\
   ...
   \fB-comment\fR {\fI-text "Specify bellow the destination address"\fR}
   ...
.CE
.TP
-yscroll \fB0\fR|\fB1\fR|\fBauto\fR
This attribute allows controlling an eventual vertical scrollbar. Setting it to \fB0\fR will permanently disable the scrollbar, setting it to \fB1\fR will enable it. By default it is set to \fBauto\fR. The scrollbar is enabled in this mode only if the vertical data entry form size exceeds 66% of the screen height.
.CS

tepam::argument_dialogbox \\
   ...
   \fB-yscroll\fR \fBauto\fR
   ...
.CE
.PP
.SS "DATA ENTRY WIDGET ITEMS"
Data entry widgets are created with the widget items. These items require as item attributes a definition list, which contains itself attribute name and value pairs:
.CS

tepam::argument_dialogbox \\
   ...
   \fB-<argument_name>\fR { \fI
      ?-<attribute_name> <attribute_value>?
      ?-<attribute_name> <attribute_value>?
      ?...?\fR
   }
   ...
.CE
The attribute list can contain various attributes to describe and comment an entry widget and to constrain its entered value. All entry widgets are accepting a common set of attributes that are described in the section \fBEntry Widget Item Attributes\fR.
.PP
TEPAM defines a rich set of entry widgets. If necessary, this set can be extended with additional application specific entry widgets (see \fBAPPLICATION SPECIFIC ENTRY WIDGETS\fR):
.TP
-entry \fIlist\fR
The \fI-entry\fR item generates the simplest but most universal data entry widget. It allows entering any kind of data in form of single line strings.
.CS

tepam::argument_dialogbox \\
   \fB-entry\fR {-label Name -variable Entry}
.CE
.TP
-text \fIlist\fR
The \fI-text\fR item generates a multi line text entry widget. The widget's height can be selected with the \fI-height\fR attribute.
.CS

tepam::argument_dialogbox \\
   \fB-text\fR {-label Name -variable Text -height 5}
.CE
.TP
-checkbox \fIlist\fR
A group of check boxes is created with the \fI-checkbox\fR item. The number of check boxes and their option values are specified with a list assigned to the \fI-choices\fR attribute or via a variable declared with the \fI-choicevariable\fR attribute:
.CS

tepam::argument_dialogbox \\
   \fB-checkbox\fR {-label "Font sytle" -variable FontStyle \\
               -choices {bold italic underline} -default italic}
.CE
.IP
If the check boxes' labels should differ from the option values, their labels can be defined with the \fI-choicelabels\fR attribute:
.CS

tepam::argument_dialogbox \\
   \fB-checkbox\fR {-label "Font sytle" -variable FontStyle \\
              -choices {bold italic underline} \\
              -choicelabels {Bold Italic Underline} \\
              -default italic}
.CE
.IP
In contrast to a radio box group, a check box group allows selecting simultaneously several choice options. The selection is stored for this reason inside the defined variable in form of a list, even if only one choice option has been selected.
.TP
-radiobox \fIlist\fR
A group of radio boxes is created with the \fI-radiobox\fR item. The number of radio boxes and their option values are specified with a list assigned to the \fI-choices\fR attribute or via a variable declared with the \fI-choicevariable\fR attribute.
.sp
In contrast to a check box group, a radio box group allows selecting simultaneously only one choice option. The selected option value is stored directly, and not in form of a list, inside the defined variable.
.CS

tepam::argument_dialogbox \\
   \fB-radiobox\fR {-label "Text adjustment" -variable Adjustment \\
              -choices {left center right} -default left}
.CE
.IP
If the radio boxes' labels should differ from the option values, their labels can be defined with the \fI-choicelabels\fR attribute:
.CS

tepam::argument_dialogbox \\
   \fB-radiobox\fR {-label "Text adjustment" -variable Adjustment \\
              -choices {left center right} \\
              -choicelabels {Left Center Right} -default left}
.CE
.TP
-checkbutton \fIlist\fR
The \fI-checkbutton\fR entry widget allows activating or deactivating a single choice option. The result written into the variable will either be \fB0\fR if the check button was not activated or \fB1\fR if it was activated. An eventually provided default value has also to be either \fB0\fR or \fB1\fR.
.CS

tepam::argument_dialogbox \\
   \fB-checkbutton\fR {-label Capitalize -variable Capitalize -default 1}
.CE
.PP
Several types of list and combo boxes are available to handle selection lists.
.TP
-combobox \fIlist\fR
The combobox is a combination of a normal entry widget together with a drop-down list box. The combobox allows selecting from this drop-down list box a single element. The list of the available elements can be provided either as a list to the \fI-choices\fR attribute, or via a variable that is specified with the \fI-choicevariable\fR attribute.
.CS

tepam::argument_dialogbox \\
   \fB-combobox\fR {-label "Text size" -variable Size -choices {8 9 10 12 15 18} -default 12}
.CE
.IP
And here is an example of using a variable to define the selection list:
.CS

set TextSizes {8 9 10 12 15 18}
tepam::argument_dialogbox \\
   \fB-combobox\fR {-label "Text size" -variable Size -choicevariable TextSizes -default 12}
.CE
.TP
-listbox \fIlist\fR
In contrast to the combo box, the list box is always displayed by the \fIlistbox\fR entry widget. Only one element is selectable unless the \fI-multiple_selection\fR attribute is set. The list box height can be selected with the \fI-height\fR attribute. If the height is not explicitly defined, the list box height is automatically adapted to the argument dialog box' size.
The first example uses a variable to define the available choices:
.CS

set set AvailableSizes
for {set k 0} {$k<16} {incr k} {lappend AvailableSizes [expr 1<<$k]}

tepam::argument_dialogbox \\
   \fB-listbox\fR {-label "Distance" -variable Distance \\
             -choicevariable AvailableSizes -default 6 -height 5}
.CE
.IP
Here is a multi-element selection example. Please note that also the default selection can contain multiple elements:
.CS

tepam::argument_dialogbox \\
   \fB-listbox\fR {-label "Text styles" -variable Styles \\
             -choices {bold italic underline overstrike} \\
             -choicelabels {Bold Italic Underline Overstrike} \\
             -default {bold underline} -multiple_selection 1 \\
             -height 3}
.CE
.TP
-disjointlistbox \fIlist\fR
A disjoint list box has to be used instead of a normal list box if the selection order is important. The disjoint list box entry widget has in fact two list boxes, one to select elements and one to display the selected elements in the chosen order.
.sp
Disjoint listboxes allow always selecting multiple elements. With the exception of the \fI-multiple_selection\fR attribute, disjointed list boxes are accepting the same attributes as the normal listbox, e.g. \fI-height, -choices, -choicevariable, -default\fR.
.CS

tepam::argument_dialogbox \\
   \fB-disjointlistbox\fR {-label "Preferred scripting languages" -variable Languages \\
             -comment "Please select your preferred languages in the order" \\
             -choices {JavaScript Lisp Lua Octave PHP Perl Python Ruby Scheme Tcl} \\
             -default {Tcl Perl Python}}
.CE
.PP
The file and directory selectors are building a next group of data entry widgets. A paragraph of section \fBEntry Widget Item Attributes\fR explains the widget specific attributes that allow specifying the targeted file types, active directory etc.
.TP
-file \fIlist\fR
The item \fI-file\fR creates a group composed by an entry widget together with a button that allows opening a file browser. The data type \fIfile\fR is automatically selected for this entry if no data type has been explicitly defined with the \fI-type\fR attribute.
.CS

tepam::argument_dialogbox \\
   \fB-file\fR {-label "Image file" -variable ImageF \\
          -filetypes {{"GIF" {*.gif}} {"JPG" {*.jpg}}} \\
          -initialfile "picture.gif"}
.CE
.TP
-existingfile \fIlist\fR
The item \fI-existingfile\fR creates a group composed by an entry widget together with a button that allows opening a browser to select an existing file. The data type \fIexistingfile\fR is automatically selected for this entry if no data type has been explicitly defined with the \fI-type\fR attribute.
.CS

tepam::argument_dialogbox \\
   \fB-existingfile\fR {-label "Image file" -variable ImageF \\
                  -filetypes {{"GIF" {*.gif}} {"JPG" {*.jpg}}} \\
                  -initialfile "picture.gif"}
.CE
.TP
-directory \fIlist\fR
The item \fI-directory\fR creates a group composed by an entry widget together with a button that allows opening a directory browser. The data type \fIdirectory\fR is automatically selected for this entry if no data type has been explicitly defined with the \fI-type\fR attribute.
.CS

tepam::argument_dialogbox \\
   \fB-directory\fR {-label "Report directory" -variable ReportDir}
.CE
.TP
-existingdirectory \fIlist\fR
The item \fI-existingdirectory\fR creates a group composed by an entry widget together with a button that allows opening a browser to select an existing directory. The data type \fIexistingdirectory\fR is automatically selected for this entry if no data type has been explicitly defined with the \fI-type\fR attribute.
.CS

tepam::argument_dialogbox \\
   \fB-existingdirectory\fR {-label "Report directory" -variable ReportDir}
.CE
.PP
Finally, there is a last group of some other special data entry widgets.
.TP
-color \fIlist\fR
The color selector is composed by an entry widget together with a button that allows opening a color browser. The data type \fIcolor\fR is automatically selected for this entry widget type if no data type has been explicitly defined with the \fI-type\fR attribute.
.CS

tepam::argument_dialogbox \\
   \fB-color\fR {-label "Background color" -variable Color -default red}
.CE
.TP
-font \fIlist\fR
The font selector is composed by an entry widget together with a button that allows opening a font browser. The data type \fIfont\fR is automatically selected for this entry widget type if no data type has been explicitly defined with the \fI-type\fR attribute. The entry widget displays an example text in the format of the selected font.
.sp
The font browser allows selecting by default the font families provided by the \fBfont families\fR Tk command as well as a reasonable set of different font sizes between 6 points and 40 points. Different sets of font families and font sizes can be specified respectively via the \fI-font_families\fR or \fI-font_sizes\fR attributes.
.sp
If no default font is provided via the \fI-default\fR attribute, the default font of the label widget to display the selected font will be used as default selected font. If the font family of this label widget is not part of the available families the first available family is used as default. If the font size of this label widget is not part of the available sizes the next close available size is selected as default size.
.CS

tepam::argument_dialogbox \\
   \fB-font\fR {-label "Font" -variable Font \\
          -font_sizes {8 10 12 16} \\
          -default {Arial 20 italic}}
.CE
.PP
.SS "ENTRY WIDGET ITEM ATTRIBUTES"
All the entry widget items are accepting the following attributes:
.TP
-text \fIstring\fR
Eventual descriptions and comments specified with the \fI-text\fR attribute are displayed above the entry widget.
.CS

tepam::argument_dialogbox \\
   -entry {\fB-text "Please enter your name bellow"\fR -variable Name}
.CE
.TP
-label \fIstring\fR
The label attribute creates left to the entry widget a label using the provided string as label text:
.CS

tepam::argument_dialogbox \\
   -entry {\fB-label Name\fR -variable Name}
.CE
.TP
-variable \fIstring\fR
All entry widgets require a specified variable. After accepting the entered information with the OK button, the entry widget's data are stored inside the defined variables.
.CS

tepam::argument_dialogbox \\
   -existingdirectory {-label "Report directory" \fB-variable ReportDir\fR}
.CE
.TP
-default \fIstring\fR
Eventual default data for the entry widgets can be provided via the \fI-default\fR attribute. The default value is overridden if an argument dialog box with a defined context is called another time. The value acknowledged in a previous call will be used in this case as default value.
.CS

tepam::argument_dialogbox \\
   -checkbox {-label "Font sytle" -variable FontStyle \\
               -choices {bold italic underline} \fB-default italic\fR}
.CE
.TP
-optional \fB0\fR|\fB1\fR
Data can be specified as optional or mandatory with the \fI-optional\fR attribute that requires either \fB0\fR (mandatory) or \fB1\fR (optional) as attribute data.
.sp
In case an entry is optional and no data has been entered, e.g. the entry contains an empty character string, the entry will be considered as undefined and the assigned variable will not be defined.
.CS

tepam::argument_dialogbox \\
   -entry {-label "City" -variable start_city -type string} \\
   -entry {-label "Street" -variable start_street -type string \fB-optional 0\fR} \\
   -entry {-label "Street number" -variable start_street_nbr -type integer \fB-optional 1\fR} \\
.CE
.TP
-type \fIstring\fR
If the data type is defined with the \fI-type\fR attribute the argument dialog box will automatically perform a data type check after acknowledging the entered values and before the dialog box is closed. If a type incompatible value is found an error message box appears and the user can correct the value.
.sp
The argument dialog box accepts all types that have been specified by the TEPAM package and that are also used by \fBtepam::procedure\fR (see the \fItepam::procedure reference manual\fR).
.sp
Some entry widgets like the file and directory widgets, as well as the color and font widgets are specifying automatically the default data type if no type has been specified explicitly with the \fI-type\fR attribute.
.CS

tepam::argument_dialogbox \\
   \fB-entry\fR {-label "Street number" -variable start_street_nbr \fB-type integer\fR} \\
.CE
.TP
-range \fIstring\fR
Values can be constrained with the \fI-range\fR attribute. The valid range is defined with a list containing the minimum valid value and a maximum valid value.
.sp
The \fI-range\fR attribute has to be used only for numerical arguments, like integers and doubles.
.CS

tepam::argument_dialogbox \\
   -entry {-label Month -variable Month -type integer \fB-range {1 12}\fR}
.CE
.TP
-validatecommand \fIstring\fR
More complex value validations than type checks can be performed via specific validation commands that are declared with the \fI-validatecommand\fR attribute.
The provided validation command can be a script (command sequence) in which the pattern \fI%P\fR is replaced by the value that has to be checked.
.CS

tepam::argument_dialogbox \\
   -entry {-label "Your comment" -variable YourCom \\
           \fB-validatecommand\fR "IllegalWordDetector %P"} ]
.CE
.PP
Some other attributes are supported by the list and combo boxes as well as by the radio and check buttons.
.TP
-choices \fIstring\fR
Choice lists can directly be defined with the \fI-choices\fR attribute. This way to define choice lists is especially adapted for smaller, fixed selection lists.
.CS

tepam::argument_dialogbox \\
   -listbox {-label "Text styles" -variable Styles \\
             \fB-choices {bold italic underline}\fR -default underline
.CE
.TP
-choicelabels \fIstring\fR \fI(only check and radio buttons)\fR
If the check and radio boxes' labels should differ from the option values, they can be defined with the \fI-choicelabels\fR attribute:
.CS

tepam::argument_dialogbox \\
   -checkbox {-label "Font sytle" -variable FontStyle \\
              -choices {bold italic underline} \\
              \fB-choicelabels {Bold Italic Underline}\fR
.CE
.TP
-choicevariable \fIstring\fR
Another way to define the choice lists is using the \fI-choicevariable\fR attribute. This way to define choice lists is especially adapted for huge and eventually variable selection lists.
.CS

set TextSizes {8 9 10 12 15 18}
tepam::argument_dialogbox \\
   -combobox {-label "Text size" -variable Size \fB-choicevariable TextSizes\fR}
.CE
.TP
-multiple_selection \fB0\fR|\fB1\fR
The list box item (\fB-listbox\fR) allows by default selecting only one list element. By setting the \fI-multiple_selection\fR attribute to \fB1\fR, multiple elements can be selected.
.CS

tepam::argument_dialogbox \\
   -listbox {-label "Text styles" -variable Styles \\
             -choices {bold italic underline} -default underline \\
             \fB-multiple_selection 1\fR -height 3}
.CE
.PP
Some additional attributes are supported by the file and directory selection widgets.
.TP
-filetypes \fIstring\fR
The file type attribute is used by the \fB-file\fR and \fB-existingfile\fR items to define the file endings that are searched by the file browser.
.CS

tepam::argument_dialogbox \\
   -file {-label "Image file" -variable ImageF \\
          \fB-filetypes {{"GIF" {*.gif}} {"JPG" {*.jpg}}}\fR}
.CE
.TP
-initialfile \fIstring\fR
The initial file used by the file browsers of the \fB-file\fR and \fB-existingfile\fR widgets are by default the file defined with the \fI-default\fR attribute, unless a file is specified with the \fI-initialfile\fR attribute.
.CS

tepam::argument_dialogbox \\
   -file {-variable ImageF \fB-initialfile "picture.gif"\fR}
.CE
.TP
-activedir \fIstring\fR
The \fI-activedir\fR attribute will override the default active search directory used by the file browsers of all file and directory entry widgets. The default active search directory is defined by the directory of a specified initial file (\fI-initialfile\fR) if defined, and otherwise by the directory of the default file/directory, specified with the \fI-default\fR attribute.
.CS

tepam::argument_dialogbox \\
   -file "-variable ImageF \fB-activedir $pwd\fR"
.CE
.PP
Finally, there is a last attribute supported by some widgets:
.TP
-height \fIstring\fR
All widgets containing a selection list (\fB-listbox\fR, \fB-disjointlistbox\fR, \fB-font\fR) as well as the multi line \fB-text\fR widget are accepting the \fI-height\fR attribute that defines the number of displayed rows of the selection lists.
.CS

tepam::argument_dialogbox \\
   -listbox {-label "Text size" -variable Size \\
             -choices {8 9 10 12 15 18} -default 12 \fB-height 3\fR}
.CE
.IP
If the no height has been explicitly specified the height of the widget will be dynamically adapted to the argument dialog box' size.
.PP
.SH "APPLICATION SPECIFIC ENTRY WIDGETS"
An application specific entry widget can be made available to the argument dialog box by adding a dedicated procedure to the \fBtepam\fR namespace. This procedure has three arguments; the first one is the widget path, the second one a subcommand and the third argument has various purposes:
.CS

\fIproc\fR tepam::ad_form(<WidgetName>) {W Command {Par ""}} {
   \fIupvar Option Option; # if required\fR
   \fIvariable argument_dialogbox; # if required\fR
   switch $Command {
      "create" <CreateCommandSequence>
      "set_choice" <SetChoiceCommandSequence>
      "set" <SetCommandv>
      "get" <GetCommandSequence>
   }
}
.CE
\fBArgument_dialogbox\fR takes care about the \fI-label\fR and \fI-text\fR attributes for all entry widgets. For any data entry widget it creates a frame into which the data entry widget components can be placed. The path to this frame is provided via the \fIW\fR argument.
.PP
The entry widget procedure has to support 3 mandatory and an optional command that are selected via the argument \fICommand\fR:
.TP
\fIcreate\fR
The entry widget is called a first time with the command \fIcreate\fR to build the data entry widget.
.sp
The frames that are made available by \fBargument_dialogbox\fR for the entry widgets are by default only extendable in the X direction. To make them also extendable in the Y direction, for example for extendable list boxes, the command \fBad_form(make_expandable) $W\fR has to be executed when an entry widget is built.
.TP
\fIset_choice\fR
The entry widget procedure is only called with the \fIset_choice\fR command if the \fI-choices\fR or \fI-choicevariable\fR has been specified. The command is therefore only relevant for list and combo boxes.
.sp
The available selection list that is either specified with the \fI-choices\fR or \fI-choicevariable\fR attribute is provided via the \fIPar\fR argument to the entry widget procedure. This list can be used to initialize an available choice list.
.TP
\fIset\fR
If a default value is either defined via the \fI-default\fR attribute or via a preceding call the entry widget procedure is called with the \fIset\fR command. The argument \fIPar\fR contains in this case the value to which the entry widget has to be initialized.
.TP
\fIget\fR
The entry widget procedure's command \fIget\fR has to return the current value of the entry widget.
.PP
Eventually specified entry widget item attributes are available via the \fBOption\fR array variable of the calling procedure. This variable becomes accessible inside the entry widget procedure via the \fBupvar\fR command.
.PP
There may be a need to store some information in a variable. The array variable \fBargument_dialogbox\fR has to be used for this purpose together with array indexes starting with \fI"$W,"\fR, e.g. \fIargument_dialogbox($W,values)\fR.
.PP
Examples of entry widget procedures are directly provided by the TEPAM package source file that specifies the standard entry widget procedures. The simplest procedure is the one for the basic \fIentry\fR widget:
.CS

proc tepam::ad_form(entry) {W Command {Par ""}} {
   switch $Command {
      "create" {pack [entry \\$W.entry] -fill x \\
                        -expand yes -pady 4 -side left}
      "set" {\\$W.entry insert 0 $Par}
      "get" {return [\\$W.entry get]}
   }
}
.CE
It is also possible to relay on an existing entry widget procedure to derive a new, more specific one. The \fIradiobox\fR widget is used for example, to create a new entry widget that allows selecting either \fIleft\fR, \fIcenter\fR or \fIright\fR. The original \fIradiobox\fR widget is called with the \fIset_choice\fR command immediately after the \fIcreate\fR command, to define the fixed list of selection options.
.CS

proc tepam::ad_form(rcl) {W Command {Par ""}} {
   set Res [ad_form(radiobox) $W $Command $Par]
   if {$Command=="create"} {
      ad_form(radiobox) $W set_choice {left center right}
   }
   return $Res
}
.CE
Please consult the TEPAM package source file to find additional and more complex examples of entry widget procedures.
.SH VARIABLES
The \fBargument_dialogbox\fR is using two variables inside the namespace \fB::tepam\fR:
.TP
\fBargument_dialogbox\fR
Application specific entry widget procedures can use this array variable to store their own data, using as index the widget path provided to the procedure, e.g. \fIargument_dialogbox($W,<sub_index>)\fR.
.TP
\fBlast_parameters\fR
This array variable is only used by an argument dialog box if its context has been specified via the \fI-context\fR attribute. The argument dialog box' position and size as well as its entered data are stored inside this variable if the data are acknowledged and the form is closed. This allows the form to restore its previous state once it is called another time.
.sp
To reuse the saved parameters not just in the actual application session but also in another one, it is sufficient to store the \fBlast_parameter\fR array variable contents in a configuration file which is loaded the next time an application is launched.
.PP
.SH "SEE ALSO"
tepam(n), tepam::procedure(n)
.SH KEYWORDS
data entry form, parameter entry form
.SH CATEGORY
Argument entry form, mega widget
.SH COPYRIGHT
.nf
Copyright (c) 2009/2010, Andreas Drollinger

.fi

Added embedded/man/files/modules/tepam/tepam_introduction.n.



























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/tepam/tepam_introduction.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009/2010, Andreas Drollinger
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tepam" n 0.4.0 tcllib "Tcl's Enhanced Procedure and Argument Manager"
.BS
.SH NAME
tepam \- An introduction into TEPAM, Tcl's Enhanced Procedure and Argument Manager
.SH DESCRIPTION
.PP
This document is an informal introduction into TEPAM, the Tcl's Enhanced Procedure and Argument Manager. Detailed information to the TEPAM package is provided in the \fItepam::procedure\fR and \fItepam::argument_dialogbox\fR reference manuals.
.SH OVERVIEW
This package provides a new Tcl procedure declaration syntax that simplifies the implementation of procedure subcommands and the handling of the different types of procedure arguments like flags or switches, options, unnamed arguments, optional and mandatory options and arguments, default values, etc. Procedure declarations can be enriched with detailed information about the procedure and its arguments. This information is used for the following purposes:
.PP
First of all, a preamble is added in front of the body of a procedure that is declared with TEPAM. This preamble calls an argument manager that that uses the provided information to check the validity of the argument types and values before the procedure body is executed. Then, the information is used to generate help and usage texts if requested, or to generate clear error message in case an argument validation fails. The information also allows generating automatically graphical forms that allows an interactive definition of all arguments, in case a procedure is called interactively. And finally, the additional information helps self-commenting in a clean way the declaration of a procedure and of all its arguments.
.PP
The graphical form generator that creates the necessary argument specification forms for the interactive procedure calls is also available for other purposes than for procedure argument specifications. It allows creating code efficiently complex parameter entry forms that are usable independently from TEPAM's new procedure definition method.
.PP
Here is a short overview about all major TEPAM features:
.IP \(bu
New self-documenting procedure declaration syntax: The additional information to declare properly a procedure has not to be provided with additional statements, but can be added in a natural syntax directly into the procedure header.
.IP \(bu
Easy way to specify subcommands: A subcommand is declared like a procedure, simply with a procedure name composed by a base name followed by a subcommand name. Sub-subcommands are created identically using simply procedure names composed by 3 words.
.IP \(bu
Flexible usage of flags (switches), options (named arguments) and unnamed arguments. Option names are optionally automatically completed.
.IP \(bu
Support for default values, mandatory/optional options and arguments, choice lists, value ranges, multiple usable options/arguments.
.IP \(bu
Choice of a \fInamed arguments first, unnamed arguments later\fR procedure calling style (typical for Tcl commands) or of an \fIunnamed arguments first, named arguments later\fR procedure calling style (typical for Tk commands).
.IP \(bu
In case the \fInamed arguments first, unnamed arguments later\fR style (Tcl) is selected:  Clear separation between options and arguments via the "--" flag. The unnamed arguments can optionally be accessed as options (named arguments).
.IP \(bu
Automatic type and value check before the procedure body is executed, taking into account validation ranges, choice lists and custom validation commands. Generation of clear error message if necessary.
.IP \(bu
Many predefined types exist (integer, boolean, double, color, file, font, ...). Other application specific types can easily be added.
.IP \(bu
Automatic help and usage text generation if a procedure is called with the \fI-help\fR flag.
.IP \(bu
Automatic generation of an interactive argument definition form, in case a procedure is called with the \fI-interactive\fR flag.
.IP \(bu
Procedure calls can be logged which is useful to get for interactively called procedures the command call lines.
.IP \(bu
Powerful and code efficient generation of complex parameter definition forms.
.PP
.SH "PROCEDURE DECLARATION"
TEPAM's procedure declaration syntax is simple and self-explaining. Instead of declaring a procedure with the Tcl key word \fBproc\fR, a procedure is declared with the TEPAM command \fBprocedure\fR which takes as \fBproc\fR also 3 arguments: The procedure name, the procedure header and the procedure body.
.PP
The following example declares the subcommand \fBmessage\fR of the procedure \fBdisplay\fR. This command has several named and unnamed arguments:
.CS

\fBtepam::procedure\fR {display message} {
   -return            -
   -short_description "Displays a simple message box"
   -description       "This procedure allows displaying a configurable message box.
   -args {
      {-mtype -default Warning -choices {Info Warning Error} -description "Message type"}
      {-font -type font -default {Arial 10 italic} -description "Message text font"}
      {-level -type integer -optional -range {1 10} -description "Message level"}
      {-fg -type color -default black -description "Message color"}
      {-bg -type color -optional -description "Background color"}
      {-no_border -type none -description "Use a splash window style (no border)"}
      {-log_file -type file -optional -description "Optional message log file"}
      {text -type string -multiple -description "Multiple text lines to display"}
   }
} {
\fI   puts "display message:"
   foreach var {mtype font level fg bg no_border log_file text} {
      if {[info exists $var]} {
         puts  "  $var=[set $var]"
      }
   }
\fR}
.CE
A call of procedure that has been declared in this way will first invoke the TEPAM argument manager, before the procedure body is executed. The argument manager parses the provided arguments, validates them, completes them eventually with some default values, and makes them finally available to the procedure body as local variables. In case an argument is missing or has a wrong type, the argument manager generates an error message that explains the reason for the error.
.PP
As the example above shows, the TEPAM command \fBprocedure\fR accepts subcommand definitions as procedure name and allows defining much more information than just the argument list inside the procedure header. The procedure body on the other hand is identical between a command declared with \fBproc\fR and a command declared with \fBprocedure\fR.
.PP
The procedure header allows defining in addition to the arguments some procedure attributes, like a description, information concerning the return value, etc. This information is basically used for the automatic generation of comprehensive help and usage texts.
.PP
A list of argument definition statements assigned to the \fI-args\fR argument is defining the procedure arguments. Each argument definition statement starts with the argument name, optionally followed by some argument attributes.
.PP
Three types of arguments can be defined: Unnamed arguments, named arguments and flags. The distinction between the named and unnamed arguments is made by the first argument name character which is simply "-" for named arguments. A flag is defined as named argument that has the type  \fInone\fR.
.PP
Named and unnamed arguments are mandatory, unless they are declared with the \fI-optional\fR flag and unless they have a default value specified with the \fI-default\fR option. Named arguments and the last unnamed argument can have the attribute \fI-multiple\fR, which means that they can be defined multiple times. The expected argument data type is specified with the \fI-type\fR option. TEPAM defines a large set of standard data types which can easily be completed with application specific data types.
.PP
The argument declaration order has only an importance for unnamed arguments that are by default parsed after the named arguments (Tcl style). A variable allows changing this behavior in a way that unnamed arguments are parsed first, before the named arguments (Tk style).
.SH "PROCEDURE HELP"
The declared procedure can simply be called with the \fI-help\fR option to get the information about the usage of the procedure and its arguments:
.CS

\fBdisplay message\fR -help
\fI  ->
NAME
      display message - Displays a simple message box
SYNOPSYS
      display message
            [-mtype <mtype>] :
               Message type, default: "Warning", choices: {Info Warning Error}
            [-font <font>] :
               Message text font, type: font, default: Arial 10 italic
            [-level <level>] :
               Message level, type: integer, range: 1..10
            [-fg <fg>] :
               Message color, type: color, default: black
            [-bg <bg>] :
               Background color, type: color
            [-no_border ] :
               Use a splash window style (no border)
            [-log_file <log_file>] :
               Optional message log file, type: file
            <text> :
               Multiple text lines to display, type: string
DESCRIPTION
      This procedure allows displaying a configurable message box.\fR
.CE
.SH "PROCEDURE CALL"
The specified procedure can be called in many ways. The following listing shows some valid procedure calls:
.CS

\fBdisplay message\fR "The document hasn't yet been saved!"
\fI-> display message:
     mtype=Warning
     font=Arial 10 italic
     fg=black
     no_border=0
     text={The document hasn't yet been saved!}\fR

\fBdisplay message\fR -fg red -bg black "Please save first the document"
\fI-> display message:
     mtype=Warning
     font=Arial 10 italic
     fg=red
     bg=black
     no_border=0
     text={Please save first the document}\fR

\fBdisplay message\fR -mtype Error -no_border "Why is here no border?"
\fI-> display message:
     mtype=Error
     font=Arial 10 italic
     fg=black
     no_border=1
     text={Why is here no border?}\fR

\fBdisplay message\fR -font {Courier 12} -level 10 \\
   "Is there enough space?" "Reduce otherwise the font size!"
\fI-> display message:
     mtype=Warning
     font=Courier 12
     level=10
     fg=black
     no_border=0
     text={Is there enough space?} {Reduce otherwise the font size!}\fR
.CE
The next lines show how wrong arguments are recognized. The \fItext\fR argument that is mandatory is missing in the first procedure call:
.CS

\fBdisplay message\fR -font {Courier 12}
\fI  -> display message: Required argument is missing: text\fR
.CE
Only known arguments are accepted:
.CS

\fBdisplay message\fR -category warning Hello
\fI  -> display message: Argument '-category' not known\fR
.CE
Argument types are automatically checked and an error message is generated in case the argument value has not the expected type:
.CS

\fBdisplay message\fR -fg MyColor "Hello"
\fI  -> display message: Argument 'fg' requires type 'color'. \\
            Provided value: 'MyColor'\fR
.CE
Selection choices have to be respected ...
.CS

\fBdisplay message\fR -mtype Fatal Hello
\fI  -> display message: Argument (mtype) has to be one of the \\
            following elements: Info, Warning, Error\fR
.CE
... as well as valid value ranges:
.CS

\fBdisplay message\fR -level 12 Hello
\fI  -> display message: Argument (level) has to be between 1 and 10\fR
.CE
.SH "INTERACTIVE PROCEDURE CALLS"
The most intuitive way to call the procedure is using an form that allows specifying all arguments interactively. This form will automatically be generated if the declared procedure is called with the \fI-interactive\fR flag.
.CS

\fBdisplay message\fR -interactive
.CE
The generated form contains for each argument a data entry widget that is adapted to the argument type. Check buttons are used to specify flags, radio boxes for tiny choice lists, disjoint list boxes for larger choice lists and files, directories, fonts and colors can be selected with dedicated browsers.
.PP
After acknowledging the specified argument data via an OK button, the entered data are first validated, before the provided arguments are transformed into local variables and the procedure body is executed. In case the entered data are invalid, a message appears and the user can correct them until they are valid.
.PP
The procedure calls can optionally be logged in a variable. This is for example useful to get the command call lines of interactively called procedures.
.SH "FLEXIBLE ARGUMENT DIALOG BOX"
The form generator that creates in the previous example the argument dialog box for the interactive procedure call is also available for other purposes than for the definition of procedure arguments. TEPAM's provided argument dialog box allows crating complex parameter definition forms in a very efficient way.
.PP
The following example tries to illustrate the simplicity to create complex data entry forms. It creates an input mask that allows specifying a file to copy, a destination folder as well as a checkbox that allows specifying if an eventual existing file can be overwritten. Comfortable browsers can be used to select files and directories. And finally, the form offers also the possibility to accept and decline the selection. Here is the code snippet that is doing all this:
.CS

\fBtepam::argument_dialogbox\fR \\
   \fB-existingfile\fR {-label "Source file" -variable SourceFile} \\
   \fB-existingdirectory\fR {-label "Destination folder" -variable DestDir} \\
   \fB-checkbutton\fR {-label "Overwrite existing file" -variable Overwrite}
.CE
The \fBargument_dialogbox\fR returns \fBok\fR if the entered data are validated. It will return \fBcancel\fR if the data entry has been canceled. After the validation of the entered data, the \fBargument_dialogbox\fR defines all the specified variables with the entered data inside the calling context.
.PP
An \fBargument_dialogbox\fR requires a pair of arguments for each variable that it has to handle. The first argument defines the entry widget type used to select the variable's value and the second one is a lists of attributes related to the variable and the entry widget.
.PP
Many entry widget types are available: Beside the simple generic entries, there are different kinds of list and combo boxes available, browsers for existing and new files and directories, check and radio boxes and buttons, as well as color and font pickers. If necessary, additional entry widgets can be defined.
.PP
The attribute list contains pairs of attribute names and attribute data. The primary attribute is \fI-variable\fR used to specify the variable in the calling context into which the entered data has to be stored. Another often used attribute is \fI-label\fR that allows adding a label to the data entry widget. Other attributes are available that allow specifying default values, the expected data types, valid data ranges, etc.
.PP
The next example of a more complex argument dialog box provides a good overview about the different available entry widget types and parameter attributes. The example contains also some formatting instructions like \fI-frame\fR and \fI-sep\fR which allows organizing the different entry widgets in frames and sections:
.CS

set ChoiceList {"Choice 1" "Choice 2" "Choice 3" "Choice 4" "Choice 5" "Choice 6"}

set Result [\fBtepam::argument_dialogbox\fR \\
   \fB-title\fR "System configuration" \\
   \fB-context\fR test_1 \\
   \fB-frame\fR {-label "Entries"} \\
      \fB-entry\fR {-label Entry1 -variable Entry1} \\
      \fB-entry\fR {-label Entry2 -variable Entry2 -default "my default"} \\
   \fB-frame\fR {-label "Listbox & combobox"} \\
      \fB-listbox\fR {-label "Listbox, single selection" -variable Listbox1 \\
                -choices {1 2 3 4 5 6 7 8} -default 1 -height 3} \\
      \fB-listbox\fR {-label "Listbox, multiple selection" -variable Listbox2
                -choicevariable ChoiceList -default {"Choice 2" "Choice 3"}
                -multiple_selection 1 -height 3} \\
      \fB-disjointlistbox\fR {-label "Disjoined listbox" -variable DisJntListbox
                        -choicevariable ChoiceList \\
                        -default {"Choice 3" "Choice 5"} -height 3} \\
      \fB-combobox\fR {-label "Combobox" -variable Combobox \\
                 -choices {1 2 3 4 5 6 7 8} -default 3} \\
   \fB-frame\fR {-label "Checkbox, radiobox and checkbutton"} \\
      \fB-checkbox\fR {-label Checkbox -variable Checkbox
                 -choices {bold italic underline} -choicelabels {Bold Italic Underline} \\
                 -default italic} \\
      \fB-radiobox\fR {-label Radiobox -variable Radiobox
                 -choices {bold italic underline} -choicelabels {Bold Italic Underline} \\
                 -default underline} \\
      \fB-checkbutton\fR {-label CheckButton -variable Checkbutton -default 1} \\
   \fB-frame\fR {-label "Files & directories"} \\
      \fB-existingfile\fR {-label "Input file" -variable InputFile} \\
      \fB-file\fR {-label "Output file" -variable OutputFile} \\
      \fB-sep\fR {} \\
      \fB-existingdirectory\fR {-label "Input directory" -variable InputDirectory} \\
      \fB-directory\fR {-label "Output irectory" -variable OutputDirectory} \\
   \fB-frame\fR {-label "Colors and fonts"} \\
      \fB-color\fR {-label "Background color" -variable Color -default red} \\
      \fB-sep\fR {} \\
      \fB-font\fR {-label "Font" -variable Font -default {Courier 12 italic}}]
.CE
The \fBargument_dialogbox\fR defines all the specified variables with the entered data and returns \fBok\fR if the data have been validated via the Ok button. If the data entry is cancelled by activating the Cancel button, the \fBargument_dialogbox\fR returns \fBcancel\fR.
.CS

if {$Result=="cancel"} {
   puts "Canceled"
} else { # $Result=="ok"
   puts "Arguments: "
   foreach Var {
      Entry1 Entry2
      Listbox1 Listbox2 DisJntListbox
      Combobox Checkbox Radiobox Checkbutton
      InputFile OutputFile InputDirectory OutputDirectory
      Color Font
   } {
      puts "  $Var: '[set $Var]'"
   }
}
\fI-> Arguments:
   Entry1: 'Hello, this is a trial'
   Entry2: 'my default'
   Listbox1: '1'
   Listbox2: '{Choice 2} {Choice 3}'
   DisJntListbox: '{Choice 3} {Choice 5}'
   Combobox: '3'
   Checkbox: 'italic'
   Radiobox: 'underline'
   Checkbutton: '1'
   InputFile: 'c:\\tepam\\in.txt'
   OutputFile: 'c:\\tepam\\out.txt'
   InputDirectory: 'c:\\tepam\\input'
   OutputDirectory: 'c:\\tepam\\output'
   Color: 'red'
   Font: 'Courier 12 italic'\fR
.CE
.SH "SEE ALSO"
tepam::argument_dialogbox(n), tepam::procedure(n)
.SH KEYWORDS
argument integrity, argument validation, arguments, entry mask, parameter entry form, procedure, subcommand
.SH CATEGORY
Procedures, arguments, parameters, options
.SH COPYRIGHT
.nf
Copyright (c) 2009/2010, Andreas Drollinger

.fi

Added embedded/man/files/modules/tepam/tepam_procedure.n.








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/tepam/tepam_procedure.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009/2010, Andreas Drollinger
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tepam::procedure" n 0.4.0 tcllib "Tcl's Enhanced Procedure and Argument Manager"
.BS
.SH NAME
tepam::procedure \- TEPAM procedure, reference manual
.SH SYNOPSIS
package require \fBTcl  8.3\fR
.sp
package require \fBtepam  ?0.4?\fR
.sp
\fBtepam::procedure\fR \fIname\fR \fIattributes\fR \fIbody\fR
.sp
.BE
.SH DESCRIPTION
This package provides an alternative way to declare Tcl procedures and to manage its arguments. There is a lot of benefit to declare a procedure with TEPAM rather than with the Tcl standard command \fBproc\fR: TEPAM allows specifying inside the procedure declaration all information that is required to generate comprehensive documentations and help support.  The information is also used by an automatically invoked argument checker that validates the provided procedure arguments before the procedure body is executed. Finally, a procedure can be called interactively which will open a graphical form that allows specifying the procedure arguments.
.PP
TEPAM simplifies also the handling of the different types of argument, like the \fInamed arguments\fR (often also called \fIoptions\fR) and the \fIunnamed arguments\fR. TEPAM supports the \fInamed first, unnamed later\fR style (typical Tcl command style) as well as also the \fIunnamed first, named later\fR style (typical Tk command style). TEPAM takes care about default values for arguments, optional arguments, multiple applicable arguments, etc. and eliminates the need to check the validity of the argument inside the procedure bodies.
.PP
An informal overview of all the TEPAM procedure declaration and calling features as well as a short introduction into TEPAM is provided by \fItepam(n)\fR.
.SH TERMINOLOGY
The exact meaning of several terms that are used in this document will be shortly explained to avoid any ambiguities and misunderstandings.
.TP
\fISubcommand\fR
The usage of subcommands is heavily used in the Tcl language. Several commands are incorporated into a single main command and are selectable via the first argument.
.sp
The \fBstring\fR command is an example of such a command that implements for example subcommands to check a character string's length, to compare strings, to extract substrings, etc:
.CS

\fBstring length\fR \fIstring\fR
\fBstring compare\fR \fIstring\fR \fIstring\fR
\fBstring range\fR \fIstring\fR \fIfirst\fR \fIlast\fR
...
.CE
.sp
TEPAM provides a framework that allows implementing easily such subcommands in form of Tcl procedures. It allows not only defining a first level of subcommands, but also a higher level of subcommands. The \fBstring\fR command's class check could be implemented as independent sub-sub-commands of the \fBstring\fR command:
.CS

\fBstring is alnum\fR \fIstring\fR
\fBstring is integer\fR \fIstring\fR
\fBstring is double\fR \fIstring\fR
...
.CE
.TP
\fIProcedure attribute\fR
TEPAM allows attaching to a declared procedure different kind of attributes. Some of these attributes are \fIjust\fR used for documentation purposes, but other attributes specify the way how the procedure has to be called. Also the procedure arguments are defined in form of a procedure attribute.
.TP
\fIArgument\fR
TEPAM uses the term \fIargument\fR for the parameters of a procedure.
.sp
The following example calls the subcommand \fBstring compare\fR with several arguments:
.CS

\fBstring compare\fR \fI-nocase -length 3 "emphasized" "emphasised"\fR
.CE
.IP
The following paragraphs discuss these different argument types.
.TP
\fINamed argument\fR
Some parameters, as \fI-length 3\fR of the subcommand \fBstring compare\fR have to be provided as pairs of argument names and argument values. This parameter type is often also called \fIoption\fR.
.sp
TEPAM uses the term \fInamed argument\fR for such options as well as for the flags (see next item).
.TP
\fIFlag, switch\fR
Another parameter type is the \fIflag\fR or the \fIswitch\fR. Flags are provided simply by naming the flag leading with the '-' character. The \fI-nocase\fR of the previous \fBstring compare\fR example is such a flag.
.sp
\fIFlags\fR are considered by TEPAM like a special form of \fInamed arguments\fR.
.TP
\fIUnnamed argument\fR
For the other parameters, e.g. the ones for which the argument name has not to be mentioned, TEPAM uses the term \fIunnamed argument\fR. The previous \fBstring compare\fR example uses for the two provided character strings two \fIunnamed arguments\fR.
.TP
\fIArgument attribute\fR
TEPAM allows describing the purpose of each procedure argument with \fIargument attributes\fR. While some of them are just documenting the attributes, most attributes are used by an argument manager to control and validate the arguments that are provided during a procedure call. Argument attributes are used to specify default values, parameter classes (integer, xdigit, font, ...), choice validation lists, value ranges, etc.
.TP
\fINamed arguments first, unnamed arguments later\fR
The \fBstring compare\fR command of the previous example requires that the \fInamed arguments\fR (options, flags) are provided first. The two mandatory (unnamed) arguments have to be provided as last argument.
.sp
This is the usual Tcl style (exceptions exist) which is referred in the TEPAM documentation as \fInamed arguments first, unnamed arguments later style\fR.
.TP
\fIUnnamed arguments first, named arguments later\fR
In contrast to most Tcl commands, Tk uses generally (exceptions exist also here) a different calling style where the \fIunnamed arguments\fR have to be provided first, before the \fInamed arguments\fR have to be provided:
.CS

\fBpack\fR \fI.ent1 .ent2 -fill x -expand yes -side left\fR
.CE
.IP
This style is referred in the TEPAM documentation as \fIunnamed arguments first, named arguments later style\fR.
.PP
.SH "PROCEDURE DECLARATION"
TEPAM allows declaring new Tcl procedures with the command \fBtepam::procedure\fR that has similar to the standard Tcl command \fBproc\fR also 3 arguments:
.TP
\fBtepam::procedure\fR \fIname\fR \fIattributes\fR \fIbody\fR
.PP
The TEPAM procedure declaration syntax is demonstrated by the following example:
.CS

\fBtepam::procedure\fR {display message} {
   -short_description
      "Displays a simple message box"
   -description
      "This procedure allows displaying a configurable\\
       message box. The default message type that is\\
       created is a warning, but also errors and info can\\
       be generated.
       The procedure accepts multiple text lines."
   -example
      {display message -mtype Warning "Save first your job"}
   -args {
      {-mtype -choices {Info Warning Error} \\
              -default Warning -description "Message type"}
      {text   -type string -multiple \\
              -description "Multiple text lines to display"}
   }
} {
   puts "Message type: $mtype"
   puts "Message: $text"
}
.CE
The 3 arguments of \fBprocedure\fR are:
.TP
\fIname\fR
The procedure name can be used in very flexible ways. Procedure names can have namespace qualifiers. By providing a two element name list as procedure name, a subcommand of a procedure will be declared. It is even possible to declare sub-sub-commands of a procedure by providing name lists with three elements.
.sp
Here are some valid procedure declarations using different procedure names (the attribute and body arguments are empty for simplicity):
.CS

\fI# Simple procedure name:\fR
tepam::procedure \fBdisplay_message\fR {} {}
\fI\fR
\fI# Procedure declared in the main namespace:\fR
tepam::procedure \fB::display_message\fR {} {}
\fI\fR
\fI# Procedure in the namespace\fR \fB::ns\fR\fI:\fR
tepam::procedure \fB::ns::display_message\fR {} {}
\fI\fR
\fI# Declaration of the subcommand\fR \fBmessage\fR \fIof the procedure\fR \fBdisplay\fR\fI:\fR
tepam::procedure \fB{display message}\fR {} {}
.CE
.TP
\fIattributes\fR
All procedure attributes are provided in form of an option list that contains pairs of option names and option values. The example above has as procedure attribute a short and a normal description, but also the procedure arguments are defined in form of a procedure attribute.
.sp
Most procedure attributes are providing information for documentation purposes. But some of them affect also the way how the procedure can be called. The section \fBProcedure Attributes\fR discusses in detail the available procedure attributes.
.sp
The procedure arguments are defined in form of a special procedure attribute. Most of the information provided in the argument definition is not just used for documentation purposes. This information is in fact used by the TEPAM argument manager to handle and validate the various forms of arguments that are provided during the procedure calls. The section \fBArgument Declaration\fR discusses in detail all the argument definition attributes.
.TP
\fIbody\fR
This is the normal procedure body. The declared arguments will be available to the procedure body in form of variables.
.sp
The procedure body will only be executed if the provided set of arguments could be validated by the TEPAM argument manager.
.CS

tepam::procedure {display_message} {
   -args {
      {-\fBmtype\fR -default Warning -choices {Warning Error}}
      {\fBtext\fR -type string}
   }
} {
   puts "Message type: \fB$mtype\fR"
   puts "Message: \fB$text\fR"
}
.CE
.PP
The commands \fBprocedure\fR as well as \fBargument_dialogbox\fR are exported from the namespace \fBtepam\fR. To use these commands without the \fBtepam::\fR namespace prefix, it is sufficient to import them into the main namespace:
.CS

\fBnamespace import tepam::*\fR

\fBprocedure\fR {display_message} {
   -args {
      ...
.CE
.SS "PROCEDURE ATTRIBUTES"
The first group of procedure attributes is not affecting the behavior of the declared procedure. These attributes are just used for the purpose of documentation and help text generation:
.TP
-category \fIstring\fR
A category can be assigned to a procedure for documentation purposes. Any string is accepted as category.
.TP
-short_description \fIstring\fR
The short description of a procedure is used in the documentation summary of a generated procedure list as well as
in the NAME section of a generated procedure manual page.
.TP
-description \fIstring\fR
The (full) description assigned to a procedure is used to create user manual and help pages.
.TP
-return \fIstring\fR
The \fI-return\fR attribute allows defining the expected return value of a procedure (used for documentation purposes).
.TP
-example \fIstring\fR
A help text or manual page of a procedure can be enriched with eventual examples, using the \fI-example\fR attribute.
.PP
The following attributes are not relevant for the documentation and help text generation, but they affect the behavior of the declared procedure:
.TP
-named_arguments_first \fB0\fR|\fB1\fR
This attribute defines the calling style of a procedure. TEPAM uses by default the \fInamed arguments first, unnamed arguments later\fR style (Tcl). This default behavior can globally be changed by setting the variable \fBtepam::named_arguments_first\fR to \fB0\fR. This global calling style can be changed individually for a procedure with the procedure's \fI-named_arguments_first\fR attribute.
.TP
-auto_argument_name_completion \fB0\fR|\fB1\fR
The declared procedures will by default automatically try to match eventually abbreviated argument names to the defined arguments names. This default behavior can globally be changed by setting the variable \fBtepam::auto_argument_name_completion\fR to \fB0\fR. This global setting of the automatic argument name completion can be changed individually for a procedure with the \fI-auto_argument_name_completion\fR procedure attribute.
.TP
-interactive_display_format \fBextended\fR|\fBshort\fR
A procedure declared with the TEPAM \fBprocedure\fR command can always be called with the \fB-interactive\fR option. By doing so, a graphical form will be generated that allows specifying all procedure argument values. There are two display modes for these interactive forms. While the \fIextended\fR mode is more adapted for small procedure argument sets, the \fBshort\fR form is more adequate for huge procedure argument sets.
.sp
The choice to use short or extended forms can be globally configured via the variable \fBtepam::interactive_display_format\fR. This global setting can then be changed individually for a procedure with the \fI-interactive_display_format\fR procedure attribute.
.TP
-args \fIlist\fR
The procedure's arguments are declared via the \fI-args\fR attribute. An argument is defined via a list having as first element the argument name, followed by eventual argument attributes. All these argument definition lists are packaged themselves into a global list that is assigned to the procedure's \fI-args\fR attribute.
.sp
The argument definition syntax will be described more in detail in the following sub section.
.PP
The following attribute allows controlling the logging settings for an individual procedure:
.TP
-command_log \fB0\fR|\fB1\fR|\fB"interactive"\fR
This argument configures the logging of the procedure calls into the list variable \fBtepam::ProcedureCallLogList\fR. The default configuration defined by the variable \fBtepam::command_log\fR will be used if this argument is not defined in a procedure declaration.
.sp
Setting this argument to \fB0\fR will disable any procedure call loggings, setting it to \fB1\fR will log any procedure calls and setting it to \fBinteractive\fR will log just the procedures that are called interactively (procedures called with the \fB-interactive\fR flag).
.PP
.SS "ARGUMENT DECLARATION"
The following example shows the structure that is used for the argument definitions in the context of a procedure declaration:
.CS

tepam::procedure {display_message} {
   -args \fB{
      {-mtype -default Warning -choices {Info Warning Error} -description "Message type"}
      {-font -type font -default {Arial 10 italic} -description "Message text font"}
      {-level -type integer -optional -range {1 10} -description "Message level"}
      {-fg -type color -optional -description "Message color"}
      {-log_file -type file -optional -description "Optional message log file"}
      {text -type string -multiple -description "Multiple text lines to display"}
   }\fR
} {
}
.CE
Each of the procedure arguments is declared with a list that has as first element the argument name, followed by eventual attributes. The argument definition syntax can be formalized in the following way:
.CS

tepam::procedure <name> {
   -args \fB{
      {<argument_name_1> <arg_attr_name_1a> <arg_attr_value_1a> \\
                         <arg_attr_name_1b> <arg_attr_value_1b> ...}
      {<argument_name_2> <arg_attr_name_2a> <arg_attr_value_2a> \\
                         <arg_attr_name_2b> <arg_attr_value_2b> ...}
      ...
   }\fR
} <body>
.CE
The argument names and attributes have to be used in the following way:
.TP
Argument name (\fI<argument_name_<n>>\fR)
The provided argument name specifies whether the argument is an \fIunnamed argument\fR or a \fInamed argument\fR. In addition to this, an argument name can also be blank to indicate an argument comment, or it can start with # to indicate a section comment.
.RS
.TP
\fI"<Name>"\fR
This is the simplest form of an argument name: An argument whose name is not starting with '-' is an \fIunnamed argument\fR. The parameter provided during a procedure call will be assigned to a variable with the name \fI<Name>\fR.
.CS

tepam::procedure {print_string} {
   -args {
      {\fBtext\fR -type string -description "This is an unnamed argument"}
   }
} {
   puts \fB$text\fR
}

print_string \fB"Hello"\fR
\fI -> Hello\fR
.CE
.TP
\fI"-<Name>"\fR
An argument whose name starts with '-' is a \fInamed argument\fR (also called \fIoption\fR). The parameter provided during a procedure call will be assigned to a variable with the name \fI<Name>\fR (not \fI-<Name>\fR).
.CS

tepam::procedure {print_string} {
   -args {
      {\fB-text\fR -type string -description "This is a named argument"}
   }
} {
   puts \fB$text\fR
}

print_string \fB-text "Hello"\fR
\fI -> Hello\fR
.CE
.TP
\fI"--"\fR
This flag allows clearly specifying the end of the named arguments and the beginning of the unnamed arguments, in case the \fInamed arguments first, unnamed arguments later style (Tcl)\fR has been selected.
.sp
If the \fIunnamed arguments first, named arguments later style (Tk)\fR style is selected, this flag is ignored if the unnamed arguments have already been parsed. Otherwise it will be assigned to the corresponding unnamed argument.
.TP
\fI"-"\fR or \fI""\fR
A blank argument name (either '-' or \fI''\fR) starts a comment for the following arguments.
.CS

tepam::procedure {print_time} {
   -interactive_display_format short
   -args {
      {hours -type integer -description "Hour"}
      {minutes -type integer -description "Minute"}

      \fB{- The following arguments are optional:}\fR
      {seconds -type integer -default 0 -description "Seconds"}
      {milliseconds -type integer -default 0 -description "Milliseconds"}
   }
} {
   puts "${hour}h${minutes}:[expr $seconds+0.001*$milliseconds]"
}
.CE
.IP
Argument comments are basically used in the graphical argument definition forms that are created if a procedure is called interactively.
.TP
\fI"#*"\fR
An argument definition list that starts with '#' is considered as a section comment. The argument definition list will be trimmed from the '#' characters and the remaining string will be used as section comment.
.sp
Section comments can be used to structure visually the argument definition code. Section comments are also used to structure the generated help texts and the interactive argument definition forms.
.CS

tepam::procedure {complex_multiply} {
   -description "This function perform a complex multiplication"
   -args {
      \fB{#### First complex number ####}\fR
      {-r0 -type double -description "First number's real part"}
      {-i0 -type double -description "First number's imaginary part"}

      \fB{#### Second complex number ####}\fR
      {-r1 -type double -description "Second number's real part"}
      {-i1 -type double -description "Second number's imaginary part"}
   }
} {
   return [expr $r0*$r1 - $i0*$i1]
}
.CE
.RE
.TP
Argument attributes (\fI<arg_attr_name_<mn>> <arg_attr_value_<mn>>\fR)
The following argument attributes are supported:
.RS
.TP
-description \fIstring\fR
The description argument attribute is used for documentation purpose. Interactive argument definition forms use this attribute to provide explanations for an argument.
.TP
-type \fItype\fR
The type argument attribute allows assigning the argument either to a predefined data type, or to an application specific data type. The argument values that are provided during a procedure call are automatically checked with respect to the defined argument type.
.sp
The section \fBARGUMENT TYPES\fR provides a list of predefined data types and explains how application specific types can be specified.
.sp
The argument type \fInone\fR has a special meaning. An argument that has the type \fInone\fR is handled as a \fIflag\fR. A flag is always optional and its related variable contains the logical value \fB1\fR if the flag has been defined during the procedure call, or otherwise \fB0\fR.
.TP
-default \fIvalue\fR
Eventual default values can be defined with the -default argument attribute. Arguments with default values are automatically optional arguments.
.TP
-optional|-mandatory
Arguments are by default mandatory, unless a default value is defined. The flag \fI-optional\fR transforms an argument into an optional argument.
.sp
In case an optional argument is not defined during a procedure call, the corresponding variable will not be defined.
The flag \fI-mandatory\fR is the opposite to \fI-optional\fR. This flag exists only for completion reason, since an argument is anyway mandatory by default.
.TP
-multiple
Arguments that have the \fI-multiple\fR attribute can be defined multiple times during a procedure call. The values that are provided during a procedure call for such an argument are stored in a list variable. This is even the case if such an argument is only defined once during a procedure call.
.sp
The \fI-multiple\fR attribute can be attributed to unnamed arguments and to named arguments. The pair of argument name/argument value has to be repeated for each provided value in case of a named argument.
In case the argument with the \fI-multiple\fR attribute is an unnamed argument, this one has to be the absolute last one of all unnamed arguments.
.TP
-choices \fIlist\fR
A possible set of valid argument values can be attributed to an argument via the \fI-choices\fR attribute. The argument value provided during a procedure call will be checked against the provided choice values.
.TP
-choicelabels \fIlist\fR
An eventual short description can be attributed to each choice option with the \fI-choicelabels\fR attribute. These descriptions will be used in the generated help texts and as radio and check box labels for the interactive calls.
.sp
The \fI-choicelabels\fR attribute is optional, but if it is defined, its list needs to have the identical size as the \fI-choices\fR argument list.
.TP
-range \fI{double double}\fR
Another argument constraint can be defined with the \fI-range\fR attribute. The valid range is defined with a list containing the minimum valid value and a maximum valid value. The \fI-range\fR attribute has to be used only for numerical arguments, like integers and doubles.
.TP
-validatecommand \fIscript\fR
Eventual more complex argument value validations can be performed via specific validation commands that are assigned to the \fI-validatecommand\fR attribute. The provided validation command can be a complete script in which the pattern \fI%P\fR is replaced by the argument value that has to be validated.
An example of a validation command declaration is:
.CS

tepam::procedure {display_message} {
   -args {
      {text -type string -description "Message text" \\
            \fB-validatecommand "IllegalWordDetector %P"\fR}
} {
}
.CE
.TP
-widget \fIstring\fR
The widgets that allow defining the different arguments in case of an interactive procedure call are normally selected automatically in function of the argument type. The \fI-widget\fR attribute allows specifying explicitly a certain widget type for an argument.
.sp
.TP
-auxargs \fIlist\fR
In case a procedure is called interactively, additional argument attributes can be provided to the interactive argument definition form via the \fI-auxargs\fR attribute that is itself a list of attribute name/attribute value pairs:
.CS

-auxargs {-<arg_attr_name_1a> <arg_attr_value_1a> \\
          -<arg_attr_name_1b> <arg_attr_value_1b>
          ...
}
.CE
.IP
For example, if a procedure takes as argument a file name it may be beneficial to specify the required file type for the interactive argument definition form. This information can be provided via the \fI-auxargs\fR attribute to the argument definition form:
.CS

tepam::procedure LoadPicture {
   -args {
      {FileName -type existingfile -description "Picture file" \\
                 \fB-auxargs {-filetypes {{"GIF" {*.gif}} {"JPG" {*.jpg}} }}\fR}
   }
} {
}
.CE
.TP
-auxargs_commands \fIscript\fR
If the auxiliary argument attributes are not static but have to be dynamically adaptable, the \fI-auxargs_commands\fR allows defining them via commands that are executed during a procedure call. A list of pairs of auxiliary attribute names and commands has to be provided to the \fI-auxargs_commands\fR attribute. The provided commands are executed in the context of the calling procedure.
.CS

-auxargs_commands {-<arg_attr_name_1a> <arg_attr_command_1a> \\
                   -<arg_attr_name_1b> <arg_attr_command_1b>
                   ...
}
.CE
.RE
.PP
.SH VARIABLES
Several variables defined inside the \fB::tepam\fR namespace are impacting the mode of operation of the procedures that have been declared with TEPAM' \fBprocedure\fR command.
.TP
\fBnamed_arguments_first\fR
This variable defines the general calling style of the procedures. It is by default set to \fB1\fR which selects the \fInamed arguments first, unnamed arguments later\fR style (Tcl style).
.sp
By setting this variable to \fB0\fR, the \fInamed arguments first, unnamed arguments later\fR style is globally selected (Tk style):
.CS

set tepam::named_arguments_first 0
.CE
.sp
While this variable defines the general calling style, the procedure attribute \fI-named_arguments_first\fR can adapt this style individually for each declared procedure.
.TP
\fBauto_argument_name_completion\fR
This variable controls the general automatic argument name matching mode. By default it is set to \fB1\fR, meaning that the called procedures are trying to match eventually abbreviated argument names with the declared argument names.
.sp
By setting this variable to \fB0\fR the automatic argument name matching mode is disabled:
.CS

set tepam::auto_argument_name_completion 0
.CE
.sp
While this variable defines the general matching mode, the procedure attribute \fI-auto_argument_name_completion\fR can adapt this mode individually for each declared procedure.
.TP
\fBinteractive_display_format\fR
A procedure declared via the TEPAM \fBprocedure\fR command can always be called with the \fB-interactive\fR switch. By doing so, a graphical form will be generated that allows entering interactively all procedure arguments.
.sp
There are two display modes for these interactive forms. The \fIextended\fR mode which is the default mode is more adapted for small procedure argument sets. The \fBshort\fR form is more adequate for huge procedure argument sets:
.CS

set tepam::interactive_display_format "short"
.CE
.sp
The choice to use short or extended forms can be globally configured via the variable \fBinteractive_display_format\fR.
This global setting can be changed individually for a procedure with the procedure attribute \fI-interactive_display_format\fR.
.TP
\fBhelp_line_length\fR
The maximum line length used by the procedure help text generator can be specified with this variable. The default length which is set to 80 (characters) can easily be adapted to the need of an application:
.CS

set tepam::help_line_length 120
.CE
.IP
Since this variable is applied directly during the help text generation, its value can continuously be adapted to the current need.
.TP
\fBcommand_log\fR
Procedure calls can be logged inside the list variable \fBtepam::ProcedureCallLogList\fR. The variable \fBtepam::command_log\fR controls the default logging settings for any procedures. The following configurations are supported:
.RS
.IP \(bu
\fI0\fR: Disables any procedure call loggings
.IP \(bu
\fI1\fR: Enables any procedure call loggings
.sp
.IP \(bu
\fI"interactive"\fR: Will log any procedures called interactively (e.g. procedures called with the -interactive flag). This is the default configuration.
.RE
.IP
This default logging configuration can be changed individually for each procedure with the \fI-command_log\fR attribute.
.PP
.SH "ARGUMENT TYPES"
A comprehensive set of procedure argument types that is already predefined by TEPAM can easily be completed with additional types that are required for a specific application.
.SS "PREDEFINED ARGUMENT TYPES"
To remember, a type can be assigned to each specified procedure argument:
.CS

tepam::procedure {warning} {
   -args {
      {-font \fB-type font\fR -default {Arial 10 italic}}
      {-severity_level \fB-type integer\fR -optional -range {1 10}}
      {-fg \fB-type color\fR -optional -description "Message color"}
      {text \fB-type string\fR -multiple -description "Multiple text lines to display"}
   }
} {
   ...
}
.CE
There are some \fIspecial purpose types\fR that are building the first category of predefined argument types:
.IP \(bu
\fBnone\fR
.sp
A \fIflag\fR, also called \fIswitch\fR, is defined as a named argument that has the type \fBnone\fR. Flags are always optional and the default value of the assigned variable is set to \fB0\fR. In contrast to the (normal) named arguments, no argument value has to be provided to a flag.
.CS

tepam::procedure flag_test {
   -args {
      \fB{-flag -type none -description "This is a flag"}\fR
   }
} {
   puts \fB$flag\fR
}

flag_test
\fI-> 0\fR

flag_test -flag
\fI-> 1\fR
.CE
.sp
Since no argument value has to be provided to a flag, also no data check is performed for this argument type.
.IP \(bu
\fBstring\fR
.sp
\fBString\fR is a generic argument data type. Any data string can be provided to a string type argument and no data type checks are therefore performed. The string type allows defining single line strings during the interactive procedure calls.
.IP \(bu
\fBtext\fR
.sp
\fBText\fR is identical to \fBstring\fR with the exception that it allows entering multi line strings during interactive procedure calls.
.IP \(bu
\fB{}\fR
.sp
A \fBblank\fR argument type signifies an undefined argument type. This is the default argument type that will be used if no type has been explicitly specified. An argument that has a \fBblank\fR type behaves identically than an argument that has a \fBstring\fR type, e.g. no argument data checks are performed. The only difference is that the data type \fBstring\fR is mentioned in the generated help documentation, while this is not the case for \fBblank\fR type.
.PP
.PP
Several \fInumerical types\fR are defined by TEPAM. The type validation procedures are using the \fBstring is <type> -strict\fR commands to check the validity of the provided arguments, which assures that no empty strings are accepted as argument value. The type validation expression for the numerical types and the argument types to which this expression is applied are:
.CS

string is \fB<type_to_check>\fR -strict \fI<argument_value>\fR
.CE
.IP \(bu
\fIboolean\fR
.sp
.IP \(bu
\fIinteger\fR
.sp
.IP \(bu
\fIdouble\fR
.sp
.PP
Empty strings are accepted as argument value for all the alpha numeric argument types. The argument types that are falling into this category and validation expression used for them are:
.CS

string is \fI<type_to_check>\fR \fI<argument_value>\fR
.CE
.IP \(bu
\fIalnum\fR
.sp
.IP \(bu
\fIalpha\fR
.sp
.IP \(bu
\fIascii\fR
.sp
.IP \(bu
\fIcontrol\fR
.sp
.IP \(bu
\fIdigit\fR
.sp
.IP \(bu
\fIgraph\fR
.sp
.IP \(bu
\fIlower\fR
.sp
.IP \(bu
\fIprint\fR
.sp
.IP \(bu
\fIpunct\fR
.sp
.IP \(bu
\fIspace\fR
.sp
.IP \(bu
\fIupper\fR
.sp
.IP \(bu
\fIwordchar\fR
.sp
.IP \(bu
\fIxdigit\fR
.sp
.PP
.PP
In addition to the data types checked with the \fBstring is <type>\fR commands, TEPAM specifies some other useful data types:
.IP \(bu
\fIchar\fR
.sp
Each string that has a length of 1 character meets the \fIcharacter\fR type. The type check is made with the following expression:
.CS

expr [string length \fI<argument_value>\fR]==1
.CE
.IP \(bu
\fIcolor\fR
.sp
Any character strings that are accepted by Tk as a color are considered as valid color argument. Please note that the Tk package has to be loaded to use the type \fIcolor\fR. TEPAM is using the following command to validate the color type:
.CS

expr ![catch {winfo rgb . \fI<argument_value>\fR}]
.CE
.IP \(bu
\fIfont\fR
.sp
Any character strings that are accepted by Tk as a font are considered as valid font argument. Please note that the Tk package has to be loaded to use the \fIfont\fR type. TEPAM is using the following command to validate the color type:
.CS

expr ![catch {font measure <argument_value> ""}]
.CE
.IP \(bu
\fIfile\fR
.sp
Any strings that are not containing one of the following characters are considered as valid file names: * ? " < >. It is not necessary that the file and its containing directory exist. Zero-length strings are not considered as valid file names.
.sp
The following expression is used to validate the file names:
.CS

expr [string length <argument_value>]>0 && ![regexp {[\\"*?<>:]} <argument_value>]
.CE
.IP \(bu
\fIexistingfile\fR
.sp
The argument is valid if it matches with an existing file. The following check is performed to validate the arguments of this type:
.CS

file exists <argument_value>
.CE
.IP \(bu
\fIdirectory\fR
.sp
The directory argument is validated exactly in the same way as the file arguments.
.IP \(bu
\fIexistingdirectory\fR
.sp
The argument is valid if it matches with an existing directory. The following check is performed to validate the arguments of this type:
.CS

file isdirectory <argument_value>
.CE
.PP
.SS "DEFINING APPLICATION SPECIFIC ARGUMENT TYPES"
To add support for a new application specific argument type it is just necessary to add into the namespace \fBtepam\fR a validation function \fBValidation(<type>)\fR. This function requires one argument. It has to returns \fB1\fR if the provided argument matches with the relevant data type. The function has to return otherwise \fB0\fR.
.PP
The validation command section of the "\fItepam.tcl\fR" package provides sufficient examples of validation functions, since it implements the ones for the standard TEPAM types.
.PP
The following additional code snippet shows the validation function for a custom argument type that requires values that have a character string length of exactly 2:
.CS

proc tepam::Validate(two_char) {v} {expr [string length $v]==2}
.CE
.SH "PROCEDURE CALLS"
.SS HELP
Each procedure can be called with the \fI-help\fR flag. The procedure will then print a generated help text to \fIstdout\fR and will then return without performing any additional actions.
.PP
Taking the first procedure declared in \fBPROCEDURE CALLS\fR, the help request and the printed help text would be:
.CS

\fBdisplay message -help\fR
\fI->
NAME
      display message - Displays a simple message box
SYNOPSIS
      display message
            [-mtype <mtype>]
               Message type, default: "Warning", choices: {Info, Warning, Error}
            <text>
               Multiple text lines to display, type: string
DESCRIPTION
      This procedure allows displaying a configurable message box. The default
      message type that is created is a warning, but also errors and info can
      be generated.
      The procedure accepts multiple text lines.
EXAMPLE
      display message -mtype Warning "Save first your job"\fR
.CE
The argument manager is checking if the last provided argument is \fI-help\fR and generates the requested help message if this is the case. So, also the following example will print the help message:
.CS

\fBdisplay message -mtype Info "It is 7:00" -help\fR
.CE
On the other hand, the following call will result in an error:
.CS

\fBdisplay message -help -mtype Info "It is 7:00"\fR
\fI->
display message: Argument '-help' not known\fR
.CE
.SS "INTERACTIVE PROCEDURE CALL"
Calling a procedure with the \fI-interactive\fR flag will open a graphical form that allows specifying interactively all procedure arguments. The Tk library has to be loaded to use the interactive call. The following example assures that the Tk library is loaded and shows the command line to call interactively the procedure declared in \fBPROCEDURE CALLS\fR:
.CS

package require Tk
\fBdisplay message -interactive\fR
.CE
Also the \fI-interactive\fR flag has to be placed at the last argument position as this is also required for the \fI-help\fR flag. Arguments defined before the \fI-interactive\fR flag will be ignored. The following example is therefore also a valid interactive procedure call:
.CS

\fBdisplay message\fR -mtype Info "It is 7:00" \fB-interactive\fR
.CE
.SS "UNNAMED ARGUMENTS"
Unnamed arguments are typically provided to the called procedure as simple parameters. This procedure calling form requires that the provided arguments are strictly following the order of the specified arguments. Several parameters can be assigned to the last argument if this one has the \fI-multiple\fR attribute. So, the following declared procedure ...
.CS

tepam::procedure {display_message} {
   -args {
      {mtype -choices {Info Warning Error}}
      {text -type string -multiple}
   }
} {
   puts "$mtype: [join $text]"
}
.CE
... can for example be called in the following ways:
.CS

\fBdisplay_message Info "It is PM 7:00."\fR
\fI-> Info: It is PM 7:00.\fR

\fBdisplay_message Info "It is PM 7:00." "You should go home."\fR
\fI-> Info: It is PM 7:00. You should go home.\fR
.CE
The nice thing is that unnamed arguments can also be called as named arguments, which can be handy, for example if the exact specified argument order is not known to a user:
.CS

\fBdisplay_message -mtype Info -text "It is PM 7:00."\fR
\fI-> Info: It is PM 7:00.\fR

\fBdisplay_message -text "It is PM 7:00." -mtype Info\fR
\fI-> Info: It is PM 7:00.\fR

\fBdisplay_message -mtype Info -text "It is PM 7:00." -text "You should go home."\fR
\fI-> Info: It is PM 7:00. You should go home.\fR

\fBdisplay_message -text "It is PM 7:00." -text "You should go home." -mtype Info\fR
\fI-> Info: It is PM 7:00. You should go home.\fR
.CE
.SS "NAMED ARGUMENTS"
Named arguments have to be provided to a procedure in form of a parameter pairs composed by the argument names and the argument values. The order how they are provided during a procedure call is irrelevant and has not to match with the argument specification order.
.PP
The following declared procedure ...
.CS

tepam::procedure {display_message} {
   -args {
      {-mtype -choices {Info Warning Error}}
      {-text -type string -multiple}
   }
} {
   puts "$mtype: [join $text]"
}
.CE
... can be called in the following ways:
.CS

\fBdisplay_message -mtype Info -text "It is PM 7:00."\fR
\fI-> Info: It is PM 7:00.\fR

\fBdisplay_message -text "It is PM 7:00." -mtype Info\fR
\fI-> Info: It is PM 7:00.\fR

\fBdisplay_message -mtype Info -text "It is PM 7:00." -text "You should go home."\fR
\fI-> Info: It is PM 7:00. You should go home.\fR

\fBdisplay_message -text "It is PM 7:00." -text "You should go home." -mtype Info\fR
\fI-> Info: It is PM 7:00. You should go home.\fR
.CE
Also named arguments that have not the \fI-multiple\fR attribute can be provided multiple times. Only the last provided argument will be retained in such a case:
.CS

\fBdisplay_message -mtype Info -text "It is PM 7:00." -mtype Warning\fR
\fI-> Warning: It is PM 7:00.\fR
.CE
.SS "UNNAMED ARGUMENTS FIRST, NAMED ARGUMENTS LATER (TK STYLE)"
A procedure that has been defined while the variable \fBtepam::named_arguments_first\fR was set to 1, or with the procedure attribute \fI-named_arguments_first\fR set to 1 has to be called in the Tcl style. The following procedure declaration will be used in this section to illustrate the meaning of this calling style:
.CS

\fBset tepam::named_arguments_first 1\fR
tepam::procedure my_proc {
   -args {
      {-n1 -default ""}
      {-n2 -default ""}
      {u1 -default ""}
      {u2 -default ""}
   }
} {
   puts "n1:'$n1', n2:'$n2', u1:'$u1', u2:'$u2'"
}
.CE
The unnamed arguments are placed at the end of procedure call, after the named arguments:
.CS

my_proc \fB-n1 N1 -n2 N2 U1 U2\fR
\fI-> n1:'N1', n2:'N2', u1:'U1', u2:'U2'\fR
.CE
The argument parser considers the first argument that doesn't start with the '-' character as well as all following arguments as unnamed argument:
.CS

my_proc \fBU1 U2\fR
\fI-> n1:'', n2:'', u1:'U1', u2:'U2'\fR
.CE
Named arguments can be defined multiple times. If the named argument has the \fI-multiply\fR attribute, all argument values will be collected in a list. Otherwise, only the last provided attribute value will be retained:
.CS

my_proc \fB-n1 N1 -n2 N2 -n1 M1 U1 U2\fR
\fI-> n1:'M1', n2:'N2', u1:'U1', u2:'U2'\fR
.CE
The name of the first unnamed argument has therefore not to start with the '-' character. The unnamed argument is otherwise considered as name of another named argument. This is especially important if the first unnamed argument is given by a variable that can contain any character strings:
.CS

my_proc \fB-n1 N1 -n2 N2 "->" "<-"\fR
\fI-> my_proc: Argument '->' not known\fR

set U1 "->"
my_proc -n1 N1 -n2 N2 $U1 U2}]
my_proc: Argument '->' not known
.CE
The '--' flag allows separating unambiguously the unnamed arguments from the named arguments. All data after the '--' flag will be considered as unnamed argument:
.CS

my_proc \fB-n1 N1 -n2 N2 -- "->" "<-"\fR
\fI-> n1:'N1', n2:'N2', u1:'->', u2:'<-'\fR

set U1 "->"
my_proc \fB-n1 N1 -n2 N2 -- $U1 U2\fR
\fI-> n1:'N1', n2:'N2', u1:'->', u2:'<-'\fR
.CE
.SS "NAMED ARGUMENTS FIRST, UNNAMED ARGUMENTS LATER (TCL STYLE)"
The Tk calling style will be chosen if a procedure is defined while the variable \fBtepam::named_arguments_first\fR is set to 0, or if the procedure attribute \fI-named_arguments_first\fR has been set to 0. The following procedure will be used in this section to illustrate this calling style:
.CS

\fBset tepam::named_arguments_first 0\fR
tepam::procedure my_proc {
   -args {
      {-n1 -default ""}
      {-n2 -default ""}
      {u1}
      {u2 -default "" -multiple}
   }
} {
   puts "n1:'$n1', n2:'$n2', u1:'$u1', u2:'$u2'"
}
.CE
The unnamed arguments have to be provided first in this case. The named arguments are provided afterwards:
.CS

my_proc \fBU1 U2 -n1 N1 -n2 N2\fR
\fI-> n1:'N1', n1:'N1', u1:'U1', u2:'U2'\fR
.CE
The argument parser will assign to each defined unnamed argument a value before it switches to read the named arguments. This default behavior changes a bit if there are unnamed arguments that are optional or that can take multiple values.
.PP
An argument value will only be assigned to an unnamed argument that is optional (that has either the \fI-optional\fR attribute or that has a default value), if the value is not beginning with the '-' character or if no named arguments are defined. The value that starts with '-' is otherwise considered as the name of a named argument.
.PP
Argument values are assigned to an argument that has the \fI-multiple\fR attribute as long as the parameter value doesn't starts with the '-' character.
.PP
Values that start with the '-' character can therefore not be assigned to optional unnamed arguments, which restricts the usage of the Tcl procedure calling style. The Tk style may be preferable in some cases, since it allows separating unambiguously the named arguments from the unnamed ones with the '--' flag.
.PP
Let's explore in a bit less theoretically the ways how the previously defined procedure can be called: The first example calls the procedure without any parameters, which leads to an error since \fIu1\fR is a mandatory argument:
.CS

my_proc
\fI-> my_proc: Required argument is missing: u1\fR
.CE
The procedure call is valid if one parameter is provided for \fIu1\fR:
.CS

my_proc \fBU1\fR
\fI-> n1:'', n2:'', u1:'U1', u2:''\fR
.CE
If more parameters are provided that are not starting with the '-' character, they will be attributed to the unnamed arguments. \fIU2\fR will receive 3 of these parameters, since it accepts multiple values:
.CS

my_proc \fBU1 U2 U3 U4\fR
\fI-> n1:'', n2:'', u1:'U1', u2:'U2 U3 U4'\fR
.CE
As soon as one parameter starts with '-' and all unnamed arguments have been assigned, the argument manager tries to interpret the parameter as name of a named argument. The procedure call will fail if a value beginning with '-' is assigned to an unnamed argument:
.CS

my_proc \fBU1 U2 U3 U4 -U5\fR
\fI-> my_proc: Argument '-U5' not known\fR
.CE
The attribution of a parameter to a named argument will fail if there are undefined unnamed (non optional) arguments. The name specification will in this case simply be considered as a parameter value that is attributed to the \fInext\fR unnamed argument. This was certainly not the intention in the following example:
.CS

my_proc \fB-n1 N1\fR
\fI-> n1:'', n2:'', u1:'-n1', u2:'N1'\fR
.CE
The situation is completely different if values have already been assigned to all mandatory unnamed arguments. A parameter beginning with the '-' character will in this case be considered as a name identifier for a named argument:
.CS

my_proc \fBU1 -n1 N1\fR
\fI-> n1:'N1', n2:'', u1:'U1', u2:''\fR
.CE
No unnamed arguments are allowed behind the named arguments:
.CS

my_proc \fBU1 -n1 N1 U2\fR
\fI-> my_proc: Argument 'U2' is not an option\fR
.CE
The '--' flag has no special meaning if not all mandatory arguments have got assigned a value. This flag will simply be attributed to one of the unnamed arguments:
.CS

my_proc \fB-- -n1 N1\fR
\fI-> n1:'N1', n2:'', u1:'--', u2:''\fR
.CE
But the '--' flag is simply ignored if the argument parser has started to handle the named arguments:
.CS

my_proc \fBU1 -- -n1 N1\fR
\fI-> n1:'N1', n2:'', u1:'U1', u2:''\fR

my_proc \fBU1 -n1 N1 -- -n2 N2\fR
\fI-> n1:'N1', n2:'N2', u1:'U1', u2:''\fR
.CE
.SS "RAW ARGUMENT LIST"
It may be necessary sometimes that the procedure body is able to access the entire list of arguments provided during a procedure call. This can happen via the \fBargs\fR variable that contains always the unprocessed argument list:
.CS

tepam::procedure {display_message} {
   -args {
      {-mtype -choices {Warning Error} -default Warning}
      {text -type string -multiple}

   }
} {
   puts "args: \fB$args\fR"
}
display_message -mtype Warning "It is 7:00"
\fI-> args: -mtype Warning {It is 7:00}\fR
.CE
.SH "SEE ALSO"
tepam(n), tepam::argument_dialogbox(n)
.SH KEYWORDS
argument integrity, argument validation, arguments, procedure, subcommand
.SH CATEGORY
Procedures, arguments, parameters, options
.SH COPYRIGHT
.nf
Copyright (c) 2009/2010, Andreas Drollinger

.fi

Added embedded/man/files/modules/term/ansi_cattr.n.


















































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/ansi_cattr.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::ansi::code::attr" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::ansi::code::attr \- ANSI attribute sequences
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::ansi::code  ?0.1?\fR
.sp
package require \fBterm::ansi::code::attr  ?0.1?\fR
.sp
\fB::term::ansi::code::attr::names\fR
.sp
\fB::term::ansi::code::attr::import\fR ?\fIns\fR? ?\fIarg\fR...?
.sp
\fB::term::ansi::code::attr::fgblack\fR
.sp
\fB::term::ansi::code::attr::fgred\fR
.sp
\fB::term::ansi::code::attr::fggreen\fR
.sp
\fB::term::ansi::code::attr::fgyellow\fR
.sp
\fB::term::ansi::code::attr::fgblue\fR
.sp
\fB::term::ansi::code::attr::fgmagenta\fR
.sp
\fB::term::ansi::code::attr::fgcyan\fR
.sp
\fB::term::ansi::code::attr::fgwhite\fR
.sp
\fB::term::ansi::code::attr::fgdefault\fR
.sp
\fB::term::ansi::code::attr::bgblack\fR
.sp
\fB::term::ansi::code::attr::bgred\fR
.sp
\fB::term::ansi::code::attr::bggreen\fR
.sp
\fB::term::ansi::code::attr::bgyellow\fR
.sp
\fB::term::ansi::code::attr::bgblue\fR
.sp
\fB::term::ansi::code::attr::bgmagenta\fR
.sp
\fB::term::ansi::code::attr::bgcyan\fR
.sp
\fB::term::ansi::code::attr::bgwhite\fR
.sp
\fB::term::ansi::code::attr::bgdefault\fR
.sp
\fB::term::ansi::code::attr::bold\fR
.sp
\fB::term::ansi::code::attr::dim\fR
.sp
\fB::term::ansi::code::attr::italic\fR
.sp
\fB::term::ansi::code::attr::underline\fR
.sp
\fB::term::ansi::code::attr::blink\fR
.sp
\fB::term::ansi::code::attr::revers\fR
.sp
\fB::term::ansi::code::attr::hidden\fR
.sp
\fB::term::ansi::code::attr::strike\fR
.sp
\fB::term::ansi::code::attr::nobold\fR
.sp
\fB::term::ansi::code::attr::noitalic\fR
.sp
\fB::term::ansi::code::attr::nounderline\fR
.sp
\fB::term::ansi::code::attr::noblink\fR
.sp
\fB::term::ansi::code::attr::norevers\fR
.sp
\fB::term::ansi::code::attr::nohidden\fR
.sp
\fB::term::ansi::code::attr::nostrike\fR
.sp
\fB::term::ansi::code::attr::reset\fR
.sp
.BE
.SH DESCRIPTION
This package provides symbolic names for the ANSI attribute control
codes. For each control code a single command is provided which
returns this code as its result. None of the commands of this package
write to a channel; that is handled by higher level packages, like
\fBterm::ansi::send\fR.
.SH API
.SS INTROSPECTION
.TP
\fB::term::ansi::code::attr::names\fR
This command is for introspection. It returns as its result a list
containing the names of all attribute commands.
.TP
\fB::term::ansi::code::attr::import\fR ?\fIns\fR? ?\fIarg\fR...?
This command imports some or all attribute commands into the namespace
\fIns\fR. This is by default the namespace \fIattr\fR. Note that this
is relative namespace name, placing the imported command into a child
of the current namespace. By default all commands are imported, this
can howver be restricted by listing the names of the wanted commands
after the namespace argument.
.PP
.SS ATTRIBUTES
.TP
\fB::term::ansi::code::attr::fgblack\fR
Set text color to \fIBlack\fR.
.TP
\fB::term::ansi::code::attr::fgred\fR
Set text color to \fIRed\fR.
.TP
\fB::term::ansi::code::attr::fggreen\fR
Set text color to \fIGreen\fR.
.TP
\fB::term::ansi::code::attr::fgyellow\fR
Set text color to \fIYellow\fR.
.TP
\fB::term::ansi::code::attr::fgblue\fR
Set text color to \fIBlue\fR.
.TP
\fB::term::ansi::code::attr::fgmagenta\fR
Set text color to \fIMagenta\fR.
.TP
\fB::term::ansi::code::attr::fgcyan\fR
Set text color to \fICyan\fR.
.TP
\fB::term::ansi::code::attr::fgwhite\fR
Set text color to \fIWhite\fR.
.TP
\fB::term::ansi::code::attr::fgdefault\fR
Set default text color (\fIBlack\fR).
.TP
\fB::term::ansi::code::attr::bgblack\fR
Set background to \fIBlack\fR.
.TP
\fB::term::ansi::code::attr::bgred\fR
Set background to \fIRed\fR.
.TP
\fB::term::ansi::code::attr::bggreen\fR
Set background to \fIGreen\fR.
.TP
\fB::term::ansi::code::attr::bgyellow\fR
Set background to \fIYellow\fR.
.TP
\fB::term::ansi::code::attr::bgblue\fR
Set background to \fIBlue\fR.
.TP
\fB::term::ansi::code::attr::bgmagenta\fR
Set background to \fIMagenta\fR.
.TP
\fB::term::ansi::code::attr::bgcyan\fR
Set background to \fICyan\fR.
.TP
\fB::term::ansi::code::attr::bgwhite\fR
Set background to \fIWhite\fR.
.TP
\fB::term::ansi::code::attr::bgdefault\fR
Set default background (Transparent).
.TP
\fB::term::ansi::code::attr::bold\fR
Bold on.
.TP
\fB::term::ansi::code::attr::dim\fR
Dim on.
.TP
\fB::term::ansi::code::attr::italic\fR
Italics on.
.TP
\fB::term::ansi::code::attr::underline\fR
Underscore on.
.TP
\fB::term::ansi::code::attr::blink\fR
Blink on.
.TP
\fB::term::ansi::code::attr::revers\fR
Reverse on.
.TP
\fB::term::ansi::code::attr::hidden\fR
Hidden on.
.TP
\fB::term::ansi::code::attr::strike\fR
Strike-through on.
.TP
\fB::term::ansi::code::attr::nobold\fR
Bold off.
.TP
\fB::term::ansi::code::attr::noitalic\fR
Italics off.
.TP
\fB::term::ansi::code::attr::nounderline\fR
Underscore off.
.TP
\fB::term::ansi::code::attr::noblink\fR
Blink off.
.TP
\fB::term::ansi::code::attr::norevers\fR
Reverse off.
.TP
\fB::term::ansi::code::attr::nohidden\fR
Hidden off.
.TP
\fB::term::ansi::code::attr::nostrike\fR
Strike-through off.
.TP
\fB::term::ansi::code::attr::reset\fR
Reset all attributes to their default values.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
ansi, attribute control, color control, control, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/ansi_cctrl.n.





















































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/ansi_cctrl.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::ansi::code::ctrl" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::ansi::code::ctrl \- ANSI control sequences
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::ansi::code  ?0.1?\fR
.sp
package require \fBterm::ansi::code::ctrl  ?0.1.1?\fR
.sp
\fB::term::ansi::code::ctrl::names\fR
.sp
\fB::term::ansi::code::ctrl::import\fR ?\fIns\fR? ?\fIarg\fR...?
.sp
\fB::term::ansi::code::ctrl::eeol\fR
.sp
\fB::term::ansi::code::ctrl::esol\fR
.sp
\fB::term::ansi::code::ctrl::el\fR
.sp
\fB::term::ansi::code::ctrl::ed\fR
.sp
\fB::term::ansi::code::ctrl::eu\fR
.sp
\fB::term::ansi::code::ctrl::es\fR
.sp
\fB::term::ansi::code::ctrl::sd\fR
.sp
\fB::term::ansi::code::ctrl::su\fR
.sp
\fB::term::ansi::code::ctrl::ch\fR
.sp
\fB::term::ansi::code::ctrl::sc\fR
.sp
\fB::term::ansi::code::ctrl::rc\fR
.sp
\fB::term::ansi::code::ctrl::sca\fR
.sp
\fB::term::ansi::code::ctrl::rca\fR
.sp
\fB::term::ansi::code::ctrl::st\fR
.sp
\fB::term::ansi::code::ctrl::ct\fR
.sp
\fB::term::ansi::code::ctrl::cat\fR
.sp
\fB::term::ansi::code::ctrl::qdc\fR
.sp
\fB::term::ansi::code::ctrl::qds\fR
.sp
\fB::term::ansi::code::ctrl::qcp\fR
.sp
\fB::term::ansi::code::ctrl::rd\fR
.sp
\fB::term::ansi::code::ctrl::elw\fR
.sp
\fB::term::ansi::code::ctrl::dlw\fR
.sp
\fB::term::ansi::code::ctrl::eg\fR
.sp
\fB::term::ansi::code::ctrl::lg\fR
.sp
\fB::term::ansi::code::ctrl::scs0\fR \fItag\fR
.sp
\fB::term::ansi::code::ctrl::scs1\fR \fItag\fR
.sp
\fB::term::ansi::code::ctrl::sda\fR \fIarg\fR...
.sp
\fB::term::ansi::code::ctrl::sda_fgblack\fR
.sp
\fB::term::ansi::code::ctrl::sda_fgred\fR
.sp
\fB::term::ansi::code::ctrl::sda_fggreen\fR
.sp
\fB::term::ansi::code::ctrl::sda_fgyellow\fR
.sp
\fB::term::ansi::code::ctrl::sda_fgblue\fR
.sp
\fB::term::ansi::code::ctrl::sda_fgmagenta\fR
.sp
\fB::term::ansi::code::ctrl::sda_fgcyan\fR
.sp
\fB::term::ansi::code::ctrl::sda_fgwhite\fR
.sp
\fB::term::ansi::code::ctrl::sda_fgdefault\fR
.sp
\fB::term::ansi::code::ctrl::sda_bgblack\fR
.sp
\fB::term::ansi::code::ctrl::sda_bgred\fR
.sp
\fB::term::ansi::code::ctrl::sda_bggreen\fR
.sp
\fB::term::ansi::code::ctrl::sda_bgyellow\fR
.sp
\fB::term::ansi::code::ctrl::sda_bgblue\fR
.sp
\fB::term::ansi::code::ctrl::sda_bgmagenta\fR
.sp
\fB::term::ansi::code::ctrl::sda_bgcyan\fR
.sp
\fB::term::ansi::code::ctrl::sda_bgwhite\fR
.sp
\fB::term::ansi::code::ctrl::sda_bgdefault\fR
.sp
\fB::term::ansi::code::ctrl::sda_bold\fR
.sp
\fB::term::ansi::code::ctrl::sda_dim\fR
.sp
\fB::term::ansi::code::ctrl::sda_italic\fR
.sp
\fB::term::ansi::code::ctrl::sda_underline\fR
.sp
\fB::term::ansi::code::ctrl::sda_blink\fR
.sp
\fB::term::ansi::code::ctrl::sda_revers\fR
.sp
\fB::term::ansi::code::ctrl::sda_hidden\fR
.sp
\fB::term::ansi::code::ctrl::sda_strike\fR
.sp
\fB::term::ansi::code::ctrl::sda_nobold\fR
.sp
\fB::term::ansi::code::ctrl::sda_noitalic\fR
.sp
\fB::term::ansi::code::ctrl::sda_nounderline\fR
.sp
\fB::term::ansi::code::ctrl::sda_noblink\fR
.sp
\fB::term::ansi::code::ctrl::sda_norevers\fR
.sp
\fB::term::ansi::code::ctrl::sda_nohidden\fR
.sp
\fB::term::ansi::code::ctrl::sda_nostrike\fR
.sp
\fB::term::ansi::code::ctrl::sda_reset\fR
.sp
\fB::term::ansi::send::fcp\fR \fIrow\fR \fIcol\fR
.sp
\fB::term::ansi::code::ctrl::cu\fR ?\fIn\fR?
.sp
\fB::term::ansi::code::ctrl::cd\fR ?\fIn\fR?
.sp
\fB::term::ansi::code::ctrl::cf\fR ?\fIn\fR?
.sp
\fB::term::ansi::code::ctrl::cb\fR ?\fIn\fR?
.sp
\fB::term::ansi::code::ctrl::ss\fR ?\fIs\fR \fIe\fR?
.sp
\fB::term::ansi::code::ctrl::skd\fR \fIcode\fR \fIstr\fR
.sp
\fB::term::ansi::code::ctrl::title\fR \fIstr\fR
.sp
\fB::term::ansi::code::ctrl::gron\fR
.sp
\fB::term::ansi::code::ctrl::groff\fR
.sp
\fB::term::ansi::code::ctrl::tlc\fR
.sp
\fB::term::ansi::code::ctrl::trc\fR
.sp
\fB::term::ansi::code::ctrl::brc\fR
.sp
\fB::term::ansi::code::ctrl::blc\fR
.sp
\fB::term::ansi::code::ctrl::ltj\fR
.sp
\fB::term::ansi::code::ctrl::ttj\fR
.sp
\fB::term::ansi::code::ctrl::rtj\fR
.sp
\fB::term::ansi::code::ctrl::btj\fR
.sp
\fB::term::ansi::code::ctrl::fwj\fR
.sp
\fB::term::ansi::code::ctrl::hl\fR
.sp
\fB::term::ansi::code::ctrl::vl\fR
.sp
\fB::term::ansi::code::ctrl::groptim\fR \fIstr\fR
.sp
\fB::term::ansi::code::ctrl::clear\fR
.sp
\fB::term::ansi::code::ctrl::init\fR
.sp
\fB::term::ansi::code::ctrl::showat\fR \fIrow\fR \fIcol\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
This package provides symbolic names for the ANSI control
sequences. For each sequence a single command is provided which
returns the sequence as its result. None of the commands of this
package write to a channel; that is handled by higher level packages,
like \fBterm::ansi::send\fR.
.SH API
.SS INTROSPECTION
.TP
\fB::term::ansi::code::ctrl::names\fR
This command is for introspection. It returns as its result a list
containing the names of all attribute commands.
.TP
\fB::term::ansi::code::ctrl::import\fR ?\fIns\fR? ?\fIarg\fR...?
This command imports some or all attribute commands into the namespace
\fIns\fR. This is by default the namespace \fIctrl\fR. Note that this
is relative namespace name, placing the imported command into a child
of the current namespace. By default all commands are imported, this
can howver be restricted by listing the names of the wanted commands
after the namespace argument.
.PP
.SS SEQUENCES
.TP
\fB::term::ansi::code::ctrl::eeol\fR
Erase (to) End Of Line
.TP
\fB::term::ansi::code::ctrl::esol\fR
Erase (to) Start Of Line
.TP
\fB::term::ansi::code::ctrl::el\fR
Erase (current) Line
.TP
\fB::term::ansi::code::ctrl::ed\fR
Erase Down (to bottom)
.TP
\fB::term::ansi::code::ctrl::eu\fR
Erase Up (to top)
.TP
\fB::term::ansi::code::ctrl::es\fR
Erase Screen
.TP
\fB::term::ansi::code::ctrl::sd\fR
Scroll Down
.TP
\fB::term::ansi::code::ctrl::su\fR
Scroll Up
.TP
\fB::term::ansi::code::ctrl::ch\fR
Cursor Home
.TP
\fB::term::ansi::code::ctrl::sc\fR
Save Cursor
.TP
\fB::term::ansi::code::ctrl::rc\fR
Restore Cursor (Unsave)
.TP
\fB::term::ansi::code::ctrl::sca\fR
Save Cursor + Attributes
.TP
\fB::term::ansi::code::ctrl::rca\fR
Restore Cursor + Attributes
.TP
\fB::term::ansi::code::ctrl::st\fR
Set Tab (@ current position)
.TP
\fB::term::ansi::code::ctrl::ct\fR
Clear Tab (@ current position)
.TP
\fB::term::ansi::code::ctrl::cat\fR
Clear All Tabs
.TP
\fB::term::ansi::code::ctrl::qdc\fR
Query Device Code
.TP
\fB::term::ansi::code::ctrl::qds\fR
Query Device Status
.TP
\fB::term::ansi::code::ctrl::qcp\fR
Query Cursor Position
.TP
\fB::term::ansi::code::ctrl::rd\fR
Reset Device
.TP
\fB::term::ansi::code::ctrl::elw\fR
Enable Line Wrap
.TP
\fB::term::ansi::code::ctrl::dlw\fR
Disable Line Wrap
.TP
\fB::term::ansi::code::ctrl::eg\fR
Enter Graphics Mode
.TP
\fB::term::ansi::code::ctrl::lg\fR
Exit Graphics Mode
.TP
\fB::term::ansi::code::ctrl::scs0\fR \fItag\fR
Set default character set
.TP
\fB::term::ansi::code::ctrl::scs1\fR \fItag\fR
Set alternate character set
Select Character Set.
.sp
Choose which character set is used for either default (scs0) or
alternate font (scs1). This does not change whether default or
alternate font are used, only their definition.
.sp
The legal tags, and their meanings, are:
.RS
.TP
A
United Kingdom Set
.TP
B
ASCII Set
.TP
0
Special Graphics
.TP
1
Alternate Character ROM Standard Character Set
.TP
2
Alternate Character ROM Special Graphics
.RE
.TP
\fB::term::ansi::code::ctrl::sda\fR \fIarg\fR...
Set Display Attributes. The arguments are the code sequences for the possible
attributes, as provided by the package \fBterm::ansi::code::attr\fR. For
convenience this package also provides additional commands each setting a single
specific attribute.
.TP
\fB::term::ansi::code::ctrl::sda_fgblack\fR
Set text color to \fIBlack\fR.
.TP
\fB::term::ansi::code::ctrl::sda_fgred\fR
Set text color to \fIRed\fR.
.TP
\fB::term::ansi::code::ctrl::sda_fggreen\fR
Set text color to \fIGreen\fR.
.TP
\fB::term::ansi::code::ctrl::sda_fgyellow\fR
Set text color to \fIYellow\fR.
.TP
\fB::term::ansi::code::ctrl::sda_fgblue\fR
Set text color to \fIBlue\fR.
.TP
\fB::term::ansi::code::ctrl::sda_fgmagenta\fR
Set text color to \fIMagenta\fR.
.TP
\fB::term::ansi::code::ctrl::sda_fgcyan\fR
Set text color to \fICyan\fR.
.TP
\fB::term::ansi::code::ctrl::sda_fgwhite\fR
Set text color to \fIWhite\fR.
.TP
\fB::term::ansi::code::ctrl::sda_fgdefault\fR
Set default text color (\fIBlack\fR).
.TP
\fB::term::ansi::code::ctrl::sda_bgblack\fR
Set background to \fIBlack\fR.
.TP
\fB::term::ansi::code::ctrl::sda_bgred\fR
Set background to \fIRed\fR.
.TP
\fB::term::ansi::code::ctrl::sda_bggreen\fR
Set background to \fIGreen\fR.
.TP
\fB::term::ansi::code::ctrl::sda_bgyellow\fR
Set background to \fIYellow\fR.
.TP
\fB::term::ansi::code::ctrl::sda_bgblue\fR
Set background to \fIBlue\fR.
.TP
\fB::term::ansi::code::ctrl::sda_bgmagenta\fR
Set background to \fIMagenta\fR.
.TP
\fB::term::ansi::code::ctrl::sda_bgcyan\fR
Set background to \fICyan\fR.
.TP
\fB::term::ansi::code::ctrl::sda_bgwhite\fR
Set background to \fIWhite\fR.
.TP
\fB::term::ansi::code::ctrl::sda_bgdefault\fR
Set default background (Transparent).
.TP
\fB::term::ansi::code::ctrl::sda_bold\fR
Bold on.
.TP
\fB::term::ansi::code::ctrl::sda_dim\fR
Dim on.
.TP
\fB::term::ansi::code::ctrl::sda_italic\fR
Italics on.
.TP
\fB::term::ansi::code::ctrl::sda_underline\fR
Underscore on.
.TP
\fB::term::ansi::code::ctrl::sda_blink\fR
Blink on.
.TP
\fB::term::ansi::code::ctrl::sda_revers\fR
Reverse on.
.TP
\fB::term::ansi::code::ctrl::sda_hidden\fR
Hidden on.
.TP
\fB::term::ansi::code::ctrl::sda_strike\fR
Strike-through on.
.TP
\fB::term::ansi::code::ctrl::sda_nobold\fR
Bold off.
.TP
\fB::term::ansi::code::ctrl::sda_noitalic\fR
Italics off.
.TP
\fB::term::ansi::code::ctrl::sda_nounderline\fR
Underscore off.
.TP
\fB::term::ansi::code::ctrl::sda_noblink\fR
Blink off.
.TP
\fB::term::ansi::code::ctrl::sda_norevers\fR
Reverse off.
.TP
\fB::term::ansi::code::ctrl::sda_nohidden\fR
Hidden off.
.TP
\fB::term::ansi::code::ctrl::sda_nostrike\fR
Strike-through off.
.TP
\fB::term::ansi::code::ctrl::sda_reset\fR
Reset all attributes to their default values.
.TP
\fB::term::ansi::send::fcp\fR \fIrow\fR \fIcol\fR
Force Cursor Position (aka Go To).
.TP
\fB::term::ansi::code::ctrl::cu\fR ?\fIn\fR?
Cursor Up. \fIn\fR defaults to 1.
.TP
\fB::term::ansi::code::ctrl::cd\fR ?\fIn\fR?
Cursor Down. \fIn\fR defaults to 1.
.TP
\fB::term::ansi::code::ctrl::cf\fR ?\fIn\fR?
Cursor Forward. \fIn\fR defaults to 1.
.TP
\fB::term::ansi::code::ctrl::cb\fR ?\fIn\fR?
Cursor Backward. \fIn\fR defaults to 1.
.TP
\fB::term::ansi::code::ctrl::ss\fR ?\fIs\fR \fIe\fR?
Scroll Screen (entire display, or between rows start end, inclusive).
.TP
\fB::term::ansi::code::ctrl::skd\fR \fIcode\fR \fIstr\fR
Set Key Definition.
.TP
\fB::term::ansi::code::ctrl::title\fR \fIstr\fR
Set the terminal title.
.TP
\fB::term::ansi::code::ctrl::gron\fR
Switch to character/box graphics. I.e. switch to the alternate font.
.TP
\fB::term::ansi::code::ctrl::groff\fR
Switch to regular characters. I.e. switch to the default font.
.TP
\fB::term::ansi::code::ctrl::tlc\fR
Character graphics, Top Left Corner.
.TP
\fB::term::ansi::code::ctrl::trc\fR
Character graphics, Top Right Corner.
.TP
\fB::term::ansi::code::ctrl::brc\fR
Character graphics, Bottom Right Corner.
.TP
\fB::term::ansi::code::ctrl::blc\fR
Character graphics, Bottom Left Corner.
.TP
\fB::term::ansi::code::ctrl::ltj\fR
Character graphics, Left T Junction.
.TP
\fB::term::ansi::code::ctrl::ttj\fR
Character graphics, Top T Junction.
.TP
\fB::term::ansi::code::ctrl::rtj\fR
Character graphics, Right T Junction.
.TP
\fB::term::ansi::code::ctrl::btj\fR
Character graphics, Bottom T Junction.
.TP
\fB::term::ansi::code::ctrl::fwj\fR
Character graphics, Four-Way Junction.
.TP
\fB::term::ansi::code::ctrl::hl\fR
Character graphics, Horizontal Line.
.TP
\fB::term::ansi::code::ctrl::vl\fR
Character graphics, Vertical Line.
.TP
\fB::term::ansi::code::ctrl::groptim\fR \fIstr\fR
Optimize character graphics. The generator commands above create way to many
superfluous commands shifting into and out of the graphics mode. This command
removes all shifts which are not needed. To this end it also knows which
characters will look the same in both modes, to handle strings created outside
of this package.
.TP
\fB::term::ansi::code::ctrl::clear\fR
Clear screen. In essence a sequence of CursorHome + EraseDown.
.TP
\fB::term::ansi::code::ctrl::init\fR
Initialize default and alternate fonts to ASCII and box graphics.
.TP
\fB::term::ansi::code::ctrl::showat\fR \fIrow\fR \fIcol\fR \fItext\fR
Format the block of text for display at the specified location.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
ansi, attribute control, color control, control, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/ansi_cmacros.n.

























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/ansi_cmacros.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::ansi::code::macros" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::ansi::code::macros \- Macro sequences
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBtextutil::repeat \fR
.sp
package require \fBtextutil::tabify \fR
.sp
package require \fBterm::ansi::code::macros  ?0.1?\fR
.sp
\fB::term::ansi::code::macros::names\fR
.sp
\fB::term::ansi::code::macros::import\fR ?\fIns\fR? ?\fIarg\fR...?
.sp
\fB::term::ansi::code::macros::menu\fR \fImenu\fR
.sp
\fB::term::ansi::code::macros::frame\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides higher level control sequences for more complex
shapes.
.SH API
.SS INTROSPECTION
.TP
\fB::term::ansi::code::macros::names\fR
This command is for introspection. It returns as its result a list
containing the names of all attribute commands.
.TP
\fB::term::ansi::code::macros::import\fR ?\fIns\fR? ?\fIarg\fR...?
This command imports some or all attribute commands into the namespace
\fIns\fR. This is by default the namespace \fImacros\fR. Note that
this is relative namespace name, placing the imported command into a
child of the current namespace. By default all commands are imported,
this can howver be restricted by listing the names of the wanted
commands after the namespace argument.
.PP
.SS SEQUENCES
.TP
\fB::term::ansi::code::macros::menu\fR \fImenu\fR
The description of a menu is converted into a formatted rectangular
block of text, with the menu command characters highlighted using bold
red text.  The result is returned as the result of the command.
.sp
The description, \fImenu\fR, is a dictionary mapping from menu label
to command character.
.TP
\fB::term::ansi::code::macros::frame\fR \fIstring\fR
The paragraph of text contained in the string is padded with spaces at
the right margin, after normalizing internal tabs, and then put into a
frame made of box-graphics. The result is returned as the result of
the command.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
ansi, control, frame, menu, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/ansi_code.n.









































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/ansi_code.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::ansi::code" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::ansi::code \- Helper for control sequences
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::ansi::code  ?0.1?\fR
.sp
\fB::term::ansi::code::esc\fR \fIstr\fR
.sp
\fB::term::ansi::code::escb\fR \fIstr\fR
.sp
\fB::term::ansi::code::define\fR \fIname\fR \fIescape\fR \fIcode\fR
.sp
\fB::term::ansi::code::const\fR \fIname\fR \fIcode\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands enabling the definition of control
sequences in an easy manner.
.PP
.TP
\fB::term::ansi::code::esc\fR \fIstr\fR
This command returns the argument string, prefixed with the ANSI
escape character, "\\033."
.TP
\fB::term::ansi::code::escb\fR \fIstr\fR
This command returns the argument string, prefixed with a common ANSI
escape sequence, "\\033[".
.TP
\fB::term::ansi::code::define\fR \fIname\fR \fIescape\fR \fIcode\fR
This command defines a procedure \fIname\fR which returns the control
sequence \fIcode\fR, beginning with the specified escape sequence,
either \fBesc\fR, or \fBescb\fR.
.TP
\fB::term::ansi::code::const\fR \fIname\fR \fIcode\fR
This command defines a procedure \fIname\fR which returns the control
sequence \fIcode\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
control, declare, define, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/ansi_ctrlu.n.

































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/ansi_ctrlu.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006-2011 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::ansi::ctrl::unix" n 0.1.1 tcllib "Terminal control"
.BS
.SH NAME
term::ansi::ctrl::unix \- Control operations and queries
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::ansi::ctrl::unix  ?0.1.1?\fR
.sp
\fB::term::ansi::ctrl::unix::import\fR ?\fIns\fR? ?\fIarg\fR...?
.sp
\fB::term::ansi::ctrl::unix::raw\fR
.sp
\fB::term::ansi::ctrl::unix::raw\fR
.sp
\fB::term::ansi::ctrl::unix::columns\fR
.sp
\fB::term::ansi::ctrl::unix::rows\fR
.sp
.BE
.SH DESCRIPTION
\fIWARNING\fR: This package is unix-specific and depends on the
availability of two unix system commands for terminal control,
i.e. \fBstty\fR and \fBtput\fR, both of which have to be found
in the \fB$PATH\fR. If any of these two commands is missing the
loading of the package will fail.
.PP
The package provides commands to switch the standard input of the
current process between \fIraw\fR and \fIcooked\fR input modes, and
to query the size of terminals, i.e. the available number of columns
and lines.
.SH API
.SS INTROSPECTION
.TP
\fB::term::ansi::ctrl::unix::import\fR ?\fIns\fR? ?\fIarg\fR...?
This command imports some or all attribute commands into the namespace
\fIns\fR. This is by default the namespace \fIctrl\fR. Note that this
is relative namespace name, placing the imported command into a child
of the current namespace. By default all commands are imported, this
can howver be restricted by listing the names of the wanted commands
after the namespace argument.
.PP
.SS OPERATIONS
.TP
\fB::term::ansi::ctrl::unix::raw\fR
This command switches the standard input of the current process to
\fIraw\fR input mode. This means that from then on all characters
typed by the user are immediately reported to the application instead
of waiting in the OS buffer until the Enter/Return key is received.
.TP
\fB::term::ansi::ctrl::unix::raw\fR
This command switches the standard input of the current process to
\fIcooked\fR input mode. This means that from then on all characters
typed by the user are kept in OS buffers for editing until the
Enter/Return key is received.
.TP
\fB::term::ansi::ctrl::unix::columns\fR
This command queries the terminal connected to the standard input for
the number of columns available for display.
.TP
\fB::term::ansi::ctrl::unix::rows\fR
This command queries the terminal connected to the standard input for
the number of rows (aka lines) available for display.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
ansi, columns, control, cooked, input mode, lines, raw, rows, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006-2011 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/ansi_send.n.













































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/ansi_send.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::ansi::send" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::ansi::send \- Output of ANSI control sequences to terminals
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::ansi::send  ?0.1?\fR
.sp
\fB::term::ansi::send::import\fR ?\fIns\fR? \fI...\fR
.sp
\fB::term::ansi::send::eeol\fR
.sp
\fB::term::ansi::send::esol\fR
.sp
\fB::term::ansi::send::el\fR
.sp
\fB::term::ansi::send::ed\fR
.sp
\fB::term::ansi::send::eu\fR
.sp
\fB::term::ansi::send::es\fR
.sp
\fB::term::ansi::send::sd\fR
.sp
\fB::term::ansi::send::su\fR
.sp
\fB::term::ansi::send::ch\fR
.sp
\fB::term::ansi::send::sc\fR
.sp
\fB::term::ansi::send::rc\fR
.sp
\fB::term::ansi::send::sca\fR
.sp
\fB::term::ansi::send::rca\fR
.sp
\fB::term::ansi::send::st\fR
.sp
\fB::term::ansi::send::ct\fR
.sp
\fB::term::ansi::send::cat\fR
.sp
\fB::term::ansi::send::qdc\fR
.sp
\fB::term::ansi::send::qds\fR
.sp
\fB::term::ansi::send::qcp\fR
.sp
\fB::term::ansi::send::rd\fR
.sp
\fB::term::ansi::send::elw\fR
.sp
\fB::term::ansi::send::dlw\fR
.sp
\fB::term::ansi::send::eg\fR
.sp
\fB::term::ansi::send::lg\fR
.sp
\fB::term::ansi::send::scs0\fR \fItag\fR
.sp
\fB::term::ansi::send::scs1\fR \fItag\fR
.sp
\fB::term::ansi::send::sda\fR \fIarg\fR...
.sp
\fB::term::ansi::send::sda_fgblack\fR
.sp
\fB::term::ansi::send::sda_fgred\fR
.sp
\fB::term::ansi::send::sda_fggreen\fR
.sp
\fB::term::ansi::send::sda_fgyellow\fR
.sp
\fB::term::ansi::send::sda_fgblue\fR
.sp
\fB::term::ansi::send::sda_fgmagenta\fR
.sp
\fB::term::ansi::send::sda_fgcyan\fR
.sp
\fB::term::ansi::send::sda_fgwhite\fR
.sp
\fB::term::ansi::send::sda_fgdefault\fR
.sp
\fB::term::ansi::send::sda_bgblack\fR
.sp
\fB::term::ansi::send::sda_bgred\fR
.sp
\fB::term::ansi::send::sda_bggreen\fR
.sp
\fB::term::ansi::send::sda_bgyellow\fR
.sp
\fB::term::ansi::send::sda_bgblue\fR
.sp
\fB::term::ansi::send::sda_bgmagenta\fR
.sp
\fB::term::ansi::send::sda_bgcyan\fR
.sp
\fB::term::ansi::send::sda_bgwhite\fR
.sp
\fB::term::ansi::send::sda_bgdefault\fR
.sp
\fB::term::ansi::send::sda_bold\fR
.sp
\fB::term::ansi::send::sda_dim\fR
.sp
\fB::term::ansi::send::sda_italic\fR
.sp
\fB::term::ansi::send::sda_underline\fR
.sp
\fB::term::ansi::send::sda_blink\fR
.sp
\fB::term::ansi::send::sda_revers\fR
.sp
\fB::term::ansi::send::sda_hidden\fR
.sp
\fB::term::ansi::send::sda_strike\fR
.sp
\fB::term::ansi::send::sda_nobold\fR
.sp
\fB::term::ansi::send::sda_noitalic\fR
.sp
\fB::term::ansi::send::sda_nounderline\fR
.sp
\fB::term::ansi::send::sda_noblink\fR
.sp
\fB::term::ansi::send::sda_norevers\fR
.sp
\fB::term::ansi::send::sda_nohidden\fR
.sp
\fB::term::ansi::send::sda_nostrike\fR
.sp
\fB::term::ansi::send::sda_reset\fR
.sp
\fB::term::ansi::send::fcp\fR \fIrow\fR \fIcol\fR
.sp
\fB::term::ansi::send::cu\fR ?\fIn\fR?
.sp
\fB::term::ansi::send::cd\fR ?\fIn\fR?
.sp
\fB::term::ansi::send::cf\fR ?\fIn\fR?
.sp
\fB::term::ansi::send::cb\fR ?\fIn\fR?
.sp
\fB::term::ansi::send::ss\fR ?\fIs\fR \fIe\fR?
.sp
\fB::term::ansi::send::skd\fR \fIcode\fR \fIstr\fR
.sp
\fB::term::ansi::send::title\fR \fIstr\fR
.sp
\fB::term::ansi::send::gron\fR
.sp
\fB::term::ansi::send::groff\fR
.sp
\fB::term::ansi::send::tlc\fR
.sp
\fB::term::ansi::send::trc\fR
.sp
\fB::term::ansi::send::brc\fR
.sp
\fB::term::ansi::send::blc\fR
.sp
\fB::term::ansi::send::ltj\fR
.sp
\fB::term::ansi::send::ttj\fR
.sp
\fB::term::ansi::send::rtj\fR
.sp
\fB::term::ansi::send::btj\fR
.sp
\fB::term::ansi::send::fwj\fR
.sp
\fB::term::ansi::send::hl\fR
.sp
\fB::term::ansi::send::vl\fR
.sp
\fB::term::ansi::send::groptim\fR \fIstr\fR
.sp
\fB::term::ansi::send::clear\fR
.sp
\fB::term::ansi::send::init\fR
.sp
\fB::term::ansi::send::showat\fR \fIrow\fR \fIcol\fR \fItext\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands to send ANSI terminal control sequences to a
terminal. All commands come in two variants, one for sending to any channel,
the other for sending to \fIstdout\fR.
.PP
The commands are defined using the control sequences provided by the package
\fBterm::ansi::code::ctrl\fR. They have the same arguments as the commands
they are based on, with the exception of the variant for sending to any channel.
Their first argument is always a channel handle, then followed by the original
arguments. Below we will list only the variant sending to \fIstdout\fR.
.TP
\fB::term::ansi::send::import\fR ?\fIns\fR? \fI...\fR
Imports the commands of this package into the namespace \fIns\fR. If not specified
it defaults to \fIsend\fR. Note that this default is a relative namespace name,
i.e. the actual namespace will be created under the current namespace.
.sp
By default all commands will be imported, this can however be restricted to specific
commands, by listing them after the namespace to import them into.
.TP
\fB::term::ansi::send::eeol\fR
Erase (to) End Of Line.
.TP
\fB::term::ansi::send::esol\fR
Erase (to) Start Of Line.
.TP
\fB::term::ansi::send::el\fR
Erase (current) Line.
.TP
\fB::term::ansi::send::ed\fR
Erase Down (to bottom).
.TP
\fB::term::ansi::send::eu\fR
Erase Up (to top).
.TP
\fB::term::ansi::send::es\fR
Erase Screen.
.TP
\fB::term::ansi::send::sd\fR
Scroll Down.
.TP
\fB::term::ansi::send::su\fR
Scroll Up.
.TP
\fB::term::ansi::send::ch\fR
Cursor Home.
.TP
\fB::term::ansi::send::sc\fR
Save Cursor. Note: Only one saved position can be handled.
This is no unlimited stack. Saving before restoring will
overwrite the saved data.
.TP
\fB::term::ansi::send::rc\fR
Restore Cursor (Unsave).
.TP
\fB::term::ansi::send::sca\fR
Save Cursor + Attributes.
.TP
\fB::term::ansi::send::rca\fR
Restore Cursor + Attributes.
.TP
\fB::term::ansi::send::st\fR
Set Tab (@ current position).
.TP
\fB::term::ansi::send::ct\fR
Clear Tab (@ current position).
.TP
\fB::term::ansi::send::cat\fR
Clear All Tabs.
.TP
\fB::term::ansi::send::qdc\fR
Query Device Code.
.TP
\fB::term::ansi::send::qds\fR
Query Device Status.
.TP
\fB::term::ansi::send::qcp\fR
Query Cursor Position.
.TP
\fB::term::ansi::send::rd\fR
Reset Device.
.TP
\fB::term::ansi::send::elw\fR
Enable Line Wrap.
.TP
\fB::term::ansi::send::dlw\fR
Disable Line Wrap.
.TP
\fB::term::ansi::send::eg\fR
Enter Graphics Mode.
.TP
\fB::term::ansi::send::lg\fR
Exit Graphics Mode.
.TP
\fB::term::ansi::send::scs0\fR \fItag\fR
.TP
\fB::term::ansi::send::scs1\fR \fItag\fR
Select Character Set.
.sp
Choose which character set is used for default (scs0) and alternate font (scs1).
This does not change whether default or alternate font are used, just their
definitions.
.sp
The legal tags, and their meanings, are:
.RS
.TP
A
United Kingdom Set
.TP
B
ASCII Set
.TP
0
Special Graphics
.TP
1
Alternate Character ROM Standard Character Set
.TP
2
Alternate Character ROM Special Graphics
.RE
.TP
\fB::term::ansi::send::sda\fR \fIarg\fR...
Set Display Attributes. The arguments are the code sequences for the possible
attributes, as provided by the package \fBterm::ansi::code::attr\fR. For
convenience this package also provides additional commands each setting a single
specific attribute.
.TP
\fB::term::ansi::send::sda_fgblack\fR
Set text color to \fIBlack\fR.
.TP
\fB::term::ansi::send::sda_fgred\fR
Set text color to \fIRed\fR.
.TP
\fB::term::ansi::send::sda_fggreen\fR
Set text color to \fIGreen\fR.
.TP
\fB::term::ansi::send::sda_fgyellow\fR
Set text color to \fIYellow\fR.
.TP
\fB::term::ansi::send::sda_fgblue\fR
Set text color to \fIBlue\fR.
.TP
\fB::term::ansi::send::sda_fgmagenta\fR
Set text color to \fIMagenta\fR.
.TP
\fB::term::ansi::send::sda_fgcyan\fR
Set text color to \fICyan\fR.
.TP
\fB::term::ansi::send::sda_fgwhite\fR
Set text color to \fIWhite\fR.
.TP
\fB::term::ansi::send::sda_fgdefault\fR
Set default text color (\fIBlack\fR).
.TP
\fB::term::ansi::send::sda_bgblack\fR
Set background to \fIBlack\fR.
.TP
\fB::term::ansi::send::sda_bgred\fR
Set background to \fIRed\fR.
.TP
\fB::term::ansi::send::sda_bggreen\fR
Set background to \fIGreen\fR.
.TP
\fB::term::ansi::send::sda_bgyellow\fR
Set background to \fIYellow\fR.
.TP
\fB::term::ansi::send::sda_bgblue\fR
Set background to \fIBlue\fR.
.TP
\fB::term::ansi::send::sda_bgmagenta\fR
Set background to \fIMagenta\fR.
.TP
\fB::term::ansi::send::sda_bgcyan\fR
Set background to \fICyan\fR.
.TP
\fB::term::ansi::send::sda_bgwhite\fR
Set background to \fIWhite\fR.
.TP
\fB::term::ansi::send::sda_bgdefault\fR
Set default background (Transparent).
.TP
\fB::term::ansi::send::sda_bold\fR
Bold on.
.TP
\fB::term::ansi::send::sda_dim\fR
Dim on.
.TP
\fB::term::ansi::send::sda_italic\fR
Italics on.
.TP
\fB::term::ansi::send::sda_underline\fR
Underscore on.
.TP
\fB::term::ansi::send::sda_blink\fR
Blink on.
.TP
\fB::term::ansi::send::sda_revers\fR
Reverse on.
.TP
\fB::term::ansi::send::sda_hidden\fR
Hidden on.
.TP
\fB::term::ansi::send::sda_strike\fR
Strike-through on.
.TP
\fB::term::ansi::send::sda_nobold\fR
Bold off.
.TP
\fB::term::ansi::send::sda_noitalic\fR
Italics off.
.TP
\fB::term::ansi::send::sda_nounderline\fR
Underscore off.
.TP
\fB::term::ansi::send::sda_noblink\fR
Blink off.
.TP
\fB::term::ansi::send::sda_norevers\fR
Reverse off.
.TP
\fB::term::ansi::send::sda_nohidden\fR
Hidden off.
.TP
\fB::term::ansi::send::sda_nostrike\fR
Strike-through off.
.TP
\fB::term::ansi::send::sda_reset\fR
Reset all attributes to their default values.
.TP
\fB::term::ansi::send::fcp\fR \fIrow\fR \fIcol\fR
Force Cursor Position (aka Go To).
.TP
\fB::term::ansi::send::cu\fR ?\fIn\fR?
Cursor Up. \fIn\fR defaults to 1.
.TP
\fB::term::ansi::send::cd\fR ?\fIn\fR?
Cursor Down. \fIn\fR defaults to 1.
.TP
\fB::term::ansi::send::cf\fR ?\fIn\fR?
Cursor Forward. \fIn\fR defaults to 1.
.TP
\fB::term::ansi::send::cb\fR ?\fIn\fR?
Cursor Backward. \fIn\fR defaults to 1.
.TP
\fB::term::ansi::send::ss\fR ?\fIs\fR \fIe\fR?
Scroll Screen (entire display, or between rows start end, inclusive).
.TP
\fB::term::ansi::send::skd\fR \fIcode\fR \fIstr\fR
Set Key Definition.
.TP
\fB::term::ansi::send::title\fR \fIstr\fR
Set the terminal title.
.TP
\fB::term::ansi::send::gron\fR
Switch to character/box graphics. I.e. switch to the alternate font.
.TP
\fB::term::ansi::send::groff\fR
Switch to regular characters. I.e. switch to the default font.
.TP
\fB::term::ansi::send::tlc\fR
Character graphics, Top Left Corner.
.TP
\fB::term::ansi::send::trc\fR
Character graphics, Top Right Corner.
.TP
\fB::term::ansi::send::brc\fR
Character graphics, Bottom Right Corner.
.TP
\fB::term::ansi::send::blc\fR
Character graphics, Bottom Left Corner.
.TP
\fB::term::ansi::send::ltj\fR
Character graphics, Left T Junction.
.TP
\fB::term::ansi::send::ttj\fR
Character graphics, Top T Junction.
.TP
\fB::term::ansi::send::rtj\fR
Character graphics, Right T Junction.
.TP
\fB::term::ansi::send::btj\fR
Character graphics, Bottom T Junction.
.TP
\fB::term::ansi::send::fwj\fR
Character graphics, Four-Way Junction.
.TP
\fB::term::ansi::send::hl\fR
Character graphics, Horizontal Line.
.TP
\fB::term::ansi::send::vl\fR
Character graphics, Vertical Line.
.TP
\fB::term::ansi::send::groptim\fR \fIstr\fR
Optimize character graphics. The generator commands above create way to many
superfluous commands shifting into and out of the graphics mode. This command
removes all shifts which are not needed. To this end it also knows which
characters will look the same in both modes, to handle strings created outside
of this package.
.TP
\fB::term::ansi::send::clear\fR
Clear screen. In essence a sequence of CursorHome + EraseDown.
.TP
\fB::term::ansi::send::init\fR
Initialize default and alternate fonts to ASCII and box graphics.
.TP
\fB::term::ansi::send::showat\fR \fIrow\fR \fIcol\fR \fItext\fR
Show the block of text at the specified location.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
character output, control, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/imenu.n.




































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/imenu.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::interact::menu" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::interact::menu \- Terminal widget, menu
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::interact::menu  ?0.1?\fR
.sp
\fBterm::interact::menu\fR \fIobject\fR \fIdict\fR ?\fIoptions\fR...?
.sp
\fIobject\fR \fBinteract\fR
.sp
\fIobject\fR \fBdone\fR
.sp
\fIobject\fR \fBclear\fR
.sp
\fIobject\fR \fBconfigure\fR
.sp
\fIobject\fR \fBconfigure\fR \fIoption\fR
.sp
\fIobject\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fIobject\fR \fBcget\fR \fIoption\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for the creation of a simple menu
control.
.SH "CLASS API"
The package exports a single command, the class command, enabling the
creation of menu instances. Its API is:
.TP
\fBterm::interact::menu\fR \fIobject\fR \fIdict\fR ?\fIoptions\fR...?
This command creates a new menu object with the name \fIobject\fR,
initializes it, and returns the fully qualified name of the object
command as its result.
.sp
The argument is the menu to show, possibly followed by configuration
options and their values. The options are explained in the section
\fBConfiguration\fR. The menu is a dictionary maping labels
to symbolic action codes.
.PP
.SH "OBJECT API"
The objects created by the class command provide the methods listed
below:
.TP
\fIobject\fR \fBinteract\fR
Shows the menu in the screen at the configured location and starts
interacting with it. This opens its own event loop for the processing
of incoming characters. The method returns when the interaction has
completed. See section \fBInteraction\fR for a description of the
possible interaction.
.sp
The method returns the symbolic action of the menu item selected by
the user at the end of the interaction.
.TP
\fIobject\fR \fBdone\fR
This method can be used by user supplied actions to terminate the
interaction with the object.
.TP
\fIobject\fR \fBclear\fR
This method can be used by user supplied actions to remove the menu
from the terminal.
.TP
\fIobject\fR \fBconfigure\fR
.TP
\fIobject\fR \fBconfigure\fR \fIoption\fR
.TP
\fIobject\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.TP
\fIobject\fR \fBcget\fR \fIoption\fR
Standard methods to retrieve and configure the options of the menu.
.PP
.SH CONFIGURATION
A menu instance recognizes the following options:
.TP
\fB-in\fR chan
Specifies the channel to read character sequences from. Defaults to
\fBstdin\fR.
.TP
\fB-out\fR chan
Specifies the channel to write the menu contents to. Defaults to
\fBstdout\fR.
.TP
\fB-column\fR int
Specifies the column of the terminal where the left margin of the
menu display should appear. Defaults to 0, i.e. the left-most
column.
.TP
\fB-line\fR int
Specifies the line of the terminal where the top margin of the menu
display should appear. Defaults to 0, i.e. the top-most line.
.TP
\fB-height\fR int
Specifies the number of lines of text to show at most in the
display. Defaults to 25.
.TP
\fB-actions\fR dict
Specifies a dictionary containing additional actions, using character
sequences as keys. Note that these sequences cannot override the
hardwired sequences described in section \fBInteraction\fR.
.TP
\fB-hilitleft\fR int
.TP
\fB-hilitright\fR int
By default the entire selected menu entry is highlighted in revers
output. However, when present these two options restrict revers dispay
to the specified sub-range of the entry.
.TP
\fB-framed\fR bool
By default the menu is shown using only header and footer out of
characters box graphics. If this flag is set the menu is fully
enclosed in a box.
.PP
.SH INTERACTION
A menu object recognizes the control sequences listed below and acts
as described. The user can supply more control sequences to act on via
the configuration, but is not able to overide these defaults.
.TP
Cursor Up
The selection is moved up one entry, except if the first entry of the
menu is already selected.
.TP
Cursor Down
The selection is moved down one entry, except if the last entry of the
menu is already selected.
.TP
Enter/Return
The interaction with the object is terminated.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
control, menu, terminal, text display
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/ipager.n.





































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/ipager.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::interact::pager" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::interact::pager \- Terminal widget, paging
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::interact::pager  ?0.1?\fR
.sp
\fBterm::interact::pager\fR \fIobject\fR \fItext\fR ?\fIoptions\fR...?
.sp
\fIobject\fR \fBinteract\fR
.sp
\fIobject\fR \fBdone\fR
.sp
\fIobject\fR \fBclear\fR
.sp
\fIobject\fR \fBtext\fR \fItext\fR
.sp
\fIobject\fR \fBconfigure\fR
.sp
\fIobject\fR \fBconfigure\fR \fIoption\fR
.sp
\fIobject\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.sp
\fIobject\fR \fBcget\fR \fIoption\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for the creation of a simple paging
text display.
.SH "CLASS API"
The package exports a single command, the class command, enabling the
creation of pager instances. Its API is:
.TP
\fBterm::interact::pager\fR \fIobject\fR \fItext\fR ?\fIoptions\fR...?
This command creates a new pager object with the name \fIobject\fR,
initializes it, and returns the fully qualified name of the object
command as its result.
.sp
The argument is the text to show, possibly followed by configuration
options and their values. The options are explained in the section
\fBConfiguration\fR.
.PP
.SH "OBJECT API"
The objects created by the class command provide the methods listed
below:
.TP
\fIobject\fR \fBinteract\fR
Show the pager in the screen at the configured location and start
interacting with it. This opens its own event loop for the processing
of incoming characters. The method returns when the interaction has
completed. See section \fBInteraction\fR for a description of the
possible interaction.
.TP
\fIobject\fR \fBdone\fR
This method can be used by user supplied actions to terminate the
interaction with the object.
.TP
\fIobject\fR \fBclear\fR
This method can be used by user supplied actions to remove the pager
from the terminal.
.TP
\fIobject\fR \fBtext\fR \fItext\fR
This method can be used to change the text shown by the pager.
The pager will reset the dispay to show the first line of the
text at the top.
.TP
\fIobject\fR \fBconfigure\fR
.TP
\fIobject\fR \fBconfigure\fR \fIoption\fR
.TP
\fIobject\fR \fBconfigure\fR \fIoption\fR \fIvalue\fR...
.TP
\fIobject\fR \fBcget\fR \fIoption\fR
Standard methods to retrieve and configure the options of the pager.
.PP
.SH CONFIGURATION
A pager instance recognizes the following options:
.TP
\fB-in\fR chan
Specifies the channel to read character sequences from. Defaults to
\fBstdin\fR.
.TP
\fB-out\fR chan
Specifies the channel to write the pager contents to. Defaults to
\fBstdout\fR.
.TP
\fB-column\fR int
Specifies the column of the terminal where the left margin of the
pager display should appear. Defaults to 0, i.e. the left-most
column.
.TP
\fB-line\fR int
Specifies the line of the terminal where the top margin of the pager
display should appear. Defaults to 0, i.e. the top-most line.
.TP
\fB-height\fR int
Specifies the number of lines of text to show at most in the
display. Defaults to 25.
.TP
\fB-actions\fR dict
Specifies a dictionary containing additional actions, using character
sequences as keys. Note that these sequences cannot override the
hardwired sequences described in section \fBInteraction\fR.
.PP
.SH INTERACTION
A pager object recognizes the control sequences listed below and acts
as described. The user can supply more control sequences to act on via
the configuration, but is not able to overide these defaults.
.TP
Cursor Up
The text is scrolled down a single line, making one more line visible
at the top. The pager will not react if the first line of the text is
already shown.
.TP
Cursor Down
The text is scrolled up a single line, making one more line visible at
the bottom. The pager will not react if the last line of the text is
already shown.
.TP
Page Up
The text is scrolled down a page. The pager will not react if the
first line of the text is already shown.
.TP
Page Down
The text is scrolled up a page. The pager will not react if the last
line of the text is already shown.
.TP
Enter/Return
The interaction with the object is terminated.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
control, pager, terminal, text display
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/receive.n.





























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/receive.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::receive" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::receive \- General input from terminals
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::receive  ?0.1?\fR
.sp
\fB::term::receive::getch\fR ?\fIchan\fR?
.sp
\fB::term::receive::listen\fR \fIcmd\fR ?\fIchan\fR?
.sp
\fIcmd\fR \fBprocess\fR \fIstring\fR
.sp
\fIcmd\fR \fBeof\fR
.sp
\fB::term::receive::unlisten\fR ?\fIchan\fR?
.sp
.BE
.SH DESCRIPTION
This package provides the most primitive commands for receiving
characters to a terminal. They are in essence convenient wrappers
around the builtin commands \fBread\fR and \fBfileevent\fR.
.TP
\fB::term::receive::getch\fR ?\fIchan\fR?
This command reads a single character from the channel with handle
\fIchan\fR and returns it as the result of the command.
.sp
If not specified \fIchan\fR defaults to \fBstdin\fR.
.sp
It is the responsibility of the caller to make sure that the channel
can provide single characters. On unix this can be done, for example,
by using the command of package \fBterm::ansi::ctrl::unix\fR.
.TP
\fB::term::receive::listen\fR \fIcmd\fR ?\fIchan\fR?
This command sets up a filevent listener for the channel with handle
\fIchan\fR and invokes the command prefix \fIcmd\fR whenever
characters have been received, or EOF was reached.
.sp
If not specified \fIchan\fR defaults to \fBstdin\fR.
.sp
The signature of the command prefix is
.RS
.TP
\fIcmd\fR \fBprocess\fR \fIstring\fR
This method is invoked when characters were received, and \fIstring\fR
holds them for processing.
.TP
\fIcmd\fR \fBeof\fR
This method is invoked when EOF was reached on the channel we listen
on.  It will be the last call to be received by the callback.
.RE
.TP
\fB::term::receive::unlisten\fR ?\fIchan\fR?
This command disables the filevent listener for the channel with handle
\fIchan\fR.
.sp
If not specified \fIchan\fR defaults to \fBstdin\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
character input, control, get character, listener, receiver, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/term.n.
















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/term.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term \- General terminal control
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm  ?0.1?\fR
.sp
.BE
.SH DESCRIPTION
It is planned to have this package provide highlevel general terminal control
commands, in the vein of ncurses or similar packages. Currently nothing has
been implemented however. I.e. this package is empty. It can be loaded, yet
provides nothing.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
control, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/term_bind.n.









































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/term_bind.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::receive::bind" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::receive::bind \- Keyboard dispatch from terminals
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::receive::bind  ?0.1?\fR
.sp
\fBterm::receive::bind\fR \fIobject\fR ?\fImap\fR?
.sp
\fIobject\fR \fBmap\fR \fIstr\fR \fIcmd\fR
.sp
\fIobject\fR \fBdefault\fR \fIcmd\fR
.sp
\fIobject\fR \fBlisten\fR ?\fIchan\fR?
.sp
\fIobject\fR \fBunlisten\fR ?\fIchan\fR?
.sp
\fIobject\fR \fBreset\fR
.sp
\fIobject\fR \fBnext\fR \fIchar\fR
.sp
\fIobject\fR \fBprocess\fR \fIstr\fR
.sp
\fIobject\fR \fBeof\fR
.sp
.BE
.SH DESCRIPTION
This package provides a class for the creation of simple dispatchers
from character sequences to actions. Internally each dispatcher is in
essence a deterministic finite automaton with tree structure.
.SH "CLASS API"
The package exports a single command, the
class command, enabling the creation of
dispatcher instances. Its API
is:
.TP
\fBterm::receive::bind\fR \fIobject\fR ?\fImap\fR?
This command creates a new dispatcher object with the name
\fIobject\fR, initializes it, and returns the fully qualified name of
the object command as its result.
.sp
The argument is a dictionary mapping from strings, i.e. character
sequences to the command prefices to invoke when the sequence is found
in the input stream.
.PP
.SH "OBJECT API"
The objects created by the class command provide the methods listed
below:
.TP
\fIobject\fR \fBmap\fR \fIstr\fR \fIcmd\fR
This method adds an additional mapping from the string \fIstr\fR to
the action \fIcmd\fR. The mapping will take effect immediately
should the processor be in a prefix of \fIstr\fR, or at the next
reset operation. The action is a command prefix and will be invoked
with one argument appended to it, the character sequence causing
the invokation. It is executed in the global namespace.
.TP
\fIobject\fR \fBdefault\fR \fIcmd\fR
This method defines a default action \fIcmd\fR which will be invoked
whenever an unknown character sequence is encountered. The command
prefix is handled in the same as the regular action defined via
method \fBmap\fR.
.TP
\fIobject\fR \fBlisten\fR ?\fIchan\fR?
This methods sets up a filevent listener for the channel with handle
\fIchan\fR and invokes the dispatcher object whenever characters have
been received, or EOF was reached.
.sp
If not specified \fIchan\fR defaults to \fBstdin\fR.
.TP
\fIobject\fR \fBunlisten\fR ?\fIchan\fR?
This methods removes the filevent listener for the channel with handle
\fIchan\fR.
.sp
If not specified \fIchan\fR defaults to \fBstdin\fR.
.TP
\fIobject\fR \fBreset\fR
This method resets the character processor
to the beginning of the tree.
.TP
\fIobject\fR \fBnext\fR \fIchar\fR
This method causes the character processor to process the character
\fIc\fR. This may simply advance the internal state, or invoke an
associated action for a recognized sequence.
.TP
\fIobject\fR \fBprocess\fR \fIstr\fR
This method causes the character processor to process the character
sequence \fIstr\fR, advancing the internal state and invoking action
as necessary. This is a callback for \fBlisten\fR.
.TP
\fIobject\fR \fBeof\fR
This method causes the character processor to handle EOF on the
input. This is currently no-op.
This is a callback for \fBlisten\fR.
.PP
.SH NOTES
The simplicity of the DFA means that it is not possible to recognize a
character sequence with has a another recognized character sequence as
its prefix.
.PP
In other words, the set of recognized strings has to form a
\fIprefix code\fR.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
character input, control, dispatcher, listener, receiver, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/term/term_send.n.































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/term/term_send.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "term::send" n 0.1 tcllib "Terminal control"
.BS
.SH NAME
term::send \- General output to terminals
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBterm::send  ?0.1?\fR
.sp
\fB::term::send::wrch\fR \fIchan\fR \fIstr\fR
.sp
\fB::term::send::wr\fR \fIstr\fR
.sp
.BE
.SH DESCRIPTION
This package provides the most primitive commands for sending characters
to a terminal. They are in essence convenient wrappers around the
builtin command \fBputs\fR.
.TP
\fB::term::send::wrch\fR \fIchan\fR \fIstr\fR
Send the text \fIstr\fR to the channel specified by the handle \fIchan\fR.
In contrast to the builtin command \fBputs\fR this command does not
terminate the string with a line terminator. It also forces an  flush of
Tcl internal and OS buffers to ensure that the characters are processed
immediately.
.TP
\fB::term::send::wr\fR \fIstr\fR
This convenience command is like \fB::term::send::wrch\fR, except that the
destination channel is fixed to \fIstdout\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIterm\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
character output, control, terminal
.SH CATEGORY
Terminal control
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/textutil/adjust.n.
































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/textutil/adjust.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "textutil::adjust" n 0.7.1 tcllib "Text and string utilities, macro processing"
.BS
.SH NAME
textutil::adjust \- Procedures to adjust, indent, and undent paragraphs
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil::adjust  ?0.7.1?\fR
.sp
\fB::textutil::adjust::adjust\fR \fIstring\fR ?\fIoption value...\fR?
.sp
\fB::textutil::adjust::readPatterns\fR \fIfilename\fR
.sp
\fB::textutil::adjust::listPredefined\fR
.sp
\fB::textutil::adjust::getPredefined\fR \fIfilename\fR
.sp
\fB::textutil::adjust::indent\fR \fIstring\fR \fIprefix\fR ?\fIskip\fR?
.sp
\fB::textutil::adjust::undent\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
The package \fBtextutil::adjust\fR provides commands that manipulate
strings or texts (a.k.a. long strings or string with embedded newlines
or paragraphs), adjusting, or indenting them.
.PP
The complete set of procedures is described below.
.TP
\fB::textutil::adjust::adjust\fR \fIstring\fR ?\fIoption value...\fR?
Do a justification on the \fIstring\fR according to the options.  The
string is taken as one big paragraph, ignoring any newlines.  Then the
line is formatted according to the options used, and the command
returns a new string with enough lines to contain all the printable
chars in the input string. A line is a set of characters between the
beginning of the string and a newline, or between 2 newlines, or
between a newline and the end of the string. If the input string is
small enough, the returned string won't contain any newlines.
.sp
Together with \fB::textutil::adjust::indent\fR it is possible to
create properly wrapped paragraphs with arbitrary indentations.
.sp
By default, any occurrence of space or tabulation characters are
replaced by a single space so that each word in a line is separated
from the next one by exactly one space character, and this forms a
\fIreal\fR line.
Each \fIreal\fR line is placed in a \fIlogical\fR line, which has
exactly a given length (see the option \fB-length\fR below).
The \fIreal\fR line may be shorter. Again by default, trailing spaces
are ignored before returning the string (see the option \fB-full\fR
below).
.sp
The following options may be used after the \fIstring\fR parameter,
and change the way the command places a \fIreal\fR line in a
\fIlogical\fR line.
.RS
.TP
\fB-full\fR \fIboolean\fR
If set to \fBfalse\fR (default), trailing space characters are
deleted before returning the string. If set to \fBtrue\fR, any
trailing space characters are left in the string.
.TP
\fB-hyphenate\fR \fIboolean\fR
If set to \fBfalse\fR (default), no hyphenation will be done. If set
to \fBtrue\fR, the command will try to hyphenate the last word of a
line. \fINote\fR: Hyphenation patterns must be loaded prior, using
the command \fB::textutil::adjust::readPatterns\fR.
.TP
\fB-justify\fR \fBcenter|left|plain|right\fR
Sets the justification of the returned string to either \fBleft\fR
(default), \fBcenter\fR, \fBplain\fR or \fBright\fR. The
justification means that any line in the returned string but the last
one is build according to the value.
If the justification is set to \fBplain\fR and the number of
printable chars in the last line is less than 90% of the length of a
line (see the option \fB-length\fR), then this line is justified
with the \fBleft\fR value, avoiding the expansion of this line when
it is too small. The meaning of each value is:
.RS
.TP
\fBcenter\fR
The real line is centered in the logical line. If needed, a set of
space characters are added at the beginning (half of the needed set)
and at the end (half of the needed set) of the line if required (see
the option \fB-full\fR).
.TP
\fBleft\fR
The real line is set on the left of the logical line. It means that
there are no space chars at the beginning of this line. If required,
all needed space chars are added at the end of the line (see the
option \fB-full\fR).
.TP
\fBplain\fR
The real line is exactly set in the logical line. It means that there
are no leading or trailing space chars. All the needed space chars are
added in the \fIreal\fR line, between 2 (or more) words.
.TP
\fBright\fR
The real line is set on the right of the logical line. It means that
there are no space chars at the end of this line, and there may be
some space chars at the beginning, despite of the \fB-full\fR option.
.RE
.TP
\fB-length\fR \fIinteger\fR
Set the length of the \fIlogical\fR line in the string to
\fIinteger\fR.  \fIinteger\fR must be a positive integer
value. Defaults to \fB72\fR.
.TP
\fB-strictlength\fR
\fIboolean\fR]
If set to \fBfalse\fR (default), a line can exceed the specified
\fB-length\fR if a single word is longer than \fB-length\fR. If
set to \fBtrue\fR, words that are longer than \fB-length\fR are
split so that no line exceeds the specified \fB-length\fR.
.RE
.TP
\fB::textutil::adjust::readPatterns\fR \fIfilename\fR
Loads the internal storage for hyphenation patterns with the contents
of the file \fIfilename\fR. This has to be done prior to calling
command \fB::textutil::adjust::adjust\fR with "\fB-hyphenate\fR
\fBtrue\fR", or the hyphenation process will not work correctly.
.sp
The package comes with a number of predefined pattern files, and the
command \fB::textutil::adjust::listPredefined\fR can be used to find
out their names.
.TP
\fB::textutil::adjust::listPredefined\fR
This command returns a list containing the names of the hyphenation
files coming with this package.
.TP
\fB::textutil::adjust::getPredefined\fR \fIfilename\fR
Use this command to query the package for the full path name of the
hyphenation file \fIfilename\fR coming with the package. Only the
filenames found in the list returned by
\fB::textutil::adjust::listPredefined\fR are legal arguments for this
command.
.TP
\fB::textutil::adjust::indent\fR \fIstring\fR \fIprefix\fR ?\fIskip\fR?
Each line in the \fIstring\fR is indented by adding the string
\fIprefix\fR at its beginning. The modified string is returned
as the result of the command.
.sp
If \fIskip\fR is specified the first \fIskip\fR lines are left
untouched. The default for \fIskip\fR is \fB0\fR, causing the
modification of all lines. Negative values for \fIskip\fR are treated
like \fB0\fR. In other words, \fIskip\fR > \fB0\fR creates a
hanging indentation.
.sp
Together with \fB::textutil::adjust::adjust\fR it is possible to
create properly wrapped paragraphs with arbitrary indentations.
.TP
\fB::textutil::adjust::undent\fR \fIstring\fR
The command computes the common prefix for all lines in \fIstring\fR
consisting solely out of whitespace, removes this from each line and
returns the modified string.
.sp
Lines containing only whitespace are always reduced to completely
empty lines. They and empty lines are also ignored when computing the
prefix to remove.
.sp
Together with \fB::textutil::adjust::adjust\fR it is possible to
create properly wrapped paragraphs with arbitrary indentations.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItextutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
regexp(n), split(n), string(n)
.SH KEYWORDS
TeX, adjusting, formatting, hyphenation, indenting, justification, paragraph, string, undenting
.SH CATEGORY
Text processing

Added embedded/man/files/modules/textutil/expander.n.





















































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/textutil/expander.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) William H. Duquette, http://www.wjduquette.com/expand
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "textutil::expander" n 1.3.1 tcllib "Text and string utilities, macro processing"
.BS
.SH NAME
textutil::expander \- Procedures to process templates and expand text.
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil::expander  ?1.3.1?\fR
.sp
\fB::textutil::expander\fR \fIexpanderName\fR
.sp
\fIexpanderName\fR \fBcappend\fR \fItext\fR
.sp
\fIexpanderName\fR \fBcget\fR \fIvarname\fR
.sp
\fIexpanderName\fR \fBcis\fR \fIcname\fR
.sp
\fIexpanderName\fR \fBcname\fR
.sp
\fIexpanderName\fR \fBcpop\fR \fIcname\fR
.sp
\fIexpanderName\fR \fBctopandclear\fR
.sp
\fIexpanderName\fR \fBcpush\fR \fIcname\fR
.sp
\fIexpanderName\fR \fBcset\fR \fIvarname\fR \fIvalue\fR
.sp
\fIexpanderName\fR \fBcvar\fR \fIvarname\fR
.sp
\fIexpanderName\fR \fBerrmode\fR \fInewErrmode\fR
.sp
\fIexpanderName\fR \fBevalcmd\fR ?\fInewEvalCmd\fR?
.sp
\fIexpanderName\fR \fBexpand\fR \fIstring\fR ?\fIbrackets\fR?
.sp
\fIexpanderName\fR \fBlb\fR ?\fInewbracket\fR?
.sp
\fIexpanderName\fR \fBrb\fR ?\fInewbracket\fR?
.sp
\fIexpanderName\fR \fBreset\fR
.sp
\fIexpanderName\fR \fBsetbrackets\fR \fIlbrack rbrack\fR
.sp
\fIexpanderName\fR \fBtextcmd\fR ?\fInewTextCmd\fR?
.sp
\fIexpanderName\fR \fBwhere\fR
.sp
.BE
.SH DESCRIPTION
.PP
The Tcl \fBsubst\fR command is often used to support a kind of
template processing. Given a string with embedded variables or
function calls, \fBsubst\fR will interpolate the variable and function
values, returning the new string:
.PP
.CS


    % set greeting "Howdy"
    Howdy
    % proc place {} {return "World"}
    % subst {$greeting, [place]!}
    Howdy, World!
    %

.CE
.PP
By defining a suitable set of Tcl commands, \fBsubst\fR can be used to
implement a markup language similar to HTML.
.PP
The \fBsubst\fR command is efficient, but it has three drawbacks for
this kind of template processing:
.IP \(bu
There's no way to identify and process the plain text between two
embedded Tcl commands; that makes it difficult to handle plain text in
a context-sensitive way.
.IP \(bu
Embedded commands are necessarily bracketed by \fB[\fR and
\fB]\fR; it's convenient to be able to choose different brackets
in special cases.  Someone producing web pages that include a large
quantity of Tcl code examples might easily prefer to use \fB<<\fR
and \fB>>\fR as the embedded code delimiters instead.
.IP \(bu
There's no easy way to handle incremental input, as one might wish to
do when reading data from a socket.
.PP
.PP
At present, expander solves the first two problems; eventually it will
solve the third problem as well.
.PP
The following section describes the command API to the expander; this
is followed by the tutorial sections, see \fBTUTORIAL\fR.
.SH "EXPANDER API"
.PP
The \fBtextutil::expander\fR package provides only one command,
described below. The rest of the section is taken by a description of
the methods for the expander objects created by this command.
.TP
\fB::textutil::expander\fR \fIexpanderName\fR
The command creates a new expander object with an associated Tcl
command whose name is \fIexpanderName\fR. This command may be used to
invoke various operations on the graph. If the \fIexpanderName\fR is
not fully qualified it is interpreted as relative to the current
namespace.  The command has the following general form:
.CS


\fIexpanderName\fR option ?\fIarg arg ...\fR?

.CE
.IP
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.PP
.PP
The following commands are possible for expander objects:
.TP
\fIexpanderName\fR \fBcappend\fR \fItext\fR
Appends a string to the output in the current context.  This command
should rarely be used by macros or application code.
.TP
\fIexpanderName\fR \fBcget\fR \fIvarname\fR
Retrieves the value of variable \fIvarname\fR, defined in the current
context.
.TP
\fIexpanderName\fR \fBcis\fR \fIcname\fR
Determines whether or not the name of the current context is
\fIcname\fR.
.TP
\fIexpanderName\fR \fBcname\fR
Returns the name of the current context.
.TP
\fIexpanderName\fR \fBcpop\fR \fIcname\fR
Pops a context from the context stack, returning all accumulated
output in that context.  The context must be named \fIcname\fR, or an
error results.
.TP
\fIexpanderName\fR \fBctopandclear\fR
Returns the output currently captured in the topmost context and
clears that buffer. This is similar to a combination of \fBcpop\fR
followed by \fBcpush\fR, except that internal state (brackets) is
preserved here.
.TP
\fIexpanderName\fR \fBcpush\fR \fIcname\fR
Pushes a context named \fIcname\fR onto the context stack.  The
context must be popped by \fBcpop\fR before expansion ends or an
error results.
.TP
\fIexpanderName\fR \fBcset\fR \fIvarname\fR \fIvalue\fR
Sets variable \fIvarname\fR to \fIvalue\fR in the current context.
.TP
\fIexpanderName\fR \fBcvar\fR \fIvarname\fR
Retrieves the internal variable name of context variable
\fIvarname\fR; this allows the variable to be passed to commands like
\fBlappend\fR.
.TP
\fIexpanderName\fR \fBerrmode\fR \fInewErrmode\fR
Sets the macro expansion error mode to one of \fBnothing\fR,
\fBmacro\fR, \fBerror\fR, or \fBfail\fR; the default value is
\fBfail\fR.  The value determines what the expander does if an
error is detected during expansion of a macro.
.RS
.TP
\fBfail\fR
The error propagates normally and can be caught or ignored by the
application.
.TP
\fBerror\fR
The macro expands into a detailed error message, and expansion
continues.
.TP
\fBmacro\fR
The macro expands to itself; that is, it is passed along to the output
unchanged.
.TP
\fBnothing\fR
The macro expands to the empty string, and is effectively ignored.
.RE
.sp
.TP
\fIexpanderName\fR \fBevalcmd\fR ?\fInewEvalCmd\fR?
Returns the current evaluation command, which defaults to
\fBuplevel #0\fR.  If specified, \fInewEvalCmd\fR will be saved for
future use and then returned; it must be a Tcl command expecting one
additional argument: the macro to evaluate.
.TP
\fIexpanderName\fR \fBexpand\fR \fIstring\fR ?\fIbrackets\fR?
Expands the input string, replacing embedded macros with their
expanded values, and returns the expanded string.
.sp
If \fIbrackets\fR is given, it must be a list of two strings; the
items will be used as the left and right macro expansion bracket
sequences for this expansion only.
.TP
\fIexpanderName\fR \fBlb\fR ?\fInewbracket\fR?
Returns the current value of the left macro expansion bracket; this is
for use as or within a macro, when the bracket needs to be included in
the output text.  If \fInewbracket\fR is specified, it becomes the new
bracket, and is returned.
.TP
\fIexpanderName\fR \fBrb\fR ?\fInewbracket\fR?
Returns the current value of the right macro expansion bracket; this
is for use as or within a macro, when the bracket needs to be included
in the output text.  If \fInewbracket\fR is specified, it becomes the
new bracket, and is returned.
.TP
\fIexpanderName\fR \fBreset\fR
Resets all expander settings to their initial values.  Unusual results
are likely if this command is called from within a call to
\fBexpand\fR.
.TP
\fIexpanderName\fR \fBsetbrackets\fR \fIlbrack rbrack\fR
Sets the left and right macro expansion brackets.  This command is for
use as or within a macro, or to permanently change the bracket
definitions.  By default, the brackets are \fB[\fR and
\fB]\fR, but any non-empty string can be used; for example,
\fB<\fR and \fB>\fR or \fB(*\fR and \fB*)\fR or even
\fBHello,\fR and \fBWorld!\fR.
.TP
\fIexpanderName\fR \fBtextcmd\fR ?\fInewTextCmd\fR?
Returns the current command for processing plain text, which defaults
to the empty string, meaning \fIidentity\fR. If specified,
\fInewTextCmd\fR will be saved for future use and then returned; it
must be a Tcl command expecting one additional argument: the text to
process. The expander object will this command for all plain text it
encounters, giving the user of the object the ability to process all
plain text in some standard way before writing it to the output. The
object expects that the command returns the processed plain text.
.sp
\fINote\fR that the combination of "\fBtextcmd\fR \fIplaintext\fR"
is run through the \fIevalcmd\fR for the actual evaluation. In other
words, the \fItextcmd\fR is treated as a special macro implicitly
surrounding all plain text in the template.
.TP
\fIexpanderName\fR \fBwhere\fR
Returns a three-element list containing the current character
position, line, and column the expander is at in the processing of the
current input string.
.PP
.SH TUTORIAL
.SS BASICS
To begin, create an expander object:
.PP
.CS


    % package require expander
    1.2
    % ::expander::expander myexp
    ::myexp
    %

.CE
.PP
The created \fB::myexp\fR object can be used to expand text strings
containing embedded Tcl commands.  By default, embedded commands are
delimited by square brackets.  Note that expander doesn't attempt to
interpolate variables, since variables can be referenced by embedded
commands:
.PP
.CS


    % set greeting "Howdy"
    Howdy
    % proc place {} {return "World"}
    % ::myexp expand {[set greeting], [place]!}
    Howdy, World!
    %

.CE
.SS "EMBEDDING MACROS"
An expander macro is simply a Tcl script embedded within a text
string.  Expander evaluates the script in the global context, and
replaces it with its result string.  For example,
.PP
.CS


    % set greetings {Howdy Hi "What's up"}
    Howdy Hi "What's up"
    % ::myexp expand {There are many ways to say "Hello, World!":
    [set result {}
    foreach greeting $greetings {
	append result "$greeting, World!\\\\n"
    }
    set result]
    And that's just a small sample!}
    There are many ways to say "Hello, World!":
    Howdy, World!
    Hi, World!
    What's up, World!

    And that's just a small sample!
    %

.CE
.SS "WRITING MACRO COMMANDS"
More typically, \fImacro commands\fR are used to create a markup
language.  A macro command is just a Tcl command that returns an
output string.  For example, expand can be used to implement a generic
document markup language that can be retargeted to HTML or any other
output format:
.PP
.CS


    % proc bold {} {return "<b>"}
    % proc /bold {} {return "</b>"}
    % ::myexp expand {Some of this text is in [bold]boldface[/bold]}
    Some of this text is in <b>boldface</b>
    %

.CE
.PP
The above definitions of \fBbold\fR and \fB/bold\fR returns HTML, but
such commands can be as complicated as needed; they could, for
example, decide what to return based on the desired output format.
.SS "CHANGING THE EXPANSION BRACKETS"
By default, embedded macros are enclosed in square brackets,
\fB[\fR and \fB]\fR.  If square brackets need to be
included in the output, the input can contain the \fBlb\fR and
\fBrb\fR commands.  Alternatively, or if square brackets are
objectionable for some other reason, the macro expansion brackets can
be changed to any pair of non-empty strings.
.PP
The \fBsetbrackets\fR command changes the brackets permanently.
For example, you can write pseudo-html by change them to \fB<\fR
and \fB>\fR:
.PP
.CS


    % ::myexp setbrackets < >
    % ::myexp expand {<bold>This is boldface</bold>}
    <b>This is boldface</b>

.CE
.PP
Alternatively, you can change the expansion brackets temporarily by
passing the desired brackets to the \fBexpand\fR command:
.PP
.CS


    % ::myexp setbrackets "\\\\[" "\\\\]"
    % ::myexp expand {<bold>This is boldface</bold>} {< >}
    <b>This is boldface</b>
    %

.CE
.SS "CUSTOMIZED MACRO EXPANSION"
By default, macros are evaluated using the Tcl \fBuplevel #0\fR
command, so that the embedded code executes in the global context.
The application can provide a different evaluation command using
\fBevalcmd\fR; this allows the application to use a safe
interpreter, for example, or even to evaluated something other than
Tcl code.  There is one caveat: to be recognized as valid, a macro
must return 1 when passed to Tcl's "info complete" command.
.PP
For example, the following code "evaluates" each macro by returning
the macro text itself.
.PP
.CS


    proc identity {macro} {return $macro}
    ::myexp evalcmd identity

.CE
.SS "USING THE CONTEXT STACK"
Often it's desirable to define a pair of macros which operate in some
way on the plain text between them.  Consider a set of macros for
adding footnotes to a web page: one could have implement something
like this:
.PP
.CS


    Dr. Pangloss, however, thinks that this is the best of all
    possible worlds.[footnote "See Candide, by Voltaire"]

.CE
.PP
The \fBfootnote\fR macro would, presumably, assign a number to this
footnote and save the text to be formatted later on.  However, this
solution is ugly if the footnote text is long or should contain
additional markup.  Consider the following instead:
.PP
.CS


    Dr. Pangloss, however, thinks that this is the best of all
    possible worlds.[footnote]See [bookTitle "Candide"], by
    [authorsName "Voltaire"], for more information.[/footnote]

.CE
.PP
Here the footnote text is contained between \fBfootnote\fR and
\fB/footnote\fR macros, continues onto a second line, and contains
several macros of its own.  This is both clearer and more flexible;
however, with the features presented so far there's no easy way to do
it.  That's the purpose of the context stack.
.PP
All macro expansion takes place in a particular context.  Here, the
\fBfootnote\fR macro pushes a new context onto the context stack.
Then, all expanded text gets placed in that new context.
\fB/footnote\fR retrieves it by popping the context.  Here's a
skeleton implementation of these two macros:
.PP
.CS


    proc footnote {} {
        ::myexp cpush footnote
    }

    proc /footnote {} {
        set footnoteText [::myexp cpop footnote]

        # Save the footnote text, and return an appropriate footnote
        # number and link.
    }

.CE
.PP
The \fBcpush\fR command pushes a new context onto the stack; the
argument is the context's name.  It can be any string, but would
typically be the name of the macro itself.  Then, \fBcpop\fR
verifies that the current context has the expected name, pops it off
of the stack, and returns the accumulated text.
.PP
Expand provides several other tools related to the context stack.
Suppose the first macro in a context pair takes arguments or computes
values which the second macro in the pair needs.  After calling
\fBcpush\fR, the first macro can define one or more context
variables; the second macro can retrieve their values any time before
calling \fBcpop\fR.  For example, suppose the document must specify
the footnote number explicitly:
.PP
.CS


    proc footnote {footnoteNumber} {
        ::myexp cpush footnote
        ::myexp csave num $footnoteNumber
        # Return an appropriate link
    }

    proc /footnote {} {
        set footnoteNumber [::myexp cget num]
        set footnoteText [::myexp cpop footnote]

        # Save the footnote text and its footnoteNumber for future
        # output.
    }

.CE
.PP
At times, it might be desirable to define macros that are valid only
within a particular context pair; such macros should verify that they
are only called within the correct context using either \fBcis\fR
or \fBcname\fR.
.SH HISTORY
\fBexpander\fR was written by William H. Duquette; it is a repackaging
of the central algorithm of the expand macro processing tool.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItextutil :: expander\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
\fIhttp://www.wjduquette.com/expand\fR, regexp, split, string
.SH KEYWORDS
string, template processing, text expansion
.SH CATEGORY
Documentation tools
.SH COPYRIGHT
.nf
Copyright (c) William H. Duquette, http://www.wjduquette.com/expand

.fi

Added embedded/man/files/modules/textutil/repeat.n.































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/textutil/repeat.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "textutil::repeat" n 0.7.1 tcllib "Text and string utilities, macro processing"
.BS
.SH NAME
textutil::repeat \- Procedures to repeat strings.
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil::repeat  ?0.7?\fR
.sp
\fB::textutil::repeat::strRepeat\fR \fItext\fR \fInum\fR
.sp
\fB::textutil::repeat::blank\fR \fInum\fR
.sp
.BE
.SH DESCRIPTION
The package \fBtextutil::repeat\fR provides commands to generate
long strings by repeating a shorter string many times.
.PP
The complete set of procedures is described below.
.TP
\fB::textutil::repeat::strRepeat\fR \fItext\fR \fInum\fR
This command returns a string containing the \fItext\fR repeated
\fInum\fR times. The repetitions are joined without characters between
them. A value of \fInum\fR <= 0 causes the command to return an empty
string.
.sp
\fINote\fR: If the Tcl core the package is loaded in provides the
command \fBstring repeat\fR then this command will be implemented in
its terms, for maximum possible speed. Otherwise a fast implementation
in Tcl will be used.
.TP
\fB::textutil::repeat::blank\fR \fInum\fR
A convenience command. Returns a string of \fInum\fR spaces.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItextutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
regexp(n), split(n), string(n)
.SH KEYWORDS
blanks, repetition, string
.SH CATEGORY
Text processing

Added embedded/man/files/modules/textutil/tabify.n.
























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/textutil/tabify.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "textutil::tabify" n 0.7 tcllib "Text and string utilities, macro processing"
.BS
.SH NAME
textutil::tabify \- Procedures to (un)tabify strings
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil::tabify  ?0.7?\fR
.sp
\fB::textutil::tabify::tabify\fR \fIstring\fR ?\fInum\fR?
.sp
\fB::textutil::tabify::tabify2\fR \fIstring\fR ?\fInum\fR?
.sp
\fB::textutil::tabify::untabify\fR \fIstring\fR ?\fInum\fR?
.sp
\fB::textutil::tabify::untabify2\fR \fIstring\fR ?\fInum\fR?
.sp
.BE
.SH DESCRIPTION
The package \fBtextutil::tabify\fR provides commands that convert
between tabulation and ordinary whitespace in strings.
.PP
The complete set of procedures is described below.
.TP
\fB::textutil::tabify::tabify\fR \fIstring\fR ?\fInum\fR?
Tabify the \fIstring\fR by replacing any substring of \fInum\fR space
chars by a tabulation and return the result as a new string. \fInum\fR
defaults to 8.
.TP
\fB::textutil::tabify::tabify2\fR \fIstring\fR ?\fInum\fR?
Similar to \fB::textutil::tabify\fR this command tabifies the
\fIstring\fR and returns the result as a new string. A different
algorithm is used however. Instead of replacing any substring of
\fInum\fR spaces this command works more like an editor. \fInum\fR
defaults to 8.
.sp
Each line of the text in \fIstring\fR is treated as if there are
tabstops every \fInum\fR columns. Only sequences of space characters
containing more than one space character and found immediately before
a tabstop are replaced with tabs.
.TP
\fB::textutil::tabify::untabify\fR \fIstring\fR ?\fInum\fR?
Untabify the \fIstring\fR by replacing any tabulation char by a
substring of \fInum\fR space chars and return the result as a new
string. \fInum\fR defaults to 8.
.TP
\fB::textutil::tabify::untabify2\fR \fIstring\fR ?\fInum\fR?
Untabify the \fIstring\fR by replacing any tabulation char by a
substring of at most \fInum\fR space chars and return the result as a
new string. Unlike \fBtextutil::tabify::untabify\fR each tab is not
replaced by a fixed number of space characters.  The command overlays
each line in the \fIstring\fR with tabstops every \fInum\fR columns
instead and replaces tabs with just enough space characters to reach
the next tabstop. This is the complement of the actions taken by
\fB::textutil::tabify::tabify2\fR. \fInum\fR defaults to 8.
.sp
There is one asymmetry though: A tab can be replaced with a single
space, but not the other way around.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItextutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
regexp(n), split(n), string(n)
.SH KEYWORDS
formatting, string, tabstops
.SH CATEGORY
Text processing

Added embedded/man/files/modules/textutil/textutil.n.



























































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/textutil/textutil.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "textutil" n 0.7.1 tcllib "Text and string utilities, macro processing"
.BS
.SH NAME
textutil \- Procedures to manipulate texts and strings.
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil  ?0.7.1?\fR
.sp
\fB::textutil::adjust\fR \fIstring args\fR
.sp
\fB::textutil::adjust::readPatterns\fR \fIfilename\fR
.sp
\fB::textutil::adjust::listPredefined\fR
.sp
\fB::textutil::adjust::getPredefined\fR \fIfilename\fR
.sp
\fB::textutil::indent\fR \fIstring\fR \fIprefix\fR ?\fIskip\fR?
.sp
\fB::textutil::undent\fR \fIstring\fR
.sp
\fB::textutil::splitn\fR \fIstring\fR ?\fIlen\fR?
.sp
\fB::textutil::splitx\fR \fIstring\fR ?\fIregexp\fR?
.sp
\fB::textutil::tabify\fR \fIstring\fR ?\fInum\fR?
.sp
\fB::textutil::tabify2\fR \fIstring\fR ?\fInum\fR?
.sp
\fB::textutil::trim\fR \fIstring\fR ?\fIregexp\fR?
.sp
\fB::textutil::trimleft\fR \fIstring\fR ?\fIregexp\fR?
.sp
\fB::textutil::trimright\fR \fIstring\fR ?\fIregexp\fR?
.sp
\fB::textutil::trimPrefix\fR \fIstring\fR \fIprefix\fR
.sp
\fB::textutil::trimEmptyHeading\fR \fIstring\fR
.sp
\fB::textutil::untabify\fR \fIstring\fR ?\fInum\fR?
.sp
\fB::textutil::untabify2\fR \fIstring\fR ?\fInum\fR?
.sp
\fB::textutil::strRepeat\fR \fItext num\fR
.sp
\fB::textutil::blank\fR \fInum\fR
.sp
\fB::textutil::chop\fR \fIstring\fR
.sp
\fB::textutil::tail\fR \fIstring\fR
.sp
\fB::textutil::cap\fR \fIstring\fR
.sp
\fB::textutil::uncap\fR \fIstring\fR
.sp
\fB::textutil::longestCommonPrefixList\fR \fIlist\fR
.sp
\fB::textutil::longestCommonPrefix\fR ?\fIstring\fR...?
.sp
.BE
.SH DESCRIPTION
The package \fBtextutil\fR provides commands that manipulate
strings or texts (a.k.a. long strings or string with embedded newlines
or paragraphs).
It is actually a bundle providing the commands of the six packages
.TP
\fBtextutil::adjust\fR
.TP
\fBtextutil::repeat\fR
.TP
\fBtextutil::split\fR
.TP
\fBtextutil::string\fR
.TP
\fBtextutil::tabify\fR
.TP
\fBtextutil::trim\fR
.PP
in the namespace \fBtextutil\fR.
.PP
The bundle is \fIdeprecated\fR, and it will be removed in a future
release of Tcllib, after the next release. It is recommended to use the
relevant sub packages instead for whatever functionality is needed by
the using package or application.
.PP
The complete set of procedures is described below.
.TP
\fB::textutil::adjust\fR \fIstring args\fR
Do a justification on the \fIstring\fR according to \fIargs\fR.  The
string is taken as one big paragraph, ignoring any newlines.  Then the
line is formatted according to the options used, and the command
return a new string with enough lines to contain all the printable
chars in the input string. A line is a set of chars between the
beginning of the string and a newline, or between 2 newlines, or
between a newline and the end of the string. If the input string is
small enough, the returned string won't contain any newlines.
.sp
Together with \fB::textutil::indent\fR it is possible to create
properly wrapped paragraphs with arbitrary indentations.
.sp
By default, any occurrence of spaces characters or tabulation are
replaced by a single space so each word in a line is separated from
the next one by exactly one space char, and this forms a \fIreal\fR
line. Each \fIreal\fR line is placed in a \fIlogical\fR line, which
have exactly a given length (see \fB-length\fR option below). The
\fIreal\fR line may have a lesser length. Again by default, any
trailing spaces are ignored before returning the string (see
\fB-full\fR option below). The following options may be used after the
\fIstring\fR parameter, and change the way the command place a
\fIreal\fR line in a \fIlogical\fR line.
.RS
.TP
-full \fIboolean\fR
If set to \fBfalse\fR, any trailing space chars are deleted before
returning the string. If set to \fBtrue\fR, any trailing space
chars are left in the string. Default to \fBfalse\fR.
.TP
\fB-hyphenate\fR \fIboolean\fR
if set to \fBfalse\fR, no hyphenation will be done. If set to
\fBtrue\fR, the last word of a line is tried to be hyphenated.
Defaults to \fBfalse\fR. Note: hyphenation patterns must be loaded
prior, using the command \fB::textutil::adjust::readPatterns\fR.
.TP
\fB-justify\fR \fBcenter|left|plain|right\fR
Set the justification of the returned string to \fBcenter\fR,
\fBleft\fR, \fBplain\fR or \fBright\fR. By default, it is set to
\fBleft\fR.  The justification means that any line in the returned
string but the last one is build according to the value. If the
justification is set to \fBplain\fR and the number of printable
chars in the last line is less than 90% of the length of a line (see
\fB-length\fR), then this line is justified with the \fBleft\fR
value, avoiding the expansion of this line when it is too small. The
meaning of each value is:
.RS
.TP
\fBcenter\fR
The real line is centered in the logical line. If needed, a set of
space characters are added at the beginning (half of the needed set)
and at the end (half of the needed set) of the line if required (see
the option \fB-full\fR).
.TP
\fBleft\fR
The real line is set on the left of the logical line. It means that
there are no space chars at the beginning of this line. If required,
all needed space chars are added at the end of the line (see the
option \fB-full\fR).
.TP
\fBplain\fR
The real line is exactly set in the logical line. It means that there
are no leading or trailing space chars. All the needed space chars are
added in the \fIreal\fR line, between 2 (or more) words.
.TP
\fBright\fR
The real line is set on the right of the logical line. It means that
there are no space chars at the end of this line, and there may be
some space chars at the beginning, despite of the \fB-full\fR option.
.RE
.TP
\fB-length\fR \fIinteger\fR
Set the length of the \fIlogical\fR line in the string to
\fIinteger\fR.  \fIinteger\fR must be a positive integer
value. Defaults to \fB72\fR.
.TP
\fB-strictlength\fR \fIboolean\fR
If set to \fBfalse\fR, a line can exceed the specified
\fB-length\fR if a single word is longer than \fB-length\fR. If
set to \fBtrue\fR, words that are longer than \fB-length\fR are
split so that no line exceeds the specified \fB-length\fR. Defaults
to \fBfalse\fR.
.RE
.TP
\fB::textutil::adjust::readPatterns\fR \fIfilename\fR
Loads the internal storage for hyphenation patterns with the contents
of the file \fIfilename\fR. This has to be done prior to calling
command \fB::textutil::adjust\fR with
"\fB-hyphenate\fR \fBtrue\fR", or the hyphenation process will
not work correctly.
.sp
The package comes with a number of predefined pattern files, and the
command \fB::textutil::adjust::listPredefined\fR can be used to find
out their names.
.TP
\fB::textutil::adjust::listPredefined\fR
This command returns a list containing the names of the hyphenation
files coming with this package.
.TP
\fB::textutil::adjust::getPredefined\fR \fIfilename\fR
Use this command to query the package for the full path name of the
hyphenation file \fIfilename\fR coming with the package. Only the
filenames found in the list returned by
\fB::textutil::adjust::listPredefined\fR are legal arguments for this
command.
.TP
\fB::textutil::indent\fR \fIstring\fR \fIprefix\fR ?\fIskip\fR?
Each line in the \fIstring\fR indented by adding the string
\fIprefix\fR at its beginning. The modified string is returned
as the result of the command.
.sp
If \fIskip\fR is specified the first \fIskip\fR lines are left
untouched. The default for \fIskip\fR is \fB0\fR, causing the
modification of all lines. Negative values for \fIskip\fR are treated
like \fB0\fR. In other words, \fIskip\fR > \fB0\fR creates a
hanging indentation.
.sp
Together with \fB::textutil::adjust\fR it is possible to create
properly wrapped paragraphs with arbitrary indentations.
.TP
\fB::textutil::undent\fR \fIstring\fR
The command computes the common prefix for all
lines in \fIstring\fR consisting solely out of whitespace,
removes this from each line and returns the modified string.
.sp
Lines containing only whitespace are always reduced to completely
empty lines. They and empty lines are also ignored when computing the
prefix to remove.
.sp
Together with \fB::textutil::adjust\fR it is possible to create
properly wrapped paragraphs with arbitrary indentations.
.TP
\fB::textutil::splitn\fR \fIstring\fR ?\fIlen\fR?
This command splits the given \fIstring\fR into chunks of \fIlen\fR
characters and returns a list containing these chunks. The argument
\fIlen\fR defaults to \fB1\fR if none is specified. A negative
length is not allowed and will cause the command to throw an
error. Providing an empty string as input is allowed, the command will
then return an empty list. If the length of the \fIstring\fR is not an
entire multiple of the chunk length, then the last chunk in the
generated list will be shorter than \fIlen\fR.
.TP
\fB::textutil::splitx\fR \fIstring\fR ?\fIregexp\fR?
Split the \fIstring\fR and return a list. The string is split
according to the regular expression \fIregexp\fR instead of a simple
list of chars. Note that if you add parenthesis into the \fIregexp\fR,
the parentheses part of separator would be added into list as
additional element. If the \fIstring\fR is empty the result is the
empty list, like for \fBsplit\fR. If \fIregexp\fR is empty the
\fIstring\fR is split at every character, like \fBsplit\fR does.
The regular expression \fIregexp\fR defaults to "[\\\\t \\\\r\\\\n]+".
.TP
\fB::textutil::tabify\fR \fIstring\fR ?\fInum\fR?
Tabify the \fIstring\fR by replacing any substring of \fInum\fR space
chars by a tabulation and return the result as a new string. \fInum\fR
defaults to 8.
.TP
\fB::textutil::tabify2\fR \fIstring\fR ?\fInum\fR?
Similar to \fB::textutil::tabify\fR this command tabifies the
\fIstring\fR and returns the result as a new string. A different
algorithm is used however. Instead of replacing any substring of
\fInum\fR spaces this command works more like an editor. \fInum\fR
defaults to 8.
.sp
Each line of the text in \fIstring\fR is treated as if there are
tabstops every \fInum\fR columns. Only sequences of space characters
containing more than one space character and found immediately before
a tabstop are replaced with tabs.
.TP
\fB::textutil::trim\fR \fIstring\fR ?\fIregexp\fR?
Remove in \fIstring\fR any leading and trailing substring according to
the regular expression \fIregexp\fR and return the result as a new
string.  This apply on any \fIline\fR in the string, that is any
substring between 2 newline chars, or between the beginning of the
string and a newline, or between a newline and the end of the string,
or, if the string contain no newline, between the beginning and the
end of the string.
The regular expression \fIregexp\fR defaults to "[ \\\\t]+".
.TP
\fB::textutil::trimleft\fR \fIstring\fR ?\fIregexp\fR?
Remove in \fIstring\fR any leading substring according to the regular
expression \fIregexp\fR and return the result as a new string. This
apply on any \fIline\fR in the string, that is any substring between
2 newline chars, or between the beginning of the string and a newline,
or between a newline and the end of the string, or, if the string
contain no newline, between the beginning and the end of the string.
The regular expression \fIregexp\fR defaults to "[ \\\\t]+".
.TP
\fB::textutil::trimright\fR \fIstring\fR ?\fIregexp\fR?
Remove in \fIstring\fR any trailing substring according to the regular
expression \fIregexp\fR and return the result as a new string. This
apply on any \fIline\fR in the string, that is any substring between
2 newline chars, or between the beginning of the string and a newline,
or between a newline and the end of the string, or, if the string
contain no newline, between the beginning and the end of the string.
The regular expression \fIregexp\fR defaults to "[ \\\\t]+".
.TP
\fB::textutil::trimPrefix\fR \fIstring\fR \fIprefix\fR
Removes the \fIprefix\fR from the beginning of \fIstring\fR and
returns the result. The \fIstring\fR is left unchanged if it doesn't
have \fIprefix\fR at its beginning.
.TP
\fB::textutil::trimEmptyHeading\fR \fIstring\fR
Looks for empty lines (including lines consisting of only whitespace)
at the beginning of the \fIstring\fR and removes it. The modified
string is returned as the result of the command.
.TP
\fB::textutil::untabify\fR \fIstring\fR ?\fInum\fR?
Untabify the \fIstring\fR by replacing any tabulation char by a
substring of \fInum\fR space chars and return the result as a new
string. \fInum\fR defaults to 8.
.TP
\fB::textutil::untabify2\fR \fIstring\fR ?\fInum\fR?
Untabify the \fIstring\fR by replacing any tabulation char by a
substring of at most \fInum\fR space chars and return the result as a
new string. Unlike \fBtextutil::untabify\fR each tab is not replaced
by a fixed number of space characters.  The command overlays each line
in the \fIstring\fR with tabstops every \fInum\fR columns instead and
replaces tabs with just enough space characters to reach the next
tabstop. This is the complement of the actions taken by
\fB::textutil::tabify2\fR. \fInum\fR defaults to 8.
.sp
There is one asymmetry though: A tab can be replaced with a single
space, but not the other way around.
.TP
\fB::textutil::strRepeat\fR \fItext num\fR
The implementation depends on the core executing the package. Used
\fBstring repeat\fR if it is present, or a fast tcl implementation
if it is not. Returns a string containing the \fItext\fR repeated
\fInum\fR times. The repetitions are joined without characters between
them. A value of \fInum\fR <= 0 causes the command to return an empty
string.
.TP
\fB::textutil::blank\fR \fInum\fR
A convenience command. Returns a string of \fInum\fR spaces.
.TP
\fB::textutil::chop\fR \fIstring\fR
A convenience command. Removes the last character of \fIstring\fR and
returns the shortened string.
.TP
\fB::textutil::tail\fR \fIstring\fR
A convenience command. Removes the first character of \fIstring\fR and
returns the shortened string.
.TP
\fB::textutil::cap\fR \fIstring\fR
Capitalizes the first character of \fIstring\fR and returns the modified string.
.TP
\fB::textutil::uncap\fR \fIstring\fR
The complementary operation to \fB::textutil::cap\fR. Forces the first
character of \fIstring\fR to lower case and returns the modified
string.
.TP
\fB::textutil::longestCommonPrefixList\fR \fIlist\fR
.TP
\fB::textutil::longestCommonPrefix\fR ?\fIstring\fR...?
Computes the longest common prefix for either the \fIstring\fRs given
to the command, or the strings specified in the single \fIlist\fR, and
returns it as the result of the command.
.sp
If no strings were specified the result is the empty string.  If only
one string was specified, the string itself is returned, as it is its
own longest common prefix.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItextutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
regexp(n), split(n), string(n)
.SH KEYWORDS
TeX, formatting, hyphenation, indenting, paragraph, regular expression, string, trimming
.SH CATEGORY
Text processing

Added embedded/man/files/modules/textutil/textutil_split.n.






































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/textutil/textutil_split.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "textutil::split" n 0.7 tcllib "Text and string utilities, macro processing"
.BS
.SH NAME
textutil::split \- Procedures to split texts
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil::split  ?0.7?\fR
.sp
\fB::textutil::split::splitn\fR \fIstring\fR ?\fIlen\fR?
.sp
\fB::textutil::split::splitx\fR \fIstring\fR ?\fIregexp\fR?
.sp
.BE
.SH DESCRIPTION
The package \fBtextutil::split\fR provides commands that split
strings by size and arbitrary regular expressions.
.PP
The complete set of procedures is described below.
.TP
\fB::textutil::split::splitn\fR \fIstring\fR ?\fIlen\fR?
This command splits the given \fIstring\fR into chunks of \fIlen\fR
characters and returns a list containing these chunks. The argument
\fIlen\fR defaults to \fB1\fR if none is specified. A negative
length is not allowed and will cause the command to throw an
error. Providing an empty string as input is allowed, the command will
then return an empty list. If the length of the \fIstring\fR is not an
entire multiple of the chunk length, then the last chunk in the
generated list will be shorter than \fIlen\fR.
.TP
\fB::textutil::split::splitx\fR \fIstring\fR ?\fIregexp\fR?
This command splits the \fIstring\fR and return a list. The string is
split according to the regular expression \fIregexp\fR instead of a
simple list of chars.
Note that if you parentheses are added into the \fIregexp\fR, the
parentheses part of separator will be added into the result list as
additional element. If the \fIstring\fR is empty the result is the
empty list, like for \fBsplit\fR. If \fIregexp\fR is empty the
\fIstring\fR is split at every character, like \fBsplit\fR does.
The regular expression \fIregexp\fR defaults to "[\\\\t \\\\r\\\\n]+".
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItextutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
regexp(n), split(n), string(n)
.SH KEYWORDS
regular expression, split, string
.SH CATEGORY
Text processing

Added embedded/man/files/modules/textutil/textutil_string.n.





















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/textutil/textutil_string.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "textutil::string" n 0.7 tcllib "Text and string utilities, macro processing"
.BS
.SH NAME
textutil::string \- Procedures to manipulate texts and strings.
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil::string  ?0.7?\fR
.sp
\fB::textutil::string::chop\fR \fIstring\fR
.sp
\fB::textutil::string::tail\fR \fIstring\fR
.sp
\fB::textutil::string::cap\fR \fIstring\fR
.sp
\fB::textutil::string::uncap\fR \fIstring\fR
.sp
\fB::textutil::string::longestCommonPrefixList\fR \fIlist\fR
.sp
\fB::textutil::string::longestCommonPrefix\fR ?\fIstring\fR...?
.sp
.BE
.SH DESCRIPTION
The package \fBtextutil::string\fR provides miscellaneous string
manipulation commands.
.PP
The complete set of procedures is described below.
.TP
\fB::textutil::string::chop\fR \fIstring\fR
A convenience command. Removes the last character of \fIstring\fR and
returns the shortened string.
.TP
\fB::textutil::string::tail\fR \fIstring\fR
A convenience command. Removes the first character of \fIstring\fR and
returns the shortened string.
.TP
\fB::textutil::string::cap\fR \fIstring\fR
Capitalizes the first character of \fIstring\fR and returns the
modified string.
.TP
\fB::textutil::string::uncap\fR \fIstring\fR
The complementary operation to \fB::textutil::string::cap\fR. Forces
the first character of \fIstring\fR to lower case and returns the
modified string.
.TP
\fB::textutil::string::longestCommonPrefixList\fR \fIlist\fR
.TP
\fB::textutil::string::longestCommonPrefix\fR ?\fIstring\fR...?
Computes the longest common prefix for either the \fIstring\fRs given
to the command, or the strings specified in the single \fIlist\fR, and
returns it as the result of the command.
.sp
If no strings were specified the result is the empty string.  If only
one string was specified, the string itself is returned, as it is its
own longest common prefix.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItextutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
regexp(n), split(n), string(n)
.SH KEYWORDS
capitalize, chop, common prefix, formatting, prefix, string, uncapitalize
.SH CATEGORY
Text processing

Added embedded/man/files/modules/textutil/trim.n.





























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/textutil/trim.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "textutil::trim" n 0.7 tcllib "Text and string utilities, macro processing"
.BS
.SH NAME
textutil::trim \- Procedures to trim strings
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtextutil::trim  ?0.7?\fR
.sp
\fB::textutil::trim::trim\fR \fIstring\fR ?\fIregexp\fR?
.sp
\fB::textutil::trim::trimleft\fR \fIstring\fR ?\fIregexp\fR?
.sp
\fB::textutil::trim::trimright\fR \fIstring\fR ?\fIregexp\fR?
.sp
\fB::textutil::trim::trimPrefix\fR \fIstring\fR \fIprefix\fR
.sp
\fB::textutil::trim::trimEmptyHeading\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
The package \fBtextutil::trim\fR provides commands that trim
strings using arbitrary regular expressions.
.PP
The complete set of procedures is described below.
.TP
\fB::textutil::trim::trim\fR \fIstring\fR ?\fIregexp\fR?
Remove in \fIstring\fR any leading and trailing substring according to
the regular expression \fIregexp\fR and return the result as a new
string.  This is done for all \fIlines\fR in the string, that is any
substring between 2 newline chars, or between the beginning of the
string and a newline, or between a newline and the end of the string,
or, if the string contain no newline, between the beginning and the
end of the string.
The regular expression \fIregexp\fR defaults to "[ \\\\t]+".
.TP
\fB::textutil::trim::trimleft\fR \fIstring\fR ?\fIregexp\fR?
Remove in \fIstring\fR any leading substring according to the regular
expression \fIregexp\fR and return the result as a new string. This
apply on any \fIline\fR in the string, that is any substring between
2 newline chars, or between the beginning of the string and a newline,
or between a newline and the end of the string, or, if the string
contain no newline, between the beginning and the end of the string.
The regular expression \fIregexp\fR defaults to "[ \\\\t]+".
.TP
\fB::textutil::trim::trimright\fR \fIstring\fR ?\fIregexp\fR?
Remove in \fIstring\fR any trailing substring according to the regular
expression \fIregexp\fR and return the result as a new string. This
apply on any \fIline\fR in the string, that is any substring between
2 newline chars, or between the beginning of the string and a newline,
or between a newline and the end of the string, or, if the string
contain no newline, between the beginning and the end of the string.
The regular expression \fIregexp\fR defaults to "[ \\\\t]+".
.TP
\fB::textutil::trim::trimPrefix\fR \fIstring\fR \fIprefix\fR
Removes the \fIprefix\fR from the beginning of \fIstring\fR and
returns the result. The \fIstring\fR is left unchanged if it doesn't
have \fIprefix\fR at its beginning.
.TP
\fB::textutil::trim::trimEmptyHeading\fR \fIstring\fR
Looks for empty lines (including lines consisting of only whitespace)
at the beginning of the \fIstring\fR and removes it. The modified
string is returned as the result of the command.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItextutil\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
regexp(n), split(n), string(n)
.SH KEYWORDS
prefix, regular expression, string, trimming
.SH CATEGORY
Text processing

Added embedded/man/files/modules/tie/tie.n.











































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/tie/tie.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004-2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tie" n 1.1 tcllib "Tcl Data Structures"
.BS
.SH NAME
tie \- Array persistence
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBtie  ?1.1?\fR
.sp
\fB::tie::tie\fR \fIarrayvarname\fR \fIoptions\fR... \fIdstype\fR \fIdsname\fR...
.sp
\fB::tie::untie\fR \fIarrayvarname\fR ?\fItoken\fR?
.sp
\fB::tie::info\fR \fBties\fR \fIarrayvarname\fR
.sp
\fB::tie::info\fR \fBtypes\fR
.sp
\fB::tie::info\fR \fBtype\fR \fIdstype\fR
.sp
\fB::tie::register\fR \fIdsclasscmd\fR \fBas\fR \fIdstype\fR
.sp
\fBdsclasscmd\fR \fIobjname\fR ?\fIdsname\fR...?
.sp
\fBds\fR \fBdestroy\fR
.sp
\fBds\fR \fBnames\fR
.sp
\fBds\fR \fBsize\fR
.sp
\fBds\fR \fBget\fR
.sp
\fBds\fR \fBset\fR \fIdict\fR
.sp
\fBds\fR \fBunset\fR ?\fIpattern\fR?
.sp
\fBds\fR \fBsetv\fR \fIindex\fR \fIvalue\fR
.sp
\fBds\fR \fBunsetv\fR \fIindex\fR
.sp
\fBds\fR \fBgetv\fR \fIindex\fR
.sp
.BE
.SH DESCRIPTION
The \fBtie\fR package provides a framework for the creation of
persistent Tcl array variables. It should be noted that the provided
mechanism is generic enough to also allow its usage for the
distribution of the contents of Tcl arrays over multiple threads and
processes, i.e. communication.
.PP
This, persistence and communication, is accomplished by \fItying\fR)
a Tcl array variable to a \fIdata source\fR. Examples of data
sources are other Tcl arrays and files.
.PP
It should be noted that a single Tcl array variable can be tied to
more than one \fIdata source\fR. It is this feature which allows
the framework to be used for communication as well. Just tie several
Tcl arrays in many client processes to a Tcl array in a server and all
changes to any of them will be distributed to all. Less centralized
variants of this are of course possible as well.
.SH "USING TIES"
.SS "TIE API"
This section describes the basic API used to establish and remove ties
between Tcl array variables and data sources. This interface is the
only one a casual user has to be concerned about. The following
sections about the various internal interfaces can be safely skipped.
.TP
\fB::tie::tie\fR \fIarrayvarname\fR \fIoptions\fR... \fIdstype\fR \fIdsname\fR...
This command establishes a tie between the Tcl array whose name is
provided by the argument \fIarrayvarname\fR and the
\fIdata source\fR identified by the \fIdstype\fR and its series of
\fIdsname\fR arguments. All changes made to the Tcl array after this
command returns will be saved to the \fIdata source\fR for
safekeeping (or distribution).
.sp
The result of the command is always a token which identifies the new
tie. This token can be used later to destroy this specific tie.
.RS
.TP
varname \fIarrayvarname\fR (in)
The name of the Tcl array variable to connect the new tie to.
.TP
name|command \fIdstype\fR (in)
This argument specifies the type of the \fIdata source\fR we wish
to access.
The \fIdstype\fR can be one of \fBlog\fR, \fBarray\fR,
\fBremotearray\fR, \fBfile\fR, \fBgrowfile\fR, or
\fBdsource\fR; in addition, the programmer can register additional
data source types.
Each \fIdstype\fR is followed by one or more arguments that identify
the \fIdata source\fR to which the array is to be tied.
.TP
string \fIdsname\fR (in)
The series of \fIdsname\fR arguments coming after the \fIdstype\fR
identifies the \fIdata source\fR we wish to connect to, and has to
be appropriate for the chosen type.
.RE
.sp
The command understands a number of additional options which guide the
process of setting up the connection between Tcl array and
\fIdata source\fR.
.sp
.RS
.TP
\fB-open\fR
The Tcl array for the new tie is \fIloaded\fR from the
\fIdata source\fR, and the previously existing contents of the Tcl
array are erased. Care is taken to \fInot\fR erase the previous
contents should the creation of the tie fail.
.sp
This option and the option \fB-save\fR exclude each other. If
neither this nor option \fB-save\fR are specified then this option
is assumed as default.
.TP
\fB-save\fR
The Tcl array for the new tie is \fIsaved\fR to the
\fIdata source\fR, and the previously existing contents of the
\fIdata source\fR are erased.
.sp
This option and the option \fB-open\fR exclude each other. If
neither this nor option \fB-open\fR are specified then option
\fB-open\fR is assumed as default.
.TP
\fB-merge\fR
Using this option prevents the erasure of any previously existing
content and merges the data instead. It can be specified in
conjunction with either \fB-open\fR or \fB-save\fR. They
determine how data existing in both Tcl array and
\fIdata source\fR, i.e duplicates, are dealt with.
.sp
When used with \fB-open\fR data in the \fIdata source\fR has
precedence.
In other words, for duplicates the data in the \fIdata source\fR is
loaded into the Tcl array.
.sp
When used with \fB-save\fR data in the Tcl array has precedence. In
other words, for duplicates the data in the Tcl array is saved into
the \fIdata source\fR.
.RE
.sp
.TP
\fB::tie::untie\fR \fIarrayvarname\fR ?\fItoken\fR?
This command dissolves one or more ties associated with the Tcl array
named by \fIarrayvarname\fR. If no \fItoken\fR is specified then all
ties to that Tcl array are dissolved. Otherwise only the tie the token
stands for is removed, if it is actually connected to the
array. Trying to remove a specific tie not belonging to the provided
array will cause an error.
.sp
It should be noted that while severing a tie will destroy management
information internal to the package the \fIdata source\fR which was
handled by the tie will not be touched, only closed.
.sp
After the command returns none of changes made to the array will be
saved to the \fIdata source\fR anymore.
.sp
The result of the command is an empty string.
.RS
.TP
varname \fIarrayname\fR (in)
The name of a Tcl array variable which may have ties.
.TP
handle \fItoken\fR (in)
A handle representing a specific tie. This argument is optional.
.RE
.sp
.TP
\fB::tie::info\fR \fBties\fR \fIarrayvarname\fR
This command returns a list of ties associated with the Tcl array
variable named by \fIarrayvarname\fR. The result list will be empty if
the variable has no ties associated with it.
.TP
\fB::tie::info\fR \fBtypes\fR
This command returns a dictionary of registered types, and the class
commands they are associated with.
.TP
\fB::tie::info\fR \fBtype\fR \fIdstype\fR
This command returns the fully resolved class command for a type
name. This means that the command will follow a chain of type
definitions ot its end.
.PP
.SS "STANDARD DATA SOURCE TYPES"
This package provides the six following types as examples and standard
data sources.
.TP
\fBlog\fR
This \fIdata source\fR does not maintain any actual data, nor
persistence. It does not accept any identifying arguments. All changes
are simply logged to \fBstdout\fR.
.TP
\fBarray\fR
This \fIdata source\fR uses a regular Tcl array as the origin of
the persistent data. It accepts a single identifying argument, the
name of this Tcl array. All changes are mirrored to that array.
.TP
\fBremotearray\fR
This \fIdata source\fR is similar to \fBarray\fR. The difference
is that the Tcl array to which we are mirroring is not directly
accessible, but through a \fBsend\fR-like command.
.sp
It accepts three identifying arguments, the name of the other Tcl
array, the command prefix for the \fBsend\fR-like accessor command,
and an identifier for the remote entity hosting the array, in this
order. All changes are mirrored to that array, via the command
prefix. All commands will be executed in the context of the global
namespace.
.sp
\fBsend\fR-like means that the command prefix has to have \fBsend\fR
syntax and semantics. I.e. it is a channel over which we can send
arbitrary commands to some other entity.
The remote array \fIdata source\fR however uses only the commands
\fBset\fR, \fBunset\fR, \fBarray exists\fR, \fBarray names\fR, \fBarray set\fR, and
\fBarray get\fR to retrieve and set values in the remote array.
.sp
The command prefix and the entity id are separate to allow the data
source to use options like \fB-async\fR when assembling the actual
commands.
.sp
Examples of command prefixes, listed with the id of the remote entity,
without options. In reality only the part before the id is the command
prefix:
.RS
.TP
\fBsend\fR \fItkname\fR
The Tcl array is in a remote interpreter and is accessed via Tk's X
communication.
.TP
\fBcomm::comm send\fR \fIhostportid\fR
The Tcl array is in a remote interpreter and is accessed through a
socket.
.TP
\fBthread::send\fR \fIthreadid\fR
The Tcl array is in a remote interpreter in a different thread of this
process.
.RE
.sp
.TP
\fBfile\fR
This \fIdata source\fR uses a single file as origin of the
persistent data. It accepts a single identifying argument, the path to
this file. The file has to be both readable and writable. It may not
exist, the \fIdata source\fR will create it in that case. This (and
only this) situation will require that the directory for the file
exists and is writable as well.
.sp
All changes are saved in the file, as proper Tcl commands, one command
per operation. In other words, the file will always contain a proper
Tcl script.
.sp
If the file exists when the tie using it is set up, then it will be
compacted, i.e. superfluous operations are removed, if the operations
log stored in it contains either at least one operation clearing the
whole array, or at least 1.5 times more operations than entries in the
loaded array.
.TP
\fBgrowfile\fR
This \fIdata source\fR is like \fBfile\fR in terms of the storage
medium for the array data, and how it is configured. In constrast to
the former it however assumes and ensures that the tied array will
never shrink. I.e. the creation of new array entries, and the
modification of existing entries is allowed, but the deletion of
entries is not, and causes the data source to throw errors.
.sp
This restriction allows us to simplify both file format and access to
the file radically. For one, the file is read only once and the
internal cache cannot be invalidated. Second, writing data is reduced
to a simple append, and no compaction step is necessary. The format of
the contents is the string representation of a dictionary which can be
incrementally extended forever at the end.
.TP
\fBdsource\fR
This \fIdata source\fR uses an explicitly specified
\fIdata source object\fR as the source for the persistent
data. It accepts a single identifying argument, the command prefix,
i.e. object command.
.sp
To use this type it is necessary to know how the framework manages
ties and what \fBdata source objects\fR are.
.sp
All changes are delegated to the specified object.
.PP
.SH "CREATING NEW DATA SOURCES"
This section is of no interest to the casual user of ties. Only
developers wishing to create new data sources have to know the
information provided herein.
.SS "DATA SOURCE OBJECTS"
All ties are represented internally by an in-memory object which
mediates between the tie framework and the specific
\fIdata source\fR, like an array, file, etc.
This is the \fIdata source object\fR.
.PP
Its class, the \fBdata source class\fR is \fInot\fR generic,
but specific to the type of the \fIdata source\fR. Writing a new
\fIdata source\fR requires us to write such a class, and then
registering it with the framework as a new type.
.PP
The following subsections describe the various APIs a
\fBdata source class\fR and the objects it generates will have
to follow to be compatible with the tie framework.
.PP
Data source objects are normally automatically created and destroyed
by the framework when a tie is created, or removed. This management
can be explicitly bypassed through the usage of the "dsource" type.
The \fIdata source\fR for this type is a
\fIdata source object\fR itself, and this object is outside of the
scope of the tie framework and not managed by it.
In other words, this type allows the creation of ties which talk to
pre-existing \fIdata source object\fRs, and these objects will
survive the removal of the ties using them as well.
.SS "REGISTERING A NEW DATA SOURCE CLASS"
After a \fBdata source class\fR has been written it is necessary
to register it as a new type with the framework.
.TP
\fB::tie::register\fR \fIdsclasscmd\fR \fBas\fR \fIdstype\fR
Using this command causes the tie framework to remember the class
command \fIdsclasscmd\fR of a \fBdata source class\fR under the
type name \fIdstype\fR.
.sp
After the call the argument \fIdstype\fR of the basic user command
\fB::tie::tie\fR will accept \fIdstype\fR as a type name and translate
it internally to the appropriate class command for the creation of
\fBdata source objects\fR for the new \fIdata source\fR.
.PP
.SS "DATA SOURCE CLASS"
Each data source class is represented by a single command, also called
the \fIclass command\fR, or \fIobject creation command\fR. Its
syntax is
.TP
\fBdsclasscmd\fR \fIobjname\fR ?\fIdsname\fR...?
The first argument of the class command is the name of the
\fIdata source object\fR to create.
The framework itself will always supply the string \fB%AUTO%\fR, to
signal that the class command has to generate not only the object, but
the object name as well.
.sp
This is followed by a series of arguments identifying the data source
the new object is for. These are the same \fIdsname\fR arguments which
are given to the basic user command \fB::tie::tie\fR. Their actual
meaning is dependent on the \fIdata source class\fR.
.sp
The result of the class command has to be the fully-qualified name of
the new \fIdata source object\fR, i.e. the name of the
\fIobject command\fR.
The interface this command has to follow is described in the section
\fBDATA SOURCE OBJECT API\fR
.PP
.PP
.SS "DATA SOURCE OBJECT API"
Please read the section \fBDATA SOURCE CLASS\fR first, to know
how to generate new \fIobject commands\fR.
.PP
Each \fIobject command\fR for a \fIdata source\fR object has to
provide at least the methods listed below for proper inter-operation
with the tie framework. Note that the names of most of the methods
match the subcommands of the builtin \fBarray\fR command.
.PP
.TP
\fBds\fR \fBdestroy\fR
This method is called when the object \fBds\fR is destroyed. It now
has to release all its internal resources associated with the external
data source.
.TP
\fBds\fR \fBnames\fR
This command has to return a list containing the names of all keys
found in the \fIdata source\fR the object talks to. This is
equivalent to \fBarray names\fR.
.TP
\fBds\fR \fBsize\fR
This command has to return an integer number specifying the number of
keys found in the \fIdata source\fR the object talks to. This is
equivalent to \fBarray size\fR.
.TP
\fBds\fR \fBget\fR
This command has to return a dictionary containing the data found in
the \fIdata source\fR the object talks to. This is equivalent to
\fBarray get\fR.
.TP
\fBds\fR \fBset\fR \fIdict\fR
This command takes a dictionary and adds its contents to the data
source the object talks to. This is equivalent to \fBarray set\fR.
.TP
\fBds\fR \fBunset\fR ?\fIpattern\fR?
This command takes a pattern and removes all elements whose keys
matching it from the \fIdata source\fR. If no pattern is specified
it defaults to \fB*\fR, causing the removal of all elements. This
is nearly equivalent to \fBarray unset\fR.
.TP
\fBds\fR \fBsetv\fR \fIindex\fR \fIvalue\fR
This command has to save the \fIvalue\fR in the \fIdata source\fR
the object talks to, under the key \fIindex\fR.
.sp
The result of the command is ignored. If an error is thrown then this
error will show up as error of the set operation which caused the
method call.
.TP
\fBds\fR \fBunsetv\fR \fIindex\fR
This command has to remove the value under the key \fIindex\fR from
the \fIdata source\fR the object talks to.
.sp
The result of the command is ignored. If an error is thrown then this
error will show up as error of the unset operation which caused the
method call.
.TP
\fBds\fR \fBgetv\fR \fIindex\fR
This command has to return the value for the key \fIindex\fR in the
\fIdata source\fR the object talks to.
.PP
And here a small table comparing the \fIdata source\fR methods to
the regular Tcl commands for accessing an array.
.PP
.CS


        Regular Tcl             Data source
        -----------             -----------
        array names a           ds names
        array size  a           ds size
        array get   a           ds get
        array set   a dict      ds set   dict
        array unset a pattern   ds unset ?pattern?
        -----------             -----------
        set a($idx) $val        ds setv   idx val
        unset a($idx)           ds unsetv idx
        $a($idx)                ds getv   idx
        -----------             -----------

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItie\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
array, database, file, metakit, persistence, tie, untie
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2004-2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/tie/tie_std.n.






























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/tie/tie_std.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tie" n 1.1 tcllib "Tcl Data Structures"
.BS
.SH NAME
tie \- Array persistence, standard data sources
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBtie::std::log  ?1.1?\fR
.sp
package require \fBtie::std::array  ?1.1?\fR
.sp
package require \fBtie::std::rarray  ?1.1?\fR
.sp
package require \fBtie::std::file  ?1.1?\fR
.sp
package require \fBtie::std::growfile  ?1.1?\fR
.sp
package require \fBtie::std::dsource  ?1.1?\fR
.sp
.BE
.SH DESCRIPTION
The packages listed as requirements for this document are internal
packages providing the standard data sources of package \fBtie\fR,
as described in section \fISTANDARD DATA SOURCE TYPES\fR of
\fBtie\fR's documentation.
.PP
They are automatically loaded and registered by \fBtie\fR when it
itself is requested, and as such there is no need to request them on
their own, although it is possible to do so.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the packages it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItie\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
array, database, file, metakit, persistence, tie, untie
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/tiff/tiff.n.











































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/tiff/tiff.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005-2006, Aaron Faupell <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tiff" n 0.2.1 tcllib "TIFF image manipulation"
.BS
.SH NAME
tiff \- TIFF reading, writing, and querying and manipulation of meta data
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBtiff  ?0.2.1?\fR
.sp
\fB::tiff::isTIFF\fR \fIfile\fR
.sp
\fB::tiff::byteOrder\fR \fIfile\fR
.sp
\fB::tiff::numImages\fR \fIfile\fR
.sp
\fB::tiff::dimensions\fR \fIfile\fR ?image?
.sp
\fB::tiff::imageInfo\fR \fIfile\fR ?image?
.sp
\fB::tiff::entries\fR \fIfile\fR ?image?
.sp
\fB::tiff::getEntry\fR \fIfile\fR \fIentry\fR ?image?
.sp
\fB::tiff::addEntry\fR \fIfile\fR \fIentry\fR ?image?
.sp
\fB::tiff::deleteEntry\fR \fIfile\fR \fIentry\fR ?image?
.sp
\fB::tiff::getImage\fR \fIfile\fR ?image?
.sp
\fB::tiff::writeImage\fR \fIimage\fR \fIfile\fR ?entry?
.sp
\fB::tiff::nametotag\fR \fInames\fR
.sp
\fB::tiff::tagtoname\fR \fItags\fR
.sp
\fB::tiff::debug\fR \fIfile\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides commands to query, modify, read, and write TIFF images.
TIFF stands for \fITagged Image File Format\fR and is a standard
for lossless storage of photographical images and associated metadata.
It is specified at \fIhttp://partners.adobe.com/public/developer/tiff/index.html\fR.
.PP
Multiple images may be stored in a single TIFF file. The ?image? options to the functions
in this package are for accessing images other than the first. Data in a TIFF image is
stored as a series of tags having a numerical value, which are represented in either a 4 digit
hexadecimal format or a string name. For a reference on defined tags and their meanings see
\fIhttp://www.awaresystems.be/imaging/tiff/tifftags.html\fR
.SH COMMANDS
.TP
\fB::tiff::isTIFF\fR \fIfile\fR
Returns a boolean value indicating if \fIfile\fR is a
TIFF image.
.TP
\fB::tiff::byteOrder\fR \fIfile\fR
Returns either \fBbig\fR or \fBlittle\fR.
Throws an error if \fIfile\fR is not a TIFF image.
.TP
\fB::tiff::numImages\fR \fIfile\fR
Returns the number of images in \fIfile\fR.
Throws an error if \fIfile\fR is not a TIFF image.
.TP
\fB::tiff::dimensions\fR \fIfile\fR ?image?
Returns the dimensions of image number ?image? in \fIfile\fR as a list of the
horizontal and vertical pixel count.
Throws an error if \fIfile\fR is not a TIFF image.
.TP
\fB::tiff::imageInfo\fR \fIfile\fR ?image?
Returns a dictionary with keys \fBImageWidth\fR, \fBImageLength\fR,
\fBBitsPerSample\fR, \fBCompression\fR, \fBPhotometricInterpretation\fR,
\fBImageDescription\fR, \fBOrientation\fR, \fBXResolution\fR,
\fBYResolution\fR, \fBResolutionUnit\fR, \fBDateTime\fR, \fBArtist\fR,
and \fBHostComputer\fR. The values are the associated properties of
the TIFF ?image? in \fIfile\fR. Values may be empty if the associated tag is not
present in the file.
.CS


    puts [::tiff::imageInfo photo.tif]

    ImageWidth 686 ImageLength 1024 BitsPerSample {8 8 8} Compression 1
    PhotometricInterpretation 2 ImageDescription {} Orientation 1
    XResolution 170.667 YResolution 170.667 ResolutionUnit 2 DateTime {2005:12:28 19:44:45}
    Artist {} HostComputer {}

.CE
.IP
There is nothing special about these tags, this is simply a convience procedure which calls
\fBgetEntry\fR with common entries.
Throws an error if \fIfile\fR is not a TIFF image.
.TP
\fB::tiff::entries\fR \fIfile\fR ?image?
Returns a list of all entries in the given \fIfile\fR and ?image?
in hexadecimal format.
Throws an error if \fIfile\fR is not a TIFF image.
.TP
\fB::tiff::getEntry\fR \fIfile\fR \fIentry\fR ?image?
Returns the value of \fIentry\fR from image ?image? in the TIFF \fIfile\fR.
\fIentry\fR may be a list of multiple entries. If an entry does not exist, an
empty string is returned
.CS


    set data [::tiff::getEntry photo.tif {0131 0132}]
    puts "file was written at [lindex $data 0] with software [lindex $data 1]"

.CE
.IP
Throws an error if \fIfile\fR is not a TIFF image.
.TP
\fB::tiff::addEntry\fR \fIfile\fR \fIentry\fR ?image?
Adds the specified entries to the image named by ?image? (default 0), or optionally \fBall\fR.
\fIentry\fR must be a list where each element is a list of tag, type, and value. If a tag already
exists, it is overwritten.
.CS


    ::tiff::addEntry photo.tif {{010e 2 "an example photo"} {013b 2 "Aaron F"}}

.CE
.IP
The data types are defined as follows
.RS
.TP
\fB1\fR
BYTE (8 bit unsigned integer)
.TP
\fB2\fR
ASCII
.TP
\fB3\fR
SHORT (16 bit unsigned integer)
.TP
\fB4\fR
LONG (32 bit unsigned integer)
.TP
\fB5\fR
RATIONAL
.TP
\fB6\fR
SBYTE (8 bit signed byte)
.TP
\fB7\fR
UNDEFINED (uninterpreted binary data)
.TP
\fB8\fR
SSHORT (signed 16 bit integer)
.TP
\fB9\fR
SLONG (signed 32 bit integer)
.TP
\fB10\fR
SRATIONAL
.TP
\fB11\fR
FLOAT (32 bit floating point number)
.TP
\fB12\fR
DOUBLE (64 bit floating point number)
.RE
.IP
Throws an error if \fIfile\fR is not a TIFF image.
.TP
\fB::tiff::deleteEntry\fR \fIfile\fR \fIentry\fR ?image?
Deletes the specified entries from the image named by ?image? (default 0), or optionally \fBall\fR.
Throws an error if \fIfile\fR is not a TIFF image.
.TP
\fB::tiff::getImage\fR \fIfile\fR ?image?
Returns the name of a Tk image containing the image at index ?image? from \fIfile\fR
Throws an error if \fIfile\fR is not a TIFF image, or if image is an unsupported format.
Supported formats are uncompressed 24 bit RGB and uncompressed 8 bit palette.
.TP
\fB::tiff::writeImage\fR \fIimage\fR \fIfile\fR ?entry?
Writes the contents of the Tk image \fIimage\fR to a tiff file \fIfile\fR. Files are
written in the 24 bit uncompressed format, with big endian byte order. Additional entries
to be added to the image may be specified, in the same format as \fBtiff::addEntry\fR
.TP
\fB::tiff::nametotag\fR \fInames\fR
Returns a list with \fInames\fR translated from string to 4 digit format. 4 digit names
in the input are passed through unchanged. Strings without a defined tag name will throw
an error.
.TP
\fB::tiff::tagtoname\fR \fItags\fR
Returns a list with \fItags\fR translated from 4 digit to string format. If a tag does
not have a defined name it is passed through unchanged.
.TP
\fB::tiff::debug\fR \fIfile\fR
Prints everything we know about the given file in a nice format.
.PP
.SH VARIABLES
The mapping of 4 digit tag names to string names uses the array ::tiff::tiff_tags. The reverse
mapping uses the array ::tiff::tiff_sgat.
.SH LIMITATIONS
.IP [1]
Cannot write exif ifd
.IP [2]
Reading limited to uncompressed 8 bit rgb and 8 bit palletized images
.IP [3]
Writing limited to uncompressed 8 bit rgb
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItiff\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
image, tif, tiff
.SH CATEGORY
File formats
.SH COPYRIGHT
.nf
Copyright (c) 2005-2006, Aaron Faupell <[email protected]>

.fi

Added embedded/man/files/modules/transfer/connect.n.


























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/transfer/connect.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "transfer::connect" n 0.2 tcllib "Data transfer facilities"
.BS
.SH NAME
transfer::connect \- Connection setup
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit  ?1.0?\fR
.sp
package require \fBtransfer::connect  ?0.2?\fR
.sp
\fBtransfer::connect\fR \fIobjectName\fR ?\fIoptions\fR...?
.sp
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBconnect\fR \fIcommand\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides objects holding enough information to enable
them to either actively connect to a counterpart, or to passively wait
for a connection from said counterpart.
I.e. any object created by this packages is always in one of two
complementary modes, called \fIactive\fR (the object initiates the
connection) and \fIpassive\fR (the object receives the connection).
.PP
Of the two objects in a connecting pair one has to be configured for
\fIactive\fR mode, and the other then has to be configured for
\fIpassive\fR mode. This establishes which of the two partners
connects to whom (the \fIactive\fR to the other), or, who is waiting
on whom (the \fIpassive\fR on the other).
Note that this is completely independent of the direction of any data
transmission using the connection after it has been established.
An active object can, after establishing the connection, either
transmit or receive data. Equivalently the passive object can do the
same after the waiting for its partner has ended.
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fBtransfer::connect\fR \fIobjectName\fR ?\fIoptions\fR...?
This command creates a new connection object with an associated Tcl
command whose name is \fIobjectName\fR.
This \fIobject\fR command is explained in full detail in the sections
\fBObject command\fR and \fBObject methods\fR. The set of
supported \fIoptions\fR is explained in section \fBOptions\fR.
.sp
The object command will be created under the current namespace if the
\fIobjectName\fR is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::transfer::connect\fR command have the
following general form:
.TP
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object.
This is safe to do for an \fIactive\fR object when a connection has
been started, as the completion callback is synchronous.
For a \fIpassive\fR object currently waiting for its partner to
establish the connection however this is not safe and will cause
errors later on, when the connection setup completes and tries to
access the now missing data structures of the destroyed object.
.TP
\fIobjectName\fR \fBconnect\fR \fIcommand\fR
This method starts the connection setup per the configuration of the
object. When the connection is established the callback \fIcommand\fR
will be invoked with one additional argument, the channel handle of
the socket over which data can be transfered.
.sp
The detailed behaviour of the method depends on the configured
mode.
.RS
.TP
\fIactive\fR
The connection setup is done synchronously. The object waits until the
connection is established. The method returns the empty string as its
result.
.TP
\fIpassive\fR
The connection setup is done asynchronously. The method returns
immediately after a listening socket has been set up. The connection
will be established in the background.
The method returns the port number of the listening socket, for use by
the caller. One important use is the transfer of this information to
the counterpart so that it knows where it has to connect to.
.sp
This is necessary as the object might have been configured for port
\fB0\fR, allowing the operating system to choose the actual port it
will listen on.
.sp
The listening port is closed immediately when the connection was
established by the partner, to keep the time interval small within
which a third party can connect to the port too.
Even so it is recommended to use additional measures in the protocol
outside of the connect and transfer object to ensure that a connection
is not used with an unidentified/unauthorized partner
One possibility for this is the use of SSL/TLS.
See the option \fB-socketcmd\fR and section
\fBSecure connections\fR for information on how to do this.
.RE
.PP
.SS OPTIONS
Connection objects support the set of options listed below.
.TP
\fB-mode\fR \fImode\fR
This option specifies the mode the object is in. It is optional and
defaults to \fBactive\fR mode. The two possible modes are:
.RS
.TP
\fBactive\fR
In this mode the two options \fB-host\fR and \fB-port\fR are
relevant and specify the host and TCP port the object has to connect
to. The host is given by either name or IP address.
.TP
\fBpassive\fR
In this mode the option \fB-host\fR has no relevance and is ignored
should it be configured.
The only option the object needs is \fB-port\fR, and it specifies
the TCP port on which the listening socket is opened to await the
connection from the partner.
.RE
.TP
\fB-host\fR \fIhostname-or-ipaddr\fR
This option specifies the host to connect to in \fIactive\fR mode,
either by name or ip-address. An object configured for \fIpassive\fR
mode ignores this option.
.TP
\fB-port\fR \fIint\fR
For \fIactive\fR mode this option specifies the port the object is
expected to connect to. For \fIpassive\fR mode however it is the port
where the object creates the listening socket waiting for a
connection. It defaults to \fB0\fR, which allows the OS to choose
the actual port to listen on.
.TP
\fB-socketcmd\fR \fIcommand\fR
This option allows the user to specify which command to use to open a
socket. The default is to use the builtin \fB::socket\fR. Any
compatible with that command is allowed.
.sp
The envisioned main use is the specfication of \fBtls::socket\fR. I.e.
this option allows the creation of secure transfer channels, without
making this package explicitly dependent on the \fBtls\fR package.
.sp
See also section \fBSecure connections\fR.
.TP
\fB-encoding\fR encodingname
.TP
\fB-eofchar\fR eofspec
.TP
\fB-translation\fR transspec
These options are the same as are recognized by the builtin command
\fBfconfigure\fR. They provide the configuration to be set for the
channel between the two partners after it has been established, but
before the callback is invoked (See method \fBconnect\fR).
.PP
.SH "SECURE CONNECTIONS"
One way to secure connections made by objects of this package is to
require the package \fBtls\fR and then configure the option
\fB-socketcmd\fR to force the use of command \fBtls::socket\fR to
open the socket.
.CS


    # Load and initialize tls
    package require tls
    tls::init -cafile /path/to/ca/cert -keyfile ...

    # Create a connector with secure socket setup,
    transfer::connect C -socketcmd tls::socket ...
    ...

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItransfer\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
active, channel, connection, passive, secure, ssl, tls, transfer
.SH CATEGORY
Transfer module
.SH COPYRIGHT
.nf
Copyright (c) 2006-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/transfer/copyops.n.









































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/transfer/copyops.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "transfer::copy" n 0.2 tcllib "Data transfer facilities"
.BS
.SH NAME
transfer::copy \- Data transfer foundation
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBtransfer::copy  ?0.2?\fR
.sp
\fBtransfer::copy::do\fR \fBchan\fR|\fBstring\fR \fIdata\fR \fIoutchannel\fR ?\fIoptions\fR...?
.sp
\fBtransfer::copy::chan\fR \fIchannel\fR \fIoutchannel\fR ?\fIoptions\fR...?
.sp
\fBtransfer::copy::string\fR \fIstring\fR \fIoutchannel\fR ?\fIoptions\fR...?
.sp
\fBtransfer::copy::doChan\fR \fIchannel\fR \fIoutchannel\fR \fIoptvar\fR
.sp
\fBtransfer::copy::doString\fR \fIstring\fR \fIoutchannel\fR \fIoptvar\fR
.sp
\fBtransfer::copy::options\fR \fIoutchannel\fR \fIoptionlist\fR \fIoptvar\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a number of commands for the asynchronous of
information contained in either a string or channel. The main point of
this package is that the commands here provide a nicer callback API
than the builtin command \fBfcopy\fR, making the use of these
facilities simpler than the builtin.
.SH API
.TP
\fBtransfer::copy::do\fR \fBchan\fR|\fBstring\fR \fIdata\fR \fIoutchannel\fR ?\fIoptions\fR...?
This command transfers the information in \fIdata\fR to the
\fIoutchannel\fR, according to the \fIoptions\fR. The type of the
information in \fIdata\fR is determined by the first argument.
.sp
The options available to this command are the same as are available to
the command \fBtransfer::copy::options\fR, and explained there.
.RS
.TP
\fBchan\fR
The argument \fIdata\fR contains the handle of a channel and the
actual infomration to transfer is read from that channel.
.TP
\fBstring\fR
The argument \fIdata\fR contains a string and this is the information
to be transfered.
.RE
.TP
\fBtransfer::copy::chan\fR \fIchannel\fR \fIoutchannel\fR ?\fIoptions\fR...?
This command is a shorter and more direct form for the command
\fBtransfer::copy::do chan\fR.
.TP
\fBtransfer::copy::string\fR \fIstring\fR \fIoutchannel\fR ?\fIoptions\fR...?
This command is a shorter and more direct form for the command
\fBtransfer::copy::do string\fR.
.TP
\fBtransfer::copy::doChan\fR \fIchannel\fR \fIoutchannel\fR \fIoptvar\fR
This command is an alternate form of \fBtransfer::copy::chan\fR which
reads its options out of the array variable named by \fIoptvar\fR
instead of from a variable length argument list.
.TP
\fBtransfer::copy::doString\fR \fIstring\fR \fIoutchannel\fR \fIoptvar\fR
This command is an alternate form of \fBtransfer::copy::string\fR which
reads its options out of the array variable named by \fIoptvar\fR
instead of from a variable length argument list.
.TP
\fBtransfer::copy::options\fR \fIoutchannel\fR \fIoptionlist\fR \fIoptvar\fR
This command is the option processor used by all the commands above
which read their options from a variable length argument list. It
first reads default settings from the channel handle \fIoutchannel\fR,
then processes the list of options in \fIoptionlist\fR, at last stores
the results in the array variable named by \fIoptvar\fR. The contents
of that variable are in a format which is directly understood by all
the commands above which read their options out of an array variable.
.sp
The recognized options are:
.RS
.TP
\fB-blocksize\fR \fIint\fR
This option specifies the size of the chunks to transfer in one
operation. It is optional and defaults to the value of
\fB-buffersize\fR as configured for the output channel.
.sp
If specified its value has to be an integer number greater than zero.
.TP
\fB-command\fR \fIcommandprefix\fR
This option specifies the completion callback of the operation. This
option has to be specified. An error will be thrown if it is not, or
if the empty list was specified as argument to it.
.sp
Its value has to be a command prefix, i.e. a list whose first word is
the command to execute, followed by words containing fixed
arguments. When the callback is invoked one or two additional
arguments are appended to the prefix. The first argument is the number
of bytes which were transfered. The optional second argument is an
error message and added if and only if an error occured during the the
transfer.
.TP
\fB-progress\fR \fIcommandprefix\fR
This option specifies the progress callback of the operation. It is
optional and defaults to the empty list. This last possibility signals
that no feedback was asked for and disabled it.
.sp
Its value has to be a command prefix, see above, \fB-command\fR for
a more detailed explanation. When the callback is invoked a single
additional arguments is appended to the prefix. This argument is the
number of bytes which were transfered so far.
.TP
\fB-size\fR \fIint\fR
This option specifies the number of bytes to read from the input data
and transfer. It is optional and defaults to "Transfer everything".
Its value has to be an integer number and any value less than zero has
the same meaning, i.e. to transfer all available data. Any other value
is the amount of bytes to transfer.
.sp
All transfer commands will throw error an when their user tries to
transfer more data than is available in the input. This happens
immediately, before the transfer is actually started, should the input
be a string. Otherwise the, i.e. for a channel as input, the error is
thrown the moment the underflow condition is actually detected.
.TP
\fB-encoding\fR \fIencodingname\fR
.TP
\fB-eofchar\fR \fIeofspec\fR
.TP
\fB-translation\fR \fItransspec\fR
These options are the same as are recognized by the builtin command
\fBfconfigure\fR and provide the settings for the output channel which
are to be active during the transfer, and only then. I.e. the settings
of the output channel before the transfer are saved, and restored at
the end of a transfer, regardless of its success or failure. None of
these options are required, and they default to the settings of the
output channel if not specified.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItransfer\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel, copy, transfer
.SH CATEGORY
Transfer module
.SH COPYRIGHT
.nf
Copyright (c) 2006-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/transfer/ddest.n.
























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/transfer/ddest.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "transfer::data::destination" n 0.2 tcllib "Data transfer facilities"
.BS
.SH NAME
transfer::data::destination \- Data destination
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit  ?1.0?\fR
.sp
package require \fBtransfer::data::destination  ?0.2?\fR
.sp
\fBtransfer::data::destination\fR \fIobjectName\fR ?\fIoptions\fR...?
.sp
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBput\fR \fIchunk\fR
.sp
\fIobjectName\fR \fBdone\fR
.sp
\fIobjectName\fR \fBvalid\fR \fImsgvar\fR
.sp
\fIobjectName\fR \fBreceive\fR \fIchannel\fR \fIdone\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides objects mainly describing the destination of a
data transfer. They are also able to initiate the reception of
information from a channel into the described destination.
.SH API
.TP
\fBtransfer::data::destination\fR \fIobjectName\fR ?\fIoptions\fR...?
This command creates a new data destination object with an associated
Tcl command whose name is \fIobjectName\fR.
This \fIobject\fR command is explained in full detail in the sections
\fBObject command\fR and \fBObject methods\fR. The set of
supported \fIoptions\fR is explained in section \fBOptions\fR.
.sp
The object command will be created under the current namespace if the
\fIobjectName\fR is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::transfer::data::destination\fR command
have the following general form:
.TP
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object. Doing so while the object is busy
with the reception of information from a channel will cause errors
later on, when the reception completes and tries to access the now
missing data structures of the destroyed object.
.TP
\fIobjectName\fR \fBput\fR \fIchunk\fR
The main receptor method. Saves the received \fIchunk\fR of data into
the configured destination. It has to be called for each piece of data
received.
.TP
\fIobjectName\fR \fBdone\fR
The secondary receptor method. Finalizes the receiver. It has to be
called when the receiving channel signals EOF. Afterward neither
itself nor method \fBput\fR can be called anymore.
.TP
\fIobjectName\fR \fBvalid\fR \fImsgvar\fR
This method checks the configuration of the object for validity. It
returns a boolean flag as result, whose value is \fBTrue\fR if the
object is valid, and \fBFalse\fR otherwise. In the latter case the
variable whose name is stored in \fImsgvar\fR is set to an error
message describing the problem found with the configuration. Otherwise
this variable is not touched.
.TP
\fIobjectName\fR \fBreceive\fR \fIchannel\fR \fIdone\fR
This method initiates the reception of data from the specified
\fIchannel\fR. The received data will be stored into the configured
destination, via calls to the methods \fBput\fR and \fBdone\fR.
When the reception completes the command prefix \fIdone\fR is invoked,
with the number of received characters appended to it as the sole
additional argument.
.PP
.SS OPTIONS
All data destinations support the options listed below. It should be
noted that all are semi-exclusive, each specifying a different type of
destination and associated information. If these options are specified
more than once then the last option specified is used to actually
configure the object.
.TP
\fB-channel\fR \fIhandle\fR
This option specifies that the destination of the data is a channel,
and its associated argument is the handle of the channel to write the
received data to.
.TP
\fB-file\fR \fIpath\fR
This option specifies that the destination of the data is a file, and
its associated argument is the path of the file to write the received
data to.
.TP
\fB-variable\fR \fIvarname\fR
This option specifies that the destination of the data is a variable,
and its associated argument contains the name of the variable to write
the received data to. The variable is assumed to be global or
namespaced, anchored at the global namespace.
.TP
\fB-progress\fR \fIcommand\fR
This option, if specified, defines a command to be invoked for each
chunk of bytes received, allowing the user to monitor the progress of
the reception of the data. The callback is always invoked with one
additional argument, the number of bytes received so far.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItransfer\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel, copy, data destination, transfer
.SH CATEGORY
Transfer module
.SH COPYRIGHT
.nf
Copyright (c) 2006-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/transfer/dsource.n.






























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/transfer/dsource.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "transfer::data::source" n 0.2 tcllib "Data transfer facilities"
.BS
.SH NAME
transfer::data::source \- Data source
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit  ?1.0?\fR
.sp
package require \fBtransfer::copy  ?0.2?\fR
.sp
package require \fBtransfer::data::source  ?0.2?\fR
.sp
\fBtransfer::data::source\fR \fIobjectName\fR ?\fIoptions\fR...?
.sp
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBtype\fR
.sp
\fIobjectName\fR \fBdata\fR
.sp
\fIobjectName\fR \fBsize\fR
.sp
\fIobjectName\fR \fBvalid\fR \fImsgvar\fR
.sp
\fIobjectName\fR \fBtransmit\fR \fIchannel\fR \fIblocksize\fR \fIdone\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides objects mainly describing the origin of some
data to transfer. They are also able to initiate transfers of the
described information to a channel using the foundation package
\fBtransfer::copy\fR.
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fBtransfer::data::source\fR \fIobjectName\fR ?\fIoptions\fR...?
This command creates a new data source object with an associated Tcl
command whose name is \fIobjectName\fR.
This \fIobject\fR command is explained in full detail in the sections
\fBObject command\fR and \fBObject methods\fR. The set of
supported \fIoptions\fR is explained in section \fBOptions\fR.
.sp
The object command will be created under the current namespace if the
\fIobjectName\fR is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::transfer::data::source\fR command have
the following general form:
.TP
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object. Doing so while a transfer initiated
by the object is active is safe as all data required for the transfer
itself was copied, and the completion of the transfer will not try to
access the initiating object anymore. i.e. the transfer is completely
separate from the source object itself.
.TP
\fIobjectName\fR \fBtype\fR
This method returns a string describing the type of the data the
object is refering to. The possible values and their meanings are:
.RS
.TP
\fBundefined\fR
No data was specified at all, or it was specified incompletely. The
object does not know the type.
.TP
\fBstring\fR
The data to transfer is contained in a string.
.TP
\fBchannel\fR
The data to transfer is contained in a channel.
.RE
.TP
\fIobjectName\fR \fBdata\fR
This method returns a value depending on the type of the data the
object refers to, through which the data can be accessed.
The method throws an error if the type is \fBundefined\fR. For type
\fBstring\fR the returned result is the data itself, whereas for
type \fBchannel\fR the returned result is the handle of the channel
containing the data.
.TP
\fIobjectName\fR \fBsize\fR
This method returns a value depending on the type of the data the
object refers to, the size of the data.
The method throws an error if the type is \fBundefined\fR. Return of
a negative value signals that the object is unable to determine an
absolute size upfront (like for data in a channel).
.TP
\fIobjectName\fR \fBvalid\fR \fImsgvar\fR
This method checks the configuration of the object for validity. It
returns a boolean flag as result, whose value is \fBTrue\fR if the
object is valid, and \fBFalse\fR otherwise. In the latter case the
variable whose name is stored in \fImsgvar\fR is set to an error
message describing the problem found with the configuration. Otherwise
this variable is not touched.
.TP
\fIobjectName\fR \fBtransmit\fR \fIchannel\fR \fIblocksize\fR \fIdone\fR
This method initiates a transfer of the referenced data to the
specified \fIchannel\fR.
When the transfer completes the command prefix \fIdone\fR is invoked,
per the rules for the option \fB-command\fR of command
\fBtransfer::copy::do\fR in the package \fBtransfer::copy\fR.
The \fIblocksize\fR specifies the size of the chunks to transfer in
one go. See the option \fB-blocksize\fR of command
\fBtransfer::copy::do\fR in the package \fBtransfer::copy\fR.
.PP
.SS OPTIONS
All data sources support the options listed below. It should be noted
that the first four options are semi-exclusive, each specifying a
different type of data source and associated content. If these options
are specified more than once then the last option specified is used to
actually configure the object.
.TP
\fB-string\fR \fItext\fR
This option specifies that the source of the data is an immediate
string, and its associated argument contains the string in question.
.TP
\fB-channel\fR \fIhandle\fR
This option specifies that the source of the data is a channel, and
its associated argument is the handle of the channel containing the
data.
.TP
\fB-file\fR \fIpath\fR
This option specifies that the source of the data is a file, and its
associated argument is the path of the file containing the data.
.TP
\fB-variable\fR \fIvarname\fR
This option specifies that the source of the data is a string stored
in a variable, and its associated argument contains the name of the
variable in question. The variable is assumed to be global or
namespaced, anchored at the global namespace.
.TP
\fB-size\fR \fIint\fR
This option specifies the size of the data transfer. It is optional
and defaults to -1. This value, and any other value less than zero
signals to transfer all the data from the source.
.TP
\fB-progress\fR \fIcommand\fR
This option, if specified, defines a command to be invoked for each
chunk of bytes transmitted, allowing the user to monitor the progress
of the transmission of the data. The callback is always invoked with
one additional argument, the number of bytes transmitted so far.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItransfer\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel, copy, data source, transfer
.SH CATEGORY
Transfer module
.SH COPYRIGHT
.nf
Copyright (c) 2006-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/transfer/receiver.n.











































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/transfer/receiver.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "transfer::receiver" n 0.2 tcllib "Data transfer facilities"
.BS
.SH NAME
transfer::receiver \- Data source
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit  ?1.0?\fR
.sp
package require \fBtransfer::data::destination  ?0.2?\fR
.sp
package require \fBtransfer::connect  ?0.2?\fR
.sp
package require \fBtransfer::receiver  ?0.2?\fR
.sp
\fBtransfer::receiver\fR \fIobject\fR ?\fIoptions\fR...?
.sp
\fBtransfer::receiver\fR \fBstream channel\fR \fIchan\fR \fIhost\fR \fIport\fR ?\fIarg\fR...?
.sp
\fBtransfer::receiver\fR \fBstream file\fR \fIpath\fR \fIhost\fR \fIport\fR ?\fIarg\fR...?
.sp
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBstart\fR
.sp
\fIobjectName\fR \fBbusy\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package pulls data destinations and connection setup together
into a combined object for the reception of information coming in over
a socket.
These objects understand all the options from objects created by the
packages \fBtransfer::data::destination\fR and
\fBtransfer::connect\fR.
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fBtransfer::receiver\fR \fIobject\fR ?\fIoptions\fR...?
This command creates a new receiver object with an associated Tcl
command whose name is \fIobjectName\fR.
This \fIobject\fR command is explained in full detail in the sections
\fBObject command\fR and \fBObject methods\fR. The set of
supported \fIoptions\fR is explained in section \fBOptions\fR.
.sp
The object command will be created under the current namespace if the
\fIobjectName\fR is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.
.TP
\fBtransfer::receiver\fR \fBstream channel\fR \fIchan\fR \fIhost\fR \fIport\fR ?\fIarg\fR...?
This method creates a fire-and-forget transfer for the data coming
from the source at host/port (details below) and writing to the
channel \fIchan\fR, starting at the current seek location. The channel
is configured to use binary translation and encoding for the transfer.
The channel is \fInot\fR closed when the transfer has completed. This
is left to the completion callback.
.sp
If both \fIhost\fR and \fIport\fR are provided an \fBactive\fR
connection to the data source is made. If only a \fIport\fR is
specified (with \fIhost\fR the empty string) then a \fBpassive\fR
connection is made instead, i.e. the receiver then waits for a
conneciton by the transmitter.
.sp
Any arguments after the port are treated as options and are used to
configure the internal receiver object.
See the section \fBOptions\fR for a list of the supported options
and their meaning.
\fINote\fR however that the signature of the command prefix specified
for the \fB-command\fR callback differs from the signature for the
same option of the receiver object.
This callback is only given the number of bytes and transfered, and
possibly an error message. No reference to the internally used
receiver object is made.
.sp
The result returned by the command is the empty string
if it was set to make an \fIactive\fR connection, and the port the
internal receiver object is listening on otherwise, i.e when it is
configured to connect \fIpassive\fRly.
See also the package \fBtransfer::connect\fR and the description
of the method \fBconnect\fR for where this behaviour comes from.
.TP
\fBtransfer::receiver\fR \fBstream file\fR \fIpath\fR \fIhost\fR \fIport\fR ?\fIarg\fR...?
This method is like \fBstream channel\fR, except that the
received data is written to the file \fIpath\fR, replacing any prior
content.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::transfer::receiver\fR command have the
following general form:
.TP
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object. Doing so while a reception is on
progress will cause errors later on, when the reception completes
and tries to access the now missing data structures of the destroyed
object.
.TP
\fIobjectName\fR \fBstart\fR
This method initiates the data reception, setting up the connection
first and then copying the received information into the
destination.
The method will throw an error if a reception is already/still in
progress.
I.e. it is not possible to run two receptions in parallel, only in
sequence.
Errors will also be thrown if the configuration of the data
destination is invalid, or if no completion callback was specified.
.sp
The result returned by the method is the empty string
for an object configured to make an \fIactive\fR connection, and the port the
object is listening on otherwise, i.e when it is
configured to connect \fIpassive\fRly.
See also the package \fBtransfer::connect\fR and the description
of the method \fBconnect\fR for where this behaviour comes from.
.TP
\fIobjectName\fR \fBbusy\fR
This method returns a boolean value telling us whether a reception
is in progress (\fBTrue\fR), or not (\fBFalse\fR).
.PP
.SS OPTIONS
All receiver objects support the union of the options supported by
their connect and data destination components, plus one of their own.
See also the documentation for the packages
\fBtransfer::data::destination\fR and \fBtransfer::connect\fR.
.TP
\fB-command\fR \fIcmdprefix\fR
This option specifies the command to invoke when the reception of
the information has been completed.
The arguments given to this command are the same as given to the
completion callback of the command \fBtransfer::copy::do\fR provided
by the package \fBtransfer::copy\fR.
.TP
\fB-mode\fR \fImode\fR
This option specifies the mode the object is in. It is optional and
defaults to \fBactive\fR mode. The two possible modes are:
.RS
.TP
\fBactive\fR
In this mode the two options \fB-host\fR and \fB-port\fR are
relevant and specify the host and TCP port the object has to connect
to. The host is given by either name or IP address.
.TP
\fBpassive\fR
In this mode the option \fB-host\fR has no relevance and is ignored
should it be configured.
The only option the object needs is \fB-port\fR, and it specifies
the TCP port on which the listening socket is opened to await the
connection from the partner.
.RE
.TP
\fB-host\fR \fIhostname-or-ipaddr\fR
This option specifies the host to connect to in \fIactive\fR mode,
either by name or ip-address. An object configured for \fIpassive\fR
mode ignores this option.
.TP
\fB-port\fR \fIint\fR
For \fIactive\fR mode this option specifies the port the object is
expected to connect to. For \fIpassive\fR mode however it is the port
where the object creates the listening socket waiting for a
connection. It defaults to \fB0\fR, which allows the OS to choose
the actual port to listen on.
.TP
\fB-socketcmd\fR \fIcommand\fR
This option allows the user to specify which command to use to open a
socket. The default is to use the builtin \fB::socket\fR. Any
compatible with that command is allowed.
.sp
The envisioned main use is the specfication of \fBtls::socket\fR. I.e.
this option allows the creation of secure transfer channels, without
making this package explicitly dependent on the \fBtls\fR package.
.sp
See also section \fBSecure connections\fR.
.TP
\fB-encoding\fR encodingname
.TP
\fB-eofchar\fR eofspec
.TP
\fB-translation\fR transspec
These options are the same as are recognized by the builtin command
\fBfconfigure\fR. They provide the configuration to be set for the
channel between the two partners after it has been established, but
before the callback is invoked (See method \fBconnect\fR).
.TP
\fB-channel\fR \fIhandle\fR
This option specifies that the destination of the data is a channel,
and its associated argument is the handle of the channel to write the
received data to.
.TP
\fB-file\fR \fIpath\fR
This option specifies that the destination of the data is a file, and
its associated argument is the path of the file to write the received
data to.
.TP
\fB-variable\fR \fIvarname\fR
This option specifies that the destination of the data is a variable,
and its associated argument contains the name of the variable to write
the received data to. The variable is assumed to be global or
namespaced, anchored at the global namespace.
.TP
\fB-progress\fR \fIcommand\fR
This option, if specified, defines a command to be invoked for each
chunk of bytes received, allowing the user to monitor the progress of
the reception of the data. The callback is always invoked with one
additional argument, the number of bytes received so far.
.PP
.SH "SECURE CONNECTIONS"
One way to secure connections made by objects of this package is to
require the package \fBtls\fR and then configure the option
\fB-socketcmd\fR to force the use of command \fBtls::socket\fR to
open the socket.
.CS


    # Load and initialize tls
    package require tls
    tls::init -cafile /path/to/ca/cert -keyfile ...

    # Create a connector with secure socket setup,
    transfer::receiver R -socketcmd tls::socket ...
    ...

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItransfer\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel, copy, data destination, receiver, secure, ssl, tls, transfer
.SH CATEGORY
Transfer module
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/transfer/tqueue.n.















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/transfer/tqueue.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "transfer::copy::queue" n 0.1 tcllib "Data transfer facilities"
.BS
.SH NAME
transfer::copy::queue \- Queued transfers
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit  ?1.0?\fR
.sp
package require \fBstruct::queue  ?1.4?\fR
.sp
package require \fBtransfer::copy  ?0.2?\fR
.sp
package require \fBtransfer::copy::queue  ?0.1?\fR
.sp
\fBtransfer::copy::queue\fR \fIobjectName\fR \fIoutchannel\fR ?\fIoptions\fR...?
.sp
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBbusy\fR
.sp
\fIobjectName\fR \fBpending\fR
.sp
\fIobjectName\fR \fBput\fR \fIrequest\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides objects which serialize transfer requests for a
single channel by means of a fifo queue. Accumulated requests are
executed in order of entrance, with the first request reaching an idle
object starting the execution in general. New requests can be added
while the object is active and are defered until all requests entered
before them have been completed successfully.
.PP
When a request causes a transfer error execution stops and all
requests coming after it are not served. Currently this means that
their completion callbacks are never triggered at all.
.PP
\fINOTE\fR:
Not triggering the completion callbacks of the unserved
requests after an error stops the queue object is something I
am not fully sure that it makes sense. It forces the user of
the queue to remember the callbacks as well and run
them. Because otherwise everything in the system which depends
on getting a notification about the status of a request will
hang in the air. I am slowly convincing myself that it is more
sensible to trigger the relevant completion callbacks with an
error message about the queue abort, and 0 bytes transfered.
.PP
All transfer requests are of the form
.PP
.CS


	{type data options...}

.CE
.PP
where \fItype\fR is in {\fBchan\fR, \fBstring\fR}, and \fIdata\fR
specifies the information to transfer.
For \fBchan\fR the data is the handle of the channel containing the
actual information to transfer, whereas for \fBstring\fR \fIdata\fR
contains directly the information to transfer.
The \fIoptions\fR are a list of them and their values, and are the
same as are accepted by the low-level copy operations of the package
\fBtransfer::copy\fR.
Note how just prepending the request with \fBtransfer::copy::do\fR and
inserting a channel handle in between \fIdata\fR and \fIoptions\fR
easily transforms it from a pure data structure into a command whose
evaluation will perform the request.
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fBtransfer::copy::queue\fR \fIobjectName\fR \fIoutchannel\fR ?\fIoptions\fR...?
This command creates a new queue object for the management of the
channel \fIoutchannel\fR, with an associated Tcl command whose name is
\fIobjectName\fR.
This \fIobject\fR command is explained in full detail in the sections
\fBObject command\fR and \fBObject methods\fR. The set of
supported \fIoptions\fR is explained in section \fBOptions\fR.
.sp
The object command will be created under the current namespace if the
\fIobjectName\fR is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::transfer::copy::queue\fR command have
the following general form:
.TP
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object. Doing so while the object is busy
will cause errors later on, when the currently executed request
completes and tries to access the now missing data structures of the
destroyed object.
.TP
\fIobjectName\fR \fBbusy\fR
This method returns a boolean value telling us if the object is
currently serving a request (i.e. \fIbusy\fR, value \fBTrue\fR), or
not (i.e. \fIidle\fR, value \fBFalse\fR).
.TP
\fIobjectName\fR \fBpending\fR
This method returns the number of requests currently waiting in the
queue for their execution. A request currently served is not counted
as waiting.
.TP
\fIobjectName\fR \fBput\fR \fIrequest\fR
This method enters the transfer \fIrequest\fR into the object's queue
of waiting requests.
If the object is \fIidle\fR it will become \fIbusy\fR, immediately
servicing the request. Otherwise servicing the new request will be
defered until all preceding requests have been served.
.PP
.SH OPTIONS
The only option known is \fB-on-status-change\fR. It is optional
and defaults to the empty list, disabling the reporting of status
changes. Otherwise its argument is a command prefix which is invoked
whenever the internal status of the object changed. The callback is
invoked with two additional arguments, the result of the methods
\fBpending\fR and \fBbusy\fR, in this order. This allows any
user to easily know, for example, when the object has processed all
outstanding requests.
.SH USE
A possible application of this package and class is within a HTTP 1.1
server, managing the results waiting for transfer to the client.
.PP
It should be noted that in this application the system also needs an
additional data structure which keeps track of outstanding results as
they may come back in a different order than the requests from the
client, and releases them to the actual queue in the proper order.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItransfer\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel, copy, queue, transfer
.SH CATEGORY
Transfer module
.SH COPYRIGHT
.nf
Copyright (c) 2006 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/transfer/transmitter.n.





















































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/transfer/transmitter.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2006-2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "transfer::transmitter" n 0.2 tcllib "Data transfer facilities"
.BS
.SH NAME
transfer::transmitter \- Data source
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBsnit  ?1.0?\fR
.sp
package require \fBtransfer::copy  ?0.2?\fR
.sp
package require \fBtransfer::data::source  ?0.2?\fR
.sp
package require \fBtransfer::connect  ?0.2?\fR
.sp
package require \fBtransfer::transmitter  ?0.2?\fR
.sp
\fBtransfer::transmitter\fR \fIobjectName\fR ?\fIoptions\fR...?
.sp
\fBtransfer::transmitter\fR \fBstream channel\fR \fIchan\fR \fIhost\fR \fIport\fR ?\fIarg\fR...?
.sp
\fBtransfer::transmitter\fR \fBstream file\fR \fIpath\fR \fIhost\fR \fIport\fR ?\fIarg\fR...?
.sp
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
\fIobjectName\fR \fBstart\fR
.sp
\fIobjectName\fR \fBbusy\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package pulls data sources and connection setup together into a
combined object for the transmission of information over a socket.
These objects understand all the options from objects created
by the packages \fBtransfer::data::source\fR and
\fBtransfer::connect\fR.
.SH API
.SS "PACKAGE COMMANDS"
.TP
\fBtransfer::transmitter\fR \fIobjectName\fR ?\fIoptions\fR...?
This command creates a new transmitter object with an associated Tcl
command whose name is \fIobjectName\fR.
This \fIobject\fR command is explained in full detail in the sections
\fBObject command\fR and \fBObject methods\fR. The set of
supported \fIoptions\fR is explained in section \fBOptions\fR.
.sp
The object command will be created under the current namespace if the
\fIobjectName\fR is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.
.TP
\fBtransfer::transmitter\fR \fBstream channel\fR \fIchan\fR \fIhost\fR \fIport\fR ?\fIarg\fR...?
This method creates a fire-and-forget transfer for the data contained
in the channel \fIchan\fR, starting at the current seek location. The
channel is configured to use binary translation and encoding for the
transfer.
The channel is automatically closed when the transfer has completed.
.sp
If both \fIhost\fR and \fIport\fR are provided an \fBactive\fR
connection to the destination is made. If only a \fIport\fR is
specified (with \fIhost\fR the empty string) then a \fBpassive\fR
connection is made instead.
.sp
Any arguments after the port are treated as options and are used to
configure the internal transmitter object.
See the section \fBOptions\fR for a list of the supported options
and their meaning.
\fINote\fR however that the signature of the command prefix specified
for the \fB-command\fR callback differs from the signature for the
same option of the transmitter object.
This callback is only given the number of bytes and transfered, and
possibly an error message. No reference to the internally used
transmitter object is made.
.sp
The result returned by the command is the empty string
if it was set to make an \fIactive\fR connection, and the port the
internal transmitter object is listening on otherwise, i.e when it is
configured to connect \fIpassive\fRly.
See also the package \fBtransfer::connect\fR and the description
of the method \fBconnect\fR for where this behaviour comes from.
.TP
\fBtransfer::transmitter\fR \fBstream file\fR \fIpath\fR \fIhost\fR \fIport\fR ?\fIarg\fR...?
This method is like \fBstream channel\fR, except that the data
contained in the file \fIpath\fR is transfered.
.PP
.SS "OBJECT COMMAND"
All objects created by the \fB::transfer::transmitter\fR command have
the following general form:
.TP
\fIobjectName\fR \fBmethod\fR ?\fIarg arg ...\fR?
The method \fBmethod\fR and its \fIarg\fR'uments determine the
exact behavior of the command.
See section \fBObject methods\fR for the detailed
specifications.
.PP
.SS "OBJECT METHODS"
.TP
\fIobjectName\fR \fBdestroy\fR
This method destroys the object. Doing so while a transmission is in
progress will cause errors later on, when the transmission completes
and tries to access the now missing data structures of the destroyed
object.
.TP
\fIobjectName\fR \fBstart\fR
This method initiates the data transmission, setting up the connection
first and then copying the information.
The method will throw an error if a transmission is already/still in
progress.
I.e. it is not possible to run two transmissions in parallel on a
single object, only in sequence. Multiple transmitter objects are
needed to manage parallel transfers, one per transmission.
Errors will also be thrown if the configuration of the data source is
invalid, or if no completion callback was specified.
.sp
The result returned by the method is the empty string
for an object configured to make an \fIactive\fR connection, and the port the
object is listening on otherwise, i.e when it is
configured to connect \fIpassive\fRly.
See also the package \fBtransfer::connect\fR and the description
of the method \fBconnect\fR for where this behaviour comes from.
.TP
\fIobjectName\fR \fBbusy\fR
This method returns a boolean value telling us whether a transmission
is in progress (\fBTrue\fR), or not (\fBFalse\fR).
.PP
.SS OPTIONS
All transmitter objects support the union of the options supported
by their connect and data source components, plus two of their own.
See also the documentation for the packages
\fBtransfer::data::source\fR and \fBtransfer::connect\fR.
.TP
\fB-blocksize\fR \fIint\fR
This option specifies the size of the chunks to be transmitted in one
block. Usage is optional, its default value is \fB1024\fR.
.TP
\fB-command\fR \fIcmdprefix\fR
This option specifies the command to invoke when the transmission of
the information has been completed.
The arguments given to this command are the same as given to the
completion callback of the command \fBtransfer::copy::do\fR provided
by the package \fBtransfer::copy\fR.
.TP
\fB-mode\fR \fImode\fR
This option specifies the mode the object is in. It is optional and
defaults to \fBactive\fR mode. The two possible modes are:
.RS
.TP
\fBactive\fR
In this mode the two options \fB-host\fR and \fB-port\fR are
relevant and specify the host and TCP port the object has to connect
to. The host is given by either name or IP address.
.TP
\fBpassive\fR
In this mode the option \fB-host\fR has no relevance and is ignored
should it be configured.
The only option the object needs is \fB-port\fR, and it specifies
the TCP port on which the listening socket is opened to await the
connection from the partner.
.RE
.TP
\fB-host\fR \fIhostname-or-ipaddr\fR
This option specifies the host to connect to in \fIactive\fR mode,
either by name or ip-address. An object configured for \fIpassive\fR
mode ignores this option.
.TP
\fB-port\fR \fIint\fR
For \fIactive\fR mode this option specifies the port the object is
expected to connect to. For \fIpassive\fR mode however it is the port
where the object creates the listening socket waiting for a
connection. It defaults to \fB0\fR, which allows the OS to choose
the actual port to listen on.
.TP
\fB-socketcmd\fR \fIcommand\fR
This option allows the user to specify which command to use to open a
socket. The default is to use the builtin \fB::socket\fR. Any
compatible with that command is allowed.
.sp
The envisioned main use is the specfication of \fBtls::socket\fR. I.e.
this option allows the creation of secure transfer channels, without
making this package explicitly dependent on the \fBtls\fR package.
.sp
See also section \fBSecure connections\fR.
.TP
\fB-encoding\fR encodingname
.TP
\fB-eofchar\fR eofspec
.TP
\fB-translation\fR transspec
These options are the same as are recognized by the builtin command
\fBfconfigure\fR. They provide the configuration to be set for the
channel between the two partners after it has been established, but
before the callback is invoked (See method \fBconnect\fR).
.TP
\fB-string\fR \fItext\fR
This option specifies that the source of the data is an immediate
string, and its associated argument contains the string in question.
.TP
\fB-channel\fR \fIhandle\fR
This option specifies that the source of the data is a channel, and
its associated argument is the handle of the channel containing the
data.
.TP
\fB-file\fR \fIpath\fR
This option specifies that the source of the data is a file, and its
associated argument is the path of the file containing the data.
.TP
\fB-variable\fR \fIvarname\fR
This option specifies that the source of the data is a string stored
in a variable, and its associated argument contains the name of the
variable in question. The variable is assumed to be global or
namespaced, anchored at the global namespace.
.TP
\fB-size\fR \fIint\fR
This option specifies the size of the data transfer. It is optional
and defaults to -1. This value, and any other value less than zero
signals to transfer all the data from the source.
.TP
\fB-progress\fR \fIcommand\fR
This option, if specified, defines a command to be invoked for each
chunk of bytes transmitted, allowing the user to monitor the progress
of the transmission of the data. The callback is always invoked with
one additional argument, the number of bytes transmitted so far.
.PP
.SH "SECURE CONNECTIONS"
One way to secure connections made by objects of this package is to
require the package \fBtls\fR and then configure the option
\fB-socketcmd\fR to force the use of command \fBtls::socket\fR to
open the socket.
.CS


    # Load and initialize tls
    package require tls
    tls::init -cafile /path/to/ca/cert -keyfile ...

    # Create a connector with secure socket setup,
    transfer::transmitter T -socketcmd tls::socket ...
    ...

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItransfer\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel, copy, data source, secure, ssl, tls, transfer, transmitter
.SH CATEGORY
Transfer module
.SH COPYRIGHT
.nf
Copyright (c) 2006-2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/treeql/treeql.n.




















































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/treeql/treeql.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004 Colin McCormack <[email protected]>
'\" Copyright (c) 2004 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "treeql" n 1.3.1 tcllib "Tree Query Language"
.BS
.SH NAME
treeql \- Query tree objects
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBsnit \fR
.sp
package require \fBstruct::list \fR
.sp
package require \fBstruct::set \fR
.sp
package require \fBtreeql  ?1.3.1?\fR
.sp
\fBtreeql\fR \fIobjectname\fR \fB-tree\fR \fItree\fR ?\fB-query\fR \fIquery\fR? ?\fB-nodes\fR \fInodes\fR? ?\fIargs\fR...?
.sp
\fIqo\fR \fBquery\fR \fIargs\fR...
.sp
\fIqo\fR \fBresult\fR
.sp
\fIqo\fR \fBdiscard\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides objects which can be used to query and transform
tree objects following the API of tree objects created by the package
\fBstruct::tree\fR.
.PP
The tree query and manipulation language used here, TreeQL, is
inspired by Cost (See section \fBReferences\fR for more
information).
.PP
\fBtreeql\fR, the package, is a fairly thin query facility over
tree-structured data types.  It implements an ordered set of nodes
(really a list) which are generated and filtered through the
application of TreeQL operators to each node in turn.
.SH API
.SS "TREEQL CLASS API"
The command \fBtreeql\fR is a \fBsnit\fR::type which implements
the Treeql Query Language. This means that it follows the API for
class commands as specified by the package \fBsnit\fR.
Its general syntax is
.TP
\fBtreeql\fR \fIobjectname\fR \fB-tree\fR \fItree\fR ?\fB-query\fR \fIquery\fR? ?\fB-nodes\fR \fInodes\fR? ?\fIargs\fR...?
The command creates a new tree query object and returns the fully
qualified name of the object command as its result.
The API the returned command is following is described in the section
\fBTreeQL OBJECT API\fR
.sp
Each query object is associated with a single \fItree\fR object. This
is the object all queries will be run against.
.sp
If the option \fB-nodes\fR was specified then its argument is
treated as a list of nodes. This list is used to initialize the node
set. It defaults to the empty list.
.sp
If the option \fB-query\fR was specified then its argument will be
interpreted as an object, the \fIparent query\fR of this query. It
defaults to the object itself. All queries will be interpreted in the
environment of this object.
.sp
Any arguments coming after the options are treated as a query and run
immediately, after the \fInode set\fR has been initialized. This
uses the same syntax for the query as the method \fBquery\fR.
.sp
The operations of the TreeQL available for this are explained in the
section about \fBThe Tree Query Language\fR. This section also
explains the term \fInode set\fR used above.
.PP
.SS "TREEQL OBJECT API"
As \fBtreeql\fR has been implemented in \fBsnit\fR all the
standard methods of \fBsnit\fR-based classes are available to the
user and therefore not listed here. Please read the documentation for
\fBsnit\fR for what they are and what functionality they provide
.PP
The methods provided by the package \fBtreeql\fR itself are listed
and explained below.
.TP
\fIqo\fR \fBquery\fR \fIargs\fR...
This method interprets its arguments as a series of TreeQL operators
and interpretes them from the left to right (i.e. first to last).
Note that the first operator uses the \fInode set\fR currently
known to the object to perform its actions.
In other words, the \fInode set\fR is \fInot\fR cleared, or
modified in other ways, before the query is run. This allows the user
to run several queries one after the other and have each use the
results of the last. Any initialization has to be done by any query
itself, using TreeQL operators.
The result of the method is the \fInode set\fR after the last
operator of the query has been executed.
.sp
\fINote\fR that uncaught errors will leave the \fInode set\fR of
the object in an intermediate state, per the TreeQL operators which
were executed successfully before the error occurred.
.sp
The above means in detail that:
.RS
.IP [1]
The first argument is interpreted as the name of a query operator, the
number of arguments required by that operator is then determined, and
taken from the immediately following arguments.
.sp
Because of this operators cannot have optional arguments, all
arguments have to be present as defined.  Failure to do this will, at
least, confuse the query interpreter, but more likely cause errors.
.IP [2]
The operator is applied to the current node set, yielding a new node
set, and/or manipulating the tree object the query object is connected
to.
.IP [3]
The arguments used (i.e. operator name and arguments) are removed from
the list of method arguments, and then the whole process is repeated
from step [1], until the list of arguments is empty or an error
occurred.
.RE
.sp
.CS


    # q is the query object.

    q query root children get data

    # The above query
    # - Resets the node set to the root node - root
    # - Adds the children of root to the set - children
    # - Replaces the node set with the       - get data
    #   values for the attribute 'data',
    #   for all nodes in the set which
    #   have such an attribute.
    # - And returns this information.

    # Below we can see the same query, but rewritten
    # to show the structure as it is seen by the query
    # interpreter.

    q query \\\\
	    root \\\\
	    children \\\\
	    get data

.CE
.sp
The operators of the TreeQL language available for this are explained
in the section about \fBThe Tree Query Language\fR. This section
also explains the term \fInode set\fR used above.
.TP
\fIqo\fR \fBresult\fR
This method returns a list containing the current node set.
.TP
\fIqo\fR \fBdiscard\fR
This method returns the current node set (like method
\fBresult\fR), but also destroys the query object (\fIqo\fR).
This is useful when constructing and using sub-queries (%AUTO% objects
immediately destroyed after use).
.PP
.SH "THE TREE QUERY LANGUAGE"
This and the following sections specify the Tree Query Language used
by the query objects of this package in detail.
.PP
First we explain the general concepts underneath the language which
are required to comprehend it. This is followed by the specifications
for all the available query operators. They fall into eight
categories, and each category has its own section.
.PP
.IP [1]
\fBTreeQL Concepts\fR
.IP [2]
\fBStructural generators\fR
.IP [3]
\fBAttribute Filters\fR
.IP [4]
\fBAttribute Mutators\fR
.IP [5]
\fBAttribute String Accessors\fR
.IP [6]
\fBSub-queries\fR
.IP [7]
\fBNode Set Operators\fR
.IP [8]
\fBNode Set Iterators\fR
.IP [9]
\fBTyped node support\fR
.PP
.PP
.SS "TREEQL CONCEPTS"
The main concept which has to be understood is that of the
\fInode set\fR.
Each query object maintains exactly one such \fInode set\fR, and
essentially all operators use it and input argument and for their
result.
This structure simply contains the handles of all nodes which are
currently of interest to the query object.
To name it a \fIset\fR is a bit of a misnomer, because
.IP [1]
A node (handle) can occur in the structure more than once, and
.IP [2]
the order of nodes in the structure is important as well.
Whenever an operator processes all nodes in the node set it will do so
in the order they occur in the structure.
.PP
.PP
Regarding the possible multiple occurrence of a node, consider a node
set containing two nodes A and B, both having node P as their
immediate parent. Application of the TreeQL operator "parent" will
then add P to the new node set twice, once per node it was parent
of. I.e. the new node set will then be {P P}.
.SS "STRUCTURAL GENERATORS"
All tree-structural operators locate nodes in the tree based on a
structural relation ship to the nodes currently in the set and then
replace the current node set with the set of nodes found
Nodes which fulfill such a relationship multiple times are added to
the result as often as they fulfill the relationship.
.PP
It is important to note that the found nodes are collected in a
separate storage area while processing the node set, and are added to
(or replacing) the current node set only after the current node set
has been processed completely.
In other words, the new nodes are \fInot\fR processed by the operator
as well and do not affect the iteration.
.PP
When describing an operator the variable \fBN\fR will be used to refer
to any node in the node set.
.TP
\fBancestors\fR
Replaces the current node set with the ancestors for all nodes \fBN\fR
in the node set, should \fBN\fR have a parent. In other words, nodes
without a parent do not contribute to the new node set. In other
words, uses all nodes on the path from node \fBN\fR to root, in this
order (root last), for all nodes \fBN\fR in the node set. This
includes the root, but not the node itself.
.TP
\fBrootpath\fR
Replaces the current node set with the ancestors for all nodes \fBN\fR
in the node set, should \fBN\fR have a parent. In other words, nodes
without a parent do not contribute to the new node set.
In contrast to the operator \fBancestors\fR the nodes are added in
reverse order however, i.e. the root node first.
.TP
\fBparent\fR
Replaces the current node set with the parent of node \fBN\fR, for all
nodes \fBN\fR in the node set, should \fBN\fR have a parent. In other
words, nodes without a parent do not contribute to the new node set.
.TP
\fBchildren\fR
Replaces the current node set with the immediate children of node
\fBN\fR, for all nodes \fBN\fR in the node set, should \fBN\fR have
children. In other words, nodes without children do not contribute to
the new node set.
.TP
\fBleft\fR
Replaces the current node set with the previous/left sibling for all
nodes \fBN\fR in the node set, should \fBN\fR have siblings to the
left. In other words, nodes without left siblings do not contribute to
the new node set.
.TP
\fBright\fR
Replaces the current node set with the next/right sibling for all
nodes \fBN\fR in the node set, should \fBN\fR have siblings to the
right. In other words, nodes without right siblings do not contribute
to the new node set.
.TP
\fBprev\fR
Replaces the current node set with all previous/left siblings of node
\fBN\fR, for all nodes \fBN\fR in the node set, should \fBN\fR have
siblings to the left. In other words, nodes without left siblings are
ignored. The left sibling adjacent to the node is added first, and the
leftmost sibling last (reverse tree order).
.TP
\fBesib\fR
Replaces the current node set with all previous/left siblings of node
\fBN\fR, for all nodes \fBN\fR in the node set, should \fBN\fR have
siblings to the left. In other words, nodes without left siblings are
ignored. The leftmost sibling is added first, and the left sibling
adjacent to the node last (tree order).
.sp
The method name is a shorthand for \fIEarlier SIBling\fR.
.TP
\fBnext\fR
Replaces the current node set with all next/right siblings of node
\fBN\fR, for all nodes \fBN\fR in the node set, should \fBN\fR have
siblings to the right. In other words, nodes without right siblings do
not contribute to the new node set. The right sibling adjacent to the
node is added first, and the rightmost sibling last (tree order).
.TP
\fBroot\fR
Replaces the current node set with a node set containing a single
node, the root of the tree.
.TP
\fBtree\fR
Replaces the current node set with a node set containing all nodes
found in the tree. The nodes are added in pre-order (parent first,
then children, the latter from left to right, first to last).
.TP
\fBdescendants\fR
Replaces the current node set with the nodes in all subtrees rooted at
node \fBN\fR, for all nodes \fBN\fR in the node set, should \fBN\fR
have children. In other words, nodes without children do not
contribute to the new node set.
.sp
This is like the operator \fBchildren\fR, but covers the children
of children as well, i.e. all the \fIproper descendants\fR. "Rooted
at \fBN\fR" means that \fBN\fR itself is not added to the new set,
which is also implied by \fIproper descendants\fR.
.TP
\fBsubtree\fR
Like operator \fBdescendants\fR, but includes the node \fBN\fR. In
other words:
.sp
Replaces the current node set with the nodes of the subtree of node
\fBN\fR, for all nodes \fBN\fR in the node set, should \fBN\fR have
children. In other words, nodes without children do not contribute to
the new node set. I.e this is like the operator \fBchildren\fR, but
covers the children of children, etc. as well. "Of \fBN\fR" means that
\fBN\fR itself is added to the new set.
.TP
\fBforward\fR
Replaces the current node set with the nodes in the subtrees rooted at
the right siblings of node \fBN\fR, for all nodes \fBN\fR in the node
set, should \fBN\fR have right siblings, and they children. In other
words, nodes without right siblings, and them without children are
ignored.
.sp
This is equivalent to the operator sequence
.CS

next descendants
.CE
.TP
\fBlater\fR
This is an alias for the operator \fBforward\fR.
.TP
\fBbackward\fR
Replaces the current node set with the nodes in the flattened previous
subtrees, in reverse tree order.
.sp
This is nearly equivalent to the operator sequence
.CS

prev descendants
.CE
.IP
The only difference is that this uses the nodes in reverse order.
.TP
\fBearlier\fR
Replaces the current node set with the nodes in the flattened previous
subtrees, in tree order.
.sp
This is equivalent to the operator sequence
.CS

prev subtree
.CE
.PP
.SS "ATTRIBUTE FILTERS"
These operators filter the node set by reference to attributes of
nodes and their properties. Filter means that all nodes not fulfilling
the criteria are removed from the node set. In other words, the node
set is replaced by the set of nodes fulfilling the filter criteria.
.TP
\fBhasatt\fR \fIattr\fR
Reduces the node set to nodes which have an attribute named
\fIattr\fR.
.TP
\fBwithatt\fR \fIattr\fR \fIvalue\fR
Reduces the node set to nodes which have an attribute named
\fIattr\fR, and where the value of that attribute is equal to
\fIvalue\fR (The "==" operator is \fBstring equal -nocase\fR).
.TP
\fBwithatt!\fR \fIattr\fR \fIval\fR
This is the same as \fBwithatt\fR, but all nodes in the node set
have to have the attribute, and the "==" operator is
\fBstring equal\fR, i.e. no \fB-nocase\fR.
The operator will fail with an error if they don't have the attribute.
.TP
\fBattof\fR \fIattr\fR \fIvals\fR
Reduces the node set to nodes which which have an attribute named
\fIattr\fR and where the value of that attribute is contained in the
list \fIvals\fR of legal values. The contained-in operator used here
does glob matching (using the attribute value as pattern) and ignores
the case of the attribute value, \fIbut not\fR for the elements of
\fIvals\fR.
.TP
\fBattmatch\fR \fIattr\fR \fImatch\fR
Same as \fBwithatt\fR, but \fBstring match\fR is used as the "=="
operator, and \fImatch\fR is the pattern checked for.
.sp
\fINote\fR that \fImatch\fR is a interpreted as a partial argument
\fIlist\fR for \fBstring match\fR. This means that it is
interpreted as a list containing the pattern, and the pattern element
can be preceded by options understand by \fBstring match\fR, like
\fB-nocase\fR.
This is especially important should the pattern contain spaces. It has
to be wrapped into a list for correct interpretation by this operator
.PP
.SS "ATTRIBUTE MUTATORS"
These operators change node attributes within the underlying tree. In
other words, all these operators have \fIside effects\fR.
.TP
\fBset\fR \fIattr\fR \fIval\fR
Sets the attribute \fIattr\fR to the value \fIval\fR, for all nodes
\fBN\fR in the node set.
The operator will fail if a node does not have an attribute named
\fIattr\fR. The tree will be left in a partially modified state.
.TP
\fBunset\fR \fIattr\fR
Unsets the attribute \fIattr\fR, for all nodes \fBN\fR in the node
set.
The operator will fail if a node does not have an attribute named
\fIattr\fR. The tree will be left in a partially modified state.
.PP
.SS "ATTRIBUTE STRING ACCESSORS"
These operators retrieve the values of node attributes from the
underlying tree. The collected results are stored in the node set, but
are not actually nodes.
.PP
In other words, they redefine the semantics of the node set stored by
the query object to contain non-node data after their completion.
.PP
The query interpreter will terminate after it has finished processing
one of these operators, silently discarding any later query elements.
It also means that our talk about maintenance of a node set is not
quite true. It is a node set while the interpreter is processing
commands, but can be left as an attribute value set at the end of
query processing.
.TP
\fBstring\fR \fIop\fR \fIattr\fR
Applies the string operator \fIop\fR to the attribute named
\fIattr\fR, for all nodes \fBN\fR in the node set, collects the
results of that application and places them into the node set.
.sp
The operator will fail if a node does not have an attribute named
\fIattr\fR.
.sp
The argument \fIop\fR is interpreted as partial argument list for the
builtin command \fBstring\fR.  Its first word has to be any of the
sub-commands understood by \fBstring\fR.  This has to be followed by
all arguments required for the subcommand, except the last.  that last
argument is supplied by the attribute value.
.TP
\fBget\fR \fIpattern\fR
For all nodes \fBN\fR in the node set it determines all their
attributes with names matching the glob \fIpattern\fR, then the values
of these attributes, at last it replaces the node set with the list of
these attribute values.
.TP
\fBattlist\fR
This is a convenience definition for the operator
\fBgetvals *\fR. In other words, it replaces the node set with a
list of the attribute values for all attributes for all nodes \fBN\fR
in the node set.
.TP
\fBattrs\fR \fIglob\fR
Replaces the current node set with a list of attribute lists, one
attribute list per for all nodes \fBN\fR in the node set.
.TP
\fBattval\fR \fIattname\fR
Reduces the current node set with the operator \fBhasatt\fR, and
then replaces it with a list containing the values of the attribute
named \fIattname\fR for all nodes \fBN\fR in the node set.
.PP
.SS SUB-QUERIES
Sub-queries yield node sets which are then used to augment, reduce or
replace the current node set.
.TP
\fBandq\fR \fIquery\fR
Replaces the node set with the set-intersection of the node set
generated by the sub-query \fIquery\fR and itself.
.sp
The execution of the sub-query uses the current node set as its own
initial node set.
.TP
\fBorq\fR \fIquery\fR
Replaces the node set with the set-union of the node set generated by
the sub-query \fIquery\fR and itself. Duplicate nodes are removed.
.sp
The execution of the sub-query uses the current node set as its own
initial node set.
.TP
\fBnotq\fR \fIquery\fR
Replaces the node set with the set of nodes generated by the sub-query
\fIquery\fR which are also not in the current node set. In other word
the set difference of itself and the node set generated by the
sub-query.
.sp
The execution of the sub-query uses the current node set as its own
initial node set.
.PP
.SS "NODE SET OPERATORS"
These operators change the node set directly, without referring to the
tree.
.TP
\fBunique\fR
Removes duplicate nodes from the node set, preserving order. In other
words, the earliest occurrence of a node handle is preserved, every
other occurrence is removed.
.TP
\fBselect\fR
Replaces the current node set with a node set containing only the
first node from the current node set
.TP
\fBtransform\fR \fIquery\fR \fIvar\fR \fIbody\fR
First it interprets the sub-query \fIquery\fR, using the current node
set as its initial node set.
Then it iterates over the result of that query, binding the handle of
each node to the variable named in \fIvar\fR, and executing the script
\fIbody\fR.
The collected results of these executions is made the new node set,
replacing the current one.
.sp
The script \fIbody\fR is executed in the context of the caller.
.TP
\fBmap\fR \fIvar\fR \fIbody\fR
Iterates over the current node set, binding the handle of each node to
the variable named in \fIvar\fR, and executing the script \fIbody\fR.
The collected results of these executions is made the new node set,
replacing the current one.
.sp
The script \fIbody\fR is executed in the context of the caller.
.TP
\fBquote\fR \fIval\fR
Appends the literal value \fIval\fR to the current node set.
.TP
\fBreplace\fR \fIval\fR
Replaces the current node set with the literal list value \fIval\fR.
.PP
.SS "NODE SET ITERATORS"
.TP
\fBforeach\fR \fIquery\fR \fIvar\fR \fIbody\fR
Interprets the sub-query \fIquery\fR, then performs the equivalent of
operator \fBover\fR on the nodes in the node set created by that
query. The current node set is not changed, except through side
effects from the script \fIbody\fR.
.sp
The script \fIbody\fR is executed in the context of the caller.
.TP
\fBwith\fR \fIquery\fR \fIbody\fR
Interprets the \fIquery\fR, then runs the script \fIbody\fR on the
node set generated by the query. At last it restores the current node
set as it was before the execution of the query.
.sp
The script \fIbody\fR is executed in the context of the caller.
.TP
\fBover\fR \fIvar\fR \fIbody\fR
Executes the script \fIbody\fR for each node in the node set, with the
variable named by \fIvar\fR bound to the name of the current node.
The script \fIbody\fR is executed in the context of the caller.
.sp
This is like the builtin \fBforeach\fR, with the node set as the
source of the list to iterate over.
.sp
The results of executing the \fIbody\fR are ignored.
.TP
\fBdelete\fR
Deletes all the nodes contained in the current node set from the tree.
.PP
.SS "TYPED NODE SUPPORT"
These filters and accessors assume the existence of an attribute
called \fB@type\fR, and are short-hand forms useful for cost-like
tree query, html tree editing, and so on.
.TP
\fBnodetype\fR
Returns the node type of nodes.
Attribute string accessor. This is equivalent to
.CS

get @type
.CE
.TP
\fBoftype\fR \fIt\fR
Reduces the node set to nodes whose type is equal to \fIt\fR, with
letter case ignored.
.TP
\fBnottype\fR \fIt\fR
Reduces the node set to nodes whose type is not equal to \fIt\fR, with
letter case ignored.
.TP
\fBoftypes\fR \fIattrs\fR
Reduces set to nodes whose @type is an element in the list \fIattrs\fR
of types. The value of @type is used as a glob pattern, and letter
case is relevant.
.PP
.SH EXAMPLES
... TODO ...
.SH REFERENCES
.IP [1]
\fICOST\fR [http://wiki.tcl.tk/COST] on the Tcler's Wiki.
.IP [2]
\fITreeQL\fR [http://wiki.tcl.tk/treeql] on the Tcler's Wiki. Discuss
this package there.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItreeql\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
Cost, DOM, TreeQL, XPath, XSLT, structured queries, tree, tree query language
.SH CATEGORY
Data structures
.SH COPYRIGHT
.nf
Copyright (c) 2004 Colin McCormack <[email protected]>
Copyright (c) 2004 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/try/tcllib_try.n.















































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/try/tcllib_try.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Donal K. Fellows, BSD licensed
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "try" n 1 tcllib "Forward compatibility implementation of [try]"
.BS
.SH NAME
try \- try - Trap and process errors and exceptions
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBtry  ?1?\fR
.sp
\fB::try\fR \fIbody\fR ?\fIhandler...\fR? ?\fBfinally\fR \fIscript\fR?
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a forward-compatibility implementation of Tcl
8.6's try/finally command (TIP 329), for Tcl 8.5. The code was
directly pulled from Tcl 8.6 revision ?, when try/finally was
implemented as Tcl procedure instead of in C.
.TP
\fB::try\fR \fIbody\fR ?\fIhandler...\fR? ?\fBfinally\fR \fIscript\fR?
This command executes the script \fIbody\fR and, depending on what the
outcome of that script is (normal exit, error, or some other
exceptional result), runs a handler script to deal with the case. Once
that has all happened, if the \fBfinally\fR clause is present, the
\fIscript\fR it includes will be run and the result of the handler (or
the \fIbody\fR if no handler matched) is allowed to continue to
propagate. Note that the \fBfinally\fR clause is processed even if
an error occurs and irrespective of which, if any, \fIhandler\fR is
used.
.sp
The \fIhandler\fR clauses are each expressed as several words,
and must have one of the following forms:
.RS
.TP
\fBon\fR \fIcode variableList script\fR
This clause matches if the evaluation of \fIbody\fR completed with the
exception code \fIcode\fR. The \fIcode\fR may be expressed as an
integer or one of the following literal words:
\fBok\fR, \fBerror\fR, \fBreturn\fR, \fBbreak\fR, or
\fBcontinue\fR. Those literals correspond to the integers 0 through
4 respectively.
.TP
\fBtrap\fR \fIpattern variableList script\fR
This clause matches if the evaluation of \fIbody\fR resulted in an
error and the prefix of the \fB-errorcode\fR from the interpreter's
status dictionary is equal to the \fIpattern\fR. The number of prefix
words taken from the \fB-errorcode\fR is equal to the list-length
of \fIpattern\fR, and inter-word spaces are normalized in both the
\fB-errorcode\fR and \fIpattern\fR before comparison.
.sp
The \fIvariableList\fR word in each \fIhandler\fR is always
interpreted as a list of variable names. If the first word of the list
is present and non-empty, it names a variable into which the result of
the evaluation of \fIbody\fR (from the main \fBtry\fR) will be placed;
this will contain the human-readable form of any errors. If the second
word of the list is present and non-empty, it names a variable into
which the options dictionary of the interpreter at the moment of
completion of execution of \fIbody\fR will be placed.
.sp
The \fIscript\fR word of each \fIhandler\fR is also always
interpreted the same: as a Tcl script to evaluate if the clause is
matched. If \fIscript\fR is a literal \fB-\fR and the \fIhandler\fR
is not the last one, the \fIscript\fR of the following \fIhandler\fR
is invoked instead (just like with the \fBswitch\fR command).
.sp
Note that \fIhandler\fR clauses are matched against in order,
and that the first matching one is always selected.
At most one \fIhandler\fR clause will selected.
As a consequence, an \fBon error\fR will mask any subsequent
\fBtrap\fR in the \fBtry\fR. Also note that \fBon error\fR is
equivalent to \fBtrap {}\fR.
.sp
If an exception (i.e. any non-\fBok\fR result) occurs during
the evaluation of either the \fIhandler\fR or the \fBfinally\fR
clause, the original exception's status dictionary will be added to
the new exception's status dictionary under the \fB-during\fR key.
.RE
.PP
.SH EXAMPLES
Ensure that a file is closed no matter what:
.PP
.CS


set f [open /some/file/name a]
\fBtry\fR {
    puts \\$f "some message"
    # ...
} \fBfinally\fR {
    close \\$f
}

.CE
.PP
Handle different reasons for a file to not be openable for reading:
.PP
.CS


\fBtry\fR {
    set f [open /some/file/name]
} \fBtrap\fR {POSIX EISDIR} {} {
    puts "failed to open /some/file/name: it's a directory"
} \fBtrap\fR {POSIX ENOENT} {} {
    puts "failed to open /some/file/name: it doesn't exist"
}

.CE
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fItry\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
catch(n), error(n), return(n), throw(n)
.SH KEYWORDS
cleanup, error, exception, final, resource management
.SH CATEGORY
Utility
.SH COPYRIGHT
.nf
Copyright (c) 2008 Donal K. Fellows, BSD licensed

.fi

Added embedded/man/files/modules/uev/uevent.n.





















































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/uev/uevent.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2012 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "uevent" n 0.3.1 tcllib "User events"
.BS
.SH NAME
uevent \- User events
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBuevent  ?0.3.1?\fR
.sp
package require \fBlogger \fR
.sp
\fB::uevent::bind\fR \fItag\fR \fIevent\fR \fIcommand\fR
.sp
\fBcommand\fR \fItag\fR \fIevent\fR \fIdetails\fR
.sp
\fB::uevent::unbind\fR \fItoken\fR
.sp
\fB::uevent::generate\fR \fItag\fR \fIevent\fR ?\fIdetails\fR?
.sp
\fB::uevent::list\fR
.sp
\fB::uevent::list\fR \fItag\fR
.sp
\fB::uevent::list\fR \fItag\fR \fIevent\fR
.sp
\fB::uevent::watch::tag::add\fR \fIpattern\fR \fIcommand\fR
.sp
\fB{*}command\fR \fBbound\fR \fItag\fR
.sp
\fB{*}command\fR \fBunbound\fR \fItag\fR
.sp
\fB::uevent::watch::tag::remove\fR \fItoken\fR
.sp
\fB::uevent::watch::event::add\fR \fItag_pattern\fR \fIevent_pattern\fR \fIcommand\fR
.sp
\fB{*}command\fR \fBbound\fR \fItag\fR \fIevent\fR
.sp
\fB{*}command\fR \fBunbound\fR \fItag\fR \fIevent\fR
.sp
\fB::uevent::watch::event::remove\fR \fItoken\fR
.sp
.BE
.SH DESCRIPTION
This package provides a general facility for the handling of user
events. Allows the binding of arbitrary commands to arbitrary events
on arbitrary tags, removal of bindings, and event generation.
.PP
The main difference to the event system built into the Tcl/Tk core is
that the latter can generate only virtual events, and only for
widgets. It is not possible to use the builtin facilities to bind to
events on arbitrary (pseudo-)objects, nor is it able to generate
events for such.
.PP
Here we can, by assuming that each object in question is represented
by its own tag. Which is possible as we allow arbitrary tags.
.PP
More differences:
.IP [1]
The package uses only a two-level hierarchy, tags and events, to
handle everything, whereas the Tcl/Tk system uses three levels, i.e.
objects, tags, and events, with a n:m relationship between objects and
tags.
.IP [2]
This package triggers all bound commands for a tag/event combination,
and they are independent of each other. A bound command cannot force
the event processing core to abort the processing of command coming
after it.
.PP
.SH API
The package exports eight commands, as specified below. Note that when
the package is used from within Tcl 8.5+ all the higher commands are
ensembles, i.e. the :: separators can be replaceed by spaces.
.TP
\fB::uevent::bind\fR \fItag\fR \fIevent\fR \fIcommand\fR
Using this command registers the \fIcommand\fR prefix to be triggered
when the \fIevent\fR occurs for the \fItag\fR. The result of the
command is an opaque token representing the binding. Note that if the
same combination of <\fItag\fR,\fIevent\fR,\fIcommand\fR> is used
multiple times the same token is returned by every call.
.sp
The signature of the \fIcommand\fR prefix is
.RS
.TP
\fBcommand\fR \fItag\fR \fIevent\fR \fIdetails\fR
.RE
.sp
where \fIdetails\fR contains the argument(s) of the event. Its
contents are event specific and have to be agreed upon between actual
event generator and consumer. This package simply transfers the
information and does not perform any processing beyond that.
.TP
\fB::uevent::unbind\fR \fItoken\fR
This command releases the event binding represented by the
\fItoken\fR. The token has to be the result of a call to
\fB::uevent::bind\fR. The result of the command is the empty string.
.TP
\fB::uevent::generate\fR \fItag\fR \fIevent\fR ?\fIdetails\fR?
This command generates an \fIevent\fR for the \fItag\fR, triggering
all commands bound to that combination. The \fIdetails\fR argument is
simply passed unchanged to all event handlers. It is the
responsibility of the code generating and consuming the event to have
an agreement about the format and contents of the information carried
therein. The result of the command is the empty string.
.sp
Note that all bound commands are triggered, independently of each
other. The event handlers cannot assume a specific order. They are
also \fInot\fR called synchronously with the invokation of this
command, but simply put into the event queue for processing when the
system returns to the event loop.
.sp
Generating an event for an unknown tag, or for a
<\fItag\fR,\fIevent\fR> combination which has no commands bound to it
is allowed, such calls will be ignored.
.TP
\fB::uevent::list\fR
In this form the command returns a list containing the names of all
tags which have events with commands bound to them.
.TP
\fB::uevent::list\fR \fItag\fR
In this format the command returns a list containing the names of all
events for the \fItag\fR with commands bound to them. Specifying an
unknown tag, i.e. a tag without event and commands, will cause the
command to throw an error.
.TP
\fB::uevent::list\fR \fItag\fR \fIevent\fR
In this format the command returns a list containing all commands
bound to the \fIevent\fR for the \fItag\fR. Specifying an unknown tag
or unknown event, will cause the command to throw an error.
.TP
\fB::uevent::watch::tag::add\fR \fIpattern\fR \fIcommand\fR
This command sets up a sort of reverse events. Events generated,
i.e. the \fIcommand\fR prefix invoked, when observers bind to and
unbind from specific tags.
.sp
Note that the command prefix is only invoked twice per tag,
first when the first command is bound to any event of the tag, and
second when the last command bound to the tag is removed.
.sp
The signature of the \fIcommand\fR prefix is
.RS
.TP
\fB{*}command\fR \fBbound\fR \fItag\fR
.TP
\fB{*}command\fR \fBunbound\fR \fItag\fR
.RE
.sp
The result of the command is a token representing the watcher.
.TP
\fB::uevent::watch::tag::remove\fR \fItoken\fR
This command removes a watcher for (un)bind events on tags.
.sp
The result of the command is the empty string.
.TP
\fB::uevent::watch::event::add\fR \fItag_pattern\fR \fIevent_pattern\fR \fIcommand\fR
This command sets up a sort of reverse events. Events generated,
i.e. the \fIcommand\fR prefix invoked, when observers bind to and
unbind from specific combinations of tags and events.
.sp
Note that the command prefix is only invoked twice per
tag/event combination, first when the first command is bound to it,
and second when the last command bound to the it is removed.
.sp
The signature of the \fIcommand\fR prefix is
.RS
.TP
\fB{*}command\fR \fBbound\fR \fItag\fR \fIevent\fR
.TP
\fB{*}command\fR \fBunbound\fR \fItag\fR \fIevent\fR
.RE
.sp
The result of the command is a token representing the watcher.
.TP
\fB::uevent::watch::event::remove\fR \fItoken\fR
This command removes a watcher for (un)bind events on tag/event
combinations.
.sp
The result of the command is the empty string.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIuevent\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
hook(n)
.SH KEYWORDS
bind, event, generate event, hook, unbind
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2007-2012 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/uev/uevent_onidle.n.














































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/uev/uevent_onidle.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "uevent::onidle" n 0.1 tcllib "User events"
.BS
.SH NAME
uevent::onidle \- Request merging and deferal to idle time
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBuevent::onidle  ?0.1?\fR
.sp
package require \fBlogger \fR
.sp
\fB::uevent::onidle\fR \fIobjectName\fR \fIcommandprefix\fR
.sp
\fIobjectName\fR \fBrequest\fR
.sp
.BE
.SH DESCRIPTION
This package provides objects which can merge multiple requestes for
an action and execute the action the moment the system (event loop)
becomes idle. The action to be run is configured during object
construction.
.SH API
The package exports a class, \fBuevent::onidle\fR, as specified
below.
.TP
\fB::uevent::onidle\fR \fIobjectName\fR \fIcommandprefix\fR
The command creates a new \fIonidle\fR object with an associated
global Tcl command whose name is \fIobjectName\fR.  This command may
be used to invoke various operations on the object.
.sp
The \fIcommandprefix\fR is the action to perform when the event loop
is idle and the user asked for it using the method \fBrequest\fR
(See below).
.PP
The object commands created by the class commands above have
the form:
.TP
\fIobjectName\fR \fBrequest\fR
This method requests the execution of the command prefix specified
during the construction of \fIobjectName\fR the next time the event
loop is idle. Multiple requests are merged and cause only one
execution of the command prefix.
.PP
.SH EXAMPLES
Examples of this type of deferal are buried in the (C-level)
implementations all the Tk widgets, defering geometry calculations and
window redraw activity in this manner.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIuevent\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
callback, deferal, event, idle, merge, on-idle
.SH COPYRIGHT
.nf
Copyright (c) 2008 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/units/units.n.

































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/units/units.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2000-2005 Mayo Foundation
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "units" n 1.2 tcllib "Convert and manipulate quantities with units"
.BS
.SH NAME
units \- unit conversion
.SH SYNOPSIS
package require \fBTcl  8.1\fR
.sp
package require \fBunits  ?2.1?\fR
.sp
\fB::units::convert\fR \fIvalue\fR \fItargetUnits\fR
.sp
\fB::units::reduce\fR \fIunitString\fR
.sp
\fB::units::new\fR \fIname\fR \fIbaseUnits\fR
.sp
.BE
.SH DESCRIPTION
.PP
This library provides a conversion facility from a variety of
scientific and engineering shorthand notations into floating point
numbers.  This allows application developers to easily convert
values with different units into uniformly scaled numbers.
.PP
The units conversion facility is also able to convert between
compatible units.  If, for example, a application is expecting a value
in \fIohms\fR (Resistance), and the user specifies units of
\fImilliwebers/femtocoulomb\fR, the conversion routine will
handle it appropriately.  An error will be generated if an incorrect
conversion is attempted.
.PP
Values are scaled from one set of units to another by dimensional
analysis.  Both the value units and the target units are reduced into
primitive units and a scale factor.  Units are checked for
compatibility, and the scale factors are applied by multiplication and
division.  This technique is extremely flexible and quite robust.
.PP
New units and new unit abbreviations can be defined in terms of
existing units and abbreviations.  It is also possible to define a new
primitive unit, although that will probably be unnecessary.  New units
will most commonly be defined to accommodate non-SI measurement
systems, such as defining the unit \fIinch\fR as \fI2.54 cm\fR.
.SH COMMANDS
.TP
\fB::units::convert\fR \fIvalue\fR \fItargetUnits\fR
Converts the \fIvalue\fR string into a floating point number, scaled to the
specified \fItargetUnits\fR.  The \fIvalue\fR string may contain a
number and units.  If units are specified, then they must be
compatible with the \fItargetUnits\fR.  If units are not specified
for the \fIvalue\fR, then it will be scaled to the target units.  For
example,
.CS


% ::units::convert "2.3 miles" km
3.7014912
% ::units::convert 300m/s miles/hour
671.080887616
% ::units::convert "1.0 m kg/s^2" newton
1.0
% ::units::convert 1.0 millimeter
1000.0

.CE
.TP
\fB::units::reduce\fR \fIunitString\fR
Returns a unit string consisting of a scale factor followed by a space
separated list of sorted and reduced primitive units.  The reduced
unit string may include a forward-slash (separated from the
surrounding primitive subunits by spaces) indicating that the
remaining subunits are in the denominator.  Generates an error if the
\fIunitString\fR is invalid.
.CS


% ::units::reduce pascal
1000.0 gram / meter second second

.CE
.TP
\fB::units::new\fR \fIname\fR \fIbaseUnits\fR
Creates a new unit conversion with the specified name.  The new unit
\fIname\fR must be only alphabetic (upper or lower case) letters.
The \fIbaseUnits\fR string can consist of any valid units conversion
string, including constant factors, numerator and denominator parts,
units with prefixes, and exponents.  The baseUnits may contain any
number of subunits, but it must reduce to primitive units.  BaseUnits
could also be the string \fI-primitive\fR to represent a new
kind of quantity which cannot be derived from other units.  But you
probably would not do that unless you have discovered some kind of new
universal property.
.CS


% ::units::new furlong "220 yards"
% ::units::new fortnight "14 days"
% ::units::convert 100m/s furlongs/fortnight
601288.475303

.CE
.PP
.SH "UNIT STRING FORMAT"
Value and unit string format is quite flexible.  It is possible to
define virtually any combination of units, prefixes, and powers.
Valid unit strings must conform to these rules.
.IP \(bu
A unit string consists of an optional scale factor followed by zero or
more subunits.  The scale factor must be a valid floating point
number, and may or may not be separated from the subunits.  The scale
factor could be negative.
.IP \(bu
Subunits are separated form each other by one or more separator
characters, which are space (" "), hyphen ("-"), asterisk ("*"), and
forward-slash ("/").  Sure, go ahead and complain about using a minus
sign ("-") to represent multiplication.  It just isn't sound
mathematics, and, by rights, we should require everyone to use the
asterisk ("*") to separate all units.  But the bottom line is that
complex unit strings like \fIm-kg/s^2\fR are pleasantly
readable.
.IP \(bu
The forward-slash seperator ("/") indicates that following subunits are
in the denominator.  There can be at most one forward-slash separator.
.IP \(bu
Subunits can be floating point scale factors, but with the exception
of the leading scale factor, they must be surrounded by valid
separators.  Subunit scale factors cannot be negative. (Remember that
the hyphen is a unit separator.)
.IP \(bu
Subunits can be valid units or abbreviations.  They may include a
prefix.  They may include a plural suffix "s" or "es".  They may also
include a power string denoted by a circumflex ("^"), followed by a
integer, after the unit name (or plural suffix, if there is one).
Negative exponents are not allowed.  (Remember that the hyphen is a
unit separator.)
.PP
.SS "EXAMPLE VALID UNIT STRINGS"
.CS


Unit String              Reduced Unit String
------------------------------------------------------------
meter                    1.0 meter
kilometer                1000.0 meter
km                       1000.0 meter
km/s                     1000.0 meter / second
/microsecond             1000000.0 / second
/us                      1000000.0 / second
kg-m/s^2                 1000.0 gram meter / second second
30second                 30.0 second
30 second                30.0 second
30 seconds               30.0 second
200*meter/20.5*second    9.75609756098 meter / second

.CE
.SH "SI UNITS"
.PP
The standard SI units are predefined according to \fINIST Special
Publication 330\fR.  Standard units for both SI Base Units (Table
1) and SI Derived Units with Special Names (Tables 3a and 3b) are
included here for reference.  Each standard unit name and abbreviation
are included in this package.
.SS "SI BASE UNITS"
.CS


Quantity                Unit Name    Abbr.
---------------------------------------------
Length                  meter        m
Mass                    kilogram     kg
Time                    second       s
Current                 ampere       A
Temperature             kelvin       K
Amount                  mole         mol
Luminous Intensity      candela      cd

.CE
.SS "SI DERIVED UNITS WITH SPECIAL NAMES"
.CS


Quantity                Unit Name    Abbr.   Units     Base Units
--------------------------------------------------------------------
plane angle             radian      rad     m/m       m/m
solid angle             steradian   sr      m^2/m^2   m^2/m^2
frequency               hertz       Hz                /s
force                   newton      N                 m-kg/s^2
pressure                pascal      Pa      N/m^2     kg/m-s^2
energy, work            joule       J       N-m       m^2-kg/s^2
power, radiant flux     watt        W       J/s       m^2-kg/s^3
electric charge         coulomb     C                 s-A
electric potential      volt        V       W/A       m^2-kg/s^3-A
capacitance             farad       F       C/V       s^4-A^2/m^2-kg
electric resistance     ohm                 V/A       m^2-kg/s^3-A^2
electric conductance    siemens     S       A/V       s^3-A^2/m^2-kg
magnetic flux           weber       Wb      V-s       m^2-kg/s^2-A
magnetic flux density   tesla       T       Wb/m^2    kg/s^2-A
inductance              henry       H       Wb/A      m^2-kg/s^2-A^2
luminous flux           lumen       lm                cd-sr
illuminance             lux         lx      lm/m^2    cd-sr/m^2
activity (of a
radionuclide)           becquerel   Bq                /s
absorbed dose           gray        Gy      J/kg      m^2/s^2
dose equivalent         sievert     Sv      J/kg      m^2/s^2

.CE
.PP
Note that the SI unit kilograms is actually implemented as grams
because 1e-6 kilogram = 1 milligram, not 1 microkilogram.  The
abbreviation for Electric Resistance (ohms), which is the omega
character, is not supported.
.PP
Also note that there is no support for Celsius or Farenheit
temperature.  The units conversion routines can only scale values
with multiplication and division, so it is not possible to convert
from thermodynamic temperature (kelvins) to absolute degrees Celsius
or Farenheit.  Conversion of thermodynamic quantities, such as
thermal expansion (per unit temperature), however, are easy to add
to the units library.
.PP
SI Units can have a multiple or sub-multiple prefix.  The prefix or its
abbreviation should appear before the unit, without spaces.  Compound
prefixes are not allowed, and a prefix should never be used alone.
These prefixes are defined in Table 5 of \fISpecial Publication
330\fR.
.SS "SI PREFIXES"
.CS


Prefix Name     Abbr.   Factor
---------------------------------------
yotta           Y       1e24
zetta           Z       1e21
exa             E       1e18
peta            P       1e15
tera            T       1e12
giga            G       1e9
mega            M       1e6
kilo            k       1e3
hecto           h       1e2
deka            da      1e1
deca                    1e1

deci            d       1e-1
centi           c       1e-2
milli           m       1e-3
micro           u       1e-6
nano            n       1e-9
pico            p       1e-12
femto           f       1e-15
atto            a       1e-18
zepto           z       1e-21
yocto           y       1e-24

.CE
.PP
Note that we define the same prefix with both the USA ("deka") and
non-USA ("deca") spellings.  Also note that we take the liberty of
allowing "micro" to be typed as a "u" instead of the Greek character
mu.
.PP
Many non-SI units are commonly used in applications.  Appendix B.8 of
\fINIST Special Publication 811\fR lists many non-SI conversion
factors.  It is not possible to include all possible unit definitions
in this package.  In some cases, many different conversion factors
exist for a given unit, depending on the context. (The appendix lists
over 40 conversions for British thermal units!)  Application specific
conversions can always be added using the \fBnew\fR
command, but some well known and often used conversions are included
in this package.
.SS "NON-SI UNITS"
.CS


Unit Name            Abbr.    Base Units
--------------------------------------------------
angstrom                      1.0E-10 m
astronomicalUnit     AU       1.495979E11 m
atmosphere                    1.01325E5 Pa
bar                           1.0E5 Pa
calorie                       4.1868 J
curie                         3.7E10 Bq
day                           8.64E4 s
degree                        1.745329E-2 rad
erg                           1.0E-7 J
faraday                       9.648531 C
fermi                         1.0E-15 m
foot                 ft       3.048E-1 m
gauss                         1.0E-4 T
gilbert                       7.957747E-1 A
grain                gr       6.479891E-5 kg
hectare              ha       1.0E4 m^2
hour                 h        3.6E3 s
inch                 in       2.54E-2 m
lightYear                     9.46073E15 m
liter                L        1.0E-3 m^3
maxwell              Mx       1.0E-8 Wb
mho                           1.0 S
micron                        1.0E-6 m
mil                           2.54E-5 m
mile                 mi       1.609344E3 m
minute               min      6.0E1 s
parsec               pc       3.085E16 m
pica                          4.233333E-3 m
pound                lb       4.535924E-1 kg
revolution                    6.283185 rad
revolutionPerMinute  rpm      1.047198E-1 rad/s
yard                 yd       9.144E-1 m
year                          3.1536E7 s

.CE
.SS "QUANTITIES AND DERIVED UNITS WITH SPECIAL NAMES"
This units conversion package is limited specifically to unit
reduction, comparison, and scaling.  This package does not consider
any of the quantity names for either base or derived units.  A similar
implementation or an extension in a typed or object-oriented language
might introduce user defined types for the quantities.  Quantity type
checking could be used, for example, to ensure that all
\fIlength\fR values properly reduced to \fImeters\fR, or
that all \fIvelocity\fR values properly reduced to
\fImeters/second\fR.
.PP
A C implementation of this package has been created to work in
conjunction with the Simplified Wrapper Interface Generator
(\fIhttp://www.swig.org/\fR).  That package (units.i) exploits SWIG's typemap
system to automatically convert script quantity strings into floating
point quantities.  Function arguments are specified as quantity types
(e.g., \fItypedef float Length\fR), and target units (expected
by the C application code) are specified in an associative array.
Default units are also defined for each quantity type, and are applied
to any unit-less quantity strings.
.PP
A units system enhanced with quantity type checking might benefit from
inclusion of other derived types which are expressed in terms of
special units, as illustrated in Table 2 of \fINIST Publication
330\fR.  The quantity \fIarea\fR, for example, could be
defined as units properly reducing to \fImeter^2\fR, although
the utility of defining a unit named \fIsquare meter\fR is
arguable.
.SH REFERENCES
The unit names, abbreviations, and conversion values are derived from
those published by the United States Department of Commerce Technology
Administration, National Institute of Standards and Technology (NIST)
in \fINIST Special Publication 330: The International System of
Units (SI)\fR and \fINIST Special Publication 811: Guide for
the Use of the International System of Units (SI)\fR.  Both of
these publications are available (as of December 2000) from
\fIhttp://physics.nist.gov/cuu/Reference/contents.html\fR
.PP
The ideas behind implementation of this package is based in part on
code written in 1993 by Adrian Mariano which performed dimensional
analysis of unit strings using fixed size tables of C structs.  After
going missing in the late 1990's, Adrian's code has reappeared in the
GNU Units program at \fIhttp://www.gnu.org/software/units/\fR
.SH AUTHORS
Robert W. Techentin
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIunits\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
angle, constants, conversion, distance, radians, unit
.SH COPYRIGHT
.nf
Copyright (c) 2000-2005 Mayo Foundation

.fi

Added embedded/man/files/modules/uri/uri.n.





















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/uri/uri.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "uri" n 1.2.2 tcllib "Tcl Uniform Resource Identifier Management"
.BS
.SH NAME
uri \- URI utilities
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBuri  ?1.2.2?\fR
.sp
\fBuri::split\fR \fIurl\fR ?\fIdefaultscheme\fR?
.sp
\fBuri::join\fR ?\fIkey\fR \fIvalue\fR?...
.sp
\fBuri::resolve\fR \fIbase\fR \fIurl\fR
.sp
\fBuri::isrelative\fR \fIurl\fR
.sp
\fBuri::geturl\fR \fIurl\fR ?\fIoptions\fR...?
.sp
\fBuri::canonicalize\fR \fIuri\fR
.sp
\fBuri::register\fR \fIschemeList\fR \fIscript\fR
.sp
.BE
.SH DESCRIPTION
This package contains two parts. First it provides regular expressions
for a number of url/uri schemes. Second it provides a number of
commands for manipulating urls/uris and fetching data specified by
them. For the latter this package analyses the requested url/uri and
then dispatches it to the appropriate package (http, ftp, ...) for
actual fetching.
.PP
The package currently does not conform to
RFC 2396 (\fIhttp://www.rfc-editor.org/rfc/rfc2396.txt\fR),
but quite likely should be. Patches and other help are welcome.
.SH COMMANDS
.TP
\fBuri::split\fR \fIurl\fR ?\fIdefaultscheme\fR?
\fBuri::split\fR takes an \fIurl\fR, decodes it and then returns a
list of key/value pairs suitable for \fBarray set\fR containing the
constituents of the \fIurl\fR. If the scheme is missing from the url
it defaults to the value of \fIdefaultscheme\fR if it was specified,
or \fIhttp\fR else. Currently only the schemes \fIhttp\fR,
\fIftp\fR, \fImailto\fR, \fIurn\fR, \fInews\fR, \fIldap\fR and
\fIfile\fR are supported by the package itself.
See section \fBEXTENDING\fR on how to expand that range.
.sp
The set of constituents of an url (= the set of keys in the returned
dictionary) is dependent on the scheme of the url. The only key which
is therefore always present is \fBscheme\fR. For the following
schemes the constituents and their keys are known:
.RS
.TP
ftp
\fBuser\fR, \fBpwd\fR, \fBhost\fR, \fBport\fR,
\fBpath\fR, \fBtype\fR
.TP
http(s)
\fBuser\fR, \fBpwd\fR, \fBhost\fR, \fBport\fR,
\fBpath\fR, \fBquery\fR, \fBfragment\fR. The fragment
is optional.
.TP
file
\fBpath\fR, \fBhost\fR. The host is optional.
.TP
mailto
\fBuser\fR, \fBhost\fR. The host is optional.
.TP
news
Either \fBmessage-id\fR or \fBnewsgroup-name\fR.
.RE
.sp
.TP
\fBuri::join\fR ?\fIkey\fR \fIvalue\fR?...
\fBuri::join\fR takes a list of key/value pairs (generated by
\fBuri::split\fR, for example) and returns the canonical url they
represent. Currently only the schemes \fIhttp\fR, \fIftp\fR,
\fImailto\fR, \fIurn\fR, \fInews\fR, \fIldap\fR and \fIfile\fR
are supported. See section \fBEXTENDING\fR on how to expand that
range.
.TP
\fBuri::resolve\fR \fIbase\fR \fIurl\fR
\fBuri::resolve\fR resolves the specified \fIurl\fR relative to
\fIbase\fR. In other words: A non-relative \fIurl\fR is returned
unchanged, whereas for a relative \fIurl\fR the missing parts are
taken from \fIbase\fR and prepended to it. The result of this
operation is returned. For an empty \fIurl\fR the result is
\fIbase\fR.
.TP
\fBuri::isrelative\fR \fIurl\fR
\fBuri::isrelative\fR determines whether the specified \fIurl\fR is
absolute or relative.
.TP
\fBuri::geturl\fR \fIurl\fR ?\fIoptions\fR...?
\fBuri::geturl\fR decodes the specified \fIurl\fR and then dispatches
the request to the package appropriate for the scheme found in the
url. The command assumes that the package to handle the given scheme
either has the same name as the scheme itself (including possible
capitalization) followed by \fB::geturl\fR, or, in case of this
failing, has the same name as the scheme itself (including possible
capitalization). It further assumes that whatever package was loaded
provides a \fBgeturl\fR-command in the namespace of the same name as
the package itself. This command is called with the given \fIurl\fR
and all given \fIoptions\fR. Currently \fBgeturl\fR does not handle
any options itself.
.sp
\fINote:\fR \fIfile\fR-urls are an exception to the rule
described above. They are handled internally.
.sp
It is not possible to specify results of the command. They depend on
the \fBgeturl\fR-command for the scheme the request was dispatched to.
.TP
\fBuri::canonicalize\fR \fIuri\fR
\fBuri::canonicalize\fR returns the canonical form of a URI.  The
canonical form of a URI is one where relative path specifications,
ie. . and .., have been resolved.
.TP
\fBuri::register\fR \fIschemeList\fR \fIscript\fR
\fBuri::register\fR registers the first element of \fIschemeList\fR as
a new scheme and the remaining elements as aliases for this scheme. It
creates the namespace for the scheme and executes the \fIscript\fR in
the new namespace. The script has to declare variables containing the
regular expressions relevant to the scheme. At least the variable
\fBschemepart\fR has to be declared as that one is used to extend
the variables keeping track of the registered schemes.
.PP
.SH SCHEMES
In addition to the commands mentioned above this package provides
regular expression to recognize urls for a number of url schemes.
.PP
For each supported scheme a namespace of the same name as the scheme
itself is provided inside of the namespace \fIuri\fR containing the
variable \fBurl\fR whose contents are a regular expression to
recognize urls of that scheme. Additional variables may contain
regular expressions for parts of urls for that scheme.
.PP
The variable \fBuri::schemes\fR contains a list of all supported
schemes. Currently these are \fIftp\fR, \fIldap\fR, \fIfile\fR,
\fIhttp\fR, \fIgopher\fR, \fImailto\fR, \fInews\fR,
\fIwais\fR and \fIprospero\fR.
.SH EXTENDING
Extending the range of schemes supported by \fBuri::split\fR and
\fBuri::join\fR is easy because both commands do not handle the
request by themselves but dispatch it to another command in the
\fIuri\fR namespace using the scheme of the url as criterion.
.PP
\fBuri::split\fR and \fBuri::join\fR
call \fBSplit[string totitle <scheme>]\fR
and  \fBJoin[string totitle <scheme>]\fR respectively.
.SH CREDITS
.PP
Original code (regular expressions) by Andreas Kupries.
Modularisation by Steve Ball, also the split/join/resolve
functionality.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIuri\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
fetching information, file, ftp, gopher, http, ldap, mailto, news, prospero, rfc 2255, rfc 2396, uri, url, wais, www
.SH CATEGORY
Networking

Added embedded/man/files/modules/uri/urn-scheme.n.




























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/uri/urn-scheme.n' by tcllib/doctools with format 'nroff'
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "uri_urn" n 1.1.2 tcllib "Tcl Uniform Resource Identifier Management"
.BS
.SH NAME
uri_urn \- URI utilities, URN scheme
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBuri::urn  ?1.1.2?\fR
.sp
\fBuri::urn::quote\fR \fIurl\fR
.sp
\fBuri::urn::unquote\fR \fIurl\fR
.sp
.BE
.SH DESCRIPTION
This package provides two commands to quote and unquote the disallowed
characters for url using the \fIurn\fR scheme, registers the scheme
with the package \fBuri\fR, and provides internal helpers which
will be automatically used by the commands \fBuri::split\fR and
\fBuri::join\fR of package \fBuri\fR to handle urls using the
\fIurn\fR scheme.
.SH COMMANDS
.TP
\fBuri::urn::quote\fR \fIurl\fR
This command quotes the characters disallowed by the \fIurn\fR scheme
(per RFC 2141 sec2.2) in the \fIurl\fR and returns the modified url as
its result.
.TP
\fBuri::urn::unquote\fR \fIurl\fR
This commands performs the reverse of \fB::uri::urn::quote\fR. It
takes an \fIurn\fR url, removes the quoting from all disallowed
characters, and returns the modified urls as its result.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIuri\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
rfc 2141, uri, url, urn
.SH CATEGORY
Networking

Added embedded/man/files/modules/uuid/uuid.n.












































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/uuid/uuid.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2004, Pat Thoyts <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "uuid" n 1.0.2 tcllib "uuid"
.BS
.SH NAME
uuid \- UUID generation and comparison
.SH SYNOPSIS
package require \fBTcl  8.2\fR
.sp
package require \fBuuid  ?1.0.2?\fR
.sp
\fB::uuid::uuid generate\fR
.sp
\fB::uuid::uuid equal\fR \fIid1\fR \fIid2\fR
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a generator of universally unique identifiers
(UUID) also known as globally unique identifiers (GUID). This
implementation follows the draft specification from (1) although this
is actually an expired draft document.
.SH COMMANDS
.TP
\fB::uuid::uuid generate\fR
Creates a type 4 uuid by MD5 hashing a number of bits of variant data
including the time and hostname.
Returns the string representation of the new uuid.
.TP
\fB::uuid::uuid equal\fR \fIid1\fR \fIid2\fR
Compares two uuids and returns true if both arguments are the same uuid.
.PP
.SH EXAMPLES
.CS


% uuid::uuid generate
b12dc22c-5c36-41d2-57da-e29d0ef5839c

.CE
.SH REFERENCES
.IP [1]
Paul J. Leach, "UUIDs and GUIDs", February 1998.
(\fIhttp://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt\fR)
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIuuid\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
GUID, UUID
.SH CATEGORY
Hashes, checksums, and encryption
.SH COPYRIGHT
.nf
Copyright (c) 2004, Pat Thoyts <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/cat.n.








































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/cat.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::cat" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::cat \- Concatenation channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::core  ?1?\fR
.sp
package require \fBtcl::chan::cat  ?1?\fR
.sp
\fB::tcl::chan::cat\fR \fIchan\fR...
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::cat\fR package provides a command creating
concatenation channels. These are non-seekable channels owning a list
of subordinate channels whose contents they return in order, until all
are exhausted. In this manner the cahnnel is the concatentation of the
contents of all the sub-ordinate channels.
.PP
Note that the created channels take ownership of the channels
they were constructed with. Whenever they have exhausted one of their
channel it will be closed. Similarly, closing the cat channel will
close all the sub-ordinates it still has.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::core\fR framework.
.PP
Event handling is delegated to the currently active sub-channel.
.SH API
.TP
\fB::tcl::chan::cat\fR \fIchan\fR...
This command creates the concatenation channel using all the provided
channels, and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
concatenation channel, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2011 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/facade.n.
































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/facade.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::facade" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::facade \- Facade channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBlogger \fR
.sp
package require \fBtcl::chan::core  ?1?\fR
.sp
package require \fBtcl::chan::facade  ?1?\fR
.sp
\fB::tcl::chan::facade\fR \fIchan\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::facade\fR package provides a command creating
facades to other channels. These are channels which own a single
subordinate channel and delegate all operations to.
.PP
The main use for facades is the debugging of actions on a
channel. While most of the information could be tracked by a virtual
channel transformation it does not have access to the event-related
operation, and furthermore they are only available in Tcl 8.6.
.PP
Therefore this channel, usable with Tcl 8.5, and having access
to everything going on for a channel.
.PP
The intercepted actions on channel are logged through package
\fBlogger\fR.
.PP
Beyond that facades provide the following additional channel
configuration options:
.TP
\fB-self\fR
The TclOO object handling the facade.
.TP
\fB-fd\fR
The handle of the subordinate, i.e. wrapped channel.
.TP
\fB-used\fR
The last time the wrapped channel was read from or written to by
the facade, as per \fBclock milliseconds\fR. A value of \fB0\fR
indicates that the subordinate channel was not accessed at all, yet.
.TP
\fB-created\fR
The time the facade was created, as per \fBclock milliseconds\fR.
.TP
\fB-user\fR
A free-form value identifying the user of the facade and its
wrapped channel.
.PP
Of these only option \fB-user\fR is writable.
.SH API
.TP
\fB::tcl::chan::facade\fR \fIchan\fR
This command creates the facade channel around the provided
channel \fIchan\fR, and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
concatenation channel, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2011 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/fifo.n.


































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/fifo.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::fifo" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::fifo \- In-memory fifo channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::fifo  ?1?\fR
.sp
\fB::tcl::chan::fifo\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::fifo\fR package provides a command creating
channels which live purely in memory. Access is fifo-like, i.e. things
are read out of the channel in the order they were written to it.
This is equivalent to the fifo channels provided by the package
\fBMmechan\fR, except that this is written in pure Tcl, not C. On
the other hand, \fBMemchan\fR is usable with Tcl 8.4 and before,
whereas this package requires Tcl 8.5 or higher, and \fBTclOO\fR.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::fifo\fR
This command creates a new fifo channel and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
fifo, in-memory channel, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/fifo2.n.








































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/fifo2.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::fifo2" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::fifo2 \- In-memory interconnected fifo channels
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::halfpipe  ?1?\fR
.sp
package require \fBtcl::chan::fifo2  ?1?\fR
.sp
\fB::tcl::chan::fifo2\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::fifo2\fR package provides a command creating
pairs of channels which live purely in memory and are connected to
each other in a fifo manner. What is written to one half of the pair
can be read from the other half, in the same order. One particular
application for this is communication between threads, with one half
of the pair moved to the thread to talk to.
This is equivalent to the fifo2 channels provided by the package
\fBMmechan\fR, except that this is written in pure Tcl, not C. On
the other hand, \fBMemchan\fR is usable with Tcl 8.4 and before,
whereas this package requires Tcl 8.5 or higher, and \fBTclOO\fR.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::fifo2\fR
This command creates a new connected pair of fifo channels and returns
their handles, as a list containing two elements.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
connected fifos, fifo, in-memory channel, inter-thread communication, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/halfpipe.n.


































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/halfpipe.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::halfpipe" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::halfpipe \- In-memory channel, half of a fifo2
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::halfpipe  ?1?\fR
.sp
package require \fBtcl::chan::halfpipe  ?1?\fR
.sp
\fB::tcl::chan::halfpipe\fR ?\fB-option\fR \fIvalue\fR...?
.sp
\fIobjectCmd\fR \fBput\fR \fIbytes\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::halfpipe\fR package provides a command creating
one half of a \fBtcl::chan::fifo2\fR pair. Writing into such a
channel invokes a set of callbacks which then handle the data. This is
similar to a channel handler, except having a much simpler API.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::halfpipe\fR ?\fB-option\fR \fIvalue\fR...?
This command creates a halfpipe channel and configures it with the
callbacks to run when the channel is closed, data was written to it,
or ran empty. See the section \fBOptions\fR for the list of
options and associated semantics.
The result of the command is a list containing two elements, the
handle of the new channel, and the object command of the channel
handler, in this order.
The latter is supplied to the caller to provide her with access to the
\fBput\fR method for adding data to the channel.
.sp
Two halfpipes with a bit of glue logic in the callbacks make
for one \fBtcl::chan::fifo2\fR.
.TP
\fIobjectCmd\fR \fBput\fR \fIbytes\fR
This method of the channel handler object puts the data \fIbytes\fR
into the channel so that it can be read from it.
.PP
.SH OPTIONS
.TP
\fB-close-command\fR cmdprefix
This callback is invoked when the channel is closed.
A single argument is supplied, the handle of the channel being closed.
The result of the callback is ignored.
.TP
\fB-write-command\fR cmdprefix
This callback is invoked when data is written to the channel.
Two arguments are supplied, the handle of the channel written to, and the data written.
The result of the callback is ignored.
.TP
\fB-empty-command\fR cmdprefix
This callback is invoked when the channel has run out of data to read.
A single argument is supplied, the handle of the channel.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
callbacks, fifo, in-memory channel, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/memchan.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/memchan.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::memchan" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::memchan \- In-memory channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::memchan  ?1?\fR
.sp
\fB::tcl::chan::memchan\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::memchan\fR package provides a command creating
channels which live purely in memory. They provide random-access,
i.e. are seekable. This is equivalent to the memchan channels provided by
the package \fBMemchan\fR, except that this is written in pure Tcl,
not C. On the other hand, \fBMemchan\fR is usable with Tcl 8.4 and
before, whereas this package requires Tcl 8.5 or higher, and
\fBTclOO\fR.
.PP
Packages related to this are \fBtcl::chan::string\fR and
\fBtcl::chan::variable\fR.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::memchan\fR
This command creates a new memchan channel and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
in-memory channel, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/null.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/null.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::null" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::null \- Null channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::null  ?1?\fR
.sp
\fB::tcl::chan::null\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::null\fR package provides a command creating null
channels, i.e. write-only channels which immediately forget whatever
is written to them. This is equivalent to the null channels provided by
the package \fBMemchan\fR, except that this is written in pure Tcl,
not C. On the other hand, \fBMemchan\fR is usable with Tcl 8.4 and
before, whereas this package requires Tcl 8.5 or higher, and
\fBTclOO\fR.
.PP
Packages related to this are \fBtcl::chan::zero\fR and
\fBtcl::chan::nullzero\fR.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::null\fR
This command creates a new null channel and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
/dev/null, null, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/nullzero.n.


































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/nullzero.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::nullzero" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::nullzero \- Null/Zero channel combination
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::nullzero  ?1?\fR
.sp
\fB::tcl::chan::nullzero\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::nullzero\fR package provides a command creating channels,
which are a combination of null and zero devices. They immediately forget
whatever is written to them, and on reading return an infinite stream of null
characters.
.PP
Packages related to this are \fBtcl::chan::null\fR and
\fBtcl::chan::zero\fR.
.PP
The internal \fBTclOO\fR class implementing the channel handler
is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::nullzero\fR
This command creates a new nullzero channel and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
/dev/null, /dev/zero, null, reflected channel, tip 219, virtual channel, zero
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/random.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/random.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::random" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::random \- Random channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::random  ?1?\fR
.sp
\fB::tcl::chan::random\fR \fIseed\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::random\fR package provides a command creating
random channels, i.e. read-only channels which return an infinite
stream of pseudo-random characters upon reading. This is similar to
the random channels provided by the package \fBMemchan\fR, except
that this is written in pure Tcl, not C, and uses a much simpler
generator as well. On the other hand, \fBMemchan\fR is usable with
Tcl 8.4 and before, whereas this package requires Tcl 8.5 or higher,
and TclOO.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::random\fR \fIseed\fR
This command creates a new random channel and returns its handle.
The seed is a list of integer numbers used to initialize the
internal feedback shift register of the generator.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
/dev/random, random, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/randseed.n.
































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/randseed.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::randseed" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::randseed \- Utilities for random channels
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::randseed  ?1?\fR
.sp
\fB::tcl::randomseed\fR
.sp
\fB::tcl::combine\fR \fIseed1\fR \fIseed2\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::randseed\fR package provides a a few utility commands to help with the seeding of \fBtcl::chan::random\fR channels.
.SH API
.TP
\fB::tcl::randomseed\fR
This command creates returns a list of seed integers suitable as seed
argument for random channels. The numbers are derived from the process
id, current time, and Tcl random number generator.
.TP
\fB::tcl::combine\fR \fIseed1\fR \fIseed2\fR
This command takes to seed lists and combines them into a single list
by XORing them elementwise, modulo 256. If the lists are not of equial
length the shorter of the two is padded with 0s before merging.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
/dev/random, merge, random, reflected channel, seed, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/std.n.


































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/std.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::std" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::std \- Standard I/O, unification of stdin and stdout
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::core  ?1?\fR
.sp
package require \fBtcl::chan::std  ?1?\fR
.sp
\fB::tcl::chan::std\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::std\fR package provides a command creating
a standard channel which unifies stdin and stdout into a single
read- and writable channel. The result is not seek-able, like
the original standard channels.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::core\fR framework.
.SH API
.TP
\fB::tcl::chan::std\fR
This command creates the std channel and returns its handle.
.sp
The channel is created only once, on the first call, and all
future calls simply return this handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
reflected channel, standard io, stdin, stdout, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2011 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/string.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/string.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::string" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::string \- Read-only in-memory channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::string  ?1?\fR
.sp
\fB::tcl::chan::string\fR \fIcontent\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::string\fR package provides a command creating
channels which live purely in memory. They provide random-access,
i.e. are seekable.
In contrast to the channels created by \fBtcl::chan::memchan\fR
they are read-only however, their content is provided at the time of
construction and immutable afterward.
.PP
Packages related to this are \fBtcl::chan::memchan\fR and
\fBtcl::chan::variable\fR.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::string\fR \fIcontent\fR
This command creates a new string channel and returns its handle. The
channel provides random read-only access to the \fIcontent\fR string.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
in-memory channel, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/textwindow.n.































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/textwindow.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::textwindow" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::textwindow \- Textwindow channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::textwindow  ?1?\fR
.sp
\fB::tcl::chan::textwindow\fR \fIwidget\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::textwindow\fR package provides a command creating
write-only channels connected to text widgets. Anything written to the
channel is printed into the associated widget.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::textwindow\fR \fIwidget\fR
This command creates a new textwindow channel and returns its handle.
Data written to this channel will appear in the associated \fIwidget\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
Tk, reflected channel, text widget, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/variable.n.






































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/variable.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::variable" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::variable \- In-memory channel using variable for storage
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::variable  ?1?\fR
.sp
\fB::tcl::chan::variable\fR \fIvarname\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::variable\fR package provides a command creating
channels which live purely in memory. They provide random-access,
i.e. are seekable.
In contrast to the channels created by \fBtcl::chan::memchan\fR
the data is not hidden in the channel however, but stored in an
associated variable, specified at the time of construction.
.PP
Packages related to this are \fBtcl::chan::memchan\fR and
\fBtcl::chan::string\fR.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::variable\fR \fIvarname\fR
This command creates a new variable channel and returns its handle.
The content of the channel is stored in the associated namespace
variable \fIvarname\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
in-memory channel, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_base/zero.n.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_base/zero.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::zero" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::zero \- Zero channel
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
package require \fBtcl::chan::zero  ?1?\fR
.sp
\fB::tcl::chan::zero\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::zero\fR package provides a command creating zero
channels, i.e. read-only channels which return an infinite stream of null
characters upon reading. This is equivalent to the zero channels
provided by the package \fBMemchan\fR, except that this is written
in pure Tcl, not C. On the other hand, \fBMemchan\fR is usable with
Tcl 8.4 and before, whereas this package requires Tcl 8.5 or higher,
and TclOO.
.PP
Packages related to this are \fBtcl::chan::null\fR and
\fBtcl::chan::nullzero\fR.
.PP
The internal \fBTclOO\fR class implementing the channel
handler is a sub-class of the \fBtcl::chan::events\fR framework.
.SH API
.TP
\fB::tcl::chan::zero\fR
This command creates a new zero channel and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
/dev/zero, reflected channel, tip 219, virtual channel, zero
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_core/core.n.































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_core/core.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::core" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::core \- Basic reflected/virtual channel support
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::core  ?1?\fR
.sp
\fB::tcl::chan::core\fR \fIobjectName\fR
.sp
\fIobjectName\fR \fBinitialize\fR \fIthechannel\fR \fImode\fR
.sp
\fIobjectName\fR \fBfinalize\fR \fIthechannel\fR
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::core\fR package provides a \fBTclOO\fR
class implementing common behaviour needed by virtually every
reflected or virtual channel (initialization, finalization).
.PP
This class expects to be used as either superclass of a concrete
channel class, or to be mixed into such a class.
.SH "CLASS API"
.TP
\fB::tcl::chan::core\fR \fIobjectName\fR
This command creates a new channel core object with an associated
global Tcl command whose name is \fIobjectName\fR. This command may
be used to invoke various operations on the object, as described in
the section for the \fBInstance API\fR.
.PP
.SH "INSTANCE API"
The API of channel core instances provides only two methods, both
corresponding to channel handler commands (For reference see
\fITIP 219\fR [http:/tip.tcl.tk/219]). They expect to be called
from whichever object instance the channel core was made a part of.
.TP
\fIobjectName\fR \fBinitialize\fR \fIthechannel\fR \fImode\fR
This method implements standard behaviour for the \fBinitialize\fR
method of channel handlers. Using introspection it finds the handler
methods supported by the instance and returns a list containing their
names, as expected by the support for reflected channels in the Tcl
core.
.sp
It further remembers the channel handle in an instance variable
for access by sub-classes.
.TP
\fIobjectName\fR \fBfinalize\fR \fIthechannel\fR
This method implements standard behaviour for the \fBfinalize\fR
method of channel handlers. It simply destroys itself.
.TP
\fIobjectName\fR \fBdestroy\fR
Destroying the channel core instance closes the channel it was
initialized for, see the method \fBinitialize\fR. When destroyed
from within a call of \fBfinalize\fR this does not happen, under
the assumption that the channel is being destroyed by Tcl.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_core/events.n.








































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_core/events.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::chan::events" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::chan::events \- Event support for reflected/virtual channels
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::chan::core  ?1?\fR
.sp
package require \fBtcl::chan::events  ?1?\fR
.sp
\fB::tcl::chan::events\fR \fIobjectName\fR
.sp
\fIobjectName\fR \fBfinalize\fR \fIthechannel\fR
.sp
\fIobjectName\fR \fBwatch\fR \fIthechannel\fR \fIeventmask\fR
.sp
\fIobjectName\fR \fBallow\fR \fIeventname\fR...
.sp
\fIobjectName\fR \fBdisallow\fR \fIeventname\fR...
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::chan::events\fR package provides a \fBTclOO\fR
class implementing common behaviour needed by virtually every
reflected or virtual channel supporting event driven IO. It is a
sub-class of \fBtcl::chan::core\fR, inheriting all of its behaviour.
.PP
This class expects to be used as either superclass of a concrete
channel class, or to be mixed into such a class.
.SH "CLASS API"
.TP
\fB::tcl::chan::events\fR \fIobjectName\fR
This command creates a new channel event core object with an associated
global Tcl command whose name is \fIobjectName\fR. This command may
be used to invoke various operations on the object, as described in
the section for the \fBInstance API\fR.
.PP
.SH "INSTANCE API"
The API of channel event core instances provides only four methods, two
corresponding to channel handler commands (For reference see
\fITIP 219\fR [http:/tip.tcl.tk/219]), and the other two for use by
sub-classes to control event generation. They former expect to be called
from whichever object instance the channel event core was made a part of.
.TP
\fIobjectName\fR \fBfinalize\fR \fIthechannel\fR
This method implements standard behaviour for the \fBfinalize\fR
method of channel handlers. It overrides the behaviour inherited from
\fBtcl::chan::core\fR and additionally disables any and all event
generation before destroying itself.
.TP
\fIobjectName\fR \fBwatch\fR \fIthechannel\fR \fIeventmask\fR
This method implements standard behaviour for the \fBwatch\fR
method of channel handlers. Called by the IO system whenever the
interest in event changes it updates the instance state to activate
and/or suppress the generation of the events of (non-)interest.
.TP
\fIobjectName\fR \fBallow\fR \fIeventname\fR...
.TP
\fIobjectName\fR \fBdisallow\fR \fIeventname\fR...
These two methods are exported to sub-classes, so that their instances
can notify their event core of the events the channel they implement
can (allow) or cannot (disallow) generate.
Together with the information about the events requested by Tcl's IO
system coming in through the \fBwatch\fR method the event core is
able to determine which events it should (not) generate and act
accordingly.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
event management, reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_core/transformcore.n.































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_core/transformcore.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::core" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::core \- Basic reflected/virtual channel transform support
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTclOO \fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
\fB::tcl::transform::core\fR \fIobjectName\fR
.sp
\fIobjectName\fR \fBinitialize\fR \fIthechannel\fR \fImode\fR
.sp
\fIobjectName\fR \fBfinalize\fR \fIthechannel\fR
.sp
\fIobjectName\fR \fBdestroy\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::core\fR package provides a \fBTclOO\fR
class implementing common behaviour needed by virtually every
reflected or virtual channel transformation (initialization, finalization).
.PP
This class expects to be used as either superclass of a concrete
channel class, or to be mixed into such a class.
.SH "CLASS API"
.TP
\fB::tcl::transform::core\fR \fIobjectName\fR
This command creates a new transform core object with an associated
global Tcl command whose name is \fIobjectName\fR. This command may
be used to invoke various operations on the object, as described in
the section for the \fBInstance API\fR.
.PP
.SH "INSTANCE API"
The API of transform core instances provides only two methods, both
corresponding to transform handler commands (For reference see
\fITIP 230\fR [http:/tip.tcl.tk/230]). They expect to be called
from whichever object instance the transform core was made a part of.
.TP
\fIobjectName\fR \fBinitialize\fR \fIthechannel\fR \fImode\fR
This method implements standard behaviour for the \fBinitialize\fR
method of transform handlers. Using introspection it finds the handler
methods supported by the instance and returns a list containing their
names, as expected by the support for reflected transformation in the
Tcl core.
.sp
It further remembers the channel handle in an instance variable
for access by sub-classes.
.TP
\fIobjectName\fR \fBfinalize\fR \fIthechannel\fR
This method implements standard behaviour for the \fBfinalize\fR
method of channel handlers. It simply destroys itself.
.TP
\fIobjectName\fR \fBdestroy\fR
Destroying the transform core instance closes the channel and transform
it was initialized for, see the method \fBinitialize\fR. When destroyed
from within a call of \fBfinalize\fR this does not happen, under
the assumption that the channel and transform are being destroyed by Tcl.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
reflected channel, tip 219, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/adler32.n.

























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/adler32.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::adler32" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::adler32 \- Adler32 transformation
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::adler32  ?1?\fR
.sp
\fB::tcl::transform::adler32\fR \fIchan\fR \fB-option\fR \fIvalue\fR...
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::adler32\fR package provides a command
creating a channel transformation which passes the read and written
bytes through unchanged (like \fBtcl::transform::identity\fR), but
additionally continuously computes the adler32 checksums of the data
it has seen for each direction and stores them in Tcl variables
specified at construction time.
.PP
Related transformations in this module are
\fBtcl::transform::counter\fR,
\fBtcl::transform::crc32\fR,
\fBtcl::transform::identity\fR, and
\fBtcl::transform::observe\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::adler32\fR \fIchan\fR \fB-option\fR \fIvalue\fR...
This command creates an adler32 checksumming transformation on top of
the channel \fIchan\fR and returns its handle. The accepted options are
.RS
.TP
\fB-read-variable\fR varname
The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
adler32 checksum of the data read from the channel.
.sp
If not specified, or the empty string, the checksum of the read
direction is not saved.
.TP
\fB-write-variable\fR varname
The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
adler32 checksum of the data written to the channel.
.sp
If not specified, or the empty string, the checksum of the
write direction is not saved.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
adler32, channel transformation, checksum, reflected channel, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/base64.n.

































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/base64.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::base64" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::base64 \- Base64 encoding transformation
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::base64  ?1?\fR
.sp
\fB::tcl::transform::base64\fR \fIchan\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::base64\fR package provides a command
creating a channel transformation which base64 encodes data written to
it, and decodes the data read from it.
.PP
A related transformations in this module is
\fBtcl::transform::hex\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::base64\fR \fIchan\fR
This command creates a base64 transformation on top of the channel
\fIchan\fR and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
base64, channel transformation, reflected channel, tip 230, tip 317, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/counter.n.
























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/counter.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::counter" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::counter \- Counter transformation
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::counter  ?1?\fR
.sp
\fB::tcl::transform::counter\fR \fIchan\fR \fB-option\fR \fIvalue\fR...
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::counterr\fR package provides a command
creating a channel transformation which passes the read and written
bytes through unchanged (like \fBtcl::transform::identity\fR), but
additionally counts the bytes it has seen for each direction and
stores these counts in Tcl variables specified at construction time.
.PP
Related transformations in this module are
\fBtcl::transform::adler32\fR,
\fBtcl::transform::crc32\fR,
\fBtcl::transform::identity\fR, and
\fBtcl::transform::observe\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::counter\fR \fIchan\fR \fB-option\fR \fIvalue\fR...
This command creates a counter transformation on top of the channel
\fIchan\fR and returns its handle. The accepted options are
.RS
.TP
\fB-read-variable\fR varname
The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
byte count of the data read from the channel.
.sp
If not specified, or the empty string, the counter of the read
direction is not saved.
.TP
\fB-write-variable\fR varname
The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
byte count of the data written to the channel.
.sp
If not specified, or the empty string, the counter of the
write direction is not saved.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, counter, reflected channel, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/crc32.n.

























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/crc32.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::crc32" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::crc32 \- Crc32 transformation
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::crc32  ?1?\fR
.sp
\fB::tcl::transform::crc32\fR \fIchan\fR \fB-option\fR \fIvalue\fR...
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::crc32\fR package provides a command
creating a channel transformation which passes the read and written
bytes through unchanged (like \fBtcl::transform::identity\fR), but
additionally continuously computes the crc32 checksums of the data it
has seen for each direction and stores them in Tcl variables specified
at construction time. The checksum in question is zlib's crc32.
.PP
Related transformations in this module are
\fBtcl::transform::adler32\fR,
\fBtcl::transform::counter\fR,
\fBtcl::transform::identity\fR, and
\fBtcl::transform::observe\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::crc32\fR \fIchan\fR \fB-option\fR \fIvalue\fR...
This command creates a crc32 checksumming transformation on top of
the channel \fIchan\fR and returns its handle. The accepted options are
.RS
.TP
\fB-read-variable\fR varname
The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
crc32 checksum of the data read from the channel.
.sp
If not specified, or the empty string, the checksum of the read
direction is not saved.
.TP
\fB-write-variable\fR varname
The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
crc32 checksum of the data written to the channel.
.sp
If not specified, or the empty string, the checksum of the
write direction is not saved.
.RE
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, checksum, crc32, reflected channel, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/hex.n.

































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/hex.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::hex" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::hex \- Hexadecimal encoding transformation
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::hex  ?1?\fR
.sp
\fB::tcl::transform::hex\fR \fIchan\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::hex\fR package provides a command creating
a channel transformation which hex encodes data written to it, and
decodes the data read from it.
.PP
A related transformations in this module is
\fBtcl::transform::base64\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::hex\fR \fIchan\fR
This command creates a hex transformation on top of the channel
\fIchan\fR and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, hexadecimal, reflected channel, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/identity.n.








































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/identity.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::identity" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::identity \- Identity transformation
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::identity  ?1?\fR
.sp
\fB::tcl::transform::identity\fR \fIchan\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::identity\fR package provides a command
creating an identity channel transformation, which does nothing but
pass the read and written bytes through it unchanged. Not really
useful in an application, however as the prototypical observer
transformation its code is a useful starting point for any other
observers people may wish to write.
.PP
The transformations in this module which derived from
identity's code are
\fBtcl::transform::adler32\fR,
\fBtcl::transform::counter\fR,
\fBtcl::transform::crc32\fR, and
\fBtcl::transform::observe\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::identity\fR \fIchan\fR
This command creates an identity transformation on top of the channel
\fIchan\fR and returns its handle.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, identity, reflected channel, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/limitsize.n.



































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/limitsize.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::limitsize" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::limitsize \- limiting input
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::limitsize  ?1?\fR
.sp
\fB::tcl::transform::limitsize\fR \fIchan\fR \fImax\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::limitsize\fR package provides a command
creating a channel transformation which limits the number of
characters which can be read from the channel. A generator for an
artificial EOF.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::limitsize\fR \fIchan\fR \fImax\fR
This command creates a size limiting transformation on top of the
channel \fIchan\fR and returns its handle.
.sp
\fImax\fR is the number of bytes which can be read from the
channel before EOF is signaled by the transformation. Note that
popping the transformation clears the EOF it generated as well.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, limitsize, reflected channel, size limit, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/observe.n.







































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/observe.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::observe" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::observe \- Observer transformation, stream copy
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::observe  ?1?\fR
.sp
\fB::tcl::transform::observe\fR \fIchan\fR \fIlogw\fR \fIlogr\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::observer\fR package provides a command
creating a channel transformation which passes the read and written
bytes through unchanged (like \fBtcl::transform::identity\fR), but
additionally copies the data it has seen for each direction into
channels specified at construction time.
.PP
Related transformations in this module are
\fBtcl::transform::adler32\fR,
\fBtcl::transform::counter\fR,
\fBtcl::transform::crc32\fR, and
\fBtcl::transform::identity\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::observe\fR \fIchan\fR \fIlogw\fR \fIlogr\fR
This command creates an observer transformation on top of the channel
\fIchan\fR and returns its handle. The channel handles \fIlogr\fR and
\fIlogw\fR are there the data is copied to.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, observer, reflected channel, stream copy, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/otp.n.






































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/otp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::otp" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::otp \- Encryption via one-time pad
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::otp  ?1?\fR
.sp
\fB::tcl::transform::otp\fR \fIchan\fR \fIkeychanw\fR \fIkeychanr\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::otp\fR package provides a command creating
a channel transformation which uses externally provided one-time pads
to perform encryption (on writing) and decryption (on reading).
.PP
A related transformations in this module is
\fBtcl::transform::rot\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::otp\fR \fIchan\fR \fIkeychanw\fR \fIkeychanr\fR
This command creates a one-time pad based encryption transformation on
top of the channel \fIchan\fR and returns its handle.
.sp
The two channels \fIkeychanw\fR and \fIkeychanr\fR contain the
one-time pads for the write and read directions, respectively. Their
contents are reads and xored with the bytes written to and read from
the channel.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, cipher, decryption, encryption, one time pad, otp, reflected channel, tip 230, transformation, virtual channel, xor
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/rot.n.










































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/rot.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::rot" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::rot \- rot-encryption
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::rot  ?1?\fR
.sp
\fB::tcl::transform::rot\fR \fIchan\fR \fIkey\fR
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::rot\fR package provides a command creating
a channel transformation which performs primitive encryption (on
writing) and decryption (on reading) on the alphabetic characters. The
algorithm is the Caesar-cipher, a specific variant of which is rot13.
.PP
A related transformations in this module is
\fBtcl::transform::otp\fR.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::rot\fR \fIchan\fR \fIkey\fR
This command creates a rot encryption transformation on top of the
channel \fIchan\fR and returns its handle.
.sp
The "\fIkey\fR" specifies how far characters are rotated in the
alphabet, and is wrapped to the range "0...25".
.sp
Note that this transformation affects only bytes in the ranges
ASCII 65...90, and 97...122, i.e. the upper- and lower-case alphabetic
characters, i.e. "A...Z" and "a...z". All other bytes are passed
through unchanged.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
caesar cipher, channel transformation, cipher, decryption, encryption, reflected channel, rot, rot13, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/spacer.n.



































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/spacer.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::spacer" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::spacer \- Space insertation and removal
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::spacer  ?1?\fR
.sp
\fB::tcl::transform::spacer\fR \fIchan\fR \fIn\fR ?\fIspace\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::spacer\fR package provides a command
creating a channel transformation which adds spacing to the data
written to it, and removes such spacing from the data read from it.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::spacer\fR \fIchan\fR \fIn\fR ?\fIspace\fR?
This command creates a spacer transformation on top of the channel
\fIchan\fR and returns its handle.
.sp
The \fIspace\fR character sequence will be added every \fIn\fR
bytes of data written, and on the read side the same is done in
reverse, removing the spacing. If \fIspace\fR is not specified it
defaults to a single space character (ASCII 32).
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, reflected channel, spacing, tip 230, transformation, virtual channel
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/virtchannel_transform/zlib.n.

































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/virtchannel_transform/zlib.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "tcl::transform::zlib" n 1 tcllib "Reflected/virtual channel support"
.BS
.SH NAME
tcl::transform::zlib \- zlib (de)compression
.SH SYNOPSIS
package require \fBTcl  8.6\fR
.sp
package require \fBtcl::transform::core  ?1?\fR
.sp
package require \fBtcl::transform::zlib  ?1?\fR
.sp
\fB::tcl::transform::zlib\fR \fIchan\fR ?\fIlevel\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The \fBtcl::transform::zlib\fR package provides a command creating
a channel transformation which zlib compresses the written data, and
decompresses on reading.
.PP
The internal \fBTclOO\fR class implementing the transform
handler is a sub-class of the \fBtcl::transform::core\fR
framework.
.SH API
.TP
\fB::tcl::transform::zlib\fR \fIchan\fR ?\fIlevel\fR?
This command creates a zlib compressor transformation on top of the
channel \fIchan\fR and returns its handle.
.sp
The \fIlevel\fR specifies how much effort is put into the
compression, from \fB0\fR to \fB9\fR, and defaults to \fB4\fR.
.PP
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIvirtchannel\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
channel transformation, compression, decompression, reflected channel, tip 230, tip 234, transformation, virtual channel, zlib
.SH CATEGORY
Channels
.SH COPYRIGHT
.nf
Copyright (c) 2009 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/wip/wip.n.

































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/wip/wip.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2007-2010 Andreas Kupries <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "wip" n 2.2 tcllib "Word Interpreter"
.BS
.SH NAME
wip \- Word Interpreter
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBwip  ?2.2?\fR
.sp
package require \fBsnit  ?1.3?\fR
.sp
package require \fBstruct::set \fR
.sp
\fB::wip\fR \fIwipName\fR \fIengine\fR \fIarg\fR...
.sp
\fBdef\fR \fIname\fR
.sp
\fBdef\fR \fIname\fR \fImethod_prefix\fR
.sp
\fBwipName\fR \fIoption\fR ?\fIarg arg ...\fR?
.sp
\fBwip::dsl\fR ?\fIsuffix\fR?
.sp
\fIwipName\fR \fBdef\fR \fIname\fR ?\fImethod_prefix\fR?
.sp
\fIwipName\fR \fBdefl\fR \fInames\fR
.sp
\fIwipName\fR \fBdefd\fR \fIdict\fR
.sp
\fIwipName\fR \fBdeflva\fR \fIname\fR...
.sp
\fIwipName\fR \fBdefdva\fR (\fIname\fR \fImethod_prefix\fR)...
.sp
\fIwipName\fR \fBundefl\fR \fInames\fR
.sp
\fIwipName\fR \fBundefva\fR \fIname\fR...
.sp
\fIwipName\fR \fBunknown\fR \fIcmdprefix\fR
.sp
\fIwipName\fR \fBrunl\fR \fIwordlist\fR
.sp
\fIwipName\fR \fBrun\fR \fIword\fR...
.sp
\fIwipName\fR \fBrun_next\fR
.sp
\fIwipName\fR \fBrun_next_while\fR \fIacceptable\fR
.sp
\fIwipName\fR \fBrun_next_until\fR \fIrejected\fR
.sp
\fIwipName\fR \fBrun_next_if\fR \fIacceptable\fR
.sp
\fIwipName\fR \fBrun_next_ifnot\fR \fIrejected\fR
.sp
\fIwipName\fR \fBnext\fR
.sp
\fIwipName\fR \fBpeek\fR
.sp
\fIwipName\fR \fBpeekall\fR
.sp
\fIwipName\fR \fBinsertl\fR \fIat\fR \fIwordlist\fR
.sp
\fIwipName\fR \fBreplacel\fR \fIwordlist\fR
.sp
\fIwipName\fR \fBpushl\fR \fIwordlist\fR
.sp
\fIwipName\fR \fBaddl\fR \fIwordlist\fR
.sp
\fIwipName\fR \fBinsert\fR \fIat\fR \fIword\fR...
.sp
\fIwipName\fR \fBreplace\fR \fIword\fR...
.sp
\fIwipName\fR \fBpush\fR \fIword\fR...
.sp
\fIwipName\fR \fBadd\fR \fIword\fR...
.sp
.BE
.SH DESCRIPTION
.PP
This package provides a micro interpreter for lists of words. Domain
specific languages based on this will have a bit of a Forth feel, with
the input stream segmented into words and any other structuring left
to whatever the language desired. Note that we have here in essence
only the core dispatch loop, and no actual commands whatsoever, making
this definitely only a Forth feel and not an actual Forth.
.PP
The idea is derived from Colin McCormack's \fBtreeql\fR processor,
modified to require less boiler plate within the command
implementations, at the expense of, likely, execution speed. In
addition the interface between processor core and commands is more
complex too.
.SH "GENERAL BEHAVIOUR"
Word interpreters have a mappping from the names of the language
commands they shall recognize to the methods in the engine to invoke
for them, and possibly fixed arguments for these methods. This mapping
is largely static, however it is possible to change it during the
execution of a word list (= program).
.PP
At the time a language command is defined the word interpreter will
use \fBsnit\fR's introspection capabilities to determine the
number of arguments expected by the method of the egnine, and together
with the number of fixed arguments supplied in the method prefix of
the mapping it then knows how many arguments the language command is
expecting. This is the command's \fIarity\fR. Variable-argument
methods (i.e. with the last argument named \fIargs\fR) are \fInot\fR
allowed and will cause the word interpreter to throw an error at
definition time.
.PP
Note that while I said \fBsnit\fR's abilities the engine object
can be written in any way, as long as it understands the method
\fBinfo args\fR, which takes a method name and returns the list
of arguments for that method.
.PP
When executing a list of words (aka program) the first word is always
taken as the name of a language command, and the next words as its
arguments, per the \fIarity\fR of the command. Command and argument
words are removed from the list and then associated method of the
engine is executed with the argument words. The process then repeats
using the then-first word of the list.
.PP
Note that the methods implementing the language commands may have full
access to the list of words and are allowed to manipulate as they see
fit.
.IP [1]
This means, for example, that while we cannot specify
variable-argument methods directly they can consume words after their
fixed arguments before returning to the execution loop. This may be
under the control of their fixed arguments.
.IP [2]
Another possibility is the use of method \fBrun_next\fR and its
variants to execute commands coming after the current command,
changing the order of execution.
.IP [3]
Execution can be further changed by use of the program accessor
methods which allow a command implementation to modify the remaining
list of words (insert, replace, prepend, append words) without
executing them immediately.
.IP [4]
At last the basic \fBrun\fR methods save and restore an existing
list of words when used, enabling recursive use from within command
implementations.
.PP
.SH "CLASS API"
The main command of the package is:
.TP
\fB::wip\fR \fIwipName\fR \fIengine\fR \fIarg\fR...
The command creates a new word interpreter object with an associated
global Tcl command whose name is \fIwipName\fR. If however the string
\fB%AUTO%\fR was used as object name the package will generate its
own unique name for the object.
.sp
The \fIengine\fR is the object the word interpreter will dispatch all
recognized commands to, and the \fIarg\fRuments are a word list which
defines an initial mapping from language words to engine methods.
.sp
The recognized language of this word list is
.RS
.TP
\fBdef\fR \fIname\fR
Defines \fIname\fR as command of the language, to be mapped to a
method of the \fIengine\fR having the same name.
.TP
\fBdef\fR \fIname\fR \fImethod_prefix\fR
Defines \fIname\fR as command of the language, to be mapped to the
method of the \fIengine\fR named in the \fImethod_prefix\fR.
.RE
.sp
The returned command may be used to invoke various operations on the
object.  It has the following general form:
.RS
.TP
\fBwipName\fR \fIoption\fR ?\fIarg arg ...\fR?
\fIOption\fR and the \fIarg\fRs determine the exact behavior of the
command.
.RE
.PP
The package additionally exports the command:
.TP
\fBwip::dsl\fR ?\fIsuffix\fR?
This command is for use within snit types which wish to use one or
more wip interpreters as a component. Use within the type definition
installs most of the boilerplate needed to setup and use a word
interpreter.
.sp
It installs a component named \fIwip\fR, and a method
\fBwip_setup\fR for initializing it. This method has to be called
from within the constructor of the type using the word interpreter.
If further installs a series of procedures which make the object API
of the word interpreter directly available to the type's methods,
without having to specify the component.
.sp
\fINote\fR that this does and cannot install the language to
interpret, i.e. the mapping from words to engine methods.
.sp
It is possible to instantiate multiple word interpreter components
within a type by using different suffices as arguments to the command.
In that case the name of the component changes to
\'wip_\fB$suffix\fR', the setup command becomes
\'wip_\fB$suffix\fR_setup' and all the procedures also get the suffix
\'_\fB$suffix\fR'.
.PP
.SH "OBJECT API"
The following commands are possible for word interpreter objects:
.TP
\fIwipName\fR \fBdef\fR \fIname\fR ?\fImethod_prefix\fR?
Defines a language command \fIname\fR and maps it to the method named
in the engine's \fImethod_prefix\fR. If the \fImethod_prefix\fR name
is not specified it is simply the name of the language command.
.TP
\fIwipName\fR \fBdefl\fR \fInames\fR
Defines a series of language commands, specified through the list of
\fInames\fR, all of which are mapped to engine methods of the same
name.
.TP
\fIwipName\fR \fBdefd\fR \fIdict\fR
Defines a series of language commands, specified through the
dictionary \fIdict\fR of names and method prefixes.
.TP
\fIwipName\fR \fBdeflva\fR \fIname\fR...
As method \fBdefl\fR, however the list of names is specified
through multiple arguments.
.TP
\fIwipName\fR \fBdefdva\fR (\fIname\fR \fImethod_prefix\fR)...
As method \fBdefd\fR, however the dictionary of names and method
prefixes is specified through multiple arguments.
.TP
\fIwipName\fR \fBundefl\fR \fInames\fR
Removes the named series of language commands from the mapping.
.TP
\fIwipName\fR \fBundefva\fR \fIname\fR...
As method \fBundefl\fR, however the list of names is specified
through multiple arguments.
.TP
\fIwipName\fR \fBunknown\fR \fIcmdprefix\fR
Sets the handler for unknown words to \fIcmdprefix\fR. This command
prefix takes one argument, the current word, and either throws some
error, or returns the result of executing the word, as defined by the
handler. The default handler simply throws an error.
.TP
\fIwipName\fR \fBrunl\fR \fIwordlist\fR
Treats the list of words in \fIwordlist\fR as a program and executes
the contained command one by one. The result of the command executed
last is returned as the result of this command.
.sp
The \fIwordlist\fR is stored in the object for access by the other
\fIrun\fR-methods, and the general program accessor methods (see
below). A previously stored wordlist is saved during the execution of
this method and restored before it returns. This enables the recursive
execution of word lists within word lists.
.TP
\fIwipName\fR \fBrun\fR \fIword\fR...
As method \fBrunl\fR, however the list of words to execute is
specified through multiple arguments.
.TP
\fIwipName\fR \fBrun_next\fR
Low-level method. Determines the next word in the list of words, and
its arguments, and then executes it. The result of the executed word
is the result of this method.
.sp
Exposed for use within command implementations.
The methods \fBrun\fR and \fBrunl\fR use it to execute words
until their word list is exhausted.
.TP
\fIwipName\fR \fBrun_next_while\fR \fIacceptable\fR
Low-level method. Invokes the method \fBrun_next\fR as long as the
next word is in the set of \fIacceptable\fR words, and the program is
not empty. The result of the command executed last is returned as the
result of this command.
.sp
Exposed for use within command implementations to change the order of
execution.
.TP
\fIwipName\fR \fBrun_next_until\fR \fIrejected\fR
Low-level method. Invokes the method \fBrun_next\fR until the next
word is in the set of \fIrejected\fR words, and the program is not
empty. The result of the command executed last is returned as the
result of this command.
.sp
Exposed for use within command implementations to change the order of
execution.
.TP
\fIwipName\fR \fBrun_next_if\fR \fIacceptable\fR
Low-level method. Invokes the method \fBrun_next\fR if the next
word is in the set of \fIacceptable\fR words, and the program is not
empty. The result of the command executed last is returned as the
result of this command.
.sp
Exposed for use within command implementations to change the order of
execution.
.TP
\fIwipName\fR \fBrun_next_ifnot\fR \fIrejected\fR
Low-level method. Invokes the method \fBrun_next\fR if the next
word is not in the set of \fIrejected\fR words, and the program is not
empty. The result of the command executed last is returned as the
result of this command.
.sp
Exposed for use within command implementations to change the order of
execution.
.TP
\fIwipName\fR \fBnext\fR
Returns the next word in the programm. The word is also removed.
.TP
\fIwipName\fR \fBpeek\fR
Returns the next word in the programm without removing it
.TP
\fIwipName\fR \fBpeekall\fR
Returns the remaining programm in toto.
.TP
\fIwipName\fR \fBinsertl\fR \fIat\fR \fIwordlist\fR
Basic programm accessor method. Inserts the specified \fIwordlist\fR
into the program, just before the word at position \fIat\fR. Positions
are counted from \fBzero\fR.
.TP
\fIwipName\fR \fBreplacel\fR \fIwordlist\fR
Basic programm accessor method. Replaces the whole stored program with
the specified \fIwordlist\fR.
.TP
\fIwipName\fR \fBpushl\fR \fIwordlist\fR
Program accessor method. The specified \fIwordlist\fR is added to the
front of the remaining program. Equivalent to
.sp
.CS

$wip insertl 0 $wordlist
.CE
.TP
\fIwipName\fR \fBaddl\fR \fIwordlist\fR
Program accessor method. The specified \fIwordlist\fR is appended at
the end of the remaining program. Equivalent to
.sp
.CS

$wip insertl end $wordlist
.CE
.TP
\fIwipName\fR \fBinsert\fR \fIat\fR \fIword\fR...
Like method \fBinsertl\fR, except the words are specified through
multiple arguments.
.TP
\fIwipName\fR \fBreplace\fR \fIword\fR...
Like method \fBsetl\fR, except the words are specified through
multiple arguments.
.TP
\fIwipName\fR \fBpush\fR \fIword\fR...
Like method \fBpushl\fR, except the words are specified through
multiple arguments.
.TP
\fIwipName\fR \fBadd\fR \fIword\fR...
Like method \fBaddl\fR, except the words are specified through
multiple arguments.
.PP
.SH EXAMPLES
No examples yet.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIwip\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH KEYWORDS
interpreter, list, word
.SH CATEGORY
Programming tools
.SH COPYRIGHT
.nf
Copyright (c) 2007-2010 Andreas Kupries <[email protected]>

.fi

Added embedded/man/files/modules/yaml/huddle.n.





























































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/yaml/huddle.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 KATO Kanryu <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "huddle" n 0.1.5 tcllib "HUDDLE"
.BS
.SH NAME
huddle \- Create and manipulate huddle object
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fBhuddle  ?0.1.5?\fR
.sp
\fBhuddle create\fR \fIkey\fR \fIvalue\fR ?\fIkey value ...\fR?
.sp
\fBhuddle list\fR ?\fIvalue value ...\fR?
.sp
\fBhuddle get\fR \fIobject\fR \fIkey\fR ?\fIkey ...\fR?
.sp
\fBhuddle gets\fR \fIobject\fR \fIkey\fR ?\fIkey ...\fR?
.sp
\fBhuddle set\fR \fIobjectVar\fR \fIkey\fR ?\fIkey ...\fR? \fIvalue\fR
.sp
\fBhuddle remove\fR \fIobject\fR \fIkey\fR ?\fIkey ...\fR?
.sp
\fBhuddle combine\fR \fIobject1\fR \fIobject2\fR ?\fIobject3 ...\fR?
.sp
\fBhuddle equal\fR \fIobject1\fR \fIobject2\fR
.sp
\fBhuddle append\fR \fIobjectVar\fR \fIkey\fR \fIvalue\fR ?\fIkey value ...\fR?
.sp
\fBhuddle append\fR \fIobjectVar\fR \fIvalue\fR ?\fIvalue ...\fR?
.sp
\fBhuddle keys\fR \fIobject\fR
.sp
\fBhuddle llength\fR \fIobject\fR
.sp
\fBhuddle type\fR \fIobject\fR ?\fIkey key...\fR?
.sp
\fBhuddle strip\fR \fIobject\fR
.sp
\fBhuddle jsondump\fR \fIobject\fR ?\fIoffset\fR? ?\fInewline\fR? ?\fIbegin_offset\fR?
.sp
\fBhuddle compile\fR \fIspec\fR \fIdata\fR
.sp
\fBhuddle isHuddle\fR \fIobject\fR
.sp
\fBhuddle checkHuddle\fR \fIobject\fR
.sp
\fBhuddle to_node\fR \fIobject\fR ?\fItag\fR?
.sp
\fBhuddle wrap\fR \fItag\fR \fIsrc\fR
.sp
\fBhuddle call\fR \fItag\fR \fIcommand\fR \fIargs\fR
.sp
\fBhuddle addType\fR \fIcallback\fR
.sp
\fBcallback\fR \fIcommand\fR ?\fIargs\fR?
.sp
\fBsetting\fR
.sp
\fBget_sub\fR \fIsrc\fR \fIkey\fR
.sp
\fBstrip\fR \fIsrc\fR
.sp
\fBset\fR \fIsrc\fR \fIkey\fR \fIvalue\fR
.sp
\fBremove\fR \fIsrc\fR \fIkey\fR \fIvalue\fR
.sp
.BE
.SH DESCRIPTION
.PP
Huddle provides a generic Tcl-based serialization/intermediary format.
Currently, each node is wrapped in a tag with simple type information.
.PP
When converting huddle-notation to other serialization formats like
JSON or YAML this type information is used to select the proper notation.
And when going from JSON/YAML/... to huddle their notation can be used
to select the proper huddle type.
.PP
In that manner huddle can serve as a common intermediary format.
.CS


huddle-format: >
  {HUDDLE {huddle-node}}
huddle-node: >
  {tag content}
each content of tag means:
  s: (content is a) string
  L: list, each sub node is a huddle-node
  D: dict, each sub node is a huddle-node
confirmed:
  - JSON
  - YAML(generally, but cannot discribe YAML-tags)
limitation:
  - cannot discribe aliases from a node to other node.

.CE
.PP
The \fBhuddle\fR package returns
data as a Tcl \fBdict\fR.  Either the \fBdict\fR package or Tcl 8.5 is
required for use.
.SH COMMANDS
.TP
\fBhuddle create\fR \fIkey\fR \fIvalue\fR ?\fIkey value ...\fR?
Create a huddle object as a dict. It can contain other huddle objects.
.TP
\fBhuddle list\fR ?\fIvalue value ...\fR?
Create a huddle object as a list. It can contain other huddle objects.
.TP
\fBhuddle get\fR \fIobject\fR \fIkey\fR ?\fIkey ...\fR?
Almost the same as \fBdict get\fR.
Get a sub-object from the huddle object.
\fIkey\fR can be used to huddle-list's index.
.TP
\fBhuddle gets\fR \fIobject\fR \fIkey\fR ?\fIkey ...\fR?
Get a sub-object from the huddle object, stripped.
.TP
\fBhuddle set\fR \fIobjectVar\fR \fIkey\fR ?\fIkey ...\fR? \fIvalue\fR
Almost the same as \fBdict set\fR.
Set a sub-object from the huddle object.
\fIkey\fR can be used to huddle-list's index.
.TP
\fBhuddle remove\fR \fIobject\fR \fIkey\fR ?\fIkey ...\fR?
Almost the same as \fBdict remove\fR.
Remove a sub-object from the huddle object.
\fIkey\fR can be used to huddle-list's index.
.TP
\fBhuddle combine\fR \fIobject1\fR \fIobject2\fR ?\fIobject3 ...\fR?
Merging huddle objects given.
.CS


% set aa [huddle create a b c d]
HUDDLE {D {a {s b} c {s d}}}
% set bb [huddle create a k l m]
HUDDLE {D {a {s k} l {s m}}}
% huddle combine $aa $bb
HUDDLE {D {a {s k} c {s d} l {s m}}}

.CE
.TP
\fBhuddle equal\fR \fIobject1\fR \fIobject2\fR
Comparing two huddle objects recursively.
When to equal, returns 1, otherwise 0.
.CS


% set aa [huddle create a b c d]
HUDDLE {D {a {s b} c {s d}}}
% set bb [huddle create c d a b]
HUDDLE {D {c {s d} a {s b}}}
% huddle equal $aa $bb
1

.CE
.TP
\fBhuddle append\fR \fIobjectVar\fR \fIkey\fR \fIvalue\fR ?\fIkey value ...\fR?
.TP
\fBhuddle append\fR \fIobjectVar\fR \fIvalue\fR ?\fIvalue ...\fR?
Appending child elements. When for dicts, giving key/value. When for lists, giving values.
.CS


% set aa [huddle create a b c d]
HUDDLE {D {a {s b} c {s d}}}
% huddle append aa a k l m
HUDDLE {D {a {s k} c {s d} l {s m}}}
% set bb [huddle list i j k l]
HUDDLE {L {{s i} {s j} {s k} {s l}}}
% huddle append bb g h i
HUDDLE {L {{s i} {s j} {s k} {s l} {s g} {s h} {s i}}}

.CE
.TP
\fBhuddle keys\fR \fIobject\fR
The same as \fBdict keys\fR.
.TP
\fBhuddle llength\fR \fIobject\fR
The same as \fBllength\fR.
.TP
\fBhuddle type\fR \fIobject\fR ?\fIkey key...\fR?
Return the element type of specified by keys.
if ?key? is not given, returns the type of root node.
.sp
.RS
.TP
\fB\fBstring\fR\fR
the node is a tcl's string.
.TP
\fB\fBdict\fR\fR
the node is a dict.
.TP
\fB\fBlist\fR\fR
the node is a list.
.RE
.CS


% huddle type {HUDDLE {s str}}
string
% huddle type {HUDDLE {L {{s a} {s b} {s c}}}}
list
% huddle type {HUDDLE {D {aa {s b} cc {s d}}}} cc
string

.CE
.TP
\fBhuddle strip\fR \fIobject\fR
Stripped all tags. Converted to normal Tcl's list/dict.
.TP
\fBhuddle jsondump\fR \fIobject\fR ?\fIoffset\fR? ?\fInewline\fR? ?\fIbegin_offset\fR?
dump a json-stream from the huddle-object.
.sp
.RS
.TP
\fB\fBoffset\fR ""\fR
begin offset as spaces "  ".
.RE
.CS

# normal output has some indents. some strings are escaped.
% huddle jsondump {HUDDLE {L {{L {{s i} {s baa} {s \\\\k} {L {{s 1.0} {s true} {s /g} {s h}}} {L {{s g}}}}} {s t}}}}
[
  [
    "i",
    "baa",
    "\\\\k",
    [
      1.0,
      true,
      "\\/g",
      "h"
    ],
    ["g"]
  ],
  "t"
]
# stripped output
% huddle jsondump {HUDDLE {D {dd {D {bb {D {a {s baa} c {s {d
a}}}} cc {D {g {s h}}}}} ee {D {i {s j} k {s 1} j {s { m\\a}}}}}}} "" ""
{"dd": {"bb": {"a": "baa","c": "d\\na"},"cc": {"g": "h"}},"ee": {"i": "j","k": 1,"j": " m\\\\a"}}

.CE
.TP
\fBhuddle compile\fR \fIspec\fR \fIdata\fR
construct a huddle object from plain old tcl values.
\fIspec\fR is defined as follows:
.RS
.TP
\fBstring\fR
data is simply a string
.TP
\fBlist\fR
data is a tcl list of strings
.TP
\fBdict\fR
data is a tcl dict of strings
.TP
list list
data is a tcl list of lists
.TP
list dict
data is a tcl list of dicts
.TP
dict xx list
data is a tcl dict where the value of key xx is a tcl list
.TP
dict * list
data is a tcl dict of lists
\fIdata\fR is plain old tcl values
.RE
.CS

% huddle compile {dict * list} {a {1 2 3} b {4 5}}
HUDDLE {D {a {L {{s 1} {s 2} {s 3}}} b {L {{s 4} {s 5}}}}}
% huddle compile {dict * {list {dict d list}}} {a {{c 1} {d {2 2 2} e 3}} b {{f 4 g 5}}}
HUDDLE {D {a {L {{D {c {s 1}}} {D {d {L {{s 2} {s 2} {s 2}}} e {s 3}}}}} b {L {{D {f {s 4} g {s 5}}}}}}}

.CE
.TP
\fBhuddle isHuddle\fR \fIobject\fR
if \fIobject\fR is a huddle, returns 1. the other, returns 0.
.TP
\fBhuddle checkHuddle\fR \fIobject\fR
if \fIobject\fR is not a huddle, rises an error.
.TP
\fBhuddle to_node\fR \fIobject\fR ?\fItag\fR?
for type-callbacks.
.sp
if \fIobject\fR is a huddle, returns root-node. the other, returns \fB[list s $object]\fR.
.CS


% huddle to_node str
s str
% huddle to_node str !!str
!!str str
% huddle to_node {HUDDLE {s str}}
s str
% huddle to_node {HUDDLE {l {a b c}}}
l {a b c}

.CE
.TP
\fBhuddle wrap\fR \fItag\fR \fIsrc\fR
for type-callbacks.
.sp
Create a huddle object from \fIsrc\fR with specified \fItag\fR.
.CS


% huddle wrap "" str
HUDDLE str
% huddle wrap s str
HUDDLE {s str}

.CE
.TP
\fBhuddle call\fR \fItag\fR \fIcommand\fR \fIargs\fR
for type-callbacks.
.sp
devolving \fIcommand\fR to default \fItag\fR-callback
.TP
\fBhuddle addType\fR \fIcallback\fR
add a user-specified-type/tag to the huddle library.
To see "Additional Type".
.sp
.RS
.TP
\fBcallback\fR
callback function name for additional type.
.RE
.PP
.SH "TYPE CALLBACK"
.PP
The definition of callback for user-type.
.TP
\fBcallback\fR \fIcommand\fR ?\fIargs\fR?
.RS
.TP
\fBcommand\fR
huddle subcomand which is needed to reply by the callback.
.TP
\fBargs\fR
arguments of subcommand. The number of list of arguments is different for each subcommand.
.RE
.PP
.PP
The callback procedure shuould reply the following subcommands.
.TP
\fBsetting\fR
only returns a fixed dict of the type infomation for setting the user-tag.
.RS
.TP
\fBtype\fR typename
typename of the type
.TP
\fBmethod\fR {method1 method2 method3 ...}
method list as huddle subcommand. Then, you can call \fB[huddle method1 ...]\fR
.TP
\fBtag\fR {tag1 child/parent tag2 child/parent ...}
tag list for huddle-node as a dict. if the type has child-nodes, use "parent", otherwise use "child".
.RE
.TP
\fBget_sub\fR \fIsrc\fR \fIkey\fR
returns a sub node specified by \fIkey\fR.
.RS
.TP
\fBsrc\fR
a node content in huddle object.
.RE
.TP
\fBstrip\fR \fIsrc\fR
returns stripped node contents. if the type has child nodes, every node must be stripped.
.TP
\fBset\fR \fIsrc\fR \fIkey\fR \fIvalue\fR
sets a sub-node from the tagged-content, and returns self.
.TP
\fBremove\fR \fIsrc\fR \fIkey\fR \fIvalue\fR
removes a sub-node from the tagged-content, and returns self.
.PP
.PP
\fBstrip\fR must be defined at all types.
\fBget_sub\fR must be defined at container types.
\fBset/remove\fR shuould be defined, if you call them.
.CS


# callback sample for my-dict
proc my_dict_setting {command args} {
    switch -- $command {
        setting { ; # type definition
            return {
                type dict
                method {create keys}
                tag {d child D parent}
                constructor create
                str s
            }
            # type:   the type-name
            # method: add methods to huddle's subcommand.
            #          "get_sub/strip/set/remove/equal/append" called by huddle module.
            #          "strip" must be defined at all types.
            #          "get_sub" must be defined at container types.
            #          "set/remove/equal/append" shuould be defined, if you call them.
            # tag:    tag definition("child/parent" word is maybe obsoleted)
        }
        get_sub { ; # get a sub-node specified by "key" from the tagged-content
            foreach {src key} $args break
            return [dict get $src $key]
        }
        strip { ; # strip from the tagged-content
            foreach {src nop} $args break
            foreach {key val} $src {
                lappend result $key [huddle strip $val]
            }
            return $result
        }
        set { ; # set a sub-node from the tagged-content
            foreach {src key value} $args break
            dict set src $key $value
            return $src
        }
        remove { ; # remove a sub-node from the tagged-content
            foreach {src key value} $args break
            return [dict remove $src $key]
        }
        equal { ; # check equal for each node
            foreach {src1 src2} $args break
            if {[llength $src1] != [llength $src2]} {return 0}
            foreach {key1 val1} $src1 {
                if {![dict exists $src2 $key1]} {return 0}
                if {![huddle _equal_subs $val1 [dict get $src2 $key1]]} {return 0}
            }
            return 1
        }
        append { ; # append nodes
            foreach {str src list} $args break
            if {[llength $list] % 2} {error {wrong # args: should be "huddle append objvar ?key value ...?"}}
            set resultL $src
            foreach {key value} $list {
                if {$str ne ""} {
                    lappend resultL $key [huddle to_node $value $str]
                } else {
                    lappend resultL $key $value
                }
            }
            return [eval dict create $resultL]
        }
        create { ; # $args: all arguments after "huddle create"
            if {[llength $args] % 2} {error {wrong # args: should be "huddle create ?key value ...?"}}
            set resultL {}
            foreach {key value} $args {
                lappend resultL $key [huddle to_node $value]
            }
            return [huddle wrap D $resultL]
        }
        keys {
            foreach {src nop} $args break
            return [dict keys [lindex [lindex $src 1] 1]]
        }
        default {
            error "$command is not callback for dict"
        }
    }
}

.CE
.CS


# inheritance sample from default dict-callback
proc ::yaml::_huddle_mapping {command args} {
    switch -- $command {
        setting { ; # type definition
            return {
                type dict
                method {mapping}
                tag {!!map parent}
                constructor mapping
                str !!str
            }
        }
        mapping { ; # $args: all arguments after "huddle mapping"
            if {[llength $args] % 2} {error {wrong # args: should be "huddle mapping ?key value ...?"}}
            set resultL {}
            foreach {key value} $args {
                lappend resultL $key [huddle to_node $value !!str]
            }
            return [huddle wrap !!map $resultL]
        }
        default { ; # devolving to default dict-callback
            return [huddle call D $command $args]
        }
    }
}

.CE
.SH "HOW TO ADD TYPE"
.PP
You can add huddle-node types e.g. ::struct::tree.
To do so, first, define a callback-procedure for additional tagged-type.
The proc get argments as \fIcommand\fR and ?\fIargs\fR?. It has some switch-sections.
.PP
And, addType subcommand will called.
.CS


huddle addType my_dict_setting

.CE
.SH "WORKING SAMPLE"
.CS


# create as a dict
% set bb [huddle create a b c d]
HUDDLE {D {a {s b} c {s d}}}

# create as a list
% set cc [huddle list e f g h]
HUDDLE {L {{s e} {s f} {s g} {s h}}}
% set bbcc [huddle create bb $bb cc $cc]
HUDDLE {D {bb {D {a {s b} c {s d}}} cc {L {{s e} {s f} {s g} {s h}}}}}
% set folding [huddle list $bbcc p [huddle list q r] s]
HUDDLE {L {{D {bb {D {a {s b} c {s d}}} cc {L {{s e} {s f} {s g} {s h}}}}} {s p} {L {{s q} {s r}}} {s s}}}

# normal Tcl's notation
% huddle strip $folding
{bb {a b c d} cc {e f g h}} p {q r} s

# get a sub node
% huddle get $folding 0 bb
HUDDLE {D {a {s b} c {s d}}}
% huddle gets $folding 0 bb
a b c d

# overwrite a node
% huddle set folding 0 bb c kkk
HUDDLE {L {{D {bb {D {a {s b} c {s kkk}}} cc {L {{s e} {s f} {s g} {s h}}}}} {s p} {L {{s q} {s r}}} {s s}}}

# remove a node
% huddle remove $folding 2 1
HUDDLE {L {{D {bb {D {a {s b} c {s kkk}}} cc {L {{s e} {s f} {s g} {s h}}}}} {s p} {L {{s q}}} {s s}}}
% huddle strip $folding
{bb {a b c kkk} cc {e f g h}} p {q r} s

# dump as a JSON stream
% huddle jsondump $folding
[
  {
    "bb": {
      "a": "b",
      "c": "kkk"
    },
    "cc": [
      "e",
      "f",
      "g",
      "h"
    ]
  },
  "p",
  [
    "q",
    "r"
  ],
  "s"
]

.CE
.SH LIMITATIONS
.PP
now printing.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIhuddle\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
yaml
.SH KEYWORDS
data exchange, exchange format, huddle, json, parsing, text processing, yaml
.SH COPYRIGHT
.nf
Copyright (c) 2008 KATO Kanryu <[email protected]>

.fi

Added embedded/man/files/modules/yaml/yaml.n.

























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/man/files/modules/yaml/yaml.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2008 KATO Kanryu <[email protected]>
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "yaml" n 0.3.6 tcllib "YAML processing"
.BS
.SH NAME
yaml \- YAML Format Encoder/Decoder
.SH SYNOPSIS
package require \fBTcl  8.4\fR
.sp
package require \fByaml  ?0.3.6?\fR
.sp
\fB::yaml::yaml2dict\fR ?\fIoptions\fR? \fItxt\fR
.sp
\fB::yaml::yaml2huddle\fR ?\fIoptions\fR? \fItxt\fR
.sp
\fB::yaml::setOption\fR ?\fIoptions\fR?
.sp
\fB::yaml::dict2yaml\fR \fIdict\fR ?\fIindent\fR? ?\fIwordwrap\fR?
.sp
\fB::yaml::list2yaml\fR \fIlist\fR ?\fIindent\fR? ?\fIwordwrap\fR?
.sp
\fB::yaml::huddle2yaml\fR \fIhuddle\fR ?\fIindent\fR? ?\fIwordwrap\fR?
.sp
.BE
.SH DESCRIPTION
.PP
The \fByaml\fR package provides a simple Tcl-only library for parsing the
YAML \fIhttp://www.yaml.org/\fR data exchange format as specified in
\fIhttp://www.yaml.org/spec/1.1/\fR.
.PP
The \fByaml\fR package returns
data as a Tcl \fBdict\fR.  Either the \fBdict\fR package or Tcl 8.5 is
required for use.
.SH COMMANDS
.TP
\fB::yaml::yaml2dict\fR ?\fIoptions\fR? \fItxt\fR
.TP
\fB::yaml::yaml2huddle\fR ?\fIoptions\fR? \fItxt\fR
Parse yaml formatted text \fItxt\fR into a Tcl dict/huddle and return the value.
.RS
.TP
\fB\fB-file\fR\fR
\fItxt\fR is a filename of YAML-stream.
.TP
\fB\fB-stream\fR\fR
\fItxt\fR is just a YAML-stream.
.TP
\fB\fB-types\fR \fIlist\fR\fR
The \fIlist\fR is a type list for the yaml-scalar types.(e.g. !!str !!timestamp !!integer !!true ...)
.CS

 -types {timestamp integer null true false}
.CE
.IP
In this case, if a string matched "timestamp", converted to the TCL internal timestamp.(e.g. "2001-12-15T02:59:43.1Z" => 1008385183)
.TP
\fB\fB-m:true\fR \fIparam\fR\fR
The \fIparam\fR is two elements of list for the value of true, and considered strings.
.CS

 -m:true {1 {true on + yes y}}
.CE
.IP
In this case, the string "yes" found in YAML Stream, automatically converted 1.
.TP
\fB\fB-m:false\fR \fIparam\fR\fR
The \fIparam\fR is two elements of list for the value of false, and considered strings.
.CS

 -m:false {0 {false off - no n}}
.CE
.TP
\fB\fB-m:null\fR \fIparam\fR\fR
The \fIparam\fR is two elements of list for the value of null, and considered strings.
.CS

 -m:null {"" {null nil "" ~}}
.CE
.TP
\fB\fB-validate\fR\fR
Experiment,old: Output stream contains YAML's-tag, each node.
.CS

% puts [::yaml::load -validate {[aaa, bbb]}]
=>
!!seq {{!!str aaa} {!!str bbb}}

.CE
.RE
.TP
\fB::yaml::setOption\fR ?\fIoptions\fR?
Change implicit options for the library.
Now, the params are the same as \fB::yaml::yaml2dict\fR.
Arguments of\fB::yaml::yaml2dict\fR is more priority than this setting.
.TP
\fB::yaml::dict2yaml\fR \fIdict\fR ?\fIindent\fR? ?\fIwordwrap\fR?
.TP
\fB::yaml::list2yaml\fR \fIlist\fR ?\fIindent\fR? ?\fIwordwrap\fR?
.TP
\fB::yaml::huddle2yaml\fR \fIhuddle\fR ?\fIindent\fR? ?\fIwordwrap\fR?
Convert a dict/list/huddle object into YAML stream.
.RS
.TP
indent
spaces indent of each block node.
currently default is 2.
.TP
wordwrap
word wrap for YAML stream.
currently default is 40.
.RE
.PP
.PP
.SH EXAMPLES
.PP
An example of a yaml stream converted to Tcl.  A yaml stream is returned as a
single item with multiple elements.
.PP
.CS

{
--- !<tag:clarkevans.com,2002:invoice>
invoice: 34843
date   : 2001-01-23
bill-to: &id001
    given  : Chris
    family : Dumars
    address:
        lines: |
            458 Walkman Dr.
            Suite #292
        city    : Royal Oak
        state   : MI
        postal  : 48046
ship-to: *id001
product:
    - sku         : BL394D
      quantity    : 4
      description : Basketball
      price       : 450.00
    - sku         : BL4438H
      quantity    : 1
      description : Super Hoop
      price       : 2392.00
tax  : 251.42
total: 4443.52
comments:
    Late afternoon is best.
    Backup contact is Nancy
    Billsmer @ 338-4338.
}
=>
invoice 34843 date 2001-01-23 bill-to {given Chris family Dumars address {lines {458 Walkman Dr.
Suite #292
} city {Royal Oak} state MI postal 48046}} ship-to {given Chris family Dumars address {lines {458 Walkman Dr.
Suite #292
} city {Royal Oak} state MI postal 48046}} product {{sku BL394D quantity 4 description Basketball price 450.00} {sku BL4438H quantity 1 description {Super Hoop} price 2392.00}} tax 251.42 total 4443.52 comments {Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.}
.CE
.PP
An example of a yaml object converted to Tcl.  A yaml object is returned as a
multi-element list (a dict).
.PP
.CS

{
---
- [name        , hr, avg  ]
- [Mark McGwire, 65, 0.278]
- [Sammy Sosa  , 63, 0.288]
-
  Mark McGwire: {hr: 65, avg: 0.278}
  Sammy Sosa: { hr: 63, avg: 0.288}
}
=>
{name hr avg} {{Mark McGwire} 65 0.278} {{Sammy Sosa} 63 0.288} {{Mark McGwire} {hr 65 avg 0.278} {Sammy Sosa} {hr 63 avg 0.288}}

.CE
.SH LIMITATIONS
.PP
tag parser not implemented. currentry, tags are merely ignored.
.PP
Only Anchor => Aliases ordering. back alias-referring is not supported.
.PP
Too many braces, or too few braces.
.PP
Not enough character set of line feeds. Please use only "\\n" as line breaks.
.SH "BUGS, IDEAS, FEEDBACK"
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category \fIyaml\fR of the
\fITcllib SF Trackers\fR [http://sourceforge.net/tracker/?group_id=12883].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
.SH "SEE ALSO"
base64, huddle, json
.SH KEYWORDS
data exchange, huddle, parsing, text processing, yaml
.SH COPYRIGHT
.nf
Copyright (c) 2008 KATO Kanryu <[email protected]>

.fi

Added embedded/man/index.n.

more than 10,000 changes

Added embedded/man/toc.n.




























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
'\"
'\" Generated by tcllib/doctools/toc with format 'nroff'
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\"	Start paragraph describing an argument to a library procedure.
'\"	type is type of argument (int, etc.), in/out is either "in", "out",
'\"	or "in/out" to describe whether procedure reads or modifies arg,
'\"	and indent is equivalent to second arg of .IP (shouldn't ever be
'\"	needed;  use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\"	Give maximum sizes of arguments for setting tab stops.  Type and
'\"	name are examples of largest possible arguments that will be passed
'\"	to .AP later.  If args are omitted, default tab stops are used.
'\"
'\" .BS
'\"	Start box enclosure.  From here until next .BE, everything will be
'\"	enclosed in one large box.
'\"
'\" .BE
'\"	End of box enclosure.
'\"
'\" .CS
'\"	Begin code excerpt.
'\"
'\" .CE
'\"	End code excerpt.
'\"
'\" .VS ?version? ?br?
'\"	Begin vertical sidebar, for use in marking newly-changed parts
'\"	of man pages.  The first argument is ignored and used for recording
'\"	the version when the .VS was added, so that the sidebars can be
'\"	found and removed when they reach a certain age.  If another argument
'\"	is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\"	End of vertical sidebar.
'\"
'\" .DS
'\"	Begin an indented unfilled display.
'\"
'\" .DE
'\"	End of indented unfilled display.
'\"
'\" .SO
'\"	Start of list of standard options for a Tk widget.  The
'\"	options follow on successive lines, in four columns separated
'\"	by tabs.
'\"
'\" .SE
'\"	End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\"	Start of description of a specific option.  cmdName gives the
'\"	option's name as specified in the class command, dbName gives
'\"	the option's name in the option database, and dbClass gives
'\"	the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\"	Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
'\"
'\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\"	# VS - start vertical sidebar
'\"	# ^Y = starting y location
'\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\"	# Special macro to handle page bottom:  finish off current
'\"	# box/sidebar if in box/sidebar mode, then invoked standard
'\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.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
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
'\"	# DE - end display
.de DE
.fi
.RE
.sp
..
'\"	# SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 4c 8c 12c
.ft B
..
'\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
'\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "Table Of Contents" n
.BS
.SH CONTENTS
tcllib
.RS
.TP
\fBaes\fR
\fIfiles/modules/aes/aes.n\fR: Implementation of the AES block cipher
.TP
\fBascii85\fR
\fIfiles/modules/base64/ascii85.n\fR: ascii85-encode/decode binary data
.TP
\fBasn\fR
\fIfiles/modules/asn/asn.n\fR: ASN.1 BER encoder/decoder
.TP
\fBautoproxy\fR
\fIfiles/modules/http/autoproxy.n\fR: Automatic HTTP proxy usage and authentication
.TP
\fBbase32\fR
\fIfiles/modules/base32/base32.n\fR: base32 standard encoding
.TP
\fBbase32::core\fR
\fIfiles/modules/base32/base32core.n\fR: Expanding basic base32 maps
.TP
\fBbase32::hex\fR
\fIfiles/modules/base32/base32hex.n\fR: base32 extended hex encoding
.TP
\fBbase64\fR
\fIfiles/modules/base64/base64.n\fR: base64-encode/decode binary data
.TP
\fBbee\fR
\fIfiles/modules/bee/bee.n\fR: BitTorrent Serialization Format Encoder/Decoder
.TP
\fBbench\fR
\fIfiles/modules/bench/bench.n\fR: bench - Processing benchmark suites
.TP
\fBbench::in\fR
\fIfiles/modules/bench/bench_read.n\fR: bench::in - Reading benchmark results
.TP
\fBbench::out::csv\fR
\fIfiles/modules/bench/bench_wcsv.n\fR: bench::out::csv - Formatting benchmark results as CSV
.TP
\fBbench::out::text\fR
\fIfiles/modules/bench/bench_wtext.n\fR: bench::out::text - Formatting benchmark results as human readable text
.TP
\fBbench_intro\fR
\fIfiles/modules/bench/bench_intro.n\fR: bench introduction
.TP
\fBbench_lang_intro\fR
\fIfiles/modules/bench/bench_lang_intro.n\fR: bench language introduction
.TP
\fBbench_lang_spec\fR
\fIfiles/modules/bench/bench_lang_spec.n\fR: bench language specification
.TP
\fBbibtex\fR
\fIfiles/modules/bibtex/bibtex.n\fR: Parse bibtex files
.TP
\fBblowfish\fR
\fIfiles/modules/blowfish/blowfish.n\fR: Implementation of the Blowfish block cipher
.TP
\fBcache::async\fR
\fIfiles/modules/cache/async.n\fR: Asynchronous in-memory cache
.TP
\fBcksum\fR
\fIfiles/modules/crc/cksum.n\fR: Calculate a cksum(1) compatible checksum
.TP
\fBclock_iso8601\fR
\fIfiles/modules/clock/iso8601.n\fR: Parsing ISO 8601 dates/times
.TP
\fBclock_rfc2822\fR
\fIfiles/modules/clock/rfc2822.n\fR: Parsing ISO 8601 dates/times
.TP
\fBcmdline\fR
\fIfiles/modules/cmdline/cmdline.n\fR: Procedures to process command lines and options.
.TP
\fBcomm\fR
\fIfiles/modules/comm/comm.n\fR: A remote communication facility for Tcl (8.3 and later)
.TP
\fBcomm_wire\fR
\fIfiles/modules/comm/comm_wire.n\fR: The comm wire protocol
.TP
\fBcontrol\fR
\fIfiles/modules/control/control.n\fR: Procedures for control flow structures.
.TP
\fBcoroutine\fR
\fIfiles/modules/coroutine/coroutine.n\fR: Coroutine based event and IO handling
.TP
\fBcoroutine::auto\fR
\fIfiles/modules/coroutine/coro_auto.n\fR: Automatic event and IO coroutine awareness
.TP
\fBcounter\fR
\fIfiles/modules/counter/counter.n\fR: Procedures for counters and histograms
.TP
\fBcrc16\fR
\fIfiles/modules/crc/crc16.n\fR: Perform a 16bit Cyclic Redundancy Check
.TP
\fBcrc32\fR
\fIfiles/modules/crc/crc32.n\fR: Perform a 32bit Cyclic Redundancy Check
.TP
\fBcsv\fR
\fIfiles/modules/csv/csv.n\fR: Procedures to handle CSV data.
.TP
\fBdeleg_method\fR
\fIfiles/modules/interp/deleg_method.n\fR: Creation of comm delegates (snit methods)
.TP
\fBdeleg_proc\fR
\fIfiles/modules/interp/deleg_proc.n\fR: Creation of comm delegates (procedures)
.TP
\fBdes\fR
\fIfiles/modules/des/des.n\fR: Implementation of the DES and triple-DES ciphers
.TP
\fBdns\fR
\fIfiles/modules/dns/tcllib_dns.n\fR: Tcl Domain Name Service Client
.TP
\fBdocidx_intro\fR
\fIfiles/modules/doctools/docidx_intro.n\fR: docidx introduction
.TP
\fBdocidx_lang_cmdref\fR
\fIfiles/modules/doctools/docidx_lang_cmdref.n\fR: docidx language command reference
.TP
\fBdocidx_lang_faq\fR
\fIfiles/modules/doctools/docidx_lang_faq.n\fR: docidx language faq
.TP
\fBdocidx_lang_intro\fR
\fIfiles/modules/doctools/docidx_lang_intro.n\fR: docidx language introduction
.TP
\fBdocidx_lang_syntax\fR
\fIfiles/modules/doctools/docidx_lang_syntax.n\fR: docidx language syntax
.TP
\fBdocidx_plugin_apiref\fR
\fIfiles/modules/doctools/docidx_plugin_apiref.n\fR: docidx plugin API reference
.TP
\fBdocstrip\fR
\fIfiles/modules/docstrip/docstrip.n\fR: Docstrip style source code extraction
.TP
\fBdocstrip_util\fR
\fIfiles/modules/docstrip/docstrip_util.n\fR: Docstrip-related utilities
.TP
\fBdoctoc_intro\fR
\fIfiles/modules/doctools/doctoc_intro.n\fR: doctoc introduction
.TP
\fBdoctoc_lang_cmdref\fR
\fIfiles/modules/doctools/doctoc_lang_cmdref.n\fR: doctoc language command reference
.TP
\fBdoctoc_lang_faq\fR
\fIfiles/modules/doctools/doctoc_lang_faq.n\fR: doctoc language faq
.TP
\fBdoctoc_lang_intro\fR
\fIfiles/modules/doctools/doctoc_lang_intro.n\fR: doctoc language introduction
.TP
\fBdoctoc_lang_syntax\fR
\fIfiles/modules/doctools/doctoc_lang_syntax.n\fR: doctoc language syntax
.TP
\fBdoctoc_plugin_apiref\fR
\fIfiles/modules/doctools/doctoc_plugin_apiref.n\fR: doctoc plugin API reference
.TP
\fBdoctools\fR
\fIfiles/modules/doctools/doctools.n\fR: doctools - Processing documents
.TP
\fBdoctools2idx_introduction\fR
\fIfiles/modules/doctools2idx/introduction.n\fR: DocTools - Keyword indices
.TP
\fBdoctools2toc_introduction\fR
\fIfiles/modules/doctools2toc/introduction.n\fR: DocTools - Tables of Contents
.TP
\fBdoctools::changelog\fR
\fIfiles/modules/doctools/changelog.n\fR: Processing text in Emacs ChangeLog format
.TP
\fBdoctools::cvs\fR
\fIfiles/modules/doctools/cvs.n\fR: Processing text in 'cvs log' format
.TP
\fBdoctools::html::cssdefaults\fR
\fIfiles/modules/doctools2base/html_cssdefaults.n\fR: Default CSS style for HTML export plugins
.TP
\fBdoctools::idx\fR
\fIfiles/modules/doctools2idx/container.n\fR: Holding keyword indices
.TP
\fBdoctools::idx\fR
\fIfiles/modules/doctools/docidx.n\fR: docidx - Processing indices
.TP
\fBdoctools::idx::export\fR
\fIfiles/modules/doctools2idx/export.n\fR: Exporting keyword indices
.TP
\fBdoctools::idx::export::docidx\fR
\fIfiles/modules/doctools2idx/export_docidx.n\fR: docidx export plugin
.TP
\fBdoctools::idx::export::html\fR
\fIfiles/modules/doctools2idx/export_html.n\fR: HTML export plugin
.TP
\fBdoctools::idx::export::json\fR
\fIfiles/modules/doctools2idx/export_json.n\fR: JSON export plugin
.TP
\fBdoctools::idx::export::nroff\fR
\fIfiles/modules/doctools2idx/export_nroff.n\fR: nroff export plugin
.TP
\fBdoctools::idx::export::text\fR
\fIfiles/modules/doctools2idx/export_text.n\fR: plain text export plugin
.TP
\fBdoctools::idx::export::wiki\fR
\fIfiles/modules/doctools2idx/export_wiki.n\fR: wiki export plugin
.TP
\fBdoctools::idx::import\fR
\fIfiles/modules/doctools2idx/import.n\fR: Importing keyword indices
.TP
\fBdoctools::idx::import::docidx\fR
\fIfiles/modules/doctools2idx/import_docidx.n\fR: docidx import plugin
.TP
\fBdoctools::idx::import::json\fR
\fIfiles/modules/doctools2idx/import_json.n\fR: JSON import plugin
.TP
\fBdoctools::idx::parse\fR
\fIfiles/modules/doctools2idx/parse.n\fR: Parsing text in docidx format
.TP
\fBdoctools::idx::structure\fR
\fIfiles/modules/doctools2idx/structure.n\fR: Docidx serialization utilities
.TP
\fBdoctools::msgcat\fR
\fIfiles/modules/doctools2base/tcllib_msgcat.n\fR: Message catalog management for the various document parsers
.TP
\fBdoctools::msgcat::idx::c\fR
\fIfiles/modules/doctools2idx/msgcat_c.n\fR: Message catalog for the docidx parser (C)
.TP
\fBdoctools::msgcat::idx::de\fR
\fIfiles/modules/doctools2idx/msgcat_de.n\fR: Message catalog for the docidx parser (DE)
.TP
\fBdoctools::msgcat::idx::en\fR
\fIfiles/modules/doctools2idx/msgcat_en.n\fR: Message catalog for the docidx parser (EN)
.TP
\fBdoctools::msgcat::idx::fr\fR
\fIfiles/modules/doctools2idx/msgcat_fr.n\fR: Message catalog for the docidx parser (FR)
.TP
\fBdoctools::msgcat::toc::c\fR
\fIfiles/modules/doctools2toc/msgcat_c.n\fR: Message catalog for the doctoc parser (C)
.TP
\fBdoctools::msgcat::toc::de\fR
\fIfiles/modules/doctools2toc/msgcat_de.n\fR: Message catalog for the doctoc parser (DE)
.TP
\fBdoctools::msgcat::toc::en\fR
\fIfiles/modules/doctools2toc/msgcat_en.n\fR: Message catalog for the doctoc parser (EN)
.TP
\fBdoctools::msgcat::toc::fr\fR
\fIfiles/modules/doctools2toc/msgcat_fr.n\fR: Message catalog for the doctoc parser (FR)
.TP
\fBdoctools::nroff::man_macros\fR
\fIfiles/modules/doctools2base/nroff_manmacros.n\fR: Default CSS style for NROFF export plugins
.TP
\fBdoctools::tcl::parse\fR
\fIfiles/modules/doctools2base/tcl_parse.n\fR: Processing text in 'subst -novariables' format
.TP
\fBdoctools::toc\fR
\fIfiles/modules/doctools2toc/container.n\fR: Holding tables of contents
.TP
\fBdoctools::toc\fR
\fIfiles/modules/doctools/doctoc.n\fR: doctoc - Processing tables of contents
.TP
\fBdoctools::toc::export\fR
\fIfiles/modules/doctools2toc/export.n\fR: Exporting tables of contents
.TP
\fBdoctools::toc::export::doctoc\fR
\fIfiles/modules/doctools2toc/export_doctoc.n\fR: doctoc export plugin
.TP
\fBdoctools::toc::export::html\fR
\fIfiles/modules/doctools2toc/export_html.n\fR: HTML export plugin
.TP
\fBdoctools::toc::export::json\fR
\fIfiles/modules/doctools2toc/export_json.n\fR: JSON export plugin
.TP
\fBdoctools::toc::export::nroff\fR
\fIfiles/modules/doctools2toc/export_nroff.n\fR: nroff export plugin
.TP
\fBdoctools::toc::export::text\fR
\fIfiles/modules/doctools2toc/export_text.n\fR: plain text export plugin
.TP
\fBdoctools::toc::export::wiki\fR
\fIfiles/modules/doctools2toc/export_wiki.n\fR: wiki export plugin
.TP
\fBdoctools::toc::import\fR
\fIfiles/modules/doctools2toc/import.n\fR: Importing keyword indices
.TP
\fBdoctools::toc::import::doctoc\fR
\fIfiles/modules/doctools2toc/import_doctoc.n\fR: doctoc import plugin
.TP
\fBdoctools::toc::import::json\fR
\fIfiles/modules/doctools2toc/import_json.n\fR: JSON import plugin
.TP
\fBdoctools::toc::parse\fR
\fIfiles/modules/doctools2toc/parse.n\fR: Parsing text in doctoc format
.TP
\fBdoctools::toc::structure\fR
\fIfiles/modules/doctools2toc/structure.n\fR: Doctoc serialization utilities
.TP
\fBdoctools_intro\fR
\fIfiles/modules/doctools/doctools_intro.n\fR: doctools introduction
.TP
\fBdoctools_lang_cmdref\fR
\fIfiles/modules/doctools/doctools_lang_cmdref.n\fR: doctools language command reference
.TP
\fBdoctools_lang_faq\fR
\fIfiles/modules/doctools/doctools_lang_faq.n\fR: doctools language faq
.TP
\fBdoctools_lang_intro\fR
\fIfiles/modules/doctools/doctools_lang_intro.n\fR: doctools language introduction
.TP
\fBdoctools_lang_syntax\fR
\fIfiles/modules/doctools/doctools_lang_syntax.n\fR: doctools language syntax
.TP
\fBdoctools_plugin_apiref\fR
\fIfiles/modules/doctools/doctools_plugin_apiref.n\fR: doctools plugin API reference
.TP
\fBdtplite\fR
\fIfiles/apps/dtplite.n\fR: Lightweight DocTools Markup Processor
.TP
\fBexif\fR
\fIfiles/modules/exif/exif.n\fR: Tcl EXIF extracts and parses EXIF fields from digital images
.TP
\fBfileutil\fR
\fIfiles/modules/fileutil/fileutil.n\fR: Procedures implementing some file utilities
.TP
\fBfileutil::magic::cfront\fR
\fIfiles/modules/fumagic/cfront.n\fR: Generator core for compiler of magic(5) files
.TP
\fBfileutil::magic::cgen\fR
\fIfiles/modules/fumagic/cgen.n\fR: Generator core for compiler of magic(5) files
.TP
\fBfileutil::magic::filetype\fR
\fIfiles/modules/fumagic/filetypes.n\fR: Procedures implementing file-type recognition
.TP
\fBfileutil::magic::mimetype\fR
\fIfiles/modules/fumagic/mimetypes.n\fR: Procedures implementing mime-type recognition
.TP
\fBfileutil::magic::rt\fR
\fIfiles/modules/fumagic/rtcore.n\fR: Runtime core for file type recognition engines written in pure Tcl
.TP
\fBfileutil::multi\fR
\fIfiles/modules/fileutil/multi.n\fR: Multi-file operation, scatter/gather, standard object
.TP
\fBfileutil::multi::op\fR
\fIfiles/modules/fileutil/multiop.n\fR: Multi-file operation, scatter/gather
.TP
\fBfileutil_traverse\fR
\fIfiles/modules/fileutil/traverse.n\fR: Iterative directory traversal
.TP
\fBftp\fR
\fIfiles/modules/ftp/ftp.n\fR: Client-side tcl implementation of the ftp protocol
.TP
\fBftp::geturl\fR
\fIfiles/modules/ftp/ftp_geturl.n\fR: Uri handler for ftp urls
.TP
\fBftpd\fR
\fIfiles/modules/ftpd/ftpd.n\fR: Tcl FTP server implementation
.TP
\fBgenerator\fR
\fIfiles/modules/generator/generator.n\fR: Procedures for creating and using generators.
.TP
\fBgpx\fR
\fIfiles/modules/gpx/gpx.n\fR: Extracts waypoints, tracks and routes from GPX files
.TP
\fBgrammar::aycock\fR
\fIfiles/modules/grammar_aycock/aycock.n\fR: Aycock-Horspool-Earley parser generator for Tcl
.TP
\fBgrammar::fa\fR
\fIfiles/modules/grammar_fa/fa.n\fR: Create and manipulate finite automatons
.TP
\fBgrammar::fa::dacceptor\fR
\fIfiles/modules/grammar_fa/dacceptor.n\fR: Create and use deterministic acceptors
.TP
\fBgrammar::fa::dexec\fR
\fIfiles/modules/grammar_fa/dexec.n\fR: Execute deterministic finite automatons
.TP
\fBgrammar::fa::op\fR
\fIfiles/modules/grammar_fa/faop.n\fR: Operations on finite automatons
.TP
\fBgrammar::me::cpu\fR
\fIfiles/modules/grammar_me/me_cpu.n\fR: Virtual machine implementation II for parsing token streams
.TP
\fBgrammar::me::cpu::core\fR
\fIfiles/modules/grammar_me/me_cpucore.n\fR: ME virtual machine state manipulation
.TP
\fBgrammar::me::cpu::gasm\fR
\fIfiles/modules/grammar_me/gasm.n\fR: ME assembler
.TP
\fBgrammar::me::tcl\fR
\fIfiles/modules/grammar_me/me_tcl.n\fR: Virtual machine implementation I for parsing token streams
.TP
\fBgrammar::me::util\fR
\fIfiles/modules/grammar_me/me_util.n\fR: AST utilities
.TP
\fBgrammar::me_ast\fR
\fIfiles/modules/grammar_me/me_ast.n\fR: Various representations of ASTs
.TP
\fBgrammar::me_intro\fR
\fIfiles/modules/grammar_me/me_intro.n\fR: Introduction to virtual machines for parsing token streams
.TP
\fBgrammar::me_vm\fR
\fIfiles/modules/grammar_me/me_vm.n\fR: Virtual machine for parsing token streams
.TP
\fBgrammar::peg\fR
\fIfiles/modules/grammar_peg/peg.n\fR: Create and manipulate parsing expression grammars
.TP
\fBgrammar::peg::interp\fR
\fIfiles/modules/grammar_peg/peg_interp.n\fR: Interpreter for parsing expression grammars
.TP
\fBhook\fR
\fIfiles/modules/hook/hook.n\fR: Hooks
.TP
\fBhtml\fR
\fIfiles/modules/html/html.n\fR: Procedures to generate HTML structures
.TP
\fBhtmlparse\fR
\fIfiles/modules/htmlparse/htmlparse.n\fR: Procedures to parse HTML strings
.TP
\fBhuddle\fR
\fIfiles/modules/yaml/huddle.n\fR: Create and manipulate huddle object
.TP
\fBident\fR
\fIfiles/modules/ident/ident.n\fR: Ident protocol client
.TP
\fBimap4\fR
\fIfiles/modules/imap4/imap4.n\fR: imap client-side tcl implementation of imap protocol
.TP
\fBinifile\fR
\fIfiles/modules/inifile/ini.n\fR: Parsing of Windows INI files
.TP
\fBinterp\fR
\fIfiles/modules/interp/tcllib_interp.n\fR: Interp creation and aliasing
.TP
\fBirc\fR
\fIfiles/modules/irc/irc.n\fR: Create IRC connection and interface.
.TP
\fBjavascript\fR
\fIfiles/modules/javascript/javascript.n\fR: Procedures to generate HTML and Java Script structures.
.TP
\fBjpeg\fR
\fIfiles/modules/jpeg/jpeg.n\fR: JPEG querying and manipulation of meta data
.TP
\fBjson\fR
\fIfiles/modules/json/json.n\fR: JSON parser
.TP
\fBjson::write\fR
\fIfiles/modules/json/json_write.n\fR: JSON generation
.TP
\fBlambda\fR
\fIfiles/modules/lambda/lambda.n\fR: Utility commands for anonymous procedures
.TP
\fBldap\fR
\fIfiles/modules/ldap/ldap.n\fR: LDAP client
.TP
\fBldapx\fR
\fIfiles/modules/ldap/ldapx.n\fR: LDAP extended object interface
.TP
\fBlog\fR
\fIfiles/modules/log/log.n\fR: Procedures to log messages of libraries and applications.
.TP
\fBlogger\fR
\fIfiles/modules/log/logger.n\fR: System to control logging of events.
.TP
\fBlogger::appender\fR
\fIfiles/modules/log/loggerAppender.n\fR: Collection of predefined appenders for logger
.TP
\fBlogger::utils\fR
\fIfiles/modules/log/loggerUtils.n\fR: Utilities for logger
.TP
\fBmap::geocode::nominatim\fR
\fIfiles/modules/map/map_geocode_nominatim.n\fR: Resolving geographical names with a Nominatim service
.TP
\fBmap::slippy\fR
\fIfiles/modules/map/map_slippy.n\fR: Common code for slippy based map packages
.TP
\fBmap::slippy::cache\fR
\fIfiles/modules/map/map_slippy_cache.n\fR: Management of a tile cache in the local filesystem
.TP
\fBmap::slippy::fetcher\fR
\fIfiles/modules/map/map_slippy_fetcher.n\fR: Accessing a server providing tiles for slippy-based maps
.TP
\fBmapproj\fR
\fIfiles/modules/mapproj/mapproj.n\fR: Map projection routines
.TP
\fBmath\fR
\fIfiles/modules/math/math.n\fR: Tcl Math Library
.TP
\fBmath::bigfloat\fR
\fIfiles/modules/math/bigfloat.n\fR: Arbitrary precision floating-point numbers
.TP
\fBmath::bignum\fR
\fIfiles/modules/math/bignum.n\fR: Arbitrary precision integer numbers
.TP
\fBmath::calculus\fR
\fIfiles/modules/math/calculus.n\fR: Integration and ordinary differential equations
.TP
\fBmath::calculus::romberg\fR
\fIfiles/modules/math/romberg.n\fR: Romberg integration
.TP
\fBmath::calculus::symdiff\fR
\fIfiles/modules/math/symdiff.n\fR: Symbolic differentiation for Tcl
.TP
\fBmath::combinatorics\fR
\fIfiles/modules/math/combinatorics.n\fR: Combinatorial functions in the Tcl Math Library
.TP
\fBmath::complexnumbers\fR
\fIfiles/modules/math/qcomplex.n\fR: Straightforward complex number package
.TP
\fBmath::constants\fR
\fIfiles/modules/math/constants.n\fR: Mathematical and numerical constants
.TP
\fBmath::decimal\fR
\fIfiles/modules/math/decimal.n\fR: General decimal arithmetic
.TP
\fBmath::fourier\fR
\fIfiles/modules/math/fourier.n\fR: Discrete and fast fourier transforms
.TP
\fBmath::fuzzy\fR
\fIfiles/modules/math/fuzzy.n\fR: Fuzzy comparison of floating-point numbers
.TP
\fBmath::geometry\fR
\fIfiles/modules/math/math_geometry.n\fR: Geometrical computations
.TP
\fBmath::interpolate\fR
\fIfiles/modules/math/interpolate.n\fR: Interpolation routines
.TP
\fBmath::linearalgebra\fR
\fIfiles/modules/math/linalg.n\fR: Linear Algebra
.TP
\fBmath::numtheory\fR
\fIfiles/modules/math/numtheory.n\fR: Number Theory
.TP
\fBmath::optimize\fR
\fIfiles/modules/math/optimize.n\fR: Optimisation routines
.TP
\fBmath::polynomials\fR
\fIfiles/modules/math/polynomials.n\fR: Polynomial functions
.TP
\fBmath::rationalfunctions\fR
\fIfiles/modules/math/rational_funcs.n\fR: Polynomial functions
.TP
\fBmath::roman\fR
\fIfiles/modules/math/roman.n\fR: Tools for creating and manipulating roman numerals
.TP
\fBmath::special\fR
\fIfiles/modules/math/special.n\fR: Special mathematical functions
.TP
\fBmath::statistics\fR
\fIfiles/modules/math/statistics.n\fR: Basic statistical functions and procedures
.TP
\fBmd4\fR
\fIfiles/modules/md4/md4.n\fR: MD4 Message-Digest Algorithm
.TP
\fBmd5\fR
\fIfiles/modules/md5/md5.n\fR: MD5 Message-Digest Algorithm
.TP
\fBmd5crypt\fR
\fIfiles/modules/md5crypt/md5crypt.n\fR: MD5-based password encryption
.TP
\fBmime\fR
\fIfiles/modules/mime/mime.n\fR: Manipulation of MIME body parts
.TP
\fBmpexpand\fR
\fIfiles/modules/doctools/mpexpand.n\fR: Markup processor
.TP
\fBmultiplexer\fR
\fIfiles/modules/multiplexer/multiplexer.n\fR: One-to-many communication with sockets.
.TP
\fBnameserv\fR
\fIfiles/modules/nns/nns_client.n\fR: Name service facility, Client
.TP
\fBnameserv::auto\fR
\fIfiles/modules/nns/nns_auto.n\fR: Name service facility, Client Extension
.TP
\fBnameserv::common\fR
\fIfiles/modules/nns/nns_common.n\fR: Name service facility, shared definitions
.TP
\fBnameserv::protocol\fR
\fIfiles/modules/nns/nns_protocol.n\fR: Name service facility, client/server protocol
.TP
\fBnameserv::server\fR
\fIfiles/modules/nns/nns_server.n\fR: Name service facility, Server
.TP
\fBnamespacex\fR
\fIfiles/modules/namespacex/namespacex.n\fR: Namespace utility commands
.TP
\fBncgi\fR
\fIfiles/modules/ncgi/ncgi.n\fR: Procedures to manipulate CGI values.
.TP
\fBnmea\fR
\fIfiles/modules/nmea/nmea.n\fR: Process NMEA data
.TP
\fBnns\fR
\fIfiles/apps/nns.n\fR: Name service facility, Commandline Client Application
.TP
\fBnns_intro\fR
\fIfiles/modules/nns/nns_intro.n\fR: Name service facility, introduction
.TP
\fBnnsd\fR
\fIfiles/apps/nnsd.n\fR: Name service facility, Commandline Server Application
.TP
\fBnnslog\fR
\fIfiles/apps/nnslog.n\fR: Name service facility, Commandline Logging Client Application
.TP
\fBnntp\fR
\fIfiles/modules/nntp/nntp.n\fR: Tcl client for the NNTP protocol
.TP
\fBntp_time\fR
\fIfiles/modules/ntp/ntp_time.n\fR: Tcl Time Service Client
.TP
\fBoo::util\fR
\fIfiles/modules/ooutil/ooutil.n\fR: Utility commands for TclOO
.TP
\fBotp\fR
\fIfiles/modules/otp/otp.n\fR: One-Time Passwords
.TP
\fBpage\fR
\fIfiles/apps/page.n\fR: Parser Generator
.TP
\fBpage_intro\fR
\fIfiles/modules/page/page_intro.n\fR: page introduction
.TP
\fBpage_pluginmgr\fR
\fIfiles/modules/page/page_pluginmgr.n\fR: page plugin manager
.TP
\fBpage_util_flow\fR
\fIfiles/modules/page/page_util_flow.n\fR: page dataflow/treewalker utility
.TP
\fBpage_util_norm_lemon\fR
\fIfiles/modules/page/page_util_norm_lemon.n\fR: page AST normalization, LEMON
.TP
\fBpage_util_norm_peg\fR
\fIfiles/modules/page/page_util_norm_peg.n\fR: page AST normalization, PEG
.TP
\fBpage_util_peg\fR
\fIfiles/modules/page/page_util_peg.n\fR: page PEG transformation utilities
.TP
\fBpage_util_quote\fR
\fIfiles/modules/page/page_util_quote.n\fR: page character quoting utilities
.TP
\fBpicoirc\fR
\fIfiles/modules/irc/picoirc.n\fR: Small and simple embeddable IRC client.
.TP
\fBpki\fR
\fIfiles/modules/pki/pki.n\fR: Implementation of the public key cipher
.TP
\fBpluginmgr\fR
\fIfiles/modules/pluginmgr/pluginmgr.n\fR: Manage a plugin
.TP
\fBpng\fR
\fIfiles/modules/png/png.n\fR: PNG querying and manipulation of meta data
.TP
\fBpop3\fR
\fIfiles/modules/pop3/pop3.n\fR: Tcl client for POP3 email protocol
.TP
\fBpop3d\fR
\fIfiles/modules/pop3d/pop3d.n\fR: Tcl POP3 server implementation
.TP
\fBpop3d::dbox\fR
\fIfiles/modules/pop3d/pop3d_dbox.n\fR: Simple mailbox database for pop3d
.TP
\fBpop3d::udb\fR
\fIfiles/modules/pop3d/pop3d_udb.n\fR: Simple user database for pop3d
.TP
\fBprofiler\fR
\fIfiles/modules/profiler/profiler.n\fR: Tcl source code profiler
.TP
\fBpt\fR
\fIfiles/modules/pt/pt.n\fR: Parser Tools Application
.TP
\fBpt::ast\fR
\fIfiles/modules/pt/pt_astree.n\fR: Abstract Syntax Tree Serialization
.TP
\fBpt::cparam::configuration::critcl\fR
\fIfiles/modules/pt/pt_cparam_config_critcl.n\fR: C/PARAM, Canned configuration, Critcl
.TP
\fBpt::json_language\fR
\fIfiles/modules/pt/pt_json_language.n\fR: The JSON Grammar Exchange Format
.TP
\fBpt::param\fR
\fIfiles/modules/pt/pt_param.n\fR: PackRat Machine Specification
.TP
\fBpt::pe\fR
\fIfiles/modules/pt/pt_pexpression.n\fR: Parsing Expression Serialization
.TP
\fBpt::pe::op\fR
\fIfiles/modules/pt/pt_pexpr_op.n\fR: Parsing Expression Utilities
.TP
\fBpt::peg\fR
\fIfiles/modules/pt/pt_pegrammar.n\fR: Parsing Expression Grammar Serialization
.TP
\fBpt::peg::container\fR
\fIfiles/modules/pt/pt_peg_container.n\fR: PEG Storage
.TP
\fBpt::peg::container::peg\fR
\fIfiles/modules/pt/pt_peg_container_peg.n\fR: PEG Storage. Canned PEG grammar specification
.TP
\fBpt::peg::export\fR
\fIfiles/modules/pt/pt_peg_export.n\fR: PEG Export
.TP
\fBpt::peg::export::container\fR
\fIfiles/modules/pt/pt_peg_export_container.n\fR: PEG Export Plugin. Write CONTAINER format
.TP
\fBpt::peg::export::json\fR
\fIfiles/modules/pt/pt_peg_export_json.n\fR: PEG Export Plugin. Write JSON format
.TP
\fBpt::peg::export::peg\fR
\fIfiles/modules/pt/pt_peg_export_peg.n\fR: PEG Export Plugin. Write PEG format
.TP
\fBpt::peg::from::container\fR
\fIfiles/modules/pt/pt_peg_from_container.n\fR: PEG Conversion. From CONTAINER format
.TP
\fBpt::peg::from::json\fR
\fIfiles/modules/pt/pt_peg_from_json.n\fR: PEG Conversion. Read JSON format
.TP
\fBpt::peg::from::peg\fR
\fIfiles/modules/pt/pt_peg_from_peg.n\fR: PEG Conversion. Read PEG format
.TP
\fBpt::peg::import\fR
\fIfiles/modules/pt/pt_peg_import.n\fR: PEG Import
.TP
\fBpt::peg::import::container\fR
\fIfiles/modules/pt/pt_peg_import_container.n\fR: PEG Import Plugin. From CONTAINER format
.TP
\fBpt::peg::import::json\fR
\fIfiles/modules/pt/pt_peg_import_json.n\fR: PEG Import Plugin. Read JSON format
.TP
\fBpt::peg::import::peg\fR
\fIfiles/modules/pt/pt_peg_import_peg.n\fR: PEG Import Plugin. Read PEG format
.TP
\fBpt::peg::interp\fR
\fIfiles/modules/pt/pt_peg_interp.n\fR: Interpreter for parsing expression grammars
.TP
\fBpt::peg::to::container\fR
\fIfiles/modules/pt/pt_peg_to_container.n\fR: PEG Conversion. Write CONTAINER format
.TP
\fBpt::peg::to::cparam\fR
\fIfiles/modules/pt/pt_peg_to_cparam.n\fR: PEG Conversion. Write CPARAM format
.TP
\fBpt::peg::to::json\fR
\fIfiles/modules/pt/pt_peg_to_json.n\fR: PEG Conversion. Write JSON format
.TP
\fBpt::peg::to::param\fR
\fIfiles/modules/pt/pt_peg_to_param.n\fR: PEG Conversion. Write PARAM format
.TP
\fBpt::peg::to::peg\fR
\fIfiles/modules/pt/pt_peg_to_peg.n\fR: PEG Conversion. Write PEG format
.TP
\fBpt::peg::to::tclparam\fR
\fIfiles/modules/pt/pt_peg_to_tclparam.n\fR: PEG Conversion. Write TCLPARAM format
.TP
\fBpt::peg_language\fR
\fIfiles/modules/pt/pt_peg_language.n\fR: PEG Language Tutorial
.TP
\fBpt::pegrammar\fR
\fIfiles/modules/pt/pt_peg_introduction.n\fR: Introduction to Parsing Expression Grammars
.TP
\fBpt::pgen\fR
\fIfiles/modules/pt/pt_pgen.n\fR: Parser Generator
.TP
\fBpt::rde\fR
\fIfiles/modules/pt/pt_rdengine.n\fR: Parsing Runtime Support, PARAM based
.TP
\fBpt::tclparam::configuration::snit\fR
\fIfiles/modules/pt/pt_tclparam_config_snit.n\fR: Tcl/PARAM, Canned configuration, Snit
.TP
\fBpt::tclparam::configuration::tcloo\fR
\fIfiles/modules/pt/pt_tclparam_config_tcloo.n\fR: Tcl/PARAM, Canned configuration, Tcloo
.TP
\fBpt_export_api\fR
\fIfiles/modules/pt/pt_to_api.n\fR: Parser Tools Export API
.TP
\fBpt_import_api\fR
\fIfiles/modules/pt/pt_from_api.n\fR: Parser Tools Import API
.TP
\fBpt_introduction\fR
\fIfiles/modules/pt/pt_introduction.n\fR: Introduction to Parser Tools
.TP
\fBpt_parser_api\fR
\fIfiles/modules/pt/pt_parser_api.n\fR: Parser API
.TP
\fBrc4\fR
\fIfiles/modules/rc4/rc4.n\fR: Implementation of the RC4 stream cipher
.TP
\fBrcs\fR
\fIfiles/modules/rcs/rcs.n\fR: RCS low level utilities
.TP
\fBreport\fR
\fIfiles/modules/report/report.n\fR: Create and manipulate report objects
.TP
\fBrest\fR
\fIfiles/modules/rest/rest.n\fR: define REST web APIs and call them inline or asychronously
.TP
\fBripemd128\fR
\fIfiles/modules/ripemd/ripemd128.n\fR: RIPEMD-128 Message-Digest Algorithm
.TP
\fBripemd160\fR
\fIfiles/modules/ripemd/ripemd160.n\fR: RIPEMD-160 Message-Digest Algorithm
.TP
\fBS3\fR
\fIfiles/modules/amazon-s3/S3.n\fR: Amazon S3 Web Service Interface
.TP
\fBSASL\fR
\fIfiles/modules/sasl/sasl.n\fR: Implementation of SASL mechanisms for Tcl
.TP
\fBsha1\fR
\fIfiles/modules/sha1/sha1.n\fR: SHA1 Message-Digest Algorithm
.TP
\fBsha256\fR
\fIfiles/modules/sha1/sha256.n\fR: SHA256 Message-Digest Algorithm
.TP
\fBsimulation::annealing\fR
\fIfiles/modules/simulation/annealing.n\fR: Simulated annealing
.TP
\fBsimulation::montecarlo\fR
\fIfiles/modules/simulation/montecarlo.n\fR: Monte Carlo simulations
.TP
\fBsimulation::random\fR
\fIfiles/modules/simulation/simulation_random.n\fR: Pseudo-random number generators
.TP
\fBsmtp\fR
\fIfiles/modules/mime/smtp.n\fR: Client-side tcl implementation of the smtp protocol
.TP
\fBsmtpd\fR
\fIfiles/modules/smtpd/smtpd.n\fR: Tcl SMTP server implementation
.TP
\fBsnit\fR
\fIfiles/modules/snit/snit.n\fR: Snit's Not Incr Tcl
.TP
\fBsnitfaq\fR
\fIfiles/modules/snit/snitfaq.n\fR: Snit Frequently Asked Questions
.TP
\fBsoundex\fR
\fIfiles/modules/soundex/soundex.n\fR: Soundex
.TP
\fBstooop\fR
\fIfiles/modules/stooop/stooop.n\fR: Object oriented extension.
.TP
\fBstringprep\fR
\fIfiles/modules/stringprep/stringprep.n\fR: Implementation of stringprep
.TP
\fBstringprep::data\fR
\fIfiles/modules/stringprep/stringprep_data.n\fR: stringprep data tables, generated, internal
.TP
\fBstruct::disjointset\fR
\fIfiles/modules/struct/disjointset.n\fR: Disjoint set data structure
.TP
\fBstruct::graph\fR
\fIfiles/modules/struct/graph.n\fR: Create and manipulate directed graph objects
.TP
\fBstruct::graph::op\fR
\fIfiles/modules/struct/graphops.n\fR: Operation for (un)directed graph objects
.TP
\fBstruct::graph_v1\fR
\fIfiles/modules/struct/graph1.n\fR: Create and manipulate directed graph objects
.TP
\fBstruct::list\fR
\fIfiles/modules/struct/struct_list.n\fR: Procedures for manipulating lists
.TP
\fBstruct::matrix\fR
\fIfiles/modules/struct/matrix.n\fR: Create and manipulate matrix objects
.TP
\fBstruct::matrix_v1\fR
\fIfiles/modules/struct/matrix1.n\fR: Create and manipulate matrix objects
.TP
\fBstruct::pool\fR
\fIfiles/modules/struct/pool.n\fR: Create and manipulate pool objects (of discrete items)
.TP
\fBstruct::prioqueue\fR
\fIfiles/modules/struct/prioqueue.n\fR: Create and manipulate prioqueue objects
.TP
\fBstruct::queue\fR
\fIfiles/modules/struct/queue.n\fR: Create and manipulate queue objects
.TP
\fBstruct::record\fR
\fIfiles/modules/struct/record.n\fR: Define and create records (similar to 'C' structures)
.TP
\fBstruct::set\fR
\fIfiles/modules/struct/struct_set.n\fR: Procedures for manipulating sets
.TP
\fBstruct::skiplist\fR
\fIfiles/modules/struct/skiplist.n\fR: Create and manipulate skiplists
.TP
\fBstruct::stack\fR
\fIfiles/modules/struct/stack.n\fR: Create and manipulate stack objects
.TP
\fBstruct::tree\fR
\fIfiles/modules/struct/struct_tree.n\fR: Create and manipulate tree objects
.TP
\fBstruct::tree_v1\fR
\fIfiles/modules/struct/struct_tree1.n\fR: Create and manipulate tree objects
.TP
\fBsum\fR
\fIfiles/modules/crc/sum.n\fR: Calculate a sum(1) compatible checksum
.TP
\fBtar\fR
\fIfiles/modules/tar/tar.n\fR: Tar file creation, extraction & manipulation
.TP
\fBtcl::chan::cat\fR
\fIfiles/modules/virtchannel_base/cat.n\fR: Concatenation channel
.TP
\fBtcl::chan::core\fR
\fIfiles/modules/virtchannel_core/core.n\fR: Basic reflected/virtual channel support
.TP
\fBtcl::chan::events\fR
\fIfiles/modules/virtchannel_core/events.n\fR: Event support for reflected/virtual channels
.TP
\fBtcl::chan::facade\fR
\fIfiles/modules/virtchannel_base/facade.n\fR: Facade channel
.TP
\fBtcl::chan::fifo\fR
\fIfiles/modules/virtchannel_base/fifo.n\fR: In-memory fifo channel
.TP
\fBtcl::chan::fifo2\fR
\fIfiles/modules/virtchannel_base/fifo2.n\fR: In-memory interconnected fifo channels
.TP
\fBtcl::chan::halfpipe\fR
\fIfiles/modules/virtchannel_base/halfpipe.n\fR: In-memory channel, half of a fifo2
.TP
\fBtcl::chan::memchan\fR
\fIfiles/modules/virtchannel_base/memchan.n\fR: In-memory channel
.TP
\fBtcl::chan::null\fR
\fIfiles/modules/virtchannel_base/null.n\fR: Null channel
.TP
\fBtcl::chan::nullzero\fR
\fIfiles/modules/virtchannel_base/nullzero.n\fR: Null/Zero channel combination
.TP
\fBtcl::chan::random\fR
\fIfiles/modules/virtchannel_base/random.n\fR: Random channel
.TP
\fBtcl::chan::randseed\fR
\fIfiles/modules/virtchannel_base/randseed.n\fR: Utilities for random channels
.TP
\fBtcl::chan::std\fR
\fIfiles/modules/virtchannel_base/std.n\fR: Standard I/O, unification of stdin and stdout
.TP
\fBtcl::chan::string\fR
\fIfiles/modules/virtchannel_base/string.n\fR: Read-only in-memory channel
.TP
\fBtcl::chan::textwindow\fR
\fIfiles/modules/virtchannel_base/textwindow.n\fR: Textwindow channel
.TP
\fBtcl::chan::variable\fR
\fIfiles/modules/virtchannel_base/variable.n\fR: In-memory channel using variable for storage
.TP
\fBtcl::chan::zero\fR
\fIfiles/modules/virtchannel_base/zero.n\fR: Zero channel
.TP
\fBtcl::transform::adler32\fR
\fIfiles/modules/virtchannel_transform/adler32.n\fR: Adler32 transformation
.TP
\fBtcl::transform::base64\fR
\fIfiles/modules/virtchannel_transform/base64.n\fR: Base64 encoding transformation
.TP
\fBtcl::transform::core\fR
\fIfiles/modules/virtchannel_core/transformcore.n\fR: Basic reflected/virtual channel transform support
.TP
\fBtcl::transform::counter\fR
\fIfiles/modules/virtchannel_transform/counter.n\fR: Counter transformation
.TP
\fBtcl::transform::crc32\fR
\fIfiles/modules/virtchannel_transform/crc32.n\fR: Crc32 transformation
.TP
\fBtcl::transform::hex\fR
\fIfiles/modules/virtchannel_transform/hex.n\fR: Hexadecimal encoding transformation
.TP
\fBtcl::transform::identity\fR
\fIfiles/modules/virtchannel_transform/identity.n\fR: Identity transformation
.TP
\fBtcl::transform::limitsize\fR
\fIfiles/modules/virtchannel_transform/limitsize.n\fR: limiting input
.TP
\fBtcl::transform::observe\fR
\fIfiles/modules/virtchannel_transform/observe.n\fR: Observer transformation, stream copy
.TP
\fBtcl::transform::otp\fR
\fIfiles/modules/virtchannel_transform/otp.n\fR: Encryption via one-time pad
.TP
\fBtcl::transform::rot\fR
\fIfiles/modules/virtchannel_transform/rot.n\fR: rot-encryption
.TP
\fBtcl::transform::spacer\fR
\fIfiles/modules/virtchannel_transform/spacer.n\fR: Space insertation and removal
.TP
\fBtcl::transform::zlib\fR
\fIfiles/modules/virtchannel_transform/zlib.n\fR: zlib (de)compression
.TP
\fBtcldocstrip\fR
\fIfiles/apps/tcldocstrip.n\fR: Tcl-based Docstrip Processor
.TP
\fBtcllib_ip\fR
\fIfiles/modules/dns/tcllib_ip.n\fR: IPv4 and IPv6 address manipulation
.TP
\fBtclrep/machineparameters\fR
\fIfiles/modules/math/machineparameters.n\fR: Compute double precision machine parameters.
.TP
\fBtepam\fR
\fIfiles/modules/tepam/tepam_introduction.n\fR: An introduction into TEPAM, Tcl's Enhanced Procedure and Argument Manager
.TP
\fBtepam::argument_dialogbox\fR
\fIfiles/modules/tepam/tepam_argument_dialogbox.n\fR: TEPAM argument_dialogbox, reference manual
.TP
\fBtepam::procedure\fR
\fIfiles/modules/tepam/tepam_procedure.n\fR: TEPAM procedure, reference manual
.TP
\fBterm\fR
\fIfiles/modules/term/term.n\fR: General terminal control
.TP
\fBterm::ansi::code\fR
\fIfiles/modules/term/ansi_code.n\fR: Helper for control sequences
.TP
\fBterm::ansi::code::attr\fR
\fIfiles/modules/term/ansi_cattr.n\fR: ANSI attribute sequences
.TP
\fBterm::ansi::code::ctrl\fR
\fIfiles/modules/term/ansi_cctrl.n\fR: ANSI control sequences
.TP
\fBterm::ansi::code::macros\fR
\fIfiles/modules/term/ansi_cmacros.n\fR: Macro sequences
.TP
\fBterm::ansi::ctrl::unix\fR
\fIfiles/modules/term/ansi_ctrlu.n\fR: Control operations and queries
.TP
\fBterm::ansi::send\fR
\fIfiles/modules/term/ansi_send.n\fR: Output of ANSI control sequences to terminals
.TP
\fBterm::interact::menu\fR
\fIfiles/modules/term/imenu.n\fR: Terminal widget, menu
.TP
\fBterm::interact::pager\fR
\fIfiles/modules/term/ipager.n\fR: Terminal widget, paging
.TP
\fBterm::receive\fR
\fIfiles/modules/term/receive.n\fR: General input from terminals
.TP
\fBterm::receive::bind\fR
\fIfiles/modules/term/term_bind.n\fR: Keyboard dispatch from terminals
.TP
\fBterm::send\fR
\fIfiles/modules/term/term_send.n\fR: General output to terminals
.TP
\fBtextutil\fR
\fIfiles/modules/textutil/textutil.n\fR: Procedures to manipulate texts and strings.
.TP
\fBtextutil::adjust\fR
\fIfiles/modules/textutil/adjust.n\fR: Procedures to adjust, indent, and undent paragraphs
.TP
\fBtextutil::expander\fR
\fIfiles/modules/textutil/expander.n\fR: Procedures to process templates and expand text.
.TP
\fBtextutil::repeat\fR
\fIfiles/modules/textutil/repeat.n\fR: Procedures to repeat strings.
.TP
\fBtextutil::split\fR
\fIfiles/modules/textutil/textutil_split.n\fR: Procedures to split texts
.TP
\fBtextutil::string\fR
\fIfiles/modules/textutil/textutil_string.n\fR: Procedures to manipulate texts and strings.
.TP
\fBtextutil::tabify\fR
\fIfiles/modules/textutil/tabify.n\fR: Procedures to (un)tabify strings
.TP
\fBtextutil::trim\fR
\fIfiles/modules/textutil/trim.n\fR: Procedures to trim strings
.TP
\fBtie\fR
\fIfiles/modules/tie/tie.n\fR: Array persistence
.TP
\fBtie\fR
\fIfiles/modules/tie/tie_std.n\fR: Array persistence, standard data sources
.TP
\fBtiff\fR
\fIfiles/modules/tiff/tiff.n\fR: TIFF reading, writing, and querying and manipulation of meta data
.TP
\fBtransfer::connect\fR
\fIfiles/modules/transfer/connect.n\fR: Connection setup
.TP
\fBtransfer::copy\fR
\fIfiles/modules/transfer/copyops.n\fR: Data transfer foundation
.TP
\fBtransfer::copy::queue\fR
\fIfiles/modules/transfer/tqueue.n\fR: Queued transfers
.TP
\fBtransfer::data::destination\fR
\fIfiles/modules/transfer/ddest.n\fR: Data destination
.TP
\fBtransfer::data::source\fR
\fIfiles/modules/transfer/dsource.n\fR: Data source
.TP
\fBtransfer::receiver\fR
\fIfiles/modules/transfer/receiver.n\fR: Data source
.TP
\fBtransfer::transmitter\fR
\fIfiles/modules/transfer/transmitter.n\fR: Data source
.TP
\fBtreeql\fR
\fIfiles/modules/treeql/treeql.n\fR: Query tree objects
.TP
\fBtry\fR
\fIfiles/modules/try/tcllib_try.n\fR: try - Trap and process errors and exceptions
.TP
\fBuevent\fR
\fIfiles/modules/uev/uevent.n\fR: User events
.TP
\fBuevent::onidle\fR
\fIfiles/modules/uev/uevent_onidle.n\fR: Request merging and deferal to idle time
.TP
\fBunicode\fR
\fIfiles/modules/stringprep/unicode.n\fR: Implementation of Unicode normalization
.TP
\fBunicode::data\fR
\fIfiles/modules/stringprep/unicode_data.n\fR: unicode data tables, generated, internal
.TP
\fBunits\fR
\fIfiles/modules/units/units.n\fR: unit conversion
.TP
\fBuri\fR
\fIfiles/modules/uri/uri.n\fR: URI utilities
.TP
\fBuri_urn\fR
\fIfiles/modules/uri/urn-scheme.n\fR: URI utilities, URN scheme
.TP
\fBuuencode\fR
\fIfiles/modules/base64/uuencode.n\fR: UU-encode/decode binary data
.TP
\fBuuid\fR
\fIfiles/modules/uuid/uuid.n\fR: UUID generation and comparison
.TP
\fBwip\fR
\fIfiles/modules/wip/wip.n\fR: Word Interpreter
.TP
\fBxsxp\fR
\fIfiles/modules/amazon-s3/xsxp.n\fR: eXtremely Simple Xml Parser
.TP
\fByaml\fR
\fIfiles/modules/yaml/yaml.n\fR: YAML Format Encoder/Decoder
.TP
\fByencode\fR
\fIfiles/modules/base64/yencode.n\fR: Y-encode/decode binary data

Added embedded/www/image/arch_core_container.png.

cannot compute difference between binary files

Added embedded/www/image/arch_core_eplugins.png.

cannot compute difference between binary files

Added embedded/www/image/arch_core_export.png.

cannot compute difference between binary files

Added embedded/www/image/arch_core_import.png.

cannot compute difference between binary files

Added embedded/www/image/arch_core_iplugins.png.

cannot compute difference between binary files

Added embedded/www/image/arch_core_support.png.

cannot compute difference between binary files

Added embedded/www/image/arch_core_transform.png.

cannot compute difference between binary files

Added embedded/www/image/arch_user_app.png.

cannot compute difference between binary files

Added embedded/www/image/arch_user_pkg.png.

cannot compute difference between binary files

Added embedded/www/image/architecture.png.

cannot compute difference between binary files

Added embedded/www/image/expr_ast.png.

cannot compute difference between binary files

Added embedded/www/image/flow.png.

cannot compute difference between binary files

Added embedded/www/image/gen_options.png.

cannot compute difference between binary files

Added embedded/www/index.html.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html>
<! -- Generated by tcllib/doctools/idx with format 'html'
   -->
<! -- CVS: $Id$ Keyword Index
   -->
<head>
<title> Keyword Index </title>
</head>
<body>
<hr> [
  <a href="toc.html">Table Of Contents</a>
| <a href="/tcllib">Home</a>
] <hr>
<h3> Keyword Index </h3>
<hr><div class="#idxnav">
<a href="#c1"> . </a> &#183; <a href="#c2"> / </a> &#183; <a href="#c3"> 3 </a> &#183; <a href="#c4"> A </a> &#183; <a href="#c5"> B </a> &#183; <a href="#c6"> C </a> &#183; <a href="#c7"> D </a> &#183; <a href="#c8"> E </a> &#183; <a href="#c9"> F </a> &#183; <a href="#c10"> G </a> &#183; <a href="#c11"> H </a> &#183; <a href="#c12"> I </a> &#183; <a href="#c13"> J </a> &#183; <a href="#c14"> K </a> &#183; <a href="#c15"> L </a> &#183; <a href="#c16"> M </a> &#183; <a href="#c17"> N </a> &#183; <a href="#c18"> O </a> &#183; <a href="#c19"> P </a> &#183; <a href="#c20"> Q </a> &#183; <a href="#c21"> R </a> &#183; <a href="#c22"> S </a> &#183; <a href="#c23"> T </a> &#183; <a href="#c24"> U </a> &#183; <a href="#c25"> V </a> &#183; <a href="#c26"> W </a> &#183; <a href="#c27"> X </a> &#183; <a href="#c28"> Y </a> &#183; <a href="#c29"> Z </a>
</div>
<hr><table class="#idx" width="100%">
<tr class="#idxheader"><th colspan="2">
<a name="c1">Keywords: .</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key619"> .ddt </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key389"> .dtx </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip.html"> docstrip </a> &#183; <a href="tcllib/files/apps/tcldocstrip.html"> tcldocstrip </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c2">Keywords: /</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key455"> /dev/null </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/null.html"> tcl::chan::null </a> &#183; <a href="tcllib/files/modules/virtchannel_base/nullzero.html"> tcl::chan::nullzero </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key276"> /dev/random </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/random.html"> tcl::chan::random </a> &#183; <a href="tcllib/files/modules/virtchannel_base/randseed.html"> tcl::chan::randseed </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key534"> /dev/zero </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/nullzero.html"> tcl::chan::nullzero </a> &#183; <a href="tcllib/files/modules/virtchannel_base/zero.html"> tcl::chan::zero </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c3">Keywords: 3</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key608"> 3DES </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/des/des.html"> des </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c4">Keywords: A</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key686"> abstract syntax tree </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_util.html"> grammar::me::util </a> &#183; <a href="tcllib/files/modules/grammar_me/me_ast.html"> grammar::me_ast </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key283"> acceptance </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key280"> acceptor </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key562"> active </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/transfer/connect.html"> transfer::connect </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key217"> adaptors </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key417"> adjacency list </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key441"> adjacency matrix </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key434"> adjacent </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key303"> adjusting </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key621"> adler32 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/adler32.html"> tcl::transform::adler32 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key729"> aes </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/aes/aes.html"> aes </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key366"> after </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key713"> alias </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/interp/tcllib_interp.html"> interp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key474"> amazon </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/amazon-s3/S3.html"> S3 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key754"> ambiguous </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_aycock/aycock.html"> grammar::aycock </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key532"> angle </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/math_geometry.html"> math::geometry </a> &#183; <a href="tcllib/files/modules/units/units.html"> units </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key547"> anonymous procedure </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/lambda/lambda.html"> lambda </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key158"> ansi </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_cattr.html"> term::ansi::code::attr </a> &#183; <a href="tcllib/files/modules/term/ansi_cctrl.html"> term::ansi::code::ctrl </a> &#183; <a href="tcllib/files/modules/term/ansi_cmacros.html"> term::ansi::code::macros </a> &#183; <a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key360"> appender </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/log/loggerAppender.html"> logger::appender </a> &#183; <a href="tcllib/files/modules/log/loggerUtils.html"> logger::utils </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key28"> application </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/apps/nns.html"> nns </a> &#183; <a href="tcllib/files/apps/nnsd.html"> nnsd </a> &#183; <a href="tcllib/files/apps/nnslog.html"> nnslog </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key443"> approximation algorithm </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key422"> arc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key113"> arcfour </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rc4/rc4.html"> rc4 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key680"> archive </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tar/tar.html"> tar </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key697"> argument integrity </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tepam/tepam_introduction.html"> tepam </a> &#183; <a href="tcllib/files/modules/tepam/tepam_procedure.html"> tepam::procedure </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key228"> argument processing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cmdline/cmdline.html"> cmdline </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key698"> argument validation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tepam/tepam_introduction.html"> tepam </a> &#183; <a href="tcllib/files/modules/tepam/tepam_procedure.html"> tepam::procedure </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key699"> arguments </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tepam/tepam_introduction.html"> tepam </a> &#183; <a href="tcllib/files/modules/tepam/tepam_procedure.html"> tepam::procedure </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key227"> argv </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cmdline/cmdline.html"> cmdline </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key226"> argv0 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cmdline/cmdline.html"> cmdline </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key37"> array </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tie/tie_std.html"> tie </a> &#183; <a href="tcllib/files/modules/tie/tie.html"> tie </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key432"> articulation point </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key664"> ascii85 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base64/ascii85.html"> ascii85 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key376"> asn </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/asn/asn.html"> asn </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key270"> assembler </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/gasm.html"> grammar::me::cpu::gasm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key132"> assert </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/control/control.html"> control </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key521"> assign </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key752"> AST </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_ast.html"> grammar::me_ast </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key590"> asynchronous </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cache/async.html"> cache::async </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key157"> attribute control </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_cattr.html"> term::ansi::code::attr </a> &#183; <a href="tcllib/files/modules/term/ansi_cctrl.html"> term::ansi::code::ctrl </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key419"> augmenting network </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key439"> augmenting path </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key740"> authentication </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/http/autoproxy.html"> autoproxy </a> &#183; <a href="tcllib/files/modules/sasl/sasl.html"> SASL </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key468"> automatic </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nns/nns_auto.html"> nameserv::auto </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key277"> automaton </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key757"> aycock </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_aycock/aycock.html"> grammar::aycock </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c5">Keywords: B</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key251"> base32 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base32/base32.html"> base32 </a> &#183; <a href="tcllib/files/modules/base32/base32core.html"> base32::core </a> &#183; <a href="tcllib/files/modules/base32/base32hex.html"> base32::hex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key716"> base64 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base64/base64.html"> base64 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/base64.html"> tcl::transform::base64 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key341"> bee </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bee/bee.html"> bee </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key84"> bench language </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_intro.html"> bench_intro </a> &#183; <a href="tcllib/files/modules/bench/bench_lang_intro.html"> bench_lang_intro </a> &#183; <a href="tcllib/files/modules/bench/bench_lang_spec.html"> bench_lang_spec </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key87"> benchmark </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench.html"> bench </a> &#183; <a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a> &#183; <a href="tcllib/files/modules/bench/bench_wcsv.html"> bench::out::csv </a> &#183; <a href="tcllib/files/modules/bench/bench_wtext.html"> bench::out::text </a> &#183; <a href="tcllib/files/modules/bench/bench_intro.html"> bench_intro </a> &#183; <a href="tcllib/files/modules/bench/bench_lang_intro.html"> bench_lang_intro </a> &#183; <a href="tcllib/files/modules/bench/bench_lang_spec.html"> bench_lang_spec </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key374"> ber </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/asn/asn.html"> asn </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key637"> Bessel functions </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/special.html"> math::special </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key415"> bfs </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key378"> bibliography </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bibtex/bibtex.html"> bibtex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key379"> bibtex </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bibtex/bibtex.html"> bibtex </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key244"> bignums </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/bignum.html"> math::bignum </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key659"> bind </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uev/uevent.html"> uevent </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key445"> bipartite </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key342"> BitTorrent </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bee/bee.html"> bee </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key343"> bittorrent </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bee/bee.html"> bee </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key237"> blanks </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/repeat.html"> textutil::repeat </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key607"> block cipher </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/aes/aes.html"> aes </a> &#183; <a href="tcllib/files/modules/blowfish/blowfish.html"> blowfish </a> &#183; <a href="tcllib/files/modules/des/des.html"> des </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key405"> blocking flow </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key737"> blowfish </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/blowfish/blowfish.html"> blowfish </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key650"> breadth-first </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_tree.html"> struct::tree </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key416"> bridge </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key218"> BWidget </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c6">Keywords: C</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key476"> C </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key213"> C++ </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a> &#183; <a href="tcllib/files/modules/stooop/stooop.html"> stooop </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key338"> cache </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cache/async.html"> cache::async </a> &#183; <a href="tcllib/files/modules/map/map_slippy_cache.html"> map::slippy::cache </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key351"> caesar cipher </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key722"> calculus </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/calculus.html"> math::calculus </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key494"> callback </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cache/async.html"> cache::async </a> &#183; <a href="tcllib/files/modules/hook/hook.html"> hook </a> &#183; <a href="tcllib/files/modules/lambda/lambda.html"> lambda </a> &#183; <a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a> &#183; <a href="tcllib/files/modules/uev/uevent_onidle.html"> uevent::onidle </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key666"> callbacks </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/halfpipe.html"> tcl::chan::halfpipe </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key641"> capitalize </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil_string.html"> textutil::string </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key672"> cardinality </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key265"> cat </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/fileutil.html"> fileutil </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key48"> catalog package </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key618"> catalogue </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key375"> cer </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/asn/asn.html"> asn </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key22"> CFG </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key27"> CFL </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key628"> CGI </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ncgi/ncgi.html"> ncgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key565"> cgraph </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graph1.html"> struct::graph_v1 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key402"> changelog </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/changelog.html"> doctools::changelog </a> &#183; <a href="tcllib/files/modules/doctools/cvs.html"> doctools::cvs </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key59"> channel </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a> &#183; <a href="tcllib/files/modules/transfer/connect.html"> transfer::connect </a> &#183; <a href="tcllib/files/modules/transfer/copyops.html"> transfer::copy </a> &#183; <a href="tcllib/files/modules/transfer/tqueue.html"> transfer::copy::queue </a> &#183; <a href="tcllib/files/modules/transfer/ddest.html"> transfer::data::destination </a> &#183; <a href="tcllib/files/modules/transfer/dsource.html"> transfer::data::source </a> &#183; <a href="tcllib/files/modules/transfer/receiver.html"> transfer::receiver </a> &#183; <a href="tcllib/files/modules/transfer/transmitter.html"> transfer::transmitter </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key271"> channel transformation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/adler32.html"> tcl::transform::adler32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/base64.html"> tcl::transform::base64 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/counter.html"> tcl::transform::counter </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/crc32.html"> tcl::transform::crc32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/hex.html"> tcl::transform::hex </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/identity.html"> tcl::transform::identity </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/limitsize.html"> tcl::transform::limitsize </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/observe.html"> tcl::transform::observe </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/spacer.html"> tcl::transform::spacer </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key91"> character input </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/receive.html"> term::receive </a> &#183; <a href="tcllib/files/modules/term/term_bind.html"> term::receive::bind </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key371"> character output </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_send.html"> term::ansi::send </a> &#183; <a href="tcllib/files/modules/term/term_send.html"> term::send </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key645"> chat </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/irc/irc.html"> irc </a> &#183; <a href="tcllib/files/modules/multiplexer/multiplexer.html"> multiplexer </a> &#183; <a href="tcllib/files/modules/irc/picoirc.html"> picoirc </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key570"> checkbox </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/html/html.html"> html </a> &#183; <a href="tcllib/files/modules/javascript/javascript.html"> javascript </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key568"> checkbutton </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/html/html.html"> html </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key140"> checksum </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/crc/cksum.html"> cksum </a> &#183; <a href="tcllib/files/modules/crc/crc16.html"> crc16 </a> &#183; <a href="tcllib/files/modules/crc/crc32.html"> crc32 </a> &#183; <a href="tcllib/files/modules/crc/sum.html"> sum </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/adler32.html"> tcl::transform::adler32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/crc32.html"> tcl::transform::crc32 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key639"> chop </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil_string.html"> textutil::string </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key162"> cipher </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pki/pki.html"> pki </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key141"> cksum </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/crc/cksum.html"> cksum </a> &#183; <a href="tcllib/files/modules/crc/crc16.html"> crc16 </a> &#183; <a href="tcllib/files/modules/crc/crc32.html"> crc32 </a> &#183; <a href="tcllib/files/modules/crc/sum.html"> sum </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key219"> class </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a> &#183; <a href="tcllib/files/modules/stooop/stooop.html"> stooop </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key707"> class methods </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key709"> class variables </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key151"> cleanup </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/try/tcllib_try.html"> try </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key30"> client </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nns/nns_client.html"> nameserv </a> &#183; <a href="tcllib/files/modules/nns/nns_auto.html"> nameserv::auto </a> &#183; <a href="tcllib/files/modules/nns/nns_common.html"> nameserv::common </a> &#183; <a href="tcllib/files/apps/nns.html"> nns </a> &#183; <a href="tcllib/files/modules/nns/nns_intro.html"> nns_intro </a> &#183; <a href="tcllib/files/apps/nnslog.html"> nnslog </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key475"> cloud </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/amazon-s3/S3.html"> S3 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key229"> cmdline processing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cmdline/cmdline.html"> cmdline </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key156"> color control </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_cattr.html"> term::ansi::code::attr </a> &#183; <a href="tcllib/files/modules/term/ansi_cctrl.html"> term::ansi::code::ctrl </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key457"> columns </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key38"> comm </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/comm/comm_wire.html"> comm_wire </a> &#183; <a href="tcllib/files/modules/interp/deleg_method.html"> deleg_method </a> &#183; <a href="tcllib/files/modules/interp/deleg_proc.html"> deleg_proc </a> &#183; <a href="tcllib/files/modules/nns/nns_protocol.html"> nameserv::protocol </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key236"> command </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcl_parse.html"> doctools::tcl::parse </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key225"> command line processing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cmdline/cmdline.html"> cmdline </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key545"> command prefix </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/lambda/lambda.html"> lambda </a> &#183; <a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key146"> comment </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/jpeg/jpeg.html"> jpeg </a> &#183; <a href="tcllib/files/modules/png/png.html"> png </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key502"> common </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key642"> common prefix </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil_string.html"> textutil::string </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key314"> communication </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/comm/comm_wire.html"> comm_wire </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key504"> comparison </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key438"> complete graph </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key730"> complex numbers </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/qcomplex.html"> math::complexnumbers </a> &#183; <a href="tcllib/files/modules/math/fourier.html"> math::fourier </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key323"> compression </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key691"> computations </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/bigfloat.html"> math::bigfloat </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key159"> concatenation channel </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/cat.html"> tcl::chan::cat </a> &#183; <a href="tcllib/files/modules/virtchannel_base/facade.html"> tcl::chan::facade </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key430"> connected component </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key770"> connected fifos </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/fifo2.html"> tcl::chan::fifo2 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key563"> connection </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/transfer/connect.html"> transfer::connect </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key560"> constants </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/constants.html"> math::constants </a> &#183; <a href="tcllib/files/modules/units/units.html"> units </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key308"> CONTAINER </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key589"> contents </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2toc/introduction.html"> doctools2toc_introduction </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key23"> context-free grammar </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key10"> context-free languages </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key92"> control </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/control/control.html"> control </a> &#183; <a href="tcllib/files/modules/term/term.html"> term </a> &#183; <a href="tcllib/files/modules/term/ansi_code.html"> term::ansi::code </a> &#183; <a href="tcllib/files/modules/term/ansi_cattr.html"> term::ansi::code::attr </a> &#183; <a href="tcllib/files/modules/term/ansi_cctrl.html"> term::ansi::code::ctrl </a> &#183; <a href="tcllib/files/modules/term/ansi_cmacros.html"> term::ansi::code::macros </a> &#183; <a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a> &#183; <a href="tcllib/files/modules/term/ansi_send.html"> term::ansi::send </a> &#183; <a href="tcllib/files/modules/term/imenu.html"> term::interact::menu </a> &#183; <a href="tcllib/files/modules/term/ipager.html"> term::interact::pager </a> &#183; <a href="tcllib/files/modules/term/receive.html"> term::receive </a> &#183; <a href="tcllib/files/modules/term/term_bind.html"> term::receive::bind </a> &#183; <a href="tcllib/files/modules/term/term_send.html"> term::send </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key205"> control structure </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key3"> conversion </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools.html"> doctools </a> &#183; <a href="tcllib/files/modules/doctools2idx/introduction.html"> doctools2idx_introduction </a> &#183; <a href="tcllib/files/modules/doctools2toc/introduction.html"> doctools2toc_introduction </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a> &#183; <a href="tcllib/files/modules/math/roman.html"> math::roman </a> &#183; <a href="tcllib/files/modules/doctools/mpexpand.html"> mpexpand </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/apps/tcldocstrip.html"> tcldocstrip </a> &#183; <a href="tcllib/files/modules/units/units.html"> units </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key459"> cooked </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key627"> cookie </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ncgi/ncgi.html"> ncgi </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key61"> copy </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/multi.html"> fileutil::multi </a> &#183; <a href="tcllib/files/modules/fileutil/multiop.html"> fileutil::multi::op </a> &#183; <a href="tcllib/files/modules/transfer/copyops.html"> transfer::copy </a> &#183; <a href="tcllib/files/modules/transfer/tqueue.html"> transfer::copy::queue </a> &#183; <a href="tcllib/files/modules/transfer/ddest.html"> transfer::data::destination </a> &#183; <a href="tcllib/files/modules/transfer/dsource.html"> transfer::data::source </a> &#183; <a href="tcllib/files/modules/transfer/receiver.html"> transfer::receiver </a> &#183; <a href="tcllib/files/modules/transfer/transmitter.html"> transfer::transmitter </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key200"> coroutine </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a> &#183; <a href="tcllib/files/modules/generator/generator.html"> generator </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key760"> Cost </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/treeql/treeql.html"> treeql </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key272"> counter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/counter.html"> tcl::transform::counter </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key662"> counting </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/counter/counter.html"> counter </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key748"> CPARAM </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key137"> crc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/crc/cksum.html"> cksum </a> &#183; <a href="tcllib/files/modules/crc/crc16.html"> crc16 </a> &#183; <a href="tcllib/files/modules/crc/crc32.html"> crc32 </a> &#183; <a href="tcllib/files/modules/crc/sum.html"> sum </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key747"> crc16 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/crc/crc16.html"> crc16 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key138"> crc32 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/crc/cksum.html"> cksum </a> &#183; <a href="tcllib/files/modules/crc/crc16.html"> crc16 </a> &#183; <a href="tcllib/files/modules/crc/crc32.html"> crc32 </a> &#183; <a href="tcllib/files/modules/crc/sum.html"> sum </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/crc32.html"> tcl::transform::crc32 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key736"> cryptography </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/blowfish/blowfish.html"> blowfish </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key356"> CSS </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/html_cssdefaults.html"> doctools::html::cssdefaults </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key53"> csv </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a> &#183; <a href="tcllib/files/modules/bench/bench_wcsv.html"> bench::out::csv </a> &#183; <a href="tcllib/files/modules/csv/csv.html"> csv </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key548"> currying </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/lambda/lambda.html"> lambda </a> &#183; <a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key433"> cut edge </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key435"> cut vertex </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key583"> CVS </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rcs/rcs.html"> rcs </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key711"> cvs </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/cvs.html"> doctools::cvs </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key712"> cvs log </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/cvs.html"> doctools::cvs </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key139"> cyclic redundancy check </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/crc/cksum.html"> cksum </a> &#183; <a href="tcllib/files/modules/crc/crc16.html"> crc16 </a> &#183; <a href="tcllib/files/modules/crc/crc32.html"> crc32 </a> &#183; <a href="tcllib/files/modules/crc/sum.html"> sum </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c7">Keywords: D</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key580"> data analysis </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/statistics.html"> math::statistics </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key58"> data destination </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/transfer/ddest.html"> transfer::data::destination </a> &#183; <a href="tcllib/files/modules/transfer/receiver.html"> transfer::receiver </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key353"> data entry form </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tepam/tepam_argument_dialogbox.html"> tepam::argument_dialogbox </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key171"> data exchange </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/yaml/huddle.html"> huddle </a> &#183; <a href="tcllib/files/modules/json/json.html"> json </a> &#183; <a href="tcllib/files/modules/json/json_write.html"> json::write </a> &#183; <a href="tcllib/files/modules/yaml/yaml.html"> yaml </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key111"> data integrity </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/aes/aes.html"> aes </a> &#183; <a href="tcllib/files/modules/crc/cksum.html"> cksum </a> &#183; <a href="tcllib/files/modules/crc/crc16.html"> crc16 </a> &#183; <a href="tcllib/files/modules/crc/crc32.html"> crc32 </a> &#183; <a href="tcllib/files/modules/des/des.html"> des </a> &#183; <a href="tcllib/files/modules/pki/pki.html"> pki </a> &#183; <a href="tcllib/files/modules/rc4/rc4.html"> rc4 </a> &#183; <a href="tcllib/files/modules/crc/sum.html"> sum </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key331"> data source </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/transfer/dsource.html"> transfer::data::source </a> &#183; <a href="tcllib/files/modules/transfer/transmitter.html"> transfer::transmitter </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key286"> data structures </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/record.html"> struct::record </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key32"> database </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tie/tie_std.html"> tie </a> &#183; <a href="tcllib/files/modules/tie/tie.html"> tie </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key352"> dataflow </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/page/page_util_flow.html"> page_util_flow </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key222"> DE </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key702"> decimal </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/decimal.html"> math::decimal </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key296"> declare </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_code.html"> term::ansi::code </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key324"> decompression </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key349"> decryption </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key497"> deferal </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uev/uevent_onidle.html"> uevent::onidle </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key297"> define </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_code.html"> term::ansi::code </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key425"> degree </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key424"> degree constrained spanning tree </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key746"> degrees </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/constants.html"> math::constants </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key39"> delegation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/interp/deleg_method.html"> deleg_method </a> &#183; <a href="tcllib/files/modules/interp/deleg_proc.html"> deleg_proc </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key649"> depth-first </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_tree.html"> struct::tree </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key377"> der </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/asn/asn.html"> asn </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key606"> DES </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/des/des.html"> des </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key231"> deserialization </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/import_docidx.html"> doctools::idx::import::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_json.html"> doctools::idx::import::json </a> &#183; <a href="tcllib/files/modules/doctools2idx/structure.html"> doctools::idx::structure </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_doctoc.html"> doctools::toc::import::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_json.html"> doctools::toc::import::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/structure.html"> doctools::toc::structure </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key407"> diameter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key513"> diff </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a> &#183; <a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key585"> diff -n format </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rcs/rcs.html"> rcs </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key677"> difference </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key507"> differential </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key723"> differential equations </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/calculus.html"> math::calculus </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key444"> dijkstra </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key127"> directory access </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ldap/ldap.html"> ldap </a> &#183; <a href="tcllib/files/modules/ldap/ldapx.html"> ldapx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key668"> directory traversal </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/traverse.html"> fileutil_traverse </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key725"> discrete items </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/pool.html"> struct::pool </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key573"> disjoint set </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/disjointset.html"> struct::disjointset </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key470"> dispatcher </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/term_bind.html"> term::receive::bind </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key428"> distance </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/math_geometry.html"> math::geometry </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a> &#183; <a href="tcllib/files/modules/units/units.html"> units </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key550"> DNS </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_dns.html"> dns </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key133"> do </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/control/control.html"> control </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key50"> docidx </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_docidx.html"> doctools::idx::export::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_docidx.html"> doctools::idx::import::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/parse.html"> doctools::idx::parse </a> &#183; <a href="tcllib/files/modules/doctools2idx/structure.html"> doctools::idx::structure </a> &#183; <a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key326"> docidx commands </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_lang_cmdref.html"> docidx_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_faq.html"> docidx_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_intro.html"> docidx_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_syntax.html"> docidx_lang_syntax </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key328"> docidx language </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_lang_cmdref.html"> docidx_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_faq.html"> docidx_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_intro.html"> docidx_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_syntax.html"> docidx_lang_syntax </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key329"> docidx markup </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_lang_cmdref.html"> docidx_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_faq.html"> docidx_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_intro.html"> docidx_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_syntax.html"> docidx_lang_syntax </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key327"> docidx syntax </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_lang_faq.html"> docidx_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_intro.html"> docidx_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_syntax.html"> docidx_lang_syntax </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key386"> docstrip </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip.html"> docstrip </a> &#183; <a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a> &#183; <a href="tcllib/files/apps/tcldocstrip.html"> tcldocstrip </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key230"> doctoc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_doctoc.html"> doctools::toc::export::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_doctoc.html"> doctools::toc::import::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/parse.html"> doctools::toc::parse </a> &#183; <a href="tcllib/files/modules/doctools2toc/structure.html"> doctools::toc::structure </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key465"> doctoc commands </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctoc_lang_cmdref.html"> doctoc_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_faq.html"> doctoc_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_intro.html"> doctoc_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_syntax.html"> doctoc_lang_syntax </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key463"> doctoc language </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctoc_lang_cmdref.html"> doctoc_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_faq.html"> doctoc_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_intro.html"> doctoc_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_syntax.html"> doctoc_lang_syntax </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key464"> doctoc markup </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctoc_lang_cmdref.html"> doctoc_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_faq.html"> doctoc_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_intro.html"> doctoc_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_syntax.html"> doctoc_lang_syntax </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key499"> doctoc syntax </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctoc_lang_faq.html"> doctoc_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_intro.html"> doctoc_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_syntax.html"> doctoc_lang_syntax </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key51"> doctools </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a> &#183; <a href="tcllib/files/modules/doctools/changelog.html"> doctools::changelog </a> &#183; <a href="tcllib/files/modules/doctools2base/html_cssdefaults.html"> doctools::html::cssdefaults </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_docidx.html"> doctools::idx::export::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_html.html"> doctools::idx::export::html </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_json.html"> doctools::idx::export::json </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_nroff.html"> doctools::idx::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_text.html"> doctools::idx::export::text </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_wiki.html"> doctools::idx::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_docidx.html"> doctools::idx::import::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_json.html"> doctools::idx::import::json </a> &#183; <a href="tcllib/files/modules/doctools2idx/parse.html"> doctools::idx::parse </a> &#183; <a href="tcllib/files/modules/doctools2idx/structure.html"> doctools::idx::structure </a> &#183; <a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a> &#183; <a href="tcllib/files/modules/doctools2base/nroff_manmacros.html"> doctools::nroff::man_macros </a> &#183; <a href="tcllib/files/modules/doctools2base/tcl_parse.html"> doctools::tcl::parse </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_doctoc.html"> doctools::toc::export::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_html.html"> doctools::toc::export::html </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_json.html"> doctools::toc::export::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_nroff.html"> doctools::toc::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_text.html"> doctools::toc::export::text </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_wiki.html"> doctools::toc::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_doctoc.html"> doctools::toc::import::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_json.html"> doctools::toc::import::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/parse.html"> doctools::toc::parse </a> &#183; <a href="tcllib/files/modules/doctools2toc/structure.html"> doctools::toc::structure </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key117"> doctools commands </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools_lang_cmdref.html"> doctools_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_faq.html"> doctools_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_intro.html"> doctools_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_syntax.html"> doctools_lang_syntax </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key119"> doctools language </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools_lang_cmdref.html"> doctools_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_faq.html"> doctools_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_intro.html"> doctools_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_syntax.html"> doctools_lang_syntax </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key120"> doctools markup </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools_lang_cmdref.html"> doctools_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_faq.html"> doctools_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_intro.html"> doctools_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_syntax.html"> doctools_lang_syntax </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key118"> doctools syntax </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools_lang_faq.html"> doctools_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_intro.html"> doctools_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_syntax.html"> doctools_lang_syntax </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key611"> document </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools_plugin_apiref.html"> doctools_plugin_apiref </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key166"> documentation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip.html"> docstrip </a> &#183; <a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a> &#183; <a href="tcllib/files/modules/doctools/doctools.html"> doctools </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/apps/tcldocstrip.html"> tcldocstrip </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key758"> DOM </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/treeql/treeql.html"> treeql </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key694"> dom </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/amazon-s3/xsxp.html"> xsxp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key552"> domain name service </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_dns.html"> dns </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c8">Keywords: E</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key744"> e </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/constants.html"> math::constants </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key756"> earley </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_aycock/aycock.html"> grammar::aycock </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key9"> EBNF </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key450"> eccentricity </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key409"> edge </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key403"> emacs </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/changelog.html"> doctools::changelog </a> &#183; <a href="tcllib/files/modules/doctools/cvs.html"> doctools::cvs </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key293"> email </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/imap4/imap4.html"> imap4 </a> &#183; <a href="tcllib/files/modules/mime/mime.html"> mime </a> &#183; <a href="tcllib/files/modules/pop3/pop3.html"> pop3 </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key674"> emptiness </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key714"> empty interpreter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/interp/tcllib_interp.html"> interp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key47"> EN </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key224"> encoding </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base64/ascii85.html"> ascii85 </a> &#183; <a href="tcllib/files/modules/base64/base64.html"> base64 </a> &#183; <a href="tcllib/files/modules/base64/uuencode.html"> uuencode </a> &#183; <a href="tcllib/files/modules/base64/yencode.html"> yencode </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key114"> encryption </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/aes/aes.html"> aes </a> &#183; <a href="tcllib/files/modules/blowfish/blowfish.html"> blowfish </a> &#183; <a href="tcllib/files/modules/des/des.html"> des </a> &#183; <a href="tcllib/files/modules/pki/pki.html"> pki </a> &#183; <a href="tcllib/files/modules/rc4/rc4.html"> rc4 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key700"> entry mask </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tepam/tepam_introduction.html"> tepam </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key511"> equal </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key523"> equality </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key572"> equivalence class </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/disjointset.html"> struct::disjointset </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key154"> error </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/try/tcllib_try.html"> try </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key635"> error function </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/special.html"> math::special </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key496"> event </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/hook/hook.html"> hook </a> &#183; <a href="tcllib/files/modules/uev/uevent.html"> uevent </a> &#183; <a href="tcllib/files/modules/uev/uevent_onidle.html"> uevent::onidle </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key469"> event management </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_core/events.html"> tcl::chan::events </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key363"> events </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key330"> examples </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_lang_intro.html"> bench_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_faq.html"> docidx_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_faq.html"> doctoc_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_faq.html"> doctools_lang_faq </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key155"> exception </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/try/tcllib_try.html"> try </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key170"> exchange format </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/yaml/huddle.html"> huddle </a> &#183; <a href="tcllib/files/modules/json/json.html"> json </a> &#183; <a href="tcllib/files/modules/json/json_write.html"> json::write </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key676"> exclusion </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key381"> execution </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key143"> exif </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/exif/exif.html"> exif </a> &#183; <a href="tcllib/files/modules/jpeg/jpeg.html"> jpeg </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key365"> exit </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key148"> export </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/html_cssdefaults.html"> doctools::html::cssdefaults </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_docidx.html"> doctools::idx::export::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_html.html"> doctools::idx::export::html </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_json.html"> doctools::idx::export::json </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_nroff.html"> doctools::idx::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_text.html"> doctools::idx::export::text </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_wiki.html"> doctools::idx::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools2base/nroff_manmacros.html"> doctools::nroff::man_macros </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_doctoc.html"> doctools::toc::export::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_html.html"> doctools::toc::export::html </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_json.html"> doctools::toc::export::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_nroff.html"> doctools::toc::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_text.html"> doctools::toc::export::text </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_wiki.html"> doctools::toc::export::wiki </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key6"> expression </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key77"> extended namespace </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/namespacex/namespacex.html"> namespacex </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c9">Keywords: F</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key325"> faq </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_lang_faq.html"> docidx_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_faq.html"> doctoc_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_faq.html"> doctools_lang_faq </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key487"> fetching information </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key739"> FFT </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/fourier.html"> math::fourier </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key95"> fifo </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/fifo.html"> tcl::chan::fifo </a> &#183; <a href="tcllib/files/modules/virtchannel_base/fifo2.html"> tcl::chan::fifo2 </a> &#183; <a href="tcllib/files/modules/virtchannel_base/halfpipe.html"> tcl::chan::halfpipe </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key31"> file </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tie/tie_std.html"> tie </a> &#183; <a href="tcllib/files/modules/tie/tie.html"> tie </a> &#183; <a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key107"> file recognition </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fumagic/cfront.html"> fileutil::magic::cfront </a> &#183; <a href="tcllib/files/modules/fumagic/cgen.html"> fileutil::magic::cgen </a> &#183; <a href="tcllib/files/modules/fumagic/filetypes.html"> fileutil::magic::filetype </a> &#183; <a href="tcllib/files/modules/fumagic/mimetypes.html"> fileutil::magic::mimetype </a> &#183; <a href="tcllib/files/modules/fumagic/rtcore.html"> fileutil::magic::rt </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key108"> file type </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fumagic/cfront.html"> fileutil::magic::cfront </a> &#183; <a href="tcllib/files/modules/fumagic/cgen.html"> fileutil::magic::cgen </a> &#183; <a href="tcllib/files/modules/fumagic/filetypes.html"> fileutil::magic::filetype </a> &#183; <a href="tcllib/files/modules/fumagic/mimetypes.html"> fileutil::magic::mimetype </a> &#183; <a href="tcllib/files/modules/fumagic/rtcore.html"> fileutil::magic::rt </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key106"> file utilities </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/fileutil.html"> fileutil </a> &#183; <a href="tcllib/files/modules/fumagic/cfront.html"> fileutil::magic::cfront </a> &#183; <a href="tcllib/files/modules/fumagic/cgen.html"> fileutil::magic::cgen </a> &#183; <a href="tcllib/files/modules/fumagic/filetypes.html"> fileutil::magic::filetype </a> &#183; <a href="tcllib/files/modules/fumagic/mimetypes.html"> fileutil::magic::mimetype </a> &#183; <a href="tcllib/files/modules/fumagic/rtcore.html"> fileutil::magic::rt </a> &#183; <a href="tcllib/files/modules/fileutil/multi.html"> fileutil::multi </a> &#183; <a href="tcllib/files/modules/fileutil/multiop.html"> fileutil::multi::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key339"> filesystem </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_slippy_cache.html"> map::slippy::cache </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key203"> filter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a> &#183; <a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key153"> final </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/try/tcllib_try.html"> try </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key574"> find </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/disjointset.html"> struct::disjointset </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key726"> finite </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/pool.html"> struct::pool </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key282"> finite automaton </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key191"> FIPS 180-1 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/sha1/sha1.html"> sha1 </a> &#183; <a href="tcllib/files/modules/sha1/sha256.html"> sha256 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key509"> first permutation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key519"> Fisher-Yates </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key508"> flatten </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key347"> floating-point </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/bigfloat.html"> math::bigfloat </a> &#183; <a href="tcllib/files/modules/math/fuzzy.html"> math::fuzzy </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key129"> flow </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/control/control.html"> control </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key448"> flow network </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key515"> folding </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key202"> foldl </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key206"> foldr </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key199"> foreach </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key566"> form </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/html/html.html"> html </a> &#183; <a href="tcllib/files/modules/ncgi/ncgi.html"> ncgi </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key103"> format conversion </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key609"> formatter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools_plugin_apiref.html"> doctools_plugin_apiref </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key307"> formatting </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a> &#183; <a href="tcllib/files/modules/bench/bench_wcsv.html"> bench::out::csv </a> &#183; <a href="tcllib/files/modules/bench/bench_wtext.html"> bench::out::text </a> &#183; <a href="tcllib/files/modules/doctools2idx/introduction.html"> doctools2idx_introduction </a> &#183; <a href="tcllib/files/modules/doctools2toc/introduction.html"> doctools2toc_introduction </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/textutil/textutil.html"> textutil </a> &#183; <a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a> &#183; <a href="tcllib/files/modules/textutil/textutil_string.html"> textutil::string </a> &#183; <a href="tcllib/files/modules/textutil/tabify.html"> textutil::tabify </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key610"> formatting engine </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html"> docidx_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html"> doctoc_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools/doctools_plugin_apiref.html"> doctools_plugin_apiref </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key738"> Fourier transform </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/fourier.html"> math::fourier </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key571"> FR </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key626"> frame </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_cmacros.html"> term::ansi::code::macros </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key249"> ftp </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ftp/ftp.html"> ftp </a> &#183; <a href="tcllib/files/modules/ftp/ftp_geturl.html"> ftp::geturl </a> &#183; <a href="tcllib/files/modules/ftpd/ftpd.html"> ftpd </a> &#183; <a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key557"> ftpd </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ftpd/ftpd.html"> ftpd </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key556"> ftpserver </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ftpd/ftpd.html"> ftpd </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key514"> full outer join </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c10">Keywords: G</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key658"> generate event </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uev/uevent.html"> uevent </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key522"> generate permutations </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key536"> generation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key207"> generator </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key539"> geocoding </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_geocode_nominatim.html"> map::geocode::nominatim </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key182"> geodesy </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_slippy.html"> map::slippy </a> &#183; <a href="tcllib/files/modules/mapproj/mapproj.html"> mapproj </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key186"> geography </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_slippy.html"> map::slippy </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key89"> get character </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/receive.html"> term::receive </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key369"> gets </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key364"> global </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key486"> gopher </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key359"> gps </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/gpx/gpx.html"> gpx </a> &#183; <a href="tcllib/files/modules/nmea/nmea.html"> nmea </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key622"> gpx </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/gpx/gpx.html"> gpx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key17"> grammar </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_aycock/aycock.html"> grammar::aycock </a> &#183; <a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a> &#183; <a href="tcllib/files/modules/grammar_me/me_cpu.html"> grammar::me::cpu </a> &#183; <a href="tcllib/files/modules/grammar_me/me_cpucore.html"> grammar::me::cpu::core </a> &#183; <a href="tcllib/files/modules/grammar_me/gasm.html"> grammar::me::cpu::gasm </a> &#183; <a href="tcllib/files/modules/grammar_me/me_tcl.html"> grammar::me::tcl </a> &#183; <a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_me/me_vm.html"> grammar::me_vm </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key256"> graph </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/gasm.html"> grammar::me::cpu::gasm </a> &#183; <a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a> &#183; <a href="tcllib/files/modules/struct/graph1.html"> struct::graph_v1 </a> &#183; <a href="tcllib/files/modules/struct/queue.html"> struct::queue </a> &#183; <a href="tcllib/files/modules/struct/stack.html"> struct::stack </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key179"> graph walking </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/page/page_util_flow.html"> page_util_flow </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_lemon.html"> page_util_norm_lemon </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_peg.html"> page_util_norm_peg </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key370"> green threads </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key268"> grep </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/fileutil.html"> fileutil </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key196"> GUID </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uuid/uuid.html"> uuid </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c11">Keywords: H</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key195"> hashing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/md4/md4.html"> md4 </a> &#183; <a href="tcllib/files/modules/md5/md5.html"> md5 </a> &#183; <a href="tcllib/files/modules/md5crypt/md5crypt.html"> md5crypt </a> &#183; <a href="tcllib/files/modules/otp/otp.html"> otp </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd128.html"> ripemd128 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd160.html"> ripemd160 </a> &#183; <a href="tcllib/files/modules/sha1/sha1.html"> sha1 </a> &#183; <a href="tcllib/files/modules/sha1/sha256.html"> sha256 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key423"> heuristic </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key298"> hex </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base32/base32hex.html"> base32::hex </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key682"> hexadecimal </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/hex.html"> tcl::transform::hex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key661"> histogram </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/counter/counter.html"> counter </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key632"> hook </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/hook/hook.html"> hook </a> &#183; <a href="tcllib/files/modules/uev/uevent.html"> uevent </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key755"> horspool </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_aycock/aycock.html"> grammar::aycock </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key1"> HTML </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools.html"> doctools </a> &#183; <a href="tcllib/files/modules/doctools2base/html_cssdefaults.html"> doctools::html::cssdefaults </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_html.html"> doctools::idx::export::html </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_html.html"> doctools::toc::export::html </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a> &#183; <a href="tcllib/files/modules/doctools/mpexpand.html"> mpexpand </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key567"> html </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/html/html.html"> html </a> &#183; <a href="tcllib/files/modules/htmlparse/htmlparse.html"> htmlparse </a> &#183; <a href="tcllib/files/modules/javascript/javascript.html"> javascript </a> &#183; <a href="tcllib/files/modules/ncgi/ncgi.html"> ncgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key481"> http </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/http/autoproxy.html"> autoproxy </a> &#183; <a href="tcllib/files/modules/map/map_geocode_nominatim.html"> map::geocode::nominatim </a> &#183; <a href="tcllib/files/modules/map/map_slippy_fetcher.html"> map::slippy::fetcher </a> &#183; <a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key541"> huddle </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/yaml/huddle.html"> huddle </a> &#183; <a href="tcllib/files/modules/yaml/yaml.html"> yaml </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key453"> human readable </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a> &#183; <a href="tcllib/files/modules/bench/bench_wtext.html"> bench::out::text </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key306"> hyphenation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil.html"> textutil </a> &#183; <a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c12">Keywords: I</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key42"> i18n </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key383"> ident </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ident/ident.html"> ident </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key385"> identification </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ident/ident.html"> ident </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key393"> identity </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/identity.html"> tcl::transform::identity </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key495"> idle </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uev/uevent_onidle.html"> uevent::onidle </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key135"> image </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/jpeg/jpeg.html"> jpeg </a> &#183; <a href="tcllib/files/modules/png/png.html"> png </a> &#183; <a href="tcllib/files/modules/tiff/tiff.html"> tiff </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key743"> imap </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/imap4/imap4.html"> imap4 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key247"> import </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_docidx.html"> doctools::idx::import::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_json.html"> doctools::idx::import::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_doctoc.html"> doctools::toc::import::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_json.html"> doctools::toc::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key97"> in-memory channel </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/fifo.html"> tcl::chan::fifo </a> &#183; <a href="tcllib/files/modules/virtchannel_base/fifo2.html"> tcl::chan::fifo2 </a> &#183; <a href="tcllib/files/modules/virtchannel_base/halfpipe.html"> tcl::chan::halfpipe </a> &#183; <a href="tcllib/files/modules/virtchannel_base/memchan.html"> tcl::chan::memchan </a> &#183; <a href="tcllib/files/modules/virtchannel_base/string.html"> tcl::chan::string </a> &#183; <a href="tcllib/files/modules/virtchannel_base/variable.html"> tcl::chan::variable </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key647"> in-order </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_tree.html"> struct::tree </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key671"> inclusion </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key220"> Incr Tcl </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key301"> indenting </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil.html"> textutil </a> &#183; <a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key420"> independent set </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key163"> index </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_intro.html"> docidx_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html"> docidx_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools2idx/introduction.html"> doctools2idx_introduction </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_docidx.html"> doctools::idx::export::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_html.html"> doctools::idx::export::html </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_json.html"> doctools::idx::export::json </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_nroff.html"> doctools::idx::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_text.html"> doctools::idx::export::text </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_wiki.html"> doctools::idx::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_docidx.html"> doctools::idx::import::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_json.html"> doctools::idx::import::json </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key717"> index formatter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html"> docidx_plugin_apiref </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key72"> info </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/namespacex/namespacex.html"> namespacex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key517"> inner join </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key458"> input mode </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key310"> integer </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/roman.html"> math::roman </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key721"> integration </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/calculus.html"> math::calculus </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key769"> inter-thread communication </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/fifo2.html"> tcl::chan::fifo2 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key46"> internationalization </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key122"> internet </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/asn/asn.html"> asn </a> &#183; <a href="tcllib/files/modules/ftp/ftp.html"> ftp </a> &#183; <a href="tcllib/files/modules/ftp/ftp_geturl.html"> ftp::geturl </a> &#183; <a href="tcllib/files/modules/imap4/imap4.html"> imap4 </a> &#183; <a href="tcllib/files/modules/ldap/ldap.html"> ldap </a> &#183; <a href="tcllib/files/modules/ldap/ldapx.html"> ldapx </a> &#183; <a href="tcllib/files/modules/mime/mime.html"> mime </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d.html"> pop3d </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_dbox.html"> pop3d::dbox </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_udb.html"> pop3d::udb </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key401"> internet address </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_ip.html"> tcllib_ip </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key773"> interpolation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/interpolate.html"> math::interpolate </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key40"> interpreter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/interp/deleg_method.html"> deleg_method </a> &#183; <a href="tcllib/files/modules/interp/deleg_proc.html"> deleg_proc </a> &#183; <a href="tcllib/files/modules/interp/tcllib_interp.html"> interp </a> &#183; <a href="tcllib/files/modules/wip/wip.html"> wip </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key678"> intersection </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key690"> interval </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/bigfloat.html"> math::bigfloat </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key398"> ip </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_ip.html"> tcllib_ip </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key319"> ipc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/comm/comm_wire.html"> comm_wire </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key400"> ipv4 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_ip.html"> tcllib_ip </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key397"> ipv6 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_ip.html"> tcllib_ip </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key687"> irc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/irc/irc.html"> irc </a> &#183; <a href="tcllib/files/modules/irc/picoirc.html"> picoirc </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key440"> isthmus </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key204"> iterator </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c13">Keywords: J</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key173"> javascript </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/javascript/javascript.html"> javascript </a> &#183; <a href="tcllib/files/modules/json/json.html"> json </a> &#183; <a href="tcllib/files/modules/json/json_write.html"> json::write </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key145"> jfif </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/jpeg/jpeg.html"> jpeg </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key510"> join </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key144"> jpeg </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/exif/exif.html"> exif </a> &#183; <a href="tcllib/files/modules/jpeg/jpeg.html"> jpeg </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key232"> JSON </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/export_json.html"> doctools::idx::export::json </a> &#183; <a href="tcllib/files/modules/doctools2idx/import_json.html"> doctools::idx::import::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_json.html"> doctools::toc::export::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_json.html"> doctools::toc::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key172"> json </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/yaml/huddle.html"> huddle </a> &#183; <a href="tcllib/files/modules/json/json.html"> json </a> &#183; <a href="tcllib/files/modules/json/json_write.html"> json::write </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key302"> justification </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c14">Keywords: K</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key165"> keyword index </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_intro.html"> docidx_intro </a> &#183; <a href="tcllib/files/modules/doctools2idx/introduction.html"> doctools2idx_introduction </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key718"> keywords </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html"> docidx_plugin_apiref </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key241"> knuth </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/soundex/soundex.html"> soundex </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c15">Keywords: L</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key49"> l10n </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key546"> lambda </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/lambda/lambda.html"> lambda </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key390"> LaTeX </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip.html"> docstrip </a> &#183; <a href="tcllib/files/apps/tcldocstrip.html"> tcldocstrip </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key167"> latex </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key181"> latitute </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_slippy.html"> map::slippy </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key124"> ldap </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ldap/ldap.html"> ldap </a> &#183; <a href="tcllib/files/modules/ldap/ldapx.html"> ldapx </a> &#183; <a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key121"> ldap client </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ldap/ldap.html"> ldap </a> &#183; <a href="tcllib/files/modules/ldap/ldapx.html"> ldapx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key452"> ldif </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ldap/ldapx.html"> ldapx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key64"> least squares </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/linalg.html"> math::linearalgebra </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key503"> left outer join </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key180"> lemon </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/page/page_util_norm_lemon.html"> page_util_norm_lemon </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key436"> level graph </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key345"> lexer </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/parse.html"> doctools::idx::parse </a> &#183; <a href="tcllib/files/modules/doctools2toc/parse.html"> doctools::toc::parse </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key669"> limitsize </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/limitsize.html"> tcl::transform::limitsize </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key529"> line </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/math_geometry.html"> math::geometry </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key65"> linear algebra </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/linalg.html"> math::linearalgebra </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key62"> linear equations </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/linalg.html"> math::linearalgebra </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key263"> linear program </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/optimize.html"> math::optimize </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key462"> lines </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key252"> list </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a> &#183; <a href="tcllib/files/modules/struct/queue.html"> struct::queue </a> &#183; <a href="tcllib/files/modules/wip/wip.html"> wip </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key93"> listener </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/receive.html"> term::receive </a> &#183; <a href="tcllib/files/modules/term/term_bind.html"> term::receive::bind </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key387"> literate programming </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip.html"> docstrip </a> &#183; <a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a> &#183; <a href="tcllib/files/apps/tcldocstrip.html"> tcldocstrip </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key21"> LL(k) </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key431"> local searching </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key45"> localization </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key184"> location </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_geocode_nominatim.html"> map::geocode::nominatim </a> &#183; <a href="tcllib/files/modules/map/map_slippy.html"> map::slippy </a> &#183; <a href="tcllib/files/modules/map/map_slippy_cache.html"> map::slippy::cache </a> &#183; <a href="tcllib/files/modules/map/map_slippy_fetcher.html"> map::slippy::fetcher </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key71"> log </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/cvs.html"> doctools::cvs </a> &#183; <a href="tcllib/files/modules/log/log.html"> log </a> &#183; <a href="tcllib/files/modules/log/logger.html"> logger </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key70"> log level </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/log/log.html"> log </a> &#183; <a href="tcllib/files/modules/log/logger.html"> logger </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key68"> logger </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/log/logger.html"> logger </a> &#183; <a href="tcllib/files/modules/log/loggerAppender.html"> logger::appender </a> &#183; <a href="tcllib/files/modules/log/loggerUtils.html"> logger::utils </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key501"> longest common subsequence </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key188"> longitude </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_slippy.html"> map::slippy </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key406"> loop </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c16">Keywords: M</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key479"> macros </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/nroff_manmacros.html"> doctools::nroff::man_macros </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key288"> mail </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/imap4/imap4.html"> imap4 </a> &#183; <a href="tcllib/files/modules/mime/mime.html"> mime </a> &#183; <a href="tcllib/files/modules/pop3/pop3.html"> pop3 </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key488"> mailto </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key772"> maker note </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/exif/exif.html"> exif </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key478"> man_macros </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/nroff_manmacros.html"> doctools::nroff::man_macros </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key2"> manpage </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools.html"> doctools </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/doctools/doctools_plugin_apiref.html"> doctools_plugin_apiref </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a> &#183; <a href="tcllib/files/modules/doctools/mpexpand.html"> mpexpand </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key187"> map </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a> &#183; <a href="tcllib/files/modules/map/map_geocode_nominatim.html"> map::geocode::nominatim </a> &#183; <a href="tcllib/files/modules/map/map_slippy.html"> map::slippy </a> &#183; <a href="tcllib/files/modules/map/map_slippy_cache.html"> map::slippy::cache </a> &#183; <a href="tcllib/files/modules/map/map_slippy_fetcher.html"> map::slippy::fetcher </a> &#183; <a href="tcllib/files/modules/mapproj/mapproj.html"> mapproj </a> &#183; <a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key0"> markup </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_intro.html"> docidx_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_cmdref.html"> docidx_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_faq.html"> docidx_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_intro.html"> docidx_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_syntax.html"> docidx_lang_syntax </a> &#183; <a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html"> docidx_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_intro.html"> doctoc_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_cmdref.html"> doctoc_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_faq.html"> doctoc_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_intro.html"> doctoc_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_syntax.html"> doctoc_lang_syntax </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html"> doctoc_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools/doctools.html"> doctools </a> &#183; <a href="tcllib/files/modules/doctools2idx/introduction.html"> doctools2idx_introduction </a> &#183; <a href="tcllib/files/modules/doctools2toc/introduction.html"> doctools2toc_introduction </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/doctools/doctools_intro.html"> doctools_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_cmdref.html"> doctools_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_faq.html"> doctools_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_intro.html"> doctools_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_syntax.html"> doctools_lang_syntax </a> &#183; <a href="tcllib/files/modules/doctools/doctools_plugin_apiref.html"> doctools_plugin_apiref </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a> &#183; <a href="tcllib/files/modules/doctools/mpexpand.html"> mpexpand </a> &#183; <a href="tcllib/files/apps/tcldocstrip.html"> tcldocstrip </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key11"> matching </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key67"> math </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/math.html"> math </a> &#183; <a href="tcllib/files/modules/math/bigfloat.html"> math::bigfloat </a> &#183; <a href="tcllib/files/modules/math/bignum.html"> math::bignum </a> &#183; <a href="tcllib/files/modules/math/calculus.html"> math::calculus </a> &#183; <a href="tcllib/files/modules/math/qcomplex.html"> math::complexnumbers </a> &#183; <a href="tcllib/files/modules/math/constants.html"> math::constants </a> &#183; <a href="tcllib/files/modules/math/decimal.html"> math::decimal </a> &#183; <a href="tcllib/files/modules/math/fuzzy.html"> math::fuzzy </a> &#183; <a href="tcllib/files/modules/math/math_geometry.html"> math::geometry </a> &#183; <a href="tcllib/files/modules/math/interpolate.html"> math::interpolate </a> &#183; <a href="tcllib/files/modules/math/linalg.html"> math::linearalgebra </a> &#183; <a href="tcllib/files/modules/math/optimize.html"> math::optimize </a> &#183; <a href="tcllib/files/modules/math/polynomials.html"> math::polynomials </a> &#183; <a href="tcllib/files/modules/math/rational_funcs.html"> math::rationalfunctions </a> &#183; <a href="tcllib/files/modules/math/special.html"> math::special </a> &#183; <a href="tcllib/files/modules/simulation/annealing.html"> simulation::annealing </a> &#183; <a href="tcllib/files/modules/simulation/montecarlo.html"> simulation::montecarlo </a> &#183; <a href="tcllib/files/modules/simulation/simulation_random.html"> simulation::random </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key579"> mathematics </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/fourier.html"> math::fourier </a> &#183; <a href="tcllib/files/modules/math/statistics.html"> math::statistics </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key63"> matrices </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/linalg.html"> math::linearalgebra </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key55"> matrix </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/csv/csv.html"> csv </a> &#183; <a href="tcllib/files/modules/math/linalg.html"> math::linearalgebra </a> &#183; <a href="tcllib/files/modules/report/report.html"> report </a> &#183; <a href="tcllib/files/modules/struct/matrix.html"> struct::matrix </a> &#183; <a href="tcllib/files/modules/struct/matrix1.html"> struct::matrix_v1 </a> &#183; <a href="tcllib/files/modules/struct/queue.html"> struct::queue </a> &#183; <a href="tcllib/files/modules/struct/stack.html"> struct::stack </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key427"> max cut </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key262"> maximum </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/optimize.html"> math::optimize </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key447"> maximum flow </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key335"> md4 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/md4/md4.html"> md4 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd128.html"> ripemd128 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd160.html"> ripemd160 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key614"> md5 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/md5/md5.html"> md5 </a> &#183; <a href="tcllib/files/modules/md5crypt/md5crypt.html"> md5crypt </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key701"> md5crypt </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/md5crypt/md5crypt.html"> md5crypt </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key215"> mega widget </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key673"> membership </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key625"> menu </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_cmacros.html"> term::ansi::code::macros </a> &#183; <a href="tcllib/files/modules/term/imenu.html"> term::interact::menu </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key493"> merge </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/randseed.html"> tcl::chan::randseed </a> &#183; <a href="tcllib/files/modules/uev/uevent_onidle.html"> uevent::onidle </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key576"> merge find </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/disjointset.html"> struct::disjointset </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key99"> merging </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench.html"> bench </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key320"> message </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/comm/comm_wire.html"> comm_wire </a> &#183; <a href="tcllib/files/modules/log/log.html"> log </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key43"> message catalog </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key735"> message level </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/log/log.html"> log </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key44"> message package </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html"> doctools::msgcat </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_c.html"> doctools::msgcat::idx::c </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_de.html"> doctools::msgcat::idx::de </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_en.html"> doctools::msgcat::idx::en </a> &#183; <a href="tcllib/files/modules/doctools2idx/msgcat_fr.html"> doctools::msgcat::idx::fr </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_c.html"> doctools::msgcat::toc::c </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_de.html"> doctools::msgcat::toc::de </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_en.html"> doctools::msgcat::toc::en </a> &#183; <a href="tcllib/files/modules/doctools2toc/msgcat_fr.html"> doctools::msgcat::toc::fr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key194"> message-digest </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/md4/md4.html"> md4 </a> &#183; <a href="tcllib/files/modules/md5/md5.html"> md5 </a> &#183; <a href="tcllib/files/modules/md5crypt/md5crypt.html"> md5crypt </a> &#183; <a href="tcllib/files/modules/otp/otp.html"> otp </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd128.html"> ripemd128 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd160.html"> ripemd160 </a> &#183; <a href="tcllib/files/modules/sha1/sha1.html"> sha1 </a> &#183; <a href="tcllib/files/modules/sha1/sha256.html"> sha256 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key36"> metakit </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tie/tie_std.html"> tie </a> &#183; <a href="tcllib/files/modules/tie/tie.html"> tie </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key332"> method </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/interp/deleg_method.html"> deleg_method </a> &#183; <a href="tcllib/files/modules/interp/tcllib_interp.html"> interp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key705"> method reference </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key211"> mime </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fumagic/cfront.html"> fileutil::magic::cfront </a> &#183; <a href="tcllib/files/modules/fumagic/cgen.html"> fileutil::magic::cgen </a> &#183; <a href="tcllib/files/modules/fumagic/mimetypes.html"> fileutil::magic::mimetype </a> &#183; <a href="tcllib/files/modules/fumagic/rtcore.html"> fileutil::magic::rt </a> &#183; <a href="tcllib/files/modules/mime/mime.html"> mime </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key410"> minimal spanning tree </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key261"> minimum </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/optimize.html"> math::optimize </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key421"> minimum cost flow </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key413"> minimum degree spanning tree </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key449"> minimum diameter spanning tree </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key620"> module </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key689"> montecarlo simulation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/simulation/montecarlo.html"> simulation::montecarlo </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key210"> move </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/multi.html"> fileutil::multi </a> &#183; <a href="tcllib/files/modules/fileutil/multiop.html"> fileutil::multi::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key208"> multi-file </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/multi.html"> fileutil::multi </a> &#183; <a href="tcllib/files/modules/fileutil/multiop.html"> fileutil::multi::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key646"> multiplexer </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/multiplexer/multiplexer.html"> multiplexer </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key245"> multiprecision </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/bigfloat.html"> math::bigfloat </a> &#183; <a href="tcllib/files/modules/math/bignum.html"> math::bignum </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key710"> my method </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c17">Keywords: N</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key29"> name service </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nns/nns_client.html"> nameserv </a> &#183; <a href="tcllib/files/modules/nns/nns_auto.html"> nameserv::auto </a> &#183; <a href="tcllib/files/modules/nns/nns_common.html"> nameserv::common </a> &#183; <a href="tcllib/files/modules/nns/nns_protocol.html"> nameserv::protocol </a> &#183; <a href="tcllib/files/modules/nns/nns_server.html"> nameserv::server </a> &#183; <a href="tcllib/files/apps/nns.html"> nns </a> &#183; <a href="tcllib/files/modules/nns/nns_intro.html"> nns_intro </a> &#183; <a href="tcllib/files/apps/nnsd.html"> nnsd </a> &#183; <a href="tcllib/files/apps/nnslog.html"> nnslog </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key75"> namespace unknown </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/namespacex/namespacex.html"> namespacex </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key76"> namespace utilities </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/namespacex/namespacex.html"> namespacex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key437"> neighbour </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key250"> net </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ftp/ftp.html"> ftp </a> &#183; <a href="tcllib/files/modules/ftp/ftp_geturl.html"> ftp::geturl </a> &#183; <a href="tcllib/files/modules/imap4/imap4.html"> imap4 </a> &#183; <a href="tcllib/files/modules/mime/mime.html"> mime </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key624"> network </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pop3d/pop3d.html"> pop3d </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_dbox.html"> pop3d::dbox </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_udb.html"> pop3d::udb </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key485"> news </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nntp/nntp.html"> nntp </a> &#183; <a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key524"> next permutation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key358"> nmea </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nmea/nmea.html"> nmea </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key602"> nntp </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nntp/nntp.html"> nntp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key605"> nntpclient </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nntp/nntp.html"> nntp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key130"> no-op </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/control/control.html"> control </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key412"> node </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a> &#183; <a href="tcllib/files/modules/struct/struct_tree.html"> struct::tree </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key538"> nominatim </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_geocode_nominatim.html"> map::geocode::nominatim </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key100"> normalization </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench.html"> bench </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_lemon.html"> page_util_norm_lemon </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_peg.html"> page_util_norm_peg </a> &#183; <a href="tcllib/files/modules/stringprep/unicode.html"> unicode </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key5"> nroff </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools.html"> doctools </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_nroff.html"> doctools::idx::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2base/nroff_manmacros.html"> doctools::nroff::man_macros </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_nroff.html"> doctools::toc::export::nroff </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a> &#183; <a href="tcllib/files/modules/doctools/mpexpand.html"> mpexpand </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key82"> NTP </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ntp/ntp_time.html"> ntp_time </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key456"> null </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/null.html"> tcl::chan::null </a> &#183; <a href="tcllib/files/modules/virtchannel_base/nullzero.html"> tcl::chan::nullzero </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key703"> number theory </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/numtheory.html"> math::numtheory </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c18">Keywords: O</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key221"> object </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a> &#183; <a href="tcllib/files/modules/stooop/stooop.html"> stooop </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key214"> object oriented </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a> &#183; <a href="tcllib/files/modules/stooop/stooop.html"> stooop </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key600"> observer </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/hook/hook.html"> hook </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/observe.html"> tcl::transform::observe </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key492"> on-idle </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uev/uevent_onidle.html"> uevent::onidle </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key732"> one time pad </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key264"> optimization </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/optimize.html"> math::optimize </a> &#183; <a href="tcllib/files/modules/simulation/annealing.html"> simulation::annealing </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key692"> ordered list </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/prioqueue.html"> struct::prioqueue </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key733"> otp </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key525"> outer join </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c19">Keywords: P</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key52"> package </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/csv/csv.html"> csv </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key617"> package indexing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key177"> page </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/page/page_intro.html"> page_intro </a> &#183; <a href="tcllib/files/modules/page/page_pluginmgr.html"> page_pluginmgr </a> &#183; <a href="tcllib/files/modules/page/page_util_flow.html"> page_util_flow </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_lemon.html"> page_util_norm_lemon </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_peg.html"> page_util_norm_peg </a> &#183; <a href="tcllib/files/modules/page/page_util_peg.html"> page_util_peg </a> &#183; <a href="tcllib/files/modules/page/page_util_quote.html"> page_util_quote </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key728"> pager </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ipager.html"> term::interact::pager </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key305"> paragraph </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil.html"> textutil </a> &#183; <a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key471"> PARAM </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key354"> parameter entry form </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tepam/tepam_introduction.html"> tepam </a> &#183; <a href="tcllib/files/modules/tepam/tepam_argument_dialogbox.html"> tepam::argument_dialogbox </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key15"> parser </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/parse.html"> doctools::idx::parse </a> &#183; <a href="tcllib/files/modules/doctools2base/tcl_parse.html"> doctools::tcl::parse </a> &#183; <a href="tcllib/files/modules/doctools2toc/parse.html"> doctools::toc::parse </a> &#183; <a href="tcllib/files/modules/grammar_aycock/aycock.html"> grammar::aycock </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a> &#183; <a href="tcllib/files/modules/amazon-s3/xsxp.html"> xsxp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key175"> parser generator </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/apps/page.html"> page </a> &#183; <a href="tcllib/files/modules/page/page_intro.html"> page_intro </a> &#183; <a href="tcllib/files/modules/page/page_pluginmgr.html"> page_pluginmgr </a> &#183; <a href="tcllib/files/modules/page/page_util_flow.html"> page_util_flow </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_lemon.html"> page_util_norm_lemon </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_peg.html"> page_util_norm_peg </a> &#183; <a href="tcllib/files/modules/page/page_util_peg.html"> page_util_peg </a> &#183; <a href="tcllib/files/modules/page/page_util_quote.html"> page_util_quote </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key26"> parsing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a> &#183; <a href="tcllib/files/modules/bibtex/bibtex.html"> bibtex </a> &#183; <a href="tcllib/files/modules/doctools2idx/introduction.html"> doctools2idx_introduction </a> &#183; <a href="tcllib/files/modules/doctools2toc/introduction.html"> doctools2toc_introduction </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/grammar_aycock/aycock.html"> grammar::aycock </a> &#183; <a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a> &#183; <a href="tcllib/files/modules/grammar_me/me_cpu.html"> grammar::me::cpu </a> &#183; <a href="tcllib/files/modules/grammar_me/me_cpucore.html"> grammar::me::cpu::core </a> &#183; <a href="tcllib/files/modules/grammar_me/gasm.html"> grammar::me::cpu::gasm </a> &#183; <a href="tcllib/files/modules/grammar_me/me_tcl.html"> grammar::me::tcl </a> &#183; <a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_me/me_vm.html"> grammar::me_vm </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/htmlparse/htmlparse.html"> htmlparse </a> &#183; <a href="tcllib/files/modules/yaml/huddle.html"> huddle </a> &#183; <a href="tcllib/files/modules/yaml/yaml.html"> yaml </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key14"> parsing expression </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key20"> parsing expression grammar </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/page/page_util_peg.html"> page_util_peg </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key544"> partial application </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/lambda/lambda.html"> lambda </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key577"> partition </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/disjointset.html"> struct::disjointset </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key578"> partitioned set </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/disjointset.html"> struct::disjointset </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key564"> passive </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/transfer/connect.html"> transfer::connect </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key644"> password </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/otp/otp.html"> otp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key615"> patch </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key586"> patching </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rcs/rcs.html"> rcs </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key12"> PEG </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_peg.html"> page_util_norm_peg </a> &#183; <a href="tcllib/files/modules/page/page_util_peg.html"> page_util_peg </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key85"> performance </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench.html"> bench </a> &#183; <a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a> &#183; <a href="tcllib/files/modules/bench/bench_wcsv.html"> bench::out::csv </a> &#183; <a href="tcllib/files/modules/bench/bench_wtext.html"> bench::out::text </a> &#183; <a href="tcllib/files/modules/bench/bench_intro.html"> bench_intro </a> &#183; <a href="tcllib/files/modules/bench/bench_lang_intro.html"> bench_lang_intro </a> &#183; <a href="tcllib/files/modules/bench/bench_lang_spec.html"> bench_lang_spec </a> &#183; <a href="tcllib/files/modules/profiler/profiler.html"> profiler </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key500"> permutation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key33"> persistence </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tie/tie_std.html"> tie </a> &#183; <a href="tcllib/files/modules/tie/tie.html"> tie </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key745"> pi </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/constants.html"> math::constants </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key147"> plain text </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/export_text.html"> doctools::idx::export::text </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_text.html"> doctools::toc::export::text </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key530"> plane geometry </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/math_geometry.html"> math::geometry </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key357"> plugin </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html"> docidx_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html"> doctoc_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools2idx/introduction.html"> doctools2idx_introduction </a> &#183; <a href="tcllib/files/modules/doctools2toc/introduction.html"> doctools2toc_introduction </a> &#183; <a href="tcllib/files/modules/doctools2base/html_cssdefaults.html"> doctools::html::cssdefaults </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools2base/nroff_manmacros.html"> doctools::nroff::man_macros </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key168"> plugin management </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pluginmgr/pluginmgr.html"> pluginmgr </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key169"> plugin search </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pluginmgr/pluginmgr.html"> pluginmgr </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key653"> png </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/png/png.html"> png </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key531"> point </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/math_geometry.html"> math::geometry </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key753"> polynomial functions </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/polynomials.html"> math::polynomials </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key255"> pool </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/pool.html"> struct::pool </a> &#183; <a href="tcllib/files/modules/struct/queue.html"> struct::queue </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key396"> pop </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pop3/pop3.html"> pop3 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key395"> pop3 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pop3/pop3.html"> pop3 </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d.html"> pop3d </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_dbox.html"> pop3d::dbox </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_udb.html"> pop3d::udb </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key651"> post-order </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_tree.html"> struct::tree </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key648"> pre-order </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_tree.html"> struct::tree </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key640"> prefix </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil_string.html"> textutil::string </a> &#183; <a href="tcllib/files/modules/textutil/trim.html"> textutil::trim </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key704"> prime </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/numtheory.html"> math::numtheory </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key260"> prioqueue </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/prioqueue.html"> struct::prioqueue </a> &#183; <a href="tcllib/files/modules/struct/queue.html"> struct::queue </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key693"> priority queue </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/prioqueue.html"> struct::prioqueue </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key543"> proc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/lambda/lambda.html"> lambda </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key41"> procedure </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/interp/deleg_proc.html"> deleg_proc </a> &#183; <a href="tcllib/files/modules/tepam/tepam_introduction.html"> tepam </a> &#183; <a href="tcllib/files/modules/tepam/tepam_procedure.html"> tepam::procedure </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key630"> producer </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/hook/hook.html"> hook </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key599"> profile </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/profiler/profiler.html"> profiler </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key595"> projection </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mapproj/mapproj.html"> mapproj </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key482"> prospero </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key125"> protocol </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/asn/asn.html"> asn </a> &#183; <a href="tcllib/files/modules/ldap/ldap.html"> ldap </a> &#183; <a href="tcllib/files/modules/ldap/ldapx.html"> ldapx </a> &#183; <a href="tcllib/files/modules/nns/nns_protocol.html"> nameserv::protocol </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d.html"> pop3d </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_dbox.html"> pop3d::dbox </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_udb.html"> pop3d::udb </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key768"> proxy </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/http/autoproxy.html"> autoproxy </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key161"> public key cipher </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pki/pki.html"> pki </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key633"> publisher </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/hook/hook.html"> hook </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key7"> push down automaton </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c20">Keywords: Q</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key54"> queue </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/csv/csv.html"> csv </a> &#183; <a href="tcllib/files/modules/htmlparse/htmlparse.html"> htmlparse </a> &#183; <a href="tcllib/files/modules/struct/stack.html"> struct::stack </a> &#183; <a href="tcllib/files/modules/transfer/tqueue.html"> transfer::copy::queue </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key558"> quoting </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/page/page_util_quote.html"> page_util_quote </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c21">Keywords: R</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key561"> radians </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/constants.html"> math::constants </a> &#183; <a href="tcllib/files/modules/units/units.html"> units </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key569"> radiobutton </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/html/html.html"> html </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key418"> radius </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key275"> random </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/random.html"> tcl::chan::random </a> &#183; <a href="tcllib/files/modules/virtchannel_base/randseed.html"> tcl::chan::randseed </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key592"> random numbers </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/simulation/simulation_random.html"> simulation::random </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key612"> rational functions </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/rational_funcs.html"> math::rationalfunctions </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key460"> raw </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key112"> rc4 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rc4/rc4.html"> rc4 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key584"> RCS </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rcs/rcs.html"> rcs </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key581"> RCS patch </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rcs/rcs.html"> rcs </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key362"> read </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key477"> reading </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key90"> receiver </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/receive.html"> term::receive </a> &#183; <a href="tcllib/files/modules/term/term_bind.html"> term::receive::bind </a> &#183; <a href="tcllib/files/modules/transfer/receiver.html"> transfer::receiver </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key467"> reconnect </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nns/nns_auto.html"> nameserv::auto </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key259"> record </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/queue.html"> struct::queue </a> &#183; <a href="tcllib/files/modules/struct/record.html"> struct::record </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key16"> recursive descent </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key198"> reduce </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a> &#183; <a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key537"> reference </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key98"> reflected channel </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/cat.html"> tcl::chan::cat </a> &#183; <a href="tcllib/files/modules/virtchannel_core/core.html"> tcl::chan::core </a> &#183; <a href="tcllib/files/modules/virtchannel_core/events.html"> tcl::chan::events </a> &#183; <a href="tcllib/files/modules/virtchannel_base/facade.html"> tcl::chan::facade </a> &#183; <a href="tcllib/files/modules/virtchannel_base/fifo.html"> tcl::chan::fifo </a> &#183; <a href="tcllib/files/modules/virtchannel_base/fifo2.html"> tcl::chan::fifo2 </a> &#183; <a href="tcllib/files/modules/virtchannel_base/halfpipe.html"> tcl::chan::halfpipe </a> &#183; <a href="tcllib/files/modules/virtchannel_base/memchan.html"> tcl::chan::memchan </a> &#183; <a href="tcllib/files/modules/virtchannel_base/null.html"> tcl::chan::null </a> &#183; <a href="tcllib/files/modules/virtchannel_base/nullzero.html"> tcl::chan::nullzero </a> &#183; <a href="tcllib/files/modules/virtchannel_base/random.html"> tcl::chan::random </a> &#183; <a href="tcllib/files/modules/virtchannel_base/randseed.html"> tcl::chan::randseed </a> &#183; <a href="tcllib/files/modules/virtchannel_base/std.html"> tcl::chan::std </a> &#183; <a href="tcllib/files/modules/virtchannel_base/string.html"> tcl::chan::string </a> &#183; <a href="tcllib/files/modules/virtchannel_base/textwindow.html"> tcl::chan::textwindow </a> &#183; <a href="tcllib/files/modules/virtchannel_base/variable.html"> tcl::chan::variable </a> &#183; <a href="tcllib/files/modules/virtchannel_base/zero.html"> tcl::chan::zero </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/adler32.html"> tcl::transform::adler32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/base64.html"> tcl::transform::base64 </a> &#183; <a href="tcllib/files/modules/virtchannel_core/transformcore.html"> tcl::transform::core </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/counter.html"> tcl::transform::counter </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/crc32.html"> tcl::transform::crc32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/hex.html"> tcl::transform::hex </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/identity.html"> tcl::transform::identity </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/limitsize.html"> tcl::transform::limitsize </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/observe.html"> tcl::transform::observe </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/spacer.html"> tcl::transform::spacer </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key281"> regular expression </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a> &#183; <a href="tcllib/files/modules/textutil/textutil.html"> textutil </a> &#183; <a href="tcllib/files/modules/textutil/textutil_split.html"> textutil::split </a> &#183; <a href="tcllib/files/modules/textutil/trim.html"> textutil::trim </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key279"> regular grammar </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key278"> regular languages </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key317"> remote communication </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/comm/comm_wire.html"> comm_wire </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key316"> remote execution </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/comm/comm_wire.html"> comm_wire </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key209"> remove </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/multi.html"> fileutil::multi </a> &#183; <a href="tcllib/files/modules/fileutil/multiop.html"> fileutil::multi::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key526"> repeating </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key238"> repetition </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a> &#183; <a href="tcllib/files/modules/textutil/repeat.html"> textutil::repeat </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key105"> report </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/report/report.html"> report </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key518"> reshuffle </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key414"> residual graph </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key553"> resolver </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_dns.html"> dns </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key152"> resource management </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/try/tcllib_try.html"> try </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key466"> restore </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nns/nns_auto.html"> nameserv::auto </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key505"> reverse </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key290"> rfc 821 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/mime.html"> mime </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a> &#183; <a href="tcllib/files/modules/smtpd/smtpd.html"> smtpd </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key291"> rfc 822 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/mime.html"> mime </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d_dbox.html"> pop3d::dbox </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key81"> rfc 868 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ntp/ntp_time.html"> ntp_time </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key248"> rfc 959 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ftp/ftp.html"> ftp </a> &#183; <a href="tcllib/files/modules/ftp/ftp_geturl.html"> ftp::geturl </a> &#183; <a href="tcllib/files/modules/ftpd/ftpd.html"> ftpd </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key604"> rfc 977 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nntp/nntp.html"> nntp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key554"> rfc 1034 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_dns.html"> dns </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key549"> rfc 1035 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_dns.html"> dns </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key603"> rfc 1036 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/nntp/nntp.html"> nntp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key334"> rfc 1320 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/md4/md4.html"> md4 </a> &#183; <a href="tcllib/files/modules/md5/md5.html"> md5 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd128.html"> ripemd128 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd160.html"> ripemd160 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key337"> rfc 1321 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/md4/md4.html"> md4 </a> &#183; <a href="tcllib/files/modules/md5/md5.html"> md5 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd128.html"> ripemd128 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd160.html"> ripemd160 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key384"> rfc 1413 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ident/ident.html"> ident </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key551"> rfc 1886 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_dns.html"> dns </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key394"> rfc 1939 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pop3/pop3.html"> pop3 </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d.html"> pop3d </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key79"> rfc 2030 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ntp/ntp_time.html"> ntp_time </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key750"> rfc 2045 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/mime.html"> mime </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key751"> rfc 2046 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/mime.html"> mime </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key749"> rfc 2049 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/mime.html"> mime </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key193"> rfc 2104 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/md4/md4.html"> md4 </a> &#183; <a href="tcllib/files/modules/md5/md5.html"> md5 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd128.html"> ripemd128 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd160.html"> ripemd160 </a> &#183; <a href="tcllib/files/modules/sha1/sha1.html"> sha1 </a> &#183; <a href="tcllib/files/modules/sha1/sha256.html"> sha256 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key528"> rfc 2141 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/urn-scheme.html"> uri_urn </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key123"> rfc 2251 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ldap/ldap.html"> ldap </a> &#183; <a href="tcllib/files/modules/ldap/ldapx.html"> ldapx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key489"> rfc 2255 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key643"> rfc 2289 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/otp/otp.html"> otp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key491"> rfc 2396 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key294"> rfc 2554 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/smtp.html"> smtp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key287"> rfc 2821 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/smtp.html"> smtp </a> &#183; <a href="tcllib/files/modules/smtpd/smtpd.html"> smtpd </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key451"> rfc 2849 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ldap/ldapx.html"> ldapx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key292"> rfc 3207 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/smtp.html"> smtp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key399"> rfc 3513 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/dns/tcllib_ip.html"> tcllib_ip </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key126"> rfc 4511 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ldap/ldap.html"> ldap </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key742"> rfc3501 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/imap4/imap4.html"> imap4 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key299"> rfc3548 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base32/base32.html"> base32 </a> &#183; <a href="tcllib/files/modules/base32/base32hex.html"> base32::hex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key506"> right outer join </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key336"> RIPEMD </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ripemd/ripemd128.html"> ripemd128 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd160.html"> ripemd160 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key309"> roman numeral </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/roman.html"> math::roman </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key724"> roots </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/calculus.html"> math::calculus </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key350"> rot </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key348"> rot13 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key346"> rounding </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/fuzzy.html"> math::fuzzy </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key461"> rows </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key313"> rpc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/comm/comm_wire.html"> comm_wire </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key160"> rsa </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pki/pki.html"> pki </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key382"> running </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c22">Keywords: S</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key473"> s3 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/amazon-s3/S3.html"> S3 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key741"> SASL </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/sasl/sasl.html"> SASL </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key201"> scanl </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/generator/generator.html"> generator </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key582"> SCCS </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rcs/rcs.html"> rcs </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key315"> secure </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/pop3/pop3.html"> pop3 </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d.html"> pop3d </a> &#183; <a href="tcllib/files/modules/transfer/connect.html"> transfer::connect </a> &#183; <a href="tcllib/files/modules/transfer/receiver.html"> transfer::receiver </a> &#183; <a href="tcllib/files/modules/transfer/transmitter.html"> transfer::transmitter </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key110"> security </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/aes/aes.html"> aes </a> &#183; <a href="tcllib/files/modules/blowfish/blowfish.html"> blowfish </a> &#183; <a href="tcllib/files/modules/crc/cksum.html"> cksum </a> &#183; <a href="tcllib/files/modules/crc/crc16.html"> crc16 </a> &#183; <a href="tcllib/files/modules/crc/crc32.html"> crc32 </a> &#183; <a href="tcllib/files/modules/des/des.html"> des </a> &#183; <a href="tcllib/files/modules/md4/md4.html"> md4 </a> &#183; <a href="tcllib/files/modules/md5/md5.html"> md5 </a> &#183; <a href="tcllib/files/modules/md5crypt/md5crypt.html"> md5crypt </a> &#183; <a href="tcllib/files/modules/otp/otp.html"> otp </a> &#183; <a href="tcllib/files/modules/pki/pki.html"> pki </a> &#183; <a href="tcllib/files/modules/rc4/rc4.html"> rc4 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd128.html"> ripemd128 </a> &#183; <a href="tcllib/files/modules/ripemd/ripemd160.html"> ripemd160 </a> &#183; <a href="tcllib/files/modules/sha1/sha1.html"> sha1 </a> &#183; <a href="tcllib/files/modules/sha1/sha256.html"> sha256 </a> &#183; <a href="tcllib/files/modules/crc/sum.html"> sum </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key771"> seed </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/randseed.html"> tcl::chan::randseed </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key684"> selectionbox </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/javascript/javascript.html"> javascript </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key116"> semantic markup </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx_intro.html"> docidx_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_cmdref.html"> docidx_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_faq.html"> docidx_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_intro.html"> docidx_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/docidx_lang_syntax.html"> docidx_lang_syntax </a> &#183; <a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html"> docidx_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_intro.html"> doctoc_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_cmdref.html"> doctoc_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_faq.html"> doctoc_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_intro.html"> doctoc_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_lang_syntax.html"> doctoc_lang_syntax </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html"> doctoc_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools2idx/introduction.html"> doctools2idx_introduction </a> &#183; <a href="tcllib/files/modules/doctools2toc/introduction.html"> doctools2toc_introduction </a> &#183; <a href="tcllib/files/modules/doctools/doctools_intro.html"> doctools_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_cmdref.html"> doctools_lang_cmdref </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_faq.html"> doctools_lang_faq </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_intro.html"> doctools_lang_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctools_lang_syntax.html"> doctools_lang_syntax </a> &#183; <a href="tcllib/files/modules/doctools/doctools_plugin_apiref.html"> doctools_plugin_apiref </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key312"> send </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key102"> serialization </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bee/bee.html"> bee </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_docidx.html"> doctools::idx::export::docidx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_html.html"> doctools::idx::export::html </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_json.html"> doctools::idx::export::json </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_nroff.html"> doctools::idx::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_text.html"> doctools::idx::export::text </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_wiki.html"> doctools::idx::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools2idx/structure.html"> doctools::idx::structure </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_doctoc.html"> doctools::toc::export::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_html.html"> doctools::toc::export::html </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_json.html"> doctools::toc::export::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_nroff.html"> doctools::toc::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_text.html"> doctools::toc::export::text </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_wiki.html"> doctools::toc::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools2toc/structure.html"> doctools::toc::structure </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/struct_tree.html"> struct::tree </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key57"> server </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_geocode_nominatim.html"> map::geocode::nominatim </a> &#183; <a href="tcllib/files/modules/map/map_slippy_fetcher.html"> map::slippy::fetcher </a> &#183; <a href="tcllib/files/modules/nns/nns_common.html"> nameserv::common </a> &#183; <a href="tcllib/files/modules/nns/nns_server.html"> nameserv::server </a> &#183; <a href="tcllib/files/modules/nns/nns_intro.html"> nns_intro </a> &#183; <a href="tcllib/files/apps/nnsd.html"> nnsd </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key69"> service </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/log/logger.html"> logger </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key555"> services </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ftpd/ftpd.html"> ftpd </a> &#183; <a href="tcllib/files/modules/smtpd/smtpd.html"> smtpd </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key253"> set </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/queue.html"> struct::queue </a> &#183; <a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key392"> sha1 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/sha1/sha1.html"> sha1 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key192"> sha256 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/sha1/sha256.html"> sha256 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key426"> shortest path </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key520"> shuffle </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key284"> simulated annealing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/simulation/annealing.html"> simulation::annealing </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key593"> simulation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/simulation/simulation_random.html"> simulation::random </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key708"> singleton </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key670"> size limit </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/limitsize.html"> tcl::transform::limitsize </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key258"> skiplist </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/queue.html"> struct::queue </a> &#183; <a href="tcllib/files/modules/struct/skiplist.html"> struct::skiplist </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key185"> slippy </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_slippy.html"> map::slippy </a> &#183; <a href="tcllib/files/modules/map/map_slippy_cache.html"> map::slippy::cache </a> &#183; <a href="tcllib/files/modules/map/map_slippy_fetcher.html"> map::slippy::fetcher </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key295"> smtp </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/mime/mime.html"> mime </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a> &#183; <a href="tcllib/files/modules/smtpd/smtpd.html"> smtpd </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key623"> smtpd </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/smtpd/smtpd.html"> smtpd </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key734"> Snit </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key333"> snit </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/interp/deleg_method.html"> deleg_method </a> &#183; <a href="tcllib/files/modules/interp/tcllib_interp.html"> interp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key80"> SNTP </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ntp/ntp_time.html"> ntp_time </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key311"> socket </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/comm/comm_wire.html"> comm_wire </a> &#183; <a href="tcllib/files/modules/smtpd/smtpd.html"> smtpd </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key242"> soundex </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/soundex/soundex.html"> soundex </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key388"> source </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip.html"> docstrip </a> &#183; <a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a> &#183; <a href="tcllib/files/apps/tcldocstrip.html"> tcldocstrip </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key472"> spacing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/spacer.html"> tcl::transform::spacer </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key774"> spatial interpolation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/interpolate.html"> math::interpolate </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key636"> special functions </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/special.html"> math::special </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key613"> specification </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_lang_spec.html"> bench_lang_spec </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key598"> speed </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/profiler/profiler.html"> profiler </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key391"> split </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil_split.html"> textutil::split </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key442"> squared graph </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key318"> ssl </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/imap4/imap4.html"> imap4 </a> &#183; <a href="tcllib/files/modules/pop3/pop3.html"> pop3 </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d.html"> pop3d </a> &#183; <a href="tcllib/files/modules/transfer/connect.html"> transfer::connect </a> &#183; <a href="tcllib/files/modules/transfer/receiver.html"> transfer::receiver </a> &#183; <a href="tcllib/files/modules/transfer/transmitter.html"> transfer::transmitter </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key257"> stack </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/queue.html"> struct::queue </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key765"> standard io </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/std.html"> tcl::chan::std </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key8"> state </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key74"> state (de)serialization </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/namespacex/namespacex.html"> namespacex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key594"> statistical distribution </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/simulation/simulation_random.html"> simulation::random </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key174"> statistics </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/counter/counter.html"> counter </a> &#183; <a href="tcllib/files/modules/math/math.html"> math </a> &#183; <a href="tcllib/files/modules/math/statistics.html"> math::statistics </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key766"> stdin </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/std.html"> tcl::chan::std </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key767"> stdout </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/std.html"> tcl::chan::std </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key688"> stochastic modelling </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/simulation/montecarlo.html"> simulation::montecarlo </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key115"> stream cipher </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rc4/rc4.html"> rc4 </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key601"> stream copy </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/observe.html"> tcl::transform::observe </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key239"> string </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil.html"> textutil </a> &#183; <a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a> &#183; <a href="tcllib/files/modules/textutil/expander.html"> textutil::expander </a> &#183; <a href="tcllib/files/modules/textutil/repeat.html"> textutil::repeat </a> &#183; <a href="tcllib/files/modules/textutil/textutil_split.html"> textutil::split </a> &#183; <a href="tcllib/files/modules/textutil/textutil_string.html"> textutil::string </a> &#183; <a href="tcllib/files/modules/textutil/tabify.html"> textutil::tabify </a> &#183; <a href="tcllib/files/modules/textutil/trim.html"> textutil::trim </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key596"> stringprep </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/stringprep/stringprep.html"> stringprep </a> &#183; <a href="tcllib/files/modules/stringprep/stringprep_data.html"> stringprep::data </a> &#183; <a href="tcllib/files/modules/stringprep/unicode_data.html"> unicode::data </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key404"> strongly connected component </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key285"> struct </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/pool.html"> struct::pool </a> &#183; <a href="tcllib/files/modules/struct/record.html"> struct::record </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key131"> structure </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/control/control.html"> control </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key764"> structured queries </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/treeql/treeql.html"> treeql </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key355"> style </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/html_cssdefaults.html"> doctools::html::cssdefaults </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key696"> subcommand </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tepam/tepam_introduction.html"> tepam </a> &#183; <a href="tcllib/files/modules/tepam/tepam_procedure.html"> tepam::procedure </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key429"> subgraph </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key631"> subject </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/hook/hook.html"> hook </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key683"> submitbutton </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/javascript/javascript.html"> javascript </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key629"> subscriber </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/hook/hook.html"> hook </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key516"> subsequence </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key234"> subst </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcl_parse.html"> doctools::tcl::parse </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key540"> sum </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/crc/sum.html"> sum </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key512"> swapping </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_list.html"> struct::list </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key675"> symmetric difference </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key591"> synchronous </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/cache/async.html"> cache::async </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key685"> syntax tree </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_util.html"> grammar::me::util </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c23">Keywords: T</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key104"> table </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/html/html.html"> html </a> &#183; <a href="tcllib/files/modules/report/report.html"> report </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key150"> table of contents </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctoc_intro.html"> doctoc_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html"> doctoc_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools2toc/introduction.html"> doctools2toc_introduction </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_doctoc.html"> doctools::toc::export::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_html.html"> doctools::toc::export::html </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_json.html"> doctools::toc::export::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_nroff.html"> doctools::toc::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_text.html"> doctools::toc::export::text </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_wiki.html"> doctools::toc::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_doctoc.html"> doctools::toc::import::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_json.html"> doctools::toc::import::json </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key498"> tabstops </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/tabify.html"> textutil::tabify </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key660"> tallying </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/counter/counter.html"> counter </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key679"> tape archive </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tar/tar.html"> tar </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key681"> tar </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tar/tar.html"> tar </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key246"> tcl </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/bigfloat.html"> math::bigfloat </a> &#183; <a href="tcllib/files/modules/math/bignum.html"> math::bignum </a> &#183; <a href="tcllib/files/modules/math/decimal.html"> math::decimal </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key616"> Tcl module </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/docstrip/docstrip_util.html"> docstrip_util </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key235"> Tcl syntax </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcl_parse.html"> doctools::tcl::parse </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key535"> tcler's wiki </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key56"> tcllib </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/csv/csv.html"> csv </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key706"> TclOO </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ooutil/ooutil.html"> oo::util </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key101"> TCLPARAM </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key13"> TDPL </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key267"> temp file </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/fileutil.html"> fileutil </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key719"> template processing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/expander.html"> textutil::expander </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key88"> terminal </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/term.html"> term </a> &#183; <a href="tcllib/files/modules/term/ansi_code.html"> term::ansi::code </a> &#183; <a href="tcllib/files/modules/term/ansi_cattr.html"> term::ansi::code::attr </a> &#183; <a href="tcllib/files/modules/term/ansi_cctrl.html"> term::ansi::code::ctrl </a> &#183; <a href="tcllib/files/modules/term/ansi_cmacros.html"> term::ansi::code::macros </a> &#183; <a href="tcllib/files/modules/term/ansi_ctrlu.html"> term::ansi::ctrl::unix </a> &#183; <a href="tcllib/files/modules/term/ansi_send.html"> term::ansi::send </a> &#183; <a href="tcllib/files/modules/term/imenu.html"> term::interact::menu </a> &#183; <a href="tcllib/files/modules/term/ipager.html"> term::interact::pager </a> &#183; <a href="tcllib/files/modules/term/receive.html"> term::receive </a> &#183; <a href="tcllib/files/modules/term/term_bind.html"> term::receive::bind </a> &#183; <a href="tcllib/files/modules/term/term_send.html"> term::send </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key266"> test </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/fileutil.html"> fileutil </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key86"> testing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench.html"> bench </a> &#183; <a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a> &#183; <a href="tcllib/files/modules/bench/bench_wcsv.html"> bench::out::csv </a> &#183; <a href="tcllib/files/modules/bench/bench_wtext.html"> bench::out::text </a> &#183; <a href="tcllib/files/modules/bench/bench_intro.html"> bench_intro </a> &#183; <a href="tcllib/files/modules/bench/bench_lang_intro.html"> bench_lang_intro </a> &#183; <a href="tcllib/files/modules/bench/bench_lang_spec.html"> bench_lang_spec </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key304"> TeX </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil.html"> textutil </a> &#183; <a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key454"> text </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bench/bench_read.html"> bench::in </a> &#183; <a href="tcllib/files/modules/bench/bench_wtext.html"> bench::out::text </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key240"> text comparison </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/soundex/soundex.html"> soundex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key588"> text conversion </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rcs/rcs.html"> rcs </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key587"> text differences </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/rcs/rcs.html"> rcs </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key727"> text display </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/term/imenu.html"> term::interact::menu </a> &#183; <a href="tcllib/files/modules/term/ipager.html"> term::interact::pager </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key720"> text expansion </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/expander.html"> textutil::expander </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key243"> text likeness </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/soundex/soundex.html"> soundex </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key178"> text processing </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bibtex/bibtex.html"> bibtex </a> &#183; <a href="tcllib/files/modules/yaml/huddle.html"> huddle </a> &#183; <a href="tcllib/files/apps/page.html"> page </a> &#183; <a href="tcllib/files/modules/page/page_intro.html"> page_intro </a> &#183; <a href="tcllib/files/modules/page/page_pluginmgr.html"> page_pluginmgr </a> &#183; <a href="tcllib/files/modules/page/page_util_flow.html"> page_util_flow </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_lemon.html"> page_util_norm_lemon </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_peg.html"> page_util_norm_peg </a> &#183; <a href="tcllib/files/modules/page/page_util_peg.html"> page_util_peg </a> &#183; <a href="tcllib/files/modules/page/page_util_quote.html"> page_util_quote </a> &#183; <a href="tcllib/files/modules/yaml/yaml.html"> yaml </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key189"> text widget </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/textwindow.html"> tcl::chan::textwindow </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key361"> threads </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key142"> thumbnail </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/jpeg/jpeg.html"> jpeg </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key35"> tie </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tie/tie_std.html"> tie </a> &#183; <a href="tcllib/files/modules/tie/tie.html"> tie </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key136"> tif </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tiff/tiff.html"> tiff </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key134"> tiff </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/exif/exif.html"> exif </a> &#183; <a href="tcllib/files/modules/tiff/tiff.html"> tiff </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key340"> tile </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_slippy_cache.html"> map::slippy::cache </a> &#183; <a href="tcllib/files/modules/map/map_slippy_fetcher.html"> map::slippy::fetcher </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key83"> time </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ntp/ntp_time.html"> ntp_time </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key652"> timestamp </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/png/png.html"> png </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key96"> tip 219 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/cat.html"> tcl::chan::cat </a> &#183; <a href="tcllib/files/modules/virtchannel_core/core.html"> tcl::chan::core </a> &#183; <a href="tcllib/files/modules/virtchannel_core/events.html"> tcl::chan::events </a> &#183; <a href="tcllib/files/modules/virtchannel_base/facade.html"> tcl::chan::facade </a> &#183; <a href="tcllib/files/modules/virtchannel_base/fifo.html"> tcl::chan::fifo </a> &#183; <a href="tcllib/files/modules/virtchannel_base/fifo2.html"> tcl::chan::fifo2 </a> &#183; <a href="tcllib/files/modules/virtchannel_base/halfpipe.html"> tcl::chan::halfpipe </a> &#183; <a href="tcllib/files/modules/virtchannel_base/memchan.html"> tcl::chan::memchan </a> &#183; <a href="tcllib/files/modules/virtchannel_base/null.html"> tcl::chan::null </a> &#183; <a href="tcllib/files/modules/virtchannel_base/nullzero.html"> tcl::chan::nullzero </a> &#183; <a href="tcllib/files/modules/virtchannel_base/random.html"> tcl::chan::random </a> &#183; <a href="tcllib/files/modules/virtchannel_base/randseed.html"> tcl::chan::randseed </a> &#183; <a href="tcllib/files/modules/virtchannel_base/std.html"> tcl::chan::std </a> &#183; <a href="tcllib/files/modules/virtchannel_base/string.html"> tcl::chan::string </a> &#183; <a href="tcllib/files/modules/virtchannel_base/textwindow.html"> tcl::chan::textwindow </a> &#183; <a href="tcllib/files/modules/virtchannel_base/variable.html"> tcl::chan::variable </a> &#183; <a href="tcllib/files/modules/virtchannel_base/zero.html"> tcl::chan::zero </a> &#183; <a href="tcllib/files/modules/virtchannel_core/transformcore.html"> tcl::transform::core </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key273"> tip 230 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/adler32.html"> tcl::transform::adler32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/base64.html"> tcl::transform::base64 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/counter.html"> tcl::transform::counter </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/crc32.html"> tcl::transform::crc32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/hex.html"> tcl::transform::hex </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/identity.html"> tcl::transform::identity </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/limitsize.html"> tcl::transform::limitsize </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/observe.html"> tcl::transform::observe </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/spacer.html"> tcl::transform::spacer </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key322"> tip 234 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key715"> tip 317 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/base64.html"> tcl::transform::base64 </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key190"> Tk </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/textwindow.html"> tcl::chan::textwindow </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key289"> tls </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/comm/comm.html"> comm </a> &#183; <a href="tcllib/files/modules/imap4/imap4.html"> imap4 </a> &#183; <a href="tcllib/files/modules/pop3/pop3.html"> pop3 </a> &#183; <a href="tcllib/files/modules/pop3d/pop3d.html"> pop3d </a> &#183; <a href="tcllib/files/modules/mime/smtp.html"> smtp </a> &#183; <a href="tcllib/files/modules/transfer/connect.html"> transfer::connect </a> &#183; <a href="tcllib/files/modules/transfer/receiver.html"> transfer::receiver </a> &#183; <a href="tcllib/files/modules/transfer/transmitter.html"> transfer::transmitter </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key4"> TMML </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctools.html"> doctools </a> &#183; <a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/apps/dtplite.html"> dtplite </a> &#183; <a href="tcllib/files/modules/doctools/mpexpand.html"> mpexpand </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key149"> toc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctoc_intro.html"> doctoc_intro </a> &#183; <a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html"> doctoc_plugin_apiref </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_doctoc.html"> doctools::toc::export::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_html.html"> doctools::toc::export::html </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_json.html"> doctools::toc::export::json </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_nroff.html"> doctools::toc::export::nroff </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_text.html"> doctools::toc::export::text </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_wiki.html"> doctools::toc::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_doctoc.html"> doctools::toc::import::doctoc </a> &#183; <a href="tcllib/files/modules/doctools2toc/import_json.html"> doctools::toc::import::json </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key665"> toc formatter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html"> doctoc_plugin_apiref </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key19"> top-down parsing languages </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key344"> torrent </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/bee/bee.html"> bee </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key269"> touch </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/fileutil.html"> fileutil </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key24"> TPDL </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key18"> transducer </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_aycock/aycock.html"> grammar::aycock </a> &#183; <a href="tcllib/files/modules/grammar_fa/fa.html"> grammar::fa </a> &#183; <a href="tcllib/files/modules/grammar_fa/dacceptor.html"> grammar::fa::dacceptor </a> &#183; <a href="tcllib/files/modules/grammar_fa/dexec.html"> grammar::fa::dexec </a> &#183; <a href="tcllib/files/modules/grammar_fa/faop.html"> grammar::fa::op </a> &#183; <a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg.html"> grammar::peg </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt.html"> pt </a> &#183; <a href="tcllib/files/modules/pt/pt_astree.html"> pt::ast </a> &#183; <a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html"> pt::cparam::configuration::critcl </a> &#183; <a href="tcllib/files/modules/pt/pt_json_language.html"> pt::json_language </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpression.html"> pt::pe </a> &#183; <a href="tcllib/files/modules/pt/pt_pexpr_op.html"> pt::pe::op </a> &#183; <a href="tcllib/files/modules/pt/pt_pegrammar.html"> pt::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container.html"> pt::peg::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_container_peg.html"> pt::peg::container::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export.html"> pt::peg::export </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_container.html"> pt::peg::export::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_json.html"> pt::peg::export::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_export_peg.html"> pt::peg::export::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_container.html"> pt::peg::from::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_json.html"> pt::peg::from::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_from_peg.html"> pt::peg::from::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import.html"> pt::peg::import </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_container.html"> pt::peg::import::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_json.html"> pt::peg::import::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_import_peg.html"> pt::peg::import::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_interp.html"> pt::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_container.html"> pt::peg::to::container </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_cparam.html"> pt::peg::to::cparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_json.html"> pt::peg::to::json </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_param.html"> pt::peg::to::param </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_peg.html"> pt::peg::to::peg </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html"> pt::peg::to::tclparam </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_language.html"> pt::peg_language </a> &#183; <a href="tcllib/files/modules/pt/pt_peg_introduction.html"> pt::pegrammar </a> &#183; <a href="tcllib/files/modules/pt/pt_pgen.html"> pt::pgen </a> &#183; <a href="tcllib/files/modules/pt/pt_rdengine.html"> pt::rde </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html"> pt::tclparam::configuration::snit </a> &#183; <a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html"> pt::tclparam::configuration::tcloo </a> &#183; <a href="tcllib/files/modules/pt/pt_to_api.html"> pt_export_api </a> &#183; <a href="tcllib/files/modules/pt/pt_from_api.html"> pt_import_api </a> &#183; <a href="tcllib/files/modules/pt/pt_introduction.html"> pt_introduction </a> &#183; <a href="tcllib/files/modules/pt/pt_parser_api.html"> pt_parser_api </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key60"> transfer </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/transfer/connect.html"> transfer::connect </a> &#183; <a href="tcllib/files/modules/transfer/copyops.html"> transfer::copy </a> &#183; <a href="tcllib/files/modules/transfer/tqueue.html"> transfer::copy::queue </a> &#183; <a href="tcllib/files/modules/transfer/ddest.html"> transfer::data::destination </a> &#183; <a href="tcllib/files/modules/transfer/dsource.html"> transfer::data::source </a> &#183; <a href="tcllib/files/modules/transfer/receiver.html"> transfer::receiver </a> &#183; <a href="tcllib/files/modules/transfer/transmitter.html"> transfer::transmitter </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key274"> transformation </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/page/page_util_peg.html"> page_util_peg </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/adler32.html"> tcl::transform::adler32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/base64.html"> tcl::transform::base64 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/counter.html"> tcl::transform::counter </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/crc32.html"> tcl::transform::crc32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/hex.html"> tcl::transform::hex </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/identity.html"> tcl::transform::identity </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/limitsize.html"> tcl::transform::limitsize </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/observe.html"> tcl::transform::observe </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/spacer.html"> tcl::transform::spacer </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key663"> transmitter </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/transfer/transmitter.html"> transfer::transmitter </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key408"> travelling salesman </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key667"> traversal </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/traverse.html"> fileutil_traverse </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key254"> tree </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/gasm.html"> grammar::me::cpu::gasm </a> &#183; <a href="tcllib/files/modules/grammar_me/me_util.html"> grammar::me::util </a> &#183; <a href="tcllib/files/modules/htmlparse/htmlparse.html"> htmlparse </a> &#183; <a href="tcllib/files/modules/struct/queue.html"> struct::queue </a> &#183; <a href="tcllib/files/modules/struct/stack.html"> struct::stack </a> &#183; <a href="tcllib/files/modules/struct/struct_tree.html"> struct::tree </a> &#183; <a href="tcllib/files/modules/struct/struct_tree1.html"> struct::tree_v1 </a> &#183; <a href="tcllib/files/modules/treeql/treeql.html"> treeql </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key762"> tree query language </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/treeql/treeql.html"> treeql </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key176"> tree walking </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/page/page_util_flow.html"> page_util_flow </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_lemon.html"> page_util_norm_lemon </a> &#183; <a href="tcllib/files/modules/page/page_util_norm_peg.html"> page_util_norm_peg </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key761"> TreeQL </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/treeql/treeql.html"> treeql </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key380"> trimming </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil.html"> textutil </a> &#183; <a href="tcllib/files/modules/textutil/trim.html"> textutil::trim </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key109"> type </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/fileutil/fileutil.html"> fileutil </a> &#183; <a href="tcllib/files/modules/fumagic/cfront.html"> fileutil::magic::cfront </a> &#183; <a href="tcllib/files/modules/fumagic/cgen.html"> fileutil::magic::cgen </a> &#183; <a href="tcllib/files/modules/fumagic/filetypes.html"> fileutil::magic::filetype </a> &#183; <a href="tcllib/files/modules/fumagic/mimetypes.html"> fileutil::magic::mimetype </a> &#183; <a href="tcllib/files/modules/fumagic/rtcore.html"> fileutil::magic::rt </a> &#183; <a href="tcllib/files/modules/snit/snit.html"> snit </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c24">Keywords: U</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key634"> uevent </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/hook/hook.html"> hook </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key657"> unbind </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uev/uevent.html"> uevent </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key638"> uncapitalize </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/textutil_string.html"> textutil::string </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key300"> undenting </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/textutil/adjust.html"> textutil::adjust </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key597"> unicode </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/stringprep/stringprep.html"> stringprep </a> &#183; <a href="tcllib/files/modules/stringprep/stringprep_data.html"> stringprep::data </a> &#183; <a href="tcllib/files/modules/stringprep/unicode.html"> unicode </a> &#183; <a href="tcllib/files/modules/stringprep/unicode_data.html"> unicode::data </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key575"> union </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/disjointset.html"> struct::disjointset </a> &#183; <a href="tcllib/files/modules/struct/struct_set.html"> struct::set </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key559"> unit </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/units/units.html"> units </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key78"> unknown hooking </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/namespacex/namespacex.html"> namespacex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key34"> untie </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/tie/tie_std.html"> tie </a> &#183; <a href="tcllib/files/modules/tie/tie.html"> tie </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key368"> update </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key480"> uri </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a> &#183; <a href="tcllib/files/modules/uri/urn-scheme.html"> uri_urn </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key483"> url </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/import.html"> doctools::idx::import </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/import.html"> doctools::toc::import </a> &#183; <a href="tcllib/files/modules/map/map_geocode_nominatim.html"> map::geocode::nominatim </a> &#183; <a href="tcllib/files/modules/map/map_slippy_fetcher.html"> map::slippy::fetcher </a> &#183; <a href="tcllib/files/modules/uri/uri.html"> uri </a> &#183; <a href="tcllib/files/modules/uri/urn-scheme.html"> uri_urn </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key527"> urn </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/urn-scheme.html"> uri_urn </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key73"> utilities </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/namespacex/namespacex.html"> namespacex </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key223"> uuencode </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base64/uuencode.html"> uuencode </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key197"> UUID </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uuid/uuid.html"> uuid </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c25">Keywords: V</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key66"> vectors </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/math/linalg.html"> math::linearalgebra </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key411"> vertex </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graph.html"> struct::graph </a> &#183; <a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key446"> vertex cover </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/struct/graphops.html"> struct::graph::op </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key94"> virtual channel </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/cat.html"> tcl::chan::cat </a> &#183; <a href="tcllib/files/modules/virtchannel_core/core.html"> tcl::chan::core </a> &#183; <a href="tcllib/files/modules/virtchannel_core/events.html"> tcl::chan::events </a> &#183; <a href="tcllib/files/modules/virtchannel_base/facade.html"> tcl::chan::facade </a> &#183; <a href="tcllib/files/modules/virtchannel_base/fifo.html"> tcl::chan::fifo </a> &#183; <a href="tcllib/files/modules/virtchannel_base/fifo2.html"> tcl::chan::fifo2 </a> &#183; <a href="tcllib/files/modules/virtchannel_base/halfpipe.html"> tcl::chan::halfpipe </a> &#183; <a href="tcllib/files/modules/virtchannel_base/memchan.html"> tcl::chan::memchan </a> &#183; <a href="tcllib/files/modules/virtchannel_base/null.html"> tcl::chan::null </a> &#183; <a href="tcllib/files/modules/virtchannel_base/nullzero.html"> tcl::chan::nullzero </a> &#183; <a href="tcllib/files/modules/virtchannel_base/random.html"> tcl::chan::random </a> &#183; <a href="tcllib/files/modules/virtchannel_base/randseed.html"> tcl::chan::randseed </a> &#183; <a href="tcllib/files/modules/virtchannel_base/std.html"> tcl::chan::std </a> &#183; <a href="tcllib/files/modules/virtchannel_base/string.html"> tcl::chan::string </a> &#183; <a href="tcllib/files/modules/virtchannel_base/textwindow.html"> tcl::chan::textwindow </a> &#183; <a href="tcllib/files/modules/virtchannel_base/variable.html"> tcl::chan::variable </a> &#183; <a href="tcllib/files/modules/virtchannel_base/zero.html"> tcl::chan::zero </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/adler32.html"> tcl::transform::adler32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/base64.html"> tcl::transform::base64 </a> &#183; <a href="tcllib/files/modules/virtchannel_core/transformcore.html"> tcl::transform::core </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/counter.html"> tcl::transform::counter </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/crc32.html"> tcl::transform::crc32 </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/hex.html"> tcl::transform::hex </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/identity.html"> tcl::transform::identity </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/limitsize.html"> tcl::transform::limitsize </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/observe.html"> tcl::transform::observe </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/rot.html"> tcl::transform::rot </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/spacer.html"> tcl::transform::spacer </a> &#183; <a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key25"> virtual machine </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/grammar_me/me_cpu.html"> grammar::me::cpu </a> &#183; <a href="tcllib/files/modules/grammar_me/me_cpucore.html"> grammar::me::cpu::core </a> &#183; <a href="tcllib/files/modules/grammar_me/gasm.html"> grammar::me::cpu::gasm </a> &#183; <a href="tcllib/files/modules/grammar_me/me_tcl.html"> grammar::me::tcl </a> &#183; <a href="tcllib/files/modules/grammar_me/me_intro.html"> grammar::me_intro </a> &#183; <a href="tcllib/files/modules/grammar_me/me_vm.html"> grammar::me_vm </a> &#183; <a href="tcllib/files/modules/grammar_peg/peg_interp.html"> grammar::peg::interp </a> &#183; <a href="tcllib/files/modules/pt/pt_param.html"> pt::param </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key367"> vwait </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/coroutine/coroutine.html"> coroutine </a> &#183; <a href="tcllib/files/modules/coroutine/coro_auto.html"> coroutine::auto </a> &#183; <a href="tcllib/files/modules/smtpd/smtpd.html"> smtpd </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c26">Keywords: W</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key484"> wais </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key212"> widget </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key216"> widget adaptors </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/snit/snit.html"> snit </a> &#183; <a href="tcllib/files/modules/snit/snitfaq.html"> snitfaq </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key164"> wiki </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools/docidx.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/container.html"> doctools::idx </a> &#183; <a href="tcllib/files/modules/doctools2idx/export.html"> doctools::idx::export </a> &#183; <a href="tcllib/files/modules/doctools2idx/export_wiki.html"> doctools::idx::export::wiki </a> &#183; <a href="tcllib/files/modules/doctools/doctoc.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/container.html"> doctools::toc </a> &#183; <a href="tcllib/files/modules/doctools2toc/export.html"> doctools::toc::export </a> &#183; <a href="tcllib/files/modules/doctools2toc/export_wiki.html"> doctools::toc::export::wiki </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key233"> word </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/doctools2base/tcl_parse.html"> doctools::tcl::parse </a> &#183; <a href="tcllib/files/modules/wip/wip.html"> wip </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key490"> www </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/uri/uri.html"> uri </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c27">Keywords: X</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key372"> x.208 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/asn/asn.html"> asn </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key373"> x.209 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/asn/asn.html"> asn </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key128"> x.500 </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/ldap/ldap.html"> ldap </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key695"> xml </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/amazon-s3/xsxp.html"> xsxp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key731"> xor </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/otp.html"> tcl::transform::otp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key759"> XPath </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/treeql/treeql.html"> treeql </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key763"> XSLT </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/treeql/treeql.html"> treeql </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c28">Keywords: Y</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key542"> yaml </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/yaml/huddle.html"> huddle </a> &#183; <a href="tcllib/files/modules/yaml/yaml.html"> yaml </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key654"> ydecode </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base64/yencode.html"> yencode </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key656"> yEnc </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base64/yencode.html"> yencode </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key655"> yencode </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/base64/yencode.html"> yencode </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c29">Keywords: Z</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key533"> zero </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_base/nullzero.html"> tcl::chan::nullzero </a> &#183; <a href="tcllib/files/modules/virtchannel_base/zero.html"> tcl::chan::zero </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key321"> zlib </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/virtchannel_transform/zlib.html"> tcl::transform::zlib </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key183"> zoom </a></td>
<td class="#idxright" width="65%">
<a href="tcllib/files/modules/map/map_slippy.html"> map::slippy </a> &#183; <a href="tcllib/files/modules/map/map_slippy_cache.html"> map::slippy::cache </a> &#183; <a href="tcllib/files/modules/map/map_slippy_fetcher.html"> map::slippy::fetcher </a>
</td></tr>
</table>
</body></html>

Added embedded/www/tcllib/files/apps/dtplite.html.

























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>dtplite - Documentation toolbox</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/apps/dtplite.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ dtplite.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../toc.html">Main Table Of Contents</a>
| <a href="../../toc.html">Table Of Contents</a>
| <a href="../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">dtplite(n) 1.0 tcllib &quot;Documentation toolbox&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>dtplite - Lightweight DocTools Markup Processor</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">USE CASES</a></li>
<li class="subsection"><a href="#subsection2">COMMAND LINE</a></li>
<li class="subsection"><a href="#subsection3">OPTIONS</a></li>
<li class="subsection"><a href="#subsection4">FORMATS</a></li>
<li class="subsection"><a href="#subsection5">DIRECTORY STRUCTURES</a></li>
</ul>
</li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">dtplite</b> <b class="option">-o</b> <i class="arg">output</i> <span class="opt">?options?</span> <i class="arg">format</i> <i class="arg">inputfile</i></a></li>
<li><a href="#2"><b class="cmd">dtplite</b> <b class="const">validate</b> <i class="arg">inputfile</i></a></li>
<li><a href="#3"><b class="cmd">dtplite</b> <b class="option">-o</b> <i class="arg">output</i> <span class="opt">?options?</span> <i class="arg">format</i> <i class="arg">inputdirectory</i></a></li>
<li><a href="#4"><b class="cmd">dtplite</b> <b class="option">-merge</b> <b class="option">-o</b> <i class="arg">output</i> <span class="opt">?options?</span> <i class="arg">format</i> <i class="arg">inputdirectory</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The application described by this document, <b class="syscmd">dtplite</b>, is the
successor to the extremely simple <b class="syscmd"><a href="../modules/doctools/mpexpand.html">mpexpand</a></b>. Influenced in its
functionality by the <b class="syscmd">dtp</b> doctools processor it is much more
powerful than <b class="syscmd"><a href="../modules/doctools/mpexpand.html">mpexpand</a></b>, yet still as easy to use; definitely
easier than <b class="syscmd">dtp</b> with its myriad of subcommands and options.</p>
<p><b class="syscmd">dtplite</b> is based upon the package <b class="package"><a href="../modules/doctools/doctools.html">doctools</a></b>, like
the other two processors.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">USE CASES</a></h3>
<p><b class="syscmd">dtplite</b> was written with the following three use cases in
mind.</p>
<ol class="enumerated">
<li><p>Validation of a single document, i.e. checking that it was written in
valid doctools format. This mode can also be used to get a preliminary
version of the formatted output for a single document, for display in
a browser, nroff, etc., allowing proofreading of the formatting.</p></li>
<li><p>Generation of the formatted documentation for a single package,
i.e. all the manpages, plus a table of contents and an index of
keywords.</p></li>
<li><p>An extension of the previous mode of operation, a method for the easy
generation of one documentation tree for several packages, and
especially of a unified table of contents and keyword index.</p></li>
</ol>
<p>Beyond the above we also want to make use of the customization
features provided by the HTML formatter. It is not the only format the
application should be able to generate, but we anticipiate it to be
the most commonly used, and it is one of the few which do provide
customization hooks.</p>
<p>We allow the caller to specify a header string, footer string, a
stylesheet, and data for a bar of navigation links at the top of the
generated document.
While all can be set as long as the formatting engine provides an
appropriate engine parameter (See section <span class="sectref"><a href="#subsection3">OPTIONS</a></span>) the last
two have internal processing which make them specific to HTML.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">COMMAND LINE</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">dtplite</b> <b class="option">-o</b> <i class="arg">output</i> <span class="opt">?options?</span> <i class="arg">format</i> <i class="arg">inputfile</i></a></dt>
<dd><p>This is the form for use case [1]. The <i class="arg">options</i> will be
explained later, in section <span class="sectref"><a href="#subsection3">OPTIONS</a></span>.</p>
<dl class="arguments">
<dt>path <i class="arg">output</i> (in)</dt>
<dd><p>This argument specifies where to write the generated document. It can
be the path to a file or directory, or <b class="const">-</b>.
The last value causes the application to write the generated
documented to <b class="const">stdout</b>.</p>
<p>If the <i class="arg">output</i> does not exist then [file dirname $output]
has to exist and must be a writable directory.
The generated document will be written to a file in that directory,
and the name of that file will be derived from the <i class="arg">inputfile</i>,
the <i class="arg">format</i>, and the value given to option <b class="option">-ext</b> (if
present).</p></dd>
<dt>(path|handle) <i class="arg">format</i> (in)</dt>
<dd><p>This argument specifies the formatting engine to use when processing
the input, and thus the format of the generated document. See section
<span class="sectref"><a href="#subsection4">FORMATS</a></span> for the possibilities recognized by the application.</p></dd>
<dt>path <i class="arg">inputfile</i> (in)</dt>
<dd><p>This argument specifies the path to the file to process. It has to
exist, must be readable, and written in <i class="term"><a href="../../../index.html#key51">doctools</a></i> format.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">dtplite</b> <b class="const">validate</b> <i class="arg">inputfile</i></a></dt>
<dd><p>This is a simpler form for use case [1]. The &quot;validate&quot; format
generates no output at all, only syntax checks are performed. As such
the specification of an output file or other options is not necessary
and left out.</p></dd>
<dt><a name="3"><b class="cmd">dtplite</b> <b class="option">-o</b> <i class="arg">output</i> <span class="opt">?options?</span> <i class="arg">format</i> <i class="arg">inputdirectory</i></a></dt>
<dd><p>This is the form for use case [2]. It differs from the form for
use case [1] by having the input documents specified through a
directory instead of a file. The other arguments are identical, except
for <i class="arg">output</i>, which now has to be the path to an existing and
writable directory.</p>
<p>The input documents are all files in <i class="arg">inputdirectory</i> or any of
its subdirectories which were recognized by <b class="cmd">fileutil::fileType</b>
as containing text in <i class="term"><a href="../../../index.html#key51">doctools</a></i> format.</p></dd>
<dt><a name="4"><b class="cmd">dtplite</b> <b class="option">-merge</b> <b class="option">-o</b> <i class="arg">output</i> <span class="opt">?options?</span> <i class="arg">format</i> <i class="arg">inputdirectory</i></a></dt>
<dd><p>This is the form for use case [3]. The only difference to the
form for use case [2] is the additional option <b class="option">-merge</b>.</p>
<p>Each such call will merge the generated documents coming from
processing the input documents under <i class="arg">inputdirectory</i> or any of
its subdirectories to the files under <i class="arg">output</i>. In this manner it
is possible to incrementally build the unified documentation for any
number of packages. Note that it is necessary to run through all the
packages twice to get fully correct cross-references (for formats
supporting them).</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OPTIONS</a></h3>
<p>This section describes all the options available to the user of the
application, with
the exception of the options <b class="option">-o</b> and <b class="option">-merge</b>. These
two were described already, in section <span class="sectref"><a href="#subsection2">COMMAND LINE</a></span>.</p>
<dl class="options">
<dt><b class="option">-exclude</b> string</dt>
<dd><p>This option specifies an exclude (glob) pattern. Any files identified
as manpages to process which match the exclude pattern are
ignored. The option can be provided multiple times, each usage adding
an additional pattern to the list of exclusions.</p></dd>
<dt><b class="option">-ext</b> string</dt>
<dd><p>If the name of an output file has to be derived from the name of an
input file it will use the name of the <i class="arg">format</i> as the extension
by default. This option here will override this however, forcing it to
use <i class="arg">string</i> as the file extension. This option is ignored if the
name of the output file is fully specified through option <b class="option">-o</b>.</p>
<p>When used multiple times only the last definition is relevant.</p></dd>
<dt><b class="option">-header</b> file</dt>
<dd><p>This option can be used if and only if the selected <i class="arg">format</i>
provides an engine parameter named &quot;header&quot;. It takes the contents of
the specified file and assign them to that parameter, for whatever use
by the engine. The HTML engine will insert the text just after the tag
<b class="const">&lt;body&gt;</b>.
If navigation buttons are present (see option <b class="option">-nav</b> below),
then the HTML generated for them is appended to the header data
originating here before the final assignment to the parameter.</p>
<p>When used multiple times only the last definition is relevant.</p></dd>
<dt><b class="option">-footer</b> file</dt>
<dd><p>Like <b class="option">-header</b>, except that: Any navigation buttons are ignored,
the corresponding required engine parameter is named &quot;footer&quot;, and the
data is inserted just before the tag <b class="const">&lt;/body&gt;</b>.</p>
<p>When used multiple times only the last definition is relevant.</p></dd>
<dt><b class="option">-style</b> file</dt>
<dd><p>This option can be used if and only if the selected <i class="arg">format</i>
provides an engine parameter named &quot;meta&quot;. When specified it will
generate a piece of HTML code declaring the <i class="arg">file</i> as the
stylesheet for the generated document and assign that to the
parameter. The HTML engine will insert this inot the document, just
after the tag <b class="const">&lt;head&gt;</b>.</p>
<p>When processing an input directory the stylesheet file is copied into
the output directory and the generated HTML will refer to the copy, to
make the result more self-contained. When processing an input file we
have no location to copy the stylesheet to and so just reference it as
specified.</p>
<p>When used multiple times only the last definition is relevant.</p></dd>
<dt><b class="option">-toc</b> path</dt>
<dd><p>This option specifies a doctoc file to use for the table of contents
instead of generating our own.</p>
<p>When used multiple times only the last definition is relevant.</p></dd>
<dt><b class="option">-nav</b> label url</dt>
<dd><p>Use this option to specify a navigation button with <i class="arg">label</i> to
display and the <i class="arg">url</i> to link to. This option can be used if and
only if the selected <i class="arg">format</i> provides an engine parameter named
&quot;header&quot;. The HTML generated for this is appended to whatever data we
got from option <b class="option">-header</b> before it is inserted into the
generated documents.</p>
<p>When used multiple times all definitions are collected and a
navigation bar is created, with the first definition shown at the left
edge and the last definition to the right.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">FORMATS</a></h3>
<p>At first the <i class="arg">format</i> argument will be treated as a path to a tcl
file containing the code for the requested formatting engine. The
argument will be treated as the name of one of the predefined formats
listed below if and only if the path does not exist.</p>
<p><em>Note a limitation</em>: If treating the format as path to the tcl
script implementing the engine was sucessful, then this script has to
implement not only the engine API for doctools, i.e.
<i class="term">doctools_api</i>, but for <i class="term">doctoc_api</i> and <i class="term">docidx_api</i>
as well. Otherwise the generation of a table of contents and of a
keyword index will fail.</p>
<p>List of predefined formats, i.e. as provided by the
package <b class="package"><a href="../modules/doctools/doctools.html">doctools</a></b>:</p>
<dl class="definitions">
<dt><b class="const">nroff</b></dt>
<dd><p>The processor generates *roff output, the standard format for unix
manpages.</p></dd>
<dt><b class="const">html</b></dt>
<dd><p>The processor generates HTML output, for usage in and display by web
browsers. This engine is currently the only one providing the various
engine parameters required for the additional customaization of the
output.</p></dd>
<dt><b class="const">tmml</b></dt>
<dd><p>The processor generates TMML output, the Tcl Manpage Markup Language,
a derivative of XML.</p></dd>
<dt><b class="const">latex</b></dt>
<dd><p>The processor generates LaTeX output.</p></dd>
<dt><b class="const">wiki</b></dt>
<dd><p>The processor generates Wiki markup as understood by <b class="syscmd">wikit</b>.</p></dd>
<dt><b class="const">list</b></dt>
<dd><p>The processor extracts the information provided by <b class="cmd">manpage_begin</b>.
This format is used internally to extract the meta data from which
both table of contents and keyword index are derived from.</p></dd>
<dt><b class="const">null</b></dt>
<dd><p>The processor does not generate any output. This is equivalent to
<b class="const">validate</b>.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">DIRECTORY STRUCTURES</a></h3>
<p>In this section we describe the directory structures generated by the
application under <i class="arg">output</i> when processing all documents in an
<i class="arg">inputdirectory</i>. In other words, this is only relevant to the use
cases [2] and [3].</p>
<dl class="definitions">
<dt>[2]</dt>
<dd><p>The following directory structure is created when processing a single
set of input documents.  The file extension used is for output in
HTML, but that is not relevant to the structure and was just used to
have proper file names.</p>
<pre class="example">
    output/
        toc.html
        index.html
        files/
            path/to/FOO.html
</pre>
<p>The last line in the example shows the document
generated for a file FOO located at</p>
<pre class="example">
    inputdirectory/path/to/FOO
</pre>
</dd>
<dt>[3]</dt>
<dd><p>When merging many packages into a unified set of documents the
generated directory structure is a bit deeper:</p>
<pre class="example">
    output
        .toc
        .idx
        .tocdoc
        .idxdoc
        .xrf
        toc.html
        index.html
        FOO1/
            ...
        FOO2/
            toc.html
            files/
                path/to/BAR.html
</pre>
<p>Each of the directories FOO1, ... contains the documents generated for
the package FOO1, ... and follows the structure shown for use case
[2]. The only exception is that there is no per-package index.</p>
<p>The files &quot;<b class="file">.toc</b>&quot;, &quot;<b class="file">.idx</b>&quot;, and &quot;<b class="file">.xrf</b>&quot; contain the
internal status of the whole output and will be read and updated by
the next invokation. Their contents will not be documented. Remove
these files when all packages wanted for the output have been
processed, i.e. when the output is complete.</p>
<p>The files &quot;<b class="file">.tocdoc</b>&quot;, and &quot;<b class="file">.idxdoc</b>&quot;, are intermediate files
in doctoc and docidx markup, respectively, containing the main table
of contents and keyword index for the set of documents before their
conversion to the chosen output format.
They are left in place, i.e. not deleted, to serve as demonstrations
of doctoc and docidx markup.</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
application and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../modules/doctools/docidx_intro.html">docidx introduction</a>, <a href="../modules/doctools/doctoc_intro.html">doctoc introduction</a>, <a href="../modules/doctools/doctools_intro.html">doctools introduction</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../index.html#key1">HTML</a>, <a href="../../../index.html#key4">TMML</a>, <a href="../../../index.html#key3">conversion</a>, <a href="../../../index.html#key50">docidx</a>, <a href="../../../index.html#key230">doctoc</a>, <a href="../../../index.html#key51">doctools</a>, <a href="../../../index.html#key2">manpage</a>, <a href="../../../index.html#key0">markup</a>, <a href="../../../index.html#key5">nroff</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/apps/nns.html.












































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>nns - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/apps/nns.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nns.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../toc.html">Main Table Of Contents</a>
| <a href="../../toc.html">Table Of Contents</a>
| <a href="../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nns(n) 1.1 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nns - Name service facility, Commandline Client Application</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">USE CASES</a></li>
<li class="subsection"><a href="#subsection2">COMMAND LINE</a></li>
<li class="subsection"><a href="#subsection3">OPTIONS</a></li>
</ul>
</li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">nns</b> <b class="method">bind</b> <span class="opt">?<b class="option">-host</b> <i class="arg">host</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span> <i class="arg">name</i> <i class="arg">data</i></a></li>
<li><a href="#2"><b class="cmd">nns</b> <b class="method">search</b> <span class="opt">?<b class="option">-host</b> <i class="arg">host</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span> <span class="opt">?<b class="option">-continuous</b>?</span> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#3"><b class="cmd">nns</b> <b class="method">ident</b> <span class="opt">?<b class="option">-host</b> <i class="arg">host</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span></a></li>
<li><a href="#4"><b class="cmd">nns</b> <b class="method">who</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Please read <i class="term"><a href="../modules/nns/nns_intro.html">Name service facility, introduction</a></i> first.</p>
<p>The application described by this document, <b class="syscmd">nns</b>, is a simple
command line client for the nano name service facility provided by the
Tcllib packages <b class="package"><a href="../modules/nns/nns_client.html">nameserv</a></b>, and <b class="package"><a href="../modules/nns/nns_server.html">nameserv::server</a></b>.
Beyond that the application's sources also serve as an example of how
to use the client package <b class="package"><a href="../modules/nns/nns_client.html">nameserv</a></b>. All abilities of a
client are covered, from configuration to registration of names to
searching.</p>
<p>This name service facility has nothing to do with the Internet's
<i class="term">Domain Name System</i>, otherwise known as <i class="term"><a href="../../../index.html#key550">DNS</a></i>. If the
reader is looking for a package dealing with that please see either of
the packages <b class="package"><a href="../modules/dns/tcllib_dns.html">dns</a></b> and <b class="package">resolv</b>, both found in Tcllib
too.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">USE CASES</a></h3>
<p><b class="syscmd">nns</b> was written with the following two main use cases in
mind.</p>
<ol class="enumerated">
<li><p>Registration of a name/data pair in the name service.</p></li>
<li><p>Searching the name service for entries matching a glob pattern.</p></li>
</ol>
<p>Beyond the above we also want to be able to identify the client, and
get information about the name service.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">COMMAND LINE</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">nns</b> <b class="method">bind</b> <span class="opt">?<b class="option">-host</b> <i class="arg">host</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span> <i class="arg">name</i> <i class="arg">data</i></a></dt>
<dd><p>This form registers the <i class="arg">name</i>/<i class="arg">data</i> pair in the specified
name service. In this form the command will <em>not</em> exit to keep
the registration alive. The user has to kill it explicitly, either by
sending a signal, or through the job-control facilities of the shell
in use. It will especially survive the loss of the connection to the
name service and reestablish the <i class="arg">name</i>/<i class="arg">data</i> pair when the
connection is restored.</p>
<p>The options to specify the name service will be explained later, in
section <span class="sectref"><a href="#subsection3">OPTIONS</a></span>.</p></dd>
<dt><a name="2"><b class="cmd">nns</b> <b class="method">search</b> <span class="opt">?<b class="option">-host</b> <i class="arg">host</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span> <span class="opt">?<b class="option">-continuous</b>?</span> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>This form searches the specified name service for entries matching the
glob-<i class="arg">pattern</i> and prints them to stdout, with each entry on its
own line. If no pattern is specified it defaults to <b class="const">*</b>,
matching everything.</p>
<p>The options to specify the name service will be explained later, in
section <span class="sectref"><a href="#subsection3">OPTIONS</a></span>.</p>
<p>If the option <b class="option">-continuous</b> is specified the client will not
exit after performing the search, but start to continuously monitor
the service for changes to the set of matching entries, appropriately
updating the display as changes arrive. In that form it will
especially also survive the loss of the connection to the name service
and reestablish the search when the connection is restored.</p></dd>
<dt><a name="3"><b class="cmd">nns</b> <b class="method">ident</b> <span class="opt">?<b class="option">-host</b> <i class="arg">host</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span></a></dt>
<dd><p>This form asks the specified name service for the version and features
of the name service protocol it supports and prints the results to
stdout.</p>
<p>The options to specify the name service will be explained later, in
section <span class="sectref"><a href="#subsection3">OPTIONS</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">nns</b> <b class="method">who</b></a></dt>
<dd><p>This form prints name, version, and protocol version of the
application to stdout.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OPTIONS</a></h3>
<p>This section describes all the options available to the user of the
application</p>
<dl class="options">
<dt><b class="option">-host</b> name|ipaddress</dt>
<dd><p>If this option is not specified it defaults to <b class="const">localhost</b>. It
specifies the name or ip-address of the host the name service to talk
to is running on.</p></dd>
<dt><b class="option">-port</b> number</dt>
<dd><p>If this option is not specified it defaults to <b class="const">38573</b>. It
specifies the TCP port the name service to talk to is listening on for
requests.</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
application and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../modules/nns/nns_client.html">nameserv(n)</a>, <a href="../modules/nns/nns_common.html">nameserv::common(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../index.html#key28">application</a>, <a href="../../../index.html#key30">client</a>, <a href="../../../index.html#key29">name service</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/apps/nnsd.html.












































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>nnsd - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/apps/nnsd.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nnsd.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../toc.html">Main Table Of Contents</a>
| <a href="../../toc.html">Table Of Contents</a>
| <a href="../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nnsd(n) 1.0.1 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nnsd - Name service facility, Commandline Server Application</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">USE CASES</a></li>
<li class="subsection"><a href="#subsection2">COMMAND LINE</a></li>
<li class="subsection"><a href="#subsection3">OPTIONS</a></li>
</ul>
</li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">nnsd</b> <span class="opt">?<b class="option">-localonly</b> <i class="arg">flag</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Please read <i class="term"><a href="../modules/nns/nns_intro.html">Name service facility, introduction</a></i> first.</p>
<p>The application described by this document, <b class="syscmd"><a href="nns.html">nns</a></b>, is a simple
command line server for the nano name service facility provided by the
Tcllib packages <b class="package"><a href="../modules/nns/nns_client.html">nameserv</a></b>, and <b class="package"><a href="../modules/nns/nns_server.html">nameserv::server</a></b>.
Beyond that the application's sources also serve as an example of how
to use the server package <b class="package"><a href="../modules/nns/nns_server.html">nameserv::server</a></b>.</p>
<p>This name service facility has nothing to do with the Internet's
<i class="term">Domain Name System</i>, otherwise known as <i class="term"><a href="../../../index.html#key550">DNS</a></i>. If the
reader is looking for a package dealing with that please see either of
the packages <b class="package"><a href="../modules/dns/tcllib_dns.html">dns</a></b> and <b class="package">resolv</b>, both found in Tcllib
too.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">USE CASES</a></h3>
<p><b class="syscmd">nnsd</b> was written with the following main use case in
mind.</p>
<ol class="enumerated">
<li><p>Run a nano name service on some host.</p></li>
</ol>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">COMMAND LINE</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">nnsd</b> <span class="opt">?<b class="option">-localonly</b> <i class="arg">flag</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span></a></dt>
<dd><p>The command configures a server per the specified options and starts
it. The command will not exit on its, as it keeps the name service
database wholly in memory. The user has to kill it explicitly, eithre
by sending a a signal, or through the job-control facilities of the
shell in use.</p>
<p>The options to configure the name service are explained in section
<span class="sectref"><a href="#subsection3">OPTIONS</a></span>.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OPTIONS</a></h3>
<p>This section describes all the options available to the user of the
application</p>
<dl class="options">
<dt><b class="option">-localonly</b> bool</dt>
<dd><p>If this option is not specified it defaults to <b class="const">true</b>, i.e.
acceptance of only local connections. The server will accept remote
connections, i.e. connections from other hosts, if and only if this
option is configured to <b class="const">false</b>.</p></dd>
<dt><b class="option">-port</b> number</dt>
<dd><p>If this option is not specified it defaults to <b class="const">38573</b>. It
specifies the TCP port the server has to listen on for requests.</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
application and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../modules/nns/nns_common.html">nameserv::common(n)</a>, <a href="../modules/nns/nns_server.html">nameserv::server(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../index.html#key28">application</a>, <a href="../../../index.html#key29">name service</a>, <a href="../../../index.html#key57">server</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/apps/nnslog.html.















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>nnslog - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/apps/nnslog.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nnslog.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../toc.html">Main Table Of Contents</a>
| <a href="../../toc.html">Table Of Contents</a>
| <a href="../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nnslog(n) 1.0 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nnslog - Name service facility, Commandline Logging Client Application</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">USE CASES</a></li>
<li class="subsection"><a href="#subsection2">COMMAND LINE</a></li>
<li class="subsection"><a href="#subsection3">OPTIONS</a></li>
</ul>
</li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">nnslog</b> <span class="opt">?<b class="option">-host</b> <i class="arg">host</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Please read <i class="term"><a href="../modules/nns/nns_intro.html">Name service facility, introduction</a></i> first.</p>
<p>The application described by this document, <b class="syscmd">nnslog</b>, is a
simple command line client for the nano name service facility provided
by the Tcllib packages <b class="package"><a href="../modules/nns/nns_client.html">nameserv</a></b>, and <b class="package"><a href="../modules/nns/nns_server.html">nameserv::server</a></b>.</p>
<p>It essentially implements &quot;<b class="syscmd"><a href="nns.html">nns</a></b> search -continuous *&quot;, but
uses a different output formatting. Instead of continuously showing
the current contents of the server in the terminal it simply logs all
received add/remove events to <b class="const">stdout</b>.</p>
<p>This name service facility has nothing to do with the Internet's
<i class="term">Domain Name System</i>, otherwise known as <i class="term"><a href="../../../index.html#key550">DNS</a></i>. If the
reader is looking for a package dealing with that please see either of
the packages <b class="package"><a href="../modules/dns/tcllib_dns.html">dns</a></b> and <b class="package">resolv</b>, both found in Tcllib
too.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">USE CASES</a></h3>
<p><b class="syscmd">nnslog</b> was written with the following main use case in mind.</p>
<ol class="enumerated">
<li><p>Monitoring the name service for all changes and logging them in a text
terminal.</p></li>
</ol>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">COMMAND LINE</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">nnslog</b> <span class="opt">?<b class="option">-host</b> <i class="arg">host</i>?</span> <span class="opt">?<b class="option">-port</b> <i class="arg">port</i>?</span></a></dt>
<dd><p>The command connects to the specified name service, sets up a search
for all changes and then prints all received events to stdout, with
each events on its own line. The command will not exit until it is
explicitly terminated by the user. It will especially survive the loss
of the connection to the name service and reestablish the search and
log when the connection is restored.</p>
<p>The options to specify the name service will be explained later, in
section <span class="sectref"><a href="#subsection3">OPTIONS</a></span>.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OPTIONS</a></h3>
<p>This section describes all the options available to the user of the
application</p>
<dl class="options">
<dt><b class="option">-host</b> name|ipaddress</dt>
<dd><p>If this option is not specified it defaults to <b class="const">localhost</b>. It
specifies the name or ip-address of the host the name service to talk
to is running on.</p></dd>
<dt><b class="option">-port</b> number</dt>
<dd><p>If this option is not specified it defaults to <b class="const">38573</b>. It
specifies the TCP port the name service to talk to is listening on for
requests.</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
application and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../modules/nns/nns_client.html">nameserv(n)</a>, <a href="../modules/nns/nns_common.html">nameserv::common(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../index.html#key28">application</a>, <a href="../../../index.html#key30">client</a>, <a href="../../../index.html#key29">name service</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/apps/page.html.


























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>page - Development Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/apps/page.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ page.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../toc.html">Main Table Of Contents</a>
| <a href="../../toc.html">Table Of Contents</a>
| <a href="../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">page(n) 1.0 tcllib &quot;Development Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>page - Parser Generator</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">COMMAND LINE</a></li>
<li class="subsection"><a href="#subsection2">OPERATION</a></li>
<li class="subsection"><a href="#subsection3">OPTIONS</a></li>
<li class="subsection"><a href="#subsection4">PLUGINS</a></li>
<li class="subsection"><a href="#subsection5">PLUGIN LOCATIONS</a></li>
</ul>
</li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">page</b> <span class="opt">?<i class="arg">options</i>...?</span> <span class="opt">?<i class="arg">input</i> <span class="opt">?<i class="arg">output</i>?</span>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The application described by this document, <b class="syscmd">page</b>, is actually
not just a parser generator, as the name implies, but a generic tool
for the execution of arbitrary transformations on texts.</p>
<p>Its genericity comes through the use of <i class="term">plugins</i> for reading,
transforming, and writing data, and the predefined set of plugins
provided by Tcllib is for the generation of memoizing recursive
descent parsers (aka <i class="term">packrat parsers</i>) from grammar
specifications (<i class="term">Parsing Expression Grammars</i>).</p>
<p><b class="syscmd">page</b> is written on top of the package
<b class="package">page::pluginmgr</b>, wrapping its functionality into a command
line based application. All the other <b class="package">page::*</b> packages are
plugin and/or supporting packages for the generation of parsers. The
parsers themselves are based on the packages <b class="package"><a href="../modules/grammar_peg/peg.html">grammar::peg</a></b>,
<b class="package"><a href="../modules/grammar_peg/peg_interp.html">grammar::peg::interp</a></b>, and <b class="package">grammar::mengine</b>.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">COMMAND LINE</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">page</b> <span class="opt">?<i class="arg">options</i>...?</span> <span class="opt">?<i class="arg">input</i> <span class="opt">?<i class="arg">output</i>?</span>?</span></a></dt>
<dd><p>This is general form for calling <b class="syscmd">page</b>. The application will
read the contents of the file <i class="arg">input</i>, process them under the
control of the specified <i class="arg">options</i>, and then write the result to
the file <i class="arg">output</i>.</p>
<p>If <i class="arg">input</i> is the string <b class="const">-</b> the data to process will be
read from <b class="const">stdin</b> instead of a file. Analogously the result will
be written to <b class="const">stdout</b> instead of a file if <i class="arg">output</i> is the
string <b class="const">-</b>. A missing output or input specification causes the
application to assume <b class="const">-</b>.</p>
<p>The detailed specifications of the recognized <i class="arg">options</i> are
provided in section <span class="sectref"><a href="#subsection3">OPTIONS</a></span>.</p>
<dl class="arguments">
<dt>path <i class="arg">input</i> (in)</dt>
<dd><p>This argument specifies the path to the file to be processed by the
application, or <b class="const">-</b>. The last value causes the application to
read the text from <b class="const">stdin</b>. Otherwise it has to exist, and be
readable. If the argument is missing <b class="const">-</b> is assumed.</p></dd>
<dt>path <i class="arg">output</i> (in)</dt>
<dd><p>This argument specifies where to write the generated text. It can be
the path to a file, or <b class="const">-</b>. The last value causes the
application to write the generated documented to <b class="const">stdout</b>.</p>
<p>If the file <i class="arg">output</i> does not exist then
[file dirname $output] has to exist and must be a writable
directory, as the application will create the fileto write to.</p>
<p>If the argument is missing <b class="const">-</b> is assumed.</p></dd>
</dl></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">OPERATION</a></h3>
<p>... reading ... transforming ... writing - plugins - pipeline ...</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OPTIONS</a></h3>
<p>This section describes all the options available to the user of the
application. Options are always processed in order. I.e. of both
<b class="option">--help</b> and <b class="option">--version</b> are specified the option
encountered first has precedence.</p>
<p>Unknown options specified before any of the options <b class="option">-rd</b>,
<b class="option">-wr</b>, or <b class="option">-tr</b> will cause processing to abort with an
error. Unknown options coming in between these options, or after the
last of them are assumed to always take a single argument and are
associated with the last plugin option coming before them. They will
be checked after all the relevant plugins, and thus the options they
understand, are known. I.e. such unknown options cause error if and
only if the plugin option they are associated with does not understand
them, and was not superceded by a plugin option coming after.</p>
<p>Default options are used if and only if the command line did not
contain any options at all. They will set the application up as a
PEG-based parser generator. The exact list of options is</p>
<pre class="example">-c peg</pre>
<p>And now the recognized options and their arguments, if they have any:</p>
<dl class="options">
<dt><b class="option">--help</b></dt>
<dd></dd>
<dt><b class="option">-h</b></dt>
<dd></dd>
<dt><b class="option">-?</b></dt>
<dd><p>When one of these options is found on the command line all arguments
coming before or after are ignored. The application will print a short
description of the recognized options and exit.</p></dd>
<dt><b class="option">--version</b></dt>
<dd></dd>
<dt><b class="option">-V</b></dt>
<dd><p>When one of these options is found on the command line all arguments
coming before or after are ignored. The application will print its
own revision and exit.</p></dd>
<dt><b class="option">-P</b></dt>
<dd><p>This option signals the application to activate visual feedback while
reading the input.</p></dd>
<dt><b class="option">-T</b></dt>
<dd><p>This option signals the application to collect statistics while
reading the input and to print them after reading has completed,
before processing started.</p></dd>
<dt><b class="option">-D</b></dt>
<dd><p>This option signals the application to activate logging in the Safe
base, for the debugging of problems with plugins.</p></dd>
<dt><b class="option">-r</b> parser</dt>
<dd></dd>
<dt><b class="option">-rd</b> parser</dt>
<dd></dd>
<dt><b class="option">--reader</b> parser</dt>
<dd><p>These options specify the plugin the application has to use for
reading the <i class="arg">input</i>. If the options are used multiple times the
last one will be used.</p></dd>
<dt><b class="option">-w</b> generator</dt>
<dd></dd>
<dt><b class="option">-wr</b> generator</dt>
<dd></dd>
<dt><b class="option">--writer</b> generator</dt>
<dd><p>These options specify the plugin the application has to use for
generating and writing the final <i class="arg">output</i>. If the options are used
multiple times the last one will be used.</p></dd>
<dt><b class="option">-t</b> process</dt>
<dd></dd>
<dt><b class="option">-tr</b> process</dt>
<dd></dd>
<dt><b class="option">--transform</b> process</dt>
<dd><p>These options specify a plugin to run on the input. In contrast to
readers and writers each use will <em>not</em> supersede previous
uses, but add each chosen plugin to a list of transformations, either
at the front, or the end, per the last seen use of either option
<b class="option">-p</b> or <b class="option">-a</b>. The initial default is to append the new
transformations.</p></dd>
<dt><b class="option">-a</b></dt>
<dd></dd>
<dt><b class="option">--append</b></dt>
<dd><p>These options signal the application that all following
transformations should be added at the end of the list of
transformations.</p></dd>
<dt><b class="option">-p</b></dt>
<dd></dd>
<dt><b class="option">--prepend</b></dt>
<dd><p>These options signal the application that all following
transformations should be added at the beginning of the list of
transformations.</p></dd>
<dt><b class="option">--reset</b></dt>
<dd><p>This option signals the application to clear the list of
transformations. This is necessary to wipe out the default
transformations used.</p></dd>
<dt><b class="option">-c</b> file</dt>
<dd></dd>
<dt><b class="option">--configuration</b> file</dt>
<dd><p>This option causes the application to load a configuration file and/or
plugin. This is a plugin which in essence provides a pre-defined set
of commandline options. They are processed exactly as if they have
been specified in place of the option and its arguments. This means
that unknown options found at the beginning of the configuration file
are associated with the last plugin, even if that plugin was specified
before the configuration file itself. Conversely, unknown options
coming after the configuration file can be associated with a plugin
specified in the file.</p>
<p>If the argument is a file which cannot be loaded as a plugin the
application will assume that its contents are a list of options and
their arguments, separated by space, tabs, and newlines. Options and
argumentes containing spaces can be quoted via double-quotes (&quot;) and
quotes ('). The quote character can be specified within in a quoted
string by doubling it. Newlines in a quoted string are accepted as is.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">PLUGINS</a></h3>
<p><b class="syscmd">page</b> makes use of four different types of plugins, namely:
readers, writers, transformations, and configurations. Here we provide
only a basic introduction on how to use them from <b class="syscmd">page</b>. The
exact APIs provided to and expected from the plugins can be found in
the documentation for <b class="package">page::pluginmgr</b>, for those who wish to
write their own plugins.</p>
<p>Plugins are specified as arguments to the options <b class="option">-r</b>,
<b class="option">-w</b>, <b class="option">-t</b>, <b class="option">-c</b>, and their equivalent longer
forms. See the section <span class="sectref"><a href="#subsection3">OPTIONS</a></span> for reference.</p>
<p>Each such argument will be first treated as the name of a file and
this file is loaded as the plugin. If however there is no file with
that name, then it will be translated into the name of a package, and
this package is then loaded. For each type of plugins the package
management searches not only the regular paths, but a set application-
and type-specific paths as well. Please see the section
<span class="sectref"><a href="#subsection5">PLUGIN LOCATIONS</a></span> for a listing of all paths and their
sources.</p>
<dl class="definitions">
<dt><b class="option">-c</b> <i class="arg">name</i></dt>
<dd><p>Configurations. The name of the package for the plugin <i class="arg">name</i> is
&quot;page::config::<i class="arg">name</i>&quot;.</p>
<p>We have one predefined plugin:</p>
<dl class="definitions">
<dt><em>peg</em></dt>
<dd><p>It sets the application up as a parser generator accepting parsing
expression grammars and writing a packrat parser in Tcl. The actual
arguments it specifies are:</p>
<pre class="example">
	--reset
	--append
	--reader    peg
	--transform reach
	--transform use
	--writer    me
</pre>
</dd>
</dl></dd>
<dt><b class="option">-r</b> <i class="arg">name</i></dt>
<dd><p>Readers. The name of the package for the plugin <i class="arg">name</i> is
&quot;page::reader::<i class="arg">name</i>&quot;.</p>
<p>We have five predefined plugins:</p>
<dl class="definitions">
<dt><em>peg</em></dt>
<dd><p>Interprets the input as a parsing expression grammar (<i class="term"><a href="../../../index.html#key12">PEG</a></i>) and
generates a tree representation for it. Both the syntax of PEGs and
the structure of the tree representation are explained in their own
manpages.</p></dd>
<dt><em>hb</em></dt>
<dd><p>Interprets the input as Tcl code as generated by the writer plugin
<em>hb</em> and generates its tree representation.</p></dd>
<dt><em>ser</em></dt>
<dd><p>Interprets the input as the serialization of a PEG, as generated by
the writer plugin <em>ser</em>, using the package
<b class="package"><a href="../modules/grammar_peg/peg.html">grammar::peg</a></b>.</p></dd>
<dt><em>lemon</em></dt>
<dd><p>Interprets the input as a grammar specification as understood by
Richard Hipp's <i class="term"><a href="../../../index.html#key180">LEMON</a></i> parser generator and generates a tree
representation for it. Both the input syntax and the structure of the
tree representation are explained in their own manpages.</p></dd>
<dt><em>treeser</em></dt>
<dd><p>Interprets the input as the serialization of a
<b class="package"><a href="../modules/struct/struct_tree.html">struct::tree</a></b>. It is validated as such,
but nothing else. It is <em>not</em> assumed to
be the tree representation of a grammar.</p></dd>
</dl></dd>
<dt><b class="option">-w</b> <i class="arg">name</i></dt>
<dd><p>Writers. The name of the package for the plugin <i class="arg">name</i> is
&quot;page::writer::<i class="arg">name</i>&quot;.</p>
<p>We have eight predefined plugins:</p>
<dl class="definitions">
<dt><em>identity</em></dt>
<dd><p>Simply writes the incoming data as it is, without making any
changes. This is good for inspecting the raw result of a reader or
transformation.</p></dd>
<dt><em>null</em></dt>
<dd><p>Generates nothing, and ignores the incoming data structure.</p></dd>
<dt><em>tree</em></dt>
<dd><p>Assumes that the incoming data structure is a <b class="package"><a href="../modules/struct/struct_tree.html">struct::tree</a></b>
and generates an indented textual representation of all nodes, their
parental relationships, and their attribute information.</p></dd>
<dt><em>peg</em></dt>
<dd><p>Assumes that the incoming data structure is a tree representation of a
<i class="term"><a href="../../../index.html#key12">PEG</a></i> or other other grammar and writes it out as a PEG. The
result is nicely formatted and partially simplified (strings as
sequences of characters). A pretty printer in essence, but can also be
used to obtain a canonical representation of the input grammar.</p></dd>
<dt><em>tpc</em></dt>
<dd><p>Assumes that the incoming data structure is a tree representation of a
<i class="term"><a href="../../../index.html#key12">PEG</a></i> or other other grammar and writes out Tcl code defining a
package which defines a <b class="package"><a href="../modules/grammar_peg/peg.html">grammar::peg</a></b> object containing the
grammar when it is loaded into an interpreter.</p></dd>
<dt><em>hb</em></dt>
<dd><p>This is like the writer plugin <em>tpc</em>, but it writes only the
statements which define stat expression and grammar rules. The code
making the result a package is left out.</p></dd>
<dt><em>ser</em></dt>
<dd><p>Assumes that the incoming data structure is a tree representation of a
<i class="term"><a href="../../../index.html#key12">PEG</a></i> or other other grammar, transforms it internally into a
<b class="package"><a href="../modules/grammar_peg/peg.html">grammar::peg</a></b> object and writes out its serialization.</p></dd>
<dt><em>me</em></dt>
<dd><p>Assumes that the incoming data structure is a tree representation of a
<i class="term"><a href="../../../index.html#key12">PEG</a></i> or other other grammar and writes out Tcl code defining a
package which implements a memoizing recursive descent parser based on
the match engine (ME) provided by the package <b class="package">grammar::mengine</b>.</p></dd>
</dl></dd>
<dt><b class="option">-t</b> <i class="arg">name</i></dt>
<dd><p>Transformers. The name of the package for the plugin <i class="arg">name</i> is
&quot;page::transform::<i class="arg">name</i>&quot;.</p>
<p>We have two predefined plugins:</p>
<dl class="definitions">
<dt><em>reach</em></dt>
<dd><p>Assumes that the incoming data structure is a tree representation of a
<i class="term"><a href="../../../index.html#key12">PEG</a></i> or other other grammar. It determines which nonterminal
symbols and rules are reachable from start-symbol/expression. All
nonterminal symbols which were not reached are removed.</p></dd>
<dt><em>use</em></dt>
<dd><p>Assumes that the incoming data structure is a tree representation of a
<i class="term"><a href="../../../index.html#key12">PEG</a></i> or other other grammar. It determines which nonterminal
symbols and rules are able to generate a <em>finite</em> sequences of
terminal symbols (in the sense for a Context Free Grammar). All
nonterminal symbols which were not deemed useful in this sense are
removed.</p></dd>
</dl></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">PLUGIN LOCATIONS</a></h3>
<p>The application-specific paths searched by <b class="syscmd">page</b> either are,
or come from:</p>
<ol class="enumerated">
<li><p>The directory            &quot;<b class="file">~/.page/plugin</b>&quot;</p></li>
<li><p>The environment variable <i class="term">PAGE_PLUGINS</i></p></li>
<li><p>The registry entry       <i class="term">HKEY_LOCAL_MACHINE\SOFTWARE\PAGE\PLUGINS</i></p></li>
<li><p>The registry entry       <i class="term">HKEY_CURRENT_USER\SOFTWARE\PAGE\PLUGINS</i></p></li>
</ol>
<p>The type-specific paths searched by <b class="syscmd">page</b> either are, or come
from:</p>
<ol class="enumerated">
<li><p>The directory            &quot;<b class="file">~/.page/plugin/&lt;TYPE&gt;</b>&quot;</p></li>
<li><p>The environment variable <i class="term">PAGE_&lt;TYPE&gt;_PLUGINS</i></p></li>
<li><p>The registry entry       <i class="term">HKEY_LOCAL_MACHINE\SOFTWARE\PAGE\&lt;TYPE&gt;\PLUGINS</i></p></li>
<li><p>The registry entry       <i class="term">HKEY_CURRENT_USER\SOFTWARE\PAGE\&lt;TYPE&gt;\PLUGINS</i></p></li>
</ol>
<p>Where the placeholder <i class="term">&lt;TYPE&gt;</i> is always one of the values below,
properly capitalized.</p>
<ol class="enumerated">
<li><p>reader</p></li>
<li><p>writer</p></li>
<li><p>transform</p></li>
<li><p>config</p></li>
</ol>
<p>The registry entries are specific to the Windows(tm) platform, all
other platforms will ignore them.</p>
<p>The contents of both environment variables and registry entries are
interpreted as a list of paths, with the elements separated by either
colon (Unix), or semicolon (Windows).</p>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category <em>page</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
application and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>page::pluginmgr</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../index.html#key175">parser generator</a>, <a href="../../../index.html#key178">text processing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Page Parser Generator</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/apps/tcldocstrip.html.





















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcldocstrip - Textprocessing toolbox</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/apps/tcldocstrip.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcldocstrip.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../toc.html">Main Table Of Contents</a>
| <a href="../../toc.html">Table Of Contents</a>
| <a href="../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcldocstrip(n) 1.0 tcllib &quot;Textprocessing toolbox&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcldocstrip - Tcl-based Docstrip Processor</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">USE CASES</a></li>
<li class="subsection"><a href="#subsection2">COMMAND LINE</a></li>
<li class="subsection"><a href="#subsection3">OPTIONS</a></li>
</ul>
</li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">tcldocstrip</b> <i class="arg">output</i> <span class="opt">?options?</span> <i class="arg">input</i> <span class="opt">?<i class="arg">guards</i>?</span></a></li>
<li><a href="#2"><b class="cmd">tcldocstrip</b> <span class="opt">?options?</span> <i class="arg">output</i> (<span class="opt">?options?</span> <i class="arg">input</i> <i class="arg">guards</i>)...</a></li>
<li><a href="#3"><b class="cmd">tcldocstrip</b> <b class="option">-guards</b> <i class="arg">input</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The application described by this document, <b class="syscmd">tcldocstrip</b>, is a
relative of <b class="syscmd"><a href="../modules/docstrip/docstrip.html">docstrip</a></b>, a simple literate programming tool for
LaTeX.</p>
<p><b class="syscmd">tcldocstrip</b> is based upon the package <b class="package"><a href="../modules/docstrip/docstrip.html">docstrip</a></b>.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">USE CASES</a></h3>
<p><b class="syscmd">tcldocstrip</b> was written with the following three use cases in
mind.</p>
<ol class="enumerated">
<li><p>Conversion of a single input file according to the listed guards into
the stripped output. This handles the most simple case of a set of
guards specifying a single document found in a single input file.</p></li>
<li><p>Stitching, or the assembly of an output from several sets of guards,
in a specific order, and possibly from different files. This is the
second common case. One document spread over several inputs, and/or
spread over different guard sets.</p></li>
<li><p>Extraction and listing of all the unique guard expressions and guards
used within a document to help a person which did not author the
document in question in familiarizing itself with it.</p></li>
</ol>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">COMMAND LINE</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">tcldocstrip</b> <i class="arg">output</i> <span class="opt">?options?</span> <i class="arg">input</i> <span class="opt">?<i class="arg">guards</i>?</span></a></dt>
<dd><p>This is the form for use case [1]. It converts the <i class="arg">input</i>
file according to the specified <i class="arg">guards</i> and options. The result
is written to the named <i class="arg">output</i> file.
Usage of the string <b class="const">-</b> as the name of the output signals that
the result should be written to <b class="const">stdout</b>. The guards are
document-specific and have to be known to the caller. The
<i class="arg">options</i> will be explained later, in section <span class="sectref"><a href="#subsection3">OPTIONS</a></span>.</p>
<dl class="arguments">
<dt>path <i class="arg">output</i> (in)</dt>
<dd><p>This argument specifies where to write the generated document. It can
be the path to a file or directory, or <b class="const">-</b>.
The last value causes the application to write the generated
documented to <b class="const">stdout</b>.</p>
<p>If the <i class="arg">output</i> does not exist then [file dirname $output]
has to exist and must be a writable directory.</p></dd>
<dt>path <i class="arg">inputfile</i> (in)</dt>
<dd><p>This argument specifies the path to the file to process. It has to
exist, must be readable, and written in <i class="term"><a href="../../../index.html#key386">docstrip</a></i> format.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">tcldocstrip</b> <span class="opt">?options?</span> <i class="arg">output</i> (<span class="opt">?options?</span> <i class="arg">input</i> <i class="arg">guards</i>)...</a></dt>
<dd><p>This is the form for use case [2]. It differs from the form for
use case [1] by the possibility of having options before the
output file, which apply in general, and specifying more than one
inputfile, each with its own set of input specific options and guards.</p>
<p>It extracts data from the various <i class="arg">input</i> files, according to the
specified <i class="arg">options</i> and <i class="arg">guards</i>, and writes the result to the
given <i class="arg">output</i>, in the order of their specification on the command
line. Options specified before the output are global settings, whereas
the options specified before each input are valid only just for this
input file. Unspecified values are taken from the global settings, or
defaults. As for form [1] using the string <b class="const">-</b> as output
causes the application to write to stdout.
Using the string <b class="const">.</b> for an input file signals that the last
input file should be used again. This enables the assembly of the
output from one input file using multiple and different sets of
guards, without having to specify the full name of the file every
time.</p></dd>
<dt><a name="3"><b class="cmd">tcldocstrip</b> <b class="option">-guards</b> <i class="arg">input</i></a></dt>
<dd><p>This is the form for use case [3]. 
It determines the guards, and unique guard expressions used within the
provided <i class="arg">input</i> document. The found strings are written to
stdout, one string per line.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OPTIONS</a></h3>
<p>This section describes all the options available to the user of the
application, with the exception of the option <b class="option">-guards</b>. This
option was described already, in section <span class="sectref"><a href="#subsection2">COMMAND LINE</a></span>.</p>
<dl class="options">
<dt><b class="option">-metaprefix</b> string</dt>
<dd><p>This option is inherited from the command <b class="cmd">docstrip::extract</b>
provided by the package <b class="package"><a href="../modules/docstrip/docstrip.html">docstrip</a></b>.</p>
<p>It specifies the string by which the '%%' prefix of a metacomment line
will be replaced. Defaults to '%%'. For Tcl code this would typically
be '#'.</p></dd>
<dt><b class="option">-onerror</b> mode</dt>
<dd><p>This option is inherited from the command <b class="cmd">docstrip::extract</b>
provided by the package <b class="package"><a href="../modules/docstrip/docstrip.html">docstrip</a></b>.</p>
<p>It controls what will be done when a format error in the <i class="arg">text</i>
being processed is detected. The settings are:</p>
<dl class="definitions">
<dt><b class="const">ignore</b></dt>
<dd><p>Just ignore the error; continue as if nothing happened.</p></dd>
<dt><b class="const">puts</b></dt>
<dd><p>Write an error message to <b class="const">stderr</b>, then continue processing.</p></dd>
<dt><b class="const">throw</b></dt>
<dd><p>Throw an error. <b class="variable">::errorCode</b> is set to a list whose first element
is <b class="const">DOCSTRIP</b>, second element is the type of error, and third
element is the line number where the error is detected. This is the
default.</p></dd>
</dl></dd>
<dt><b class="option">-trimlines</b> bool</dt>
<dd><p>This option is inherited from the command <b class="cmd">docstrip::extract</b>
provided by the package <b class="package"><a href="../modules/docstrip/docstrip.html">docstrip</a></b>.</p>
<p>Controls whether <em>spaces</em> at the end of a line should be trimmed
away before the line is processed. Defaults to <b class="const">true</b>.</p></dd>
<dt><b class="option">-preamble</b> text</dt>
<dd></dd>
<dt><b class="option">-postamble</b> text</dt>
<dd></dd>
<dt><b class="option">-nopreamble</b></dt>
<dd></dd>
<dt><b class="option">-nopostamble</b></dt>
<dd><p>The -no*amble options deactivate file pre- and postambles altogether,
whereas the -*amble options specify the <em>user</em> part of the file
pre- and postambles. This part can be empty, in that case only the
standard parts are shown. This is the default.</p>
<p>Preambles, when active, are written before the actual content of a
generated file. In the same manner postambles are, when active,
written after the actual content of a generated file.</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the application it describes, will undoubtedly
contain bugs and other problems.
Please report such in the category <em>docstrip</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
application and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../modules/docstrip/docstrip.html">docstrip</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../index.html#key389">.dtx</a>, <a href="../../../index.html#key390">LaTeX</a>, <a href="../../../index.html#key3">conversion</a>, <a href="../../../index.html#key386">docstrip</a>, <a href="../../../index.html#key166">documentation</a>, <a href="../../../index.html#key387">literate programming</a>, <a href="../../../index.html#key0">markup</a>, <a href="../../../index.html#key388">source</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/aes/aes.html.










































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>aes - Advanced Encryption Standard (AES)</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/aes/aes.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005, Pat Thoyts &lt;[email protected]&gt;   -- Copyright &copy; 2012, Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ aes.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">aes(n) 1.1 tcllib &quot;Advanced Encryption Standard (AES)&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>aes - Implementation of the AES block cipher</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">MODES OF OPERATION</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">REFERENCES</a></li>
<li class="section"><a href="#section7">AUTHORS</a></li>
<li class="section"><a href="#section8">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">aes <span class="opt">?1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::aes::aes</b> <span class="opt">?<i class="arg">-mode [ecb|cbc]</i>?</span> <span class="opt">?<i class="arg">-dir [encrypt|decrypt]</i>?</span> <i class="arg">-key keydata</i> <span class="opt">?<i class="arg">-iv vector</i>?</span> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-out channel</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> [ <i class="arg">-in channel</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">data</i> ]</a></li>
<li><a href="#2"><b class="cmd">::aes::Init</b> <i class="arg">mode</i> <i class="arg">keydata</i> <i class="arg">iv</i></a></li>
<li><a href="#3"><b class="cmd">::aes::Encrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></li>
<li><a href="#4"><b class="cmd">::aes::Decrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></li>
<li><a href="#5"><b class="cmd">::aes::Reset</b> <i class="arg">Key</i> <i class="arg">iv</i></a></li>
<li><a href="#6"><b class="cmd">::aes::Final</b> <i class="arg">Key</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This is an implementation in Tcl of the Advanced Encryption Standard
(AES) as published by the U.S. National Institute of Standards and
Technology [1]. AES is a 128-bit block cipher with a variable
key size of 128, 192 or 256 bits. This implementation supports ECB and
CBC modes.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::aes::aes</b> <span class="opt">?<i class="arg">-mode [ecb|cbc]</i>?</span> <span class="opt">?<i class="arg">-dir [encrypt|decrypt]</i>?</span> <i class="arg">-key keydata</i> <span class="opt">?<i class="arg">-iv vector</i>?</span> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-out channel</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> [ <i class="arg">-in channel</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">data</i> ]</a></dt>
<dd><p>Perform the <b class="package">aes</b> algorithm on either the data provided
by the argument or on the data read from the <i class="arg">-in</i> channel. If
an <i class="arg">-out</i> channel is given then the result will be written to
this channel.</p>
<p>The <i class="arg">-key</i> option must be given. This parameter takes a binary
string of either 16, 24 or 32 bytes in length and is used to generate the 
key schedule.</p>
<p>The <i class="arg">-mode</i> and <i class="arg">-dir</i> options are optional and default to cbc
mode and encrypt respectively. The initialization vector <i class="arg">-iv</i>
takes a 16 byte binary argument which defaults to all zeros.
See <span class="sectref"><a href="#section4">MODES OF OPERATION</a></span> for more about available modes and
their uses.</p>
<p>AES is a 128-bit block cipher. This means that the data must be
provided in units that are a multiple of 16 bytes.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<p>Internal state is maintained in an opaque structure that is returned
from the <b class="cmd">Init</b> function. In ECB mode the state is not affected by
the input but for CBC mode some input dependent state is maintained
and may be reset by calling the <b class="cmd">Reset</b> function with a new
initialization vector value.</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">::aes::Init</b> <i class="arg">mode</i> <i class="arg">keydata</i> <i class="arg">iv</i></a></dt>
<dd><p>Construct a new AES key schedule using the specified key data and the
given initialization vector. The initialization vector is not used
with ECB mode but is important for CBC mode.
See <span class="sectref"><a href="#section4">MODES OF OPERATION</a></span> for details about cipher modes.</p></dd>
<dt><a name="3"><b class="cmd">::aes::Encrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></dt>
<dd><p>Use a prepared key acquired by calling <b class="cmd">Init</b> to encrypt the
provided data. The data argument should be a binary array that is a
multiple of the AES block size of 16 bytes. The result is a binary
array the same size as the input of encrypted data.</p></dd>
<dt><a name="4"><b class="cmd">::aes::Decrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></dt>
<dd><p>Decipher data using the key. Note that the same key may be used to
encrypt and decrypt data provided that the initialization vector is
reset appropriately for CBC mode.</p></dd>
<dt><a name="5"><b class="cmd">::aes::Reset</b> <i class="arg">Key</i> <i class="arg">iv</i></a></dt>
<dd><p>Reset the initialization vector. This permits the programmer to re-use
a key and avoid the cost of re-generating the key schedule where the
same key data is being used multiple times.</p></dd>
<dt><a name="6"><b class="cmd">::aes::Final</b> <i class="arg">Key</i></a></dt>
<dd><p>This should be called to clean up resources associated with <i class="arg">Key</i>.
Once this function has been called the key may not be used again.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">MODES OF OPERATION</a></h2>
<dl class="definitions">
<dt>Electronic Code Book (ECB)</dt>
<dd><p>ECB is the basic mode of all block ciphers. Each block is encrypted
independently and so identical plain text will produce identical
output when encrypted with the same key. Any encryption errors will
only affect a single block however this is vulnerable to known
plaintext attacks.</p></dd>
<dt>Cipher Block Chaining (CBC)</dt>
<dd><p>CBC mode uses the output of the last block encryption to affect the
current block. An initialization vector of the same size as the cipher
block size is used to handle the first block. The initialization
vector should be chosen randomly and transmitted as the first block of
the output. Errors in encryption affect the current block and the next
block after which the cipher will correct itself. CBC is the most
commonly used mode in software encryption. This is the default mode
of operation for this module.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<pre class="example">
% set nil_block [string repeat \\0 16]
% aes::aes -hex -mode cbc -dir encrypt -key $nil_block $nil_block
66e94bd4ef8a2c3b884cfa59ca342b2e
</pre>
<pre class="example">
set Key [aes::Init cbc $sixteen_bytes_key_data $sixteen_byte_iv]
append ciphertext [aes::Encrypt $Key $plaintext]
append ciphertext [aes::Encrypt $Key $additional_plaintext]
aes::Final $Key
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>&quot;Advanced Encryption Standard&quot;,
    Federal Information Processing Standards Publication 197, 2001
    (<a href="http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf">http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf</a>)</p></li>
</ol>
</div>
<div id="section7" class="section"><h2><a name="section7">AUTHORS</a></h2>
<p>Thorsten Schloermann, Pat Thoyts</p>
</div>
<div id="section8" class="section"><h2><a name="section8">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>aes</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../blowfish/blowfish.html">blowfish(n)</a>, <a href="../des/des.html">des(n)</a>, <a href="../md5/md5.html">md5(n)</a>, <a href="../sha1/sha1.html">sha1(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key729">aes</a>, <a href="../../../../index.html#key607">block cipher</a>, <a href="../../../../index.html#key111">data integrity</a>, <a href="../../../../index.html#key114">encryption</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005, Pat Thoyts &lt;[email protected]&gt;<br>
Copyright &copy; 2012, Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/amazon-s3/S3.html.














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>S3 - Amazon S3 Web Service Utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/amazon-s3/S3.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; Copyright 2006,2008 Darren New. All Rights Reserved. See LICENSE.TXT for terms.
   -->
<! -- CVS: $Id$ S3.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">S3(n) 1.0.0 tcllib &quot;Amazon S3 Web Service Utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>S3 - Amazon S3 Web Service Interface</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">ERROR REPORTING</a></li>
<li class="section"><a href="#section3">COMMANDS</a></li>
<li class="section"><a href="#section4">LOW LEVEL COMMANDS</a></li>
<li class="section"><a href="#section5">HIGH LEVEL COMMANDS</a></li>
<li class="section"><a href="#section6">LIMITATIONS</a></li>
<li class="section"><a href="#section7">USAGE SUGGESTIONS</a></li>
<li class="section"><a href="#section8">FUTURE DEVELOPMENTS</a></li>
<li class="section"><a href="#section9">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">sha1 1.0</b></li>
<li>package require <b class="pkgname">md5 2.0</b></li>
<li>package require <b class="pkgname">base64 2.3</b></li>
<li>package require <b class="pkgname">xsxp 1.0</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">S3::Configure</b> <span class="opt">?<b class="option">-reset</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-retries</b> <i class="arg">integer</i>?</span> <span class="opt">?<b class="option">-accesskeyid</b> <i class="arg">idstring</i>?</span> <span class="opt">?<b class="option">-secretaccesskey</b> <i class="arg">idstring</i>?</span> <span class="opt">?<b class="option">-service-access-point</b> <i class="arg">FQDN</i>?</span> <span class="opt">?<b class="option">-use-tls</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-default-compare</b> <i class="arg">always|never|exists|missing|newer|date|checksum|different</i>?</span> <span class="opt">?<b class="option">-default-separator</b> <i class="arg">string</i>?</span> <span class="opt">?<b class="option">-default-acl</b> <i class="arg">private|public-read|public-read-write|authenticated-read|keep|calc</i>?</span> <span class="opt">?<b class="option">-default-bucket</b> <i class="arg">bucketname</i>?</span></a></li>
<li><a href="#2"><b class="cmd">S3::SuggestBucket</b> <span class="opt">?<i class="arg">name</i>?</span></a></li>
<li><a href="#3"><b class="cmd">S3::REST</b> <i class="arg">dict</i></a></li>
<li><a href="#4"><b class="cmd">S3::ListAllMyBuckets</b> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-parse-xml</b> <i class="arg">xmlstring</i>?</span> <span class="opt">?<b class="option">-result-type</b> <i class="arg">REST|xml|pxml|dict|names|owner</i>?</span></a></li>
<li><a href="#5"><b class="cmd">S3::PutBucket</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-acl</b> <i class="arg">{}|private|public-read|public-read-write|authenticated-read</i>?</span></a></li>
<li><a href="#6"><b class="cmd">S3::DeleteBucket</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span></a></li>
<li><a href="#7"><b class="cmd">S3::GetBucket</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-parse-xml</b> <i class="arg">xmlstring</i>?</span> <span class="opt">?<b class="option">-max-count</b> <i class="arg">integer</i>?</span> <span class="opt">?<b class="option">-prefix</b> <i class="arg">prefixstring</i>?</span> <span class="opt">?<b class="option">-delimiter</b> <i class="arg">delimiterstring</i>?</span> <span class="opt">?<b class="option">-result-type</b> <i class="arg">REST|xml|pxml|names|dict</i>?</span></a></li>
<li><a href="#8"><b class="cmd">S3::Put</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-file</b> <i class="arg">filename</i>?</span> <span class="opt">?<b class="option">-content</b> <i class="arg">contentstring</i>?</span> <span class="opt">?<b class="option">-acl</b> <i class="arg">private|public-read|public-read-write|authenticated-read|calc|keep</i>?</span> <span class="opt">?<b class="option">-content-type</b> <i class="arg">contenttypestring</i>?</span> <span class="opt">?<b class="option">-x-amz-meta-*</b> <i class="arg">metadatatext</i>?</span> <span class="opt">?<b class="option">-compare</b> <i class="arg">comparemode</i>?</span></a></li>
<li><a href="#9"><b class="cmd">S3::Get</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-compare</b> <i class="arg">comparemode</i>?</span> <span class="opt">?<b class="option">-file</b> <i class="arg">filename</i>?</span> <span class="opt">?<b class="option">-content</b> <i class="arg">contentvarname</i>?</span> <span class="opt">?<b class="option">-timestamp</b> <i class="arg">aws|now</i>?</span> <span class="opt">?<b class="option">-headers</b> <i class="arg">headervarname</i>?</span></a></li>
<li><a href="#10"><b class="cmd">S3::Head</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-dict</b> <i class="arg">dictvarname</i>?</span> <span class="opt">?<b class="option">-headers</b> <i class="arg">headersvarname</i>?</span> <span class="opt">?<b class="option">-status</b> <i class="arg">statusvarname</i>?</span></a></li>
<li><a href="#11"><b class="cmd">S3::GetAcl</b> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-result-type</b> <i class="arg">REST|xml|pxml</i>?</span></a></li>
<li><a href="#12"><b class="cmd">S3::PutAcl</b> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-acl</b> <i class="arg">new-acl</i>?</span></a></li>
<li><a href="#13"><b class="cmd">S3::Delete</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-status</b> <i class="arg">statusvar</i>?</span></a></li>
<li><a href="#14"><b class="cmd">S3::Push</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-directory</b> <i class="arg">directoryname</i> <span class="opt">?<b class="option">-prefix</b> <i class="arg">prefixstring</i>?</span> <span class="opt">?<b class="option">-compare</b> <i class="arg">comparemode</i>?</span> <span class="opt">?<b class="option">-x-amz-meta-*</b> <i class="arg">metastring</i>?</span> <span class="opt">?<b class="option">-acl</b> <i class="arg">aclcode</i>?</span> <span class="opt">?<b class="option">-delete</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-error</b> <i class="arg">throw|break|continue</i>?</span> <span class="opt">?<b class="option">-progress</b> <i class="arg">scriptprefix</i>?</span></a></li>
<li><a href="#15"><b class="cmd">S3::Pull</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-directory</b> <i class="arg">directoryname</i> <span class="opt">?<b class="option">-prefix</b> <i class="arg">prefixstring</i>?</span> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-compare</b> <i class="arg">comparemode</i>?</span> <span class="opt">?<b class="option">-delete</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-timestamp</b> <i class="arg">aws|now</i>?</span> <span class="opt">?<b class="option">-error</b> <i class="arg">throw|break|continue</i>?</span> <span class="opt">?<b class="option">-progress</b> <i class="arg">scriptprefix</i>?</span></a></li>
<li><a href="#16"><b class="cmd">S3::Toss</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-prefix</b> <i class="arg">prefixstring</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-error</b> <i class="arg">throw|break|continue</i>?</span> <span class="opt">?<b class="option">-progress</b> <i class="arg">scriptprefix</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides access to Amazon's Simple Storage Solution web service.</p>
<p>As a quick summary, Amazon Simple Storage Solution
provides a for-fee web service allowing the storage of arbitrary data as
&quot;resources&quot; within &quot;buckets&quot; online.  
See <a href="http://www.amazonaws.com/">http://www.amazonaws.com/</a> for details on that system.  
Access to the service is via HTTP (SOAP or REST).  Much of this
documentation will not make sense if you're not familiar with
the terms and functionality of the Amazon S3 service.</p>
<p>This package provides services for reading and writing
the data items via the REST interface.  It also provides some
higher-level operations.  Other packages in the same distribution
provide for even more functionality.</p>
<p>Copyright 2006 Darren New. All Rights Reserved.
NO WARRANTIES OF ANY TYPE ARE PROVIDED.
COPYING OR USE INDEMNIFIES THE AUTHOR IN ALL WAYS.
This software is licensed under essentially the same 
terms as Tcl. See LICENSE.txt for the terms.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">ERROR REPORTING</a></h2>
<p>The error reporting from this package makes use of $errorCode to 
provide more details on what happened than simply throwing an error.
Any error caught by the S3 package (and we try to catch them all)
will return with an $errorCode being a list having at least three
elements. In all cases, the first element will be &quot;S3&quot;. The second
element will take on one of six values, with that element defining
the value of the third and subsequent elements. S3::REST does not
throw an error, but rather returns a dictionary with the keys &quot;error&quot;, 
&quot;errorInfo&quot;, and &quot;errorCode&quot; set. This allows for reliable background
use. The possible second elements are these:</p>
<dl class="definitions">
<dt>usage</dt>
<dd><p>The usage of the package is incorrect. For example,
a command has been invoked which requires the library to be configured
before the library has been configured, or an invalid combination of
options has been specified. The third element of $errorCode supplies
the name of the parameter that was wrong. The fourth usually provides
the arguments that were actually supplied to the throwing proc, unless
the usage error isn't confined to a single proc.</p></dd>
<dt>local</dt>
<dd><p>Something happened on the local system which threw 
an error. For example, a request to upload or download a file was made
and the file permissions denied that sort of access. The third element
of $errorCode is the original $errorCode.</p></dd>
<dt>socket</dt>
<dd><p>Something happened with the socket. It closed 
prematurely, or some other condition of failure-to-communicate-with-Amazon 
was detected. The third element of $errorCode is the original $errorCode,
or sometimes the message from fcopy, or ...?</p></dd>
<dt>remote</dt>
<dd><p>The Amazon web service returned an error code outside
the 2xx range in the HTTP header. In other words, everything went as
documented, except this particular case was documented not to work.
The third element is the dictionary returned from <b class="cmd">::S3::REST</b>. 
Note that S3::REST itself never throws this error, but just returns
the dictionary. Most of the higher-level commands throw for convenience,
unless an argument indicates they should not. If something is documented
as &quot;not throwing an S3 remote error&quot;, it means a status return is set
rather than throwing an error if Amazon returns a non-2XX HTTP result code.</p></dd>
<dt>notyet</dt>
<dd><p>The user obeyed the documentation, but the author
has not yet gotten around to implementing this feature. (Right now,
only TLS support and sophisticated permissions fall into this category,
as well as the S3::Acl command.)</p></dd>
<dt>xml</dt>
<dd><p>The service has returned invalid XML, or XML whose 
schema is unexpected. For the high-level commands that accept
service XML as input for parsing, this may also be thrown.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">COMMANDS</a></h2>
<p>This package provides several separate levels of complexity.</p>
<ul class="itemized">
<li><p>The lowest level simply takes arguments to be sent to the service,
sends them, retrieves the result, and provides it to the caller.
<em>Note:</em> This layer allows both synchronous and event-driven
processing. It depends on the MD5 and SHA1 and base64 packages
from Tcllib (available at <a href="http://tcllib.sourceforge.net/">http://tcllib.sourceforge.net/</a>). 
Note that <b class="cmd">S3::Configure</b> is required for <b class="cmd">S3::REST</b> to 
work due to the authentication portion, so we put that in the &quot;lowest level.&quot;</p></li>
<li><p>The next layer parses the results of calls, allowing for functionality
such as uploading only changed files, synchronizing directories, 
and so on.  This layer depends on the <b class="package">TclXML</b> package as well as the 
included <b class="package"><a href="xsxp.html">xsxp</a></b> package. These packages are package required when
these more-sophisticated routines are called, so nothing breaks if
they are not correctly installed.</p></li>
<li><p>Also included is a separate program that uses the library. 
It provides code to parse $argv0 and $argv from the
command line, allowing invocation as a tclkit, etc. 
(Not yet implmented.)</p></li>
<li><p>Another separate program provides a GUI interface allowing drag-and-drop
and other such functionality. (Not yet implemented.)</p></li>
<li><p>Also built on this package is the OddJob program. It is 
a separate program designed to allow distribution of 
computational work units over Amazon's Elastic Compute
Cloud web service.</p></li>
</ul>
<p>The goal is to have at least the bottom-most layers implemented in
pure Tcl using only that which comes from widely-available sources,
such as Tcllib.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">LOW LEVEL COMMANDS</a></h2>
<p>These commands do not require any packages not listed above.
They talk directly to the service, or they are utility or 
configuration routines. Note that the &quot;xsxp&quot; package was
written to support this package, so it should be available
wherever you got this package.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">S3::Configure</b> <span class="opt">?<b class="option">-reset</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-retries</b> <i class="arg">integer</i>?</span> <span class="opt">?<b class="option">-accesskeyid</b> <i class="arg">idstring</i>?</span> <span class="opt">?<b class="option">-secretaccesskey</b> <i class="arg">idstring</i>?</span> <span class="opt">?<b class="option">-service-access-point</b> <i class="arg">FQDN</i>?</span> <span class="opt">?<b class="option">-use-tls</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-default-compare</b> <i class="arg">always|never|exists|missing|newer|date|checksum|different</i>?</span> <span class="opt">?<b class="option">-default-separator</b> <i class="arg">string</i>?</span> <span class="opt">?<b class="option">-default-acl</b> <i class="arg">private|public-read|public-read-write|authenticated-read|keep|calc</i>?</span> <span class="opt">?<b class="option">-default-bucket</b> <i class="arg">bucketname</i>?</span></a></dt>
<dd><p>There is one command for configuration, and that is <b class="cmd">S3::Configure</b>.  
If called with no arguments, it returns a
dictionary of key/value pairs listing all current settings.  If called
with one argument, it returns the value of that single argument.  If
called with two or more arguments, it must be called with pairs of
arguments, and it applies the changes in order.  There is only one set
of configuration information per interpreter.</p>
<p>The following options are accepted:</p>
<dl class="definitions">
<dt><b class="option">-reset</b> <i class="arg">boolean</i></dt>
<dd><p>By default, false.  If true, any previous changes and any changes on the
same call before the reset option will be returned to default values.</p></dd>
<dt><b class="option">-retries</b> <i class="arg">integer</i></dt>
<dd><p>Default value is 3.
If Amazon returns a 500 error, a retry after an exponential
backoff delay will be tried this many times before finally
throwing the 500 error. This applies to each call to <b class="cmd">S3::REST</b>
from the higher-level commands, but not to <b class="cmd">S3::REST</b> itself.
That is, <b class="cmd">S3::REST</b> will always return httpstatus 500 if that's
what it receives. Functions like <b class="cmd">S3::Put</b> will retry the PUT call,
and will also retry the GET and HEAD calls used to do content comparison.
Changing this to 0 will prevent retries and their associated delays.
In addition, socket errors (i.e., errors whose errorCode starts with 
&quot;S3 socket&quot;) will be similarly retried after backoffs.</p></dd>
<dt><b class="option">-accesskeyid</b> <i class="arg">idstring</i></dt>
<dd></dd>
<dt><b class="option">-secretaccesskey</b> <i class="arg">idstring</i></dt>
<dd><p>Each defaults to an empty string.
These must be set before any calls are made. This is your S3 ID.
Once you sign up for an account, go to <a href="http://www.amazonaws.com/">http://www.amazonaws.com/</a>,
sign in, go to the &quot;Your Web Services Account&quot; button, pick &quot;AWS 
Access Identifiers&quot;, and your access key ID and secret access keys 
will be available. All <b class="cmd">S3::REST</b> calls are authenticated.
Blame Amazon for the poor choice of names.</p></dd>
<dt><b class="option">-service-access-point</b> <i class="arg">FQDN</i></dt>
<dd><p>Defaults to &quot;s3.amazonaws.com&quot;. This is the fully-qualified domain
name of the server to contact for <b class="cmd">S3::REST</b> calls. You should
probably never need to touch this, unless someone else implements
a compatible service, or you wish to test something by pointing
the library at your own service.</p></dd>
<dt><b class="option">-slop-seconds</b> <i class="arg">integer</i></dt>
<dd><p>When comparing dates between Amazon and the local machine,
two dates within this many seconds of each other are considered
the same. Useful for clock drift correction, processing overhead 
time, and so on.</p></dd>
<dt><b class="option">-use-tls</b> <i class="arg">boolean</i></dt>
<dd><p>Defaults to false. This is not yet implemented. If true, <b class="cmd">S3::REST</b> will
negotiate a TLS connection to Amazon. If false, unencrypted connections
are used.</p></dd>
<dt><b class="option">-bucket-prefix</b> <i class="arg">string</i></dt>
<dd><p>Defaults to &quot;TclS3&quot;.  This string is used by <b class="cmd">S3::SuggestBucketName</b>
if that command is passed an empty string as an argument. It is used
to distinguish different applications using the Amazon service. 
Your application should always set this to keep from interfering with
the buckets of other users of Amazon S3 or with other buckets of the
same user.</p></dd>
<dt><b class="option">-default-compare</b> <i class="arg">always|never|exists|missing|newer|date|checksum|different</i></dt>
<dd><p>Defaults to &quot;always.&quot; If no -compare is specified on 
<b class="cmd">S3::Put</b>, <b class="cmd">S3::Get</b>, or <b class="cmd">S3::Delete</b>, this comparison is used. 
See those commands for a description of the meaning.</p></dd>
<dt><b class="option">-default-separator</b> <i class="arg">string</i></dt>
<dd><p>Defaults to &quot;/&quot;. This is currently unused. It might make sense to use
this for <b class="cmd">S3::Push</b> and <b class="cmd">S3::Pull</b>, but allowing resources to 
have slashes in their names that aren't marking directories would be
problematic. Hence, this currently does nothing.</p></dd>
<dt><b class="option">-default-acl</b> <i class="arg">private|public-read|public-read-write|authenticated-read|keep|calc</i></dt>
<dd><p>Defaults to an empty string. If no -acl argument is provided to <b class="cmd">S3::Put</b> or
<b class="cmd">S3::Push</b>, this string is used 
(given as the x-amz-acl header if not keep or calc). If this is also
empty, no x-amz-acl header is generated. 
This is <em>not</em> used by <b class="cmd">S3::REST</b>.</p></dd>
<dt><b class="option">-default-bucket</b> <i class="arg">bucketname</i></dt>
<dd><p>If no bucket is given to <b class="cmd">S3::GetBucket</b>, <b class="cmd">S3::PutBucket</b>,
<b class="cmd">S3::Get</b>, <b class="cmd">S3::Put</b>, 
<b class="cmd">S3::Head</b>, <b class="cmd">S3::Acl</b>,
<b class="cmd">S3::Delete</b>, <b class="cmd">S3::Push</b>, 
<b class="cmd">S3::Pull</b>, or <b class="cmd">S3::Toss</b>, and if this configuration variable
is not an empty string (and not simply &quot;/&quot;), then this value
will be used for the bucket. This is useful if one program does
a large amount of resource manipulation within a single bucket.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">S3::SuggestBucket</b> <span class="opt">?<i class="arg">name</i>?</span></a></dt>
<dd><p>The <b class="cmd">S3::SuggestBucket</b> command accepts an optional string as 
a prefix and returns a valid bucket containing the <i class="arg">name</i> argument
and the Access Key ID. This makes the name unique to the owner and
to the application (assuming the application picks a good <i class="arg">name</i> argument).
If no name is provided, 
the name from <b class="cmd">S3::Configure</b> <i class="arg">-bucket-prefix</i> is used. 
If that too is empty (which is not the default), an error is thrown.</p></dd>
<dt><a name="3"><b class="cmd">S3::REST</b> <i class="arg">dict</i></a></dt>
<dd><p>The <b class="cmd">S3::REST</b> command takes as an argument a dictionary and 
returns a dictionary.  The return dictionary has the same keys
as the input dictionary, and includes additional keys as the result.
The presence or absence of keys in the input dictionary can control
the behavior of the routine.  It never throws an error directly, but 
includes keys &quot;error&quot;, &quot;errorInfo&quot;, and &quot;errorCode&quot; if necessary.
Some keys are required, some optional. The routine can run either
in blocking or non-blocking mode, based on the presense 
of <b class="option">resultvar</b> in the input dictionary. This requires
the <i class="arg">-accesskeyid</i> and <i class="arg">-secretaccesskey</i> to be configured via
<b class="cmd">S3::Configure</b> before being called.</p>
<p>The possible input keys are these:</p>
<dl class="definitions">
<dt><b class="option">verb</b> <i class="arg">GET|PUT|DELETE|HEAD</i></dt>
<dd><p>This required item indicates the verb to be used.</p></dd>
<dt><b class="option">resource</b> <i class="arg">string</i></dt>
<dd><p>This required item indicates the resource to be accessed.
A leading / is added if not there already. It will
be URL-encoded for you if necessary. Do not supply a
resource name that is already URL-encoded.</p></dd>
<dt><span class="opt">?<b class="option">rtype</b> <i class="arg">torrent|acl</i>?</span></dt>
<dd><p>This indicates a torrent or acl resource is being manipulated.
Do not include this in the <b class="option">resource</b> key, or the
&quot;?&quot; separator will get URL-encoded.</p></dd>
<dt><span class="opt">?<b class="option">parameters</b> <i class="arg">dict</i>?</span></dt>
<dd><p>This optional dictionary provides parameters added to the URL
for the transaction. The keys must be in the correct case
(which is confusing in the Amazon documentation) and the
values must be valid. This can be an empty dictionary or
omitted entirely if no parameters are desired. No other
error checking on parameters is performed.</p></dd>
<dt><span class="opt">?<b class="option">headers</b> <i class="arg">dict</i>?</span></dt>
<dd><p>This optional dictionary provides headers to be added
to the HTTP request. The keys must be in <em>lower case</em>
for the authentication to work. The values must not contain
embedded newlines or carriage returns. This is primarily 
useful for adding x-amz-* headers. Since authentication
is calculated by <b class="cmd">S3::REST</b>, do not add that header here.
Since content-type gets its own key, also do not add
that header here.</p></dd>
<dt><span class="opt">?<b class="option">inbody</b> <i class="arg">contentstring</i>?</span></dt>
<dd><p>This optional item, if provided, gives the content that will
be sent. It is sent with a tranfer encoding of binary, and
only the low bytes are used, so use [encoding convertto utf-8] 
if the string is a utf-8 string. This is written all in one blast,
so if you are using non-blocking mode and the <b class="option">inbody</b> is
especially large, you may wind up blocking on the write socket.</p></dd>
<dt><span class="opt">?<b class="option">infile</b> <i class="arg">filename</i>?</span></dt>
<dd><p>This optional item, if provided, and if <b class="option">inbody</b> is not provided,
names the file from which the body of the HTTP message will be
constructed. The file is opened for reading and sent progressively
by [fcopy], so it should not block in non-blocking mode
even if the file is very large. The file is transfered in 
binary mode, so the bytes on your disk will match the bytes 
in your resource. Due to HTTP restrictions, it must be possible to
use [file size] on this file to determine the size at the
start of the transaction.</p></dd>
<dt><span class="opt">?<b class="option">S3chan</b> <i class="arg">channel</i>?</span></dt>
<dd><p>This optional item, if provided, indicates the already-open socket
over which the transaction should be conducted. If not provided,
a connection is made to the service access point specified via
<b class="cmd">S3::Configure</b>, which is normally s3.amazonaws.com. If this
is provided, the channel is not closed at the end of the transaction.</p></dd>
<dt><span class="opt">?<b class="option">outchan</b> <i class="arg">channel</i>?</span></dt>
<dd><p>This optional item, if provided, indicates the already-open channel
to which the body returned from S3 should be written. That is, 
to retrieve a large resource, open a file, set the translation mode,
and pass the channel as the value of the key outchan. Output
will be written to the channel in pieces so memory does not fill
up unnecessarily. The channel is not closed at the end of the transaction.</p></dd>
<dt><span class="opt">?<b class="option">resultvar</b> <i class="arg">varname</i>?</span></dt>
<dd><p>This optional item, if provided, indicates that <b class="cmd">S3::REST</b> should
run in non-blocking mode. The <i class="arg">varname</i> should be fully qualified
with respect to namespaces and cannot be local to a proc. If provided,
the result of the <b class="cmd">S3::REST</b> call is assigned to this variable once
everything has completed; use trace or vwait to know when this has happened.
If this key is not provided, the result is simply returned from the 
call to <b class="cmd">S3::REST</b> and no calls to the eventloop are invoked from
within this call.</p></dd>
<dt><span class="opt">?<b class="option">throwsocket</b> <i class="arg">throw|return</i>?</span></dt>
<dd><p>This optional item, if provided, indicates that <b class="cmd">S3::REST</b> should
throw an error if throwmode is throw and a socket error is encountered.
It indicates that <b class="cmd">S3::REST</b> should return the error code in the 
returned dictionary if a socket error is encountered and this is
set to return. If <b class="option">throwsocket</b> is set to <i class="arg">return</i> or
if the call is not blocking, then a socket error (i.e., an error 
whose error code starts with &quot;S3 socket&quot; will be returned in the
dictionary as <b class="option">error</b>, <b class="option">errorInfo</b>, and <b class="option">errorCode</b>.
If a foreground call is made (i.e., <b class="option">resultvar</b> is not provided),
and this option is not provided or is set to <i class="arg">throw</i>, then 
<b class="cmd"><a href="../../../../index.html#key154">error</a></b> will be invoked instead.</p></dd>
</dl>
<p>Once the call to <b class="cmd">S3::REST</b> completes, a new dict is returned,
either in the <i class="arg">resultvar</i> or as the result of execution. This dict is 
a copy of the original dict with the results added as new keys. The possible
new keys are these:</p>
<dl class="definitions">
<dt><b class="option">error</b> <i class="arg">errorstring</i></dt>
<dd></dd>
<dt><b class="option">errorInfo</b> <i class="arg">errorstring</i></dt>
<dd></dd>
<dt><b class="option">errorCode</b> <i class="arg">errorstring</i></dt>
<dd><p>If an error is caught, these three keys will be set in the result.
Note that <b class="cmd">S3::REST</b> does <em>not</em> consider a non-2XX HTTP 
return code as an error. The <b class="option">errorCode</b> value will be
formatted according to the <span class="sectref"><a href="#section2">ERROR REPORTING</a></span> description.
If these are present, other keys described here might not be.</p></dd>
<dt><b class="option">httpstatus</b> <i class="arg">threedigits</i></dt>
<dd><p>The three-digit code from the HTTP transaction. 2XX for good, 
5XX for server error, etc.</p></dd>
<dt><b class="option">httpmessage</b> <i class="arg">text</i></dt>
<dd><p>The textual result after the status code. &quot;OK&quot; or &quot;Forbidden&quot;
or etc.</p></dd>
<dt><b class="option">outbody</b> <i class="arg">contentstring</i></dt>
<dd><p>If <i class="arg">outchan</i> was not specified, this key will hold a 
reference to the (unencoded) contents of the body returned.
If Amazon returned an error (a la the httpstatus not a 2XX value),
the error message will be in <b class="option">outbody</b> or written to
<b class="option">outchan</b> as appropriate.</p></dd>
<dt><b class="option">outheaders</b> <i class="arg">dict</i></dt>
<dd><p>This contains a dictionary of headers returned by Amazon.
The keys are always lower case. It's mainly useful for
finding the x-amz-meta-* headers, if any, although things
like last-modified and content-type are also useful. 
The keys of this dictionary are always lower case. 
Both keys and values are trimmed of extraneous whitespace.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">HIGH LEVEL COMMANDS</a></h2>
<p>The routines in this section all make use of one or more calls 
to <b class="cmd">S3::REST</b> to do their work, then parse and manage the data
in a convenient way.  All these commands throw errors
as described in <span class="sectref"><a href="#section2">ERROR REPORTING</a></span> unless otherwise noted.</p>
<p>In all these commands, all arguments are presented as name/value pairs, 
in any order. All the argument names start with a hyphen.</p>
<p>There are a few options that are common to many
of the commands, and those common options are documented here.</p>
<dl class="definitions">
<dt><b class="option">-blocking</b> <i class="arg">boolean</i></dt>
<dd><p>If provided and specified as false, 
then any calls to <b class="cmd">S3:REST</b> will be non-blocking,
and internally these routines will call [vwait] to get
the results. In other words, these routines will return the
same value, but they'll have event loops running while waiting
for Amazon.</p></dd>
<dt><b class="option">-parse-xml</b> <i class="arg">xmlstring</i></dt>
<dd><p>If provided, the routine skips actually communicating with
Amazon, and instead behaves as if the XML string provided
was returned as the body of the call. Since several of
these routines allow the return of data in various formats,
this argument can be used to parse existing XML to extract
the bits of information that are needed. It's also helpful
for testing.</p></dd>
<dt><b class="option">-bucket</b> <i class="arg">bucketname</i></dt>
<dd><p>Almost every high-level command needs to know what bucket
the resources are in. This option specifies that. (Only the
command to list available buckets does not require this parameter.)
This does not need to be URL-encoded, even if it contains
special or non-ASCII characters. May or may not contain leading
or trailing spaces - commands normalize the bucket. If this is
not supplied, the value is taken from <b class="cmd">S3::Configure -default-bucket</b>
if that string isn't empty. Note that spaces and slashes are 
always trimmed from both ends and the rest must leave a valid bucket.</p></dd>
<dt><b class="option">-resource</b> <i class="arg">resourcename</i></dt>
<dd><p>This specifies the resource of interest within the bucket. 
It may or may not start with a slash - both cases are handled.
This does not need to be URL-encoded, even if it contains
special or non-ASCII characters.</p></dd>
<dt><b class="option">-compare</b> <i class="arg">always|never|exists|missing|newer|date|checksum|different</i></dt>
<dd><p>When commands copy resources to files or files to resources, the caller may specify that the copy should be skipped if the contents are the same. This argument specifies the conditions under which the files should be copied. If it is not passed, the result of <b class="cmd">S3::Configure -default-compare</b> is used, which in turn defaults to &quot;always.&quot; The meanings of the various values are these:</p>
<dl class="definitions">
<dt><i class="arg">always</i></dt>
<dd><p>Always copy the data. This is the default.</p></dd>
<dt><i class="arg">never</i></dt>
<dd><p>Never copy the data. This is essentially a no-op, except in <b class="cmd">S3::Push</b> and <b class="cmd">S3::Pull</b> where the -delete flag might make a difference.</p></dd>
<dt><i class="arg">exists</i></dt>
<dd><p>Copy the data only if the destination already exists.</p></dd>
<dt><i class="arg">missing</i></dt>
<dd><p>Copy the data only if the destination does not already exist.</p></dd>
<dt><i class="arg">newer</i></dt>
<dd><p>Copy the data if the destination is missing, or if the date on the source is 
newer than the date on the destination by at 
least <b class="cmd">S3::Configure -slop-seconds</b> seconds. If the source is 
Amazon, the date is taken from the Last-Modified header. If the 
source is local, it is taken as the mtime of the file. If the source data
is specified in a string rather than a file, it is taken as right now,
via [clock seconds].</p></dd>
<dt><i class="arg">date</i></dt>
<dd><p>Like <i class="arg">newer</i>, except copy if the date is newer <em>or</em> older.</p></dd>
<dt><i class="arg">checksum</i></dt>
<dd><p>Calculate the MD5 checksum on the local file or string, ask Amazon for the eTag
of the resource, and copy the data if they're different. Copy the data
also if the destination is missing. Note that this can be slow with
large local files unless the C version of the MD5 support is available.</p></dd>
<dt><i class="arg">different</i></dt>
<dd><p>Copy the data if the destination does not exist. 
If the destination exists and an actual file name was specified 
(rather than a content string), 
and the date on the file differs from the date on the resource,
copy the data. 
If the data is provided as a content string, the &quot;date&quot; is treated 
as &quot;right now&quot;, so it will likely always differ unless slop-seconds is large.
If the dates are the same, the MD5 checksums are compared, and the
data is copied if the checksums differ.</p></dd>
</dl>
<p>Note that &quot;newer&quot; and &quot;date&quot; don't care about the contents, and &quot;checksum&quot; doesn't care about the dates, but &quot;different&quot; checks both.</p></dd>
<dt><a name="4"><b class="cmd">S3::ListAllMyBuckets</b> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-parse-xml</b> <i class="arg">xmlstring</i>?</span> <span class="opt">?<b class="option">-result-type</b> <i class="arg">REST|xml|pxml|dict|names|owner</i>?</span></a></dt>
<dd><p>This routine performs a GET on the Amazon S3 service, which is
defined to return a list of buckets owned by the account identified
by the authorization header. (Blame Amazon for the dumb names.)</p>
<dl class="definitions">
<dt><b class="option">-blocking</b> <i class="arg">boolean</i></dt>
<dd><p>See above for standard definition.</p></dd>
<dt><b class="option">-parse-xml</b> <i class="arg">xmlstring</i></dt>
<dd><p>See above for standard definition.</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">REST</i></dt>
<dd><p>The dictionary returned by <b class="cmd">S3::REST</b> is the return value of <b class="cmd">S3::ListAllMyBuckets</b>. In this case, a non-2XX httpstatus will not throw an error. You may not combine this with <i class="arg">-parse-xml</i>.</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">xml</i></dt>
<dd><p>The raw XML of the body is returned as the result (with no encoding applied).</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">pxml</i></dt>
<dd><p>The XML of the body as parsed by <b class="cmd">xsxp::parse</b> is returned.</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">dict</i></dt>
<dd><p>A dictionary of interesting portions of the XML is returned. The dictionary contains the following keys:</p>
<dl class="definitions">
<dt>Owner/ID</dt>
<dd><p>The Amazon AWS ID (in hex) of the owner of the bucket.</p></dd>
<dt>Owner/DisplayName</dt>
<dd><p>The Amazon AWS ID's Display Name.</p></dd>
<dt>Bucket/Name</dt>
<dd><p>A list of names, one for each bucket.</p></dd>
<dt>Bucket/CreationDate</dt>
<dd><p>A list of dates, one for each bucket, 
in the same order as Bucket/Name, in ISO format (as returned by Amazon).</p></dd>
</dl></dd>
<dt><b class="option">-result-type</b> <i class="arg">names</i></dt>
<dd><p>A list of bucket names is returned with all other information stripped out.
This is the default result type for this command.</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">owner</i></dt>
<dd><p>A list containing two elements is returned. The first element is 
the owner's ID, and the second is the owner's display name.</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">S3::PutBucket</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-acl</b> <i class="arg">{}|private|public-read|public-read-write|authenticated-read</i>?</span></a></dt>
<dd><p>This command creates a bucket if it does not already exist. Bucket names are
globally unique, so you may get a &quot;Forbidden&quot; error from Amazon even if you
cannot see the bucket in <b class="cmd">S3::ListAllMyBuckets</b>. See <b class="cmd">S3::SuggestBucket</b> for ways to minimize this risk. The x-amz-acl header comes from the <b class="option">-acl</b> option, or from <b class="cmd">S3::Configure -default-acl</b> if not specified.</p></dd>
<dt><a name="6"><b class="cmd">S3::DeleteBucket</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span></a></dt>
<dd><p>This command deletes a bucket if it is empty and you have such permission.
Note that Amazon's list of buckets is a global resource, requiring
far-flung synchronization. If you delete a bucket, it may be quite 
a few minutes (or hours) before you can recreate it, yielding &quot;Conflict&quot;
errors until then.</p></dd>
<dt><a name="7"><b class="cmd">S3::GetBucket</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-parse-xml</b> <i class="arg">xmlstring</i>?</span> <span class="opt">?<b class="option">-max-count</b> <i class="arg">integer</i>?</span> <span class="opt">?<b class="option">-prefix</b> <i class="arg">prefixstring</i>?</span> <span class="opt">?<b class="option">-delimiter</b> <i class="arg">delimiterstring</i>?</span> <span class="opt">?<b class="option">-result-type</b> <i class="arg">REST|xml|pxml|names|dict</i>?</span></a></dt>
<dd><p>This lists the contents of a bucket. That is, it returns a directory 
listing of resources within a bucket, rather than transfering any
user data.</p>
<dl class="definitions">
<dt><b class="option">-bucket</b> <i class="arg">bucketname</i></dt>
<dd><p>The standard bucket argument.</p></dd>
<dt><b class="option">-blocking</b> <i class="arg">boolean</i></dt>
<dd><p>The standard blocking argument.</p></dd>
<dt><b class="option">-parse-xml</b> <i class="arg">xmlstring</i></dt>
<dd><p>The standard parse-xml argument.</p></dd>
<dt><b class="option">-max-count</b> <i class="arg">integer</i></dt>
<dd><p>If supplied, this is the most number of records to be returned.
If not supplied, the code will iterate until all records have been found.
Not compatible with -parse-xml. Note that if this is supplied, only
one call to <b class="cmd">S3::REST</b> will be made. Otherwise, enough calls
will be made to exhaust the listing, buffering results in memory,
so take care if you may have huge buckets.</p></dd>
<dt><b class="option">-prefix</b> <i class="arg">prefixstring</i></dt>
<dd><p>If present, restricts listing to resources with a particular prefix. One 
leading / is stripped if present.</p></dd>
<dt><b class="option">-delimiter</b> <i class="arg">delimiterstring</i></dt>
<dd><p>If present, specifies a delimiter for the listing.
The presence of this will summarize multiple resources
into one entry, as if S3 supported directories. See the
Amazon documentation for details.</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">REST|xml|pxml|names|dict</i></dt>
<dd><p>This indicates the format of the return result of the command.</p>
<dl class="definitions">
<dt>REST</dt>
<dd><p>If <i class="arg">-max-count</i> is specified, the dictionary returned
from <b class="cmd">S3::REST</b> is returned. If <i class="arg">-max-count</i> is
not specified, a list of all the dictionaries returned from
the one or more calls to <b class="cmd">S3::REST</b> is returned.</p></dd>
<dt>xml</dt>
<dd><p>If <i class="arg">-max-count</i> is specified, the body returned
from <b class="cmd">S3::REST</b> is returned. If <i class="arg">-max-count</i> is
not specified, a list of all the bodies returned from
the one or more calls to <b class="cmd">S3::REST</b> is returned.</p></dd>
<dt>pxml</dt>
<dd><p>If <i class="arg">-max-count</i> is specified, the body returned
from <b class="cmd">S3::REST</b> is passed throught <b class="cmd">xsxp::parse</b> and then returned. 
If <i class="arg">-max-count</i> is
not specified, a list of all the bodies returned from
the one or more calls to <b class="cmd">S3::REST</b> are each passed through
<b class="cmd">xsxp::parse</b> and then returned.</p></dd>
<dt>names</dt>
<dd><p>Returns a list of all names found in either the Contents/Key fields or
the CommonPrefixes/Prefix fields. If no <i class="arg">-delimiter</i> is specified
and no <i class="arg">-max-count</i> is specified, this returns a list of all
resources with the specified <i class="arg">-prefix</i>.</p></dd>
<dt>dict</dt>
<dd><p>Returns a dictionary. (Returns only one dictionary even if <i class="arg">-max-count</i>
wasn't specified.) The keys of the dictionary are as follows:</p>
<dl class="definitions">
<dt>Name</dt>
<dd><p>The name of the bucket (from the final call to <b class="cmd">S3::REST</b>).</p></dd>
<dt>Prefix</dt>
<dd><p>From the final call to <b class="cmd">S3::REST</b>.</p></dd>
<dt>Marker</dt>
<dd><p>From the final call to <b class="cmd">S3::REST</b>.</p></dd>
<dt>MaxKeys</dt>
<dd><p>From the final call to <b class="cmd">S3::REST</b>.</p></dd>
<dt>IsTruncated</dt>
<dd><p>From the final call to <b class="cmd">S3::REST</b>, so
always false if <i class="arg">-max-count</i> is not specified.</p></dd>
<dt>NextMarker</dt>
<dd><p>Always provided if IsTruncated is true, and
calculated of Amazon does not provide it. May be empty if IsTruncated is false.</p></dd>
<dt>Key</dt>
<dd><p>A list of names of resources in the bucket matching the <i class="arg">-prefix</i> and <i class="arg">-delimiter</i> restrictions.</p></dd>
<dt>LastModified</dt>
<dd><p>A list of times of resources in the bucket, in the same
order as Key, in the format returned by Amazon. (I.e., it is not parsed into 
a seconds-from-epoch.)</p></dd>
<dt>ETag</dt>
<dd><p>A list of entity tags (a.k.a. MD5 checksums) in the same order as Key.</p></dd>
<dt>Size</dt>
<dd><p>A list of sizes in bytes of the resources, in the same order as Key.</p></dd>
<dt>Owner/ID</dt>
<dd><p>A list of owners of the resources in the bucket, in the same order as Key.</p></dd>
<dt>Owner/DisplayName</dt>
<dd><p>A list of owners of the resources in the bucket, in the same order as Key. These are the display names.</p></dd>
<dt>CommonPrefixes/Prefix</dt>
<dd><p>A list of prefixes common to multiple entities. This is present only if <i class="arg">-delimiter</i> was supplied.</p></dd>
</dl></dd>
</dl></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">S3::Put</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-file</b> <i class="arg">filename</i>?</span> <span class="opt">?<b class="option">-content</b> <i class="arg">contentstring</i>?</span> <span class="opt">?<b class="option">-acl</b> <i class="arg">private|public-read|public-read-write|authenticated-read|calc|keep</i>?</span> <span class="opt">?<b class="option">-content-type</b> <i class="arg">contenttypestring</i>?</span> <span class="opt">?<b class="option">-x-amz-meta-*</b> <i class="arg">metadatatext</i>?</span> <span class="opt">?<b class="option">-compare</b> <i class="arg">comparemode</i>?</span></a></dt>
<dd><p>This command sends data to a resource on Amazon's servers for storage,
using the HTTP PUT command. It returns 0 if the <b class="option">-compare</b> mode 
prevented the transfer, 1 if the transfer worked, or throws an error
if the transfer was attempted but failed. 
Server 5XX errors and S3 socket errors are retried
according to <b class="cmd">S3:Configure -retries</b> settings before throwing an error; 
other errors throw immediately.</p>
<dl class="definitions">
<dt><b class="option">-bucket</b></dt>
<dd><p>This specifies the bucket into which the resource will be written.
Leading and/or trailing slashes are removed for you, as are spaces.</p></dd>
<dt><b class="option">-resource</b></dt>
<dd><p>This is the full name of the resource within the bucket. A single 
leading slash is removed, but not a trailing slash. 
Spaces are not trimmed.</p></dd>
<dt><b class="option">-blocking</b></dt>
<dd><p>The standard blocking flag.</p></dd>
<dt><b class="option">-file</b></dt>
<dd><p>If this is specified, the <i class="arg">filename</i> must exist, must be readable, 
and must not be a special or directory file. [file size] must
apply to it and must not change for the lifetime of the call.  The
default content-type is calculated based on the name and/or contents
of the file. Specifying this is an error if <b class="option">-content</b> is 
also specified, but at least one of <b class="option">-file</b> or <b class="option">-content</b> must 
be specified. (The file is allowed to not exist or not be readable if 
<b class="option">-compare</b> <i class="arg">never</i> is specified.)</p></dd>
<dt><b class="option">-content</b></dt>
<dd><p>If this is specified, the <i class="arg">contentstring</i> is sent as the body
of the resource. The content-type defaults to &quot;application/octet-string&quot;.
Only the low bytes are sent, so non-ASCII should use the appropriate encoding 
(such as [encoding convertto utf-8]) before passing it 
to this routine, if necessary. Specifying this is an error if <b class="option">-file</b> 
is also specified, but at least one of <b class="option">-file</b> or <b class="option">-content</b> must 
be specified.</p></dd>
<dt><b class="option">-acl</b></dt>
<dd><p>This defaults to <b class="cmd">S3::Configure -default-acl</b> if not specified.
It sets the x-amz-acl header on the PUT operation.
If the value provided is <i class="arg">calc</i>, the x-amz-acl header is
calculated based on the I/O permissions of the file to be uploaded;
it is an error to specify <i class="arg">calc</i> and <b class="option">-content</b>.
If the value provided is <i class="arg">keep</i>, the acl of the resource
is read before the PUT (or the default is used if the 
resource does not exist), then set back to what it
was after the PUT (if it existed). An error will occur if 
the resource is successfully written but the kept ACL cannot
be then applied. This should never happen. 
<em>Note:</em>  <i class="arg">calc</i> is not currently fully implemented.</p></dd>
<dt><b class="option">-x-amz-meta-*</b></dt>
<dd><p>If any header starts with &quot;-x-amz-meta-&quot;, its contents are added to the 
PUT command to be stored as metadata with the resource. Again, no 
encoding is performed, and the metadata should not contain characters
like newlines, carriage returns, and so on. It is best to stick with
simple ASCII strings, or to fix the library in several places.</p></dd>
<dt><b class="option">-content-type</b></dt>
<dd><p>This overrides the content-type calculated by <b class="option">-file</b> or 
sets the content-type for <b class="option">-content</b>.</p></dd>
<dt><b class="option">-compare</b></dt>
<dd><p>This is the standard compare mode argument. <b class="cmd">S3::Put</b> returns
1 if the data was copied or 0 if the data was skipped due to
the comparison mode so indicating it should be skipped.</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">S3::Get</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-compare</b> <i class="arg">comparemode</i>?</span> <span class="opt">?<b class="option">-file</b> <i class="arg">filename</i>?</span> <span class="opt">?<b class="option">-content</b> <i class="arg">contentvarname</i>?</span> <span class="opt">?<b class="option">-timestamp</b> <i class="arg">aws|now</i>?</span> <span class="opt">?<b class="option">-headers</b> <i class="arg">headervarname</i>?</span></a></dt>
<dd><p>This command retrieves data from a resource on Amazon's S3 servers,
using the HTTP GET command. It returns 0 if the <b class="option">-compare</b> mode 
prevented the transfer, 1 if the transfer worked, or throws an error
if the transfer was attempted but failed. Server 5XX errors and S3 socket
errors are are retried
according to <b class="cmd">S3:Configure</b> settings before throwing an error; 
other errors throw immediately. Note that this is always authenticated
as the user configured in via <b class="cmd">S3::Configure -accesskeyid</b>. Use
the Tcllib http for unauthenticated GETs.</p>
<dl class="definitions">
<dt><b class="option">-bucket</b></dt>
<dd><p>This specifies the bucket from which the resource will be read.
Leading and/or trailing slashes are removed for you, as are spaces.</p></dd>
<dt><b class="option">-resource</b></dt>
<dd><p>This is the full name of the resource within the bucket. A single 
leading slash is removed, but not a trailing slash. 
Spaces are not trimmed.</p></dd>
<dt><b class="option">-blocking</b></dt>
<dd><p>The standard blocking flag.</p></dd>
<dt><b class="option">-file</b></dt>
<dd><p>If this is specified, the body of the resource will be read into this file, 
incrementally without pulling it entirely into memory first. The parent 
directory must already exist. If the file already exists, it must be
writable. If an error is thrown part-way through the process and the
file already existed, it may be clobbered. If an error is thrown part-way
through the process and the file did not already exist, any partial
bits will be deleted. Specifying this is an error if <b class="option">-content</b>
is also specified, but at least one of <b class="option">-file</b> or <b class="option">-content</b> must 
be specified.</p></dd>
<dt><b class="option">-timestamp</b></dt>
<dd><p>This is only valid in conjunction with <b class="option">-file</b>. It may be specified
as <i class="arg">now</i> or <i class="arg">aws</i>. The default is <i class="arg">now</i>. If <i class="arg">now</i>, the file's
modification date is left up to the system. If <i class="arg">aws</i>, the file's
mtime is set to match the Last-Modified header on the resource, synchronizing
the two appropriately for <b class="option">-compare</b> <i class="arg">date</i> or 
<b class="option">-compare</b> <i class="arg">newer</i>.</p></dd>
<dt><b class="option">-content</b></dt>
<dd><p>If this is specified, the <i class="arg">contentvarname</i> is a variable in the caller's
scope (not necessarily global) that receives the value of the body of
the resource. No encoding is done, so if the resource (for example) represents
a UTF-8 byte sequence, use [encoding convertfrom utf-8] to get a valid
UTF-8 string. If this is specified, the <b class="option">-compare</b> is ignored unless
it is <i class="arg">never</i>, in which case no assignment to <i class="arg">contentvarname</i> is 
performed. Specifying this is an error if <b class="option">-file</b> is also specified,
but at least one of <b class="option">-file</b> or <b class="option">-content</b> must be specified.</p></dd>
<dt><b class="option">-compare</b></dt>
<dd><p>This is the standard compare mode argument. <b class="cmd">S3::Get</b> returns
1 if the data was copied or 0 if the data was skipped due to
the comparison mode so indicating it should be skipped.</p></dd>
<dt><b class="option">-headers</b></dt>
<dd><p>If this is specified, the headers resulting from the fetch are stored
in the provided variable, as a dictionary. This will include content-type
and x-amz-meta-* headers, as well as the usual HTTP headers, the x-amz-id
debugging headers, and so on. If no file is fetched (due to <b class="option">-compare</b>
or other errors), no assignment to this variable is performed.</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">S3::Head</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-dict</b> <i class="arg">dictvarname</i>?</span> <span class="opt">?<b class="option">-headers</b> <i class="arg">headersvarname</i>?</span> <span class="opt">?<b class="option">-status</b> <i class="arg">statusvarname</i>?</span></a></dt>
<dd><p>This command requests HEAD from the resource.
It returns whether a 2XX code was returned as a result
of the request, never throwing an S3 remote error.
That is, if this returns 1, the resource exists and is
accessible. If this returns 0, something went wrong, and the
<b class="option">-status</b> result can be consulted for details.</p>
<dl class="definitions">
<dt><b class="option">-bucket</b></dt>
<dd><p>This specifies the bucket from which the resource will be read.
Leading and/or trailing slashes are removed for you, as are spaces.</p></dd>
<dt><b class="option">-resource</b></dt>
<dd><p>This is the full name of the resource within the bucket. A single 
leading slash is removed, but not a trailing slash. 
Spaces are not trimmed.</p></dd>
<dt><b class="option">-blocking</b></dt>
<dd><p>The standard blocking flag.</p></dd>
<dt><b class="option">-dict</b></dt>
<dd><p>If specified, the resulting dictionary from the <b class="cmd">S3::REST</b>
call is assigned to the indicated (not necessarily global) variable 
in the caller's scope.</p></dd>
<dt><b class="option">-headers</b></dt>
<dd><p>If specified, the dictionary of headers from the result are assigned
to the indicated (not necessarily global) variable in the caller's scope.</p></dd>
<dt><b class="option">-status</b></dt>
<dd><p>If specified, the indicated (not necessarily global) variable in 
the caller's scope is assigned a 2-element list. The first element is
the 3-digit HTTP status code, while the second element is 
the HTTP message (such as &quot;OK&quot; or &quot;Forbidden&quot;).</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">S3::GetAcl</b> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-result-type</b> <i class="arg">REST|xml|pxml</i>?</span></a></dt>
<dd><p>This command gets the ACL of the indicated resource or throws an
error if it is unavailable.</p>
<dl class="definitions">
<dt><b class="option">-blocking</b> <i class="arg">boolean</i></dt>
<dd><p>See above for standard definition.</p></dd>
<dt><b class="option">-bucket</b></dt>
<dd><p>This specifies the bucket from which the resource will be read.
Leading and/or trailing slashes are removed for you, as are spaces.</p></dd>
<dt><b class="option">-resource</b></dt>
<dd><p>This is the full name of the resource within the bucket. A single 
leading slash is removed, but not a trailing slash. 
Spaces are not trimmed.</p></dd>
<dt><b class="option">-parse-xml</b> <i class="arg">xml</i></dt>
<dd><p>The XML from a previous GetACL can be passed in to be parsed into
dictionary form.  In this case, -result-type must be pxml or dict.</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">REST</i></dt>
<dd><p>The dictionary returned by <b class="cmd">S3::REST</b> is the return value of 
<b class="cmd">S3::GetAcl</b>.  In this case, a non-2XX httpstatus will not throw an
error.</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">xml</i></dt>
<dd><p>The raw XML of the body is returned as the result (with no encoding applied).</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">pxml</i></dt>
<dd><p>The XML of the body as parsed by <b class="cmd">xsxp::parse</b> is returned.</p></dd>
<dt><b class="option">-result-type</b> <i class="arg">dict</i></dt>
<dd><p>This fetches the ACL, parses it, and returns a dictionary of two elements.</p>
<p>The first element has the key &quot;owner&quot; whose value is the canonical ID of the owner of the resource.</p>
<p>The second element has the key &quot;acl&quot; whose value is a dictionary.  Each
key in the dictionary is one of Amazon's permissions, namely &quot;READ&quot;,
&quot;WRITE&quot;, &quot;READ_ACP&quot;, &quot;WRITE_ACP&quot;, or &quot;FULL_CONTROL&quot;.  Each value of each
key is a list of canonical IDs or group URLs that have that permission.
Elements are not in the list in any particular order, and not all keys
are necessarily present.  Display names are not returned, as they are
not especially useful; use pxml to obtain them if necessary.</p></dd>
</dl></dd>
<dt><a name="12"><b class="cmd">S3::PutAcl</b> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-acl</b> <i class="arg">new-acl</i>?</span></a></dt>
<dd><p>This sets the ACL on the indicated resource. It returns the XML written to the ACL, or throws an error if anything went wrong.</p>
<dl class="definitions">
<dt><b class="option">-blocking</b> <i class="arg">boolean</i></dt>
<dd><p>See above for standard definition.</p></dd>
<dt><b class="option">-bucket</b></dt>
<dd><p>This specifies the bucket from which the resource will be read.
Leading and/or trailing slashes are removed for you, as are spaces.</p></dd>
<dt><b class="option">-resource</b></dt>
<dd><p>This is the full name of the resource within the bucket. A single 
leading slash is removed, but not a trailing slash. 
Spaces are not trimmed.</p></dd>
<dt><b class="option">-owner</b></dt>
<dd><p>If this is provided, it is assumed to match the owner of the resource.
Otherwise, a GET may need to be issued against the resource to find
the owner. If you already have the owner (such as from a call 
to <b class="cmd">S3::GetAcl</b>, you can pass the value of the &quot;owner&quot; key
as the value of this option, and it will be used in the construction
of the XML.</p></dd>
<dt><b class="option">-acl</b></dt>
<dd><p>If this option is specified, it provides the ACL the caller wishes
to write to the resource. If this is not supplied or is empty,
the value is taken from <b class="cmd">S3::Configure -default-acl</b>.
The ACL is written with a PUT to the ?acl resource.</p>
<p>If the value passed to this option
starts with &quot;&lt;&quot;, it is taken to be a body to be PUT to the ACL resource.</p>
<p>If the value matches one of the standard Amazon x-amz-acl headers (i.e.,
a canned access policy), that header is translated to XML and then
applied. The canned access policies are private, public-read,
public-read-write, and authenticated-read (in lower case).</p>
<p>Otherwise, the value is assumed to be a dictionary formatted as the
&quot;acl&quot; sub-entry within the dict returns by <b class="cmd">S3::GetAcl -result-type dict</b>.
The proper XML is generated and applied to the resource.  Note that a
value containing &quot;//&quot; is assumed to be a group, a value containing &quot;@&quot;
is assumed to be an AmazonCustomerByEmail, and otherwise the value is
assumed to be a canonical Amazon ID.</p>
<p>Note that you cannot change the owner, so calling GetAcl on a resource
owned by one user and applying it via PutAcl on a resource owned by
another user may not do exactly what you expect.</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">S3::Delete</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-resource</b> <i class="arg">resourcename</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-status</b> <i class="arg">statusvar</i>?</span></a></dt>
<dd><p>This command deletes the specified resource from the specified bucket.
It returns 1 if the resource was deleted successfully, 0 otherwise.
It returns 0 rather than throwing an S3 remote error.</p>
<dl class="definitions">
<dt><b class="option">-bucket</b></dt>
<dd><p>This specifies the bucket from which the resource will be deleted.
Leading and/or trailing slashes are removed for you, as are spaces.</p></dd>
<dt><b class="option">-resource</b></dt>
<dd><p>This is the full name of the resource within the bucket. A single 
leading slash is removed, but not a trailing slash. 
Spaces are not trimmed.</p></dd>
<dt><b class="option">-blocking</b></dt>
<dd><p>The standard blocking flag.</p></dd>
<dt><b class="option">-status</b></dt>
<dd><p>If specified, the indicated (not necessarily global) variable 
in the caller's scope is set to a two-element list. The first
element is the 3-digit HTTP status code. The second element
is the HTTP message (such as &quot;OK&quot; or &quot;Forbidden&quot;). Note that
Amazon's DELETE result is 204 on success, that being the 
code indicating no content in the returned body.</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">S3::Push</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-directory</b> <i class="arg">directoryname</i> <span class="opt">?<b class="option">-prefix</b> <i class="arg">prefixstring</i>?</span> <span class="opt">?<b class="option">-compare</b> <i class="arg">comparemode</i>?</span> <span class="opt">?<b class="option">-x-amz-meta-*</b> <i class="arg">metastring</i>?</span> <span class="opt">?<b class="option">-acl</b> <i class="arg">aclcode</i>?</span> <span class="opt">?<b class="option">-delete</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-error</b> <i class="arg">throw|break|continue</i>?</span> <span class="opt">?<b class="option">-progress</b> <i class="arg">scriptprefix</i>?</span></a></dt>
<dd><p>This synchronises a local directory with a remote bucket
by pushing the differences using <b class="cmd">S3::Put</b>. Note that
if something has changed in the bucket but not locally,
those changes could be lost. Thus, this is not a general
two-way synchronization primitive. (See <b class="cmd">S3::Sync</b> 
for that.) Note too that resource names are case sensitive,
so changing the case of a file on a Windows machine may lead
to otherwise-unnecessary transfers. 
Note that only regular files are considered, so devices, pipes, symlinks,
and directories are not copied.</p>
<dl class="definitions">
<dt><b class="option">-bucket</b></dt>
<dd><p>This names the bucket into which data will be pushed.</p></dd>
<dt><b class="option">-directory</b></dt>
<dd><p>This names the local directory from which files will be taken.
It must exist, be readable via [glob] and so on. If only
some of the files therein are readable, <b class="cmd">S3::Push</b> will PUT
those files that are readable and return in its results the list
of files that could not be opened.</p></dd>
<dt><b class="option">-prefix</b></dt>
<dd><p>This names the prefix that will be added to all resources. 
That is, it is the remote equivalent of <b class="option">-directory</b>.
If it is not specified, the root of the bucket will be treated
as the remote directory. An example may clarify.</p>
<pre class="example">
S3::Push -bucket test -directory /tmp/xyz -prefix hello/world
</pre>
<p>In this example, /tmp/xyz/pdq.html will be stored as
http://s3.amazonaws.com/test/hello/world/pdq.html in Amazon's servers. Also,
/tmp/xyz/abc/def/Hello will be stored as
http://s3.amazonaws.com/test/hello/world/abc/def/Hello in Amazon's servers.
Without the <b class="option">-prefix</b> option, /tmp/xyz/pdq.html would be stored
as http://s3.amazonaws.com/test/pdq.html.</p></dd>
<dt><b class="option">-blocking</b></dt>
<dd><p>This is the standard blocking option.</p></dd>
<dt><b class="option">-compare</b></dt>
<dd><p>If present, this is passed to each invocation of <b class="cmd">S3::Put</b>.
Naturally, <b class="cmd">S3::Configure -default-compare</b> is used 
if this is not specified.</p></dd>
<dt><b class="option">-x-amz-meta-*</b></dt>
<dd><p>If present, this is passed to each invocation of <b class="cmd">S3::Put</b>. All copied
files will have the same metadata.</p></dd>
<dt><b class="option">-acl</b></dt>
<dd><p>If present, this is passed to each invocation of <b class="cmd">S3::Put</b>.</p></dd>
<dt><b class="option">-delete</b></dt>
<dd><p>This defaults to false. If true, resources in the destination that
are not in the source directory are deleted with <b class="cmd">S3::Delete</b>.
Since only regular files are considered, the existance of a symlink,
pipe, device, or directory in the local source will <em>not</em>
prevent the deletion of a remote resource with a corresponding name.</p></dd>
<dt><b class="option">-error</b></dt>
<dd><p>This controls the behavior of <b class="cmd">S3::Push</b> in the event that
<b class="cmd">S3::Put</b> throws an error. Note that
errors encountered on the local file system or in reading the
list of resources in the remote bucket always throw errors.
This option allows control over &quot;partial&quot; errors, when some 
files were copied and some were not. <b class="cmd">S3::Delete</b> is always
finished up, with errors simply recorded in the return result.</p>
<dl class="definitions">
<dt>throw</dt>
<dd><p>The error is rethrown with the same errorCode.</p></dd>
<dt>break</dt>
<dd><p>Processing stops without throwing an error, the error is recorded
in the return value, and the command returns with a normal return.
The calls to <b class="cmd">S3::Delete</b> are not started.</p></dd>
<dt>continue</dt>
<dd><p>This is the default. Processing continues without throwing,
recording the error in the return result, and resuming with the
next file in the local directory to be copied.</p></dd>
</dl></dd>
<dt><b class="option">-progress</b></dt>
<dd><p>If this is specified and the indicated script prefix is not empty, the
indicated script prefix will be invoked several times in the caller's
context with additional arguments at various points in the processing.
This allows progress reporting without backgrounding.  The provided
prefix will be invoked with additional arguments, with the first
additional argument indicating what part of the process is being
reported on.  The prefix is initially invoked with <i class="arg">args</i> as the
first additional argument and a dictionary representing the normalized
arguments to the <b class="cmd">S3::Push</b> call as the second additional argument.
Then the prefix is invoked with <i class="arg">local</i> as the first additional
argument and a list of suffixes of the files to be considered as the
second argument.  Then the prefix is invoked with <i class="arg">remote</i> as the
first additional argument and a list of suffixes existing in the remote
bucket as the second additional argument.  Then, for each file in the
local list, the prefix will be invoked with <i class="arg">start</i> as the first
additional argument and the common suffix as the second additional
argument.  When <b class="cmd">S3::Put</b> returns for that file, the prefix will be
invoked with <i class="arg">copy</i> as the first additional argument, the common
suffix as the second additional argument, and a third argument that will
be &quot;copied&quot; (if <b class="cmd">S3::Put</b> sent the resource), &quot;skipped&quot; (if 
<b class="cmd">S3::Put</b> decided not to based on <b class="option">-compare</b>), or the errorCode
that <b class="cmd">S3::Put</b> threw due to unexpected errors (in which case the
third argument is a list that starts with &quot;S3&quot;). When all files have
been transfered, the prefix may be invoked zero or more times with
<i class="arg">delete</i> as the first additional argument and the suffix of the
resource being deleted as the second additional argument, with a third
argument being either an empty string (if the delete worked) or the
errorCode from <b class="cmd">S3::Delete</b> if it failed. Finally, the prefix
will be invoked with <i class="arg">finished</i> as the first additional argument 
and the return value as the second additional argument.</p></dd>
</dl>
<p>The return result from this command is a dictionary. They keys are the 
suffixes (i.e., the common portion of the path after the <b class="option">-directory</b>
and <b class="option">-prefix</b>), while the values are either &quot;copied&quot;, &quot;skipped&quot; (if
<b class="option">-compare</b> indicated not to copy the file), or the errorCode 
thrown by <b class="cmd">S3::Put</b>, as appropriate. If <b class="option">-delete</b> was true,
there may also be entries for suffixes with the value &quot;deleted&quot; or 
&quot;notdeleted&quot;, indicating whether the attempted <b class="cmd">S3::Delete</b> 
worked or not, respectively. There is one additional pair in the return
result, whose key is the empty string and whose value is a nested dictionary.
The keys of this nested dictionary include &quot;filescopied&quot; (the number of 
files successfully copied), &quot;bytescopied&quot; (the number of data bytes in
the files copied, excluding headers, metadata, etc), &quot;compareskipped&quot; (the 
number of files not copied due to <b class="option">-compare</b> mode), &quot;errorskipped&quot;
(the number of files not copied due to thrown errors), &quot;filesdeleted&quot;
(the number of resources deleted due to not having corresponding files
locally, or 0 if <b class="option">-delete</b> is false), and &quot;filesnotdeleted&quot; 
(the number of resources whose deletion was attempted but failed).</p>
<p>Note that this is currently implemented somewhat inefficiently.
It fetches the bucket listing (including timestamps and eTags),
then calls <b class="cmd">S3::Put</b>, which uses HEAD to find the timestamps
and eTags again. Correcting this with no API change 
is planned for a future upgrade.</p></dd>
<dt><a name="15"><b class="cmd">S3::Pull</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-directory</b> <i class="arg">directoryname</i> <span class="opt">?<b class="option">-prefix</b> <i class="arg">prefixstring</i>?</span> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-compare</b> <i class="arg">comparemode</i>?</span> <span class="opt">?<b class="option">-delete</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-timestamp</b> <i class="arg">aws|now</i>?</span> <span class="opt">?<b class="option">-error</b> <i class="arg">throw|break|continue</i>?</span> <span class="opt">?<b class="option">-progress</b> <i class="arg">scriptprefix</i>?</span></a></dt>
<dd><p>This synchronises a remote bucket with a local directory by pulling the 
differences using <b class="cmd">S3::Get</b> If something has been changed locally but not
in the bucket, those difference may be lost. This is not a general two-way 
synchronization mechanism. (See <b class="cmd">S3::Sync</b> for that.) 
This creates directories
if needed; new directories are created with default permissions. Note that 
resource names are case sensitive, so changing the case of a file on a 
Windows machine may lead to otherwise-unnecessary transfers. Also, try not
to store data in resources that end with a slash, or which are prefixes of
resources that otherwise would start with a slash; i.e., don't use this if
you store data in resources whose names have to be directories locally.</p>
<p>Note that this is currently implemented somewhat inefficiently.
It fetches the bucket listing (including timestamps and eTags),
then calls <b class="cmd">S3::Get</b>, which uses HEAD to find the timestamps
and eTags again. Correcting this with no API change 
is planned for a future upgrade.</p>
<dl class="definitions">
<dt><b class="option">-bucket</b></dt>
<dd><p>This names the bucket from which data will be pulled.</p></dd>
<dt><b class="option">-directory</b></dt>
<dd><p>This names the local directory into which files will be written
It must exist, be readable via [glob], writable for file creation,
and so on. If only some of the files therein are writable, 
<b class="cmd">S3::Pull</b> will GET
those files that are writable and return in its results the list
of files that could not be opened.</p></dd>
<dt><b class="option">-prefix</b></dt>
<dd><p>The prefix of resources that will be considered for retrieval.
See <b class="cmd">S3::Push</b> for more details, examples, etc. (Of course,
<b class="cmd">S3::Pull</b> reads rather than writes, but the prefix is 
treated similarly.)</p></dd>
<dt><b class="option">-blocking</b></dt>
<dd><p>This is the standard blocking option.</p></dd>
<dt><b class="option">-compare</b></dt>
<dd><p>This is passed to each invocation of <b class="cmd">S3::Get</b> if provided. 
Naturally, <b class="cmd">S3::Configure -default-compare</b> is 
used if this is not provided.</p></dd>
<dt><b class="option">-timestamp</b></dt>
<dd><p>This is passed to each invocation of <b class="cmd">S3::Get</b> if provided.</p></dd>
<dt><b class="option">-delete</b></dt>
<dd><p>If this is specified and true, files that exist in the <b class="option">-directory</b>
that are not in the <b class="option">-prefix</b> will be deleted after all resources
have been copied. In addition, empty directories (other than the
top-level <b class="option">-directory</b>) will be deleted, as
Amazon S3 has no concept of an empty directory.</p></dd>
<dt><b class="option">-error</b></dt>
<dd><p>See <b class="cmd">S3::Push</b> for a description of this option.</p></dd>
<dt><b class="option">-progress</b></dt>
<dd><p>See <b class="cmd">S3::Push</b> for a description of this option. 
It differs slightly in that local directories may be included
with a trailing slash to indicate they are directories.</p></dd>
</dl>
<p>The return value from this command is a dictionary. It 
is identical in form and meaning to the description of the
return result of <b class="cmd">S3::Push</b>. It differs only in that
directories may be included, with a trailing slash in their name,
if they are empty and get deleted.</p></dd>
<dt><a name="16"><b class="cmd">S3::Toss</b> <span class="opt">?<b class="option">-bucket</b> <i class="arg">bucketname</i>?</span> <b class="option">-prefix</b> <i class="arg">prefixstring</i> <span class="opt">?<b class="option">-blocking</b> <i class="arg">boolean</i>?</span> <span class="opt">?<b class="option">-error</b> <i class="arg">throw|break|continue</i>?</span> <span class="opt">?<b class="option">-progress</b> <i class="arg">scriptprefix</i>?</span></a></dt>
<dd><p>This deletes some or all resources within a bucket. It would be
considered a &quot;recursive delete&quot; had Amazon implemented actual
directories.</p>
<dl class="options">
<dt><b class="option">-bucket</b></dt>
<dd><p>The bucket from which resources will be deleted.</p></dd>
<dt><b class="option"><b class="option">-blocking</b></b></dt>
<dd><p>The standard blocking option.</p></dd>
<dt><b class="option"><b class="option">-prefix</b></b></dt>
<dd><p>The prefix for resources to be deleted. Any resource that
starts with this string will be deleted. This is required.
To delete everything in the bucket, pass an empty string
for the prefix.</p></dd>
<dt><b class="option"><b class="option">-error</b></b></dt>
<dd><p>If this is &quot;throw&quot;, <b class="cmd">S3::Toss</b> rethrows any errors
it encounters.  If this is &quot;break&quot;, <b class="cmd">S3::Toss</b> returns
with a normal return after the first error, recording that
error in the return result. If this is &quot;continue&quot;, which is
the default, <b class="cmd">S3::Toss</b> continues on and lists all 
errors in the return result.</p></dd>
<dt><b class="option"><b class="option">-progress</b></b></dt>
<dd><p>If this is specified and not an empty string, the script
prefix will be invoked several times in the context of the caller
with additional arguments appended.  Initially, it will be invoked
with the first additional argument being <i class="arg">args</i> and the second
being the processed list of arguments to <b class="cmd">S3::Toss</b>. Then it
is invoked with <i class="arg">remote</i> as the first additional argument and
the list of suffixes in the bucket to be deleted as the second
additional argument. Then it is invoked with the first additional
argument being <i class="arg">delete</i> and the second additional argument being
the suffix deleted and the third additional argument being &quot;deleted&quot;
or &quot;notdeleted&quot; depending on whether <b class="cmd">S3::Delete</b> threw an error.
Finally, the script prefix is invoked with a first additional argument
of &quot;finished&quot; and a second additional argument of the return value.</p></dd>
</dl>
<p>The return value is a dictionary. The keys are the suffixes of files
that <b class="cmd">S3::Toss</b> attempted to delete, and whose values are either
the string &quot;deleted&quot; or &quot;notdeleted&quot;. There is also one additional
pair, whose key is the empty string and whose value is an embedded
dictionary. The keys of this embedded dictionary include 
&quot;filesdeleted&quot; and &quot;filesnotdeleted&quot;, each of which has integer values.</p></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">LIMITATIONS</a></h2>
<ul class="itemized">
<li><p>The pure-Tcl MD5 checking is slow. If you are processing
files in the megabyte range, consider ensuring binary support is available.</p></li>
<li><p>The commands <b class="cmd">S3::Pull</b> and <b class="cmd">S3::Push</b> fetch a
directory listing which includes timestamps and MD5 hashes, 
then invoke <b class="cmd">S3::Get</b> and <b class="cmd">S3::Put</b>. If
a complex <b class="option">-compare</b> mode is specified, <b class="cmd">S3::Get</b> and 
<b class="cmd">S3::Put</b> will invoke a HEAD operation for each file to fetch
timestamps and MD5 hashes of each resource again. It is expected that
a future release of this package will solve this without any API changes.</p></li>
<li><p>The commands <b class="cmd">S3::Pull</b> and <b class="cmd">S3::Push</b> fetch a
directory listing without using <b class="option">-max-count</b>. The entire 
directory is pulled into memory at once. For very large buckets,
this could be a performance problem. The author, at this time,
does not plan to change this behavior. Welcome to Open Source.</p></li>
<li><p><b class="cmd">S3::Sync</b> is neither designed nor implemented yet. 
The intention would be to keep changes synchronised, so changes
could be made to both the bucket and the local directory and
be merged by <b class="cmd">S3::Sync</b>.</p></li>
<li><p>Nor is
<b class="option">-compare</b> <i class="arg">calc</i> fully implemented. This is primarily due to
Windows not providing a convenient method for distinguishing between
local files that are &quot;public-read&quot; or &quot;public-read-write&quot;. Assistance
figuring out TWAPI for this would be appreciated. The U**X semantics
are difficult to map directly as well. See the source for details.
Note that there are not tests for calc, since it isn't done yet.</p></li>
<li><p>The HTTP processing is implemented within the library, 
rather than using a &quot;real&quot; HTTP package. Hence, multi-line headers
are not (yet) handled correctly. Do not include carriage returns or
linefeeds in x-amz-meta-* headers, content-type values, and so on. 
The author does not at this time expect to improve this.</p></li>
<li><p>Internally, <b class="cmd">S3::Push</b> and <b class="cmd">S3::Pull</b> and <b class="cmd">S3::Toss</b>
are all very similar and should be refactored.</p></li>
<li><p>The idea of using <b class="option">-compare</b> <i class="arg">never</i> 
<b class="option">-delete</b> <i class="arg">true</i> to delete files that have been 
deleted from one place but not the other yet not copying 
changed files is untested.</p></li>
</ul>
</div>
<div id="section7" class="section"><h2><a name="section7">USAGE SUGGESTIONS</a></h2>
<p>To fetch a &quot;directory&quot; out of a bucket, make changes, and store it back:</p>
<pre class="example">
file mkdir ./tempfiles
S3::Pull -bucket sample -prefix of/interest -directory ./tempfiles \
  -timestamp aws
do_my_process ./tempfiles other arguments
S3::Push -bucket sample -prefix of/interest -directory ./tempfiles \
  -compare newer -delete true
</pre>
<p>To delete files locally that were deleted off of S3 but not otherwise
update files:</p>
<pre class="example">
S3::Pull -bucket sample -prefix of/interest -directory ./myfiles \
  -compare never -delete true
</pre>
</div>
<div id="section8" class="section"><h2><a name="section8">FUTURE DEVELOPMENTS</a></h2>
<p>The author intends to work on several additional projects related to 
this package, in addition to finishing the unfinished features.</p>
<p>First, a command-line program allowing browsing of buckets and 
transfer of files from shell scripts and command prompts is useful.</p>
<p>Second, a GUI-based program allowing visual manipulation of
bucket and resource trees not unlike Windows Explorer would
be useful.</p>
<p>Third, a command-line (and perhaps a GUI-based) program called
&quot;OddJob&quot; that will use S3 to synchronize computation amongst 
multiple servers running OddJob. An S3 bucket will be set up
with a number of scripts to run, and the OddJob program can
be invoked on multiple machines to run scripts on all the machines,
each moving on to the next unstarted task as it finishes each.
This is still being designed, and it is intended primarily
to be run on Amazon's Elastic Compute Cloud.</p>
</div>
<div id="section9" class="section"><h2><a name="section9">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>amazon-s3</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key474">amazon</a>, <a href="../../../../index.html#key475">cloud</a>, <a href="../../../../index.html#key473">s3</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; Copyright 2006,2008 Darren New. All Rights Reserved. See LICENSE.TXT for terms.</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/amazon-s3/xsxp.html.




















































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>xsxp - Amazon S3 Web Service Utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/amazon-s3/xsxp.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; Copyright 2006 Darren New. All Rights Reserved.
   -->
<! -- CVS: $Id$ xsxp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">xsxp(n) 1.0 tcllib &quot;Amazon S3 Web Service Utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>xsxp - eXtremely Simple Xml Parser</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">xml</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">xsxp::parse</b> <i class="arg">xml</i></a></li>
<li><a href="#2"><b class="cmd">xsxp::fetch</b> <i class="arg">pxml</i> <i class="arg">path</i> <span class="opt">?<i class="arg">part</i>?</span></a></li>
<li><a href="#3"><b class="cmd">xsxp::fetchall</b> <i class="arg">pxml_list</i> <i class="arg">path</i> <span class="opt">?<i class="arg">part</i>?</span></a></li>
<li><a href="#4"><b class="cmd">xsxp::only</b> <i class="arg">pxml</i> <i class="arg">tagname</i></a></li>
<li><a href="#5"><b class="cmd">xsxp::prettyprint</b> <i class="arg">pxml</i> <span class="opt">?<i class="arg">chan</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a simple interface to parse XML into a pure-value list.
It also provides accessor routines to pull out specific subtags, 
not unlike DOM access. 
This package was written for and is used by Darren New's Amazon S3 access package.</p>
<p>This is pretty lame, but I needed something like this for S3,
and at the time, TclDOM would not work with the new 8.5 Tcl
due to version number problems.</p>
<p>In addition, this is a pure-value implementation. There is no
garbage to clean up in the event of a thrown error, for example.
This simplifies the code for sufficiently small XML documents,
which is what Amazon's S3 guarantees.</p>
<p>Copyright 2006 Darren New. All Rights Reserved.
NO WARRANTIES OF ANY TYPE ARE PROVIDED.
COPYING OR USE INDEMNIFIES THE AUTHOR IN ALL WAYS.
This software is licensed under essentially the same 
terms as Tcl. See LICENSE.txt for the terms.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<p>The package implements five rather simple procedures.
One parses, one is for debugging, and the rest pull various
parts of the parsed document out for processing.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">xsxp::parse</b> <i class="arg">xml</i></a></dt>
<dd><p>This parses an XML document (using the standard xml tcllib module in a SAX sort of way) and builds a data structure which it returns if the parsing succeeded. The return value is referred to herein as a &quot;pxml&quot;, or &quot;parsed xml&quot;. The list consists of two or more elements:</p>
<ul class="itemized">
<li><p>The first element is the name of the tag.</p></li>
<li><p>The second element is an array-get formatted list of key/value pairs. The keys are attribute names and the values are attribute values. This is an empty list if there are no attributes on the tag.</p></li>
<li><p>The third through end elements are the children of the node, if any. Each child is, recursively, a pxml.</p></li>
<li><p>Note that if the zero'th element, i.e. the tag name, is &quot;%PCDATA&quot;, then
the attributes will be empty and the third element will be the text of the element. In addition, if an element's contents consists only of PCDATA, it will have only one child, and all the PCDATA will be concatenated. In other words, 
this parser works poorly for XML with elements that contain both child tags and PCDATA.  Since Amazon S3 does not do this (and for that matter most 
uses of XML where XML is a poor choice don't do this), this is probably
not a serious limitation.</p></li>
</ul></dd>
<dt><a name="2"><b class="cmd">xsxp::fetch</b> <i class="arg">pxml</i> <i class="arg">path</i> <span class="opt">?<i class="arg">part</i>?</span></a></dt>
<dd><p><i class="arg">pxml</i> is a parsed XML, as returned from xsxp::parse.
<i class="arg">path</i> is a list of element tag names. Each element is the name
of a child to look up, optionally followed by a 
hash (&quot;#&quot;) and a string of digits. An empty list or an initial empty element
selects <i class="arg">pxml</i>. If no hash sign is present, the behavior is as if &quot;#0&quot;
had been appended to that element. (In addition to a list, slashes can separate subparts where convenient.)</p>
<p>An element of <i class="arg">path</i> scans the children at the indicated level
for the n'th instance of a child whose tag matches the part of the
element before the hash sign. If an element is simply &quot;#&quot;  followed
by digits, that indexed child is selected, regardless of the tags
in the children. Hence, an element of &quot;#3&quot; will always select
the fourth child of the node under consideration.</p>
<p><i class="arg">part</i> defaults to &quot;%ALL&quot;. It can be one of the following case-sensitive terms:</p>
<dl class="definitions">
<dt>%ALL</dt>
<dd><p>returns the entire selected element.</p></dd>
<dt>%TAGNAME</dt>
<dd><p>returns lindex 0 of the selected element.</p></dd>
<dt>%ATTRIBUTES</dt>
<dd><p>returns index 1 of the selected element.</p></dd>
<dt>%CHILDREN</dt>
<dd><p>returns lrange 2 through end of the selected element,
resulting in a list of elements being returned.</p></dd>
<dt>%PCDATA</dt>
<dd><p>returns a concatenation of all the bodies of
direct children of this node whose tag is %PCDATA.
It throws an error if no such children are found. That
is, part=%PCDATA means return the textual content found
in that node but not its children nodes.</p></dd>
<dt>%PCDATA?</dt>
<dd><p>is like %PCDATA, but returns an empty string if
no PCDATA is found.</p></dd>
</dl>
<p>For example, to fetch the first bold text from the fifth paragraph of the body of your HTML file,</p>
<pre class="example">xsxp::fetch $pxml {html body p#4 b} %PCDATA</pre>
</dd>
<dt><a name="3"><b class="cmd">xsxp::fetchall</b> <i class="arg">pxml_list</i> <i class="arg">path</i> <span class="opt">?<i class="arg">part</i>?</span></a></dt>
<dd><p>This iterates over each PXML in <i class="arg">pxml_list</i> (which must be a list 
of pxmls) selecting the indicated path from it, building a new list 
with the selected data, and returning that new list.</p>
<p>For example, <i class="arg">pxml_list</i> might be
the %CHILDREN of a particular element, and the <i class="arg">path</i> and <i class="arg">part</i>
might select from each child a sub-element in which we're interested.</p></dd>
<dt><a name="4"><b class="cmd">xsxp::only</b> <i class="arg">pxml</i> <i class="arg">tagname</i></a></dt>
<dd><p>This iterates over the direct children of <i class="arg">pxml</i> and selects only
those with <i class="arg">tagname</i> as their tag. Returns a list of matching
elements.</p></dd>
<dt><a name="5"><b class="cmd">xsxp::prettyprint</b> <i class="arg">pxml</i> <span class="opt">?<i class="arg">chan</i>?</span></a></dt>
<dd><p>This outputs to <i class="arg">chan</i> (default stdout) a pretty-printed
version of <i class="arg">pxml</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>amazon-s3</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key694">dom</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key695">xml</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; Copyright 2006 Darren New. All Rights Reserved.</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/asn/asn.html.

























































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>asn - ASN.1 processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/asn/asn.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2004 Jochen Loewer &lt;[email protected]&gt;   -- Copyright &copy; 2004-2011 Michael Schlenker &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ asn.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">asn(n) 0.8 tcllib &quot;ASN.1 processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>asn - ASN.1 BER encoder/decoder</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a>
<ul>
<li class="subsection"><a href="#subsection1">ENCODER</a></li>
<li class="subsection"><a href="#subsection2">DECODER</a></li>
<li class="subsection"><a href="#subsection3">HANDLING TAGS</a></li>
</ul>
</li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">asn <span class="opt">?0.8.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::asn::asnSequence</b> <i class="arg">evalue</i>...</a></li>
<li><a href="#2"><b class="cmd">::asn::asnSequenceFromList</b> <i class="arg">elist</i></a></li>
<li><a href="#3"><b class="cmd">::asn::asnSet</b> <i class="arg">evalue</i>...</a></li>
<li><a href="#4"><b class="cmd">::asn::asnSetFromList</b> <i class="arg">elist</i></a></li>
<li><a href="#5"><b class="cmd">::asn::asnApplicationConstr</b> <i class="arg">appNumber</i> <i class="arg">evalue</i>...</a></li>
<li><a href="#6"><b class="cmd">::asn::asnApplication</b> <i class="arg">appNumber</i> <i class="arg">data</i></a></li>
<li><a href="#7"><b class="cmd">::asn::asnChoice</b> <i class="arg">appNumber</i> <i class="arg">evalue</i>...</a></li>
<li><a href="#8"><b class="cmd">::asn::asnChoiceConstr</b> <i class="arg">appNumber</i> <i class="arg">evalue</i>...</a></li>
<li><a href="#9"><b class="cmd">::asn::asnInteger</b> <i class="arg">number</i></a></li>
<li><a href="#10"><b class="cmd">::asn::asnEnumeration</b> <i class="arg">number</i></a></li>
<li><a href="#11"><b class="cmd">::asn::asnBoolean</b> <i class="arg">bool</i></a></li>
<li><a href="#12"><b class="cmd">::asn::asnContext</b> <i class="arg">context</i> <i class="arg">data</i></a></li>
<li><a href="#13"><b class="cmd">::asn::asnContextConstr</b> <i class="arg">context</i> <i class="arg">evalue</i>...</a></li>
<li><a href="#14"><b class="cmd">::asn::asnObjectIdentifier</b> <i class="arg">idlist</i></a></li>
<li><a href="#15"><b class="cmd">::asn::asnUTCTime</b> <i class="arg">utcstring</i></a></li>
<li><a href="#16"><b class="cmd">::asn::asnNull</b></a></li>
<li><a href="#17"><b class="cmd">::asn::asnBitString</b> <i class="arg">string</i></a></li>
<li><a href="#18"><b class="cmd">::asn::asnOctetString</b> <i class="arg">string</i></a></li>
<li><a href="#19"><b class="cmd">::asn::asnNumericString</b> <i class="arg">string</i></a></li>
<li><a href="#20"><b class="cmd">::asn::asnPrintableString</b> <i class="arg">string</i></a></li>
<li><a href="#21"><b class="cmd">::asn::asnIA5String</b> <i class="arg">string</i></a></li>
<li><a href="#22"><b class="cmd">::asn::asnBMPString</b> <i class="arg">string</i></a></li>
<li><a href="#23"><b class="cmd">::asn::asnUTF8String</b> <i class="arg">string</i></a></li>
<li><a href="#24"><b class="cmd">::asn::asnString</b> <i class="arg">string</i></a></li>
<li><a href="#25"><b class="cmd">::asn::defaultStringType</b> <span class="opt">?<i class="arg">type</i>?</span></a></li>
<li><a href="#26"><b class="cmd">::asn::asnPeekByte</b> <i class="arg">data_var</i> <i class="arg">byte_var</i></a></li>
<li><a href="#27"><b class="cmd">::asn::asnGetLength</b> <i class="arg">data_var</i> <i class="arg">length_var</i></a></li>
<li><a href="#28"><b class="cmd">::asn::asnGetResponse</b> <i class="arg">chan</i> <i class="arg">data_var</i></a></li>
<li><a href="#29"><b class="cmd">::asn::asnGetInteger</b> <i class="arg">data_var</i> <i class="arg">int_var</i></a></li>
<li><a href="#30"><b class="cmd">::asn::asnGetEnumeration</b> <i class="arg">data_var</i> <i class="arg">enum_var</i></a></li>
<li><a href="#31"><b class="cmd">::asn::asnGetOctetString</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></li>
<li><a href="#32"><b class="cmd">::asn::asnGetString</b> <i class="arg">data_var</i> <i class="arg">string_var</i> <span class="opt">?<i class="arg">type_var</i>?</span></a></li>
<li><a href="#33"><b class="cmd">::asn::asnGetNumericString</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></li>
<li><a href="#34"><b class="cmd">::asn::asnGetPrintableString</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></li>
<li><a href="#35"><b class="cmd">::asn::asnGetIA5String</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></li>
<li><a href="#36"><b class="cmd">::asn::asnGetBMPString</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></li>
<li><a href="#37"><b class="cmd">::asn::asnGetUTF8String</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></li>
<li><a href="#38"><b class="cmd">::asn::asnGetUTCTime</b> <i class="arg">data_var</i> <i class="arg">utc_var</i></a></li>
<li><a href="#39"><b class="cmd">::asn::asnGetBitString</b> <i class="arg">data_var</i> <i class="arg">bits_var</i></a></li>
<li><a href="#40"><b class="cmd">::asn::asnGetObjectIdentifier</b> <i class="arg">data_var</i> <i class="arg">oid_var</i></a></li>
<li><a href="#41"><b class="cmd">::asn::asnGetBoolean</b> <i class="arg">data_var</i> <i class="arg">bool_var</i></a></li>
<li><a href="#42"><b class="cmd">::asn::asnGetNull</b> <i class="arg">data_var</i></a></li>
<li><a href="#43"><b class="cmd">::asn::asnGetSequence</b> <i class="arg">data_var</i> <i class="arg">sequence_var</i></a></li>
<li><a href="#44"><b class="cmd">::asn::asnGetSet</b> <i class="arg">data_var</i> <i class="arg">set_var</i></a></li>
<li><a href="#45"><b class="cmd">::asn::asnGetApplication</b> <i class="arg">data_var</i> <i class="arg">appNumber_var</i> <span class="opt">?<i class="arg">content_var</i>?</span> <span class="opt">?<i class="arg">encodingType_var</i>?</span></a></li>
<li><a href="#46"><b class="cmd">::asn::asnGetContext</b> <i class="arg">data_var</i> <i class="arg">contextNumber_var</i> <span class="opt">?<i class="arg">content_var</i>?</span> <span class="opt">?<i class="arg">encodingType_var</i>?</span></a></li>
<li><a href="#47"><b class="cmd">::asn::asnPeekTag</b> <i class="arg">data_var</i> <i class="arg">tag_var</i> <i class="arg">tagtype_var</i> <i class="arg">constr_var</i></a></li>
<li><a href="#48"><b class="cmd">::asn::asnTag</b> <i class="arg">tagnumber</i> <span class="opt">?<i class="arg">class</i>?</span> <span class="opt">?<i class="arg">tagstyle</i>?</span></a></li>
<li><a href="#49"><b class="cmd">::asn::asnRetag</b> <i class="arg">data_var</i> <i class="arg">newTag</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">asn</b> package provides <em>partial</em> de- and encoder
commands for BER encoded ASN.1 data. It can also be used for
decoding DER, which is a restricted subset of BER.</p>
<p>ASN.1 is a standard <i class="term">Abstract Syntax Notation</i>, and BER are its
<i class="term">Basic Encoding Rules</i>.</p>
<p>See <a href="http://asn1.elibel.tm.fr/en/standards/index.htm">http://asn1.elibel.tm.fr/en/standards/index.htm</a> for more
information about the standard.</p>
<p>Also see <a href="http://luca.ntop.org/Teaching/Appunti/asn1.html">http://luca.ntop.org/Teaching/Appunti/asn1.html</a> for
<em>A Layman's Guide to a Subset of ASN.1, BER, and DER</em>, an RSA
Laboratories Technical Note by Burton S. Kaliski Jr. (Revised November
1, 1993). A text version of this note is part of the module sources
and should be read by any implementor.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">ENCODER</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::asn::asnSequence</b> <i class="arg">evalue</i>...</a></dt>
<dd><p>Takes zero or more encoded values, packs them into an ASN sequence and
returns its encoded binary form.</p></dd>
<dt><a name="2"><b class="cmd">::asn::asnSequenceFromList</b> <i class="arg">elist</i></a></dt>
<dd><p>Takes a list of encoded values, packs them into an ASN sequence and
returns its encoded binary form.</p></dd>
<dt><a name="3"><b class="cmd">::asn::asnSet</b> <i class="arg">evalue</i>...</a></dt>
<dd><p>Takes zero or more encoded values, packs them into an ASN set and
returns its encoded binary form.</p></dd>
<dt><a name="4"><b class="cmd">::asn::asnSetFromList</b> <i class="arg">elist</i></a></dt>
<dd><p>Takes a list of encoded values, packs them into an ASN set and
returns its encoded binary form.</p></dd>
<dt><a name="5"><b class="cmd">::asn::asnApplicationConstr</b> <i class="arg">appNumber</i> <i class="arg">evalue</i>...</a></dt>
<dd><p>Takes zero or more encoded values, packs them into an ASN application
construct and returns its encoded binary form.</p></dd>
<dt><a name="6"><b class="cmd">::asn::asnApplication</b> <i class="arg">appNumber</i> <i class="arg">data</i></a></dt>
<dd><p>Takes a single encoded value <i class="arg">data</i>, packs it into an ASN
application construct and returns its encoded binary form.</p></dd>
<dt><a name="7"><b class="cmd">::asn::asnChoice</b> <i class="arg">appNumber</i> <i class="arg">evalue</i>...</a></dt>
<dd><p>Takes zero or more encoded values, packs them into an ASN choice
construct and returns its encoded binary form.</p></dd>
<dt><a name="8"><b class="cmd">::asn::asnChoiceConstr</b> <i class="arg">appNumber</i> <i class="arg">evalue</i>...</a></dt>
<dd><p>Takes zero or more encoded values, packs them into an ASN choice
construct and returns its encoded binary form.</p></dd>
<dt><a name="9"><b class="cmd">::asn::asnInteger</b> <i class="arg">number</i></a></dt>
<dd><p>Returns the encoded form of the specified integer
<i class="arg">number</i>.</p></dd>
<dt><a name="10"><b class="cmd">::asn::asnEnumeration</b> <i class="arg">number</i></a></dt>
<dd><p>Returns the encoded form of the specified enumeration id
<i class="arg">number</i>.</p></dd>
<dt><a name="11"><b class="cmd">::asn::asnBoolean</b> <i class="arg">bool</i></a></dt>
<dd><p>Returns the encoded form of the specified boolean value
<i class="arg">bool</i>.</p></dd>
<dt><a name="12"><b class="cmd">::asn::asnContext</b> <i class="arg">context</i> <i class="arg">data</i></a></dt>
<dd><p>Takes an encoded value and packs it into a constructed value with
application tag, the <i class="arg">context</i> number.</p></dd>
<dt><a name="13"><b class="cmd">::asn::asnContextConstr</b> <i class="arg">context</i> <i class="arg">evalue</i>...</a></dt>
<dd><p>Takes zero or more encoded values and packs them into a constructed
value with application tag, the <i class="arg">context</i> number.</p></dd>
<dt><a name="14"><b class="cmd">::asn::asnObjectIdentifier</b> <i class="arg">idlist</i></a></dt>
<dd><p>Takes a list of at least 2 integers describing an object identifier
(OID) value, and returns the encoded value.</p></dd>
<dt><a name="15"><b class="cmd">::asn::asnUTCTime</b> <i class="arg">utcstring</i></a></dt>
<dd><p>Returns the encoded form of the specified UTC time string.</p></dd>
<dt><a name="16"><b class="cmd">::asn::asnNull</b></a></dt>
<dd><p>Returns the NULL encoding.</p></dd>
<dt><a name="17"><b class="cmd">::asn::asnBitString</b> <i class="arg">string</i></a></dt>
<dd><p>Returns the encoded form of the specified <i class="arg">string</i>.</p></dd>
<dt><a name="18"><b class="cmd">::asn::asnOctetString</b> <i class="arg">string</i></a></dt>
<dd><p>Returns the encoded form of the specified <i class="arg">string</i>.</p></dd>
<dt><a name="19"><b class="cmd">::asn::asnNumericString</b> <i class="arg">string</i></a></dt>
<dd><p>Returns the <i class="arg">string</i> encoded as ASN.1 NumericString. Raises an
error if the <i class="arg">string</i> contains characters other than decimal
numbers and space.</p></dd>
<dt><a name="20"><b class="cmd">::asn::asnPrintableString</b> <i class="arg">string</i></a></dt>
<dd><p>Returns the <i class="arg">string</i> encoding as ASN.1 PrintableString. Raises an
error if the <i class="arg">string</i> contains characters which are not allowed by
the Printable String datatype. The allowed characters are A-Z, a-z,
0-9, space, apostrophe, colon, parentheses, plus, minus, comma,
period, forward slash, question mark, and the equals sign.</p></dd>
<dt><a name="21"><b class="cmd">::asn::asnIA5String</b> <i class="arg">string</i></a></dt>
<dd><p>Returns the <i class="arg">string</i> encoded as ASN.1 IA5String. Raises an error
if the <i class="arg">string</i> contains any characters outside of the US-ASCII
range.</p></dd>
<dt><a name="22"><b class="cmd">::asn::asnBMPString</b> <i class="arg">string</i></a></dt>
<dd><p>Returns the <i class="arg">string</i> encoded as ASN.1 Basic Multilingual Plane
string (Which is essentialy big-endian UCS2).</p></dd>
<dt><a name="23"><b class="cmd">::asn::asnUTF8String</b> <i class="arg">string</i></a></dt>
<dd><p>Returns the <i class="arg">string</i> encoded as UTF8 String. Note that some legacy
applications such as Windows CryptoAPI do not like UTF8 strings. Use
BMPStrings if you are not sure.</p></dd>
<dt><a name="24"><b class="cmd">::asn::asnString</b> <i class="arg">string</i></a></dt>
<dd><p>Returns an encoded form of <i class="arg">string</i>, choosing the most restricted
ASN.1 string type possible. If the string contains non-ASCII
characters, then there is more than one string type which can be
used. See <b class="cmd">::asn::defaultStringType</b>.</p></dd>
<dt><a name="25"><b class="cmd">::asn::defaultStringType</b> <span class="opt">?<i class="arg">type</i>?</span></a></dt>
<dd><p>Selects the string type to use for the encoding of non-ASCII
strings. Returns current default when called without argument. If the
argument <i class="arg">type</i> is supplied, it should be either <b class="const">UTF8</b> or
<b class="const">BMP</b> to choose UTF8String or BMPString respectively.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">DECODER</a></h3>
<p>General notes:</p>
<ol class="enumerated">
<li><p>Nearly all decoder commands take two arguments. These arguments are variable
names, except for <b class="cmd">::asn::asnGetResponse</b>. The first variable
contains the encoded ASN value to decode at the beginning, and more,
and the second variable is where the value is stored to. The remainder
of the input after the decoded value is stored back into the
datavariable.</p></li>
<li><p>After extraction the data variable is always modified first, before by
writing the extracted value to its variable. This means that if both
arguments refer to the same variable, it will always contain the
extracted value after the call, and not the remainder of the input.</p></li>
</ol>
<dl class="definitions">
<dt><a name="26"><b class="cmd">::asn::asnPeekByte</b> <i class="arg">data_var</i> <i class="arg">byte_var</i></a></dt>
<dd><p>Retrieve the first byte of the data, without modifing <i class="arg">data_var</i>.
This can be used to check for implicit tags.</p></dd>
<dt><a name="27"><b class="cmd">::asn::asnGetLength</b> <i class="arg">data_var</i> <i class="arg">length_var</i></a></dt>
<dd><p>Decode the length information for a block of BER data. The tag has already
to be removed from the data.</p></dd>
<dt><a name="28"><b class="cmd">::asn::asnGetResponse</b> <i class="arg">chan</i> <i class="arg">data_var</i></a></dt>
<dd><p>Reads an encoded ASN <em>sequence</em> from the channel <i class="arg">chan</i> and
stores it into the variable named by <i class="arg">data_var</i>.</p></dd>
<dt><a name="29"><b class="cmd">::asn::asnGetInteger</b> <i class="arg">data_var</i> <i class="arg">int_var</i></a></dt>
<dd><p>Assumes that an encoded integer value is at the front of the data
stored in the variable named <i class="arg">data_var</i>, extracts and stores it
into the variable named by <i class="arg">int_var</i>. Additionally removes all
bytes associated with the value from the data for further processing
by the following decoder commands.</p></dd>
<dt><a name="30"><b class="cmd">::asn::asnGetEnumeration</b> <i class="arg">data_var</i> <i class="arg">enum_var</i></a></dt>
<dd><p>Assumes that an enumeration id is at the front of the data stored in
the variable named <i class="arg">data_var</i>, and stores it into the variable
named by <i class="arg">enum_var</i>. Additionally removes all bytes associated
with the value from the data for further processing by the following
decoder commands.</p></dd>
<dt><a name="31"><b class="cmd">::asn::asnGetOctetString</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></dt>
<dd><p>Assumes that a string is at the front of the data stored in the
variable named <i class="arg">data_var</i>, and stores it into the variable named
by <i class="arg">string_var</i>. Additionally removes all bytes associated with
the value from the data for further processing by the following
decoder commands.</p></dd>
<dt><a name="32"><b class="cmd">::asn::asnGetString</b> <i class="arg">data_var</i> <i class="arg">string_var</i> <span class="opt">?<i class="arg">type_var</i>?</span></a></dt>
<dd><p>Decodes a user-readable string. This is a convenience function which
is able to automatically distinguish all supported ASN.1 string types
and convert the input value appropriately.
See <b class="cmd">::asn::asnGetPrintableString</b>, <b class="cmd">::asnGetIA5String</b>, etc.
below for the type-specific conversion commands.</p>
<p>If the optional third argument <i class="arg">type_var</i> is supplied, then the
type of the incoming string is stored in the variable named by it.</p>
<p>The function throws the error
&quot;Invalid command name asnGetSome<b class="variable">UnsupportedString</b>&quot; if the
unsupported string type <b class="variable">Unsupported</b> is encountered. You can
create the appropriate function
&quot;asn::asnGetSome<b class="variable">UnsupportedString</b>&quot; in your application if
neccessary.</p></dd>
<dt><a name="33"><b class="cmd">::asn::asnGetNumericString</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></dt>
<dd><p>Assumes that a numeric string value is at the front of the data stored
in the variable named <i class="arg">data_var</i>, and stores it into the variable
named by <i class="arg">string_var</i>. Additionally removes all bytes associated
with the value from the data for further processing by the following
decoder commands.</p></dd>
<dt><a name="34"><b class="cmd">::asn::asnGetPrintableString</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></dt>
<dd><p>Assumes that a printable string value is at the front of the data
stored in the variable named <i class="arg">data_var</i>, and stores it into the
variable named by <i class="arg">string_var</i>. Additionally removes all bytes
associated with the value from the data for further processing by the
following decoder commands.</p></dd>
<dt><a name="35"><b class="cmd">::asn::asnGetIA5String</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></dt>
<dd><p>Assumes that a IA5 (ASCII) string value is at the front of the data
stored in the variable named <i class="arg">data_var</i>, and stores it into the
variable named by <i class="arg">string_var</i>. Additionally removes all bytes
associated with the value from the data for further processing by the
following decoder commands.</p></dd>
<dt><a name="36"><b class="cmd">::asn::asnGetBMPString</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></dt>
<dd><p>Assumes that a BMP (two-byte unicode) string value is at the front of
the data stored in the variable named <i class="arg">data_var</i>, and stores it
into the variable named by <i class="arg">string_var</i>, converting it into a
proper Tcl string. Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.</p></dd>
<dt><a name="37"><b class="cmd">::asn::asnGetUTF8String</b> <i class="arg">data_var</i> <i class="arg">string_var</i></a></dt>
<dd><p>Assumes that a UTF8 string value is at the front of the data stored in
the variable named <i class="arg">data_var</i>, and stores it into the variable
named by <i class="arg">string_var</i>, converting it into a proper Tcl string.
Additionally removes all bytes associated with the value from the data
for further processing by the following decoder commands.</p></dd>
<dt><a name="38"><b class="cmd">::asn::asnGetUTCTime</b> <i class="arg">data_var</i> <i class="arg">utc_var</i></a></dt>
<dd><p>Assumes that a UTC time value is at the front of the data stored in the
variable named <i class="arg">data_var</i>, and stores it into the variable named 
by <i class="arg">utc_var</i>. The UTC time value is stored as a string, which has to
be decoded with the usual clock scan commands.
Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.</p></dd>
<dt><a name="39"><b class="cmd">::asn::asnGetBitString</b> <i class="arg">data_var</i> <i class="arg">bits_var</i></a></dt>
<dd><p>Assumes that a bit string value is at the front of the data stored in the
variable named <i class="arg">data_var</i>, and stores it into the variable named 
by <i class="arg">bits_var</i> as a string containing only 0 and 1.
Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.</p></dd>
<dt><a name="40"><b class="cmd">::asn::asnGetObjectIdentifier</b> <i class="arg">data_var</i> <i class="arg">oid_var</i></a></dt>
<dd><p>Assumes that a object identifier (OID) value is at the front of the data 
stored in the variable named <i class="arg">data_var</i>, and stores it into the variable 
named by <i class="arg">oid_var</i> as a list of integers. 
Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.</p></dd>
<dt><a name="41"><b class="cmd">::asn::asnGetBoolean</b> <i class="arg">data_var</i> <i class="arg">bool_var</i></a></dt>
<dd><p>Assumes that a boolean value is at the front of the data stored in the
variable named <i class="arg">data_var</i>, and stores it into the variable named 
by <i class="arg">bool_var</i>. Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.</p></dd>
<dt><a name="42"><b class="cmd">::asn::asnGetNull</b> <i class="arg">data_var</i></a></dt>
<dd><p>Assumes that a NULL value is at the front of the data stored in the
variable named <i class="arg">data_var</i> and removes the bytes used to encode it
from the data.</p></dd>
<dt><a name="43"><b class="cmd">::asn::asnGetSequence</b> <i class="arg">data_var</i> <i class="arg">sequence_var</i></a></dt>
<dd><p>Assumes that an ASN sequence is at the front of the data stored in the
variable named <i class="arg">data_var</i>, and stores it into the variable named
by <i class="arg">sequence_var</i>. Additionally removes all bytes associated with
the value from the data for further processing by the following
decoder commands.</p>
<p>The data in <i class="arg">sequence_var</i> is encoded binary and has to be
further decoded according to the definition of the sequence, using the
decoder commands here.</p></dd>
<dt><a name="44"><b class="cmd">::asn::asnGetSet</b> <i class="arg">data_var</i> <i class="arg">set_var</i></a></dt>
<dd><p>Assumes that an ASN set is at the front of the data stored in the
variable named <i class="arg">data_var</i>, and stores it into the variable named
by <i class="arg">set_var</i>. Additionally removes all bytes associated with the
value from the data for further processing by the following decoder
commands.</p>
<p>The data in <i class="arg">set_var</i> is encoded binary and has to be further
decoded according to the definition of the set, using the decoder
commands here.</p></dd>
<dt><a name="45"><b class="cmd">::asn::asnGetApplication</b> <i class="arg">data_var</i> <i class="arg">appNumber_var</i> <span class="opt">?<i class="arg">content_var</i>?</span> <span class="opt">?<i class="arg">encodingType_var</i>?</span></a></dt>
<dd><p>Assumes that an ASN application construct is at the front of the data
stored in the variable named <i class="arg">data_var</i>, and stores its id into
the variable named by <i class="arg">appNumber_var</i>. Additionally removes all
bytes associated with the value from the data for further processing
by the following decoder commands.
If a <i class="arg">content_var</i> is specified, then the command places all data
associated with it into the named variable, in the binary form which
can be processed using the decoder commands of this package.
If a <i class="arg">encodingType_var</i> is specified, then that var is set to 1 if
the encoding is constructed and 0 if it is primitive.</p>
<p>Otherwise it is the responsibility of the caller to decode the
remainder of the application construct based on the id retrieved by
this command, using the decoder commands of this package.</p></dd>
<dt><a name="46"><b class="cmd">::asn::asnGetContext</b> <i class="arg">data_var</i> <i class="arg">contextNumber_var</i> <span class="opt">?<i class="arg">content_var</i>?</span> <span class="opt">?<i class="arg">encodingType_var</i>?</span></a></dt>
<dd><p>Assumes that an ASN context tag construct is at the front of the data
stored in the variable named <i class="arg">data_var</i>, and stores its id into
the variable named by <i class="arg">contextNumber_var</i>. Additionally removes all
bytes associated with the value from the data for further processing
by the following decoder commands.
If a <i class="arg">content_var</i> is specified, then the command places all data
associated with it into the named variable, in the binary form which
can be processed using the decoder commands of this package.
If a <i class="arg">encodingType_var</i> is specified, then that var is set to 1 if
the encoding is constructed and 0 if it is primitive.</p>
<p>Otherwise it is the responsibility of the caller to decode the
remainder of the construct based on the id retrieved by this command,
using the decoder commands of this package.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">HANDLING TAGS</a></h3>
<p>Working with ASN.1 you often need to decode tagged values, which use a tag thats different
from the universal tag for a type. In those cases you have to replace the tag with the universal tag
used for the type, to decode the value.
To decode a tagged value use the <b class="cmd">::asn::asnRetag</b> to change the tag to the appropriate type
to use one of the decoders for primitive values.
To help with this the module contains three functions:</p>
<dl class="definitions">
<dt><a name="47"><b class="cmd">::asn::asnPeekTag</b> <i class="arg">data_var</i> <i class="arg">tag_var</i> <i class="arg">tagtype_var</i> <i class="arg">constr_var</i></a></dt>
<dd><p>The <b class="cmd">::asn::asnPeekTag</b> command can be used to take a peek at the data and decode the tag value, without
removing it from the data. The <i class="arg">tag_var</i> gets set to the tag number, while the <i class="arg">tagtype_var</i> gets set
to the class of the tag. (Either UNIVERSAL, CONTEXT, APPLICATION or PRIVATE). The <i class="arg">constr_var</i> is set to 1 if the
tag is for a constructed value, and to 0 for not constructed. It returns the length of the tag.</p></dd>
<dt><a name="48"><b class="cmd">::asn::asnTag</b> <i class="arg">tagnumber</i> <span class="opt">?<i class="arg">class</i>?</span> <span class="opt">?<i class="arg">tagstyle</i>?</span></a></dt>
<dd><p>The <b class="cmd">::asn::asnTag</b> can be used to create a tag value. The <i class="arg">tagnumber</i> gives the number of the tag, while
the <i class="arg">class</i> gives one of the classes (UNIVERSAL,CONTEXT,APPLICATION or PRIVATE). The class may be abbreviated to just the first letter (U,C,A,P),
default is UNIVERSAL.    
The <i class="arg">tagstyle</i> is either C for Constructed encoding, or P for primitve encoding. It defaults to P. You can also use 1 instead of C and
0 instead of P for direct use of the values returned by <b class="cmd">::asn::asnPeekTag</b>.</p></dd>
<dt><a name="49"><b class="cmd">::asn::asnRetag</b> <i class="arg">data_var</i> <i class="arg">newTag</i></a></dt>
<dd><p>Replaces the tag in front of the data in <i class="arg">data_var</i> with <i class="arg">newTag</i>. The new Tag can be created using the <b class="cmd">::asn::asnTag</b> command.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p>Examples for the usage of this package can be found in the
implementation of package <b class="package"><a href="../ldap/ldap.html">ldap</a></b>.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>asn</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key376">asn</a>, <a href="../../../../index.html#key374">ber</a>, <a href="../../../../index.html#key375">cer</a>, <a href="../../../../index.html#key377">der</a>, <a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key125">protocol</a>, <a href="../../../../index.html#key372">x.208</a>, <a href="../../../../index.html#key373">x.209</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2004 Jochen Loewer &lt;[email protected]&gt;<br>
Copyright &copy; 2004-2011 Michael Schlenker &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/base32/base32.html.









































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>base32 - Base32 encoding</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/base32/base32.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; Public domain
   -->
<! -- CVS: $Id$ base32.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">base32(n) 0.1 tcllib &quot;Base32 encoding&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>base32 - base32 standard encoding</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Code map</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">base32::core <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">base32 <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::base32::encode</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::base32::decode</b> <i class="arg">estring</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands for encoding and decoding of strings
into and out of the standard base32 encoding as specified in RFC 3548.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::base32::encode</b> <i class="arg">string</i></a></dt>
<dd><p>This command encodes the given <i class="arg">string</i> in base32 and returns the
encoded string as its result. The result may be padded with the
character <b class="const">=</b> to signal a partial encoding at the end of the
input string.</p></dd>
<dt><a name="2"><b class="cmd">::base32::decode</b> <i class="arg">estring</i></a></dt>
<dd><p>This commands takes the <i class="arg">estring</i> and decodes it under the
assumption that it is a valid base32 encoded string. The result of the
decoding is returned as the result of the command.</p>
<p>Note that while the encoder will generate only uppercase characters
this decoder accepts input in lowercase as well.</p>
<p>The command will always throw an error whenever encountering
conditions which signal some type of bogus input, namely if</p>
<ol class="enumerated">
<li><p>the input contains characters which are not valid output of a base32 encoder,</p></li>
<li><p>the length of the input is not a multiple of eight,</p></li>
<li><p>padding appears not at the end of input, but in the middle,</p></li>
<li><p>the padding has not of length six, four, three, or one characters,</p></li>
</ol></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Code map</a></h2>
<p>The code map used to convert 5-bit sequences is shown below, with the
numeric id of the bit sequences to the left and the character used to
encode it to the right. It should be noted that the characters &quot;0&quot; and
&quot;1&quot; are not used by the encoding. This is done as these characters can
be easily confused with &quot;O&quot;, &quot;o&quot; and &quot;l&quot; (L).</p>
<pre class="example">
	0 A    9 J   18 S   27 3
	1 B   10 K   19 T   28 4
	2 C   11 L   20 U   29 5
	3 D   12 M   21 V   30 6
	4 E   13 N   22 W   31 7
	5 F   14 O   23 X
	6 G   15 P   24 Y
	7 H   16 Q   25 Z
	8 I   17 R   26 2
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>base32</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key251">base32</a>, <a href="../../../../index.html#key299">rfc3548</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; Public domain</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/base32/base32core.html.































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>base32::core - Base32 encoding</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/base32/base32core.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; Public domain
   -->
<! -- CVS: $Id$ base32::core.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">base32::core(n) 0.1 tcllib &quot;Base32 encoding&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>base32::core - Expanding basic base32 maps</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">base32::core <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::base32::core::define</b> <i class="arg">map</i> <i class="arg">forwvar</i> <i class="arg">backwvar</i> <i class="arg">ivar</i></a></li>
<li><a href="#2"><b class="cmd">::base32::core::valid</b> <i class="arg">string</i> <i class="arg">pattern</i> <i class="arg">mvar</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides generic commands for the construction of full
base32 mappings from a basic mapping listing just the codes and
associated characters. The full mappings, regular and inverse, created
here map to and from bit sequences, and also handle the partial
mappings at the end of a string.</p>
<p>This is in essence an internal package to be used by implementors of a
base32 en- and decoder. A regular user has no need of this package at
all.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::base32::core::define</b> <i class="arg">map</i> <i class="arg">forwvar</i> <i class="arg">backwvar</i> <i class="arg">ivar</i></a></dt>
<dd><p>This command computes full forward and backward (inverse) mappings
from the basic <i class="arg">map</i> and stores them in the variables named by
<i class="arg">forwvar</i> and <i class="arg">backwvar</i> resp. It also constructs a regexp
pattern for the detection of invalid characters in supposedly base32
encoded input and stores it in the variable named by <i class="arg">ivar</i>.</p></dd>
<dt><a name="2"><b class="cmd">::base32::core::valid</b> <i class="arg">string</i> <i class="arg">pattern</i> <i class="arg">mvar</i></a></dt>
<dd><p>This command checks if the input <i class="arg">string</i> is a valid base32
encoded string, based on the <i class="arg">pattern</i> of invalid characters as
generated by <b class="cmd">::base32::core::define</b>, and some other general
rules.</p>
<p>The result of the command is a boolean flag. Its value is <b class="const">True</b>
for a valid <i class="arg">string</i>, and <b class="const">False</b> otherwise. In the latter
case an error message describing the problem with the input is stored
into the variable named by <i class="arg">mvar</i>. The variable is not touched if
the input was found to be valid.</p>
<p>The rules checked by the command, beyond rejection of bad characters,
are:</p>
<ol class="enumerated">
<li><p>The length of the input is not a multiple of eight,</p></li>
<li><p>The padding appears not at the end of input, but in the middle,</p></li>
<li><p>The padding has not of length six, four, three, or one characters,</p></li>
</ol></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>base32</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key251">base32</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; Public domain</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/base32/base32hex.html.











































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>base32::hex - Base32 encoding</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/base32/base32hex.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; Public domain
   -->
<! -- CVS: $Id$ base32::hex.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">base32::hex(n) 0.1 tcllib &quot;Base32 encoding&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>base32::hex - base32 extended hex encoding</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Code map</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">base32::core <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">base32::hex <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::base32::hex::encode</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::base32::hex::decode</b> <i class="arg">estring</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands for encoding and decoding of strings
into and out of the extended hex base32 encoding as specified in the
RFC 3548bis draft.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::base32::hex::encode</b> <i class="arg">string</i></a></dt>
<dd><p>This command encodes the given <i class="arg">string</i> in extended hex base32 and
returns the encoded string as its result. The result may be padded
with the character <b class="const">=</b> to signal a partial encoding at the end
of the input string.</p></dd>
<dt><a name="2"><b class="cmd">::base32::hex::decode</b> <i class="arg">estring</i></a></dt>
<dd><p>This commands takes the <i class="arg">estring</i> and decodes it under the
assumption that it is a valid extended hex base32 encoded string. The
result of the decoding is returned as the result of the command.</p>
<p>Note that while the encoder will generate only uppercase characters
this decoder accepts input in lowercase as well.</p>
<p>The command will always throw an error whenever encountering
conditions which signal some type of bogus input, namely if</p>
<ol class="enumerated">
<li><p>the input contains characters which are not valid output
       of a extended hex base32 encoder,</p></li>
<li><p>the length of the input is not a multiple of eight,</p></li>
<li><p>padding appears not at the end of input, but in the middle,</p></li>
<li><p>the padding has not of length six, four, three, or one characters,</p></li>
</ol></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Code map</a></h2>
<p>The code map used to convert 5-bit sequences is shown below, with the
numeric id of the bit sequences to the left and the character used to
encode it to the right. The important feature of the extended hex
mapping is that the first 16 codes map to the digits and hex
characters.</p>
<pre class="example">
	0 0    9 9        18 I   27 R
	1 1   10 A        19 J   28 S
	2 2   11 B        20 K   29 T
	3 3   12 C        21 L   30 U
	4 4   13 D        22 M   31 V
	5 5   14 E        23 N
	6 6   15 F        24 O
	7 7        16 G   25 P
	8 8        17 H   26 Q
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>base32</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key251">base32</a>, <a href="../../../../index.html#key298">hex</a>, <a href="../../../../index.html#key299">rfc3548</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; Public domain</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/base64/ascii85.html.







































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>ascii85 - Text encoding &amp; decoding binary data</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/base64/ascii85.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2010, Emiliano Gavil&aacute;n
   -->
<! -- CVS: $Id$ ascii85.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ascii85(n) 1.0 tcllib &quot;Text encoding &amp; decoding binary data&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ascii85 - ascii85-encode/decode binary data</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">ascii85 <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ascii85::encode</b> <span class="opt">?<b class="option">-maxlen</b> <i class="arg">maxlen</i>?</span> <span class="opt">?<b class="option">-wrapchar</b> <i class="arg">wrapchar</i>?</span> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::ascii85::decode</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides procedures to encode binary data into ascii85 and back.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ascii85::encode</b> <span class="opt">?<b class="option">-maxlen</b> <i class="arg">maxlen</i>?</span> <span class="opt">?<b class="option">-wrapchar</b> <i class="arg">wrapchar</i>?</span> <i class="arg">string</i></a></dt>
<dd><p>Ascii85 encodes the given binary <i class="arg">string</i> and returns the encoded
result. Inserts the character <i class="arg">wrapchar</i> every <i class="arg">maxlen</i>
characters of output. <i class="arg">wrapchar</i> defaults to newline. <i class="arg">maxlen</i>
defaults to <b class="const">76</b>.</p>
<p><em>Note well</em>: If your string is not simple ascii you should fix
the string encoding before doing ascii85 encoding. See the examples.</p>
<p>The command will throw an error for negative values of <i class="arg">maxlen</i>,
or if <i class="arg">maxlen</i> is not an integer number.</p></dd>
<dt><a name="2"><b class="cmd">::ascii85::decode</b> <i class="arg">string</i></a></dt>
<dd><p>Ascii85 decodes the given <i class="arg">string</i> and returns the binary data.
The decoder ignores whitespace in the string, as well as tabs and
newlines.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<pre class="example">
% ascii85::encode &quot;Hello, world&quot;
87cURD_*#TDfTZ)
</pre>
<pre class="example">
% ascii85::encode [string repeat xyz 24]
G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G
^4U[H$X^\H?a^]
% ascii85::encode -wrapchar &quot;&quot; [string repeat xyz 24]
G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]
</pre>
<pre class="example">
# NOTE: ascii85 encodes BINARY strings.
% set chemical [encoding convertto utf-8 &quot;C\u2088H\u2081\u2080N\u2084O\u2082&quot;]
% set encoded [ascii85::encode $chemical]
6fN]R8E,5Pidu\UiduhZidua
% set caffeine [encoding convertfrom utf-8 [ascii85::decode $encoded]]
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://en.wikipedia.org/wiki/Ascii85">http://en.wikipedia.org/wiki/Ascii85</a></p></li>
<li><p>Postscript Language Reference Manual, 3rd Edition, page 131.
       <a href="http://www.adobe.com/devnet/postscript/pdfs/PLRM.pdf">http://www.adobe.com/devnet/postscript/pdfs/PLRM.pdf</a></p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>base64</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key664">ascii85</a>, <a href="../../../../index.html#key224">encoding</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2010, Emiliano Gavil&aacute;n</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/base64/base64.html.

































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>base64 - Text encoding &amp; decoding binary data</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/base64/base64.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2000, Eric Melski   -- Copyright &copy; 2001, Miguel Sofer
   -->
<! -- CVS: $Id$ base64.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">base64(n) 2.4.2 tcllib &quot;Text encoding &amp; decoding binary data&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>base64 - base64-encode/decode binary data</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8</b></li>
<li>package require <b class="pkgname">base64 <span class="opt">?2.4.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::base64::encode</b> <span class="opt">?<b class="option">-maxlen</b> <i class="arg">maxlen</i>?</span> <span class="opt">?<b class="option">-wrapchar</b> <i class="arg">wrapchar</i>?</span> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::base64::decode</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides procedures to encode binary data into base64 and back.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::base64::encode</b> <span class="opt">?<b class="option">-maxlen</b> <i class="arg">maxlen</i>?</span> <span class="opt">?<b class="option">-wrapchar</b> <i class="arg">wrapchar</i>?</span> <i class="arg">string</i></a></dt>
<dd><p>Base64 encodes the given binary <i class="arg">string</i> and returns the encoded
result. Inserts the character <i class="arg">wrapchar</i> every <i class="arg">maxlen</i>
characters of output. <i class="arg">wrapchar</i> defaults to newline. <i class="arg">maxlen</i>
defaults to <b class="const">76</b>.</p>
<p><em>Note</em> that if <i class="arg">maxlen</i> is set to <b class="const">0</b>, the
output will not be wrapped at all.</p>
<p><em>Note well</em>: If your string is not simple ascii you should fix
the string encoding before doing base64 encoding. See the examples.</p>
<p>The command will throw an error for negative values of <i class="arg">maxlen</i>,
or if <i class="arg">maxlen</i> is not an integer number.</p></dd>
<dt><a name="2"><b class="cmd">::base64::decode</b> <i class="arg">string</i></a></dt>
<dd><p>Base64 decodes the given <i class="arg">string</i> and returns the binary data.
The decoder ignores whitespace in the string.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<pre class="example">
% base64::encode &quot;Hello, world&quot;
SGVsbG8sIHdvcmxk
</pre>
<pre class="example">
% base64::encode [string repeat xyz 20]
eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6
eHl6eHl6eHl6
% base64::encode -wrapchar &quot;&quot; [string repeat xyz 20]
eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6eHl6
</pre>
<pre class="example">
# NOTE: base64 encodes BINARY strings.
% set chemical [encoding convertto utf-8 &quot;C\u2088H\u2081\u2080N\u2084O\u2082&quot;]
% set encoded [base64::encode $chemical]
Q+KCiEjigoHigoBO4oKET+KCgg==
% set caffeine [encoding convertfrom utf-8 [base64::decode $encoded]]
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>base64</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key716">base64</a>, <a href="../../../../index.html#key224">encoding</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2000, Eric Melski<br>
Copyright &copy; 2001, Miguel Sofer</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/base64/uuencode.html.























































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>uuencode - Text encoding &amp; decoding binary data</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/base64/uuencode.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Pat Thoyts
   -->
<! -- CVS: $Id$ uuencode.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">uuencode(n) 1.1.4 tcllib &quot;Text encoding &amp; decoding binary data&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>uuencode - UU-encode/decode binary data</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OPTIONS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8</b></li>
<li>package require <b class="pkgname">uuencode <span class="opt">?1.1.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::uuencode::encode</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::uuencode::decode</b> <i class="arg">string</i></a></li>
<li><a href="#3"><b class="cmd">::uuencode::uuencode</b> <span class="opt">?<b class="option">-name</b> <i class="arg">string</i>?</span> <span class="opt">?<b class="option">-mode</b> <i class="arg">octal</i>?</span> (<b class="option">-file</b> <i class="arg">filename</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i>)</a></li>
<li><a href="#4"><b class="cmd">::uuencode::uudecode</b> (<b class="option">-file</b> <i class="arg">filename</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i>)</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a Tcl-only implementation of the
<b class="syscmd">uuencode(1)</b> and <b class="syscmd">uudecode(1)</b> commands. This encoding
packs binary data into printable ASCII characters.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::uuencode::encode</b> <i class="arg">string</i></a></dt>
<dd><p>returns the uuencoded data. This will encode all the data passed in
even if this is longer than the uuencode maximum line length. If the
number of input bytes is not a multiple of 3 then additional 0 bytes
are added to pad the string.</p></dd>
<dt><a name="2"><b class="cmd">::uuencode::decode</b> <i class="arg">string</i></a></dt>
<dd><p>Decodes the given encoded data. This will return any padding
characters as well and it is the callers responsibility to deal with
handling the actual length of the encoded data. (see uuencode).</p></dd>
<dt><a name="3"><b class="cmd">::uuencode::uuencode</b> <span class="opt">?<b class="option">-name</b> <i class="arg">string</i>?</span> <span class="opt">?<b class="option">-mode</b> <i class="arg">octal</i>?</span> (<b class="option">-file</b> <i class="arg">filename</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i>)</a></dt>
<dd></dd>
<dt><a name="4"><b class="cmd">::uuencode::uudecode</b> (<b class="option">-file</b> <i class="arg">filename</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i>)</a></dt>
<dd><p>UUDecode a file or block of data. A file may contain more than one
embedded file so the result is a list where each element is a three
element list of filename, mode value and data.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">OPTIONS</a></h2>
<dl class="definitions">
<dt>-filename name</dt>
<dd><p>Cause the uuencode or uudecode commands to read their data from the
named file rather that taking a string parameter.</p></dd>
<dt>-name string</dt>
<dd><p>The uuencoded data header line contains the suggested file name to be
used when unpacking the data. Use this option to change this from the
default of &quot;data.dat&quot;.</p></dd>
<dt>-mode octal</dt>
<dd><p>The uuencoded data header line contains a suggested permissions bit
pattern expressed as an octal string. To change the default of 0644
you can set this option. For instance, 0755 would be suitable for an
executable. See <b class="syscmd">chmod(1)</b>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<pre class="example">
% set d [uuencode::encode &quot;Hello World!&quot;]
2&amp;5L;&amp;\\@5V]R;&amp;0A
</pre>
<pre class="example">
% uuencode::uudecode $d
Hello World!
</pre>
<pre class="example">
% set d [uuencode::uuencode -name hello.txt &quot;Hello World&quot;]
begin 644 hello.txt
+2&amp;5L;&amp;\@5V]R;&amp;0`
`
end
</pre>
<pre class="example">
% uuencode::uudecode $d
{hello.txt 644 {Hello World}}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>base64</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key224">encoding</a>, <a href="../../../../index.html#key223">uuencode</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Pat Thoyts</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/base64/yencode.html.
















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>yencode - Text encoding &amp; decoding binary data</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/base64/yencode.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Pat Thoyts
   -->
<! -- CVS: $Id$ yencode.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">yencode(n) 1.1.2 tcllib &quot;Text encoding &amp; decoding binary data&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>yencode - Y-encode/decode binary data</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OPTIONS</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">yencode <span class="opt">?1.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::yencode::encode</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::yencode::decode</b> <i class="arg">string</i></a></li>
<li><a href="#3"><b class="cmd">::yencode::yencode</b> <span class="opt">?<b class="option">-name</b> <i class="arg">string</i>?</span> <span class="opt">?<b class="option">-line</b> <i class="arg">integer</i>?</span> <span class="opt">?<b class="option">-crc32</b> <i class="arg">boolean</i>?</span> (<b class="option">-file</b> <i class="arg">filename</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i>)</a></li>
<li><a href="#4"><b class="cmd">::yencode::ydecode</b> (<b class="option">-file</b> <i class="arg">filename</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i>)</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a Tcl-only implementation of the yEnc file
encoding. This is a recently introduced method of encoding binary
files for transmission through Usenet. This encoding packs binary data
into a format that requires an 8-bit clean transmission layer but that
escapes characters special to the <i class="term"><a href="../../../../index.html#key602">NNTP</a></i> posting protocols. See 
<a href="http://www.yenc.org/">http://www.yenc.org/</a> for details concerning the algorithm.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::yencode::encode</b> <i class="arg">string</i></a></dt>
<dd><p>returns the yEnc encoded data.</p></dd>
<dt><a name="2"><b class="cmd">::yencode::decode</b> <i class="arg">string</i></a></dt>
<dd><p>Decodes the given yEnc encoded data.</p></dd>
<dt><a name="3"><b class="cmd">::yencode::yencode</b> <span class="opt">?<b class="option">-name</b> <i class="arg">string</i>?</span> <span class="opt">?<b class="option">-line</b> <i class="arg">integer</i>?</span> <span class="opt">?<b class="option">-crc32</b> <i class="arg">boolean</i>?</span> (<b class="option">-file</b> <i class="arg">filename</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i>)</a></dt>
<dd><p>Encode a file or block of data.</p></dd>
<dt><a name="4"><b class="cmd">::yencode::ydecode</b> (<b class="option">-file</b> <i class="arg">filename</i> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i>)</a></dt>
<dd><p>Decode a file or block of data. A file may contain more than one
embedded file so the result is a list where each element is a three
element list of filename, file size and data.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">OPTIONS</a></h2>
<dl class="definitions">
<dt>-filename name</dt>
<dd><p>Cause the yencode or ydecode commands to read their data from the
named file rather that taking a string parameter.</p></dd>
<dt>-name string</dt>
<dd><p>The encoded data header line contains the suggested file name to be
used when unpacking the data. Use this option to change this from the
default of &quot;data.dat&quot;.</p></dd>
<dt>-line integer</dt>
<dd><p>The yencoded data header line contains records the line length used
during the encoding. Use this option to select a line length other
that the default of 128. Note that NNTP imposes a 1000 character line
length limit and some gateways may have trouble with more than 255
characters per line.</p></dd>
<dt>-crc32 boolean</dt>
<dd><p>The yEnc specification recommends the inclusion of a cyclic redundancy
check value in the footer. Use this option to change the default from
<i class="arg">true</i> to <i class="arg">false</i>.</p></dd>
</dl>
<pre class="example">
% set d [yencode::yencode -file testfile.txt]
=ybegin line=128 size=584 name=testfile.txt
 -o- data not shown -o-
=yend size=584 crc32=ded29f4f
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://www.yenc.org/yenc-draft.1.3.txt">http://www.yenc.org/yenc-draft.1.3.txt</a></p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>base64</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key224">encoding</a>, <a href="../../../../index.html#key656">yEnc</a>, <a href="../../../../index.html#key654">ydecode</a>, <a href="../../../../index.html#key655">yencode</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Pat Thoyts</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bee/bee.html.



























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bee - BitTorrent</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bee/bee.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bee.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bee(n) 0.1 tcllib &quot;BitTorrent&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bee - BitTorrent Serialization Format Encoder/Decoder</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a>
<ul>
<li class="subsection"><a href="#subsection1">ENCODER</a></li>
<li class="subsection"><a href="#subsection2">DECODER</a></li>
</ul>
</li>
<li class="section"><a href="#section3">FORMAT DEFINITION</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">bee <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::bee::encodeString</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::bee::encodeNumber</b> <i class="arg">integer</i></a></li>
<li><a href="#3"><b class="cmd">::bee::encodeListArgs</b> <i class="arg">value</i>...</a></li>
<li><a href="#4"><b class="cmd">::bee::encodeList</b> <i class="arg">list</i></a></li>
<li><a href="#5"><b class="cmd">::bee::encodeDictArgs</b> <i class="arg">key</i> <i class="arg">value</i>...</a></li>
<li><a href="#6"><b class="cmd">::bee::encodeDict</b> <i class="arg">dict</i></a></li>
<li><a href="#7"><b class="cmd">::bee::decode</b> <i class="arg">string</i> <span class="opt">?<i class="arg">endvar</i>?</span> <span class="opt">?<i class="arg">start</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::bee::decodeIndices</b> <i class="arg">string</i> <span class="opt">?<i class="arg">endvar</i>?</span> <span class="opt">?<i class="arg">start</i>?</span></a></li>
<li><a href="#9"><b class="cmd">::bee::decodeChannel</b> <i class="arg">chan</i> <b class="option">-command</b> <i class="arg">cmdprefix</i> <span class="opt">?<b class="option">-exact</b>?</span> <span class="opt">?<b class="option">-prefix</b> <i class="arg">data</i>?</span></a></li>
<li><a href="#10"><b class="cmd">cmdprefix</b> <b class="method">eof</b> <i class="arg">token</i></a></li>
<li><a href="#11"><b class="cmd">cmdprefix</b> <b class="method">error</b> <i class="arg">token</i> <i class="arg">message</i></a></li>
<li><a href="#12"><b class="cmd">cmdprefix</b> <b class="method">value</b> <i class="arg">token</i> <i class="arg">value</i></a></li>
<li><a href="#13"><b class="cmd">::bee::decodeCancel</b> <i class="arg">token</i></a></li>
<li><a href="#14"><b class="cmd">::bee::decodePush</b> <i class="arg">token</i> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">bee</b> package provides de- and encoder commands for data
in bencoding (speak 'bee'), the serialization format for data and
messages used by the BitTorrent application.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">ENCODER</a></h3>
<p>The package provides one encoder command for each of the basic forms,
and two commands per container, one taking a proper tcl data structure
to encode in the container, the other taking the same information as
several arguments.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::bee::encodeString</b> <i class="arg">string</i></a></dt>
<dd><p>Returns the bee-encoding of the <i class="arg">string</i>.</p></dd>
<dt><a name="2"><b class="cmd">::bee::encodeNumber</b> <i class="arg">integer</i></a></dt>
<dd><p>Returns the bee-encoding of the <i class="arg">integer</i> number.</p></dd>
<dt><a name="3"><b class="cmd">::bee::encodeListArgs</b> <i class="arg">value</i>...</a></dt>
<dd><p>Takes zero or more bee-encoded values and returns the bee-encoding of
their list.</p></dd>
<dt><a name="4"><b class="cmd">::bee::encodeList</b> <i class="arg">list</i></a></dt>
<dd><p>Takes a list of bee-encoded values and returns the bee-encoding of the
list.</p></dd>
<dt><a name="5"><b class="cmd">::bee::encodeDictArgs</b> <i class="arg">key</i> <i class="arg">value</i>...</a></dt>
<dd><p>Takes zero or more pairs of keys and values and returns the
bee-encoding of the dictionary they form. The values are expected to
be already bee-encoded, but the keys must not be. Their encoding will
be done by the command itself.</p></dd>
<dt><a name="6"><b class="cmd">::bee::encodeDict</b> <i class="arg">dict</i></a></dt>
<dd><p>Takes a dictionary list of string keys and bee-encoded values and
returns the bee-encoding of the list. Note that the keys in the input
must not be bee-encoded already. This will be done by the command
itself.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">DECODER</a></h3>
<p>The package provides two main decoder commands, one for decoding a
string expected to contain a complete data structure, the other for
the incremental decoding of bee-values arriving on a channel. The
latter command is asynchronous and provides the completed decoded
values to the user through a command callback.</p>
<dl class="definitions">
<dt><a name="7"><b class="cmd">::bee::decode</b> <i class="arg">string</i> <span class="opt">?<i class="arg">endvar</i>?</span> <span class="opt">?<i class="arg">start</i>?</span></a></dt>
<dd><p>Takes the bee-encoding in the string and returns one decoded value. In
the case of this being a container all contained values are decoded
recursively as well and the result is a properly nested tcl list
and/or dictionary.</p>
<p>If the optional <i class="arg">endvar</i> is set then it is the name of a variable
to store the index of the first character <em>after</em> the decoded
value into. In other words, if the string contains more than one value
then <i class="arg">endvar</i> can be used to obtain the position of the bee-value
after the bee-value currently decoded. together with <i class="arg">start</i>, see
below, it is possible to iterate over the string to extract all
contained values.</p>
<p>The optional <i class="arg">start</i> index defaults to <b class="const">0</b>, i.e. the
beginning of the string. It is the index of the first character of the
bee-encoded value to extract.</p></dd>
<dt><a name="8"><b class="cmd">::bee::decodeIndices</b> <i class="arg">string</i> <span class="opt">?<i class="arg">endvar</i>?</span> <span class="opt">?<i class="arg">start</i>?</span></a></dt>
<dd><p>Takes the same arguments as <b class="cmd">::bee::decode</b> and returns the same
information in <i class="arg">endvar</i>. The result however is different. Instead
of the tcl value contained in the <i class="arg">string</i> it returns a list
describing the value with respect to type and location (indices for
the first and last character of the bee-value). In case of a container
the structure also contains the same information for all the embedded
values.</p>
<p>Formally the results for the various types of bee-values are:</p>
<dl class="definitions">
<dt>string</dt>
<dd><p>A list containing three elements:</p>
<ul class="itemized">
<li><p>The constant string <b class="const">string</b>, denoting the type of the value.</p></li>
<li><p>An integer number greater than or equal to zero. This is the index of
the first character of the bee-value in the input <i class="arg">string</i>.</p></li>
<li><p>An integer number greater than or equal to zero. This is the index of
the last character of the bee-value in the input <i class="arg">string</i>.</p></li>
</ul>
<p><em>Note</em> that this information is present in the results for all
four types of bee-values, with only the first element changing
according to the type of the value.</p></dd>
<dt>integer</dt>
<dd><p>The result is like for strings, except that the type element contains
the constant string <b class="const">integer</b>.</p></dd>
<dt>list</dt>
<dd><p>The result is like before, with two exceptions: One, the type element
contains the constant string <b class="const">list</b>. And two, the result
actually contains four elements. The last element is new, and contains
the index data as described here for all elements of the bee-list.</p></dd>
<dt>dictionary</dt>
<dd><p>The result is like for strings, except that the type element contains
the constant string <b class="const">dict</b>. A fourth element is present as well,
with a slightly different structure than for lists. The element is a
dictionary mapping from the strings keys of the bee-dictionary to a
list containing two elements. The first of them is the index
information for the key, and the second element is the index
information for the value the key maps to. This structure is the only
which contains not only index data, but actual values from the
bee-string. While the index information of the keys is unique enough,
i.e. serviceable as keys, they are not easy to navigate when trying to
find particular element. Using the actual keys makes this much easier.</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::bee::decodeChannel</b> <i class="arg">chan</i> <b class="option">-command</b> <i class="arg">cmdprefix</i> <span class="opt">?<b class="option">-exact</b>?</span> <span class="opt">?<b class="option">-prefix</b> <i class="arg">data</i>?</span></a></dt>
<dd><p>The command creates a decoder for a series of bee-values arriving on
the channel <i class="arg">chan</i> and returns its handle. This handle can be used
to remove the decoder again.
Setting up another bee decoder on <i class="arg">chan</i> while a bee decoder is
still active will fail with an error message.</p>
<dl class="definitions">
<dt><b class="option">-command</b></dt>
<dd><p>The command prefix <i class="arg">cmdprefix</i> specified by the <em>required</em>
option <b class="option">-command</b> is used to report extracted values and
exceptional situations (error, and EOF on the channel).
The callback will be executed at the global level of the interpreter,
with two or three arguments. The exact call signatures are</p>
<dl class="definitions">
<dt><a name="10"><b class="cmd">cmdprefix</b> <b class="method">eof</b> <i class="arg">token</i></a></dt>
<dd><p>The decoder has reached eof on the channel <i class="arg">chan</i>. No further
invocations of the callback will be made after this. The channel has
already been closed at the time of the call, and the <i class="arg">token</i> is
not valid anymore as well.</p></dd>
<dt><a name="11"><b class="cmd">cmdprefix</b> <b class="method">error</b> <i class="arg">token</i> <i class="arg">message</i></a></dt>
<dd><p>The decoder encountered an error, which is not eof. For example a
malformed bee-value. The <i class="arg">message</i> provides details about the
error. The decoder token is in the same state as for eof,
i.e. invalid. The channel however is kept open.</p></dd>
<dt><a name="12"><b class="cmd">cmdprefix</b> <b class="method">value</b> <i class="arg">token</i> <i class="arg">value</i></a></dt>
<dd><p>The decoder received and successfully decoded a bee-value.
The format of the equivalent tcl <i class="arg">value</i> is the same as returned
by <b class="cmd">::bee::decode</b>. The channel is still open and the decoder
token is valid. This means that the callback is able to remove the
decoder.</p></dd>
</dl></dd>
<dt><b class="option">-exact</b></dt>
<dd><p>By default the decoder assumes that the remainder of the data in the
channel consists only of bee-values, and reads as much as possible per
event, without regard for boundaries between bee-values. This means
that if the the input contains non-bee data after a series of
bee-value the beginning of that data may be lost because it was
already read by the decoder, but not processed.</p>
<p>The <b class="option">-exact</b> was made for this situation. When specified the
decoder will take care to not read any characters behind the currently
processed bee-value, so that any non-bee data is kept in the channel
for further processing after removal of the decoder.</p></dd>
<dt><b class="option">-prefix</b></dt>
<dd><p>If this option is specified its value is assumed to be the beginning
of the bee-value and used to initialize the internal decoder
buffer. This feature is required if the creator of the decoder used
data from the channel to determine if it should create the decoder or
not. Without the option this data would be lost to the decoding.</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::bee::decodeCancel</b> <i class="arg">token</i></a></dt>
<dd><p>This command cancels the decoder set up by <b class="cmd">::bee::decodeChannel</b>
and represented by the handle <i class="arg">token</i>.</p></dd>
<dt><a name="14"><b class="cmd">::bee::decodePush</b> <i class="arg">token</i> <i class="arg">string</i></a></dt>
<dd><p>This command appends the <i class="arg">string</i> to the internal decoder
buffer. It is the runtime equivalent of the option <b class="option">-prefix</b> of
<b class="cmd">::bee::decodeChannel</b>. Use it to push data back into the decoder
when the <b class="method">value</b> callback used data from the channel to
determine if it should decode another bee-value or not.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">FORMAT DEFINITION</a></h2>
<p>Data in the bee serialization format is constructed from two basic
forms, and two container forms. The basic forms are strings and
integer numbers, and the containers are lists and dictionaries.</p>
<dl class="definitions">
<dt>String <i class="arg">S</i></dt>
<dd><p>A string <i class="arg">S</i> of length <i class="arg">L</i> is encoded by the string
&quot;<i class="arg">L</i><b class="const">:</b><i class="arg">S</i>&quot;, where the length is written out in textual
form.</p></dd>
<dt>Integer <i class="arg">N</i></dt>
<dd><p>An integer number <i class="arg">N</i> is encoded by the string
&quot;<b class="const">i</b><i class="arg">N</i><b class="const">e</b>&quot;.</p></dd>
<dt>List <i class="arg">v1</i> ... <i class="arg">vn</i></dt>
<dd><p>A list of the values <i class="arg">v1</i> to <i class="arg">vn</i> is encoded by the string
&quot;<b class="const">l</b><i class="arg">BV1</i>...<i class="arg">BVn</i><b class="const">e</b>&quot;
where &quot;BV<b class="variable">i</b>&quot; is the bee-encoding of the value &quot;v<b class="variable">i</b>&quot;.</p></dd>
<dt>Dict <i class="arg">k1</i> -&gt; <i class="arg">v1</i> ...</dt>
<dd><p>A dictionary mapping the string key <i class="arg">k</i><b class="variable">i</b> to the value
<i class="arg">v</i><b class="variable">i</b>, for <b class="variable">i</b> in <b class="const">1</b> ... <b class="variable">n</b>
is encoded by the string
&quot;<b class="const">d</b><i class="arg">BK</i><b class="variable">i</b><i class="arg">BV</i><b class="variable">i</b>...<b class="const">e</b>&quot;
for i in <b class="const">1</b> ... <b class="variable">n</b>, where &quot;BK<b class="variable">i</b>&quot; is the bee-encoding
of the key string &quot;k<b class="variable">i</b>&quot;.  and &quot;BV<b class="variable">i</b>&quot; is the bee-encoding of
the value &quot;v<b class="variable">i</b>&quot;.</p>
<p><em>Note</em>: The bee-encoding does not retain the order of the keys in
the input, but stores in a sorted order. The sorting is done for the
&quot;raw strings&quot;.</p></dd>
</dl>
<p>Note that the type of each encoded item can be determined immediately
from the first character of its representation:</p>
<dl class="definitions">
<dt>i</dt>
<dd><p>Integer.</p></dd>
<dt>l</dt>
<dd><p>List.</p></dd>
<dt>d</dt>
<dd><p>Dictionary.</p></dd>
<dt>[0-9]</dt>
<dd><p>String.</p></dd>
</dl>
<p>By wrapping an integer number into <b class="const">i</b>...<b class="const">e</b> the format
makes sure that they are different from strings, which all begin with
a digit.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>bee</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key342">BitTorrent</a>, <a href="../../../../index.html#key341">bee</a>, <a href="../../../../index.html#key343">bittorrent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key344">torrent</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bench/bench.html.
















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bench - Benchmarking/Performance tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bench/bench.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bench.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bench(n) 0.4 tcllib &quot;Benchmarking/Performance tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bench - bench - Processing benchmark suites</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a>
<ul>
<li class="subsection"><a href="#subsection1">Benchmark execution</a></li>
<li class="subsection"><a href="#subsection2">Result manipulation</a></li>
<li class="subsection"><a href="#subsection3">Result format</a></li>
</ul>
</li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">bench <span class="opt">?0.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::bench::locate</b> <i class="arg">pattern</i> <i class="arg">paths</i></a></li>
<li><a href="#2"><b class="cmd">::bench::run</b> <span class="opt">?<i class="arg">option value</i>...?</span> <i class="arg">interp_list</i> <i class="arg">file</i>...</a></li>
<li><a href="#3"><b class="cmd">::bench::versions</b> <i class="arg">interp_list</i></a></li>
<li><a href="#4"><b class="cmd">::bench::del</b> <i class="arg">bench_result</i> <i class="arg">column</i></a></li>
<li><a href="#5"><b class="cmd">::bench::edit</b> <i class="arg">bench_result</i> <i class="arg">column</i> <i class="arg">newvalue</i></a></li>
<li><a href="#6"><b class="cmd">::bench::merge</b> <i class="arg">bench_result</i>...</a></li>
<li><a href="#7"><b class="cmd">::bench::norm</b> <i class="arg">bench_result</i> <i class="arg">column</i></a></li>
<li><a href="#8"><b class="cmd">::bench::out::raw</b> <i class="arg">bench_result</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands for the execution of benchmarks written
in the bench language, and for the processing of results generated by
such execution.</p>
<p>A reader interested in the bench language itself should start with the
<i class="term"><a href="bench_lang_intro.html">bench language introduction</a></i> and proceed from there to the
formal <i class="term"><a href="bench_lang_spec.html">bench language specification</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Benchmark execution</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::bench::locate</b> <i class="arg">pattern</i> <i class="arg">paths</i></a></dt>
<dd><p>This command locates Tcl interpreters and returns a list containing
their paths. It searches them in the list of <i class="arg">paths</i> specified by
the caller, using the glob <i class="arg">pattern</i>.</p>
<p>The command resolves soft links to find the actual executables
matching the pattern. Note that only interpreters which are marked as
executable and are actually executable on the current platform are put
into the result.</p></dd>
<dt><a name="2"><b class="cmd">::bench::run</b> <span class="opt">?<i class="arg">option value</i>...?</span> <i class="arg">interp_list</i> <i class="arg">file</i>...</a></dt>
<dd><p>This command executes the benchmarks declared in the set of files,
once per Tcl interpreter specified via the <i class="arg">interp_list</i>, and per
the configuration specified by the options, and then returns the
accumulated timing results. The format of this result is described in
section <span class="sectref"><a href="#subsection3">Result format</a></span>.</p>
<p>It is assumed that the contents of the files are written in the bench
language.</p>
<p>The available options are</p>
<dl class="options">
<dt><b class="option">-errors</b> <i class="arg">flag</i></dt>
<dd><p>The argument is a boolean value. If set errors in benchmarks are
propagated to the command, aborting benchmark execution. Otherwise
they are recorded in the timing result via a special result code. The
default is to propagate and abort.</p></dd>
<dt><b class="option">-threads</b> <i class="arg">n</i></dt>
<dd><p>The argument is a non-negative integer value declaring the number of
threads to use while executing the benchmarks. The default value is
<b class="const">0</b>, to not use threads.</p></dd>
<dt><b class="option">-match</b> <i class="arg">pattern</i></dt>
<dd><p>The argument is a glob pattern. Only benchmarks whose description
matches the pattern are executed. The default is the empty string, to
execute all patterns.</p></dd>
<dt><b class="option">-rmatch</b> <i class="arg">pattern</i></dt>
<dd><p>The argument is a regular expression pattern. Only benchmarks whose
description matches the pattern are executed. The default is the empty
string, to execute all patterns.</p></dd>
<dt><b class="option">-iters</b> <i class="arg">n</i></dt>
<dd><p>The argument is positive integer number, the maximal number of
iterations for any benchmark. The default is <b class="const">1000</b>. Individual
benchmarks can override this.</p></dd>
<dt><b class="option">-pkgdir</b> <i class="arg">path</i></dt>
<dd><p>The argument is a path to an existing, readable directory. Multiple
paths can be specified, simply use the option multiple times, each
time with one of the paths to use.</p>
<p>If no paths were specified the system will behave as before.
If one or more paths are specified, say <b class="variable">N</b>, each of the specified
interpreters will be invoked <b class="variable">N</b> times, with one of the specified
paths. The chosen path is put into the interpreters' <b class="variable">auto_path</b>,
thus allowing it to find specific versions of a package.</p>
<p>In this way the use of <b class="option">-pkgdir</b> allows the user to benchmark
several different versions of a package, against one or more interpreters.</p>
<p><em>Note:</em> The empty string is allowed as a path and causes the system to
run the specified interpreters with an unmodified <b class="variable">auto_path</b>. In case
the package in question is available there as well.</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::bench::versions</b> <i class="arg">interp_list</i></a></dt>
<dd><p>This command takes a list of Tcl interpreters, identified by their
path, and returns a dictionary mapping from the interpreters to their
versions. Interpreters which are not actually executable, or fail when
interrogated, are not put into the result. I.e the result may contain
less interpreters than there in the input list.</p>
<p>The command uses builtin command <b class="cmd">info patchlevel</b> to determine
the version of each interpreter.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Result manipulation</a></h3>
<dl class="definitions">
<dt><a name="4"><b class="cmd">::bench::del</b> <i class="arg">bench_result</i> <i class="arg">column</i></a></dt>
<dd><p>This command removes a column, i.e. all benchmark results for a
specific Tcl interpreter, from the specified benchmark result and
returns the modified result.</p>
<p>The benchmark results are in the format described in section
<span class="sectref"><a href="#subsection3">Result format</a></span>.</p>
<p>The column is identified by an integer number.</p></dd>
<dt><a name="5"><b class="cmd">::bench::edit</b> <i class="arg">bench_result</i> <i class="arg">column</i> <i class="arg">newvalue</i></a></dt>
<dd><p>This command renames a column in the specified benchmark result and
returns the modified result. This means that the path of the Tcl
interpreter in the identified column is changed to an arbitrary
string.</p>
<p>The benchmark results are in the format described in section
<span class="sectref"><a href="#subsection3">Result format</a></span>.</p>
<p>The column is identified by an integer number.</p></dd>
<dt><a name="6"><b class="cmd">::bench::merge</b> <i class="arg">bench_result</i>...</a></dt>
<dd><p>This commands takes one or more benchmark results, merges them into
one big result, and returns that as its result.</p>
<p>All benchmark results are in the format described in section
<span class="sectref"><a href="#subsection3">Result format</a></span>.</p></dd>
<dt><a name="7"><b class="cmd">::bench::norm</b> <i class="arg">bench_result</i> <i class="arg">column</i></a></dt>
<dd><p>This command normalizes the timing results in the specified benchmark
result and returns the modified result. This means that the cell
values are not times anymore, but factors showing how much faster or
slower the execution was relative to the baseline.</p>
<p>The baseline against which the command normalizes are the timing
results in the chosen column. This means that after the normalization
the values in this column are all <b class="const">1</b>, as these benchmarks are
neither faster nor slower than the baseline.</p>
<p>A factor less than <b class="const">1</b> indicates a benchmark which was faster
than the baseline, whereas a factor greater than <b class="const">1</b> indicates a
slower execution.</p>
<p>The benchmark results are in the format described in section
<span class="sectref"><a href="#subsection3">Result format</a></span>.</p>
<p>The column is identified by an integer number.</p></dd>
<dt><a name="8"><b class="cmd">::bench::out::raw</b> <i class="arg">bench_result</i></a></dt>
<dd><p>This command formats the specified benchmark result for output to a
file, socket, etc. This specific command does no formatting at all,
it passes the input through unchanged.</p>
<p>For other formatting styles see the packages <b class="package"><a href="bench_wtext.html">bench::out::text</a></b>
and <b class="package"><a href="bench_wcsv.html">bench::out::csv</a></b> which provide commands to format
benchmark results for human consumption, or as CSV data importable by
spread sheets, respectively.</p>
<p>Complementary, to read benchmark results from files, sockets etc. look
for the package <b class="package"><a href="bench_read.html">bench::in</a></b> and the commands provided by it.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Result format</a></h3>
<p>After the execution of a set of benchmarks the raw result returned by
this package is a Tcl dictionary containing all the relevant
information.
The dictionary is a compact representation, i.e. serialization, of a
2-dimensional table which has Tcl interpreters as columns and
benchmarks as rows. The cells of the table contain the timing
results.
The Tcl interpreters / columns are identified by their paths.
The benchmarks / rows are identified by their description.</p>
<p>The possible keys are all valid Tcl lists of two or three elements and
have one of the following forms:</p>
<dl class="definitions">
<dt>{interp *}</dt>
<dd><p>The set of keys matching this glob pattern capture the information
about all the Tcl interpreters used to run the benchmarks. The second
element of the key is the path to the interpreter.</p>
<p>The associated value is the version of the Tcl interpreter.</p></dd>
<dt>{desc *}</dt>
<dd><p>The set of keys matching this glob pattern capture the information
about all the benchmarks found in the executed benchmark suite. The
second element of the key is the description of the benchmark, which
has to be unique.</p>
<p>The associated value is irrelevant, and set to the empty string.</p></dd>
<dt>{usec * *}</dt>
<dd><p>The set of keys matching this glob pattern capture the performance
information, i.e. timing results. The second element of the key is the
description of the benchmark, the third element the path of the Tcl
interpreter which was used to run it.</p>
<p>The associated value is either one of several special result codes, or
the time it took to execute the benchmark, in microseconds. The
possible special result codes are</p>
<dl class="definitions">
<dt>ERR</dt>
<dd><p>Benchmark could not be executed, failed with a Tcl error.</p></dd>
<dt>BAD_RES</dt>
<dd><p>The benchmark could be executed, however the result from its body did
not match the declared expectations.</p></dd>
</dl></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>bench</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="bench_intro.html">bench_intro</a>, <a href="bench_lang_intro.html">bench_lang_intro</a>, <a href="bench_lang_spec.html">bench_lang_spec</a>, bench_read, bench_wcsv, bench_wtext</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key87">benchmark</a>, <a href="../../../../index.html#key99">merging</a>, <a href="../../../../index.html#key100">normalization</a>, <a href="../../../../index.html#key85">performance</a>, <a href="../../../../index.html#key86">testing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Benchmark tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bench/bench_intro.html.
















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bench_intro - Benchmarking/Performance tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bench/bench_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bench_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bench_intro(n) 1.0 tcllib &quot;Benchmarking/Performance tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bench_intro - bench introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">HISTORICAL NOTES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <i class="term"><a href="bench.html">bench</a></i> (short for <em>benchmark tools</em>), is a set of
related, yet different, entities which are working together for the
easy creation and execution of performance test suites, also known as
benchmarks. These are</p>
<ol class="enumerated">
<li><p>A tcl based language for the declaration of test cases. A test case is
represented by a tcl command declaring the various parts needed to
execute it, like setup, cleanup, the commands to test, etc.</p></li>
<li><p>A package providing the ability to execute test cases written in that
language.</p></li>
</ol>
<p>Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the benchmarking process.</p>
<ol class="enumerated">
<li><p>A <i class="term">writer</i> of benchmarks has to understand the bench language
itself. A beginner to bench should read the more informally written
<i class="term"><a href="bench_lang_intro.html">bench language introduction</a></i> first. Having digested this the
formal <i class="term"><a href="bench_lang_spec.html">bench language specification</a></i> should become
understandable. A writer experienced with bench may only need this
last document from time to time, to refresh her memory.</p></li>
<li><p>A <i class="term">user</i> of benchmark suites written in the <i class="term"><a href="bench.html">bench</a></i> language
has to know which tools are available for use.
At the bottom level sits the package <b class="package"><a href="bench.html">bench</a></b>, providing the
basic facilities to read and execute files containing benchmarks
written in the bench language, and to manipulate benchmark results.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">HISTORICAL NOTES</a></h2>
<p>This module and package have been derived from Jeff Hobbs'
<b class="syscmd">tclbench</b> application for the benchmarking of the Tcl core and
its ancestor &quot;<b class="file">runbench.tcl</b>&quot;.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>bench</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="bench.html">bench</a>, bench_lang_faq, <a href="bench_lang_intro.html">bench_lang_intro</a>, <a href="bench_lang_spec.html">bench_lang_spec</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key84">bench language</a>, <a href="../../../../index.html#key87">benchmark</a>, <a href="../../../../index.html#key85">performance</a>, <a href="../../../../index.html#key86">testing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Benchmark tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bench/bench_lang_intro.html.




























































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bench_lang_intro - Benchmarking/Performance tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bench/bench_lang_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bench_lang_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bench_lang_intro(n) 1.0 tcllib &quot;Benchmarking/Performance tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bench_lang_intro - bench language introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Fundamentals</a></li>
<li class="subsection"><a href="#subsection2">Basics</a></li>
<li class="subsection"><a href="#subsection3">Pre- and postprocessing</a></li>
<li class="subsection"><a href="#subsection4">Advanced pre- and postprocessing</a></li>
</ul>
</li>
<li class="section"><a href="#section2">FURTHER READING</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is an informal introduction to version 1 of the bench
language based on a multitude of examples. After reading this a
benchmark writer should be ready to understand the formal
<i class="term"><a href="bench_lang_spec.html">bench language specification</a></i>.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Fundamentals</a></h3>
<p>In the broadest terms possible the <i class="term"><a href="../../../../index.html#key84">bench language</a></i> is
essentially Tcl, plus a number of commands to support the declaration
of benchmarks.
A document written in this language is a Tcl script and has the same
syntax.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Basics</a></h3>
<p>One of the most simplest benchmarks which can be written in bench is</p>
<pre class="example">
bench -desc LABEL -body {
    set a b
}
</pre>
<p>This code declares a benchmark named <b class="const">LABEL</b> which measures the
time it takes to assign a value to a variable. The Tcl code doing this
assignment is the <b class="option">-body</b> of the benchmark.</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Pre- and postprocessing</a></h3>
<p>Our next example demonstrates how to declare <i class="term">initialization</i> and
<i class="term"><a href="../../../../index.html#key151">cleanup</a></i> code, i.e. code computing information for the use of
the <b class="option">-body</b>, and for releasing such resources after the
measurement is done.
They are the <b class="option">-pre</b>- and the <b class="option">-post</b>-body, respectively.</p>
<p>In our example, directly drawn from the benchmark suite of Tcllib's
<b class="package"><a href="../aes/aes.html">aes</a></b> package, the concrete initialization code constructs the
key schedule used by the encryption command whose speed we measure,
and the cleanup code releases any resources bound to that schedule.</p>
<pre class="example">
bench -desc &quot;AES-${len} ECB encryption core&quot; <b class="option">-pre</b> {
    set key [aes::Init ecb $k $i]
} -body {
    aes::Encrypt $key $p
} <b class="option">-post</b> {
    aes::Final $key
}
</pre>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Advanced pre- and postprocessing</a></h3>
<p>Our last example again deals with initialization and cleanup code. To
see the difference to the regular initialization and cleanup discussed
in the last section it is necessary to know a bit more about how bench
actually measures the speed of the the <b class="option">-body</b>.</p>
<p>Instead of running the <b class="option">-body</b> just once the system actually
executes the <b class="option">-body</b> several hundred times and then returns the
average of the found execution times. This is done to remove
environmental effects like machine load from the result as much as
possible, with outliers canceling each other out in the average.</p>
<p>The drawback of doing things this way is that when we measure
operations which are not idempotent we will most likely not measure
the time for the operation we want, but of the state(s) the system is
in after the first iteration, a mixture of things we have no interest
in.</p>
<p>Should we wish, for example, to measure the time it takes to include
an element into a set, with the element not yet in the set, and the
set having specific properties like being a shared Tcl_Obj, then the
first iteration will measure the time for this. <em>However</em> all
subsequent iterations will measure the time to include an element
which is already in the set, and the Tcl_Obj holding the set will not
be shared anymore either. In the end the timings taken for the several
hundred iterations of this state will overwhelm the time taken from
the first iteration, the only one which actually measured what we
wanted.</p>
<p>The advanced initialization and cleanup codes, <b class="option">-ipre</b>- and the
<b class="option">-ipost</b>-body respectively, are present to solve this very
problem. While the regular initialization and cleanup codes are
executed before and after the whole series of iterations the advanced
codes are executed before and after each iteration of the body,
without being measured themselves. This allows them to bring the
system into the exact state the body wishes to measure.</p>
<p>Our example, directly drawn from the benchmark suite of Tcllib's
<b class="package"><a href="../struct/struct_set.html">struct::set</a></b> package, is for exactly the example we used
above to demonstrate the necessity for the advanced initialization and
cleanup. Its concrete initialization code constructs a variable
refering to a set with specific properties (The set has a string
representation, which is shared) affecting the speed of the inclusion
command, and the cleanup code releases the temporary variables created
by this initialization.</p>
<pre class="example">
bench -desc &quot;set include, missing &lt;SC&gt; x$times $n&quot; <b class="option">-ipre</b> {
    set A $sx($times,$n)
    set B $A
} -body {
    struct::set include A x
} <b class="option">-ipost</b> {
    unset A B
}
</pre>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">FURTHER READING</a></h2>
<p>Now that this document has been digested the reader, assumed to be a
<i class="term">writer</i> of benchmarks, he should be fortified enough to be able
to understand the formal <i class="term">bench language specfication</i>. It will
also serve as the detailed specification and cheat sheet for all
available commands and their syntax.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>bench</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="bench_intro.html">bench_intro</a>, <a href="bench_lang_spec.html">bench_lang_spec</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key84">bench language</a>, <a href="../../../../index.html#key87">benchmark</a>, <a href="../../../../index.html#key330">examples</a>, <a href="../../../../index.html#key85">performance</a>, <a href="../../../../index.html#key86">testing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Benchmark tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bench/bench_lang_spec.html.










































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bench_lang_spec - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bench/bench_lang_spec.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bench_lang_spec.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bench_lang_spec(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bench_lang_spec - bench language specification</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Commands</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">bench_rm</b> <i class="arg">path</i>...</a></li>
<li><a href="#2"><b class="cmd">bench_tmpfile</b></a></li>
<li><a href="#3"><b class="cmd"><a href="bench.html">bench</a></b> <i class="arg">options</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document specifies both names and syntax of all the commands
which together are the bench language, version 1.
As this document is intended to be a reference the commands are listed
in alphabetical order, and the descriptions are relatively short.
A beginner should read the more informally written
<i class="term"><a href="bench_lang_intro.html">bench language introduction</a></i> first.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Commands</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">bench_rm</b> <i class="arg">path</i>...</a></dt>
<dd><p>This command silently removes the files specified as its arguments and
then returns the empty string as its result.
The command is <em>trusted</em>, there is no checking if the specified
files are outside of whatever restricted area the benchmarks are run
in.</p></dd>
<dt><a name="2"><b class="cmd">bench_tmpfile</b></a></dt>
<dd><p>This command returns the path to a bench specific unique temporary
file. The uniqueness means that multiple calls will return different
paths. While the path may exist from previous runs, the command itself
does <em>not</em> create aynthing.</p>
<p>The base location of the temporary files is platform dependent:</p>
<dl class="definitions">
<dt>Unix, and indeterminate platform</dt>
<dd><p>&quot;<b class="file">/tmp</b>&quot;</p></dd>
<dt>Windows</dt>
<dd><p><b class="variable">$TEMP</b></p></dd>
<dt>Anything else</dt>
<dd><p>The current working directory.</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd"><a href="bench.html">bench</a></b> <i class="arg">options</i>...</a></dt>
<dd><p>This command declares a single benchmark. Its result is the empty
string. All parts of the benchmark are declared via options, and their
values. The options can occur in any order. The accepted options are:</p>
<dl class="options">
<dt><b class="option">-body</b> script</dt>
<dd><p>The argument of this option declares the body of the benchmark, the
Tcl script whose performance we wish to measure. This option, and
<b class="option">-desc</b>, are the two required parts of each benchmark.</p></dd>
<dt><b class="option">-desc</b> msg</dt>
<dd><p>The argument of this option declares the name of the benchmark. It has
to be unique, or timing data from different benchmarks will be mixed
together.</p>
<p><em>Beware!</em> This requirement is not checked when benchmarks are
executed, and the system will silently produce bogus data. This
option, and <b class="option">-body</b>, are the two required parts of each
benchmark.</p></dd>
<dt><b class="option">-ipost</b> script</dt>
<dd><p>The argument of this option declares a script which is run immediately
<em>after</em> each iteration of the body. Its responsibility is to
release resources created by the body, or <b class="option">-ipre</b>-bodym which
we do not wish to live into the next iteration.</p></dd>
<dt><b class="option">-ipre</b> script</dt>
<dd><p>The argument of this option declares a script which is run immediately
<em>before</em> each iteration of the body. Its responsibility is to
create the state of the system expected by the body so that we measure
the right thing.</p></dd>
<dt><b class="option">-iterations</b> num</dt>
<dd><p>The argument of this option declares the maximum number of times to
run the <b class="option">-body</b> of the benchmark. During execution this and the
global maximum number of iterations are compared and the smaller of
the two values is used.</p>
<p>This option should be used only for benchmarks which are expected or
known to take a long time per run. I.e. reduce the number of times
they are run to keep the overall time for the execution of the whole
benchmark within manageable limits.</p></dd>
<dt><b class="option">-post</b> script</dt>
<dd><p>The argument of this option declares a script which is run
<em>after</em> all iterations of the body have been run. Its
responsibility is to release resources created by the body,
or <b class="option">-pre</b>-body.</p></dd>
<dt><b class="option">-pre</b> script</dt>
<dd><p>The argument of this option declares a script which is run
<em>before</em> any of the iterations of the body are run. Its
responsibility is to create whatever resources are needed by the body
to run without failing.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>bench</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="bench_intro.html">bench_intro</a>, <a href="bench_lang_intro.html">bench_lang_intro</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key84">bench language</a>, <a href="../../../../index.html#key87">benchmark</a>, <a href="../../../../index.html#key85">performance</a>, <a href="../../../../index.html#key613">specification</a>, <a href="../../../../index.html#key86">testing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Benchmark tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bench/bench_read.html.

























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bench::in - Benchmarking/Performance tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bench/bench_read.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bench::in.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bench::in(n) 0.1 tcllib &quot;Benchmarking/Performance tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bench::in - bench::in - Reading benchmark results</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">csv</b></li>
<li>package require <b class="pkgname">bench::in <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::bench::in::read</b> <i class="arg">file</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a command for reading benchmark results from
files, sockets, etc.</p>
<p>A reader interested in the creation, processing or writing of such
results should go and read
<i class="term"><a href="bench.html">bench - Processing benchmark suites</a></i> instead.</p>
<p>If the bench language itself is the actual interest please start with
the <i class="term"><a href="bench_lang_intro.html">bench language introduction</a></i> and then proceed from there
to the formal <i class="term"><a href="bench_lang_spec.html">bench language specification</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::bench::in::read</b> <i class="arg">file</i></a></dt>
<dd><p>This command reads a benchmark result from the specified <i class="arg">file</i>
and returns it as its result. The command understands the three
formats created by the commands</p>
<dl class="commands">
<dt><b class="cmd">bench::out::raw</b></dt>
<dd><p>Provided by package <b class="package"><a href="bench.html">bench</a></b>.</p></dd>
<dt><b class="cmd"><a href="bench_wcsv.html">bench::out::csv</a></b></dt>
<dd><p>Provided by package <b class="package"><a href="bench_wcsv.html">bench::out::csv</a></b>.</p></dd>
<dt><b class="cmd"><a href="bench_wtext.html">bench::out::text</a></b></dt>
<dd><p>Provided by package <b class="package"><a href="bench_wtext.html">bench::out::text</a></b>.</p></dd>
</dl>
<p>and automatically detects which format is used by the input file.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>bench</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="bench.html">bench</a>, <a href="bench_wcsv.html">bench::out::csv</a>, <a href="bench_wtext.html">bench::out::text</a>, <a href="bench_intro.html">bench_intro</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key87">benchmark</a>, <a href="../../../../index.html#key53">csv</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key453">human readable</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key85">performance</a>, <a href="../../../../index.html#key477">reading</a>, <a href="../../../../index.html#key86">testing</a>, <a href="../../../../index.html#key454">text</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Benchmark tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bench/bench_wcsv.html.

















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bench::out::csv - Benchmarking/Performance tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bench/bench_wcsv.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bench::out::csv.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bench::out::csv(n) 0.1.2 tcllib &quot;Benchmarking/Performance tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bench::out::csv - bench::out::csv - Formatting benchmark results as CSV</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">bench::out::csv <span class="opt">?0.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::bench::out::csv</b> <i class="arg">bench_result</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands for fomatting of benchmark results into
a CSV table importable by spread sheets.</p>
<p>A reader interested in the generation or processing of such results should
go and read <i class="term"><a href="bench.html">bench - Processing benchmark suites</a></i> instead.</p>
<p>If the bench language itself is the actual interest please start with
the <i class="term"><a href="bench_lang_intro.html">bench language introduction</a></i> and then proceed from there
to the formal <i class="term"><a href="bench_lang_spec.html">bench language specification</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::bench::out::csv</b> <i class="arg">bench_result</i></a></dt>
<dd><p>This command formats the specified benchmark result for output to a
file, socket, etc. This specific command generates CSV data importable
by spread sheets.</p>
<p>For other formatting styles see the packages <b class="package"><a href="bench.html">bench</a></b> and
<b class="package"><a href="bench_wtext.html">bench::out::text</a></b> which provide commands to format benchmark
results in raw form, or for human consumption, respectively.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>bench</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="bench.html">bench</a>, <a href="bench_wtext.html">bench::out::text</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key87">benchmark</a>, <a href="../../../../index.html#key53">csv</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key85">performance</a>, <a href="../../../../index.html#key86">testing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Benchmark tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bench/bench_wtext.html.

















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bench::out::text - Benchmarking/Performance tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bench/bench_wtext.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bench::out::text.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bench::out::text(n) 0.1.2 tcllib &quot;Benchmarking/Performance tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bench::out::text - bench::out::text - Formatting benchmark results as human readable text</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">bench::out::text <span class="opt">?0.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::bench::out::text</b> <i class="arg">bench_result</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands for fomatting of benchmark results into
human readable text.</p>
<p>A reader interested in the generation or processing of such results should
go and read <i class="term"><a href="bench.html">bench - Processing benchmark suites</a></i> instead.</p>
<p>If the bench language itself is the actual interest please start with
the <i class="term"><a href="bench_lang_intro.html">bench language introduction</a></i> and then proceed from there
to the formal <i class="term"><a href="bench_lang_spec.html">bench language specification</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::bench::out::text</b> <i class="arg">bench_result</i></a></dt>
<dd><p>This command formats the specified benchmark result for output to a
file, socket, etc. This specific command generates human readable
text.</p>
<p>For other formatting styles see the packages <b class="package"><a href="bench.html">bench</a></b> and
<b class="package"><a href="bench_wcsv.html">bench::out::csv</a></b> which provide commands to format benchmark
results in raw form, or as importable CSV data, respectively.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>bench</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="bench.html">bench</a>, <a href="bench_wcsv.html">bench::out::csv</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key87">benchmark</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key453">human readable</a>, <a href="../../../../index.html#key85">performance</a>, <a href="../../../../index.html#key86">testing</a>, <a href="../../../../index.html#key454">text</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Benchmark tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/bibtex/bibtex.html.
































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>bibtex - bibtex</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/bibtex/bibtex.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 for documentation, Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ bibtex.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">bibtex(n) 0.5 tcllib &quot;bibtex&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>bibtex - Parse bibtex files</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">bibtex <span class="opt">?0.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::bibtex::parse</b> <span class="opt">?<i class="arg">options</i>?</span> <span class="opt">?<i class="arg">text</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::bibtex::parse</b> <i class="arg">text</i></a></li>
<li><a href="#3"><b class="cmd">::bibtex::parse</b> <span class="opt">?<b class="option">-command</b> <i class="arg">cmd</i>?</span> <b class="option">-channel</b> <i class="arg">chan</i></a></li>
<li><a href="#4"><b class="cmd">::bibtex::parse</b> <span class="opt">?<b class="option">-recordcommand</b>   <i class="arg">recordcmd</i>?</span> <span class="opt">?<b class="option">-preamblecommand</b> <i class="arg">preamblecmd</i>?</span> <span class="opt">?<b class="option">-stringcommand</b>   <i class="arg">stringcmd</i>?</span> <span class="opt">?<b class="option">-commentcommand</b>  <i class="arg">commentcmd</i>?</span> <span class="opt">?<b class="option">-progresscommand</b> <i class="arg">progresscmd</i>?</span> (<i class="arg">text</i> | <b class="option">-channel</b> <i class="arg">chan</i>)</a></li>
<li><a href="#5"><b class="cmd">::bibtex::wait</b> <i class="arg">token</i></a></li>
<li><a href="#6"><b class="cmd">::bibtex::destroy</b> <i class="arg">token</i></a></li>
<li><a href="#7"><b class="cmd">::bibtex::addStrings</b> <i class="arg">token</i> <i class="arg">stringdict</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands for the parsing of bibliographies in
BibTeX format.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::bibtex::parse</b> <span class="opt">?<i class="arg">options</i>?</span> <span class="opt">?<i class="arg">text</i>?</span></a></dt>
<dd><p>This is the general form of the command for parsing a
bibliography. Depending on the options used to invoke it it will
either return a token for the parser, or the parsed entries of the
input bibliography. Instead of performing an immediate parse returning
a predefined format the command can also enter an event-based parsing
style where all relevant entries in the input are reported through
callback commands, in the style of SAX.</p></dd>
<dt><a name="2"><b class="cmd">::bibtex::parse</b> <i class="arg">text</i></a></dt>
<dd><p>In this form the command will assume that the specified <i class="arg">text</i> is
a bibliography in BibTeX format, parse it, and then return a list
containing one element per record found in the bibliography. Note that
comments, string definitions, preambles, etc. will not show up in the
result.  Each element will be a list containing record type,
bibliography key and record data, in this order. The record data will
be a dictionary, its keys the keys of the record, with the associated
values.</p></dd>
<dt><a name="3"><b class="cmd">::bibtex::parse</b> <span class="opt">?<b class="option">-command</b> <i class="arg">cmd</i>?</span> <b class="option">-channel</b> <i class="arg">chan</i></a></dt>
<dd><p>In this form the command will reads the bibliography from the
specified Tcl channel <i class="arg">chan</i> and then returns the same data
structure as described above.</p>
<p>If however the option <b class="option">-command</b> is specified the result will be a
handle for the parser instead and all processing will be incremental
and happen in the background. When the input has been exhausted the
callback <i class="arg">cmd</i> will be invoked with the result of the parse. The
exact definition for the callback is</p>
<dl class="definitions">
<dt><b class="cmd">cmd</b> <i class="arg">token</i> <i class="arg">parseresult</i></dt>
<dd><p>The parse result will have the structure explained above, for the
simpler forms of the parser.</p></dd>
</dl>
<p><em>Note</em> that the parser will <em>not</em> close the channel after it
has exhausted it. This is still the responsibility of the user of the
parser.</p></dd>
<dt><a name="4"><b class="cmd">::bibtex::parse</b> <span class="opt">?<b class="option">-recordcommand</b>   <i class="arg">recordcmd</i>?</span> <span class="opt">?<b class="option">-preamblecommand</b> <i class="arg">preamblecmd</i>?</span> <span class="opt">?<b class="option">-stringcommand</b>   <i class="arg">stringcmd</i>?</span> <span class="opt">?<b class="option">-commentcommand</b>  <i class="arg">commentcmd</i>?</span> <span class="opt">?<b class="option">-progresscommand</b> <i class="arg">progresscmd</i>?</span> (<i class="arg">text</i> | <b class="option">-channel</b> <i class="arg">chan</i>)</a></dt>
<dd><p>This is the most low-level form for the parser. The returned result
will be a handle for the parser. During processing it will invoke the
invoke the specified callback commands for each type of data found in
the bibliography.</p>
<p>The processing will be incremental and happen in the background if,
and only if a Tcl channel <i class="arg">chan</i> is specified. For a <i class="arg">text</i>
the processing will happen immediately and all callbacks will be
invoked before the command itself returns.</p>
<p>The callbacks, i.e. <i class="arg">*cmd</i>, are all command prefixes and will be
invoked with additional arguments appended to them. The meaning of the
arguments depends on the callback and is explained below. The first
argument will however always be the handle of the parser invoking the
callback.</p>
<dl class="definitions">
<dt><b class="cmd">recordcmd</b> <i class="arg">token</i> <i class="arg">type</i> <i class="arg">key</i> <i class="arg">recorddict</i></dt>
<dd><p>This callback is invoked whenever the parser detects a bibliography
record in the input. Its arguments are the record type, the
bibliography key for the record, and a dictionary containing the keys
and values describing the record. Any string macros known to the
parser have already been expanded.</p></dd>
<dt><b class="cmd">preamblecmd</b> <i class="arg">token</i> <i class="arg">preambletext</i></dt>
<dd><p>This callback is invoked whenever the parser detects an @preamble
block in the input. The only additional argument is the text found in
the preamble block. By default such entries are ignored.</p></dd>
<dt><b class="cmd">stringcmd</b> <i class="arg">token</i> <i class="arg">stringdict</i></dt>
<dd><p>This callback is invoked whenever the parser detects an @string-based
macro definition in the input. The argument is a dictionary with the
macro names as keys and their replacement strings as values. By
default such definitions are added to the parser state for use in
future bibliography records.</p></dd>
<dt><b class="cmd">commentcmd</b> <i class="arg">token</i> <i class="arg">commenttext</i></dt>
<dd><p>This callback is invoked whenever the parser detects a comment in the
input. The only additional argument is the comment text. By default
such entries are ignored.</p></dd>
<dt><b class="cmd">progresscmd</b> <i class="arg">token</i> <i class="arg">percent</i></dt>
<dd><p>This callback is invoked during processing to tell the user about the
progress which has been made. Its argument is the percentage of data
processed, as integer number between <b class="const">0</b> and <b class="const">100</b>.
In the case of incremental processing the perecentage will always be
<b class="const">-1</b> as the total number of entries is not known beforehand.</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::bibtex::wait</b> <i class="arg">token</i></a></dt>
<dd><p>This command waits for the parser represented by the <i class="arg">token</i> to
complete and then returns. The returned result is the empty string.</p></dd>
<dt><a name="6"><b class="cmd">::bibtex::destroy</b> <i class="arg">token</i></a></dt>
<dd><p>This command cleans up all internal state associated with the parser
represented by the handle <i class="arg">token</i>, effectively destroying it. This
command can be called from within the parser callbacks to terminate
processing.</p></dd>
<dt><a name="7"><b class="cmd">::bibtex::addStrings</b> <i class="arg">token</i> <i class="arg">stringdict</i></a></dt>
<dd><p>This command adds the macro definitions stored in the
dictionary <i class="arg">stringdict</i> to the parser represented
by the handle <i class="arg">token</i>.</p>
<p>The dictionary keys are the macro names and the values their
replacement strings. This command has the correct signature for use as
a <b class="option">-stringcommand</b> callback in an invokation of the command
<b class="cmd">::bibtex::parse</b>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>bibtex</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key378">bibliography</a>, <a href="../../../../index.html#key379">bibtex</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key178">text processing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 for documentation, Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/blowfish/blowfish.html.









































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>blowfish - Blowfish Block Cipher</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/blowfish/blowfish.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ blowfish.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">blowfish(n) 1.0.3 tcllib &quot;Blowfish Block Cipher&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>blowfish - Implementation of the Blowfish block cipher</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">MODES OF OPERATION</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">REFERENCES</a></li>
<li class="section"><a href="#section7">AUTHORS</a></li>
<li class="section"><a href="#section8">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">blowfish <span class="opt">?1.0.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::blowfish::blowfish</b> <span class="opt">?<i class="arg">-mode [ecb|cbc]</i>?</span> <span class="opt">?<i class="arg">-dir [encrypt|decrypt]</i>?</span> <i class="arg">-key keydata</i> <span class="opt">?<i class="arg">-iv vector</i>?</span> <span class="opt">?<i class="arg">-out channel</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> <span class="opt">?<i class="arg">-pad padchar</i>?</span> [ <i class="arg">-in channel</i> | <span class="opt">?<i class="arg">--</i>?</span> <i class="arg">data</i> ]</a></li>
<li><a href="#2"><b class="cmd">::blowfish::Init</b> <i class="arg">mode</i> <i class="arg">keydata</i> <i class="arg">iv</i></a></li>
<li><a href="#3"><b class="cmd">::blowfish::Encrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></li>
<li><a href="#4"><b class="cmd">::blowfish::Decrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></li>
<li><a href="#5"><b class="cmd">::blowfish::Reset</b> <i class="arg">Key</i> <i class="arg">iv</i></a></li>
<li><a href="#6"><b class="cmd">::blowfish::Final</b> <i class="arg">Key</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is an implementation in Tcl of the Blowfish algorithm
developed by Bruce Schneier [1]. Blowfish is a 64-bit block cipher
designed to operate quickly on 32 bit architectures and accepting a
variable key length. This implementation supports ECB and CBC mode
blowfish encryption.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::blowfish::blowfish</b> <span class="opt">?<i class="arg">-mode [ecb|cbc]</i>?</span> <span class="opt">?<i class="arg">-dir [encrypt|decrypt]</i>?</span> <i class="arg">-key keydata</i> <span class="opt">?<i class="arg">-iv vector</i>?</span> <span class="opt">?<i class="arg">-out channel</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> <span class="opt">?<i class="arg">-pad padchar</i>?</span> [ <i class="arg">-in channel</i> | <span class="opt">?<i class="arg">--</i>?</span> <i class="arg">data</i> ]</a></dt>
<dd><p>Perform the <b class="package">blowfish</b> algorithm on either the data provided
by the argument or on the data read from the <i class="arg">-in</i> channel. If
an <i class="arg">-out</i> channel is given then the result will be written to
this channel.</p>
<p>The <i class="arg">-key</i> option must be given. This parameter takes a binary
string of variable length and is used to generate the <b class="package">blowfish</b>
key schedule. You should be aware that creating a key
schedule is quite an expensive operation in blowfish so it is worth
reusing the key where possible. See <b class="cmd">Reset</b>.</p>
<p>The <i class="arg">-mode</i> and <i class="arg">-dir</i> options are optional and default to cbc
mode and encrypt respectively. The initialization vector <i class="arg">-iv</i>
takes an 8 byte binary argument which defaults to 8 zeros.
See <span class="sectref"><a href="#section4">MODES OF OPERATION</a></span> for more about available modes and
their uses.</p>
<p>Blowfish is a 64-bit block cipher. This means that the data must be
provided in units that are a multiple of 8 bytes. The <b class="cmd">blowfish</b>
command will by default add nul characters to pad the input data to a
multiple of 8 bytes if necessary. The programming api commands will
never add padding and instead will raise an error if the input is not
a multiple of the block size. The <i class="arg">-pad</i> option can be used to
change the padding character or to disable padding if the empty string
is provided as the argument.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<dl class="definitions">
<dt><a name="2"><b class="cmd">::blowfish::Init</b> <i class="arg">mode</i> <i class="arg">keydata</i> <i class="arg">iv</i></a></dt>
<dd><p>Construct a new blowfish key schedule using the specified key data and
the given initialization vector. The initialization vector is not used
with ECB mode but is important for CBC mode.
See <span class="sectref"><a href="#section4">MODES OF OPERATION</a></span> for details about cipher modes.</p></dd>
<dt><a name="3"><b class="cmd">::blowfish::Encrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></dt>
<dd><p>Use a prepared key acquired by calling <b class="cmd">Init</b> to encrypt the
provided data. The data argument should be a binary array that is a
multiple of the block size of 8 bytes. The result is a binary
array the same size as the input of encrypted data.</p></dd>
<dt><a name="4"><b class="cmd">::blowfish::Decrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></dt>
<dd><p>Decipher data using the key. Note that the same key may be used to
encrypt and decrypt data provided that the initialization vector is
reset appropriately for CBC mode.</p></dd>
<dt><a name="5"><b class="cmd">::blowfish::Reset</b> <i class="arg">Key</i> <i class="arg">iv</i></a></dt>
<dd><p>Reset the initialization vector. This permits the programmer to re-use
a key and avoid the cost of re-generating the key schedule where the
same key data is being used multiple times.</p></dd>
<dt><a name="6"><b class="cmd">::blowfish::Final</b> <i class="arg">Key</i></a></dt>
<dd><p>This should be called to clean up resources associated with <i class="arg">Key</i>.
Once this function has been called the key may not be used again.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">MODES OF OPERATION</a></h2>
<dl class="definitions">
<dt>Electronic Code Book (ECB)</dt>
<dd><p>ECB is the basic mode of all block ciphers. Each block is encrypted
independently and so identical plain text will produce identical
output when encrypted with the same key. Any encryption errors will
only affect a single block however this is vulnerable to known
plaintext attacks.</p></dd>
<dt>Cipher Block Chaining (CBC)</dt>
<dd><p>CBC mode uses the output of the last block encryption to affect the
current block. An initialization vector of the same size as the cipher
block size is used to handle the first block. The initialization
vector should be chosen randomly and transmitted as the first block of
the output. Errors in encryption affect the current block and the next
block after which the cipher will correct itself. CBC is the most
commonly used mode in software encryption.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<pre class="example">
% blowfish::blowfish -hex -mode ecb -dir encrypt -key secret01 &quot;hello, world!&quot;
d0d8f27e7a374b9e2dbd9938dd04195a
</pre>
<pre class="example">
 set Key [blowfish::Init cbc $eight_bytes_key_data $eight_byte_iv]
 append ciphertext [blowfish::Encrypt $Key $plaintext]
 append ciphertext [blowfish::Encrypt $Key $additional_plaintext]
 blowfish::Final $Key
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Schneier, B. &quot;Applied Cryptography, 2nd edition&quot;, 1996,
    ISBN 0-471-11709-9, pub. John Wiley &amp; Sons.</p></li>
</ol>
</div>
<div id="section7" class="section"><h2><a name="section7">AUTHORS</a></h2>
<p>Frank Pilhofer, Pat Thoyts</p>
</div>
<div id="section8" class="section"><h2><a name="section8">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>blowfish</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>3des, <a href="../des/des.html">des</a>, <a href="../rc4/rc4.html">rc4</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key607">block cipher</a>, <a href="../../../../index.html#key737">blowfish</a>, <a href="../../../../index.html#key736">cryptography</a>, <a href="../../../../index.html#key114">encryption</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/cache/async.html.















































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>cache::async - In-memory caches</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/cache/async.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ cache::async.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">cache::async(n) 0.3 tcllib &quot;In-memory caches&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>cache::async - Asynchronous in-memory cache</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">cache::async <span class="opt">?0.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::cache::async</b> <i class="arg">objectName</i> <i class="arg">commandprefix</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">get</b> <i class="arg">key</i> <i class="arg">donecmdprefix</i></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">set</b> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">unset</b> <i class="arg">key</i></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">exists</b> <i class="arg">key</i></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">clear</b> <span class="opt">?<i class="arg">key</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects which cache data in memory, and operate
asynchronously with regard to request and responses. The objects are
agnostic with regard to cache keys and values, and unknown methods are
delegated to the provider of cached data. These two properties make it
easy to use caches as a facade for any data provider.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports a class, <b class="class">cache::async</b>, as specified
below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::cache::async</b> <i class="arg">objectName</i> <i class="arg">commandprefix</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>The command creates a new <i class="term"><a href="../../../../index.html#key338">cache</a></i> object with an associated
global Tcl command whose name is <i class="arg">objectName</i>.  This command may
be used to invoke various operations on the object.</p>
<p>The <i class="arg">commandprefix</i> is the action to perform when an user asks for
data in the cache and the cache doesn't yet know about the key. When
run the commandprefix is given three additional arguments, the string
<b class="const">get</b>, the key requested, and the cache object itself, in the
form of its object command, in this order. The execution of the action
is done in an idle-handler, decoupling it from the original request.</p>
<p>The only supported option is</p>
<dl class="options">
<dt><b class="option">-full-async-results</b></dt>
<dd><p>This option defines the behaviour of the cache for when requested keys
are known to the cache at the time of <b class="method">get</b> request. By default
such requeste are responded to asynchronously as well. Setting this
option to <b class="const">false</b> forces the cache to respond to them
synchronuously, although still through the specified callback.</p></dd>
</dl></dd>
</dl>
<p>The object commands created by the class commands above have
the form:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">get</b> <i class="arg">key</i> <i class="arg">donecmdprefix</i></a></dt>
<dd><p>This method requests the data for the <i class="arg">key</i> from the cache. If the
data is not yet known the command prefix specified during construction
of the cache object is used to ask for this information.</p>
<p>Whenever the information is/becomes available the <i class="arg">donecmdprefix</i>
will be run to transfer the result to the caller. This command prefix
is invoked with either 2 or 3 arguments, i.e.</p>
<ol class="enumerated">
<li><p>The string <b class="const">set</b>, the <i class="arg">key</i>, and the value.</p></li>
<li><p>The string <b class="const">unset</b>, and the <i class="arg">key</i>.</p></li>
</ol>
<p>These two possibilities are used to either signal the value for the
<i class="arg">key</i>, or that the <i class="arg">key</i> has no value defined for it. The
latter is distinct from the cache not knowing about the <i class="arg">key</i>.</p>
<p>For a cache object configured to be fully asynchronous (default) the
<i class="arg">donecmdprefix</i> is always run in an idle-handler, decoupling it
from the request. Otherwise the callback will be invoked synchronously
when the <i class="arg">key</i> is known to the cache at the time of the
invokation.</p>
<p>Another important part of the cache's behaviour, as it is asynchronous
it is possible that multiple <b class="method">get</b> requests are issued for the
same <i class="arg">key</i> before it can respond. In that case the cache will
issue only one data request to the provider, for the first of these,
and suspend the others, and then notify all of them when the data
becomes available.</p></dd>
<dt><a name="3"><i class="arg">objectName</i> <b class="method">set</b> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">unset</b> <i class="arg">key</i></a></dt>
<dd><p>These two methods are provided to allow users of the cache to make
keys known to the cache, as either having a <i class="arg">value</i>, or as
undefined.</p>
<p>It is expected that the data provider (see <i class="arg">commandprefix</i> of the
constructor) uses them in response to data requests for unknown keys.</p>
<p>Note how this matches the cache's own API towards its caller, calling
the <i class="arg">donecmd</i> of <b class="method">get</b>-requests issued to itself with
either &quot;set key value&quot; or &quot;unset key&quot;, versus issuing
<b class="method">get</b>-requests to its own provider with itself in the place of
the <i class="arg">donecmd</i>, expecting to be called with either &quot;set key value&quot;
or &quot;unset key&quot;.</p>
<p>This also means that these methods invoke the <i class="arg">donecmd</i> of all
<b class="method">get</b>-requests waiting for information about the modified
<i class="arg">key</i>.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">exists</b> <i class="arg">key</i></a></dt>
<dd><p>This method queries the cache for knowledge about the <i class="arg">key</i> and
returns a boolean value. The result is <b class="const">true</b> if the key is
known, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">clear</b> <span class="opt">?<i class="arg">key</i>?</span></a></dt>
<dd><p>This method resets the state of either the specified <i class="arg">key</i> or of
all keys known to the cache, making it unkown. This forces future
<b class="method">get</b>-requests to reload the information from the provider.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>cache</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key590">asynchronous</a>, <a href="../../../../index.html#key338">cache</a>, <a href="../../../../index.html#key494">callback</a>, <a href="../../../../index.html#key591">synchronous</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/clock/iso8601.html.







































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>clock_iso8601 - Date/Time Utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/clock/iso8601.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ clock_iso8601.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">clock_iso8601(n) 0.1 tcllib &quot;Date/Time Utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>clock_iso8601 - Parsing ISO 8601 dates/times</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">clock::iso8601 <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::clock::iso8601 parse_date</b> <i class="arg">date</i> <i class="arg">options...</i></a></li>
<li><a href="#2"><b class="cmd">::clock::iso8601 parse_time</b> <i class="arg">time</i> <i class="arg">options...</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides functionality to parse dates and times in
ISO 8601 format.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::clock::iso8601 parse_date</b> <i class="arg">date</i> <i class="arg">options...</i></a></dt>
<dd><p>This command parses an ISO8601 date string in an unknown variant and
returns the given date/time in seconds since epoch.</p>
<p>The acceptable options are
<b class="option">-base</b>,
<b class="option">-gmt</b>,
<b class="option">-locale</b>, and
<b class="option">-timezone</b>
of the builtin command <b class="cmd">clock scan</b>.</p></dd>
<dt><a name="2"><b class="cmd">::clock::iso8601 parse_time</b> <i class="arg">time</i> <i class="arg">options...</i></a></dt>
<dd><p>This command parses a full ISO8601 timestamp string (date and time) in
an unknown variant and returns the given time in seconds since epoch.</p>
<p>The acceptable options are
<b class="option">-base</b>,
<b class="option">-gmt</b>,
<b class="option">-locale</b>, and
<b class="option">-timezone</b>
of the builtin command <b class="cmd">clock scan</b>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>clock::iso8601</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/clock/rfc2822.html.
























































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>clock_rfc2822 - Date/Time Utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/clock/rfc2822.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ clock_rfc2822.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">clock_rfc2822(n) 0.1 tcllib &quot;Date/Time Utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>clock_rfc2822 - Parsing ISO 8601 dates/times</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">clock::rfc2822 <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::clock::rfc2822 parse_date</b> <i class="arg">date</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides functionality to parse dates in
RFC 2822 format.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::clock::rfc2822 parse_date</b> <i class="arg">date</i></a></dt>
<dd><p>This command parses an RFC2822 date string and returns
the given date in seconds since epoch. An error is thrown
if the command is unable to parse the date.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>clock::rfc2822</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/cmdline/cmdline.html.







































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>cmdline - Command line and option processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/cmdline/cmdline.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ cmdline.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">cmdline(n) 1.3.3 tcllib &quot;Command line and option processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>cmdline - Procedures to process command lines and options.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">::argv handling</a></li>
<li class="section"><a href="#section3">API</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">cmdline <span class="opt">?1.3.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::cmdline::getopt</b> <i class="arg">argvVar</i> <i class="arg">optstring</i> <i class="arg">optVar</i> <i class="arg">valVar</i></a></li>
<li><a href="#2"><b class="cmd">::cmdline::getKnownOpt</b> <i class="arg">argvVar</i> <i class="arg">optstring</i> <i class="arg">optVar</i> <i class="arg">valVar</i></a></li>
<li><a href="#3"><b class="cmd">::cmdline::getoptions</b> <i class="arg">arglistVar</i> <i class="arg">optlist</i> <span class="opt">?<i class="arg">usage</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::cmdline::getKnownOptions</b> <i class="arg">arglistVar</i> <i class="arg">optlist</i> <span class="opt">?<i class="arg">usage</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::cmdline::usage</b> <i class="arg">optlist</i> <span class="opt">?<i class="arg">usage</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::cmdline::getfiles</b> <i class="arg">patterns</i> <i class="arg">quiet</i></a></li>
<li><a href="#7"><b class="cmd">::cmdline::getArgv0</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to parse command lines and options.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">::argv handling</a></h2>
<p>One of the most common variables this package will be used with is
<b class="variable">::argv</b>, which holds the command line of the current
application. This variable has a companion <b class="variable">::argc</b> which is
initialized to the number of elements in <b class="variable">::argv</b> at the beginning
of the application.</p>
<p>The commands in this package will <em>not</em> modify the <b class="variable">::argc</b>
companion when called with <b class="variable">::argv</b>. Keeping the value consistent,
if such is desired or required, is the responsibility of the caller.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::cmdline::getopt</b> <i class="arg">argvVar</i> <i class="arg">optstring</i> <i class="arg">optVar</i> <i class="arg">valVar</i></a></dt>
<dd><p>This command works in a fashion like the standard C based <b class="cmd">getopt</b>
function.  Given an option string and a pointer to an array of args
this command will process the first argument and return info on how to
proceed. The command returns 1 if an option was found, 0 if no more
options were found, and -1 if an error occurred.</p>
<p><i class="arg">argvVar</i> contains the name of the list of arguments to
process. If options are found the list is modified and the processed
arguments are removed from the start of the list.</p>
<p><i class="arg">optstring</i> contains a list of command options that the
application will accept.  If the option ends in &quot;.arg&quot; the command
will use the next argument as an argument to the option.  Otherwise
the option is a boolean that is set to 1 if present.</p>
<p><i class="arg">optVar</i> refers to the variable the command will store the found
option into (without the leading '-' and without the .arg extension).</p>
<p><i class="arg">valVar</i> refers to the variable to store either the value for the
specified option into upon success or an error message in the case of
failure. The stored value comes from the command line for .arg
options, otherwise the value is 1.</p></dd>
<dt><a name="2"><b class="cmd">::cmdline::getKnownOpt</b> <i class="arg">argvVar</i> <i class="arg">optstring</i> <i class="arg">optVar</i> <i class="arg">valVar</i></a></dt>
<dd><p>Like <b class="cmd">::cmdline::getopt</b>, but ignores any unknown options in the
input.</p></dd>
<dt><a name="3"><b class="cmd">::cmdline::getoptions</b> <i class="arg">arglistVar</i> <i class="arg">optlist</i> <span class="opt">?<i class="arg">usage</i>?</span></a></dt>
<dd><p>Processes the set of command line options found in the list variable
named by <i class="arg">arglistVar</i> and fills in defaults for those not
specified.  This also generates an error message that lists the
allowed flags if an incorrect flag is specified. The optional
<i class="arg">usage</i>-argument contains a string to include in front of the
generated message. If not present it defaults to &quot;options:&quot;.</p>
<p><i class="arg">optlist</i> contains a list of lists where each element specifies an
option in the form: <i class="arg">flag</i> <i class="arg">default</i> <i class="arg">comment</i>.</p>
<p>If <i class="arg">flag</i> ends in &quot;.arg&quot; then the value is taken from the command
line. Otherwise it is a boolean and appears in the result if present
on the command line. If <i class="arg">flag</i> ends in &quot;.secret&quot;, it will not be
displayed in the usage.</p>
<p>The options <b class="option">-?</b>, <b class="option">-help</b>, and <b class="option">--</b> are
implicitly understood. The first two abort option processing and force
the generation of the usage message, whereas the the last aborts
option processing without an error, leaving all arguments coming after
for regular processing, even if starting with a dash.</p>
<p>The result of the command is a dictionary mapping all options to their
values, be they user-specified or defaults.</p></dd>
<dt><a name="4"><b class="cmd">::cmdline::getKnownOptions</b> <i class="arg">arglistVar</i> <i class="arg">optlist</i> <span class="opt">?<i class="arg">usage</i>?</span></a></dt>
<dd><p>Like <b class="cmd">::cmdline::getoptions</b>, but ignores any unknown options in the
input.</p></dd>
<dt><a name="5"><b class="cmd">::cmdline::usage</b> <i class="arg">optlist</i> <span class="opt">?<i class="arg">usage</i>?</span></a></dt>
<dd><p>Generates and returns an error message that lists the allowed
flags. <i class="arg">optlist</i> is defined as for
<b class="cmd">::cmdline::getoptions</b>. The optional <i class="arg">usage</i>-argument
contains a string to include in front of the generated message. If not
present it defaults to &quot;options:&quot;.</p></dd>
<dt><a name="6"><b class="cmd">::cmdline::getfiles</b> <i class="arg">patterns</i> <i class="arg">quiet</i></a></dt>
<dd><p>Given a list of file <i class="arg">patterns</i> this command computes the set of
valid files.  On windows, file globbing is performed on each argument.
On Unix, only file existence is tested.  If a file argument produces
no valid files, a warning is optionally generated (set <i class="arg">quiet</i> to
true).</p>
<p>This code also uses the full path for each file.  If not given it
prepends the current working directory to the filename. This ensures
that these files will never conflict with files in a wrapped zip
file. The last sentence refers to the pro-tools.</p></dd>
<dt><a name="7"><b class="cmd">::cmdline::getArgv0</b></a></dt>
<dd><p>This command returns the &quot;sanitized&quot; version of <i class="arg">argv0</i>.  It will
strip off the leading path and removes the extension &quot;.bin&quot;. The
latter is used by the pro-apps because they must be wrapped by a shell
script.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
        set options {
            {a          &quot;set the atime only&quot;}
            {m          &quot;set the mtime only&quot;}
            {c          &quot;do not create non-existent files&quot;}
            {r.arg  &quot;&quot;  &quot;use time from ref_file&quot;}
            {t.arg  -1  &quot;use specified time&quot;}
        }
        set usage &quot;: MyCommandName \[options] filename ...\noptions:&quot;
        array set params [::cmdline::getoptions argv $options $usage]
        if {  $params(a) } { set set_atime &quot;true&quot; }
        set has_t [expr {$params(t) != -1}]
        set has_r [expr {[string length $params(r)] &gt; 0}]
        if {$has_t &amp;&amp; $has_r} {
            return -code error &quot;Cannot specify both -r and -t&quot;
        } elseif {$has_t} {
	    ...
        }
</pre>
<p>This example, taken (and slightly modified) from the package
<b class="package"><a href="../fileutil/fileutil.html">fileutil</a></b>, shows how to use cmdline.  First, a list of
options is created, then the 'args' list is passed to cmdline for
processing.  Subsequently, different options are checked to see if
they have been passed to the script, and what their value is.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>cmdline</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key228">argument processing</a>, <a href="../../../../index.html#key227">argv</a>, <a href="../../../../index.html#key226">argv0</a>, <a href="../../../../index.html#key229">cmdline processing</a>, <a href="../../../../index.html#key225">command line processing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/comm/comm.html.




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>comm - Remote communication</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/comm/comm.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 1995-1998 The Open Group. All Rights Reserved.   -- Copyright &copy; 2003-2004 ActiveState Corporation.   -- Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ comm.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">comm(n) 4.6.2 tcllib &quot;Remote communication&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>comm - A remote communication facility for Tcl (8.3 and later)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Commands</a></li>
<li class="subsection"><a href="#subsection2">Eval Semantics</a></li>
<li class="subsection"><a href="#subsection3">Multiple Channels</a></li>
<li class="subsection"><a href="#subsection4">Channel Configuration</a></li>
<li class="subsection"><a href="#subsection5">Id/port Assignments</a></li>
<li class="subsection"><a href="#subsection6">Execution Environment</a></li>
<li class="subsection"><a href="#subsection7">Remote Interpreters</a></li>
<li class="subsection"><a href="#subsection8">Closing Connections</a></li>
<li class="subsection"><a href="#subsection9">Callbacks</a></li>
<li class="subsection"><a href="#subsection10">Unsupported</a></li>
<li class="subsection"><a href="#subsection11">Security</a></li>
<li class="subsection"><a href="#subsection12">Blocking Semantics</a></li>
<li class="subsection"><a href="#subsection13">Asynchronous Result Generation</a></li>
<li class="subsection"><a href="#subsection14">Compatibility</a></li>
</ul>
</li>
<li class="section"><a href="#section2">Author</a></li>
<li class="section"><a href="#section3">License</a></li>
<li class="section"><a href="#section4">Bugs</a></li>
<li class="section"><a href="#section5">On Using Old Versions Of Tcl</a></li>
<li class="section"><a href="#section6">Related Work</a></li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">comm <span class="opt">?4.6.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::comm::comm send</b> <span class="opt">?-async?</span> <span class="opt">?-command <i class="arg">callback</i>?</span> <i class="arg">id</i> <i class="arg">cmd</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::comm::comm self</b></a></li>
<li><a href="#3"><b class="cmd">::comm::comm interps</b></a></li>
<li><a href="#4"><b class="cmd">::comm::comm connect</b> <span class="opt">?<i class="arg">id</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::comm::comm new</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">name value ...</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::comm::comm channels</b></a></li>
<li><a href="#7"><b class="cmd">::comm::comm config</b></a></li>
<li><a href="#8"><b class="cmd">::comm::comm config</b> <i class="arg">name</i></a></li>
<li><a href="#9"><b class="cmd">::comm::comm config</b> <span class="opt">?<i class="arg">name</i> <i class="arg">value</i> <i class="arg">...</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::comm::comm shutdown</b> <i class="arg">id</i></a></li>
<li><a href="#11"><b class="cmd">::comm::comm abort</b></a></li>
<li><a href="#12"><b class="cmd">::comm::comm destroy</b></a></li>
<li><a href="#13"><b class="cmd">::comm::comm hook</b> <i class="arg">event</i> <span class="opt">?<b class="const">+</b>?</span> <span class="opt">?<i class="arg">script</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::comm::comm remoteid</b></a></li>
<li><a href="#15"><b class="cmd">::comm::comm_send</b></a></li>
<li><a href="#16"><b class="cmd">::comm::comm return_async</b></a></li>
<li><a href="#17"><b class="cmd">$future</b> <b class="method">return</b> <span class="opt">?<b class="option">-code</b> <i class="arg">code</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#18"><b class="cmd">$future</b> <b class="method">configure</b> <span class="opt">?<b class="option">-command</b> <span class="opt">?<i class="arg">cmdprefix</i>?</span>?</span></a></li>
<li><a href="#19"><b class="cmd">$future</b> <b class="method">cget</b> <b class="option">-command</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">comm</b> command provides an inter-interpreter remote
execution facility much like Tk's <b class="cmd">send(n)</b>, except that it uses
sockets rather than the X server for the communication path.  As a
result, <b class="package">comm</b> works with multiple interpreters, works on
Windows and Macintosh systems, and provides control over the remote
execution path.</p>
<p>These commands work just like <b class="cmd"><a href="../../../../index.html#key312">send</a></b> and <b class="cmd">winfo interps</b> :</p>
<pre class="example">
    ::comm::comm send ?-async? id cmd ?arg arg ...?
    ::comm::comm interps
</pre>
<p>This is all that is really needed to know in order to use
<b class="package">comm</b></p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Commands</a></h3>
<p>The package initializes <b class="cmd">::comm::comm</b> as the default <em>chan</em>.</p>
<p><b class="package">comm</b> names communication endpoints with an <em>id</em> unique
to each machine.  Before sending commands, the <em>id</em> of another
interpreter is needed.  Unlike Tk's send, <b class="package">comm</b> doesn't
implicitly know the <em>id</em>'s of all the interpreters on the system.
The following four methods make up the basic <b class="package">comm</b> interface.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::comm::comm send</b> <span class="opt">?-async?</span> <span class="opt">?-command <i class="arg">callback</i>?</span> <i class="arg">id</i> <i class="arg">cmd</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>This invokes the given command in the interpreter named by <i class="arg">id</i>.  The
command waits for the result and remote errors are returned unless the
<b class="option">-async</b> or <b class="option">-command</b> option is given.  If <b class="option">-async</b>
is given, send returns immediately and there is no further notification of
result.  If <b class="option">-command</b> is used, <em>callback</em> specifies a command
to invoke when the result is received.  These options are mutually
exclusive.  The callback will receive arguments in the form
<em>-option value</em>, suitable for <b class="cmd">array set</b>.
The options are: <em>-id</em>, the comm id of the interpreter that received
the command; <em>-serial</em>, a unique serial for each command sent to a
particular comm interpreter; <em>-chan</em>, the comm channel name;
<em>-code</em>, the result code of the command; <em>-errorcode</em>, the
errorcode, if any, of the command; <em>-errorinfo</em>, the errorinfo, if
any, of the command; and <em>-result</em>, the return value of the command.
If connection is lost before a reply is received, the callback will be
invoked with a connection lost message with -code equal to -1.  When
<b class="option">-command</b> is used, the command returns the unique serial for the
command.</p></dd>
<dt><a name="2"><b class="cmd">::comm::comm self</b></a></dt>
<dd><p>Returns the <em>id</em> for this channel.</p></dd>
<dt><a name="3"><b class="cmd">::comm::comm interps</b></a></dt>
<dd><p>Returns a list of all the remote <em>id</em>'s to which this channel is
connected.  <b class="package">comm</b> learns a new remote <em>id</em> when a command
is first issued it, or when a remote <em>id</em> first issues a command
to this comm channel.  <b class="cmd">::comm::comm ids</b> is an alias for this
method.</p></dd>
<dt><a name="4"><b class="cmd">::comm::comm connect</b> <span class="opt">?<i class="arg">id</i>?</span></a></dt>
<dd><p>Whereas <b class="cmd">::comm::comm send</b> will automatically connect to the
given <i class="arg">id</i>, this forces a connection to a remote <em>id</em> without
sending a command.  After this, the remote <em>id</em> will appear in
<b class="cmd">::comm::comm interps</b>.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Eval Semantics</a></h3>
<p>The evaluation semantics of <b class="cmd">::comm::comm send</b> are intended to
match Tk's <b class="cmd"><a href="../../../../index.html#key312">send</a></b> <em>exactly</em>. This means that <b class="package">comm</b>
evaluates arguments on the remote side.</p>
<p>If you find that <b class="cmd">::comm::comm send</b> doesn't work for a
particular command, try the same thing with Tk's send and see if the
result is different.  If there is a problem, please report it.  For
instance, there was had one report that this command produced an
error.  Note that the equivalent <b class="cmd"><a href="../../../../index.html#key312">send</a></b> command also produces the
same error.</p>
<pre class="example">
    % ::comm::comm send id llength {a b c}
    wrong # args: should be &quot;llength list&quot;
    % send name llength {a b c}
    wrong # args: should be &quot;llength list&quot;
</pre>
<p>The <b class="cmd">eval</b> hook (described below) can be used to change from
<b class="cmd"><a href="../../../../index.html#key312">send</a></b>'s double eval semantics to single eval semantics.</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Multiple Channels</a></h3>
<p>More than one <b class="cmd">comm</b> channel (or <em>listener</em>) can be created
in each Tcl interpreter.  This allows flexibility to create full and
restricted channels.  For instance, <i class="term"><a href="../../../../index.html#key632">hook</a></i> scripts are specific
to the channel they are defined against.</p>
<dl class="definitions">
<dt><a name="5"><b class="cmd">::comm::comm new</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">name value ...</i>?</span></a></dt>
<dd><p>This creates a new channel and Tcl command with the given channel
name.  This new command controls the new channel and takes all the
same arguments as <b class="cmd">::comm::comm</b>.  Any remaining arguments are
passed to the <b class="cmd">config</b> method.  The fully qualified channel
name is returned.</p></dd>
<dt><a name="6"><b class="cmd">::comm::comm channels</b></a></dt>
<dd><p>This lists all the channels allocated in this Tcl interpreter.</p></dd>
</dl>
<p>The default configuration parameters for a new channel are:</p>
<pre class="example">
    &quot;-port 0 -local 1 -listen 0 -silent 0&quot;
</pre>
<p>The default channel <b class="cmd">::comm::comm</b> is created with:</p>
<pre class="example">
    &quot;::comm::comm new ::comm::comm -port 0 -local 1 -listen 1 -silent 0&quot;
</pre>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Channel Configuration</a></h3>
<p>The <b class="cmd">config</b> method acts similar to <b class="cmd">fconfigure</b> in that it
sets or queries configuration variables associated with a channel.</p>
<dl class="definitions">
<dt><a name="7"><b class="cmd">::comm::comm config</b></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">::comm::comm config</b> <i class="arg">name</i></a></dt>
<dd></dd>
<dt><a name="9"><b class="cmd">::comm::comm config</b> <span class="opt">?<i class="arg">name</i> <i class="arg">value</i> <i class="arg">...</i>?</span></a></dt>
<dd><p>When given no arguments, <b class="cmd">config</b> returns a list of all variables
and their value With one argument, <b class="cmd">config</b> returns the value of
just that argument.  With an even number of arguments, the given
variables are set to the given values.</p></dd>
</dl>
<p>These configuration variables can be changed (descriptions of them are
elsewhere in this manual page):</p>
<dl class="definitions">
<dt><b class="option">-listen</b> <span class="opt">?<i class="arg">0|1</i>?</span></dt>
<dd></dd>
<dt><b class="option">-local</b>  <span class="opt">?<i class="arg">0|1</i>?</span></dt>
<dd></dd>
<dt><b class="option">-port</b>   <span class="opt">?<i class="arg">port</i>?</span></dt>
<dd></dd>
<dt><b class="option">-silent</b> <span class="opt">?<i class="arg">0|1</i>?</span></dt>
<dd></dd>
<dt><b class="option">-socketcmd</b> <span class="opt">?<i class="arg">commandname</i>?</span></dt>
<dd></dd>
<dt><b class="option">-interp</b> <span class="opt">?<i class="arg">interpreter</i>?</span></dt>
<dd></dd>
<dt><b class="option">-events</b> <span class="opt">?<i class="arg">eventlist</i>?</span></dt>
<dd></dd>
</dl>
<p>These configuration variables are read only:</p>
<dl class="definitions">
<dt><b class="option">-chan</b>    <i class="arg">chan</i></dt>
<dd></dd>
<dt><b class="option">-serial</b>  <i class="arg">n</i></dt>
<dd></dd>
<dt><b class="option">-socket</b>  sock<i class="arg">In</i></dt>
<dd></dd>
</dl>
<p>When <b class="cmd">config</b> changes the parameters of an existing channel (with
the exception of <b class="option">-interp</b> and <b class="option">-events</b>), it closes and
reopens the listening socket.
An automatically assigned channel <em>id</em> will change when this
happens.
Recycling the socket is done by invoking <b class="cmd">::comm::comm abort</b>,
which causes all active sends to terminate.</p>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Id/port Assignments</a></h3>
<p><b class="package">comm</b> uses a TCP port for endpoint <em>id</em>.  The
<b class="method">interps</b> (or <b class="method">ids</b>) method merely lists all the TCP ports
to which the channel is connected.  By default, each channel's
<em>id</em> is randomly assigned by the operating system (but usually
starts at a low value around 1024 and increases each time a new socket
is opened).  This behavior is accomplished by giving the
<b class="option">-port</b> config option a value of 0.  Alternately, a specific
TCP port number may be provided for a given channel.  As a special
case, comm contains code to allocate a a high-numbered TCP port
(&gt;10000) by using <b class="option">-port {}</b>.  Note that a channel won't be
created and initialized unless the specific port can be allocated.</p>
<p>As a special case, if the channel is configured with
<b class="option">-listen 0</b>, then it will not create a listening socket and
will use an id of <b class="const">0</b> for itself.  Such a channel is only good
for outgoing connections (although once a connection is established,
it can carry send traffic in both directions).
As another special case, if the channel is configured with
<b class="option">-silent 0</b>, then the listening side will ignore connection
attempts where the protocol negotiation phase failed, instead of
throwing an error.</p>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Execution Environment</a></h3>
<p>A communication channel in its default configuration will use the
current interpreter for the execution of all received scripts, and of
the event scripts associated with the various hooks.</p>
<p>This insecure setup can be changed by the user via the two options
<b class="option">-interp</b>, and <b class="option">-events</b>.</p>
<p>When <b class="option">-interp</b> is set all received scripts are executed in the
slave interpreter specified as the value of the option. This
interpreter is expected to exist before configuration. I.e. it is the
responsibility of the user to create it. However afterward the
communication channel takes ownership of this interpreter, and will
destroy it when the communication channel is destroyed.
Note that reconfiguration of the communication channel to either a
different interpreter or the empty string will release the ownership
<em>without</em> destroying the previously configured interpreter.  The
empty string has a special meaning, it restores the default behaviour
of executing received scripts in the current interpreter.</p>
<p><em>Also of note</em> is that replies and callbacks (a special form of
reply) are <em>not</em> considered as received scripts. They are
trusted, part of the internal machinery of comm, and therefore always
executed in the current interpreter.</p>
<p>Even if an interpreter has been configured as the execution
environment for received scripts the event scripts associated with the
various hooks will by default still be executed in the current
interpreter. To change this use the option <b class="option">-events</b> to declare
a list of the events whose scripts should be executed in the declared
interpreter as well. The contents of this option are ignored if the
communication channel is configured to execute received scripts in the
current interpreter.</p>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Remote Interpreters</a></h3>
<p>By default, each channel is restricted to accepting connections from
the local system.  This can be overridden by using the
<b class="option">-local 0</b> configuration option For such channels, the
<em>id</em> parameter takes the form <em>{ id host }</em>.</p>
<p><em>WARNING</em>: The <em>host</em> must always be specified in the same
form (e.g., as either a fully qualified domain name, plain hostname or
an IP address).</p>
</div>
<div id="subsection8" class="subsection"><h3><a name="subsection8">Closing Connections</a></h3>
<p>These methods give control over closing connections:</p>
<dl class="definitions">
<dt><a name="10"><b class="cmd">::comm::comm shutdown</b> <i class="arg">id</i></a></dt>
<dd><p>This closes the connection to <i class="arg">id</i>, aborting all outstanding
commands in progress.  Note that nothing prevents the connection from
being immediately reopened by another incoming or outgoing command.</p></dd>
<dt><a name="11"><b class="cmd">::comm::comm abort</b></a></dt>
<dd><p>This invokes shutdown on all open connections in this comm channel.</p></dd>
<dt><a name="12"><b class="cmd">::comm::comm destroy</b></a></dt>
<dd><p>This aborts all connections and then destroys the this comm channel
itself, including closing the listening socket.  Special code allows
the default <b class="cmd">::comm::comm</b> channel to be closed such that the
<b class="cmd">::comm::comm</b> command it is not destroyed.  Doing so closes the
listening socket, preventing both incoming and outgoing commands on
the channel.  This sequence reinitializes the default channel:</p>
<pre class="example">
    &quot;::comm::comm destroy; ::comm::comm new ::comm::comm&quot;
</pre>
</dd>
</dl>
<p>When a remote connection is lost (because the remote exited or called
<b class="cmd">shutdown</b>), <b class="package">comm</b> can invoke an application callback.
This can be used to cleanup or restart an ancillary process, for
instance.  See the <i class="term">lost</i> callback below.</p>
</div>
<div id="subsection9" class="subsection"><h3><a name="subsection9">Callbacks</a></h3>
<p>This is a mechanism for setting hooks for particular events:</p>
<dl class="definitions">
<dt><a name="13"><b class="cmd">::comm::comm hook</b> <i class="arg">event</i> <span class="opt">?<b class="const">+</b>?</span> <span class="opt">?<i class="arg">script</i>?</span></a></dt>
<dd><p>This uses a syntax similar to Tk's <b class="cmd"><a href="../../../../index.html#key659">bind</a></b> command.  Prefixing
<i class="arg">script</i> with a <b class="const">+</b> causes the new script to be appended.
Without this, a new <i class="arg">script</i> replaces any existing script.  When
invoked without a script, no change is made.  In all cases, the new
hook script is returned by the command.</p>
<p>When an <i class="arg">event</i> occurs, the <i class="arg">script</i> associated with it is
evaluated with the listed variables in scope and available.  The
return code (<em>not</em> the return value) of the script is commonly
used decide how to further process after the hook.</p>
<p>Common variables include:</p>
<dl class="definitions">
<dt><b class="variable">chan</b></dt>
<dd><p>the name of the comm channel (and command)</p></dd>
<dt><b class="variable">id</b></dt>
<dd><p>the id of the remote in question</p></dd>
<dt><b class="variable">fid</b></dt>
<dd><p>the file id for the socket of the connection</p></dd>
</dl></dd>
</dl>
<p>These are the defined <em>events</em>:</p>
<dl class="definitions">
<dt><b class="const">connecting</b></dt>
<dd><p>Variables:
<b class="variable">chan</b>, <b class="variable">id</b></p>
<p>This hook is invoked before making a connection to the remote named in
<i class="arg">id</i>.  An error return (via <b class="cmd"><a href="../../../../index.html#key154">error</a></b>) will abort the connection
attempt with the error.  Example:</p>
<pre class="example">
    % ::comm::comm hook connecting {
        if {[string match {*[02468]} $id]} {
            error &quot;Can't connect to even ids&quot; 
        }
    }
    % ::comm::comm send 10000 puts ok
    Connect to remote failed: Can't connect to even ids
    %
</pre>
</dd>
<dt><b class="const">connected</b></dt>
<dd><p>Variables:
<b class="variable">chan</b>, <b class="variable">fid</b>, <b class="variable">id</b>, <b class="variable">host</b>, and <b class="variable">port</b>.</p>
<p>This hook is invoked immediately after making a remote connection to
<i class="arg">id</i>, allowing arbitrary authentication over the socket named by
<i class="arg">fid</i>.  An error return (via <b class="cmd"><a href="../../../../index.html#key154">error</a></b> ) will close the
connection with the error.  <i class="arg">host</i> and <i class="arg">port</i> are merely
extracted from the <i class="arg">id</i>; changing any of these will have no effect
on the connection, however.  It is also possible to substitute and
replace <i class="arg">fid</i>.</p></dd>
<dt><b class="const">incoming</b></dt>
<dd><p>Variables:
<b class="variable">chan</b>, <b class="variable">fid</b>, <b class="variable">addr</b>, and <b class="variable">remport</b>.</p>
<p>Hook invoked when receiving an incoming connection, allowing arbitrary
authentication over socket named by <i class="arg">fid</i>.  An error return (via
<b class="cmd"><a href="../../../../index.html#key154">error</a></b>) will close the connection with the error.  Note that the
peer is named by <i class="arg">remport</i> and <i class="arg">addr</i> but that the remote
<em>id</em> is still unknown.  Example:</p>
<pre class="example">
    ::comm::comm hook incoming {
        if {[string match 127.0.0.1 $addr]} {
            error &quot;I don't talk to myself&quot;
        }
    }
</pre>
</dd>
<dt><b class="const">eval</b></dt>
<dd><p>Variables:
<b class="variable">chan</b>, <b class="variable">id</b>, <b class="variable">cmd</b>, and <b class="variable">buffer</b>.</p>
<p>This hook is invoked after collecting a complete script from a remote
but <em>before</em> evaluating it.  This allows complete control over
the processing of incoming commands.  <i class="arg">cmd</i> contains either
<b class="const">send</b> or <b class="const">async</b>.  <i class="arg">buffer</i> holds the script to
evaluate.  At the time the hook is called, <i class="arg">$chan remoteid</i> is
identical in value to <i class="arg">id</i>.</p>
<p>By changing <i class="arg">buffer</i>, the hook can change the script to be
evaluated.  The hook can short circuit evaluation and cause a value to
be immediately returned by using <b class="cmd">return</b> <i class="arg">result</i> (or, from
within a procedure, <b class="cmd">return -code return</b> <i class="arg">result</i>).  An
error return (via <b class="cmd"><a href="../../../../index.html#key154">error</a></b>) will return an error result, as is if
the script caused the error.  Any other return will evaluate the
script in <i class="arg">buffer</i> as normal.  For compatibility with 3.2,
<b class="cmd">break</b> and <b class="cmd">return -code break</b> <i class="arg">result</i> is supported,
acting similarly to <b class="cmd">return {}</b> and <b class="cmd">return -code return</b>
<i class="arg">result</i>.</p>
<p>Examples:</p>
<ol class="enumerated">
<li><p>augmenting a command</p>
<pre class="example">
    % ::comm::comm send [::comm::comm self] pid
    5013
    % ::comm::comm hook eval {puts &quot;going to execute $buffer&quot;}
    % ::comm::comm send [::comm::comm self] pid
    going to execute pid
    5013
</pre>
</li>
<li><p>short circuiting a command</p>
<pre class="example">
    % ::comm::comm hook eval {puts &quot;would have executed $buffer&quot;; return 0}
    % ::comm::comm send [::comm::comm self] pid
    would have executed pid
    0
</pre>
</li>
<li><p>Replacing double eval semantics</p>
<pre class="example">
    % ::comm::comm send [::comm::comm self] llength {a b c}
    wrong # args: should be &quot;llength list&quot;
    % ::comm::comm hook eval {return [uplevel #0 $buffer]}
    return [uplevel #0 $buffer]
    % ::comm::comm send [::comm::comm self] llength {a b c}
    3
</pre>
</li>
<li><p>Using a slave interpreter</p>
<pre class="example">
    % interp create foo
    % ::comm::comm hook eval {return [foo eval $buffer]}
    % ::comm::comm send [::comm::comm self] set myvar 123
    123
    % set myvar
    can't read &quot;myvar&quot;: no such variable
    % foo eval set myvar
    123
</pre>
</li>
<li><p>Using a slave interpreter (double eval)</p>
<pre class="example">
    % ::comm::comm hook eval {return [eval foo eval $buffer]}
</pre>
</li>
<li><p>Subverting the script to execute</p>
<pre class="example">
    % ::comm::comm hook eval {
        switch -- $buffer {
            a {return A-OK}
            b {return B-OK}
            default {error &quot;$buffer is a no-no&quot;}
        }
    }
    % ::comm::comm send [::comm::comm self] pid
    pid is a no-no
    % ::comm::comm send [::comm::comm self] a
    A-OK
</pre>
</li>
</ol></dd>
<dt><b class="const">reply</b></dt>
<dd><p>Variables:
<b class="variable">chan</b>, <b class="variable">id</b>, <b class="variable">buffer</b>, <b class="variable">ret</b>, and <b class="variable">return()</b>.</p>
<p>This hook is invoked after collecting a complete reply script from a
remote but <em>before</em> evaluating it.  This allows complete
control over the processing of replies to sent commands.  The reply
<i class="arg">buffer</i> is in one of the following forms</p>
<ul class="itemized">
<li><p>return result</p></li>
<li><p>return -code code result</p></li>
<li><p>return -code code -errorinfo info -errorcode ecode msg</p></li>
</ul>
<p>For safety reasons, this is decomposed.  The return result is in
<i class="arg">ret</i>, and the return switches are in the return array:</p>
<ul class="itemized">
<li><p><em>return(-code)</em></p></li>
<li><p><em>return(-errorinfo)</em></p></li>
<li><p><em>return(-errorcode)</em></p></li>
</ul>
<p>Any of these may be the empty string.  Modifying these four variables
can change the return value, whereas modifying <i class="arg">buffer</i> has no
effect.</p></dd>
<dt><b class="const">callback</b></dt>
<dd><p>Variables:
<b class="variable">chan</b>, <b class="variable">id</b>, <b class="variable">buffer</b>, <b class="variable">ret</b>, and <b class="variable">return()</b>.</p>
<p>Similar to <em>reply</em>, but used for callbacks.</p></dd>
<dt><b class="const">lost</b></dt>
<dd><p>Variables:
<b class="variable">chan</b>, <b class="variable">id</b>, and <b class="variable">reason</b>.</p>
<p>This hook is invoked when the connection to <b class="variable">id</b> is lost.  Return
value (or thrown error) is ignored.  <i class="arg">reason</i> is an explanatory
string indicating why the connection was lost.  Example:</p>
<pre class="example">
    ::comm::comm hook lost {
        global myvar
        if {$myvar(id) == $id} {
            myfunc
            return
        }
    }
</pre>
</dd>
</dl>
</div>
<div id="subsection10" class="subsection"><h3><a name="subsection10">Unsupported</a></h3>
<p>These interfaces may change or go away in subsequence releases.</p>
<dl class="definitions">
<dt><a name="14"><b class="cmd">::comm::comm remoteid</b></a></dt>
<dd><p>Returns the <i class="arg">id</i> of the sender of the last remote command
executed on this channel.  If used by a proc being invoked remotely,
it must be called before any events are processed.  Otherwise, another
command may get invoked and change the value.</p></dd>
<dt><a name="15"><b class="cmd">::comm::comm_send</b></a></dt>
<dd><p>Invoking this procedure will substitute the Tk <b class="cmd"><a href="../../../../index.html#key312">send</a></b> and
<b class="cmd">winfo interps</b> commands with these equivalents that use
<b class="cmd">::comm::comm</b>.</p>
<pre class="example">
    proc send {args} {
        eval ::comm::comm send $args
    }
    rename winfo tk_winfo
    proc winfo {cmd args} {
        if {![string match in* $cmd]} {
            return [eval [list tk_winfo $cmd] $args]
        }
        return [::comm::comm interps]
    }
</pre>
</dd>
</dl>
</div>
<div id="subsection11" class="subsection"><h3><a name="subsection11">Security</a></h3>
<p>Starting with version 4.6 of the package an option <b class="option">-socketcmd</b>
is supported, allowing the user of a comm channel to specify which
command to use when opening a socket. Anything which is API-compatible
with the builtin <b class="cmd">::socket</b> (the default) can be used.</p>
<p>The envisioned main use is the specification of the <b class="cmd">tls::socket</b>
command, see package <b class="package"><a href="../../../../index.html#key289">tls</a></b>, to secure the communication.</p>
<pre class="example">
	# Load and initialize tls
	package require tls
	tls::init  -cafile /path/to/ca/cert -keyfile ...
	# Create secured comm channel
	::comm::comm new SECURE -socketcmd tls::socket -listen 1
	...
</pre>
<p>The sections <span class="sectref"><a href="#subsection6">Execution Environment</a></span> and <span class="sectref"><a href="#subsection9">Callbacks</a></span>
are also relevant to the security of the system, providing means to
restrict the execution to a specific environment, perform additional
authentication, and the like.</p>
</div>
<div id="subsection12" class="subsection"><h3><a name="subsection12">Blocking Semantics</a></h3>
<p>There is one outstanding difference between <b class="package">comm</b> and
<b class="cmd"><a href="../../../../index.html#key312">send</a></b>.  When blocking in a synchronous remote command, <b class="cmd"><a href="../../../../index.html#key312">send</a></b>
uses an internal C hook (Tk_RestrictEvents) to the event loop to look
ahead for send-related events and only process those without
processing any other events.  In contrast, <b class="package">comm</b> uses the
<b class="cmd"><a href="../../../../index.html#key367">vwait</a></b> command as a semaphore to indicate the return message has
arrived.  The difference is that a synchronous <b class="cmd"><a href="../../../../index.html#key312">send</a></b> will block
the application and prevent all events (including window related ones)
from being processed, while a synchronous <b class="cmd">::comm::comm send</b>
will block the application but still allow other events to get
processed.  In particular, <b class="cmd">after idle</b> handlers will fire
immediately when comm blocks.</p>
<p>What can be done about this?  First, note that this behavior will come
from any code using <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b> to block and wait for an event to
occur.  At the cost of multiple channel support, <b class="package">comm</b> could
be changed to do blocking I/O on the socket, giving send-like blocking
semantics.  However, multiple channel support is a very useful feature
of comm that it is deemed too important to lose.  The remaining
approaches involve a new loadable module written in C (which is
somewhat against the philosophy of <b class="cmd">comm</b>) One way would be to
create a modified version of the <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b> command that allow the
event flags passed to Tcl_DoOneEvent to be specified.  For <b class="cmd">comm</b>,
just the TCL_FILE_EVENTS would be processed.  Another way would be to
implement a mechanism like Tk_RestrictEvents, but apply it to the Tcl
event loop (since <b class="package">comm</b> doesn't require Tk).  One of these
approaches will be available in a future <b class="package">comm</b> release as an
optional component.</p>
</div>
<div id="subsection13" class="subsection"><h3><a name="subsection13">Asynchronous Result Generation</a></h3>
<p>By default the result returned by a remotely invoked command is the
result sent back to the invoker. This means that the result is
generated synchronously, and the server handling the call is blocked
for the duration of the command.</p>
<p>While this is tolerable as long as only short-running commands are
invoked on the server long-running commands, like database queries
make this a problem. One command can prevent the processing requests
of all other clients for an arbitrary period of time.</p>
<p>Before version 4.5 of comm the only solution was to rewrite the server
command to use the Tcl builtin command <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>, or one of its
relatives like <b class="cmd">tkwait</b>, to open a new event loop which processes
requests while the long-running operation is executed. This however
has its own perils, as this makes it possible to both overflow the Tcl
stack with a large number of event loop, and to have a newer requests
block the return of older ones, as the eventloop have to be unwound in
the order of their creation.</p>
<p>The proper solution is to have the invoked command indicate to
<b class="package">comm</b> that it cannot or will not deliver an immediate,
synchronous result, but will do so later. At that point the framework
can put sending the actual result on hold and continue processing
requests using the main event loop. No blocking, no nesting of event
loops. At some future date the long running operation delivers the
result to comm, via the future object, which is then forwarded to the
invoker as usual.</p>
<p>The necessary support for this solution has been added to comm since
version 4.5, in the form of the new method <b class="method">return_async</b>.</p>
<dl class="definitions">
<dt><a name="16"><b class="cmd">::comm::comm return_async</b></a></dt>
<dd><p>This command is used by a remotely invoked script to notify the comm
channel which invoked it that the result to send back to the invoker
is not generated synchronously. If this command is not called the
default/standard behaviour of comm is to send the synchronously
generated result of the script itself to the invoker.</p>
<p>The result of <b class="cmd">return_async</b> is an object. This object, called a
<i class="term">future</i> is where the result of the script has to be delivered to
when it becomes ready. When that happens it will take all the
necessary actions to deliver the result to the invoker of the script,
and then destroy itself. Should comm have lost the connection to the
invoker while the result is being computed the future will not try to
deliver the result it got, but just destroy itself. The future can be
configured with a command to call when the invoker is lost. This
enables the user to implement an early abort of the long-running
operation, should this be supported by it.</p>
<p>An example:</p>
<pre class="example">
# Procedure invoked by remote clients to run database operations.
proc select {sql} {
    # Signal the async generation of the result
    set future [::comm::comm return_async]
    # Generate an async db operation and tell it where to deliver the result.
    set query [db query -command [list $future return] $sql]
    # Tell the database system which query to cancel if the connection
    # goes away while it is running.
    $future configure -command [list db cancel $query]
    # Note: The above will work without problem only if the async
    # query will nover run its completion callback immediately, but
    # only from the eventloop. Because otherwise the future we wish to
    # configure may already be gone. If that is possible use 'catch'
    # to prevent the error from propagating.
    return
}
</pre>
<p>The API of a future object is:</p>
<dl class="definitions">
<dt><a name="17"><b class="cmd">$future</b> <b class="method">return</b> <span class="opt">?<b class="option">-code</b> <i class="arg">code</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Use this method to tell the future that long-running operation has
completed. Arguments are an optional return value (defaults to the
empty string), and the Tcl return code (defaults to OK).</p>
<p>The future will deliver this information to invoker, if the connection
was not lost in the meantime, and then destroy itself. If the
connection was lost it will do nothing but destroy itself.</p></dd>
<dt><a name="18"><b class="cmd">$future</b> <b class="method">configure</b> <span class="opt">?<b class="option">-command</b> <span class="opt">?<i class="arg">cmdprefix</i>?</span>?</span></a></dt>
<dd></dd>
<dt><a name="19"><b class="cmd">$future</b> <b class="method">cget</b> <b class="option">-command</b></a></dt>
<dd><p>These methods allow the user to retrieve and set a command to be
called if the connection the future belongs to has been lost.</p></dd>
</dl></dd>
</dl>
</div>
<div id="subsection14" class="subsection"><h3><a name="subsection14">Compatibility</a></h3>
<p><b class="package">comm</b> exports itself as a package.  The package version number
is in the form <em>major . minor</em>, where the major version will
only change when a non-compatible change happens to the API or
protocol.  Minor bug fixes and changes will only affect the minor
version.  To load <b class="package">comm</b> this command is usually used:</p>
<pre class="example">
    package require comm 3
</pre>
<p>Note that requiring no version (or a specific version) can also be done.</p>
<p>The revision history of <b class="package">comm</b> includes these releases:</p>
<dl class="definitions">
<dt>4.6.2</dt>
<dd><p>Fixed bugs 2972571 and 3066872, the first a misdetection of quoted
brace after double backslash, the other a blocking gets making for an
obvious (hinsight) DoS attack on comm channels.</p></dd>
<dt>4.6.1</dt>
<dd><p>Changed the implementation of <b class="cmd">comm::commCollect</b> to emulate
lindex's pre-Tcl 8 behaviour, i.e. it was given the ability to parse
out the first word of a list, even if the whole buffer is not a
well-formed list. Without this change the first word could only be
extracted if the whole buffer was a well-formed list (ever since Tcl
8), and in a ver-high-load situation, i.e. a server sending lots
and/or large commands very fast, this may never happen, eventually
crashing the receiver when it runs out of memory. With the change the
receiver is always able to process the first word when it becomes
well-formed, regardless of the structure of the remainder of the
buffer.</p></dd>
<dt>4.6</dt>
<dd><p>Added the option <b class="option">-socketcmd</b> enabling users to override how a
socket is opened. The envisioned main use is the specification of the
<b class="cmd">tls::socket</b> command, see package <b class="package"><a href="../../../../index.html#key289">tls</a></b>, to secure the
communication.</p></dd>
<dt>4.5.7</dt>
<dd><p>Changed handling of ports already in use to provide a proper error
message.</p></dd>
<dt>4.5.6</dt>
<dd><p>Bugfix in the replacement for <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>, made robust against of
variable names containing spaces.</p></dd>
<dt>4.5.5</dt>
<dd><p>Bugfix in the handling of hooks, typo in variable name.</p></dd>
<dt>4.5.4</dt>
<dd><p>Bugfix in the handling of the result received by the <b class="method">send</b>
method. Replaced an <em>after idle unset result</em> with an immediate
<b class="cmd">unset</b>, with the information saved to a local variable.</p>
<p>The <b class="cmd">after idle</b> can spill into a forked child process if there
is no event loop between its setup and the fork. This may bork the
child if the next event loop is the <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b> of <b class="package">comm</b>'s
<b class="method">send</b> a few lines above the <b class="cmd">after idle</b>, and the child
used the same serial number for its next request. In that case the
parent's <b class="cmd">after idle unset</b> will delete the very array element
the child is waiting for, unlocking the <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>, causing it to
access a now missing array element, instead of the expected result.</p></dd>
<dt>4.5.3</dt>
<dd><p>Bugfixes in the wrappers for the builtin <b class="cmd"><a href="../../../../index.html#key368">update</a></b> and <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>
commands.</p></dd>
<dt>4.5.2</dt>
<dd><p>Bugfix in the wrapper for the builtin <b class="cmd"><a href="../../../../index.html#key368">update</a></b> command.</p></dd>
<dt>4.5.1</dt>
<dd><p>Bugfixes in the handling of -interp for regular scripts. The handling
of the buffer was wrong for scripts which are a single statement as
list. Fixed missing argument to new command <b class="cmd">commSendReply</b>,
introduced by version 4.5. Affected debugging.</p></dd>
<dt>4.5</dt>
<dd><p>New server-side feature. The command invoked on the server can now
switch comm from the standard synchronous return of its result to an
asynchronous (defered) return. Due to the use of snit to implement the
<i class="term">future</i> objects used by this feature from this version on comm
requires at least Tcl 8.3 to run. Please read the section
<span class="sectref"><a href="#subsection13">Asynchronous Result Generation</a></span> for more details.</p></dd>
<dt>4.4.1</dt>
<dd><p>Bugfix in the execution of hooks.</p></dd>
<dt>4.4</dt>
<dd><p>Bugfixes in the handling of -interp for regular and hook
scripts. Bugfixes in channel cleanup.</p></dd>
<dt>4.3.1</dt>
<dd><p>Introduced -interp and -events to enable easy use of a slave interp
for execution of received scripts, and of event scripts.</p></dd>
<dt>4.3</dt>
<dd><p>Bugfixes, and introduces -silent to allow the user to force the
server/listening side to silently ignore connection attempts where the
protocol negotiation failed.</p></dd>
<dt>4.2</dt>
<dd><p>Bugfixes, and most important, switched to utf-8 as default encoding
for full i18n without any problems.</p></dd>
<dt>4.1</dt>
<dd><p>Rewrite of internal code to remove old pseudo-object model.  Addition
of send -command asynchronous callback option.</p></dd>
<dt>4.0</dt>
<dd><p>Per request by John LoVerso. Improved handling of error for async
invoked commands.</p></dd>
<dt>3.7</dt>
<dd><p>Moved into tcllib and placed in a proper namespace.</p></dd>
<dt>3.6</dt>
<dd><p>A bug in the looking up of the remoteid for a executed command could
be triggered when the connection was closed while several asynchronous
sends were queued to be executed.</p></dd>
<dt>3.5</dt>
<dd><p>Internal change to how reply messages from a <b class="cmd"><a href="../../../../index.html#key312">send</a></b> are handled.
Reply messages are now decoded into the <i class="arg">value</i> to pass to
<b class="cmd">return</b>; a new return statement is then cons'd up to with this
value.  Previously, the return code was passed in from the remote as a
command to evaluate.  Since the wire protocol has not changed, this is
still the case.  Instead, the reply handling code decodes the
<b class="const">reply</b> message.</p></dd>
<dt>3.4</dt>
<dd><p>Added more source commentary, as well as documenting config variables
in this man page.  Fixed bug were loss of connection would give error
about a variable named <b class="variable">pending</b> rather than the message about
the lost connection.  <b class="cmd">comm ids</b> is now an alias for
<b class="cmd">comm interps</b> (previously, it an alias for <b class="cmd">comm chans</b>).
Since the method invocation change of 3.0, break and other exceptional
conditions were not being returned correctly from <b class="cmd">comm send</b>.
This has been fixed by removing the extra level of indirection into
the internal procedure <b class="cmd">commSend</b>.  Also added propagation of
the <i class="arg">errorCode</i> variable.  This means that these commands return
exactly as they would with <b class="cmd"><a href="../../../../index.html#key312">send</a></b>:</p>
<pre class="example">
    comm send id break
    catch {comm send id break}
    comm send id expr 1 / 0
</pre>
<p>Added a new hook for reply messages.  Reworked method invocation to
avoid the use of comm:* procedures; this also cut the invocation time
down by 40%.  Documented <b class="cmd">comm config</b> (as this manual page
still listed the defunct <b class="cmd">comm init</b>!)</p></dd>
<dt>3.3</dt>
<dd><p>Some minor bugs were corrected and the documentation was cleaned up.
Added some examples for hooks.  The return semantics of the <b class="cmd">eval</b>
hook were changed.</p></dd>
<dt>3.2</dt>
<dd><p>A new wire protocol, version 3, was added.  This is backwards
compatible with version 2 but adds an exchange of supported protocol
versions to allow protocol negotiation in the future.  Several bugs
with the hook implementation were fixed.  A new section of the man
page on blocking semantics was added.</p></dd>
<dt>3.1</dt>
<dd><p>All the documented hooks were implemented.  <b class="cmd">commLostHook</b> was
removed.  A bug in <b class="cmd">comm new</b> was fixed.</p></dd>
<dt>3.0</dt>
<dd><p>This is a new version of <b class="package">comm</b> with several major changes.
There is a new way of creating the methods available under the
<b class="cmd">comm</b> command.  The <b class="cmd">comm init</b> method has been retired
and is replaced by <b class="cmd">comm configure</b> which allows access to many
of the well-defined internal variables.  This also generalizes the
options available to <b class="cmd">comm new</b>.  Finally, there is now a
protocol version exchanged when a connection is established.  This
will allow for future on-wire protocol changes.  Currently, the
protocol version is set to 2.</p></dd>
<dt>2.3</dt>
<dd><p><b class="cmd">comm ids</b> was renamed to <b class="cmd">comm channels</b>.  General
support for <b class="cmd">comm hook</b> was fully implemented, but only the
<i class="term">lost</i> hook exists, and it was changed to follow the general
hook API.  <b class="cmd">commLostHook</b> was unsupported (replaced by
<b class="cmd">comm hook lost</b>) and <b class="cmd">commLost</b> was removed.</p></dd>
<dt>2.2</dt>
<dd><p>The <i class="term">died</i> hook was renamed <i class="term">lost</i>, to be accessed by
<b class="cmd">commLostHook</b> and an early implementation of
<b class="cmd">comm lost hook</b>.  As such, <b class="cmd">commDied</b> is now
<b class="cmd">commLost</b>.</p></dd>
<dt>2.1</dt>
<dd><p>Unsupported method <b class="cmd">comm remoteid</b> was added.</p></dd>
<dt>2.0</dt>
<dd><p><b class="package">comm</b> has been rewritten from scratch (but is fully compatible
with Comm 1.0, without the requirement to use obTcl).</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">Author</a></h2>
<p>John LoVerso, [email protected]</p>
<p><em>http://www.opengroup.org/~loverso/tcl-tk/#comm</em></p>
</div>
<div id="section3" class="section"><h2><a name="section3">License</a></h2>
<p>Please see the file <em>comm.LICENSE</em> that accompanied this source,
or
<a href="http://www.opengroup.org/www/dist_client/caubweb/COPYRIGHT.free.html">http://www.opengroup.org/www/dist_client/caubweb/COPYRIGHT.free.html</a>.</p>
<p>This license for <b class="package">comm</b>, new as of version 3.2, allows it to be
used for free, without any licensing fee or royalty.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs</a></h2>
<ul class="itemized">
<li><p>If there is a failure initializing a channel created with
<b class="cmd">::comm::comm new</b>, then the channel should be destroyed.
Currently, it is left in an inconsistent state.</p></li>
<li><p>There should be a way to force a channel to quiesce when changing the
configuration.</p></li>
</ul>
<p>The following items can be implemented with the existing hooks and are
listed here as a reminder to provide a sample hook in a future
version.</p>
<ul class="itemized">
<li><p>Allow easier use of a slave interp for actual command execution
(especially when operating in &quot;not local&quot; mode).</p></li>
<li><p>Add host list (xhost-like) or &quot;magic cookie&quot; (xauth-like)
authentication to initial handshake.</p></li>
</ul>
<p>The following are outstanding todo items.</p>
<ul class="itemized">
<li><p>Add an interp discovery and name-&gt;port mapping.  This is likely to be
in a separate, optional nameserver.  (See also the related work,
below.)</p></li>
<li><p>Fix the <em>{id host}</em> form so as not to be dependent upon
canonical hostnames.  This requires fixes to Tcl to resolve hostnames!</p></li>
</ul>
<p>This man page is bigger than the source file.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">On Using Old Versions Of Tcl</a></h2>
<p>Tcl7.5 under Windows contains a bug that causes the interpreter to
hang when EOF is reached on non-blocking sockets.  This can be
triggered with a command such as this:</p>
<pre class="example">
    &quot;comm send $other exit&quot;
</pre>
<p>Always make sure the channel is quiescent before closing/exiting or
use at least Tcl7.6 under Windows.</p>
<p>Tcl7.6 on the Mac contains several bugs.  It is recommended you use
at least Tcl7.6p2.</p>
<p>Tcl8.0 on UNIX contains a socket bug that can crash Tcl.  It is recommended
you use Tcl8.0p1 (or Tcl7.6p2).</p>
</div>
<div id="section6" class="section"><h2><a name="section6">Related Work</a></h2>
<p>Tcl-DP provides an RPC-based remote execution interface, but is a
compiled Tcl extension.  See
<a href="http://www.cs.cornell.edu/Info/Projects/zeno/Projects/Tcl-DP.html">http://www.cs.cornell.edu/Info/Projects/zeno/Projects/Tcl-DP.html</a>.</p>
<p>Michael Doyle &lt;[email protected]&gt; has code that implements the Tcl-DP
RPC interface using standard Tcl sockets, much like <b class="package">comm</b>.</p>
<p>Andreas Kupries &lt;[email protected]&gt; uses
<b class="package">comm</b> and has built a simple nameserver as part of his Pool
library.  See <a href="http://www.purl.org/net/akupries/soft/pool/index.htm">http://www.purl.org/net/akupries/soft/pool/index.htm</a>.</p>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>comm</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>send(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key38">comm</a>, <a href="../../../../index.html#key314">communication</a>, <a href="../../../../index.html#key319">ipc</a>, <a href="../../../../index.html#key320">message</a>, <a href="../../../../index.html#key317">remote communication</a>, <a href="../../../../index.html#key316">remote execution</a>, <a href="../../../../index.html#key313">rpc</a>, <a href="../../../../index.html#key315">secure</a>, <a href="../../../../index.html#key312">send</a>, <a href="../../../../index.html#key311">socket</a>, <a href="../../../../index.html#key318">ssl</a>, <a href="../../../../index.html#key289">tls</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 1995-1998 The Open Group. All Rights Reserved.<br>
Copyright &copy; 2003-2004 ActiveState Corporation.<br>
Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/comm/comm_wire.html.

























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>comm_wire - Remote communication</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/comm/comm_wire.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Docs. Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ comm_wire.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">comm_wire(n) 3 tcllib &quot;Remote communication&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>comm_wire - The comm wire protocol</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Wire Protocol Version 3</a>
<ul>
<li class="subsection"><a href="#subsection1">Basic Layer</a></li>
<li class="subsection"><a href="#subsection2">Basic Message Layer</a></li>
<li class="subsection"><a href="#subsection3">Negotiation Messages - Initial Handshake</a></li>
<li class="subsection"><a href="#subsection4">Script/Command Messages</a></li>
</ul>
</li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">comm</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package"><a href="comm.html">comm</a></b> command provides an inter-interpreter remote
execution facility much like Tk's <b class="cmd">send(n)</b>, except that it uses
sockets rather than the X server for the communication path.  As a
result, <b class="package"><a href="comm.html">comm</a></b> works with multiple interpreters, works on
Windows and Macintosh systems, and provides control over the remote
execution path.</p>
<p>This document contains a specification of the various versions of the
wire protocol used by comm internally for the communication between
its endpoints. It has no relevance to users of <b class="package"><a href="comm.html">comm</a></b>, only to
developers who wish to modify the package, write a compatible facility
in a different language, or some other facility based on the same
protocol.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Wire Protocol Version 3</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Basic Layer</a></h3>
<p>The basic encoding for <em>all</em> data is UTF-8. Because of this
binary data, including the NULL character, can be sent over the wire
as is, without the need for armoring it.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Basic Message Layer</a></h3>
<p>On top of the <span class="sectref"><a href="#subsection1">Basic Layer</a></span> we have a
<i class="term">message oriented</i> exchange of data. 
The totality of all characters written to the channel is a Tcl list,
with each element a separate <i class="term"><a href="../../../../index.html#key320">message</a></i>, each itself a list. The
messages in the overall list are separated by EOL. Note that EOL
characters can occur within the list as well. They can be
distinguished from the message-separating EOL by the fact that the
data from the beginning up to their location is not a valid Tcl list.</p>
<p>EOL is signaled through the linefeed character, i.e <b class="const">LF</b>, or,
hex <b class="const">0x0a</b>. This is following the unix convention for
line-endings.</p>
<p>As a list each message is composed of <i class="term">words</i>. Their meaning
depends on when the message was sent in the overall exchange. This is
described in the upcoming sections.</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Negotiation Messages - Initial Handshake</a></h3>
<p>The command protocol is defined like this:</p>
<ul class="itemized">
<li><p>The first message send by a client to a server, when opening the
connection, contains two words. The first word is a list as well, and
contains the versions of the wire protocol the client is willing to
accept, with the most preferred version first. The second word is the
TCP port the client is listening on for connections to itself. The
value <b class="const">0</b> is used here to signal that the client will not listen
for connections, i.e. that it is purely for sending commands, and not
receiving them.</p></li>
<li><p>The first message sent by the server to the client, in response to the
message above contains only one word. This word is a list, containing
the string <b class="const">vers</b> as its first element, and the version of the
wire protocol the server has selected from the offered versions as the
second.</p></li>
</ul>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Script/Command Messages</a></h3>
<p>All messages coming after the <span class="sectref"><a href="#subsection3">initial handshake</a></span>
consist of three words. These are an instruction, a transaction id,
and the payload. The valid instructions are shown below. The
transaction ids are used by the client to match any incoming replies
to the command messages it sent. This means that a server has to copy
the transaction id from a command message to the reply it sends for
that message.</p>
<dl class="definitions">
<dt><b class="const">send</b></dt>
<dd></dd>
<dt><b class="const">async</b></dt>
<dd></dd>
<dt><b class="const">command</b></dt>
<dd><p>The payload is the Tcl script to execute on the server. It is actually
a list containing the script fragments. These fragment are
<b class="cmd">concat</b>enated together by the server to form the full script to
execute on the server side.
This emulates the Tcl &quot;eval&quot; semantics.
In most cases it is best to have only one word in the list, a list
containing the exact command.</p>
<p>Examples:</p>
<pre class="example">
    (a)     {send 1 {{array get tcl_platform}}}
    (b)     {send 1 {array get tcl_platform}}
    (c)     {send 1 {array {get tcl_platform}}}
    are all valid representations of the same command. They are
    generated via
    (a')    send {array get tcl_platform}
    (b')    send array get tcl_platform
    (c')    send array {get tcl_platform}
    respectively
</pre>
<p>Note that (a), generated by (a'), is the usual form, if only single
commands are sent by the client.
For example constructed using <b class="cmd"><a href="../../../../index.html#key252">list</a></b>, if the command contains
variable arguments. Like</p>
<pre class="example">
    send [list array get $the_variable]
</pre>
<p>These three instructions all invoke the script on the server
side. Their difference is in the treatment of result values, and thus
determines if a reply is expected.</p>
<dl class="definitions">
<dt><b class="const">send</b></dt>
<dd><p>A reply is expected. The sender is waiting for the result.</p></dd>
<dt><b class="const">async</b></dt>
<dd><p>No reply is expected, the sender has no interest in the result and is
not waiting for any.</p></dd>
<dt><b class="const">command</b></dt>
<dd><p>A reply is expected, but the sender is not waiting for it. It has
arranged to get a process-internal notification when the result
arrives.</p></dd>
</dl></dd>
<dt><b class="const">reply</b></dt>
<dd><p>Like the previous three command, however the tcl script in the payload
is highly restricted.
It has to be a syntactically valid Tcl <b class="cmd">return</b> command. This
contains result code, value, error code, and error info.</p>
<p>Examples:</p>
<pre class="example">
    {reply 1 {return -code 0 {}}}
    {reply 1 {return -code 0 {osVersion 2.4.21-99-default byteOrder littleEndian machine i686 platform unix os Linux user andreask wordSize 4}}}
</pre>
</dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>comm</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="comm.html">comm</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key38">comm</a>, <a href="../../../../index.html#key314">communication</a>, <a href="../../../../index.html#key319">ipc</a>, <a href="../../../../index.html#key320">message</a>, <a href="../../../../index.html#key317">remote communication</a>, <a href="../../../../index.html#key316">remote execution</a>, <a href="../../../../index.html#key313">rpc</a>, <a href="../../../../index.html#key311">socket</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Docs. Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/control/control.html.

































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>control - Tcl Control Flow Commands</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/control/control.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ control.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">control(n) 0.1.3 tcllib &quot;Tcl Control Flow Commands&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>control - Procedures for control flow structures.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">LIMITATIONS</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">control <span class="opt">?0.1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">control::control</b> <i class="arg">command</i> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><b class="cmd">control::assert</b> <i class="arg">expr</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><b class="cmd">control::do</b> <i class="arg">body</i> <span class="opt">?<i class="arg">option test</i>?</span></a></li>
<li><a href="#4"><b class="cmd">control::no-op</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">control</b> package provides a variety of commands that provide
additional flow of control structures beyond the built-in ones
provided by Tcl.  These are commands that in many programming
languages might be considered <em>keywords</em>, or a part of the
language itself.  In Tcl, control flow structures are just commands
like everything else.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">control::control</b> <i class="arg">command</i> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The <b class="cmd">control</b> command is used as a configuration command for
customizing the other public commands of the control package.  The
<i class="arg">command</i> argument names the command to be customized.  The set of
valid <i class="arg">option</i> and subsequent arguments are determined by the
command being customized, and are documented with the command.</p></dd>
<dt><a name="2"><b class="cmd">control::assert</b> <i class="arg">expr</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>When disabled, the <b class="cmd"><a href="../../../../index.html#key132">assert</a></b> command behaves exactly like the
<b class="cmd"><a href="../../../../index.html#key130">no-op</a></b> command.</p>
<p>When enabled, the <b class="cmd"><a href="../../../../index.html#key132">assert</a></b> command evaluates <i class="arg">expr</i> as an
expression (in the same way that <b class="cmd">expr</b> evaluates its argument).
If evaluation reveals that <i class="arg">expr</i> is not a valid boolean
expression (according to [<b class="cmd">string is boolean -strict</b>]),
an error is raised.  If <i class="arg">expr</i> evaluates to a true boolean value
(as recognized by <b class="cmd">if</b>), then <b class="cmd"><a href="../../../../index.html#key132">assert</a></b> returns an empty
string.  Otherwise, the remaining arguments to <b class="cmd"><a href="../../../../index.html#key132">assert</a></b> are used
to construct a message string.  If there are no arguments, the message
string is &quot;assertion failed: $expr&quot;.  If there are arguments, they are
joined by <b class="cmd"><a href="../../../../index.html#key510">join</a></b> to form the message string.  The message string
is then appended as an argument to a callback command, and the
completed callback command is evaluated in the global namespace.</p>
<p>The <b class="cmd"><a href="../../../../index.html#key132">assert</a></b> command can be customized by the <b class="cmd">control</b>
command in two ways:</p>
<p>[<b class="cmd">control::control assert enabled</b> <span class="opt">?<i class="arg">boolean</i>?</span>]
queries or sets whether <b class="cmd">control::assert</b> is enabled.  When called
without a <i class="arg">boolean</i> argument, a boolean value is returned
indicating whether the <b class="cmd">control::assert</b> command is enabled.  When
called with a valid boolean value as the <i class="arg">boolean</i> argument, the
<b class="cmd">control::assert</b> command is enabled or disabled to match the
argument, and an empty string is returned.</p>
<p>[<b class="cmd">control::control assert callback</b> <span class="opt">?<i class="arg">command</i>?</span>]
queries or sets the callback command that will be called by an enabled
<b class="cmd"><a href="../../../../index.html#key132">assert</a></b> on assertion failure.  When called without a
<i class="arg">command</i> argument, the current callback command is returned.
When called with a <i class="arg">command</i> argument, that argument becomes the
new assertion failure callback command.  Note that an assertion
failure callback command is always defined, even when <b class="cmd"><a href="../../../../index.html#key132">assert</a></b>
is disabled.  The default callback command is
[<b class="cmd">return -code error</b>].</p>
<p>Note that <b class="cmd">control::assert</b> has been written so that in
combination with [<b class="cmd">namespace import</b>], it is possible to
use enabled <b class="cmd"><a href="../../../../index.html#key132">assert</a></b> commands in some namespaces and disabled
<b class="cmd"><a href="../../../../index.html#key132">assert</a></b> commands in other namespaces at the same time.  This
capability is useful so that debugging efforts can be independently
controlled module by module.</p>
<pre class="example">
% package require control
% control::control assert enabled 1
% namespace eval one namespace import ::control::assert
% control::control assert enabled 0
% namespace eval two namespace import ::control::assert
% one::assert {1 == 0}
assertion failed: 1 == 0
% two::assert {1 == 0}
</pre>
</dd>
<dt><a name="3"><b class="cmd">control::do</b> <i class="arg">body</i> <span class="opt">?<i class="arg">option test</i>?</span></a></dt>
<dd><p>The <b class="cmd"><a href="../../../../index.html#key133">do</a></b> command evaluates the script <i class="arg">body</i> repeatedly
<em>until</em> the expression <i class="arg">test</i> becomes true or as long as
(<em>while</em>) <i class="arg">test</i> is true, depending on the value of
<i class="arg">option</i> being <b class="const">until</b> or <b class="const">while</b>. If
<i class="arg">option</i> and <i class="arg">test</i> are omitted the body is evaluated exactly
once. After normal completion, <b class="cmd"><a href="../../../../index.html#key133">do</a></b> returns an empty string.
Exceptional return codes (<b class="cmd">break</b>, <b class="cmd">continue</b>, <b class="cmd"><a href="../../../../index.html#key154">error</a></b>,
etc.) during the evaluation of <i class="arg">body</i> are handled in the same way
the <b class="cmd">while</b> command handles them, except as noted in
<span class="sectref"><a href="#section3">LIMITATIONS</a></span>, below.</p></dd>
<dt><a name="4"><b class="cmd">control::no-op</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The <b class="cmd"><a href="../../../../index.html#key130">no-op</a></b> command takes any number of arguments and does
nothing.  It returns an empty string.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">LIMITATIONS</a></h2>
<p>Several of the commands provided by the <b class="cmd">control</b> package accept
arguments that are scripts to be evaluated.  Due to fundamental
limitations of Tcl's <b class="cmd">catch</b> and <b class="cmd">return</b> commands, it is not
possible for these commands to properly evaluate the command
[<b class="cmd">return -code $code</b>] within one of those script
arguments for any value of <i class="arg">$code</i> other than <i class="arg">ok</i>.  In this
way, the commands of the <b class="cmd">control</b> package are limited as compared
to Tcl's built-in control flow commands (such as <b class="cmd">if</b>,
<b class="cmd">while</b>, etc.) and those control flow commands that can be
provided by packages coded in C.  An example of this difference:</p>
<pre class="example">
% package require control
% proc a {} {while 1 {return -code error a}}
% proc b {} {control::do {return -code error b} while 1}
% catch a
1
% catch b
0
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>control</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>break, continue, expr, if, <a href="../../../../index.html#key510">join</a>, namespace, return, <a href="../../../../index.html#key239">string</a>, while</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key132">assert</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key133">do</a>, <a href="../../../../index.html#key129">flow</a>, <a href="../../../../index.html#key130">no-op</a>, <a href="../../../../index.html#key131">structure</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/coroutine/coro_auto.html.















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>coroutine::auto - Coroutine utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/coroutine/coro_auto.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2010-2011 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ coroutine::auto.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">coroutine::auto(n) 1 tcllib &quot;Coroutine utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>coroutine::auto - Automatic event and IO coroutine awareness</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">coroutine::auto 1.1</b></li>
<li>package require <b class="pkgname">coroutine 1.1</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">coroutine::auto</b> package provides no commands or other
directly visible functionality.
Built on top of the package <b class="package"><a href="coroutine.html">coroutine</a></b>, it intercepts various
builtin commands of the Tcl core to make any code using them
coroutine-oblivious, i.e. able to run inside and outside of a
coroutine without changes.</p>
<p>The commands so affected by this package are</p>
<dl class="definitions">
<dt><b class="cmd"><a href="../../../../index.html#key366">after</a></b></dt>
<dd></dd>
<dt><b class="cmd"><a href="../../../../index.html#key365">exit</a></b></dt>
<dd></dd>
<dt><b class="cmd"><a href="../../../../index.html#key369">gets</a></b></dt>
<dd></dd>
<dt><b class="cmd"><a href="../../../../index.html#key364">global</a></b></dt>
<dd></dd>
<dt><b class="cmd"><a href="../../../../index.html#key362">read</a></b></dt>
<dd></dd>
<dt><b class="cmd"><a href="../../../../index.html#key368">update</a></b></dt>
<dd></dd>
<dt><b class="cmd"><a href="../../../../index.html#key367">vwait</a></b></dt>
<dd></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>coroutine</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key366">after</a>, <a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key200">coroutine</a>, <a href="../../../../index.html#key363">events</a>, <a href="../../../../index.html#key365">exit</a>, <a href="../../../../index.html#key369">gets</a>, <a href="../../../../index.html#key364">global</a>, <a href="../../../../index.html#key370">green threads</a>, <a href="../../../../index.html#key362">read</a>, <a href="../../../../index.html#key361">threads</a>, <a href="../../../../index.html#key368">update</a>, <a href="../../../../index.html#key367">vwait</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Coroutine</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2010-2011 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/coroutine/coroutine.html.




























































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>coroutine - Coroutine utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/coroutine/coroutine.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2010-2011 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ coroutine.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">coroutine(n) 1 tcllib &quot;Coroutine utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>coroutine - Coroutine based event and IO handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">coroutine 1.1</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">coroutine::util after</b> <i class="arg">delay</i></a></li>
<li><a href="#2"><b class="cmd">coroutine::util await</b> <i class="arg">varname</i>...</a></li>
<li><a href="#3"><b class="cmd">coroutine::util create</b> <i class="arg">arg</i>...</a></li>
<li><a href="#4"><b class="cmd">coroutine::util exit</b> <span class="opt">?<i class="arg">status</i>?</span></a></li>
<li><a href="#5"><b class="cmd">coroutine::util gets</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">varname</i>?</span></a></li>
<li><a href="#6"><b class="cmd">coroutine::util global</b> <i class="arg">varname</i>...</a></li>
<li><a href="#7"><b class="cmd">coroutine::util read</b> <b class="option">-nonewline</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#8"><b class="cmd">coroutine::util update</b> <span class="opt">?<b class="const">idletasks</b>?</span></a></li>
<li><a href="#9"><b class="cmd">coroutine::util vwait</b> <i class="arg">varname</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">coroutine</b> package provides coroutine-aware
implementations of various event- and channel related commands. It can
be in multiple modes:</p>
<ol class="enumerated">
<li><p>Call the commands through their ensemble, in code which is
explicitly written for use within coroutines.</p></li>
<li><p>Import the commands into a namespace, either directly, or
through <b class="cmd">namespace path</b>. This allows the use from within code
which is not coroutine-aware per se and restricted to specific
namespaces.</p></li>
</ol>
<p>A more agressive form of making code coroutine-oblivious than point 2
above is available through the package <b class="package"><a href="coro_auto.html">coroutine::auto</a></b>,
which intercepts the relevant builtin commands and changes their
implementation dependending on the context they are run in, i.e.
inside or outside of a coroutine.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>All the commands listed below are synchronous with respect to the
coroutine invoking them, i.e. this coroutine blocks until the result
is available. The overall eventloop is not blocked however.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">coroutine::util after</b> <i class="arg">delay</i></a></dt>
<dd><p>This command delays the coroutine invoking it by <i class="arg">delay</i>
milliseconds.</p></dd>
<dt><a name="2"><b class="cmd">coroutine::util await</b> <i class="arg">varname</i>...</a></dt>
<dd><p>This command is an extension form of the <b class="cmd">coroutine::util vwait</b>
command (see below) which waits on a write to one of many named
namespace variables.</p></dd>
<dt><a name="3"><b class="cmd">coroutine::util create</b> <i class="arg">arg</i>...</a></dt>
<dd><p>This command creates a new coroutine with an automatically assigned
name and causes it to run the code specified by the arguments.</p></dd>
<dt><a name="4"><b class="cmd">coroutine::util exit</b> <span class="opt">?<i class="arg">status</i>?</span></a></dt>
<dd><p>This command exits the current coroutine, causing it to return
<i class="arg">status</i>. If no status was specified the default <i class="arg">0</i> is
returned.</p></dd>
<dt><a name="5"><b class="cmd">coroutine::util gets</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">varname</i>?</span></a></dt>
<dd><p>This command reads a line from the channel <i class="arg">chan</i> and returns it
either as its result, or, if a <i class="arg">varname</i> was specified, writes it
to the named variable and returns the number of characters read.</p></dd>
<dt><a name="6"><b class="cmd">coroutine::util global</b> <i class="arg">varname</i>...</a></dt>
<dd><p>This command imports the named global variables of the coroutine into
the current scope. From the technical point of view these variables
reside in level <b class="const">#1</b> of the Tcl stack. I.e. these are not the
regular global variable in to the global namespace, and each coroutine
can have their own set, independent of all others.</p></dd>
<dt><a name="7"><b class="cmd">coroutine::util read</b> <b class="option">-nonewline</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>This command reads <i class="arg">n</i> characters from the channel <i class="arg">chan</i> and
returns them as its result. If <i class="arg">n</i> is not specified the command
will read the channel until EOF is reached.</p></dd>
<dt><a name="8"><b class="cmd">coroutine::util update</b> <span class="opt">?<b class="const">idletasks</b>?</span></a></dt>
<dd><p>This command causes the coroutine invoking it to run pending events or
idle handlers before proceeding.</p></dd>
<dt><a name="9"><b class="cmd">coroutine::util vwait</b> <i class="arg">varname</i></a></dt>
<dd><p>This command causes the coroutine calling it to wait for a write to
the named namespace variable <i class="arg">varname</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>coroutine</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key366">after</a>, <a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key200">coroutine</a>, <a href="../../../../index.html#key363">events</a>, <a href="../../../../index.html#key365">exit</a>, <a href="../../../../index.html#key369">gets</a>, <a href="../../../../index.html#key364">global</a>, <a href="../../../../index.html#key370">green threads</a>, <a href="../../../../index.html#key362">read</a>, <a href="../../../../index.html#key361">threads</a>, <a href="../../../../index.html#key368">update</a>, <a href="../../../../index.html#key367">vwait</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Coroutine</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2010-2011 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/counter/counter.html.










































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>counter - Counters and Histograms</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/counter/counter.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ counter.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">counter(n) 2.0.4 tcllib &quot;Counters and Histograms&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>counter - Procedures for counters and histograms</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8</b></li>
<li>package require <b class="pkgname">counter <span class="opt">?2.0.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::counter::init</b> <i class="arg">tag args</i></a></li>
<li><a href="#2"><b class="cmd">::counter::count</b> <i class="arg">tag</i> <span class="opt">?<i class="arg">delta</i>?</span> <span class="opt">?<i class="arg">instance</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::counter::start</b> <i class="arg">tag instance</i></a></li>
<li><a href="#4"><b class="cmd">::counter::stop</b> <i class="arg">tag instance</i></a></li>
<li><a href="#5"><b class="cmd">::counter::get</b> <i class="arg">tag args</i></a></li>
<li><a href="#6"><b class="cmd">::counter::exists</b> <i class="arg">tag</i></a></li>
<li><a href="#7"><b class="cmd">::counter::names</b></a></li>
<li><a href="#8"><b class="cmd">::counter::histHtmlDisplay</b> <i class="arg">tag args</i></a></li>
<li><a href="#9"><b class="cmd">::counter::reset</b> <i class="arg">tag args</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">counter</b> package provides a counter facility and can
compute statistics and histograms over the collected data.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::counter::init</b> <i class="arg">tag args</i></a></dt>
<dd><p>This defines a counter with the name <i class="arg">tag</i>.  The <i class="arg">args</i>
determines the characteristics of the counter.  The <i class="arg">args</i> are</p>
<dl class="definitions">
<dt><b class="option">-group</b> <i class="arg">name</i></dt>
<dd><p>Keep a grouped counter where the name of the histogram bucket is
passed into <b class="cmd">::counter::count</b>.</p></dd>
<dt><b class="option">-hist</b> <i class="arg">bucketsize</i></dt>
<dd><p>Accumulate the counter into histogram buckets of size
<i class="arg">bucketsize</i>.  For example, if the samples are millisecond time
values and <i class="arg">bucketsize</i> is 10, then each histogram bucket
represents time values of 0 to 10 msec, 10 to 20 msec, 20 to 30 msec,
and so on.</p></dd>
<dt><b class="option">-hist2x</b> <i class="arg">bucketsize</i></dt>
<dd><p>Accumulate the statistic into histogram buckets.  The size of the
first bucket is <i class="arg">bucketsize</i>, each other bucket holds values 2
times the size of the previous bucket.  For example, if
<i class="arg">bucketsize</i> is 10, then each histogram bucket represents time
values of 0 to 10 msec, 10 to 20 msec, 20 to 40 msec, 40 to 80 msec,
and so on.</p></dd>
<dt><b class="option">-hist10x</b> <i class="arg">bucketsize</i></dt>
<dd><p>Accumulate the statistic into histogram buckets.  The size of the
first bucket is <i class="arg">bucketsize</i>, each other bucket holds values 10
times the size of the previous bucket.  For example, if
<i class="arg">bucketsize</i> is 10, then each histogram bucket represents time
values of 0 to 10 msec, 10 to 100 msec, 100 to 1000 msec, and so on.</p></dd>
<dt><b class="option">-lastn</b> <i class="arg">N</i></dt>
<dd><p>Save the last <i class="arg">N</i> values of the counter to maintain a &quot;running
average&quot; over the last <i class="arg">N</i> values.</p></dd>
<dt><b class="option">-timehist</b> <i class="arg">secsPerMinute</i></dt>
<dd><p>Keep a time-based histogram.  The counter is summed into a histogram
bucket based on the current time.  There are 60 per-minute buckets
that have a size determined by <i class="arg">secsPerMinute</i>, which is normally
60, but for testing purposes can be less.  Every &quot;hour&quot; (i.e., 60
&quot;minutes&quot;) the contents of the per-minute buckets are summed into the
next hourly bucket.  Every 24 &quot;hours&quot; the contents of the per-hour
buckets are summed into the next daily bucket.  The counter package
keeps all time-based histograms in sync, so the first
<i class="arg">secsPerMinute</i> value seen by the package is used for all
subsequent time-based histograms.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::counter::count</b> <i class="arg">tag</i> <span class="opt">?<i class="arg">delta</i>?</span> <span class="opt">?<i class="arg">instance</i>?</span></a></dt>
<dd><p>Increment the counter identified by <i class="arg">tag</i>.  The default increment
is 1, although you can increment by any value, integer or real, by
specifying <i class="arg">delta</i>.  You must declare each counter with
<b class="cmd">::counter::init</b> to define the characteristics of counter before
you start to use it.  If the counter type is <b class="option">-group</b>, then the
counter identified by <i class="arg">instance</i> is incremented.</p></dd>
<dt><a name="3"><b class="cmd">::counter::start</b> <i class="arg">tag instance</i></a></dt>
<dd><p>Record the starting time of an interval.  The <i class="arg">tag</i> is the name of
the counter defined as a <b class="option">-hist</b> value-based histogram.  The
<i class="arg">instance</i> is used to distinguish this interval from any other
intervals that might be overlapping this one.</p></dd>
<dt><a name="4"><b class="cmd">::counter::stop</b> <i class="arg">tag instance</i></a></dt>
<dd><p>Record the ending time of an interval.  The delta time since the
corresponding <b class="cmd">::counter::start</b> call for <i class="arg">instance</i> is
recorded in the histogram identified by <i class="arg">tag</i>.</p></dd>
<dt><a name="5"><b class="cmd">::counter::get</b> <i class="arg">tag args</i></a></dt>
<dd><p>Return statistics about a counter identified by <i class="arg">tag</i>.  The
<i class="arg">args</i> determine what value to return:</p>
<dl class="definitions">
<dt><b class="option">-total</b></dt>
<dd><p>Return the total value of the counter.  This is the default if
<i class="arg">args</i> is not specified.</p></dd>
<dt><b class="option">-totalVar</b></dt>
<dd><p>Return the name of the total variable.  Useful for specifying with
-textvariable in a Tk widget.</p></dd>
<dt><b class="option">-N</b></dt>
<dd><p>Return the number of samples accumulated into the counter.</p></dd>
<dt><b class="option">-avg</b></dt>
<dd><p>Return the average of samples accumulated into the counter.</p></dd>
<dt><b class="option">-avgn</b></dt>
<dd><p>Return the average over the last <i class="arg">N</i> samples taken.  The <i class="arg">N</i>
value is set in the <b class="cmd">::counter::init</b> call.</p></dd>
<dt><b class="option">-hist</b> <i class="arg">bucket</i></dt>
<dd><p>If <i class="arg">bucket</i> is specified, then the value in that bucket of the
histogram is returned.  Otherwise the complete histogram is returned
in array get format sorted by bucket.</p></dd>
<dt><b class="option">-histVar</b></dt>
<dd><p>Return the name of the histogram array variable.</p></dd>
<dt><b class="option">-histHour</b></dt>
<dd><p>Return the complete hourly histogram in array get format sorted by
bucket.</p></dd>
<dt><b class="option">-histHourVar</b></dt>
<dd><p>Return the name of the hourly histogram array variable.</p></dd>
<dt><b class="option">-histDay</b></dt>
<dd><p>Return the complete daily histogram in array get format sorted by
bucket.</p></dd>
<dt><b class="option">-histDayVar</b></dt>
<dd><p>Return the name of the daily histogram array variable.</p></dd>
<dt><b class="option">-resetDate</b></dt>
<dd><p>Return the clock seconds value recorded when the
counter was last reset.</p></dd>
<dt><b class="option">-all</b></dt>
<dd><p>Return an array get of the array used to store the counter.  This
includes the total, the number of samples (N), and any type-specific
information.  This does not include the histogram array.</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::counter::exists</b> <i class="arg">tag</i></a></dt>
<dd><p>Returns 1 if the counter is defined.</p></dd>
<dt><a name="7"><b class="cmd">::counter::names</b></a></dt>
<dd><p>Returns a list of all counters defined.</p></dd>
<dt><a name="8"><b class="cmd">::counter::histHtmlDisplay</b> <i class="arg">tag args</i></a></dt>
<dd><p>Generate HTML to display a histogram for a counter.  The <i class="arg">args</i>
control the format of the display.  They are:</p>
<dl class="definitions">
<dt><b class="option">-title</b> <i class="arg">string</i></dt>
<dd><p>Label to display above bar chart</p></dd>
<dt><b class="option">-unit</b> <i class="arg">unit</i></dt>
<dd><p>Specify <b class="const">minutes</b>, <b class="const">hours</b>, or <b class="const">days</b> for the
time-base histograms.  For value-based histograms, the <i class="arg">unit</i> is
used in the title.</p></dd>
<dt><b class="option">-images</b> <i class="arg">url</i></dt>
<dd><p>URL of /images directory.</p></dd>
<dt><b class="option">-gif</b> <i class="arg">filename</i></dt>
<dd><p>Image for normal histogram bars.  The <i class="arg">filename</i> is relative to
the <b class="option">-images</b> directory.</p></dd>
<dt><b class="option">-ongif</b> <i class="arg">filename</i></dt>
<dd><p>Image for the active histogram bar.  The <i class="arg">filename</i> is relative to
the <b class="option">-images</b> directory.</p></dd>
<dt><b class="option">-max</b> <i class="arg">N</i></dt>
<dd><p>Maximum number of value-based buckets to display.</p></dd>
<dt><b class="option">-height</b> <i class="arg">N</i></dt>
<dd><p>Pixel height of the highest bar.</p></dd>
<dt><b class="option">-width</b> <i class="arg">N</i></dt>
<dd><p>Pixel width of each bar.</p></dd>
<dt><b class="option">-skip</b> <i class="arg">N</i></dt>
<dd><p>Buckets to skip when labeling value-based histograms.</p></dd>
<dt><b class="option">-format</b> <i class="arg">string</i></dt>
<dd><p>Format used to display labels of buckets.</p></dd>
<dt><b class="option">-text</b> <i class="arg">boolean</i></dt>
<dd><p>If 1, a text version of the histogram is dumped, otherwise a graphical
one is generated.</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::counter::reset</b> <i class="arg">tag args</i></a></dt>
<dd><p>Resets the counter with the name <i class="arg">tag</i> to an initial state. The
<i class="arg">args</i> determine the new characteristics of the counter. They have
the same meaning as described for <b class="cmd">::counter::init</b>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>counter</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key662">counting</a>, <a href="../../../../index.html#key661">histogram</a>, <a href="../../../../index.html#key174">statistics</a>, <a href="../../../../index.html#key660">tallying</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/crc/cksum.html.















































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>cksum - Cyclic Redundancy Checks</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/crc/cksum.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Pat Thoyts
   -->
<! -- CVS: $Id$ cksum.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">cksum(n) 1.1.3 tcllib &quot;Cyclic Redundancy Checks&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>cksum - Calculate a cksum(1) compatible checksum</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">OPTIONS</a></li>
<li class="section"><a href="#section4">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">AUTHORS</a></li>
<li class="section"><a href="#section7">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">cksum <span class="opt">?1.1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crc::cksum</b> <span class="opt">?<i class="arg">-format format</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> [ <i class="arg">-channel chan</i> | <i class="arg">-filename file</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#2"><b class="cmd">::crc::CksumInit</b></a></li>
<li><a href="#3"><b class="cmd">::crc::CksumUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#4"><b class="cmd">::crc::CksumFinal</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a Tcl implementation of the cksum(1) algorithm
based upon information provided at in the GNU implementation of this
program as part of the GNU Textutils 2.0 package.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::crc::cksum</b> <span class="opt">?<i class="arg">-format format</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> [ <i class="arg">-channel chan</i> | <i class="arg">-filename file</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>The command takes string data or a channel or file name and returns a
checksum value calculated using the <b class="syscmd">cksum(1)</b> algorithm. The
result is formatted using the <i class="arg">format</i>(n) specifier provided or as
an unsigned integer (%u) by default.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OPTIONS</a></h2>
<dl class="definitions">
<dt>-channel <i class="arg">name</i></dt>
<dd><p>Return a checksum for the data read from a channel. The command will
read data from the channel until the <b class="cmd">eof</b> is true. If you need
to be able to process events during this calculation see the
<span class="sectref"><a href="#section4">PROGRAMMING INTERFACE</a></span> section</p></dd>
<dt>-filename <i class="arg">name</i></dt>
<dd><p>This is a convenience option that opens the specified file, sets the
encoding to binary and then acts as if the <i class="arg">-channel</i> option had
been used. The file is closed on completion.</p></dd>
<dt>-format <i class="arg">string</i></dt>
<dd><p>Return the checksum using an alternative format template.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">PROGRAMMING INTERFACE</a></h2>
<p>The cksum package implements the checksum using a context variable to
which additional data can be added at any time. This is expecially
useful in an event based environment such as a Tk application or a web
server package. Data to be checksummed may be handled incrementally
during a <b class="cmd">fileevent</b> handler in discrete chunks. This can improve
the interactive nature of a GUI application and can help to avoid
excessive memory consumption.</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">::crc::CksumInit</b></a></dt>
<dd><p>Begins a new cksum context. Returns a token ID that must be used for the
remaining functions. An optional seed may be specified if required.</p></dd>
<dt><a name="3"><b class="cmd">::crc::CksumUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd><p>Add data to the checksum identified by token. Calling 
<em>CksumUpdate $token &quot;abcd&quot;</em> is equivalent to calling
<em>CksumUpdate $token &quot;ab&quot;</em> followed by 
<em>CksumUpdate $token &quot;cb&quot;</em>. See <span class="sectref"><a href="#section5">EXAMPLES</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::crc::CksumFinal</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the checksum value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a 32 bit integer value.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<pre class="example">
% crc::cksum &quot;Hello, World!&quot;
2609532967
</pre>
<pre class="example">
% crc::cksum -format 0x%X &quot;Hello, World!&quot;
0x9B8A5027
</pre>
<pre class="example">
% crc::cksum -file cksum.tcl
1828321145
</pre>
<pre class="example">
% set tok [crc::CksumInit]
% crc::CksumUpdate $tok &quot;Hello, &quot;
% crc::CksumUpdate $tok &quot;World!&quot;
% crc::CksumFinal $tok
2609532967
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section7" class="section"><h2><a name="section7">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>crc</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="crc32.html">crc32(n)</a>, <a href="sum.html">sum(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key140">checksum</a>, <a href="../../../../index.html#key141">cksum</a>, <a href="../../../../index.html#key137">crc</a>, <a href="../../../../index.html#key138">crc32</a>, <a href="../../../../index.html#key139">cyclic redundancy check</a>, <a href="../../../../index.html#key111">data integrity</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Pat Thoyts</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/crc/crc16.html.


























































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>crc16 - Cyclic Redundancy Checks</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/crc/crc16.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Pat Thoyts
   -->
<! -- CVS: $Id$ crc16.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">crc16(n) 1.1.2 tcllib &quot;Cyclic Redundancy Checks&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crc16 - Perform a 16bit Cyclic Redundancy Check</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">OPTIONS</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">AUTHORS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">crc16 <span class="opt">?1.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crc::crc16</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <i class="arg">message</i></a></li>
<li><a href="#2"><b class="cmd">::crc::crc16</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></li>
<li><a href="#3"><b class="cmd">::crc::crc-ccitt</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <i class="arg">message</i></a></li>
<li><a href="#4"><b class="cmd">::crc::crc-ccitt</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></li>
<li><a href="#5"><b class="cmd">::crc::xmodem</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <i class="arg">message</i></a></li>
<li><a href="#6"><b class="cmd">::crc::xmodem</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a Tcl-only implementation of the CRC
algorithms based upon information provided at
http://www.microconsultants.com/tips/crc/crc.txt
There are a number of permutations available for calculating CRC
checksums and this package can handle all of them. Defaults are set up
for the most common cases.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::crc::crc16</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="2"><b class="cmd">::crc::crc16</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></dt>
<dd></dd>
<dt><a name="3"><b class="cmd">::crc::crc-ccitt</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="4"><b class="cmd">::crc::crc-ccitt</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></dt>
<dd></dd>
<dt><a name="5"><b class="cmd">::crc::xmodem</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="6"><b class="cmd">::crc::xmodem</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></dt>
<dd><p>The command takes either string data or a file name and returns a checksum
value calculated using the CRC algorithm. The command used sets up the
CRC polynomial, initial value and bit ordering for the desired
standard checksum calculation. The result is formatted
using the <i class="arg">format</i>(n) specifier provided or as an unsigned integer
(%u) by default.</p>
<p>A number of common polynomials are in use with the CRC algorithm and
the most commonly used of these are included in this package. For
convenience each of these has a command alias in the crc namespace.</p>
<p>It is possible to implement the CRC-32 checksum using this crc16
package as the implementation is sufficiently generic to extend to 32
bit checksums. As an example this has been done already - however this
is not the fastest method to implement this algorithm in Tcl and a
separate <b class="package"><a href="crc32.html">crc32</a></b> package is available.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OPTIONS</a></h2>
<dl class="definitions">
<dt>-filename <i class="arg">name</i></dt>
<dd><p>Return a checksum for the file contents instead of for parameter data.</p></dd>
<dt>-format <i class="arg">string</i></dt>
<dd><p>Return the checksum using an alternative format template.</p></dd>
<dt>-seed <i class="arg">value</i></dt>
<dd><p>Select an alternative seed value for the CRC calculation. The default
is 0 for the CRC16 calculation and 0xFFFF for the CCITT version.
This can be useful for calculating the CRC for data
structures without first converting the whole structure into a
string. The CRC of the previous member can be used as the seed for
calculating the CRC of the next member. It is also used for
accumulating a checksum from fragments of a large message (or file)</p></dd>
<dt>-implementation <i class="arg">procname</i></dt>
<dd><p>This hook is provided to allow users to provide their own
implementation (perhaps a C compiled extension). The
procedure specfied is called with two parameters. The first is the
data to be checksummed and the second is the seed value. An
integer is expected as the result.</p>
<p>The package provides some implementations of standard CRC polynomials
for the XMODEM, CCITT and the usual CRC-16 checksum. For convenience,
additional commands have been provided that make use of these
implementations.</p></dd>
<dt>--</dt>
<dd><p>Terminate option processing.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% crc::crc16 &quot;Hello, World!&quot;
64077
</pre>
<pre class="example">
% crc::crc-ccitt &quot;Hello, World!&quot;
26586
</pre>
<pre class="example">
% crc::crc16 -format 0x%X &quot;Hello, World!&quot;
0xFA4D
</pre>
<pre class="example">
% crc::crc16 -file crc16.tcl
51675
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>crc</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="cksum.html">cksum(n)</a>, <a href="crc32.html">crc32(n)</a>, <a href="sum.html">sum(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key140">checksum</a>, <a href="../../../../index.html#key141">cksum</a>, <a href="../../../../index.html#key137">crc</a>, <a href="../../../../index.html#key747">crc16</a>, <a href="../../../../index.html#key138">crc32</a>, <a href="../../../../index.html#key139">cyclic redundancy check</a>, <a href="../../../../index.html#key111">data integrity</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Pat Thoyts</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/crc/crc32.html.






























































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>crc32 - Cyclic Redundancy Checks</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/crc/crc32.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Pat Thoyts
   -->
<! -- CVS: $Id$ crc32.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">crc32(n) 1.3 tcllib &quot;Cyclic Redundancy Checks&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crc32 - Perform a 32bit Cyclic Redundancy Check</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">OPTIONS</a></li>
<li class="section"><a href="#section4">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">AUTHORS</a></li>
<li class="section"><a href="#section7">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">crc32 <span class="opt">?1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crc::crc32</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> [ <i class="arg">-channel chan</i> | <i class="arg">-filename file</i> | <i class="arg">message</i> ]</a></li>
<li><a href="#2"><b class="cmd">::crc::Crc32Init</b> <span class="opt">?<i class="arg">seed</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::crc::Crc32Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#4"><b class="cmd">::crc::Crc32Final</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a Tcl implementation of the CRC-32
algorithm based upon information provided at
http://www.naaccr.org/standard/crc32/document.html
If either the <b class="package">critcl</b> package or the <b class="package">Trf</b> package
are available then a compiled version may be used internally to
accelerate the checksum calculation.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::crc::crc32</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> [ <i class="arg">-channel chan</i> | <i class="arg">-filename file</i> | <i class="arg">message</i> ]</a></dt>
<dd><p>The command takes either string data or a channel or file name and
returns a checksum value calculated using the CRC-32 algorithm. The
result is formatted using the <i class="arg">format</i>(n) specifier provided. The
default is to return the value as an unsigned integer (format %u).</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OPTIONS</a></h2>
<dl class="definitions">
<dt>-channel <i class="arg">name</i></dt>
<dd><p>Return a checksum for the data read from a channel. The command will
read data from the channel until the <b class="cmd">eof</b> is true. If you need
to be able to process events during this calculation see the
<span class="sectref"><a href="#section4">PROGRAMMING INTERFACE</a></span> section</p></dd>
<dt>-filename <i class="arg">name</i></dt>
<dd><p>This is a convenience option that opens the specified file, sets the
encoding to binary and then acts as if the <i class="arg">-channel</i> option had
been used. The file is closed on completion.</p></dd>
<dt>-format <i class="arg">string</i></dt>
<dd><p>Return the checksum using an alternative format template.</p></dd>
<dt>-seed <i class="arg">value</i></dt>
<dd><p>Select an alternative seed value for the CRC calculation. The default
is 0xffffffff. This can be useful for calculating the CRC for data
structures without first converting the whole structure into a
string. The CRC of the previous member can be used as the seed for
calculating the CRC of the next member.
Note that the crc32 algorithm includes a final XOR step. If
incremental processing is desired then this must be undone before
using the output of the algorithm as the seed for further
processing. A simpler alternative is to use the 
<span class="sectref"><a href="#section4">PROGRAMMING INTERFACE</a></span> which is intended for this mode of
operation.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">PROGRAMMING INTERFACE</a></h2>
<p>The CRC-32 package implements the checksum using a context variable to
which additional data can be added at any time. This is expecially
useful in an event based environment such as a Tk application or a web
server package. Data to be checksummed may be handled incrementally
during a <b class="cmd">fileevent</b> handler in discrete chunks. This can improve
the interactive nature of a GUI application and can help to avoid
excessive memory consumption.</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">::crc::Crc32Init</b> <span class="opt">?<i class="arg">seed</i>?</span></a></dt>
<dd><p>Begins a new CRC32 context. Returns a token ID that must be used for the
remaining functions. An optional seed may be specified if required.</p></dd>
<dt><a name="3"><b class="cmd">::crc::Crc32Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd><p>Add data to the checksum identified by token. Calling 
<em>Crc32Update $token &quot;abcd&quot;</em> is equivalent to calling
<em>Crc32Update $token &quot;ab&quot;</em> followed by 
<em>Crc32Update $token &quot;cb&quot;</em>. See <span class="sectref"><a href="#section5">EXAMPLES</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::crc::Crc32Final</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the checksum value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a 32 bit integer value.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<pre class="example">
% crc::crc32 &quot;Hello, World!&quot;
3964322768
</pre>
<pre class="example">
% crc::crc32 -format 0x%X &quot;Hello, World!&quot;
0xEC4AC3D0
</pre>
<pre class="example">
% crc::crc32 -file crc32.tcl
483919716
</pre>
<pre class="example">
% set tok [crc::Crc32Init]
% crc::Crc32Update $tok &quot;Hello, &quot;
% crc::Crc32Update $tok &quot;World!&quot;
% crc::Crc32Final $tok
3964322768
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section7" class="section"><h2><a name="section7">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>crc</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="cksum.html">cksum(n)</a>, <a href="crc16.html">crc16(n)</a>, <a href="sum.html">sum(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key140">checksum</a>, <a href="../../../../index.html#key141">cksum</a>, <a href="../../../../index.html#key137">crc</a>, <a href="../../../../index.html#key138">crc32</a>, <a href="../../../../index.html#key139">cyclic redundancy check</a>, <a href="../../../../index.html#key111">data integrity</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Pat Thoyts</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/crc/sum.html.






















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>sum - Cyclic Redundancy Checks</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/crc/sum.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ sum.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">sum(n) 1.1.0 tcllib &quot;Cyclic Redundancy Checks&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>sum - Calculate a sum(1) compatible checksum</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">OPTIONS</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">AUTHORS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">sum <span class="opt">?1.1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crc::sum</b> <span class="opt">?<i class="arg">-bsd</i> | <i class="arg">-sysv</i>?</span> <span class="opt">?<i class="arg">-format fmt</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> [ <i class="arg">-filename file</i> | <i class="arg">-channel chan</i> | <i class="arg">string</i> ]</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a Tcl-only implementation of the sum(1) command
which calculates a 16 bit checksum value from the input data.  The BSD
sum algorithm is used by default but the SysV algorithm is also
available.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::crc::sum</b> <span class="opt">?<i class="arg">-bsd</i> | <i class="arg">-sysv</i>?</span> <span class="opt">?<i class="arg">-format fmt</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> [ <i class="arg">-filename file</i> | <i class="arg">-channel chan</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>The command takes string data or a file name or a channel and returns
a checksum value calculated using the <b class="syscmd">sum(1)</b> algorithm. The
result is formatted using the <i class="arg">format</i>(n) specifier provided or as
an unsigned integer (%u) by default.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OPTIONS</a></h2>
<dl class="definitions">
<dt>-sysv</dt>
<dd><p>The SysV algorithm is fairly naive. The byte values are summed and any
overflow is discarded. The lowest 16 bits are returned as the
checksum.  Input with the same content but different ordering will
give the same result.</p></dd>
<dt>-bsd</dt>
<dd><p>This algorithm is similar to the SysV version but includes a bit rotation
step which provides a dependency on the order of the data values.</p></dd>
<dt>-filename <i class="arg">name</i></dt>
<dd><p>Return a checksum for the file contents instead of for parameter data.</p></dd>
<dt>-channel <i class="arg">chan</i></dt>
<dd><p>Return a checksum for the contents of the specified channel. The
channel must be open for reading and should be configured for binary
translation. The channel will no be closed on completion.</p></dd>
<dt>-chunksize <i class="arg">size</i></dt>
<dd><p>Set the block size used when reading data from either files or
channels. This value defaults to 4096.</p></dd>
<dt>-format <i class="arg">string</i></dt>
<dd><p>Return the checksum using an alternative format template.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% crc::sum &quot;Hello, World!&quot;
37287
</pre>
<pre class="example">
% crc::sum -format 0x%X &quot;Hello, World!&quot;
0x91A7
</pre>
<pre class="example">
% crc::sum -file sum.tcl
13392
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>crc</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="cksum.html">cksum(n)</a>, <a href="crc32.html">crc32(n)</a>, sum(1)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key140">checksum</a>, <a href="../../../../index.html#key141">cksum</a>, <a href="../../../../index.html#key137">crc</a>, <a href="../../../../index.html#key138">crc32</a>, <a href="../../../../index.html#key139">cyclic redundancy check</a>, <a href="../../../../index.html#key111">data integrity</a>, <a href="../../../../index.html#key110">security</a>, <a href="../../../../index.html#key540">sum</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/csv/csv.html.
































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>csv - CSV processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/csv/csv.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002-2013 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ csv.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">csv(n) 0.8 tcllib &quot;CSV processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>csv - Procedures to handle CSV data.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">FORMAT</a></li>
<li class="section"><a href="#section4">EXAMPLE</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">csv <span class="opt">?0.8?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::csv::iscomplete</b> <i class="arg">data</i></a></li>
<li><a href="#2"><b class="cmd">::csv::join</b> <i class="arg">values</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span> <span class="opt">?<i class="arg">delMode</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::csv::joinlist</b> <i class="arg">values</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span> <span class="opt">?<i class="arg">delMode</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::csv::joinmatrix</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span> <span class="opt">?<i class="arg">delMode</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::csv::read2matrix</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">chan m</i> {<i class="arg">sepChar</i> ,} {<i class="arg">expand</i> none}</a></li>
<li><a href="#6"><b class="cmd">::csv::read2queue</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">chan q</i> {<i class="arg">sepChar</i> ,}</a></li>
<li><a href="#7"><b class="cmd">::csv::report</b> <i class="arg">cmd matrix</i> <span class="opt">?<i class="arg">chan</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::csv::split</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">line</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span></a></li>
<li><a href="#9"><b class="cmd">::csv::split2matrix</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">m line</i> {<i class="arg">sepChar</i> ,} {<i class="arg">expand</i> none}</a></li>
<li><a href="#10"><b class="cmd">::csv::split2queue</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">q line</i> {<i class="arg">sepChar</i> ,}</a></li>
<li><a href="#11"><b class="cmd">::csv::writematrix</b> <i class="arg">m chan</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span></a></li>
<li><a href="#12"><b class="cmd">::csv::writequeue</b> <i class="arg">q chan</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">csv</b> package provides commands to manipulate information
in CSV <span class="sectref"><a href="#section3">FORMAT</a></span> (CSV = Comma Separated Values).</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<p>The following commands are available:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::csv::iscomplete</b> <i class="arg">data</i></a></dt>
<dd><p>A predicate checking if the argument <i class="arg">data</i> is a complete csv
record. The result is a boolean flag indicating the completeness of
the data. The result is true if the data is complete.</p></dd>
<dt><a name="2"><b class="cmd">::csv::join</b> <i class="arg">values</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span> <span class="opt">?<i class="arg">delMode</i>?</span></a></dt>
<dd><p>Takes a list of values and returns a string in CSV format containing
these values. The separator character can be defined by the caller,
but this is optional. The default is &quot;,&quot;. The quoting aka delimiting character can
be defined by the caller, but this is optional. The default is '&quot;'.
By default the quoting mode <i class="arg">delMode</i> is &quot;auto&quot;, surrounding
values with <i class="arg">delChar</i> only when needed. When set to &quot;always&quot;
however, values are always surrounded by the <i class="arg">delChar</i> instead.</p></dd>
<dt><a name="3"><b class="cmd">::csv::joinlist</b> <i class="arg">values</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span> <span class="opt">?<i class="arg">delMode</i>?</span></a></dt>
<dd><p>Takes a list of lists of values and returns a string in CSV format
containing these values. The separator character can be defined by the
caller, but this is optional. The default is &quot;,&quot;. The quoting character
can be defined by the caller, but this is optional. The default is '&quot;'.
By default the quoting mode <i class="arg">delMode</i> is &quot;auto&quot;, surrounding
values with <i class="arg">delChar</i> only when needed. When set to &quot;always&quot;
however, values are always surrounded by the <i class="arg">delChar</i> instead.
Each element of the outer list is considered a record, these are
separated by newlines in the result. The elements of each record are
formatted as usual (via <b class="cmd">::csv::join</b>).</p></dd>
<dt><a name="4"><b class="cmd">::csv::joinmatrix</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span> <span class="opt">?<i class="arg">delMode</i>?</span></a></dt>
<dd><p>Takes a <i class="arg">matrix</i> object following the API specified for the
struct::matrix package and returns a string in CSV format containing
these values. The separator character can be defined by the caller,
but this is optional. The default is &quot;,&quot;. The quoting character
can be defined by the caller, but this is optional. The default is
'&quot;'.
By default the quoting mode <i class="arg">delMode</i> is &quot;auto&quot;, surrounding
values with <i class="arg">delChar</i> only when needed. When set to &quot;always&quot;
however, values are always surrounded by the <i class="arg">delChar</i> instead.
Each row of the matrix is considered a record, these are
separated by newlines in the result. The elements of each record are
formatted as usual (via <b class="cmd">::csv::join</b>).</p></dd>
<dt><a name="5"><b class="cmd">::csv::read2matrix</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">chan m</i> {<i class="arg">sepChar</i> ,} {<i class="arg">expand</i> none}</a></dt>
<dd><p>A wrapper around <b class="cmd">::csv::split2matrix</b> (see below) reading
CSV-formatted lines from the specified channel (until EOF) and adding
them to the given matrix. For an explanation of the <i class="arg">expand</i>
argument see <b class="cmd">::csv::split2matrix</b>.</p></dd>
<dt><a name="6"><b class="cmd">::csv::read2queue</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">chan q</i> {<i class="arg">sepChar</i> ,}</a></dt>
<dd><p>A wrapper around <b class="cmd">::csv::split2queue</b> (see below) reading
CSV-formatted lines from the specified channel (until EOF) and adding
them to the given queue.</p></dd>
<dt><a name="7"><b class="cmd">::csv::report</b> <i class="arg">cmd matrix</i> <span class="opt">?<i class="arg">chan</i>?</span></a></dt>
<dd><p>A report command which can be used by the matrix methods
<b class="cmd">format 2string</b> and <b class="cmd">format 2chan</b>. For the latter this
command delegates the work to <b class="cmd">::csv::writematrix</b>. <i class="arg">cmd</i> is
expected to be either <b class="method">printmatrix</b> or
<b class="method">printmatrix2channel</b>. The channel argument, <i class="arg">chan</i>, has
to be present for the latter and must not be present for the first.</p></dd>
<dt><a name="8"><b class="cmd">::csv::split</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">line</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span></a></dt>
<dd><p>converts a <i class="arg">line</i> in CSV format into a list of the values
contained in the line. The character used to separate the values from
each other can be defined by the caller, via <i class="arg">sepChar</i>, but this
is optional. The default is &quot;,&quot;. The quoting character can be defined
by the caller, but this is optional. The default is '&quot;'.</p>
<p>If the option <b class="option">-alternate</b> is specified a slightly different
syntax is used to parse the input. This syntax is explained below, in
the section <span class="sectref"><a href="#section3">FORMAT</a></span>.</p></dd>
<dt><a name="9"><b class="cmd">::csv::split2matrix</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">m line</i> {<i class="arg">sepChar</i> ,} {<i class="arg">expand</i> none}</a></dt>
<dd><p>The same as <b class="cmd">::csv::split</b>, but appends the resulting list as a
new row to the matrix <i class="arg">m</i>, using the method <b class="cmd">add row</b>. The
expansion mode specified via <i class="arg">expand</i> determines how the command
handles a matrix with less columns than contained in <i class="arg">line</i>. The
allowed modes are:</p>
<dl class="definitions">
<dt><b class="const">none</b></dt>
<dd><p>This is the default mode. In this mode it is the responsibility of the
caller to ensure that the matrix has enough columns to contain the
full line. If there are not enough columns the list of values is
silently truncated at the end to fit.</p></dd>
<dt><b class="const">empty</b></dt>
<dd><p>In this mode the command expands an empty matrix to hold all columns
of the specified line, but goes no further. The overall effect is that
the first of a series of lines determines the number of columns in the
matrix and all following lines are truncated to that size, as if mode
<b class="const">none</b> was set.</p></dd>
<dt><b class="const">auto</b></dt>
<dd><p>In this mode the command expands the matrix as needed to hold all
columns contained in <i class="arg">line</i>. The overall effect is that after
adding a series of lines the matrix will have enough columns to hold
all columns of the longest line encountered so far.</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::csv::split2queue</b> <span class="opt">?<b class="option">-alternate</b>?</span> <i class="arg">q line</i> {<i class="arg">sepChar</i> ,}</a></dt>
<dd><p>The same as <b class="cmd">::csv::split</b>, but appending the resulting list as a
single item to the queue <i class="arg">q</i>, using the method <b class="cmd">put</b>.</p></dd>
<dt><a name="11"><b class="cmd">::csv::writematrix</b> <i class="arg">m chan</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span></a></dt>
<dd><p>A wrapper around <b class="cmd">::csv::join</b> taking all rows in the matrix
<i class="arg">m</i> and writing them CSV formatted into the channel <i class="arg">chan</i>.</p></dd>
<dt><a name="12"><b class="cmd">::csv::writequeue</b> <i class="arg">q chan</i> <span class="opt">?<i class="arg">sepChar</i>?</span> <span class="opt">?<i class="arg">delChar</i>?</span></a></dt>
<dd><p>A wrapper around <b class="cmd">::csv::join</b> taking all items in the queue
<i class="arg">q</i> (assumes that they are lists) and writing them CSV formatted
into the channel <i class="arg">chan</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">FORMAT</a></h2>
<p>The format of regular CSV files is specified as</p>
<ol class="enumerated">
<li><p>Each record of a csv file (comma-separated values, as exported e.g. by
Excel) is a set of ASCII values separated by &quot;,&quot;. For other languages
it may be &quot;;&quot; however, although this is not important for this case as
the functions provided here allow any separator character.</p></li>
<li><p>If and only if a value contains itself the separator &quot;,&quot;, then it (the
value) has to be put between &quot;&quot;. If the value does not contain the
separator character then quoting is optional.</p></li>
<li><p>If a value contains the character &quot;, that character is represented by &quot;&quot;.</p></li>
<li><p>The output string &quot;&quot; represents the value &quot;. In other words, it is
assumed that it was created through rule 3, and only this rule,
i.e. that the value was not quoted.</p></li>
</ol>
<p>An alternate format definition mainly used by MS products specifies
that the output string &quot;&quot; is a representation of the empty
string. In other words, it is assumed that the output was generated
out of the empty string by quoting it (i.e. rule 2), and not through
rule 3. This is the only difference between the regular and the
alternate format.</p>
<p>The alternate format is activated through specification of the option
<b class="option">-alternate</b> to the various split commands.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLE</a></h2>
<p>Using the regular format the record</p>
<pre class="example">
123,&quot;123,521.2&quot;,&quot;Mary says &quot;&quot;Hello, I am Mary&quot;&quot;&quot;,&quot;&quot;
</pre>
<p>is parsed into the items</p>
<pre class="example">
a) 123
b) 123,521.2
c) Mary says &quot;Hello, I am Mary&quot;
d) &quot;
</pre>
<p>Using the alternate format the result is</p>
<pre class="example">
a) 123
b) 123,521.2
c) Mary says &quot;Hello, I am Mary&quot;
d) (the empty string)
</pre>
<p>instead. As can be seen only item (d) is different, now the empty string
instead of a &quot;.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>csv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../../../../index.html#key55">matrix</a>, <a href="../../../../index.html#key54">queue</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key53">csv</a>, <a href="../../../../index.html#key55">matrix</a>, <a href="../../../../index.html#key52">package</a>, <a href="../../../../index.html#key54">queue</a>, <a href="../../../../index.html#key56">tcllib</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002-2013 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/des/des.html.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>des - Data Encryption Standard (DES)</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/des/des.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ des.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">des(n) 1.1 tcllib &quot;Data Encryption Standard (DES)&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>des - Implementation of the DES and triple-DES ciphers</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">MODES OF OPERATION</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">REFERENCES</a></li>
<li class="section"><a href="#section7">AUTHORS</a></li>
<li class="section"><a href="#section8">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">des 1.1</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::DES::des</b> <span class="opt">?<i class="arg">-mode [ecb|cbc|cfb|ofb]</i>?</span> <span class="opt">?<i class="arg">-dir [encrypt|decrypt]</i>?</span> <i class="arg">-key keydata</i> <span class="opt">?<i class="arg">-iv vector</i>?</span> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-weak</i>?</span> <span class="opt">?<i class="arg">-out channel</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> [ <i class="arg">-in channel</i> | <i class="arg">data</i> ]</a></li>
<li><a href="#2"><b class="cmd">::DES::Init</b> <i class="arg">mode</i> <i class="arg">keydata</i> <i class="arg">iv</i> <span class="opt">?<i class="arg">weak</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::DES::Encrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></li>
<li><a href="#4"><b class="cmd">::DES::Decrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></li>
<li><a href="#5"><b class="cmd">::DES::Reset</b> <i class="arg">Key</i> <i class="arg">iv</i></a></li>
<li><a href="#6"><b class="cmd">::DES::Final</b> <i class="arg">Key</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This is an implementation in Tcl of the Data Encryption Standard (DES)
as published by the U.S. National Institute of Standards and
Technology (NIST) [1]. This implementation also supports triple
DES (3DES) extension to DES. DES is a 64-bit block cipher that uses a
56-bit key. 3DES uses a 168-bit key. DES has now officially been
superceeded by AES but is in common use in many protocols.</p>
<p>The tcllib implementation of DES and 3DES uses an implementation by
Mac Cody and is available as a separate download from [2]. For
anyone concerned about the details of exporting this code please see
the TclDES web pages. The tcllib specific code is a wrapper to the 
TclDES API that presents same API for the DES cipher as for other
ciphers in the library.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::DES::des</b> <span class="opt">?<i class="arg">-mode [ecb|cbc|cfb|ofb]</i>?</span> <span class="opt">?<i class="arg">-dir [encrypt|decrypt]</i>?</span> <i class="arg">-key keydata</i> <span class="opt">?<i class="arg">-iv vector</i>?</span> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-weak</i>?</span> <span class="opt">?<i class="arg">-out channel</i>?</span> <span class="opt">?<i class="arg">-chunksize size</i>?</span> [ <i class="arg">-in channel</i> | <i class="arg">data</i> ]</a></dt>
<dd><p>Perform the <b class="package"><a href="../../../../index.html#key606">DES</a></b> algorithm on either the data provided
by the argument or on the data read from the <i class="arg">-in</i> channel. If
an <i class="arg">-out</i> channel is given then the result will be written to
this channel.</p>
<p>The <i class="arg">-key</i> option must be given. This parameter takes a binary
string of 8 bytes in length and is used to generate the key schedule.
In DES only 56 bits of key data are used. The highest bit from each
byte is discarded.</p>
<p>The <i class="arg">-mode</i> and <i class="arg">-dir</i> options are optional and default to cbc
mode and encrypt respectively. The initialization vector <i class="arg">-iv</i>
takes an 8 byte binary argument. This defaults to all zeros. See 
<span class="sectref"><a href="#section4">MODES OF OPERATION</a></span> for more about <i class="arg">-mode</i> and the use
of the initialization vector.</p>
<p>DES is a 64-bit block cipher. This means that the data must be
provided in units that are a multiple of 8 bytes.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<p>Internal state is maintained in an opaque structure that is returned
from the <b class="cmd">Init</b> function. In ECB mode the state is not affected by
the input but for other modes some input dependent state is maintained
and may be reset by calling the <b class="cmd">Reset</b> function with a new
initialization vector value.</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">::DES::Init</b> <i class="arg">mode</i> <i class="arg">keydata</i> <i class="arg">iv</i> <span class="opt">?<i class="arg">weak</i>?</span></a></dt>
<dd><p>Construct a new DES key schedule using the specified key data and the
given initialization vector. The initialization vector is not used
with ECB mode but is important for other usage modes.
See <span class="sectref"><a href="#section4">MODES OF OPERATION</a></span>.</p>
<p>There are a small number of keys that are known to be weak when used
with DES. By default if such a key is passed in then an error will be
raised. If there is a need to accept such keys then the <i class="arg">weak</i>
parameter can be set true to avoid the error being thrown.</p></dd>
<dt><a name="3"><b class="cmd">::DES::Encrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></dt>
<dd><p>Use a prepared key acquired by calling <b class="cmd">Init</b> to encrypt the
provided data. The data argument should be a binary array that is a
multiple of the DES block size of 8 bytes. The result is a binary
array the same size as the input of encrypted data.</p></dd>
<dt><a name="4"><b class="cmd">::DES::Decrypt</b> <i class="arg">Key</i> <i class="arg">data</i></a></dt>
<dd><p>Decipher data using the key. Note that the same key may be used to
encrypt and decrypt data provided that the initialization vector is
reset appropriately for CBC mode.</p></dd>
<dt><a name="5"><b class="cmd">::DES::Reset</b> <i class="arg">Key</i> <i class="arg">iv</i></a></dt>
<dd><p>Reset the initialization vector. This permits the programmer to re-use
a key and avoid the cost of re-generating the key schedule where the
same key data is being used multiple times.</p></dd>
<dt><a name="6"><b class="cmd">::DES::Final</b> <i class="arg">Key</i></a></dt>
<dd><p>This should be called to clean up resources associated with <i class="arg">Key</i>.
Once this function has been called the key may not be used again.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">MODES OF OPERATION</a></h2>
<dl class="definitions">
<dt>Electronic Code Book (ECB)</dt>
<dd><p>ECB is the basic mode of all block ciphers. Each block is encrypted
independently and so identical plain text will produce identical
output when encrypted with the same key. Any encryption errors will
only affect a single block however this is vulnerable to known
plaintext attacks.</p></dd>
<dt>Cipher Block Chaining (CBC)</dt>
<dd><p>CBC mode uses the output of the last block encryption to affect the
current block. An initialization vector of the same size as the cipher
block size is used to handle the first block. The initialization
vector should be chosen randomly and transmitted as the first block of
the output. Errors in encryption affect the current block and the next
block after which the cipher will correct itself. CBC is the most
commonly used mode in software encryption.</p></dd>
<dt>Cipher Feedback (CFB)</dt>
<dd><p>CFB mode can be used to convert block ciphers into stream ciphers. In
CFB mode the initialization vector is encrypted and the output is then
xor'd with the plaintext stream. The result is then used as the
initialization vector for the next round. Errors will affect the
current block and the next block.</p></dd>
<dt>Output Feedback (OFB)</dt>
<dd><p>OFB is similar to CFB except that the output of the cipher is fed back
into the next round and not the xor'd plain text. This means that
errors only affect a single block but the cipher is more vulnerable to
attack.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<pre class="example">
% set ciphertext [DES::des -mode cbc -dir encrypt -key $secret $plaintext]
% set plaintext [DES::des -mode cbc -dir decrypt -key $secret $ciphertext]
</pre>
<pre class="example">
set iv [string repeat \\0 8]
set Key [DES::Init cbc \\0\\1\\2\\3\\4\\5\\6\\7 $iv]
set ciphertext [DES::Encrypt $Key &quot;somedata&quot;]
append ciphertext [DES::Encrypt $Key &quot;moredata&quot;]
DES::Reset $Key $iv
set plaintext [DES::Decrypt $Key $ciphertext]
DES::Final $Key
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>&quot;Data Encryption Standard&quot;,
    Federal Information Processing Standards Publication 46-3, 1999,
    (<a href="http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf">http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf</a>)</p></li>
<li><p>&quot;TclDES: munitions-grade Tcl scripting&quot;
    <a href="http://tcldes.sourceforge.net/">http://tcldes.sourceforge.net/</a></p></li>
</ol>
</div>
<div id="section7" class="section"><h2><a name="section7">AUTHORS</a></h2>
<p>Jochen C Loewer, 
Mac Cody,
Pat Thoyts</p>
</div>
<div id="section8" class="section"><h2><a name="section8">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>des</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../aes/aes.html">aes(n)</a>, <a href="../blowfish/blowfish.html">blowfish(n)</a>, <a href="../md5/md5.html">md5(n)</a>, <a href="../rc4/rc4.html">rc4(n)</a>, <a href="../sha1/sha1.html">sha1(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key608">3DES</a>, <a href="../../../../index.html#key606">DES</a>, <a href="../../../../index.html#key607">block cipher</a>, <a href="../../../../index.html#key111">data integrity</a>, <a href="../../../../index.html#key114">encryption</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/dns/tcllib_dns.html.













































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>dns - Domain Name Service</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/dns/tcllib_dns.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Pat Thoyts
   -->
<! -- CVS: $Id$ dns.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">dns(n) 1.3.3 tcllib &quot;Domain Name Service&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>dns - Tcl Domain Name Service Client</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">AUTHORS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">dns <span class="opt">?1.3.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::dns::resolve</b> <i class="arg">query</i> <span class="opt">?<i class="arg">options</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::dns::configure</b> <span class="opt">?<i class="arg">options</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::dns::name</b> <i class="arg">token</i></a></li>
<li><a href="#4"><b class="cmd">::dns::address</b> <i class="arg">token</i></a></li>
<li><a href="#5"><b class="cmd">::dns::cname</b> <i class="arg">token</i></a></li>
<li><a href="#6"><b class="cmd">::dns::result</b> <i class="arg">token</i></a></li>
<li><a href="#7"><b class="cmd">::dns::status</b> <i class="arg">token</i></a></li>
<li><a href="#8"><b class="cmd">::dns::error</b> <i class="arg">token</i></a></li>
<li><a href="#9"><b class="cmd">::dns::reset</b> <i class="arg">token</i></a></li>
<li><a href="#10"><b class="cmd">::dns::wait</b> <i class="arg">token</i></a></li>
<li><a href="#11"><b class="cmd">::dns::cleanup</b> <i class="arg">token</i></a></li>
<li><a href="#12"><b class="cmd">::dns::nameservers</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The dns package provides a Tcl only Domain Name Service client. You
should refer to (1) and (2) for information about the DNS protocol or
read resolver(3) to find out how the C library resolves domain names.
The intention of this package is to insulate Tcl scripts
from problems with using the system library resolver for slow name servers.
It may or may not be of practical use. Internet name resolution is a
complex business and DNS is only one part of the resolver. You may
find you are supposed to be using hosts files, NIS or WINS to name a
few other systems. This package is not a substitute for the C library
resolver - it does however implement name resolution over DNS.
The package also extends the package <b class="package"><a href="../uri/uri.html">uri</a></b> to support DNS URIs
(4) of the form <a href="dns:what.host.com">dns:what.host.com</a> or
<a href="dns://my.nameserver/what.host.com">dns://my.nameserver/what.host.com</a>. The <b class="cmd">dns::resolve</b>
command can handle DNS URIs or simple domain names as a query.</p>
<p><em>Note:</em> The package defaults to using DNS over TCP
connections. If you wish to use UDP you will need to have the 
<b class="package">tcludp</b> package installed and have a version that
correctly handles binary data (&gt; 1.0.4).
This is available at <a href="http://tcludp.sourceforge.net/">http://tcludp.sourceforge.net/</a>. 
If the <b class="package">udp</b> package is present then UDP will be used by default.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::dns::resolve</b> <i class="arg">query</i> <span class="opt">?<i class="arg">options</i>?</span></a></dt>
<dd><p>Resolve a domain name using the <i class="term"><a href="../../../../index.html#key550">DNS</a></i> protocol. <i class="arg">query</i> is
the domain name to be lookup up. This should be either a fully
qualified domain name or a DNS URI.</p>
<dl class="definitions">
<dt><b class="cmd">-nameserver</b> <i class="arg">hostname</i> or <b class="cmd">-server</b> <i class="arg">hostname</i></dt>
<dd><p>Specify an alternative name server for this request.</p></dd>
<dt><b class="cmd">-protocol</b> <i class="arg">tcp|udp</i></dt>
<dd><p>Specify the network protocol to use for this request. Can be one of
  <i class="arg">tcp</i> or <i class="arg">udp</i>.</p></dd>
<dt><b class="cmd">-port</b> <i class="arg">portnum</i></dt>
<dd><p>Specify an alternative port.</p></dd>
<dt><b class="cmd">-search</b> <i class="arg">domainlist</i></dt>
<dd></dd>
<dt><b class="cmd">-timeout</b> <i class="arg">milliseconds</i></dt>
<dd><p>Override the default timeout.</p></dd>
<dt><b class="cmd">-type</b> <i class="arg">TYPE</i></dt>
<dd><p>Specify the type of DNS record you are interested in. Valid values
  are A, NS, MD, MF, CNAME, SOA, MB, MG, MR, NULL, WKS, PTR, HINFO, 
  MINFO, MX, TXT, SPF, SRV, AAAA, AXFR, MAILB, MAILA and *. 
  See RFC1035 for details about the return values.
  See <a href="http://spf.pobox.com/">http://spf.pobox.com/</a> about SPF.
  See (3) about AAAA records and RFC2782 for details of SRV records.</p></dd>
<dt><b class="cmd">-class</b> <i class="arg">CLASS</i></dt>
<dd><p>Specify the class of domain name. This is usually IN but may be one
  of IN for internet domain names, CS, CH, HS or * for any class.</p></dd>
<dt><b class="cmd">-recurse</b> <i class="arg">boolean</i></dt>
<dd><p>Set to <i class="arg">false</i> if you do not want the name server to recursively
  act upon your request. Normally set to <i class="arg">true</i>.</p></dd>
<dt><b class="cmd">-command</b> <i class="arg">procname</i></dt>
<dd><p>Set a procedure to be called upon request completion. The procedure 
  will be passed the token as its only argument.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::dns::configure</b> <span class="opt">?<i class="arg">options</i>?</span></a></dt>
<dd><p>The <b class="cmd">::dns::configure</b> command is used to setup the dns
package. The server to query, the protocol and domain search path are
all set via this command. If no arguments are provided then a list of
all the current settings is returned.  If only one argument then it
must the the name of an option and the value for that option is
returned.</p>
<dl class="definitions">
<dt><b class="cmd">-nameserver</b> <i class="arg">hostname</i></dt>
<dd><p>Set the default name server to be used by all queries. The default is
  <i class="term">localhost</i>.</p></dd>
<dt><b class="cmd">-protocol</b> <i class="arg">tcp|udp</i></dt>
<dd><p>Set the default network protocol to be used. Default is <i class="arg">tcp</i>.</p></dd>
<dt><b class="cmd">-port</b> <i class="arg">portnum</i></dt>
<dd><p>Set the default port to use on the name server. The default is 53.</p></dd>
<dt><b class="cmd">-search</b> <i class="arg">domainlist</i></dt>
<dd><p>Set the domain search list. This is currently not used.</p></dd>
<dt><b class="cmd">-timeout</b> <i class="arg">milliseconds</i></dt>
<dd><p>Set the default timeout value for DNS lookups. Default is 30 seconds.</p></dd>
<dt><b class="cmd">-loglevel</b> <i class="arg">level</i></dt>
<dd><p>Set the log level used for emitting diagnostic messages from this
  package. The default is <i class="term">warn</i>. See the <b class="package"><a href="../log/log.html">log</a></b> package
  for details of the available levels.</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::dns::name</b> <i class="arg">token</i></a></dt>
<dd><p>Returns a list of all domain names returned as an answer to your query.</p></dd>
<dt><a name="4"><b class="cmd">::dns::address</b> <i class="arg">token</i></a></dt>
<dd><p>Returns a list of the address records that match your query.</p></dd>
<dt><a name="5"><b class="cmd">::dns::cname</b> <i class="arg">token</i></a></dt>
<dd><p>Returns a list of canonical names (usually just one) matching your query.</p></dd>
<dt><a name="6"><b class="cmd">::dns::result</b> <i class="arg">token</i></a></dt>
<dd><p>Returns a list of all the decoded answer records provided for your
  query. This permits you to extract the result for more unusual query types.</p></dd>
<dt><a name="7"><b class="cmd">::dns::status</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the status flag. For a successfully completed query this will be
  <em>ok</em>. May be <em>error</em> or <em>timeout</em> or <em>eof</em>.
  See also <b class="cmd">::dns::error</b></p></dd>
<dt><a name="8"><b class="cmd">::dns::error</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the error message provided for requests whose status is <em>error</em>.
  If there is no error message then an empty string is returned.</p></dd>
<dt><a name="9"><b class="cmd">::dns::reset</b> <i class="arg">token</i></a></dt>
<dd><p>Reset or cancel a DNS query.</p></dd>
<dt><a name="10"><b class="cmd">::dns::wait</b> <i class="arg">token</i></a></dt>
<dd><p>Wait for a DNS query to complete and return the status upon completion.</p></dd>
<dt><a name="11"><b class="cmd">::dns::cleanup</b> <i class="arg">token</i></a></dt>
<dd><p>Remove all state variables associated with the request.</p></dd>
<dt><a name="12"><b class="cmd">::dns::nameservers</b></a></dt>
<dd><p>Attempts to return a list of the nameservers currently configured
for the users system. On a unix machine this parses the
/etc/resolv.conf file for nameservers (if it exists) and on Windows
systems we examine certain parts of the registry. If no nameserver can
be found then the loopback address (127.0.0.1) is used as a default.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<pre class="example">
% set tok [dns::resolve www.tcl.tk]
::dns::1
% dns::status $tok
ok
% dns::address $tok
199.175.6.239
% dns::name $tok
www.tcl.tk
% dns::cleanup $tok
</pre>
<p>Using DNS URIs as queries:</p>
<pre class="example">
% set tok [dns::resolve &quot;dns:tcl.tk;type=MX&quot;]
% set tok [dns::resolve &quot;dns://l.root-servers.net/www.tcl.tk&quot;]
</pre>
<p>Reverse address lookup:</p>
<pre class="example">
% set tok [dns::resolve 127.0.0.1]
::dns::1
% dns::name $tok
localhost
% dns::cleanup $tok
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Mockapetris, P., &quot;Domain Names - Concepts and Facilities&quot;,
    RFC 1034, November 1987.
    (<a href="http://www.ietf.org/rfc/rfc1034.txt">http://www.ietf.org/rfc/rfc1034.txt</a>)</p></li>
<li><p>Mockapetris, P., &quot;Domain Names - Implementation and Specification&quot;,
    RFC 1035, November 1087.
    (<a href="http://www.ietf.org/rfc/rfc1035.txt">http://www.ietf.org/rfc/rfc1035.txt</a>)</p></li>
<li><p>Thompson, S. and Huitema, C., &quot;DNS Extensions to support IP version 6&quot;,
    RFC 1886, December 1995.
    (<a href="http://www.ietf.org/rfc/rfc1886.txt">http://www.ietf.org/rfc/rfc1886.txt</a>)</p></li>
<li><p>Josefsson, S., &quot;Domain Name System Uniform Resource Identifiers&quot;,
    Internet-Draft, October 2003,
    (<a href="http://www.ietf.org/internet-drafts/draft-josefsson-dns-url-09.txt">http://www.ietf.org/internet-drafts/draft-josefsson-dns-url-09.txt</a>)</p></li>
<li><p>Gulbrandsen, A., Vixie, P. and Esibov, L.,
    &quot;A DNS RR for specifying the location of services (DNS SRV)&quot;,
    RFC 2782, February 2000,
    (<a href="http://www.ietf.org/rfc/rfc2782.txt">http://www.ietf.org/rfc/rfc2782.txt</a>)</p></li>
<li><p>Ohta, M. &quot;Incremental Zone Transfer in DNS&quot;,
    RFC 1995, August 1996,
    (<a href="http://www.ietf.org/rfc/rfc1995.txt">http://www.ietf.org/rfc/rfc1995.txt</a>)</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>dns</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>resolver(5)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key550">DNS</a>, <a href="../../../../index.html#key552">domain name service</a>, <a href="../../../../index.html#key553">resolver</a>, <a href="../../../../index.html#key554">rfc 1034</a>, <a href="../../../../index.html#key549">rfc 1035</a>, <a href="../../../../index.html#key551">rfc 1886</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Pat Thoyts</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/dns/tcllib_ip.html.












































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>tcllib_ip - Domain Name Service</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/dns/tcllib_ip.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004, Pat Thoyts   -- Copyright &copy; 2005 Aamer Akhter &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcllib_ip.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcllib_ip(n) 1.3 tcllib &quot;Domain Name Service&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcllib_ip - IPv4 and IPv6 address manipulation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">AUTHORS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">ip <span class="opt">?1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ip::version</b> <i class="arg">address</i></a></li>
<li><a href="#2"><b class="cmd">::ip::is</b> <i class="arg">class</i> <i class="arg">address</i></a></li>
<li><a href="#3"><b class="cmd">::ip::equal</b> <i class="arg">address</i> <i class="arg">address</i></a></li>
<li><a href="#4"><b class="cmd">::ip::normalize</b> <i class="arg">address</i></a></li>
<li><a href="#5"><b class="cmd">::ip::contract</b> <i class="arg">address</i></a></li>
<li><a href="#6"><b class="cmd">::ip::prefix</b> <i class="arg">address</i></a></li>
<li><a href="#7"><b class="cmd">::ip::type</b> <i class="arg">address</i></a></li>
<li><a href="#8"><b class="cmd">::ip::mask</b> <i class="arg">address</i></a></li>
<li><a href="#9"><b class="cmd">::ip::prefixToNative</b> <i class="arg">prefix</i></a></li>
<li><a href="#10"><b class="cmd">::ip::nativeToPrefix</b> <i class="arg">nativeList</i>|<i class="arg">native</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></li>
<li><a href="#11"><b class="cmd">::ip::intToString</b> <i class="arg">number</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></li>
<li><a href="#12"><b class="cmd">::ip::toInteger</b> <i class="arg">ipaddr</i></a></li>
<li><a href="#13"><b class="cmd">::ip::toHex</b> <i class="arg">ipaddr</i></a></li>
<li><a href="#14"><b class="cmd">::ip::maskToInt</b> <i class="arg">ipmask</i></a></li>
<li><a href="#15"><b class="cmd">::ip::broadcastAddress</b> <i class="arg">prefix</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></li>
<li><a href="#16"><b class="cmd">::ip::maskToLength</b> <i class="arg">dottedMask</i>|<i class="arg">integerMask</i>|<i class="arg">hexMask</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></li>
<li><a href="#17"><b class="cmd">::ip::lengthToMask</b> <i class="arg">maskLength</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></li>
<li><a href="#18"><b class="cmd">::ip::nextNet</b> <i class="arg">ipaddr</i> <i class="arg">ipmask</i> <span class="opt">?<i class="arg">count</i>?</span> <span class="opt">?<b class="option">-ipv4</b>?</span></a></li>
<li><a href="#19"><b class="cmd">::ip::isOverlap</b> <i class="arg">prefix</i> <i class="arg">prefix</i>...</a></li>
<li><a href="#20"><b class="cmd">::ip::isOverlapNative</b> <span class="opt">?<b class="option">-all</b>?</span> <span class="opt">?<b class="option">-inline</b>?</span> <span class="opt">?<b class="option">-ipv4</b>?</span> <i class="arg">hexipaddr</i> <i class="arg">hexipmask</i> <i class="arg">hexiplist</i></a></li>
<li><a href="#21"><b class="cmd">::ip::ipToLayer2Multicast</b> <i class="arg">ipaddr</i></a></li>
<li><a href="#22"><b class="cmd">::ip::ipHostFromPrefix</b> <i class="arg">prefix</i> <span class="opt">?<b class="option">-exclude</b> <i class="arg">prefixExcludeList</i>?</span></a></li>
<li><a href="#23"><b class="cmd">::ip::reduceToAggregates</b> <i class="arg">prefixlist</i></a></li>
<li><a href="#24"><b class="cmd">::ip::longestPrefixMatch</b> <i class="arg">ipaddr</i> <i class="arg">prefixlist</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></li>
<li><a href="#25"><b class="cmd">::ip::collapse</b> <i class="arg">prefixlist</i></a></li>
<li><a href="#26"><b class="cmd">::ip::subtract</b> <i class="arg">prefixlist</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a set of commands to help in parsing, displaying
and comparing internet addresses. The package can handle both IPv4 (1)
and IPv6 (2) address types.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ip::version</b> <i class="arg">address</i></a></dt>
<dd><p>Returns the protocol version of the address (4 or 6) or 0 if the
address is neither IPv4 or IPv6.</p></dd>
<dt><a name="2"><b class="cmd">::ip::is</b> <i class="arg">class</i> <i class="arg">address</i></a></dt>
<dd><p>Returns true if the address is a member of the given protocol
class. The class parameter may be either <i class="arg">ipv4</i> or <i class="arg">ipv6</i>
This is effectively a boolean equivalent of the <b class="cmd">version</b>
command. The <i class="arg">class</i> argument may be shortened to <i class="arg">4</i> or
<i class="arg">6</i>.</p></dd>
<dt><a name="3"><b class="cmd">::ip::equal</b> <i class="arg">address</i> <i class="arg">address</i></a></dt>
<dd><p>Compare two address specifications for equivalence. The arguments are
normalized and the address prefix determined (if a mask is
supplied). The normalized addresses are then compared bit-by-bit and
the procedure returns true if they match.</p></dd>
<dt><a name="4"><b class="cmd">::ip::normalize</b> <i class="arg">address</i></a></dt>
<dd><p>Convert an IPv4 or IPv6 address into a fully expanded version. There
are various shorthand ways to write internet addresses, missing out
redundant parts or digts.. This procedure is the opposite of 
<b class="cmd">contract</b>.</p></dd>
<dt><a name="5"><b class="cmd">::ip::contract</b> <i class="arg">address</i></a></dt>
<dd><p>Convert a <b class="cmd">normalize</b>d internet address into a more compact form
suitable for displaying to users.</p></dd>
<dt><a name="6"><b class="cmd">::ip::prefix</b> <i class="arg">address</i></a></dt>
<dd><p>Returns the address prefix generated by masking the address part with
the mask if provided. If there is no mask then it is equivalent to
calling <b class="cmd">normalize</b></p></dd>
<dt><a name="7"><b class="cmd">::ip::type</b> <i class="arg">address</i></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">::ip::mask</b> <i class="arg">address</i></a></dt>
<dd><p>If the address supplied includes a mask then this is returned
otherwise returns an empty string.</p></dd>
<dt><a name="9"><b class="cmd">::ip::prefixToNative</b> <i class="arg">prefix</i></a></dt>
<dd><p>This command converts the string <i class="arg">prefix</i> from dotted form
(&lt;ipaddr&gt;/&lt;mask&gt; format) to native (hex) form. Returns a list
containing two elements, ipaddress and mask, in this order, in
hexadecimal notation.</p>
<pre class="example">
   % ip::prefixToNative 1.1.1.0/24
   0x01010100 0xffffff00
</pre>
</dd>
<dt><a name="10"><b class="cmd">::ip::nativeToPrefix</b> <i class="arg">nativeList</i>|<i class="arg">native</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></dt>
<dd><p>This command converts from native (hex) form to dotted form.
It is the complement of <b class="cmd">::ip::prefixToNative</b>.</p>
<dl class="arguments">
<dt>list <i class="arg">nativeList</i> (in)</dt>
<dd><p>List of several ip addresses in native form. The native form is a list
as returned by <b class="cmd">::ip::prefixToNative</b>.</p></dd>
<dt>list <i class="arg">native</i> (in)</dt>
<dd><p>A list as returned by <b class="cmd">::ip::prefixToNative</b>.</p></dd>
</dl>
<p>The command returns a list of addresses in dotted form if it was
called with a list of addresses. Otherwise a single address in dotted
form is returned.</p>
<pre class="example">
   % ip::nativeToPrefix {0x01010100 0xffffff00} -ipv4
   1.1.1.0/24
</pre>
</dd>
<dt><a name="11"><b class="cmd">::ip::intToString</b> <i class="arg">number</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></dt>
<dd><p>This command converts from an ip address specified as integer number
to dotted form.</p>
<pre class="example">
       ip::intToString 4294967295
       255.255.255.255
</pre>
</dd>
<dt><a name="12"><b class="cmd">::ip::toInteger</b> <i class="arg">ipaddr</i></a></dt>
<dd><p>This command converts a dotted form ip into an integer number.</p>
<pre class="example">
   % ::ip::toInteger 1.1.1.0
   16843008
</pre>
</dd>
<dt><a name="13"><b class="cmd">::ip::toHex</b> <i class="arg">ipaddr</i></a></dt>
<dd><p>This command converts dotted form ip into a hexadecimal number.</p>
<pre class="example">
   % ::ip::toHex 1.1.1.0
   0x01010100
</pre>
</dd>
<dt><a name="14"><b class="cmd">::ip::maskToInt</b> <i class="arg">ipmask</i></a></dt>
<dd><p>This command convert an ipmask in either dotted (255.255.255.0) form
or mask length form (24) into an integer number.</p>
<pre class="example">
   ::ip::maskToInt 24
   4294967040
</pre>
</dd>
<dt><a name="15"><b class="cmd">::ip::broadcastAddress</b> <i class="arg">prefix</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></dt>
<dd><p>This commands returns a broadcast address in dotted form for the given
route <i class="arg">prefix</i>, either in the form &quot;addr/mask&quot;, or in native
form. The result is in dotted form.</p>
<pre class="example">
   ::ip::broadcastAddress 1.1.1.0/24
   1.1.1.255
   ::ip::broadcastAddress {0x01010100 0xffffff00}
   0x010101ff
</pre>
</dd>
<dt><a name="16"><b class="cmd">::ip::maskToLength</b> <i class="arg">dottedMask</i>|<i class="arg">integerMask</i>|<i class="arg">hexMask</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></dt>
<dd><p>This command converts the dotted or integer form of an ipmask to
the mask length form.</p>
<pre class="example">
   ::ip::maskToLength 0xffffff00 -ipv4
   24
   % ::ip::maskToLength 255.255.255.0
   24
</pre>
</dd>
<dt><a name="17"><b class="cmd">::ip::lengthToMask</b> <i class="arg">maskLength</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></dt>
<dd><p>This command converts an ipmask in mask length form to its dotted
form.</p>
<pre class="example">
   ::ip::lengthToMask 24
   255.255.255.0
</pre>
</dd>
<dt><a name="18"><b class="cmd">::ip::nextNet</b> <i class="arg">ipaddr</i> <i class="arg">ipmask</i> <span class="opt">?<i class="arg">count</i>?</span> <span class="opt">?<b class="option">-ipv4</b>?</span></a></dt>
<dd><p>This command returns an ipaddress in the same position in the
<i class="arg">count</i> next network. The default value for <i class="arg">count</i> is
<b class="const">1</b>.</p>
<p>The address can be specified as either integer number or in dotted
form. The mask can be specified as either integer number, dotted form,
or mask length form.</p>
<p>The result is in hex form.</p></dd>
<dt><a name="19"><b class="cmd">::ip::isOverlap</b> <i class="arg">prefix</i> <i class="arg">prefix</i>...</a></dt>
<dd><p>This command checks if the given ip prefixes overlap.  All arguments
are in dotted &quot;addr/mask&quot; form. All arguments after the first prefix
are compared against the first prefix. The result is a boolean
value. It is true if an overlap was found for any of the prefixes.</p>
<pre class="example">
  % ::ip::isOverlap 1.1.1.0/24 2.1.0.1/32
  0
  ::ip::isOverlap 1.1.1.0/24 2.1.0.1/32 1.1.1.1/32
  1
</pre>
</dd>
<dt><a name="20"><b class="cmd">::ip::isOverlapNative</b> <span class="opt">?<b class="option">-all</b>?</span> <span class="opt">?<b class="option">-inline</b>?</span> <span class="opt">?<b class="option">-ipv4</b>?</span> <i class="arg">hexipaddr</i> <i class="arg">hexipmask</i> <i class="arg">hexiplist</i></a></dt>
<dd><p>This command is similar to <b class="cmd">::ip::isOverlap</b>, however the
arguments are in the native form, and the form of the result is under
greater control of the caller.
If the option <b class="option">-all</b> is specified it checks all addresses for
overlap, not only until the first one is found.
If the option <b class="option">-inline</b> is specified the command returns the
overlapping prefix instead of index values.</p>
<p>The result of the command is, depending on the specified options,</p>
<dl class="definitions">
<dt>no options</dt>
<dd><p>The index of the first overlap found, or 0 if there is none.</p></dd>
<dt>-all</dt>
<dd><p>A list containing the indices of all overlaps found, or an empty list
if there are none.</p></dd>
<dt>-inline</dt>
<dd><p>The first overlapping prefix, or an empoty string if there is none.</p></dd>
<dt>-all -inline</dt>
<dd><p>A list containing the prefixes of all overlaps found, or an empty list
if there are none.</p></dd>
</dl>
<pre class="example">
  % ::ip::isOverlapNative 0x01010100 0xffffff00 {{0x02010001 0xffffffff}}
  0
  % ::ip::isOverlapNative 0x01010100 0xffffff00 {{0x02010001 0xffffffff} {0x01010101 0xffffffff}}
  2
</pre>
</dd>
<dt><a name="21"><b class="cmd">::ip::ipToLayer2Multicast</b> <i class="arg">ipaddr</i></a></dt>
<dd><p>This command an converts ipv4 address in dotted form into a layer 2
multicast address, also in dotted form.</p>
<pre class="example">
  % ::ip::ipToLayer2Multicast 224.0.0.2
  01.00.5e.00.00.02
</pre>
</dd>
<dt><a name="22"><b class="cmd">::ip::ipHostFromPrefix</b> <i class="arg">prefix</i> <span class="opt">?<b class="option">-exclude</b> <i class="arg">prefixExcludeList</i>?</span></a></dt>
<dd><p>This command returns a host address from a prefix in the form
&quot;ipaddr/masklen&quot;, also making sure that the result is not an address
found in the <i class="arg">prefixExcludeList</i>.
The result is an ip address in dotted form.</p>
<pre class="example">
  %::ip::ipHostFromPrefix  1.1.1.5/24
  1.1.1.1
  %::ip::ipHostFromPrefix  1.1.1.1/32
  1.1.1.1
</pre>
</dd>
<dt><a name="23"><b class="cmd">::ip::reduceToAggregates</b> <i class="arg">prefixlist</i></a></dt>
<dd><p>This command finds nets that overlap and filters out the more specific
nets. The prefixes are in either addr/mask form or in native format.
The result is a list containing the non-overlapping ip prefixes from
the input.</p>
<pre class="example">
  % ::ip::reduceToAggregates {1.1.1.0/24 1.1.0.0/8  2.1.1.0/24 1.1.1.1/32 }
  1.0.0.0/8 2.1.1.0/24
</pre>
</dd>
<dt><a name="24"><b class="cmd">::ip::longestPrefixMatch</b> <i class="arg">ipaddr</i> <i class="arg">prefixlist</i> <span class="opt">?<b class="option">-ipv4</b>?</span></a></dt>
<dd><p>This command finds longest prefix match from set of prefixes, given a
specific host address. The prefixes in the list are in either native
or dotted form, whereas the host address is in either ipprefix format,
dotted form, or integer form.
The result is the prefix which is the most specific match to the host
address.</p>
<pre class="example">
  % ::ip::longestPrefixMatch 1.1.1.1 {1.1.1.0/24 1.0.0.0/8  2.1.1.0/24 1.1.1.0/28 }
  1.1.1.0/28
</pre>
</dd>
<dt><a name="25"><b class="cmd">::ip::collapse</b> <i class="arg">prefixlist</i></a></dt>
<dd><p>This commands takes a list of prefixes and returns a list prefixes
with the largest possible subnet masks covering the input, in this
manner collapsing adjacent prefixes into larger ranges.</p>
<p>This is different from <b class="cmd">::ip::reduceToAggregates</b> in that
the latter only removes specific nets from a list when they are
covered by other elements of the input whereas this command actively
merges nets into larger ranges when they are adjacent to each other.</p>
<pre class="example">
% ::ip::collapse {1.2.2.0/24 1.2.3.0/24}
1.2.2.0/23
</pre>
</dd>
<dt><a name="26"><b class="cmd">::ip::subtract</b> <i class="arg">prefixlist</i></a></dt>
<dd><p>This command takes a list of prefixes, some of which are prefixed by a
dash. These latter <i class="term">negative</i> prefixes are used to punch holes
into the ranges described by the other, <i class="term">positive</i>,
prefixes. I.e. the negative prefixes are subtracted frrom the positive
ones, resulting in a larger list of describes describing the covered
ranges only as positives.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<pre class="example">
% ip::version ::1
6
% ip::version 127.0.0.1
4
</pre>
<pre class="example">
% ip::normalize 127/8
127.0.0.0/8
% ip::contract 192.168.0.0
192.168
%
% ip::normalize fec0::1
fec0:0000:0000:0000:0000:0000:0000:0001
% ip::contract fec0:0000:0000:0000:0000:0000:0000:0001
fec0::1
</pre>
<pre class="example">
% ip::equal 192.168.0.4/16 192.168.0.0/16
1
% ip::equal fec0::1/10 fec0::fe01/10
1
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Postel, J. &quot;Internet Protocol.&quot; RFC 791,  September 1981,
    (<a href="http://www.ietf.org/rfc/rfc791.txt">http://www.ietf.org/rfc/rfc791.txt</a>)</p></li>
<li><p>Hinden, R. and Deering, S.,
    &quot;Internet Protocol Version 6 (IPv6) Addressing Architecture&quot;,
    RFC 3513, April 2003
    (<a href="http://www.ietf.org/rfc/rfc3513.txt">http://www.ietf.org/rfc/rfc3513.txt</a>)</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>dns</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>inet(3), ip(7), ipv6(7)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key401">internet address</a>, <a href="../../../../index.html#key398">ip</a>, <a href="../../../../index.html#key400">ipv4</a>, <a href="../../../../index.html#key397">ipv6</a>, <a href="../../../../index.html#key399">rfc 3513</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004, Pat Thoyts<br>
Copyright &copy; 2005 Aamer Akhter &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/docstrip/docstrip.html.













































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>docstrip - Literate programming tool</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/docstrip/docstrip.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003–2010 Lars Hellstr&ouml;m &lt;Lars dot Hellstrom at residenset dot net&gt;
   -->
<! -- CVS: $Id$ docstrip.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">docstrip(n) 1.2 tcllib &quot;Literate programming tool&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>docstrip - Docstrip style source code extraction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">File format</a></li>
<li class="section"><a href="#section3">Commands</a></li>
<li class="section"><a href="#section4">Document structure</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">docstrip <span class="opt">?1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">docstrip::extract</b> <i class="arg">text</i> <i class="arg">terminals</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#2"><b class="cmd">docstrip::sourcefrom</b> <i class="arg">filename</i> <i class="arg">terminals</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><b class="syscmd">Docstrip</b> is a tool created to support a brand of Literate
Programming. It is most common in the (La)TeX community, where it
is being used for pretty much everything from the LaTeX core and up,
but there is nothing about <b class="syscmd">docstrip</b> which prevents using it
for other types of software.</p>
<p>In short, the basic principle of literate programming is that program
source should primarily be written and structured to suit the
developers (and advanced users who want to peek &quot;under the hood&quot;), not
to suit the whims of a compiler or corresponding source code consumer.
This means literate sources often need some kind of &quot;translation&quot; to an
illiterate form that dumb software can understand.
The <b class="package">docstrip</b> Tcl package handles this translation.</p>
<p>Even for those who do not whole-hartedly subscribe to the philosophy
behind literate programming, <b class="syscmd">docstrip</b> can bring greater
clarity to in particular:</p>
<ul class="itemized">
  
<li><p>programs employing non-obvious mathematics</p></li>
<li><p>projects where separate pieces of code, perhaps in
    different languages, need to be closely coordinated.</p></li>
</ul>
<p>The first is by providing access to much more powerful typographical
features for source code comments than are possible in plain text.
The second is because all the separate pieces of code can be kept
next to each other in the same source file.</p>
<p>The way it works is that the programmer edits directly only one or
several &quot;master&quot; source code files, from which <b class="syscmd">docstrip</b>
generates the more traditional &quot;source&quot; files compilers or the like
would expect. The master sources typically contain a large amount of
documentation of the code, sometimes even in places where the code
consumers would not allow any comments. The etymology of &quot;docstrip&quot;
is that this <em>doc</em>umentation was <em>strip</em>ped away (although
&quot;code extraction&quot; might be a better description, as it has always
been a matter of copying selected pieces of the master source rather
than deleting text from it).
The <b class="package">docstrip</b> Tcl package contains a reimplementation of
the basic extraction functionality from the <b class="syscmd">docstrip</b>
program, and thus makes it possible for a Tcl interpreter to read
and interpret the master source files directly.</p>
<p>Readers who are not previously familiar with <b class="syscmd">docstrip</b> but
want to know more about it may consult the following sources.</p>
<ol class="enumerated">
<li><p><em>The tclldoc package and class</em>,
  <a href="http://ctan.org/tex-archive/macros/latex/contrib/tclldoc/">http://ctan.org/tex-archive/macros/latex/contrib/tclldoc/</a>.</p></li>
<li><p><em>The DocStrip utility</em>,
  <a href="http://ctan.org/tex-archive/macros/latex/base/docstrip.dtx">http://ctan.org/tex-archive/macros/latex/base/docstrip.dtx</a>.</p></li>
<li><p><em>The doc and shortvrb Packages</em>,
  <a href="http://ctan.org/tex-archive/macros/latex/base/doc.dtx">http://ctan.org/tex-archive/macros/latex/base/doc.dtx</a>.</p></li>
<li><p>Chapter 14 of
  <em>The LaTeX Companion</em> (second edition),
  Addison-Wesley, 2004; ISBN 0-201-36299-6.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">File format</a></h2>
<p>The basic unit <b class="syscmd">docstrip</b> operates on are the <em>lines</em> of
a master source file. Extraction consists of selecting some of these
lines to be copied from input text to output text. The basic
distinction is that between <em>code lines</em> (which are copied and
do not begin with a percent character) and <em>comment lines</em>
(which begin with a percent character and are not copied).</p>
<pre class="example">
   docstrip::extract [join {
     {% comment}
     {% more comment !&quot;#$%&amp;/(}
     {some command}
     { % blah $blah &quot;Not a comment.&quot;}
     {% abc; this is comment}
     {# def; this is code}
     {ghi}
     {% jkl}
   } \n] {}
</pre>
<p>returns the same sequence of lines as</p>
<pre class="example">
   join {
     {some command}
     { % blah $blah &quot;Not a comment.&quot;}
     {# def; this is code}
     {ghi} &quot;&quot;
   } \n
</pre>
<p>It does not matter to <b class="syscmd">docstrip</b> what format is used for the
documentation in the comment lines, but in order to do better than
plain text comments, one typically uses some markup language. Most
commonly LaTeX is used, as that is a very established standard and
also provides the best support for mathematical formulae, but the
<b class="package">docstrip::util</b> package also gives some support for
<i class="term"><a href="../../../../index.html#key51">doctools</a></i>-like markup.</p>
<p>Besides the basic code and comment lines, there are also
<em>guard lines</em>, which begin with the two characters '%&lt;', and
<em>meta-comment lines</em>, which begin with the two characters
'%%'. Within guard lines there is furthermore the distinction between
<em>verbatim guard lines</em>, which begin with '%&lt;&lt;', and ordinary
guard lines, where the '%&lt;' is not followed by another '&lt;'. The last
category is by far the most common.</p>
<p>Ordinary guard lines conditions extraction of the code line(s) they
guard by the value of a boolean expression; the guarded block of
code lines will only be included if the expression evaluates to true.
The syntax of an ordinary guard line is one of</p>
<pre class="example">
    '%' '&lt;' STARSLASH EXPRESSION '&gt;'
    '%' '&lt;' PLUSMINUS EXPRESSION '&gt;' CODE
</pre>
<p>where</p>
<pre class="example">
    STARSLASH  ::=  '*' | '/'
    PLUSMINUS  ::=  | '+' | '-'
    EXPRESSION ::= SECONDARY | SECONDARY ',' EXPRESSION
                 | SECONDARY '|' EXPRESSION
    SECONDARY  ::= PRIMARY | PRIMARY '&amp;' SECONDARY
    PRIMARY    ::= TERMINAL | '!' PRIMARY | '(' EXPRESSION ')'
    CODE       ::= { any character except end-of-line }
</pre>
<p>Comma and vertical bar both denote 'or'. Ampersand denotes 'and'.
Exclamation mark denotes 'not'. A TERMINAL can be any nonempty string
of characters not containing '&gt;', '&amp;', '|', comma, '(', or ')',
although the <b class="syscmd">docstrip</b> manual is a bit restrictive and only
guarantees proper operation for strings of letters (although even
the LaTeX core sources make heavy use also of digits in TERMINALs).
The second argument of <b class="cmd">docstrip::extract</b> is the list of those
TERMINALs that should count as having the value 'true'; all other
TERMINALs count as being 'false' when guard expressions are evaluated.</p>
<p>In the case of a '%&lt;*<em>EXPRESSION</em>&gt;' guard, the lines guarded are
all lines up to the next '%&lt;/<em>EXPRESSION</em>&gt;' guard with the same
<em>EXPRESSION</em> (compared as strings). The blocks of code delimited
by such '*' and '/' guard lines must be properly nested.</p>
<pre class="example">
   set text [join {
      {begin}
      {%&lt;*foo&gt;}
      {1}
      {%&lt;*bar&gt;}
      {2}
      {%&lt;/bar&gt;}
      {%&lt;*!bar&gt;}
      {3}
      {%&lt;/!bar&gt;}
      {4}
      {%&lt;/foo&gt;}
      {5}
      {%&lt;*bar&gt;}
      {6}
      {%&lt;/bar&gt;}
      {end}
   } \n]
   set res [docstrip::extract $text foo]
   append res [docstrip::extract $text {foo bar}]
   append res [docstrip::extract $text bar]
</pre>
<p>sets $res to the result of</p>
<pre class="example">
   join {
      {begin}
      {1}
      {3}
      {4}
      {5}
      {end}
      {begin}
      {1}
      {2}
      {4}
      {5}
      {6}
      {end}
      {begin}
      {5}
      {6}
      {end} &quot;&quot;
   } \n
</pre>
<p>In guard lines without a '*', '/', '+', or '-' modifier after the
'%&lt;', the guard applies only to the CODE following the '&gt;' on that
single line. A '+' modifier is equivalent to no modifier. A '-'
modifier is like the case with no modifier, but the expression is
implicitly negated, i.e., the CODE of a '%&lt;-' guard line is only
included if the expression evaluates to false.</p>
<p>Metacomment lines are &quot;comment lines which should not be stripped
away&quot;, but be extracted like code lines; these are sometimes used for
copyright notices and similar material. The '%%' prefix is however
not kept, but substituted by the current <b class="option">-metaprefix</b>, which
is customarily set to some &quot;comment until end of line&quot; character (or
character sequence) of the language of the code being extracted.</p>
<pre class="example">
   set text [join {
      {begin}
      {%&lt;foo&gt; foo}
      {%&lt;+foo&gt;plusfoo}
      {%&lt;-foo&gt;minusfoo}
      {middle}
      {%% some metacomment}
      {%&lt;*foo&gt;}
      {%%another metacomment}
      {%&lt;/foo&gt;}
      {end}
   } \n]
   set res [docstrip::extract $text foo -metaprefix {# }]
   append res [docstrip::extract $text bar -metaprefix {#}]
</pre>
<p>sets $res to the result of</p>
<pre class="example">
   join {
      {begin}
      { foo}
      {plusfoo}
      {middle}
      {#  some metacomment}
      {# another metacomment}
      {end}
      {begin}
      {minusfoo}
      {middle}
      {# some metacomment}
      {end} &quot;&quot;
   } \n
</pre>
<p>Verbatim guards can be used to force code line
interpretation of a block of lines even if some of them happen to look
like any other type of lines to docstrip. A verbatim guard has the
form '%&lt;&lt;<em>END-TAG</em>' and the verbatim block is terminated by the
first line that is exactly '%<em>END-TAG</em>'.</p>
<pre class="example">
   set text [join {
      {begin}
      {%&lt;*myblock&gt;}
      {some stupid()}
      {   #computer&lt;program&gt;}
      {%&lt;&lt;QQQ-98765}
      {% These three lines are copied verbatim (including percents}
      {%% even if -metaprefix is something different than %%).}
      {%&lt;/myblock&gt;}
      {%QQQ-98765}
      {   using*strange@programming&lt;language&gt;}
      {%&lt;/myblock&gt;}
      {end}
   } \n]
   set res [docstrip::extract $text myblock -metaprefix {# }]
   append res [docstrip::extract $text {}]
</pre>
<p>sets $res to the result of</p>
<pre class="example">
   join {
      {begin}
      {some stupid()}
      {   #computer&lt;program&gt;}
      {% These three lines are copied verbatim (including percents}
      {%% even if -metaprefix is something different than %%).}
      {%&lt;/myblock&gt;}
      {   using*strange@programming&lt;language&gt;}
      {end}
      {begin}
      {end} &quot;&quot;
   } \n
</pre>
<p>The processing of verbatim guards takes place also inside blocks of
lines which due to some outer block guard will not be copied.</p>
<p>The final piece of <b class="syscmd">docstrip</b> syntax is that extraction
stops at a line that is exactly &quot;\endinput&quot;; this is often used to
avoid copying random whitespace at the end of a file. In the unlikely
case that one wants such a code line, one can protect it with a
verbatim guard.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Commands</a></h2>
<p>The package defines two commands.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">docstrip::extract</b> <i class="arg">text</i> <i class="arg">terminals</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>The <b class="cmd">extract</b> command docstrips the <i class="arg">text</i> and returns the
  extracted lines of code, as a string with each line terminated with
  a newline. The <i class="arg">terminals</i> is the list of those guard
  expression terminals which should evaluate to true.
  The available options are:</p>
<dl class="options">
  
<dt><b class="option">-annotate</b> <i class="arg">lines</i></dt>
<dd><p>Requests the specified number of lines of annotation to follow
    each extracted line in the result. Defaults to 0. Annotation lines
    are mostly useful when the extracted lines are to undergo some
    further transformation. A first annotation line is a list of three
    elements: line type, prefix removed in extraction, and prefix
    inserted in extraction. The line type is one of: 'V' (verbatim),
    'M' (metacomment), '+' (+ or no modifier guard line), '-' (-
    modifier guard line), '.' (normal line). A second annotation line
    is the source line number. A third annotation line is the current
    stack of block guards. Requesting more than three lines of
    annotation is currently not supported.</p></dd>
<dt><b class="option">-metaprefix</b> <i class="arg">string</i></dt>
<dd><p>The string by which the '%%' prefix of a metacomment line will
    be replaced. Defaults to '%%'. For Tcl code this would typically
    be '#'.</p></dd>
<dt><b class="option">-onerror</b> <i class="arg">keyword</i></dt>
<dd><p>Controls what will be done when a format error in the <i class="arg">text</i>
    being processed is detected. The settings are:</p>
<dl class="definitions">
    
<dt><b class="const">ignore</b></dt>
<dd><p>Just ignore the error; continue as if nothing happened.</p></dd>
<dt><b class="const">puts</b></dt>
<dd><p>Write an error message to <b class="const">stderr</b>, then continue
      processing.</p></dd>
<dt><b class="const">throw</b></dt>
<dd><p>Throw an error. The <b class="option">-errorcode</b> is set to a list whose
      first element is <b class="const">DOCSTRIP</b>, second element is the
      type of error, and third element is the line number where
      the error is detected. This is the default.</p></dd>
</dl></dd>
<dt><b class="option">-trimlines</b> <i class="arg">boolean</i></dt>
<dd><p>Controls whether <em>spaces</em> at the end of a line should be
    trimmed away before the line is processed. Defaults to true.</p></dd>
</dl>
<p>It should be remarked that the <i class="arg">terminals</i> are often called
  &quot;options&quot; in the context of the <b class="syscmd">docstrip</b> program, since
  these specify which optional code fragments should be included.</p></dd>
<dt><a name="2"><b class="cmd">docstrip::sourcefrom</b> <i class="arg">filename</i> <i class="arg">terminals</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>The <b class="cmd">sourcefrom</b> command is a docstripping emulation of
  <b class="cmd"><a href="../../../../index.html#key388">source</a></b>. It opens the file <i class="arg">filename</i>, reads it, closes it,
  docstrips the contents as specified by the <i class="arg">terminals</i>, and
  evaluates the result in the local context of the caller, during
  which time the <b class="cmd"><a href="../../../../index.html#key72">info</a></b> <b class="method">script</b> value will be the
  <i class="arg">filename</i>. The options are passed on to <b class="cmd">fconfigure</b> to
  configure the file before its contents are read. The
  <b class="option">-metaprefix</b> is set to '#', all other <b class="cmd">extract</b>
  options have their default values.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Document structure</a></h2>
<p>The file format (as described above) determines whether a master
source code file can be processed correctly by <b class="syscmd">docstrip</b>,
but the usefulness of the format is to no little part also dependent
on that the code and comment lines together constitute a well-formed
document.</p>
<p>For a document format that does not require any non-Tcl software, see
the <b class="cmd">ddt2man</b> command in the <b class="package">docstrip::util</b> package. It
is suggested that files employing that document format are given the
suffix &quot;<b class="file">.ddt</b>&quot;, to distinguish them from the more traditional
LaTeX-based &quot;<b class="file">.dtx</b>&quot; files.</p>
<p>Master source files with &quot;<b class="file">.dtx</b>&quot; extension are usually set up so
that they can be typeset directly by <b class="syscmd"><a href="../../../../index.html#key167">latex</a></b> without any
support from other files. This is achieved by beginning the file
with the lines</p>
<pre class="example">
   % \iffalse
   %&lt;*driver&gt;
   \documentclass{tclldoc}
   \begin{document}
   \DocInput{<em>filename.dtx</em>}
   \end{document}
   %&lt;/driver&gt;
   % \fi
</pre>
<p>or some variation thereof. The trick is that the file gets read twice.
With normal LaTeX reading rules, the first two lines are comments and
therefore ignored. The third line is the document preamble, the fourth
line begins the document body, and the sixth line ends the document,
so LaTeX stops there — non-comments below that point in
the file are never subjected to the normal LaTeX reading rules. Before
that, however, the \DocInput command on the fifth line is processed,
and that does two things: it changes the interpretation of '%' from
&quot;comment&quot; to &quot;ignored&quot;, and it inputs the file specified in the
argument (which is normally the name of the file the command is in).
It is this second time that the file is being read that the comments
and code in it are typeset.</p>
<p>The function of the \iffalse ... \fi is to skip lines two to seven
on this second time through; this is similar to the &quot;if 0 { ... }&quot;
idiom for block comments in Tcl code, and it is needed here because
(amongst other things) the \documentclass command may only be
executed once. The function of the &lt;driver&gt; guards is to prevent this
short piece of LaTeX code from being extracted by <b class="syscmd">docstrip</b>.
The total effect is that the file can function both as a LaTeX
document and as a <b class="syscmd">docstrip</b> master source code file.</p>
<p>It is not necessary to use the tclldoc document class, but that does
provide a number of features that are convenient for &quot;<b class="file">.dtx</b>&quot;
files containing Tcl code. More information on this matter can be
found in the references above.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docstrip_util.html">docstrip_util</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key389">.dtx</a>, <a href="../../../../index.html#key390">LaTeX</a>, <a href="../../../../index.html#key386">docstrip</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key387">literate programming</a>, <a href="../../../../index.html#key388">source</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003–2010 Lars Hellstr&ouml;m &lt;Lars dot Hellstrom at residenset dot net&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/docstrip/docstrip_util.html.






































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>docstrip_util - Literate programming tool</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/docstrip/docstrip_util.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003–2010 Lars Hellstr&ouml;m &lt;Lars dot Hellstrom at residenset dot net&gt;
   -->
<! -- CVS: $Id$ docstrip_util.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">docstrip_util(n) 1.3 tcllib &quot;Literate programming tool&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>docstrip_util - Docstrip-related utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Package indexing commands</a></li>
<li class="section"><a href="#section3">Source processing commands</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">docstrip <span class="opt">?1.2?</span></b></li>
<li>package require <b class="pkgname">docstrip::util <span class="opt">?1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pkgProvide</b> <i class="arg">name</i> <i class="arg">version</i> <i class="arg">terminals</i></a></li>
<li><a href="#2"><b class="cmd">pkgIndex</b> <span class="opt">?<i class="arg">terminal</i> ...?</span></a></li>
<li><a href="#3"><b class="cmd">fileoptions</b> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#4"><b class="cmd">docstrip::util::index_from_catalogue</b> <i class="arg">dir</i> <i class="arg">pattern</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#5"><b class="cmd">docstrip::util::modules_from_catalogue</b> <i class="arg">target</i> <i class="arg">source</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#6"><b class="cmd">docstrip::util::classical_preamble</b> <i class="arg">metaprefix</i> <i class="arg">message</i> <i class="arg">target</i> <span class="opt">?<i class="arg">source</i> <i class="arg">terminals</i> ...?</span></a></li>
<li><a href="#7"><b class="cmd">docstrip::util::classical_postamble</b> <i class="arg">metaprefix</i> <i class="arg">message</i> <i class="arg">target</i> <span class="opt">?<i class="arg">source</i> <i class="arg">terminals</i> ...?</span></a></li>
<li><a href="#8"><b class="cmd">docstrip::util::packages_provided</b> <i class="arg">text</i> <span class="opt">?<i class="arg">setup-script</i>?</span></a></li>
<li><a href="#9"><b class="cmd">docstrip::util::ddt2man</b> <i class="arg">text</i></a></li>
<li><a href="#10"><b class="cmd">docstrip::util::guards</b> <i class="arg">subcmd</i> <i class="arg">text</i></a></li>
<li><a href="#11"><b class="cmd">docstrip::util::patch</b> <i class="arg">source-var</i> <i class="arg">terminals</i> <i class="arg">fromtext</i> <i class="arg">diff</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#12"><b class="cmd">docstrip::util::thefile</b> <i class="arg">filename</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#13"><b class="cmd">docstrip::util::import_unidiff</b> <i class="arg">diff-text</i> <span class="opt">?<i class="arg">warning-var</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">docstrip::util</b> package is meant for collecting various
utility procedures that are mainly useful at installation or
development time. It is separate from the base package to avoid
overhead when the latter is used to <b class="cmd"><a href="../../../../index.html#key388">source</a></b> code.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Package indexing commands</a></h2>
<p>Like raw &quot;<b class="file">.tcl</b>&quot; files, code lines in docstrip source files can
be searched for package declarations and corresponding indices
constructed. A complication is however that one cannot tell from the
code blocks themselves which will fit together to make a working
package; normally that information would be found in an accompanying
&quot;<b class="file">.ins</b>&quot; file, but parsing one of those is not an easy task.
Therefore <b class="package">docstrip::util</b> introduces an alternative encoding
of such information, in the form of a declarative Tcl script: the
<i class="term"><a href="../../../../index.html#key618">catalogue</a></i> (of the contents in a source file).</p>
<p>The special commands which are available inside a catalogue are:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pkgProvide</b> <i class="arg">name</i> <i class="arg">version</i> <i class="arg">terminals</i></a></dt>
<dd><p>Declares that the code for a package with name <i class="arg">name</i> and
  version <i class="arg">version</i> is made up from those modules in the source
  file which are selected by the <i class="arg">terminals</i> list of guard
  expression terminals. This code should preferably not contain a
  <b class="cmd"><a href="../../../../index.html#key52">package</a></b> <b class="method">provide</b> command for the package, as one
  will be provided by the package loading mechanisms.</p></dd>
<dt><a name="2"><b class="cmd">pkgIndex</b> <span class="opt">?<i class="arg">terminal</i> ...?</span></a></dt>
<dd><p>Declares that the code for a package is made up from those modules
  in the source file which are selected by the listed guard
  expression <i class="arg">terminal</i>s. The name and version of this package is
  determined from <b class="cmd"><a href="../../../../index.html#key52">package</a></b> <b class="method">provide</b> command(s) found
  in that code (hence there must be such a command in there).</p></dd>
<dt><a name="3"><b class="cmd">fileoptions</b> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>Declares the <b class="cmd">fconfigure</b> options that should be in force when
  reading the source; this can usually be ignored for pure ASCII
  files, but if the file needs to be interpreted according to some
  other <b class="option">-encoding</b> then this is how to specify it. The
  command should normally appear first in the catalogue, as it takes
  effect only for commands following it.</p></dd>
</dl>
<p>Other Tcl commands are supported too — a catalogue is
parsed by being evaluated in a safe interpreter — but they
are rarely needed. To allow for future extensions, unknown commands
in the catalogue are silently ignored.</p>
<p>To simplify distribution of catalogues together with their source
files, the catalogue is stored <em>in the source file itself</em> as
a module selected by the terminal '<b class="const">docstrip.tcl::catalogue</b>'.
This supports both the style of collecting all catalogue lines in one
place and the style of putting each catalogue line in close proximity
of the code that it declares.</p>
<p>Putting catalogue entries next to the code they declare may look as
follows</p>
<pre class="example">
%    First there's the catalogue entry
%    \begin{tcl}
%&lt;docstrip.tcl::catalogue&gt;pkgProvide foo::bar 1.0 {foobar load}
%    \end{tcl}
%    second a metacomment used to include a copyright message
%    \begin{macrocode}
%&lt;*foobar&gt;
%% This file is placed in the public domain.
%    \end{macrocode}
%    third the package implementation
%    \begin{tcl}
namespace eval foo::bar {
   # ... some clever piece of Tcl code elided ...
%    \end{tcl}
%    which at some point may have variant code to make use of a
%    |load|able extension
%    \begin{tcl}
%&lt;*load&gt;
   load [file rootname [info script]][info sharedlibextension]
%&lt;/load&gt;
%&lt;*!load&gt;
   # ... even more clever scripted counterpart of the extension
   # also elided ...
%&lt;/!load&gt;
}
%&lt;/foobar&gt;
%    \end{tcl}
%    and that's it!
</pre>
<p>The corresponding set-up with <b class="cmd">pkgIndex</b> would be</p>
<pre class="example">
%    First there's the catalogue entry
%    \begin{tcl}
%&lt;docstrip.tcl::catalogue&gt;pkgIndex foobar load
%    \end{tcl}
%    second a metacomment used to include a copyright message
%    \begin{tcl}
%&lt;*foobar&gt;
%% This file is placed in the public domain.
%    \end{tcl}
%    third the package implementation
%    \begin{tcl}
package provide foo::bar 1.0
namespace eval foo::bar {
   # ... some clever piece of Tcl code elided ...
%    \end{tcl}
%    which at some point may have variant code to make use of a
%    |load|able extension
%    \begin{tcl}
%&lt;*load&gt;
   load [file rootname [info script]][info sharedlibextension]
%&lt;/load&gt;
%&lt;*!load&gt;
   # ... even more clever scripted counterpart of the extension
   # also elided ...
%&lt;/!load&gt;
}
%&lt;/foobar&gt;
%    \end{tcl}
%    and that's it!
</pre>
<dl class="definitions">
<dt><a name="4"><b class="cmd">docstrip::util::index_from_catalogue</b> <i class="arg">dir</i> <i class="arg">pattern</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>This command is a sibling of the standard <b class="cmd">pkg_mkIndex</b>
  command, in that it adds package entries to &quot;<b class="file">pkgIndex.tcl</b>&quot;
  files. The difference is that it indexes <b class="syscmd"><a href="docstrip.html">docstrip</a></b>-style
  source files rather than raw &quot;<b class="file">.tcl</b>&quot; or loadable library files.
  Only packages listed in the catalogue of a file are considered.</p>
<p>The <i class="arg">dir</i> argument is the directory in which to look for files
  (and whose &quot;<b class="file">pkgIndex.tcl</b>&quot; file should be amended).
  The <i class="arg">pattern</i> argument is a <b class="cmd">glob</b> pattern of files to look
  into; a typical value would be <b class="const">*.dtx</b> or
  <b class="const">*.{dtx,ddt}</b>. Remaining arguments are option-value pairs,
  where the supported options are:</p>
<dl class="options">
  
<dt><b class="option">-recursein</b> <i class="arg">dirpattern</i></dt>
<dd><p>If this option is given, then the <b class="cmd">index_from_catalogue</b>
    operation will be repeated in each subdirectory whose name
    matches the <i class="arg">dirpattern</i>. <b class="option">-recursein</b> <b class="const">*</b> will
    cause the entire subtree rooted at <i class="arg">dir</i> to be indexed.</p></dd>
<dt><b class="option">-sourceconf</b> <i class="arg">dictionary</i></dt>
<dd><p>Specify <b class="cmd">fileoptions</b> to use when reading the catalogues of
    files (and also for reading the packages if the catalogue does
    not contain a <b class="cmd">fileoptions</b> command). Defaults to being
    empty. Primarily useful if your system encoding is very different
    from that of the source file (e.g., one is a two-byte encoding
    and the other is a one-byte encoding). <b class="const">ascii</b> and
    <b class="const">utf-8</b> are not very different in that sense.</p></dd>
<dt><b class="option">-options</b> <i class="arg">terminals</i></dt>
<dd><p>The <i class="arg">terminals</i> is a list of terminals in addition to
    <b class="const">docstrip.tcl::catalogue</b> that should be held as true when
    extracting the catalogue. Defaults to being empty. This makes it
    possible to make use of &quot;variant sections&quot; in the catalogue
    itself, e.g. gaurd some entries with an extra &quot;experimental&quot; and
    thus prevent them from appearing in the index unless that is
    generated with &quot;experimental&quot; among the <b class="option">-options</b>.</p></dd>
<dt><b class="option">-report</b> <i class="arg">boolean</i></dt>
<dd><p>If the <i class="arg">boolean</i> is true then the return value will be a
    textual, probably multiline, report on what was done. Defaults
    to false, in which case there is no particular return value.</p></dd>
<dt><b class="option">-reportcmd</b> <i class="arg">commandPrefix</i></dt>
<dd><p>Every item in the report is handed as an extra argument to the
    command prefix. Since <b class="cmd">index_from_catalogue</b> would typically
    be used at a rather high level in installation scripts and the
    like, the <i class="arg">commandPrefix</i> defaults to
    &quot;<b class="cmd">puts</b> <b class="const">stdout</b>&quot;.
    Use <b class="cmd"><a href="../../../../index.html#key252">list</a></b> to effectively disable this feature. The return
    values from the prefix are ignored.</p></dd>
</dl>
<p>The <b class="cmd">package ifneeded</b> scripts that are generated contain
  one <b class="cmd">package require docstrip</b> command and one
  <b class="cmd">docstrip::sourcefrom</b> command. If the catalogue entry was
  of the <b class="cmd">pkgProvide</b> kind then the <b class="cmd">package ifneeded</b>
  script also contains the <b class="cmd">package provide</b> command.</p>
<p>Note that <b class="cmd">index_from_catalogue</b> never removes anything from an
  existing &quot;<b class="file">pkgIndex.tcl</b>&quot; file. Hence you may need to delete it
  (or have <b class="cmd">pkg_mkIndex</b> recreate it from scratch) before running
  <b class="cmd">index_from_catalogue</b> to update some piece of information, such
  as a package version number.</p></dd>
<dt><a name="5"><b class="cmd">docstrip::util::modules_from_catalogue</b> <i class="arg">target</i> <i class="arg">source</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>This command is an alternative to <b class="cmd">index_from_catalogue</b> which
  creates Tcl Module (&quot;<b class="file">.tm</b>&quot;) files rather than
  &quot;<b class="file">pkgIndex.tcl</b>&quot; entries. Since this action is more similar to
  what <b class="syscmd"><a href="docstrip.html">docstrip</a></b> classically does, it has features for
  putting pre- and postambles on the generated files.</p>
<p>The <i class="arg">source</i> argument is the name of the source file to
  generate &quot;<b class="file">.tm</b>&quot; files from. The <i class="arg">target</i> argument is the
  directory which should count as a module path, i.e., this is what
  the relative paths derived from package names are joined to. The
  supported options are:</p>
<dl class="options">
  
<dt><b class="option">-preamble</b> <i class="arg">message</i></dt>
<dd><p>A message to put in the preamble (initial block of comments) of
    generated files. Defaults to a space. May be several lines, which
    are then separated by newlines. Traditionally used for copyright
    notices or the like, but metacomment lines provide an alternative
    to that.</p></dd>
<dt><b class="option">-postamble</b> <i class="arg">message</i></dt>
<dd><p>Like <b class="option">-preamble</b>, but the message is put at the end of the
    file instead of the beginning. Defaults to being empty.</p></dd>
<dt><b class="option">-sourceconf</b> <i class="arg">dictionary</i></dt>
<dd><p>Specify <b class="cmd">fileoptions</b> to use when reading the catalogue of
    the <i class="arg">source</i> (and also for reading the packages if the
    catalogue does not contain a <b class="cmd">fileoptions</b> command). Defaults
    to being empty. Primarily useful if your system encoding is very
    different from that of the source file (e.g., one is a two-byte
    encoding and the other is a one-byte encoding). <b class="const">ascii</b> and
    <b class="const">utf-8</b> are not very different in that sense.</p></dd>
<dt><b class="option">-options</b> <i class="arg">terminals</i></dt>
<dd><p>The <i class="arg">terminals</i> is a list of terminals in addition to
    <b class="const">docstrip.tcl::catalogue</b> that should be held as true when
    extracting the catalogue. Defaults to being empty. This makes it
    possible to make use of &quot;variant sections&quot; in the catalogue
    itself, e.g. gaurd some entries with an extra &quot;experimental&quot; guard
    and thus prevent them from contributing packages unless those are
    generated with &quot;experimental&quot; among the <b class="option">-options</b>.</p></dd>
<dt><b class="option">-formatpreamble</b> <i class="arg">commandPrefix</i></dt>
<dd><p>Command prefix used to actually format the preamble. Takes four
    additional arguments <i class="arg">message</i>, <i class="arg">targetFilename</i>,
    <i class="arg">sourceFilename</i>, and <i class="arg">terminalList</i> and returns a fully
    formatted preamble. Defaults to using <b class="cmd">classical_preamble</b>
    with a <i class="arg">metaprefix</i> of '##'.</p></dd>
<dt><b class="option">-formatpostamble</b> <i class="arg">commandPrefix</i></dt>
<dd><p>Command prefix used to actually format the postamble. Takes four
    additional arguments <i class="arg">message</i>, <i class="arg">targetFilename</i>,
    <i class="arg">sourceFilename</i>, and <i class="arg">terminalList</i> and returns a fully
    formatted postamble. Defaults to using <b class="cmd">classical_postamble</b>
    with a <i class="arg">metaprefix</i> of '##'.</p></dd>
<dt><b class="option">-report</b> <i class="arg">boolean</i></dt>
<dd><p>If the <i class="arg">boolean</i> is true (which is the default) then the return
    value will be a textual, probably multiline, report on what was
    done. If it is false then there is no particular return value.</p></dd>
<dt><b class="option">-reportcmd</b> <i class="arg">commandPrefix</i></dt>
<dd><p>Every item in the report is handed as an extra argument to this
    command prefix. Defaults to <b class="cmd"><a href="../../../../index.html#key252">list</a></b>, which effectively disables
    this feature. The return values from the prefix are ignored. Use
    for example &quot;<b class="cmd">puts</b> <b class="const">stdout</b>&quot; to get report items
    written immediately to the terminal.</p></dd>
</dl>
<p>An existing file of the same name as one to be created will be
  overwritten.</p></dd>
<dt><a name="6"><b class="cmd">docstrip::util::classical_preamble</b> <i class="arg">metaprefix</i> <i class="arg">message</i> <i class="arg">target</i> <span class="opt">?<i class="arg">source</i> <i class="arg">terminals</i> ...?</span></a></dt>
<dd><p>This command returns a preamble in the classical
  <b class="syscmd"><a href="docstrip.html">docstrip</a></b> style</p>
<pre class="example">
##
## This is `TARGET',
## generated by the docstrip::util package.
##
## The original source files were:
##
## SOURCE (with options: `foo,bar')
##
## Some message line 1
## line2
## line3
</pre>
<p>if called as</p>
<pre class="example">
docstrip::util::classical_preamble {##}\
  &quot;\nSome message line 1\nline2\nline3&quot; TARGET SOURCE {foo bar}
</pre>
<p>The command supports preambles for files generated from multiple
  sources, even though <b class="cmd">modules_from_catalogue</b> at present does
  not need that.</p></dd>
<dt><a name="7"><b class="cmd">docstrip::util::classical_postamble</b> <i class="arg">metaprefix</i> <i class="arg">message</i> <i class="arg">target</i> <span class="opt">?<i class="arg">source</i> <i class="arg">terminals</i> ...?</span></a></dt>
<dd><p>This command returns a postamble in the classical
  <b class="syscmd"><a href="docstrip.html">docstrip</a></b> style</p>
<pre class="example">
## Some message line 1
## line2
## line3
##
## End of file `TARGET'.
</pre>
<p>if called as</p>
<pre class="example">
docstrip::util::classical_postamble {##}\
  &quot;Some message line 1\nline2\nline3&quot; TARGET SOURCE {foo bar}
</pre>
<p>In other words, the <i class="arg">source</i> and <i class="arg">terminals</i> arguments are
  ignored, but supported for symmetry with <b class="cmd">classical_preamble</b>.</p></dd>
<dt><a name="8"><b class="cmd">docstrip::util::packages_provided</b> <i class="arg">text</i> <span class="opt">?<i class="arg">setup-script</i>?</span></a></dt>
<dd><p>This command returns a list where every even index element is the
  name of a package <b class="cmd">provide</b>d by <i class="arg">text</i> when that is
  evaluated as a Tcl script, and the following odd index element is
  the corresponding version. It is used to do package indexing of
  extracted pieces of code, in the manner of <b class="cmd">pkg_mkIndex</b>.</p>
<p>One difference to <b class="cmd">pkg_mkIndex</b> is that the <i class="arg">text</i> gets
  evaluated in a safe interpreter. <b class="cmd">package require</b> commands
  are silently ignored, as are unknown commands (which includes
  <b class="cmd"><a href="../../../../index.html#key388">source</a></b> and <b class="cmd">load</b>). Other errors cause
  processing of the <i class="arg">text</i> to stop, in which case only those
  package declarations that had been encountered before the error
  will be included in the return value.</p>
<p>The <i class="arg">setup-script</i> argument can be used to customise the
  evaluation environment, if the code in <i class="arg">text</i> has some very
  special needs. The <i class="arg">setup-script</i> is evaluated in the local
  context of the <b class="cmd">packages_provided</b> procedure just before the
  <i class="arg">text</i> is processed. At that time, the name of the slave
  command for the safe interpreter that will do this processing is
  kept in the local variable <b class="variable">c</b>. To for example copy the
  contents of the <b class="variable">::env</b> array to the safe interpreter, one
  might use a <i class="arg">setup-script</i> of</p>
<pre class="example">  $c eval [list array set env [array get ::env]]</pre>
</dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Source processing commands</a></h2>
<p>Unlike the previous group of commands, which would use
<b class="cmd">docstrip::extract</b> to extract some code lines and then process
those further, the following commands operate on text consisting of
all types of lines.</p>
<dl class="definitions">
<dt><a name="9"><b class="cmd">docstrip::util::ddt2man</b> <i class="arg">text</i></a></dt>
<dd><p>The <b class="cmd">ddt2man</b> command reformats <i class="arg">text</i> from the general
  <b class="syscmd"><a href="docstrip.html">docstrip</a></b> format to <b class="package"><a href="../doctools/doctools.html">doctools</a></b> &quot;<b class="file">.man</b>&quot; format
  (Tcl Markup Language for Manpages). The different line types are
  treated as follows:</p>
<dl class="definitions">
  
<dt>comment and metacomment lines</dt>
<dd><p>The '%' and '%%' prefixes are removed, the rest of the text is
    kept as it is.</p></dd>
<dt>empty lines</dt>
<dd><p>These are kept as they are. (Effectively this means that they will
    count as comment lines after a comment line and as code lines
    after a code line.)</p></dd>
<dt>code lines</dt>
<dd><p><b class="cmd">example_begin</b> and <b class="cmd">example_end</b> commands are placed
    at the beginning and end of every block of consecutive code
    lines. Brackets in a code line are converted to <b class="cmd">lb</b> and
    <b class="cmd">rb</b> commands.</p></dd>
<dt>verbatim guards</dt>
<dd><p>These are processed as usual, so they do not show up in the
    result but every line in a verbatim block is treated as a code
    line.</p></dd>
<dt>other guards</dt>
<dd><p>These are treated as code lines, except that the actual guard is
    <b class="cmd">emph</b>asised.</p></dd>
</dl>
<p>At the time of writing, no project has employed <b class="package"><a href="../doctools/doctools.html">doctools</a></b>
  markup in master source files, so experience of what works well is
  not available. A source file could however look as follows</p>
<pre class="example">
% [manpage_begin gcd n 1.0]
% [moddesc {Greatest Common Divisor}]
% [require gcd [opt 1.0]]
% [description]
%
% [list_begin definitions]
% [call [cmd gcd] [arg a] [arg b]]
%   The [cmd gcd] procedure takes two arguments [arg a] and [arg b] which
%   must be integers and returns their greatest common divisor.
proc gcd {a b} {
%   The first step is to take the absolute values of the arguments.
%   This relieves us of having to worry about how signs will be treated
%   by the remainder operation.
   set a [expr {abs($a)}]
   set b [expr {abs($b)}]
%   The next line does all of Euclid's algorithm! We can make do
%   without a temporary variable, since $a is substituted before the
%   [lb]set a $b[rb] and thus continues to hold a reference to the
%   &quot;old&quot; value of [var a].
   while {$b&gt;0} { set b [expr { $a % [set a $b] }] }
%   In Tcl 8.3 we might want to use [cmd set] instead of [cmd return]
%   to get the slight advantage of byte-compilation.
%&lt;tcl83&gt;  set a
%&lt;!tcl83&gt;   return $a
}
% [list_end]
%
% [manpage_end]
</pre>
<p>If the above text is fed through <b class="cmd">docstrip::util::ddt2man</b> then
  the result will be a syntactically correct <b class="package"><a href="../doctools/doctools.html">doctools</a></b>
  manpage, even though its purpose is a bit different.</p>
<p>It is suggested that master source code files with <b class="package"><a href="../doctools/doctools.html">doctools</a></b>
  markup are given the suffix &quot;<b class="file">.ddt</b>&quot;, hence the &quot;ddt&quot; in
  <b class="cmd">ddt2man</b>.</p></dd>
<dt><a name="10"><b class="cmd">docstrip::util::guards</b> <i class="arg">subcmd</i> <i class="arg">text</i></a></dt>
<dd><p>The <b class="cmd">guards</b> command returns information (mostly of a
  statistical nature) about the ordinary docstrip guards that occur
  in the <i class="arg">text</i>. The <i class="arg">subcmd</i> selects what is returned.</p>
<dl class="definitions">
  
<dt><b class="method">counts</b></dt>
<dd><p>List the guard expression terminals with counts. The format of
    the return value is a dictionary which maps the terminal name to
    the number of occurencies of it in the file.</p></dd>
<dt><b class="method">exprcount</b></dt>
<dd><p>List the guard expressions with counts. The format of the return
    value is a dictionary which maps the expression to the number of
    occurencies of it in the file.</p></dd>
<dt><b class="method">exprerr</b></dt>
<dd><p>List the syntactically incorrect guard expressions (e.g.
    parentheses do not match, or a terminal is missing). The return
    value is a list, with the elements in no particular order.</p></dd>
<dt><b class="method">expressions</b></dt>
<dd><p>List the guard expressions. The return value is a list, with the
    elements in no particular order.</p></dd>
<dt><b class="method">exprmods</b></dt>
<dd><p>List the guard expressions with modifiers. The format of the return
    value is a dictionary where each index is a guard expression and
    each entry is a string with one character for every guard line that
    has this expression. The characters in the entry specify what
    modifier was used in that line: +, -, *, /, or (for guard without
    modifier:) space. This is the most primitive form of the
    information gathered by <b class="cmd">guards</b>.</p></dd>
<dt><b class="method">names</b></dt>
<dd><p>List the guard expression terminals. The return value is a list,
    with the elements in no particular order.</p></dd>
<dt><b class="method">rotten</b></dt>
<dd><p>List the malformed guard lines (this does not include lines where
    only the expression is malformed, though). The format of the return
    value is a dictionary which maps line numbers to their contents.</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">docstrip::util::patch</b> <i class="arg">source-var</i> <i class="arg">terminals</i> <i class="arg">fromtext</i> <i class="arg">diff</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>This command tries to apply a <b class="syscmd"><a href="../../../../index.html#key513">diff</a></b> file (for example a
  contributed patch) that was computed for a generated file to the
  <b class="syscmd"><a href="docstrip.html">docstrip</a></b> source. This can be useful if someone has
  edited a generated file, thus mistaking it for being the source.
  This command makes no presumptions which are specific for the case
  that the generated file is a Tcl script.</p>
<p><b class="cmd"><a href="../../../../index.html#key615">patch</a></b> requires that the source file to patch is kept as a
  list of lines in a variable, and the name of that variable in the
  calling context is what goes into the <i class="arg">source-var</i> argument.
  The <i class="arg">terminals</i> is the list of terminals used to extract the
  file that has been patched. The <i class="arg">diff</i> is the actual diff to
  apply (in a format as explained below) and the <i class="arg">fromtext</i> is
  the contents of the file which served as &quot;from&quot; when the diff was
  computed. Options can be used to further control the process.</p>
<p>The process works by &quot;lifting&quot; the hunks in the <i class="arg">diff</i> from
  generated to source file, and then applying them to the elements of
  the <i class="arg">source-var</i>. In order to do this lifting, it is necessary
  to determine how lines in the <i class="arg">fromtext</i> correspond to elements
  of the <i class="arg">source-var</i>, and that is where the <i class="arg">terminals</i> come
  in; the source is first <b class="cmd">extract</b>ed under the given
  <i class="arg">terminals</i>, and the result of that is then matched against
  the <i class="arg">fromtext</i>. This produces a map which translates line
  numbers stated in the <i class="arg">diff</i> to element numbers in
  <i class="arg">source-var</i>, which is what is needed to lift the hunks.</p>
<p>The reason that both the <i class="arg">terminals</i> and the <i class="arg">fromtext</i>
  must be given is twofold. First, it is very difficult to keep track
  of how many lines of preamble are supplied some other way than by
  copying lines from source files. Second, a generated file might
  contain material from several source files. Both make it impossible
  to predict what line number an extracted file would have in the
  generated file, so instead the algorithm for computing the line
  number map looks for a block of lines in the <i class="arg">fromtext</i> which
  matches what can be extracted from the source. This matching is
  affected by the following options:</p>
<dl class="options">
  
<dt><b class="option">-matching</b> <i class="arg">mode</i></dt>
<dd><p>How equal must two lines be in order to match? The supported
    <i class="arg">mode</i>s are:</p>
<dl class="definitions">
    
<dt><b class="const">exact</b></dt>
<dd><p>Lines must be equal as strings. This is the default.</p></dd>
<dt><b class="const">anyspace</b></dt>
<dd><p>All sequences of whitespace characters are converted to single
      spaces before comparing.</p></dd>
<dt><b class="const">nonspace</b></dt>
<dd><p>Only non-whitespace characters are considered when comparing.</p></dd>
<dt><b class="const">none</b></dt>
<dd><p>Any two lines are considered to be equal.</p></dd>
</dl></dd>
<dt><b class="option">-metaprefix</b> <i class="arg">string</i></dt>
<dd><p>The <b class="option">-metaprefix</b> value to use when extracting. Defaults
    to &quot;%%&quot;, but for Tcl code it is more likely that &quot;#&quot; or &quot;##&quot; had
    been used for the generated file.</p></dd>
<dt><b class="option">-trimlines</b> <i class="arg">boolean</i></dt>
<dd><p>The <b class="option">-trimlines</b> value to use when extracting. Defaults to
    true.</p></dd>
</dl>
<p>The return value is in the form of a unified diff, containing only
  those hunks which were not applied or were only partially applied;
  a comment in the header of each hunk specifies which case is at
  hand. It is normally necessary to manually review both the return
  value from <b class="cmd"><a href="../../../../index.html#key615">patch</a></b> and the patched text itself, as this command
  cannot adjust comment lines to match new content.</p>
<p>An example use would look like</p>
<pre class="example">
set sourceL [split [docstrip::util::thefile from.dtx] \n]
set terminals {foo bar baz}
set fromtext [docstrip::util::thefile from.tcl]
set difftext [exec diff --unified from.tcl to.tcl]
set leftover [docstrip::util::patch sourceL $terminals $fromtext\
  [docstrip::util::import_unidiff $difftext] -metaprefix {#}]
set F [open to.dtx w]; puts $F [join $sourceL \n]; close $F
return $leftover
</pre>
<p>Here, &quot;<b class="file">from.dtx</b>&quot; was used as source for &quot;<b class="file">from.tcl</b>&quot;, which
  someone modified into &quot;<b class="file">to.tcl</b>&quot;. We're trying to construct a
  &quot;<b class="file">to.dtx</b>&quot; which can be used as source for &quot;<b class="file">to.tcl</b>&quot;.</p></dd>
<dt><a name="12"><b class="cmd">docstrip::util::thefile</b> <i class="arg">filename</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>The <b class="cmd">thefile</b> command opens the file <i class="arg">filename</i>, reads it to
  end, closes it, and returns the contents (dropping a final newline
  if there is one). The option-value pairs are
  passed on to <b class="cmd">fconfigure</b> to configure the open file channel
  before anything is read from it.</p></dd>
<dt><a name="13"><b class="cmd">docstrip::util::import_unidiff</b> <i class="arg">diff-text</i> <span class="opt">?<i class="arg">warning-var</i>?</span></a></dt>
<dd><p>This command parses a unified (<b class="syscmd"><a href="../../../../index.html#key513">diff</a></b> flags <b class="option">-U</b> and
  <b class="option">--unified</b>) format diff into the list-of-hunks format
  expected by <b class="cmd">docstrip::util::patch</b>. The <i class="arg">diff-text</i>
  argument is the text to parse and the <i class="arg">warning-var</i> is, if
  specified, the name in the calling context of a variable to which
  any warnings about parsing problems will be <b class="cmd">append</b>ed.</p>
<p>The return value is a list of <i class="term">hunks</i>. Each hunk is a list of
  five elements &quot;<i class="arg">start1</i> <i class="arg">end1</i> <i class="arg">start2</i> <i class="arg">end2</i>
  <i class="arg">lines</i>&quot;. <i class="arg">start1</i> and <i class="arg">end1</i> are line numbers in the
  &quot;from&quot; file of the first and last respectively lines of the hunk.
  <i class="arg">start2</i> and <i class="arg">end2</i> are the corresponding line numbers in
  the &quot;to&quot; file. Line numbers start at 1. The <i class="arg">lines</i> is a list
  with two elements for each line in the hunk; the first specifies the
  type of a line and the second is the actual line contents. The type
  is <b class="const">-</b> for lines only in the &quot;from&quot; file, <b class="const">+</b> for lines
  that are only in the &quot;to&quot; file, and <b class="const">0</b> for lines that are
  in both.</p></dd>
</dl>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docstrip.html">docstrip</a>, <a href="../doctools/doctools.html">doctools</a>, doctools_fmt</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key619">.ddt</a>, <a href="../../../../index.html#key616">Tcl module</a>, <a href="../../../../index.html#key618">catalogue</a>, <a href="../../../../index.html#key513">diff</a>, <a href="../../../../index.html#key386">docstrip</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key387">literate programming</a>, <a href="../../../../index.html#key620">module</a>, <a href="../../../../index.html#key617">package indexing</a>, <a href="../../../../index.html#key615">patch</a>, <a href="../../../../index.html#key388">source</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003–2010 Lars Hellstr&ouml;m &lt;Lars dot Hellstrom at residenset dot net&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/changelog.html.



















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::changelog - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/changelog.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003-2013 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::changelog.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::changelog(n) 1.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::changelog - Processing text in Emacs ChangeLog format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil</b></li>
<li>package require <b class="pkgname">doctools::changelog <span class="opt">?1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::changelog::scan</b> <i class="arg">text</i></a></li>
<li><a href="#2"><b class="cmd">::doctools::changelog::flatten</b> <i class="arg">entries</i></a></li>
<li><a href="#3"><b class="cmd">::doctools::changelog::toDoctools</b> <i class="arg">title</i> <i class="arg">module</i> <i class="arg">version</i> <i class="arg">entries</i></a></li>
<li><a href="#4"><b class="cmd">::doctools::changelog::merge</b> <i class="arg">entries</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides Tcl commands for the processing and reformatting
of text in the &quot;<b class="file">ChangeLog</b>&quot; format generated by <b class="syscmd"><a href="../../../../index.html#key403">emacs</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::changelog::scan</b> <i class="arg">text</i></a></dt>
<dd><p>The command takes the <i class="arg">text</i> and parses it under the assumption
that it contains a ChangeLog as generated by <b class="syscmd"><a href="../../../../index.html#key403">emacs</a></b>. It
returns a data structure describing the contents of this ChangeLog.</p>
<p>This data structure is a list where each element describes one entry
in the ChangeLog. Each element/entry is then a list of three elements
describing the date of the entry, its author, and the comments made,
in this order. The last item in each element/entry, the comments, is a
list of sections. Each section is described by a list containing two
elements, a list of file names, and a string containing the true
comment associated with the files of the section.</p>
<pre class="example">
    {
	{
	    date
	    author
	    {
		{
		    {file ...}
		    commenttext
		}
		...
	    }
	}
	{...}
    }
</pre>
</dd>
<dt><a name="2"><b class="cmd">::doctools::changelog::flatten</b> <i class="arg">entries</i></a></dt>
<dd><p>This command converts a list of entries as generated by
<b class="cmd">change::scan</b> above into a simpler list of plain
text blocks each containing all the information of a
single entry.</p></dd>
<dt><a name="3"><b class="cmd">::doctools::changelog::toDoctools</b> <i class="arg">title</i> <i class="arg">module</i> <i class="arg">version</i> <i class="arg">entries</i></a></dt>
<dd><p>This command converts the pre-parsed ChangeLog <i class="arg">entries</i> as
generated by the command <b class="cmd">::doctools::changelog::scan</b> into a
document in <i class="term"><a href="../../../../index.html#key51">doctools</a></i> format and returns it as the result of the
command.</p>
<p>The other three arguments supply the information for the header of
that document which is not available from the changelog itself.</p></dd>
<dt><a name="4"><b class="cmd">::doctools::changelog::merge</b> <i class="arg">entries</i>...</a></dt>
<dd><p>Each argument of the command is assumed to be a pre-parsed Changelog
as generated by the command <b class="cmd">::doctools::changelog::scan</b>. This
command merges all of them into a single structure, and collapses
multiple entries for the same date and author into a single entry. The
new structure is returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key402">changelog</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key403">emacs</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003-2013 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/cvs.html.

















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::cvs - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/cvs.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::cvs.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::cvs(n) 1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::cvs - Processing text in 'cvs log' format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil</b></li>
<li>package require <b class="pkgname">doctools::cvs <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::cvs::scanLog</b> <i class="arg">text</i> <i class="arg">evar</i> <i class="arg">cvar</i> <i class="arg">fvar</i></a></li>
<li><a href="#2"><b class="cmd">::doctools::cvs::toChangeLog</b> <i class="arg">evar</i> <i class="arg">cvar</i> <i class="arg">fvar</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides Tcl commands for the processing and reformatting
text in the format generated by the <b class="syscmd"><a href="../../../../index.html#key712">cvs log</a></b> command.</p>
<p>The commands <b class="cmd">::doctools::cvs::scanLog</b>
and <b class="cmd">::doctools::cvs::toChangeLog</b> are derived from code found on
the <a href="http://wiki.tcl.tk">Tcl'ers Wiki</a>. See the references at the
end of the page.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::cvs::scanLog</b> <i class="arg">text</i> <i class="arg">evar</i> <i class="arg">cvar</i> <i class="arg">fvar</i></a></dt>
<dd><p>The command takes the <i class="arg">text</i> and parses it under the assumption
that it contains a CVS log as generated by <b class="syscmd"><a href="../../../../index.html#key712">cvs log</a></b>. The
resulting information is stored in the variables whose names were
specified via <i class="arg">evar</i>, <i class="arg">cvar</i>, and <i class="arg">fvar</i>.</p>
<p>Already existing information in the referenced variables is preserved,
allowing the caller to merge data from multiple logs into one
database.</p>
<dl class="arguments">
<dt>varname <i class="arg">evar</i> (in)</dt>
<dd><p>Has to refer to a scalar variable. After the call this variable will
contain a list of all the entries found in the log file. An entry is
identified through the combination of date and author, and can be
split over multiple physical entries, one per touched file.</p>
<p>It should be noted that the entries are listed in the same order as
they were found in the <i class="arg">text</i>. This is not necessarily sorted by
date or author.</p>
<p>Each item in the list is a list containing two elements, the date of
the entry, and its author, in this order. The date is formatted as
<b class="variable">year</b>/<b class="variable">month</b>/<b class="variable">day</b>.</p></dd>
<dt>varname <i class="arg">cvar</i> (in)</dt>
<dd><p>Has to refer to an array variable. Keys are strings containing the
date and author of log entries, in this order, separated by a comma.</p>
<p>The values are lists of comments made for the entry.</p></dd>
<dt>varname <i class="arg">fvar</i> (in)</dt>
<dd><p>Has to refer to an array variable. Keys are strings containing
date, author of a log entry, and a comment for that entry, in this
order, separated by commas.</p>
<p>The values are lists of the files the entry is touching.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::doctools::cvs::toChangeLog</b> <i class="arg">evar</i> <i class="arg">cvar</i> <i class="arg">fvar</i></a></dt>
<dd><p>]
The three arguments for this command are the same as the last three
arguments of the command <b class="cmd">::doctools::cvs::scanLog</b>. This command
however expects them to be filled with information about one or more
logs. It takes this information and converts it into a text in the
format of a ChangeLog as accepted and generated by <b class="syscmd"><a href="../../../../index.html#key403">emacs</a></b>. The
constructed text is returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="http://wiki.tcl.tk/log2changelog">http://wiki.tcl.tk/log2changelog</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key402">changelog</a>, <a href="../../../../index.html#key711">cvs</a>, <a href="../../../../index.html#key712">cvs log</a>, <a href="../../../../index.html#key403">emacs</a>, <a href="../../../../index.html#key71">log</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/docidx.html.






























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/docidx.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003-2010 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx(n) 1.0.4 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx - docidx - Processing indices</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a>
<ul>
<li class="subsection"><a href="#subsection1">PACKAGE COMMANDS</a></li>
<li class="subsection"><a href="#subsection2">OBJECT COMMAND</a></li>
<li class="subsection"><a href="#subsection3">OBJECT METHODS</a></li>
<li class="subsection"><a href="#subsection4">OBJECT CONFIGURATION</a></li>
<li class="subsection"><a href="#subsection5">FORMAT MAPPING</a></li>
</ul>
</li>
<li class="section"><a href="#section3">PREDEFINED ENGINES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">doctools::idx <span class="opt">?1.0.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::idx::new</b> <i class="arg">objectName</i> <span class="opt">?<b class="option">-option</b> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#2"><b class="cmd">::doctools::idx::help</b></a></li>
<li><a href="#3"><b class="cmd">::doctools::idx::search</b> <i class="arg">path</i></a></li>
<li><a href="#4"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">configure</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">cget</b> <b class="option">-option</b></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">format</b> <i class="arg">text</i></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">map</b> <i class="arg">symbolic</i> <i class="arg">actual</i></a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">parameters</b></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">search</b> <i class="arg">path</i></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">setparam</b> <i class="arg">name</i> <i class="arg">value</i></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">warnings</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for the creation of objects able to
process and convert text written in the <i class="term"><a href="../../../../index.html#key50">docidx</a></i> markup language
into any output format X for which a <i class="term"><a href="../../../../index.html#key610">formatting engine</a></i> is
available.</p>
<p>A reader interested in the markup language itself should start with
the <i class="term"><a href="docidx_lang_intro.html">docidx language introduction</a></i> and proceed from there to
the formal specifications, i.e. the <i class="term"><a href="docidx_lang_syntax.html">docidx language syntax</a></i>
and the <i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i>.</p>
<p>If on the other hand the reader wishes to write her own formatting
engine for some format, i.e. is a <i class="term">plugin writer</i> then reading
and understanding the <i class="term"><a href="docidx_plugin_apiref.html">docidx plugin API reference</a></i> is an
absolute necessity, as that document specifies the interaction between
this package and its plugins, i.e. the formatting engines, in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">PACKAGE COMMANDS</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::idx::new</b> <i class="arg">objectName</i> <span class="opt">?<b class="option">-option</b> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>This command creates a new docidx object with an associated Tcl
command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is
explained in full detail in the sections <span class="sectref"><a href="#subsection2">OBJECT COMMAND</a></span>
and <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p>
<p>The options and their values coming after the name of the object are
used to set the initial configuration of the object.</p></dd>
<dt><a name="2"><b class="cmd">::doctools::idx::help</b></a></dt>
<dd><p>This is a convenience command for applications wishing to provide
their user with a short description of the available formatting
commands and their meanings. It returns a string containing a standard
help text.</p></dd>
<dt><a name="3"><b class="cmd">::doctools::idx::search</b> <i class="arg">path</i></a></dt>
<dd><p>Whenever an object created by this the package has to map the name of
a format to the file containing the code for its formatting engine it
will search for the file in a number of directories stored in a
list. See section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span> for more explanations.</p>
<p>This list not only contains three default directories which are
declared by the package itself, but is also extensible user of the
package.
This command is the means to do so. When given a <i class="arg">path</i> to an
existing and readable directory it will prepend that directory to the
list of directories to search. This means that the <i class="arg">path</i> added
last is later searched through first.</p>
<p>An error will be thrown if the <i class="arg">path</i> either does not exist, is
not a directory, or is not readable.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">OBJECT COMMAND</a></h3>
<p>All commands created by <b class="cmd">::doctools::idx::new</b> have the following
general form and may be used to invoke various operations on their
docidx converter object.</p>
<dl class="definitions">
<dt><a name="4"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the exact
behavior of the command. See section <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span> for
the detailed specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OBJECT METHODS</a></h3>
<dl class="definitions">
<dt><a name="5"><i class="arg">objectName</i> <b class="method">configure</b></a></dt>
<dd><p>The method returns a list of all known options and their current
values when called without any arguments.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>The method behaves like the method <b class="method">cget</b> when called with a
single argument and returns the value of the option specified by said
argument.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>The method reconfigures the specified <b class="option">option</b>s of the object,
setting them to the associated <i class="arg">value</i>s, when called with an even
number of arguments, at least two.</p>
<p>The legal options are described in the section
<span class="sectref"><a href="#subsection4">OBJECT CONFIGURATION</a></span>.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">cget</b> <b class="option">-option</b></a></dt>
<dd><p>This method expects a legal configuration option as argument and will
return the current value of that option for the object the method was
invoked for.</p>
<p>The legal configuration options are described in section
<span class="sectref"><a href="#subsection4">OBJECT CONFIGURATION</a></span>.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">format</b> <i class="arg">text</i></a></dt>
<dd><p>This method runs the <i class="arg">text</i> through the configured formatting
engine and returns the generated string as its result. An error will
be thrown if no <b class="option">-format</b> was configured for the object.</p>
<p>The method assumes that the <i class="arg">text</i> is in <i class="term"><a href="../../../../index.html#key50">docidx</a></i> format as
specified in the companion document <i class="term">docidx_fmt</i>. Errors will be
thrown otherwise.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">map</b> <i class="arg">symbolic</i> <i class="arg">actual</i></a></dt>
<dd><p>This methods add one entry to the per-object mapping from
<i class="arg">symbolic</i> filenames to the <i class="arg">actual</i> uris.
The object just stores this mapping and makes it available to the
configured formatting engine through the command <b class="cmd">dt_fmap</b>.
This command is described in more detail in the
<i class="term"><a href="docidx_plugin_apiref.html">docidx plugin API reference</a></i> which specifies the interaction
between the objects created by this package and index formatting
engines.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">parameters</b></a></dt>
<dd><p>This method returns a list containing the names of all engine
parameters provided by the configured formatting engine. It will
return an empty list if the object is not yet configured for a
specific format.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">search</b> <i class="arg">path</i></a></dt>
<dd><p>This method extends the per-object list of paths searched for index
formatting engines. See also the command <b class="cmd">::doctools::idx::search</b>
on how to extend the per-package list of paths. Note that the path
entered last will be searched first.
For more details see section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span>.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">setparam</b> <i class="arg">name</i> <i class="arg">value</i></a></dt>
<dd><p>This method sets the <i class="arg">name</i>d engine parameter to the specified
<i class="arg">value</i>.
It will throw an error if the object is either not yet configured for
a specific format, or if the formatting engine for the configured
format does not provide a parameter with the given <i class="arg">name</i>.
The list of parameters provided by the configured formatting engine
can be retrieved through the method <b class="method">parameters</b>.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">warnings</b></a></dt>
<dd><p>This method returns a list containing all the warnings which were
generated by the configured formatting engine during the last
invocation of the method <b class="method">format</b>.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">OBJECT CONFIGURATION</a></h3>
<p>All docidx objects understand the following configuration options:</p>
<dl class="options">
<dt><b class="option">-file</b> <i class="arg">file</i></dt>
<dd><p>The argument of this option is stored in the object and made available
to the configured formatting engine through the command <b class="cmd">dt_file</b>.
This command is described in more detail in the companion document
<i class="term">docidx_api</i> which specifies the API between the object and
formatting engines.</p>
<p>The default value of this option is the empty string.</p>
<p>The configured formatting engine should interpret the value as the
name of the file containing the document which is currently processed.</p></dd>
<dt><b class="option">-format</b> <i class="arg">text</i></dt>
<dd><p>The argument of this option specifies the format to generate and by
implication the formatting engine to use when converting text via the
method <b class="method">format</b>. Its default value is the empty string. The
method <b class="method">format</b> cannot be used if this option is not set to a
valid value at least once.</p>
<p>The package will immediately try to map the given name to a file
containing the code for a formatting engine generating that format. An
error will be thrown if this mapping fails. In that case a previously
configured format is left untouched.</p>
<p>The section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span> explains in detail how the
package and object will look for engine implementations.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">FORMAT MAPPING</a></h3>
<p>The package and object will perform the following algorithm when
trying to map a format name <i class="term">foo</i> to a file containing an
implementation of a formatting engine for <i class="term">foo</i>:</p>
<ol class="enumerated">
<li><p>If <i class="term">foo</i> is the name of an existing file then this file is
directly taken as the implementation.</p></li>
<li><p>If not, the list of per-object search paths is searched. For each
directory in the list the package checks if that directory contains a
file &quot;<b class="file">idx.<i class="term">foo</i></b>&quot;. If yes, then that file is taken as the
implementation.</p>
<p>Note that this list of paths is initially empty and can be extended
through the object method <b class="method">search</b>.</p></li>
<li><p>If not, the list of package paths is searched.
For each directory in the list the package checks if that directory
contains a file &quot;<b class="file">idx.<i class="term">foo</i></b>&quot;. If yes, then that file is taken
as the implementation.</p>
<p>This list of paths can be extended
through the command <b class="cmd">::doctools::idx::search</b>.
It contains initially one path, the subdirectory &quot;<b class="file">mpformats</b>&quot; of
the directory the package itself is located in. In other words, if the
package implementation &quot;<b class="file">docidx.tcl</b>&quot; is installed in the directory
&quot;<b class="file">/usr/local/lib/tcllib/doctools</b>&quot; then it will by default search
the directory &quot;<b class="file">/usr/local/lib/tcllib/doctools/mpformats</b>&quot; for
format implementations.</p></li>
<li><p>The mapping fails.</p></li>
</ol>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">PREDEFINED ENGINES</a></h2>
<p>The package provides predefined formatting engines for the following
formats. Some of the formatting engines support engine
parameters. These will be explicitly highlighted.</p>
<dl class="definitions">
<dt>html</dt>
<dd><p>This engine generates HTML markup, for processing by web browsers and
the like. This engine supports three parameters:</p>
<dl class="definitions">
<dt>footer</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
before the <b class="const">&lt;/body&gt;</b> tag, closing the body of the generated
HTML.</p>
<p>This can be used to insert boilerplate footer markup into the
generated document.</p></dd>
<dt>header</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the <b class="const">&lt;body&gt;</b> tag, starting the body of the generated HTML.</p>
<p>This can be used to insert boilerplate header markup into the
generated document.</p></dd>
<dt>meta</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the header section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the <b class="const">&lt;head&gt;</b> tag, starting the header section of the
generated HTML.</p>
<p>This can be used to insert boilerplate meta data markup into the
generated document, like references to a stylesheet, standard meta
keywords, etc.</p></dd>
</dl></dd>
<dt>latex</dt>
<dd><p>This engine generates output suitable for the <b class="syscmd"><a href="../../../../index.html#key167">latex</a></b> text
processor coming out of the TeX world.</p></dd>
<dt>list</dt>
<dd><p>This engine retrieves version, section and title of the manpage from
the document. As such it can be used to generate a directory listing
for a set of manpages.</p></dd>
<dt>nroff</dt>
<dd><p>This engine generates nroff output, for processing by <b class="syscmd"><a href="../../../../index.html#key5">nroff</a></b>,
or <b class="syscmd">groff</b>. The result will be standard man pages as they are
known in the unix world.</p></dd>
<dt>null</dt>
<dd><p>This engine generates no outout at all. This can be used if one just
wants to validate some input.</p></dd>
<dt>tmml</dt>
<dd><p>This engine generates TMML markup as specified by Joe English. The Tcl
Manpage Markup Language is a derivate of XML.</p></dd>
<dt>wiki</dt>
<dd><p>This engine generates Wiki markup as understood by Jean Claude
Wippler's <b class="syscmd">wikit</b> application.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_intro.html">docidx_intro</a>, <a href="docidx_lang_cmdref.html">docidx_lang_cmdref</a>, <a href="docidx_lang_intro.html">docidx_lang_intro</a>, <a href="docidx_lang_syntax.html">docidx_lang_syntax</a>, <a href="docidx_plugin_apiref.html">docidx_plugin_apiref</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key4">TMML</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key165">keyword index</a>, <a href="../../../../index.html#key167">latex</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key164">wiki</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003-2010 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/docidx_intro.html.



































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>docidx_intro - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/docidx_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ docidx_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">docidx_intro(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>docidx_intro - docidx introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">RELATED FORMATS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><i class="term"><a href="../../../../index.html#key50">docidx</a></i> (short for <em>documentation tables of contents</em>)
stands for a set of related, yet different, entities which are working
together for the easy creation and transformation of keyword-based
indices for documentation. These are</p>
<ol class="enumerated">
<li><p>A tcl based language for the semantic markup of a keyword index.
Markup is represented by Tcl commands.</p></li>
<li><p>A package providing the ability to read and transform texts written in
that markup language. It is important to note that the actual
transformation of the input text is delegated to plugins.</p></li>
<li><p>An API describing the interface between the package above and a
plugin.</p></li>
</ol>
<p>Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.</p>
<ol class="enumerated">
<li><p>A <i class="term">writer</i> of documentation has to understand the markup language
itself. A beginner to docidx should read the more informally written
<i class="term"><a href="docidx_lang_intro.html">docidx language introduction</a></i> first. Having digested this
the formal <i class="term"><a href="docidx_lang_syntax.html">docidx language syntax</a></i> specification should
become understandable. A writer experienced with docidx may only
need the <i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i> from time to
time to refresh her memory.</p>
<p>While a document is written the <b class="syscmd">dtp</b> application can be used
to validate it, and after completion it also performs the conversion
into the chosen system of visual markup, be it *roff, HTML, plain
text, wiki, etc. The simpler <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> application makes
internal use of docidx when handling directories of documentation,
automatically generating a proper keyword index for them.</p></li>
<li><p>A <i class="term">processor</i> of documentation written in the <i class="term"><a href="../../../../index.html#key50">docidx</a></i>
markup language has to know which tools are available for use.</p>
<p>The main tool is the aforementioned <b class="syscmd">dtp</b> application provided
by Tcllib. The simpler <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> does not expose docidx to the
user.
At the bottom level, common to both applications, however sits the
package <b class="package">doctoools::idx</b>, providing the basic facilities to
read and process files containing text in the docidx format.</p></li>
<li><p>At last, but not least, <i class="term">plugin writers</i> have to understand the
interaction between the <b class="package"><a href="../doctools2idx/container.html">doctools::idx</a></b> package and its
plugins, as described in the <i class="term"><a href="docidx_plugin_apiref.html">docidx plugin API reference</a></i>.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">RELATED FORMATS</a></h2>
<p>docidx does not stand alone, it has two companion formats. These are
called <i class="term"><a href="../../../../index.html#key230">doctoc</a></i> and <i class="term"><a href="../../../../index.html#key51">doctools</a></i>, and they are for the markup
of <i class="term">tables of contents</i>, and general documentation,
respectively.
They are described in their own sets of documents, starting at the
<i class="term"><a href="doctoc_intro.html">doctoc introduction</a></i> and the <i class="term"><a href="doctools_intro.html">doctools introduction</a></i>,
respectively.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_lang_cmdref.html">docidx_lang_cmdref</a>, <a href="docidx_lang_faq.html">docidx_lang_faq</a>, <a href="docidx_lang_intro.html">docidx_lang_intro</a>, <a href="docidx_lang_syntax.html">docidx_lang_syntax</a>, <a href="docidx_plugin_apiref.html">docidx_plugin_apiref</a>, <a href="doctoc_intro.html">doctoc_intro</a>, <a href="../doctools2idx/container.html">doctools::idx</a>, <a href="doctools_intro.html">doctools_intro</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key165">keyword index</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/docidx_lang_cmdref.html.




































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>docidx_lang_cmdref - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/docidx_lang_cmdref.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ docidx_lang_cmdref.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">docidx_lang_cmdref(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>docidx_lang_cmdref - docidx language command reference</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Commands</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key146">comment</a></b> <i class="arg">plaintext</i></a></li>
<li><a href="#2"><b class="cmd">include</b> <i class="arg">filename</i></a></li>
<li><a href="#3"><b class="cmd">index_begin</b> <i class="arg">text</i> <i class="arg">title</i></a></li>
<li><a href="#4"><b class="cmd">index_end</b></a></li>
<li><a href="#5"><b class="cmd">key</b> <i class="arg">text</i></a></li>
<li><a href="#6"><b class="cmd">lb</b></a></li>
<li><a href="#7"><b class="cmd"><a href="../../../../index.html#key2">manpage</a></b> <i class="arg">file</i> <i class="arg">text</i></a></li>
<li><a href="#8"><b class="cmd">rb</b></a></li>
<li><a href="#9"><b class="cmd"><a href="../../../../index.html#key483">url</a></b> <i class="arg">url</i> <i class="arg">label</i></a></li>
<li><a href="#10"><b class="cmd">vset</b> <i class="arg">varname</i> <i class="arg">value</i></a></li>
<li><a href="#11"><b class="cmd">vset</b> <i class="arg">varname</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document specifies both names and syntax of all the commands
which together are the docidx markup language, version 1.
As this document is intended to be a reference the commands are listed
in alphabetical order, and the descriptions are relatively short.
A beginner should read the much more informally written
<i class="term"><a href="docidx_lang_intro.html">docidx language introduction</a></i> first.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Commands</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key146">comment</a></b> <i class="arg">plaintext</i></a></dt>
<dd><p>Index markup. The argument text is marked up as a comment standing
outside of the actual text of the document. Main use is in free-form
text.</p></dd>
<dt><a name="2"><b class="cmd">include</b> <i class="arg">filename</i></a></dt>
<dd><p>Templating. The contents of the named file are interpreted as text
written in the docidx markup and processed in the place of the
include command. The markup in the file has to be self-contained. It
is not possible for a markup command to cross the file boundaries.</p></dd>
<dt><a name="3"><b class="cmd">index_begin</b> <i class="arg">text</i> <i class="arg">title</i></a></dt>
<dd><p>Document structure. The command to start an index. The arguments are a
label for the whole group of documents the index refers to
(<i class="arg">text</i>) and the overall title text for the index (<i class="arg">title</i>),
without markup.</p>
<p>The label often is the name of the package (or extension) the
documents belong to.</p></dd>
<dt><a name="4"><b class="cmd">index_end</b></a></dt>
<dd><p>Document structure. Command to end an index. Anything in the document
coming after this command is in error.</p></dd>
<dt><a name="5"><b class="cmd">key</b> <i class="arg">text</i></a></dt>
<dd><p>Index structure. This command adds the keyword <i class="arg">text</i> to the
index.</p></dd>
<dt><a name="6"><b class="cmd">lb</b></a></dt>
<dd><p>Text. The command is replaced with a left bracket. Use in free-form
text. Required to avoid interpretation of a left bracket as the start
of a markup command. Its usage is restricted to the arguments of other
markup commands.</p></dd>
<dt><a name="7"><b class="cmd"><a href="../../../../index.html#key2">manpage</a></b> <i class="arg">file</i> <i class="arg">text</i></a></dt>
<dd><p>Index structure. This command adds an element to the index which
refers to a document. The document is specified through the symbolic
name <i class="arg">file</i>. The <i class="arg">text</i> argument is used to label the
reference.</p>
<p>Symbolic names are used to preserve the convertibility of this format
to any output format. The actual name of the file will be inserted by
the chosen formatting engine when converting the input. This will be
based on a mapping from symbolic to actual names given to the engine.</p></dd>
<dt><a name="8"><b class="cmd">rb</b></a></dt>
<dd><p>Text. The command is replaced with a right bracket. Use in free-form
text. Required to avoid interpretation of a right bracket as the end
of a markup command. Its usage is restricted to the arguments of other
commands.</p></dd>
<dt><a name="9"><b class="cmd"><a href="../../../../index.html#key483">url</a></b> <i class="arg">url</i> <i class="arg">label</i></a></dt>
<dd><p>Index structure. This is the second command to add an element to the
index. To refer to a document it is not using a symbolic name however,
but a (possibly format-specific) url describing the exact location of
the document indexed here.</p></dd>
<dt><a name="10"><b class="cmd">vset</b> <i class="arg">varname</i> <i class="arg">value</i></a></dt>
<dd><p>Templating. In this form the command sets the named document variable
to the specified <i class="arg">value</i>. It does not generate output. I.e. the
command is replaced by the empty string.</p></dd>
<dt><a name="11"><b class="cmd">vset</b> <i class="arg">varname</i></a></dt>
<dd><p>Templating. In this form the command is replaced by the value of the
named document variable</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_intro.html">docidx_intro</a>, <a href="docidx_lang_faq.html">docidx_lang_faq</a>, <a href="docidx_lang_intro.html">docidx_lang_intro</a>, <a href="docidx_lang_syntax.html">docidx_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key326">docidx commands</a>, <a href="../../../../index.html#key328">docidx language</a>, <a href="../../../../index.html#key329">docidx markup</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/docidx_lang_faq.html.
























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>docidx_lang_faq - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/docidx_lang_faq.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ docidx_lang_faq.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">docidx_lang_faq(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>docidx_lang_faq - docidx language faq</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a>
<ul>
<li class="subsection"><a href="#subsection1">What is this document?</a></li>
</ul>
</li>
<li class="section"><a href="#section3">EXAMPLES</a>
<ul>
<li class="subsection"><a href="#subsection2">Where do I find docidx examples?</a></li>
</ul>
</li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">What is this document?</a></h3>
<p>This document is currently mainly a placeholder, to be filled with
commonly asked questions about the docidx markup language and
companions, and their answers.</p>
<p>Please report any questions (and, if possible, answers) we should
consider for this document in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.</p>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Where do I find docidx examples?</a></h3>
<p>We have no direct examples of documents written using docidx
markup. However the doctools processor <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> does generate
keyword indices when processing a set of documents written in doctools
markup. The intermediate files use docidx markup and are not deleted
when generation completes. These files can therefore serve as
examples.</p>
<p><b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> is distributed as part of Tcllib, so to get it you
need one of</p>
<ol class="enumerated">
<li><p>A CVS snapshot of Tcllib. How to retrieve such a snapshot and the
tools required for this are described at
<a href="http://sourceforge.net/cvs/?group_id=12883">http://sourceforge.net/cvs/?group_id=12883</a></p></li>
<li><p>A Tcllib release archive. They are available at
<a href="http://sourceforge.net/project/showfiles.php?group_id=12883">http://sourceforge.net/project/showfiles.php?group_id=12883</a></p></li>
</ol>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report any such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
the package and/or the documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_lang_cmdref.html">docidx_lang_cmdref</a>, <a href="docidx_lang_intro.html">docidx_lang_intro</a>, <a href="docidx_lang_syntax.html">docidx_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key326">docidx commands</a>, <a href="../../../../index.html#key328">docidx language</a>, <a href="../../../../index.html#key329">docidx markup</a>, <a href="../../../../index.html#key327">docidx syntax</a>, <a href="../../../../index.html#key330">examples</a>, <a href="../../../../index.html#key325">faq</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/docidx_lang_intro.html.





































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>docidx_lang_intro - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/docidx_lang_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ docidx_lang_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">docidx_lang_intro(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>docidx_lang_intro - docidx language introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Fundamentals</a></li>
<li class="subsection"><a href="#subsection2">Basic structure</a></li>
<li class="subsection"><a href="#subsection3">Advanced structure</a></li>
<li class="subsection"><a href="#subsection4">Escapes</a></li>
</ul>
</li>
<li class="section"><a href="#section2">FURTHER READING</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is an informal introduction to version 1 of the docidx
markup language based on a multitude of examples. After reading this a
writer should be ready to understand the two parts of the formal
specification, i.e. the <i class="term"><a href="docidx_lang_syntax.html">docidx language syntax</a></i> specification
and the <i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i>.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Fundamentals</a></h3>
<p>While the <i class="term">docidx markup language</i> is quite similar to the
<i class="term">doctools markup language</i>, in the broadest terms possible,
there is one key difference. An index consists essentially only of
markup commands, with no plain text interspersed between them, except
for whitespace.</p>
<p>Each markup command is a Tcl command surrounded by a matching pair of
<b class="const">[</b> and <b class="const">]</b>. Inside of these delimiters the usual
rules for a Tcl command apply with regard to word quotation, nested
commands, continuation lines, etc. I.e.</p>
<pre class="example">
    ... [key {markup language}] ...
</pre>
<pre class="example">
  ... [manpage thefile \\
          {file description}] ...
</pre>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Basic structure</a></h3>
<p>The most simple document which can be written in docidx is</p>
<pre class="example">
    [index_begin GROUPTITLE TITLE]
    [index_end]
</pre>
<p>Not very useful, but valid. This also shows us that all docidx
documents consist of only one part where we will list all keys and
their references.</p>
<p>A more useful index will contain at least keywords, or short 'keys',
i.e. the phrases which were indexed. So:</p>
<pre class="example">
[index_begin GROUPTITLE TITLE]
[<b class="cmd">key markup</b>]
[<b class="cmd">key {semantic markup}]</b>]
[<b class="cmd">key {docidx markup}</b>]
[<b class="cmd">key {docidx language}</b>]
[<b class="cmd">key {docidx commands}</b>]
[index_end]
</pre>
<p>In the above example the command <b class="cmd">key</b> is used to declare the
keyword phrases we wish to be part of the index.</p>
<p>However a truly useful index does not only list the keyword phrases,
but will also contain references to documents associated with the
keywords. Here is a made-up index for all the manpages in the module
<i class="term"><a href="../../../../index.html#key716">base64</a></i>:</p>
<pre class="example">
[index_begin tcllib/base64 {De- &amp; Encoding}]
[key base64]
[<b class="cmd">manpage base64</b>]
[key encoding]
[<b class="cmd">manpage base64</b>]
[<b class="cmd">manpage uuencode</b>]
[<b class="cmd">manpage yencode</b>]
[key uuencode]
[<b class="cmd">manpage uuencode</b>]
[key yEnc]
[<b class="cmd">manpage yencode</b>]
[key ydecode]
[<b class="cmd">manpage yencode</b>]
[key yencode]
[<b class="cmd">manpage yencode</b>]
[index_end]
</pre>
<p>In the above example the command <b class="cmd"><a href="../../../../index.html#key2">manpage</a></b> is used to insert
references to documents, using symbolic file names, with each command
belonging to the last <b class="cmd">key</b> command coming before it.</p>
<p>The other command to insert references is <b class="cmd"><a href="../../../../index.html#key483">url</a></b>. In contrast to
<b class="cmd"><a href="../../../../index.html#key2">manpage</a></b> it uses explicit (possibly format-specific) urls to
describe the location of the referenced document. As such this command
is intended for the creation of references to external documents which
could not be handled in any other way.</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Advanced structure</a></h3>
<p>In all previous examples we fudged a bit regarding the markup actually
allowed to be used before the <b class="cmd">index_begin</b> command opening the
document.</p>
<p>Instead of only whitespace the two templating commands <b class="cmd">include</b>
and <b class="cmd">vset</b> are also allowed, to enable the writer to either set
and/or import configuration settings relevant to the table of
contents. I.e. it is possible to write</p>
<pre class="example">
[<b class="cmd">include FILE</b>]
[<b class="cmd">vset VAR VALUE</b>]
[index_begin GROUPTITLE TITLE]
...
[index_end]
</pre>
<p>Even more important, these two commands are allowed anywhere where a
markup command is allowed, without regard for any other
structure.</p>
<pre class="example">
[index_begin GROUPTITLE TITLE]
[<b class="cmd">include FILE</b>]
[<b class="cmd">vset VAR VALUE</b>]
...
[index_end]
</pre>
<p>The only restriction <b class="cmd">include</b> has to obey is that the contents of
the included file must be valid at the place of the inclusion. I.e. a
file included before <b class="cmd">index_begin</b> may contain only the templating
commands <b class="cmd">vset</b> and <b class="cmd">include</b>, a file included after a key
may contain only manape or url references, and other keys, etc.</p>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Escapes</a></h3>
<p>Beyond the 6 commands shown so far we have two more available.
However their function is not the marking up of index structure, but
the insertion of characters, namely <b class="const">[</b> and <b class="const">]</b>.
These commands, <b class="cmd">lb</b> and <b class="cmd">rb</b> respectively, are required
because our use of [ and ] to bracket markup commands makes it
impossible to directly use [ and ] within the text.</p>
<p>Our example of their use are the sources of the last sentence in the
previous paragraph, with some highlighting added.</p>
<pre class="example">
  ...
  These commands, [cmd lb] and [cmd lb] respectively, are required
  because our use of [<b class="cmd">lb</b>] and [<b class="cmd">rb</b>] to bracket markup commands makes it
  impossible to directly use [<b class="cmd">lb</b>] and [<b class="cmd">rb</b>] within the text.
  ...
</pre>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">FURTHER READING</a></h2>
<p>Now that this document has been digested the reader, assumed to be a
<i class="term">writer</i> of documentation should be fortified enough to be able
to understand the formal <i class="term"><a href="docidx_lang_syntax.html">docidx language syntax</a></i>
specification as well. From here on out the
<i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i> will also serve as the
detailed specification and cheat sheet for all available commands and
their syntax.</p>
<p>To be able to validate a document while writing it, it is also
recommended to familiarize oneself with Tclapps' ultra-configurable
<b class="syscmd">dtp</b>.</p>
<p>On the other hand, docidx is perfectly suited for the automatic
generation from doctools documents, and this is the route Tcllib's
easy and simple <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> goes, creating an index for a set of
documents behind the scenes, without the writer having to do so on
their own.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_intro.html">docidx_intro</a>, <a href="docidx_lang_cmdref.html">docidx_lang_cmdref</a>, <a href="docidx_lang_syntax.html">docidx_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key326">docidx commands</a>, <a href="../../../../index.html#key328">docidx language</a>, <a href="../../../../index.html#key329">docidx markup</a>, <a href="../../../../index.html#key327">docidx syntax</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/docidx_lang_syntax.html.





















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>docidx_lang_syntax - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/docidx_lang_syntax.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ docidx_lang_syntax.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">docidx_lang_syntax(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>docidx_lang_syntax - docidx language syntax</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Fundamentals</a></li>
<li class="section"><a href="#section3">Lexical definitions</a></li>
<li class="section"><a href="#section4">Syntax</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document contains the formal specification of the syntax of the
docidx markup language, version 1 in Backus-Naur-Form. This document
is intended to be a reference, complementing the
<i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i>.
A beginner should read the much more informally written
<i class="term"><a href="docidx_lang_intro.html">docidx language introduction</a></i> first before trying to
understand either this document or the command reference.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Fundamentals</a></h2>
<p>In the broadest terms possible the <i class="term">docidx markup language</i> is
like SGML and similar languages. A document written in this language
consists primarily of markup commands, with text embedded into it at
some places.</p>
<p>Each markup command is a just Tcl command surrounded by a matching
pair of <b class="const">[</b> and <b class="const">]</b>. Which commands are available,
and their arguments, i.e. syntax is specified in the
<i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i>.</p>
<p>In this document we specify first the lexeme, and then the syntax,
i.e. how we can mix text and markup commands with each other.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Lexical definitions</a></h2>
<p>In the syntax rules listed in the next section</p>
<ol class="enumerated">
<li><p>&lt;TEXT&gt; stands for all text except markup commands.</p></li>
<li><p>Any XXX stands for the markup command [xxx] including its
arguments. Each markup command is a Tcl command surrounded by a
matching pair of <b class="const">[</b> and <b class="const">]</b>. Inside of these
delimiters the usual rules for a Tcl command apply with regard to word
quotation, nested commands, continuation lines, etc.</p></li>
<li><p>&lt;WHITE&gt; stands for all text consisting only of spaces, newlines,
tabulators and the <b class="cmd"><a href="../../../../index.html#key146">comment</a></b> markup command.</p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">Syntax</a></h2>
<p>The rules listed here specify only the syntax of docidx documents. The
lexical level of the language was covered in the previous section.</p>
<p>Regarding the syntax of the (E)BNF itself</p>
<ol class="enumerated">
<li><p>The construct { X } stands for zero or more occurrences of X.</p></li>
<li><p>The construct [ X ] stands for zero or one occurrence of X.</p></li>
</ol>
<p>The syntax:</p>
<pre class="example">
index     = defs
            INDEX_BEGIN
            [ contents ]
            INDEX_END  
            { &lt;WHITE&gt; }
defs      = { INCLUDE | VSET | &lt;WHITE&gt; }
contents  = keyword { keyword }
keyword   = defs KEY ref { ref }
ref       = MANPAGE | URL | defs
</pre>
<p>At last a rule we were unable to capture in the EBNF syntax, as it is
about the arguments of the markup commands, something which is not
modeled here.</p>
<ol class="enumerated">
<li><p>The arguments of all markup commands have to be plain text, and/or text
markup commands, i.e. one of</p>
<ol class="enumerated">
<li><p><b class="cmd">lb</b>,</p></li>
<li><p><b class="cmd">rb</b>, or</p></li>
<li><p><b class="cmd">vset</b> (1-argument form).</p></li>
</ol>
</li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_intro.html">docidx_intro</a>, <a href="docidx_lang_cmdref.html">docidx_lang_cmdref</a>, <a href="docidx_lang_faq.html">docidx_lang_faq</a>, <a href="docidx_lang_intro.html">docidx_lang_intro</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key326">docidx commands</a>, <a href="../../../../index.html#key328">docidx language</a>, <a href="../../../../index.html#key329">docidx markup</a>, <a href="../../../../index.html#key327">docidx syntax</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/docidx_plugin_apiref.html.


























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>docidx_plugin_apiref - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/docidx_plugin_apiref.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ docidx_plugin_apiref.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">docidx_plugin_apiref(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>docidx_plugin_apiref - docidx plugin API reference</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a></li>
<li class="section"><a href="#section3">FRONTEND COMMANDS</a></li>
<li class="section"><a href="#section4">PLUGIN COMMANDS</a>
<ul>
<li class="subsection"><a href="#subsection1">Management commands</a></li>
<li class="subsection"><a href="#subsection2">Formatting commands</a></li>
</ul>
</li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">dt_fmap</b> <i class="arg">symfname</i></a></li>
<li><a href="#2"><b class="cmd">dt_format</b></a></li>
<li><a href="#3"><b class="cmd">dt_read</b> <i class="arg">file</i></a></li>
<li><a href="#4"><b class="cmd">dt_source</b> <i class="arg">file</i></a></li>
<li><a href="#5"><b class="cmd">ex_cappend</b> <i class="arg">text</i></a></li>
<li><a href="#6"><b class="cmd">ex_cget</b> <i class="arg">varname</i></a></li>
<li><a href="#7"><b class="cmd">ex_cis</b> <i class="arg">cname</i></a></li>
<li><a href="#8"><b class="cmd">ex_cname</b></a></li>
<li><a href="#9"><b class="cmd">ex_cpop</b> <i class="arg">cname</i></a></li>
<li><a href="#10"><b class="cmd">ex_cpush</b> <i class="arg">cname</i></a></li>
<li><a href="#11"><b class="cmd">ex_cset</b> <i class="arg">varname</i> <i class="arg">value</i></a></li>
<li><a href="#12"><b class="cmd">ex_lb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></li>
<li><a href="#13"><b class="cmd">ex_rb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></li>
<li><a href="#14"><b class="cmd">idx_initialize</b></a></li>
<li><a href="#15"><b class="cmd">idx_listvariables</b></a></li>
<li><a href="#16"><b class="cmd">idx_numpasses</b></a></li>
<li><a href="#17"><b class="cmd">idx_postprocess</b> <i class="arg">text</i></a></li>
<li><a href="#18"><b class="cmd">idx_setup</b> <i class="arg">n</i></a></li>
<li><a href="#19"><b class="cmd">idx_shutdown</b></a></li>
<li><a href="#20"><b class="cmd">idx_varset</b> <i class="arg">varname</i> <i class="arg">text</i></a></li>
<li><a href="#21"><b class="cmd">fmt_plain_text</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is intended for <i class="term">plugin writers</i>, i.e. developers
wishing to write an index <i class="term"><a href="../../../../index.html#key610">formatting engine</a></i> for some output
format X.</p>
<p>It specifies the interaction between the <b class="package"><a href="../doctools2idx/container.html">doctools::idx</a></b>
package and its plugins, i.e. the interface any index formatting
engine has to comply with.</p>
<p>This document deals with version 1 of the interface.</p>
<p>A reader who is on the other hand more interested in the markup
language itself should start with the
<i class="term"><a href="docidx_lang_intro.html">docidx language introduction</a></i> and proceed from there to the
formal specifications, i.e. the <i class="term"><a href="docidx_lang_syntax.html">docidx language syntax</a></i> and
the <i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<p>The API for an index formatting engine consists of two major sections.</p>
<p>On the one side we have a set of commands through which the plugin is
able to query the frontend. These commands are provided by the
frontend and linked into the plugin interpreter. Please see section
<span class="sectref"><a href="#section3">FRONTEND COMMANDS</a></span> for their detailed specification.</p>
<p>And on the other side the plugin has to provide its own set of
commands which will then be called by the frontend in a specific
sequence while processing input. They, again, fall into two
categories, management and formatting.
Please see section <span class="sectref"><a href="#section4">PLUGIN COMMANDS</a></span> and its subsections for
their detailed specification.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">FRONTEND COMMANDS</a></h2>
<p>This section specifies the set of commands through which a plugin,
also known as an index formatting engine, is able to query the
frontend. These commands are provided by the frontend and linked into
the plugin interpreter.</p>
<p>I.e. an index formatting engine can assume that all of the following
commands are present when any of its own commands (as specified in
section <span class="sectref"><a href="#section4">PLUGIN COMMANDS</a></span>) are executed.</p>
<p>Beyond that it can also assume that it has full access to its own safe
interpreter and thus is not able to damage the other parts of the
processor, nor can it damage the filesystem.
It is however able to either kill or hang the whole process, by
exiting, or running an infinite loop.</p>
<p>Coming back to the imported commands, all the commands with prefix
<em>dt_</em> provide limited access to specific parts of the frontend,
whereas the commands with prefix <em>ex_</em> provide access to the
state of the <b class="package"><a href="../textutil/expander.html">textutil::expander</a></b> object which does the main
parsing of the input within the frontend. These commands should not be
except under very special circumstances.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">dt_fmap</b> <i class="arg">symfname</i></a></dt>
<dd><p>Query command. It returns the actual pathname to use in the output in
place of the symbolic filename <i class="arg">symfname</i>. It will return the
unchanged input if no mapping was established for <i class="arg">symfname</i>.</p>
<p>The required mappings are established with the method <b class="method">map</b> of
a frontend, as explained in section <b class="sectref">OBJECT METHODS</b>
of the documentation for the package <b class="package"><a href="../doctools2idx/container.html">doctools::idx</a></b>.</p></dd>
<dt><a name="2"><b class="cmd">dt_format</b></a></dt>
<dd><p>Query command. It returns the name of the format associated with the
index formatting engine.</p></dd>
<dt><a name="3"><b class="cmd">dt_read</b> <i class="arg">file</i></a></dt>
<dd><p>Controlled filesystem access. Returns contents of <i class="arg">file</i> for
whatever use desired by the plugin.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.</p></dd>
<dt><a name="4"><b class="cmd">dt_source</b> <i class="arg">file</i></a></dt>
<dd><p>Controlled filesystem access. This command allows the index formatting
engine to load additional Tcl code it may need.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.</p></dd>
<dt><a name="5"><b class="cmd">ex_cappend</b> <i class="arg">text</i></a></dt>
<dd><p>Appends a string to the output in the current context.  This command
should rarely be used by macros or application code.</p></dd>
<dt><a name="6"><b class="cmd">ex_cget</b> <i class="arg">varname</i></a></dt>
<dd><p>Retrieves the value of variable <i class="arg">varname</i>, defined in the current
context.</p></dd>
<dt><a name="7"><b class="cmd">ex_cis</b> <i class="arg">cname</i></a></dt>
<dd><p>Determines whether or not the name of the current context is
<i class="arg">cname</i>.</p></dd>
<dt><a name="8"><b class="cmd">ex_cname</b></a></dt>
<dd><p>Returns the name of the current context.</p></dd>
<dt><a name="9"><b class="cmd">ex_cpop</b> <i class="arg">cname</i></a></dt>
<dd><p>Pops a context from the context stack, returning all accumulated
output in that context.  The context must be named <i class="arg">cname</i>, or an
error results.</p></dd>
<dt><a name="10"><b class="cmd">ex_cpush</b> <i class="arg">cname</i></a></dt>
<dd><p>Pushes a context named <i class="arg">cname</i> onto the context stack.  The
context must be popped by <b class="method">cpop</b> before expansion ends or an
error results.</p></dd>
<dt><a name="11"><b class="cmd">ex_cset</b> <i class="arg">varname</i> <i class="arg">value</i></a></dt>
<dd><p>Sets variable <i class="arg">varname</i> to <i class="arg">value</i> in the current context.</p></dd>
<dt><a name="12"><b class="cmd">ex_lb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></dt>
<dd><p>Returns the current value of the left macro expansion bracket; this is
for use as or within a macro, when the bracket needs to be included in
the output text.  If <i class="arg">newbracket</i> is specified, it becomes the new
bracket, and is returned.</p></dd>
<dt><a name="13"><b class="cmd">ex_rb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></dt>
<dd><p>Returns the current value of the right macro expansion bracket; this
is for use as or within a macro, when the bracket needs to be included
in the output text.  If <i class="arg">newbracket</i> is specified, it becomes the
new bracket, and is returned.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">PLUGIN COMMANDS</a></h2>
<p>The plugin has to provide its own set of commands which will then be
called by the frontend in a specific sequence while processing
input. They fall into two categories, management and formatting. Their
expected names, signatures, and responsibilities are specified in the
following two subsections.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Management commands</a></h3>
<p>The management commands a plugin has to provide are used by the
frontend to</p>
<ol class="enumerated">
<li><p>initialize and shutdown the plugin</p></li>
<li><p>determine the number of passes it has
       to make over the input</p></li>
<li><p>initialize and shutdown each pass</p></li>
<li><p>query and initialize engine parameters</p></li>
</ol>
<p>After the plugin has been loaded and the frontend commands are
established the commands will be called in the following sequence:</p>
<pre class="example">
    idx_numpasses -&gt; n
    idx_listvariables -&gt; vars
    idx_varset var1 value1
    idx_varset var2 value2
    ...
    idx_varset varK valueK
    idx_initialize
    idx_setup 1
    ...
    idx_setup 2
    ...
    ...
    idx_setup n
    ...
    idx_postprocess
    idx_shutdown
    ...
</pre>
<p>I.e. first the number of passes and the set of available engine
parameters is established, followed by calls setting the
parameters. That second part is optional.</p>
<p>After that the plugin is initialized, the specified number of passes
executed, the final result run through a global post processing step
and at last the plugin is shutdown again. This can be followed by more
conversions, restarting the sequence at <b class="cmd">idx_varset</b>.</p>
<p>In each of the passes, i.e. after the calls of <b class="cmd">idx_setup</b> the
frontend will process the input and call the formatting commands as
markup is encountered. This means that the sequence of formatting
commands is determined by the grammar of the docidx markup language,
as specified in the <i class="term"><a href="docidx_lang_syntax.html">docidx language syntax</a></i> specification.</p>
<p>A different way of looking at the sequence is:</p>
<ul class="itemized">
<li><p>First some basic parameters are determined.</p></li>
<li><p>Then everything starting at the first <b class="cmd">idx_varset</b> to
<b class="cmd">idx_shutdown</b> forms a <i class="term">run</i>, the formatting of a
single input. Each run can be followed by more.</p></li>
<li><p>Embedded within each run we have one or more <i class="term">passes</i>,
each starting with <b class="cmd">idx_setup</b> and going until either the next
<b class="cmd">idx_setup</b> or <b class="cmd">idx_postprocess</b> is reached.</p>
<p>If more than one pass is required to perform the formatting only the
output of the last pass is relevant. The output of all the previous,
preparatory passes is ignored.</p></li>
</ul>
<p>The commands, their names, signatures, and responsibilities are, in
detail:</p>
<dl class="definitions">
<dt><a name="14"><b class="cmd">idx_initialize</b></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called at the beginning of every conversion run, as
the first command of that run. Note that a run is not a pass, but may
consist of multiple passes.
It has to initialize the general state of the plugin, beyond the
initialization done during the load. No return value is expected, and
any returned value is ignored.</p></dd>
<dt><a name="15"><b class="cmd">idx_listvariables</b></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Engine parameters</em>.
Second command is called after the plugin code has been loaded,
i.e. immediately after <b class="cmd">idx_numpasses</b>.
It has to return a list containing the names of the parameters the
frontend can set to configure the engine. This list can be empty.</p></dd>
<dt><a name="16"><b class="cmd">idx_numpasses</b></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Pass management</em>.
First command called after the plugin code has been loaded. No other
command of the engine will be called before it.
It has to return the number of passes this engine requires to fully
process the input document. This value has to be an integer number
greater or equal to one.</p></dd>
<dt><a name="17"><b class="cmd">idx_postprocess</b> <i class="arg">text</i></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called immediately after the last pass in a run. Its
argument is the result of the conversion generated by that pass. It is
provided to allow the engine to perform any global modifications of
the generated document. If no post-processing is required for a
specific format the command has to just return the argument.</p>
<p>Expected to return a value, the final result of formatting the input.</p></dd>
<dt><a name="18"><b class="cmd">idx_setup</b> <i class="arg">n</i></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Pass management</em>.
This command is called at the beginning of each pass over the input in
a run. Its argument is the number of the pass which has begun. Passes
are counted from <b class="const">1</b> upward.
The command has to set up the internal state of the plugin for this
particular pass. No return value is expected, and any returned value
is ignored.</p></dd>
<dt><a name="19"><b class="cmd">idx_shutdown</b></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called at the end of every conversion run. It is the
last command called in a run. It has to clean up of all the
run-specific state in the plugin.
After the call the engine has to be in a state which allows the
initiation of another run without fear that information from the last
run is leaked into this new run.
No return value is expected, and any returned value is ignored.</p></dd>
<dt><a name="20"><b class="cmd">idx_varset</b> <i class="arg">varname</i> <i class="arg">text</i></a></dt>
<dd><p><em>Engine parameters</em>.
This command is called by the frontend to set an engine parameter to a
particular value.
The parameter to change is specified by <i class="arg">varname</i>, the value to
set in <i class="arg">text</i>.</p>
<p>The command has to throw an error if an unknown <i class="arg">varname</i> is
used. Only the names returned by <b class="cmd">idx_listvariables</b> have to be
considered as known.</p>
<p>The values of all engine parameters have to persist between passes and
runs.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Formatting commands</a></h3>
<p>The formatting commands have to implement the formatting for the
output format, for all the markup commands of the docidx markup
language, except <b class="cmd">lb</b>, <b class="cmd">rb</b>, <b class="cmd">vset</b>, <b class="cmd">include</b>, and
<b class="cmd"><a href="../../../../index.html#key146">comment</a></b>. These exceptions are processed by the frontend and are
never seen by the plugin. In return a command for the formatting of
plain text has to be provided, something which has no markup in the
input at all.</p>
<p>This means, that each of the five markup commands specified in the
<i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i> and outside of the set of
exceptions listed above has an equivalent formatting command which
takes the same arguments as the markup command and whose name is the
name of markup command with the prefix <em>fmt_</em> added to it.</p>
<p>All commands are expected to format their input in some way per the
semantics specified in the command reference and to return whatever
part of this that they deem necessary as their result, which will be
added to the output.</p>
<p>To avoid essentially duplicating the command reference we do not list
any of the command here and simply refer the reader to the
<i class="term"><a href="docidx_lang_cmdref.html">docidx language command reference</a></i> for their signature and
description. The sole exception is the plain text formatter, which has
no equivalent markup command.</p>
<p>The calling sequence of formatting commands is not as rigid as for the
management commands, but determined by the grammar of the docidx
markup language, as specified in the <i class="term"><a href="docidx_lang_syntax.html">docidx language syntax</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="21"><b class="cmd">fmt_plain_text</b> <i class="arg">text</i></a></dt>
<dd><p><em>No associated markup command</em>.</p>
<p>Called by the frontend for any plain text encountered in the
input. It has to perform any and all special processing required for
plain text.</p>
<p>The formatted text is expected as the result of the command,
and added to the output. If no special processing is required it has
to simply return its argument without change.</p></dd>
</dl>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_intro.html">docidx_intro</a>, <a href="docidx_lang_cmdref.html">docidx_lang_cmdref</a>, <a href="docidx_lang_faq.html">docidx_lang_faq</a>, <a href="docidx_lang_intro.html">docidx_lang_intro</a>, <a href="docidx_lang_syntax.html">docidx_lang_syntax</a>, <a href="../doctools2idx/container.html">doctools::idx</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key610">formatting engine</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key717">index formatter</a>, <a href="../../../../index.html#key718">keywords</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctoc.html.






























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctoc.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003-2010 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc(n) 1.1.3 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc - doctoc - Processing tables of contents</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a>
<ul>
<li class="subsection"><a href="#subsection1">PACKAGE COMMANDS</a></li>
<li class="subsection"><a href="#subsection2">OBJECT COMMAND</a></li>
<li class="subsection"><a href="#subsection3">OBJECT METHODS</a></li>
<li class="subsection"><a href="#subsection4">OBJECT CONFIGURATION</a></li>
<li class="subsection"><a href="#subsection5">FORMAT MAPPING</a></li>
</ul>
</li>
<li class="section"><a href="#section3">PREDEFINED ENGINES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">doctools::toc <span class="opt">?1.1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::toc::new</b> <i class="arg">objectName</i> <span class="opt">?<b class="option">-option</b> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#2"><b class="cmd">::doctools::toc::help</b></a></li>
<li><a href="#3"><b class="cmd">::doctools::toc::search</b> <i class="arg">path</i></a></li>
<li><a href="#4"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">configure</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">cget</b> <b class="option">-option</b></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">format</b> <i class="arg">text</i></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">map</b> <i class="arg">symbolic</i> <i class="arg">actual</i></a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">parameters</b></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">search</b> <i class="arg">path</i></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">setparam</b> <i class="arg">name</i> <i class="arg">value</i></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">warnings</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for the creation of objects able to
process and convert text written in the <i class="term"><a href="../../../../index.html#key230">doctoc</a></i> markup language
into any output format X for which a <i class="term"><a href="../../../../index.html#key610">formatting engine</a></i> is
available.</p>
<p>A reader interested in the markup language itself should start with
the <i class="term"><a href="doctoc_lang_intro.html">doctoc language introduction</a></i> and proceed from there to
the formal specifications, i.e. the <i class="term"><a href="doctoc_lang_syntax.html">doctoc language syntax</a></i>
and the <i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i>.</p>
<p>If on the other hand the reader wishes to write her own formatting
engine for some format, i.e. is a <i class="term">plugin writer</i> then reading
and understanding the <i class="term"><a href="doctoc_plugin_apiref.html">doctoc plugin API reference</a></i> is an
absolute necessity, as that document specifies the interaction between
this package and its plugins, i.e. the formatting engines, in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">PACKAGE COMMANDS</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::toc::new</b> <i class="arg">objectName</i> <span class="opt">?<b class="option">-option</b> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>This command creates a new doctoc object with an associated Tcl
command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is
explained in full detail in the sections <span class="sectref"><a href="#subsection2">OBJECT COMMAND</a></span>
and <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p>
<p>The options and their values coming after the name of the object are
used to set the initial configuration of the object.</p></dd>
<dt><a name="2"><b class="cmd">::doctools::toc::help</b></a></dt>
<dd><p>This is a convenience command for applications wishing to provide
their user with a short description of the available formatting
commands and their meanings. It returns a string containing a standard
help text.</p></dd>
<dt><a name="3"><b class="cmd">::doctools::toc::search</b> <i class="arg">path</i></a></dt>
<dd><p>Whenever an object created by this the package has to map the name of
a format to the file containing the code for its formatting engine it
will search for the file in a number of directories stored in a
list. See section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span> for more explanations.</p>
<p>This list not only contains three default directories which are
declared by the package itself, but is also extensible user of the
package.
This command is the means to do so. When given a <i class="arg">path</i> to an
existing and readable directory it will prepend that directory to the
list of directories to search. This means that the <i class="arg">path</i> added
last is later searched through first.</p>
<p>An error will be thrown if the <i class="arg">path</i> either does not exist, is
not a directory, or is not readable.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">OBJECT COMMAND</a></h3>
<p>All commands created by <b class="cmd">::doctools::toc::new</b> have the following
general form and may be used to invoke various operations on their
doctoc converter object.</p>
<dl class="definitions">
<dt><a name="4"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the exact
behavior of the command. See section <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span> for
the detailed specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OBJECT METHODS</a></h3>
<dl class="definitions">
<dt><a name="5"><i class="arg">objectName</i> <b class="method">configure</b></a></dt>
<dd><p>The method returns a list of all known options and their current
values when called without any arguments.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>The method behaves like the method <b class="method">cget</b> when called with a
single argument and returns the value of the option specified by said
argument.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>The method reconfigures the specified <b class="option">option</b>s of the object,
setting them to the associated <i class="arg">value</i>s, when called with an even
number of arguments, at least two.</p>
<p>The legal options are described in the section
<span class="sectref"><a href="#subsection4">OBJECT CONFIGURATION</a></span>.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">cget</b> <b class="option">-option</b></a></dt>
<dd><p>This method expects a legal configuration option as argument and will
return the current value of that option for the object the method was
invoked for.</p>
<p>The legal configuration options are described in section
<span class="sectref"><a href="#subsection4">OBJECT CONFIGURATION</a></span>.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">format</b> <i class="arg">text</i></a></dt>
<dd><p>This method runs the <i class="arg">text</i> through the configured formatting
engine and returns the generated string as its result. An error will
be thrown if no <b class="option">-format</b> was configured for the object.</p>
<p>The method assumes that the <i class="arg">text</i> is in <i class="term"><a href="../../../../index.html#key230">doctoc</a></i> format as
specified in the companion document <i class="term">doctoc_fmt</i>. Errors will be
thrown otherwise.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">map</b> <i class="arg">symbolic</i> <i class="arg">actual</i></a></dt>
<dd><p>This methods add one entry to the per-object mapping from
<i class="arg">symbolic</i> filenames to the <i class="arg">actual</i> uris.
The object just stores this mapping and makes it available to the
configured formatting engine through the command <b class="cmd">dt_fmap</b>.
This command is described in more detail in the
<i class="term"><a href="doctoc_plugin_apiref.html">doctoc plugin API reference</a></i> which specifies the interaction
between the objects created by this package and toc formatting
engines.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">parameters</b></a></dt>
<dd><p>This method returns a list containing the names of all engine
parameters provided by the configured formatting engine. It will
return an empty list if the object is not yet configured for a
specific format.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">search</b> <i class="arg">path</i></a></dt>
<dd><p>This method extends the per-object list of paths searched for toc
formatting engines. See also the command <b class="cmd">::doctools::toc::search</b>
on how to extend the per-package list of paths. Note that the path
entered last will be searched first.
For more details see section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span>.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">setparam</b> <i class="arg">name</i> <i class="arg">value</i></a></dt>
<dd><p>This method sets the <i class="arg">name</i>d engine parameter to the specified
<i class="arg">value</i>.
It will throw an error if the object is either not yet configured for
a specific format, or if the formatting engine for the configured
format does not provide a parameter with the given <i class="arg">name</i>.
The list of parameters provided by the configured formatting engine
can be retrieved through the method <b class="method">parameters</b>.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">warnings</b></a></dt>
<dd><p>This method returns a list containing all the warnings which were
generated by the configured formatting engine during the last
invocation of the method <b class="method">format</b>.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">OBJECT CONFIGURATION</a></h3>
<p>All doctoc objects understand the following configuration options:</p>
<dl class="options">
<dt><b class="option">-file</b> <i class="arg">file</i></dt>
<dd><p>The argument of this option is stored in the object and made available
to the configured formatting engine through the command <b class="cmd">dt_file</b>.
This command is described in more detail in the companion document
<i class="term">doctoc_api</i> which specifies the API between the object and
formatting engines.</p>
<p>The default value of this option is the empty string.</p>
<p>The configured formatting engine should interpret the value as the
name of the file containing the document which is currently processed.</p></dd>
<dt><b class="option">-format</b> <i class="arg">text</i></dt>
<dd><p>The argument of this option specifies the format to generate and by
implication the formatting engine to use when converting text via the
method <b class="method">format</b>. Its default value is the empty string. The
method <b class="method">format</b> cannot be used if this option is not set to a
valid value at least once.</p>
<p>The package will immediately try to map the given name to a file
containing the code for a formatting engine generating that format. An
error will be thrown if this mapping fails. In that case a previously
configured format is left untouched.</p>
<p>The section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span> explains in detail how the
package and object will look for engine implementations.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">FORMAT MAPPING</a></h3>
<p>The package and object will perform the following algorithm when
trying to map a format name <i class="term">foo</i> to a file containing an
implementation of a formatting engine for <i class="term">foo</i>:</p>
<ol class="enumerated">
<li><p>If <i class="term">foo</i> is the name of an existing file then this file is
directly taken as the implementation.</p></li>
<li><p>If not, the list of per-object search paths is searched. For each
directory in the list the package checks if that directory contains a
file &quot;<b class="file">toc.<i class="term">foo</i></b>&quot;. If yes, then that file is taken as the
implementation.</p>
<p>Note that this list of paths is initially empty and can be extended
through the object method <b class="method">search</b>.</p></li>
<li><p>If not, the list of package paths is searched.
For each directory in the list the package checks if that directory
contains a file &quot;<b class="file">toc.<i class="term">foo</i></b>&quot;. If yes, then that file is taken
as the implementation.</p>
<p>This list of paths can be extended
through the command <b class="cmd">::doctools::toc::search</b>.
It contains initially one path, the subdirectory &quot;<b class="file">mpformats</b>&quot; of
the directory the package itself is located in. In other words, if the
package implementation &quot;<b class="file">doctoc.tcl</b>&quot; is installed in the directory
&quot;<b class="file">/usr/local/lib/tcllib/doctools</b>&quot; then it will by default search
the directory &quot;<b class="file">/usr/local/lib/tcllib/doctools/mpformats</b>&quot; for
format implementations.</p></li>
<li><p>The mapping fails.</p></li>
</ol>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">PREDEFINED ENGINES</a></h2>
<p>The package provides predefined formatting engines for the following
formats. Some of the formatting engines support engine
parameters. These will be explicitly highlighted.</p>
<dl class="definitions">
<dt>html</dt>
<dd><p>This engine generates HTML markup, for processing by web browsers and
the like. This engine supports three parameters:</p>
<dl class="definitions">
<dt>footer</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
before the <b class="const">&lt;/body&gt;</b> tag, closing the body of the generated
HTML.</p>
<p>This can be used to insert boilerplate footer markup into the
generated document.</p></dd>
<dt>header</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the <b class="const">&lt;body&gt;</b> tag, starting the body of the generated HTML.</p>
<p>This can be used to insert boilerplate header markup into the
generated document.</p></dd>
<dt>meta</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the header section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the <b class="const">&lt;head&gt;</b> tag, starting the header section of the
generated HTML.</p>
<p>This can be used to insert boilerplate meta data markup into the
generated document, like references to a stylesheet, standard meta
keywords, etc.</p></dd>
</dl></dd>
<dt>latex</dt>
<dd><p>This engine generates output suitable for the <b class="syscmd"><a href="../../../../index.html#key167">latex</a></b> text
processor coming out of the TeX world.</p></dd>
<dt>list</dt>
<dd><p>This engine retrieves version, section and title of the manpage from
the document. As such it can be used to generate a directory listing
for a set of manpages.</p></dd>
<dt>nroff</dt>
<dd><p>This engine generates nroff output, for processing by <b class="syscmd"><a href="../../../../index.html#key5">nroff</a></b>,
or <b class="syscmd">groff</b>. The result will be standard man pages as they are
known in the unix world.</p></dd>
<dt>null</dt>
<dd><p>This engine generates no outout at all. This can be used if one just
wants to validate some input.</p></dd>
<dt>tmml</dt>
<dd><p>This engine generates TMML markup as specified by Joe English. The Tcl
Manpage Markup Language is a derivate of XML.</p></dd>
<dt>wiki</dt>
<dd><p>This engine generates Wiki markup as understood by Jean Claude
Wippler's <b class="syscmd">wikit</b> application.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctoc_intro.html">doctoc_intro</a>, <a href="doctoc_lang_cmdref.html">doctoc_lang_cmdref</a>, <a href="doctoc_lang_intro.html">doctoc_lang_intro</a>, <a href="doctoc_lang_syntax.html">doctoc_lang_syntax</a>, <a href="doctoc_plugin_apiref.html">doctoc_plugin_apiref</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key4">TMML</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key167">latex</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a>, <a href="../../../../index.html#key164">wiki</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003-2010 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctoc_intro.html.


































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctoc_intro - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctoc_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctoc_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctoc_intro(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctoc_intro - doctoc introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">RELATED FORMATS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><i class="term"><a href="../../../../index.html#key230">doctoc</a></i> (short for <em>documentation tables of contents</em>)
stands for a set of related, yet different, entities which are working
together for the easy creation and transformation of tables of
contents for documentation. These are</p>
<ol class="enumerated">
<li><p>A tcl based language for the semantic markup of a table of
contents. Markup is represented by Tcl commands.</p></li>
<li><p>A package providing the ability to read and transform texts written in
that markup language. It is important to note that the actual
transformation of the input text is delegated to plugins.</p></li>
<li><p>An API describing the interface between the package above and a
plugin.</p></li>
</ol>
<p>Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.</p>
<ol class="enumerated">
<li><p>A <i class="term">writer</i> of documentation has to understand the markup language
itself. A beginner to doctoc should read the more informally written
<i class="term"><a href="doctoc_lang_intro.html">doctoc language introduction</a></i> first. Having digested this
the formal <i class="term"><a href="doctoc_lang_syntax.html">doctoc language syntax</a></i> specification should
become understandable. A writer experienced with doctoc may only
need the <i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i> from time to
time to refresh her memory.</p>
<p>While a document is written the <b class="syscmd">dtp</b> application can be used
to validate it, and after completion it also performs the conversion
into the chosen system of visual markup, be it *roff, HTML, plain
text, wiki, etc. The simpler <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> application makes
internal use of doctoc when handling directories of documentation,
automatically generating a proper table of contents for them.</p></li>
<li><p>A <i class="term">processor</i> of documentation written in the <i class="term"><a href="../../../../index.html#key230">doctoc</a></i>
markup language has to know which tools are available for use.</p>
<p>The main tool is the aforementioned <b class="syscmd">dtp</b> application provided
by Tcllib. The simpler <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> does not expose doctoc to the
user.
At the bottom level, common to both applications, however sits the
package <b class="package">doctoools::toc</b>, providing the basic facilities to
read and process files containing text in the doctoc format.</p></li>
<li><p>At last, but not least, <i class="term">plugin writers</i> have to understand the
interaction between the <b class="package"><a href="../doctools2toc/container.html">doctools::toc</a></b> package and its
plugins, as described in the <i class="term"><a href="doctoc_plugin_apiref.html">doctoc plugin API reference</a></i>.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">RELATED FORMATS</a></h2>
<p>doctoc does not stand alone, it has two companion formats. These are
called <i class="term"><a href="../../../../index.html#key50">docidx</a></i> and <i class="term"><a href="../../../../index.html#key51">doctools</a></i>, and they are for the markup
of <i class="term">keyword indices</i>, and general documentation, respectively.
They are described in their own sets of documents, starting at the
<i class="term"><a href="docidx_intro.html">docidx introduction</a></i> and the <i class="term"><a href="doctools_intro.html">doctools introduction</a></i>,
respectively.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_intro.html">docidx_intro</a>, <a href="doctoc_lang_cmdref.html">doctoc_lang_cmdref</a>, <a href="doctoc_lang_faq.html">doctoc_lang_faq</a>, <a href="doctoc_lang_intro.html">doctoc_lang_intro</a>, <a href="doctoc_lang_syntax.html">doctoc_lang_syntax</a>, <a href="doctoc_plugin_apiref.html">doctoc_plugin_apiref</a>, <a href="../doctools2toc/container.html">doctools::toc</a>, <a href="doctools_intro.html">doctools_intro</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctoc_lang_cmdref.html.









































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctoc_lang_cmdref - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctoc_lang_cmdref.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctoc_lang_cmdref.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctoc_lang_cmdref(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctoc_lang_cmdref - doctoc language command reference</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Commands</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key146">comment</a></b> <i class="arg">plaintext</i></a></li>
<li><a href="#2"><b class="cmd">division_end</b></a></li>
<li><a href="#3"><b class="cmd">division_start</b> <i class="arg">text</i> <span class="opt">?<i class="arg">symfile</i>?</span></a></li>
<li><a href="#4"><b class="cmd">include</b> <i class="arg">filename</i></a></li>
<li><a href="#5"><b class="cmd">item</b> <i class="arg">file</i> <i class="arg">text</i> <i class="arg">desc</i></a></li>
<li><a href="#6"><b class="cmd">lb</b></a></li>
<li><a href="#7"><b class="cmd">rb</b></a></li>
<li><a href="#8"><b class="cmd">toc_begin</b> <i class="arg">text</i> <i class="arg">title</i></a></li>
<li><a href="#9"><b class="cmd">toc_end</b></a></li>
<li><a href="#10"><b class="cmd">vset</b> <i class="arg">varname</i> <i class="arg">value</i></a></li>
<li><a href="#11"><b class="cmd">vset</b> <i class="arg">varname</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document specifies both names and syntax of all the commands
which together are the doctoc markup language, version 1.
As this document is intended to be a reference the commands are listed
in alphabetical order, and the descriptions are relatively short.
A beginner should read the much more informally written
<i class="term"><a href="doctoc_lang_intro.html">doctoc language introduction</a></i> first.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Commands</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key146">comment</a></b> <i class="arg">plaintext</i></a></dt>
<dd><p>Toc markup. The argument text is marked up as a comment standing
outside of the actual text of the document. Main use is in free-form
text.</p></dd>
<dt><a name="2"><b class="cmd">division_end</b></a></dt>
<dd><p>Toc structure. This command closes the division opened by the last
<b class="cmd">division_begin</b> command coming before it, and not yet closed.</p></dd>
<dt><a name="3"><b class="cmd">division_start</b> <i class="arg">text</i> <span class="opt">?<i class="arg">symfile</i>?</span></a></dt>
<dd><p>Toc structure. This command opens a division in the table of
contents. Its counterpart is <b class="cmd">division_end</b>. Together they allow a
user to give a table of contents additional structure.</p>
<p>The title of the new division is provided by the argument <i class="arg">text</i>.</p>
<p>If the symbolic filename <i class="arg">symfile</i> is present then the section
title should link to the referenced document, if links are supported
by the output format.</p></dd>
<dt><a name="4"><b class="cmd">include</b> <i class="arg">filename</i></a></dt>
<dd><p>Templating. The contents of the named file are interpreted as text
written in the doctoc markup and processed in the place of the
include command. The markup in the file has to be self-contained. It
is not possible for a markup command to cross the file boundaries.</p></dd>
<dt><a name="5"><b class="cmd">item</b> <i class="arg">file</i> <i class="arg">text</i> <i class="arg">desc</i></a></dt>
<dd><p>Toc structure. This command adds an individual element to the table of
contents. Each such element refers to a document. The document is
specified through the symbolic name <i class="arg">file</i>. The <i class="arg">text</i>
argument is used to label the reference, whereas the <i class="arg">desc</i>
provides a short descriptive text of that document.</p>
<p>The symbolic names are used to preserve the convertibility of this
format to any output format. The actual name of the file will be
inserted by the chosen formatting engine when converting the
input. This will be based on a mapping from symbolic to actual names
given to the engine.</p></dd>
<dt><a name="6"><b class="cmd">lb</b></a></dt>
<dd><p>Text. The command is replaced with a left bracket. Use in free-form
text. Required to avoid interpretation of a left bracket as the start
of a markup command. Its usage is restricted to the arguments of other
markup commands.</p></dd>
<dt><a name="7"><b class="cmd">rb</b></a></dt>
<dd><p>Text. The command is replaced with a right bracket. Use in free-form
text. Required to avoid interpretation of a right bracket as the end
of a markup command. Its usage is restricted to the arguments of other
commands.</p></dd>
<dt><a name="8"><b class="cmd">toc_begin</b> <i class="arg">text</i> <i class="arg">title</i></a></dt>
<dd><p>Document structure. The command to start a table of contents. The
arguments are a label for the whole group of documents the index
refers to (<i class="arg">text</i>) and the overall title text for the index
(<i class="arg">title</i>), without markup.</p>
<p>The label often is the name of the package (or extension) the
documents belong to.</p></dd>
<dt><a name="9"><b class="cmd">toc_end</b></a></dt>
<dd><p>Document structure. Command to end a table of contents. Anything in
the document coming after this command is in error.</p></dd>
<dt><a name="10"><b class="cmd">vset</b> <i class="arg">varname</i> <i class="arg">value</i></a></dt>
<dd><p>Templating. In this form the command sets the named document variable
to the specified <i class="arg">value</i>. It does not generate output. I.e. the
command is replaced by the empty string.</p></dd>
<dt><a name="11"><b class="cmd">vset</b> <i class="arg">varname</i></a></dt>
<dd><p>Templating. In this form the command is replaced by the value of the
named document variable</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctoc_intro.html">doctoc_intro</a>, <a href="doctoc_lang_faq.html">doctoc_lang_faq</a>, <a href="doctoc_lang_intro.html">doctoc_lang_intro</a>, <a href="doctoc_lang_syntax.html">doctoc_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key465">doctoc commands</a>, <a href="../../../../index.html#key463">doctoc language</a>, <a href="../../../../index.html#key464">doctoc markup</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctoc_lang_faq.html.
























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctoc_lang_faq - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctoc_lang_faq.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctoc_lang_faq.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctoc_lang_faq(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctoc_lang_faq - doctoc language faq</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a>
<ul>
<li class="subsection"><a href="#subsection1">What is this document?</a></li>
</ul>
</li>
<li class="section"><a href="#section3">EXAMPLES</a>
<ul>
<li class="subsection"><a href="#subsection2">Where do I find doctoc examples?</a></li>
</ul>
</li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">What is this document?</a></h3>
<p>This document is currently mainly a placeholder, to be filled with
commonly asked questions about the doctoc markup language and
companions, and their answers.</p>
<p>Please report any questions (and, if possible, answers) we should
consider for this document in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.</p>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Where do I find doctoc examples?</a></h3>
<p>We have no direct examples of documents written using doctoc
markup. However the doctools processor <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> does generate
a table of contents when processing a set of documents written in
doctools markup. The intermediate file for it uses doctoc markup and
is not deleted when generation completes. Such files can therefore
serve as examples.</p>
<p><b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> is distributed as part of Tcllib, so to get it you
need one of</p>
<ol class="enumerated">
<li><p>A CVS snapshot of Tcllib. How to retrieve such a snapshot and the
tools required for this are described at
<a href="http://sourceforge.net/cvs/?group_id=12883">http://sourceforge.net/cvs/?group_id=12883</a></p></li>
<li><p>A Tcllib release archive. They are available at
<a href="http://sourceforge.net/project/showfiles.php?group_id=12883">http://sourceforge.net/project/showfiles.php?group_id=12883</a></p></li>
</ol>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report any such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
the package and/or the documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctoc_lang_cmdref.html">doctoc_lang_cmdref</a>, <a href="doctoc_lang_intro.html">doctoc_lang_intro</a>, <a href="doctoc_lang_syntax.html">doctoc_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key465">doctoc commands</a>, <a href="../../../../index.html#key463">doctoc language</a>, <a href="../../../../index.html#key464">doctoc markup</a>, <a href="../../../../index.html#key499">doctoc syntax</a>, <a href="../../../../index.html#key330">examples</a>, <a href="../../../../index.html#key325">faq</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctoc_lang_intro.html.






































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctoc_lang_intro - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctoc_lang_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctoc_lang_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctoc_lang_intro(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctoc_lang_intro - doctoc language introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Fundamentals</a></li>
<li class="subsection"><a href="#subsection2">Basic structure</a></li>
<li class="subsection"><a href="#subsection3">Items</a></li>
<li class="subsection"><a href="#subsection4">Divisions</a></li>
<li class="subsection"><a href="#subsection5">Advanced structure</a></li>
<li class="subsection"><a href="#subsection6">Escapes</a></li>
</ul>
</li>
<li class="section"><a href="#section2">FURTHER READING</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is an informal introduction to version 1.1 of the doctoc
markup language based on a multitude of examples. After reading this a
writer should be ready to understand the two parts of the formal
specification, i.e. the <i class="term"><a href="doctoc_lang_syntax.html">doctoc language syntax</a></i> specification
and the <i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i>.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Fundamentals</a></h3>
<p>While the <i class="term">doctoc markup language</i> is quite similar to the
<i class="term">doctools markup language</i>, in the broadest terms possible,
there is one key difference. A table of contents consists essentially
only of markup commands, with no plain text interspersed between them,
except for whitespace.</p>
<p>Each markup command is a Tcl command surrounded by a matching pair of
<b class="const">[</b> and <b class="const">]</b>. Inside of these delimiters the usual
rules for a Tcl command apply with regard to word quotation, nested
commands, continuation lines, etc. I.e.</p>
<pre class="example">
    ... [division_start {Appendix 1}] ...
</pre>
<pre class="example">
  ... [item thefile \\
          label {file description}] ...
</pre>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Basic structure</a></h3>
<p>The most simple document which can be written in doctoc is</p>
<pre class="example">
    [toc_begin GROUPTITLE TITLE]
    [toc_end]
</pre>
<p>This also shows us that all doctoc documents consist of only one
part where we will list <i class="term">items</i> and <i class="term">divisions</i>.</p>
<p>The user is free to mix these as she sees fit. This is a change from
version 1 of the language, which did not allow this mixing, but only
the use of either a series of items or a series of divisions.</p>
<p>We will discuss the commands for each of these two possibilities in
the next sections.</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Items</a></h3>
<p>Use the command <b class="cmd">item</b> to put an <i class="term">item</i> into a table of
contents. This is essentially a reference to a section, subsection,
etc. in the document, or set of documents, the table of contents is
for. The command takes three arguments, a symbolic name for the file
the item is for and two text to label the item and describe the
referenced section.</p>
<p>Symbolic names are used to preserve the convertibility of this format
to any output format. The actual name of any file will be inserted by
the chosen formatting engine when converting the input, based on a
mapping from symbolic to actual names given to the engine.</p>
<p>Here a made up example for a table of contents of this document:</p>
<pre class="example">
[toc_begin Doctoc {Language Introduction}]
[<b class="cmd">item 1 DESCRIPTION</b>]
[<b class="cmd">item 1.1 {Basic structure}</b>]
[<b class="cmd">item 1.2 Items</b>]
[<b class="cmd">item 1.3 Divisions</b>]
[<b class="cmd">item 2 {FURTHER READING}</b>]
[toc_end]
</pre>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Divisions</a></h3>
<p>One thing of notice in the last example in the previous section is
that the referenced sections actually had a nested structure,
something which was expressed in the item labels, by using a common
prefix for all the sections nested under section 1.</p>
<p>This kind of structure can be made more explicit in the doctoc
language by using divisions. Instead of using a series of plain items
we use a series of divisions for the major references, and then place
the nested items inside of these.</p>
<p>Of course, instead of the nested items we can again use divisions and
thus nest arbitrarily deep.</p>
<p>A division is marked by two commands instead of one, one to start it,
the other to close the last opened division. They are:</p>
<dl class="commands">
<dt><b class="cmd">division_start</b></dt>
<dd><p>This command opens a new division. It takes one or two arguments, the
title of the division, and the symbolic name of the file it refers
to. The latter is optional.
If the symbolic filename is present then the section title should link
to the referenced document, if links are supported by the output
format.</p></dd>
<dt><b class="cmd">division_end</b></dt>
<dd><p>This command closes the last opened and not yet closed division.</p></dd>
</dl>
<p>Using this we can recast the last example like this</p>
<pre class="example">
[toc_begin Doctoc {Language Introduction}]
[<b class="cmd">division_start DESCRIPTION</b>]
[item 1 {Basic structure}]
[item 2 Items]
[item 3 Divisions]
[<b class="cmd">division_end</b>]
[<b class="cmd">division_start {FURTHER READING}</b>]
[<b class="cmd">division_end</b>]
[toc_end]
</pre>
<p>Or, to demonstrate deeper nesting</p>
<pre class="example">
[toc_begin Doctoc {Language Introduction}]
[<b class="cmd">division_start DESCRIPTION</b>]
[<b class="cmd">division_start {Basic structure}</b>]
[item 1 Do]
[item 2 Re]
[<b class="cmd">division_end</b>]
[<b class="cmd">division_start Items</b>]
[item a Fi]
[item b Fo]
[item c Fa]
[<b class="cmd">division_end</b>]
[<b class="cmd">division_start Divisions</b>]
[item 1 Sub]
[item 1 Zero]
[<b class="cmd">division_end</b>]
[<b class="cmd">division_end</b>]
[<b class="cmd">division_start {FURTHER READING}</b>]
[<b class="cmd">division_end</b>]
[toc_end]
</pre>
<p>And do not forget, it is possible to freely mix items and divisions,
and to have empty divisions.</p>
<pre class="example">
[toc_begin Doctoc {Language Introduction}]
[item 1 Do]
[<b class="cmd">division_start DESCRIPTION</b>]
[<b class="cmd">division_start {Basic structure}</b>]
[item 2 Re]
[<b class="cmd">division_end</b>]
[item a Fi]
[<b class="cmd">division_start Items</b>]
[item b Fo]
[item c Fa]
[<b class="cmd">division_end</b>]
[<b class="cmd">division_start Divisions</b>]
[<b class="cmd">division_end</b>]
[<b class="cmd">division_end</b>]
[<b class="cmd">division_start {FURTHER READING}</b>]
[<b class="cmd">division_end</b>]
[toc_end]
</pre>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Advanced structure</a></h3>
<p>In all previous examples we fudged a bit regarding the markup actually
allowed to be used before the <b class="cmd">toc_begin</b> command opening the
document.</p>
<p>Instead of only whitespace the two templating commands <b class="cmd">include</b>
and <b class="cmd">vset</b> are also allowed, to enable the writer to either set
and/or import configuration settings relevant to the table of
contents. I.e. it is possible to write</p>
<pre class="example">
[<b class="cmd">include FILE</b>]
[<b class="cmd">vset VAR VALUE</b>]
[toc_begin GROUPTITLE TITLE]
...
[toc_end]
</pre>
<p>Even more important, these two commands are allowed anywhere where a
markup command is allowed, without regard for any other
structure.</p>
<pre class="example">
[toc_begin GROUPTITLE TITLE]
[<b class="cmd">include FILE</b>]
[<b class="cmd">vset VAR VALUE</b>]
...
[toc_end]
</pre>
<p>The only restriction <b class="cmd">include</b> has to obey is that the contents of
the included file must be valid at the place of the inclusion. I.e. a
file included before <b class="cmd">toc_begin</b> may contain only the templating
commands <b class="cmd">vset</b> and <b class="cmd">include</b>, a file included in a division
may contain only items or divisions commands, etc.</p>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Escapes</a></h3>
<p>Beyond the 6 commands shown so far we have two more available.
However their function is not the marking up of toc structure, but the
insertion of characters, namely <b class="const">[</b> and <b class="const">]</b>.
These commands, <b class="cmd">lb</b> and <b class="cmd">rb</b> respectively, are required
because our use of [ and ] to bracket markup commands makes it
impossible to directly use [ and ] within the text.</p>
<p>Our example of their use are the sources of the last sentence in the
previous paragraph, with some highlighting added.</p>
<pre class="example">
  ...
  These commands, [cmd lb] and [cmd lb] respectively, are required
  because our use of [<b class="cmd">lb</b>] and [<b class="cmd">rb</b>] to bracket markup commands makes it
  impossible to directly use [<b class="cmd">lb</b>] and [<b class="cmd">rb</b>] within the text.
  ...
</pre>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">FURTHER READING</a></h2>
<p>Now that this document has been digested the reader, assumed to be a
<i class="term">writer</i> of documentation should be fortified enough to be able
to understand the formal <i class="term"><a href="doctoc_lang_syntax.html">doctoc language syntax</a></i>
specification as well. From here on out the
<i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i> will also serve as the
detailed specification and cheat sheet for all available commands and
their syntax.</p>
<p>To be able to validate a document while writing it, it is also
recommended to familiarize oneself with Tclapps' ultra-configurable
<b class="syscmd">dtp</b>.</p>
<p>On the other hand, doctoc is perfectly suited for the automatic
generation from doctools documents, and this is the route Tcllib's
easy and simple <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> goes, creating a table of contents
for a set of documents behind the scenes, without the writer having to
do so on their own.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctoc_intro.html">doctoc_intro</a>, <a href="doctoc_lang_cmdref.html">doctoc_lang_cmdref</a>, <a href="doctoc_lang_syntax.html">doctoc_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key465">doctoc commands</a>, <a href="../../../../index.html#key463">doctoc language</a>, <a href="../../../../index.html#key464">doctoc markup</a>, <a href="../../../../index.html#key499">doctoc syntax</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctoc_lang_syntax.html.










































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctoc_lang_syntax - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctoc_lang_syntax.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctoc_lang_syntax.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctoc_lang_syntax(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctoc_lang_syntax - doctoc language syntax</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Fundamentals</a></li>
<li class="section"><a href="#section3">Lexical definitions</a></li>
<li class="section"><a href="#section4">Syntax</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document contains the formal specification of the syntax of the
doctoc markup language, version 1.1 in Backus-Naur-Form. This document
is intended to be a reference, complementing the
<i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i>.
A beginner should read the much more informally written
<i class="term"><a href="doctoc_lang_intro.html">doctoc language introduction</a></i> first before trying to
understand either this document or the command reference.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Fundamentals</a></h2>
<p>In the broadest terms possible the <i class="term">doctoc markup language</i> is
like SGML and similar languages. A document written in this language
consists primarily of markup commands, with text embedded into it at
some places.</p>
<p>Each markup command is a just Tcl command surrounded by a matching
pair of <b class="const">[</b> and <b class="const">]</b>. Which commands are available,
and their arguments, i.e. syntax is specified in the
<i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i>.</p>
<p>In this document we specify first the lexeme, and then the syntax,
i.e. how we can mix text and markup commands with each other.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Lexical definitions</a></h2>
<p>In the syntax rules listed in the next section</p>
<ol class="enumerated">
<li><p>&lt;TEXT&gt; stands for all text except markup commands.</p></li>
<li><p>Any XXX stands for the markup command [xxx] including its
arguments. Each markup command is a Tcl command surrounded by a
matching pair of <b class="const">[</b> and <b class="const">]</b>. Inside of these
delimiters the usual rules for a Tcl command apply with regard to word
quotation, nested commands, continuation lines, etc.</p></li>
<li><p>&lt;WHITE&gt; stands for all text consisting only of spaces, newlines,
tabulators and the <b class="cmd"><a href="../../../../index.html#key146">comment</a></b> markup command.</p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">Syntax</a></h2>
<p>The rules listed here specify only the syntax of doctoc documents. The
lexical level of the language was covered in the previous section.</p>
<p>Regarding the syntax of the (E)BNF itself</p>
<ol class="enumerated">
<li><p>The construct { X } stands for zero or more occurrences of X.</p></li>
<li><p>The construct [ X ] stands for zero or one occurrence of X.</p></li>
</ol>
<p>The syntax:</p>
<pre class="example">
toc       = defs
            TOC_BEGIN
            contents
            TOC_END  
            { &lt;WHITE&gt; }
defs      = { INCLUDE | VSET | &lt;WHITE&gt; }
contents  = { defs entry } [ defs ]
entry     = ITEM | division
division  = DIVISION_START
            contents
            DIVISION_END
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctoc_intro.html">doctoc_intro</a>, <a href="doctoc_lang_cmdref.html">doctoc_lang_cmdref</a>, <a href="doctoc_lang_faq.html">doctoc_lang_faq</a>, <a href="doctoc_lang_intro.html">doctoc_lang_intro</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key465">doctoc commands</a>, <a href="../../../../index.html#key463">doctoc language</a>, <a href="../../../../index.html#key464">doctoc markup</a>, <a href="../../../../index.html#key499">doctoc syntax</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctoc_plugin_apiref.html.


























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctoc_plugin_apiref - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctoc_plugin_apiref.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctoc_plugin_apiref.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctoc_plugin_apiref(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctoc_plugin_apiref - doctoc plugin API reference</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a></li>
<li class="section"><a href="#section3">FRONTEND COMMANDS</a></li>
<li class="section"><a href="#section4">PLUGIN COMMANDS</a>
<ul>
<li class="subsection"><a href="#subsection1">Management commands</a></li>
<li class="subsection"><a href="#subsection2">Formatting commands</a></li>
</ul>
</li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">dt_fmap</b> <i class="arg">symfname</i></a></li>
<li><a href="#2"><b class="cmd">dt_format</b></a></li>
<li><a href="#3"><b class="cmd">dt_read</b> <i class="arg">file</i></a></li>
<li><a href="#4"><b class="cmd">dt_source</b> <i class="arg">file</i></a></li>
<li><a href="#5"><b class="cmd">ex_cappend</b> <i class="arg">text</i></a></li>
<li><a href="#6"><b class="cmd">ex_cget</b> <i class="arg">varname</i></a></li>
<li><a href="#7"><b class="cmd">ex_cis</b> <i class="arg">cname</i></a></li>
<li><a href="#8"><b class="cmd">ex_cname</b></a></li>
<li><a href="#9"><b class="cmd">ex_cpop</b> <i class="arg">cname</i></a></li>
<li><a href="#10"><b class="cmd">ex_cpush</b> <i class="arg">cname</i></a></li>
<li><a href="#11"><b class="cmd">ex_cset</b> <i class="arg">varname</i> <i class="arg">value</i></a></li>
<li><a href="#12"><b class="cmd">ex_lb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></li>
<li><a href="#13"><b class="cmd">ex_rb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></li>
<li><a href="#14"><b class="cmd">toc_initialize</b></a></li>
<li><a href="#15"><b class="cmd">toc_listvariables</b></a></li>
<li><a href="#16"><b class="cmd">toc_numpasses</b></a></li>
<li><a href="#17"><b class="cmd">toc_postprocess</b> <i class="arg">text</i></a></li>
<li><a href="#18"><b class="cmd">toc_setup</b> <i class="arg">n</i></a></li>
<li><a href="#19"><b class="cmd">toc_shutdown</b></a></li>
<li><a href="#20"><b class="cmd">toc_varset</b> <i class="arg">varname</i> <i class="arg">text</i></a></li>
<li><a href="#21"><b class="cmd">fmt_plain_text</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is intended for <i class="term">plugin writers</i>, i.e. developers
wishing to write a toc <i class="term"><a href="../../../../index.html#key610">formatting engine</a></i> for some output
format X.</p>
<p>It specifies the interaction between the <b class="package"><a href="../doctools2toc/container.html">doctools::toc</a></b>
package and its plugins, i.e. the interface any toc formatting engine
has to comply with.</p>
<p>This document deals with version 1 of the interface.</p>
<p>A reader who is on the other hand more interested in the markup
language itself should start with the
<i class="term"><a href="doctoc_lang_intro.html">doctoc language introduction</a></i> and proceed from there to the
formal specifications, i.e. the <i class="term"><a href="doctoc_lang_syntax.html">doctoc language syntax</a></i> and
the <i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<p>The API for a toc formatting engine consists of two major sections.</p>
<p>On the one side we have a set of commands through which the plugin is
able to query the frontend. These commands are provided by the
frontend and linked into the plugin interpreter. Please see section
<span class="sectref"><a href="#section3">FRONTEND COMMANDS</a></span> for their detailed specification.</p>
<p>And on the other side the plugin has to provide its own set of
commands which will then be called by the frontend in a specific
sequence while processing input. They, again, fall into two
categories, management and formatting.
Please see section <span class="sectref"><a href="#section4">PLUGIN COMMANDS</a></span> and its subsections for
their detailed specification.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">FRONTEND COMMANDS</a></h2>
<p>This section specifies the set of commands through which a plugin,
also known as a toc formatting engine, is able to query the
frontend. These commands are provided by the frontend and linked into
the plugin interpreter.</p>
<p>I.e. a toc formatting engine can assume that all of the following
commands are present when any of its own commands (as specified in
section <span class="sectref"><a href="#section4">PLUGIN COMMANDS</a></span>) are executed.</p>
<p>Beyond that it can also assume that it has full access to its own safe
interpreter and thus is not able to damage the other parts of the
processor, nor can it damage the filesystem.
It is however able to either kill or hang the whole process, by
exiting, or running an infinite loop.</p>
<p>Coming back to the imported commands, all the commands with prefix
<em>dt_</em> provide limited access to specific parts of the frontend,
whereas the commands with prefix <em>ex_</em> provide access to the
state of the <b class="package"><a href="../textutil/expander.html">textutil::expander</a></b> object which does the main
parsing of the input within the frontend. These commands should not be
except under very special circumstances.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">dt_fmap</b> <i class="arg">symfname</i></a></dt>
<dd><p>Query command. It returns the actual pathname to use in the output in
place of the symbolic filename <i class="arg">symfname</i>. It will return the
unchanged input if no mapping was established for <i class="arg">symfname</i>.</p>
<p>The required mappings are established with the method <b class="method">map</b> of
a frontend, as explained in section <b class="sectref">OBJECT METHODS</b>
of the documentation for the package <b class="package"><a href="../doctools2toc/container.html">doctools::toc</a></b>.</p></dd>
<dt><a name="2"><b class="cmd">dt_format</b></a></dt>
<dd><p>Query command. It returns the name of the format associated with the
toc formatting engine.</p></dd>
<dt><a name="3"><b class="cmd">dt_read</b> <i class="arg">file</i></a></dt>
<dd><p>Controlled filesystem access. Returns contents of <i class="arg">file</i> for
whatever use desired by the plugin.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.</p></dd>
<dt><a name="4"><b class="cmd">dt_source</b> <i class="arg">file</i></a></dt>
<dd><p>Controlled filesystem access. This command allows the toc formatting
engine to load additional Tcl code it may need.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.</p></dd>
<dt><a name="5"><b class="cmd">ex_cappend</b> <i class="arg">text</i></a></dt>
<dd><p>Appends a string to the output in the current context.  This command
should rarely be used by macros or application code.</p></dd>
<dt><a name="6"><b class="cmd">ex_cget</b> <i class="arg">varname</i></a></dt>
<dd><p>Retrieves the value of variable <i class="arg">varname</i>, defined in the current
context.</p></dd>
<dt><a name="7"><b class="cmd">ex_cis</b> <i class="arg">cname</i></a></dt>
<dd><p>Determines whether or not the name of the current context is
<i class="arg">cname</i>.</p></dd>
<dt><a name="8"><b class="cmd">ex_cname</b></a></dt>
<dd><p>Returns the name of the current context.</p></dd>
<dt><a name="9"><b class="cmd">ex_cpop</b> <i class="arg">cname</i></a></dt>
<dd><p>Pops a context from the context stack, returning all accumulated
output in that context.  The context must be named <i class="arg">cname</i>, or an
error results.</p></dd>
<dt><a name="10"><b class="cmd">ex_cpush</b> <i class="arg">cname</i></a></dt>
<dd><p>Pushes a context named <i class="arg">cname</i> onto the context stack.  The
context must be popped by <b class="method">cpop</b> before expansion ends or an
error results.</p></dd>
<dt><a name="11"><b class="cmd">ex_cset</b> <i class="arg">varname</i> <i class="arg">value</i></a></dt>
<dd><p>Sets variable <i class="arg">varname</i> to <i class="arg">value</i> in the current context.</p></dd>
<dt><a name="12"><b class="cmd">ex_lb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></dt>
<dd><p>Returns the current value of the left macro expansion bracket; this is
for use as or within a macro, when the bracket needs to be included in
the output text.  If <i class="arg">newbracket</i> is specified, it becomes the new
bracket, and is returned.</p></dd>
<dt><a name="13"><b class="cmd">ex_rb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></dt>
<dd><p>Returns the current value of the right macro expansion bracket; this
is for use as or within a macro, when the bracket needs to be included
in the output text.  If <i class="arg">newbracket</i> is specified, it becomes the
new bracket, and is returned.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">PLUGIN COMMANDS</a></h2>
<p>The plugin has to provide its own set of commands which will then be
called by the frontend in a specific sequence while processing
input. They fall into two categories, management and formatting. Their
expected names, signatures, and responsibilities are specified in the
following two subsections.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Management commands</a></h3>
<p>The management commands a plugin has to provide are used by the
frontend to</p>
<ol class="enumerated">
<li><p>initialize and shutdown the plugin</p></li>
<li><p>determine the number of passes it has
       to make over the input</p></li>
<li><p>initialize and shutdown each pass</p></li>
<li><p>query and initialize engine parameters</p></li>
</ol>
<p>After the plugin has been loaded and the frontend commands are
established the commands will be called in the following sequence:</p>
<pre class="example">
    toc_numpasses -&gt; n
    toc_listvariables -&gt; vars
    toc_varset var1 value1
    toc_varset var2 value2
    ...
    toc_varset varK valueK
    toc_initialize
    toc_setup 1
    ...
    toc_setup 2
    ...
    ...
    toc_setup n
    ...
    toc_postprocess
    toc_shutdown
    ...
</pre>
<p>I.e. first the number of passes and the set of available engine
parameters is established, followed by calls setting the
parameters. That second part is optional.</p>
<p>After that the plugin is initialized, the specified number of passes
executed, the final result run through a global post processing step
and at last the plugin is shutdown again. This can be followed by more
conversions, restarting the sequence at <b class="cmd">toc_varset</b>.</p>
<p>In each of the passes, i.e. after the calls of <b class="cmd">toc_setup</b> the
frontend will process the input and call the formatting commands as
markup is encountered. This means that the sequence of formatting
commands is determined by the grammar of the doctoc markup language,
as specified in the <i class="term"><a href="doctoc_lang_syntax.html">doctoc language syntax</a></i> specification.</p>
<p>A different way of looking at the sequence is:</p>
<ul class="itemized">
<li><p>First some basic parameters are determined.</p></li>
<li><p>Then everything starting at the first <b class="cmd">toc_varset</b> to
<b class="cmd">toc_shutdown</b> forms a <i class="term">run</i>, the formatting of a
single input. Each run can be followed by more.</p></li>
<li><p>Embedded within each run we have one or more <i class="term">passes</i>,
each starting with <b class="cmd">toc_setup</b> and going until either the next
<b class="cmd">toc_setup</b> or <b class="cmd">toc_postprocess</b> is reached.</p>
<p>If more than one pass is required to perform the formatting only the
output of the last pass is relevant. The output of all the previous,
preparatory passes is ignored.</p></li>
</ul>
<p>The commands, their names, signatures, and responsibilities are, in
detail:</p>
<dl class="definitions">
<dt><a name="14"><b class="cmd">toc_initialize</b></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called at the beginning of every conversion run, as
the first command of that run. Note that a run is not a pass, but may
consist of multiple passes.
It has to initialize the general state of the plugin, beyond the
initialization done during the load. No return value is expected, and
any returned value is ignored.</p></dd>
<dt><a name="15"><b class="cmd">toc_listvariables</b></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Engine parameters</em>.
Second command is called after the plugin code has been loaded,
i.e. immediately after <b class="cmd">toc_numpasses</b>.
It has to return a list containing the names of the parameters the
frontend can set to configure the engine. This list can be empty.</p></dd>
<dt><a name="16"><b class="cmd">toc_numpasses</b></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Pass management</em>.
First command called after the plugin code has been loaded. No other
command of the engine will be called before it.
It has to return the number of passes this engine requires to fully
process the input document. This value has to be an integer number
greater or equal to one.</p></dd>
<dt><a name="17"><b class="cmd">toc_postprocess</b> <i class="arg">text</i></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called immediately after the last pass in a run. Its
argument is the result of the conversion generated by that pass. It is
provided to allow the engine to perform any global modifications of
the generated document. If no post-processing is required for a
specific format the command has to just return the argument.</p>
<p>Expected to return a value, the final result of formatting the input.</p></dd>
<dt><a name="18"><b class="cmd">toc_setup</b> <i class="arg">n</i></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Pass management</em>.
This command is called at the beginning of each pass over the input in
a run. Its argument is the number of the pass which has begun. Passes
are counted from <b class="const">1</b> upward.
The command has to set up the internal state of the plugin for this
particular pass. No return value is expected, and any returned value
is ignored.</p></dd>
<dt><a name="19"><b class="cmd">toc_shutdown</b></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called at the end of every conversion run. It is the
last command called in a run. It has to clean up of all the
run-specific state in the plugin.
After the call the engine has to be in a state which allows the
initiation of another run without fear that information from the last
run is leaked into this new run.
No return value is expected, and any returned value is ignored.</p></dd>
<dt><a name="20"><b class="cmd">toc_varset</b> <i class="arg">varname</i> <i class="arg">text</i></a></dt>
<dd><p><em>Engine parameters</em>.
This command is called by the frontend to set an engine parameter to a
particular value.
The parameter to change is specified by <i class="arg">varname</i>, the value to
set in <i class="arg">text</i>.</p>
<p>The command has to throw an error if an unknown <i class="arg">varname</i> is
used. Only the names returned by <b class="cmd">toc_listvariables</b> have to be
considered as known.</p>
<p>The values of all engine parameters have to persist between passes and
runs.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Formatting commands</a></h3>
<p>The formatting commands have to implement the formatting for the
output format, for all the markup commands of the doctoc markup
language, except <b class="cmd">lb</b>, <b class="cmd">rb</b>, <b class="cmd">vset</b>, <b class="cmd">include</b>, and
<b class="cmd"><a href="../../../../index.html#key146">comment</a></b>. These exceptions are processed by the frontend and are
never seen by the plugin. In return a command for the formatting of
plain text has to be provided, something which has no markup in the
input at all.</p>
<p>This means, that each of the five markup commands specified in the
<i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i> and outside of the set of
exceptions listed above has an equivalent formatting command which
takes the same arguments as the markup command and whose name is the
name of markup command with the prefix <em>fmt_</em> added to it.</p>
<p>All commands are expected to format their input in some way per the
semantics specified in the command reference and to return whatever
part of this that they deem necessary as their result, which will be
added to the output.</p>
<p>To avoid essentially duplicating the command reference we do not list
any of the command here and simply refer the reader to the
<i class="term"><a href="doctoc_lang_cmdref.html">doctoc language command reference</a></i> for their signature and
description. The sole exception is the plain text formatter, which has
no equivalent markup command.</p>
<p>The calling sequence of formatting commands is not as rigid as for the
management commands, but determined by the grammar of the doctoc
markup language, as specified in the <i class="term"><a href="doctoc_lang_syntax.html">doctoc language syntax</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="21"><b class="cmd">fmt_plain_text</b> <i class="arg">text</i></a></dt>
<dd><p><em>No associated markup command</em>.</p>
<p>Called by the frontend for any plain text encountered in the
input. It has to perform any and all special processing required for
plain text.</p>
<p>The formatted text is expected as the result of the command,
and added to the output. If no special processing is required it has
to simply return its argument without change.</p></dd>
</dl>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctoc_intro.html">doctoc_intro</a>, <a href="doctoc_lang_cmdref.html">doctoc_lang_cmdref</a>, <a href="doctoc_lang_faq.html">doctoc_lang_faq</a>, <a href="doctoc_lang_intro.html">doctoc_lang_intro</a>, <a href="doctoc_lang_syntax.html">doctoc_lang_syntax</a>, <a href="../doctools2toc/container.html">doctools::toc</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key610">formatting engine</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key116">semantic markup</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a>, <a href="../../../../index.html#key665">toc formatter</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctools.html.






















































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctools.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003-2013 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools(n) 1.4.14 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools - doctools - Processing documents</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a>
<ul>
<li class="subsection"><a href="#subsection1">PACKAGE COMMANDS</a></li>
<li class="subsection"><a href="#subsection2">OBJECT COMMAND</a></li>
<li class="subsection"><a href="#subsection3">OBJECT METHODS</a></li>
<li class="subsection"><a href="#subsection4">OBJECT CONFIGURATION</a></li>
<li class="subsection"><a href="#subsection5">FORMAT MAPPING</a></li>
</ul>
</li>
<li class="section"><a href="#section3">PREDEFINED ENGINES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">doctools <span class="opt">?1.4.14?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::new</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">option value</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">::doctools::help</b></a></li>
<li><a href="#3"><b class="cmd">::doctools::search</b> <i class="arg">path</i></a></li>
<li><a href="#4"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">configure</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">cget</b> <b class="option">-option</b></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">format</b> <i class="arg">text</i></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">map</b> <i class="arg">symbolic</i> <i class="arg">actual</i></a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">parameters</b></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">search</b> <i class="arg">path</i></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">setparam</b> <i class="arg">name</i> <i class="arg">value</i></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">warnings</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for the creation of objects able to
process and convert text written in the <i class="term"><a href="../../../../index.html#key51">doctools</a></i> markup
language into any output format X for which a
<i class="term"><a href="../../../../index.html#key610">formatting engine</a></i> is available.</p>
<p>A reader interested in the markup language itself should start with
the <i class="term"><a href="doctools_lang_intro.html">doctools language introduction</a></i> and proceed from there to
the formal specifications, i.e. the <i class="term"><a href="doctools_lang_syntax.html">doctools language syntax</a></i>
and the <i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i>.</p>
<p>If on the other hand the reader wishes to write her own formatting
engine for some format, i.e. is a <i class="term">plugin writer</i> then reading
and understanding the <i class="term"><a href="doctools_plugin_apiref.html">doctools plugin API reference</a></i> is an
absolute necessity, as that document specifies the interaction between
this package and its plugins, i.e. the formatting engines, in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">PACKAGE COMMANDS</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::new</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">option value</i>...?</span></a></dt>
<dd><p>This command creates a new doctools object with an associated Tcl
command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is
explained in full detail in the sections <span class="sectref"><a href="#subsection2">OBJECT COMMAND</a></span>
and <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p>
<p>The options and their values coming after the name of the object are
used to set the initial configuration of the object.</p></dd>
<dt><a name="2"><b class="cmd">::doctools::help</b></a></dt>
<dd><p>This is a convenience command for applications wishing to provide
their user with a short description of the available formatting
commands and their meanings. It returns a string containing a standard
help text.</p></dd>
<dt><a name="3"><b class="cmd">::doctools::search</b> <i class="arg">path</i></a></dt>
<dd><p>Whenever an object created by this the package has to map the name of
a format to the file containing the code for its formatting engine it
will search for the file in a number of directories stored in a
list. See section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span> for more explanations.</p>
<p>This list not only contains three default directories which are
declared by the package itself, but is also extensible user of the
package.
This command is the means to do so. When given a <i class="arg">path</i> to an
existing and readable directory it will prepend that directory to the
list of directories to search. This means that the <i class="arg">path</i> added
last is later searched through first.</p>
<p>An error will be thrown if the <i class="arg">path</i> either does not exist, is
not a directory, or is not readable.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">OBJECT COMMAND</a></h3>
<p>All commands created by <b class="cmd">::doctools::new</b> have the following
general form and may be used to invoke various operations on their
doctools converter object.</p>
<dl class="definitions">
<dt><a name="4"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the exact
behavior of the command. See section <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span> for
the detailed specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OBJECT METHODS</a></h3>
<dl class="definitions">
<dt><a name="5"><i class="arg">objectName</i> <b class="method">configure</b></a></dt>
<dd><p>The method returns a list of all known options and their current
values when called without any arguments.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>The method behaves like the method <b class="method">cget</b> when called with a
single argument and returns the value of the option specified by said
argument.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>The method reconfigures the specified <b class="option">option</b>s of the object,
setting them to the associated <i class="arg">value</i>s, when called with an even
number of arguments, at least two.</p>
<p>The legal options are described in the section
<span class="sectref"><a href="#subsection4">OBJECT CONFIGURATION</a></span>.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">cget</b> <b class="option">-option</b></a></dt>
<dd><p>This method expects a legal configuration option as argument and will
return the current value of that option for the object the method was
invoked for.</p>
<p>The legal configuration options are described in section
<span class="sectref"><a href="#subsection4">OBJECT CONFIGURATION</a></span>.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">format</b> <i class="arg">text</i></a></dt>
<dd><p>This method runs the <i class="arg">text</i> through the configured formatting
engine and returns the generated string as its result. An error will
be thrown if no <b class="option">-format</b> was configured for the object.</p>
<p>The method assumes that the <i class="arg">text</i> is in <i class="term"><a href="../../../../index.html#key51">doctools</a></i> format as
specified in the companion document <i class="term">doctools_fmt</i>. Errors will
be thrown otherwise.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">map</b> <i class="arg">symbolic</i> <i class="arg">actual</i></a></dt>
<dd><p>This methods add one entry to the per-object mapping from
<i class="arg">symbolic</i> filenames to the <i class="arg">actual</i> uris.
The object just stores this mapping and makes it available to the
configured formatting engine through the command <b class="cmd">dt_fmap</b>.
This command is described in more detail in the
<i class="term"><a href="doctools_plugin_apiref.html">doctools plugin API reference</a></i> which specifies the interaction
between the objects created by this package and doctools formatting
engines.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">parameters</b></a></dt>
<dd><p>This method returns a list containing the names of all engine
parameters provided by the configured formatting engine. It will
return an empty list if the object is not yet configured for a
specific format.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">search</b> <i class="arg">path</i></a></dt>
<dd><p>This method extends the per-object list of paths searched for doctools
formatting engines. See also the command <b class="cmd">::doctools::search</b> on
how to extend the per-package list of paths. Note that the path
entered last will be searched first.
For more details see section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span>.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">setparam</b> <i class="arg">name</i> <i class="arg">value</i></a></dt>
<dd><p>This method sets the <i class="arg">name</i>d engine parameter to the specified
<i class="arg">value</i>.
It will throw an error if the object is either not yet configured for
a specific format, or if the formatting engine for the configured
format does not provide a parameter with the given <i class="arg">name</i>.
The list of parameters provided by the configured formatting engine
can be retrieved through the method <b class="method">parameters</b>.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">warnings</b></a></dt>
<dd><p>This method returns a list containing all the warnings which were
generated by the configured formatting engine during the last
invocation of the method <b class="method">format</b>.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">OBJECT CONFIGURATION</a></h3>
<p>All doctools objects understand the following configuration options:</p>
<dl class="options">
<dt><b class="option">-file</b> <i class="arg">file</i></dt>
<dd><p>The argument of this option is stored in the object and made available
to the configured formatting engine through the commands <b class="cmd">dt_file</b>
and <b class="cmd">dt_mainfile</b>.
These commands are described in more detail in the companion document
<i class="term">doctools_api</i> which specifies the API between the object and
formatting engines.</p>
<p>The default value of this option is the empty string.</p>
<p>The configured formatting engine should interpret the value as the
name of the file containing the document which is currently processed.</p></dd>
<dt><b class="option">-ibase</b> <i class="arg">file</i></dt>
<dd><p>The argument of this option is stored in the object and used as the
base path for resolution of relative include paths. If this option is
not set (empty string) the value of <b class="option">-file</b> is used instead.</p>
<p>Note that <b class="option">-file</b> and <b class="option">-ibase</b>, while similar looking,
are actually very different. The value of <b class="option">-file</b> is used by
some engines for the generation of proper relative references between
output documents (HTML). As such this is a <i class="term">destination</i>
path. The <b class="option">-ibase</b> on the other hand is used to resolve
relative include paths, and as such deals with <i class="term"><a href="../../../../index.html#key388">source</a></i> paths.</p>
<p>The default value of this option is the empty string.</p></dd>
<dt><b class="option">-module</b> <i class="arg">text</i></dt>
<dd><p>The argument of this option is stored in the object and made available
to the configured formatting engine through the command <b class="cmd">dt_module</b>.
This command is described in more detail in the companion document
<i class="term">doctools_api</i> which specifies the API between the object and
formatting engines.</p>
<p>The default value of this option is the empty string.</p>
<p>The configured formatting engine should interpret the value as the
name of the module the file containing the document which is currently
processed belongs to.</p></dd>
<dt><b class="option">-format</b> <i class="arg">text</i></dt>
<dd><p>The argument of this option specifies the format to generate and by
implication the formatting engine to use when converting text via the
method <b class="method">format</b>. Its default value is the empty string. The
method <b class="method">format</b> cannot be used if this option is not set to a
valid value at least once.</p>
<p>The package will immediately try to map the given name to a file
containing the code for a formatting engine generating that format. An
error will be thrown if this mapping fails. In that case a previously
configured format is left untouched.</p>
<p>The section <span class="sectref"><a href="#subsection5">FORMAT MAPPING</a></span> explains in detail how the
package and object will look for engine implementations.</p></dd>
<dt><b class="option">-deprecated</b> <i class="arg">boolean</i></dt>
<dd><p>This option is a boolean flag. The object will generate warnings if
this flag is set and the text given to method <b class="method">format</b> contains
the deprecated markup command <b class="cmd">strong</b>.
Its default value is <b class="const">FALSE</b>. In other words, no warnings will
be generated.</p></dd>
<dt><b class="option">-copyright</b> <i class="arg">text</i></dt>
<dd><p>The argument of this option is stored in the object and made available
to the configured formatting engine through the command <b class="cmd">dt_copyright</b>.
This command is described in more detail in the companion document
<i class="term">doctools_api</i> which specifies the API between the object and
formatting engines.</p>
<p>The default value of this option is the empty string.</p>
<p>The configured formatting engine should interpret the value as a
copyright assignment for the document which is currently processed, or
the package described by it.</p>
<p>This information must be used if and only if the engine is unable to
find any copyright assignments within the document itself. Such are
specified by the formatting command <b class="cmd">copyright</b>. This command is
described in more detail in the companion document <i class="term">doctools_fmt</i>
which specifies the <i class="term"><a href="../../../../index.html#key51">doctools</a></i> format itself.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">FORMAT MAPPING</a></h3>
<p>The package and object will perform the following algorithm when
trying to map a format name <i class="term">foo</i> to a file containing an
implementation of a formatting engine for <i class="term">foo</i>:</p>
<ol class="enumerated">
<li><p>If <i class="term">foo</i> is the name of an existing file then this file is
directly taken as the implementation.</p></li>
<li><p>If not, the list of per-object search paths is searched. For each
directory in the list the package checks if that directory contains a
file &quot;<b class="file">fmt.<i class="term">foo</i></b>&quot;. If yes, then that file is taken as the
implementation.</p>
<p>Note that this list of paths is initially empty and can be extended
through the object method <b class="method">search</b>.</p></li>
<li><p>If not, the list of package paths is searched.
For each directory in the list the package checks if that directory
contains a file &quot;<b class="file">fmt.<i class="term">foo</i></b>&quot;. If yes, then that file is taken
as the implementation.</p>
<p>This list of paths can be extended
through the command <b class="cmd">::doctools::search</b>.
It contains initially one path, the subdirectory &quot;<b class="file">mpformats</b>&quot; of
the directory the package itself is located in.
In other words, if the package implementation &quot;<b class="file">doctools.tcl</b>&quot; is
installed in the directory &quot;<b class="file">/usr/local/lib/tcllib/doctools</b>&quot; then
it will by default search the
directory &quot;<b class="file">/usr/local/lib/tcllib/doctools/mpformats</b>&quot; for format
implementations.</p></li>
<li><p>The mapping fails.</p></li>
</ol>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">PREDEFINED ENGINES</a></h2>
<p>The package provides predefined engines for the following
formats. Some of the engines support parameters. These will be
explained below as well.</p>
<dl class="definitions">
<dt>html</dt>
<dd><p>This engine generates HTML markup, for processing by web browsers and
the like. This engine supports four parameters:</p>
<dl class="definitions">
<dt>footer</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
before the <b class="const">&lt;/body&gt;</b> tag, closing the body of the generated
HTML.</p>
<p>This can be used to insert boilerplate footer markup into the
generated document.</p></dd>
<dt>header</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the body section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the <b class="const">&lt;body&gt;</b> tag, starting the body of the generated HTML.</p>
<p>This can be used to insert boilerplate header markup into the
generated document.</p></dd>
<dt>meta</dt>
<dd><p>The value for this parameter has to be valid selfcontained HTML markup
for the header section of a HTML document. The default value is the
empty string. The value is inserted into the generated output just
after the <b class="const">&lt;head&gt;</b> tag, starting the header section of the
generated HTML.</p>
<p>This can be used to insert boilerplate meta data markup into the
generated document, like references to a stylesheet, standard meta
keywords, etc.</p></dd>
<dt>xref</dt>
<dd><p>The value for this parameter has to be a list of triples specifying
cross-reference information. This information is used by the engine to
create more hyperlinks. Each triple is a list containing a pattern,
symbolic filename and fragment reference, in this order. If a pattern
is specified multiple times the last occurence of the pattern will be
used.</p>
<p>The engine will consult the xref database when encountering specific
commands and will create a link if the relevant text matches one of
the patterns. No link will be created if no match was found. The link
will go to the uri <b class="const">file#fragment</b> listed in the relevant
triple, after conversion of the symbolic file name to the actual uri
via <b class="cmd">dt_fmap</b> (see the <i class="term"><a href="doctools_plugin_apiref.html">doctools plugin API reference</a></i>).
This file-to-uri mapping was build by calls to the method <b class="method">map</b>
of the doctools object (See section <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span>).</p>
<p>The following formatting commands will consult the xref database:</p>
<dl class="definitions">
<dt><b class="cmd">cmd</b> <i class="arg">word</i></dt>
<dd><p>The command will look for the patterns <b class="const">sa,</b><i class="arg">word</i>, and
<i class="arg">word</i>, in this order. If this fails if it will convert <i class="arg">word</i>
to all lowercase and try again.</p></dd>
<dt><b class="cmd">syscmd</b> <i class="arg">word</i></dt>
<dd><p>The command will look for the patterns <b class="const">sa,</b><i class="arg">word</i>, and
<i class="arg">word</i>, in this order. If this fails if it will convert <i class="arg">word</i>
to all lowercase and try again.</p></dd>
<dt><b class="cmd"><a href="../term/term.html">term</a></b> <i class="arg">word</i></dt>
<dd><p>The command will look for the patterns <b class="const">kw,</b><i class="arg">word</i>,
<b class="const">sa,</b><i class="arg">word</i>, and <i class="arg">word</i>, in this order. If this fails if
it will convert <i class="arg">word</i> to all lowercase and try again.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key52">package</a></b> <i class="arg">word</i></dt>
<dd><p>The command will look for the patterns <b class="const">sa,</b><i class="arg">word</i>,
<b class="const">kw,</b><i class="arg">word</i>, and <i class="arg">word</i>, in this order. If this fails if
it will convert <i class="arg">word</i> to all lowercase and try again.</p></dd>
<dt><b class="cmd">see_also</b> <i class="arg">word</i>...</dt>
<dd><p>The command will look for the patterns <b class="const">sa,</b><i class="arg">word</i>, and
<i class="arg">word</i>, in this order, for each <i class="arg">word</i> given to the
command. If this fails if it will convert <i class="arg">word</i> to all lowercase
and try again.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key718">keywords</a></b> <i class="arg">word</i>...</dt>
<dd><p>The command will look for the patterns <b class="const">kw,</b><i class="arg">word</i>, and
<i class="arg">word</i>, in this order, for each <i class="arg">word</i> given to the
command. If this fails if it will convert <i class="arg">word</i> to all lowercase
and try again.</p></dd>
</dl></dd>
</dl></dd>
<dt>latex</dt>
<dd><p>This engine generates output suitable for the <b class="syscmd"><a href="../../../../index.html#key167">latex</a></b> text
processor coming out of the TeX world.</p></dd>
<dt>list</dt>
<dd><p>This engine retrieves version, section and title of the manpage from
the document. As such it can be used to generate a directory listing
for a set of manpages.</p></dd>
<dt>nroff</dt>
<dd><p>This engine generates nroff output, for processing by <b class="syscmd"><a href="../../../../index.html#key5">nroff</a></b>,
or <b class="syscmd">groff</b>. The result will be standard man pages as they are
known in the unix world.</p></dd>
<dt>null</dt>
<dd><p>This engine generates no outout at all. This can be used if one just
wants to validate some input.</p></dd>
<dt>tmml</dt>
<dd><p>This engine generates TMML markup as specified by Joe English. The Tcl
Manpage Markup Language is a derivate of XML.</p></dd>
<dt>wiki</dt>
<dd><p>This engine generates Wiki markup as understood by Jean Claude
Wippler's <b class="syscmd">wikit</b> application.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctools_intro.html">doctools_intro</a>, <a href="doctools_lang_cmdref.html">doctools_lang_cmdref</a>, <a href="doctools_lang_intro.html">doctools_lang_intro</a>, <a href="doctools_lang_syntax.html">doctools_lang_syntax</a>, <a href="doctools_plugin_apiref.html">doctools_plugin_apiref</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key4">TMML</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key5">nroff</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003-2013 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctools_intro.html.

































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools_intro - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctools_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools_intro(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools_intro - doctools introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">RELATED FORMATS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><i class="term"><a href="../../../../index.html#key51">doctools</a></i> (short for <em>documentation tools</em>) stands for
a set of related, yet different, entities which are working together
for the easy creation and transformation of documentation. These are</p>
<ol class="enumerated">
<li><p>A tcl based language for the semantic markup of text. Markup is
represented by Tcl commands interspersed with the actual text.</p></li>
<li><p>A package providing the ability to read and transform texts written in
that markup language. It is important to note that the actual
transformation of the input text is delegated to plugins.</p></li>
<li><p>An API describing the interface between the package above and a
plugin.</p></li>
</ol>
<p>Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.</p>
<ol class="enumerated">
<li><p>A <i class="term">writer</i> of documentation has to understand the markup language
itself. A beginner to doctools should read the more informally written
<i class="term"><a href="doctools_lang_intro.html">doctools language introduction</a></i> first. Having digested this
the formal <i class="term"><a href="doctools_lang_syntax.html">doctools language syntax</a></i> specification should
become understandable. A writer experienced with doctools may only
need the <i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i> from time to
time to refresh her memory.</p>
<p>While a document is written the <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> application can be
used to validate it, and after completion it also performs the
conversion into the chosen system of visual markup, be it *roff, HTML,
plain text, wiki, etc.</p></li>
<li><p>A <i class="term">processor</i> of documentation written in the <i class="term"><a href="../../../../index.html#key51">doctools</a></i>
markup language has to know which tools are available for use.</p>
<p>The main tool is the aforementioned <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> application
provided by Tcllib. A more powerful one (in terms of options and
ability to configure it) is the <b class="syscmd">dtp</b> application, provided by
Tclapps.
At the bottom level, common to both applications, however sits the
package <b class="package"><a href="doctools.html">doctools</a></b>, providing the basic facilities to read and
process files containing text in the doctools format.</p></li>
<li><p>At last, but not least, <i class="term">plugin writers</i> have to understand the
interaction between the <b class="package"><a href="doctools.html">doctools</a></b> package and its plugins, as
described in the <i class="term"><a href="doctools_plugin_apiref.html">doctools plugin API reference</a></i>.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">RELATED FORMATS</a></h2>
<p>doctools does not stand alone, it has two companion formats. These are
called <i class="term"><a href="../../../../index.html#key50">docidx</a></i> and <i class="term"><a href="../../../../index.html#key230">doctoc</a></i>, and they are for the markup of
<i class="term">keyword indices</i>, and <i class="term">tables of contents</i>,
respectively.
They are described in their own sets of documents, starting at the
<i class="term"><a href="docidx_intro.html">docidx introduction</a></i> and the <i class="term"><a href="doctoc_intro.html">doctoc introduction</a></i>,
respectively.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="docidx_intro.html">docidx_intro</a>, <a href="doctoc_intro.html">doctoc_intro</a>, <a href="doctools.html">doctools</a>, <a href="doctools_lang_cmdref.html">doctools_lang_cmdref</a>, <a href="doctools_lang_faq.html">doctools_lang_faq</a>, <a href="doctools_lang_intro.html">doctools_lang_intro</a>, <a href="doctools_lang_syntax.html">doctools_lang_syntax</a>, <a href="doctools_plugin_apiref.html">doctools_plugin_apiref</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctools_lang_cmdref.html.























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools_lang_cmdref - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctools_lang_cmdref.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2010 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools_lang_cmdref.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools_lang_cmdref(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools_lang_cmdref - doctools language command reference</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Commands</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">arg</b> <i class="arg">text</i></a></li>
<li><a href="#2"><b class="cmd">arg_def</b> <i class="arg">type</i> <i class="arg">name</i> <span class="opt">?<i class="arg">mode</i>?</span></a></li>
<li><a href="#3"><b class="cmd">bullet</b></a></li>
<li><a href="#4"><b class="cmd">call</b> <i class="arg">args</i></a></li>
<li><a href="#5"><b class="cmd">category</b> <i class="arg">text</i></a></li>
<li><a href="#6"><b class="cmd"><a href="../../../../index.html#key219">class</a></b> <i class="arg">text</i></a></li>
<li><a href="#7"><b class="cmd">cmd</b> <i class="arg">text</i></a></li>
<li><a href="#8"><b class="cmd">cmd_def</b> <i class="arg">command</i></a></li>
<li><a href="#9"><b class="cmd"><a href="../../../../index.html#key146">comment</a></b> <i class="arg">plaintext</i></a></li>
<li><a href="#10"><b class="cmd">const</b> <i class="arg">text</i></a></li>
<li><a href="#11"><b class="cmd">copyright</b> <i class="arg">text</i></a></li>
<li><a href="#12"><b class="cmd">def</b> <i class="arg">text</i></a></li>
<li><a href="#13"><b class="cmd">description</b></a></li>
<li><a href="#14"><b class="cmd">enum</b></a></li>
<li><a href="#15"><b class="cmd">emph</b> <i class="arg">text</i></a></li>
<li><a href="#16"><b class="cmd">example</b> <i class="arg">text</i></a></li>
<li><a href="#17"><b class="cmd">example_begin</b></a></li>
<li><a href="#18"><b class="cmd">example_end</b></a></li>
<li><a href="#19"><b class="cmd"><a href="../../../../index.html#key31">file</a></b> <i class="arg">text</i></a></li>
<li><a href="#20"><b class="cmd">fun</b> <i class="arg">text</i></a></li>
<li><a href="#21"><b class="cmd"><a href="../../../../index.html#key135">image</a></b> <i class="arg">name</i> <span class="opt">?<i class="arg">label</i>?</span></a></li>
<li><a href="#22"><b class="cmd">include</b> <i class="arg">filename</i></a></li>
<li><a href="#23"><b class="cmd">item</b></a></li>
<li><a href="#24"><b class="cmd"><a href="../../../../index.html#key718">keywords</a></b> <i class="arg">args</i></a></li>
<li><a href="#25"><b class="cmd">lb</b></a></li>
<li><a href="#26"><b class="cmd">list_begin</b> <i class="arg">what</i></a></li>
<li><a href="#27"><b class="cmd">list_end</b></a></li>
<li><a href="#28"><b class="cmd">lst_item</b> <i class="arg">text</i></a></li>
<li><a href="#29"><b class="cmd">manpage_begin</b> <i class="arg">command</i> <i class="arg">section</i> <i class="arg">version</i></a></li>
<li><a href="#30"><b class="cmd">manpage_end</b></a></li>
<li><a href="#31"><b class="cmd"><a href="../../../../index.html#key332">method</a></b> <i class="arg">text</i></a></li>
<li><a href="#32"><b class="cmd">moddesc</b> <i class="arg">text</i></a></li>
<li><a href="#33"><b class="cmd">namespace</b> <i class="arg">text</i></a></li>
<li><a href="#34"><b class="cmd">nl</b></a></li>
<li><a href="#35"><b class="cmd">opt</b> <i class="arg">text</i></a></li>
<li><a href="#36"><b class="cmd">opt_def</b> <i class="arg">name</i> <span class="opt">?<i class="arg">arg</i>?</span></a></li>
<li><a href="#37"><b class="cmd">option</b> <i class="arg">text</i></a></li>
<li><a href="#38"><b class="cmd"><a href="../../../../index.html#key52">package</a></b> <i class="arg">text</i></a></li>
<li><a href="#39"><b class="cmd">para</b></a></li>
<li><a href="#40"><b class="cmd">rb</b></a></li>
<li><a href="#41"><b class="cmd">require</b> <i class="arg">package</i> <span class="opt">?<i class="arg">version</i>?</span></a></li>
<li><a href="#42"><b class="cmd">section</b> <i class="arg">name</i></a></li>
<li><a href="#43"><b class="cmd">sectref</b> <i class="arg">id</i> <span class="opt">?<i class="arg">text</i>?</span></a></li>
<li><a href="#44"><b class="cmd">sectref-external</b> <i class="arg">text</i></a></li>
<li><a href="#45"><b class="cmd">see_also</b> <i class="arg">args</i></a></li>
<li><a href="#46"><b class="cmd">strong</b> <i class="arg">text</i></a></li>
<li><a href="#47"><b class="cmd">subsection</b> <i class="arg">name</i></a></li>
<li><a href="#48"><b class="cmd">syscmd</b> <i class="arg">text</i></a></li>
<li><a href="#49"><b class="cmd"><a href="../term/term.html">term</a></b> <i class="arg">text</i></a></li>
<li><a href="#50"><b class="cmd">titledesc</b> <i class="arg">desc</i></a></li>
<li><a href="#51"><b class="cmd">tkoption_def</b> <i class="arg">name</i> <i class="arg">dbname</i> <i class="arg">dbclass</i></a></li>
<li><a href="#52"><b class="cmd"><a href="../../../../index.html#key109">type</a></b> <i class="arg">text</i></a></li>
<li><a href="#53"><b class="cmd"><a href="../uri/uri.html">uri</a></b> <i class="arg">text</i> <span class="opt">?<i class="arg">text</i>?</span></a></li>
<li><a href="#54"><b class="cmd">usage</b> <i class="arg">args</i></a></li>
<li><a href="#55"><b class="cmd">var</b> <i class="arg">text</i></a></li>
<li><a href="#56"><b class="cmd">vset</b> <i class="arg">varname</i> <i class="arg">value</i></a></li>
<li><a href="#57"><b class="cmd">vset</b> <i class="arg">varname</i></a></li>
<li><a href="#58"><b class="cmd"><a href="../../../../index.html#key212">widget</a></b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document specifies both names and syntax of all the commands
which together are the doctools markup language, version 1.
As this document is intended to be a reference the commands are listed
in alphabetical order, and the descriptions are relatively short.
A beginner should read the much more informally written
<i class="term"><a href="doctools_lang_intro.html">doctools language introduction</a></i> first.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Commands</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">arg</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument text is marked up as the <i class="term">argument</i> of
a command. Main uses are the highlighting of command arguments in
free-form text, and for the argument parameters of the markup commands
<b class="cmd">call</b> and <b class="cmd">usage</b>.</p></dd>
<dt><a name="2"><b class="cmd">arg_def</b> <i class="arg">type</i> <i class="arg">name</i> <span class="opt">?<i class="arg">mode</i>?</span></a></dt>
<dd><p>Text structure. List element. Argument list. Automatically closes the
previous list element. Specifies the data-<i class="arg">type</i> of the described
argument of a command, its <i class="arg">name</i> and its i/o-<i class="arg">mode</i>. The
latter is optional.</p></dd>
<dt><a name="3"><b class="cmd">bullet</b></a></dt>
<dd><p><em>Deprecated</em>. Text structure. List element. Itemized list. See
<b class="cmd">item</b> for the canonical command to open a list item in an
itemized list.</p></dd>
<dt><a name="4"><b class="cmd">call</b> <i class="arg">args</i></a></dt>
<dd><p>Text structure. List element. Definition list. Automatically closes
the previous list element. Defines the term as a command and its
arguments.
The first argument is the name of the command described by the
following free-form text, and all arguments coming after that are
descriptions of the command's arguments.
It is expected that the arguments are marked up with <b class="cmd">arg</b>,
<b class="cmd"><a href="../../../../index.html#key332">method</a></b>, <b class="cmd">option</b> etc., as is appropriate, and that the
command itself is marked up with <b class="cmd">cmd</b>.
It is expected that the formatted term is not only printed in place,
but also in the table of contents of the document, or synopsis,
depending on the output format.</p></dd>
<dt><a name="5"><b class="cmd">category</b> <i class="arg">text</i></a></dt>
<dd><p>Document information. Anywhere. This command registers its plain text
arguments as the category this document belongs to. If this command is
used multiple times the last value specified is used.</p></dd>
<dt><a name="6"><b class="cmd"><a href="../../../../index.html#key219">class</a></b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as the name of a
<i class="term"><a href="../../../../index.html#key219">class</a></i>. The text may have other markup already applied to
it. Main use is the highlighting of class names in free-form text.</p></dd>
<dt><a name="7"><b class="cmd">cmd</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument text is marked up as the name of a
<i class="term">Tcl command</i>. The text may have other markup already applied
to it. Main uses are the highlighting of commands in free-form text,
and for the command parameters of the markup commands <b class="cmd">call</b> and
<b class="cmd">usage</b>.</p></dd>
<dt><a name="8"><b class="cmd">cmd_def</b> <i class="arg">command</i></a></dt>
<dd><p>Text structure. List element. Command list. Automatically closes the
previous list element. The argument specifies the name of the
<i class="term">Tcl command</i> to be described by the list element. Expected to
be marked up in the output as if it had been formatted with <b class="cmd">cmd</b>.</p></dd>
<dt><a name="9"><b class="cmd"><a href="../../../../index.html#key146">comment</a></b> <i class="arg">plaintext</i></a></dt>
<dd><p>Text markup. The argument text is marked up as a comment standing
outside of the actual text of the document. Main use is in free-form
text.</p></dd>
<dt><a name="10"><b class="cmd">const</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as a <i class="term">constant</i> value. The
text may have other markup already applied to it. Main use is the
highlighting of constants in free-form text.</p></dd>
<dt><a name="11"><b class="cmd">copyright</b> <i class="arg">text</i></a></dt>
<dd><p>Document information. Anywhere. The command registers the plain text
argument as a copyright assignment for the manpage. When invoked more
than once the assignments are accumulated.</p></dd>
<dt><a name="12"><b class="cmd">def</b> <i class="arg">text</i></a></dt>
<dd><p>Text structure. List element. Definition list. Automatically closes
the previous list element. The argument text is the term defined by
the new list element. Text markup can be applied to it.</p></dd>
<dt><a name="13"><b class="cmd">description</b></a></dt>
<dd><p>Document structure. This command separates the header from the
document body.  Implicitly starts a section named &quot;DESCRIPTION&quot; (See
command <b class="cmd">section</b>).</p></dd>
<dt><a name="14"><b class="cmd">enum</b></a></dt>
<dd><p>Text structure. List element. Enumerated list. Automatically closes
the previous list element.</p></dd>
<dt><a name="15"><b class="cmd">emph</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument text is marked up as emphasized. Main use is
for general highlighting of pieces of free-form text without attaching
special meaning to the pieces.</p></dd>
<dt><a name="16"><b class="cmd">example</b> <i class="arg">text</i></a></dt>
<dd><p>Text structure, Text markup. This command marks its argument up as an
<i class="term">example</i>. Main use is the simple embedding of examples in
free-form text. It should be used if the example does <em>not</em> need
special markup of its own. Otherwise use a sequence of
<b class="cmd">example_begin</b> ... <b class="cmd">example_end</b>.</p></dd>
<dt><a name="17"><b class="cmd">example_begin</b></a></dt>
<dd><p>Text structure. This commands starts an example. All text until the
next <b class="cmd">example_end</b> belongs to the example. Line breaks, spaces,
and tabs have to be preserved literally. Examples cannot be nested.</p></dd>
<dt><a name="18"><b class="cmd">example_end</b></a></dt>
<dd><p>Text structure. This command closes the example started by the last
<b class="cmd">example_begin</b>.</p></dd>
<dt><a name="19"><b class="cmd"><a href="../../../../index.html#key31">file</a></b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as a <i class="term"><a href="../../../../index.html#key31">file</a></i> or
<i class="term">directory</i>, i.e. in general a <i class="term">path</i>. The text may have
other markup already applied to it. Main use is the highlighting of
paths in free-form text.</p></dd>
<dt><a name="20"><b class="cmd">fun</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as the name of a
<i class="term">function</i>. The text may have other markup already applied to
it. Main use is the highlighting of function names in free-form text.</p></dd>
<dt><a name="21"><b class="cmd"><a href="../../../../index.html#key135">image</a></b> <i class="arg">name</i> <span class="opt">?<i class="arg">label</i>?</span></a></dt>
<dd><p>Text markup. The argument is the symbolic name of an <i class="term"><a href="../../../../index.html#key135">image</a></i>
and replaced with the image itself, if a suitable variant is found
by the backend. The second argument, should it be present, will be
interpreted the human-readable description of the image, and put
into the output in a suitable position, if such is supported by the
format. The HTML format, for example, can place it into the <i class="term">alt</i>
attribute of image references.</p></dd>
<dt><a name="22"><b class="cmd">include</b> <i class="arg">filename</i></a></dt>
<dd><p>Templating. The contents of the named file are interpreted as text
written in the doctools markup and processed in the place of the
include command. The markup in the file has to be self-contained. It
is not possible for a markup command to cross the file boundaries.</p></dd>
<dt><a name="23"><b class="cmd">item</b></a></dt>
<dd><p>Text structure. List element. Itemized list. Automatically closes the
previous list element.</p></dd>
<dt><a name="24"><b class="cmd"><a href="../../../../index.html#key718">keywords</a></b> <i class="arg">args</i></a></dt>
<dd><p>Document information. Anywhere. This command registers all its plain text
arguments as keywords applying to this document. Each argument is a single
keyword. If this command is used multiple times all the arguments accumulate.</p></dd>
<dt><a name="25"><b class="cmd">lb</b></a></dt>
<dd><p>Text. The command is replaced with a left bracket. Use in free-form text.
Required to avoid interpretation of a left bracket as the start of a markup
command.</p></dd>
<dt><a name="26"><b class="cmd">list_begin</b> <i class="arg">what</i></a></dt>
<dd><p>Text structure. This command starts a list. The exact nature of the
list is determined by the argument <i class="arg">what</i> of the command. This
further determines which commands are have to be used to start the
list elements. Lists can be nested, i.e. it is allowed to start a new
list within a list element.</p>
<p>The allowed types (and their associated item commands) are:</p>
<dl class="definitions">
<dt><b class="const">arguments</b></dt>
<dd><p><b class="cmd">arg_def</b>.</p></dd>
<dt><b class="const">commands</b></dt>
<dd><p><b class="cmd">cmd_def</b>.</p></dd>
<dt><b class="const">definitions</b></dt>
<dd><p><b class="cmd">def</b> and <b class="cmd">call</b>.</p></dd>
<dt><b class="const">enumerated</b></dt>
<dd><p><b class="cmd">enum</b></p></dd>
<dt><b class="const">itemized</b></dt>
<dd><p><b class="cmd">item</b></p></dd>
<dt><b class="const">options</b></dt>
<dd><p><b class="cmd">opt_def</b></p></dd>
<dt><b class="const">tkoptions</b></dt>
<dd><p><b class="cmd">tkoption_def</b></p></dd>
</dl>
<p>Additionally the following names are recognized as shortcuts for some
of the regular types:</p>
<dl class="definitions">
<dt><b class="const">args</b></dt>
<dd><p>Short for <b class="const">arguments</b>.</p></dd>
<dt><b class="const">cmds</b></dt>
<dd><p>Short for <b class="const">commands</b>.</p></dd>
<dt><b class="const">enum</b></dt>
<dd><p>Short for <b class="const">enumerated</b>.</p></dd>
<dt><b class="const">item</b></dt>
<dd><p>Short for <b class="const">itemized</b>.</p></dd>
<dt><b class="const">opts</b></dt>
<dd><p>Short for <b class="const">options</b>.</p></dd>
</dl>
<p>At last the following names are still recognized for backward
compatibility, but are otherwise considered to be <em>deprecated</em>.</p>
<dl class="definitions">
<dt><b class="const">arg</b></dt>
<dd><p><em>Deprecated</em>. See <b class="const">arguments</b>.</p></dd>
<dt><b class="const">bullet</b></dt>
<dd><p><em>Deprecated</em>. See <b class="const">itemized</b>.</p></dd>
<dt><b class="const">cmd</b></dt>
<dd><p><em>Deprecated</em>. See <b class="const">commands</b>.</p></dd>
<dt><b class="const">opt</b></dt>
<dd><p><em>Deprecated</em>. See <b class="const">options</b>.</p></dd>
<dt><b class="const">tkoption</b></dt>
<dd><p><em>Deprecated</em>. See <b class="const">tkoptions</b>.</p></dd>
</dl></dd>
<dt><a name="27"><b class="cmd">list_end</b></a></dt>
<dd><p>Text structure. This command closes the list opened by the last
<b class="cmd">list_begin</b> command coming before it.</p></dd>
<dt><a name="28"><b class="cmd">lst_item</b> <i class="arg">text</i></a></dt>
<dd><p><em>Deprecated</em>. Text structure. List element. Definition list. See
<b class="cmd">def</b> for the canonical command to open a general list item in a
definition list.</p></dd>
<dt><a name="29"><b class="cmd">manpage_begin</b> <i class="arg">command</i> <i class="arg">section</i> <i class="arg">version</i></a></dt>
<dd><p>Document structure. The command to start a manpage. The arguments are
the name of the <i class="arg">command</i> described by the manpage, the
<i class="arg">section</i> of the manpages this manpage resides in, and the
<i class="arg">version</i> of the module containing the command. All arguments have
to be plain text, without markup.</p></dd>
<dt><a name="30"><b class="cmd">manpage_end</b></a></dt>
<dd><p>Document structure. Command to end a manpage/document. Anything in the document
coming after this command is in error.</p></dd>
<dt><a name="31"><b class="cmd"><a href="../../../../index.html#key332">method</a></b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument text is marked up as the name of an
<i class="term"><a href="../../../../index.html#key221">object</a></i> <i class="term"><a href="../../../../index.html#key332">method</a></i>, i.e. subcommand of a Tcl command. The
text may have other markup already applied to it. Main uses are the
highlighting of method names in free-form text, and for the command
parameters of the markup commands <b class="cmd">call</b> and <b class="cmd">usage</b>.</p></dd>
<dt><a name="32"><b class="cmd">moddesc</b> <i class="arg">text</i></a></dt>
<dd><p>Document information. Header. Registers the plain text argument as a short
description of the module the manpage resides in.</p></dd>
<dt><a name="33"><b class="cmd">namespace</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument text is marked up as a namespace name. The
text may have other markup already applied to it. Main use is the
highlighting of namespace names in free-form text.</p></dd>
<dt><a name="34"><b class="cmd">nl</b></a></dt>
<dd><p><em>Deprecated</em>. Text structure. See <b class="cmd">para</b> for the canonical
command to insert paragraph breaks into the text.</p></dd>
<dt><a name="35"><b class="cmd">opt</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument text is marked up as <i class="term">optional</i>. The text may
have other markup already applied to it. Main use is the highlighting of
optional arguments, see the command arg <b class="cmd">arg</b>.</p></dd>
<dt><a name="36"><b class="cmd">opt_def</b> <i class="arg">name</i> <span class="opt">?<i class="arg">arg</i>?</span></a></dt>
<dd><p>Text structure. List element. Option list. Automatically closes the
previous list element. Specifies <i class="arg">name</i> and arguments of the
<i class="term">option</i> described by the list element. It is expected that the
name is marked up using <b class="cmd">option</b>.</p></dd>
<dt><a name="37"><b class="cmd">option</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as <i class="term">option</i>. The text may
have other markup already applied to it. Main use is the highlighting
of options, also known as command-switches, in either free-form text,
or the arguments of the <b class="cmd">call</b> and <b class="cmd">usage</b> commands.</p></dd>
<dt><a name="38"><b class="cmd"><a href="../../../../index.html#key52">package</a></b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as the name of a
<i class="term"><a href="../../../../index.html#key52">package</a></i>. The text may have other markup already applied to
it. Main use is the highlighting of package names in free-form text.</p></dd>
<dt><a name="39"><b class="cmd">para</b></a></dt>
<dd><p>Text structure. This command breaks free-form text into
paragraphs. Each command closes the paragraph coming before it and
starts a new paragraph for the text coming after it. Higher-level
forms of structure are sections and subsections.</p></dd>
<dt><a name="40"><b class="cmd">rb</b></a></dt>
<dd><p>Text. The command is replaced with a right bracket. Use in free-form text.
Required to avoid interpretation of a right bracket as the end of a markup
command.</p></dd>
<dt><a name="41"><b class="cmd">require</b> <i class="arg">package</i> <span class="opt">?<i class="arg">version</i>?</span></a></dt>
<dd><p>Document information. Header. This command registers its argument
<i class="arg">package</i> as the name of a package or application required by the
described package or application. A minimum version can be provided as
well. This argument can be marked up. The usual markup is <b class="cmd">opt</b>.</p></dd>
<dt><a name="42"><b class="cmd">section</b> <i class="arg">name</i></a></dt>
<dd><p>Text structure. This command starts a new named document section. The
argument has to be plain text. Implicitly closes the last paragraph
coming before it and also implicitly opens the first paragraph of the
new section.</p></dd>
<dt><a name="43"><b class="cmd">sectref</b> <i class="arg">id</i> <span class="opt">?<i class="arg">text</i>?</span></a></dt>
<dd><p>Text markup. Formats a reference to the section identified by <i class="arg">id</i>.
If no <i class="arg">text</i> is specified the title of the referenced section is
used in the output, otherwise <i class="arg">text</i> is used.</p></dd>
<dt><a name="44"><b class="cmd">sectref-external</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. Like <b class="cmd">sectref</b>, except that the section is assumed to
be in a different document and therefore doesn't need to be identified,
nor are any checks for existence made. Only the text to format is needed.</p></dd>
<dt><a name="45"><b class="cmd">see_also</b> <i class="arg">args</i></a></dt>
<dd><p>Document information. Anywhere. The command defines direct cross-references
to other documents. Each argument is a plain text label identifying the
referenced document. If this command is used multiple times all the arguments
accumulate.</p></dd>
<dt><a name="46"><b class="cmd">strong</b> <i class="arg">text</i></a></dt>
<dd><p><em>Deprecated</em>. Text markup. See <b class="cmd">emph</b> for the canonical
command to emphasize text.</p></dd>
<dt><a name="47"><b class="cmd">subsection</b> <i class="arg">name</i></a></dt>
<dd><p>Text structure. This command starts a new named subsection of a
section. The argument has to be plain text. Implicitly closes the last
paragraph coming before it and also implicitly opens the first
paragraph of the new subsection.</p></dd>
<dt><a name="48"><b class="cmd">syscmd</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument text is marked up as the name of an external
command. The text may have other markup already applied to it. Main
use is the highlighting of external commands in free-form text.</p></dd>
<dt><a name="49"><b class="cmd"><a href="../term/term.html">term</a></b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as unspecific terminology.  The
text may have other markup already applied to it. Main use is the
highlighting of important terms and concepts in free-form text.</p></dd>
<dt><a name="50"><b class="cmd">titledesc</b> <i class="arg">desc</i></a></dt>
<dd><p>Document information. Header. Optional. Registers the plain text
argument as the title of the manpage. Defaults to the value registered
by <b class="cmd">moddesc</b>.</p></dd>
<dt><a name="51"><b class="cmd">tkoption_def</b> <i class="arg">name</i> <i class="arg">dbname</i> <i class="arg">dbclass</i></a></dt>
<dd><p>Text structure. List element. Widget option list. Automatically closes
the previous list element. Specifies the <i class="arg">name</i> of the option as
used in scripts, the name used by the option database (<i class="arg">dbname</i>),
and its class (<i class="arg">dbclass</i>), i.e. its type. It is expected that the
name is marked up using <b class="cmd">option</b>.</p></dd>
<dt><a name="52"><b class="cmd"><a href="../../../../index.html#key109">type</a></b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as the name of a
<i class="term">data type</i>. The text may have other markup already applied to
it. Main use is the highlighting of data types in free-form text.</p></dd>
<dt><a name="53"><b class="cmd"><a href="../uri/uri.html">uri</a></b> <i class="arg">text</i> <span class="opt">?<i class="arg">text</i>?</span></a></dt>
<dd><p>Text markup. The argument is marked up as an <i class="term"><a href="../../../../index.html#key480">uri</a></i> (i.e. a
<i class="term">uniform resource identifier</i>. The text may have other markup
already applied to it. Main use is the highlighting of uris in
free-form text. The second argument, should it be present, will be
interpreted the human-readable description of the uri. In other words,
as its label. Without an explicit label the uri will be its own label.</p></dd>
<dt><a name="54"><b class="cmd">usage</b> <i class="arg">args</i></a></dt>
<dd><p>Text markup. See <b class="cmd">call</b> for the full description, this command is
syntactically identical, as it is in its expectations for the markup
of its arguments.
In contrast to <b class="cmd">call</b> it is however not allowed to generate output
where this command occurs in the text. The command is <i class="term">silent</i>.
The formatted text may only appear in a different section of the
output, for example a table of contents, or synopsis, depending on the
output format.</p></dd>
<dt><a name="55"><b class="cmd">var</b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as the name of a
<i class="term">variable</i>. The text may have other markup already applied to
it. Main use is the highlighting of variables in free-form text.</p></dd>
<dt><a name="56"><b class="cmd">vset</b> <i class="arg">varname</i> <i class="arg">value</i></a></dt>
<dd><p>Templating. In this form the command sets the named document variable
to the specified <i class="arg">value</i>. It does not generate output. I.e. the
command is replaced by the empty string.</p></dd>
<dt><a name="57"><b class="cmd">vset</b> <i class="arg">varname</i></a></dt>
<dd><p>Templating. In this form the command is replaced by the value of the
named document variable</p></dd>
<dt><a name="58"><b class="cmd"><a href="../../../../index.html#key212">widget</a></b> <i class="arg">text</i></a></dt>
<dd><p>Text markup. The argument is marked up as the name of a
<i class="term"><a href="../../../../index.html#key212">widget</a></i>. The text may have other markup already applied to
it. Main use is the highlighting of widget names in free-form text.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctools_intro.html">doctools_intro</a>, <a href="doctools_lang_faq.html">doctools_lang_faq</a>, <a href="doctools_lang_intro.html">doctools_lang_intro</a>, <a href="doctools_lang_syntax.html">doctools_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key117">doctools commands</a>, <a href="../../../../index.html#key119">doctools language</a>, <a href="../../../../index.html#key120">doctools markup</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2010 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctools_lang_faq.html.























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools_lang_faq - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctools_lang_faq.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools_lang_faq.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools_lang_faq(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools_lang_faq - doctools language faq</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a>
<ul>
<li class="subsection"><a href="#subsection1">What is this document?</a></li>
</ul>
</li>
<li class="section"><a href="#section3">EXAMPLES</a>
<ul>
<li class="subsection"><a href="#subsection2">Where do I find doctools examples?</a></li>
</ul>
</li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">What is this document?</a></h3>
<p>This document is currently mainly a placeholder, to be filled with
commonly asked questions about the doctools markup language and
companions, and their answers.</p>
<p>Please report any questions (and, if possible, answers) we should
consider for this document in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.</p>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Where do I find doctools examples?</a></h3>
<p>The most examples of doctools markup currently known can be found in
the Tcllib and Tklib package bundles where basically the documentation
of all packages is written in it.
In Tcllib you will also find the sources for the doctools
documentation themselves, which makes use of nearly all of the
available markup commands.
You need one of</p>
<ol class="enumerated">
<li><p>A CVS snapshot of Tcllib. How to retrieve such a snapshot and the
tools required for this are described at
<a href="http://sourceforge.net/cvs/?group_id=12883">http://sourceforge.net/cvs/?group_id=12883</a></p></li>
<li><p>A Tcllib release archive. They are available at
<a href="http://sourceforge.net/project/showfiles.php?group_id=12883">http://sourceforge.net/project/showfiles.php?group_id=12883</a></p></li>
</ol>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report any such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
the package and/or the documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctools_lang_cmdref.html">doctools_lang_cmdref</a>, <a href="doctools_lang_intro.html">doctools_lang_intro</a>, <a href="doctools_lang_syntax.html">doctools_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key117">doctools commands</a>, <a href="../../../../index.html#key119">doctools language</a>, <a href="../../../../index.html#key120">doctools markup</a>, <a href="../../../../index.html#key118">doctools syntax</a>, <a href="../../../../index.html#key330">examples</a>, <a href="../../../../index.html#key325">faq</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctools_lang_intro.html.










































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools_lang_intro - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctools_lang_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools_lang_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools_lang_intro(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools_lang_intro - doctools language introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Fundamentals</a></li>
<li class="subsection"><a href="#subsection2">Basic structure</a></li>
<li class="subsection"><a href="#subsection3">Advanced structure</a></li>
<li class="subsection"><a href="#subsection4">Text structure</a></li>
<li class="subsection"><a href="#subsection5">Text markup</a></li>
<li class="subsection"><a href="#subsection6">Escapes</a></li>
<li class="subsection"><a href="#subsection7">Cross-references</a></li>
<li class="subsection"><a href="#subsection8">Examples</a></li>
<li class="subsection"><a href="#subsection9">Lists</a></li>
</ul>
</li>
<li class="section"><a href="#section2">FURTHER READING</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is an informal introduction to version 1 of the doctools
markup language based on a multitude of examples. After reading this a
writer should be ready to understand the two parts of the formal
specification, i.e. the <i class="term"><a href="doctools_lang_syntax.html">doctools language syntax</a></i> specification
and the <i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i>.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Fundamentals</a></h3>
<p>In the broadest terms possible the <i class="term">doctools markup language</i>
is LaTeX-like, instead of like SGML and similar languages. A document
written in this language consists primarily of text, with markup
commands embedded into it.</p>
<p>Each markup command is a Tcl command surrounded by a matching pair of
<b class="const">[</b> and <b class="const">]</b>. Inside of these delimiters the usual
rules for a Tcl command apply with regard to word quotation, nested
commands, continuation lines, etc. I.e.</p>
<pre class="example">
  ... [list_begin enumerated] ...
</pre>
<pre class="example">
  ... [call [cmd foo] \\
          [arg bar]] ...
</pre>
<pre class="example">
  ... [term {complex concept}] ...
</pre>
<pre class="example">
  ... [opt &quot;[arg key] [arg value]&quot;] ...
</pre>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Basic structure</a></h3>
<p>The most simple document which can be written in doctools is</p>
<pre class="example">
    [manpage_begin NAME SECTION VERSION]
    [description]
    [manpage_end]
</pre>
<p>This also shows us that all doctools documents are split into two
parts, the <i class="term">header</i> and the <i class="term">body</i>. Everything coming before
[<b class="cmd">description</b>] belongs to the header, and everything coming
after belongs to the body, with the whole document bracketed by the
two <b class="cmd">manpage_*</b> commands. Before and after these opening and
closing commands we have only <i class="term">whitespace</i>.</p>
<p>In the remainder of this section we will discuss only the contents of
the header, the structure of the body will be discussed in the section
<span class="sectref"><a href="#subsection4">Text structure</a></span>.</p>
<p>The header section can be empty, and otherwise may contain only an
arbitrary sequence of the four so-called <i class="term">header</i> commands, plus
<i class="term">whitespace</i>. These commands are</p>
<dl class="commands">
<dt><b class="cmd">titledesc</b></dt>
<dd></dd>
<dt><b class="cmd">moddesc</b></dt>
<dd></dd>
<dt><b class="cmd">require</b></dt>
<dd></dd>
<dt><b class="cmd">copyright</b></dt>
<dd></dd>
</dl>
<p>They provide, through their arguments, additional information about
the document, like its title, the title of the larger group the
document belongs to (if applicable), the requirements of the
documented packages (if applicable), and copyright assignments. All of
them can occur multiple times, including none, and they can be used in
any order.
However for <b class="cmd">titledesc</b> and <b class="cmd">moddesc</b> only the last occurrence
is taken. For the other two the specified information is accumulated,
in the given order. Regular text is not allowed within the header.</p>
<p>Given the above a less minimal example of a document is</p>
<pre class="example">
[manpage_begin NAME SECTION VERSION]
[<b class="cmd">copyright {YEAR AUTHOR}</b>]
[<b class="cmd">titledesc TITLE</b>]
[<b class="cmd">moddesc   MODULE_TITLE</b>]
[<b class="cmd">require   PACKAGE VERSION</b>]
[<b class="cmd">require   PACKAGE</b>]
[description]
[manpage_end]
</pre>
<p>Remember that the whitespace is optional. The document</p>
<pre class="example">
    [manpage_begin NAME SECTION VERSION]
    [copyright {YEAR AUTHOR}][titledesc TITLE][moddesc MODULE_TITLE]
    [require PACKAGE VERSION][require PACKAGE][description]
    [manpage_end]
</pre>
<p>has the same meaning as the example before.</p>
<p>On the other hand, if <i class="term">whitespace</i> is present it consists not
only of any sequence of characters containing the space character,
horizontal and vertical tabs, carriage return, and newline, but it may
contain comment markup as well, in the form of the <b class="cmd"><a href="../../../../index.html#key146">comment</a></b>
command.</p>
<pre class="example">
[<b class="cmd">comment { ... }</b>]
[manpage_begin NAME SECTION VERSION]
[copyright {YEAR AUTHOR}]
[titledesc TITLE]
[moddesc   MODULE_TITLE][<b class="cmd">comment { ... }</b>]
[require   PACKAGE VERSION]
[require   PACKAGE]
[description]
[manpage_end]
[<b class="cmd">comment { ... }</b>]
</pre>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Advanced structure</a></h3>
<p>In the simple examples of the last section we fudged a bit regarding
the markup actually allowed to be used before the <b class="cmd">manpage_begin</b>
command opening the document.</p>
<p>Instead of only whitespace the two templating commands <b class="cmd">include</b>
and <b class="cmd">vset</b> are also allowed, to enable the writer to either set
and/or import configuration settings relevant to the document. I.e. it
is possible to write</p>
<pre class="example">
[<b class="cmd">include FILE</b>]
[<b class="cmd">vset VAR VALUE</b>]
[manpage_begin NAME SECTION VERSION]
[description]
[manpage_end]
</pre>
<p>Even more important, these two commands are allowed anywhere where a
markup command is allowed, without regard for any other
structure. I.e. for example in the header as well.</p>
<pre class="example">
[manpage_begin NAME SECTION VERSION]
[<b class="cmd">include FILE</b>]
[<b class="cmd">vset VAR VALUE</b>]
[description]
[manpage_end]
</pre>
<p>The only restriction <b class="cmd">include</b> has to obey is that the contents of
the included file must be valid at the place of the inclusion. I.e. a
file included before <b class="cmd">manpage_begin</b> may contain only the
templating commands <b class="cmd">vset</b> and <b class="cmd">include</b>, a file included in
the header may contain only header commands, etc.</p>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Text structure</a></h3>
<p>The body of the document consists mainly of text, possibly split into
sections, subsections, and paragraphs, with parts marked up to
highlight various semantic categories of text, and additional
structure through the use of examples and (nested) lists.</p>
<p>This section explains the high-level structural commands, with
everything else deferred to the following sections.</p>
<p>The simplest way of structuring the body is through the introduction
of paragraphs. The command for doing so is <b class="cmd">para</b>. Each occurrence
of this command closes the previous paragraph and automatically opens
the next. The first paragraph is automatically opened at the beginning
of the body, by <b class="cmd">description</b>. In the same manner the last
paragraph automatically ends at <b class="cmd">manpage_end</b>.</p>
<pre class="example">
[manpage_begin NAME SECTION VERSION]
[description]
 ...
[<b class="cmd">para</b>]
 ...
[<b class="cmd">para</b>]
 ...
[manpage_end]
</pre>
<p>Empty paragraphs are ignored.</p>
<p>A structure coarser than paragraphs are sections, which allow the
writer to split a document into larger, and labeled, pieces. The
command for doing so is <b class="cmd">section</b>. Each occurrence of this command
closes the previous section and automatically opens the next,
including its first paragraph. The first section is automatically
opened at the beginning of the body, by <b class="cmd">description</b> (This
section is labeled &quot;DESCRIPTION&quot;). In the same manner the last section
automatically ends at <b class="cmd">manpage_end</b>.</p>
<p>Empty sections are <em>not</em> ignored. We are free to (not) use
paragraphs within sections.</p>
<pre class="example">
[manpage_begin NAME SECTION VERSION]
[description]
 ...
[<b class="cmd">section {Section A}</b>]
 ...
[para]
 ...
[<b class="cmd">section {Section B}</b>]
 ...
[manpage_end]
</pre>
<p>Between sections and paragraphs we have subsections, to split sections.
The command for doing so is <b class="cmd">subsection</b>. Each occurrence of this
command closes the previous subsection and automatically opens the
next, including its first paragraph. A subsection is automatically
opened at the beginning of the body, by <b class="cmd">description</b>, and at the
beginning of each section. In the same manner the last subsection
automatically ends at <b class="cmd">manpage_end</b>.</p>
<p>Empty subsections are <em>not</em> ignored. We are free to (not) use
paragraphs within subsections.</p>
<pre class="example">
[manpage_begin NAME SECTION VERSION]
[description]
 ...
[section {Section A}]
 ...
[<b class="cmd">subsection {Sub 1}</b>]
 ...
[para]
 ...
[<b class="cmd">subsection {Sub 2}</b>]
 ...
[section {Section B}]
 ...
[manpage_end]
</pre>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Text markup</a></h3>
<p>Having handled the overall structure a writer can impose on the
document we now take a closer at the text in a paragraph.</p>
<p>While most often this is just the unadorned content of the document we
do have situations where we wish to highlight parts of it as some type
of thing or other, like command arguments, command names, concepts,
uris, etc.</p>
<p>For this we have a series of markup commands which take the text to
highlight as their single argument. It should be noted that while
their predominant use is the highlighting of parts of a paragraph they
can also be used to mark up the arguments of list item commands, and
of other markup commands.</p>
<p>The commands available to us are</p>
<dl class="commands">
<dt><b class="cmd">arg</b></dt>
<dd><p>Its argument is a the name of a command argument.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key219">class</a></b></dt>
<dd><p>Its argument is a class name.</p></dd>
<dt><b class="cmd">cmd</b></dt>
<dd><p>Its argument is a command name (Tcl command).</p></dd>
<dt><b class="cmd">const</b></dt>
<dd><p>Its argument is a constant.</p></dd>
<dt><b class="cmd">emph</b></dt>
<dd><p>General, non-semantic emphasis.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key31">file</a></b></dt>
<dd><p>Its argument is a filename / path.</p></dd>
<dt><b class="cmd">fun</b></dt>
<dd><p>Its argument is a function name.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key332">method</a></b></dt>
<dd><p>Its argument is a method name</p></dd>
<dt><b class="cmd">namespace</b></dt>
<dd><p>Its argument is namespace name.</p></dd>
<dt><b class="cmd">opt</b></dt>
<dd><p>Its argument is some optional syntax element.</p></dd>
<dt><b class="cmd">option</b></dt>
<dd><p>Its argument is a command line switch / widget option.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key52">package</a></b></dt>
<dd><p>Its argument is a package name.</p></dd>
<dt><b class="cmd">sectref</b></dt>
<dd><p>Its argument is the title of a section or subsection,
                    i.e. a section reference.</p></dd>
<dt><b class="cmd">syscmd</b></dt>
<dd><p>Its argument is a command name (external, system command).</p></dd>
<dt><b class="cmd"><a href="../term/term.html">term</a></b></dt>
<dd><p>Its argument is a concept, or general terminology.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key109">type</a></b></dt>
<dd><p>Its argument is a type name.</p></dd>
<dt><b class="cmd"><a href="../uri/uri.html">uri</a></b></dt>
<dd><p>Its argument is a uniform resource identifier, i.e an
                    external reference. A second argument can be used
                    to specify an explicit label for the reference in
                    question.</p></dd>
<dt><b class="cmd">usage</b></dt>
<dd><p>The arguments describe the syntax of a Tcl command.</p></dd>
<dt><b class="cmd">var</b></dt>
<dd><p>Its argument is a variable.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key212">widget</a></b></dt>
<dd><p>Its argument is a widget name.</p></dd>
</dl>
<p>The example demonstrating the use of text markup is an excerpt from
the <i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i>, with some
highlighting added.
It shows their use within a block of text, as the arguments of a list
item command (<b class="cmd">call</b>), and our ability to nest them.</p>
<pre class="example">
  ...
  [call [<b class="cmd">cmd arg_def</b>] [<b class="cmd">arg type</b>] [<b class="cmd">arg name</b>]] [<b class="cmd">opt</b> [<b class="cmd">arg mode</b>]]]
  Text structure. List element. Argument list. Automatically closes the
  previous list element. Specifies the data-[<b class="cmd">arg type</b>] of the described
  argument of a command, its [<b class="cmd">arg name</b>] and its i/o-[<b class="cmd">arg mode</b>]. The
  latter is optional.
  ...
</pre>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Escapes</a></h3>
<p>Beyond the 20 commands for simple markup shown in the previous section
we have two more available which are technically simple markup.
However their function is not the marking up of phrases as specific
types of things, but the insertion of characters, namely <b class="const">[</b>
and <b class="const">]</b>.
These commands, <b class="cmd">lb</b> and <b class="cmd">rb</b> respectively, are required
because our use of [ and ] to bracket markup commands makes it
impossible to directly use [ and ] within the text.</p>
<p>Our example of their use are the sources of the last sentence in the
previous paragraph, with some highlighting added.</p>
<pre class="example">
  ...
  These commands, [cmd lb] and [cmd lb] respectively, are required
  because our use of [<b class="cmd">lb</b>] and [<b class="cmd">rb</b>] to bracket markup commands makes it
  impossible to directly use [<b class="cmd">lb</b>] and [<b class="cmd">rb</b>] within the text.
  ...
</pre>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Cross-references</a></h3>
<p>The last two commands we have to discuss are for the declaration of
cross-references between documents, explicit and implicit. They are
<b class="cmd"><a href="../../../../index.html#key718">keywords</a></b> and <b class="cmd">see_also</b>. Both take an arbitrary number of
arguments, all of which have to be plain unmarked text. I.e. it is not
allowed to use markup on them. Both commands can be used multiple
times in a document. If that is done all arguments of all occurrences
of one of them are put together into a single set.</p>
<dl class="definitions">
<dt><b class="cmd"><a href="../../../../index.html#key718">keywords</a></b></dt>
<dd><p>The arguments of this command are interpreted as keywords describing
the document. A processor can use this information to create an index
indirectly linking the containing document to all documents with the
same keywords.</p></dd>
<dt><b class="cmd">see_also</b></dt>
<dd><p>The arguments of this command are interpreted as references to other
documents. A processor can format them as direct links to these
documents.</p></dd>
</dl>
<p>All the cross-reference commands can occur anywhere in the document
between <b class="cmd">manpage_begin</b> and <b class="cmd">manpage_end</b>. As such the writer
can choose whether she wants to have them at the beginning of the
body, or at its end, maybe near the place a keyword is actually
defined by the main content, or considers them as meta data which
should be in the header, etc.</p>
<p>Our example shows the sources for the cross-references of this
document, with some highlighting added. Incidentally they are found
at the end of the body.</p>
<pre class="example">
  ...
  [<b class="cmd">see_also doctools_intro</b>]
  [<b class="cmd">see_also doctools_lang_syntax</b>]
  [<b class="cmd">see_also doctools_lang_cmdref</b>]
  [<b class="cmd">keywords markup {semantic markup}</b>]
  [<b class="cmd">keywords {doctools markup} {doctools language}</b>]
  [<b class="cmd">keywords {doctools syntax} {doctools commands}</b>]
  [manpage_end]
</pre>
</div>
<div id="subsection8" class="subsection"><h3><a name="subsection8">Examples</a></h3>
<p>Where ever we can write plain text we can write examples too. For
simple examples we have the command <b class="cmd">example</b> which takes a single
argument, the text of the argument. The example text must not contain
markup. If we wish to have markup within an example we have to use the
2-command combination <b class="cmd">example_begin</b> / <b class="cmd">example_end</b> instead.</p>
<p>The first opens an example block, the other closes it, and in between
we can write plain text and use all the regular text markup commands.
Note that text structure commands are not allowed. This also means
that it is not possible to embed examples and lists within an example.
On the other hand, we <em>can</em> use templating commands within
example blocks to read their contents from a file (Remember section
<span class="sectref"><a href="#subsection3">Advanced structure</a></span>).</p>
<p>The source for the very first example in this document (see section
<span class="sectref"><a href="#subsection1">Fundamentals</a></span>), with some highlighting added, is</p>
<pre class="example">
  [<b class="cmd">example</b> {
    ... [list_begin enumerated] ...
  }]
</pre>
<p>Using <b class="cmd">example_begin</b> / <b class="cmd">example_end</b> this would look like</p>
<pre class="example">
  [<b class="cmd">example_begin</b>]
    ... [list_begin enumerated] ...
  [<b class="cmd">example_end</b>]
</pre>
</div>
<div id="subsection9" class="subsection"><h3><a name="subsection9">Lists</a></h3>
<p>Where ever we can write plain text we can write lists too. The main
commands are <b class="cmd">list_begin</b> to start a list, and <b class="cmd">list_end</b> to
close one. The opening command takes an argument specifying the type
of list started it, and this in turn determines which of the eight
existing list item commands are allowed within the list to start list
items.</p>
<p>After the opening command only whitespace is allowed, until the first
list item command opens the first item of the list. Each item is a
regular series of paragraphs and is closed by either the next list
item command, or the end of the list. If closed by a list item command
this command automatically opens the next list item. A consequence of
a list item being a series of paragraphs is that all regular text
markup can be used within a list item, including examples and other
lists.</p>
<p>The list types recognized by <b class="cmd">list_begin</b> and their associated
list item commands are:</p>
<dl class="definitions">
<dt><b class="const">arguments</b></dt>
<dd><p>(<b class="cmd">arg_def</b>) This opens an <i class="term">argument (declaration) list</i>. It
is a specialized form of a term definition list where the term is an
argument name, with its type and i/o-mode.</p></dd>
<dt><b class="const">commands</b></dt>
<dd><p>(<b class="cmd">cmd_def</b>) This opens a <i class="term">command (declaration) list</i>. It
is a specialized form of a term definition list where the term is a
command name.</p></dd>
<dt><b class="const">definitions</b></dt>
<dd><p>(<b class="cmd">def</b> and <b class="cmd">call</b>) This opens a general
<i class="term">term definition list</i>. The terms defined by the list items are
specified through the argument(s) of the list item commands, either
general terms, possibly with markup (<b class="cmd">def</b>), or Tcl commands with
their syntax (<b class="cmd">call</b>).</p></dd>
<dt><b class="const">enumerated</b></dt>
<dd><p>(<b class="cmd">enum</b>) This opens a general <i class="term">enumerated list</i>.</p></dd>
<dt><b class="const">itemized</b></dt>
<dd><p>(<b class="cmd">item</b>)
This opens a general <i class="term">itemized list</i>.</p></dd>
<dt><b class="const">options</b></dt>
<dd><p>(<b class="cmd">opt_def</b>) This opens an <i class="term">option (declaration) list</i>. It
is a specialized form of a term definition list where the term is an
option name, possibly with the option's arguments.</p></dd>
<dt><b class="const">tkoptions</b></dt>
<dd><p>(<b class="cmd">tkoption_def</b>) This opens a
<i class="term">widget option (declaration) list</i>. It is a specialized form of
a term definition list where the term is the name of a configuration
option for a widget, with its name and class in the option database.</p></dd>
</dl>
<p>Our example is the source of the definition list in the previous
paragraph, with most of the content in the middle removed.</p>
<pre class="example">
  ...
  [<b class="cmd">list_begin</b> definitions]
  [<b class="cmd">def</b> [const arg]]
  ([cmd arg_def]) This opens an argument (declaration) list. It is a
  specialized form of a definition list where the term is an argument
  name, with its type and i/o-mode.
  [<b class="cmd">def</b> [const itemized]]
  ([cmd item])
  This opens a general itemized list.
  ...
  [<b class="cmd">def</b> [const tkoption]]
  ([cmd tkoption_def]) This opens a widget option (declaration) list. It
  is a specialized form of a definition list where the term is the name
  of a configuration option for a widget, with its name and class in the
  option database.
  [<b class="cmd">list_end</b>]
  ...
</pre>
<p>Note that a list cannot begin in one (sub)section and end in
another. Differently said, (sub)section breaks are not allowed within
lists and list items. An example of this <em>illegal</em> construct is</p>
<pre class="example">
  ...
  [list_begin itemized]
  [item]
  ...
  [<b class="cmd">section {ILLEGAL WITHIN THE LIST}</b>]
  ...
  [list_end]
  ...
</pre>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">FURTHER READING</a></h2>
<p>Now that this document has been digested the reader, assumed to be a
<i class="term">writer</i> of documentation should be fortified enough to be able
to understand the formal <i class="term"><a href="doctools_lang_syntax.html">doctools language syntax</a></i>
specification as well. From here on out the
<i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i> will also serve as the
detailed specification and cheat sheet for all available commands and
their syntax.</p>
<p>To be able to validate a document while writing it, it is also
recommended to familiarize oneself with one of the applications for
the processing and conversion of doctools documents, i.e. either
Tcllib's easy and simple <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b>, or Tclapps'
ultra-configurable <b class="syscmd">dtp</b>.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctools_intro.html">doctools_intro</a>, <a href="doctools_lang_cmdref.html">doctools_lang_cmdref</a>, <a href="doctools_lang_faq.html">doctools_lang_faq</a>, <a href="doctools_lang_syntax.html">doctools_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key117">doctools commands</a>, <a href="../../../../index.html#key119">doctools language</a>, <a href="../../../../index.html#key120">doctools markup</a>, <a href="../../../../index.html#key118">doctools syntax</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctools_lang_syntax.html.






































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools_lang_syntax - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctools_lang_syntax.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools_lang_syntax.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools_lang_syntax(n) 1.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools_lang_syntax - doctools language syntax</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Fundamentals</a></li>
<li class="section"><a href="#section3">Lexical definitions</a></li>
<li class="section"><a href="#section4">Syntax</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document contains the formal specification of the syntax of the
doctools markup language, version 1 in Backus-Naur-Form. This document
is intended to be a reference, complementing the
<i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i>.
A beginner should read the much more informally written
<i class="term"><a href="doctools_lang_intro.html">doctools language introduction</a></i> first before trying to
understand either this document or the command reference.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Fundamentals</a></h2>
<p>In the broadest terms possible the <i class="term">doctools markup language</i>
is LaTeX-like, instead of like SGML and similar languages. A document
written in this language consists primarily of text, with markup
commands embedded into it.</p>
<p>Each markup command is a just Tcl command surrounded by a matching
pair of <b class="const">[</b> and <b class="const">]</b>. Which commands are available,
and their arguments, i.e. syntax is specified in the
<i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i>.</p>
<p>In this document we specify first the lexeme, and then the syntax,
i.e. how we can mix text and markup commands with each other.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Lexical definitions</a></h2>
<p>In the syntax rules listed in the next section</p>
<ol class="enumerated">
<li><p>&lt;TEXT&gt; stands for all text except markup commands.</p></li>
<li><p>Any XXX stands for the markup command [xxx] including its
arguments. Each markup command is a Tcl command surrounded by a
matching pair of <b class="const">[</b> and <b class="const">]</b>. Inside of these
delimiters the usual rules for a Tcl command apply with regard to word
quotation, nested commands, continuation lines, etc.</p></li>
<li><p>&lt;WHITE&gt; stands for all text consisting only of spaces, newlines,
tabulators and the <b class="cmd"><a href="../../../../index.html#key146">comment</a></b> markup command.</p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">Syntax</a></h2>
<p>The rules listed here specify only the syntax of doctools
documents. The lexical level of the language was covered in the
previous section.</p>
<p>Regarding the syntax of the (E)BNF itself</p>
<ol class="enumerated">
<li><p>The construct { X } stands for zero or more occurrences of X.</p></li>
<li><p>The construct [ X ] stands for zero or one occurrence of X.</p></li>
<li><p>The construct LIST_BEGIN&lt;X&gt; stands for the markup command
<b class="cmd">list_begin</b> with <b class="const">X</b> as its type argument.</p></li>
</ol>
<p>The syntax:</p>
<pre class="example">
manpage = defs
          MANPAGE_BEGIN
          header
          DESCRIPTION
          body
          MANPAGE_END
          { &lt;WHITE&gt; }
defs    = { INCLUDE | VSET | &lt;WHITE&gt; }
header  = { TITLEDESC | MODDESC | COPYRIGHT | REQUIRE | defs | xref }
xref    = KEYWORDS | SEE_ALSO | CATEGORY
body    = paras { SECTION    sbody  }
sbody   = paras { SUBSECTION ssbody }
ssbody  = paras
paras   = tblock { (PARA | NL) tblock }
tblock  = { &lt;TEXT&gt; | defs | markup | xref | an_example | a_list }
markup  = ARG     | CLASS | CMD     | CONST     | EMPH   | FILE
        | FUN     | LB    | METHOD  | NAMESPACE | OPT    | OPTION
        | PACKAGE | RB    | SECTREF | STRONG    | SYSCMD | TERM
        | TYPE    | URI   | USAGE   | VAR       | WIDGET
example = EXAMPLE
        | EXAMPLE_BEGIN extext EXAMPLE_END
extext  = { &lt;TEXT&gt; | defs | markup }
a_list  = LIST_BEGIN&lt;arguments&gt;   argd_list   LIST_END
        | LIST_BEGIN&lt;commands&gt;    cmdd_list   LIST_END
        | LIST_BEGIN&lt;definitions&gt; def_list    LIST_END
        | LIST_BEGIN&lt;enumerated&gt;  enum_list   LIST_END
        | LIST_BEGIN&lt;itemized&gt;    item_list   LIST_END
        | LIST_BEGIN&lt;options&gt;     optd_list   LIST_END
        | LIST_BEGIN&lt;tkoptions&gt;   tkoptd_list LIST_END
argd_list   = [ &lt;WHITE&gt; ] { ARG_DEF      paras }
cmdd_list   = [ &lt;WHITE&gt; ] { CMD_DEF      paras }
def_list    = [ &lt;WHITE&gt; ] { (DEF|CALL)   paras }
enum_list   = [ &lt;WHITE&gt; ] { ENUM         paras }
item_list   = [ &lt;WHITE&gt; ] { ITEM         paras }
optd_list   = [ &lt;WHITE&gt; ] { OPT_DEF      paras }
tkoptd_list = [ &lt;WHITE&gt; ] { TKOPTION_DEF paras }
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctools_intro.html">doctools_intro</a>, <a href="doctools_lang_cmdref.html">doctools_lang_cmdref</a>, <a href="doctools_lang_faq.html">doctools_lang_faq</a>, <a href="doctools_lang_intro.html">doctools_lang_intro</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key117">doctools commands</a>, <a href="../../../../index.html#key119">doctools language</a>, <a href="../../../../index.html#key120">doctools markup</a>, <a href="../../../../index.html#key118">doctools syntax</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/doctools_plugin_apiref.html.










































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools_plugin_apiref - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/doctools_plugin_apiref.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2010 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools_plugin_apiref.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools_plugin_apiref(n) 1.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools_plugin_apiref - doctools plugin API reference</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a></li>
<li class="section"><a href="#section3">FRONTEND COMMANDS</a></li>
<li class="section"><a href="#section4">PLUGIN COMMANDS</a>
<ul>
<li class="subsection"><a href="#subsection1">Management commands</a></li>
<li class="subsection"><a href="#subsection2">Formatting commands</a></li>
</ul>
</li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">dt_copyright</b></a></li>
<li><a href="#2"><b class="cmd">dt_file</b></a></li>
<li><a href="#3"><b class="cmd">dt_mainfile</b></a></li>
<li><a href="#4"><b class="cmd">dt_fileid</b></a></li>
<li><a href="#5"><b class="cmd">dt_fmap</b> <i class="arg">symfname</i></a></li>
<li><a href="#6"><b class="cmd">dt_format</b></a></li>
<li><a href="#7"><b class="cmd">dt_imgdata</b> <i class="arg">key</i> <i class="arg">extensions</i></a></li>
<li><a href="#8"><b class="cmd">dt_imgdst</b> <i class="arg">key</i> <i class="arg">extensions</i></a></li>
<li><a href="#9"><b class="cmd">dt_imgsrc</b> <i class="arg">key</i> <i class="arg">extensions</i></a></li>
<li><a href="#10"><b class="cmd">dt_lnesting</b></a></li>
<li><a href="#11"><b class="cmd">dt_module</b></a></li>
<li><a href="#12"><b class="cmd">dt_read</b> <i class="arg">file</i></a></li>
<li><a href="#13"><b class="cmd">dt_source</b> <i class="arg">file</i></a></li>
<li><a href="#14"><b class="cmd">dt_user</b></a></li>
<li><a href="#15"><b class="cmd">ex_cappend</b> <i class="arg">text</i></a></li>
<li><a href="#16"><b class="cmd">ex_cget</b> <i class="arg">varname</i></a></li>
<li><a href="#17"><b class="cmd">ex_cis</b> <i class="arg">cname</i></a></li>
<li><a href="#18"><b class="cmd">ex_cname</b></a></li>
<li><a href="#19"><b class="cmd">ex_cpop</b> <i class="arg">cname</i></a></li>
<li><a href="#20"><b class="cmd">ex_cpush</b> <i class="arg">cname</i></a></li>
<li><a href="#21"><b class="cmd">ex_cset</b> <i class="arg">varname</i> <i class="arg">value</i></a></li>
<li><a href="#22"><b class="cmd">ex_lb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></li>
<li><a href="#23"><b class="cmd">ex_rb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></li>
<li><a href="#24"><b class="cmd">fmt_initialize</b></a></li>
<li><a href="#25"><b class="cmd">fmt_listvariables</b></a></li>
<li><a href="#26"><b class="cmd">fmt_numpasses</b></a></li>
<li><a href="#27"><b class="cmd">fmt_postprocess</b> <i class="arg">text</i></a></li>
<li><a href="#28"><b class="cmd">fmt_setup</b> <i class="arg">n</i></a></li>
<li><a href="#29"><b class="cmd">fmt_shutdown</b></a></li>
<li><a href="#30"><b class="cmd">fmt_varset</b> <i class="arg">varname</i> <i class="arg">text</i></a></li>
<li><a href="#31"><b class="cmd">fmt_plain_text</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is intended for <i class="term">plugin writers</i>, i.e. developers
wishing to write a doctools <i class="term"><a href="../../../../index.html#key610">formatting engine</a></i> for some output
format X.</p>
<p>It specifies the interaction between the <b class="package"><a href="doctools.html">doctools</a></b> package
and its plugins, i.e. the interface any doctools formatting engine has
to comply with.</p>
<p>This document deals with version 1 of the interface.</p>
<p>A reader who is on the other hand more interested in the markup
language itself should start with the
<i class="term"><a href="doctools_lang_intro.html">doctools language introduction</a></i> and proceed from there to the
formal specifications, i.e. the <i class="term"><a href="doctools_lang_syntax.html">doctools language syntax</a></i> and
the <i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<p>The API for a doctools formatting engine consists of two major
sections.</p>
<p>On the one side we have a set of commands through which the plugin is
able to query the frontend. These commands are provided by the
frontend and linked into the plugin interpreter. Please see section
<span class="sectref"><a href="#section3">FRONTEND COMMANDS</a></span> for their detailed specification.</p>
<p>And on the other side the plugin has to provide its own set of
commands which will then be called by the frontend in a specific
sequence while processing input. They, again, fall into two
categories, management and formatting.
Please see section <span class="sectref"><a href="#section4">PLUGIN COMMANDS</a></span> and its subsections for
their detailed specification.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">FRONTEND COMMANDS</a></h2>
<p>This section specifies the set of commands through which a plugin,
also known as a doctools formatting engine, is able to query the
frontend. These commands are provided by the frontend and linked into
the plugin interpreter.</p>
<p>I.e. a doctools formatting engine can assume that all of the following
commands are present when any of its own commands (as specified in
section <span class="sectref"><a href="#section4">PLUGIN COMMANDS</a></span>) are executed.</p>
<p>Beyond that it can also assume that it has full access to its own safe
interpreter and thus is not able to damage the other parts of the
processor, nor can it damage the filesystem.
It is however able to either kill or hang the whole process, by
exiting, or running an infinite loop.</p>
<p>Coming back to the imported commands, all the commands with prefix
<em>dt_</em> provide limited access to specific parts of the frontend,
whereas the commands with prefix <em>ex_</em> provide access to the
state of the <b class="package"><a href="../textutil/expander.html">textutil::expander</a></b> object which does the main
parsing of the input within the frontend. These commands should not be
except under very special circumstances.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">dt_copyright</b></a></dt>
<dd><p>Query command. It returns a string containing the copyright
information the doctools processor was configured with. The relevant
option is <b class="option">-copyright</b>).</p></dd>
<dt><a name="2"><b class="cmd">dt_file</b></a></dt>
<dd><p>Query command. It returns the full path of the file containing the
input currently processed by the engine. This may be an included file.</p></dd>
<dt><a name="3"><b class="cmd">dt_mainfile</b></a></dt>
<dd><p>Query command. It returns the full path of the toplevel file containing
the input currently processed by the engine.</p></dd>
<dt><a name="4"><b class="cmd">dt_fileid</b></a></dt>
<dd><p>Query command. It returns the name of the file containing the input
currently processed by the engine, without path, nor extension.</p></dd>
<dt><a name="5"><b class="cmd">dt_fmap</b> <i class="arg">symfname</i></a></dt>
<dd><p>Query command. It returns the actual pathname to use in the output in
place of the symbolic filename <i class="arg">symfname</i>. It will return the
unchanged input if no mapping was established for <i class="arg">symfname</i>.</p>
<p>The required mappings are established with the method <b class="method">map</b> of
a frontend, as explained in section <b class="sectref">OBJECT METHODS</b>
of the documentation for the package <b class="package"><a href="doctools.html">doctools</a></b>.</p></dd>
<dt><a name="6"><b class="cmd">dt_format</b></a></dt>
<dd><p>Query command. It returns the name of the format associated with the
doctools formatting engine.</p></dd>
<dt><a name="7"><b class="cmd">dt_imgdata</b> <i class="arg">key</i> <i class="arg">extensions</i></a></dt>
<dd><p>Query command. Access to the image map. Looks for an image recorded
under the <i class="arg">key</i> and having on the specified <i class="arg">extension</i>. If a
matching image is found its data is returned as the result of the
command. Otherwise an empty string is returned.</p></dd>
<dt><a name="8"><b class="cmd">dt_imgdst</b> <i class="arg">key</i> <i class="arg">extensions</i></a></dt>
<dd><p>Query command. Access to the image map. Looks for an image recorded
under the <i class="arg">key</i> and having on the specified <i class="arg">extension</i>. If a
matching image is found its destination path in the output is returned
as the result of the command. Otherwise an empty string is returned.</p></dd>
<dt><a name="9"><b class="cmd">dt_imgsrc</b> <i class="arg">key</i> <i class="arg">extensions</i></a></dt>
<dd><p>Query command. Access to the image map. Looks for an image recorded
under the <i class="arg">key</i> and having on the specified <i class="arg">extension</i>. If a
matching image is found its origin path is returned as the result of
the command. Otherwise an empty string is returned.</p></dd>
<dt><a name="10"><b class="cmd">dt_lnesting</b></a></dt>
<dd><p>Query command. It returns the number of lists currently open.</p></dd>
<dt><a name="11"><b class="cmd">dt_module</b></a></dt>
<dd><p>Query command. It returns the name of the module the input currently
processed belongs to.</p></dd>
<dt><a name="12"><b class="cmd">dt_read</b> <i class="arg">file</i></a></dt>
<dd><p>Controlled filesystem access. Returns contents of <i class="arg">file</i> for
whatever use desired by the plugin.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.</p></dd>
<dt><a name="13"><b class="cmd">dt_source</b> <i class="arg">file</i></a></dt>
<dd><p>Controlled filesystem access. This command allows the doctools
formatting engine to load additional Tcl code it may need.
Only files which are either in the same directory as the file
containing the engine, or below it, can be loaded. Trying to load a
file outside of this directory causes an error.</p></dd>
<dt><a name="14"><b class="cmd">dt_user</b></a></dt>
<dd><p>Query command. It returns the name of the current user as known to the
tcl interpreter the frontend controlling the formatting engine resides
in.</p></dd>
<dt><a name="15"><b class="cmd">ex_cappend</b> <i class="arg">text</i></a></dt>
<dd><p>Appends a string to the output in the current context.  This command
should rarely be used by macros or application code.</p></dd>
<dt><a name="16"><b class="cmd">ex_cget</b> <i class="arg">varname</i></a></dt>
<dd><p>Retrieves the value of variable <i class="arg">varname</i>, defined in the current
context.</p></dd>
<dt><a name="17"><b class="cmd">ex_cis</b> <i class="arg">cname</i></a></dt>
<dd><p>Determines whether or not the name of the current context is
<i class="arg">cname</i>.</p></dd>
<dt><a name="18"><b class="cmd">ex_cname</b></a></dt>
<dd><p>Returns the name of the current context.</p></dd>
<dt><a name="19"><b class="cmd">ex_cpop</b> <i class="arg">cname</i></a></dt>
<dd><p>Pops a context from the context stack, returning all accumulated
output in that context.  The context must be named <i class="arg">cname</i>, or an
error results.</p></dd>
<dt><a name="20"><b class="cmd">ex_cpush</b> <i class="arg">cname</i></a></dt>
<dd><p>Pushes a context named <i class="arg">cname</i> onto the context stack.  The
context must be popped by <b class="method">cpop</b> before expansion ends or an
error results.</p></dd>
<dt><a name="21"><b class="cmd">ex_cset</b> <i class="arg">varname</i> <i class="arg">value</i></a></dt>
<dd><p>Sets variable <i class="arg">varname</i> to <i class="arg">value</i> in the current context.</p></dd>
<dt><a name="22"><b class="cmd">ex_lb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></dt>
<dd><p>Returns the current value of the left macro expansion bracket; this is
for use as or within a macro, when the bracket needs to be included in
the output text.  If <i class="arg">newbracket</i> is specified, it becomes the new
bracket, and is returned.</p></dd>
<dt><a name="23"><b class="cmd">ex_rb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></dt>
<dd><p>Returns the current value of the right macro expansion bracket; this
is for use as or within a macro, when the bracket needs to be included
in the output text.  If <i class="arg">newbracket</i> is specified, it becomes the
new bracket, and is returned.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">PLUGIN COMMANDS</a></h2>
<p>The plugin has to provide its own set of commands which will then be
called by the frontend in a specific sequence while processing
input. They fall into two categories, management and formatting. Their
expected names, signatures, and responsibilities are specified in the
following two subsections.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Management commands</a></h3>
<p>The management commands a plugin has to provide are used by the
frontend to</p>
<ol class="enumerated">
<li><p>initialize and shutdown the plugin</p></li>
<li><p>determine the number of passes it has
       to make over the input</p></li>
<li><p>initialize and shutdown each pass</p></li>
<li><p>query and initialize engine parameters</p></li>
</ol>
<p>After the plugin has been loaded and the frontend commands are
established the commands will be called in the following sequence:</p>
<pre class="example">
    fmt_numpasses -&gt; n
    fmt_listvariables -&gt; vars
    fmt_varset var1 value1
    fmt_varset var2 value2
    ...
    fmt_varset varK valueK
    fmt_initialize
    fmt_setup 1
    ...
    fmt_setup 2
    ...
    ...
    fmt_setup n
    ...
    fmt_postprocess
    fmt_shutdown
    ...
</pre>
<p>I.e. first the number of passes and the set of available engine
parameters is established, followed by calls setting the
parameters. That second part is optional.</p>
<p>After that the plugin is initialized, the specified number of passes
executed, the final result run through a global post processing step
and at last the plugin is shutdown again. This can be followed by more
conversions, restarting the sequence at <b class="cmd">fmt_varset</b>.</p>
<p>In each of the passes, i.e. after the calls of <b class="cmd">fmt_setup</b> the
frontend will process the input and call the formatting commands as
markup is encountered. This means that the sequence of formatting
commands is determined by the grammar of the doctools markup language,
as specified in the <i class="term"><a href="doctools_lang_syntax.html">doctools language syntax</a></i> specification.</p>
<p>A different way of looking at the sequence is:</p>
<ul class="itemized">
<li><p>First some basic parameters are determined.</p></li>
<li><p>Then everything starting at the first <b class="cmd">fmt_varset</b> to
<b class="cmd">fmt_shutdown</b> forms a <i class="term">run</i>, the formatting of a
single input. Each run can be followed by more.</p></li>
<li><p>Embedded within each run we have one or more <i class="term">passes</i>,
each starting with <b class="cmd">fmt_setup</b> and going until either the next
<b class="cmd">fmt_setup</b> or <b class="cmd">fmt_postprocess</b> is reached.</p>
<p>If more than one pass is required to perform the formatting only the
output of the last pass is relevant. The output of all the previous,
preparatory passes is ignored.</p></li>
</ul>
<p>The commands, their names, signatures, and responsibilities are, in
detail:</p>
<dl class="definitions">
<dt><a name="24"><b class="cmd">fmt_initialize</b></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called at the beginning of every conversion run, as
the first command of that run. Note that a run is not a pass, but may
consist of multiple passes.
It has to initialize the general state of the plugin, beyond the
initialization done during the load. No return value is expected, and
any returned value is ignored.</p></dd>
<dt><a name="25"><b class="cmd">fmt_listvariables</b></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Engine parameters</em>.
Second command is called after the plugin code has been loaded,
i.e. immediately after <b class="cmd">fmt_numpasses</b>.
It has to return a list containing the names of the parameters the
frontend can set to configure the engine. This list can be empty.</p></dd>
<dt><a name="26"><b class="cmd">fmt_numpasses</b></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Pass management</em>.
First command called after the plugin code has been loaded. No other
command of the engine will be called before it.
It has to return the number of passes this engine requires to fully
process the input document. This value has to be an integer number
greater or equal to one.</p></dd>
<dt><a name="27"><b class="cmd">fmt_postprocess</b> <i class="arg">text</i></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called immediately after the last pass in a run. Its
argument is the result of the conversion generated by that pass. It is
provided to allow the engine to perform any global modifications of
the generated document. If no post-processing is required for a
specific format the command has to just return the argument.</p>
<p>Expected to return a value, the final result of formatting the input.</p></dd>
<dt><a name="28"><b class="cmd">fmt_setup</b> <i class="arg">n</i></a></dt>
<dd><p><em>Initialization/Shutdown</em> and <em>Pass management</em>.
This command is called at the beginning of each pass over the input in
a run. Its argument is the number of the pass which has begun. Passes
are counted from <b class="const">1</b> upward.
The command has to set up the internal state of the plugin for this
particular pass. No return value is expected, and any returned value
is ignored.</p></dd>
<dt><a name="29"><b class="cmd">fmt_shutdown</b></a></dt>
<dd><p><em>Initialization/Shutdown</em>.
This command is called at the end of every conversion run. It is the
last command called in a run. It has to clean up of all the
run-specific state in the plugin.
After the call the engine has to be in a state which allows the
initiation of another run without fear that information from the last
run is leaked into this new run.
No return value is expected, and any returned value is ignored.</p></dd>
<dt><a name="30"><b class="cmd">fmt_varset</b> <i class="arg">varname</i> <i class="arg">text</i></a></dt>
<dd><p><em>Engine parameters</em>.
This command is called by the frontend to set an engine parameter to a
particular value.
The parameter to change is specified by <i class="arg">varname</i>, the value to
set in <i class="arg">text</i>.</p>
<p>The command has to throw an error if an unknown <i class="arg">varname</i> is
used. Only the names returned by <b class="cmd">fmt_listvariables</b> have to be
considered as known.</p>
<p>The values of all engine parameters have to persist between passes and
runs.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Formatting commands</a></h3>
<p>The formatting commands have to implement the formatting for the
output format, for all the markup commands of the doctools markup
language, except <b class="cmd">lb</b>, <b class="cmd">rb</b>, <b class="cmd">vset</b>, <b class="cmd">include</b>, and
<b class="cmd"><a href="../../../../index.html#key146">comment</a></b>. These exceptions are processed by the frontend and are
never seen by the plugin. In return a command for the formatting of
plain text has to be provided, something which has no markup in the
input at all.</p>
<p>This means, that each of the 49 markup commands specified in the
<i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i> and outside of the set of
exceptions listed above has an equivalent formatting command which
takes the same arguments as the markup command and whose name is the
name of markup command with the prefix <em>fmt_</em> added to it.</p>
<p>All commands are expected to format their input in some way per the
semantics specified in the command reference and to return whatever
part of this that they deem necessary as their result, which will be
added to the output.</p>
<p>To avoid essentially duplicating the command reference we do not list
any of the command here and simply refer the reader to the
<i class="term"><a href="doctools_lang_cmdref.html">doctools language command reference</a></i> for their signature and
description. The sole exception is the plain text formatter, which has
no equivalent markup command.</p>
<p>The calling sequence of formatting commands is not as rigid as for the
management commands, but determined by the grammar of the doctools
markup language, as specified in the <i class="term"><a href="doctools_lang_syntax.html">doctools language syntax</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="31"><b class="cmd">fmt_plain_text</b> <i class="arg">text</i></a></dt>
<dd><p><em>No associated markup command</em>.</p>
<p>Called by the frontend for any plain text encountered in the
input. It has to perform any and all special processing required for
plain text.</p>
<p>The formatted text is expected as the result of the command,
and added to the output. If no special processing is required it has
to simply return its argument without change.</p></dd>
</dl>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="doctools.html">doctools</a>, <a href="doctools_intro.html">doctools_intro</a>, <a href="doctools_lang_cmdref.html">doctools_lang_cmdref</a>, <a href="doctools_lang_faq.html">doctools_lang_faq</a>, <a href="doctools_lang_intro.html">doctools_lang_intro</a>, <a href="doctools_lang_syntax.html">doctools_lang_syntax</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key611">document</a>, <a href="../../../../index.html#key609">formatter</a>, <a href="../../../../index.html#key610">formatting engine</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2010 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools/mpexpand.html.































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>mpexpand - Documentation toolbox</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools/mpexpand.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2003 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ mpexpand.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">mpexpand(n) 1.0 tcllib &quot;Documentation toolbox&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>mpexpand - Markup processor</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">NOTES</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">mpexpand</b> <span class="opt">?-module <i class="arg">module</i>?</span> <i class="arg">format</i> <i class="arg">infile</i>|- <i class="arg">outfile</i>|-</a></li>
<li><a href="#2"><b class="cmd">mpexpand.all</b> <span class="opt">?<i class="arg">-verbose</i>?</span> <span class="opt">?<i class="arg">module</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This manpage describes a processor / converter for manpages in the
doctools format as specified in <b class="cmd">doctools_fmt</b>. The processor
is based upon the package <b class="package"><a href="doctools.html">doctools</a></b>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">mpexpand</b> <span class="opt">?-module <i class="arg">module</i>?</span> <i class="arg">format</i> <i class="arg">infile</i>|- <i class="arg">outfile</i>|-</a></dt>
<dd><p>The processor takes three arguments, namely the code describing which
formatting to generate as the output, the file to read the markup
from, and the file to write the generated output into. If the
<i class="arg">infile</i> is &quot;<b class="const">-</b>&quot; the processor will read from
<b class="const">stdin</b>. If <i class="arg">outfile</i> is &quot;<b class="const">-</b>&quot; the processor will
write to <b class="const">stdout</b>.</p>
<p>If the option <i class="arg">-module</i> is present its value overrides the internal
definition of the module name.</p>
<p>The currently known output formats are</p>
<dl class="definitions">
<dt><b class="const">nroff</b></dt>
<dd><p>The processor generates *roff output, the standard format for unix
manpages.</p></dd>
<dt><b class="const">html</b></dt>
<dd><p>The processor generates HTML output, for usage in and display by web
browsers.</p></dd>
<dt><b class="const">tmml</b></dt>
<dd><p>The processor generates TMML output, the Tcl Manpage Markup Language,
a derivative of XML.</p></dd>
<dt><b class="const">latex</b></dt>
<dd><p>The processor generates LaTeX output.</p></dd>
<dt><b class="const">wiki</b></dt>
<dd><p>The processor generates Wiki markup as understood by <b class="syscmd">wikit</b>.</p></dd>
<dt><b class="const">list</b></dt>
<dd><p>The processor extracts the information provided by <b class="cmd">manpage_begin</b>.</p></dd>
<dt><b class="const">null</b></dt>
<dd><p>The processor does not generate any output.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">mpexpand.all</b> <span class="opt">?<i class="arg">-verbose</i>?</span> <span class="opt">?<i class="arg">module</i>?</span></a></dt>
<dd><p>This command uses <b class="syscmd">mpexpand</b> to generate all possible output
formats for all manpages in the current directory. The manpages are
recognized through the extension &quot;<b class="file">.man</b>&quot;. If <i class="arg">-verbose</i> is
specified the command will list its actions before executing them.</p>
<p>The <i class="arg">module</i> information is passed to <b class="cmd">mpexpand</b>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">NOTES</a></h2>
<p>Possible future formats are plain text, pdf and postscript.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>expander(n), format(n), formatter(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key4">TMML</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key5">nroff</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2003 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2base/html_cssdefaults.html.








































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::html::cssdefaults - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2base/html_cssdefaults.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::html::cssdefaults.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::html::cssdefaults(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::html::cssdefaults - Default CSS style for HTML export plugins</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::html::cssdefaults <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::html::cssdefaults::contents</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a single command providing access to the text of
the default CSS style to use for HTML markup generated by the various
HTML export plugins.</p>
<p>This is an internal package of doctools, for use by <i class="term"><a href="../../../../index.html#key148">export</a></i> plugins,
i.e. the packages converting doctools related documented into other
formats, most notably <i class="term"><a href="../../../../index.html#key1">HTML</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::html::cssdefaults::contents</b></a></dt>
<dd><p>This command returns the text of the default CSS style to use for HTML
markup generated by the various HTML export plugins.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key356">CSS</a>, <a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key355">style</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2base/nroff_manmacros.html.








































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::nroff::man_macros - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2base/nroff_manmacros.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::nroff::man_macros.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::nroff::man_macros(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::nroff::man_macros - Default CSS style for NROFF export plugins</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::nroff::man_macros <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::nroff::man_macros::contents</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a single command providing access to the
definition of the nroff <em>man</em> macro set to use for NROFF markup
generated by the various NROFF export plugins.</p>
<p>This is an internal package of doctools, for use by <i class="term"><a href="../../../../index.html#key148">export</a></i> plugins,
i.e. the packages converting doctools related documented into other
formats, most notably <i class="term"><a href="../../../../index.html#key5">nroff</a></i>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::nroff::man_macros::contents</b></a></dt>
<dd><p>This command returns the text of the default CSS style to use for NROFF
generated by the various NROFF export plugins.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key479">macros</a>, <a href="../../../../index.html#key478">man_macros</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key357">plugin</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2base/tcl_parse.html.














































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::tcl::parse - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2base/tcl_parse.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::tcl::parse.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::tcl::parse(n) 1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::tcl::parse - Processing text in 'subst -novariables' format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Error format</a></li>
<li class="section"><a href="#section4">Tree Structure</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">fileutil</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">struct::stack</b></li>
<li>package require <b class="pkgname">struct::set</b></li>
<li>package require <b class="pkgname">treeql</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::tcl::parse</b> <b class="method">text</b> <i class="arg">tree</i> <i class="arg">text</i> <span class="opt">?<i class="arg">root</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::doctools::tcl::parse</b> <b class="method">file</b> <i class="arg">tree</i> <i class="arg">path</i> <span class="opt">?<i class="arg">root</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands for parsing text with embedded Tcl
commands as accepted by the Tcl builtin command
<b class="cmd">subst -novariables</b>. The result of the parsing is an abstract
syntax tree.</p>
<p>This is an internal package of doctools, for use by the higher level
parsers processing the <i class="term"><a href="../../../../index.html#key50">docidx</a></i>, <i class="term"><a href="../../../../index.html#key230">doctoc</a></i>, and <i class="term"><a href="../../../../index.html#key51">doctools</a></i>
markup languages.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::tcl::parse</b> <b class="method">text</b> <i class="arg">tree</i> <i class="arg">text</i> <span class="opt">?<i class="arg">root</i>?</span></a></dt>
<dd><p>The command takes the <i class="arg">text</i> and parses it under the assumption
that it contains a string acceptable to the Tcl builtin command
<b class="cmd">subst -novariables</b>. Errors are thrown otherwise during the
parsing. The format used for these errors in described in section
<span class="sectref"><a href="#section3">Error format</a></span>.</p>
<p>The command returns the empty string as it result. The actual result
of the parsing is entered into the tree structure <i class="arg">tree</i>, under
the node <i class="arg">root</i>.
If <i class="arg">root</i> is not specified the root of <i class="arg">tree</i> is used. The
<i class="arg">tree</i> has to exist and be the command of a tree object which
supports the same methods as trees created by the package
<b class="package"><a href="../struct/struct_tree.html">struct::tree</a></b>.</p>
<p>In case of errors <i class="arg">tree</i> will be left in an undefined state.</p></dd>
<dt><a name="2"><b class="cmd">::doctools::tcl::parse</b> <b class="method">file</b> <i class="arg">tree</i> <i class="arg">path</i> <span class="opt">?<i class="arg">root</i>?</span></a></dt>
<dd><p>The same as <b class="method">text</b>, except that the text to parse is read from
the file specified by <i class="arg">path</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Error format</a></h2>
<p>When the parser encounters a problem in the input
it will throw an error using the format described
here.</p>
<ol class="enumerated">
<li><p>The message will contain the reason for the problem (unexpected
character or end of input in input), the character in question, if
any, and the line and column the problem was found at, in a human
readable form. This part is not documented further as its format may
change as we see fit. It is intended for human consumption, not
machine.</p></li>
<li><p>The error code however will contain a machine-readable representation
of the problem, in the form of a 5-element list containing, in the
order listed below</p>
<ol class="enumerated">
<li><p>the constant string <b class="const">doctools::tcl::parse</b></p></li>
<li><p>the cause of the problem, one of</p>
<dl class="definitions">
<dt><b class="const">char</b></dt>
<dd><p>Unexpected character in input</p></dd>
<dt><b class="const">eof</b></dt>
<dd><p>Unexpected end of the input</p></dd>
</dl>
</li>
<li><p>The location of the problem as offset from the beginning of the input,
counted in characters. Note: Line markers count as one character.</p></li>
<li><p>The line the problem was found on (counted from 1 (one)),</p></li>
<li><p>The column the problem was found at (counted from 0 (zero))</p></li>
</ol>
</li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">Tree Structure</a></h2>
<p>After successfully parsing a string the generated tree will have the
following structure:</p>
<ol class="enumerated">
<li><p>In the following items the word 'root' refers to the node which was
specified as the root of the tree when invoking either <b class="method">text</b>
or <b class="method">file</b>. This may be the actual root of the tree.</p></li>
<li><p>All the following items further ignore the possibility of pre-existing
attributes in the pre-existing nodes. If attributes exists with the
same names as the attributes used by the parser the pre-existing
values are written over. Attributes with names not clashing with the
parser's attributes are not touched.</p></li>
<li><p>The root node has no attributes.</p></li>
<li><p>All other nodes have the attributes</p>
<dl class="definitions">
<dt>type</dt>
<dd><p>The value is a string from the set { Command , Text , Word }</p></dd>
<dt>range</dt>
<dd><p>The value is either empty or a 2-element list containing integer
numbers. The numbers are the offsets of the first and last character
in the input text, of the token described by the node,.</p></dd>
<dt>line</dt>
<dd><p>The value is an integer, it describes the line in the input the token
described by the node ends on. Lines are counted from 1 (<b class="const">one</b>).</p></dd>
<dt>col</dt>
<dd><p>The value is an integer, it describes the column in the line in the
input the token described by the node ends on. Columns are counted
from 0 (<b class="const">zero</b>).</p></dd>
</dl>
</li>
<li><p>The children of the root, if any, are of type Command and Text, in
semi-alternation. This means: After a Text node a Command node has to
follow, and anything can follow a Command node, a Text or other
Command node.</p></li>
<li><p>The children of a Command node, if any, are of type Command, and Text,
and Word, they describe the arguments of the command.</p></li>
<li><p>The children of a Word node, if any, are of type Command, Text, in
semi-alternation. This means: After a Text node a Command node has to
follow, and anything can follow a Command node, a Text or other
Command node.</p></li>
<li><p>A Word node without children represents the empty string.</p></li>
<li><p>All Text nodes are leaves of the tree.</p></li>
<li><p>All leaves of the tree are either Text or Command nodes.
Word nodes cannot be leaves.</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key235">Tcl syntax</a>, <a href="../../../../index.html#key236">command</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key234">subst</a>, <a href="../../../../index.html#key233">word</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2base/tcllib_msgcat.html.
























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2base/tcllib_msgcat.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat - Message catalog management for the various document parsers</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::msgcat::init</b> <i class="arg">prefix</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat</b> is a support module handling
the selection of message catalogs for the various document processing
packages in the doctools system version 2. As such it is an internal
package a regular user (developer) should not be in direct contact
with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="../doctools2toc/container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="../doctools2idx/container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the various
parser packages, and is shared by them. Underneath it, but not
explicit dependencies, are the packages providing the message catalogs
for the various languages.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::msgcat::init</b> <i class="arg">prefix</i></a></dt>
<dd><p>The command locates and loads the message catalogs for all the
languages returned by <b class="cmd">msgcat::mcpreferences</b>, provided that they
could be found. It returns an integer number describing how many
packages were found and loaded.</p>
<p>The names of the packages the command will look for have the form
&quot;doctools::msgcat::<i class="arg">prefix</i>::<b class="variable">langcode</b>&quot;, with <i class="arg">prefix</i>
the argument to the command, and the <b class="variable">langcode</b> supplied by the
result of <b class="cmd">msgcat::mcpreferences</b>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/container.html.






























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/container.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx(n) 2 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx - Holding keyword indices</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Concepts</a></li>
<li class="section"><a href="#section3">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Keyword index serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::idx <span class="opt">?2?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::structure</b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::idx</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">key add</b> <i class="arg">name</i></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">key remove</b> <i class="arg">name</i></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">key references</b> <i class="arg">name</i></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">keys</b></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">reference add</b> <i class="arg">type</i> <i class="arg">key</i> <i class="arg">name</i> <i class="arg">label</i></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">reference remove</b> <i class="arg">name</i></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">reference label</b> <i class="arg">name</i></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">reference keys</b> <i class="arg">name</i></a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">reference type</b> <i class="arg">name</i></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">references</b></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">title</b></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">title</b> <i class="arg">text</i></a></li>
<li><a href="#16"><i class="arg">objectName</i> <b class="method">label</b></a></li>
<li><a href="#17"><i class="arg">objectName</i> <b class="method">label</b> <i class="arg">text</i></a></li>
<li><a href="#18"><i class="arg">objectName</i> <b class="method">importer</b></a></li>
<li><a href="#19"><i class="arg">objectName</i> <b class="method">importer</b> <i class="arg">object</i></a></li>
<li><a href="#20"><i class="arg">objectName</i> <b class="method">exporter</b></a></li>
<li><a href="#21"><i class="arg">objectName</i> <b class="method">exporter</b> <i class="arg">object</i></a></li>
<li><a href="#22"><i class="arg">objectName</i> <b class="method">deserialize =</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#23"><i class="arg">objectName</i> <b class="method">deserialize +=</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#24"><i class="arg">objectName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">format</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class to contain and programmatically
manipulate keyword indices</p>
<p>This is one of the three public pillars the management of keyword
indices resides on. The other two pillars are</p>
<ol class="enumerated">
<li><p><i class="term"><a href="export.html">Exporting keyword indices</a></i>, and</p></li>
<li><p><i class="term"><a href="import.html">Importing keyword indices</a></i></p></li>
</ol>
<p>For information about the <span class="sectref"><a href="#section2">Concepts</a></span> of keyword indices, and
their parts, see the same-named section.
For information about the data structure which is used to encode
keyword indices as values see the section
<span class="sectref"><a href="#section4">Keyword index serialization format</a></span>.
This is the only format directly known to this class. Conversions from
and to any other format are handled by export and import manager
objects. These may be attached to a container, but do not have to be,
it is merely a convenience.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Concepts</a></h2>
<ol class="enumerated">
<li><p>A <i class="term"><a href="../../../../index.html#key165">keyword index</a></i> consists of a (possibly empty) set of <i class="term"><a href="../../../../index.html#key718">keywords</a></i>.</p></li>
<li><p>Each keyword in the set is identified by its name.</p></li>
<li><p>Each keyword has a (possibly empty) set of <i class="term">references</i>.</p></li>
<li><p>A reference can be associated with more than one keyword.</p></li>
<li><p>A reference not associated with at least one keyword is not possible
however.</p></li>
<li><p>Each reference is identified by its target, specified as either an url
or symbolic filename, depending on the type of reference (<b class="const">url</b>,
or <b class="const">manpage</b>).</p></li>
<li><p>The type of a reference (url, or manpage) depends only on the
reference itself, and not the keywords it is associated with.</p></li>
<li><p>In addition to a type each reference has a descriptive label as
well. This label depends only on the reference itself, and not the
keywords it is associated with.</p></li>
</ol>
<p>A few notes</p>
<ol class="enumerated">
<li><p>Manpage references are intended to be used for references to the
documents the index is made for. Their target is a symbolic file name
identifying the document, and export plugins may replace symbolic with
actual file names, if specified.</p></li>
<li><p>Url references are intended on the othre hand are inteded to be used
for links to anything else, like websites. Their target is an url.</p></li>
<li><p>While url and manpage references share a namespace for their
identifiers, this should be no problem, given that manpage identifiers
are symbolic filenames and as such they should never look like urls,
the identifiers for url references.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::idx</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new container object with an associated Tcl
command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is
explained in full detail in the sections <span class="sectref"><a href="#subsection2">Object command</a></span>
and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::doctools::idx</b> command have the
following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">key add</b> <i class="arg">name</i></a></dt>
<dd><p>This method adds the keyword <i class="arg">name</i> to the index. If the keyword
is already known nothing is done. The result of the method is the
empty string.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">key remove</b> <i class="arg">name</i></a></dt>
<dd><p>This method removes the keyword <i class="arg">name</i> from the index. If the
keyword is already gone nothing is done. Any references for whom this
keyword was the last association are removed as well.  The result of
the method is the empty string.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">key references</b> <i class="arg">name</i></a></dt>
<dd><p>This method returns a list containing the names of all references
associated with the keyword <i class="arg">name</i>. An error is thrown in the
keyword is not known to the index. The order of the references in the
list is undefined.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">keys</b></a></dt>
<dd><p>This method returns a list containing the names of all keywords known
to the index. The order of the keywords in the list is undefined.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">reference add</b> <i class="arg">type</i> <i class="arg">key</i> <i class="arg">name</i> <i class="arg">label</i></a></dt>
<dd><p>This method adds the reference <i class="arg">name</i> to the index and associates
it with the keyword <i class="arg">key</i>.
The other two arguments hold the <i class="arg">type</i> and <i class="arg">label</i> of the
reference, respectively.
The type has to match the stored information, should the reference
exist already, i.e. this information is immutable after the reference
is known. The only way to change it is delete and recreate the
reference.
The label on the other hand is automatically updated to the value of
the argument, overwriting any previously stored information.
Should the reference exists already it is simply associated with the
<i class="arg">key</i>.  If that is true already as well nothing is done, but the
<i class="arg">label</i> updated to the new value.  The result of the method is the
empty string.</p>
<p>The <i class="arg">type</i> argument has be to one of <b class="const">manpage</b> or <b class="const">url</b>.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">reference remove</b> <i class="arg">name</i></a></dt>
<dd><p>The reference <i class="arg">name</i> is removed from the index. All associations
with keywords are released and the relevant reference labels removed.
The result of the method is the empty string.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">reference label</b> <i class="arg">name</i></a></dt>
<dd><p>This method returns the label associated with the reference
<i class="arg">name</i>. An error is thrown if the reference is not known.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">reference keys</b> <i class="arg">name</i></a></dt>
<dd><p>This method returns a list containing the names of all keywords
associated with the reference <i class="arg">name</i>. An error is thrown in the
reference is not known to the index. The order of the keywords in the
list is undefined.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">reference type</b> <i class="arg">name</i></a></dt>
<dd><p>This method returns the type of the reference <i class="arg">name</i>. An error is
thrown in the reference is not known to the index.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">references</b></a></dt>
<dd><p>This method returns a list containing the names of all references
known to the index. The order of the references in the list is
undefined.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">title</b></a></dt>
<dd><p>Returns the currently defined title of the keyword index.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">title</b> <i class="arg">text</i></a></dt>
<dd><p>Sets the title of the keyword index to <i class="arg">text</i>, and returns it as
the result of the command.</p></dd>
<dt><a name="16"><i class="arg">objectName</i> <b class="method">label</b></a></dt>
<dd><p>Returns the currently defined label of the keyword index.</p></dd>
<dt><a name="17"><i class="arg">objectName</i> <b class="method">label</b> <i class="arg">text</i></a></dt>
<dd><p>Sets the label of the keyword index to <i class="arg">text</i>, and returns it as
the result of the command.</p></dd>
<dt><a name="18"><i class="arg">objectName</i> <b class="method">importer</b></a></dt>
<dd><p>Returns the import manager object currently attached to the container,
if any.</p></dd>
<dt><a name="19"><i class="arg">objectName</i> <b class="method">importer</b> <i class="arg">object</i></a></dt>
<dd><p>Attaches the <i class="arg">object</i> as import manager to the container, and
returns it as the result of the command.
Note that the <i class="arg">object</i> is <em>not</em> put into ownership of the
container. I.e., destruction of the container will <em>not</em> destroy
the <i class="arg">object</i>.</p>
<p>It is expected that <i class="arg">object</i> provides a method named
<b class="method">import text</b> which takes a text and a format name, and
returns the canonical serialization of the keyword index contained in
the text, assuming the given format.</p></dd>
<dt><a name="20"><i class="arg">objectName</i> <b class="method">exporter</b></a></dt>
<dd><p>Returns the export manager object currently attached to the container,
if any.</p></dd>
<dt><a name="21"><i class="arg">objectName</i> <b class="method">exporter</b> <i class="arg">object</i></a></dt>
<dd><p>Attaches the <i class="arg">object</i> as export manager to the container, and
returns it as the result of the command.
Note that the <i class="arg">object</i> is <em>not</em> put into ownership of the
container. I.e., destruction of the container will <em>not</em> destroy
the <i class="arg">object</i>.</p>
<p>It is expected that <i class="arg">object</i> provides a method named
<b class="method">export object</b> which takes the container and a format name,
and returns a text encoding keyword index stored in the container, in
the given format. It is further expected that the <i class="arg">object</i> will
use the container's method <b class="method">serialize</b> to obtain the
serialization of the keyword index from which to generate the text.</p></dd>
<dt><a name="22"><i class="arg">objectName</i> <b class="method">deserialize =</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method replaces the contents of the index object with the index
contained in the <i class="arg">data</i>. If no <i class="arg">format</i> was specified it is
assumed to be the regular serialization of a keyword index.</p>
<p>Otherwise the object will use the attached import manager to convert
the data from the specified format to a serialization it can handle.
In that case an error will be thrown if the container has no import
manager attached to it.</p>
<p>The result of the method is the empty string.</p></dd>
<dt><a name="23"><i class="arg">objectName</i> <b class="method">deserialize +=</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method behaves like <b class="method">deserialize =</b> in its essentials,
except that it merges the keyword index in the <i class="arg">data</i> to its
contents instead of replacing it. 
The method will throw an error if merging is not possible, i.e. would
produce an invalid index. The existing content is left unchanged in
that case.</p>
<p>The result of the method is the empty string.</p></dd>
<dt><a name="24"><i class="arg">objectName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method returns the keyword index contained in the object. If no
<i class="arg">format</i> is not specified the returned result is the canonical
serialization of its contents.</p>
<p>Otherwise the object will use the attached export manager to convert
the data to the specified format.
In that case an error will be thrown if the container has no export
manager attached to it.</p></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key4">TMML</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key329">docidx markup</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key536">generation</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key172">json</a>, <a href="../../../../index.html#key165">keyword index</a>, <a href="../../../../index.html#key167">latex</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key537">reference</a>, <a href="../../../../index.html#key535">tcler's wiki</a>, <a href="../../../../index.html#key454">text</a>, <a href="../../../../index.html#key483">url</a>, <a href="../../../../index.html#key164">wiki</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/export.html.












































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::export - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/export.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::export.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::export(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::export - Exporting keyword indices</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Concepts</a></li>
<li class="section"><a href="#section3">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Export plugin API v2 reference</a></li>
<li class="section"><a href="#section5">Keyword index serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::idx::export <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::config</b></li>
<li>package require <b class="pkgname">doctools::idx::structure</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">pluginmgr</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::idx::export</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">export serial</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">export object</b> <i class="arg">object</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">config names</b></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">config get</b></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">config set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">config unset</b> <i class="arg">pattern</i>...</a></li>
<li><a href="#10"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class to manage the plugins for the export of
keyword indices to other formats, i.e. their conversion to, for
example <i class="term"><a href="../../../../index.html#key50">docidx</a></i>, <i class="term"><a href="../../../../index.html#key1">HTML</a></i>, etc.</p>
<p>This is one of the three public pillars the management of keyword
indices resides on. The other two pillars are</p>
<ol class="enumerated">
<li><p><i class="term"><a href="import.html">Importing keyword indices</a></i>, and</p></li>
<li><p><i class="term"><a href="container.html">Holding keyword indices</a></i></p></li>
</ol>
<p>For information about the <span class="sectref"><a href="#section2">Concepts</a></span> of keyword indices, and
their parts, see the same-named section.
For information about the data structure which is the major input to
the manager objects provided by this package see the section
<span class="sectref"><a href="#section5">Keyword index serialization format</a></span>.</p>
<p>The plugin system of our class is based on the package
<b class="package"><a href="../pluginmgr/pluginmgr.html">pluginmgr</a></b>, and configured to look for plugins using</p>
<ol class="enumerated">
<li><p>the environment variable <b class="variable">DOCTOOLS_IDX_EXPORT_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">DOCTOOLS_IDX_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">DOCTOOLS_PLUGINS</b>,</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/idx/export/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/idx/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/idx/export/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/idx/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/plugins</b>&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\IDX\EXPORT\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\IDX\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\PLUGINS&quot;</p></li>
</ol>
<p>The last three are used only when the package is run on a machine
using Windows(tm) operating system.</p>
<p>The whole system is delivered with six predefined export plugins,
namely</p>
<dl class="definitions">
<dt>docidx</dt>
<dd><p>See <i class="term"><a href="export_docidx.html">docidx export plugin</a></i> for details.</p></dd>
<dt>html</dt>
<dd><p>See <i class="term">html export plugin</i> for details.</p></dd>
<dt>json</dt>
<dd><p>See <i class="term">json export plugin</i> for details.</p></dd>
<dt>nroff</dt>
<dd><p>See <i class="term"><a href="../doctools2toc/export_nroff.html">nroff export plugin</a></i> for details.</p></dd>
<dt>text</dt>
<dd><p>See <i class="term">text export plugin</i> for details.</p></dd>
<dt>wiki</dt>
<dd><p>See <i class="term"><a href="export_wiki.html">wiki export plugin</a></i> for details.</p></dd>
</dl>
<p>Readers wishing to write their own export plugin for some format, i.e.
<i class="term">plugin writer</i>s reading and understanding the section
containing the <span class="sectref"><a href="#section4">Export plugin API v2 reference</a></span> is an
absolute necessity, as it specifies the interaction between this
package and its plugins in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Concepts</a></h2>
<ol class="enumerated">
<li><p>A <i class="term"><a href="../../../../index.html#key165">keyword index</a></i> consists of a (possibly empty) set of <i class="term"><a href="../../../../index.html#key718">keywords</a></i>.</p></li>
<li><p>Each keyword in the set is identified by its name.</p></li>
<li><p>Each keyword has a (possibly empty) set of <i class="term">references</i>.</p></li>
<li><p>A reference can be associated with more than one keyword.</p></li>
<li><p>A reference not associated with at least one keyword is not possible
however.</p></li>
<li><p>Each reference is identified by its target, specified as either an url
or symbolic filename, depending on the type of reference (<b class="const">url</b>,
or <b class="const">manpage</b>).</p></li>
<li><p>The type of a reference (url, or manpage) depends only on the
reference itself, and not the keywords it is associated with.</p></li>
<li><p>In addition to a type each reference has a descriptive label as
well. This label depends only on the reference itself, and not the
keywords it is associated with.</p></li>
</ol>
<p>A few notes</p>
<ol class="enumerated">
<li><p>Manpage references are intended to be used for references to the
documents the index is made for. Their target is a symbolic file name
identifying the document, and export plugins may replace symbolic with
actual file names, if specified.</p></li>
<li><p>Url references are intended on the othre hand are inteded to be used
for links to anything else, like websites. Their target is an url.</p></li>
<li><p>While url and manpage references share a namespace for their
identifiers, this should be no problem, given that manpage identifiers
are symbolic filenames and as such they should never look like urls,
the identifiers for url references.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::idx::export</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new export manager object with an associated
Tcl command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command
is explained in full detail in the sections <span class="sectref"><a href="#subsection2">Object command</a></span>
and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::doctools::idx::export</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">export serial</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method takes the canonical serialization of a keyword index
stored in <i class="arg">serial</i> and converts it to the specified <i class="arg">format</i>,
using the export plugin for the format. An error is thrown if no
plugin could be found for the format.
The string generated by the conversion process is returned as
the result of this method.</p>
<p>If no format is specified the method defaults to <b class="const">docidx</b>.</p>
<p>The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section5">Keyword index serialization format</a></span>.</p>
<p>The plugin has to conform to the interface specified in section
<span class="sectref"><a href="#section4">Export plugin API v2 reference</a></span>.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">export object</b> <i class="arg">object</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">export serial</b>
method described by the previous item.
It expects that <i class="arg">object</i> is an object command supporting a
<b class="method">serialize</b> method returning the canonical serialization of a
keyword index. It invokes that method, feeds the result into
<b class="method">export serial</b> and returns the resulting string as its own
result.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">config names</b></a></dt>
<dd><p>This method returns a list containing the names of all configuration
variables currently known to the object.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">config get</b></a></dt>
<dd><p>This method returns a dictionary containing the names and values of
all configuration variables currently known to the object.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">config set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>This method sets the configuration variable <i class="arg">name</i> to the
specified <i class="arg">value</i> and returns the new value of the variable.</p>
<p>If no value is specified it simply returns the current value, without
changing it.</p>
<p>Note that while the user can set the predefined configuration
variables <b class="const">user</b> and <b class="const">format</b> doing so will have no
effect, these values will be internally overriden when invoking an
import plugin.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">config unset</b> <i class="arg">pattern</i>...</a></dt>
<dd><p>This method unsets all configuration variables matching the specified
glob <i class="arg">pattern</i>s. If no pattern is specified it will unset all
currently defined configuration variables.</p></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Export plugin API v2 reference</a></h2>
<p>Plugins are what this package uses to manage the support for any
output format beyond the
<span class="sectref"><a href="#section5">Keyword index serialization format</a></span>. Here we specify the
API the objects created by this package use to interact with their
plugins.</p>
<p>A plugin for this package has to follow the rules listed below:</p>
<ol class="enumerated">
<li><p>A plugin is a package.</p></li>
<li><p>The name of a plugin package has the form
		doctools::idx::export::<b class="variable">FOO</b>,
       where <b class="variable">FOO</b> is the name of the format the plugin will
       generate output for. This name is also the argument to provide
       to the various <b class="method">export</b> methods of export manager
       objects to get a string encoding a keyword index in that
       format.</p></li>
<li><p>The plugin can expect that the package
       <b class="package">doctools::idx::export::plugin</b> is present, as
       indicator that it was invoked from a genuine plugin manager.</p></li>
<li><p>A plugin has to provide one command, with the signature shown
       below.</p>
<dl class="definitions">
<dt><a name="10"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>Whenever an export manager of <b class="package"><a href="container.html">doctools::idx</a></b> has to generate
output for an index it will invoke this command.</p>
<dl class="arguments">
<dt>string <i class="arg">serial</i></dt>
<dd><p>This argument will contain the <i class="term">canonical</i> serialization of the
index for which to generate the output.
The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section5">Keyword index serialization format</a></span>.</p></dd>
<dt>dictionary <i class="arg">configuration</i></dt>
<dd><p>This argument will contain the current configuration to apply to the
generation, as a dictionary mapping from variable names to values.</p>
<p>The following configuration variables have a predefined meaning all
plugins have to obey, although they can ignore this information at
their discretion. Any other other configuration variables recognized
by a plugin will be described in the manpage for that plugin.</p>
<dl class="definitions">
<dt>user</dt>
<dd><p>This variable is expected to contain the name of the user
           owning the process invoking the plugin.</p></dd>
<dt>format</dt>
<dd><p>This variable is expected to contain the name of the
             format whose plugin is invoked.</p></dd>
<dt>file</dt>
<dd><p>This variable, if defined by the user of the index object
           is expected to contain the name of the input file for which
           the plugin is generating its output for.</p></dd>
<dt>map</dt>
<dd><p>This variable, if defined by the user of the index object is
          expected to contain a dictionary mapping from symbolic file
          names used in the references of type <b class="const">manpage</b> to
          actual paths (or urls). A plugin has to be able to handle
          the possibility that a symbolic name is without entry in
          this mapping.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
<li><p>A single usage cycle of a plugin consists of the invokations of
       the command <b class="cmd"><a href="../../../../index.html#key148">export</a></b>. This call has to leave the plugin in
       a state where another usage cycle can be run without problems.</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key536">generation</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key172">json</a>, <a href="../../../../index.html#key165">keyword index</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key537">reference</a>, <a href="../../../../index.html#key535">tcler's wiki</a>, <a href="../../../../index.html#key454">text</a>, <a href="../../../../index.html#key483">url</a>, <a href="../../../../index.html#key164">wiki</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/export_docidx.html.














































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::export::docidx - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/export_docidx.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::export::docidx.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::export::docidx(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::export::docidx - docidx export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">[docidx] notation of keyword indices</a></li>
<li class="section"><a href="#section4">Configuration</a></li>
<li class="section"><a href="#section5">Keyword index serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::export::docidx <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools keyword index export plugin for
the generation of docidx markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially <b class="package"><a href="export.html">doctools::idx::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::idx::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
docidx export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a keyword index, as
specified in section <span class="sectref"><a href="#section5">Keyword index serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates docidx markup encoding the index.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">[docidx] notation of keyword indices</a></h2>
<p>The docidx format for keyword indices, also called the
<i class="term">docidx markup language</i>, is too large to be covered in single
section.
The interested reader should start with the document</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/docidx_lang_intro.html">docidx language introduction</a></i></p></li>
</ol>
<p>and then proceed from there to the formal specifications, i.e. the
documents</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/docidx_lang_syntax.html">docidx language syntax</a></i> and</p></li>
<li><p><i class="term"><a href="../doctools/docidx_lang_cmdref.html">docidx language command reference</a></i>.</p></li>
</ol>
<p>to get a thorough understanding of the language.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Configuration</a></h2>
<p>The docidx export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>string <i class="arg">user</i></dt>
<dd><p>This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.</p></dd>
<dt>string <i class="arg">file</i></dt>
<dd><p>This standard configuration variable contains the name of the file the
index came from. This variable may not be set or contain the empty
string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.</p></dd>
<dt>boolean <i class="arg">newlines</i></dt>
<dd><p>If this flag is set the plugin will break the generated docidx code
across lines, with each markup command on a separate line.</p>
<p>If this flag is not set (the default), the whole document will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt>boolean <i class="arg">indented</i></dt>
<dd><p>If this flag is set the plugin will indent the markup commands
according to the structure of indices. To make this work this also
implies that <b class="variable">newlines</b> is set. This effect is independent of the
value for <b class="variable">aligned</b> however.</p>
<p>If this flag is not set (the default), the output is formatted as per
the values of <b class="variable">newlines</b> and <b class="variable">aligned</b>, and no indenting is
done.</p></dd>
<dt>boolean <i class="arg">aligned</i></dt>
<dd><p>If this flag is set the generator ensures that the arguments for the
<b class="cmd"><a href="../../../../index.html#key2">manpage</a></b> and <b class="cmd"><a href="../../../../index.html#key483">url</a></b> commands in a keyword section are aligned
vertically for a nice table effect. To make this work this also
implies that <b class="variable">newlines</b> is set. This effect is independent of the
value for <b class="variable">indented</b> however.</p>
<p>If this flag is not set (the default), the output is formatted as per
the values of <b class="variable">newlines</b> and <b class="variable">indented</b>, and no alignment is
done.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">format</b>, and <b class="variable">map</b>, and their values.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key102">serialization</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/export_html.html.












































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::export::html - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/export_html.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::export::html.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::export::html(n) 0.2 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::export::html - HTML export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">Keyword index serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::export::html <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">doctools::text</b></li>
<li>package require <b class="pkgname">doctools::html</b></li>
<li>package require <b class="pkgname">doctools::html::cssdefaults</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools keyword index export plugin for
the generation of HTML markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially <b class="package"><a href="export.html">doctools::idx::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::idx::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
docidx export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a keyword index, as
specified in section <span class="sectref"><a href="#section4">Keyword index serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates HTML markup encoding the index.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The html export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>string <i class="arg">user</i></dt>
<dd><p>This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.</p></dd>
<dt>string <i class="arg">file</i></dt>
<dd><p>This standard configuration variable contains the name of the file the
index came from. This variable may not be set or contain the empty
string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.</p></dd>
<dt>dictionary <i class="arg">map</i></dt>
<dd><p>This standard configuration variable contains a dictionary mapping
from the symbolic files names in manpage references to the actual
filenames and/or urls to be used in the output.</p>
<p>Url references and symbolic file names without a mapping are used
unchanged.</p></dd>
<dt>boolean <i class="arg">newlines</i></dt>
<dd><p>If this flag is set the plugin will break the generated html code
across lines, with each markup command on a separate line.</p>
<p>If this flag is not set (the default), the whole document will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt>boolean <i class="arg">indented</i></dt>
<dd><p>If this flag is set the plugin will indent the markup commands
according to the structure of indices. To make this work this also
implies that <b class="variable">newlines</b> is set.</p>
<p>If this flag is not set (the default), the output is formatted as per
the value of <b class="variable">newlines</b>, and no indenting is done.</p></dd>
<dt>string <i class="arg">meta</i></dt>
<dd><p>This variable is meant to hold a fragment of HTML (default: empty).
The fragment it contains will be inserted into the generated output in
the &lt;head&gt; section of the document, just after the &lt;title&gt; tag.</p></dd>
<dt>string <i class="arg">header</i></dt>
<dd><p>This variable is meant to hold a fragment of HTML (default: empty).
The fragment it contains will be inserted into the generated output
just after the &lt;h1&gt; title tag in the body of the document, in the
class.header &lt;div&gt;'ision.</p></dd>
<dt>string <i class="arg">footer</i></dt>
<dd><p>This variable is meant to hold a fragment of HTML (default:
empty). The fragment it contains will be inserted into the generated
output just before the &lt;/body&gt; tag, in the class.footer &lt;div&gt;'ision.</p></dd>
<dt>dictionary <i class="arg">kwid</i></dt>
<dd><p>The value of this variable (default: empty) maps keywords to the
identifiers to use as their anchor names. Each keyword <b class="variable">FOO</b> not
found in the dictionary uses <b class="const">KW-</b><b class="variable">FOO</b> as anchor,
i.e. itself prefixed with the string <b class="const">KW-</b>.</p></dd>
<dt>string <i class="arg">sepline</i></dt>
<dd><p>The value of this variable is the string to use for the separator
comments inserted into the output when the outpout is broken across
lines and/or indented. The default string consists of 60 dashes.</p></dd>
<dt>integer <i class="arg">kwidth</i></dt>
<dd><p>This variable holds the size of the keyword column in the main table
generated by the plugin, in percent of the total width of the
table. This is an integer number in the range of 1 to 99. Choosing a
value outside of that range causes the generator to switch back to the
defauly setting, 35 percent.</p></dd>
<dt>string <i class="arg">dot</i></dt>
<dd><p>This variable contains a HTML fragment inserted between the entries of
the navigation bar, and the references associated with each keyword.
The default is the HTML entity &amp;#183; i.e. the bullet character, also
known as the &quot;Greek middle dot&quot;, i.e. the unicode character 00B7.</p></dd>
<dt>string <i class="arg">class.main</i></dt>
<dd><p>This variable contains the class name for the main &lt;div&gt;'ivision of
the generated document. The default is <b class="const">doctools</b>.</p></dd>
<dt>string <i class="arg">class.header</i></dt>
<dd><p>This variable contains the class name for the header &lt;div&gt;'ision of
the generated document. The default is <b class="const">idx-header</b>.  This
division contains the document title, the user specified <b class="variable">header</b>,
if any, a visible separator line, and the navigation bar for quick
access to each keyword section.</p></dd>
<dt>string <i class="arg">class.title</i></dt>
<dd><p>This variable contains the class name for the &lt;h1&gt; tag enclosing the
document title. The default is <b class="const">idx-title</b>.</p></dd>
<dt>string <i class="arg">class.navsep</i></dt>
<dd><p>This variable contains the class name for the &lt;hr&gt; separators in the
header and footer sections of the generated document. The default is
<b class="const">idx-navsep</b>.</p></dd>
<dt>string <i class="arg">class.navbar</i></dt>
<dd><p>This variable contains the class name for the navigation &lt;div&gt;'ision
enclosing the navigation bar of the generated document. The default is
<b class="const">idx-kwnav</b>.</p></dd>
<dt>string <i class="arg">class.contents</i></dt>
<dd><p>This variable contains the class name for the &lt;table&gt; holding the
keywords and their references in the generated document. The default
is <b class="const">idx-contents</b>.</p></dd>
<dt>string <i class="arg">class.leader</i></dt>
<dd><p>This variable contains the class name for the anchor names the plugin
inserts into the keyword table when switching from one section to the
next (Each section holds all keywords with a particular first
character). The default is <b class="const">idx-leader</b>.</p></dd>
<dt>string <i class="arg">class.row0</i></dt>
<dd><p>This variable contains the class name used to label the even rows
(&lt;tr&gt;) of the keyword table. The default is <b class="const">idx-even</b>.</p></dd>
<dt>string <i class="arg">class.row1</i></dt>
<dd><p>This variable contains the class name used to label the odd rows
(&lt;tr&gt;) of the keyword table. The default is <b class="const">idx-odd</b>.</p></dd>
<dt>string <i class="arg">class.keyword</i></dt>
<dd><p>This variable contains the class name used to label the keyword
cells/column (&lt;td&gt;) in the keyword table of the document. The default
is <b class="const">idx-keyword</b>.</p></dd>
<dt>string <i class="arg">class.refs</i></dt>
<dd><p>This variable contains the class name used to label the reference
cells/column (&lt;td&gt;) in the keyword table of the document. The default
is <b class="const">idx-refs</b>.</p></dd>
<dt>string <i class="arg">class.footer</i></dt>
<dd><p>This variable contains the class name for the footer &lt;div&gt;'ision of
the generated document. The default is <b class="const">idx-footer</b>. This
division contains a browser-visible separator line and the user
specified <b class="variable">footer</b>, if any.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variable <b class="variable">format</b>, and its value.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key102">serialization</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/export_json.html.





























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::export::json - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/export_json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::export::json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::export::json(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::export::json - JSON export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">JSON notation of keyword indices</a></li>
<li class="section"><a href="#section4">Configuration</a></li>
<li class="section"><a href="#section5">Keyword index serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::export::json <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">textutil::adjust</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools keyword index export plugin for
the generation of JSON markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially <b class="package"><a href="export.html">doctools::idx::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::idx::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
docidx export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a keyword index, as
specified in section <span class="sectref"><a href="#section5">Keyword index serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates JSON markup encoding the index.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">JSON notation of keyword indices</a></h2>
<p>The JSON format used for keyword indices is a direct translation of
the <span class="sectref"><a href="#section5">Keyword index serialization format</a></span>, mapping Tcl
dictionaries as JSON objects and Tcl lists as JSON arrays.
For example, the Tcl serialization</p>
<pre class="example">
doctools::idx {
	label {Keyword Index}
	keywords {
		changelog  {changelog.man cvs.man}
		conversion {doctools.man docidx.man doctoc.man apps/dtplite.man mpexpand.man}
		cvs        cvs.man
	}
	references {
		apps/dtplite.man {manpage dtplite}
		changelog.man    {manpage doctools::changelog}
		cvs.man          {manpage doctools::cvs}
		docidx.man       {manpage doctools::idx}
		doctoc.man       {manpage doctools::toc}
		doctools.man     {manpage doctools}
		mpexpand.man     {manpage mpexpand}
	}
	title {}
}
</pre>
<p>is equivalent to the JSON string</p>
<pre class="example">
{
    &quot;doctools::idx&quot; : {
        &quot;label&quot;      : &quot;Keyword Index&quot;,
        &quot;keywords&quot;   : {
            &quot;changelog&quot;  : [&quot;changelog.man&quot;,&quot;cvs.man&quot;],
            &quot;conversion&quot; : [&quot;doctools.man&quot;,&quot;docidx.man&quot;,&quot;doctoc.man&quot;,&quot;apps\/dtplite.man&quot;,&quot;mpexpand.man&quot;],
            &quot;cvs&quot;        : [&quot;cvs.man&quot;],
        },
        &quot;references&quot; : {
            &quot;apps\/dtplite.man&quot; : [&quot;manpage&quot;,&quot;dtplite&quot;],
            &quot;changelog.man&quot;     : [&quot;manpage&quot;,&quot;doctools::changelog&quot;],
            &quot;cvs.man&quot;           : [&quot;manpage&quot;,&quot;doctools::cvs&quot;],
            &quot;docidx.man&quot;        : [&quot;manpage&quot;,&quot;doctools::idx&quot;],
            &quot;doctoc.man&quot;        : [&quot;manpage&quot;,&quot;doctools::toc&quot;],
            &quot;doctools.man&quot;      : [&quot;manpage&quot;,&quot;doctools&quot;],
            &quot;mpexpand.man&quot;      : [&quot;manpage&quot;,&quot;mpexpand&quot;]
        },
        &quot;title&quot;      : &quot;&quot;
    }
}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Configuration</a></h2>
<p>The JSON export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>boolean <i class="arg">indented</i></dt>
<dd><p>If this flag is set the plugin will break the generated JSON code
across lines and indent it according to its inner structure, with each
key of a dictionary on a separate line.</p>
<p>If this flag is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt>boolean <i class="arg">aligned</i></dt>
<dd><p>If this flag is set the generator ensures that the values for the keys
in a dictionary are vertically aligned with each other, for a nice
table effect. To make this work this also implies that <b class="variable">indented</b>
is set.</p>
<p>If this flag is not set (the default), the output is formatted as per
the value of <b class="variable">indented</b>, without trying to align the values for
dictionary keys.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">user</b>, <b class="variable">format</b>, <b class="variable">file</b>, and <b class="variable">map</b> and
their values.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key232">JSON</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key102">serialization</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/export_nroff.html.















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::export::nroff - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/export_nroff.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::export::nroff.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::export::nroff(n) 0.3 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::export::nroff - nroff export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">Keyword index serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::export::nroff <span class="opt">?0.3?</span></b></li>
<li>package require <b class="pkgname">doctools::text</b></li>
<li>package require <b class="pkgname">doctools::nroff::man_macros</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools keyword index export plugin for
the generation of nroff markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially <b class="package"><a href="export.html">doctools::idx::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::idx::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
docidx export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a keyword index, as
specified in section <span class="sectref"><a href="#section4">Keyword index serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates nroff markup encoding the index.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The nroff export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>string <i class="arg">user</i></dt>
<dd><p>This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.</p></dd>
<dt>string <i class="arg">file</i></dt>
<dd><p>This standard configuration variable contains the name of the file the
index came from. This variable may not be set or contain the empty
string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.</p></dd>
<dt>boolean <i class="arg">inline</i></dt>
<dd><p>If this flag is set (default) the plugin will place the definitions of
the man macro set directly into the output.</p>
<p>If this flag is not set, the plugin will place a reference to the
definitions of the man macro set into the output, but not the macro
definitions themselves.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">format</b>, and <b class="variable">map</b>, and their values.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key102">serialization</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/export_text.html.


































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::export::text - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/export_text.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::export::text.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::export::text(n) 0.2 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::export::text - plain text export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">Keyword index serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::export::text <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">doctools::text</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools keyword index export plugin for
the generation of plain text markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially <b class="package"><a href="export.html">doctools::idx::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::idx::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
docidx export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a keyword index, as
specified in section <span class="sectref"><a href="#section4">Keyword index serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates plain text markup encoding the index.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The text export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>dictionary <i class="arg">map</i></dt>
<dd><p>This standard configuration variable contains a dictionary mapping
from the symbolic files names in manpage references to the actual
filenames and/or urls to be used in the output.</p>
<p>Url references and symbolic file names without a mapping are used
unchanged.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">user</b>, <b class="variable">file</b>, and <b class="variable">format</b>, and their values.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key147">plain text</a>, <a href="../../../../index.html#key102">serialization</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/export_wiki.html.















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::export::wiki - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/export_wiki.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::export::wiki.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::export::wiki(n) 0.2 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::export::wiki - wiki export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Wiki markup</a></li>
<li class="section"><a href="#section4">Configuration</a></li>
<li class="section"><a href="#section5">Keyword index serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::export::wiki <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">doctools::text</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools keyword index export plugin for
the generation of wiki markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially <b class="package"><a href="export.html">doctools::idx::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::idx::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
docidx export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a keyword index, as
specified in section <span class="sectref"><a href="#section5">Keyword index serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates wiki markup encoding the index.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Wiki markup</a></h2>
<p>The basic syntax of the wiki markup generated by this plugin are
described at <a href="http://wiki.tcl.tk/14">http://wiki.tcl.tk/14</a>.</p>
<p>The plugin goes beyond the classic markup to generate proper headers
and either a table or indented list of the keywords and their
references.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Configuration</a></h2>
<p>The wiki export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>dictionary <i class="arg">map</i></dt>
<dd><p>This standard configuration variable contains a dictionary mapping
from the symbolic files names in manpage references to the actual
filenames and/or urls to be used in the output.</p>
<p>Url references and symbolic file names without a mapping are used
unchanged.</p></dd>
<dt>enum <i class="arg">style</i></dt>
<dd><p>This variable recognizes two values as legal, <b class="const">list</b> (default),
and <b class="const">table</b>.
Depending on the value the plugin generates either a list- or
table-based wiki page for the index.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">user</b>, <b class="variable">file</b> and <b class="variable">format</b>, and their values.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key164">wiki</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/import.html.







































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::import - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/import.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::import.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::import(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::import - Importing keyword indices</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Concepts</a></li>
<li class="section"><a href="#section3">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Import plugin API v2 reference</a></li>
<li class="section"><a href="#section5">Keyword index serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::idx::import <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::config</b></li>
<li>package require <b class="pkgname">doctools::idx::structure</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">pluginmgr</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::idx::import</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">import text</b> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">import file</b> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">import object text</b> <i class="arg">object</i> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">import object file</b> <i class="arg">object</i> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">config names</b></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">config get</b></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">config set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">config unset</b> <i class="arg">pattern</i>...</a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">includes</b></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">include add</b> <i class="arg">path</i></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">include remove</b> <i class="arg">path</i></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">include clear</b></a></li>
<li><a href="#16"><b class="cmd">IncludeFile</b> <i class="arg">currentfile</i> <i class="arg">path</i></a></li>
<li><a href="#17"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">text</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class to manage the plugins for the import of
keyword indices from other formats, i.e. their conversion from, for
example <i class="term"><a href="../../../../index.html#key50">docidx</a></i>, <i class="term"><a href="../../../../index.html#key172">json</a></i>, etc.</p>
<p>This is one of the three public pillars the management of keyword
indices resides on. The other two pillars are</p>
<ol class="enumerated">
<li><p><i class="term"><a href="export.html">Exporting keyword indices</a></i>, and</p></li>
<li><p><i class="term"><a href="container.html">Holding keyword indices</a></i></p></li>
</ol>
<p>For information about the <span class="sectref"><a href="#section2">Concepts</a></span> of keyword indices, and
their parts, see the same-named section.
For information about the data structure which is the major output of
the manager objects provided by this package see the section
<span class="sectref"><a href="#section5">Keyword index serialization format</a></span>.</p>
<p>The plugin system of our class is based on the package
<b class="package"><a href="../pluginmgr/pluginmgr.html">pluginmgr</a></b>, and configured to look for plugins using</p>
<ol class="enumerated">
<li><p>the environment variable <b class="variable">DOCTOOLS_IDX_IMPORT_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">DOCTOOLS_IDX_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">DOCTOOLS_PLUGINS</b>,</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/idx/import/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/idx/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/idx/import/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/idx/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/plugins</b>&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\IDX\IMPORT\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\IDX\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\PLUGINS&quot;</p></li>
</ol>
<p>The last three are used only when the package is run on a machine
using Windows(tm) operating system.</p>
<p>The whole system is delivered with two predefined import plugins,
namely</p>
<dl class="definitions">
<dt>docidx</dt>
<dd><p>See <i class="term"><a href="import_docidx.html">docidx import plugin</a></i> for details.</p></dd>
<dt>json</dt>
<dd><p>See <i class="term">json import plugin</i> for details.</p></dd>
</dl>
<p>Readers wishing to write their own import plugin for some format, i.e.
<i class="term">plugin writer</i>s reading and understanding the section
containing the <span class="sectref"><a href="#section4">Import plugin API v2 reference</a></span> is an
absolute necessity, as it specifies the interaction between this
package and its plugins in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Concepts</a></h2>
<ol class="enumerated">
<li><p>A <i class="term"><a href="../../../../index.html#key165">keyword index</a></i> consists of a (possibly empty) set of <i class="term"><a href="../../../../index.html#key718">keywords</a></i>.</p></li>
<li><p>Each keyword in the set is identified by its name.</p></li>
<li><p>Each keyword has a (possibly empty) set of <i class="term">references</i>.</p></li>
<li><p>A reference can be associated with more than one keyword.</p></li>
<li><p>A reference not associated with at least one keyword is not possible
however.</p></li>
<li><p>Each reference is identified by its target, specified as either an url
or symbolic filename, depending on the type of reference (<b class="const">url</b>,
or <b class="const">manpage</b>).</p></li>
<li><p>The type of a reference (url, or manpage) depends only on the
reference itself, and not the keywords it is associated with.</p></li>
<li><p>In addition to a type each reference has a descriptive label as
well. This label depends only on the reference itself, and not the
keywords it is associated with.</p></li>
</ol>
<p>A few notes</p>
<ol class="enumerated">
<li><p>Manpage references are intended to be used for references to the
documents the index is made for. Their target is a symbolic file name
identifying the document, and export plugins may replace symbolic with
actual file names, if specified.</p></li>
<li><p>Url references are intended on the othre hand are inteded to be used
for links to anything else, like websites. Their target is an url.</p></li>
<li><p>While url and manpage references share a namespace for their
identifiers, this should be no problem, given that manpage identifiers
are symbolic filenames and as such they should never look like urls,
the identifiers for url references.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::idx::import</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new import manager object with an associated
Tcl command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command
is explained in full detail in the sections <span class="sectref"><a href="#subsection2">Object command</a></span>
and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::doctools::idx::import</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">import text</b> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method takes the <i class="arg">text</i> and converts it from the specified
<i class="arg">format</i> to the canonical serialization of a keyword index using
the import plugin for the format. An error is thrown if no plugin
could be found for the format.
The serialization generated by the conversion process is returned as
the result of this method.</p>
<p>If no format is specified the method defaults to <b class="const">docidx</b>.</p>
<p>The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section5">Keyword index serialization format</a></span>.</p>
<p>The plugin has to conform to the interface specified in section
<span class="sectref"><a href="#section4">Import plugin API v2 reference</a></span>.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">import file</b> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">import text</b>
method described by the previous item.
It reads the contents of the specified file into memory, feeds the
result into <b class="method">import text</b> and returns the resulting
serialization as its own result.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">import object text</b> <i class="arg">object</i> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">import text</b>
method described by the previous item.
It expects that <i class="arg">object</i> is an object command supporting a
<b class="method">deserialize</b> method expecting the canonical serialization of a
keyword index.
It imports the text using <b class="method">import text</b> and then feeds the
resulting serialization into the <i class="arg">object</i> via <b class="method">deserialize</b>.
This method returns the empty string as it result.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">import object file</b> <i class="arg">object</i> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method behaves like <b class="method">import object text</b>, except that it
reads the text to convert from the specified file instead of being
given it as argument.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">config names</b></a></dt>
<dd><p>This method returns a list containing the names of all configuration
variables currently known to the object.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">config get</b></a></dt>
<dd><p>This method returns a dictionary containing the names and values of
all configuration variables currently known to the object.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">config set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>This method sets the configuration variable <i class="arg">name</i> to the
specified <i class="arg">value</i> and returns the new value of the variable.</p>
<p>If no value is specified it simply returns the current value, without
changing it.</p>
<p>Note that while the user can set the predefined configuration
variables <b class="const">user</b> and <b class="const">format</b> doing so will have no
effect, these values will be internally overriden when invoking an
import plugin.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">config unset</b> <i class="arg">pattern</i>...</a></dt>
<dd><p>This method unsets all configuration variables matching the specified
glob <i class="arg">pattern</i>s. If no pattern is specified it will unset all
currently defined configuration variables.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">includes</b></a></dt>
<dd><p>This method returns a list containing the currently specified paths to
use to search for include files when processing input.
The order of paths in the list corresponds to the order in which they
are used, from first to last, and also corresponds to the order in
which they were added to the object.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">include add</b> <i class="arg">path</i></a></dt>
<dd><p>This methods adds the specified <i class="arg">path</i> to the list of paths to use
to search for include files when processing input. The path is added
to the end of the list, causing it to be searched after all previously
added paths. The result of the command is the empty string.</p>
<p>The method does nothing if the path is already known.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">include remove</b> <i class="arg">path</i></a></dt>
<dd><p>This methods removes the specified <i class="arg">path</i> from the list of paths
to use to search for include files when processing input. The result
of the command is the empty string.</p>
<p>The method does nothing if the path is not known.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">include clear</b></a></dt>
<dd><p>This method clears the list of paths to use to search for include
files when processing input. The result of the command is the empty
string.</p></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Import plugin API v2 reference</a></h2>
<p>Plugins are what this package uses to manage the support for any input
format beyond the <span class="sectref"><a href="#section5">Keyword index serialization format</a></span>. Here
we specify the API the objects created by this package use to interact
with their plugins.</p>
<p>A plugin for this package has to follow the rules listed below:</p>
<ol class="enumerated">
<li><p>A plugin is a package.</p></li>
<li><p>The name of a plugin package has the form
		doctools::idx::import::<b class="variable">FOO</b>,
       where <b class="variable">FOO</b> is the name of the format the plugin will
       generate output for. This name is also the argument to provide
       to the various <b class="method">import</b> methods of import manager
       objects to get a string encoding a keyword index in that
       format.</p></li>
<li><p>The plugin can expect that the package
       <b class="package">doctools::idx::export::plugin</b> is present, as
       indicator that it was invoked from a genuine plugin manager.</p></li>
<li><p>The plugin can expect that a command named <b class="cmd">IncludeFile</b> is
       present, with the signature</p>
<dl class="definitions">
<dt><a name="16"><b class="cmd">IncludeFile</b> <i class="arg">currentfile</i> <i class="arg">path</i></a></dt>
<dd><p>This command has to be invoked by the plugin when it has to process an
included file, if the format has the concept of such. An example of
such a format would be <i class="term"><a href="../../../../index.html#key50">docidx</a></i>.</p>
<p>The plugin has to supply the following arguments</p>
<dl class="arguments">
<dt>string <i class="arg">currentfile</i></dt>
<dd><p>The path of the file it is currently processing. This may be the empty
string if no such is known.</p></dd>
<dt>string <i class="arg">path</i></dt>
<dd><p>The path of the include file as specified in the include directive
being processed.</p></dd>
</dl>
<p>The result of the command will be a 5-element list containing</p>
<ol class="enumerated">
<li><p>A boolean flag indicating the success (<b class="const">True</b>) or failure
       (<b class="const">False</b>) of the operation.</p></li>
<li><p>In case of success the contents of the included file, and the
       empty string otherwise.</p></li>
<li><p>The resolved, i.e. absolute path of the included file, if
       possible, or the unchanged <i class="arg">path</i> argument. This is for
       display in an error message, or as the <i class="arg">currentfile</i>
       argument of another call to <b class="cmd">IncludeFile</b> should this file
       contain more files.</p></li>
<li><p>In case of success an empty string, and for failure a code
       indicating the reason for it, one of</p>
<dl class="definitions">
<dt>notfound</dt>
<dd><p>The specified file could not be found.</p></dd>
<dt>notread</dt>
<dd><p>The specified file was found, but not be read into memory.</p></dd>
</dl>
</li>
<li><p>An empty string in case of success of a <b class="const">notfound</b>
       failure, and an additional error message describing the reason
       for a <b class="const">notread</b> error in more detail.</p></li>
</ol></dd>
</dl>
</li>
<li><p>A plugin has to provide one command, with the signature shown
       below.</p>
<dl class="definitions">
<dt><a name="17"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">text</i> <i class="arg">configuration</i></a></dt>
<dd><p>Whenever an import manager of <b class="package"><a href="container.html">doctools::idx</a></b> has to parse
input for an index it will invoke this command.</p>
<dl class="arguments">
<dt>string <i class="arg">text</i></dt>
<dd><p>This argument will contain the text encoding the index per the format
the plugin is for.</p></dd>
<dt>dictionary <i class="arg">configuration</i></dt>
<dd><p>This argument will contain the current configuration to apply to the
parsing, as a dictionary mapping from variable names to values.</p>
<p>The following configuration variables have a predefined meaning all
plugins have to obey, although they can ignore this information at
their discretion. Any other other configuration variables recognized
by a plugin will be described in the manpage for that plugin.</p>
<dl class="definitions">
<dt>user</dt>
<dd><p>This variable is expected to contain the name of the user
           owning the process invoking the plugin.</p></dd>
<dt>format</dt>
<dd><p>This variable is expected to contain the name of the
             format whose plugin is invoked.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
<li><p>A single usage cycle of a plugin consists of the invokations of
       the command <b class="cmd"><a href="../../../../index.html#key247">import</a></b>. This call has to leave the plugin in
       a state where another usage cycle can be run without problems.</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key247">import</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key172">json</a>, <a href="../../../../index.html#key165">keyword index</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key537">reference</a>, <a href="../../../../index.html#key483">url</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/import_docidx.html.















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::import::docidx - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/import_docidx.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::import::docidx.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::import::docidx(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::import::docidx - docidx import plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">[docidx] notation of keyword indices</a></li>
<li class="section"><a href="#section4">Keyword index serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::import::docidx <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">doctools::idx::parse</b></li>
<li>package require <b class="pkgname">doctools::idx::structure</b></li>
<li>package require <b class="pkgname">doctools::msgcat</b></li>
<li>package require <b class="pkgname">doctools::tcl::parse</b></li>
<li>package require <b class="pkgname">fileutil</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">struct::set</b></li>
<li>package require <b class="pkgname">struct::stack</b></li>
<li>package require <b class="pkgname">struct::tree</b></li>
<li>package require <b class="pkgname">treeql</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">string</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools keyword index import plugin for
the parsing of docidx markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially <b class="package"><a href="import.html">doctools::idx::import</a></b>, the import manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="import.html">doctools::idx::import</a></b> and the import manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
docidx import plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">string</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the <i class="arg">string</i> and parses it as docidx
markup encoding a keyword index, in the context of the specified
<i class="arg">configuration</i> (a dictionary). The result of the command is the
canonical serialization of that keyword index, in the form specified
in section <span class="sectref"><a href="#section4">Keyword index serialization format</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">[docidx] notation of keyword indices</a></h2>
<p>The docidx format for keyword indices, also called the
<i class="term">docidx markup language</i>, is too large to be covered in single
section.
The interested reader should start with the document</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/docidx_lang_intro.html">docidx language introduction</a></i></p></li>
</ol>
<p>and then proceed from there to the formal specifications, i.e. the
documents</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/docidx_lang_syntax.html">docidx language syntax</a></i> and</p></li>
<li><p><i class="term"><a href="../doctools/docidx_lang_cmdref.html">docidx language command reference</a></i>.</p></li>
</ol>
<p>to get a thorough understanding of the language.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key231">deserialization</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key247">import</a>, <a href="../../../../index.html#key163">index</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/import_json.html.






































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::import::json - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/import_json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::import::json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::import::json(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::import::json - JSON import plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">JSON notation of keyword indices</a></li>
<li class="section"><a href="#section4">Keyword index serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::import::json <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">doctools::idx::structure</b></li>
<li>package require <b class="pkgname">json</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">string</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools keyword index import plugin for
the parsing of JSON markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling keyword indices, especially <b class="package"><a href="import.html">doctools::idx::import</a></b>, the import manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="import.html">doctools::idx::import</a></b> and the import manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
docidx import plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">string</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the <i class="arg">string</i> and parses it as JSON
markup encoding a keyword index, in the context of the specified
<i class="arg">configuration</i> (a dictionary). The result of the command is the
canonical serialization of that keyword index, in the form specified
in section <span class="sectref"><a href="#section4">Keyword index serialization format</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">JSON notation of keyword indices</a></h2>
<p>The JSON format used for keyword indices is a direct translation of
the <span class="sectref"><a href="#section4">Keyword index serialization format</a></span>, mapping Tcl
dictionaries as JSON objects and Tcl lists as JSON arrays.
For example, the Tcl serialization</p>
<pre class="example">
doctools::idx {
	label {Keyword Index}
	keywords {
		changelog  {changelog.man cvs.man}
		conversion {doctools.man docidx.man doctoc.man apps/dtplite.man mpexpand.man}
		cvs        cvs.man
	}
	references {
		apps/dtplite.man {manpage dtplite}
		changelog.man    {manpage doctools::changelog}
		cvs.man          {manpage doctools::cvs}
		docidx.man       {manpage doctools::idx}
		doctoc.man       {manpage doctools::toc}
		doctools.man     {manpage doctools}
		mpexpand.man     {manpage mpexpand}
	}
	title {}
}
</pre>
<p>is equivalent to the JSON string</p>
<pre class="example">
{
    &quot;doctools::idx&quot; : {
        &quot;label&quot;      : &quot;Keyword Index&quot;,
        &quot;keywords&quot;   : {
            &quot;changelog&quot;  : [&quot;changelog.man&quot;,&quot;cvs.man&quot;],
            &quot;conversion&quot; : [&quot;doctools.man&quot;,&quot;docidx.man&quot;,&quot;doctoc.man&quot;,&quot;apps\/dtplite.man&quot;,&quot;mpexpand.man&quot;],
            &quot;cvs&quot;        : [&quot;cvs.man&quot;],
        },
        &quot;references&quot; : {
            &quot;apps\/dtplite.man&quot; : [&quot;manpage&quot;,&quot;dtplite&quot;],
            &quot;changelog.man&quot;     : [&quot;manpage&quot;,&quot;doctools::changelog&quot;],
            &quot;cvs.man&quot;           : [&quot;manpage&quot;,&quot;doctools::cvs&quot;],
            &quot;docidx.man&quot;        : [&quot;manpage&quot;,&quot;doctools::idx&quot;],
            &quot;doctoc.man&quot;        : [&quot;manpage&quot;,&quot;doctools::toc&quot;],
            &quot;doctools.man&quot;      : [&quot;manpage&quot;,&quot;doctools&quot;],
            &quot;mpexpand.man&quot;      : [&quot;manpage&quot;,&quot;mpexpand&quot;]
        },
        &quot;title&quot;      : &quot;&quot;
    }
}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key232">JSON</a>, <a href="../../../../index.html#key231">deserialization</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key247">import</a>, <a href="../../../../index.html#key163">index</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/introduction.html.


































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools2idx_introduction - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/introduction.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools2idx_introduction.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools2idx_introduction(n) 2.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools2idx_introduction - DocTools - Keyword indices</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Related formats</a></li>
<li class="section"><a href="#section3">Package Overview</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><i class="term"><a href="../../../../index.html#key50">docidx</a></i> (short for <em>documentation indices</em>) stands for a
set of related, yet different, entities which are working together for
the easy creation and transformation of keyword indices for
documentation.</p>
<p>These are</p>
<ol class="enumerated">
<li><p>A tcl based language for the semantic markup of a keyword index.
Markup is represented by Tcl commands.
Beginners should start with the
<i class="term"><a href="../doctools/docidx_lang_intro.html">docidx language introduction</a></i>.
The formal specification is split over two documents, one dealing with
the <i class="term"><a href="../doctools/docidx_lang_syntax.html">docidx language syntax</a></i>, the other a
<i class="term"><a href="../doctools/docidx_lang_cmdref.html">docidx language command reference</a></i>.</p></li>
<li><p>A set of packages for the programmatic manipulation of keyword indices
in memory, and their conversion between various formats, reading and
writing. The aforementioned markup language is one of the formats
which can be both read from and written to.</p></li>
<li><p>The system for the conversion of indices is based on a plugin
mechanism, for this we have two APIs describing the interface between
the packages above and the import/export plugins.</p></li>
</ol>
<p>Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.</p>
<ol class="enumerated">
<li><p>A <i class="term">writer</i> of documentation has to understand the markup language
itself. A beginner to docidx should read the more informally written
<i class="term"><a href="../doctools/docidx_lang_intro.html">docidx language introduction</a></i> first. Having digested this
the formal <i class="term"><a href="../doctools/docidx_lang_syntax.html">docidx language syntax</a></i> specification should
become understandable. A writer experienced with docidx may only
need the <i class="term"><a href="../doctools/docidx_lang_cmdref.html">docidx language command reference</a></i> from time to
time to refresh her memory.</p>
<p>While a document is written the <b class="syscmd">dtp</b> application can be used
to validate it, and after completion it also performs the conversion
into the chosen system of visual markup, be it *roff, HTML, plain
text, wiki, etc. The simpler <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> application makes
internal use of docidx when handling directories of documentation,
automatically generating a proper keyword index for them.</p></li>
<li><p>A <i class="term">processor</i> of documentation written in the <i class="term"><a href="../../../../index.html#key50">docidx</a></i>
markup language has to know which tools are available for use.</p>
<p>The main tool is the aforementioned <b class="syscmd">dtp</b> application provided
by Tcllib. The simpler <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> does not expose docidx to the
user. At the bottom level, common to both applications, however we
find the three packages providing the basic facilities to handle
keyword indices, i.e. import from textual formats, programmatic
manipulation in memory, and export to textual formats. These are</p>
<dl class="definitions">
<dt><b class="package"><a href="container.html">doctools::idx</a></b></dt>
<dd><p>Programmatic manipulation of keyword indices in memory.</p></dd>
<dt><b class="package"><a href="import.html">doctools::idx::import</a></b></dt>
<dd><p>Import of keyword indices from various textual formats. The set of
supported formats is extensible through plugin packages.</p></dd>
<dt><b class="package"><a href="export.html">doctools::idx::export</a></b></dt>
<dd><p>Export of keyword indices to various textual formats. The set of
supported formats is extensible through plugin packages.</p></dd>
</dl>
<p>See also section <span class="sectref"><a href="#section3">Package Overview</a></span> for an overview of the
dependencies between these and other, supporting packages.</p></li>
<li><p>At last, but not least, <i class="term">plugin writers</i> have to understand the
interaction between the import and export packages and their plugins.
These APIs are described in the documentation for the two relevant
packages, i.e.</p>
<ul class="itemized">
<li><p><b class="package"><a href="import.html">doctools::idx::import</a></b></p></li>
<li><p><b class="package"><a href="export.html">doctools::idx::export</a></b></p></li>
</ul>
</li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">Related formats</a></h2>
<p>The docidx format does not stand alone, it has two companion formats.
These are called <i class="term"><a href="../../../../index.html#key230">doctoc</a></i> and <i class="term"><a href="../../../../index.html#key51">doctools</a></i>, and they are
intended for the markup of <i class="term">tables of contents</i>, and of general
documentation, respectively.
They are described in their own sets of documents, starting at
the <i class="term">DocTools - Tables Of Contents</i> and
the <i class="term">DocTools - General</i>, respectively.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Package Overview</a></h2>
<pre class="example">
                                    ~~~~~~~~~~~ doctools::idx ~~~~~~~~~~~
                                   ~~                   |               ~~
                doctools::idx::export ~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~ doctools::idx::import
                        |                               |                       |
        +---------------+-------------------------+     |    +------------------+---------------+-----------------------+---------------+
        |               |                         |     |    |                  |               |                       |               |
doctools::config        =                         |     |    |                  =       doctools::include       doctools::config doctools::paths
                        |                         |     |    |                  |
                doctools::idx::export::&lt;*&gt;        |     |    |          doctools::idx::import::&lt;*&gt;
                        docidx                    |     |    |                  docidx, json
                        json                      |     |    |                  |           \\
                        html                      |     |    |          doctools::idx::parse \\
                        nroff                     |     |    |                  |             \\
                        wiki                      |     |    |  +---------------+              json
                        text                      |     |    |  |               |
                                                doctools::idx::structure        |
                                                                                |
                                                                        +-------+---------------+
                                                                        |                       |
          doctools::html  doctools::html::cssdefaults           doctools::tcl::parse    doctools::msgcat        
                |                                                                               |
          doctools::text  doctools::nroff::man_macros                                           =
                                                                                                |
                                                                                        doctools::msgcat::idx::&lt;*&gt;
                                                                                                c, en, de, fr
                                                                                                (fr == en for now)
        ~~      Interoperable objects, without actual package dependencies
        --      Package dependency, higher requires lower package
        =       Dynamic dependency through plugin system
        &lt;*&gt;     Multiple packages following the given form of naming.
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>doctools2doc_introduction, <a href="../doctools2toc/introduction.html">doctools2toc_introduction</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key163">index</a>, <a href="../../../../index.html#key165">keyword index</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key116">semantic markup</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/msgcat_c.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat::idx::c - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/msgcat_c.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat::idx::c.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat::idx::c(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat::idx::c - Message catalog for the docidx parser (C)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat::idx::c <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat::idx::c</b> is a
support module providing the C language message catalog
for the docidx parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="../doctools2toc/container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b> providing the general message catalog
management within the system. <em>Note</em> that there is <em>no</em>
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>This package has no exported API.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key476">C</a>, <a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/msgcat_de.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat::idx::de - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/msgcat_de.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat::idx::de.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat::idx::de(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat::idx::de - Message catalog for the docidx parser (DE)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat::idx::de <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat::idx::de</b> is a
support module providing the DE (german) language message catalog
for the docidx parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="../doctools2toc/container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b> providing the general message catalog
management within the system. <em>Note</em> that there is <em>no</em>
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>This package has no exported API.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key222">DE</a>, <a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/msgcat_en.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat::idx::en - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/msgcat_en.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat::idx::en.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat::idx::en(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat::idx::en - Message catalog for the docidx parser (EN)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat::idx::en <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat::idx::en</b> is a
support module providing the EN (english) language message catalog
for the docidx parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="../doctools2toc/container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b> providing the general message catalog
management within the system. <em>Note</em> that there is <em>no</em>
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>This package has no exported API.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key47">EN</a>, <a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/msgcat_fr.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat::idx::fr - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/msgcat_fr.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat::idx::fr.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat::idx::fr(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat::idx::fr - Message catalog for the docidx parser (FR)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat::idx::fr <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat::idx::fr</b> is a
support module providing the FR (french) language message catalog
for the docidx parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="../doctools2toc/container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b> providing the general message catalog
management within the system. <em>Note</em> that there is <em>no</em>
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>This package has no exported API.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key571">FR</a>, <a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/parse.html.




























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::parse - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/parse.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::parse.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::parse(n) 1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::parse - Parsing text in docidx format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Parse errors</a></li>
<li class="section"><a href="#section4">[docidx] notation of keyword indices</a></li>
<li class="section"><a href="#section5">Keyword index serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::idx::parse <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::idx::structure</b></li>
<li>package require <b class="pkgname">doctools::msgcat</b></li>
<li>package require <b class="pkgname">doctools::tcl::parse</b></li>
<li>package require <b class="pkgname">fileutil</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">struct::stack</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::idx::parse</b> <b class="method">text</b> <i class="arg">text</i></a></li>
<li><a href="#2"><b class="cmd">::doctools::idx::parse</b> <b class="method">file</b> <i class="arg">path</i></a></li>
<li><a href="#3"><b class="cmd">::doctools::idx::parse</b> <b class="method">includes</b></a></li>
<li><a href="#4"><b class="cmd">::doctools::idx::parse</b> <b class="method">include add</b> <i class="arg">path</i></a></li>
<li><a href="#5"><b class="cmd">::doctools::idx::parse</b> <b class="method">include remove</b> <i class="arg">path</i></a></li>
<li><a href="#6"><b class="cmd">::doctools::idx::parse</b> <b class="method">include clear</b></a></li>
<li><a href="#7"><b class="cmd">::doctools::idx::parse</b> <b class="method">vars</b></a></li>
<li><a href="#8"><b class="cmd">::doctools::idx::parse</b> <b class="method">var set</b> <i class="arg">name</i> <i class="arg">value</i></a></li>
<li><a href="#9"><b class="cmd">::doctools::idx::parse</b> <b class="method">var unset</b> <i class="arg">name</i></a></li>
<li><a href="#10"><b class="cmd">::doctools::idx::parse</b> <b class="method">var clear</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to parse text written in the
<i class="term"><a href="../../../../index.html#key50">docidx</a></i> markup language and convert it into the canonical
serialization of the keyword index encoded in the text.
See the section <span class="sectref"><a href="#section5">Keyword index serialization format</a></span> for
specification of their format.</p>
<p>This is an internal package of doctools, for use by the higher level
packages handling <i class="term"><a href="../../../../index.html#key50">docidx</a></i> documents.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::idx::parse</b> <b class="method">text</b> <i class="arg">text</i></a></dt>
<dd><p>The command takes the string contained in <i class="arg">text</i> and parses it
under the assumption that it contains a document written using the
<i class="term"><a href="../../../../index.html#key50">docidx</a></i> markup language. An error is thrown if this assumption
is found to be false. The format of these errors is described in
section <span class="sectref"><a href="#section3">Parse errors</a></span>.</p>
<p>When successful the command returns the canonical serialization of the
keyword index which was encoded in the text.
See the section <span class="sectref"><a href="#section5">Keyword index serialization format</a></span> for
specification of that format.</p></dd>
<dt><a name="2"><b class="cmd">::doctools::idx::parse</b> <b class="method">file</b> <i class="arg">path</i></a></dt>
<dd><p>The same as <b class="method">text</b>, except that the text to parse is read from
the file specified by <i class="arg">path</i>.</p></dd>
<dt><a name="3"><b class="cmd">::doctools::idx::parse</b> <b class="method">includes</b></a></dt>
<dd><p>This method returns the current list of search paths used when looking
for include files.</p></dd>
<dt><a name="4"><b class="cmd">::doctools::idx::parse</b> <b class="method">include add</b> <i class="arg">path</i></a></dt>
<dd><p>This method adds the <i class="arg">path</i> to the list of paths searched when
looking for an include file. The call is ignored if the path is
already in the list of paths. The method returns the empty string as
its result.</p></dd>
<dt><a name="5"><b class="cmd">::doctools::idx::parse</b> <b class="method">include remove</b> <i class="arg">path</i></a></dt>
<dd><p>This method removes the <i class="arg">path</i> from the list of paths searched
when looking for an include file. The call is ignored if the path is
not contained in the list of paths. The method returns the empty
string as its result.</p></dd>
<dt><a name="6"><b class="cmd">::doctools::idx::parse</b> <b class="method">include clear</b></a></dt>
<dd><p>This method clears the list of search paths for include files.</p></dd>
<dt><a name="7"><b class="cmd">::doctools::idx::parse</b> <b class="method">vars</b></a></dt>
<dd><p>This method returns a dictionary containing the current set of
predefined variables known to the <b class="cmd">vset</b> markup command during
processing.</p></dd>
<dt><a name="8"><b class="cmd">::doctools::idx::parse</b> <b class="method">var set</b> <i class="arg">name</i> <i class="arg">value</i></a></dt>
<dd><p>This method adds the variable <i class="arg">name</i> to the set of predefined
variables known to the <b class="cmd">vset</b> markup command during processing,
and gives it the specified <i class="arg">value</i>. The method returns the empty
string as its result.</p></dd>
<dt><a name="9"><b class="cmd">::doctools::idx::parse</b> <b class="method">var unset</b> <i class="arg">name</i></a></dt>
<dd><p>This method removes the variable <i class="arg">name</i> from the set of predefined
variables known to the <b class="cmd">vset</b> markup command during
processing. The method returns the empty string as its result.</p></dd>
<dt><a name="10"><b class="cmd">::doctools::idx::parse</b> <b class="method">var clear</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>This method removes all variables matching the <i class="arg">pattern</i> from the
set of predefined variables known to the <b class="cmd">vset</b> markup command
during processing. The method returns the empty string as its result.</p>
<p>The pattern matching is done with <b class="cmd">string match</b>, and the
default pattern used when none is specified, is <b class="const">*</b>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Parse errors</a></h2>
<p>The format of the parse error messages thrown when encountering
violations of the <i class="term"><a href="../../../../index.html#key50">docidx</a></i> markup syntax is human readable and
not intended for processing by machines. As such it is not documented.</p>
<p><em>However</em>, the errorCode attached to the message is
machine-readable and has the following format:</p>
<ol class="enumerated">
<li><p>The error code will be a list, each element describing a single error
found in the input. The list has at least one element, possibly more.</p></li>
<li><p>Each error element will be a list containing six strings describing an
error in detail. The strings will be</p>
<ol class="enumerated">
<li><p>The path of the file the error occured in. This may be empty.</p></li>
<li><p>The range of the token the error was found at. This range is a
two-element list containing the offset of the first and last character
in the range, counted from the beginning of the input (file). Offsets
are counted from zero.</p></li>
<li><p>The line the first character after the error is on.
Lines are counted from one.</p></li>
<li><p>The column the first character after the error is at.
Columns are counted from zero.</p></li>
<li><p>The message code of the error. This value can be used as argument to
<b class="cmd">msgcat::mc</b> to obtain a localized error message, assuming that
the application had a suitable call of <b class="cmd">doctools::msgcat::init</b> to
initialize the necessary message catalogs (See package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b>).</p></li>
<li><p>A list of details for the error, like the markup command involved. In
the case of message code <b class="const">docidx/include/syntax</b> this value is
the set of errors found in the included file, using the format
described here.</p></li>
</ol>
</li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">[docidx] notation of keyword indices</a></h2>
<p>The docidx format for keyword indices, also called the
<i class="term">docidx markup language</i>, is too large to be covered in single
section.
The interested reader should start with the document</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/docidx_lang_intro.html">docidx language introduction</a></i></p></li>
</ol>
<p>and then proceed from there to the formal specifications, i.e. the
documents</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/docidx_lang_syntax.html">docidx language syntax</a></i> and</p></li>
<li><p><i class="term"><a href="../doctools/docidx_lang_cmdref.html">docidx language command reference</a></i>.</p></li>
</ol>
<p>to get a thorough understanding of the language.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key345">lexer</a>, <a href="../../../../index.html#key15">parser</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2idx/structure.html.

































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::idx::structure - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2idx/structure.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::idx::structure.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::idx::structure(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::idx::structure - Docidx serialization utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Keyword index serialization format</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::idx::structure <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::idx::structure</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::doctools::idx::structure</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></li>
<li><a href="#3"><b class="cmd">::doctools::idx::structure</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></li>
<li><a href="#4"><b class="cmd">::doctools::idx::structure</b> <b class="method">print</b> <i class="arg">serial</i></a></li>
<li><a href="#5"><b class="cmd">::doctools::idx::structure</b> <b class="method">merge</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to work with the serializations of
keyword indices as managed by the doctools system v2, and specified in
section <span class="sectref"><a href="#section3">Keyword index serialization format</a></span>.</p>
<p>This is an internal package of doctools, for use by the higher level
packages handling keyword indices and their conversion into and out of
various other formats, like documents written using <i class="term"><a href="../../../../index.html#key50">docidx</a></i>
markup.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::idx::structure</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
<i class="term">regular</i> serialization of a keyword index and will throw an
error if that is not the case. The result of the command is the empty
string.</p>
<p>If the argument <i class="arg">canonvar</i> is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if <i class="arg">serial</i> is a valid regular
serialization. Its value will be a boolean, with <b class="const">True</b>
indicating that the serialization is not only valid, but also
<i class="term">canonical</i>. <b class="const">False</b> will be written for a valid, but
non-canonical serialization.</p>
<p>For the specification of regular and canonical keyword index
serializations see the section
<span class="sectref"><a href="#section3">Keyword index serialization format</a></span>.</p></dd>
<dt><a name="2"><b class="cmd">::doctools::idx::structure</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
<i class="term">canonical</i> serialization of a keyword index and will throw an
error if that is not the case. The result of the command is the empty
string.</p>
<p>For the specification of canonical keyword index serializations see
the section <span class="sectref"><a href="#section3">Keyword index serialization format</a></span>.</p></dd>
<dt><a name="3"><b class="cmd">::doctools::idx::structure</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the content of <i class="arg">serial</i> is a valid
<i class="term">regular</i> serialization of a keyword index and will throw an
error if that is not the case.</p>
<p>It will then convert the input into the <i class="term">canonical</i> serialization
of the contained keyword index and return it as its result. If the
input is already canonical it will be returned unchanged.</p>
<p>For the specification of regular and canonical keyword index
serializations see the section
<span class="sectref"><a href="#section3">Keyword index serialization format</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::doctools::idx::structure</b> <b class="method">print</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the argument <i class="arg">serial</i> contains a valid
regular serialization of a keyword index and returns a string
containing that index in a human readable form.</p>
<p>The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.</p>
<p>For the specification of regular keyword index serializations see the
section <span class="sectref"><a href="#section3">Keyword index serialization format</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::doctools::idx::structure</b> <b class="method">merge</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></dt>
<dd><p>This command accepts the regular serializations of two keyword indices
and uses them to create their union.  The result of the command is the
canonical serialization of this unified keyword index.</p>
<p>Title and label of the resulting index are taken from the index
contained in <i class="arg">serialb</i>. The set of keys, references and their
connections is the union of the set of keys and references of the two
inputs.</p>
<p>For the specification of regular and canonical keyword index
serializations see the section
<span class="sectref"><a href="#section3">Keyword index serialization format</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Keyword index serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize keyword indices as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations. While a keyword index may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>An index serialization is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::idx</b>, and its
value. This value holds the contents of the index.</p></li>
<li><p>The contents of the index are a Tcl dictionary holding the title of
the index, a label, and the keywords and references. The relevant keys
and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the index.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the index.</p></dd>
<dt><b class="const">keywords</b></dt>
<dd><p>The value is a Tcl dictionary, using the keywords known to the index
as keys. The associated values are lists containing the identifiers of
the references associated with that particular keyword.</p>
<p>Any reference identifier used in these lists has to exist as a key in
the <b class="const">references</b> dictionary, see the next item for its
definition.</p></dd>
<dt><b class="const">references</b></dt>
<dd><p>The value is a Tcl dictionary, using the identifiers for the
references known to the index as keys. The associated values are
2-element lists containing the type and label of the reference, in
this order.</p>
<p>Any key here has to be associated with at least one keyword,
i.e. occur in at least one of the reference lists which are the values
in the <b class="const">keywords</b> dictionary, see previous item for its
definition.</p></dd>
</dl>
</li>
<li><p>The <i class="term"><a href="../../../../index.html#key109">type</a></i> of a reference can be one of two values,</p>
<dl class="definitions">
<dt><b class="const">manpage</b></dt>
<dd><p>The identifier of the reference is interpreted as symbolic file name,
refering to one of the documents the index was made for.</p></dd>
<dt><b class="const">url</b></dt>
<dd><p>The identifier of the reference is interpreted as an url, refering to
some external location, like a website, etc.</p></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a keyword index has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of the keyword index.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The references listed for each keyword of the index, if any, are
listed in ascending dictionary order of their <em>labels</em>, as
generated by Tcl's builtin command <b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key231">deserialization</a>, <a href="../../../../index.html#key50">docidx</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key102">serialization</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/container.html.































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/container.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc(n) 2 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc - Holding tables of contents</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Concepts</a></li>
<li class="section"><a href="#section3">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section4">ToC serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::toc <span class="opt">?2?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::structure</b></li>
<li>package require <b class="pkgname">struct::tree</b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::toc</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">+ reference</b> <i class="arg">id</i> <i class="arg">label</i> <i class="arg">docid</i> <i class="arg">desc</i></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">+ division</b> <i class="arg">id</i> <i class="arg">label</i> <span class="opt">?<i class="arg">docid</i>?</span></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">remove</b> <i class="arg">id</i></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">up</b> <i class="arg">id</i></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">next</b> <i class="arg">id</i></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">prev</b> <i class="arg">id</i></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">child</b> <i class="arg">id</i> <i class="arg">label</i> <span class="opt">?<i class="arg">...</i>?</span></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">element</b> <span class="opt">?<i class="arg">...</i>?</span></a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">children</b> <i class="arg">id</i></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">type</b> <i class="arg">id</i></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">full-label</b> <i class="arg">id</i></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">elabel</b> <i class="arg">id</i> <span class="opt">?<i class="arg">newlabel</i>?</span></a></li>
<li><a href="#16"><i class="arg">objectName</i> <b class="method">description</b> <i class="arg">id</i> <span class="opt">?<i class="arg">newdesc</i>?</span></a></li>
<li><a href="#17"><i class="arg">objectName</i> <b class="method">document</b> <i class="arg">id</i> <span class="opt">?<i class="arg">newdocid</i>?</span></a></li>
<li><a href="#18"><i class="arg">objectName</i> <b class="method">title</b></a></li>
<li><a href="#19"><i class="arg">objectName</i> <b class="method">title</b> <i class="arg">text</i></a></li>
<li><a href="#20"><i class="arg">objectName</i> <b class="method">label</b></a></li>
<li><a href="#21"><i class="arg">objectName</i> <b class="method">label</b> <i class="arg">text</i></a></li>
<li><a href="#22"><i class="arg">objectName</i> <b class="method">importer</b></a></li>
<li><a href="#23"><i class="arg">objectName</i> <b class="method">importer</b> <i class="arg">object</i></a></li>
<li><a href="#24"><i class="arg">objectName</i> <b class="method">exporter</b></a></li>
<li><a href="#25"><i class="arg">objectName</i> <b class="method">exporter</b> <i class="arg">object</i></a></li>
<li><a href="#26"><i class="arg">objectName</i> <b class="method">deserialize =</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#27"><i class="arg">objectName</i> <b class="method">deserialize +=</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#28"><i class="arg">objectName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">format</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class to contain and programmatically
manipulate tables of contents.</p>
<p>This is one of the three public pillars the management of tables of
contents resides on. The other two pillars are</p>
<ol class="enumerated">
<li><p><i class="term"><a href="export.html">Exporting tables of contents</a></i>, and</p></li>
<li><p><i class="term">Importing tables of contents</i></p></li>
</ol>
<p>For information about the <span class="sectref"><a href="#section2">Concepts</a></span> of tables of contents, and
their parts, see the same-named section.
For information about the data structure which is used to encode
tables of contents as values see the section
<span class="sectref"><a href="#section4">ToC serialization format</a></span>.
This is the only format directly known to this class. Conversions from
and to any other format are handled by export and import manager
objects. These may be attached to a container, but do not have to be,
it is merely a convenience.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Concepts</a></h2>
<ol class="enumerated">
<li><p>A <i class="term"><a href="../../../../index.html#key150">table of contents</a></i> consists of a (possibly empty) list of
<i class="term">elements</i>.</p></li>
<li><p>Each element in the list is identified by its label.</p></li>
<li><p>Each element is either a <i class="term"><a href="../../../../index.html#key537">reference</a></i>, or a <i class="term">division</i>.</p></li>
<li><p>Each reference has an associated document, identified by a symbolic
id, and a textual description.</p></li>
<li><p>Each division may have an associated document, identified by a
symbolic id.</p></li>
<li><p>Each division consists consists of a (possibly empty) list of
<i class="term">elements</i>, with each element following the rules as specified in
item 2 and above.</p></li>
</ol>
<p>A few notes</p>
<ol class="enumerated">
<li><p>The above rules span up a tree of elements, with references as the
leaf nodes, and divisions as the inner nodes, and each element
representing an entry in the whole table of contents.</p></li>
<li><p>The identifying labels of any element E are unique within their
division (or toc), and the full label of any element E is the list of
labels for all nodes on the unique path from the root of the tree to
E, including E.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::toc</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new container object with an associated Tcl
command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is
explained in full detail in the sections <span class="sectref"><a href="#subsection2">Object command</a></span>
and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::doctools::toc</b> command have the
following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">+ reference</b> <i class="arg">id</i> <i class="arg">label</i> <i class="arg">docid</i> <i class="arg">desc</i></a></dt>
<dd><p>This method adds a new reference element to the table of contents,
under the element specified via its handle <i class="arg">id</i>. This parent
element has to be a division element, or the root. An error is thrown
otherwise.
The new element will be externally identified by its <i class="arg">label</i>,
which has to be be unique within the parent element. An error is
thrown otherwise.</p>
<p>As a reference element it will refer to a document identified by the
symbolic <i class="arg">docid</i>. This reference must not be the empty string, an
error is thrown otherwise.
Beyond the label the element also has a longer descriptive string,
supplied via <i class="arg">desc</i>.</p>
<p>The result of the method is the handle (id) of the new element.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">+ division</b> <i class="arg">id</i> <i class="arg">label</i> <span class="opt">?<i class="arg">docid</i>?</span></a></dt>
<dd><p>This method adds a new division element to the table of contents,
under the element specified via its handle <i class="arg">id</i>. This parent
element has to be a division element, or the root. An error is thrown
otherwise.
The new element will be externally identified by its <i class="arg">label</i>,
which has to be be unique within the parent element. An error is
thrown otherwise.</p>
<p>As a division element it is can refer to a document, identified by the
symbolic <i class="arg">docid</i>, but may choose not to.</p>
<p>The result of the method is the handle (id) of the new element.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">remove</b> <i class="arg">id</i></a></dt>
<dd><p>This method removes the element identified by the handle <i class="arg">id</i> from
the table of contents.
If the element is a division all of its children, if any, are removed
as well. The root element/division of the table of contents cannot be
removed however, only its children.</p>
<p>The result of the method is the empty string.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">up</b> <i class="arg">id</i></a></dt>
<dd><p>This method returns the handle of the parent for the element
identified by its handle <i class="arg">id</i>, or the empty string if <i class="arg">id</i>
refered to the root element.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">next</b> <i class="arg">id</i></a></dt>
<dd><p>This method returns the handle of the right sibling for the element
identified by its handle <i class="arg">id</i>, or the handle of the parent if the
element has no right sibling, or the empty string if <i class="arg">id</i> refered
to the root element.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">prev</b> <i class="arg">id</i></a></dt>
<dd><p>This method returns the handle of the left sibling for the element
identified by its handle <i class="arg">id</i>, or the handle of the parent if the
element has no left sibling, or the empty string if <i class="arg">id</i> refered
to the root element.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">child</b> <i class="arg">id</i> <i class="arg">label</i> <span class="opt">?<i class="arg">...</i>?</span></a></dt>
<dd><p>This method returns the handle of a child of the element identified by
its handle <i class="arg">id</i>. The child itself is identified by a series of
labels.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">element</b> <span class="opt">?<i class="arg">...</i>?</span></a></dt>
<dd><p>This method returns the handle of the element identified by a series
of labels, starting from the root of the table of contents. The series
of labels is allowed to be empty, in which case the handle of the root
element is returned.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">children</b> <i class="arg">id</i></a></dt>
<dd><p>This method returns a list containing the handles of all children of
the element identified by the handle <i class="arg">id</i>, from first to last, in
that order.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">type</b> <i class="arg">id</i></a></dt>
<dd><p>This method returns the type of the element, either <b class="const">reference</b>,
or <b class="const">division</b>.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">full-label</b> <i class="arg">id</i></a></dt>
<dd><p>This method is the complement of the method <b class="method">element</b>,
converting the handle <i class="arg">id</i> of an element into a list of labels
full identifying the element within the whole table of contents.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">elabel</b> <i class="arg">id</i> <span class="opt">?<i class="arg">newlabel</i>?</span></a></dt>
<dd><p>This method queries and/or changes the label of the element identified
by the handle <i class="arg">id</i>. If the argument <i class="arg">newlabel</i> is present then
the label is changed to that value. Regardless of this, the result of
the method is the current value of the label.</p>
<p>If the label is changed the new label has to be unique within the
containing division, or an error is thrown.</p>
<p>Further, of the <i class="arg">id</i> refers to the root element of the table of
contents, then using this method is equivalent to using the method
<i class="arg">label</i>, i.e. it is accessing the global label for the whole
table.</p></dd>
<dt><a name="16"><i class="arg">objectName</i> <b class="method">description</b> <i class="arg">id</i> <span class="opt">?<i class="arg">newdesc</i>?</span></a></dt>
<dd><p>This method queries and/or changes the description of the element
identified by the handle <i class="arg">id</i>. If the argument <i class="arg">newdesc</i> is
present then the description is changed to that value. Regardless of
this, the result of the method is the current value of the description.</p>
<p>The element this method operates on has to be a reference element, or
an error will be thrown.</p></dd>
<dt><a name="17"><i class="arg">objectName</i> <b class="method">document</b> <i class="arg">id</i> <span class="opt">?<i class="arg">newdocid</i>?</span></a></dt>
<dd><p>This method queries and/or changes the document reference of the
element identified by the handle <i class="arg">id</i>.
If the argument <i class="arg">newdocid</i> is present then the description is
changed to that value. Regardless of this, the result of the method is
the current value of the document reference.</p>
<p>Setting the reference to the empty string means unsetting it, and is
allowed only for division elements. Conversely, if the result is the
empty string then the element has no document reference, and this can
happen only for division elements.</p></dd>
<dt><a name="18"><i class="arg">objectName</i> <b class="method">title</b></a></dt>
<dd><p>Returns the currently defined title of the table of contents.</p></dd>
<dt><a name="19"><i class="arg">objectName</i> <b class="method">title</b> <i class="arg">text</i></a></dt>
<dd><p>Sets the title of the table of contents to <i class="arg">text</i>, and returns it as
the result of the command.</p></dd>
<dt><a name="20"><i class="arg">objectName</i> <b class="method">label</b></a></dt>
<dd><p>Returns the currently defined label of the table of contents.</p></dd>
<dt><a name="21"><i class="arg">objectName</i> <b class="method">label</b> <i class="arg">text</i></a></dt>
<dd><p>Sets the label of the table of contents to <i class="arg">text</i>, and returns it as
the result of the command.</p></dd>
<dt><a name="22"><i class="arg">objectName</i> <b class="method">importer</b></a></dt>
<dd><p>Returns the import manager object currently attached to the container,
if any.</p></dd>
<dt><a name="23"><i class="arg">objectName</i> <b class="method">importer</b> <i class="arg">object</i></a></dt>
<dd><p>Attaches the <i class="arg">object</i> as import manager to the container, and
returns it as the result of the command.
Note that the <i class="arg">object</i> is <em>not</em> put into ownership of the
container. I.e., destruction of the container will <em>not</em> destroy
the <i class="arg">object</i>.</p>
<p>It is expected that <i class="arg">object</i> provides a method named
<b class="method">import text</b> which takes a text and a format name, and
returns the canonical serialization of the table of contents contained in
the text, assuming the given format.</p></dd>
<dt><a name="24"><i class="arg">objectName</i> <b class="method">exporter</b></a></dt>
<dd><p>Returns the export manager object currently attached to the container,
if any.</p></dd>
<dt><a name="25"><i class="arg">objectName</i> <b class="method">exporter</b> <i class="arg">object</i></a></dt>
<dd><p>Attaches the <i class="arg">object</i> as export manager to the container, and
returns it as the result of the command.
Note that the <i class="arg">object</i> is <em>not</em> put into ownership of the
container. I.e., destruction of the container will <em>not</em> destroy
the <i class="arg">object</i>.</p>
<p>It is expected that <i class="arg">object</i> provides a method named
<b class="method">export object</b> which takes the container and a format name,
and returns a text encoding table of contents stored in the container, in
the given format. It is further expected that the <i class="arg">object</i> will
use the container's method <b class="method">serialize</b> to obtain the
serialization of the table of contents from which to generate the text.</p></dd>
<dt><a name="26"><i class="arg">objectName</i> <b class="method">deserialize =</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method replaces the contents of the table object with the table
contained in the <i class="arg">data</i>. If no <i class="arg">format</i> was specified it is
assumed to be the regular serialization of a table of contents.</p>
<p>Otherwise the object will use the attached import manager to convert
the data from the specified format to a serialization it can handle.
In that case an error will be thrown if the container has no import
manager attached to it.</p>
<p>The result of the method is the empty string.</p></dd>
<dt><a name="27"><i class="arg">objectName</i> <b class="method">deserialize +=</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method behaves like <b class="method">deserialize =</b> in its essentials,
except that it merges the table of contents in the <i class="arg">data</i> to its
contents instead of replacing it. 
The method will throw an error if merging is not possible, i.e. would
produce an invalid table. The existing content is left unchanged in
that case.</p>
<p>The result of the method is the empty string.</p></dd>
<dt><a name="28"><i class="arg">objectName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method returns the table of contents contained in the object. If no
<i class="arg">format</i> is not specified the returned result is the canonical
serialization of its contents.</p>
<p>Otherwise the object will use the attached export manager to convert
the data to the specified format.
In that case an error will be thrown if the container has no export
manager attached to it.</p></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key4">TMML</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key464">doctoc markup</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key536">generation</a>, <a href="../../../../index.html#key172">json</a>, <a href="../../../../index.html#key167">latex</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key537">reference</a>, <a href="../../../../index.html#key104">table</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key535">tcler's wiki</a>, <a href="../../../../index.html#key454">text</a>, <a href="../../../../index.html#key164">wiki</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/export.html.




























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::export - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/export.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::export.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::export(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::export - Exporting tables of contents</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Concepts</a></li>
<li class="section"><a href="#section3">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Export plugin API v2 reference</a></li>
<li class="section"><a href="#section5">ToC serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::toc::export <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::config</b></li>
<li>package require <b class="pkgname">doctools::toc::structure</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">pluginmgr</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::toc::export</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">export serial</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">export object</b> <i class="arg">object</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">config names</b></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">config get</b></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">config set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">config unset</b> <i class="arg">pattern</i>...</a></li>
<li><a href="#10"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class to manage the plugins for the export of
tables of contents to other formats, i.e. their conversion to, for
example <i class="term"><a href="../../../../index.html#key230">doctoc</a></i>, <i class="term"><a href="../../../../index.html#key1">HTML</a></i>, etc.</p>
<p>This is one of the three public pillars the management of tables of
contents resides on. The other two pillars are</p>
<ol class="enumerated">
<li><p><i class="term">Importing tables of contents</i>, and</p></li>
<li><p><i class="term"><a href="container.html">Holding tables of contents</a></i></p></li>
</ol>
<p>For information about the <span class="sectref"><a href="#section2">Concepts</a></span> of tables of contents,
and their parts, see the same-named section.
For information about the data structure which is the major input to
the manager objects provided by this package see the section
<span class="sectref"><a href="#section5">ToC serialization format</a></span>.</p>
<p>The plugin system of our class is based on the package
<b class="package"><a href="../pluginmgr/pluginmgr.html">pluginmgr</a></b>, and configured to look for plugins using</p>
<ol class="enumerated">
<li><p>the environment variable <b class="variable">DOCTOOLS_TOC_EXPORT_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">DOCTOOLS_TOC_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">DOCTOOLS_PLUGINS</b>,</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/toc/export/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/toc/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/toc/export/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/toc/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/plugins</b>&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\TOC\EXPORT\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\TOC\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\PLUGINS&quot;</p></li>
</ol>
<p>The last three are used only when the package is run on a machine
using Windows(tm) operating system.</p>
<p>The whole system is delivered with six predefined export plugins,
namely</p>
<dl class="definitions">
<dt>doctoc</dt>
<dd><p>See <i class="term"><a href="export_doctoc.html">doctoc export plugin</a></i> for details.</p></dd>
<dt>html</dt>
<dd><p>See <i class="term">html export plugin</i> for details.</p></dd>
<dt>json</dt>
<dd><p>See <i class="term">json export plugin</i> for details.</p></dd>
<dt>nroff</dt>
<dd><p>See <i class="term"><a href="export_nroff.html">nroff export plugin</a></i> for details.</p></dd>
<dt>text</dt>
<dd><p>See <i class="term">text export plugin</i> for details.</p></dd>
<dt>wiki</dt>
<dd><p>See <i class="term"><a href="../doctools2idx/export_wiki.html">wiki export plugin</a></i> for details.</p></dd>
</dl>
<p>Readers wishing to write their own export plugin for some format, i.e.
<i class="term">plugin writer</i>s reading and understanding the section
containing the <span class="sectref"><a href="#section4">Export plugin API v2 reference</a></span> is an
absolute necessity, as it specifies the interaction between this
package and its plugins in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Concepts</a></h2>
<ol class="enumerated">
<li><p>A <i class="term"><a href="../../../../index.html#key150">table of contents</a></i> consists of a (possibly empty) list of
<i class="term">elements</i>.</p></li>
<li><p>Each element in the list is identified by its label.</p></li>
<li><p>Each element is either a <i class="term"><a href="../../../../index.html#key537">reference</a></i>, or a <i class="term">division</i>.</p></li>
<li><p>Each reference has an associated document, identified by a symbolic
id, and a textual description.</p></li>
<li><p>Each division may have an associated document, identified by a
symbolic id.</p></li>
<li><p>Each division consists consists of a (possibly empty) list of
<i class="term">elements</i>, with each element following the rules as specified in
item 2 and above.</p></li>
</ol>
<p>A few notes</p>
<ol class="enumerated">
<li><p>The above rules span up a tree of elements, with references as the
leaf nodes, and divisions as the inner nodes, and each element
representing an entry in the whole table of contents.</p></li>
<li><p>The identifying labels of any element E are unique within their
division (or toc), and the full label of any element E is the list of
labels for all nodes on the unique path from the root of the tree to
E, including E.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::toc::export</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new export manager object with an associated
Tcl command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command
is explained in full detail in the sections <span class="sectref"><a href="#subsection2">Object command</a></span>
and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::doctools::toc::export</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">export serial</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method takes the canonical serialization of a table of contents
stored in <i class="arg">serial</i> and converts it to the specified <i class="arg">format</i>,
using the export plugin for the format. An error is thrown if no
plugin could be found for the format.
The string generated by the conversion process is returned as
the result of this method.</p>
<p>If no format is specified the method defaults to <b class="const">doctoc</b>.</p>
<p>The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section5">ToC serialization format</a></span>.</p>
<p>The plugin has to conform to the interface specified in section
<span class="sectref"><a href="#section4">Export plugin API v2 reference</a></span>.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">export object</b> <i class="arg">object</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">export serial</b>
method described by the previous item.
It expects that <i class="arg">object</i> is an object command supporting a
<b class="method">serialize</b> method returning the canonical serialization of a
table of contents. It invokes that method, feeds the result into
<b class="method">export serial</b> and returns the resulting string as its own
result.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">config names</b></a></dt>
<dd><p>This method returns a list containing the names of all configuration
variables currently known to the object.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">config get</b></a></dt>
<dd><p>This method returns a dictionary containing the names and values of
all configuration variables currently known to the object.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">config set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>This method sets the configuration variable <i class="arg">name</i> to the
specified <i class="arg">value</i> and returns the new value of the variable.</p>
<p>If no value is specified it simply returns the current value, without
changing it.</p>
<p>Note that while the user can set the predefined configuration
variables <b class="const">user</b> and <b class="const">format</b> doing so will have no
effect, these values will be internally overriden when invoking an
import plugin.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">config unset</b> <i class="arg">pattern</i>...</a></dt>
<dd><p>This method unsets all configuration variables matching the specified
glob <i class="arg">pattern</i>s. If no pattern is specified it will unset all
currently defined configuration variables.</p></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Export plugin API v2 reference</a></h2>
<p>Plugins are what this package uses to manage the support for any
output format beyond the <span class="sectref"><a href="#section5">ToC serialization format</a></span>. Here we
specify the API the objects created by this package use to interact
with their plugins.</p>
<p>A plugin for this package has to follow the rules listed below:</p>
<ol class="enumerated">
<li><p>A plugin is a package.</p></li>
<li><p>The name of a plugin package has the form
		doctools::toc::export::<b class="variable">FOO</b>,
       where <b class="variable">FOO</b> is the name of the format the plugin will
       generate output for. This name is also the argument to provide
       to the various <b class="method">export</b> methods of export manager
       objects to get a string encoding a table of contents in that
       format.</p></li>
<li><p>The plugin can expect that the package
       <b class="package">doctools::toc::export::plugin</b> is present, as
       indicator that it was invoked from a genuine plugin manager.</p></li>
<li><p>A plugin has to provide one command, with the signature shown
       below.</p>
<dl class="definitions">
<dt><a name="10"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>Whenever an export manager of <b class="package"><a href="container.html">doctools::toc</a></b> has to generate
output for a table of contents it will invoke this command.</p>
<dl class="arguments">
<dt>string <i class="arg">serial</i></dt>
<dd><p>This argument will contain the <i class="term">canonical</i> serialization of the
table of contents for which to generate the output.
The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section5">ToC serialization format</a></span>.</p></dd>
<dt>dictionary <i class="arg">configuration</i></dt>
<dd><p>This argument will contain the current configuration to apply to the
generation, as a dictionary mapping from variable names to values.</p>
<p>The following configuration variables have a predefined meaning all
plugins have to obey, although they can ignore this information at
their discretion. Any other other configuration variables recognized
by a plugin will be described in the manpage for that plugin.</p>
<dl class="definitions">
<dt>user</dt>
<dd><p>This variable is expected to contain the name of the user
           owning the process invoking the plugin.</p></dd>
<dt>format</dt>
<dd><p>This variable is expected to contain the name of the
             format whose plugin is invoked.</p></dd>
<dt>file</dt>
<dd><p>This variable, if defined by the user of the table object
           is expected to contain the name of the input file for which
           the plugin is generating its output for.</p></dd>
<dt>map</dt>
<dd><p>This variable, if defined by the user of the table object is
          expected to contain a dictionary mapping from symbolic
          document ids used in the table entries to actual paths (or
          urls). A plugin has to be able to handle the possibility
          that a document id is without entry in this mapping.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
<li><p>A single usage cycle of a plugin consists of the invokations of
       the command <b class="cmd"><a href="../../../../index.html#key148">export</a></b>. This call has to leave the plugin in
       a state where another usage cycle can be run without problems.</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key536">generation</a>, <a href="../../../../index.html#key172">json</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key537">reference</a>, <a href="../../../../index.html#key104">table</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key535">tcler's wiki</a>, <a href="../../../../index.html#key454">text</a>, <a href="../../../../index.html#key483">url</a>, <a href="../../../../index.html#key164">wiki</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/export_doctoc.html.





































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::export::doctoc - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/export_doctoc.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::export::doctoc.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::export::doctoc(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::export::doctoc - doctoc export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">[doctoc] notation of tables of contents</a></li>
<li class="section"><a href="#section4">Configuration</a></li>
<li class="section"><a href="#section5">ToC serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::export::doctoc <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools table of contents export plugin
for the generation of doctoc markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially <b class="package"><a href="export.html">doctools::toc::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::toc::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a table of contents,
as specified in section <span class="sectref"><a href="#section5">ToC serialization format</a></span>, and
contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary, and
generates doctoc markup encoding the table.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">[doctoc] notation of tables of contents</a></h2>
<p>The doctoc format for tables of contents, also called the
<i class="term">doctoc markup language</i>, is too large to be covered in single
section.
The interested reader should start with the document</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/doctoc_lang_intro.html">doctoc language introduction</a></i></p></li>
</ol>
<p>and then proceed from there to the formal specifications, i.e. the
documents</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/doctoc_lang_syntax.html">doctoc language syntax</a></i> and</p></li>
<li><p><i class="term"><a href="../doctools/doctoc_lang_cmdref.html">doctoc language command reference</a></i>.</p></li>
</ol>
<p>to get a thorough understanding of the language.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Configuration</a></h2>
<p>The doctoc export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>string <i class="arg">user</i></dt>
<dd><p>This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.</p></dd>
<dt>string <i class="arg">file</i></dt>
<dd><p>This standard configuration variable contains the name of the file the
table of contents came from. This variable may not be set or contain
the empty string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.</p></dd>
<dt>boolean <i class="arg">newlines</i></dt>
<dd><p>If this flag is set the plugin will break the generated doctoc code
across lines, with each markup command on a separate line.</p>
<p>If this flag is not set (the default), the whole document will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt>boolean <i class="arg">indented</i></dt>
<dd><p>If this flag is set the plugin will indent the markup commands
according to the structure of tables of contents. To make this work
this also implies that <b class="variable">newlines</b> is set. This effect is
independent of the value for <b class="variable">aligned</b> however.</p>
<p>If this flag is not set (the default), the output is formatted as per
the value of <b class="variable">newlines</b>, and no indenting is done.</p></dd>
<dt>boolean <i class="arg">aligned</i></dt>
<dd><p>If this flag is set the generator ensures that the arguments for the
<b class="cmd">item</b> commands in a division are aligned vertically for a nice
table effect. To make this work this also implies that <b class="variable">newlines</b>
is set. This effect is independent of the value for <b class="variable">indented</b>
however.</p>
<p>If this flag is not set (the default), the output is formatted as per
the values of <b class="variable">newlines</b> and <b class="variable">indented</b>, and no alignment is
done.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">format</b>, and <b class="variable">map</b>, and their values.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/export_html.html.






































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::export::html - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/export_html.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::export::html.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::export::html(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::export::html - HTML export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">ToC serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::export::html <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">doctools::text</b></li>
<li>package require <b class="pkgname">doctools::html</b></li>
<li>package require <b class="pkgname">doctools::html::cssdefaults</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools table of contents export plugin
for the generation of HTML markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially <b class="package"><a href="export.html">doctools::toc::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::toc::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a table of contents,
as specified in section <span class="sectref"><a href="#section4">ToC serialization format</a></span>, and
contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary, and
generates HTML markup encoding the table.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The html export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>string <i class="arg">user</i></dt>
<dd><p>This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.</p></dd>
<dt>string <i class="arg">file</i></dt>
<dd><p>This standard configuration variable contains the name of the file the
table of contents came from. This variable may not be set or contain
the empty string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.</p></dd>
<dt>dictionary <i class="arg">map</i></dt>
<dd><p>This standard configuration variable contains a dictionary mapping
from the (symbolic) document ids in reference entries to the actual
filenames and/or urls to be used in the output.</p>
<p>Document ids without a mapping are used unchanged.</p></dd>
<dt>boolean <i class="arg">newlines</i></dt>
<dd><p>If this flag is set the plugin will break the generated html code
across lines, with each markup command on a separate line.</p>
<p>If this flag is not set (the default), the whole document will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt>boolean <i class="arg">indented</i></dt>
<dd><p>If this flag is set the plugin will indent the markup commands
according to the structure of indices. To make this work this also
implies that <b class="variable">newlines</b> is set.</p>
<p>If this flag is not set (the default), the output is formatted as per
the value of <b class="variable">newlines</b>, and no indenting is done.</p></dd>
<dt>string <i class="arg">meta</i></dt>
<dd><p>This variable is meant to hold a fragment of HTML (default: empty).
The fragment it contains will be inserted into the generated output in
the &lt;head&gt; section of the document, just after the &lt;title&gt; tag.</p></dd>
<dt>string <i class="arg">header</i></dt>
<dd><p>This variable is meant to hold a fragment of HTML (default: empty).
The fragment it contains will be inserted into the generated output
just after the &lt;h1&gt; title tag in the body of the document, in the
class.header &lt;div&gt;'ision.</p></dd>
<dt>string <i class="arg">footer</i></dt>
<dd><p>This variable is meant to hold a fragment of HTML (default:
empty). The fragment it contains will be inserted into the generated
output just before the &lt;/body&gt; tag, in the class.footer &lt;div&gt;'ision.</p></dd>
<dt>dictionary <i class="arg">rid</i></dt>
<dd><p>The value of this variable (default: empty) maps references to the
identifiers to use as their anchor names. Each reference <b class="variable">FOO</b> not
found in the dictionary uses <b class="const">REF-</b><b class="variable">FOO</b> as anchor,
i.e. itself prefixed with the string <b class="const">REF-</b>.</p></dd>
<dt>string <i class="arg">sepline</i></dt>
<dd><p>The value of this variable is the string to use for the separator
comments inserted into the output when the outpout is broken across
lines and/or indented. The default string consists of 60 dashes.</p></dd>
<dt>string <i class="arg">class.main</i></dt>
<dd><p>This variable contains the class name for the main &lt;div&gt;'ivision of
the generated document. The default is <b class="const">doctools</b>.</p></dd>
<dt>string <i class="arg">class.header</i></dt>
<dd><p>This variable contains the class name for the header &lt;div&gt;'ision of
the generated document. The default is <b class="const">toc-header</b>.  This
division contains the document title, the user specified <b class="variable">header</b>,
if any, and a visible separator line.</p></dd>
<dt>string <i class="arg">class.title</i></dt>
<dd><p>This variable contains the class name for the &lt;h1&gt; tag enclosing the
document title. The default is <b class="const">toc-title</b>.</p></dd>
<dt>string <i class="arg">class.navsep</i></dt>
<dd><p>This variable contains the class name for the &lt;hr&gt; separators in the
header and footer sections of the generated document. The default is
<b class="const">toc-navsep</b>.</p></dd>
<dt>string <i class="arg">class.contents</i></dt>
<dd><p>This variable contains the class name for the XXXXX holding the
keywords and their references in the generated document. The default
is <b class="const">toc-contents</b>.</p></dd>
<dt>string <i class="arg">class.ref</i></dt>
<dd><p>This variable contains the class name for the table elements which are
references to other documents. The default is <b class="const">toc-ref</b>.</p></dd>
<dt>string <i class="arg">class.div</i></dt>
<dd><p>This variable contains the class name for the table elements which are
divisions. The default is <b class="const">toc-div</b>.</p></dd>
<dt>string <i class="arg">class.footer</i></dt>
<dd><p>This variable contains the class name for the footer &lt;div&gt;'ision of
the generated document. The default is <b class="const">toc-footer</b>. This
division contains a browser-visible separator line and the user
specified <b class="variable">footer</b>, if any.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variable <b class="variable">format</b>, and its value.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key1">HTML</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/export_json.html.









































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::export::json - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/export_json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::export::json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::export::json(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::export::json - JSON export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">JSON notation of tables of contents</a></li>
<li class="section"><a href="#section4">Configuration</a></li>
<li class="section"><a href="#section5">ToC serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::export::json <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">textutil::adjust</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools table of contents export plugin
for the generation of JSON markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially <b class="package"><a href="export.html">doctools::toc::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::toc::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a table of contents,
as specified in section <span class="sectref"><a href="#section5">ToC serialization format</a></span>, and
contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary, and
generates JSON markup encoding the table.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">JSON notation of tables of contents</a></h2>
<p>The JSON format used for tables of contents is a direct translation of
the <span class="sectref"><a href="#section5">ToC serialization format</a></span>, mapping Tcl dictionaries as
JSON objects and Tcl lists as JSON arrays.
For example, the Tcl serialization</p>
<pre class="example">
doctools::toc {
    items {
        {reference {
	    desc {DocTools - Tables of Contents}
	     id introduction.man
	     label doctools::toc::introduction
	}}
	{division {
	     id processing.man
	     items {
	         {reference {
		     desc {doctoc serialization utilities}
		     id structure.man
		     label doctools::toc::structure
		 }}
		 {reference {
		     desc {Parsing text in doctoc format}
		     id parse.man
		     label doctools::toc::parse
		 }}
	     }
             label Processing
        }}
    }
    label {Table of Contents} 
    title TOC
}
</pre>
<p>is equivalent to the JSON string</p>
<pre class="example">
{
    &quot;doctools::toc&quot; : {
        &quot;items&quot; : [{
            &quot;reference&quot; : {
                &quot;desc&quot;  : &quot;DocTools - Tables of Contents&quot;,
                &quot;id&quot;    : &quot;introduction.man&quot;,
                &quot;label&quot; : &quot;doctools::toc::introduction&quot;
            }
        },{
            &quot;division&quot; : {
                &quot;id&quot;    : &quot;processing.man&quot;,
                &quot;items&quot; : [{
                    &quot;reference&quot; : {
                        &quot;desc&quot;  : &quot;doctoc serialization utilities&quot;,
                        &quot;id&quot;    : &quot;structure.man&quot;,
                        &quot;label&quot; : &quot;doctools::toc::structure&quot;
                    }
                },{
                    &quot;reference&quot; : {
                        &quot;desc&quot;  : &quot;Parsing text in doctoc format&quot;,
                        &quot;id&quot;    : &quot;parse.man&quot;,
                        &quot;label&quot; : &quot;doctools::toc::parse&quot;
                    }
                }],
                &quot;label&quot; : &quot;Processing&quot;
            }
        }],
        &quot;label&quot; : &quot;Table of Contents&quot;,
        &quot;title&quot; : &quot;TOC&quot;
    }
}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Configuration</a></h2>
<p>The JSON export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>boolean <i class="arg">indented</i></dt>
<dd><p>If this flag is set the plugin will break the generated JSON code
across lines and indent it according to its inner structure, with each
key of a dictionary on a separate line.</p>
<p>If this flag is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt>boolean <i class="arg">aligned</i></dt>
<dd><p>If this flag is set the generator ensures that the values for the keys
in a dictionary are vertically aligned with each other, for a nice
table effect. To make this work this also implies that <b class="variable">indented</b>
is set.</p>
<p>If this flag is not set (the default), the output is formatted as per
the value of <b class="variable">indented</b>, without trying to align the values for
dictionary keys.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">user</b>, <b class="variable">format</b>, <b class="variable">file</b>, and <b class="variable">map</b> and
their values.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key232">JSON</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/export_nroff.html.







































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::export::nroff - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/export_nroff.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::export::nroff.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::export::nroff(n) 0.2 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::export::nroff - nroff export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">ToC serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::export::nroff <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">doctools::text</b></li>
<li>package require <b class="pkgname">doctools::nroff::man_macros</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools table of contents export plugin
for the generation of nroff markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially <b class="package"><a href="export.html">doctools::toc::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::toc::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a table of contents,
as specified in section <span class="sectref"><a href="#section4">ToC serialization format</a></span>, and
contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary, and
generates nroff markup encoding the table.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The nroff export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>string <i class="arg">user</i></dt>
<dd><p>This standard configuration variable contains the name of the user
running the process which invoked the export plugin.
The plugin puts this information into the provenance comment at the
beginning of the generated document.</p></dd>
<dt>string <i class="arg">file</i></dt>
<dd><p>This standard configuration variable contains the name of the file the
table of contents came from. This variable may not be set or contain
the empty string.
The plugin puts this information, if defined, i.e. set and not the
empty string, into the provenance comment at the beginning of the
generated document.</p></dd>
<dt>boolean <i class="arg">inline</i></dt>
<dd><p>If this flag is set (default) the plugin will place the definitions of
the man macro set directly into the output.</p>
<p>If this flag is not set, the plugin will place a reference to the
definitions of the man macro set into the output, but not the macro
definitions themselves.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">format</b>, and <b class="variable">map</b>, and their values.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key5">nroff</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/export_text.html.

























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::export::text - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/export_text.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::export::text.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::export::text(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::export::text - plain text export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">ToC serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::export::text <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">doctools::text</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools table of contents export plugin
for the generation of plain text markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially <b class="package"><a href="export.html">doctools::toc::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::toc::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a table of contents,
as specified in section <span class="sectref"><a href="#section4">ToC serialization format</a></span>, and
contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary, and
generates plain text markup encoding the table.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The text export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>dictionary <i class="arg">map</i></dt>
<dd><p>This standard configuration variable contains a dictionary mapping
from the (symbolic) document ids in reference entries to the actual
filenames and/or urls to be used in the output.</p>
<p>Document ids without a mapping are used unchanged.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">user</b>, <b class="variable">file</b>, and <b class="variable">format</b>, and their values.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key147">plain text</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/export_wiki.html.
































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::export::wiki - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/export_wiki.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::export::wiki.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::export::wiki(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::export::wiki - wiki export plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Wiki markup</a></li>
<li class="section"><a href="#section4">Configuration</a></li>
<li class="section"><a href="#section5">ToC serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::export::wiki <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">doctools::text</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools table of contents export plugin
for the generation of wiki markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially <b class="package"><a href="export.html">doctools::toc::export</a></b>, the export manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="export.html">doctools::toc::export</a></b> and the export manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
doctoc export plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a table of contents,
as specified in section <span class="sectref"><a href="#section5">ToC serialization format</a></span>, and
contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary, and
generates wiki markup encoding the table.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Wiki markup</a></h2>
<p>The basic syntax of the wiki markup generated by this plugin are
described at <a href="http://wiki.tcl.tk/14">http://wiki.tcl.tk/14</a>.</p>
<p>The plugin goes beyond the classic markup to generate proper headers
and indenting.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Configuration</a></h2>
<p>The wiki export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>dictionary <i class="arg">map</i></dt>
<dd><p>This standard configuration variable contains a dictionary mapping
from the (symbolic) document ids in reference entries to the actual
filenames and/or urls to be used in the output.</p>
<p>Document ids without a mapping are used unchanged.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">user</b>, <b class="variable">file</b> and <b class="variable">format</b>, and their values.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a>, <a href="../../../../index.html#key164">wiki</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/import.html.

























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::import - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/import.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::import.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::import(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::import - Importing keyword indices</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Concepts</a></li>
<li class="section"><a href="#section3">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Import plugin API v2 reference</a></li>
<li class="section"><a href="#section5">ToC serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::toc::import <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::config</b></li>
<li>package require <b class="pkgname">doctools::toc::structure</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">pluginmgr</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::toc::import</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">import text</b> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">import file</b> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">import object text</b> <i class="arg">object</i> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">import object file</b> <i class="arg">object</i> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">config names</b></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">config get</b></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">config set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">config unset</b> <i class="arg">pattern</i>...</a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">includes</b></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">include add</b> <i class="arg">path</i></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">include remove</b> <i class="arg">path</i></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">include clear</b></a></li>
<li><a href="#16"><b class="cmd">IncludeFile</b> <i class="arg">currentfile</i> <i class="arg">path</i></a></li>
<li><a href="#17"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">text</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class to manage the plugins for the import of
tables of contents from other formats, i.e. their conversion from, for
example <i class="term"><a href="../../../../index.html#key230">doctoc</a></i>, <i class="term"><a href="../../../../index.html#key172">json</a></i>, etc.</p>
<p>This is one of the three public pillars the management of tables of
contents resides on. The other two pillars are</p>
<ol class="enumerated">
<li><p><i class="term"><a href="export.html">Exporting tables of contents</a></i>, and</p></li>
<li><p><i class="term"><a href="container.html">Holding tables of contents</a></i></p></li>
</ol>
<p>For information about the <span class="sectref"><a href="#section2">Concepts</a></span> of tables of contents,
and their parts, see the same-named section.
For information about the data structure which is the major output of
the manager objects provided by this package see the section
<span class="sectref"><a href="#section5">ToC serialization format</a></span>.</p>
<p>The plugin system of our class is based on the package
<b class="package"><a href="../pluginmgr/pluginmgr.html">pluginmgr</a></b>, and configured to look for plugins using</p>
<ol class="enumerated">
<li><p>the environment variable <b class="variable">DOCTOOLS_TOC_IMPORT_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">DOCTOOLS_TOC_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">DOCTOOLS_PLUGINS</b>,</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/toc/import/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/toc/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/toc/import/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/toc/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.doctools/plugins</b>&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\TOC\IMPORT\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\TOC\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\DOCTOOLS\PLUGINS&quot;</p></li>
</ol>
<p>The last three are used only when the package is run on a machine
using Windows(tm) operating system.</p>
<p>The whole system is delivered with two predefined import plugins,
namely</p>
<dl class="definitions">
<dt>doctoc</dt>
<dd><p>See <i class="term"><a href="import_doctoc.html">doctoc import plugin</a></i> for details.</p></dd>
<dt>json</dt>
<dd><p>See <i class="term">json import plugin</i> for details.</p></dd>
</dl>
<p>Readers wishing to write their own import plugin for some format, i.e.
<i class="term">plugin writer</i>s reading and understanding the section
containing the <span class="sectref"><a href="#section4">Import plugin API v2 reference</a></span> is an
absolute necessity, as it specifies the interaction between this
package and its plugins in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Concepts</a></h2>
<ol class="enumerated">
<li><p>A <i class="term"><a href="../../../../index.html#key150">table of contents</a></i> consists of a (possibly empty) list of
<i class="term">elements</i>.</p></li>
<li><p>Each element in the list is identified by its label.</p></li>
<li><p>Each element is either a <i class="term"><a href="../../../../index.html#key537">reference</a></i>, or a <i class="term">division</i>.</p></li>
<li><p>Each reference has an associated document, identified by a symbolic
id, and a textual description.</p></li>
<li><p>Each division may have an associated document, identified by a
symbolic id.</p></li>
<li><p>Each division consists consists of a (possibly empty) list of
<i class="term">elements</i>, with each element following the rules as specified in
item 2 and above.</p></li>
</ol>
<p>A few notes</p>
<ol class="enumerated">
<li><p>The above rules span up a tree of elements, with references as the
leaf nodes, and divisions as the inner nodes, and each element
representing an entry in the whole table of contents.</p></li>
<li><p>The identifying labels of any element E are unique within their
division (or toc), and the full label of any element E is the list of
labels for all nodes on the unique path from the root of the tree to
E, including E.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::toc::import</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new import manager object with an associated
Tcl command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command
is explained in full detail in the sections <span class="sectref"><a href="#subsection2">Object command</a></span>
and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::doctools::toc::import</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">import text</b> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method takes the <i class="arg">text</i> and converts it from the specified
<i class="arg">format</i> to the canonical serialization of a table of contents using
the import plugin for the format. An error is thrown if no plugin
could be found for the format.
The serialization generated by the conversion process is returned as
the result of this method.</p>
<p>If no format is specified the method defaults to <b class="const">doctoc</b>.</p>
<p>The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section5">ToC serialization format</a></span>.</p>
<p>The plugin has to conform to the interface specified in section
<span class="sectref"><a href="#section4">Import plugin API v2 reference</a></span>.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">import file</b> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">import text</b>
method described by the previous item.
It reads the contents of the specified file into memory, feeds the
result into <b class="method">import text</b> and returns the resulting
serialization as its own result.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">import object text</b> <i class="arg">object</i> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">import text</b>
method described by the previous item.
It expects that <i class="arg">object</i> is an object command supporting a
<b class="method">deserialize</b> method expecting the canonical serialization of a
table of contents.
It imports the text using <b class="method">import text</b> and then feeds the
resulting serialization into the <i class="arg">object</i> via <b class="method">deserialize</b>.
This method returns the empty string as it result.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">import object file</b> <i class="arg">object</i> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method behaves like <b class="method">import object text</b>, except that it
reads the text to convert from the specified file instead of being
given it as argument.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">config names</b></a></dt>
<dd><p>This method returns a list containing the names of all configuration
variables currently known to the object.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">config get</b></a></dt>
<dd><p>This method returns a dictionary containing the names and values of
all configuration variables currently known to the object.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">config set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>This method sets the configuration variable <i class="arg">name</i> to the
specified <i class="arg">value</i> and returns the new value of the variable.</p>
<p>If no value is specified it simply returns the current value, without
changing it.</p>
<p>Note that while the user can set the predefined configuration
variables <b class="const">user</b> and <b class="const">format</b> doing so will have no
effect, these values will be internally overriden when invoking an
import plugin.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">config unset</b> <i class="arg">pattern</i>...</a></dt>
<dd><p>This method unsets all configuration variables matching the specified
glob <i class="arg">pattern</i>s. If no pattern is specified it will unset all
currently defined configuration variables.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">includes</b></a></dt>
<dd><p>This method returns a list containing the currently specified paths to
use to search for include files when processing input.
The order of paths in the list corresponds to the order in which they
are used, from first to last, and also corresponds to the order in
which they were added to the object.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">include add</b> <i class="arg">path</i></a></dt>
<dd><p>This methods adds the specified <i class="arg">path</i> to the list of paths to use
to search for include files when processing input. The path is added
to the end of the list, causing it to be searched after all previously
added paths. The result of the command is the empty string.</p>
<p>The method does nothing if the path is already known.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">include remove</b> <i class="arg">path</i></a></dt>
<dd><p>This methods removes the specified <i class="arg">path</i> from the list of paths
to use to search for include files when processing input. The result
of the command is the empty string.</p>
<p>The method does nothing if the path is not known.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">include clear</b></a></dt>
<dd><p>This method clears the list of paths to use to search for include
files when processing input. The result of the command is the empty
string.</p></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Import plugin API v2 reference</a></h2>
<p>Plugins are what this package uses to manage the support for any input
format beyond the <span class="sectref"><a href="#section5">ToC serialization format</a></span>. Here we
specify the API the objects created by this package use to interact
with their plugins.</p>
<p>A plugin for this package has to follow the rules listed below:</p>
<ol class="enumerated">
<li><p>A plugin is a package.</p></li>
<li><p>The name of a plugin package has the form
		doctools::toc::import::<b class="variable">FOO</b>,
       where <b class="variable">FOO</b> is the name of the format the plugin will
       generate output for. This name is also the argument to provide
       to the various <b class="method">import</b> methods of import manager
       objects to get a string encoding a table of contents in that
       format.</p></li>
<li><p>The plugin can expect that the package
       <b class="package">doctools::toc::export::plugin</b> is present, as
       indicator that it was invoked from a genuine plugin manager.</p></li>
<li><p>The plugin can expect that a command named <b class="cmd">IncludeFile</b> is
       present, with the signature</p>
<dl class="definitions">
<dt><a name="16"><b class="cmd">IncludeFile</b> <i class="arg">currentfile</i> <i class="arg">path</i></a></dt>
<dd><p>This command has to be invoked by the plugin when it has to process an
included file, if the format has the concept of such. An example of
such a format would be <i class="term"><a href="../../../../index.html#key230">doctoc</a></i>.</p>
<p>The plugin has to supply the following arguments</p>
<dl class="arguments">
<dt>string <i class="arg">currentfile</i></dt>
<dd><p>The path of the file it is currently processing. This may be the empty
string if no such is known.</p></dd>
<dt>string <i class="arg">path</i></dt>
<dd><p>The path of the include file as specified in the include directive
being processed.</p></dd>
</dl>
<p>The result of the command will be a 5-element list containing</p>
<ol class="enumerated">
<li><p>A boolean flag indicating the success (<b class="const">True</b>) or failure
       (<b class="const">False</b>) of the operation.</p></li>
<li><p>In case of success the contents of the included file, and the
       empty string otherwise.</p></li>
<li><p>The resolved, i.e. absolute path of the included file, if
       possible, or the unchanged <i class="arg">path</i> argument. This is for
       display in an error message, or as the <i class="arg">currentfile</i>
       argument of another call to <b class="cmd">IncludeFile</b> should this file
       contain more files.</p></li>
<li><p>In case of success an empty string, and for failure a code
       indicating the reason for it, one of</p>
<dl class="definitions">
<dt>notfound</dt>
<dd><p>The specified file could not be found.</p></dd>
<dt>notread</dt>
<dd><p>The specified file was found, but not be read into memory.</p></dd>
</dl>
</li>
<li><p>An empty string in case of success of a <b class="const">notfound</b>
       failure, and an additional error message describing the reason
       for a <b class="const">notread</b> error in more detail.</p></li>
</ol></dd>
</dl>
</li>
<li><p>A plugin has to provide one command, with the signature shown
       below.</p>
<dl class="definitions">
<dt><a name="17"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">text</i> <i class="arg">configuration</i></a></dt>
<dd><p>Whenever an import manager of <b class="package"><a href="container.html">doctools::toc</a></b> has to parse
input for a table of contents it will invoke this command.</p>
<dl class="arguments">
<dt>string <i class="arg">text</i></dt>
<dd><p>This argument will contain the text encoding the table of contents per
the format the plugin is for.</p></dd>
<dt>dictionary <i class="arg">configuration</i></dt>
<dd><p>This argument will contain the current configuration to apply to the
parsing, as a dictionary mapping from variable names to values.</p>
<p>The following configuration variables have a predefined meaning all
plugins have to obey, although they can ignore this information at
their discretion. Any other other configuration variables recognized
by a plugin will be described in the manpage for that plugin.</p>
<dl class="definitions">
<dt>user</dt>
<dd><p>This variable is expected to contain the name of the user
           owning the process invoking the plugin.</p></dd>
<dt>format</dt>
<dd><p>This variable is expected to contain the name of the
             format whose plugin is invoked.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
<li><p>A single usage cycle of a plugin consists of the invokations of
       the command <b class="cmd"><a href="../../../../index.html#key247">import</a></b>. This call has to leave the plugin in
       a state where another usage cycle can be run without problems.</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key166">documentation</a>, <a href="../../../../index.html#key247">import</a>, <a href="../../../../index.html#key172">json</a>, <a href="../../../../index.html#key2">manpage</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key537">reference</a>, <a href="../../../../index.html#key104">table</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key483">url</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/import_doctoc.html.







































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::import::doctoc - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/import_doctoc.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::import::doctoc.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::import::doctoc(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::import::doctoc - doctoc import plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">[doctoc] notation of tables of contents</a></li>
<li class="section"><a href="#section4">ToC serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::import::doctoc <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">doctools::toc::parse</b></li>
<li>package require <b class="pkgname">doctools::toc::structure</b></li>
<li>package require <b class="pkgname">doctools::msgcat</b></li>
<li>package require <b class="pkgname">doctools::tcl::parse</b></li>
<li>package require <b class="pkgname">fileutil</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">struct::set</b></li>
<li>package require <b class="pkgname">struct::stack</b></li>
<li>package require <b class="pkgname">struct::tree</b></li>
<li>package require <b class="pkgname">treeql</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">string</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools table of contents import plugin
for the parsing of doctoc markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially <b class="package"><a href="import.html">doctools::toc::import</a></b>, the import manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="import.html">doctools::toc::import</a></b> and the import manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
doctoc import plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">string</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the <i class="arg">string</i> and parses it as doctoc
markup encoding a table of contents, in the context of the specified
<i class="arg">configuration</i> (a dictionary). The result of the command is the
canonical serialization of that table of contents, in the form
specified in section <span class="sectref"><a href="#section4">ToC serialization format</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">[doctoc] notation of tables of contents</a></h2>
<p>The doctoc format for tables of contents, also called the
<i class="term">doctoc markup language</i>, is too large to be covered in single
section.
The interested reader should start with the document</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/doctoc_lang_intro.html">doctoc language introduction</a></i></p></li>
</ol>
<p>and then proceed from there to the formal specifications, i.e. the
documents</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/doctoc_lang_syntax.html">doctoc language syntax</a></i> and</p></li>
<li><p><i class="term"><a href="../doctools/doctoc_lang_cmdref.html">doctoc language command reference</a></i>.</p></li>
</ol>
<p>to get a thorough understanding of the language.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key231">deserialization</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key247">import</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/import_json.html.


















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::import::json - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/import_json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::import::json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::import::json(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::import::json - JSON import plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">JSON notation of tables of contents</a></li>
<li class="section"><a href="#section4">ToC serialization format</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::import::json <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">doctools::toc::structure</b></li>
<li>package require <b class="pkgname">json</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">string</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements the doctools table of contents import plugin
for the parsing of JSON markup.</p>
<p>This is an internal package of doctools, for use by the higher level
management packages handling tables of contents, especially <b class="package"><a href="import.html">doctools::toc::import</a></b>, the import manager.</p>
<p>Using it from a regular interpreter is possible, however only with
contortions, and is not recommended.
The proper way to use this functionality is through the package
<b class="package"><a href="import.html">doctools::toc::import</a></b> and the import manager objects it
provides.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
doctoc import plugin API version 2.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">string</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the <i class="arg">string</i> and parses it as JSON
markup encoding a table of contents, in the context of the specified
<i class="arg">configuration</i> (a dictionary). The result of the command is the
canonical serialization of that table of contents, in the form
specified in section <span class="sectref"><a href="#section4">ToC serialization format</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">JSON notation of tables of contents</a></h2>
<p>The JSON format used for tables of contents is a direct translation of
the <span class="sectref"><a href="#section4">ToC serialization format</a></span>, mapping Tcl dictionaries as
JSON objects and Tcl lists as JSON arrays.
For example, the Tcl serialization</p>
<pre class="example">
doctools::toc {
    items {
        {reference {
	    desc {DocTools - Tables of Contents}
	     id introduction.man
	     label doctools::toc::introduction
	}}
	{division {
	     id processing.man
	     items {
	         {reference {
		     desc {doctoc serialization utilities}
		     id structure.man
		     label doctools::toc::structure
		 }}
		 {reference {
		     desc {Parsing text in doctoc format}
		     id parse.man
		     label doctools::toc::parse
		 }}
	     }
             label Processing
        }}
    }
    label {Table of Contents} 
    title TOC
}
</pre>
<p>is equivalent to the JSON string</p>
<pre class="example">
{
    &quot;doctools::toc&quot; : {
        &quot;items&quot; : [{
            &quot;reference&quot; : {
                &quot;desc&quot;  : &quot;DocTools - Tables of Contents&quot;,
                &quot;id&quot;    : &quot;introduction.man&quot;,
                &quot;label&quot; : &quot;doctools::toc::introduction&quot;
            }
        },{
            &quot;division&quot; : {
                &quot;id&quot;    : &quot;processing.man&quot;,
                &quot;items&quot; : [{
                    &quot;reference&quot; : {
                        &quot;desc&quot;  : &quot;doctoc serialization utilities&quot;,
                        &quot;id&quot;    : &quot;structure.man&quot;,
                        &quot;label&quot; : &quot;doctools::toc::structure&quot;
                    }
                },{
                    &quot;reference&quot; : {
                        &quot;desc&quot;  : &quot;Parsing text in doctoc format&quot;,
                        &quot;id&quot;    : &quot;parse.man&quot;,
                        &quot;label&quot; : &quot;doctools::toc::parse&quot;
                    }
                }],
                &quot;label&quot; : &quot;Processing&quot;
            }
        }],
        &quot;label&quot; : &quot;Table of Contents&quot;,
        &quot;title&quot; : &quot;TOC&quot;
    }
}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key232">JSON</a>, <a href="../../../../index.html#key231">deserialization</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key247">import</a>, <a href="../../../../index.html#key150">table of contents</a>, <a href="../../../../index.html#key149">toc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text formatter plugin</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/introduction.html.


































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools2toc_introduction - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/introduction.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools2toc_introduction.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools2toc_introduction(n) 2.0 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools2toc_introduction - DocTools - Tables of Contents</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Related formats</a></li>
<li class="section"><a href="#section3">Package Overview</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><i class="term"><a href="../../../../index.html#key230">doctoc</a></i> (short for <em>documentation tables of contents</em>)
stands for a set of related, yet different, entities which are working
together for the easy creation and transformation of tables and
contents for documentation.</p>
<p>These are</p>
<ol class="enumerated">
<li><p>A tcl based language for the semantic markup of a table of contents.
Markup is represented by Tcl commands.
Beginners should start with the
<i class="term"><a href="../doctools/doctoc_lang_intro.html">doctoc language introduction</a></i>.
The formal specification is split over two documents, one dealing with
the <i class="term"><a href="../doctools/doctoc_lang_syntax.html">doctoc language syntax</a></i>, the other a
<i class="term"><a href="../doctools/doctoc_lang_cmdref.html">doctoc language command reference</a></i>.</p></li>
<li><p>A set of packages for the programmatic manipulation of tables of
contents in memory, and their conversion between various formats,
reading and writing. The aforementioned markup language is one of the
formats which can be both read from and written to.</p></li>
<li><p>The system for the conversion of tables of contents is based on a
plugin mechanism, for this we have two APIs describing the interface
between the packages above and the import/export plugins.</p></li>
</ol>
<p>Which of the more detailed documents are relevant to the reader of
this introduction depends on their role in the documentation process.</p>
<ol class="enumerated">
<li><p>A <i class="term">writer</i> of documentation has to understand the markup language
itself. A beginner to doctoc should read the more informally written
<i class="term"><a href="../doctools/doctoc_lang_intro.html">doctoc language introduction</a></i> first. Having digested this
the formal <i class="term"><a href="../doctools/doctoc_lang_syntax.html">doctoc language syntax</a></i> specification should
become understandable. A writer experienced with doctoc may only
need the <i class="term"><a href="../doctools/doctoc_lang_cmdref.html">doctoc language command reference</a></i> from time to
time to refresh her memory.</p>
<p>While a document is written the <b class="syscmd">dtp</b> application can be used
to validate it, and after completion it also performs the conversion
into the chosen system of visual markup, be it *roff, HTML, plain
text, wiki, etc. The simpler <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> application makes
internal use of doctoc when handling directories of documentation,
automatically generating a proper table of contents for them.</p></li>
<li><p>A <i class="term">processor</i> of documentation written in the <i class="term"><a href="../../../../index.html#key230">doctoc</a></i>
markup language has to know which tools are available for use.</p>
<p>The main tool is the aforementioned <b class="syscmd">dtp</b> application provided
by Tcllib. The simpler <b class="syscmd"><a href="../../apps/dtplite.html">dtplite</a></b> does not expose doctoc to the
user. At the bottom level, common to both applications, however we
find the three packages providing the basic facilities to handle
tables of contents, i.e. import from textual formats, programmatic
manipulation in memory, and export to textual formats. These are</p>
<dl class="definitions">
<dt><b class="package">doctoools::toc</b></dt>
<dd><p>Programmatic manipulation of tables of contents in memory.</p></dd>
<dt><b class="package">doctoools::toc::import</b></dt>
<dd><p>Import of tables of contents from various textual formats. The set of
supported formats is extensible through plugin packages.</p></dd>
<dt><b class="package">doctoools::toc::export</b></dt>
<dd><p>Export of tables of contents to various textual formats. The set of
supported formats is extensible through plugin packages.</p></dd>
</dl>
<p>See also section <span class="sectref"><a href="#section3">Package Overview</a></span> for an overview of the
dependencies between these and other, supporting packages.</p></li>
<li><p>At last, but not least, <i class="term">plugin writers</i> have to understand the
interaction between the import and export packages and their plugins.
These APIs are described in the documentation for the two relevant
packages, i.e.</p>
<ul class="itemized">
<li><p><b class="package">doctoools::toc::import</b></p></li>
<li><p><b class="package">doctoools::toc::export</b></p></li>
</ul>
</li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">Related formats</a></h2>
<p>The doctoc format does not stand alone, it has two companion formats.
These are called <i class="term"><a href="../../../../index.html#key50">docidx</a></i> and <i class="term"><a href="../../../../index.html#key51">doctools</a></i>, and they are
intended for the markup of <i class="term">keyword indices</i>, and of general
documentation, respectively.
They are described in their own sets of documents, starting at
the <i class="term">DocTools - Keyword Indices</i> and
the <i class="term">DocTools - General</i>, respectively.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Package Overview</a></h2>
<pre class="example">
                                    ~~~~~~~~~~~ doctools::toc ~~~~~~~~~~~
                                   ~~                   |               ~~
                doctools::toc::export ~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~ doctools::toc::import
                        |                               |                       |
        +---------------+-------------------------+     |    +------------------+---------------+-----------------------+---------------+
        |               |                         |     |    |                  |               |                       |               |
doctools::config        =                         |     |    |                  =       doctools::include       doctools::config doctools::paths
                        |                         |     |    |                  |
                doctools::toc::export::&lt;*&gt;        |     |    |          doctools::toc::import::&lt;*&gt;
                        doctoc                    |     |    |                  doctoc, json
                        json                      |     |    |                  |           \\
                        html                      |     |    |          doctools::toc::parse \\
                        nroff                     |     |    |                  |             \\
                        wiki                      |     |    |  +---------------+              json
                        text                      |     |    |  |               |
                                                doctools::toc::structure        |
                                                                                |
                                                                        +-------+---------------+
                                                                        |                       |
          doctools::html  doctools::html::cssdefaults           doctools::tcl::parse    doctools::msgcat        
                |                                                                               |
          doctools::text  doctools::nroff::man_macros                                           =
                                                                                                |
                                                                                        doctools::msgcat::toc::&lt;*&gt;
                                                                                                c, en, de, fr
                                                                                                (fr == en for now)
        ~~      Interoperable objects, without actual package dependencies
        --      Package dependency, higher requires lower package
        =       Dynamic dependency through plugin system
        &lt;*&gt;     Multiple packages following the given form of naming.
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>doctools2doc_introduction, <a href="../doctools2idx/introduction.html">doctools2idx_introduction</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key589">contents</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key0">markup</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key116">semantic markup</a>, <a href="../../../../index.html#key150">table of contents</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/msgcat_c.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat::toc::c - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/msgcat_c.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat::toc::c.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat::toc::c(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat::toc::c - Message catalog for the doctoc parser (C)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat::toc::c <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat::toc::c</b> is a
support module providing the C language message catalog
for the doctoc parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="../doctools2idx/container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b> providing the general message catalog
management within the system. <em>Note</em> that there is <em>no</em>
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>This package has no exported API.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key476">C</a>, <a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/msgcat_de.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat::toc::de - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/msgcat_de.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat::toc::de.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat::toc::de(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat::toc::de - Message catalog for the doctoc parser (DE)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat::toc::de <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat::toc::de</b> is a
support module providing the DE (german) language message catalog
for the doctoc parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="../doctools2idx/container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b> providing the general message catalog
management within the system. <em>Note</em> that there is <em>no</em>
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>This package has no exported API.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key222">DE</a>, <a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/msgcat_en.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat::toc::en - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/msgcat_en.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat::toc::en.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat::toc::en(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat::toc::en - Message catalog for the doctoc parser (EN)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat::toc::en <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat::toc::en</b> is a
support module providing the EN (english) language message catalog
for the doctoc parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="../doctools2idx/container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b> providing the general message catalog
management within the system. <em>Note</em> that there is <em>no</em>
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>This package has no exported API.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key47">EN</a>, <a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/msgcat_fr.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::msgcat::toc::fr - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/msgcat_fr.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::msgcat::toc::fr.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::msgcat::toc::fr(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::msgcat::toc::fr - Message catalog for the doctoc parser (FR)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">msgcat</b></li>
<li>package require <b class="pkgname">doctools::msgcat::toc::fr <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">doctools::msgcat::toc::fr</b> is a
support module providing the FR (french) language message catalog
for the doctoc parser in the doctools system version 2. As such it is
an internal package a regular user (developer) should not be in direct
contact with.</p>
<p>If you are such please go the documentation of either</p>
<ol class="enumerated">
<li><p><b class="package">doctools::doc</b>,</p></li>
<li><p><b class="package"><a href="container.html">doctools::toc</a></b>, or</p></li>
<li><p><b class="package"><a href="../doctools2idx/container.html">doctools::idx</a></b></p></li>
</ol>
<p>Within the system architecture this package resides under the package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b> providing the general message catalog
management within the system. <em>Note</em> that there is <em>no</em>
explicit dependency between the manager and catalog packages. The
catalog is a plugin which is selected and loaded dynamically.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>This package has no exported API.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key571">FR</a>, <a href="../../../../index.html#key48">catalog package</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key42">i18n</a>, <a href="../../../../index.html#key46">internationalization</a>, <a href="../../../../index.html#key49">l10n</a>, <a href="../../../../index.html#key45">localization</a>, <a href="../../../../index.html#key43">message catalog</a>, <a href="../../../../index.html#key44">message package</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/parse.html.




















































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::parse - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/parse.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::parse.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::parse(n) 1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::parse - Parsing text in doctoc format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Parse errors</a></li>
<li class="section"><a href="#section4">[doctoc] notation of tables of contents</a></li>
<li class="section"><a href="#section5">ToC serialization format</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::toc::parse <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">doctools::toc::structure</b></li>
<li>package require <b class="pkgname">doctools::msgcat</b></li>
<li>package require <b class="pkgname">doctools::tcl::parse</b></li>
<li>package require <b class="pkgname">fileutil</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">struct::stack</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::toc::parse</b> <b class="method">text</b> <i class="arg">text</i></a></li>
<li><a href="#2"><b class="cmd">::doctools::toc::parse</b> <b class="method">file</b> <i class="arg">path</i></a></li>
<li><a href="#3"><b class="cmd">::doctools::toc::parse</b> <b class="method">includes</b></a></li>
<li><a href="#4"><b class="cmd">::doctools::toc::parse</b> <b class="method">include add</b> <i class="arg">path</i></a></li>
<li><a href="#5"><b class="cmd">::doctools::toc::parse</b> <b class="method">include remove</b> <i class="arg">path</i></a></li>
<li><a href="#6"><b class="cmd">::doctools::toc::parse</b> <b class="method">include clear</b></a></li>
<li><a href="#7"><b class="cmd">::doctools::toc::parse</b> <b class="method">vars</b></a></li>
<li><a href="#8"><b class="cmd">::doctools::toc::parse</b> <b class="method">var set</b> <i class="arg">name</i> <i class="arg">value</i></a></li>
<li><a href="#9"><b class="cmd">::doctools::toc::parse</b> <b class="method">var unset</b> <i class="arg">name</i></a></li>
<li><a href="#10"><b class="cmd">::doctools::toc::parse</b> <b class="method">var clear</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to parse text written in the
<i class="term"><a href="../../../../index.html#key230">doctoc</a></i> markup language and convert it into the canonical
serialization of the table of contents encoded in the text.
See the section <span class="sectref"><a href="#section5">ToC serialization format</a></span> for specification
of their format.</p>
<p>This is an internal package of doctools, for use by the higher level
packages handling <i class="term"><a href="../../../../index.html#key230">doctoc</a></i> documents.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::toc::parse</b> <b class="method">text</b> <i class="arg">text</i></a></dt>
<dd><p>The command takes the string contained in <i class="arg">text</i> and parses it
under the assumption that it contains a document written using the
<i class="term"><a href="../../../../index.html#key230">doctoc</a></i> markup language. An error is thrown if this assumption
is found to be false. The format of these errors is described in
section <span class="sectref"><a href="#section3">Parse errors</a></span>.</p>
<p>When successful the command returns the canonical serialization of the
table of contents which was encoded in the text.
See the section <span class="sectref"><a href="#section5">ToC serialization format</a></span> for specification
of that format.</p></dd>
<dt><a name="2"><b class="cmd">::doctools::toc::parse</b> <b class="method">file</b> <i class="arg">path</i></a></dt>
<dd><p>The same as <b class="method">text</b>, except that the text to parse is read from
the file specified by <i class="arg">path</i>.</p></dd>
<dt><a name="3"><b class="cmd">::doctools::toc::parse</b> <b class="method">includes</b></a></dt>
<dd><p>This method returns the current list of search paths used when looking
for include files.</p></dd>
<dt><a name="4"><b class="cmd">::doctools::toc::parse</b> <b class="method">include add</b> <i class="arg">path</i></a></dt>
<dd><p>This method adds the <i class="arg">path</i> to the list of paths searched when
looking for an include file. The call is ignored if the path is
already in the list of paths. The method returns the empty string as
its result.</p></dd>
<dt><a name="5"><b class="cmd">::doctools::toc::parse</b> <b class="method">include remove</b> <i class="arg">path</i></a></dt>
<dd><p>This method removes the <i class="arg">path</i> from the list of paths searched
when looking for an include file. The call is ignored if the path is
not contained in the list of paths. The method returns the empty
string as its result.</p></dd>
<dt><a name="6"><b class="cmd">::doctools::toc::parse</b> <b class="method">include clear</b></a></dt>
<dd><p>This method clears the list of search paths for include files.</p></dd>
<dt><a name="7"><b class="cmd">::doctools::toc::parse</b> <b class="method">vars</b></a></dt>
<dd><p>This method returns a dictionary containing the current set of
predefined variables known to the <b class="cmd">vset</b> markup command during
processing.</p></dd>
<dt><a name="8"><b class="cmd">::doctools::toc::parse</b> <b class="method">var set</b> <i class="arg">name</i> <i class="arg">value</i></a></dt>
<dd><p>This method adds the variable <i class="arg">name</i> to the set of predefined
variables known to the <b class="cmd">vset</b> markup command during processing,
and gives it the specified <i class="arg">value</i>. The method returns the empty
string as its result.</p></dd>
<dt><a name="9"><b class="cmd">::doctools::toc::parse</b> <b class="method">var unset</b> <i class="arg">name</i></a></dt>
<dd><p>This method removes the variable <i class="arg">name</i> from the set of predefined
variables known to the <b class="cmd">vset</b> markup command during
processing. The method returns the empty string as its result.</p></dd>
<dt><a name="10"><b class="cmd">::doctools::toc::parse</b> <b class="method">var clear</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>This method removes all variables matching the <i class="arg">pattern</i> from the
set of predefined variables known to the <b class="cmd">vset</b> markup command
during processing. The method returns the empty string as its result.</p>
<p>The pattern matching is done with <b class="cmd">string match</b>, and the
default pattern used when none is specified, is <b class="const">*</b>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Parse errors</a></h2>
<p>The format of the parse error messages thrown when encountering
violations of the <i class="term"><a href="../../../../index.html#key230">doctoc</a></i> markup syntax is human readable and
not intended for processing by machines. As such it is not documented.</p>
<p><em>However</em>, the errorCode attached to the message is
machine-readable and has the following format:</p>
<ol class="enumerated">
<li><p>The error code will be a list, each element describing a single error
found in the input. The list has at least one element, possibly more.</p></li>
<li><p>Each error element will be a list containing six strings describing an
error in detail. The strings will be</p>
<ol class="enumerated">
<li><p>The path of the file the error occured in. This may be empty.</p></li>
<li><p>The range of the token the error was found at. This range is a
two-element list containing the offset of the first and last character
in the range, counted from the beginning of the input (file). Offsets
are counted from zero.</p></li>
<li><p>The line the first character after the error is on.
Lines are counted from one.</p></li>
<li><p>The column the first character after the error is at.
Columns are counted from zero.</p></li>
<li><p>The message code of the error. This value can be used as argument to
<b class="cmd">msgcat::mc</b> to obtain a localized error message, assuming that
the application had a suitable call of <b class="cmd">doctools::msgcat::init</b> to
initialize the necessary message catalogs (See package
<b class="package"><a href="../doctools2base/tcllib_msgcat.html">doctools::msgcat</a></b>).</p></li>
<li><p>A list of details for the error, like the markup command involved. In
the case of message code <b class="const">doctoc/include/syntax</b> this value is
the set of errors found in the included file, using the format
described here.</p></li>
</ol>
</li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">[doctoc] notation of tables of contents</a></h2>
<p>The doctoc format for tables of contents, also called the
<i class="term">doctoc markup language</i>, is too large to be covered in single
section.
The interested reader should start with the document</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/doctoc_lang_intro.html">doctoc language introduction</a></i></p></li>
</ol>
<p>and then proceed from there to the formal specifications, i.e. the
documents</p>
<ol class="enumerated">
<li><p><i class="term"><a href="../doctools/doctoc_lang_syntax.html">doctoc language syntax</a></i> and</p></li>
<li><p><i class="term"><a href="../doctools/doctoc_lang_cmdref.html">doctoc language command reference</a></i>.</p></li>
</ol>
<p>to get a thorough understanding of the language.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key345">lexer</a>, <a href="../../../../index.html#key15">parser</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/doctools2toc/structure.html.





































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>doctools::toc::structure - Documentation tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/doctools2toc/structure.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ doctools::toc::structure.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">doctools::toc::structure(n) 0.1 tcllib &quot;Documentation tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>doctools::toc::structure - Doctoc serialization utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">ToC serialization format</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">doctools::toc::structure <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::doctools::toc::structure</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::doctools::toc::structure</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></li>
<li><a href="#3"><b class="cmd">::doctools::toc::structure</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></li>
<li><a href="#4"><b class="cmd">::doctools::toc::structure</b> <b class="method">print</b> <i class="arg">serial</i></a></li>
<li><a href="#5"><b class="cmd">::doctools::toc::structure</b> <b class="method">merge</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to work with the serializations of
tables of contents as managed by the doctools system v2, and specified
in section <span class="sectref"><a href="#section3">ToC serialization format</a></span>.</p>
<p>This is an internal package of doctools, for use by the higher level
packages handling tables of contents and their conversion into and out
of various other formats, like documents written using <i class="term"><a href="../../../../index.html#key230">doctoc</a></i>
markup.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::doctools::toc::structure</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
<i class="term">regular</i> serialization of a table of contents and will throw an
error if that is not the case. The result of the command is the empty
string.</p>
<p>If the argument <i class="arg">canonvar</i> is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if <i class="arg">serial</i> is a valid regular
serialization. Its value will be a boolean, with <b class="const">True</b>
indicating that the serialization is not only valid, but also
<i class="term">canonical</i>. <b class="const">False</b> will be written for a valid, but
non-canonical serialization.</p>
<p>For the specification of regular and canonical serializations see the
section <span class="sectref"><a href="#section3">ToC serialization format</a></span>.</p></dd>
<dt><a name="2"><b class="cmd">::doctools::toc::structure</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
<i class="term">canonical</i> serialization of a table of contents and will throw
an error if that is not the case. The result of the command is the
empty string.</p>
<p>For the specification of canonical serializations see the section
<span class="sectref"><a href="#section3">ToC serialization format</a></span>.</p></dd>
<dt><a name="3"><b class="cmd">::doctools::toc::structure</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the content of <i class="arg">serial</i> is a valid
<i class="term">regular</i> serialization of a table of contents and will throw an
error if that is not the case.</p>
<p>It will then convert the input into the <i class="term">canonical</i> serialization
of the contained table of contents and return it as its result. If the
input is already canonical it will be returned unchanged.</p>
<p>For the specification of regular and canonical serializations see the
section <span class="sectref"><a href="#section3">ToC serialization format</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::doctools::toc::structure</b> <b class="method">print</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the argument <i class="arg">serial</i> contains a valid
regular serialization of a table of contents and returns a string
containing that table in a human readable form.</p>
<p>The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.</p>
<p>For the specification of regular serializations see the section
<span class="sectref"><a href="#section3">ToC serialization format</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::doctools::toc::structure</b> <b class="method">merge</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></dt>
<dd><p>This command accepts the regular serializations of two tables of
contents and uses them to create their union.  The result of the
command is the canonical serialization of this unified table of
contents.</p>
<p>Title and label of the resulting table are taken from the table
contained in <i class="arg">serialb</i>.</p>
<p>The whole table and its divisions are merged recursively in the same
manner:</p>
<ol class="enumerated">
<li><p>All reference elements which occur in both divisions (identified by
their label) are unified with document id's and descriptions taken
from the second table.</p></li>
<li><p>All division elements which occur in both divisions (identified by
their label) are unified with the optional document id taken from the
second table, if any, or from the first if none is in the second. The
elements in the division are merged recursively using the same
algorithm as described in this list.</p></li>
<li><p>Type conflicts between elements, i.e. finding two elements with the
same label but different types result in a merge error.</p></li>
<li><p>All elements found in the second division but not in the first are
added to the end of the list of elements in the merge result.</p></li>
</ol>
<p>For the specification of regular and canonical serializations see the
section <span class="sectref"><a href="#section3">ToC serialization format</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">ToC serialization format</a></h2>
<p>Here we specify the format used by the doctools v2 packages to
serialize tables of contents as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a table of contents may have more than one regular serialization
only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any table of contents is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">doctools::toc</b>, and its
value. This value holds the contents of the table of contents.</p></li>
<li><p>The contents of the table of contents are a Tcl dictionary holding the
title of the table of contents, a label, and its elements. The
relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">title</b></dt>
<dd><p>The value is a string containing the title of the table of contents.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the table of contents.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the table, in the
order they are to be shown.</p>
<p>Each element is a Tcl list holding the type of the item, and its
description, in this order. An alternative description would be that
it is a Tcl dictionary holding a single key, the item type, mapped to
the item description.</p>
<p>The two legal item types and their descriptions are</p>
<dl class="definitions">
<dt><b class="const">reference</b></dt>
<dd><p>This item describes a single entry in the table of contents,
referencing a single document.
To this end its value is a Tcl dictionary containing an id for the
referenced document, a label, and a longer textual description which
can be associated with the entry.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the entry.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for this entry. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">desc</b></dt>
<dd><p>The value is a string containing a longer description for this entry.</p></dd>
</dl></dd>
<dt><b class="const">division</b></dt>
<dd><p>This item describes a group of entries in the table of contents,
inducing a hierarchy of entries.
To this end its value is a Tcl dictionary containing a label for the
group, an optional id to a document for the whole group, and the list
of entries in the group.
The relevant keys and their values are</p>
<dl class="definitions">
<dt><b class="const">id</b></dt>
<dd><p>The value is a string containing the id of the document associated
with the whole group. This key is optional.</p></dd>
<dt><b class="const">label</b></dt>
<dd><p>The value is a string containing a label for the group. This string
also identifies the entry, and no two entries (references and
divisions) in the containing list are allowed to have the same label.</p></dd>
<dt><b class="const">items</b></dt>
<dd><p>The value is a Tcl list holding the elements of the group, in the
order they are to be shown.
This list has the same structure as the value for the keyword
<b class="const">items</b> used to describe the whole table of contents, see
above. This closes the recusrive definition of the structure, with
divisions holding the same type of elements as the whole table of
contents, including other divisions.</p></dd>
</dl></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a table of contents has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this table of contents.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
</ol></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>doctools</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key231">deserialization</a>, <a href="../../../../index.html#key230">doctoc</a>, <a href="../../../../index.html#key51">doctools</a>, <a href="../../../../index.html#key102">serialization</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/exif/exif.html.



































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>exif - EXIF parsing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/exif/exif.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ exif.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">exif(n) 1.1.2 tcllib &quot;EXIF parsing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>exif - Tcl EXIF extracts and parses EXIF fields from digital images</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">COPYRIGHTS</a></li>
<li class="section"><a href="#section4">ACKNOWLEDGEMENTS</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">exif <span class="opt">?1.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">exif::analyze</b> <i class="arg">channel</i> <span class="opt">?<i class="arg">thumbnail</i>?</span></a></li>
<li><a href="#2"><b class="cmd">exif::analyzeFile</b> <i class="arg">filename</i> <span class="opt">?<i class="arg">thumbnail</i>?</span></a></li>
<li><a href="#3"><b class="cmd">exif::fieldnames</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The EXIF package is a recoding of Chris Breeze's Perl package to do
the same thing.  This version accepts a channel as input and returns a
serialized array with all the recognised fields parsed out.</p>
<p>There is also a function to obtain a list of all possible field names
that might be present, which is useful in building GUIs that present
such information.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">exif::analyze</b> <i class="arg">channel</i> <span class="opt">?<i class="arg">thumbnail</i>?</span></a></dt>
<dd><p><i class="arg">channel</i> should be an open file handle rewound to the start.  It
does not need to be seekable.  <i class="arg">channel</i> will be set to binary
mode and is left wherever it happens to stop being parsed, usually at
the end of the file or the start of the image data.  You must open and
close the stream yourself.  If no error is thrown, the return value is
a serialized array with informative English text about what was found
in the EXIF block.  Failure during parsing or I/O throw errors.</p>
<p>If <i class="arg">thumbnail</i> is present and not the empty string it will be
interpreted as the name of a file, and the thumbnail image contained
in the exif data will be written into it.</p></dd>
<dt><a name="2"><b class="cmd">exif::analyzeFile</b> <i class="arg">filename</i> <span class="opt">?<i class="arg">thumbnail</i>?</span></a></dt>
<dd><p>This is a file-based wrapper around <b class="cmd">exif::analyze</b>. Instead of
taking a stream it takes a <i class="arg">filename</i> and analyzes the contents of
the specified file.</p></dd>
<dt><a name="3"><b class="cmd">exif::fieldnames</b></a></dt>
<dd><p>This returns a list of all possible field names.  That is, the array
returned by <b class="cmd">exif::analyze</b> will not contain keys that are not
listed in the return from <b class="cmd">exif::fieldnames</b>.  Of course, if
information is missing in the image file, <b class="cmd">exif::analyze</b> may not
return all the fields listed in the return from exif::fieldnames.
This function is expected to be primarily useful for building GUIs to
display results.</p>
<p>N.B.: Read the implementation of <b class="cmd">exif::fieldnames</b> before
modifying the implementation of <b class="cmd">exif::analyze</b>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">COPYRIGHTS</a></h2>
<p>(c) 2002 Darren New
Hold harmless the author, and any lawful use is allowed.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">ACKNOWLEDGEMENTS</a></h2>
<p>This code is a direct translation of version 1.3 of exif.pl by Chris
Breeze.  See the source for full headers, references, etc.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>exif</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key143">exif</a>, <a href="../../../../index.html#key144">jpeg</a>, <a href="../../../../index.html#key772">maker note</a>, <a href="../../../../index.html#key134">tiff</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>File formats</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fileutil/fileutil.html.























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fileutil/fileutil.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil(n) 1.14.5 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil - Procedures implementing some file utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8</b></li>
<li>package require <b class="pkgname">fileutil <span class="opt">?1.14.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::lexnormalize</b> <i class="arg">path</i></a></li>
<li><a href="#2"><b class="cmd">::fileutil::fullnormalize</b> <i class="arg">path</i></a></li>
<li><a href="#3"><b class="cmd">::fileutil::test</b> <i class="arg">path</i> <i class="arg">codes</i> <span class="opt">?<i class="arg">msgvar</i>?</span> <span class="opt">?<i class="arg">label</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::fileutil::cat</b> (<span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i>)...</a></li>
<li><a href="#5"><b class="cmd">::fileutil::writeFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">data</i></a></li>
<li><a href="#6"><b class="cmd">::fileutil::appendToFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">data</i></a></li>
<li><a href="#7"><b class="cmd">::fileutil::insertIntoFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">data</i></a></li>
<li><a href="#8"><b class="cmd">::fileutil::removeFromFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">n</i></a></li>
<li><a href="#9"><b class="cmd">::fileutil::replaceInFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">n</i> <i class="arg">data</i></a></li>
<li><a href="#10"><b class="cmd">::fileutil::updateInPlace</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">cmd</i></a></li>
<li><a href="#11"><b class="cmd">::fileutil::fileType</b> <i class="arg">filename</i></a></li>
<li><a href="#12"><b class="cmd">::fileutil::find</b> <span class="opt">?<i class="arg">basedir</i> <span class="opt">?<i class="arg">filtercmd</i>?</span>?</span></a></li>
<li><a href="#13"><b class="cmd">::fileutil::findByPattern</b> <i class="arg">basedir</i> <span class="opt">?<b class="option">-regexp</b>|<b class="option">-glob</b>?</span> <span class="opt">?<b class="option">--</b>?</span> <i class="arg">patterns</i></a></li>
<li><a href="#14"><b class="cmd">::fileutil::foreachLine</b> <i class="arg">var filename cmd</i></a></li>
<li><a href="#15"><b class="cmd">::fileutil::grep</b> <i class="arg">pattern</i> <span class="opt">?<i class="arg">files</i>?</span></a></li>
<li><a href="#16"><b class="cmd">::fileutil::install</b> <span class="opt">?<b class="option">-m</b> <i class="arg">mode</i>?</span> <i class="arg">source</i> <i class="arg">destination</i></a></li>
<li><a href="#17"><b class="cmd">::fileutil::stripN</b> <i class="arg">path</i> <i class="arg">n</i></a></li>
<li><a href="#18"><b class="cmd">::fileutil::stripPwd</b> <i class="arg">path</i></a></li>
<li><a href="#19"><b class="cmd">::fileutil::stripPath</b> <i class="arg">prefix</i> <i class="arg">path</i></a></li>
<li><a href="#20"><b class="cmd">::fileutil::jail</b> <i class="arg">jail</i> <i class="arg">path</i></a></li>
<li><a href="#21"><b class="cmd">::fileutil::touch</b> <span class="opt">?<b class="option">-a</b>?</span> <span class="opt">?<b class="option">-c</b>?</span> <span class="opt">?<b class="option">-m</b>?</span> <span class="opt">?<b class="option">-r</b> <i class="arg">ref_file</i>?</span> <span class="opt">?<b class="option">-t</b> <i class="arg">time</i>?</span> <i class="arg">filename</i> <span class="opt">?<i class="arg">...</i>?</span></a></li>
<li><a href="#22"><b class="cmd">::fileutil::tempdir</b></a></li>
<li><a href="#23"><b class="cmd">::fileutil::tempdir</b> <i class="arg">path</i></a></li>
<li><a href="#24"><b class="cmd">::fileutil::tempdirReset</b></a></li>
<li><a href="#25"><b class="cmd">::fileutil::tempfile</b> <span class="opt">?<i class="arg">prefix</i>?</span></a></li>
<li><a href="#26"><b class="cmd">::fileutil::relative</b> <i class="arg">base</i> <i class="arg">dst</i></a></li>
<li><a href="#27"><b class="cmd">::fileutil::relativeUrl</b> <i class="arg">base</i> <i class="arg">dst</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides implementations of standard unix utilities.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::lexnormalize</b> <i class="arg">path</i></a></dt>
<dd><p>This command performs purely lexical normalization on the <i class="arg">path</i> and returns
the changed path as its result. Symbolic links in the path are <em>not</em> resolved.</p>
<p>Examples:</p>
<pre class="example">
    fileutil::lexnormalize /foo/./bar
    =&gt; /foo/bar
    fileutil::lexnormalize /foo/../bar
    =&gt; /bar
</pre>
</dd>
<dt><a name="2"><b class="cmd">::fileutil::fullnormalize</b> <i class="arg">path</i></a></dt>
<dd><p>This command resolves all symbolic links in the <i class="arg">path</i> and returns
the changed path as its result.
In contrast to the builtin <b class="cmd">file normalize</b> this command
resolves a symbolic link in the last element of the path as well.</p></dd>
<dt><a name="3"><b class="cmd">::fileutil::test</b> <i class="arg">path</i> <i class="arg">codes</i> <span class="opt">?<i class="arg">msgvar</i>?</span> <span class="opt">?<i class="arg">label</i>?</span></a></dt>
<dd><p>A command for the testing of several properties of a <i class="arg">path</i>. The
properties to test for are specified in <i class="arg">codes</i>, either as a list
of keywords describing the properties, or as a string where each
letter is a shorthand for a property to test. The recognized keywords,
shorthands, and associated properties are shown in the list below. The
tests are executed in the order given to the command.</p>
<p>The result of the command is a boolean value. It will be true if and
only if the <i class="arg">path</i> passes all the specified tests.
In the case of the <i class="arg">path</i> not passing one or more test the first
failing test will leave a message in the variable referenced by
<i class="arg">msgvar</i>, if such is specified. The message will be prefixed with
<i class="arg">label</i>, if it is specified.
<em>Note</em> that the variabled referenced by <i class="arg">msgvar</i> is not touched at
all if all the tests pass.</p>
<dl class="definitions">
<dt><em>r</em>ead</dt>
<dd><p><b class="cmd">file readable</b></p></dd>
<dt><em>w</em>rite</dt>
<dd><p><b class="cmd">file writable</b></p></dd>
<dt><em>e</em>xists</dt>
<dd><p><b class="cmd">file exists</b></p></dd>
<dt>e<em>x</em>ec</dt>
<dd><p><b class="cmd">file executable</b></p></dd>
<dt><em>f</em>ile</dt>
<dd><p><b class="cmd">file isfile</b></p></dd>
<dt><em>d</em>ir</dt>
<dd><p><b class="cmd">file isdirectory</b></p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::fileutil::cat</b> (<span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i>)...</a></dt>
<dd><p>A tcl implementation of the UNIX <b class="syscmd"><a href="../../../../index.html#key265">cat</a></b> command.  Returns the
contents of the specified file(s). The arguments are files to read,
with interspersed options configuring the process. If there are
problems reading any of the files, an error will occur, and no data
will be returned.</p>
<p>The options accepted are <b class="option">-encoding</b>, <b class="option">-translation</b>,
<b class="option">-eofchar</b>, and <b class="option">--</b>. With the exception of the last all
options take a single value as argument, as specified by the tcl
builtin command <b class="cmd">fconfigure</b>. The <b class="option">--</b> has to be used to
terminate option processing before a file if that file's name begins
with a dash.</p>
<p>Each file can have its own set of options coming before it, and for
anything not specified directly the defaults are inherited from the
options of the previous file. The first file inherits the system
default for unspecified options.</p></dd>
<dt><a name="5"><b class="cmd">::fileutil::writeFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">data</i></a></dt>
<dd><p>The command replaces the current contents of the specified <i class="arg">file</i>
with <i class="arg">data</i>, with the process configured by the options. The
command accepts the same options as <b class="cmd">::fileutil::cat</b>. The
specification of a non-existent file is legal and causes the command
to create the file (and all required but missing directories).</p></dd>
<dt><a name="6"><b class="cmd">::fileutil::appendToFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">data</i></a></dt>
<dd><p>This command is like <b class="cmd">::fileutil::writeFile</b>, except that the
previous contents of <i class="arg">file</i> are not replaced, but appended to. The
command accepts the same options as <b class="cmd">::fileutil::cat</b></p></dd>
<dt><a name="7"><b class="cmd">::fileutil::insertIntoFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">data</i></a></dt>
<dd><p>This comment is similar to <b class="cmd">::fileutil::appendToFile</b>, except that
the new data is not appended at the end, but inserted at a specified
location within the file. In further contrast this command has to be
given the path to an existing file. It will not create a missing file,
but throw an error instead.</p>
<p>The specified location <i class="arg">at</i> has to be an integer number in the
range <b class="const">0</b> ... [file size <i class="arg">file</i>]. <b class="const">0</b> will cause
insertion of the new data before the first character of the existing
content, whereas [file size <i class="arg">file</i>] causes insertion after
the last character of the existing content, i.e. appending.</p>
<p>The command accepts the same options as <b class="cmd">::fileutil::cat</b>.</p></dd>
<dt><a name="8"><b class="cmd">::fileutil::removeFromFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">n</i></a></dt>
<dd><p>This command is the complement to <b class="cmd">::fileutil::insertIntoFile</b>, removing <i class="arg">n</i> characters from the <i class="arg">file</i>, starting at location <i class="arg">at</i>.
The specified location <i class="arg">at</i> has to be an integer number in the
range <b class="const">0</b> ... [file size <i class="arg">file</i>] - <i class="arg">n</i>. <b class="const">0</b>
will cause the removal of the new data to start with the first
character of the existing content,
whereas [file size <i class="arg">file</i>] - <i class="arg">n</i> causes the removal of
the tail of the existing content, i.e. the truncation of the file.</p>
<p>The command accepts the same options as <b class="cmd">::fileutil::cat</b>.</p></dd>
<dt><a name="9"><b class="cmd">::fileutil::replaceInFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">n</i> <i class="arg">data</i></a></dt>
<dd><p>This command is a combination of <b class="cmd">::fileutil::removeFromFile</b> and
<b class="cmd">::fileutil::insertIntoFile</b>. It first removes the part of the
contents specified by the arguments <i class="arg">at</i> and <i class="arg">n</i>, and then
inserts <i class="arg">data</i> at the given location, effectively replacing the
removed by content with <i class="arg">data</i>.
All constraints imposed on <i class="arg">at</i> and <i class="arg">n</i> by
<b class="cmd">::fileutil::removeFromFile</b> and <b class="cmd">::fileutil::insertIntoFile</b>
are obeyed.</p>
<p>The command accepts the same options as <b class="cmd">::fileutil::cat</b>.</p></dd>
<dt><a name="10"><b class="cmd">::fileutil::updateInPlace</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">cmd</i></a></dt>
<dd><p>This command can be seen as the generic core functionality of
<b class="cmd">::fileutil::replaceInFile</b>.
It first reads the contents of the specified <i class="arg">file</i>, then runs the
command prefix <i class="arg">cmd</i> with that data appended to it, and at last
writes the result of that invokation back as the new contents of the
file.</p>
<p>If the executed command throws an error the <i class="arg">file</i> is not changed.</p>
<p>The command accepts the same options as <b class="cmd">::fileutil::cat</b>.</p></dd>
<dt><a name="11"><b class="cmd">::fileutil::fileType</b> <i class="arg">filename</i></a></dt>
<dd><p>An implementation of the UNIX <b class="syscmd"><a href="../../../../index.html#key31">file</a></b> command, which uses
various heuristics to guess the type of a file.  Returns a list
specifying as much type information as can be determined about the
file, from most general (eg, &quot;binary&quot; or &quot;text&quot;) to most specific (eg,
&quot;gif&quot;).  For example, the return value for a GIF file would be &quot;binary
graphic gif&quot;.  The command will detect the following types of files:
directory, empty, binary, text, script (with interpreter), executable
elf, executable dos, executable ne, executable pe, graphic gif, graphic
jpeg, graphic png, graphic tiff, graphic bitmap, html, xml (with doctype
if available), message pgp, binary pdf, text ps, text eps, binary
gravity_wave_data_frame, compressed bzip, compressed gzip, compressed
zip, compressed tar, audio wave, audio mpeg, and link. It further
detects doctools, doctoc, and docidx documentation files, and
tklib diagrams.</p></dd>
<dt><a name="12"><b class="cmd">::fileutil::find</b> <span class="opt">?<i class="arg">basedir</i> <span class="opt">?<i class="arg">filtercmd</i>?</span>?</span></a></dt>
<dd><p>An implementation of the unix command <b class="syscmd"><a href="../../../../index.html#key574">find</a></b>. Adapted from the
Tcler's Wiki. Takes at most two arguments, the path to the directory
to start searching from and a command to use to evaluate interest in
each file. The path defaults to &quot;<b class="file">.</b>&quot;, i.e. the current
directory. The command defaults to the empty string, which means that
all files are of interest. The command takes care <em>not</em> to
lose itself in infinite loops upon encountering circular link
structures. The result of the command is a list containing the paths
to the interesting files.</p>
<p>The <i class="arg">filtercmd</i>, if specified, is interpreted as a command prefix
and one argument is added to it, the name of the file or directory
find is currently looking at. Note that this name is <em>not</em> fully
qualified. It has to be joined it with the result of <b class="cmd">pwd</b> to get
an absolute filename.</p>
<p>The result of <i class="arg">filtercmd</i> is a boolean value that indicates if the
current file should be included in the list of interesting files.</p>
<p>Example:</p>
<pre class="example">
    # find .tcl files
    package require fileutil
    proc is_tcl {name} {return [string match *.tcl $name]}
    set tcl_files [fileutil::find . is_tcl]
</pre>
</dd>
<dt><a name="13"><b class="cmd">::fileutil::findByPattern</b> <i class="arg">basedir</i> <span class="opt">?<b class="option">-regexp</b>|<b class="option">-glob</b>?</span> <span class="opt">?<b class="option">--</b>?</span> <i class="arg">patterns</i></a></dt>
<dd><p>This command is based upon the <b class="package">TclX</b> command
<b class="cmd">recursive_glob</b>, except that it doesn't allow recursion over more
than one directory at a time. It uses <b class="cmd">::fileutil::find</b>
internally and is thus able to and does follow symbolic links,
something the <b class="package">TclX</b> command does not do. First argument is
the directory to start the search in, second argument is a list of
<i class="arg">patterns</i>. The command returns a list of all files reachable
through <i class="arg">basedir</i> whose names match at least one of the
patterns. The options before the pattern-list determine the style of
matching, either regexp or glob. glob-style matching is the default if
no options are given. Usage of the option <b class="option">--</b> stops option
processing. This allows the use of a leading '-' in the patterns.</p></dd>
<dt><a name="14"><b class="cmd">::fileutil::foreachLine</b> <i class="arg">var filename cmd</i></a></dt>
<dd><p>The command reads the file <i class="arg">filename</i> and executes the script
<i class="arg">cmd</i> for every line in the file. During the execution of the
script the variable <i class="arg">var</i> is set to the contents of the current
line. The return value of this command is the result of the last
invocation of the script <i class="arg">cmd</i> or the empty string if the file was
empty.</p></dd>
<dt><a name="15"><b class="cmd">::fileutil::grep</b> <i class="arg">pattern</i> <span class="opt">?<i class="arg">files</i>?</span></a></dt>
<dd><p>Implementation of <b class="syscmd"><a href="../../../../index.html#key268">grep</a></b>. Adapted from the Tcler's Wiki. The
first argument defines the <i class="arg">pattern</i> to search for. This is
followed by a list of <i class="arg">files</i> to search through. The list is
optional and <b class="const">stdin</b> will be used if it is missing. The result
of the procedures is a list containing the matches. Each match is a
single element of the list and contains filename, number and contents
of the matching line, separated by a colons.</p></dd>
<dt><a name="16"><b class="cmd">::fileutil::install</b> <span class="opt">?<b class="option">-m</b> <i class="arg">mode</i>?</span> <i class="arg">source</i> <i class="arg">destination</i></a></dt>
<dd><p>The <b class="cmd">install</b> command is similar in functionality to the <b class="syscmd">install</b>
command found on many unix systems, or the shell script
distributed with many source distributions (unix/install-sh in the Tcl
sources, for example).  It copies <i class="arg">source</i>, which can be either a
file or directory to <i class="arg">destination</i>, which should be a directory,
unless <i class="arg">source</i> is also a single file.  The <span class="opt">?-m?</span> option lets
the user specify a unix-style mode (either octal or symbolic - see
<b class="cmd">file attributes</b>.</p></dd>
<dt><a name="17"><b class="cmd">::fileutil::stripN</b> <i class="arg">path</i> <i class="arg">n</i></a></dt>
<dd><p>Removes the first <i class="arg">n</i> elements from the specified <i class="arg">path</i> and
returns the modified path. If <i class="arg">n</i> is greater than the number of
components in <i class="arg">path</i> an empty string is returned. The number of
components in a given path may be determined by performing
<b class="cmd">llength</b> on the list returned by <b class="cmd">file split</b>.</p></dd>
<dt><a name="18"><b class="cmd">::fileutil::stripPwd</b> <i class="arg">path</i></a></dt>
<dd><p>If, and only if the <i class="arg">path</i> is inside of the directory returned by
[<b class="cmd">pwd</b>] (or the current working directory itself) it is made
relative to that directory. In other words, the current working
directory is stripped from the <i class="arg">path</i>.  The possibly modified path
is returned as the result of the command. If the current working
directory itself was specified for <i class="arg">path</i> the result is the string
&quot;<b class="const">.</b>&quot;.</p></dd>
<dt><a name="19"><b class="cmd">::fileutil::stripPath</b> <i class="arg">prefix</i> <i class="arg">path</i></a></dt>
<dd><p>If, and only of the <i class="arg">path</i> is inside of the directory
&quot;<b class="file">prefix</b>&quot; (or the prefix directory itself) it is made relative to
that directory. In other words, the prefix directory is stripped from
the <i class="arg">path</i>. The possibly modified path is returned as the result
of the command.
If the prefix directory itself was specified for <i class="arg">path</i> the result
is the string &quot;<b class="const">.</b>&quot;.</p></dd>
<dt><a name="20"><b class="cmd">::fileutil::jail</b> <i class="arg">jail</i> <i class="arg">path</i></a></dt>
<dd><p>This command ensures that the <i class="arg">path</i> is not escaping the directory
<i class="arg">jail</i>. It always returns an absolute path derived from <i class="arg">path</i>
which is within <i class="arg">jail</i>.</p>
<p>If <i class="arg">path</i> is an absolute path and already within <i class="arg">jail</i> it is
returned unmodified.</p>
<p>An absolute path outside of <i class="arg">jail</i> is stripped of its root element
and then put into the <i class="arg">jail</i> by prefixing it with it. The same
happens if <i class="arg">path</i> is relative, except that nothing is stripped of
it. Before adding the <i class="arg">jail</i> prefix the <i class="arg">path</i> is lexically
normalized to prevent the caller from using <b class="const">..</b> segments in
<i class="arg">path</i> to escape the jail.</p></dd>
<dt><a name="21"><b class="cmd">::fileutil::touch</b> <span class="opt">?<b class="option">-a</b>?</span> <span class="opt">?<b class="option">-c</b>?</span> <span class="opt">?<b class="option">-m</b>?</span> <span class="opt">?<b class="option">-r</b> <i class="arg">ref_file</i>?</span> <span class="opt">?<b class="option">-t</b> <i class="arg">time</i>?</span> <i class="arg">filename</i> <span class="opt">?<i class="arg">...</i>?</span></a></dt>
<dd><p>Implementation of <b class="syscmd"><a href="../../../../index.html#key269">touch</a></b>. Alter the atime and mtime of the
specified files. If <b class="option">-c</b>, do not create files if they do not
already exist. If <b class="option">-r</b>, use the atime and mtime from
<i class="arg">ref_file</i>. If <b class="option">-t</b>, use the integer clock value
<i class="arg">time</i>. It is illegal to specify both <b class="option">-r</b> and
<b class="option">-t</b>. If <b class="option">-a</b>, only change the atime. If <b class="option">-m</b>,
only change the mtime.</p>
<p><em>This command is not available for Tcl versions less than 8.3.</em></p></dd>
<dt><a name="22"><b class="cmd">::fileutil::tempdir</b></a></dt>
<dd><p>The command returns the path of a directory where the caller can
place temporary files, such as &quot;<b class="file">/tmp</b>&quot; on Unix systems. The
algorithm we use to find the correct directory is as follows:</p>
<ol class="enumerated">
<li><p>The directory set by an invokation of <b class="cmd">::fileutil::tempdir</b> with
an argument. If this is present it is tried exclusively and none of
the following item are tried.</p></li>
<li><p>The directory named in the TMPDIR environment variable.</p></li>
<li><p>The directory named in the TEMP environment variable.</p></li>
<li><p>The directory named in the TMP environment variable.</p></li>
<li><p>A platform specific location:</p>
<dl class="definitions">
<dt>Windows</dt>
<dd><p>&quot;<b class="file">C:\TEMP</b>&quot;, &quot;<b class="file">C:\TMP</b>&quot;, &quot;<b class="file">\TEMP</b>&quot;,
and &quot;<b class="file">\TMP</b>&quot; are tried in that order.</p></dd>
<dt>(classic) Macintosh</dt>
<dd><p>The TRASH_FOLDER environment variable is used.  This is most likely
not correct.</p></dd>
<dt>Unix</dt>
<dd><p>The directories &quot;<b class="file">/tmp</b>&quot;, &quot;<b class="file">/var/tmp</b>&quot;, and &quot;<b class="file">/usr/tmp</b>&quot; are
tried in that order.</p></dd>
</dl>
</li>
</ol>
<p>The algorithm utilized is mainly that used in the Python standard
library. The exception is the first item, the ability to have the
search overridden by a user-specified directory.</p></dd>
<dt><a name="23"><b class="cmd">::fileutil::tempdir</b> <i class="arg">path</i></a></dt>
<dd><p>In this mode the command sets the <i class="arg">path</i> as the first and only
directory to try as a temp. directory. See the previous item for the
use of the set directory. The command returns the empty string.</p></dd>
<dt><a name="24"><b class="cmd">::fileutil::tempdirReset</b></a></dt>
<dd><p>Invoking this command clears the information set by the
last call of [<b class="cmd">::fileutil::tempdir</b> <i class="arg">path</i>].
See the last item too.</p></dd>
<dt><a name="25"><b class="cmd">::fileutil::tempfile</b> <span class="opt">?<i class="arg">prefix</i>?</span></a></dt>
<dd><p>The command generates a temporary file name suitable for writing to,
and the associated file.  The file name will be unique, and the file
will be writable and contained in the appropriate system specific temp
directory. The name of the file will be returned as the result of the
command.</p>
<p>The code was taken from <a href="http://wiki.tcl.tk/772">http://wiki.tcl.tk/772</a>, attributed to
Igor Volobouev and anon.</p></dd>
<dt><a name="26"><b class="cmd">::fileutil::relative</b> <i class="arg">base</i> <i class="arg">dst</i></a></dt>
<dd><p>This command takes two directory paths, both either absolute or relative
and computes the path of <i class="arg">dst</i> relative to <i class="arg">base</i>. This relative
path is returned as the result of the command. As implied in the previous
sentence, the command is not able to compute this relationship between the
arguments if one of the paths is absolute and the other relative.</p>
<p><em>Note:</em> The processing done by this command is purely lexical.
Symbolic links are <em>not</em> taken into account.</p></dd>
<dt><a name="27"><b class="cmd">::fileutil::relativeUrl</b> <i class="arg">base</i> <i class="arg">dst</i></a></dt>
<dd><p>This command takes two file paths, both either absolute or relative
and computes the path of <i class="arg">dst</i> relative to <i class="arg">base</i>, as seen
from inside of the <i class="arg">base</i>. This is the algorithm how a browser
resolves a relative link found in the currently shown file.</p>
<p>The computed relative path is returned as the result of the command.
As implied in the previous sentence, the command is not able to compute
this relationship between the arguments if one of the paths is absolute
and the other relative.</p>
<p><em>Note:</em> The processing done by this command is purely lexical.
Symbolic links are <em>not</em> taken into account.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key265">cat</a>, <a href="../../../../index.html#key106">file utilities</a>, <a href="../../../../index.html#key268">grep</a>, <a href="../../../../index.html#key267">temp file</a>, <a href="../../../../index.html#key266">test</a>, <a href="../../../../index.html#key269">touch</a>, <a href="../../../../index.html#key109">type</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fileutil/multi.html.














































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil::multi - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fileutil/multi.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil::multi.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil::multi(n) 0.1 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil::multi - Multi-file operation, scatter/gather, standard object</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">fileutil::multi <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">fileutil::multi::op <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">wip <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::multi</b> <span class="opt">?<i class="arg">word</i>...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a single command to perform actions on multiple
files selected by glob patterns. It is a thin layer over the package
<b class="package"><a href="multiop.html">fileutil::multi::op</a></b> which provides objects for the
same. This package simply creates a single such object and directs all
file commands to it.</p>
<p>At the core is a domain specific language allowing the easy
specification of multi-file copy and/or move and/or deletion
operations. Alternate names would be scatter/gather processor, or
maybe even assembler.
For the detailed specification of this language, and examples, please
see the documention for the package <b class="package"><a href="multiop.html">fileutil::multi::op</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<p>The main command of the package is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::multi</b> <span class="opt">?<i class="arg">word</i>...?</span></a></dt>
<dd><p>This command interprets the specified words as file commands to
execute. See the section <b class="sectref">FILE API</b> of the
documentation for the package <b class="package"><a href="multiop.html">fileutil::multi::op</a></b> for
the set of acceptable commands, their syntax, and semantics.</p>
<p>The result of the command is the result generated by the last file
command it executed.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key61">copy</a>, <a href="../../../../index.html#key106">file utilities</a>, <a href="../../../../index.html#key210">move</a>, <a href="../../../../index.html#key208">multi-file</a>, <a href="../../../../index.html#key209">remove</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fileutil/multiop.html.











































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil::multi::op - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fileutil/multiop.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil::multi::op.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil::multi::op(n) 0.5.3 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil::multi::op - Multi-file operation, scatter/gather</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">CLASS API</a></li>
<li class="section"><a href="#section3">OBJECT API</a></li>
<li class="section"><a href="#section4">FILE API</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">fileutil::multi::op <span class="opt">?0.5.3?</span></b></li>
<li>package require <b class="pkgname">wip <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::multi::op</b> <span class="opt">?<i class="arg">opName</i>?</span> <span class="opt">?<i class="arg">word</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">opName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><b class="cmd">$opName</b> <b class="method">do</b> <span class="opt">?<i class="arg">word</i>...?</span></a></li>
<li><a href="#4"><b class="cmd">into</b> <i class="arg">directory</i></a></li>
<li><a href="#5"><b class="cmd">in</b> <i class="arg">directory</i></a></li>
<li><a href="#6"><b class="cmd">to</b> <i class="arg">directory</i></a></li>
<li><a href="#7"><b class="cmd">from</b> <i class="arg">directory</i></a></li>
<li><a href="#8"><b class="cmd">not</b> <i class="arg">pattern</i></a></li>
<li><a href="#9"><b class="cmd">for</b> <i class="arg">pattern</i></a></li>
<li><a href="#10"><b class="cmd">exclude</b> <i class="arg">pattern</i></a></li>
<li><a href="#11"><b class="cmd">but</b></a></li>
<li><a href="#12"><b class="cmd">except</b></a></li>
<li><a href="#13"><b class="cmd">as</b> <i class="arg">name</i></a></li>
<li><a href="#14"><b class="cmd">recursive</b></a></li>
<li><a href="#15"><b class="cmd">recursively</b></a></li>
<li><a href="#16"><b class="cmd"><a href="../../../../index.html#key61">copy</a></b></a></li>
<li><a href="#17"><b class="cmd"><a href="../../../../index.html#key210">move</a></b></a></li>
<li><a href="#18"><b class="cmd"><a href="../../../../index.html#key209">remove</a></b></a></li>
<li><a href="#19"><b class="cmd">expand</b></a></li>
<li><a href="#20"><b class="cmd">invoke</b> <i class="arg">cmdprefix</i></a></li>
<li><a href="#21"><b class="cmd">reset</b></a></li>
<li><a href="#22"><b class="cmd">(</b></a></li>
<li><a href="#23"><b class="cmd">)</b></a></li>
<li><a href="#24"><b class="cmd">cd</b> <i class="arg">directory</i></a></li>
<li><a href="#25"><b class="cmd">up</b></a></li>
<li><a href="#26"><b class="cmd">for-windows</b></a></li>
<li><a href="#27"><b class="cmd">for-win</b></a></li>
<li><a href="#28"><b class="cmd">for-unix</b></a></li>
<li><a href="#29"><b class="cmd">the</b> <i class="arg">pattern</i></a></li>
<li><a href="#30"><b class="cmd">the-set</b> <i class="arg">varname</i></a></li>
<li><a href="#31"><b class="cmd">-&gt;</b> <i class="arg">varname</i></a></li>
<li><a href="#32"><b class="cmd">strict</b></a></li>
<li><a href="#33"><b class="cmd">!strict</b></a></li>
<li><a href="#34"><b class="cmd">files</b></a></li>
<li><a href="#35"><b class="cmd">links</b></a></li>
<li><a href="#36"><b class="cmd">directories</b></a></li>
<li><a href="#37"><b class="cmd">dirs</b></a></li>
<li><a href="#38"><b class="cmd">all</b></a></li>
<li><a href="#39"><b class="cmd">state?</b></a></li>
<li><a href="#40"><b class="cmd">as?</b></a></li>
<li><a href="#41"><b class="cmd">excluded?</b></a></li>
<li><a href="#42"><b class="cmd">from?</b></a></li>
<li><a href="#43"><b class="cmd">into?</b></a></li>
<li><a href="#44"><b class="cmd">operation?</b></a></li>
<li><a href="#45"><b class="cmd">recursive?</b></a></li>
<li><a href="#46"><b class="cmd">strict?</b></a></li>
<li><a href="#47"><b class="cmd">type?</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects which are able to perform actions on
multiple files selected by glob patterns.</p>
<p>At the core is a domain specific language allowing the easy
specification of multi-file copy and/or move and/or deletion
operations. Alternate names would be scatter/gather processor, or
maybe even assembler.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">CLASS API</a></h2>
<p>The main command of the package is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::multi::op</b> <span class="opt">?<i class="arg">opName</i>?</span> <span class="opt">?<i class="arg">word</i>...?</span></a></dt>
<dd><p>The command creates a new multi-file operation object with an
associated global Tcl command whose name is <i class="arg">opName</i>.  This
command can be used to invoke the various possible file operations.
It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">opName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>If the string <b class="const">%AUTO%</b> is used as the <i class="arg">opName</i> then the
package will generate a unique name on its own.</p>
<p>If one or more <i class="arg">word</i>s are specified they are interpreted as an
initial set of file commands to execute. I.e. the method <b class="method">do</b>
of the newly constructed object is implicitly invoked using the words
as its arguments.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OBJECT API</a></h2>
<p>The following methods are possible for multi-file operation objects:</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">$opName</b> <b class="method">do</b> <span class="opt">?<i class="arg">word</i>...?</span></a></dt>
<dd><p>This method interprets the specified words as file commands to
execute. See the section <span class="sectref"><a href="#section4">FILE API</a></span> for the set of
acceptable commands, their syntax, and semantics.</p>
<p>The result of the method is the result generated by the last file
command it executed.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">FILE API</a></h2>
<p>Both object constructor and method <b class="method">do</b> take a list of words
and interpret them as file commands to execute. The names were chosen
to allow the construction of operations as sentences in near-natural
language. Most of the commands influence just the state of the object,
i.e. are simply providing the configuration used by the command
triggering the actual action.</p>
<dl class="definitions">
<dt><a name="4"><b class="cmd">into</b> <i class="arg">directory</i></a></dt>
<dd><p>Specifies the destination directory for operations.</p></dd>
<dt><a name="5"><b class="cmd">in</b> <i class="arg">directory</i></a></dt>
<dd><p>Alias for <b class="cmd">into</b>.</p></dd>
<dt><a name="6"><b class="cmd">to</b> <i class="arg">directory</i></a></dt>
<dd><p>Alias for <b class="cmd">into</b>.</p></dd>
<dt><a name="7"><b class="cmd">from</b> <i class="arg">directory</i></a></dt>
<dd><p>Specifies the source directory for operations.</p></dd>
<dt><a name="8"><b class="cmd">not</b> <i class="arg">pattern</i></a></dt>
<dd><p>Specifies a glob pattern for paths to be excluded from the operation.</p></dd>
<dt><a name="9"><b class="cmd">for</b> <i class="arg">pattern</i></a></dt>
<dd><p>Alias for <b class="cmd">not</b>.</p></dd>
<dt><a name="10"><b class="cmd">exclude</b> <i class="arg">pattern</i></a></dt>
<dd><p>Alias for <b class="cmd">not</b>.</p></dd>
<dt><a name="11"><b class="cmd">but</b></a></dt>
<dd><p>Has no arguments of its own, but looks ahead in the list of words and
executes all <b class="cmd">not</b> commands immediately following it. This allows the
construction of &quot;but not&quot; and &quot;but exclude&quot; clauses for a more natural
sounding specification of excluded paths.</p></dd>
<dt><a name="12"><b class="cmd">except</b></a></dt>
<dd><p>A semi-alias for <b class="cmd">but</b>. Has no arguments of its own, but looks
ahead in the list of words and executes all <b class="cmd">for</b> commands
immediately following it. This allows the construction of &quot;except for&quot;
clauses for a more natural sounding specification of excluded paths.</p></dd>
<dt><a name="13"><b class="cmd">as</b> <i class="arg">name</i></a></dt>
<dd><p>Specifies a new name for the first file handled by the current
operation. I.e. for the renaming of a single file during the
operation.</p></dd>
<dt><a name="14"><b class="cmd">recursive</b></a></dt>
<dd><p>Signals that file expansion should happen in the whole directory
hierarchy and not just the directory itself.</p></dd>
<dt><a name="15"><b class="cmd">recursively</b></a></dt>
<dd><p>An alias for <b class="cmd">recursive</b>.</p></dd>
<dt><a name="16"><b class="cmd"><a href="../../../../index.html#key61">copy</a></b></a></dt>
<dd><p>Signals that the operation is the copying of files from source to
destination directory per the specified inclusion and exclusion
patterns.</p></dd>
<dt><a name="17"><b class="cmd"><a href="../../../../index.html#key210">move</a></b></a></dt>
<dd><p>Signals that the operation is the moving of files from source to
destination directory per the specified inclusion and exclusion
patterns.</p></dd>
<dt><a name="18"><b class="cmd"><a href="../../../../index.html#key209">remove</a></b></a></dt>
<dd><p>Signals that the operation is the removal of files in the destination
directory per the specified inclusion and exclusion patterns.</p></dd>
<dt><a name="19"><b class="cmd">expand</b></a></dt>
<dd><p>Signals that there is no operation but the calculation of the set of
files from the include and exclude patterns. This operation is not
available if <b class="cmd">the-set</b> is used.</p></dd>
<dt><a name="20"><b class="cmd">invoke</b> <i class="arg">cmdprefix</i></a></dt>
<dd><p>Signals that the user-specified command prefix <i class="arg">cmdprefix</i> is the
operation to perform. The command prefix is executed at the global
level and given the source directory, destination directory, and set
of files (as dictionary mapping from source to destination files), in
this order.</p></dd>
<dt><a name="21"><b class="cmd">reset</b></a></dt>
<dd><p>Forces the object into the ground state where all parts of the
configuration have default values.</p></dd>
<dt><a name="22"><b class="cmd">(</b></a></dt>
<dd><p>Saves a copy of the current object state on a stack.</p></dd>
<dt><a name="23"><b class="cmd">)</b></a></dt>
<dd><p>Takes the state at the top of the state stack and restores it,
i.e. makes it the new current object state.</p></dd>
<dt><a name="24"><b class="cmd">cd</b> <i class="arg">directory</i></a></dt>
<dd><p>Changes the destination directory to the sub-directory <i class="arg">directory</i>
of the current destination.</p></dd>
<dt><a name="25"><b class="cmd">up</b></a></dt>
<dd><p>Changes the destination directory to the parent directory of the
current destination.</p></dd>
<dt><a name="26"><b class="cmd">for-windows</b></a></dt>
<dd><p>Checks that Windows is the current platform. Aborts processing if not.</p></dd>
<dt><a name="27"><b class="cmd">for-win</b></a></dt>
<dd><p>An alias for <b class="cmd">for-windows</b>.</p></dd>
<dt><a name="28"><b class="cmd">for-unix</b></a></dt>
<dd><p>Checks that Unix is the current platform. Aborts processing if not.</p></dd>
<dt><a name="29"><b class="cmd">the</b> <i class="arg">pattern</i></a></dt>
<dd><p>This command specifies the files to operate on per a glob pattern, and
is also the active element, i.e. the command which actually performs
the specified operation. All the other commands only modified the
object state to set the operation up, but di nothing else.</p>
<p>To allow for a more natural sounding syntax this command also looks
ahead in the list of words looks and executes several commands
immediately following it before performing its own actions.
These commands are <b class="cmd">as</b>, <b class="cmd">but</b>, <b class="cmd">exclude</b>, <b class="cmd">except</b>,
<b class="cmd">from</b>, and <b class="cmd">into</b> (and aliases). That way these commands act
like qualifiers, and still take effect as if they had been written
before this command.</p>
<p>After the operation has been performed the object state the exclude
patterns and the alias name, if specified, are reset to their default
values (i.e. empty), but nothing else.</p></dd>
<dt><a name="30"><b class="cmd">the-set</b> <i class="arg">varname</i></a></dt>
<dd><p>Like <b class="cmd">the</b>, however the set of files to use is not specified
implicitly per a glob pattern, but contained and loaded from the 
specified variable. The operation <b class="cmd">expand</b> is not available
if this command is used.</p></dd>
<dt><a name="31"><b class="cmd">-&gt;</b> <i class="arg">varname</i></a></dt>
<dd><p>Saves the set of files from the last expansion into the specified
variable.</p></dd>
<dt><a name="32"><b class="cmd">strict</b></a></dt>
<dd><p>Make file expansion and definition of destination directory (<b class="cmd">in</b>
and aliases) strict, i.e. report errors for missing directories, and
empty expansion.</p></dd>
<dt><a name="33"><b class="cmd">!strict</b></a></dt>
<dd><p>Complement of <b class="cmd">strict</b>. A missing destination directory or empty
expansion are not reported as errors.</p></dd>
<dt><a name="34"><b class="cmd">files</b></a></dt>
<dd><p>Limit the search to files. Default is to accept every type of path.</p></dd>
<dt><a name="35"><b class="cmd">links</b></a></dt>
<dd><p>Limit the search to symbolic links. Default is to accept every type of path.</p></dd>
<dt><a name="36"><b class="cmd">directories</b></a></dt>
<dd><p>Limit the search to directories. Default is to accept every type of path.</p></dd>
<dt><a name="37"><b class="cmd">dirs</b></a></dt>
<dd><p>An alias for <b class="cmd">directories</b>.</p></dd>
<dt><a name="38"><b class="cmd">all</b></a></dt>
<dd><p>Accept all types of paths (default).</p></dd>
<dt><a name="39"><b class="cmd">state?</b></a></dt>
<dd><p>Returns the current state of the object as dictionary. The dictionary keys and their meanings are:</p>
<dl class="definitions">
<dt><b class="const">as</b></dt>
<dd><p>Last setting made by <b class="cmd">as</b>.</p></dd>
<dt><b class="const">excluded</b></dt>
<dd><p>List of currently known exclusion patterns.</p></dd>
<dt><b class="const">from</b></dt>
<dd><p>Current source directory, set by <b class="cmd">from</b>.</p></dd>
<dt><b class="const">into</b></dt>
<dd><p>Current destination directory, set by <b class="cmd">into</b> (and aliases).</p></dd>
<dt><b class="const">operation</b></dt>
<dd><p>Current operation to perform, set by <b class="cmd"><a href="../../../../index.html#key61">copy</a></b>, <b class="cmd"><a href="../../../../index.html#key210">move</a></b>, <b class="cmd"><a href="../../../../index.html#key209">remove</a></b>, <b class="cmd">expand</b>, or <b class="cmd">invoke</b>.</p></dd>
<dt><b class="const">recursive</b></dt>
<dd><p>Current recursion status. Set/unset by <b class="cmd">recursive</b> and <b class="cmd">!recursive</b>.</p></dd>
<dt><b class="const">strict</b></dt>
<dd><p>Current strictness. Set/unset by <b class="cmd">strict</b> and <b class="cmd">!strict</b>.</p></dd>
<dt><b class="const">type</b></dt>
<dd><p>Current path type limiter. Set by either <b class="cmd">files</b>, <b class="cmd">directories</b>, <b class="cmd">links</b>, or <b class="cmd">all</b>.</p></dd>
</dl></dd>
<dt><a name="40"><b class="cmd">as?</b></a></dt>
<dd><p>Returns the current alias name.</p></dd>
<dt><a name="41"><b class="cmd">excluded?</b></a></dt>
<dd><p>Returns the current set of exclusion patterns.</p></dd>
<dt><a name="42"><b class="cmd">from?</b></a></dt>
<dd><p>Returns the current source directory.</p></dd>
<dt><a name="43"><b class="cmd">into?</b></a></dt>
<dd><p>Returns the current destination directory.</p></dd>
<dt><a name="44"><b class="cmd">operation?</b></a></dt>
<dd><p>Returns the current operation to perform.</p></dd>
<dt><a name="45"><b class="cmd">recursive?</b></a></dt>
<dd><p>Returns the current recursion status.</p></dd>
<dt><a name="46"><b class="cmd">strict?</b></a></dt>
<dd><p>Returns the current strictness.</p></dd>
<dt><a name="47"><b class="cmd">type?</b></a></dt>
<dd><p>Returns the current path type limiter.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<p>The following examples assume that the variable <b class="variable">F</b> contains a
reference to a multi-file operation object.</p>
<pre class="example">
    $F do copy                       \\
	the  *.dll                    \\
	from c:/TDK/PrivateOpenSSL/bin \\
	to   [installdir_of tls]
</pre>
<pre class="example">
    $F do move      \\
	the  *       \\
	from /sources \\
	into /scratch  \\
	but not *.html
    # Alternatively use 'except for *.html'.
</pre>
<pre class="example">
    $F do           \\
	move         \\
	the  index    \\
	from /sources  \\
	into /scratch   \\
	as   pkgIndex.tcl
</pre>
<pre class="example">
    $F do         \\
	remove     \\
	the *.txt  \\
	in /scratch
</pre>
<p>Note that the fact that most commands just modify the object state
allows us to use more off forms as specifications instead of just
nearly-natural language sentences.
For example the second example in this section can re-arranged into:</p>
<pre class="example">
    $F do            \\
	from /sources \\
	into /scratch  \\
	but not *.html \\
	move           \\
	the  *
</pre>
<p>and the result is not only still a valid specification, but even stays
relatively readable.</p>
<p>Further note that the information collected by the commands <b class="cmd">but</b>,
<b class="cmd">except</b>, and <b class="cmd">as</b> is automatically reset after the associated
<b class="cmd">the</b> was executed. However no other state is reset in that
manner, allowing the user to avoid repetitions of unchanging
information. For example the second and third examples of this section
can be merged and rewritten into the equivalent:</p>
<pre class="example">
$F do                   \\
    move                 \\
    the  *                \\
    from /sources          \\
    into /scratch           \\
    but not *.html not index \\
    the  index               \\
    as   pkgIndex.tcl
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key61">copy</a>, <a href="../../../../index.html#key106">file utilities</a>, <a href="../../../../index.html#key210">move</a>, <a href="../../../../index.html#key208">multi-file</a>, <a href="../../../../index.html#key209">remove</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fileutil/traverse.html.








































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil_traverse - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fileutil/traverse.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil_traverse.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil_traverse(n) 0.4.3 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil_traverse - Iterative directory traversal</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OPTIONS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">fileutil::traverse <span class="opt">?0.4.3?</span></b></li>
<li>package require <b class="pkgname">fileutil</b></li>
<li>package require <b class="pkgname">control</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::traverse</b> <span class="opt">?<i class="arg">objectName</i>?</span> <i class="arg">path</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">$traverser</b> <b class="method">command</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><b class="cmd">$traverser</b> <b class="method">files</b></a></li>
<li><a href="#4"><b class="cmd">$traverser</b> <b class="method">foreach</b> <i class="arg">filevar</i> <i class="arg">script</i></a></li>
<li><a href="#5"><b class="cmd">$traverser</b> <b class="method">next</b> <i class="arg">filevar</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects for the programmable traversal of
directory hierarchies.
The main command exported by the package is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::traverse</b> <span class="opt">?<i class="arg">objectName</i>?</span> <i class="arg">path</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></dt>
<dd><p>The command creates a new traversal object with an associated global
Tcl command whose name is <i class="arg">objectName</i>. This command may be used
to invoke various operations on the traverser.
If the string <b class="const">%AUTO%</b> is used as the <i class="arg">objectName</i> then a
unique name will be generated by the package itself.</p>
<p>Regarding the recognized options see section <span class="sectref"><a href="#section2">OPTIONS</a></span>. Note
that all these options can be set only during the creation of the
traversal object. Changing them later is not possible and causes
errors to be thrown if attempted.</p>
<p>The object command has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">$traverser</b> <b class="method">command</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Command</i> and its <i class="arg">arg</i>uments determine the exact behavior of
the object.</p></dd>
</dl></dd>
</dl>
<p>The following commands are possible for traversal objects:</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">$traverser</b> <b class="method">files</b></a></dt>
<dd><p>This method is the most highlevel one provided by traversal
objects. When invoked it returns a list containing the names of all
files and directories matching the current configuration of the
traverser.</p></dd>
<dt><a name="4"><b class="cmd">$traverser</b> <b class="method">foreach</b> <i class="arg">filevar</i> <i class="arg">script</i></a></dt>
<dd><p>The highlevel <b class="method">files</b> method (see above) is based on this
mid-level method. When invoked it finds all files and directories
matching per the current configuration and executes the <i class="arg">script</i>
for each path. The current path under consideration is stored in the
variable named by <i class="arg">filevar</i>. Both variable and script live / are
executed in the context of the caller of the method. In the method
<b class="method">files</b> the script simply saves the found paths into the list
to return.</p></dd>
<dt><a name="5"><b class="cmd">$traverser</b> <b class="method">next</b> <i class="arg">filevar</i></a></dt>
<dd><p>This is the lowest possible interface to the traverser, the core all
higher methods are built on. When invoked it returns a boolean value
indicating whether it found a path matching the current configuration
(<b class="const">True</b>), or not (<b class="const">False</b>). If a path was found it is
stored into the variable named by <i class="arg">filevar</i>, in the context of the
caller.
The <b class="method">foreach</b> method simply calls this method in a loop until
it returned <b class="const">False</b>. This method is exposed so that we are also
able to incrementally traverse a directory hierarchy in an event-based
manner.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">OPTIONS</a></h2>
<dl class="options">
<dt><b class="option">-prefilter</b> command_prefix</dt>
<dd><p>This callback is executed for directories. Its result determines if
the traverser recurses into the directory or not. The default is to
always recurse into all directories. The callback is invoked with a
single argument, the <em>absolute</em> path of the directory, and has to
return a boolean value, <b class="const">True</b> when the directory passes the
filter, and <b class="const">False</b> if not.</p></dd>
<dt><b class="option">-filter</b> command_prefix</dt>
<dd><p>This callback is executed for all paths. Its result determines if the
current path is a valid result, and returned by <b class="method">next</b>. The
default is to accept all paths as valid. The callback is invoked with
a single argument, the <em>absolute</em> path to check, and has to
return a boolean value, <b class="const">True</b> when the path passes the filter,
and <b class="const">False</b> if not.</p></dd>
<dt><b class="option">-errorcmd</b> command_prefix</dt>
<dd><p>This callback is executed for all paths the traverser has trouble
with. Like being unable to change into them, get their status,
etc. The default is to ignore any such problems. The callback is
invoked with a two arguments, the <em>absolute</em> path for which the
error occured, and the error message. Errors thrown by the filter
callbacks are handled through this callback too. Errors thrown by the
error callback itself are not caught and ignored, but allowed to pass
to the caller, i.e. however invoked the <b class="method">next</b>. Any other
results from the callback are ignored.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key668">directory traversal</a>, <a href="../../../../index.html#key667">traversal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ftp/ftp.html.





























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>ftp - ftp client</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ftp/ftp.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ ftp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ftp(n) 2.4.11 tcllib &quot;ftp client&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ftp - Client-side tcl implementation of the ftp protocol</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">ftp <span class="opt">?2.4.11?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ftp::Open</b> <i class="arg">server</i> <i class="arg">user</i> <i class="arg">passwd</i> <span class="opt">?<i class="arg">options</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::ftp::Close</b> <i class="arg">handle</i></a></li>
<li><a href="#3"><b class="cmd">::ftp::Cd</b> <i class="arg">handle</i> <i class="arg">directory</i></a></li>
<li><a href="#4"><b class="cmd">::ftp::Pwd</b> <i class="arg">handle</i></a></li>
<li><a href="#5"><b class="cmd">::ftp::Type</b> <i class="arg">handle</i> <span class="opt">?<b class="const">ascii|binary|tenex</b>?</span></a></li>
<li><a href="#6"><b class="cmd">::ftp::List</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::ftp::NList</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">directory</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::ftp::FileSize</b> <i class="arg">handle</i> <i class="arg">file</i></a></li>
<li><a href="#9"><b class="cmd">::ftp::ModTime</b> <i class="arg">handle</i> <i class="arg">file</i></a></li>
<li><a href="#10"><b class="cmd">::ftp::Delete</b> <i class="arg">handle</i> <i class="arg">file</i></a></li>
<li><a href="#11"><b class="cmd">::ftp::Rename</b> <i class="arg">handle</i> <i class="arg">from</i> <i class="arg">to</i></a></li>
<li><a href="#12"><b class="cmd">::ftp::Put</b> <i class="arg">handle</i> (<i class="arg">local</i> | -data <i class="arg">data</i> | -channel <i class="arg">chan</i>) <span class="opt">?<i class="arg">remote</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::ftp::Append</b> <i class="arg">handle</i> (<i class="arg">local</i> | -data <i class="arg">data</i> | -channel <i class="arg">chan</i>) <span class="opt">?<i class="arg">remote</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::ftp::Get</b> <i class="arg">handle</i> <i class="arg">remote</i> <span class="opt">?(<i class="arg">local</i> | -variable <i class="arg">varname</i> | -channel <i class="arg">chan</i>)?</span></a></li>
<li><a href="#15"><b class="cmd">::ftp::Reget</b> <i class="arg">handle</i> <i class="arg">remote</i> <span class="opt">?<i class="arg">local</i>?</span> <span class="opt">?<i class="arg">from</i>?</span> <span class="opt">?<i class="arg">to</i>?</span></a></li>
<li><a href="#16"><b class="cmd">::ftp::Newer</b> <i class="arg">handle</i> <i class="arg">remote</i> <span class="opt">?<i class="arg">local</i>?</span></a></li>
<li><a href="#17"><b class="cmd">::ftp::MkDir</b> <i class="arg">handle</i> <i class="arg">directory</i></a></li>
<li><a href="#18"><b class="cmd">::ftp::RmDir</b> <i class="arg">handle</i> <i class="arg">directory</i></a></li>
<li><a href="#19"><b class="cmd">::ftp::Quote</b> <i class="arg">handle</i> <i class="arg">arg1</i> <i class="arg">arg2</i> <i class="arg">...</i></a></li>
<li><a href="#20"><b class="cmd">::ftp::DisplayMsg</b> <i class="arg">handle</i> <i class="arg">msg</i> <span class="opt">?<i class="arg">state</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The ftp package provides the client side of the ftp protocol as
specified in RFC 959 (<a href="http://www.rfc-editor.org/rfc/rfc959.txt">http://www.rfc-editor.org/rfc/rfc959.txt</a>).
The package implements both active (default) and passive ftp sessions.</p>
<p>A new ftp session is started with the <b class="cmd">::ftp::Open</b> command. To
shutdown an existing ftp session use <b class="cmd">::ftp::Close</b>. All other
commands are restricted to usage in an an open ftp session. They will
generate errors if they are used out of context.  The ftp package
includes file and directory manipulating commands for remote sites. To
perform the same operations on the local site use commands built into
the core, like <b class="cmd">cd</b> or <b class="cmd"><a href="../../../../index.html#key31">file</a></b>.</p>
<p>The output of the package is controlled by two state variables,
<b class="variable">::ftp::VERBOSE</b> and <b class="variable">::ftp::DEBUG</b>. Setting
<b class="variable">::ftp::VERBOSE</b> to &quot;1&quot; forces the package to show all responses
from a remote server. The default value is &quot;0&quot;. Setting
<b class="variable">::ftp::DEBUG</b> to &quot;1&quot; enables debugging and forces the package to
show all return codes, states, state changes and &quot;real&quot; ftp
commands. The default value is &quot;0&quot;.</p>
<p>The command <b class="cmd">::ftp::DisplayMsg</b> is used to show the different
messages from the ftp session. The setting of <b class="variable">::ftp::VERBOSE</b>
determines if this command is called or not. The current
implementation of the command uses the <b class="package"><a href="../log/log.html">log</a></b> package of tcllib
to write the messages to their final destination. This means that the
behaviour of <b class="cmd">::ftp::DisplayMsg</b> can be customized without
changing its implementation. For more radical changes overwriting its
implementation by the application is of course still possible. Note
that the default implementation honors the option <b class="option">-output</b> to
<b class="cmd">::ftp::Open</b> for a session specific log command.</p>
<p><em>Caution</em>: The default implementation logs error messages like
all other messages. If this behaviour is changed to throwing an error
instead all commands in the API will change their behaviour too. In
such a case they will not return a failure code as described below but
pass the thrown error to their caller.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ftp::Open</b> <i class="arg">server</i> <i class="arg">user</i> <i class="arg">passwd</i> <span class="opt">?<i class="arg">options</i>?</span></a></dt>
<dd><p>This command is used to start a FTP session by establishing a control
connection to the FTP server. The defaults are used for any option not
specified by the caller.</p>
<p>The command takes a host name <i class="arg">server</i>, a user name <i class="arg">user</i> and
a password <i class="arg">password</i> as its parameters and returns a session
handle that is an integer number greater than or equal to &quot;0&quot;, if the
connection is successfully established. Otherwise it returns &quot;-1&quot;.
The <i class="arg">server</i> parameter must be the name or internet address (in
dotted decimal notation) of the ftp server to connect to. The
<i class="arg">user</i> and <i class="arg">passwd</i> parameters must contain a valid user name
and password to complete the login process.</p>
<p>The options overwrite some default values or set special abilities:</p>
<dl class="definitions">
<dt><b class="option">-blocksize</b> <i class="arg">size</i></dt>
<dd><p>The blocksize is used during data transfer. At most <i class="arg">size</i> bytes
are transfered at once. The default value for this option is 4096.
The package will evaluate the <b class="cmd">-progress callback</b> for the
session after the transfer of each block.</p></dd>
<dt><b class="option">-timeout</b> <i class="arg">seconds</i></dt>
<dd><p>If <i class="arg">seconds</i> is non-zero, then <b class="cmd">::ftp::Open</b> sets up a timeout
which will occur after the specified number of seconds. The default
value is 600.</p></dd>
<dt><b class="option">-port</b> <i class="arg">number</i></dt>
<dd><p>The port <i class="arg">number</i> specifies an alternative remote port on the ftp
server on which the ftp service resides. Most ftp services listen for
connection requests on the default port 21. Sometimes, usually for
security reasons, port numbers other than 21 are used for ftp
connections.</p></dd>
<dt><b class="option">-mode</b> <i class="arg">mode</i></dt>
<dd><p>The transfer <i class="arg">mode</i> option determines if a file transfer occurs in
<b class="const">active</b> or <b class="const">passive</b> mode. In passive mode the client
will ask the ftp server to listen on a data port and wait for the
connection rather than to initiate the process by itself when a data
transfer request comes in. Passive mode is normally a requirement when
accessing sites via a firewall. The default mode is <b class="const">active</b>.</p></dd>
<dt><b class="option">-progress</b> <i class="arg">callback</i></dt>
<dd><p>This <i class="arg">callback</i> is evaluated whenever a block of data was
transfered. See the option <b class="option">-blocksize</b> for how to specify the
size of the transfered blocks.</p>
<p>When evaluating the <i class="arg">callback</i> one argument is appended to the
callback script, the current accumulated number of bytes transferred
so far.</p></dd>
<dt><b class="option">-command</b> <i class="arg">callback</i></dt>
<dd><p>Specifying this option places the connection into asynchronous
mode. The <i class="arg">callback</i> is evaluated after the completion of any
operation. When an operation is running no further operations must be
started until a callback has been received for the currently executing
operation.</p>
<p>When evaluating the <i class="arg">callback</i> several arguments are appended to
the callback script, namely the keyword of the operation that has
completed and any additional arguments specific to the operation.  If
an error occurred during the execution of the operation the callback is
given the keyword <b class="const">error</b>.</p></dd>
<dt><b class="option">-output</b> <i class="arg">callback</i></dt>
<dd><p>This option has no default. If it is set the default implementation of
<b class="cmd">::ftp::DisplayMsg</b> will use its value as command prefix to log
all internal messages. The callback will have three arguments appended
to it before evaluation, the id of the session, the message itself,
and the connection state, in this order.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::ftp::Close</b> <i class="arg">handle</i></a></dt>
<dd><p>This command terminates the specified ftp session. If no file transfer
is in progress, the server will close the control connection
immediately. If a file transfer is in progress however, the control
connection will remain open until the transfers completes. When that
happens the server will write the result response for the transfer to
it and close the connection afterward.</p></dd>
<dt><a name="3"><b class="cmd">::ftp::Cd</b> <i class="arg">handle</i> <i class="arg">directory</i></a></dt>
<dd><p>This command changes the current working directory on the ftp server
to a specified target <i class="arg">directory</i>.  The command returns 1 if the
current working directory was successfully changed to the specified
directory or 0 if it fails.  The target directory can be</p>
<ul class="itemized">
<li><p>a subdirectory of the current directory,</p></li>
<li><p>Two dots, <b class="const">..</b>  (as an indicator for the parent directory of
the current directory)</p></li>
<li><p>or a fully qualified path to a new working directory.</p></li>
</ul></dd>
<dt><a name="4"><b class="cmd">::ftp::Pwd</b> <i class="arg">handle</i></a></dt>
<dd><p>This command returns the complete path of the current working
directory on the ftp server, or an empty string in case of an error.</p></dd>
<dt><a name="5"><b class="cmd">::ftp::Type</b> <i class="arg">handle</i> <span class="opt">?<b class="const">ascii|binary|tenex</b>?</span></a></dt>
<dd><p>This command sets the ftp file transfer type to either <b class="const">ascii</b>,
<b class="const">binary</b>, or <b class="const">tenex</b>. The command always returns the
currently set type. If called without type no change is made.</p>
<p>Currently only <b class="const">ascii</b> and <b class="const">binary</b> types are
supported. There is some early (alpha) support for Tenex mode. The
type <b class="const">ascii</b> is normally used to convert text files into a
format suitable for text editors on the platform of the destination
machine. This mainly affects end-of-line markers. The type
<b class="const">binary</b> on the other hand allows the undisturbed transfer of
non-text files, such as compressed files, images and executables.</p></dd>
<dt><a name="6"><b class="cmd">::ftp::List</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>This command returns a human-readable list of files.  Wildcard
expressions such as &quot;<b class="file">*.tcl</b>&quot; are allowed.  If <i class="arg">pattern</i>
refers to a specific directory, then the contents of that directory
are returned.  If the <i class="arg">pattern</i> is not a fully-qualified path
name, the command lists entries relative to the current remote
directory.  If no <i class="arg">pattern</i> is specified, the contents of the
current remote directory is returned.</p>
<p>The listing includes any system-dependent information that the server
chooses to include. For example most UNIX systems produce output from
the command <b class="syscmd">ls -l</b>. The command returns the retrieved
information as a tcl list with one item per entry. Empty lines and
UNIX's &quot;total&quot; lines are ignored and not included in the result as
reported by this command.</p>
<p>If the command fails an empty list is returned.</p></dd>
<dt><a name="7"><b class="cmd">::ftp::NList</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">directory</i>?</span></a></dt>
<dd><p>This command has the same behavior as the <b class="cmd">::ftp::List</b> command,
except that it only retrieves an abbreviated listing. This means only
file names are returned in a sorted list.</p></dd>
<dt><a name="8"><b class="cmd">::ftp::FileSize</b> <i class="arg">handle</i> <i class="arg">file</i></a></dt>
<dd><p>This command returns the size of the specified <i class="arg">file</i> on the ftp
server. If the command fails an empty string is returned.</p>
<p><em>ATTENTION!</em> It will not work properly when in ascii mode and
is not supported by all ftp server implementations.</p></dd>
<dt><a name="9"><b class="cmd">::ftp::ModTime</b> <i class="arg">handle</i> <i class="arg">file</i></a></dt>
<dd><p>This command retrieves the time of the last modification of the
<i class="arg">file</i> on the ftp server as a system dependent integer value in
seconds or an empty string if an error occurred. Use the built-in
command <b class="cmd">clock</b> to convert the retrieves value into other formats.</p></dd>
<dt><a name="10"><b class="cmd">::ftp::Delete</b> <i class="arg">handle</i> <i class="arg">file</i></a></dt>
<dd><p>This command deletes the specified <i class="arg">file</i> on the ftp server. The
command returns 1 if the specified file was successfully deleted or 0
if it failed.</p></dd>
<dt><a name="11"><b class="cmd">::ftp::Rename</b> <i class="arg">handle</i> <i class="arg">from</i> <i class="arg">to</i></a></dt>
<dd><p>This command renames the file <i class="arg">from</i> in the current directory of
the ftp server to the specified new file name <i class="arg">to</i>. This new file
name must not be the same as any existing subdirectory or file name.
The command returns 1 if the specified file was successfully renamed
or 0 if it failed.</p></dd>
<dt><a name="12"><b class="cmd">::ftp::Put</b> <i class="arg">handle</i> (<i class="arg">local</i> | -data <i class="arg">data</i> | -channel <i class="arg">chan</i>) <span class="opt">?<i class="arg">remote</i>?</span></a></dt>
<dd><p>This command transfers a local file <i class="arg">local</i> to a remote file
<i class="arg">remote</i> on the ftp server. If the file parameters passed to the
command do not fully qualified path names the command will use the
current directory on local and remote host. If the remote file name is
unspecified, the server will use the name of the local file as the
name of the remote file. The command returns 1 to indicate a successful
transfer and 0 in the case of a failure.</p>
<p>If <b class="option">-data</b> <i class="arg">data</i> is specified instead of a local file, the
system will not transfer a file, but the <i class="arg">data</i> passed into it. In
this case the name of the remote file has to be specified.</p>
<p>If <b class="option">-channel</b> <i class="arg">chan</i> is specified instead of a local file,
the system will not transfer a file, but read the contents of the
channel <i class="arg">chan</i> and write this to the remote file. In this case the
name of the remote file has to be specified. After the transfer
<i class="arg">chan</i> will be closed.</p></dd>
<dt><a name="13"><b class="cmd">::ftp::Append</b> <i class="arg">handle</i> (<i class="arg">local</i> | -data <i class="arg">data</i> | -channel <i class="arg">chan</i>) <span class="opt">?<i class="arg">remote</i>?</span></a></dt>
<dd><p>This command behaves like <b class="cmd">::ftp::Puts</b>, but appends the
transfered information to the remote file. If the file did not exist
on the server it will be created.</p></dd>
<dt><a name="14"><b class="cmd">::ftp::Get</b> <i class="arg">handle</i> <i class="arg">remote</i> <span class="opt">?(<i class="arg">local</i> | -variable <i class="arg">varname</i> | -channel <i class="arg">chan</i>)?</span></a></dt>
<dd><p>This command retrieves a remote file <i class="arg">remote</i> on the ftp server
and stores its contents into the local file <i class="arg">local</i>. If the file
parameters passed to the command are not fully qualified path names
the command will use the current directory on local and remote
host. If the local file name is unspecified, the server will use the
name of the remote file as the name of the local file. The command
returns 1 to indicate a successful transfer and 0 in the case of a
failure. The command will throw an error if the directory the file
<i class="arg">local</i> is to be placed in does not exist.</p>
<p>If <b class="option">-variable</b> <i class="arg">varname</i> is specified, the system will
store the retrieved data into the variable <i class="arg">varname</i> instead of a
file.</p>
<p>If <b class="option">-channel</b> <i class="arg">chan</i> is specified, the system will write
the retrieved data into the channel <i class="arg">chan</i> instead of a file. The
system will <em>not</em> close <i class="arg">chan</i> after the transfer, this is
the responsibility of the caller to <b class="cmd">::ftp::Get</b>.</p></dd>
<dt><a name="15"><b class="cmd">::ftp::Reget</b> <i class="arg">handle</i> <i class="arg">remote</i> <span class="opt">?<i class="arg">local</i>?</span> <span class="opt">?<i class="arg">from</i>?</span> <span class="opt">?<i class="arg">to</i>?</span></a></dt>
<dd><p>This command behaves like <b class="cmd">::ftp::Get</b>, except that if local file
<i class="arg">local</i> exists and is smaller than remote file <i class="arg">remote</i>, the
local file is presumed to be a partially transferred copy of the
remote file and the transfer is continued from the apparent point of
failure.  The command will throw an error if the directory the file
<i class="arg">local</i> is to be placed in does not exist. This command is useful
when transferring very large files over networks that tend to drop
connections.</p>
<p>Specifying the additional byte offsets <i class="arg">from</i> and <i class="arg">to</i> will
cause the command to change its behaviour and to download exactly the
specified slice of the remote file. This mode is possible only if a
local destination is explicitly provided. Omission of <i class="arg">to</i> leads
to downloading till the end of the file.</p></dd>
<dt><a name="16"><b class="cmd">::ftp::Newer</b> <i class="arg">handle</i> <i class="arg">remote</i> <span class="opt">?<i class="arg">local</i>?</span></a></dt>
<dd><p>This command behaves like <b class="cmd">::ftp::Get</b>, except that it retrieves
the remote file only if the modification time of the remote file is
more recent than the file on the local system. If the file does not
exist on the local system, the remote file is considered newer. The
command will throw an error if the directory the file <i class="arg">local</i> is
to be placed in does not exist.</p></dd>
<dt><a name="17"><b class="cmd">::ftp::MkDir</b> <i class="arg">handle</i> <i class="arg">directory</i></a></dt>
<dd><p>This command creates the specified <i class="arg">directory</i> on the ftp
server. If the specified path is relative the new directory will be
created as a subdirectory of the current working directory. Else the
created directory will have the specified path name. The command
returns 1 to indicate a successful creation of the directory and 0 in
the case of a failure.</p></dd>
<dt><a name="18"><b class="cmd">::ftp::RmDir</b> <i class="arg">handle</i> <i class="arg">directory</i></a></dt>
<dd><p>This command removes the specified directory on the ftp server. The
remote directory has to be empty or the command will fail. The command
returns 1 to indicate a successful removal of the directory and 0 in
the case of a failure.</p></dd>
<dt><a name="19"><b class="cmd">::ftp::Quote</b> <i class="arg">handle</i> <i class="arg">arg1</i> <i class="arg">arg2</i> <i class="arg">...</i></a></dt>
<dd><p>This command is used to send an arbitrary ftp command to the
server. It cannot be used to obtain a directory listing or for
transferring files. It is included to allow an application to execute
commands on the ftp server which are not provided by this package.
The arguments are sent verbatim, i.e. as is, with no changes.</p>
<p>In contrast to the other commands in this package this command will
not parse the response it got from the ftp server but return it
verbatim to the caller.</p></dd>
<dt><a name="20"><b class="cmd">::ftp::DisplayMsg</b> <i class="arg">handle</i> <i class="arg">msg</i> <span class="opt">?<i class="arg">state</i>?</span></a></dt>
<dd><p>This command is used by the package itself to show the different
messages from the ftp sessions. The package itself declares this
command very simple, writing the messages to <b class="const">stdout</b> (if
<b class="variable">::ftp::VERBOSE</b> was set, see below) and throwing tcl errors for
error messages. It is the responsibility of the application to
overwrite it as needed. A state variable for different states assigned
to different colors is recommended by the author. The package
<b class="package"><a href="../log/log.html">log</a></b> is useful for this.</p></dd>
<dt><b class="variable">::ftp::VERBOSE</b></dt>
<dd><p>A state variable controlling the output of the package. Setting
<b class="variable">::ftp::VERBOSE</b> to &quot;1&quot; forces the package to show all responses
from a remote server. The default value is &quot;0&quot;.</p></dd>
<dt><b class="variable">::ftp::DEBUG</b></dt>
<dd><p>A state variable controlling the output of ftp. Setting
<b class="variable">::ftp::DEBUG</b> to &quot;1&quot; enables debugging and forces the package to
show all return codes, states, state changes and &quot;real&quot; ftp
commands. The default value is &quot;0&quot;.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS</a></h2>
<p>The correct execution of many commands depends upon the proper
behavior by the remote server, network and router configuration.</p>
<p>An update command placed in the procedure <b class="cmd">::ftp::DisplayMsg</b> may
run into persistent errors or infinite loops. The solution to this
problem is to use <b class="cmd">update idletasks</b> instead of <b class="cmd"><a href="../../../../index.html#key368">update</a></b>.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ftp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../ftpd/ftpd.html">ftpd</a>, <a href="../mime/mime.html">mime</a>, <a href="../pop3/pop3.html">pop3</a>, <a href="../mime/smtp.html">smtp</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key249">ftp</a>, <a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key250">net</a>, <a href="../../../../index.html#key248">rfc 959</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ftp/ftp_geturl.html.















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>ftp::geturl - ftp client</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ftp/ftp_geturl.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ ftp::geturl.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ftp::geturl(n) 0.2.1 tcllib &quot;ftp client&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ftp::geturl - Uri handler for ftp urls</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">ftp::geturl <span class="opt">?0.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ftp::geturl</b> <i class="arg">url</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a command which wraps around the client side of
the <i class="term"><a href="../../../../index.html#key249">ftp</a></i> protocol provided by package <b class="package"><a href="ftp.html">ftp</a></b> to allow the
retrieval of urls using the <i class="term"><a href="../../../../index.html#key249">ftp</a></i> schema.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ftp::geturl</b> <i class="arg">url</i></a></dt>
<dd><p>This command can be used by the generic command <b class="cmd">::uri::geturl</b>
(See package <b class="package"><a href="../uri/uri.html">uri</a></b>) to retrieve the contents of ftp
urls. Internally it uses the commands of the package <b class="package"><a href="ftp.html">ftp</a></b> to
fulfill the request.</p>
<p>The contents of a <i class="term"><a href="../../../../index.html#key249">ftp</a></i> url are defined as follows:</p>
<dl class="definitions">
<dt><i class="term"><a href="../../../../index.html#key31">file</a></i></dt>
<dd><p>The contents of the specified file itself.</p></dd>
<dt><i class="term">directory</i></dt>
<dd><p>A listing of the contents of the directory in key value notation where
the file name is the key and its attributes the associated value.</p></dd>
<dt><i class="term">link</i></dt>
<dd><p>The attributes of the link, including the path it refers to.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ftp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../ftpd/ftpd.html">ftpd</a>, <a href="../mime/mime.html">mime</a>, <a href="../pop3/pop3.html">pop3</a>, <a href="../mime/smtp.html">smtp</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key249">ftp</a>, <a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key250">net</a>, <a href="../../../../index.html#key248">rfc 959</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ftpd/ftpd.html.























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>ftpd - Tcl FTP Server Package</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ftpd/ftpd.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ ftpd.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ftpd(n) 1.2.6 tcllib &quot;Tcl FTP Server Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ftpd - Tcl FTP server implementation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">CALLBACKS</a></li>
<li class="section"><a href="#section4">VARIABLES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">ftpd <span class="opt">?1.2.6?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ftpd::server</b> <span class="opt">?<i class="arg">myaddr</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::ftpd::config</b> <span class="opt">?<i class="arg">option value</i>?</span> <span class="opt">?<i class="arg">option value ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">fsCmd</i> <b class="method">append</b> <i class="arg">path</i></a></li>
<li><a href="#4"><i class="arg">fsCmd</i> <b class="method">delete</b> <i class="arg">path</i> <i class="arg">channel</i></a></li>
<li><a href="#5"><i class="arg">fsCmd</i> <b class="method">dlist</b> <i class="arg">path</i> <i class="arg">style</i> <i class="arg">channel</i></a></li>
<li><a href="#6"><i class="arg">fsCmd</i> <b class="method">exists</b> <i class="arg">path</i></a></li>
<li><a href="#7"><i class="arg">fsCmd</i> <b class="method">mkdir</b> <i class="arg">path</i> <i class="arg">channel</i></a></li>
<li><a href="#8"><i class="arg">fsCmd</i> <b class="method">mtime</b> <i class="arg">path</i> <i class="arg">channel</i></a></li>
<li><a href="#9"><i class="arg">fsCmd</i> <b class="method">permissions</b> <i class="arg">path</i></a></li>
<li><a href="#10"><i class="arg">fsCmd</i> <b class="method">rename</b> <i class="arg">path</i> <i class="arg">newpath</i> <i class="arg">channel</i></a></li>
<li><a href="#11"><i class="arg">fsCmd</i> <b class="method">retr</b> <i class="arg">path</i></a></li>
<li><a href="#12"><i class="arg">fsCmd</i> <b class="method">rmdir</b> <i class="arg">path</i> <i class="arg">channel</i></a></li>
<li><a href="#13"><i class="arg">fsCmd</i> <b class="method">size</b> <i class="arg">path</i> <i class="arg">channel</i></a></li>
<li><a href="#14"><i class="arg">fsCmd</i> <b class="method">store</b> <i class="arg">path</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">ftpd</b> package provides a simple Tcl-only server library
for the FTP protocol as specified in
RFC 959 (<a href="http://www.rfc-editor.org/rfc/rfc959.txt">http://www.rfc-editor.org/rfc/rfc959.txt</a>).
It works by listening on the standard FTP socket.  Most server errors
are returned as error messages with the appropriate code attached to
them.  Since the server code for the ftp daemon is executed in the
event loop, it is possible that a
<b class="cmd">bgerror</b> will be thrown on the server if there are problems with
the code in the module.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ftpd::server</b> <span class="opt">?<i class="arg">myaddr</i>?</span></a></dt>
<dd><p>Open a listening socket to listen to and accept ftp connections.
myaddr is an optional argument.  <i class="arg">myaddr</i> is the domain-style name
or numerical IP address of the client-side network interface to use
for the connection.</p></dd>
<dt><a name="2"><b class="cmd">::ftpd::config</b> <span class="opt">?<i class="arg">option value</i>?</span> <span class="opt">?<i class="arg">option value ...</i>?</span></a></dt>
<dd><p>The value is always the name of the command to call as the
callback. The option specifies which callback should be configured.
See section <span class="sectref"><a href="#section3">CALLBACKS</a></span> for descriptions of the arguments and
return values for each of the callbacks.</p>
<dl class="definitions">
<dt>-authIpCmd <i class="arg">proc</i></dt>
<dd><p>Callback to authenticate new connections based on the ip-address of
the peer.</p></dd>
<dt>-authUsrCmd <i class="arg">proc</i></dt>
<dd><p>Callback to authenticate new connections based on the user logging in
(and the users password).</p></dd>
<dt>-authFileCmd <i class="arg">proc</i></dt>
<dd><p>Callback to accept or deny a users access to read and write to a
specific path or file.</p></dd>
<dt>-logCmd <i class="arg">proc</i></dt>
<dd><p>Callback for log information generated by the FTP engine.</p></dd>
<dt>-fsCmd <i class="arg">proc</i></dt>
<dd><p>Callback to connect the engine to the filesystem it operates on.</p></dd>
<dt>-closeCmd <i class="arg">proc</i></dt>
<dd><p>Callback to be called when a connection is closed. This allows the
embedding application to perform its own cleanup operations.</p></dd>
<dt>-xferDoneCmd <i class="arg">proc</i></dt>
<dd><p>Callback for transfer completion notification. In other words, it is
called whenever a transfer of data to or from the client has
completed.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">CALLBACKS</a></h2>
<dl class="definitions">
<dt><b class="cmd">authIpCmd</b> callback</dt>
<dd><p>The authIpCmd receives the ip-address of the peer attempting to
connect to the ftp server as its argument. It returns a 1 to allow
users from the specified IP to attempt to login and a 0 to reject the
login attempt from the specified IP.</p></dd>
<dt><b class="cmd">authUsrCmd</b> callback</dt>
<dd><p>The authUsrCmd receives the username and password as its two
arguments. It returns a 1 to accept the attempted login to the ftpd
and a 0 to reject the attempted login.</p></dd>
<dt><b class="cmd">authFileCmd</b> callback</dt>
<dd><p>The authFileCmd receives the user (that is currently logged in), the
path or filename that is about to be read or written, and
<b class="const">read</b> or <b class="const">write</b> as its three arguments.  It returns a
1 to allow the path or filename to be read or written, and a 0 to
reject the attempted read or write with a permissions error code.</p></dd>
<dt><b class="cmd">logCmd</b> callback</dt>
<dd><p>The logCmd receives a severity and a message as its two arguments.
The severities used within the ftpd package are <b class="const">note</b>,
<b class="const">debug</b>, and <b class="const">error</b>. The logCmd doesn't return
anything.</p></dd>
<dt><b class="cmd">fsCmd</b> callback</dt>
<dd><p>The fsCmd receives a subcommand, a filename or path, and optional
additional arguments (depending on the subcommand).</p>
<p>The subcommands supported by the fsCmd are:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">fsCmd</i> <b class="method">append</b> <i class="arg">path</i></a></dt>
<dd><p>The append subcommand receives the filename to append to as its
argument. It returns a writable tcl channel as its return value.</p></dd>
<dt><a name="4"><i class="arg">fsCmd</i> <b class="method">delete</b> <i class="arg">path</i> <i class="arg">channel</i></a></dt>
<dd><p>The delete subcommand receives the filename to delete, and a channel
to write to as its two arguments.  The file specified is deleted and
the appropriate ftp message is written to the channel that is passed
as the second argument.  The delete subcommand returns nothing.</p></dd>
<dt><a name="5"><i class="arg">fsCmd</i> <b class="method">dlist</b> <i class="arg">path</i> <i class="arg">style</i> <i class="arg">channel</i></a></dt>
<dd><p>The dlist subcommand receives the path that it should list the files
that are in, the style in which the files should be listed which is
either <b class="const">nlst</b> or <b class="const">list</b>, and a channel to write to as
its three arguments.  The files in the specified path are printed to
the specified channel one per line.  If the style is <b class="const">nlst</b>
only the name of the file is printed to the channel.  If the style is
<b class="const">list</b> then the file permissions, number of links to the file,
the name of the user that owns the file, the name of the group that
owns the file, the size (in bytes) of the file, the modify time of the
file, and the filename are printed out to the channel in a formatted
space separated format.  The <b class="method">dlist</b> subcommand returns
nothing.</p></dd>
<dt><a name="6"><i class="arg">fsCmd</i> <b class="method">exists</b> <i class="arg">path</i></a></dt>
<dd><p>The exists subcommand receives the name of a file to check the
existence of as its only argument.  The exists subcommand returns a 1
if the path specified exists and the path is not a directory.</p></dd>
<dt><a name="7"><i class="arg">fsCmd</i> <b class="method">mkdir</b> <i class="arg">path</i> <i class="arg">channel</i></a></dt>
<dd><p>The mkdir subcommand receives the path of a directory to create and a
channel to write to as its two arguments.  The mkdir subcommand
creates the specified directory if necessary and possible.  The mkdir
subcommand then prints the appropriate success or failure message to
the channel.  The mkdir subcommand returns nothing.</p></dd>
<dt><a name="8"><i class="arg">fsCmd</i> <b class="method">mtime</b> <i class="arg">path</i> <i class="arg">channel</i></a></dt>
<dd><p>The mtime subcommand receives the path of a file to check the modify
time on and a channel as its two arguments.  If the file exists the
mtime is printed to the channel in the proper FTP format, otherwise an
appropriate error message and code are printed to the channel.  The
mtime subcommand returns nothing.</p></dd>
<dt><a name="9"><i class="arg">fsCmd</i> <b class="method">permissions</b> <i class="arg">path</i></a></dt>
<dd><p>The permissions subcommand receives the path of a file to retrieve the
permissions of.  The permissions subcommand returns the octal file
permissions of the specified file.  The file is expected to exist.</p></dd>
<dt><a name="10"><i class="arg">fsCmd</i> <b class="method">rename</b> <i class="arg">path</i> <i class="arg">newpath</i> <i class="arg">channel</i></a></dt>
<dd><p>The rename subcommand receives the path of the current file, the new
file path, and a channel to write to as its three arguments.  The
rename subcommand renames the current file to the new file path if the
path to the new file exists, and then prints out the appropriate
message to the channel.  If the new file path doesn't exist the
appropriate error message is printed to the channel.  The rename
subcommand returns nothing.</p></dd>
<dt><a name="11"><i class="arg">fsCmd</i> <b class="method">retr</b> <i class="arg">path</i></a></dt>
<dd><p>The retr subcommand receives the path of a file to read as its only
argument.  The retr subcommand returns a readable channel that the
specified file can be read from.</p></dd>
<dt><a name="12"><i class="arg">fsCmd</i> <b class="method">rmdir</b> <i class="arg">path</i> <i class="arg">channel</i></a></dt>
<dd><p>The rmdir subcommand receives the path of a directory to remove and a
channel to write to as its two arguments.  The rmdir subcommand
removes the specified directory (if possible) and prints the
appropriate message to the channel (which may be an error if the
specified directory does not exist or is not empty).  The rmdir
subcommand returns nothing.</p></dd>
<dt><a name="13"><i class="arg">fsCmd</i> <b class="method">size</b> <i class="arg">path</i> <i class="arg">channel</i></a></dt>
<dd><p>The size subcommand receives the path of a file to get the size (in
bytes) of and a channel to write to as its two arguments.  The size
subcommand prints the appropriate code and the size of the file if the
specified path is a file, otherwise an appropriate error code and
message are printed to the channel.  The size subcommand returns
nothing.</p></dd>
<dt><a name="14"><i class="arg">fsCmd</i> <b class="method">store</b> <i class="arg">path</i></a></dt>
<dd><p>The store subcommand receives the path of a file to write as its only
argument.  The store subcommand returns a writable channel.</p></dd>
</dl></dd>
<dt><b class="cmd">closeCmd</b></dt>
<dd><p>The <b class="cmd">closeCmd</b> receives no arguments when it is invoked, and any
return value it may generate is discarded.</p></dd>
<dt><b class="cmd">xferDoneCmd</b> sock sock2 file bytes filename err</dt>
<dd><p>The <b class="cmd">xferDoneCmd</b> receives six arguments when invoked. These are,
in this order, the channel handle of the control socket for the
connection, the channel handle of the data socket used for the
transfer (already closed), the handle of the channel containing the
transfered file, the number of bytes transfered, the path of the file
which was transfered, and a (possibly empty) error message.
Any return value it may generate is discarded.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">VARIABLES</a></h2>
<dl class="definitions">
<dt><b class="variable">::ftpd::cwd</b></dt>
<dd><p>The current working directory for a session when someone first
connects to the FTPD or when the <b class="cmd">REIN</b> ftp command is received.</p></dd>
<dt><b class="variable">::ftpd::contact</b></dt>
<dd><p>The e-mail address of the person that is the contact for the ftp
server.  This address is printed out as part of the response to the
<b class="cmd">FTP HELP</b> command.</p></dd>
<dt><b class="variable">::ftpd::port</b></dt>
<dd><p>The port that the ftp server should listen on. 
If port is specified as zero, the operating system will allocate an 
unused port for use as a server socket; afterwards, the variable will 
contain the port number that was allocated.</p></dd>
<dt><b class="variable">::ftpd::welcome</b></dt>
<dd><p>The message that is printed out when the user first connects to the
ftp server.</p></dd>
<dt><b class="variable">::ftpd::CurrentSocket</b></dt>
<dd><p>Accessible to all callbacks and all filesystem commands (which are a
special form of callback) and contains the handle of the socket
channel which was active when the callback was invoked.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ftpd</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key249">ftp</a>, <a href="../../../../index.html#key557">ftpd</a>, <a href="../../../../index.html#key556">ftpserver</a>, <a href="../../../../index.html#key248">rfc 959</a>, <a href="../../../../index.html#key555">services</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fumagic/cfront.html.



























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil::magic::cfront - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fumagic/cfront.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil::magic::cfront.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil::magic::cfront(n) 1.0 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil::magic::cfront - Generator core for compiler of magic(5) files</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">fileutil::magic::cfront <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">fileutil::magic::cgen <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">fileutil::magic::rt <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">fileutil</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::magic::cfront::compile</b> <i class="arg">path</i>...</a></li>
<li><a href="#2"><b class="cmd">::fileutil::magic::cfront::procdef</b> <i class="arg">procname</i> <i class="arg">path</i>...</a></li>
<li><a href="#3"><b class="cmd">::fileutil::magic::cfront::install</b> <i class="arg">path</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides the frontend of a compiler of magic(5) files
into recognizers based on the <b class="package"><a href="rtcore.html">fileutil::magic::rt</a></b> recognizer
runtime package. For the generator backed used by this compiler see
the package <b class="package"><a href="cgen.html">fileutil::magic::cgen</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::magic::cfront::compile</b> <i class="arg">path</i>...</a></dt>
<dd><p>This command takes the paths of one or more files and directories and
compiles all the files, and the files in all the directories into a
single recognizer for all the file types specified in these files.</p>
<p>All the files have to be in the format specified by magic(5).</p>
<p>The result of the command is a Tcl script containing the generated
recognizer.</p></dd>
<dt><a name="2"><b class="cmd">::fileutil::magic::cfront::procdef</b> <i class="arg">procname</i> <i class="arg">path</i>...</a></dt>
<dd><p>This command behaves like <b class="cmd">::fileutil::magic::cfront::compile</b>
with regard to the specified path arguments, then wraps the resulting
recognizer script into a procedure named <i class="arg">procname</i>, puts code
setting up the namespace of <i class="arg">procname</i> in front, and returns the
resulting script.</p></dd>
<dt><a name="3"><b class="cmd">::fileutil::magic::cfront::install</b> <i class="arg">path</i>...</a></dt>
<dd><p>This command uses <b class="cmd">::fileutil::magic::cfront::procdef</b> to compile
each of the paths into a recognizer procedure and installs the result
in the current interpreter.</p>
<p>The name of each new procedure is derived from the name of the
file/directory used in its creation, with file/directory &quot;<b class="file">FOO</b>&quot;
causing the creation of procedure <b class="const">::fileutil::magic::/FOO::run</b>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil :: magic</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>file(1), <a href="../fileutil/fileutil.html">fileutil</a>, magic(5)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key107">file recognition</a>, <a href="../../../../index.html#key108">file type</a>, <a href="../../../../index.html#key106">file utilities</a>, <a href="../../../../index.html#key211">mime</a>, <a href="../../../../index.html#key109">type</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fumagic/cgen.html.























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil::magic::cgen - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fumagic/cgen.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil::magic::cgen.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil::magic::cgen(n) 1.0 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil::magic::cgen - Generator core for compiler of magic(5) files</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">fileutil::magic::cgen <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">fileutil::magic::rt <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">struct::tree</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::magic::cgen::2tree</b> <i class="arg">script</i></a></li>
<li><a href="#2"><b class="cmd">::fileutil::magic::cgen::treedump</b> <i class="arg">tree</i></a></li>
<li><a href="#3"><b class="cmd">::fileutil::magic::cgen::treegen</b> <i class="arg">tree</i> <i class="arg">node</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides the generator backend for a compiler of magic(5)
files into recognizers based on the <b class="package"><a href="rtcore.html">fileutil::magic::rt</a></b>
recognizer runtime package. For the compiler frontend using this
generator see the package <b class="package"><a href="cfront.html">fileutil::magic::cfront</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::magic::cgen::2tree</b> <i class="arg">script</i></a></dt>
<dd><p>This command converts the recognizer specified by the <i class="arg">script</i>
into a tree and returns the object command of that tree as its
result. It uses the package <b class="package"><a href="../struct/struct_tree.html">struct::tree</a></b> for the tree.</p>
<p>The <i class="arg">script</i> is in the format specified by magic(5).</p></dd>
<dt><a name="2"><b class="cmd">::fileutil::magic::cgen::treedump</b> <i class="arg">tree</i></a></dt>
<dd><p>This command takes a <i class="arg">tree</i> as generated by
<b class="cmd">::fileutil::magic::cgen::2tree</b> and returns a string encoding the
tree for human consumption, to aid in debugging.</p></dd>
<dt><a name="3"><b class="cmd">::fileutil::magic::cgen::treegen</b> <i class="arg">tree</i> <i class="arg">node</i></a></dt>
<dd><p>This command takes a <i class="arg">tree</i> as generated by
<b class="cmd">::fileutil::magic::cgen::2tree</b> and returns a Tcl script, the
recognizer for the file types represented by the sub-tree rooted at
the <i class="arg">node</i>.
The generated script makes extensive use of the commands provided by
the recognizer runtime package <b class="package"><a href="rtcore.html">fileutil::magic::rt</a></b> to
perform its duties.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil :: magic</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>file(1), <a href="../fileutil/fileutil.html">fileutil</a>, magic(5)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key107">file recognition</a>, <a href="../../../../index.html#key108">file type</a>, <a href="../../../../index.html#key106">file utilities</a>, <a href="../../../../index.html#key211">mime</a>, <a href="../../../../index.html#key109">type</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fumagic/filetypes.html.















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil::magic::filetype - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fumagic/filetypes.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil::magic::filetype.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil::magic::filetype(n) 1.0.2 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil::magic::filetype - Procedures implementing file-type recognition</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">REFERENCES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">fileutil::magic::filetype <span class="opt">?1.0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::magic::filetype</b> <i class="arg">filename</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a command for the recognition of file types in
pure Tcl.</p>
<p>The core part of the recognizer was generated from a &quot;magic(5)&quot; file
containing the checks to perform to recognize files, and associated
file-types.</p>
<p><em>Beware!</em> This recognizer is large, about 276 Kilobyte of
generated Tcl code.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::magic::filetype</b> <i class="arg">filename</i></a></dt>
<dd><p>This command is similar to the command <b class="cmd">fileutil::fileType</b>.</p>
<p>The output of the command for the specified file is a string
describing the type of the file.</p>
<p>This list will be empty if the type of the file is not recognized.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">REFERENCES</a></h2>
<ol class="enumerated">
<li><p><a href="ftp://ftp.astron.com/pub/file/">File(1) sources</a>
This site contains the current sources for the file command, including
the magic definitions used by it. The latter were used by us to
generate this recognizer.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil :: magic</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>file(1), <a href="../fileutil/fileutil.html">fileutil</a>, magic(5)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key107">file recognition</a>, <a href="../../../../index.html#key108">file type</a>, <a href="../../../../index.html#key106">file utilities</a>, <a href="../../../../index.html#key109">type</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fumagic/mimetypes.html.














































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil::magic::mimetype - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fumagic/mimetypes.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil::magic::mimetype.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil::magic::mimetype(n) 1.0.2 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil::magic::mimetype - Procedures implementing mime-type recognition</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">REFERENCES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">fileutil::magic::mimetype <span class="opt">?1.0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::magic::mimetype</b> <i class="arg">filename</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a command for the recognition of file types in
pure Tcl. The output is standardized to mime-types.</p>
<p>The core part of the recognizer was generated from a &quot;magic(5)&quot; file
containing the checks to perform to recognize files, and associated
mime-types.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::magic::mimetype</b> <i class="arg">filename</i></a></dt>
<dd><p>This command is similar to the command <b class="cmd">fileutil::fileType</b>.</p>
<p>The output of the command for the specified file is not a list of
attributes describing the type of the file, but a list of standard
mime-types the file may have.</p>
<p>This list will be empty if the type of the file is not recognized.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">REFERENCES</a></h2>
<ol class="enumerated">
<li><p><a href="ftp://ftp.astron.com/pub/file/">File(1) sources</a>
This site contains the current sources for the file command, including
the magic definitions used by it. The latter were used by us to
generate this recognizer.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil :: magic</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>file(1), <a href="../fileutil/fileutil.html">fileutil</a>, magic(5)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key107">file recognition</a>, <a href="../../../../index.html#key108">file type</a>, <a href="../../../../index.html#key106">file utilities</a>, <a href="../../../../index.html#key211">mime</a>, <a href="../../../../index.html#key109">type</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/fumagic/rtcore.html.



































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>fileutil::magic::rt - file utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/fumagic/rtcore.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ fileutil::magic::rt.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">fileutil::magic::rt(n) 1.0 tcllib &quot;file utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>fileutil::magic::rt - Runtime core for file type recognition engines written in pure Tcl</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">NUMERIC TYPES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">fileutil::magic::rt <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::fileutil::magic::rt::open</b> <i class="arg">filename</i></a></li>
<li><a href="#2"><b class="cmd">::fileutil::magic::rt::close</b></a></li>
<li><a href="#3"><b class="cmd">::fileutil::magic::rt::file_start</b> <i class="arg">name</i></a></li>
<li><a href="#4"><b class="cmd">::fileutil::magic::rt::result</b> <span class="opt">?<i class="arg">msg</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::fileutil::magic::rt::resultv</b> <span class="opt">?<i class="arg">msg</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::fileutil::magic::rt::emit</b> <i class="arg">msg</i></a></li>
<li><a href="#7"><b class="cmd">::fileutil::magic::rt::offset</b> <i class="arg">where</i></a></li>
<li><a href="#8"><b class="cmd">::fileutil::magic::rt::Nv</b> <i class="arg">type</i> <i class="arg">offset</i> <span class="opt">?<i class="arg">qual</i>?</span></a></li>
<li><a href="#9"><b class="cmd">::fileutil::magic::rt::N</b> <i class="arg">type</i> <i class="arg">offset</i> <i class="arg">comp</i> <i class="arg">val</i> <span class="opt">?<i class="arg">qual</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::fileutil::magic::rt::Nvx</b> <i class="arg">atlevel</i> <i class="arg">type</i> <i class="arg">offset</i> <span class="opt">?<i class="arg">qual</i>?</span></a></li>
<li><a href="#11"><b class="cmd">::fileutil::magic::rt::Nx</b> <i class="arg">atlevel</i> <i class="arg">type</i> <i class="arg">offset</i> <i class="arg">comp</i> <i class="arg">val</i> <span class="opt">?<i class="arg">qual</i>?</span></a></li>
<li><a href="#12"><b class="cmd">::fileutil::magic::rt::S</b> <i class="arg">offset</i> <i class="arg">comp</i> <i class="arg">val</i> <span class="opt">?<i class="arg">qual</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::fileutil::magic::rt::Sx</b> <i class="arg">atlevel</i> <i class="arg">offset</i> <i class="arg">comp</i> <i class="arg">val</i> <span class="opt">?<i class="arg">qual</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::fileutil::magic::rt::L</b> <i class="arg">newlevel</i></a></li>
<li><a href="#15"><b class="cmd">::fileutil::magic::rt::I</b> <i class="arg">base</i> <i class="arg">type</i> <i class="arg">delta</i></a></li>
<li><a href="#16"><b class="cmd">::fileutil::magic::rt::R</b> <i class="arg">offset</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides the runtime core for file type recognition
engines written in pure Tcl and is thus used by all other packages in
this module, i.e. the two frontend packages
<b class="package">fileutil::magic::mimetypes</b> and
<b class="package">fileutil::magic::filetypes</b>, and the two engine compiler
packages <b class="package"><a href="cgen.html">fileutil::magic::cgen</a></b> and
<b class="package"><a href="cfront.html">fileutil::magic::cfront</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::fileutil::magic::rt::open</b> <i class="arg">filename</i></a></dt>
<dd><p>This command initializes the runtime and prepares the file
<i class="arg">filename</i> for use by the system.
This command has to be invoked first, before any other command of this
package.</p>
<p>The command returns the channel handle of the opened file as its
result.</p></dd>
<dt><a name="2"><b class="cmd">::fileutil::magic::rt::close</b></a></dt>
<dd><p>This command closes the last file opened via
<b class="cmd">::fileutil::magic::rt::open</b> and shuts the runtime down.
This command has to be invoked last, after the file has been dealt
with completely.
Afterward another invokation of <b class="cmd">::fileutil::magic::rt::open</b>  is
required to process another file.</p>
<p>This command returns the empty string as its result.</p></dd>
<dt><a name="3"><b class="cmd">::fileutil::magic::rt::file_start</b> <i class="arg">name</i></a></dt>
<dd><p>This command marks the start of a magic file when debugging. It
returns the empty string as its result.</p></dd>
<dt><a name="4"><b class="cmd">::fileutil::magic::rt::result</b> <span class="opt">?<i class="arg">msg</i>?</span></a></dt>
<dd><p>This command returns the current result and stops processing.</p>
<p>If <i class="arg">msg</i> is specified its text is added to the result before it is
returned. See <b class="cmd">::fileutil::magic::rt::emit</b> for the allowed
special character sequences.</p></dd>
<dt><a name="5"><b class="cmd">::fileutil::magic::rt::resultv</b> <span class="opt">?<i class="arg">msg</i>?</span></a></dt>
<dd><p>This command returns the current result.
In contrast to <b class="cmd">::fileutil::magic::rt::result</b> processing
continues.</p>
<p>If <i class="arg">msg</i> is specified its text is added to the result before it is
returned. See <b class="cmd">::fileutil::magic::rt::emit</b> for the allowed
special character sequences.</p></dd>
<dt><a name="6"><b class="cmd">::fileutil::magic::rt::emit</b> <i class="arg">msg</i></a></dt>
<dd><p>This command adds the text <i class="arg">msg</i> to the result buffer. The
message may contain the following special character sequences. They
will be replaced with buffered values before the message is added to
the result. The command returns the empty string as its result.</p>
<dl class="definitions">
<dt><b class="const">\b</b></dt>
<dd><p>This sequence is removed</p></dd>
<dt><b class="const">%s</b></dt>
<dd><p>Replaced with the last buffered string value.</p></dd>
<dt><b class="const">%ld</b></dt>
<dd><p>Replaced with the last buffered numeric value.</p></dd>
<dt><b class="const">%d</b></dt>
<dd><p>See above.</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::fileutil::magic::rt::Nv</b> <i class="arg">type</i> <i class="arg">offset</i> <span class="opt">?<i class="arg">qual</i>?</span></a></dt>
<dd><p>This command fetches the numeric value with <i class="arg">type</i> from the
absolute location <i class="arg">offset</i> and returns it as its result. The
fetched value is further stored in the numeric buffer.</p>
<p>If <i class="arg">qual</i> is specified it is considered to be a mask and applied
to the fetched value before it is stored and returned. It has to have
the form of a partial Tcl bit-wise expression, i.e.</p>
<pre class="example">
	&amp; number
</pre>
<p>For example:</p>
<pre class="example">
	Nv lelong 0 &amp;0x8080ffff
</pre>
<p>For the possible types see section <span class="sectref"><a href="#section3">NUMERIC TYPES</a></span>.</p></dd>
<dt><a name="9"><b class="cmd">::fileutil::magic::rt::N</b> <i class="arg">type</i> <i class="arg">offset</i> <i class="arg">comp</i> <i class="arg">val</i> <span class="opt">?<i class="arg">qual</i>?</span></a></dt>
<dd><p>This command behaves mostly like <b class="cmd">::fileutil::magic::rt::Nv</b>,
except that it compares the fetched and masked value against <i class="arg">val</i>
as specified with <i class="arg">comp</i> and returns the result of that
comparison.</p>
<p>The argument <i class="arg">comp</i> has to contain one of Tcl's comparison
operators, and the comparison made will be</p>
<pre class="example">
	&lt;val&gt; &lt;comp&gt; &lt;fetched-and-masked-value&gt;
</pre>
<p>The special comparison operator <b class="const">x</b> signals that no comparison
should be done, or, in other words, that the fetched value will always
match <i class="arg">val</i>.</p></dd>
<dt><a name="10"><b class="cmd">::fileutil::magic::rt::Nvx</b> <i class="arg">atlevel</i> <i class="arg">type</i> <i class="arg">offset</i> <span class="opt">?<i class="arg">qual</i>?</span></a></dt>
<dd><p>This command behaves like <b class="cmd">::fileutil::magic::rt::Nv</b>, except that
it additionally remembers the location in the file after the fetch in
the calling context, for the level <i class="arg">atlevel</i>, for later use by 
<b class="cmd">::fileutil::magic::rt::R</b>.</p></dd>
<dt><a name="11"><b class="cmd">::fileutil::magic::rt::Nx</b> <i class="arg">atlevel</i> <i class="arg">type</i> <i class="arg">offset</i> <i class="arg">comp</i> <i class="arg">val</i> <span class="opt">?<i class="arg">qual</i>?</span></a></dt>
<dd><p>This command behaves like <b class="cmd">::fileutil::magic::rt::N</b>, except that
it additionally remembers the location in the file after the fetch in
the calling context, for the level <i class="arg">atlevel</i>, for later use by 
<b class="cmd">::fileutil::magic::rt::R</b>.</p></dd>
<dt><a name="12"><b class="cmd">::fileutil::magic::rt::S</b> <i class="arg">offset</i> <i class="arg">comp</i> <i class="arg">val</i> <span class="opt">?<i class="arg">qual</i>?</span></a></dt>
<dd><p>This command behaves like <b class="cmd">::fileutil::magic::rt::N</b>, except that
it fetches and compares strings, not numeric data. The fetched value
is also stored in the internal string buffer instead of the numeric
buffer.</p></dd>
<dt><a name="13"><b class="cmd">::fileutil::magic::rt::Sx</b> <i class="arg">atlevel</i> <i class="arg">offset</i> <i class="arg">comp</i> <i class="arg">val</i> <span class="opt">?<i class="arg">qual</i>?</span></a></dt>
<dd><p>This command behaves like <b class="cmd">::fileutil::magic::rt::S</b>, except that
it additionally remembers the location in the file after the fetch in
the calling context, for the level <i class="arg">atlevel</i>, for later use by 
<b class="cmd">::fileutil::magic::rt::R</b>.</p></dd>
<dt><a name="14"><b class="cmd">::fileutil::magic::rt::L</b> <i class="arg">newlevel</i></a></dt>
<dd><p>This command sets the current level in the calling context to
<i class="arg">newlevel</i>. The command returns the empty string as its result.</p></dd>
<dt><a name="15"><b class="cmd">::fileutil::magic::rt::I</b> <i class="arg">base</i> <i class="arg">type</i> <i class="arg">delta</i></a></dt>
<dd><p>This command handles base locations specified indirectly through the
contents of the inspected file. It returns the sum of <i class="arg">delta</i> and
the value of numeric <i class="arg">type</i> fetched from the absolute location
<i class="arg">base</i>.</p>
<p>For the possible types see section <span class="sectref"><a href="#section3">NUMERIC TYPES</a></span>.</p></dd>
<dt><a name="16"><b class="cmd">::fileutil::magic::rt::R</b> <i class="arg">offset</i></a></dt>
<dd><p>This command handles base locations specified relative to the end of
the last field one level above.</p>
<p>In other words, the command computes an absolute location in the file
based on the relative <i class="arg">offset</i> and returns it as its result. The
base the offset is added to is the last location remembered for the
level in the calling context.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">NUMERIC TYPES</a></h2>
<dl class="definitions">
<dt><b class="const">byte</b></dt>
<dd><p>8-bit integer</p></dd>
<dt><b class="const">short</b></dt>
<dd><p>16-bit integer, stored in native endianess</p></dd>
<dt><b class="const">beshort</b></dt>
<dd><p>see above, stored in big endian</p></dd>
<dt><b class="const">leshort</b></dt>
<dd><p>see above, stored in small/little endian</p></dd>
<dt><b class="const">long</b></dt>
<dd><p>32-bit integer, stored in native endianess</p></dd>
<dt><b class="const">belong</b></dt>
<dd><p>see above, stored in big endian</p></dd>
<dt><b class="const">lelong</b></dt>
<dd><p>see above, stored in small/little endian</p></dd>
</dl>
<p>All of the types above exit in an unsigned form as well. The type
names are the same, with the character &quot;u&quot; added as prefix.</p>
<dl class="definitions">
<dt><b class="const">date</b></dt>
<dd><p>32-bit integer timestamp, stored in native endianess</p></dd>
<dt><b class="const">bedate</b></dt>
<dd><p>see above, stored in big endian</p></dd>
<dt><b class="const">ledate</b></dt>
<dd><p>see above, stored in small/little endian</p></dd>
<dt><b class="const">ldate</b></dt>
<dd><p>32-bit integer timestamp, stored in native endianess</p></dd>
<dt><b class="const">beldate</b></dt>
<dd><p>see above, stored in big endian</p></dd>
<dt><b class="const">leldate</b></dt>
<dd><p>see above, stored in small/little endian</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil :: magic</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>file(1), <a href="../fileutil/fileutil.html">fileutil</a>, magic(5)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key107">file recognition</a>, <a href="../../../../index.html#key108">file type</a>, <a href="../../../../index.html#key106">file utilities</a>, <a href="../../../../index.html#key211">mime</a>, <a href="../../../../index.html#key109">type</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/generator/generator.html.































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>generator - Tcl Generator Commands</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/generator/generator.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ generator.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">generator(n) 0.1 tcllib &quot;Tcl Generator Commands&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>generator - Procedures for creating and using generators.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PRELUDE</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">generator <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">generator</b> <b class="method">define</b> <i class="arg">name</i> <i class="arg">params</i> <i class="arg">body</i></a></li>
<li><a href="#2"><b class="cmd">generator</b> <b class="method">yield</b> <i class="arg">arg</i> <span class="opt">?<i class="arg">args..</i>?</span></a></li>
<li><a href="#3"><b class="cmd">generator</b> <b class="method">foreach</b> <i class="arg">varList</i> <i class="arg">generator</i> <i class="arg">varList</i> <i class="arg">generator</i> <span class="opt">?...?</span> <i class="arg">body</i></a></li>
<li><a href="#4"><b class="cmd">generator</b> <b class="method">next</b> <i class="arg">generator</i> <span class="opt">?<i class="arg">varName..</i>?</span></a></li>
<li><a href="#5"><b class="cmd">generator</b> <b class="method">exists</b> <i class="arg">generator</i></a></li>
<li><a href="#6"><b class="cmd">generator</b> <b class="method">names</b></a></li>
<li><a href="#7"><b class="cmd">generator</b> <b class="method">destroy</b> <span class="opt">?<i class="arg">generator..</i>?</span></a></li>
<li><a href="#8"><b class="cmd">generator</b> <b class="method">finally</b> <i class="arg">cmd</i> <span class="opt">?<i class="arg">arg..</i>?</span></a></li>
<li><a href="#9"><b class="cmd">generator</b> <b class="method">from</b> <i class="arg">format</i> <i class="arg">value</i></a></li>
<li><a href="#10"><b class="cmd">generator</b> <b class="method">to</b> <i class="arg">format</i> <i class="arg">generator</i></a></li>
<li><a href="#11"><b class="cmd">generator</b> <b class="method">map</b> <i class="arg">function</i> <i class="arg">generator</i></a></li>
<li><a href="#12"><b class="cmd">generator</b> <b class="method">filter</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></li>
<li><a href="#13"><b class="cmd">generator</b> <b class="method">reduce</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></li>
<li><a href="#14"><b class="cmd">generator</b> <b class="method">foldl</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></li>
<li><a href="#15"><b class="cmd">generator</b> <b class="method">foldr</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></li>
<li><a href="#16"><b class="cmd">generator</b> <b class="method">all</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></li>
<li><a href="#17"><b class="cmd">generator</b> <b class="method">and</b> <i class="arg">generator</i></a></li>
<li><a href="#18"><b class="cmd">generator</b> <b class="method">any</b> <i class="arg">generator</i></a></li>
<li><a href="#19"><b class="cmd">generator</b> <b class="method">concat</b> <i class="arg">generator</i> <span class="opt">?<i class="arg">generator..</i>?</span></a></li>
<li><a href="#20"><b class="cmd">generator</b> <b class="method">concatMap</b> <i class="arg">function</i> <i class="arg">generator</i></a></li>
<li><a href="#21"><b class="cmd">generator</b> <b class="method">drop</b> <i class="arg">n</i> <i class="arg">generator</i></a></li>
<li><a href="#22"><b class="cmd">generator</b> <b class="method">dropWhile</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></li>
<li><a href="#23"><b class="cmd">generator</b> <b class="method">contains</b> <i class="arg">element</i> <i class="arg">generator</i></a></li>
<li><a href="#24"><b class="cmd">generator</b> <b class="method">foldl1</b> <i class="arg">function</i> <i class="arg">generator</i></a></li>
<li><a href="#25"><b class="cmd">generator</b> <b class="method">foldli</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></li>
<li><a href="#26"><b class="cmd">generator</b> <b class="method">foldri</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></li>
<li><a href="#27"><b class="cmd">generator</b> <b class="method">head</b> <i class="arg">generator</i></a></li>
<li><a href="#28"><b class="cmd">generator</b> <b class="method">tail</b> <i class="arg">generator</i></a></li>
<li><a href="#29"><b class="cmd">generator</b> <b class="method">init</b> <i class="arg">generator</i></a></li>
<li><a href="#30"><b class="cmd">generator</b> <b class="method">takeList</b> <i class="arg">n</i> <i class="arg">generator</i></a></li>
<li><a href="#31"><b class="cmd">generator</b> <b class="method">take</b> <i class="arg">n</i> <i class="arg">generator</i></a></li>
<li><a href="#32"><b class="cmd">generator</b> <b class="method">iterate</b> <i class="arg">function</i> <i class="arg">init</i></a></li>
<li><a href="#33"><b class="cmd">generator</b> <b class="method">last</b> <i class="arg">generator</i></a></li>
<li><a href="#34"><b class="cmd">generator</b> <b class="method">length</b> <i class="arg">generator</i></a></li>
<li><a href="#35"><b class="cmd">generator</b> <b class="method">or</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></li>
<li><a href="#36"><b class="cmd">generator</b> <b class="method">product</b> <i class="arg">generator</i></a></li>
<li><a href="#37"><b class="cmd">generator</b> <b class="method">repeat</b> <i class="arg">n</i> <i class="arg">value..</i></a></li>
<li><a href="#38"><b class="cmd">generator</b> <b class="method">sum</b> <i class="arg">generator</i></a></li>
<li><a href="#39"><b class="cmd">generator</b> <b class="method">takeWhile</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></li>
<li><a href="#40"><b class="cmd">generator</b> <b class="method">splitWhen</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></li>
<li><a href="#41"><b class="cmd">generator</b> <b class="method">scanl</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">generator</b> package provides commands to define and iterate over
generator expressions. A <em>generator</em> is a command that returns a sequence
of values. However, unlike an ordinary command that returns a list, a
generator <em>yields</em> each value and then suspends, allowing subsequent
values to be fetched on-demand. As such, generators can be used to efficiently
iterate over a set of values, without having to generate all answers in-memory.
Generators can be used to iterate over elements of a data structure, or rows
in the result set of a database query, or to decouple producer/consumer software
designs such as parsers and tokenizers, or to implement sophisticated custom
control strategies such as backtracking search. Generators reduce the need to
implement custom control structures, as many such structures can be recast as
generators, leading to both a simpler implementation and a more standardised
interface. The generator mechanism is built on top of the Tcl 8.6 coroutine
mechanism.</p>
<p>The package exports a single ensemble command, <b class="cmd">generator</b>. All
functionality is provided as subcommands of this command. The core subcommands
of the package are <b class="method">define</b>, <b class="method">yield</b>, and <b class="method">foreach</b>. The
<b class="method">define</b> command works like Tcl's <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> command, but creates a
generator procedure; that is, a procedure that returns a generator when called.
The generator itself is a command that can be called multiple times: each time
it returns the next value in the generated series. When the
series has been exhausted, the generator command returns an empty list and then
destroys itself. Rather than manually call a generator, however, the package
also provides a flexible <b class="method">foreach</b> command that loops through the values of
one or more generators. This loop construct mimicks the functionality of the
built-in Tcl <b class="cmd"><a href="../../../../index.html#key199">foreach</a></b> command, including handling multiple return values
and looping over multiple generators at once. Writing a generator is also a
simple task, much like writing a normal procedure: simply use the <b class="method">define</b>
command to define the generator, and then call <b class="method">yield</b> instead of <b class="cmd">return</b>. 
For example, we can define a generator for looping through the integers
in a particular range:</p>
<pre class="example">
    generator define range {n m} {
        for {set i $n} {$i &lt;= $m} {incr i} { generator yield $i }
    }
    generator foreach x [range 1 10] {
        puts &quot;x = $x&quot;
    }
</pre>
<p>The above example will print the numbers from 1 to 10 in sequence, as you would
expect. The difference from a normal loop over a list is that the numbers are
only generated as they are needed. If we insert a break into the loop then any
remaining numbers in the sequence would never be generated. To illustrate, we
can define a generator that produces the sequence of natural numbers: an
infinite series. A normal procedure would never return trying to produce this
series as a list. By using a generator we only have to generate those values
which are actually used:</p>
<pre class="example">
    generator define nats {} {
        while 1 { generator yield [incr nat] }
    }
    generator foreach n [nats] {
        if {$n &gt; 100} { break }
    }
</pre>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">generator</b> <b class="method">define</b> <i class="arg">name</i> <i class="arg">params</i> <i class="arg">body</i></a></dt>
<dd><p>Creates a new generator procedure. The arguments to the command are identical to
those for <b class="cmd"><a href="../../../../index.html#key543">proc</a></b>: a <i class="arg">name</i>, a list of parameters, and a body. The
parameter list format is identical to a procedure. In particular, default values
and the <span class="opt">?args?</span> syntax can be used as usual. Each time the resulting
generator procedure is called it creates a new generator command (coroutine)
that will yield a list of values on each call. Each result from a generator is
guaranteed to be a non-empty list of values. When a generator is exhausted it
returns an empty list and then destroys itself to free up resources. It is an
error to attempt to call an exhausted generator as the command no longer exists.</p></dd>
<dt><a name="2"><b class="cmd">generator</b> <b class="method">yield</b> <i class="arg">arg</i> <span class="opt">?<i class="arg">args..</i>?</span></a></dt>
<dd><p>Used in the definition of a generator, this command returns the next set of
values to the consumer. Once the <b class="method">yield</b> command has been called the
generator will suspend to allow the consumer to process that value. When the
next value is requested, the generator will resume as if the yield command had
just returned, and can continue processing to yield the next result. The 
<b class="method">yield</b> command must be called with at least one argument, but can be called with
multiple arguments, in which case this is equivalent to calling <b class="method">yield</b>
once for each argument.</p></dd>
<dt><a name="3"><b class="cmd">generator</b> <b class="method">foreach</b> <i class="arg">varList</i> <i class="arg">generator</i> <i class="arg">varList</i> <i class="arg">generator</i> <span class="opt">?...?</span> <i class="arg">body</i></a></dt>
<dd><p>Loops through one or more generators, assigning the next values to variables and
then executing the loop body. Works much like the built-in <b class="cmd"><a href="../../../../index.html#key199">foreach</a></b>
command, but working with generators rather than lists. Multiple generators can
be iterated over in parallel, and multiple results can be retrieved from a
single generator at once.  Like the built-in <b class="cmd"><a href="../../../../index.html#key199">foreach</a></b>, the loop will
continue until all of the generators have been exhausted: variables for
generators that are exhausted early will be set to the empty string.</p>
<p>The <b class="method">foreach</b> command will automatically clean-up all of the generators
at the end of the loop, regardless of whether the loop terminated early or not.
This behaviour is provided as a convenience to avoid having to explicitly
clean up a generator in the usual cases. Generators can however be destroyed
before the end of the loop, in which case the loop will continue as normal until
all the other generators have been destroyed or exhausted.</p>
<p>The <b class="method">foreach</b> command does not take a snapshot of the generator. Any
changes in the state of the generator made inside the loop or by other code will
affect the state of the loop. In particular, if the code in the loop invokes the
generator to manually retrieve the next element, this element will then be
excluded from the loop, and the next iteration will continue from the element
after that one. Care should be taken to avoid concurrent updates to generators
unless this behaviour is required (e.g., in argument processing).</p></dd>
<dt><a name="4"><b class="cmd">generator</b> <b class="method">next</b> <i class="arg">generator</i> <span class="opt">?<i class="arg">varName..</i>?</span></a></dt>
<dd><p>Manually retrieves the next values from a generator. One value is retrieved for
each variable supplied and assigned to the corresponding variable. If the
generator becomes exhausted at any time then any remaining variables are set to
the empty string.</p></dd>
<dt><a name="5"><b class="cmd">generator</b> <b class="method">exists</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns 1 if the generator (still) exists, or 0 otherwise.</p></dd>
<dt><a name="6"><b class="cmd">generator</b> <b class="method">names</b></a></dt>
<dd><p>Returns a list of all currently existing generator commands.</p></dd>
<dt><a name="7"><b class="cmd">generator</b> <b class="method">destroy</b> <span class="opt">?<i class="arg">generator..</i>?</span></a></dt>
<dd><p>Destroys one or more generators, freeing any associated resources.</p></dd>
<dt><a name="8"><b class="cmd">generator</b> <b class="method">finally</b> <i class="arg">cmd</i> <span class="opt">?<i class="arg">arg..</i>?</span></a></dt>
<dd><p>Used in the definition of a generator procedure, this command arranges for a
resource to be cleaned up whenever the generator is destroyed, either explicitly
or implicitly when the generator is exhausted. This command can be used like a
<b class="method">finally</b> block in the <b class="cmd"><a href="../try/tcllib_try.html">try</a></b> command, except that it is tied to the
life-cycle of the generator rather than to a particular scope. For example, if
we create a generator to iterate over the lines in a text file, we can use
<b class="method">finally</b> to ensure that the file is closed whenever the generator is
destroyed:</p>
<pre class="example">
    generator define lines file {
        set in [open $file]
        # Ensure file is always closed
        generator finally close $in
        while {[gets $in line] &gt;= 0} {
            generator yield $line
        }
    }
    generator foreach line [lines /etc/passwd] {
        puts &quot;[incr count]: $line&quot;
        if {$count &gt; 10} { break }
    }
    # File will be closed even on early exit
</pre>
<p>If you create a generator that consumes another generator (such as the standard
<b class="method">map</b> and <b class="method">filter</b> generators defined later), then you should use
a <b class="method">finally</b> command to ensure that this generator is destroyed when its
parent is. For example, the <b class="method">map</b> generator is defined as follows:</p>
<pre class="example">
    generator define map {f xs} {
        generator finally generator destroy $xs
        generator foreach x $xs { generator yield [{*}$f $x] }
    }
</pre>
</dd>
<dt><a name="9"><b class="cmd">generator</b> <b class="method">from</b> <i class="arg">format</i> <i class="arg">value</i></a></dt>
<dd><p>Creates a generator from a data structure. Currently, supported formats are
<b class="option">list</b>, <b class="option">dict</b>, or <b class="option">string</b>. The list format yields each
element in turn. For dictionaries, each key and value are yielded separately.
Finally, strings are yielded a character at a time.</p></dd>
<dt><a name="10"><b class="cmd">generator</b> <b class="method">to</b> <i class="arg">format</i> <i class="arg">generator</i></a></dt>
<dd><p>Converts a generator into a data structure. This is the reverse operation of the
<b class="method">from</b> command, and supports the same data structures. The two operations
obey the following identity laws (where <b class="method">=</b> is interpreted
appropriately):</p>
<pre class="example">
    [generator to $fmt [generator from $fmt $value]] = $value
    [generator from $fmt [generator to $fmt $gen]]   = $gen
</pre>
</dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PRELUDE</a></h2>
<p>The following commands are provided as a standard library of generator
combinators and functions that perform convenience operations on generators. The
functions in this section are loosely modelled on the equivalent functions from
the Haskell Prelude. <em>Warning:</em> most of the functions in this prelude
destroy any generator arguments they are passed as a side-effect. If you want to
have persistent generators, see the streams library.</p>
<dl class="definitions">
<dt><a name="11"><b class="cmd">generator</b> <b class="method">map</b> <i class="arg">function</i> <i class="arg">generator</i></a></dt>
<dd><p>Apply a function to every element of a generator, returning a new generator of
the results. This is the classic map function from functional programming,
applied to generators. For example, we can generate all the square numbers using
the following code (where <b class="cmd">nats</b> is defined as earlier):</p>
<pre class="example">
    proc square x { expr {$x * $x} }
    generator foreach n [generator map square [nats]] {
        puts &quot;n = $n&quot;
        if {$n &gt; 1000} { break }
    }
</pre>
</dd>
<dt><a name="12"><b class="cmd">generator</b> <b class="method">filter</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></dt>
<dd><p>Another classic functional programming gem. This command returns a generator
that yields only those items from the argument generator that satisfy the
predicate (boolean function). For example, if we had a generator <b class="variable">employees</b>
that returned a stream of dictionaries representing people, we could filter all
those whose salaries are above 100,000 dollars (or whichever currency you prefer)
using a simple filter:</p>
<pre class="example">
    proc salary&gt; {amount person} { expr {[dict get $person salary] &gt; $amount} }
    set fat-cats [generator filter {salary&gt; 100000} $employees]
</pre>
</dd>
<dt><a name="13"><b class="cmd">generator</b> <b class="method">reduce</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></dt>
<dd><p>This is the classic left-fold operation. This command takes a function, an
initial value, and a generator of values. For each element in the generator it
applies the function to the current accumulator value (the <i class="arg">zero</i> argument
initially) and that element, and then uses the result as the new accumulator
value. This process is repeated through the entire generator (eagerly) and the
final accumulator value is then returned. If we consider the function to be a
binary operator, and the zero argument to be the left identity element of that
operation, then we can consider the <b class="method">reduce</b> command as <em>folding</em>
the operator between each successive pair of values in the generator in a
left-associative fashion. For example, the sum of a sequence of numbers can be
calculated by folding a <b class="cmd">+</b> operator between them, with 0 as the identity:</p>
<pre class="example">
    # sum xs          = reduce + 0 xs
    # sum [range 1 5] = reduce + 0 [range 1 5]
    #                 = reduce + [+ 0 1] [range 2 5]
    #                 = reduce + [+ 1 2] [range 3 5]
    #                 = ...
    #                 = reduce + [+ 10 5] &lt;empty&gt;
    #                 = ((((0+1)+2)+3)+4)+5
    #                 = 15
    proc + {a b} { expr {$a + $b} }
    proc sum gen { generator reduce + 0 $gen }
    puts [sum [range 1 10]]
</pre>
<p>The <b class="method">reduce</b> operation is an extremely useful one, and a great variety of
different operations can be defined using it. For example, we can define a
factorial function as the product of a range using generators. This definition
is both very clear and also quite efficient (in both memory and running time):</p>
<pre class="example">
    proc * {x y} { expr {$x * $y} }
    proc prod gen { generator reduce * 0 $gen }
    proc fac n { prod [range 1 $n] }
</pre>
<p>However, while the <b class="method">reduce</b> operation is efficient for finite generators,
care should be taken not to apply it to an infinite generator, as this will
result in an infinite loop:</p>
<pre class="example">
    sum [nats]; # Never returns
</pre>
</dd>
<dt><a name="14"><b class="cmd">generator</b> <b class="method">foldl</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></dt>
<dd><p>This is an alias for the <b class="method">reduce</b> command.</p></dd>
<dt><a name="15"><b class="cmd">generator</b> <b class="method">foldr</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></dt>
<dd><p>This is the right-associative version of <b class="method">reduce</b>. This operation is
generally inefficient, as the entire generator needs to be evaluated into memory
(as a list) before the reduction can commence. In an eagerly evaluated language
like Tcl, this operation has limited use, and should be avoided if possible.</p></dd>
<dt><a name="16"><b class="cmd">generator</b> <b class="method">all</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></dt>
<dd><p>Returns true if all elements of the generator satisfy the given predicate.</p></dd>
<dt><a name="17"><b class="cmd">generator</b> <b class="method">and</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns true if all elements of the generator are true (i.e., takes the logical
conjunction of the elements).</p></dd>
<dt><a name="18"><b class="cmd">generator</b> <b class="method">any</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns true if any of the elements of the generator are true (i.e., logical
disjunction).</p></dd>
<dt><a name="19"><b class="cmd">generator</b> <b class="method">concat</b> <i class="arg">generator</i> <span class="opt">?<i class="arg">generator..</i>?</span></a></dt>
<dd><p>Returns a generator which is the concatenation of each of the argument
generators.</p></dd>
<dt><a name="20"><b class="cmd">generator</b> <b class="method">concatMap</b> <i class="arg">function</i> <i class="arg">generator</i></a></dt>
<dd><p>Given a function which maps a value to a series of values, and a generator of
values of that type, returns a generator of all of the results in one flat
series. Equivalent to <b class="method">concat</b> applied to the result of <b class="method">map</b>.</p></dd>
<dt><a name="21"><b class="cmd">generator</b> <b class="method">drop</b> <i class="arg">n</i> <i class="arg">generator</i></a></dt>
<dd><p>Removes the given number of elements from the front of the generator and returns
the resulting generator with those elements removed.</p></dd>
<dt><a name="22"><b class="cmd">generator</b> <b class="method">dropWhile</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></dt>
<dd><p>Removes all elements from the front of the generator that satisfy the predicate.</p></dd>
<dt><a name="23"><b class="cmd">generator</b> <b class="method">contains</b> <i class="arg">element</i> <i class="arg">generator</i></a></dt>
<dd><p>Returns true if the generator contains the given element. Note that this will
destroy the generator!</p></dd>
<dt><a name="24"><b class="cmd">generator</b> <b class="method">foldl1</b> <i class="arg">function</i> <i class="arg">generator</i></a></dt>
<dd><p>A version of <b class="method">foldl</b> that takes the <i class="arg">zero</i> argument from the first
element of the generator. Therefore this function is only valid on non-empty
generators.</p></dd>
<dt><a name="25"><b class="cmd">generator</b> <b class="method">foldli</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></dt>
<dd><p>A version of <b class="method">foldl</b> that supplies the integer index of each element as
the first argument to the function. The first element in the generator at this
point is given index 0.</p></dd>
<dt><a name="26"><b class="cmd">generator</b> <b class="method">foldri</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></dt>
<dd><p>Right-associative version of <b class="method">foldli</b>.</p></dd>
<dt><a name="27"><b class="cmd">generator</b> <b class="method">head</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns the first element of the generator.</p></dd>
<dt><a name="28"><b class="cmd">generator</b> <b class="method">tail</b> <i class="arg">generator</i></a></dt>
<dd><p>Removes the first element of the generator, returning the rest.</p></dd>
<dt><a name="29"><b class="cmd">generator</b> <b class="method">init</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns a new generator consisting of all elements except the last of the
argument generator.</p></dd>
<dt><a name="30"><b class="cmd">generator</b> <b class="method">takeList</b> <i class="arg">n</i> <i class="arg">generator</i></a></dt>
<dd><p>Returns the next <i class="arg">n</i> elements of the generator as a list. If not enough
elements are left in the generator, then just the remaining elements are
returned.</p></dd>
<dt><a name="31"><b class="cmd">generator</b> <b class="method">take</b> <i class="arg">n</i> <i class="arg">generator</i></a></dt>
<dd><p>Returns the next <i class="arg">n</i> elements of the generator as a new generator. The old
generator is destroyed.</p></dd>
<dt><a name="32"><b class="cmd">generator</b> <b class="method">iterate</b> <i class="arg">function</i> <i class="arg">init</i></a></dt>
<dd><p>Returns an infinite generator formed by repeatedly applying the function to the
initial argument. For example, the Fibonacci numbers can be defined as follows:</p>
<pre class="example">
    proc fst pair { lindex $pair 0 }
    proc snd pair { lindex $pair 1 }
    proc nextFib ab { list [snd $ab] [expr {[fst $ab] + [snd $ab]}] }
    proc fibs {} { generator map fst [generator iterate nextFib {0 1}] }
</pre>
</dd>
<dt><a name="33"><b class="cmd">generator</b> <b class="method">last</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns the last element of the generator (if it exists).</p></dd>
<dt><a name="34"><b class="cmd">generator</b> <b class="method">length</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns the length of the generator, destroying it in the process.</p></dd>
<dt><a name="35"><b class="cmd">generator</b> <b class="method">or</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></dt>
<dd><p>Returns 1 if any of the elements of the generator satisfy the predicate.</p></dd>
<dt><a name="36"><b class="cmd">generator</b> <b class="method">product</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns the product of the numbers in a generator.</p></dd>
<dt><a name="37"><b class="cmd">generator</b> <b class="method">repeat</b> <i class="arg">n</i> <i class="arg">value..</i></a></dt>
<dd><p>Returns a generator that consists of <i class="arg">n</i> copies of the given elements. The
special value <em>Inf</em> can be used to generate an infinite sequence.</p></dd>
<dt><a name="38"><b class="cmd">generator</b> <b class="method">sum</b> <i class="arg">generator</i></a></dt>
<dd><p>Returns the sum of the values in the generator.</p></dd>
<dt><a name="39"><b class="cmd">generator</b> <b class="method">takeWhile</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></dt>
<dd><p>Returns a generator of the first elements in the argument generator that satisfy
the predicate.</p></dd>
<dt><a name="40"><b class="cmd">generator</b> <b class="method">splitWhen</b> <i class="arg">predicate</i> <i class="arg">generator</i></a></dt>
<dd><p>Splits the generator into lists of elements using the predicate to identify
delimiters. The resulting lists are returned as a generator. Elements matching
the delimiter predicate are discarded. For example, to split up a generator
using the string &quot;|&quot; as a delimiter:</p>
<pre class="example">
    set xs [generator from list {a | b | c}]
    generator split {string equal &quot;|&quot;} $xs ;# returns a then b then c
</pre>
</dd>
<dt><a name="41"><b class="cmd">generator</b> <b class="method">scanl</b> <i class="arg">function</i> <i class="arg">zero</i> <i class="arg">generator</i></a></dt>
<dd><p>Similar to <b class="method">foldl</b>, but returns a generator of all of the intermediate
values for the accumulator argument. The final element of this generator is
equivalent to <b class="method">foldl</b> called on the same arguments.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>Please report any errors in this document, or in the package it describes, to
<a href="mailto:[email protected]">Neil Madden</a>.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key205">control structure</a>, <a href="../../../../index.html#key200">coroutine</a>, <a href="../../../../index.html#key203">filter</a>, <a href="../../../../index.html#key202">foldl</a>, <a href="../../../../index.html#key206">foldr</a>, <a href="../../../../index.html#key199">foreach</a>, <a href="../../../../index.html#key207">generator</a>, <a href="../../../../index.html#key204">iterator</a>, <a href="../../../../index.html#key187">map</a>, <a href="../../../../index.html#key198">reduce</a>, <a href="../../../../index.html#key201">scanl</a></p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/gpx/gpx.html.
















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>gpx - GPS eXchange Format (GPX)</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/gpx/gpx.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2010, Keith Vetter &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ gpx.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">gpx(n) 0.9 tcllib &quot;GPS eXchange Format (GPX)&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>gpx - Extracts waypoints, tracks and routes from GPX files</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">DATA STRUCTURES</a></li>
<li class="section"><a href="#section4">EXAMPLE</a></li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">AUTHOR</a></li>
<li class="section"><a href="#section7">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">gpx <span class="opt">?0.9?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::gpx::Create</b> <i class="arg">gpxFilename</i> <span class="opt">?<i class="arg">rawXML</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::gpx::Cleanup</b> <i class="arg">token</i></a></li>
<li><a href="#3"><b class="cmd">::gpx::GetGPXMetadata</b> <i class="arg">token</i></a></li>
<li><a href="#4"><b class="cmd">::gpx::GetWaypointCount</b> <i class="arg">token</i></a></li>
<li><a href="#5"><b class="cmd">::gpx::GetAllWaypoints</b> <i class="arg">token</i></a></li>
<li><a href="#6"><b class="cmd">::gpx::GetTrackCount</b> <i class="arg">token</i></a></li>
<li><a href="#7"><b class="cmd">::gpx::GetTrackMetadata</b> <i class="arg">token</i> <i class="arg">whichTrack</i></a></li>
<li><a href="#8"><b class="cmd">::gpx::GetTrackPoints</b> <i class="arg">token</i> <i class="arg">whichTrack</i></a></li>
<li><a href="#9"><b class="cmd">::gpx::GetRouteCount</b> <i class="arg">token</i></a></li>
<li><a href="#10"><b class="cmd">::gpx::GetRouteMetadata</b> <i class="arg">token</i> <i class="arg">whichRoute</i></a></li>
<li><a href="#11"><b class="cmd">::gpx::GetRoutePoints</b> <i class="arg">token</i> <i class="arg">whichRoute</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This module parses and extracts waypoints, tracks, routes and
metadata from a GPX (GPS eXchange) file. Both GPX version 1.0
and 1.1 are supported.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::gpx::Create</b> <i class="arg">gpxFilename</i> <span class="opt">?<i class="arg">rawXML</i>?</span></a></dt>
<dd><p>The <b class="cmd">::gpx::Create</b> is the first command called to process GPX
data. It takes the GPX data from either the <i class="arg">rawXML</i>
parameter if present or from the contents of <i class="arg">gpxFilename</i>,
and parses it using <em>tdom</em>. It returns a token value that is used
by all the other commands.</p></dd>
<dt><a name="2"><b class="cmd">::gpx::Cleanup</b> <i class="arg">token</i></a></dt>
<dd><p>This procedure cleans up resources associated with <i class="arg">token</i>.
It is <em>strongly</em> recommended that you call this
function after you are done with a given GPX file.
Not doing so will result in memory not being freed, and
if your app calls <b class="cmd">::gpx::Create</b> enough times, the
memory leak could cause a performance hit...or worse.</p></dd>
<dt><a name="3"><b class="cmd">::gpx::GetGPXMetadata</b> <i class="arg">token</i></a></dt>
<dd><p>This procedure returns a dictionary of the metadata
associated with the GPX data identified by <i class="arg">token</i>.
The format of the metadata dictionary is described
below, but keys <em>version</em> and <em>creator</em>
will always be present.</p></dd>
<dt><a name="4"><b class="cmd">::gpx::GetWaypointCount</b> <i class="arg">token</i></a></dt>
<dd><p>This procedure returns the number of waypoints defined in the GPX 
data identified by <i class="arg">token</i>.</p></dd>
<dt><a name="5"><b class="cmd">::gpx::GetAllWaypoints</b> <i class="arg">token</i></a></dt>
<dd><p>This procedure returns the a list of waypoints defined in the GPX 
data identified by <i class="arg">token</i>. The format of each waypoint item
is described below.</p></dd>
<dt><a name="6"><b class="cmd">::gpx::GetTrackCount</b> <i class="arg">token</i></a></dt>
<dd><p>This procedure returns the number of tracks defined in the GPX 
data identified by <i class="arg">token</i>.</p></dd>
<dt><a name="7"><b class="cmd">::gpx::GetTrackMetadata</b> <i class="arg">token</i> <i class="arg">whichTrack</i></a></dt>
<dd><p>This procedure returns a dictionary of the metadata 
associated track number <i class="arg">whichTrack</i> (1 based) in 
the GPX data identified by <i class="arg">token</i>.
The format of the metadata dictionary is described below.</p></dd>
<dt><a name="8"><b class="cmd">::gpx::GetTrackPoints</b> <i class="arg">token</i> <i class="arg">whichTrack</i></a></dt>
<dd><p>The procedure returns a list of track points comprising track
number <i class="arg">whichTrack</i> (1 based) in the GPX data identified by
<i class="arg">token</i>. The format of the metadata dictionary is described below.</p></dd>
<dt><a name="9"><b class="cmd">::gpx::GetRouteCount</b> <i class="arg">token</i></a></dt>
<dd><p>This procedure returns the number of routes defined in the GPX 
data identified by <i class="arg">token</i>.</p></dd>
<dt><a name="10"><b class="cmd">::gpx::GetRouteMetadata</b> <i class="arg">token</i> <i class="arg">whichRoute</i></a></dt>
<dd><p>This procedure returns a dictionary of the metadata 
associated route number <i class="arg">whichRoute</i> (1 based) in 
the GPX data identified by <i class="arg">token</i>.
The format of the metadata dictionary is described below.</p></dd>
<dt><a name="11"><b class="cmd">::gpx::GetRoutePoints</b> <i class="arg">token</i> <i class="arg">whichRoute</i></a></dt>
<dd><p>The procedure returns a list of route points comprising route
number <i class="arg">whichRoute</i> (1 based) in the GPX data identified by
<i class="arg">token</i>. The format of the metadata dictionary is described below.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">DATA STRUCTURES</a></h2>
<dl class="definitions">
<dt>metadata dictionary</dt>
<dd><p>The metadata associated with either the GPX document, a
track, a route, a waypoint, a track point or route
point is returned in a dictionary. The keys of that
dictionary will be whatever optional GPX elements are
present. The value for each key depends on the GPX schema
for that element. For example, the value for a version
key will be a string, while for a link key will be
a sub-dictionary with keys <em>href</em> and optionally
<em>text</em> and <em>type</em>.</p></dd>
<dt>point item</dt>
<dd><p>Each item in a track or route list of points consists of
a list of three elements: <em>latitude</em>, <em>longitude</em> and
<em>metadata dictionary</em>. <em>Latitude</em> and <em>longitude</em>
are decimal numbers. The <em>metadata dictionary</em> format is
described above. For points in a track, typically there will 
always be ele (elevation) and time metadata keys.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLE</a></h2>
<pre class="example">
% set token [::gpx::Create myGpxFile.gpx]
% set version [dict get [::gpx::GetGPXMetadata $token] version]
% set trackCnt [::gpx::GetTrackCount $token]
% set firstPoint [lindex [::gpx::GetTrackPoints $token 1] 0]
% lassign $firstPoint lat lon ptMetadata
% puts &quot;first point in the first track is at $lat, $lon&quot;
% if {[dict exists $ptMetadata ele]} { 
     puts &quot;at elevation [dict get $ptMetadata ele] meters&quot;
  }
% ::gpx::Cleanup $token
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>GPX: the GPS Exchange Format
   (<a href="http://www.topografix.com/gpx.asp">http://www.topografix.com/gpx.asp</a>)</p></li>
<li><p>GPX 1.1 Schema Documentation (<a href="http://www.topografix.com/GPX/1/1/">http://www.topografix.com/GPX/1/1/</a>)</p></li>
<li><p>GPX 1.0 Developer's Manual (<a href="http://www.topografix.com/gpx_manual.asp">http://www.topografix.com/gpx_manual.asp</a>)</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">AUTHOR</a></h2>
<p>Keith Vetter</p>
</div>
<div id="section7" class="section"><h2><a name="section7">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>gpx</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key359">gps</a>, <a href="../../../../index.html#key622">gpx</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>File formats</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2010, Keith Vetter &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_aycock/aycock.html.























































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::aycock - Aycock-Horspool-Earley parser generator for Tcl</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_aycock/aycock.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 by Kevin B. Kenny &lt;[email protected]&gt;   -- Redistribution permitted under the terms of the Open Publication License &lt;http://www.opencontent.org/openpub/&gt;
   -->
<! -- CVS: $Id$ grammar::aycock.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::aycock(n) 1.0 tcllib &quot;Aycock-Horspool-Earley parser generator for Tcl&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::aycock - Aycock-Horspool-Earley parser generator for Tcl</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">OBJECT COMMAND</a></li>
<li class="section"><a href="#section4">DESCRIPTION</a></li>
<li class="section"><a href="#section5">EXAMPLE</a></li>
<li class="section"><a href="#section6">KEYWORDS</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">grammar::aycock <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::aycock::parser</b> <i class="arg">grammar</i> <span class="opt">?<b class="option">-verbose</b>?</span></a></li>
<li><a href="#2"><i class="arg">parserName</i> <b class="method">parse</b> <i class="arg">symList</i> <i class="arg">valList</i> <span class="opt">?<i class="arg">clientData</i>?</span></a></li>
<li><a href="#3"><i class="arg">parserName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">parserName</i> <b class="method">terminals</b></a></li>
<li><a href="#5"><i class="arg">parserName</i> <b class="method">nonterminals</b></a></li>
<li><a href="#6"><i class="arg">parserName</i> <b class="method">save</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">grammar::aycock</b> package
implements a parser generator for the class of parsers described
in John Aycock and R. Nigel Horspool. Practical Earley Parsing. 
<em>The Computer Journal,</em> <em>45</em>(6):620-630, 2002. 
<a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.12.4254">http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.12.4254</a></p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The <b class="package">grammar::aycock</b> package exports the single procedure:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::aycock::parser</b> <i class="arg">grammar</i> <span class="opt">?<b class="option">-verbose</b>?</span></a></dt>
<dd><p>Generates a parser for the given <i class="arg">grammar</i>, and returns its
name.  If the optional <b class="option">-verbose</b> flag is given, dumps verbose
information relating to the generated parser to the standard output.
The returned parser is an object that accepts commands as shown in
<span class="sectref"><a href="#section3">OBJECT COMMAND</a></span> below.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OBJECT COMMAND</a></h2>
<dl class="definitions">
<dt><a name="2"><i class="arg">parserName</i> <b class="method">parse</b> <i class="arg">symList</i> <i class="arg">valList</i> <span class="opt">?<i class="arg">clientData</i>?</span></a></dt>
<dd><p>Invokes a parser returned from <b class="cmd">::aycock::parser</b>. <i class="arg">symList</i> is
a list of grammar symbols representing the terminals in an input
string, and <i class="arg">valList</i> is a list of their semantic values. The
result is the semantic value of the entire string when parsed.</p></dd>
<dt><a name="3"><i class="arg">parserName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys a parser constructed by <b class="cmd">::aycock::parser</b>.</p></dd>
<dt><a name="4"><i class="arg">parserName</i> <b class="method">terminals</b></a></dt>
<dd><p>Returns a list of terminal symbols that may be presented in the 
<i class="arg">symList</i> argument to the <b class="method">parse</b> object command.</p></dd>
<dt><a name="5"><i class="arg">parserName</i> <b class="method">nonterminals</b></a></dt>
<dd><p>Returns a list of nonterminal symbols that were defined in the
parser's grammar.</p></dd>
<dt><a name="6"><i class="arg">parserName</i> <b class="method">save</b></a></dt>
<dd><p>Returns a Tcl script that will reconstruct the parser without
needing all the mechanism of the parser generator at run time.
The reconstructed parser depends on a set of commands in the
package <b class="package">grammar::aycock::runtime</b>,
which is also automatically loaded
when the <b class="package">grammar::aycock</b> package is loaded.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">DESCRIPTION</a></h2>
<p>The <b class="cmd">grammar::aycock::parser</b> command accepts a grammar expressed as
a Tcl list.  The list must be structured as the concatenation of a set
of <i class="term">rule</i>s. Each <i class="term">rule</i> comprises a variable number of
elements in the list:</p>
<ul class="itemized">
<li><p>The name of the nonterminal symbol that the rule reduces.</p></li>
<li><p>The literal string, <b class="const">::=</b></p></li>
<li><p>Zero or more names of terminal or nonterminal symbols that
comprise the right-hand-side of the rule.</p></li>
<li><p>Finally, a Tcl script to execute when the rule is reduced.
Within the given script, a variable called <b class="variable">_</b> contains a list of
the semantic values of the symbols on the right-hand side. The value
returned by the script is expected to be the semantic value of the
left-hand side.  If the <i class="arg">clientData</i> parameter was passed to the
<b class="method">parse</b> method, it is available in a variable called
<b class="variable">clientData</b>.  It is permissible for the script to be the empty
string.  In this case, the semantic value of the rule will be the same
as the semantic value of the first symbol on the right-hand side.  If
the right-hand side is also empty, the semantic value will be the
empty string.</p></li>
</ul>
<p>Parsing is done with an Earley parser, which is not terribly efficient
in speed or memory consumption, but which deals effectively with
ambiguous grammars.  For this reason, the <b class="package">grammar::aycock</b> package is
perhaps best adapted to natural-language processing or the parsing of
extraordinarily complex languages in which ambiguity can be tolerated.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLE</a></h2>
<p>The following code demonstrates a trivial desk calculator, admitting
only <b class="const">+</b>, <b class="const">*</b> and parentheses as its operators.  It also
shows the format in which the lexical analyzer is expected to present
terminal symbols to the parser.</p>
<pre class="example">
set p [aycock::parser {
    start ::= E {}
    E ::= E + T {expr {[lindex $_ 0] + [lindex $_ 2]}}
    E ::= T {}
    T ::= T * F {expr {[lindex $_ 0] * [lindex $_ 2]}}
    T ::= F {}
    F ::= NUMBER {}
    F ::= ( E ) {lindex $_ 1}
}]
puts [$p parse {(  NUMBER +  NUMBER )  *  ( NUMBER +  NUMBER ) }  {{} 2      {} 3      {} {} {} 7     {} 1      {}}]
$p destroy
</pre>
<p>The example, when run, prints <b class="const">40</b>.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">KEYWORDS</a></h2>
<p>Aycock, Earley, Horspool, parser, compiler</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key754">ambiguous</a>, <a href="../../../../index.html#key757">aycock</a>, <a href="../../../../index.html#key756">earley</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key755">horspool</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 by Kevin B. Kenny &lt;[email protected]&gt;<br>
Redistribution permitted under the terms of the Open Publication License &lt;http://www.opencontent.org/openpub/&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_fa/dacceptor.html.

















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::fa::dacceptor - Finite automaton operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_fa/dacceptor.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::fa::dacceptor.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::fa::dacceptor(n) 0.1.1 tcllib &quot;Finite automaton operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::fa::dacceptor - Create and use deterministic acceptors</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">ACCEPTOR METHODS</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">struct::set</b></li>
<li>package require <b class="pkgname">grammar::fa::dacceptor <span class="opt">?0.1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::fa::dacceptor</b> <i class="arg">daName</i> <i class="arg">fa</i> <span class="opt">?<b class="option">-any</b> <i class="arg">any</i>?</span></a></li>
<li><a href="#2"><b class="cmd">daName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">daName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">daName</i> <b class="method">accept?</b> <i class="arg">symbols</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for acceptors constructed from
deterministic <i class="term">finite automatons</i> (DFA). Acceptors are objects
which can be given a string of symbols and tell if the DFA they are
constructed from would <i class="term">accept</i> that string.
For the actual creation of the DFAs the acceptors are based on we have
the packages <b class="package"><a href="fa.html">grammar::fa</a></b> and <b class="package"><a href="faop.html">grammar::fa::op</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports the API described here.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::fa::dacceptor</b> <i class="arg">daName</i> <i class="arg">fa</i> <span class="opt">?<b class="option">-any</b> <i class="arg">any</i>?</span></a></dt>
<dd><p>Creates a new deterministic acceptor with an associated global Tcl command
whose name is <i class="arg">daName</i>. This command may be used to invoke various
operations on the acceptor. It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">daName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command. See section <span class="sectref"><a href="#section3">ACCEPTOR METHODS</a></span> for more explanations.</p>
<p>The acceptor will be based on the deterministic finite automaton
stored in the object <i class="arg">fa</i>. It will keep a copy of the relevant
data of the FA in its own storage, in a form easy to use for its
purposes. This also means that changes made to the <i class="arg">fa</i> after the
construction of the acceptor <em>will not</em> influence the acceptor.</p>
<p>If <i class="arg">any</i> has been specified, then the acceptor will convert all
symbols in the input which are unknown to the base FA to that symbol
before proceeding with the processing.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">ACCEPTOR METHODS</a></h2>
<p>All acceptors provide the following methods for their manipulation:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">daName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the automaton, including its storage space and associated
command.</p></dd>
<dt><a name="4"><i class="arg">daName</i> <b class="method">accept?</b> <i class="arg">symbols</i></a></dt>
<dd><p>Takes the list of <i class="arg">symbols</i> and checks if the FA the acceptor is
based on would accept it. The result is a boolean value. <b class="const">True</b>
is returned if the symbols are accepted, and <b class="const">False</b>
otherwise. Note that bogus symbols in the input are either translated
to the <i class="arg">any</i> symbol (if specified), or cause the acceptance test
to simply fail. No errors will be thrown. The method will process only
just that prefix of the input which is enough to fully determine
(non-)acceptance.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_fa</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key283">acceptance</a>, <a href="../../../../index.html#key280">acceptor</a>, <a href="../../../../index.html#key277">automaton</a>, <a href="../../../../index.html#key282">finite automaton</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key281">regular expression</a>, <a href="../../../../index.html#key279">regular grammar</a>, <a href="../../../../index.html#key278">regular languages</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_fa/dexec.html.










































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::fa::dexec - Finite automaton operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_fa/dexec.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2007 Bogdan &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::fa::dexec.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::fa::dexec(n) 0.2 tcllib &quot;Finite automaton operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::fa::dexec - Execute deterministic finite automatons</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">EXECUTOR METHODS</a></li>
<li class="section"><a href="#section4">EXECUTOR CALLBACK</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">grammar::fa::dexec <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::fa::dexec</b> <i class="arg">daName</i> <i class="arg">fa</i> <span class="opt">?<b class="option">-any</b> <i class="arg">any</i>?</span> <span class="opt">?<b class="option">-command</b> <i class="arg">cmdprefix</i>?</span></a></li>
<li><a href="#2"><b class="cmd">daName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">daName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">daName</i> <b class="method">put</b> <i class="arg">symbol</i></a></li>
<li><a href="#5"><i class="arg">daName</i> <b class="method">reset</b></a></li>
<li><a href="#6"><i class="arg">daName</i> <b class="method">state</b></a></li>
<li><a href="#7"><i class="arg">cmdprefix</i> <b class="method">error</b> <i class="arg">code</i> <i class="arg">message</i></a></li>
<li><a href="#8"><i class="arg">cmdprefix</i> <b class="method">final</b> <i class="arg">stateid</i></a></li>
<li><a href="#9"><i class="arg">cmdprefix</i> <b class="method">reset</b></a></li>
<li><a href="#10"><i class="arg">cmdprefix</i> <b class="method">state</b> <i class="arg">stateid</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for executors constructed from
deterministic <i class="term">finite automatons</i> (DFA). Executors are objects
which are given a string of symbols in a piecemal fashion, perform
state transitions and report back when they enter a final state, or
find an error in the input.
For the actual creation of the DFAs the executors are based on we have
the packages <b class="package"><a href="fa.html">grammar::fa</a></b> and <b class="package"><a href="faop.html">grammar::fa::op</a></b>.</p>
<p>The objects follow a push model. Symbols are pushed into the executor,
and when something important happens, i.e. error occurs, a state transition,
or a final state is entered this will be reported via the callback
specified via the option <b class="option">-command</b>. Note that conversion of
this into a pull model where the environment retrieves messages from
the object and the object uses a callback to ask for more symbols is
a trivial thing.</p>
<p><em>Side note</em>:
The acceptor objects provided by <b class="package"><a href="dacceptor.html">grammar::fa::dacceptor</a></b>
could have been implemented on top of the executors provided here, but
were not, to get a bit more performance (we avoid a number of method
calls and the time required for their dispatch).</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports the API described here.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::fa::dexec</b> <i class="arg">daName</i> <i class="arg">fa</i> <span class="opt">?<b class="option">-any</b> <i class="arg">any</i>?</span> <span class="opt">?<b class="option">-command</b> <i class="arg">cmdprefix</i>?</span></a></dt>
<dd><p>Creates a new deterministic executor with an associated global Tcl
command whose name is <i class="arg">daName</i>. This command may be used to invoke
various operations on the executor. It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">daName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command. See section <span class="sectref"><a href="#section3">EXECUTOR METHODS</a></span> for more
explanations.</p>
<p>The executor will be based on the deterministic finite automaton
stored in the object <i class="arg">fa</i>. It will keep a copy of the relevant
data of the FA in its own storage, in a form easy to use for its
purposes. This also means that changes made to the <i class="arg">fa</i> after the
construction of the executor <em>will not</em> influence the executor.</p>
<p>If <i class="arg">any</i> has been specified, then the executor will convert all
symbols in the input which are unknown to the base FA to that symbol
before proceeding with the processing.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXECUTOR METHODS</a></h2>
<p>All executors provide the following methods for their manipulation:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">daName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the automaton, including its storage space and associated
command.</p></dd>
<dt><a name="4"><i class="arg">daName</i> <b class="method">put</b> <i class="arg">symbol</i></a></dt>
<dd><p>Takes the current state of the executor and the <i class="arg">symbol</i> and
performs the appropriate state transition. Reports any errors
encountered via the command callback, as well as entering a final
state of the underlying FA.</p>
<p>When an error is reported all further invokations of <b class="method">put</b> will
do nothing, until the error condition has been cleared via an
invokation of method <b class="method">reset</b>.</p></dd>
<dt><a name="5"><i class="arg">daName</i> <b class="method">reset</b></a></dt>
<dd><p>Unconditionally sets the executor into the start state of the
underlying FA. This also clears any error condition  <b class="method">put</b> may
have encountered.</p></dd>
<dt><a name="6"><i class="arg">daName</i> <b class="method">state</b></a></dt>
<dd><p>Returns the current state of the underlying FA. This allow for 
introspection without the need to pass data from the callback command.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXECUTOR CALLBACK</a></h2>
<p>The callback command <i class="arg">cmdprefix</i> given to an executor via the
option <b class="option">-command</b> will be executed by the object at the global
level, using the syntax described below. Note that <i class="arg">cmdprefix</i> is
not simply the name of a command, but a full command prefix. In other
words it may contain additional fixed argument words beyond the
command word.</p>
<dl class="definitions">
<dt><a name="7"><i class="arg">cmdprefix</i> <b class="method">error</b> <i class="arg">code</i> <i class="arg">message</i></a></dt>
<dd><p>The executor has encountered an error, and <i class="arg">message</i> contains a
human-readable text explaining the nature of the problem.
The <i class="arg">code</i> on the other hand is a fixed machine-readable text.
The following error codes can be generated by executor objects.</p>
<dl class="definitions">
<dt><b class="const">BADSYM</b></dt>
<dd><p>An unknown symbol was found in the input. This can happen if and only
if no <b class="option">-any</b> symbol was specified.</p></dd>
<dt><b class="const">BADTRANS</b></dt>
<dd><p>The underlying FA has no transition for the current combination of
input symbol and state. In other words, the executor was not able to
compute a new state for this combination.</p></dd>
</dl></dd>
<dt><a name="8"><i class="arg">cmdprefix</i> <b class="method">final</b> <i class="arg">stateid</i></a></dt>
<dd><p>The executor has entered the final state <i class="arg">stateid</i>.</p></dd>
<dt><a name="9"><i class="arg">cmdprefix</i> <b class="method">reset</b></a></dt>
<dd><p>The executor was reset.</p></dd>
<dt><a name="10"><i class="arg">cmdprefix</i> <b class="method">state</b> <i class="arg">stateid</i></a></dt>
<dd><p>The FA changed state due to a transition. <i class="arg">stateid</i> is the new state.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_fa</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key277">automaton</a>, <a href="../../../../index.html#key381">execution</a>, <a href="../../../../index.html#key282">finite automaton</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key281">regular expression</a>, <a href="../../../../index.html#key279">regular grammar</a>, <a href="../../../../index.html#key278">regular languages</a>, <a href="../../../../index.html#key382">running</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2007 Bogdan &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_fa/fa.html.





















































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::fa - Finite automaton operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_fa/fa.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::fa.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::fa(n) 0.4 tcllib &quot;Finite automaton operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::fa - Create and manipulate finite automatons</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">FA METHODS</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">FINITE AUTOMATONS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit 1.3</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">struct::set</b></li>
<li>package require <b class="pkgname">grammar::fa::op <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">grammar::fa <span class="opt">?0.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::fa</b> <i class="arg">faName</i> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">&lt;--</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">src</i>|<b class="const">fromRegex</b> <i class="arg">re</i> <span class="opt">?<i class="arg">over</i>?</span>?</span></a></li>
<li><a href="#2"><b class="cmd">faName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">faName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">faName</i> <b class="method">clear</b></a></li>
<li><a href="#5"><i class="arg">faName</i> <b class="method">=</b> <i class="arg">srcFA</i></a></li>
<li><a href="#6"><i class="arg">faName</i> <b class="method">--&gt;</b> <i class="arg">dstFA</i></a></li>
<li><a href="#7"><i class="arg">faName</i> <b class="method">serialize</b></a></li>
<li><a href="#8"><i class="arg">faName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></li>
<li><a href="#9"><i class="arg">faName</i> <b class="method">states</b></a></li>
<li><a href="#10"><i class="arg">faName</i> <b class="method">state</b> <b class="method">add</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></li>
<li><a href="#11"><i class="arg">faName</i> <b class="method">state</b> <b class="method">delete</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></li>
<li><a href="#12"><i class="arg">faName</i> <b class="method">state</b> <b class="method">exists</b> <i class="arg">s</i></a></li>
<li><a href="#13"><i class="arg">faName</i> <b class="method">state</b> <b class="method">rename</b> <i class="arg">s</i> <i class="arg">snew</i></a></li>
<li><a href="#14"><i class="arg">faName</i> <b class="method">startstates</b></a></li>
<li><a href="#15"><i class="arg">faName</i> <b class="method">start</b> <b class="method">add</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></li>
<li><a href="#16"><i class="arg">faName</i> <b class="method">start</b> <b class="method">remove</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></li>
<li><a href="#17"><i class="arg">faName</i> <b class="method">start?</b> <i class="arg">s</i></a></li>
<li><a href="#18"><i class="arg">faName</i> <b class="method">start?set</b> <i class="arg">stateset</i></a></li>
<li><a href="#19"><i class="arg">faName</i> <b class="method">finalstates</b></a></li>
<li><a href="#20"><i class="arg">faName</i> <b class="method">final</b> <b class="method">add</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></li>
<li><a href="#21"><i class="arg">faName</i> <b class="method">final</b> <b class="method">remove</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></li>
<li><a href="#22"><i class="arg">faName</i> <b class="method">final?</b> <i class="arg">s</i></a></li>
<li><a href="#23"><i class="arg">faName</i> <b class="method">final?set</b> <i class="arg">stateset</i></a></li>
<li><a href="#24"><i class="arg">faName</i> <b class="method">symbols</b></a></li>
<li><a href="#25"><i class="arg">faName</i> <b class="method">symbols@</b> <i class="arg">s</i> <span class="opt">?<i class="arg">d</i>?</span></a></li>
<li><a href="#26"><i class="arg">faName</i> <b class="method">symbols@set</b> <i class="arg">stateset</i></a></li>
<li><a href="#27"><i class="arg">faName</i> <b class="method">symbol</b> <b class="method">add</b> <i class="arg">sym1</i> <span class="opt">?<i class="arg">sym2</i> ...?</span></a></li>
<li><a href="#28"><i class="arg">faName</i> <b class="method">symbol</b> <b class="method">delete</b> <i class="arg">sym1</i> <span class="opt">?<i class="arg">sym2</i> ...?</span></a></li>
<li><a href="#29"><i class="arg">faName</i> <b class="method">symbol</b> <b class="method">rename</b> <i class="arg">sym</i> <i class="arg">newsym</i></a></li>
<li><a href="#30"><i class="arg">faName</i> <b class="method">symbol</b> <b class="method">exists</b> <i class="arg">sym</i></a></li>
<li><a href="#31"><i class="arg">faName</i> <b class="method">next</b> <i class="arg">s</i> <i class="arg">sym</i> <span class="opt">?<b class="const">--&gt;</b> <i class="arg">next</i>?</span></a></li>
<li><a href="#32"><i class="arg">faName</i> <b class="method">!next</b> <i class="arg">s</i> <i class="arg">sym</i> <span class="opt">?<b class="const">--&gt;</b> <i class="arg">next</i>?</span></a></li>
<li><a href="#33"><i class="arg">faName</i> <b class="method">nextset</b> <i class="arg">stateset</i> <i class="arg">sym</i></a></li>
<li><a href="#34"><i class="arg">faName</i> <b class="method">is</b> <b class="method">deterministic</b></a></li>
<li><a href="#35"><i class="arg">faName</i> <b class="method">is</b> <b class="method">complete</b></a></li>
<li><a href="#36"><i class="arg">faName</i> <b class="method">is</b> <b class="method">useful</b></a></li>
<li><a href="#37"><i class="arg">faName</i> <b class="method">is</b> <b class="method">epsilon-free</b></a></li>
<li><a href="#38"><i class="arg">faName</i> <b class="method">reachable_states</b></a></li>
<li><a href="#39"><i class="arg">faName</i> <b class="method">unreachable_states</b></a></li>
<li><a href="#40"><i class="arg">faName</i> <b class="method">reachable</b> <i class="arg">s</i></a></li>
<li><a href="#41"><i class="arg">faName</i> <b class="method">useful_states</b></a></li>
<li><a href="#42"><i class="arg">faName</i> <b class="method">unuseful_states</b></a></li>
<li><a href="#43"><i class="arg">faName</i> <b class="method">useful</b> <i class="arg">s</i></a></li>
<li><a href="#44"><i class="arg">faName</i> <b class="method">epsilon_closure</b> <i class="arg">s</i></a></li>
<li><a href="#45"><i class="arg">faName</i> <b class="method">reverse</b></a></li>
<li><a href="#46"><i class="arg">faName</i> <b class="method">complete</b></a></li>
<li><a href="#47"><i class="arg">faName</i> <b class="method">remove_eps</b></a></li>
<li><a href="#48"><i class="arg">faName</i> <b class="method">trim</b> <span class="opt">?<i class="arg">what</i>?</span></a></li>
<li><a href="#49"><i class="arg">faName</i> <b class="method">determinize</b> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#50"><i class="arg">faName</i> <b class="method">minimize</b> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#51"><i class="arg">faName</i> <b class="method">complement</b></a></li>
<li><a href="#52"><i class="arg">faName</i> <b class="method">kleene</b></a></li>
<li><a href="#53"><i class="arg">faName</i> <b class="method">optional</b></a></li>
<li><a href="#54"><i class="arg">faName</i> <b class="method">union</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#55"><i class="arg">faName</i> <b class="method">intersect</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#56"><i class="arg">faName</i> <b class="method">difference</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#57"><i class="arg">faName</i> <b class="method">concatenate</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#58"><i class="arg">faName</i> <b class="method">fromRegex</b> <i class="arg">regex</i> <span class="opt">?<i class="arg">over</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a container class for
<i class="term">finite automatons</i> (Short: FA).
It allows the incremental definition of the automaton, its
manipulation and querying of the definition.
While the package provides complex operations on the automaton
(via package <b class="package"><a href="faop.html">grammar::fa::op</a></b>), it does not have the
ability to execute a definition for a stream of symbols.
Use the packages
<b class="package"><a href="dacceptor.html">grammar::fa::dacceptor</a></b> and
<b class="package"><a href="dexec.html">grammar::fa::dexec</a></b> for that.
Another package related to this is <b class="package">grammar::fa::compiler</b>. It
turns a FA into an executor class which has the definition of the FA
hardwired into it. The output of this package is configurable to suit
a large number of different implementation languages and paradigms.</p>
<p>For more information about what a finite automaton is see section
<span class="sectref"><a href="#section5">FINITE AUTOMATONS</a></span>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports the API described here.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::fa</b> <i class="arg">faName</i> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">&lt;--</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">src</i>|<b class="const">fromRegex</b> <i class="arg">re</i> <span class="opt">?<i class="arg">over</i>?</span>?</span></a></dt>
<dd><p>Creates a new finite automaton with an associated global Tcl command
whose name is <i class="arg">faName</i>. This command may be used to invoke various
operations on the automaton. It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">faName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command. See section <span class="sectref"><a href="#section3">FA METHODS</a></span> for more explanations. The
new automaton will be empty if no <i class="arg">src</i> is specified. Otherwise
it will contain a copy of the definition contained in the <i class="arg">src</i>.
The <i class="arg">src</i> has to be a FA object reference for all operators except
<b class="const">deserialize</b> and <b class="const">fromRegex</b>. The <b class="const">deserialize</b>
operator requires <i class="arg">src</i> to be the serialization of a FA instead,
and <b class="const">fromRegex</b> takes a regular expression in the form a of a
syntax tree. See <b class="cmd">::grammar::fa::op::fromRegex</b> for more detail on
that.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">FA METHODS</a></h2>
<p>All automatons provide the following methods for their manipulation:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">faName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the automaton, including its storage space and associated
command.</p></dd>
<dt><a name="4"><i class="arg">faName</i> <b class="method">clear</b></a></dt>
<dd><p>Clears out the definition of the automaton contained in <i class="arg">faName</i>,
but does <em>not</em> destroy the object.</p></dd>
<dt><a name="5"><i class="arg">faName</i> <b class="method">=</b> <i class="arg">srcFA</i></a></dt>
<dd><p>Assigns the contents of the automaton contained
in <i class="arg">srcFA</i> to <i class="arg">faName</i>, overwriting any
existing definition.
This is the assignment operator for automatons. It copies the
automaton contained in the FA object <i class="arg">srcFA</i> over the automaton
definition in <i class="arg">faName</i>. The old contents of <i class="arg">faName</i> are
deleted by this operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">faName</i> <b class="method">deserialize</b> [<i class="arg">srcFA</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="6"><i class="arg">faName</i> <b class="method">--&gt;</b> <i class="arg">dstFA</i></a></dt>
<dd><p>This is the reverse assignment operator for automatons. It copies the
automation contained in the object <i class="arg">faName</i> over the automaton
definition in the object <i class="arg">dstFA</i>.
The old contents of <i class="arg">dstFA</i> are deleted by this operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">dstFA</i> <b class="method">deserialize</b> [<i class="arg">faName</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="7"><i class="arg">faName</i> <b class="method">serialize</b></a></dt>
<dd><p>This method serializes the automaton stored in <i class="arg">faName</i>. In other
words it returns a tcl <em>value</em> completely describing that
automaton.
This allows, for example, the transfer of automatons over arbitrary
channels, persistence, etc.
This method is also the basis for both the copy constructor and the
assignment operator.</p>
<p>The result of this method has to be semantically identical over all
implementations of the <b class="package">grammar::fa</b> interface. This is what
will enable us to copy automatons between different implementations of
the same interface.</p>
<p>The result is a list of three elements with the following structure:</p>
<ol class="enumerated">
<li><p>The constant string <b class="const">grammar::fa</b>.</p></li>
<li><p>A list containing the names of all known input symbols. The order of
elements in this list is not relevant.</p></li>
<li><p>The last item in the list is a dictionary, however the order of the
keys is important as well. The keys are the states of the serialized
FA, and their order is the order in which to create the states when
deserializing. This is relevant to preserve the order relationship
between states.</p>
<p>The value of each dictionary entry is a list of three elements
describing the state in more detail.</p>
<ol class="enumerated">
<li><p>A boolean flag. If its value is <b class="const">true</b> then the state is a
start state, otherwise it is not.</p></li>
<li><p>A boolean flag. If its value is <b class="const">true</b> then the state is a
final state, otherwise it is not.</p></li>
<li><p>The last element is a dictionary describing the transitions for the
state. The keys are symbols (or the empty string), and the values are
sets of successor states.</p></li>
</ol>
</li>
</ol>
<p>Assuming the following FA (which describes the life of a truck driver
in a very simple way :)</p>
<pre class="example">
    Drive -- yellow --&gt; Brake -- red --&gt; (Stop) -- red/yellow --&gt; Attention -- green --&gt; Drive
    (...) is the start state.
</pre>
<p>a possible serialization is</p>
<pre class="example">
    grammar::fa \\
    {yellow red green red/yellow} \\
    {Drive     {0 0 {yellow     Brake}} \\
     Brake     {0 0 {red        Stop}} \\
     Stop      {1 0 {red/yellow Attention}} \\
     Attention {0 0 {green      Drive}}}
</pre>
<p>A possible one, because I did not care about creation order here</p></dd>
<dt><a name="8"><i class="arg">faName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></dt>
<dd><p>This is the complement to <b class="method">serialize</b>. It replaces the
automaton definition in <i class="arg">faName</i> with the automaton described by
the <i class="arg">serialization</i> value. The old contents of <i class="arg">faName</i> are
deleted by this operation.</p></dd>
<dt><a name="9"><i class="arg">faName</i> <b class="method">states</b></a></dt>
<dd><p>Returns the set of all states known to <i class="arg">faName</i>.</p></dd>
<dt><a name="10"><i class="arg">faName</i> <b class="method">state</b> <b class="method">add</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></dt>
<dd><p>Adds the states <i class="arg">s1</i>, <i class="arg">s2</i>, et cetera to the FA definition in
<i class="arg">faName</i>. The operation will fail any of the new states is already
declared.</p></dd>
<dt><a name="11"><i class="arg">faName</i> <b class="method">state</b> <b class="method">delete</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></dt>
<dd><p>Deletes the state <i class="arg">s1</i>, <i class="arg">s2</i>, et cetera, and all associated
information from the FA definition in <i class="arg">faName</i>. The latter means
that the information about in- or outbound transitions is deleted as
well. If the deleted state was a start or final state then this
information is invalidated as well. The operation will fail if the
state <i class="arg">s</i> is not known to the FA.</p></dd>
<dt><a name="12"><i class="arg">faName</i> <b class="method">state</b> <b class="method">exists</b> <i class="arg">s</i></a></dt>
<dd><p>A predicate. It tests whether the state <i class="arg">s</i> is known to the FA in
<i class="arg">faName</i>.
The result is a boolean value. It will be set to <b class="const">true</b> if the
state <i class="arg">s</i> is known, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="13"><i class="arg">faName</i> <b class="method">state</b> <b class="method">rename</b> <i class="arg">s</i> <i class="arg">snew</i></a></dt>
<dd><p>Renames the state <i class="arg">s</i> to <i class="arg">snew</i>. Fails if <i class="arg">s</i> is not a
known state. Also fails if <i class="arg">snew</i> is already known as a state.</p></dd>
<dt><a name="14"><i class="arg">faName</i> <b class="method">startstates</b></a></dt>
<dd><p>Returns the set of states which are marked as <i class="term">start</i> states,
also known as <i class="term">initial</i> states.
See <span class="sectref"><a href="#section5">FINITE AUTOMATONS</a></span> for explanations what this means.</p></dd>
<dt><a name="15"><i class="arg">faName</i> <b class="method">start</b> <b class="method">add</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></dt>
<dd><p>Mark the states <i class="arg">s1</i>, <i class="arg">s2</i>, et cetera in the FA <i class="arg">faName</i>
as <i class="term">start</i> (aka <i class="term">initial</i>).</p></dd>
<dt><a name="16"><i class="arg">faName</i> <b class="method">start</b> <b class="method">remove</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></dt>
<dd><p>Mark the states <i class="arg">s1</i>, <i class="arg">s2</i>, et cetera in the FA <i class="arg">faName</i>
as <i class="term">not start</i> (aka <i class="term">not accepting</i>).</p></dd>
<dt><a name="17"><i class="arg">faName</i> <b class="method">start?</b> <i class="arg">s</i></a></dt>
<dd><p>A predicate. It tests if the state <i class="arg">s</i> in the FA <i class="arg">faName</i> is
<i class="term">start</i> or not.
The result is a boolean value. It will be set to <b class="const">true</b> if the
state <i class="arg">s</i> is <i class="term">start</i>, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="18"><i class="arg">faName</i> <b class="method">start?set</b> <i class="arg">stateset</i></a></dt>
<dd><p>A predicate. It tests if the set of states <i class="arg">stateset</i> contains at
least one start state. They operation will fail if the set contains an
element which is not a known state.
The result is a boolean value. It will be set to <b class="const">true</b> if a
start state is present in <i class="arg">stateset</i>, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="19"><i class="arg">faName</i> <b class="method">finalstates</b></a></dt>
<dd><p>Returns the set of states which are marked as <i class="term"><a href="../../../../index.html#key153">final</a></i> states,
also known as <i class="term">accepting</i> states.
See <span class="sectref"><a href="#section5">FINITE AUTOMATONS</a></span> for explanations what this means.</p></dd>
<dt><a name="20"><i class="arg">faName</i> <b class="method">final</b> <b class="method">add</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></dt>
<dd><p>Mark the states <i class="arg">s1</i>, <i class="arg">s2</i>, et cetera in the FA <i class="arg">faName</i>
as <i class="term"><a href="../../../../index.html#key153">final</a></i> (aka <i class="term">accepting</i>).</p></dd>
<dt><a name="21"><i class="arg">faName</i> <b class="method">final</b> <b class="method">remove</b> <i class="arg">s1</i> <span class="opt">?<i class="arg">s2</i> ...?</span></a></dt>
<dd><p>Mark the states <i class="arg">s1</i>, <i class="arg">s2</i>, et cetera in the FA <i class="arg">faName</i>
as <i class="term">not final</i> (aka <i class="term">not accepting</i>).</p></dd>
<dt><a name="22"><i class="arg">faName</i> <b class="method">final?</b> <i class="arg">s</i></a></dt>
<dd><p>A predicate. It tests if the state <i class="arg">s</i> in the FA <i class="arg">faName</i> is
<i class="term"><a href="../../../../index.html#key153">final</a></i> or not.
The result is a boolean value. It will be set to <b class="const">true</b> if the
state <i class="arg">s</i> is <i class="term"><a href="../../../../index.html#key153">final</a></i>, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="23"><i class="arg">faName</i> <b class="method">final?set</b> <i class="arg">stateset</i></a></dt>
<dd><p>A predicate. It tests if the set of states <i class="arg">stateset</i> contains at
least one final state. They operation will fail if the set contains an
element which is not a known state.
The result is a boolean value. It will be set to <b class="const">true</b> if a
final state is present in <i class="arg">stateset</i>, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="24"><i class="arg">faName</i> <b class="method">symbols</b></a></dt>
<dd><p>Returns the set of all symbols known to the FA <i class="arg">faName</i>.</p></dd>
<dt><a name="25"><i class="arg">faName</i> <b class="method">symbols@</b> <i class="arg">s</i> <span class="opt">?<i class="arg">d</i>?</span></a></dt>
<dd><p>Returns the set of all symbols for which the state <i class="arg">s</i> has transitions.
If the empty symbol is present then <i class="arg">s</i> has epsilon transitions. If two
states are specified the result is the set of symbols which have transitions
from <i class="arg">s</i> to <i class="arg">t</i>. This set may be empty if there are no transitions
between the two specified states.</p></dd>
<dt><a name="26"><i class="arg">faName</i> <b class="method">symbols@set</b> <i class="arg">stateset</i></a></dt>
<dd><p>Returns the set of all symbols for which at least one state in the set
of states <i class="arg">stateset</i> has transitions.
In other words, the union of [<i class="arg">faName</i> <b class="method">symbols@</b> <b class="variable">s</b>]
for all states <b class="variable">s</b> in <i class="arg">stateset</i>.
If the empty symbol is present then at least one state contained in
<i class="arg">stateset</i> has epsilon transitions.</p></dd>
<dt><a name="27"><i class="arg">faName</i> <b class="method">symbol</b> <b class="method">add</b> <i class="arg">sym1</i> <span class="opt">?<i class="arg">sym2</i> ...?</span></a></dt>
<dd><p>Adds the symbols <i class="arg">sym1</i>, <i class="arg">sym2</i>, et cetera to the FA
definition in <i class="arg">faName</i>. The operation will fail any of the symbols
is already declared. The empty string is not allowed as a value for the symbols.</p></dd>
<dt><a name="28"><i class="arg">faName</i> <b class="method">symbol</b> <b class="method">delete</b> <i class="arg">sym1</i> <span class="opt">?<i class="arg">sym2</i> ...?</span></a></dt>
<dd><p>Deletes the symbols <i class="arg">sym1</i>, <i class="arg">sym2</i> et cetera, and all
associated information from the FA definition in <i class="arg">faName</i>. The
latter means that all transitions using the symbols are deleted as
well. The operation will fail if any of the symbols is not known to
the FA.</p></dd>
<dt><a name="29"><i class="arg">faName</i> <b class="method">symbol</b> <b class="method">rename</b> <i class="arg">sym</i> <i class="arg">newsym</i></a></dt>
<dd><p>Renames the symbol <i class="arg">sym</i> to <i class="arg">newsym</i>. Fails if <i class="arg">sym</i> is
not a known symbol. Also fails if <i class="arg">newsym</i> is already known as a
symbol.</p></dd>
<dt><a name="30"><i class="arg">faName</i> <b class="method">symbol</b> <b class="method">exists</b> <i class="arg">sym</i></a></dt>
<dd><p>A predicate. It tests whether the symbol <i class="arg">sym</i> is known to the FA
in <i class="arg">faName</i>.
The result is a boolean value. It will be set to <b class="const">true</b> if the
symbol <i class="arg">sym</i> is known, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="31"><i class="arg">faName</i> <b class="method">next</b> <i class="arg">s</i> <i class="arg">sym</i> <span class="opt">?<b class="const">--&gt;</b> <i class="arg">next</i>?</span></a></dt>
<dd><p>Define or query transition information.</p>
<p>If <i class="arg">next</i> is specified, then the method will add a transition from
the state <i class="arg">s</i> to the <i class="term">successor</i> state <i class="arg">next</i> labeled with
the symbol <i class="arg">sym</i> to the FA contained in <i class="arg">faName</i>. The
operation will fail if <i class="arg">s</i>, or <i class="arg">next</i> are not known states, or
if <i class="arg">sym</i> is not a known symbol. An exception to the latter is that
<i class="arg">sym</i> is allowed to be the empty string. In that case the new
transition is an <i class="term">epsilon transition</i> which will not consume
input when traversed. The operation will also fail if the combination
of (<i class="arg">s</i>, <i class="arg">sym</i>, and <i class="arg">next</i>) is already present in the FA.</p>
<p>If <i class="arg">next</i> was not specified, then the method will return
the set of states which can be reached from <i class="arg">s</i> through
a single transition labeled with symbol <i class="arg">sym</i>.</p></dd>
<dt><a name="32"><i class="arg">faName</i> <b class="method">!next</b> <i class="arg">s</i> <i class="arg">sym</i> <span class="opt">?<b class="const">--&gt;</b> <i class="arg">next</i>?</span></a></dt>
<dd><p>Remove one or more transitions from the Fa in <i class="arg">faName</i>.</p>
<p>If <i class="arg">next</i> was specified then the single transition from the state
<i class="arg">s</i> to the state <i class="arg">next</i> labeled with the symbol <i class="arg">sym</i> is
removed from the FA. Otherwise <em>all</em> transitions originating in
state <i class="arg">s</i> and labeled with the symbol <i class="arg">sym</i> will be removed.</p>
<p>The operation will fail if <i class="arg">s</i> and/or <i class="arg">next</i> are not known as
states. It will also fail if a non-empty <i class="arg">sym</i> is not known as
symbol. The empty string is acceptable, and allows the removal of
epsilon transitions.</p></dd>
<dt><a name="33"><i class="arg">faName</i> <b class="method">nextset</b> <i class="arg">stateset</i> <i class="arg">sym</i></a></dt>
<dd><p>Returns the set of states which can be reached by a single transition
originating in a state in the set <i class="arg">stateset</i> and labeled with the
symbol <i class="arg">sym</i>.</p>
<p>In other words, this is the union of
[<i class="arg">faName</i> next <b class="variable">s</b> <i class="arg">symbol</i>]
for all states <b class="variable">s</b> in <i class="arg">stateset</i>.</p></dd>
<dt><a name="34"><i class="arg">faName</i> <b class="method">is</b> <b class="method">deterministic</b></a></dt>
<dd><p>A predicate. It tests whether the FA in <i class="arg">faName</i> is a
deterministic FA or not.
The result is a boolean value. It will be set to <b class="const">true</b> if the
FA is deterministic, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="35"><i class="arg">faName</i> <b class="method">is</b> <b class="method">complete</b></a></dt>
<dd><p>A predicate. It tests whether the FA in <i class="arg">faName</i> is a complete FA
or not. A FA is complete if it has at least one transition per state
and symbol. This also means that a FA without symbols, or states is
also complete.
The result is a boolean value. It will be set to <b class="const">true</b> if the
FA is deterministic, and <b class="const">false</b> otherwise.</p>
<p>Note: When a FA has epsilon-transitions transitions over a symbol for
a state S can be indirect, i.e. not attached directly to S, but to a
state in the epsilon-closure of S. The symbols for such indirect
transitions count when computing completeness.</p></dd>
<dt><a name="36"><i class="arg">faName</i> <b class="method">is</b> <b class="method">useful</b></a></dt>
<dd><p>A predicate. It tests whether the FA in <i class="arg">faName</i> is an useful FA
or not. A FA is useful if all states are <i class="term">reachable</i>
and <i class="term">useful</i>.
The result is a boolean value. It will be set to <b class="const">true</b> if the
FA is deterministic, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="37"><i class="arg">faName</i> <b class="method">is</b> <b class="method">epsilon-free</b></a></dt>
<dd><p>A predicate. It tests whether the FA in <i class="arg">faName</i> is an
epsilon-free FA or not. A FA is epsilon-free if it has no epsilon
transitions. This definition means that all deterministic FAs are
epsilon-free as well, and epsilon-freeness is a necessary
pre-condition for deterministic'ness.
The result is a boolean value. It will be set to <b class="const">true</b> if the
FA is deterministic, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="38"><i class="arg">faName</i> <b class="method">reachable_states</b></a></dt>
<dd><p>Returns the set of states which are reachable from a start state by
one or more transitions.</p></dd>
<dt><a name="39"><i class="arg">faName</i> <b class="method">unreachable_states</b></a></dt>
<dd><p>Returns the set of states which are not reachable from any start state
by any number of transitions. This is</p>
<pre class="example">
	 [faName states] - [faName reachable_states]
</pre>
</dd>
<dt><a name="40"><i class="arg">faName</i> <b class="method">reachable</b> <i class="arg">s</i></a></dt>
<dd><p>A predicate. It tests whether the state <i class="arg">s</i> in the FA <i class="arg">faName</i>
can be reached from a start state by one or more transitions.
The result is a boolean value. It will be set to <b class="const">true</b> if the
state can be reached, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="41"><i class="arg">faName</i> <b class="method">useful_states</b></a></dt>
<dd><p>Returns the set of states which are able to reach a final state by
one or more transitions.</p></dd>
<dt><a name="42"><i class="arg">faName</i> <b class="method">unuseful_states</b></a></dt>
<dd><p>Returns the set of states which are not able to reach a final state by
any number of transitions. This is</p>
<pre class="example">
	 [faName states] - [faName useful_states]
</pre>
</dd>
<dt><a name="43"><i class="arg">faName</i> <b class="method">useful</b> <i class="arg">s</i></a></dt>
<dd><p>A predicate. It tests whether the state <i class="arg">s</i> in the FA <i class="arg">faName</i>
is able to reach a final state by one or more transitions.
The result is a boolean value. It will be set to <b class="const">true</b> if the
state is useful, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="44"><i class="arg">faName</i> <b class="method">epsilon_closure</b> <i class="arg">s</i></a></dt>
<dd><p>Returns the set of states which are reachable from the state <i class="arg">s</i>
in the FA <i class="arg">faName</i> by one or more epsilon transitions, i.e
transitions over the empty symbol, transitions which do not consume
input. This is called the <i class="term">epsilon closure</i> of <i class="arg">s</i>.</p></dd>
<dt><a name="45"><i class="arg">faName</i> <b class="method">reverse</b></a></dt>
<dd></dd>
<dt><a name="46"><i class="arg">faName</i> <b class="method">complete</b></a></dt>
<dd></dd>
<dt><a name="47"><i class="arg">faName</i> <b class="method">remove_eps</b></a></dt>
<dd></dd>
<dt><a name="48"><i class="arg">faName</i> <b class="method">trim</b> <span class="opt">?<i class="arg">what</i>?</span></a></dt>
<dd></dd>
<dt><a name="49"><i class="arg">faName</i> <b class="method">determinize</b> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd></dd>
<dt><a name="50"><i class="arg">faName</i> <b class="method">minimize</b> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd></dd>
<dt><a name="51"><i class="arg">faName</i> <b class="method">complement</b></a></dt>
<dd></dd>
<dt><a name="52"><i class="arg">faName</i> <b class="method">kleene</b></a></dt>
<dd></dd>
<dt><a name="53"><i class="arg">faName</i> <b class="method">optional</b></a></dt>
<dd></dd>
<dt><a name="54"><i class="arg">faName</i> <b class="method">union</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd></dd>
<dt><a name="55"><i class="arg">faName</i> <b class="method">intersect</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd></dd>
<dt><a name="56"><i class="arg">faName</i> <b class="method">difference</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd></dd>
<dt><a name="57"><i class="arg">faName</i> <b class="method">concatenate</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd></dd>
<dt><a name="58"><i class="arg">faName</i> <b class="method">fromRegex</b> <i class="arg">regex</i> <span class="opt">?<i class="arg">over</i>?</span></a></dt>
<dd><p>These methods provide more complex operations on the FA.  Please see
the same-named commands in the package <b class="package"><a href="faop.html">grammar::fa::op</a></b> for
descriptions of what they do.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
</div>
<div id="section5" class="section"><h2><a name="section5">FINITE AUTOMATONS</a></h2>
<p>For the mathematically inclined, a FA is a 5-tuple (S,Sy,St,Fi,T) where</p>
<ul class="itemized">
<li><p>S is a set of <i class="term">states</i>,</p></li>
<li><p>Sy a set of <i class="term">input symbols</i>,</p></li>
<li><p>St is a subset of S, the set of <i class="term">start</i> states, also known as
<i class="term">initial</i> states.</p></li>
<li><p>Fi is a subset of S, the set of <i class="term"><a href="../../../../index.html#key153">final</a></i> states, also known as
<i class="term">accepting</i>.</p></li>
<li><p>T is a function from S x (Sy + epsilon) to {S}, the <i class="term">transition function</i>.
Here <b class="const">epsilon</b> denotes the empty input symbol and is distinct
from all symbols in Sy; and {S} is the set of subsets of S. In other
words, T maps a combination of State and Input (which can be empty) to
a set of <i class="term">successor states</i>.</p></li>
</ul>
<p>In computer theory a FA is most often shown as a graph where the nodes
represent the states, and the edges between the nodes encode the
transition function: For all n in S' = T (s, sy) we have one edge
between the nodes representing s and n resp., labeled with sy. The
start and accepting states are encoded through distinct visual
markers, i.e. they are attributes of the nodes.</p>
<p>FA's are used to process streams of symbols over Sy.</p>
<p>A specific FA is said to <i class="term">accept</i> a finite stream sy_1 sy_2
... sy_n if there is a path in the graph of the FA beginning at a
state in St and ending at a state in Fi whose edges have the labels
sy_1, sy_2, etc. to sy_n.
The set of all strings accepted by the FA is the <i class="term">language</i> of
the FA. One important equivalence is that the set of languages which
can be accepted by an FA is the set of <i class="term"><a href="../../../../index.html#key278">regular languages</a></i>.</p>
<p>Another important concept is that of deterministic FAs. A FA is said
to be <i class="term">deterministic</i> if for each string of input symbols there
is exactly one path in the graph of the FA beginning at the start
state and whose edges are labeled with the symbols in the string.
While it might seem that non-deterministic FAs to have more power of
recognition, this is not so. For each non-deterministic FA we can
construct a deterministic FA which accepts the same language (--&gt;
Thompson's subset construction).</p>
<p>While one of the premier applications of FAs is in <i class="term"><a href="../../../../index.html#key26">parsing</a></i>,
especially in the <i class="term"><a href="../../../../index.html#key345">lexer</a></i> stage (where symbols == characters),
this is not the only possibility by far.</p>
<p>Quite a lot of processes can be modeled as a FA, albeit with a
possibly large set of states. For these the notion of accepting states
is often less or not relevant at all. What is needed instead is the
ability to act to state changes in the FA, i.e. to generate some
output in response to the input.
This transforms a FA into a <i class="term">finite transducer</i>, which has an
additional set OSy of <i class="term">output symbols</i> and also an additional
<i class="term">output function</i> O which maps from &quot;S x (Sy + epsilon)&quot; to
&quot;(Osy + epsilon)&quot;, i.e a combination of state and input, possibly
empty to an output symbol, or nothing.</p>
<p>For the graph representation this means that edges are additional
labeled with the output symbol to write when this edge is traversed
while matching input. Note that for an application &quot;writing an output
symbol&quot; can also be &quot;executing some code&quot;.</p>
<p>Transducers are not handled by this package. They will get their own
package in the future.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_fa</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key277">automaton</a>, <a href="../../../../index.html#key282">finite automaton</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key281">regular expression</a>, <a href="../../../../index.html#key279">regular grammar</a>, <a href="../../../../index.html#key278">regular languages</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_fa/faop.html.

















































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::fa::op - Finite automaton operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_fa/faop.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::fa::op.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::fa::op(n) 0.4 tcllib &quot;Finite automaton operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::fa::op - Operations on finite automatons</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">struct::set</b></li>
<li>package require <b class="pkgname">grammar::fa::op <span class="opt">?0.4.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::fa::op::constructor</b> <i class="arg">cmd</i></a></li>
<li><a href="#2"><b class="cmd">::grammar::fa::op::reverse</b> <i class="arg">fa</i></a></li>
<li><a href="#3"><b class="cmd">::grammar::fa::op::complete</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">sink</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::grammar::fa::op::remove_eps</b> <i class="arg">fa</i></a></li>
<li><a href="#5"><b class="cmd">::grammar::fa::op::trim</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">what</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::grammar::fa::op::determinize</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::grammar::fa::op::minimize</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::grammar::fa::op::complement</b> <i class="arg">fa</i></a></li>
<li><a href="#9"><b class="cmd">::grammar::fa::op::kleene</b> <i class="arg">fa</i></a></li>
<li><a href="#10"><b class="cmd">::grammar::fa::op::optional</b> <i class="arg">fa</i></a></li>
<li><a href="#11"><b class="cmd">::grammar::fa::op::union</b> <i class="arg">fa</i> <i class="arg">fb</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#12"><b class="cmd">::grammar::fa::op::intersect</b> <i class="arg">fa</i> <i class="arg">fb</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::grammar::fa::op::difference</b> <i class="arg">fa</i> <i class="arg">fb</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::grammar::fa::op::concatenate</b> <i class="arg">fa</i> <i class="arg">fb</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></li>
<li><a href="#15"><b class="cmd">::grammar::fa::op::fromRegex</b> <i class="arg">fa</i> <i class="arg">regex</i> <span class="opt">?<i class="arg">over</i>?</span></a></li>
<li><a href="#16"><b class="cmd">::grammar::fa::op::toRegexp</b> <i class="arg">fa</i></a></li>
<li><a href="#17"><b class="cmd">::grammar::fa::op::toRegexp2</b> <i class="arg">fa</i></a></li>
<li><a href="#18"><b class="cmd">::grammar::fa::op::toTclRegexp</b> <i class="arg">regexp</i> <i class="arg">symdict</i></a></li>
<li><a href="#19"><b class="cmd">::grammar::fa::op::simplifyRegexp</b> <i class="arg">regexp</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a number of complex operations on finite
automatons (Short: FA),
as provided by the package <b class="package"><a href="fa.html">grammar::fa</a></b>.
The package does not provide the ability to create and/or manipulate
such FAs, nor the ability to execute a FA for a stream of symbols.
Use the packages <b class="package"><a href="fa.html">grammar::fa</a></b>
and <b class="package">grammar::fa::interpreter</b> for that.
Another package related to this is <b class="package">grammar::fa::compiler</b>
which turns a FA into an executor class which has the definition of
the FA hardwired into it.</p>
<p>For more information about what a finite automaton is see section
<em>FINITE AUTOMATONS</em> in package <b class="package"><a href="fa.html">grammar::fa</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports the API described here.  All commands modify their
first argument. I.e. whatever FA they compute is stored back into
it. Some of the operations will construct an automaton whose states
are all new, but related to the states in the source
automaton(s). These operations take variable names as optional
arguments where they will store mappings which describe the
relationship(s).
The operations can be loosely partitioned into structural and language
operations. The latter are defined in terms of the language the
automaton(s) accept, whereas the former are defined in terms of the
structural properties of the involved automaton(s). Some operations
are both.
<em>Structure operations</em></p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::fa::op::constructor</b> <i class="arg">cmd</i></a></dt>
<dd><p>This command has to be called by the user of the package before any other
operations is performed, to establish a command which can be used to
construct a FA container object. If this is not done several operations
will fail as they are unable to construct internal and transient containers
to hold state and/or partial results.</p>
<p>Any container class using this package for complex operations should set
its own class command as the constructor. See package <b class="package"><a href="fa.html">grammar::fa</a></b>
for an example.</p></dd>
<dt><a name="2"><b class="cmd">::grammar::fa::op::reverse</b> <i class="arg">fa</i></a></dt>
<dd><p>Reverses the <i class="arg">fa</i>. This is done by reversing the direction of all
transitions and swapping the sets of <i class="term">start</i> and <i class="term"><a href="../../../../index.html#key153">final</a></i>
states. The language of <i class="arg">fa</i> changes unpredictably.</p></dd>
<dt><a name="3"><b class="cmd">::grammar::fa::op::complete</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">sink</i>?</span></a></dt>
<dd><p>Completes the <i class="arg">fa</i> <i class="term">complete</i>, but nothing is done if the
<i class="arg">fa</i> is already <i class="term">complete</i>. This implies that only the first
in a series of multiple consecutive complete operations on <i class="arg">fa</i>
will perform anything. The remainder will be null operations.</p>
<p>The language of <i class="arg">fa</i> is unchanged by this operation.</p>
<p>This is done by adding a single new state, the <i class="term">sink</i>, and
transitions from all other states to that sink for all symbols they
have no transitions for. The sink itself is made complete by adding
loop transitions for all symbols.</p>
<p>Note: When a FA has epsilon-transitions transitions over a symbol for
a state S can be indirect, i.e. not attached directly to S, but to a
state in the epsilon-closure of S. The symbols for such indirect
transitions count when computing completeness of a state. In other
words, these indirectly reached symbols are <em>not</em> missing.</p>
<p>The argument <i class="arg">sink</i> provides the name for the new state and most
not be present in the <i class="arg">fa</i> if specified. If the name is not
specified the command will name the state &quot;sink<b class="variable">n</b>&quot;, where <b class="variable">n</b>
is set so that there are no collisions with existing states.</p>
<p>Note that the sink state is <i class="term">not useful</i> by definition.  In
other words, while the FA becomes complete, it is also
<i class="term">not useful</i> in the strict sense as it has a state from which
no final state can be reached.</p></dd>
<dt><a name="4"><b class="cmd">::grammar::fa::op::remove_eps</b> <i class="arg">fa</i></a></dt>
<dd><p>Removes all epsilon-transitions from the <i class="arg">fa</i> in such a manner the
the language of <i class="arg">fa</i> is unchanged. However nothing is done if the
<i class="arg">fa</i> is already <i class="term">epsilon-free</i>.
This implies that only the first in a series of multiple consecutive
complete operations on <i class="arg">fa</i> will perform anything. The remainder
will be null operations.</p>
<p><em>Note:</em> This operation may cause states to become unreachable or
not useful. These states are not removed by this operation.
Use <b class="cmd">::grammar::fa::op::trim</b> for that instead.</p></dd>
<dt><a name="5"><b class="cmd">::grammar::fa::op::trim</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">what</i>?</span></a></dt>
<dd><p>Removes unwanted baggage from <i class="arg">fa</i>.
The legal values for <i class="arg">what</i> are listed below. The command defaults
to <b class="const">!reachable|!useful</b> if no specific argument was given.</p>
<dl class="definitions">
<dt><b class="const">!reachable</b></dt>
<dd><p>Removes all states which are not reachable from a start state.</p></dd>
<dt><b class="const">!useful</b></dt>
<dd><p>Removes all states which are unable to reach a final state.</p></dd>
<dt><b class="const">!reachable&amp;!useful</b></dt>
<dd></dd>
<dt><b class="const">!(reachable|useful)</b></dt>
<dd><p>Removes all states which are not reachable from a start state and are
unable to reach a final state.</p></dd>
<dt><b class="const">!reachable|!useful</b></dt>
<dd></dd>
<dt><b class="const">!(reachable&amp;useful)</b></dt>
<dd><p>Removes all states which are not reachable from a start state or are
unable to reach a final state.</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::grammar::fa::op::determinize</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd><p>Makes the <i class="arg">fa</i> deterministic without changing the language
accepted by the <i class="arg">fa</i>. However nothing is done if the <i class="arg">fa</i> is
already <i class="term">deterministic</i>. This implies that only the first in a
series of multiple consecutive complete operations on <i class="arg">fa</i> will
perform anything. The remainder will be null operations.</p>
<p>The command will store a dictionary describing the relationship
between the new states of the resulting dfa and the states of the
input nfa in <i class="arg">mapvar</i>, if it has been specified. Keys of the
dictionary are the handles for the states of the resulting dfa, values
are sets of states from the input nfa.</p>
<p><em>Note</em>: An empty dictionary signals that the command was able to
make the <i class="arg">fa</i> deterministic without performing a full subset
construction, just by removing states and shuffling transitions around
(As part of making the FA epsilon-free).</p>
<p><em>Note</em>: The algorithm fails to make the FA deterministic in the
technical sense if the FA has no start state(s), because determinism
requires the FA to have exactly one start states.
In that situation we make a best effort; and the missing start state
will be the only condition preventing the generated result from being
<i class="term">deterministic</i>.
It should also be noted that in this case the possibilities for
trimming states from the FA are also severely reduced as we cannot
declare states unreachable.</p></dd>
<dt><a name="7"><b class="cmd">::grammar::fa::op::minimize</b> <i class="arg">fa</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd><p>Creates a FA which accepts the same language as <i class="arg">fa</i>, but has a
minimal number of states. Uses Brzozowski's method to accomplish this.</p>
<p>The command will store a dictionary describing the relationship
between the new states of the resulting minimal fa and the states of
the input fa in <i class="arg">mapvar</i>, if it has been specified. Keys of the
dictionary are the handles for the states of the resulting minimal fa,
values are sets of states from the input fa.</p>
<p><em>Note</em>: An empty dictionary signals that the command was able to
minimize the <i class="arg">fa</i> without having to compute new states. This
should happen if and only if the input FA was already minimal.</p>
<p><em>Note</em>: If the algorithm has no start or final states to work
with then the result might be technically minimal, but have a very
unexpected structure.
It should also be noted that in this case the possibilities for
trimming states from the FA are also severely reduced as we cannot
declare states unreachable.</p></dd>
</dl>
<p><em>Language operations</em>
All operations in this section require that all input FAs have at
least one start and at least one final state. Otherwise the language of
the FAs will not be defined, making the operation senseless (as it
operates on the languages of the FAs in a defined manner).</p>
<dl class="definitions">
<dt><a name="8"><b class="cmd">::grammar::fa::op::complement</b> <i class="arg">fa</i></a></dt>
<dd><p>Complements <i class="arg">fa</i>. This is possible if and only if <i class="arg">fa</i> is
<i class="term">complete</i> and <i class="term">deterministic</i>. The resulting FA accepts the
complementary language of <i class="arg">fa</i>. In other words, all inputs not
accepted by the input are accepted by the result, and vice versa.</p>
<p>The result will have all states and transitions of the input, and
different final states.</p></dd>
<dt><a name="9"><b class="cmd">::grammar::fa::op::kleene</b> <i class="arg">fa</i></a></dt>
<dd><p>Applies Kleene's closure to <i class="arg">fa</i>.
The resulting FA accepts all strings <b class="variable">S</b> for which we can find a
natural number <b class="variable">n</b> (0 inclusive) and strings <b class="variable">A1</b> ... <b class="variable">An</b>
in the language of <i class="arg">fa</i> such that <b class="variable">S</b> is the concatenation of
<b class="variable">A1</b> ... <b class="variable">An</b>.
In other words, the language of the result is the infinite union over
finite length concatenations over the language of <i class="arg">fa</i>.</p>
<p>The result will have all states and transitions of the input, and new
start and final states.</p></dd>
<dt><a name="10"><b class="cmd">::grammar::fa::op::optional</b> <i class="arg">fa</i></a></dt>
<dd><p>Makes the <i class="arg">fa</i> optional. In other words it computes the FA which
accepts the language of <i class="arg">fa</i> and the empty the word (epsilon) as
well.</p>
<p>The result will have all states and transitions of the input, and new
start and final states.</p></dd>
<dt><a name="11"><b class="cmd">::grammar::fa::op::union</b> <i class="arg">fa</i> <i class="arg">fb</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd><p>Combines the FAs <i class="arg">fa</i> and <i class="arg">fb</i> such that the resulting FA
accepts the union of the languages of the two FAs.</p>
<p>The result will have all states and transitions of the two input FAs,
and new start and final states. All states of <i class="arg">fb</i> which exist in
<i class="arg">fa</i> as well will be renamed, and the <i class="arg">mapvar</i> will contain a
mapping from the old states of <i class="arg">fb</i> to the new ones, if present.</p>
<p>It should be noted that the result will be non-deterministic, even if
the inputs are deterministic.</p></dd>
<dt><a name="12"><b class="cmd">::grammar::fa::op::intersect</b> <i class="arg">fa</i> <i class="arg">fb</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd><p>Combines the FAs <i class="arg">fa</i> and <i class="arg">fb</i> such that the resulting FA
accepts the intersection of the languages of the two FAs. In other
words, the result will accept a word if and only if the word is
accepted by both <i class="arg">fa</i> and <i class="arg">fb</i>. The result will be useful, but
not necessarily deterministic or minimal.</p>
<p>The command will store a dictionary describing the relationship
between the new states of the resulting fa and the pairs of states of
the input FAs in <i class="arg">mapvar</i>, if it has been specified. Keys of the
dictionary are the handles for the states of the resulting fa, values
are pairs of states from the input FAs. Pairs are represented by
lists. The first element in each pair will be a state in <i class="arg">fa</i>, the
second element will be drawn from <i class="arg">fb</i>.</p></dd>
<dt><a name="13"><b class="cmd">::grammar::fa::op::difference</b> <i class="arg">fa</i> <i class="arg">fb</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd><p>Combines the FAs <i class="arg">fa</i> and <i class="arg">fb</i> such that the resulting FA
accepts the difference of the languages of the two FAs. In other
words, the result will accept a word if and only if the word is
accepted by <i class="arg">fa</i>, but not by <i class="arg">fb</i>. This can also be expressed
as the intersection of <i class="arg">fa</i> with the complement of <i class="arg">fb</i>. The
result will be useful, but not necessarily deterministic or minimal.</p>
<p>The command will store a dictionary describing the relationship
between the new states of the resulting fa and the pairs of states of
the input FAs in <i class="arg">mapvar</i>, if it has been specified. Keys of the
dictionary are the handles for the states of the resulting fa, values
are pairs of states from the input FAs. Pairs are represented by
lists. The first element in each pair will be a state in <i class="arg">fa</i>, the
second element will be drawn from <i class="arg">fb</i>.</p></dd>
<dt><a name="14"><b class="cmd">::grammar::fa::op::concatenate</b> <i class="arg">fa</i> <i class="arg">fb</i> <span class="opt">?<i class="arg">mapvar</i>?</span></a></dt>
<dd><p>Combines the FAs <i class="arg">fa</i> and <i class="arg">fb</i> such that the resulting FA
accepts the cross-product of the languages of the two FAs. I.e. a word
W will be accepted by the result if there are two words A and B
accepted by <i class="arg">fa</i>, and <i class="arg">fb</i> resp. and W is the concatenation of
A and B.</p>
<p>The result FA will be non-deterministic.</p></dd>
<dt><a name="15"><b class="cmd">::grammar::fa::op::fromRegex</b> <i class="arg">fa</i> <i class="arg">regex</i> <span class="opt">?<i class="arg">over</i>?</span></a></dt>
<dd><p>Generates a non-deterministic FA which accepts the same language as
the regular expression <i class="arg">regex</i>. If the <i class="arg">over</i> is specified it
is treated as the set of symbols the regular expression and the
automaton are defined over. The command will compute the set from the
&quot;S&quot; constructors in <i class="arg">regex</i> when <i class="arg">over</i> was not
specified. This set is important if and only if the complement
operator &quot;!&quot; is used in <i class="arg">regex</i> as the complementary language of
an FA is quite different for different sets of symbols.</p>
<p>The regular expression is represented by a nested list, which forms
a syntax tree. The following structures are legal:</p>
<dl class="definitions">
<dt>{S x}</dt>
<dd><p>Atomic regular expression. Everything else is constructed from
these. Accepts the <b class="const">S</b>ymbol &quot;x&quot;.</p></dd>
<dt>{. A1 A2 ...}</dt>
<dd><p>Concatenation operator. Accepts the concatenation of the regular
expressions <b class="variable">A1</b>, <b class="variable">A2</b>, etc.</p>
<p><em>Note</em> that this operator accepts zero or more arguments. With zero
arguments the represented language is <i class="term">epsilon</i>, the empty word.</p></dd>
<dt>{| A1 A2 ...}</dt>
<dd><p>Choice operator, also called &quot;Alternative&quot;. Accepts all input accepted
by at least one of the regular expressions <b class="variable">A1</b>, <b class="variable">A2</b>, etc. In
other words, the union of <b class="variable">A1</b>, <b class="variable">A2</b>.</p>
<p><em>Note</em> that this operator accepts zero or more arguments. With zero
arguments the represented language is the <i class="term">empty</i> language,
the language without words.</p></dd>
<dt>{&amp; A1 A2 ...}</dt>
<dd><p>Intersection operator, logical and. Accepts all input accepted which
is accepted by all of the regular expressions <b class="variable">A1</b>, <b class="variable">A2</b>,
etc. In other words, the intersection of <b class="variable">A1</b>, <b class="variable">A2</b>.</p></dd>
<dt>{? A}</dt>
<dd><p>Optionality operator. Accepts the empty word and anything from the
regular expression <b class="variable">A</b>.</p></dd>
<dt>{* A}</dt>
<dd><p>Kleene closure. Accepts the empty word and any finite concatenation of
words accepted by the regular expression <b class="variable">A</b>.</p></dd>
<dt>{+ A}</dt>
<dd><p>Positive Kleene closure. Accepts any finite concatenation of words
accepted by the regular expression <b class="variable">A</b>, but not the empty word.</p></dd>
<dt>{! A}</dt>
<dd><p>Complement operator. Accepts any word not accepted by the regular
expression <b class="variable">A</b>. Note that the complement depends on the set of
symbol the result should run over. See the discussion of the argument
<i class="arg">over</i> before.</p></dd>
</dl></dd>
<dt><a name="16"><b class="cmd">::grammar::fa::op::toRegexp</b> <i class="arg">fa</i></a></dt>
<dd><p>This command generates and returns a regular expression which accepts
the same language as the finite automaton <i class="arg">fa</i>. The regular
expression is in the format as described above, for
<b class="cmd">::grammar::fa::op::fromRegex</b>.</p></dd>
<dt><a name="17"><b class="cmd">::grammar::fa::op::toRegexp2</b> <i class="arg">fa</i></a></dt>
<dd><p>This command has the same functionality as <b class="cmd">::grammar::fa::op::toRegexp</b>,
but uses a different algorithm to simplify the generated regular expressions.</p></dd>
<dt><a name="18"><b class="cmd">::grammar::fa::op::toTclRegexp</b> <i class="arg">regexp</i> <i class="arg">symdict</i></a></dt>
<dd><p>This command generates and returns a regular expression in Tcl syntax for the
regular expression <i class="arg">regexp</i>, if that is possible. <i class="arg">regexp</i> is in the
same format as expected by <b class="cmd">::grammar::fa::op::fromRegex</b>.</p>
<p>The command will fail and throw an error if <i class="arg">regexp</i> contains
complementation and intersection operations.</p>
<p>The argument <i class="arg">symdict</i> is a dictionary mapping symbol names to 
pairs of <i class="term">syntactic type</i> and Tcl-regexp. If a symbol 
occurring in the <i class="arg">regexp</i> is not listed in this dictionary then 
single-character symbols are considered to designate themselves 
whereas multiple-character symbols are considered to be a character 
class name.</p></dd>
<dt><a name="19"><b class="cmd">::grammar::fa::op::simplifyRegexp</b> <i class="arg">regexp</i></a></dt>
<dd><p>This command simplifies a regular expression by applying the following
algorithm first to the main expression and then recursively to all
sub-expressions:</p>
<ol class="enumerated">
<li><p>Convert the expression into a finite automaton.</p></li>
<li><p>Minimize the automaton.</p></li>
<li><p>Convert the automaton back to a regular expression.</p></li>
<li><p>Choose the shorter of original expression and expression from
the previous step.</p></li>
</ol></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_fa</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key277">automaton</a>, <a href="../../../../index.html#key282">finite automaton</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key281">regular expression</a>, <a href="../../../../index.html#key279">regular grammar</a>, <a href="../../../../index.html#key278">regular languages</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_me/gasm.html.






























































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::me::cpu::gasm - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_me/gasm.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::me::cpu::gasm.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::me::cpu::gasm(n) 0.1 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::me::cpu::gasm - ME assembler</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">DEFINITIONS</a></li>
<li class="section"><a href="#section3">API</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">grammar::me::cpu::gasm <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::me::cpu::gasm::begin</b> <i class="arg">g</i> <i class="arg">n</i> <span class="opt">?<i class="arg">mode</i>?</span> <span class="opt">?<i class="arg">note</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::grammar::me::cpu::gasm::done</b> <b class="const">--&gt;</b> <i class="arg">t</i></a></li>
<li><a href="#3"><b class="cmd">::grammar::me::cpu::gasm::state</b></a></li>
<li><a href="#4"><b class="cmd">::grammar::me::cpu::gasm::state!</b> <i class="arg">s</i></a></li>
<li><a href="#5"><b class="cmd">::grammar::me::cpu::gasm::lift</b> <i class="arg">t</i> <i class="arg">dst</i> <b class="const">=</b> <i class="arg">src</i></a></li>
<li><a href="#6"><b class="cmd">::grammar::me::cpu::gasm::Inline</b> <i class="arg">t</i> <i class="arg">node</i> <i class="arg">label</i></a></li>
<li><a href="#7"><b class="cmd">::grammar::me::cpu::gasm::Cmd</b> <i class="arg">cmd</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#8"><b class="cmd">::grammar::me::cpu::gasm::Bra</b></a></li>
<li><a href="#9"><b class="cmd">::grammar::me::cpu::gasm::Nop</b> <i class="arg">text</i></a></li>
<li><a href="#10"><b class="cmd">::grammar::me::cpu::gasm::Note</b> <i class="arg">text</i></a></li>
<li><a href="#11"><b class="cmd">::grammar::me::cpu::gasm::Jmp</b> <i class="arg">label</i></a></li>
<li><a href="#12"><b class="cmd">::grammar::me::cpu::gasm::Exit</b></a></li>
<li><a href="#13"><b class="cmd">::grammar::me::cpu::gasm::Who</b> <i class="arg">label</i></a></li>
<li><a href="#14"><b class="cmd">::grammar::me::cpu::gasm::/Label</b> <i class="arg">name</i></a></li>
<li><a href="#15"><b class="cmd">::grammar::me::cpu::gasm::/Clear</b></a></li>
<li><a href="#16"><b class="cmd">::grammar::me::cpu::gasm::/Ok</b></a></li>
<li><a href="#17"><b class="cmd">::grammar::me::cpu::gasm::/Fail</b></a></li>
<li><a href="#18"><b class="cmd">::grammar::me::cpu::gasm::/At</b> <i class="arg">name</i></a></li>
<li><a href="#19"><b class="cmd">::grammar::me::cpu::gasm::/CloseLoop</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a simple in-memory assembler. Its origin is that
of a support package for use by packages converting PEG and other
grammars into a corresponding matcher based on the ME virtual machine,
like <b class="package">page::compiler::peg::mecpu</b>. Despite that it is actually
mostly agnostic regarding the instructions, users can choose any
instruction set they like.</p>
<p>The program under construction is held in a graph structure (See
package <b class="package"><a href="../struct/graph.html">struct::graph</a></b>) during assembly and subsequent
manipulation, with instructions represented by nodes, and the flow of
execution between instructions explicitly encoded in the arcs between
them.</p>
<p>In this model jumps are not encoded explicitly, they are implicit in
the arcs. The generation of explicit jumps is left to any code
converting the graph structure into a more conventional
representation. The same goes for branches. They are implicitly
encoded by all instructions which have two outgoing arcs, whereas all
other instructions have only one outgoing arc. Their conditonality is
handled by tagging their outgoing arcs with information about the
conditions under which they are taken.</p>
<p>While the graph the assembler operates on is supplied from the
outside, i.e. external, it does manage some internal state, namely:</p>
<ol class="enumerated">
<li><p>The handle of the graph node most assembler operations will
work on, the <i class="term">anchor</i>.</p></li>
<li><p>A mapping from arbitrary strings to instructions. I.e. it is
possible to <i class="term">label</i> an instruction during assembly, and later
recall that instruction by its label.</p></li>
<li><p>The condition code to use when creating arcs between
instructions, which is one of <b class="const">always</b>, <b class="const">ok</b>, and
<b class="const">fail</b>.</p></li>
<li><p>The current operation mode, one of <b class="const">halt</b>,
<b class="const">okfail</b>, and <b class="const">!okfail</b>.</p></li>
<li><p>The name of a node in a tree. This, and the operation mode
above are the parts most heavily influenced by the needs of a grammar
compiler, as they assume some basic program structures (selected
through the operation mode), and intertwine the graph with a tree,
like the AST for the grammar to be compiled.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">DEFINITIONS</a></h2>
<p>As the graph the assembler is operating on, and the tree it is
intertwined with, are supplied to the assembler from the outside it is
necessary to specify the API expected from them, and to describe the
structures expected and/or generated by the assembler in either.</p>
<ol class="enumerated">
<li><p>Any graph object command used by the assembler has to provide
the API as specified in the documentation for the package
<b class="package"><a href="../struct/graph.html">struct::graph</a></b>.</p></li>
<li><p>Any tree object command used by the assembler has to provide
the API as specified in the documentation for the package
<b class="package"><a href="../struct/struct_tree.html">struct::tree</a></b>.</p></li>
<li><p>Any instruction (node) generated by the assembler in a graph
will have at least two, and at most three attributes:</p>
<dl class="definitions">
<dt><b class="const">instruction</b></dt>
<dd><p>The value of this attribute is the name of
the instruction. The only names currently defined by the assembler are
the three pseudo-instructions</p>
<dl class="definitions">
<dt><b class="const">NOP</b></dt>
<dd><p>This instruction does nothing. Useful for fixed
framework nodes, unchanging jump destinations, and the like. No
arguments.</p></dd>
<dt><b class="const">C</b></dt>
<dd><p>A .NOP to allow the insertion of arbitrary comments
into the instruction stream, i.e. a comment node. One argument, the
text of the comment.</p></dd>
<dt><b class="const">BRA</b></dt>
<dd><p>A .NOP serving as explicitly coded conditional
branch. No arguments.</p></dd>
</dl>
<p>However we reserve the space of all instructions whose names begin
with a &quot;.&quot; (dot) for future use by the assembler.</p></dd>
<dt><b class="const">arguments</b></dt>
<dd><p>The value of this attribute is a list of
strings, the arguments of the instruction. The contents are dependent
on the actual instruction and the assembler doesn't know or care about
them. This means for example that it has no builtin knowledge about
what instruction need which arguments and thus doesn't perform any
type of checking.</p></dd>
<dt><b class="const">expr</b></dt>
<dd><p>This attribute is optional. When it is present its
value is the name of a node in the tree intertwined with the graph.</p></dd>
</dl>
</li>
<li><p>Any arc between two instructions will have one attribute:</p>
<dl class="definitions">
<dt><b class="const">condition</b></dt>
<dd><p>The value of this attribute determines under which
condition execution will take this arc. It is one of <b class="const">always</b>,
<b class="const">ok</b>, and <b class="const">fail</b>. The first condition is used for all arcs
which are the single outgoing arc of an instruction. The other two are
used for the two outgoing arcs of an instruction which implicitly
encode a branch.</p></dd>
</dl>
</li>
<li><p>A tree node given to the assembler for cross-referencing will
be written to and given the following attributes, some fixed, some
dependent on the operation mode. All values will be references to
nodes in the instruction graph. Some of the instruction will expect
some or specific sets of these attributes.</p>
<dl class="definitions">
<dt><b class="const">gas::entry</b></dt>
<dd><p>Always written.</p></dd>
<dt><b class="const">gas::exit</b></dt>
<dd><p>Written for all modes but <b class="const">okfail</b>.</p></dd>
<dt><b class="const">gas::exit::ok</b></dt>
<dd><p>Written for mode <b class="const">okfail</b>.</p></dd>
<dt><b class="const">gas::exit::fail</b></dt>
<dd><p>Written for mode <b class="const">okfail</b>.</p></dd>
</dl>
</li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::me::cpu::gasm::begin</b> <i class="arg">g</i> <i class="arg">n</i> <span class="opt">?<i class="arg">mode</i>?</span> <span class="opt">?<i class="arg">note</i>?</span></a></dt>
<dd><p>This command starts the assembly of an instruction sequence, and
(re)initializes the state of the assembler. After completion of the
instruction sequence use <b class="cmd">::grammar::me::cpu::gasm::done</b> to
finalize the assembler.</p>
<p>It will operate on the graph <i class="arg">g</i> in the specified <i class="arg">mode</i>
(Default is <b class="const">okfail</b>). As part of the initialization it will
always create a standard .NOP instruction and label it &quot;entry&quot;. The
creation of the remaining standard instructions is
<i class="arg">mode</i>-dependent:</p>
<dl class="definitions">
<dt><b class="const">halt</b></dt>
<dd><p>An &quot;icf_halt&quot; instruction labeled &quot;exit/return&quot;.</p></dd>
<dt><b class="const">!okfail</b></dt>
<dd><p>An &quot;icf_ntreturn&quot; instruction labeled &quot;exit/return&quot;.</p></dd>
<dt><b class="const">okfail</b></dt>
<dd><p>Two .NOP instructions labeled &quot;exit/ok&quot; and
&quot;exit/fail&quot; respectively.</p></dd>
</dl>
<p>The <i class="arg">note</i>, if specified (default is not), is given to the &quot;entry&quot; .NOP instruction.</p>
<p>The node reference <i class="arg">n</i> is simply stored for use by
<b class="cmd">::grammar::me::cpu::gasm::done</b>. It has to refer to a node in the
tree <i class="arg">t</i> argument of that command.</p>
<p>After the initialization is done the &quot;entry&quot; instruction will be the
<i class="term">anchor</i>, and the condition code will be set to <b class="const">always</b>.</p>
<p>The command returns the empy string as its result.</p></dd>
<dt><a name="2"><b class="cmd">::grammar::me::cpu::gasm::done</b> <b class="const">--&gt;</b> <i class="arg">t</i></a></dt>
<dd><p>This command finalizes the creation of an instruction sequence and
then clears the state of the assembler.
<em>NOTE</em> that this <em>does not</em> delete any of the created
instructions. They can be made available to future begin/done cycles.
Further assembly will be possible only after reinitialization of the
system via <b class="cmd">::grammar::me::cpu::gasm::begin</b>.</p>
<p>Before the state is cleared selected references to selected
instructions will be written to attributes of the node <i class="arg">n</i> in the
tree <i class="arg">t</i>.
Which instructions are saved is <i class="arg">mode</i>-dependent. Both <i class="arg">mode</i>
and the destination node <i class="arg">n</i> were specified during invokation of
<b class="cmd">::grammar::me::cpu::gasm::begin</b>.</p>
<p>Independent of the mode a reference to the instruction labeled &quot;entry&quot;
will be saved to the attribute <b class="const">gas::entry</b> of <i class="arg">n</i>. The
reference to the node <i class="arg">n</i> will further be saved into the attribute
&quot;expr&quot; of the &quot;entry&quot; instruction. Beyond that</p>
<dl class="definitions">
<dt><b class="const">halt</b></dt>
<dd><p>A reference to the instruction labeled
&quot;exit/return&quot; will be saved to the attribute <b class="const">gas::exit</b> of
<i class="arg">n</i>.</p></dd>
<dt><b class="const">okfail</b></dt>
<dd><p>See <b class="const">halt</b>.</p></dd>
<dt><b class="const">!okfail</b></dt>
<dd><p>Reference to the two instructions labeled
&quot;exit/ok&quot; and &quot;exit/fail&quot; will be saved to the attributes
<b class="const">gas::exit::ok</b> and <b class="const">gas::exit::fail</b> of <i class="arg">n</i>
respectively.</p></dd>
</dl>
<p>The command returns the empy string as its result.</p></dd>
<dt><a name="3"><b class="cmd">::grammar::me::cpu::gasm::state</b></a></dt>
<dd><p>This command returns the current state of the assembler. Its format is
not documented and considered to be internal to the package.</p></dd>
<dt><a name="4"><b class="cmd">::grammar::me::cpu::gasm::state!</b> <i class="arg">s</i></a></dt>
<dd><p>This command takes a serialized assembler state <i class="arg">s</i> as returned by
<b class="cmd">::grammar::me::cpu::gasm::state</b> and makes it the current state
of the assembler.</p>
<p><em>Note</em> that this may overwrite label definitions, however all
non-conflicting label definitions in the state before are not touched
and merged with <i class="arg">s</i>.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="5"><b class="cmd">::grammar::me::cpu::gasm::lift</b> <i class="arg">t</i> <i class="arg">dst</i> <b class="const">=</b> <i class="arg">src</i></a></dt>
<dd><p>This command operates on the tree <i class="arg">t</i>. It copies the contents of
the attributes <b class="const">gas::entry</b>, <b class="const">gas::exit::ok</b> and
<b class="const">gas::exit::fail</b> from the node <i class="arg">src</i> to the node <i class="arg">dst</i>.
It returns the empty string as its result.</p></dd>
<dt><a name="6"><b class="cmd">::grammar::me::cpu::gasm::Inline</b> <i class="arg">t</i> <i class="arg">node</i> <i class="arg">label</i></a></dt>
<dd><p>This command links an instruction sequence created by an earlier
begin/done pair into the current instruction sequence.</p>
<p>To this end it</p>
<ol class="enumerated">
<li><p>reads the instruction references from the attributes
<b class="const">gas::entry</b>, <b class="const">gas::exit::ok</b>, and <b class="const">gas::exit::fail</b>
from the node <i class="arg">n</i> of the tree <i class="arg">t</i> and makes them available to
assembler und the labels <i class="arg">label</i>/entry, <i class="arg">label</i>/exit::ok, and
<i class="arg">label</i>/exit::fail respectively.</p></li>
<li><p>Creates an arc from the <i class="term">anchor</i> to the node labeled
<i class="arg">label</i>/entry, and tags it with the current condition code.</p></li>
<li><p>Makes the node labeled <i class="arg">label</i>/exit/ok the new <i class="term">anchor</i>.</p></li>
</ol>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="7"><b class="cmd">::grammar::me::cpu::gasm::Cmd</b> <i class="arg">cmd</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This is the basic command to add instructions to the graph.
It creates a new instruction of type <i class="arg">cmd</i> with the given
arguments <i class="arg">arg</i>...
If the <i class="term">anchor</i> was defined it will also create an arc from the
<i class="term">anchor</i> to the new instruction using the current condition code.
After the call the new instruction will be the <i class="term">anchor</i> and the
current condition code will be set to <b class="const">always</b>.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="8"><b class="cmd">::grammar::me::cpu::gasm::Bra</b></a></dt>
<dd><p>This is a convenience command to create a .BRA pseudo-instruction. It
uses <b class="cmd">::grammar::me::cpu::gasm::Cmd</b> to actually create the
instruction and inherits its behaviour.</p></dd>
<dt><a name="9"><b class="cmd">::grammar::me::cpu::gasm::Nop</b> <i class="arg">text</i></a></dt>
<dd><p>This is a convenience command to create a .NOP pseudo-instruction. It
uses <b class="cmd">::grammar::me::cpu::gasm::Cmd</b> to actually create the
instruction and inherits its behaviour.
The <i class="arg">text</i> will be saved as the first and only argument of the new
instruction.</p></dd>
<dt><a name="10"><b class="cmd">::grammar::me::cpu::gasm::Note</b> <i class="arg">text</i></a></dt>
<dd><p>This is a convenience command to create a .C pseudo-instruction,
i.e. a comment. It uses <b class="cmd">::grammar::me::cpu::gasm::Cmd</b> to
actually create the instruction and inherits its behaviour.
The <i class="arg">text</i> will be saved as the first and only argument of the new
instruction.</p></dd>
<dt><a name="11"><b class="cmd">::grammar::me::cpu::gasm::Jmp</b> <i class="arg">label</i></a></dt>
<dd><p>This command creates an arc from the <i class="term">anchor</i> to the instruction
labeled with <i class="arg">label</i>, and tags with the the current condition
code.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="12"><b class="cmd">::grammar::me::cpu::gasm::Exit</b></a></dt>
<dd><p>This command creates an arc from the <i class="term">anchor</i> to one of the exit
instructions, based on the operation mode (see
<b class="cmd">::grammar::me::cpu::gasm::begin</b>), and tags it with current
condition code.</p>
<p>For mode <b class="const">okfail</b> it links to the instruction labeled either
&quot;exit/ok&quot; or &quot;exit/fail&quot;, depending on the current condition code, and
tagging it with the current condition code
For the other two modes it links to the instruction labeled
&quot;exit/return&quot;, tagging it condition code <b class="const">always</b>, independent
the current condition code.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="13"><b class="cmd">::grammar::me::cpu::gasm::Who</b> <i class="arg">label</i></a></dt>
<dd><p>This command returns a reference to the instruction labeled with
<i class="arg">label</i>.</p></dd>
<dt><a name="14"><b class="cmd">::grammar::me::cpu::gasm::/Label</b> <i class="arg">name</i></a></dt>
<dd><p>This command labels the <i class="term">anchor</i> with <i class="arg">name</i>.
<em>Note</em> that an instruction can have more than one label.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="15"><b class="cmd">::grammar::me::cpu::gasm::/Clear</b></a></dt>
<dd><p>This command clears the <i class="term">anchor</i>, leaving it undefined, and
further resets the current condition code to <b class="const">always</b>.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="16"><b class="cmd">::grammar::me::cpu::gasm::/Ok</b></a></dt>
<dd><p>This command sets the current condition code to <b class="const">ok</b>.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="17"><b class="cmd">::grammar::me::cpu::gasm::/Fail</b></a></dt>
<dd><p>This command sets the current condition code to <b class="const">fail</b>.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="18"><b class="cmd">::grammar::me::cpu::gasm::/At</b> <i class="arg">name</i></a></dt>
<dd><p>This command sets the <i class="term">anchor</i> to the instruction labeled with
<i class="arg">name</i>, and further resets the current condition code to
<b class="const">always</b>.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="19"><b class="cmd">::grammar::me::cpu::gasm::/CloseLoop</b></a></dt>
<dd><p>This command marks the <i class="term">anchor</i> as the last instruction in a loop
body, by creating the attribute <b class="const">LOOP</b>.</p>
<p>The command returns the empty string as its result.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key270">assembler</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key256">graph</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key254">tree</a>, <a href="../../../../index.html#key25">virtual machine</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_me/me_ast.html.



























































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::me_ast - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_me/me_ast.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::me_ast.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::me_ast(n) 0.1 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::me_ast - Various representations of ASTs</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">AST VALUES</a></li>
<li class="section"><a href="#section3">AST OBJECTS</a></li>
<li class="section"><a href="#section4">EXTENDED AST OBJECTS</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document specifies various representations for the
<i class="term"><a href="../../../../index.html#key686">abstract syntax tree</a></i>s (short <i class="term"><a href="../../../../index.html#key752">AST</a></i>) generated by
instances of ME virtual machines, independent of variant.
Please go and read the document <b class="syscmd"><a href="me_intro.html">grammar::me_intro</a></b> first if
you do not know what a ME virtual machine is.</p>
<p>ASTs and all the representations we specify distinguish between two
types of nodes, namely:</p>
<dl class="definitions">
<dt>Terminal</dt>
<dd><p>Terminal nodes refer to the terminal symbols found in the token
stream. They are always leaf nodes. I.e. terminal nodes never have
children.</p></dd>
<dt>Nonterminal</dt>
<dd><p>Nonterminal nodes represent a nonterminal symbol of the grammar used
during parsing. They can occur as leaf and inner nodes of the
tree.</p></dd>
</dl>
<p>Both types of nodes carry basic range information telling a user which
parts of the input are covered by the node by providing the location
of the first and last tokens found within the range. Locations are
provided as non-negative integer offsets from the beginning of the
token stream, with the first token found in the stream located at
offset 0 (zero).</p>
<p>The root of an AS tree can be either a terminal or nonterminal node.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">AST VALUES</a></h2>
<p>This representation of ASTs is a Tcl list. The main list represents
the root node of the tree, with the representations of the children
nested within.</p>
<p>Each node is represented by a single Tcl list containing three or more
elements. The first element is either the empty string or the name of
a nonterminal symbol (which is never the empty string). The second and
third elements are then the locations of the first and last tokens.
Any additional elements after the third are then the representations
of the children, with the leftmost child first, i.e. as the fourth
element of the list representing the node.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">AST OBJECTS</a></h2>
<p>In this representation an AST is represented by a Tcl object command
whose API is compatible to the tree objects provided by the package
<b class="package"><a href="../struct/struct_tree.html">struct::tree</a></b>. I.e it has to support at least all of the
methods described by that package, and may support more.</p>
<p>Because of this the remainder of the specifications is written using
the terms of <b class="package"><a href="../struct/struct_tree.html">struct::tree</a></b>.</p>
<p>Each node of the AST directly maps to a node in the tree object. All
data beyond the child nodes, i.e. node type and input locations, are
stored in attributes of the node in the tree object. They are:</p>
<dl class="definitions">
<dt>type</dt>
<dd><p>The type of the AST node. The recognized values are <b class="const">terminal</b>
and <b class="const">nonterminal</b>.</p></dd>
<dt>range</dt>
<dd><p>The locations of the first and last token of the terminal data in the
input covered by the node. This is a list containing two locations.</p></dd>
<dt>detail</dt>
<dd><p>This attribute is present only for nonterminal nodes. It contains the
name of the nonterminal symbol stored in the node.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXTENDED AST OBJECTS</a></h2>
<p>Extended AST objects are like AST objects, with additional
information.</p>
<dl class="definitions">
<dt>detail</dt>
<dd><p>This attribute is now present at all nodes. Its contents are unchanged
for nonterminal nodes. For terminal nodes it contains a list
describing all tokens from the input which are covered by the node.</p>
<p>Each element of the list contains the token name, the associated
lexeme attribute, line number, and column index, in this order.</p></dd>
<dt>range_lc</dt>
<dd><p>This new attribute is defined for all nodes, and contains the
locations from attribute <i class="term">range</i> translated into line number and
column index. Lines are counted from 1, columns are counted from 0.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key752">AST</a>, <a href="../../../../index.html#key686">abstract syntax tree</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_me/me_cpu.html.






































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::me::cpu - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_me/me_cpu.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005-2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::me::cpu.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::me::cpu(n) 0.2 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::me::cpu - Virtual machine implementation II for parsing token streams</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">CLASS API</a></li>
<li class="subsection"><a href="#subsection2">OBJECT API</a></li>
</ul>
</li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">grammar::me::cpu <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::me::cpu</b> <i class="arg">meName</i> <i class="arg">matchcode</i></a></li>
<li><a href="#2"><b class="cmd">meName</b> <b class="method">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">meName</i> <b class="method">lc</b> <i class="arg">location</i></a></li>
<li><a href="#4"><i class="arg">meName</i> <b class="method">tok</b> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#5"><i class="arg">meName</i> <b class="method">pc</b> <i class="arg">state</i></a></li>
<li><a href="#6"><i class="arg">meName</i> <b class="method">iseof</b> <i class="arg">state</i></a></li>
<li><a href="#7"><i class="arg">meName</i> <b class="method">at</b> <i class="arg">state</i></a></li>
<li><a href="#8"><i class="arg">meName</i> <b class="method">cc</b> <i class="arg">state</i></a></li>
<li><a href="#9"><i class="arg">meName</i> <b class="method">sv</b></a></li>
<li><a href="#10"><i class="arg">meName</i> <b class="method">ok</b></a></li>
<li><a href="#11"><i class="arg">meName</i> <b class="method">error</b></a></li>
<li><a href="#12"><i class="arg">meName</i> <b class="method">lstk</b> <i class="arg">state</i></a></li>
<li><a href="#13"><i class="arg">meName</i> <b class="method">astk</b> <i class="arg">state</i></a></li>
<li><a href="#14"><i class="arg">meName</i> <b class="method">mstk</b> <i class="arg">state</i></a></li>
<li><a href="#15"><i class="arg">meName</i> <b class="method">estk</b> <i class="arg">state</i></a></li>
<li><a href="#16"><i class="arg">meName</i> <b class="method">rstk</b> <i class="arg">state</i></a></li>
<li><a href="#17"><i class="arg">meName</i> <b class="method">nc</b> <i class="arg">state</i></a></li>
<li><a href="#18"><i class="arg">meName</i> <b class="method">ast</b></a></li>
<li><a href="#19"><i class="arg">meName</i> <b class="method">halted</b></a></li>
<li><a href="#20"><i class="arg">meName</i> <b class="method">code</b></a></li>
<li><a href="#21"><i class="arg">meName</i> <b class="method">eof</b></a></li>
<li><a href="#22"><i class="arg">meName</i> <b class="method">put</b> <i class="arg">tok</i> <i class="arg">lex</i> <i class="arg">line</i> <i class="arg">col</i></a></li>
<li><a href="#23"><i class="arg">meName</i> <b class="method">putstring</b> <i class="arg">string</i> <i class="arg">lvar</i> <i class="arg">cvar</i></a></li>
<li><a href="#24"><i class="arg">meName</i> <b class="method">run</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#25"><i class="arg">meName</i> <b class="method">pull</b> <i class="arg">nextcmd</i></a></li>
<li><a href="#26"><i class="arg">meName</i> <b class="method">reset</b></a></li>
<li><a href="#27"><i class="arg">meName</i> <b class="method">destroy</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides an implementation of the ME virtual machine.
Please go and read the document <b class="syscmd"><a href="me_intro.html">grammar::me_intro</a></b> first if
you do not know what a ME virtual machine is.</p>
<p>This implementation provides an object-based API and the machines are
not truly tied to Tcl. A C implementation of the same API is quite
possible.</p>
<p>Internally the package actually uses the value-based machine
manipulation commands as provided by the package
<b class="package"><a href="me_cpucore.html">grammar::me::cpu::core</a></b> to perform its duties.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">CLASS API</a></h3>
<p>The package directly provides only a single command for the
construction of ME virtual machines.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::me::cpu</b> <i class="arg">meName</i> <i class="arg">matchcode</i></a></dt>
<dd><p>The command creates a new ME machine object with an associated global
Tcl command whose name is <i class="arg">meName</i>. This command may be used to
invoke various operations on the machine.
It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">meName</b> <b class="method">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>The argument <i class="arg">matchcode</i> contains the match instructions the
machine has to execute while parsing the input stream. Please read
section <b class="sectref">MATCH CODE REPRESENTATION</b> of the
documentation for the package <b class="package"><a href="me_cpucore.html">grammar::me::cpu::core</a></b> for
the specification of the structure of this value.</p>
<p>The <i class="arg">tokmap</i> argument taken by the implementation provided by the
package <b class="package"><a href="me_tcl.html">grammar::me::tcl</a></b> is here hidden inside of the match
instructions and therefore not needed.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">OBJECT API</a></h3>
<p>All ME virtual machine objects created by the class command specified
in section <span class="sectref"><a href="#subsection1">CLASS API</a></span> support the methods listed below.</p>
<p>The machines provided by this package provide methods for operation in
both push- and pull-styles. Push-style means that tokens are pushed
into the machine state when they arrive, triggering further execution
until they are consumed. In other words, this allows the machine to be
suspended and resumed at will and an arbitrary number of times, the
quasi-parallel operation of several machines, and the operation as
part of the event loop.</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">meName</i> <b class="method">lc</b> <i class="arg">location</i></a></dt>
<dd><p>This method converts the location of a token given as offset in the
input stream into the associated line number and column index. The
result of the command is a 2-element list containing the two values,
in the order mentioned in the previous sentence.
This allows higher levels to convert the location information found in
the error status and the generated AST into more human readable data.</p>
<p><em>Note</em> that the command is not able to convert locations which
have not been reached by the machine yet. In other words, if the
machine has read 7 tokens the command is able to convert the offsets
<b class="const">0</b> to <b class="const">6</b>, but nothing beyond that. This also shows that
it is not possible to convert offsets which refer to locations before
the beginning of the stream.</p></dd>
<dt><a name="4"><i class="arg">meName</i> <b class="method">tok</b> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>This method returns a Tcl list containing the part of the input stream
between the locations <i class="arg">from</i> and <i class="arg">to</i> (both inclusive). If
<i class="arg">to</i> is not specified it will default to the value of <i class="arg">from</i>.
If <i class="arg">from</i> is not specified either the whole input stream is returned.</p>
<p>Each element of the returned list is a list of four elements, the
token, its associated lexeme, line number, and column index, in this
order.
This command places the same restrictions on its location arguments as
the method <b class="method">lc</b>.</p></dd>
<dt><a name="5"><i class="arg">meName</i> <b class="method">pc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current value of the stored program counter.</p></dd>
<dt><a name="6"><i class="arg">meName</i> <b class="method">iseof</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current value of the stored eof flag.</p></dd>
<dt><a name="7"><i class="arg">meName</i> <b class="method">at</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current location in the input stream.</p></dd>
<dt><a name="8"><i class="arg">meName</i> <b class="method">cc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current token.</p></dd>
<dt><a name="9"><i class="arg">meName</i> <b class="method">sv</b></a></dt>
<dd><p>This command returns the current semantic value <i class="term">SV</i> stored in
the machine. This is an abstract syntax tree as specified in the
document <b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section <b class="sectref">AST VALUES</b>.</p></dd>
<dt><a name="10"><i class="arg">meName</i> <b class="method">ok</b></a></dt>
<dd><p>This method returns the current match status <i class="term">OK</i>.</p></dd>
<dt><a name="11"><i class="arg">meName</i> <b class="method">error</b></a></dt>
<dd><p>This method returns the current error status <i class="term">ER</i>.</p></dd>
<dt><a name="12"><i class="arg">meName</i> <b class="method">lstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the location stack.</p></dd>
<dt><a name="13"><i class="arg">meName</i> <b class="method">astk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the AST stack.</p></dd>
<dt><a name="14"><i class="arg">meName</i> <b class="method">mstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the AST marker stack.</p></dd>
<dt><a name="15"><i class="arg">meName</i> <b class="method">estk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the error stack.</p></dd>
<dt><a name="16"><i class="arg">meName</i> <b class="method">rstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the subroutine return stack.</p></dd>
<dt><a name="17"><i class="arg">meName</i> <b class="method">nc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the nonterminal match cache as a dictionary.</p></dd>
<dt><a name="18"><i class="arg">meName</i> <b class="method">ast</b></a></dt>
<dd><p>This method returns the current top entry of the AST stack <i class="term">AS</i>.
This is an abstract syntax tree as specified in the document
<b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section <b class="sectref">AST VALUES</b>.</p></dd>
<dt><a name="19"><i class="arg">meName</i> <b class="method">halted</b></a></dt>
<dd><p>This method returns a boolean value telling the caller whether the
engine has halted execution or not. Halt means that no further
matching is possible, and the information retrieved via the other
method is final. Attempts to <b class="method">run</b> the engine will be ignored,
until a <b class="method">reset</b> is made.</p></dd>
<dt><a name="20"><i class="arg">meName</i> <b class="method">code</b></a></dt>
<dd><p>This method returns the <i class="arg">code</i> information used to construct the
object. In other words, the match program executed by the machine.</p></dd>
<dt><a name="21"><i class="arg">meName</i> <b class="method">eof</b></a></dt>
<dd><p>This method adds an end of file marker to the end of the input stream.
This signals the machine that the current contents of the input queue
are the final parts of the input and nothing will come after. Attempts
to put more characters into the queue will fail.</p></dd>
<dt><a name="22"><i class="arg">meName</i> <b class="method">put</b> <i class="arg">tok</i> <i class="arg">lex</i> <i class="arg">line</i> <i class="arg">col</i></a></dt>
<dd><p>This method adds the token <i class="arg">tok</i> to the end of the input stream,
with associated lexeme data <i class="arg">lex</i> and <i class="arg">line</i>/<i class="arg">col</i>umn
information.</p></dd>
<dt><a name="23"><i class="arg">meName</i> <b class="method">putstring</b> <i class="arg">string</i> <i class="arg">lvar</i> <i class="arg">cvar</i></a></dt>
<dd><p>This method adds each individual character in the <i class="arg">string</i> as a
token to the end of the input stream, from first to last. The lexemes
will be empty and the line/col information is computed based on the
characters encountered and the data in the variables <i class="arg">lvar</i> and
<i class="arg">cvar</i>.</p></dd>
<dt><a name="24"><i class="arg">meName</i> <b class="method">run</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>This methods causes the engine to execute match instructions until
either</p>
<ul class="itemized">
<li><p><i class="arg">n</i> instructions have been executed, or</p></li>
<li><p>a halt instruction was executed, or</p></li>
<li><p>the input queue is empty and the code is asking for more tokens to
process.</p></li>
</ul>
<p>If no limit <i class="arg">n</i> was set only the last two conditions are checked
for.</p></dd>
<dt><a name="25"><i class="arg">meName</i> <b class="method">pull</b> <i class="arg">nextcmd</i></a></dt>
<dd><p>This method implements pull-style operation of the machine. It causes
it to execute match instructions until either a halt instruction is
reached, or the command prefix
<i class="arg">nextcmd</i> ceases to deliver more tokens.</p>
<p>The command prefix <i class="arg">nextcmd</i> represents the input stream of
characters and is invoked by the machine whenever the a new character
from the stream is required. The instruction for handling this is
<i class="term">ict_advance</i>.
The callback has to return either the empty list, or a list of 4
elements containing the token, its lexeme attribute, and its location
as line number and column index, in this order.
The empty list is the signal that the end of the input stream has been
reached. The lexeme attribute is stored in the terminal cache, but
otherwise not used by the machine.</p>
<p>The end of the input stream for this method does not imply that method
<b class="method">eof</b> is called for the machine as a whole. By avoiding this
and still asking for an explicit call of the method it is possible to
mix push- and pull-style operation during the lifetime of the machine.</p></dd>
<dt><a name="26"><i class="arg">meName</i> <b class="method">reset</b></a></dt>
<dd><p>This method resets the machine to its initial state, discarding any
state it may have.</p></dd>
<dt><a name="27"><i class="arg">meName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method deletes the object and releases all resurces it claimed.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key25">virtual machine</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005-2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_me/me_cpucore.html.







































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::me::cpu::core - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_me/me_cpucore.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005-2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::me::cpu::core.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::me::cpu::core(n) 0.2 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::me::cpu::core - ME virtual machine state manipulation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></li>
</ul>
</li>
<li class="section"><a href="#section3">CPU STATE</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">grammar::me::cpu::core <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">disasm</b> <i class="arg">asm</i></a></li>
<li><a href="#2"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">asm</b> <i class="arg">asm</i></a></li>
<li><a href="#3"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">new</b> <i class="arg">asm</i></a></li>
<li><a href="#4"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">lc</b> <i class="arg">state</i> <i class="arg">location</i></a></li>
<li><a href="#5"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">tok</b> <i class="arg">state</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#6"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">pc</b> <i class="arg">state</i></a></li>
<li><a href="#7"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">iseof</b> <i class="arg">state</i></a></li>
<li><a href="#8"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">at</b> <i class="arg">state</i></a></li>
<li><a href="#9"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">cc</b> <i class="arg">state</i></a></li>
<li><a href="#10"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">sv</b> <i class="arg">state</i></a></li>
<li><a href="#11"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">ok</b> <i class="arg">state</i></a></li>
<li><a href="#12"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">error</b> <i class="arg">state</i></a></li>
<li><a href="#13"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">lstk</b> <i class="arg">state</i></a></li>
<li><a href="#14"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">astk</b> <i class="arg">state</i></a></li>
<li><a href="#15"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">mstk</b> <i class="arg">state</i></a></li>
<li><a href="#16"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">estk</b> <i class="arg">state</i></a></li>
<li><a href="#17"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">rstk</b> <i class="arg">state</i></a></li>
<li><a href="#18"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">nc</b> <i class="arg">state</i></a></li>
<li><a href="#19"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">ast</b> <i class="arg">state</i></a></li>
<li><a href="#20"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">halted</b> <i class="arg">state</i></a></li>
<li><a href="#21"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">code</b> <i class="arg">state</i></a></li>
<li><a href="#22"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">eof</b> <i class="arg">statevar</i></a></li>
<li><a href="#23"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">put</b> <i class="arg">statevar</i> <i class="arg">tok</i> <i class="arg">lex</i> <i class="arg">line</i> <i class="arg">col</i></a></li>
<li><a href="#24"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">run</b> <i class="arg">statevar</i> <span class="opt">?<i class="arg">n</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides an implementation of the ME virtual machine.
Please go and read the document <b class="syscmd"><a href="me_intro.html">grammar::me_intro</a></b> first if
you do not know what a ME virtual machine is.</p>
<p>This implementation represents each ME virtual machine as a Tcl value
and provides commands to manipulate and query such values to show the
effects of executing instructions, adding tokens, retrieving state,
etc.</p>
<p>The values fully follow the paradigm of Tcl that every value is a
string and while also allowing C implementations for a proper
Tcl_ObjType to keep all the important data in native data structures.
Because of the latter it is recommended to access the state values
<em>only</em> through the commands of this package to ensure that
internal representation is not shimmered away.</p>
<p>The actual structure used by all state values is described in section
<span class="sectref"><a href="#section3">CPU STATE</a></span>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package directly provides only a single command, and all the
functionality is made available through its methods.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">disasm</b> <i class="arg">asm</i></a></dt>
<dd><p>This method returns a list containing a disassembly of the match
instructions in <i class="arg">asm</i>. The format of <i class="arg">asm</i> is specified in the
section <span class="sectref"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></span>.</p>
<p>Each element of the result contains instruction label, instruction
name, and the instruction arguments, in this order. The label can be
the empty string. Jump destinations are shown as labels, strings and
tokens unencoded. Token names are prefixed with their numeric id, if,
and only if a tokmap is defined. The two components are separated by a
colon.</p></dd>
<dt><a name="2"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">asm</b> <i class="arg">asm</i></a></dt>
<dd><p>This method returns code in the format as specified in section
<span class="sectref"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></span> generated from ME assembly
code <i class="arg">asm</i>, which is in the format as returned by the method
<b class="method">disasm</b>.</p></dd>
<dt><a name="3"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">new</b> <i class="arg">asm</i></a></dt>
<dd><p>This method creates state value for a ME virtual machine in its
initial state and returns it as its result.</p>
<p>The argument <i class="arg">matchcode</i> contains a Tcl representation of the
match instructions the machine has to execute while parsing the input
stream. Its format is specified in the section
<span class="sectref"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></span>.</p>
<p>The <i class="arg">tokmap</i> argument taken by the implementation provided by the
package <b class="package"><a href="me_tcl.html">grammar::me::tcl</a></b> is here hidden inside of the match
instructions and therefore not needed.</p></dd>
<dt><a name="4"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">lc</b> <i class="arg">state</i> <i class="arg">location</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and uses it
to convert a location in the input stream (as offset) into a line
number and column index. The result of the method is a 2-element list
containing the two pieces in the order mentioned in the previous
sentence.</p>
<p><em>Note</em> that the method cannot convert locations which the machine
has not yet read from the input stream. In other words, if the machine
has read 7 characters so far it is possible to convert the offsets
<b class="const">0</b> to <b class="const">6</b>, but nothing beyond that. This also shows that
it is not possible to convert offsets which refer to locations before
the beginning of the stream.</p>
<p>This utility allows higher levels to convert the location offsets
found in the error status and the AST into more human readable data.</p></dd>
<dt><a name="5"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">tok</b> <i class="arg">state</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
a Tcl list containing the part of the input stream between the
locations <i class="arg">from</i> and <i class="arg">to</i> (both inclusive). If <i class="arg">to</i> is not
specified it will default to the value of <i class="arg">from</i>. If <i class="arg">from</i> is
not specified either the whole input stream is returned.</p>
<p>This method places the same restrictions on its location arguments as
the method <b class="method">lc</b>.</p></dd>
<dt><a name="6"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">pc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current value of the stored program counter.</p></dd>
<dt><a name="7"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">iseof</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current value of the stored eof flag.</p></dd>
<dt><a name="8"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">at</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current location in the input stream.</p></dd>
<dt><a name="9"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">cc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current token.</p></dd>
<dt><a name="10"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">sv</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current semantic value stored in it.
This is an abstract syntax tree as specified in the document
<b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section <b class="sectref">AST VALUES</b>.</p></dd>
<dt><a name="11"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">ok</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the match status stored in it.</p></dd>
<dt><a name="12"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">error</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current error status stored in it.</p></dd>
<dt><a name="13"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">lstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the location stack.</p></dd>
<dt><a name="14"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">astk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the AST stack.</p></dd>
<dt><a name="15"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">mstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the AST marker stack.</p></dd>
<dt><a name="16"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">estk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the error stack.</p></dd>
<dt><a name="17"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">rstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the subroutine return stack.</p></dd>
<dt><a name="18"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">nc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the nonterminal match cache as a dictionary.</p></dd>
<dt><a name="19"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">ast</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the abstract syntax tree currently at the top of the AST stack stored
in it.
This is an abstract syntax tree as specified in the document
<b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section <b class="sectref">AST VALUES</b>.</p></dd>
<dt><a name="20"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">halted</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current halt status stored in it, i.e. if the machine has stopped
or not.</p></dd>
<dt><a name="21"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">code</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the code stored in it, i.e. the instructions executed by the machine.</p></dd>
<dt><a name="22"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">eof</b> <i class="arg">statevar</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine as stored in
the variable named by <i class="arg">statevar</i> and modifies it so that the eof
flag inside is set. This signals to the machine that whatever token
are in the input queue are the last to be processed. There will be no
more.</p></dd>
<dt><a name="23"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">put</b> <i class="arg">statevar</i> <i class="arg">tok</i> <i class="arg">lex</i> <i class="arg">line</i> <i class="arg">col</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine as stored in
the variable named by <i class="arg">statevar</i> and modifies it so that the token
<i class="arg">tok</i> is added to the end of the input queue, with associated
lexeme data <i class="arg">lex</i> and <i class="arg">line</i>/<i class="arg">col</i>umn information.</p>
<p>The operation will fail with an error if the eof flag of the machine
has been set through the method <b class="method">eof</b>.</p></dd>
<dt><a name="24"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">run</b> <i class="arg">statevar</i> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>This method takes the state value of a ME virtual machine as stored in
the variable named by <i class="arg">statevar</i>, executes a number of
instructions and stores the state resulting from their modifications
back into the variable.</p>
<p>The execution loop will run until either</p>
<ul class="itemized">
<li><p><i class="arg">n</i> instructions have been executed, or</p></li>
<li><p>a halt instruction was executed, or</p></li>
<li><p>the input queue is empty and the code is asking for more tokens to
process.</p></li>
</ul>
<p>If no limit <i class="arg">n</i> was set only the last two conditions are checked
for.</p></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">MATCH PROGRAM REPRESENTATION</a></h3>
<p>A match program is represented by nested Tcl list. The first element,
<i class="term">asm</i>, is a list of integer numbers, the instructions to execute,
and their arguments. The second element, <i class="term"><a href="../../../../index.html#key255">pool</a></i>, is a list of
strings, referenced by the instructions, for error messages, token
names, etc. The third element, <i class="term">tokmap</i>, provides ordering
information for the tokens, mapping their names to their numerical
rank. This element can be empty, forcing lexicographic comparison when
matching ranges.</p>
<p>All ME instructions are encoded as integer numbers, with the mapping
given below. A number of the instructions, those which handle error
messages, have been given an additional argument to supply that
message explicitly instead of having it constructed from token names,
etc. This allows the machine state to store only the message ids
instead of the full strings.</p>
<p>Jump destination arguments are absolute indices into the <i class="term">asm</i>
element, refering to the instruction to jump to. Any string arguments
are absolute indices into the <i class="term"><a href="../../../../index.html#key255">pool</a></i> element. Tokens, characters,
messages, and token (actually character) classes to match are coded as
references into the <i class="term"><a href="../../../../index.html#key255">pool</a></i> as well.</p>
<ol class="enumerated">
<li><p>&quot;<b class="cmd">ict_advance</b> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ict_match_token</b> <i class="arg">tok</i> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ict_match_tokrange</b> <i class="arg">tokbegin</i> <i class="arg">tokend</i> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ict_match_tokclass</b> <i class="arg">code</i> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">inc_restore</b> <i class="arg">branchlabel</i> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">inc_save</b> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_ntcall</b> <i class="arg">branchlabel</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_ntreturn</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">iok_ok</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">iok_fail</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">iok_negate</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_jalways</b> <i class="arg">branchlabel</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_jok</b> <i class="arg">branchlabel</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_jfail</b> <i class="arg">branchlabel</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_halt</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">icl_push</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">icl_rewind</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">icl_pop</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ier_push</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ier_clear</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ier_nonterminal</b> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ier_merge</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_clear</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_terminal</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_nonterminal_leaf</b> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_nonterminal_range</b> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_nonterminal_reduce</b> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ias_push</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ias_mark</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ias_mrewind</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ias_mpop</b>&quot;</p></li>
</ol>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">CPU STATE</a></h2>
<p>A state value is a list containing the following elements, in the order listed below:</p>
<ol class="enumerated">
<li><p><i class="term">code</i>: Match instructions, see <span class="sectref"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></span>.</p></li>
<li><p><i class="term">pc</i>:   Program counter, <i class="term">int</i>.</p></li>
<li><p><i class="term">halt</i>: Halt flag, <i class="term">boolean</i>.</p></li>
<li><p><i class="term">eof</i>:  Eof flag, <i class="term">boolean</i></p></li>
<li><p><i class="term">tc</i>:   Terminal cache, and input queue. Structure see below.</p></li>
<li><p><i class="term">cl</i>:   Current location, <i class="term">int</i>.</p></li>
<li><p><i class="term">ct</i>:   Current token, <i class="term"><a href="../../../../index.html#key239">string</a></i>.</p></li>
<li><p><i class="term">ok</i>:   Match status, <i class="term">boolean</i>.</p></li>
<li><p><i class="term">sv</i>:   Semantic value, <i class="term"><a href="../../../../index.html#key252">list</a></i>.</p></li>
<li><p><i class="term">er</i>:   Error status, <i class="term"><a href="../../../../index.html#key252">list</a></i>.</p></li>
<li><p><i class="term">ls</i>:   Location stack, <i class="term"><a href="../../../../index.html#key252">list</a></i>.</p></li>
<li><p><i class="term">as</i>:   AST stack, <i class="term"><a href="../../../../index.html#key252">list</a></i>.</p></li>
<li><p><i class="term">ms</i>:   AST marker stack, <i class="term"><a href="../../../../index.html#key252">list</a></i>.</p></li>
<li><p><i class="term">es</i>:   Error stack, <i class="term"><a href="../../../../index.html#key252">list</a></i>.</p></li>
<li><p><i class="term">rs</i>:   Return stack, <i class="term"><a href="../../../../index.html#key252">list</a></i>.</p></li>
<li><p><i class="term">nc</i>:   Nonterminal cache, <i class="term">dictionary</i>.</p></li>
</ol>
<p><i class="term">tc</i>, the input queue of tokens waiting for processing and the
terminal cache containing the tokens already processing are one
unified data structure simply holding all tokens and their
information, with the current location separating that which has been
processed from that which is waiting.
Each element of the queue/cache is a list containing the token, its
lexeme information, line number, and column index, in this order.</p>
<p>All stacks have their top element aat the end, i.e. pushing an item is
equivalent to appending to the list representing the stack, and
popping it removes the last element.</p>
<p><i class="term">er</i>, the error status is either empty or a list of two elements,
a location in the input, and a list of messages, encoded as references
into the <i class="term"><a href="../../../../index.html#key255">pool</a></i> element of the <i class="term">code</i>.</p>
<p><i class="term">nc</i>, the nonterminal cache is keyed by nonterminal name and
location, each value a four-element list containing current location,
match status, semantic value, and error status, in this order.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key25">virtual machine</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005-2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_me/me_intro.html.




















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::me_intro - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_me/me_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::me_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::me_intro(n) 0.1 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::me_intro - Introduction to virtual machines for parsing token streams</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is an introduction to and overview of the basic
facilities for the parsing and/or matching of <i class="term">token</i>
streams. One possibility often used for the token domain are
characters.</p>
<p>The packages themselves all provide variants of one
<i class="term"><a href="../../../../index.html#key25">virtual machine</a></i>, called a <i class="term">match engine</i> (short
<i class="term">ME</i>), which has all the facilities needed for the matching and
parsing of a stream, and which are either controlled directly, or are
customized with a match program. The virtual machine is basically a
pushdown automaton, with additional elements for backtracking and/or
handling of semantic data and construction of abstract syntax trees
(<i class="term"><a href="../../../../index.html#key752">AST</a></i>).</p>
<p>Because of the high degree of similarity in the actual implementations
of the aforementioned virtual machine and the data structures they
receive and generate these common parts are specified in a separate
document which will be referenced by the documentation for packages
actually implementing it.</p>
<p>The relevant documents are:</p>
<dl class="definitions">
<dt><b class="package"><a href="me_vm.html">grammar::me_vm</a></b></dt>
<dd><p>Virtual machine specification.</p></dd>
<dt><b class="package"><a href="me_ast.html">grammar::me_ast</a></b></dt>
<dd><p>Specification of various representations used for abstract syntax
trees.</p></dd>
<dt><b class="package"><a href="me_util.html">grammar::me::util</a></b></dt>
<dd><p>Utility commands.</p></dd>
<dt><b class="package"><a href="me_tcl.html">grammar::me::tcl</a></b></dt>
<dd><p>Singleton ME virtual machine implementation tied to Tcl for control
flow and stacks. Hardwired for pull operation. Uninteruptible during
processing.</p></dd>
<dt><b class="package"><a href="me_cpu.html">grammar::me::cpu</a></b></dt>
<dd><p>Object-based ME virtual machine implementation with explicit control
flow, and stacks, using bytecodes. Suspend/Resumable. Push/pull
operation.</p></dd>
<dt><b class="package"><a href="me_cpucore.html">grammar::me::cpu::core</a></b></dt>
<dd><p>Core functionality for state manipulation and stepping used in the
bytecode based implementation of ME virtual machines.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key22">CFG</a>, <a href="../../../../index.html#key27">CFL</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key24">TPDL</a>, <a href="../../../../index.html#key23">context-free grammar</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a>, <a href="../../../../index.html#key25">virtual machine</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_me/me_tcl.html.



















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::me::tcl - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_me/me_tcl.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::me::tcl.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::me::tcl(n) 0.1 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::me::tcl - Virtual machine implementation I for parsing token streams</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">MACHINE STATE</a></li>
<li class="section"><a href="#section4">MACHINE INSTRUCTIONS</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">grammar::me::tcl <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::me::tcl</b> <b class="method">cmd</b> <i class="arg">...</i></a></li>
<li><a href="#2"><b class="cmd">::grammar::me::tcl</b> <b class="method">init</b> <i class="arg">nextcmd</i> <span class="opt">?<i class="arg">tokmap</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::grammar::me::tcl</b> <b class="method">lc</b> <i class="arg">location</i></a></li>
<li><a href="#4"><b class="cmd">::grammar::me::tcl</b> <b class="method">tok</b> <i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::grammar::me::tcl</b> <b class="method">tokens</b></a></li>
<li><a href="#6"><b class="cmd">::grammar::me::tcl</b> <b class="method">sv</b></a></li>
<li><a href="#7"><b class="cmd">::grammar::me::tcl</b> <b class="method">ast</b></a></li>
<li><a href="#8"><b class="cmd">::grammar::me::tcl</b> <b class="method">astall</b></a></li>
<li><a href="#9"><b class="cmd">::grammar::me::tcl</b> <b class="method">ctok</b></a></li>
<li><a href="#10"><b class="cmd">::grammar::me::tcl</b> <b class="method">nc</b></a></li>
<li><a href="#11"><b class="cmd">::grammar::me::tcl</b> <b class="method">next</b></a></li>
<li><a href="#12"><b class="cmd">::grammar::me::tcl</b> <b class="method">ord</b></a></li>
<li><a href="#13"><b class="cmd">::grammar::me::tcl::ict_advance</b> <i class="arg">message</i></a></li>
<li><a href="#14"><b class="cmd">::grammar::me::tcl::ict_match_token</b> <i class="arg">tok</i> <i class="arg">message</i></a></li>
<li><a href="#15"><b class="cmd">::grammar::me::tcl::ict_match_tokrange</b> <i class="arg">tokbegin</i> <i class="arg">tokend</i> <i class="arg">message</i></a></li>
<li><a href="#16"><b class="cmd">::grammar::me::tcl::ict_match_tokclass</b> <i class="arg">code</i> <i class="arg">message</i></a></li>
<li><a href="#17"><b class="cmd">::grammar::me::tcl::inc_restore</b> <i class="arg">nt</i></a></li>
<li><a href="#18"><b class="cmd">::grammar::me::tcl::inc_save</b> <i class="arg">nt</i> <i class="arg">startlocation</i></a></li>
<li><a href="#19"><b class="cmd">::grammar::me::tcl::iok_ok</b></a></li>
<li><a href="#20"><b class="cmd">::grammar::me::tcl::iok_fail</b></a></li>
<li><a href="#21"><b class="cmd">::grammar::me::tcl::iok_negate</b></a></li>
<li><a href="#22"><b class="cmd">::grammar::me::tcl::icl_get</b></a></li>
<li><a href="#23"><b class="cmd">::grammar::me::tcl::icl_rewind</b> <i class="arg">oldlocation</i></a></li>
<li><a href="#24"><b class="cmd">::grammar::me::tcl::ier_get</b></a></li>
<li><a href="#25"><b class="cmd">::grammar::me::tcl::ier_clear</b></a></li>
<li><a href="#26"><b class="cmd">::grammar::me::tcl::ier_nonterminal</b> <i class="arg">message</i> <i class="arg">location</i></a></li>
<li><a href="#27"><b class="cmd">::grammar::me::tcl::ier_merge</b> <i class="arg">olderror</i></a></li>
<li><a href="#28"><b class="cmd">::grammar::me::tcl::isv_clear</b></a></li>
<li><a href="#29"><b class="cmd">::grammar::me::tcl::isv_terminal</b></a></li>
<li><a href="#30"><b class="cmd">::grammar::me::tcl::isv_nonterminal_leaf</b> <i class="arg">nt</i> <i class="arg">startlocation</i></a></li>
<li><a href="#31"><b class="cmd">::grammar::me::tcl::isv_nonterminal_range</b> <i class="arg">nt</i> <i class="arg">startlocation</i></a></li>
<li><a href="#32"><b class="cmd">::grammar::me::tcl::isv_nonterminal_reduce</b> <i class="arg">nt</i> <i class="arg">startlocation</i> <span class="opt">?<i class="arg">marker</i>?</span></a></li>
<li><a href="#33"><b class="cmd">::grammar::me::tcl::ias_push</b></a></li>
<li><a href="#34"><b class="cmd">::grammar::me::tcl::ias_mark</b></a></li>
<li><a href="#35"><b class="cmd">::grammar::me::tcl::ias_pop2mark</b> <i class="arg">marker</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides an implementation of the ME virtual machine.
Please go and read the document <b class="syscmd"><a href="me_intro.html">grammar::me_intro</a></b> first if
you do not know what a ME virtual machine is.</p>
<p>This implementation is tied very strongly to Tcl. All the stacks in
the machine state are handled through the Tcl stack, all control flow
is handled by Tcl commands, and the remaining machine instructions are
directly mapped to Tcl commands. Especially the matching of
nonterminal symbols is handled by Tcl procedures as well, essentially
extending the machine implementation with custom instructions.</p>
<p>Further on the implementation handles only a single machine which is
uninteruptible during execution and hardwired for pull operation. I.e.
it explicitly requests each new token through a callback, pulling them
into its state.</p>
<p>A related package is <b class="package"><a href="../grammar_peg/peg_interp.html">grammar::peg::interp</a></b> which provides a
generic interpreter / parser for parsing expression grammars (PEGs),
implemented on top of this implementation of the ME virtual machine.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The commands documented in this section do not implement any of the
instructions of the ME virtual machine. They provide the facilities
for the initialization of the machine and the retrieval of important
information.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::me::tcl</b> <b class="method">cmd</b> <i class="arg">...</i></a></dt>
<dd><p>This is an ensemble command providing access to the commands listed in
this section. See the methods themselves for detailed specifications.</p></dd>
<dt><a name="2"><b class="cmd">::grammar::me::tcl</b> <b class="method">init</b> <i class="arg">nextcmd</i> <span class="opt">?<i class="arg">tokmap</i>?</span></a></dt>
<dd><p>This command (re)initializes the machine. It returns the empty
string. This command has to be invoked before any other command of
this package.</p>
<p>The command prefix <i class="arg">nextcmd</i> represents the input stream of
characters and is invoked by the machine whenever the a new character
from the stream is required. The instruction for handling this is
<i class="term">ict_advance</i>.
The callback has to return either the empty list, or a list of 4
elements containing the token, its lexeme attribute, and its location
as line number and column index, in this order.
The empty list is the signal that the end of the input stream has been
reached. The lexeme attribute is stored in the terminal cache, but
otherwise not used by the machine.</p>
<p>The optional dictionary <i class="arg">tokmap</i> maps from tokens to integer
numbers. If present the numbers impose an order on the tokens, which
is subsequently used by <i class="term">ict_match_tokrange</i> to determine if a
token is in the specified range or not. If no token map is specified
the lexicographic order of th token names will be used instead. This
choice is especially asensible when using characters as tokens.</p></dd>
<dt><a name="3"><b class="cmd">::grammar::me::tcl</b> <b class="method">lc</b> <i class="arg">location</i></a></dt>
<dd><p>This command converts the location of a token given as offset in the
input stream into the associated line number and column index. The
result of the command is a 2-element list containing the two values,
in the order mentioned in the previous sentence.
This allows higher levels to convert the location information found in
the error status and the generated AST into more human readable data.</p>
<p><em>Note</em> that the command is not able to convert locations which
have not been reached by the machine yet. In other words, if the
machine has read 7 tokens the command is able to convert the offsets
<b class="const">0</b> to <b class="const">6</b>, but nothing beyond that. This also shows that
it is not possible to convert offsets which refer to locations before
the beginning of the stream.</p>
<p>After a call of <b class="method">init</b> the state used for the conversion is
cleared, making further conversions impossible until the machine has
read tokens again.</p></dd>
<dt><a name="4"><b class="cmd">::grammar::me::tcl</b> <b class="method">tok</b> <i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span></a></dt>
<dd><p>This command returns a Tcl list containing the part of the input
stream between the locations <i class="arg">from</i> and <i class="arg">to</i> (both
inclusive). If <i class="arg">to</i> is not specified it will default to the value
of <i class="arg">from</i>.</p>
<p>Each element of the returned list is a list of four elements, the
token, its associated lexeme, line number, and column index, in this
order.
In other words, each element has the same structure as the result of
the <i class="arg">nextcmd</i> callback given to <b class="cmd">::grammar::me::tcl::init</b></p>
<p>This command places the same restrictions on its location arguments as
<b class="cmd">::grammar::me::tcl::lc</b>.</p></dd>
<dt><a name="5"><b class="cmd">::grammar::me::tcl</b> <b class="method">tokens</b></a></dt>
<dd><p>This command returns the number of tokens currently known to the ME
virtual machine.</p></dd>
<dt><a name="6"><b class="cmd">::grammar::me::tcl</b> <b class="method">sv</b></a></dt>
<dd><p>This command returns the current semantic value <i class="term">SV</i> stored in
the machine. This is an abstract syntax tree as specified in the
document <b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section <b class="sectref">AST VALUES</b>.</p></dd>
<dt><a name="7"><b class="cmd">::grammar::me::tcl</b> <b class="method">ast</b></a></dt>
<dd><p>This method returns the abstract syntax tree currently at the top of
the AST stack of the ME virtual machine. This is an abstract syntax
tree as specified in the document <b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section
<b class="sectref">AST VALUES</b>.</p></dd>
<dt><a name="8"><b class="cmd">::grammar::me::tcl</b> <b class="method">astall</b></a></dt>
<dd><p>This method returns the whole stack of abstract syntax trees currently
known to the ME virtual machine. Each element of the returned list is
an abstract syntax tree as specified in the document
<b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section <b class="sectref">AST VALUES</b>.
The top of the stack resides at the end of the list.</p></dd>
<dt><a name="9"><b class="cmd">::grammar::me::tcl</b> <b class="method">ctok</b></a></dt>
<dd><p>This method returns the current token considered by the ME virtual
machine.</p></dd>
<dt><a name="10"><b class="cmd">::grammar::me::tcl</b> <b class="method">nc</b></a></dt>
<dd><p>This method returns the contents of the nonterminal cache as a
dictionary mapping from &quot;<b class="variable">symbol</b>,<b class="variable">location</b>&quot; to match
information.</p></dd>
<dt><a name="11"><b class="cmd">::grammar::me::tcl</b> <b class="method">next</b></a></dt>
<dd><p>This method returns the next token callback as specified during
initialization of the ME virtual machine.</p></dd>
<dt><a name="12"><b class="cmd">::grammar::me::tcl</b> <b class="method">ord</b></a></dt>
<dd><p>This method returns a dictionary containing the <i class="arg">tokmap</i> specified
during initialization of the ME virtual machine.
<b class="variable"><b class="cmd">::grammar::me::tcl::ok</b></b>
This variable contains the current match status <i class="term">OK</i>. It is
provided as variable instead of a command because that makes access to
this information faster, and the speed of access is considered very
important here as this information is used constantly to determine the
control flow.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">MACHINE STATE</a></h2>
<p>Please go and read the document <b class="syscmd"><a href="me_vm.html">grammar::me_vm</a></b> first for a
specification of the basic ME virtual machine and its state.</p>
<p>This implementation manages the state described in that document,
except for the stacks minus the AST stack. In other words, location
stack, error stack, return stack, and ast marker stack are implicitly
managed through standard Tcl scoping, i.e. Tcl variables in
procedures, outside of this implementation.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">MACHINE INSTRUCTIONS</a></h2>
<p>Please go and read the document <b class="syscmd"><a href="me_vm.html">grammar::me_vm</a></b> first for a
specification of the basic ME virtual machine and its instruction set.</p>
<p>This implementation maps all instructions to Tcl commands in the
namespace &quot;::grammar::me::tcl&quot;, except for the stack related commands,
nonterminal symbols and control flow.
Here we simply list the commands and explain the differences to the
specified instructions, if there are any. For their semantics see the
aforementioned specification. The machine commands are <em>not</em>
reachable through the ensemble command <b class="cmd">::grammar::me::tcl</b>.</p>
<dl class="definitions">
<dt><a name="13"><b class="cmd">::grammar::me::tcl::ict_advance</b> <i class="arg">message</i></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="14"><b class="cmd">::grammar::me::tcl::ict_match_token</b> <i class="arg">tok</i> <i class="arg">message</i></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="15"><b class="cmd">::grammar::me::tcl::ict_match_tokrange</b> <i class="arg">tokbegin</i> <i class="arg">tokend</i> <i class="arg">message</i></a></dt>
<dd><p>If, and only if a token map was specified during initialization then
the arguments are the numeric representations of the smallest and
largest tokens in the range. Otherwise they are the relevant tokens
themselves and lexicographic comparison is used.</p></dd>
<dt><a name="16"><b class="cmd">::grammar::me::tcl::ict_match_tokclass</b> <i class="arg">code</i> <i class="arg">message</i></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="17"><b class="cmd">::grammar::me::tcl::inc_restore</b> <i class="arg">nt</i></a></dt>
<dd><p>Instead of taking a branchlabel the command returns a boolean value.
The result will be <b class="const">true</b> if and only if cached information was
found. The caller has to perform the appropriate branching.</p></dd>
<dt><a name="18"><b class="cmd">::grammar::me::tcl::inc_save</b> <i class="arg">nt</i> <i class="arg">startlocation</i></a></dt>
<dd><p>The command takes the start location as additional argument, as it is
managed on the Tcl stack, and not in the machine state.</p></dd>
<dt><b class="cmd">icf_ntcall</b> <i class="arg">branchlabel</i></dt>
<dd></dd>
<dt><b class="cmd">icf_ntreturn</b></dt>
<dd><p>These two instructions are not mapped to commands. They are control
flow instructions and handled in Tcl.</p></dd>
<dt><a name="19"><b class="cmd">::grammar::me::tcl::iok_ok</b></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="20"><b class="cmd">::grammar::me::tcl::iok_fail</b></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="21"><b class="cmd">::grammar::me::tcl::iok_negate</b></a></dt>
<dd><p>No changes.</p></dd>
<dt><b class="cmd">icf_jalways</b> <i class="arg">branchlabel</i></dt>
<dd></dd>
<dt><b class="cmd">icf_jok</b> <i class="arg">branchlabel</i></dt>
<dd></dd>
<dt><b class="cmd">icf_jfail</b> <i class="arg">branchlabel</i></dt>
<dd></dd>
<dt><b class="cmd">icf_halt</b></dt>
<dd><p>These four instructions are not mapped to commands. They are control
flow instructions and handled in Tcl.</p></dd>
<dt><a name="22"><b class="cmd">::grammar::me::tcl::icl_get</b></a></dt>
<dd><p>This command returns the current location <i class="term">CL</i> in the input.
It replaces <i class="term">icl_push</i>.</p></dd>
<dt><a name="23"><b class="cmd">::grammar::me::tcl::icl_rewind</b> <i class="arg">oldlocation</i></a></dt>
<dd><p>The command takes the location as argument as it comes from the
Tcl stack, not the machine state.</p></dd>
<dt><b class="cmd">icl_pop</b></dt>
<dd><p>Not mapped, the stacks are not managed by the package.</p></dd>
<dt><a name="24"><b class="cmd">::grammar::me::tcl::ier_get</b></a></dt>
<dd><p>This command returns the current error state <i class="term">ER</i>.
It replaces <i class="term">ier_push</i>.</p></dd>
<dt><a name="25"><b class="cmd">::grammar::me::tcl::ier_clear</b></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="26"><b class="cmd">::grammar::me::tcl::ier_nonterminal</b> <i class="arg">message</i> <i class="arg">location</i></a></dt>
<dd><p>The command takes the location as argument as it comes from the
Tcl stack, not the machine state.</p></dd>
<dt><a name="27"><b class="cmd">::grammar::me::tcl::ier_merge</b> <i class="arg">olderror</i></a></dt>
<dd><p>The command takes the second error state to merge as argument as it
comes from the Tcl stack, not the machine state.</p></dd>
<dt><a name="28"><b class="cmd">::grammar::me::tcl::isv_clear</b></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="29"><b class="cmd">::grammar::me::tcl::isv_terminal</b></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="30"><b class="cmd">::grammar::me::tcl::isv_nonterminal_leaf</b> <i class="arg">nt</i> <i class="arg">startlocation</i></a></dt>
<dd><p>The command takes the start location as argument as it comes from the
Tcl stack, not the machine state.</p></dd>
<dt><a name="31"><b class="cmd">::grammar::me::tcl::isv_nonterminal_range</b> <i class="arg">nt</i> <i class="arg">startlocation</i></a></dt>
<dd><p>The command takes the start location as argument as it comes from the
Tcl stack, not the machine state.</p></dd>
<dt><a name="32"><b class="cmd">::grammar::me::tcl::isv_nonterminal_reduce</b> <i class="arg">nt</i> <i class="arg">startlocation</i> <span class="opt">?<i class="arg">marker</i>?</span></a></dt>
<dd><p>The command takes start location and marker as argument as it comes
from the Tcl stack, not the machine state.</p></dd>
<dt><a name="33"><b class="cmd">::grammar::me::tcl::ias_push</b></a></dt>
<dd><p>No changes.</p></dd>
<dt><a name="34"><b class="cmd">::grammar::me::tcl::ias_mark</b></a></dt>
<dd><p>This command returns a marker for the current state of the AST stack
<i class="term">AS</i>. The marker stack is not managed by the machine.</p></dd>
<dt><a name="35"><b class="cmd">::grammar::me::tcl::ias_pop2mark</b> <i class="arg">marker</i></a></dt>
<dd><p>The command takes the marker as argument as it comes from the
Tcl stack, not the machine state. It replaces <i class="term">ias_mpop</i>.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key25">virtual machine</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_me/me_util.html.








































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::me::util - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_me/me_util.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::me::util.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::me::util(n) 0.1 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::me::util - AST utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">grammar::me::util <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::me::util::ast2tree</b> <i class="arg">ast</i> <i class="arg">tree</i> <span class="opt">?<i class="arg">root</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::grammar::me::util::ast2etree</b> <i class="arg">ast</i> <i class="arg">mcmd</i> <i class="arg">tree</i> <span class="opt">?<i class="arg">root</i>?</span></a></li>
<li><a href="#3"><b class="cmd">mcmd</b> <b class="method">lc</b> <i class="arg">location</i></a></li>
<li><a href="#4"><b class="cmd">mcmd</b> <b class="method">tok</b> <i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::grammar::me::util::tree2ast</b> <i class="arg">tree</i> <span class="opt">?<i class="arg">root</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a number of utility command for the conversion
between the various representations of abstract syntax trees as
specified in the document <b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::me::util::ast2tree</b> <i class="arg">ast</i> <i class="arg">tree</i> <span class="opt">?<i class="arg">root</i>?</span></a></dt>
<dd><p>This command converts an <i class="arg">ast</i> from value to object
representation. All nodes in the <i class="arg">ast</i> will be converted into
nodes of this <i class="arg">tree</i>, with the root of the AST a child of the node
<i class="arg">root</i>. If this node is not explicitly specified the root of the
tree is used. Existing content of tree is not touched, i.e.  neither
removed nor changed, with the exception of the specified root node,
which will gain a new child.</p></dd>
<dt><a name="2"><b class="cmd">::grammar::me::util::ast2etree</b> <i class="arg">ast</i> <i class="arg">mcmd</i> <i class="arg">tree</i> <span class="opt">?<i class="arg">root</i>?</span></a></dt>
<dd><p>This command is like <b class="cmd">::grammar::me::util::ast2tree</b>, except that
the result is in the extended object representation of the input AST.
The source of the extended information is the command prefix
<i class="arg">mcmd</i>.
It has to understand two methods, <b class="method">lc</b>, and <b class="method">tok</b>, with
the semantics specified below.</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">mcmd</b> <b class="method">lc</b> <i class="arg">location</i></a></dt>
<dd><p>Takes the location of a token given as offset in the input stream and
return a 2-element list containing the associated line number and
column index, in this order.</p></dd>
<dt><a name="4"><b class="cmd">mcmd</b> <b class="method">tok</b> <i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span></a></dt>
<dd><p>Takes one or two locations <i class="arg">from</i> and <i class="arg">to</i> as offset in the
input stream and returns a Tcl list containing the specified part of
the input stream. Both location are inclusive. If <i class="arg">to</i> is not
specified it will default to the value of <i class="arg">from</i>.</p>
<p>Each element of the returned list is a list containing the token, its
associated lexeme, the line number, and column index, in this order.</p></dd>
</dl>
<p>Both the ensemble command <b class="cmd">::grammar::me::tcl</b> provided by the
package <b class="package"><a href="me_tcl.html">grammar::me::tcl</a></b> and the objects command created by
the package <b class="package">::grammar::me::cpu</b> fit the above specification.</p></dd>
<dt><a name="5"><b class="cmd">::grammar::me::util::tree2ast</b> <i class="arg">tree</i> <span class="opt">?<i class="arg">root</i>?</span></a></dt>
<dd><p>This command converts an <i class="arg">ast</i> in (extended) object representation
into a value and returns it.
If a <i class="arg">root</i> node is specified the AST is generated from that node
downward. Otherwise the root of the tree object is used as the
starting point.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key686">abstract syntax tree</a>, <a href="../../../../index.html#key685">syntax tree</a>, <a href="../../../../index.html#key254">tree</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_me/me_vm.html.






































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::me_vm - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_me/me_vm.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::me_vm.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::me_vm(n) 0.1 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::me_vm - Virtual machine for parsing token streams</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">MACHINE STATE</a></li>
<li class="section"><a href="#section3">MACHINE INSTRUCTIONS</a>
<ul>
<li class="subsection"><a href="#subsection1">TERMINAL MATCHING</a></li>
<li class="subsection"><a href="#subsection2">NONTERMINAL MATCHING</a></li>
<li class="subsection"><a href="#subsection3">UNCONDITIONAL MATCHING</a></li>
<li class="subsection"><a href="#subsection4">CONTROL FLOW</a></li>
<li class="subsection"><a href="#subsection5">INPUT LOCATION HANDLING</a></li>
<li class="subsection"><a href="#subsection6">ERROR HANDLING</a></li>
<li class="subsection"><a href="#subsection7">SEMANTIC VALUES</a></li>
<li class="subsection"><a href="#subsection8">AST STACK HANDLING</a></li>
</ul>
</li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Please go and read the document <b class="syscmd"><a href="me_intro.html">grammar::me_intro</a></b> first for
an overview of the various documents and their relations.</p>
<p>This document specifies a virtual machine for the controlled matching
and parsing of token streams, creating an
<i class="term"><a href="../../../../index.html#key686">abstract syntax tree</a></i> (short <i class="term"><a href="../../../../index.html#key752">AST</a></i>) reflecting the
structure of the input. Special machine features are the caching and
reuse of partial results, caching of the encountered input, and the
ability to backtrack in both input and AST creation.</p>
<p>These features make the specified virtual machine especially useful to
packrat parsers based on parsing expression grammars. It is however
not restricted to this type of parser. Normal LL and LR parsers can be
implemented with it as well.</p>
<p>The following sections will discuss first the abstract state kept by
ME virtual machines, and then their instruction set.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">MACHINE STATE</a></h2>
<p>A ME virtual machine manages the following state:</p>
<dl class="definitions">
<dt><i class="term">Current token</i> CT</dt>
<dd><p>The token from the input under consideration by the machine.</p>
<p>This information is used and modified by the instructions defined in
the section
<span class="sectref"><a href="#subsection1">TERMINAL MATCHING</a></span>.</p></dd>
<dt><i class="term">Current location</i> CL</dt>
<dd><p>The location of the <i class="term">current token</i> in the input stream, as
offset relative to the beginning of the stream. The first token is
considered to be at offset <b class="const">0</b>.</p>
<p>This information is implicitly used and modified by the instructions
defined in the sections
<span class="sectref"><a href="#subsection1">TERMINAL MATCHING</a></span> and
<span class="sectref"><a href="#subsection2">NONTERMINAL MATCHING</a></span>,
and can be directly queried and modified by the instructions defined
in section
<span class="sectref"><a href="#subsection5">INPUT LOCATION HANDLING</a></span>.</p></dd>
<dt><i class="term">Location stack</i> LS</dt>
<dd><p>In addition to the above a stack of locations, for backtracking.
Locations can put on the stack, removed from it, and removed with
setting the current location.</p>
<p>This information is implicitly used and modified by the instructions
defined in the sections
<span class="sectref"><a href="#subsection1">TERMINAL MATCHING</a></span> and
<span class="sectref"><a href="#subsection2">NONTERMINAL MATCHING</a></span>,
and can be directly queried and modified by the instructions defined
in section
<span class="sectref"><a href="#subsection5">INPUT LOCATION HANDLING</a></span>.</p></dd>
<dt><i class="term">Match status</i> OK</dt>
<dd><p>A boolean value, the result of the last attempt at matching input.
It is set to <b class="const">true</b> if that attempt was successful, and
<b class="const">false</b> otherwise.</p>
<p>This information is influenced by the instructions defined in the
sections
<span class="sectref"><a href="#subsection1">TERMINAL MATCHING</a></span>,
<span class="sectref"><a href="#subsection2">NONTERMINAL MATCHING</a></span>, and
<span class="sectref"><a href="#subsection3">UNCONDITIONAL MATCHING</a></span>.
It is queried by the instructions defined in the section
<span class="sectref"><a href="#subsection4">CONTROL FLOW</a></span>.</p></dd>
<dt><i class="term">Semantic value</i> SV</dt>
<dd><p>The semantic value associated with (generated by) the last attempt at
matching input. Contains either the empty string or a node for the
abstract syntax tree constructed from the input.</p>
<p>This information is influenced by the instructions defined in the
sections
<span class="sectref"><a href="#subsection7">SEMANTIC VALUES</a></span>, and
<span class="sectref"><a href="#subsection8">AST STACK HANDLING</a></span>.</p></dd>
<dt><i class="term">AST stack</i> AS</dt>
<dd><p>A stack of partial abstract syntax trees constructed by the machine
during matching.</p>
<p>This information is influenced by the instructions defined in the
sections
<span class="sectref"><a href="#subsection7">SEMANTIC VALUES</a></span>, and
<span class="sectref"><a href="#subsection8">AST STACK HANDLING</a></span>.</p></dd>
<dt><i class="term">AST Marker stack</i> MS</dt>
<dd><p>In addition to the above a stack of stacks, for backtracking. This is
actually a stack of markers into the AST stack, thus implicitly
snapshooting the state of the AST stack at some point in time. Markers
can be put on the stack, dropped from it, and used to roll back the
AST stack to an earlier state.</p>
<p>This information is influenced by the instructions defined in the
sections
<span class="sectref"><a href="#subsection7">SEMANTIC VALUES</a></span>, and
<span class="sectref"><a href="#subsection8">AST STACK HANDLING</a></span>.</p></dd>
<dt><i class="term">Error status</i> ER</dt>
<dd><p>Error information associated with the last attempt at matching
input. Contains either the empty string or a list of 2 elements, a
location in the input and a list of error messages associated with
it, in this order.</p>
<p><em>Note</em> that error information can be set even if the last attempt
at matching input was successful. For example the *-operator (matching
a sub-expression zero or more times) in a parsing expression grammar
is always successful, even if it encounters a problem further in the
input and has to backtrack. Such problems must not be forgotten when
continuing to match.</p>
<p>This information is queried and influenced by the instructions defined
in the sections
<span class="sectref"><a href="#subsection1">TERMINAL MATCHING</a></span>,
<span class="sectref"><a href="#subsection2">NONTERMINAL MATCHING</a></span>, and
<span class="sectref"><a href="#subsection6">ERROR HANDLING</a></span>.</p></dd>
<dt><i class="term">Error stack</i> ES</dt>
<dd><p>In addition to the above a stack of error information, to allow the
merging of current and older error information when performing
backtracking in choices after an unsucessful match.</p>
<p>This information is queried and influenced by the instructions defined
in the sections
<span class="sectref"><a href="#subsection1">TERMINAL MATCHING</a></span>,
<span class="sectref"><a href="#subsection2">NONTERMINAL MATCHING</a></span>, and
<span class="sectref"><a href="#subsection6">ERROR HANDLING</a></span>.</p></dd>
<dt><i class="term">Return stack</i> RS</dt>
<dd><p>A stack of program counter values, i.e. locations in the code
controlling the virtual machine, for the management of subroutine
calls, i.e. the matching of nonterminal symbols.</p>
<p>This information is queried and influenced by the instructions defined
in the section
<span class="sectref"><a href="#subsection2">NONTERMINAL MATCHING</a></span>.</p></dd>
<dt><i class="term">Nonterminal cache</i> NC</dt>
<dd><p>A cache of machine states (A 4-tuple containing a location in the
input, match status <i class="term">OK</i>, semantic value <i class="term">SV</i>, and error
status <i class="term">ER</i>) keyed by name of nonterminal symbol and location in
the input stream.</p>
<p>The key location is where machine started the attempt to match the
named nonterminal symbol, and the location in the value is where
machine ended up after the attempt completed, independent of the
success of the attempt.</p>
<p>This status is queried and influenced by the instructions defined in
the section
<span class="sectref"><a href="#subsection2">NONTERMINAL MATCHING</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">MACHINE INSTRUCTIONS</a></h2>
<p>With the machine state specified it is now possible to explain the
instruction set of ME virtual machines. They are grouped roughly by
the machine state they influence and/or query.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">TERMINAL MATCHING</a></h3>
<p>First the instructions to match tokens from the input stream, and
by extension all terminal symbols.</p>
<p>These instructions are the only ones which may retrieve a new token
from the input stream. This is a <em>may</em> and not a <em>will</em>
because the instructions will a retrieve new token if, and only if the
current location <i class="term">CL</i> is at the head of the stream.
If the machine has backtracked (see <b class="cmd">icl_rewind</b>) the instructions
will retrieve the token to compare against from the internal cache.</p>
<dl class="definitions">
<dt><b class="cmd">ict_advance</b> <i class="arg">message</i></dt>
<dd><p>This instruction tries to advance to the next token in the input
stream, i.e. the one after the current location <i class="term">CL</i>. The
instruction will fail if, and only if the end of the input stream is
reached, i.e. if there is no next token.</p>
<p>The sucess/failure of the instruction is remembered in the match
status <i class="term">OK</i>. In the case of failure the error status <i class="term">ER</i> is
set to the current location and the message <i class="arg">message</i>.
In the case of success the error status <i class="term">ER</i> is cleared, the new
token is made the current token <i class="term">CT</i>, and the new location is
made the current location <i class="term">CL</i>.</p>
<p>The argument <i class="arg">message</i> is a reference to the string to put into
the error status <i class="term">ER</i>, if such is needed.</p></dd>
<dt><b class="cmd">ict_match_token</b> <i class="arg">tok</i> <i class="arg">message</i></dt>
<dd><p>This instruction tests the current token <i class="term">CT</i> for equality
with the argument <i class="arg">tok</i> and records the result in the match
status <i class="term">OK</i>. The instruction fails if the current token is
not equal to <i class="arg">tok</i>.</p>
<p>In case of failure the error status <i class="term">ER</i> is set to the current
location <i class="term">CL</i> and the message <i class="arg">message</i>, and the
current location <i class="term">CL</i> is moved one token backwards.
Otherwise, i.e. upon success, the error status <i class="term">ER</i> is cleared
and the current location <i class="term">CL</i> is not touched.</p></dd>
<dt><b class="cmd">ict_match_tokrange</b> <i class="arg">tokbegin</i> <i class="arg">tokend</i> <i class="arg">message</i></dt>
<dd><p>This instruction tests the current token <i class="term">CT</i> for being in
the range of tokens from <i class="arg">tokbegin</i> to <i class="arg">tokend</i>
(inclusive) and records the result in the match status <i class="term">OK</i>. The
instruction fails if the current token is not inside the range.</p>
<p>In case of failure the error status <i class="term">ER</i> is set to the current
location <i class="term">CL</i> and the message <i class="arg">message</i>, and the current location
<i class="term">CL</i> is moved one token backwards.
Otherwise, i.e. upon success, the error status <i class="term">ER</i> is cleared
and the current location <i class="term">CL</i> is not touched.</p></dd>
<dt><b class="cmd">ict_match_tokclass</b> <i class="arg">code</i> <i class="arg">message</i></dt>
<dd><p>This instruction tests the current token <i class="term">CT</i> for being a member
of the token class <i class="arg">code</i> and records the result in the match
status <i class="term">OK</i>. The instruction fails if the current token is not a
member of the specified class.</p>
<p>In case of failure the error status <i class="term">ER</i> is set to the current
location <i class="term">CL</i> and the message <i class="arg">message</i>, and the
current location <i class="term">CL</i> is moved one token backwards.
Otherwise, i.e. upon success, the error status <i class="term">ER</i> is cleared
and the current location <i class="term">CL</i> is not touched.</p>
<p>Currently the following classes are legal:</p>
<dl class="definitions">
<dt>alnum</dt>
<dd><p>A token is accepted if it is a unicode alphabetical character, or a digit.</p></dd>
<dt>alpha</dt>
<dd><p>A token is accepted if it is a unicode alphabetical character.</p></dd>
<dt>digit</dt>
<dd><p>A token is accepted if it is a unicode digit character.</p></dd>
<dt>xdigit</dt>
<dd><p>A token is accepted if it is a hexadecimal digit character.</p></dd>
<dt>punct</dt>
<dd><p>A token is accepted if it is a unicode punctuation character.</p></dd>
<dt>space</dt>
<dd><p>A token is accepted if it is a unicode space character.</p></dd>
</dl></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">NONTERMINAL MATCHING</a></h3>
<p>The instructions in this section handle the matching of nonterminal
symbols. They query the nonterminal cache <i class="term">NC</i> for saved
information, and put such information into the cache.</p>
<p>The usage of the cache is a performance aid for backtracking parsers,
allowing them to avoid an expensive rematch of complex nonterminal
symbols if they have been encountered before.</p>
<dl class="definitions">
<dt><b class="cmd">inc_restore</b> <i class="arg">branchlabel</i> <i class="arg">nt</i></dt>
<dd><p>This instruction checks if the nonterminal cache <i class="term">NC</i> contains
information about the nonterminal symbol <i class="arg">nt</i>, at the current
location <i class="term">CL</i>. If that is the case the instruction will update
the machine state (current location <i class="term">CL</i>, match status <i class="term">OK</i>,
semantic value <i class="term">SV</i>, and error status <i class="term">ER</i>) with the found
information and continue execution at the instruction refered to by
the <i class="arg">branchlabel</i>. The new current location <i class="term">CL</i> will be the
last token matched by the nonterminal symbol, i.e. belonging to it.</p>
<p>If no information was found the instruction will continue execution at
the next instruction.</p>
<p>Together with <b class="cmd">icf_ntcall</b> it is possible to generate code for
memoized and non-memoized matching of nonterminal symbols, either as
subroutine calls, or inlined in the caller.</p></dd>
<dt><b class="cmd">inc_save</b> <i class="arg">nt</i></dt>
<dd><p>This instruction saves the current state of the machine (current
location <i class="term">CL</i>, match status <i class="term">OK</i>, semantic value <i class="term">SV</i>,
and error status <i class="term">ER</i>), to the nonterminal cache <i class="term">NC</i>. It
will also pop an entry from the location stack <i class="term">LS</i> and save it
as the start location of the match.</p>
<p>It is expected to be called at the end of matching a nonterminal
symbol, with <i class="arg">nt</i> the name of the nonterminal symbol the code was
working on. This allows the instruction <b class="cmd">inc_restore</b> to check for
and retrieve the data, should we have to match this nonterminal symbol
at the same location again, during backtracking.</p></dd>
<dt><b class="cmd">icf_ntcall</b> <i class="arg">branchlabel</i></dt>
<dd><p>This instruction invokes the code for matching the nonterminal symbol
<i class="arg">nt</i> as a subroutine. To this end it stores the current program
counter <i class="term">PC</i> on the return stack <i class="term">RS</i>, the current location
<i class="term">CL</i> on the location stack <i class="term">LS</i>, and then continues
execution at the address <i class="arg">branchlabel</i>.</p>
<p>The next matching <b class="cmd">icf_ntreturn</b> will cause the execution to
continue at the instruction coming after the call.</p></dd>
<dt><b class="cmd">icf_ntreturn</b></dt>
<dd><p>This instruction will pop an entry from the return stack <i class="term">RS</i>,
assign it to the program counter <i class="term">PC</i>, and then continue
execution at the new address.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">UNCONDITIONAL MATCHING</a></h3>
<p>The instructions in this section are the remaining match
operators. They change the match status <i class="term">OK</i> directly and
unconditionally.</p>
<dl class="definitions">
<dt><b class="cmd">iok_ok</b></dt>
<dd><p>This instruction sets the match status <i class="term">OK</i> to <b class="const">true</b>,
indicating a successful match.</p></dd>
<dt><b class="cmd">iok_fail</b></dt>
<dd><p>This instruction sets the match status <i class="term">OK</i> to <b class="const">false</b>,
indicating a failed match.</p></dd>
<dt><b class="cmd">iok_negate</b></dt>
<dd><p>This instruction negates the match status <i class="term">OK</i>, turning a failure
into a success and vice versa.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">CONTROL FLOW</a></h3>
<p>The instructions in this section implement both conditional and
unconditional control flow. The conditional jumps query the match
status <i class="term">OK</i>.</p>
<dl class="definitions">
<dt><b class="cmd">icf_jalways</b> <i class="arg">branchlabel</i></dt>
<dd><p>This instruction sets the program counter <i class="term">PC</i> to the address
specified by <i class="arg">branchlabel</i> and then continues execution from
there. This is an unconditional jump.</p></dd>
<dt><b class="cmd">icf_jok</b> <i class="arg">branchlabel</i></dt>
<dd><p>This instruction sets the program counter <i class="term">PC</i> to the address
specified by <i class="arg">branchlabel</i>. This happens if, and only if the match
status <i class="term">OK</i> indicates a success. Otherwise it simply continues
execution at the next instruction. This is a conditional jump.</p></dd>
<dt><b class="cmd">icf_jfail</b> <i class="arg">branchlabel</i></dt>
<dd><p>This instruction sets the program counter <i class="term">PC</i> to the address
specified by <i class="arg">branchlabel</i>. This happens if, and only if the match
status <i class="term">OK</i> indicates a failure. Otherwise it simply continues
execution at the next instruction. This is a conditional jump.</p></dd>
<dt><b class="cmd">icf_halt</b></dt>
<dd><p>This instruction halts the machine and blocks any further execution.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">INPUT LOCATION HANDLING</a></h3>
<p>The instructions in this section are for backtracking, they manipulate
the current location <i class="term">CL</i> of the machine state.
They allow a user of the machine to query and save locations in the
input, and to rewind the current location <i class="term">CL</i> to saved
locations, making them one of the components enabling the
implementation of backtracking parsers.</p>
<dl class="definitions">
<dt><b class="cmd">icl_push</b></dt>
<dd><p>This instruction pushes a copy of the current location <i class="term">CL</i> on
the location stack <i class="term">LS</i>.</p></dd>
<dt><b class="cmd">icl_rewind</b></dt>
<dd><p>This instruction pops an entry from the location stack <i class="term">LS</i> and
then moves the current location <i class="term">CL</i> back to this point in the
input.</p></dd>
<dt><b class="cmd">icl_pop</b></dt>
<dd><p>This instruction pops an entry from the location stack <i class="term">LS</i> and
discards it.</p></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">ERROR HANDLING</a></h3>
<p>The instructions in this section provide read and write access to the
error status <i class="term">ER</i> of the machine.</p>
<dl class="definitions">
<dt><b class="cmd">ier_push</b></dt>
<dd><p>This instruction pushes a copy of the current error status <i class="term">ER</i>
on the error stack <i class="term">ES</i>.</p></dd>
<dt><b class="cmd">ier_clear</b></dt>
<dd><p>This instruction clears the error status <i class="term">ER</i>.</p></dd>
<dt><b class="cmd">ier_nonterminal</b> <i class="arg">message</i></dt>
<dd><p>This instruction checks if the error status <i class="term">ER</i> contains an
error whose location is just past the location found in the top entry
of the location stack <i class="term">LS</i>.
Nothing happens if no such error is found.
Otherwise the found error is replaced by an error at the location
found on the stack, having the message <i class="arg">message</i>.</p></dd>
<dt><b class="cmd">ier_merge</b></dt>
<dd><p>This instruction pops an entry from the error stack <i class="term">ES</i>, merges
it with the current error status <i class="term">ER</i> and stores the result of
the merge as the new error status <i class="term">ER</i>.</p>
<p>The merge is performed as described below:</p>
<p>If one of the two error states is empty the other is chosen. If
neither error state is empty, and refering to different locations,
then the error state with the location further in the input is
chosen. If both error states refer to the same location their messages
are merged (with removing duplicates).</p></dd>
</dl>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">SEMANTIC VALUES</a></h3>
<p>The instructions in this section manipulate the semantic value
<i class="term">SV</i>.</p>
<dl class="definitions">
<dt><b class="cmd">isv_clear</b></dt>
<dd><p>This instruction clears the semantic value <i class="term">SV</i>.</p></dd>
<dt><b class="cmd">isv_terminal</b></dt>
<dd><p>This instruction creates a terminal AST node for the current token
<i class="term">CT</i>, makes it the semantic value <i class="term">SV</i>, and also pushes the
node on the AST stack <i class="term">AS</i>.</p></dd>
<dt><b class="cmd">isv_nonterminal_leaf</b> <i class="arg">nt</i></dt>
<dd><p>This instruction creates a nonterminal AST node without any children
for the nonterminal <i class="arg">nt</i>, and makes it the semantic value
<i class="term">SV</i>.</p>
<p>This instruction should be executed if, and only if the match status
<i class="term">OK</i> indicates a success.
In the case of a failure <b class="cmd">isv_clear</b> should be called.</p></dd>
<dt><b class="cmd">isv_nonterminal_range</b> <i class="arg">nt</i></dt>
<dd><p>This instruction creates a nonterminal AST node for the nonterminal
<i class="arg">nt</i>, with a single terminal node as its child, and makes this AST
the semantic value <i class="term">SV</i>. The terminal node refers to the input
string from the location found on top of the location stack <i class="term">LS</i>
to the current location <i class="term">CL</i> (both inclusive).</p>
<p>This instruction should be executed if, and only if the match status
<i class="term">OK</i> indicates a success.
In the case of a failure <b class="cmd">isv_clear</b> should be called.</p></dd>
<dt><b class="cmd">isv_nonterminal_reduce</b> <i class="arg">nt</i></dt>
<dd><p>This instruction creates a nonterminal AST node for the nonterminal
<i class="arg">nt</i> and makes it the semantic value <i class="term">SV</i>.</p>
<p>All entries on the AST stack <i class="term">AS</i> above the marker found in the
top entry of the AST Marker stack <i class="term">MS</i> become children of the new
node, with the entry at the stack top becoming the rightmost child. If
the AST Marker stack <i class="term">MS</i> is empty the whole stack is used. The
AST marker stack <i class="term">MS</i> is left unchanged.</p>
<p>This instruction should be executed if, and only if the match status
<i class="term">OK</i> indicates a success.
In the case of a failure <b class="cmd">isv_clear</b> should be called.</p></dd>
</dl>
</div>
<div id="subsection8" class="subsection"><h3><a name="subsection8">AST STACK HANDLING</a></h3>
<p>The instructions in this section manipulate the AST stack <i class="term">AS</i>,
and the AST Marker stack <i class="term">MS</i>.</p>
<dl class="definitions">
<dt><b class="cmd">ias_push</b></dt>
<dd><p>This instruction pushes the semantic value <i class="term">SV</i> on the AST stack
<i class="term">AS</i>.</p></dd>
<dt><b class="cmd">ias_mark</b></dt>
<dd><p>This instruction pushes a marker for the current state of the AST
stack <i class="term">AS</i> on the AST Marker stack <i class="term">MS</i>.</p></dd>
<dt><b class="cmd">ias_mrewind</b></dt>
<dd><p>This instruction pops an entry from the AST Marker stack <i class="term">MS</i> and
then proceeds to pop entries from the AST stack <i class="term">AS</i> until the
state represented by the popped marker has been reached again.
Nothing is done if the AST stack <i class="term">AS</i> is already smaller than
indicated by the popped marker.</p></dd>
<dt><b class="cmd">ias_mpop</b></dt>
<dd><p>This instruction pops an entry from the AST Marker stack <i class="term">MS</i> and
discards it.</p></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key25">virtual machine</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_peg/peg.html.

















































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::peg - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_peg/peg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::peg(n) 0.1 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::peg - Create and manipulate parsing expression grammars</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">TERMS &amp; CONCEPTS</a></li>
<li class="subsection"><a href="#subsection2">CONTAINER CLASS API</a></li>
<li class="subsection"><a href="#subsection3">CONTAINER OBJECT API</a></li>
<li class="subsection"><a href="#subsection4">PARSING EXPRESSIONS</a></li>
</ul>
</li>
<li class="section"><a href="#section2">PARSING EXPRESSION GRAMMARS</a></li>
<li class="section"><a href="#section3">REFERENCES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">grammar::peg <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::peg</b> <i class="arg">pegName</i> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">&lt;--</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">src</i>?</span></a></li>
<li><a href="#2"><i class="arg">pegName</i> <b class="method">destroy</b></a></li>
<li><a href="#3"><i class="arg">pegName</i> <b class="method">clear</b></a></li>
<li><a href="#4"><i class="arg">pegName</i> <b class="method">=</b> <i class="arg">srcPEG</i></a></li>
<li><a href="#5"><i class="arg">pegName</i> <b class="method">--&gt;</b> <i class="arg">dstPEG</i></a></li>
<li><a href="#6"><i class="arg">pegName</i> <b class="method">serialize</b></a></li>
<li><a href="#7"><i class="arg">pegName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></li>
<li><a href="#8"><i class="arg">pegName</i> <b class="method">is valid</b></a></li>
<li><a href="#9"><i class="arg">pegName</i> <b class="method">start</b> <span class="opt">?<i class="arg">pe</i>?</span></a></li>
<li><a href="#10"><i class="arg">pegName</i> <b class="method">nonterminals</b></a></li>
<li><a href="#11"><i class="arg">pegName</i> <b class="method">nonterminal add</b> <i class="arg">nt</i> <i class="arg">pe</i></a></li>
<li><a href="#12"><i class="arg">pegName</i> <b class="method">nonterminal delete</b> <i class="arg">nt1</i> <span class="opt">?<i class="arg">nt2</i> ...?</span></a></li>
<li><a href="#13"><i class="arg">pegName</i> <b class="method">nonterminal exists</b> <i class="arg">nt</i></a></li>
<li><a href="#14"><i class="arg">pegName</i> <b class="method">nonterminal rename</b> <i class="arg">nt</i> <i class="arg">ntnew</i></a></li>
<li><a href="#15"><i class="arg">pegName</i> <b class="method">nonterminal mode</b> <i class="arg">nt</i> <span class="opt">?<i class="arg">mode</i>?</span></a></li>
<li><a href="#16"><i class="arg">pegName</i> <b class="method">nonterminal rule</b> <i class="arg">nt</i></a></li>
<li><a href="#17"><i class="arg">pegName</i> <b class="method">unknown nonterminals</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a container class for
<i class="term">parsing expression grammars</i> (Short: PEG).
It allows the incremental definition of the grammar, its manipulation
and querying of the definition.
The package neither provides complex operations on the grammar, nor has
it the ability to execute a grammar definition for a stream of symbols.
Two packages related to this one are <b class="package">grammar::mengine</b> and
<b class="package">grammar::peg::interpreter</b>. The first of them defines a
general virtual machine for the matching of a character stream, and
the second implements an interpreter for parsing expression grammars
on top of that virtual machine.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">TERMS &amp; CONCEPTS</a></h3>
<p>PEGs are similar to context-free grammars, but not equivalent; in some
cases PEGs are strictly more powerful than context-free grammars (there
exist PEGs for some non-context-free languages).
The formal mathematical definition of parsing expressions and parsing
expression grammars can be found in section
<span class="sectref"><a href="#section2">PARSING EXPRESSION GRAMMARS</a></span>.</p>
<p>In short, we have <i class="term">terminal symbols</i>, which are the most basic
building blocks for <i class="term">sentences</i>, and <i class="term">nonterminal symbols</i>
with associated <i class="term">parsing expressions</i>, defining the grammatical
structure of the sentences. The two sets of symbols are distinctive,
and do not overlap. When speaking about symbols the word &quot;symbol&quot; is
often left out. The union of the sets of terminal and nonterminal
symbols is called the set of <i class="term">symbols</i>.</p>
<p>Here the set of <i class="term">terminal symbols</i> is not explicitly managed,
but implicitly defined as the set of all characters. Note that this
means that we inherit from Tcl the ability to handle all of Unicode.</p>
<p>A pair of <i class="term">nonterminal</i> and <i class="term"><a href="../../../../index.html#key14">parsing expression</a></i> is also
called a <i class="term">grammatical rule</i>, or <i class="term">rule</i> for short. In the
context of a rule the nonterminal is often called the left-hand-side
(LHS), and the parsing expression the right-hand-side (RHS).</p>
<p>The <i class="term">start expression</i> of a grammar is a parsing expression
from which all the sentences contained in the language specified by
the grammar are <i class="term">derived</i>.
To make the understanding of this term easier let us assume for a
moment that the RHS of each rule, and the start expression, is either
a sequence of symbols, or a series of alternate parsing expressions.
In the latter case the rule can be seen as a set of rules, each
providing one alternative for the nonterminal.
A parsing expression A' is now a derivation of a parsing expression A
if we pick one of the nonterminals N in the expression, and one of the
alternative rules R for N, and then replace the nonterminal in A with
the RHS of the chosen rule. Here we can see why the terminal symbols
are called such. They cannot be expanded any further, thus terminate
the process of deriving new expressions.
An example</p>
<pre class="example">
    Rules
      (1)  A &lt;- a B c
      (2a) B &lt;- d B
      (2b) B &lt;- e
    Some derivations, using starting expression A.
      A -/1/-&gt; a B c -/2a/-&gt; a d B c -/2b/-&gt; a d e c
</pre>
<p>A derived expression containing only terminal symbols is a
<i class="term">sentence</i>. The set of all sentences which can be derived from
the start expression is the <i class="term">language</i> of the grammar.</p>
<p>Some definitions for nonterminals and expressions:</p>
<ol class="enumerated">
<li><p>A nonterminal A is called <i class="term">reachable</i> if it is possible to derive
a parsing expression from the start expression which contains A.</p></li>
<li><p>A nonterminal A is called <i class="term">useful</i> if it is possible to derive a
sentence from it.</p></li>
<li><p>A nonterminal A is called <i class="term">recursive</i> if it is possible to derive
a parsing expression from it which contains A, again.</p></li>
<li><p>The <i class="term">FIRST set</i> of a nonterminal A contains all the symbols which
can occur of as the leftmost symbol in a parsing expression derived from
A. If the FIRST set contains A itself then that nonterminal is called
<i class="term">left-recursive</i>.</p></li>
<li><p>The <i class="term">LAST set</i> of a nonterminal A contains all the symbols which
can occur of as the rightmost symbol in a parsing expression derived from
A. If the LAST set contains A itself then that nonterminal is called
<i class="term">right-recursive</i>.</p></li>
<li><p>The <i class="term">FOLLOW set</i> of a nonterminal A contains all the symbols which
can occur after A in a parsing expression derived from the start
expression.</p></li>
<li><p>A nonterminal (or parsing expression) is called <i class="term">nullable</i> if the
empty sentence can be derived from it.</p></li>
</ol>
<p>And based on the above definitions for grammars:</p>
<ol class="enumerated">
<li><p>A grammar G is <i class="term">recursive</i> if and only if it contains a nonterminal
A which is recursive. The terms <i class="term">left-</i> and <i class="term">right-recursive</i>,
and <i class="term">useful</i> are analogously defined.</p></li>
<li><p>A grammar is <i class="term">minimal</i> if it contains only <i class="term">reachable</i> and
<i class="term">useful</i> nonterminals.</p></li>
<li><p>A grammar is <i class="term">wellformed</i> if it is not left-recursive. Such
grammars are also <i class="term">complete</i>, which means that they always succeed
or fail on all input sentences. For an incomplete grammar on the
other hand input sentences exist for which an attempt to match them
against the grammar will not terminate.</p></li>
<li><p>As we wish to allow ourselves to build a grammar incrementally in a
container object we will encounter stages where the RHS of one or more
rules reference symbols which are not yet known to the container. Such
a grammar we call <i class="term">invalid</i>.
We cannot use the term <i class="term">incomplete</i> as this term is already
taken, see the last item.</p></li>
</ol>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">CONTAINER CLASS API</a></h3>
<p>The package exports the API described here.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::peg</b> <i class="arg">pegName</i> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">&lt;--</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">src</i>?</span></a></dt>
<dd><p>The command creates a new container object for a parsing expression
grammar and returns the fully qualified name of the object command as
its result. The API the returned command is following is described in
the section <span class="sectref"><a href="#subsection3">CONTAINER OBJECT API</a></span>. It may be used to invoke
various operations on the container and the grammar within.</p>
<p>The new container, i.e. grammar will be empty if no <i class="arg">src</i> is
specified. Otherwise it will contain a copy of the grammar contained
in the <i class="arg">src</i>.
The <i class="arg">src</i> has to be a container object reference for all operators
except <b class="const">deserialize</b>.
The <b class="const">deserialize</b> operator requires <i class="arg">src</i> to be the
serialization of a parsing expression grammar instead.</p>
<p>An empty grammar has no nonterminal symbols, and the start expression
is the empty expression, i.e. epsilon. It is <i class="term">valid</i>, but not
<i class="term">useful</i>.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">CONTAINER OBJECT API</a></h3>
<p>All grammar container objects provide the following methods for the
manipulation of their contents:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">pegName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the grammar, including its storage space and associated
command.</p></dd>
<dt><a name="3"><i class="arg">pegName</i> <b class="method">clear</b></a></dt>
<dd><p>Clears out the definition of the grammar contained in <i class="arg">pegName</i>,
but does <em>not</em> destroy the object.</p></dd>
<dt><a name="4"><i class="arg">pegName</i> <b class="method">=</b> <i class="arg">srcPEG</i></a></dt>
<dd><p>Assigns the contents of the grammar contained in <i class="arg">srcPEG</i> to
<i class="arg">pegName</i>, overwriting any existing definition.
This is the assignment operator for grammars. It copies the grammar
contained in the grammar object <i class="arg">srcPEG</i> over the grammar
definition in <i class="arg">pegName</i>. The old contents of <i class="arg">pegName</i> are
deleted by this operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">pegName</i> <b class="method">deserialize</b> [<i class="arg">srcPEG</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="5"><i class="arg">pegName</i> <b class="method">--&gt;</b> <i class="arg">dstPEG</i></a></dt>
<dd><p>This is the reverse assignment operator for grammars. It copies the
automation contained in the object <i class="arg">pegName</i> over the grammar
definition in the object <i class="arg">dstPEG</i>.
The old contents of <i class="arg">dstPEG</i> are deleted by this operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">dstPEG</i> <b class="method">deserialize</b> [<i class="arg">pegName</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="6"><i class="arg">pegName</i> <b class="method">serialize</b></a></dt>
<dd><p>This method serializes the grammar stored in <i class="arg">pegName</i>. In other
words it returns a tcl <em>value</em> completely describing that
grammar.
This allows, for example, the transfer of grammars over arbitrary
channels, persistence, etc.
This method is also the basis for both the copy constructor and the
assignment operator.</p>
<p>The result of this method has to be semantically identical over all
implementations of the <b class="package">grammar::peg</b> interface. This is what
will enable us to copy grammars between different implementations of
the same interface.</p>
<p>The result is a list of four elements with the following structure:</p>
<ol class="enumerated">
<li><p>The constant string <b class="const">grammar::peg</b>.</p></li>
<li><p>A dictionary. Its keys are the names of all known nonterminal symbols,
and their associated values are the parsing expressions describing
their sentennial structure.</p></li>
<li><p>A dictionary. Its keys are the names of all known nonterminal symbols,
and their associated values hints to a matcher regarding the semantic
values produced by the symbol.</p></li>
<li><p>The last item is a parsing expression, the <i class="term">start expression</i>
of the grammar.</p></li>
</ol>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'
    Sign       &lt;- '+' / '-'
    Number     &lt;- Sign? Digit+
    Expression &lt;- '(' Expression ')' / (Factor (MulOp Factor)*)
    MulOp      &lt;- '*' / '/'
    Factor     &lt;- Term (AddOp Term)*
    AddOp      &lt;- '+'/'-'
    Term       &lt;- Number
</pre>
<p>a possible serialization is</p>
<pre class="example">
    grammar::peg \\
    {Expression {/ {x ( Expression )} {x Factor {* {x MulOp Factor}}}} \\
     Factor     {x Term {* {x AddOp Term}}} \\
     Term       Number \\
     MulOp      {/ * /} \\
     AddOp      {/ + -} \\
     Number     {x {? Sign} {+ Digit}} \\
     Sign       {/ + -} \\
     Digit      {/ 0 1 2 3 4 5 6 7 8 9} \\
    } \\
    {Expression value     Factor     value \\
     Term       value     MulOp      value \\
     AddOp      value     Number     value \\
     Sign       value     Digit      value \\
    }
    Expression
</pre>
<p>A possible one, because the order of the nonterminals in the
dictionary is not relevant.</p></dd>
<dt><a name="7"><i class="arg">pegName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></dt>
<dd><p>This is the complement to <b class="method">serialize</b>. It replaces the grammar
definition in <i class="arg">pegName</i> with the grammar described by the
<i class="arg">serialization</i> value. The old contents of <i class="arg">pegName</i> are
deleted by this operation.</p></dd>
<dt><a name="8"><i class="arg">pegName</i> <b class="method">is valid</b></a></dt>
<dd><p>A predicate. It tests whether the PEG in <i class="arg">pegName</i> is <i class="term">valid</i>.
See section <span class="sectref"><a href="#subsection1">TERMS &amp; CONCEPTS</a></span> for the definition of this
grammar property.
The result is a boolean value. It will be set to <b class="const">true</b> if
the PEG has the tested property, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="9"><i class="arg">pegName</i> <b class="method">start</b> <span class="opt">?<i class="arg">pe</i>?</span></a></dt>
<dd><p>This method defines the <i class="term">start expression</i> of the grammar. It
replaces the previously defined start expression with the parsing
expression <i class="arg">pe</i>.
The method fails and throws an error if <i class="arg">pe</i> does not contain a
valid parsing expression as specified in the section
<span class="sectref"><a href="#subsection4">PARSING EXPRESSIONS</a></span>. In that case the existing start
expression is not changed.
The method returns the empty string as its result.</p>
<p>If the method is called without an argument it will return the currently
defined start expression.</p></dd>
<dt><a name="10"><i class="arg">pegName</i> <b class="method">nonterminals</b></a></dt>
<dd><p>Returns the set of all nonterminal symbols known to the grammar.</p></dd>
<dt><a name="11"><i class="arg">pegName</i> <b class="method">nonterminal add</b> <i class="arg">nt</i> <i class="arg">pe</i></a></dt>
<dd><p>This method adds the nonterminal <i class="arg">nt</i> and its associated parsing
expression <i class="arg">pe</i> to the set of nonterminal symbols and rules of the
PEG contained in the object <i class="arg">pegName</i>.
The method fails and throws an error if either the string <i class="arg">nt</i> is
already known as a symbol of the grammar, or if <i class="arg">pe</i> does not
contain a valid parsing expression as specified in the section
<span class="sectref"><a href="#subsection4">PARSING EXPRESSIONS</a></span>. In that case the current set of
nonterminal symbols and rules is not changed.
The method returns the empty string as its result.</p></dd>
<dt><a name="12"><i class="arg">pegName</i> <b class="method">nonterminal delete</b> <i class="arg">nt1</i> <span class="opt">?<i class="arg">nt2</i> ...?</span></a></dt>
<dd><p>This method removes the named symbols <i class="arg">nt1</i>, <i class="arg">nt2</i> from the
set of nonterminal symbols of the PEG contained in the object
<i class="arg">pegName</i>.
The method fails and throws an error if any of the strings is not
known as a nonterminal symbol. In that case the current set of
nonterminal symbols is not changed.
The method returns the empty string as its result.</p>
<p>The stored grammar becomes invalid if the deleted nonterminals are
referenced by the RHS of still-known rules.</p></dd>
<dt><a name="13"><i class="arg">pegName</i> <b class="method">nonterminal exists</b> <i class="arg">nt</i></a></dt>
<dd><p>A predicate. It tests whether the nonterminal symbol <i class="arg">nt</i> is known
to the PEG in <i class="arg">pegName</i>.
The result is a boolean value. It will be set to <b class="const">true</b> if the
symbol <i class="arg">nt</i> is known, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="14"><i class="arg">pegName</i> <b class="method">nonterminal rename</b> <i class="arg">nt</i> <i class="arg">ntnew</i></a></dt>
<dd><p>This method renames the nonterminal symbol <i class="arg">nt</i> to <i class="arg">ntnew</i>.
The method fails and throws an error if either <i class="arg">nt</i> is not known
as a nonterminal, or if <i class="arg">ntnew</i> is a known symbol.
The method returns the empty string as its result.</p></dd>
<dt><a name="15"><i class="arg">pegName</i> <b class="method">nonterminal mode</b> <i class="arg">nt</i> <span class="opt">?<i class="arg">mode</i>?</span></a></dt>
<dd><p>This mode returns or sets the semantic mode associated with the
nonterminal symbol <i class="arg">nt</i>. If no <i class="arg">mode</i> is specified the
current mode of the nonterminal is returned. Otherwise the current
mode is set to <i class="arg">mode</i>.
The method fails and throws an error if <i class="arg">nt</i> is not known as a
nonterminal.
The grammar interpreter implemented by the package
<b class="package">grammar::peg::interpreter</b> recognizes the
following modes:</p>
<dl class="definitions">
<dt>value</dt>
<dd><p>The semantic value of the nonterminal is the abstract syntax tree
created from the AST's of the RHS and a node for the nonterminal
itself.</p></dd>
<dt>match</dt>
<dd><p>The semantic value of the nonterminal is an the abstract syntax tree
consisting of single a node for the string matched by the RHS. The ASTs
generated by the RHS are discarded.</p></dd>
<dt>leaf</dt>
<dd><p>The semantic value of the nonterminal is an the abstract syntax tree
consisting of single a node for the nonterminal itself. The ASTs
generated by the RHS are discarded.</p></dd>
<dt>discard</dt>
<dd><p>The nonterminal has no semantic value. The ASTs generated by the RHS
are discarded (as well).</p></dd>
</dl></dd>
<dt><a name="16"><i class="arg">pegName</i> <b class="method">nonterminal rule</b> <i class="arg">nt</i></a></dt>
<dd><p>This method returns the parsing expression associated with the
nonterminal <i class="arg">nt</i>.
The method fails and throws an error if <i class="arg">nt</i> is not known as a
nonterminal.</p></dd>
<dt><a name="17"><i class="arg">pegName</i> <b class="method">unknown nonterminals</b></a></dt>
<dd><p>This method returns a list containing the names of all nonterminal
symbols which are referenced on the RHS of a grammatical rule, but
have no rule definining their structure. In other words, a list of
the nonterminal symbols which make the grammar invalid. The grammar
is valid if this list is empty.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">PARSING EXPRESSIONS</a></h3>
<p>Various methods of PEG container objects expect a parsing expression
as their argument, or will return such. This section specifies the
format such parsing expressions are in.</p>
<ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any alphanumeric character.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any alphabetical character.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol>
<p>Examples of parsing expressions where already shown, in the
description of the method <b class="method">serialize</b>.</p>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">PARSING EXPRESSION GRAMMARS</a></h2>
<p>For the mathematically inclined, a PEG is a 4-tuple (VN,VT,R,eS) where</p>
<ul class="itemized">
<li><p>VN is a set of <i class="term">nonterminal symbols</i>,</p></li>
<li><p>VT is a set of <i class="term">terminal symbols</i>,</p></li>
<li><p>R is a finite set of rules, where each rule is a pair (A,e), A in VN,
and <i class="term"><a href="../../../../index.html#key744">e</a></i> a <i class="term"><a href="../../../../index.html#key14">parsing expression</a></i>.</p></li>
<li><p>eS is a parsing expression, the <i class="term">start expression</i>.</p></li>
</ul>
<p>Further constraints are</p>
<ul class="itemized">
<li><p>The intersection of VN and VT is empty.</p></li>
<li><p>For all A in VT exists exactly one pair (A,e) in R. In other words, R
is a function from nonterminal symbols to parsing expressions.</p></li>
</ul>
<p>Parsing expression are inductively defined via</p>
<ul class="itemized">
<li><p>The empty string (epsilon) is a parsing expression.</p></li>
<li><p>A terminal symbol <i class="term">a</i> is a parsing expression.</p></li>
<li><p>A nonterminal symbol <i class="term">A</i> is a parsing expression.</p></li>
<li><p><i class="term">e1</i><i class="term">e2</i> is a parsing expression for parsing expressions
<i class="term">e1</i> and <i class="term">2</i>. This is called <i class="term">sequence</i>.</p></li>
<li><p><i class="term">e1</i>/<i class="term">e2</i> is a parsing expression for parsing expressions
<i class="term">e1</i> and <i class="term">2</i>. This is called <i class="term">ordered choice</i>.</p></li>
<li><p><i class="term"><a href="../../../../index.html#key744">e</a></i>* is a parsing expression for parsing expression
<i class="term"><a href="../../../../index.html#key744">e</a></i>. This is called <i class="term">zero-or-more repetitions</i>, also known
as <i class="term">kleene closure</i>.</p></li>
<li><p><i class="term"><a href="../../../../index.html#key744">e</a></i>+ is a parsing expression for parsing expression
<i class="term"><a href="../../../../index.html#key744">e</a></i>. This is called <i class="term">one-or-more repetitions</i>, also known
as <i class="term">positive kleene closure</i>.</p></li>
<li><p>!<i class="term"><a href="../../../../index.html#key744">e</a></i> is a parsing expression for parsing expression
<i class="term">e1</i>. This is called a <i class="term">not lookahead predicate</i>.</p></li>
<li><p>&amp;<i class="term"><a href="../../../../index.html#key744">e</a></i> is a parsing expression for parsing expression
<i class="term">e1</i>. This is called an <i class="term">and lookahead predicate</i>.</p></li>
</ul>
<p>PEGs are used to define a grammatical structure for streams of symbols
over VT. They are a modern phrasing of older formalisms invented by
Alexander Birham. These formalisms were called TS (TMG recognition
scheme), and gTS (generalized TS). Later they were renamed to TPDL
(Top-Down Parsing Languages) and gTPDL (generalized TPDL).</p>
<p>They can be easily implemented by recursive descent parsers with
backtracking. This makes them relatives of LL(k) Context-Free
Grammars.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">REFERENCES</a></h2>
<ol class="enumerated">
<li><p><a href="http://www.pdos.lcs.mit.edu/~baford/packrat/">The Packrat Parsing and Parsing Expression Grammars Page</a>,
by Bryan Ford, Massachusetts Institute of Technology. This is the main
entry page to PEGs, and their realization through Packrat Parsers.</p></li>
<li><p><a href="http://www.cs.vu.nl/~dick/PTAPG.html">Parsing Techniques - A Practical Guide </a>, an online book
offering a clear, accessible, and thorough discussion of many
different parsing techniques with their interrelations and
applicabilities, including error recovery techniques.</p></li>
<li><p><a href="http://scifac.ru.ac.za/compilers/">Compilers and Compiler Generators</a>, an online book using
CoCo/R, a generator for recursive descent parsers.</p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_peg</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/grammar_peg/peg_interp.html.





















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>grammar::peg::interp - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/grammar_peg/peg_interp.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005-2011 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ grammar::peg::interp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">grammar::peg::interp(n) 0.1.1 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>grammar::peg::interp - Interpreter for parsing expression grammars</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">THE INTERPRETER API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">grammar::mengine <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">grammar::peg::interp <span class="opt">?0.1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::grammar::peg::interp::setup</b> <i class="arg">peg</i></a></li>
<li><a href="#2"><b class="cmd">::grammar::peg::interp::parse</b> <i class="arg">nextcmd</i> <i class="arg">errorvar</i> <i class="arg">astvar</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands for the controlled matching of a
character stream via a parsing expression grammar and the creation
of an abstract syntax tree for the stream and partials.</p>
<p>It is built on top of the virtual machine provided by the package
<b class="package"><a href="../grammar_me/me_tcl.html">grammar::me::tcl</a></b> and directly interprets the parsing
expression grammar given to it.
In other words, the grammar is <em>not</em> pre-compiled but used as is.</p>
<p>The grammar to be interpreted is taken from a container object
following the interface specified by the package
<b class="package">grammar::peg::container</b>. Only the relevant parts
are copied into the state of this package.</p>
<p>It should be noted that the package provides exactly one instance
of the interpreter, and interpreting a second grammar requires
the user to either abort or complete a running interpretation, or
to put them into different Tcl interpreters.</p>
<p>Also of note is that the implementation assumes a pull-type
handling of the input. In other words, the interpreter pulls
characters from the input stream as it needs them. For usage
in a push environment, i.e. where the environment pushes new
characters as they come we have to put the engine into its
own thread.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">THE INTERPRETER API</a></h2>
<p>The package exports the following API</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::grammar::peg::interp::setup</b> <i class="arg">peg</i></a></dt>
<dd><p>This command (re)initializes the interpreter. It returns the
empty string. This command has to be invoked first, before any
matching run.</p>
<p>Its argument <i class="arg">peg</i> is the handle of an object containing the
parsing expression grammar to interpret. This grammar has to be
valid, or an error will be thrown.</p></dd>
<dt><a name="2"><b class="cmd">::grammar::peg::interp::parse</b> <i class="arg">nextcmd</i> <i class="arg">errorvar</i> <i class="arg">astvar</i></a></dt>
<dd><p>This command interprets the loaded grammar and tries to match it
against the stream of characters represented by the command prefix
<i class="arg">nextcmd</i>.</p>
<p>The command prefix <i class="arg">nextcmd</i> represents the input stream of
characters and is invoked by the interpreter whenever the a new
character from the stream is required.
The callback has to return either the empty list, or a list of 4
elements containing the token, its lexeme attribute, and its location
as line number and column index, in this order.
The empty list is the signal that the end of the input stream has been
reached. The lexeme attribute is stored in the terminal cache, but
otherwise not used by the machine.</p>
<p>The result of the command is a boolean value indicating whether the
matching process was successful (<b class="const">true</b>), or not
(<b class="const">false</b>). In the case of a match failure error information will
be stored into the variable referenced by <i class="arg">errorvar</i>. The variable
referenced by <i class="arg">astvar</i> will always contain the generated abstract
syntax tree, however in the case of an error it will be only partial
and possibly malformed.</p>
<p>The abstract syntax tree is represented by a nested list, as
described in section <b class="sectref">AST VALUES</b> of
document <i class="term"><a href="../grammar_me/me_ast.html">grammar::me_ast</a></i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_peg</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a>, <a href="../../../../index.html#key25">virtual machine</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005-2011 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/hook/hook.html.
































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>hook - Hooks</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/hook/hook.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2010, by William H. Duquette
   -->
<! -- CVS: $Id$ hook.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">hook(n) 0.1 tcllib &quot;Hooks&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>hook - Hooks</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Concepts</a>
<ul>
<li class="subsection"><a href="#subsection1">Introduction</a></li>
<li class="subsection"><a href="#subsection2">Bindings</a></li>
<li class="subsection"><a href="#subsection3">Subjects and observers</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Reference</a></li>
<li class="section"><a href="#section4">Example</a></li>
<li class="section"><a href="#section5">Credits</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">hook <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">hook</b> <b class="method">bind</b> <span class="opt">?<i class="arg">subject</i>?</span> <span class="opt">?<i class="arg">hook</i>?</span> <span class="opt">?<i class="arg">observer</i>?</span> <span class="opt">?<i class="arg">cmdPrefix</i>?</span></a></li>
<li><a href="#2"><b class="cmd">hook</b> <b class="method">call</b> <i class="arg">subject</i> <i class="arg">hook</i> <span class="opt">?<i class="arg">args</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">hook</b> <b class="method">forget</b> <i class="arg">object</i></a></li>
<li><a href="#4"><b class="cmd">hook</b> <b class="method">cget</b> <i class="arg">option</i></a></li>
<li><a href="#5"><b class="cmd">hook</b> <b class="method">configure</b> <b class="option">option</b> <i class="arg">value</i> ...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides the <b class="cmd">hook</b> ensemble command, which
implements the Subject/Observer pattern. It allows <i class="term">subjects</i>,
which may be <i class="term">modules</i>, <i class="term">objects</i>, <i class="term">widgets</i>, and so
forth, to synchronously call <i class="term">hooks</i> which may be bound to an
arbitrary number of subscribers, called <i class="term">observers</i>. A subject
may call any number of distinct hooks, and any number of observers can
bind callbacks to a particular hook called by a particular
subject. Hook bindings can be queried and deleted.</p>
<p>This man page is intended to be a reference only.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Concepts</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Introduction</a></h3>
<p>Tcl modules usually send notifications to other modules in two ways:
via Tk events, and via callback options like the text widget's
<b class="option">-yscrollcommand</b> option. Tk events are available only in Tk,
and callback options require tight coupling between the modules
sending and receiving the notification.</p>
<p>Loose coupling between sender and receiver is often desirable,
however.  In Model/View/Controller terms, a View can send a command
(stemming from user input) to the Controller, which updates the
Model. The Model can then call a hook <em>to which all relevant
Views subscribe.</em> The Model is decoupled from the Views, and indeed
need not know whether any Views actually exist.
At present, Tcl/Tk has no standard mechanism for implementing loose
coupling of this kind. This package defines a new command, <b class="cmd">hook</b>,
which implements just such a mechanism.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Bindings</a></h3>
<p>The <b class="cmd">hook</b> command manages a collection of hook bindings. A hook
binding has four elements:</p>
<ol class="enumerated">
<li><p>A <i class="term"><a href="../../../../index.html#key631">subject</a></i>: the name of the entity that will be calling the
hook.</p></li>
<li><p>The <i class="term"><a href="../../../../index.html#key632">hook</a></i> itself. A hook usually reflects some occurrence in the
life of the <i class="term"><a href="../../../../index.html#key631">subject</a></i> that other entities might care to know
about. A <i class="term"><a href="../../../../index.html#key632">hook</a></i> has a name, and may also have arguments. Hook
names are arbitrary strings. Each <i class="term"><a href="../../../../index.html#key631">subject</a></i> must document the
names and arguments of the hooks it can call.</p></li>
<li><p>The name of the <i class="term"><a href="../../../../index.html#key600">observer</a></i> that wishes to receive the <i class="term"><a href="../../../../index.html#key632">hook</a></i>
from the <i class="term"><a href="../../../../index.html#key631">subject</a></i>.</p></li>
<li><p>A command prefix to which the <i class="term"><a href="../../../../index.html#key632">hook</a></i> arguments will be appended 
when the binding is executed.</p></li>
</ol>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Subjects and observers</a></h3>
<p>For convenience, this document collectively refers to subjects and
observers as <i class="term">objects</i>, while placing no requirements on how
these <i class="term">objects</i> are actually implemented. An object can be a
<b class="package"><a href="../../../../index.html#key706">TclOO</a></b> or <b class="package"><a href="../../../../index.html#key734">Snit</a></b> or <b class="package">XOTcl</b> object, a Tcl
command, a namespace, a module, a pseudo-object managed by some other
object (as tags are managed by the Tk text widget) or simply a
well-known name.</p>
<p>Subject and observer names are arbitrary strings; however, as
<b class="cmd">hook</b> might be used at the package level, it's necessary to have
conventions that avoid name collisions between packages written by
different people.</p>
<p>Therefore, any subject or observer name used in core or package level
code should look like a Tcl command name, and should be defined in a
namespace owned by the package. Consider, for example, an ensemble
command <b class="cmd">::foo</b> that creates a set of pseudo-objects and uses
<b class="package">hook</b> to send notifications. The pseudo-objects have names
that are not commands and exist in their own namespace, rather like
file handles do. To avoid name collisions with subjects defined by
other packages, users of <b class="package">hook</b>, these <b class="cmd">::foo</b> handles
should have names like <b class="const">::foo::1</b>, <b class="const">::foo::2</b>, and so on.</p>
<p>Because object names are arbitrary strings, application code can use
whatever additional conventions are dictated by the needs of the
application.</p>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Reference</a></h2>
<p>Hook provides the following commands:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">hook</b> <b class="method">bind</b> <span class="opt">?<i class="arg">subject</i>?</span> <span class="opt">?<i class="arg">hook</i>?</span> <span class="opt">?<i class="arg">observer</i>?</span> <span class="opt">?<i class="arg">cmdPrefix</i>?</span></a></dt>
<dd><p>This subcommand is used to create, update, delete, and query hook
bindings.</p>
<p>Called with no arguments it returns a list of the subjects with
hooks to which observers are currently bound.</p>
<p>Called with one argument, a <i class="arg">subject</i>, it returns a list of
the subject's hooks to which observers are currently bound.</p>
<p>Called with two arguments, a <i class="arg">subject</i> and a <i class="arg">hook</i>, it
returns a list of the observers which are currently bound to this
<i class="arg">subject</i> and <i class="arg">hook</i>.</p>
<p>Called with three arguments, a <i class="arg">subject</i>, a <i class="arg">hook</i>, and
an <i class="arg">observer</i>, it returns the binding proper, the command prefix
to be called when the hook is called, or the empty string if there is
no such binding.</p>
<p>Called with four arguments, it creates, updates, or deletes a
binding. If <i class="arg">cmdPrefix</i> is the empty string, it deletes any
existing binding for the <i class="arg">subject</i>, <i class="arg">hook</i>, and
<i class="arg">observer</i>; nothing is returned. Otherwise, <i class="arg">cmdPrefix</i> must
be a command prefix taking as many additional arguments as are
documented for the <i class="arg">subject</i> and <i class="arg">hook</i>. The binding is added
or updated, and the observer is returned.</p>
<p>If the <i class="arg">observer</i> is the empty string, &quot;&quot;, it will create a
new binding using an automatically generated observer name of the form
<b class="const">::hook::ob</b>&lt;<b class="variable">number</b>&gt;. The automatically generated name
will be returned, and can be used to query, update, and delete the
binding as usual. If automated observer names are always used, the
observer name effectively becomes a unique binding ID.</p>
<p>It is possible to call <b class="cmd">hook bind</b> to create or delete a
binding to a <i class="arg">subject</i> and <i class="arg">hook</i> while in an observer binding
for that same <i class="arg">subject</i> and <i class="arg">hook</i>. The following rules
determine what happens when</p>
<pre class="example">
    hook bind $s $h $o $binding
</pre>
<p>is called during the execution of</p>
<pre class="example">
    hook call $s $h
</pre>
<ol class="enumerated">
<li><p>No binding is ever called after it is deleted.</p></li>
<li><p>When a binding is called, the most recently given command prefix is
always used.</p></li>
<li><p>The set of observers whose bindings are to be called is determined
when this method begins to execute, and does not change thereafter,
except that deleted bindings are not called.</p></li>
</ol>
<p>In particular:</p>
<ol class="enumerated">
<li><p>If <b class="variable">$o</b>s binding to <b class="variable">$s</b> and <b class="variable">$h</b> is deleted, and
<b class="variable">$o</b>s binding has not yet been called during this execution of</p>
<pre class="example">
    hook call $s $h
</pre>
<p>it will not be called. (Note that it might already have been called;
and in all likelihood, it is probably deleting itself.)</p></li>
<li><p>If <b class="variable">$o</b> changes the command prefix that's bound to <b class="variable">$s</b> and
<b class="variable">$h</b>, and if <b class="variable">$o</b>s binding has not yet been called during
this execution of</p>
<pre class="example">
    hook call $s $h
</pre>
<p>the new binding will be called when the time comes. (But again, it is
probably <b class="variable">$o</b>s binding that is is making the change.)</p></li>
<li><p>If a new observer is bound to <b class="variable">$s</b> and <b class="variable">$h</b>, its binding will
not be called until the next invocation of</p>
<pre class="example">
    hook call $s $h
</pre>
</li>
</ol></dd>
<dt><a name="2"><b class="cmd">hook</b> <b class="method">call</b> <i class="arg">subject</i> <i class="arg">hook</i> <span class="opt">?<i class="arg">args</i>...?</span></a></dt>
<dd><p>This command is called when the named <i class="arg">subject</i> wishes to call the
named <i class="arg">hook</i>. All relevant bindings are called with the specified
arguments in the global namespace. Note that the bindings are called
synchronously, before the command returns; this allows the <i class="arg">args</i>
to include references to entities that will be cleaned up as soon as
the hook has been called.</p>
<p>The order in which the bindings are called is not guaranteed. If
sequence among observers must be preserved, define one observer and
have its bindings call the other callbacks directly in the proper
sequence.</p>
<p>Because the <b class="cmd">hook</b> mechanism is intended to support loose
coupling, it is presumed that the <i class="arg">subject</i> has no knowledge of
the observers, nor any expectation regarding return values. This has a
number of implications:</p>
<ol class="enumerated">
<li><p><b class="cmd">hook call</b> returns the empty string.</p></li>
<li><p>Normal return values from observer bindings are ignored.</p></li>
<li><p>Errors and other exceptional returns propagate normally by
default. This will rarely be what is wanted, because the subjects
usually have no knowledge of the observers and will therefore have no
particular competence at handling their errors. That makes it an
application issue, and so applications will usually want to define an
<b class="option">-errorcommand</b>.</p></li>
</ol>
<p>If the <b class="option">-errorcommand</b> configuration option has a non-empty
value, its value will be invoked for all errors and other exceptional
returns in observer bindings. See <b class="cmd">hook configure</b>, below, for
more information on configuration options.</p></dd>
<dt><a name="3"><b class="cmd">hook</b> <b class="method">forget</b> <i class="arg">object</i></a></dt>
<dd><p>This command deletes any existing bindings in which the named
<i class="arg">object</i> appears as either the <i class="term"><a href="../../../../index.html#key631">subject</a></i> or the
<i class="term"><a href="../../../../index.html#key600">observer</a></i>.
Bindings deleted by this method will never be called again. In
particular,</p>
<ol class="enumerated">
<li><p>If an observer is forgotten during a call to <b class="cmd">hook call</b>, any
uncalled binding it might have had to the relevant subject and hook
will <em>not</em> be called subsequently.</p></li>
<li><p>If a subject <b class="variable">$s</b> is forgotten during a call to</p>
<pre class="example">hook call $s $h</pre>
<p>then <b class="cmd">hook call</b> will return as soon as the current binding
returns.  No further bindings will be called.</p></li>
</ol></dd>
<dt><a name="4"><b class="cmd">hook</b> <b class="method">cget</b> <i class="arg">option</i></a></dt>
<dd><p>This command returns the value of one of the <b class="cmd">hook</b> command's
configuration options.</p></dd>
<dt><a name="5"><b class="cmd">hook</b> <b class="method">configure</b> <b class="option">option</b> <i class="arg">value</i> ...</a></dt>
<dd><p>This command sets the value of one or more of the <b class="cmd">hook</b> command's
configuration options:</p>
<dl class="options">
<dt><b class="option">-errorcommand</b> <i class="arg">cmdPrefix</i></dt>
<dd><p>If the value of this option is the empty string, &quot;&quot;, then errors 
and other exception returns in binding scripts are propagated 
normally. Otherwise, it must be a command prefix taking three 
additional arguments:</p>
<ol class="enumerated">
<li><p>a 4-element list {subject hook arglist observer},</p></li>
<li><p>the result string, and</p></li>
<li><p>the return options dictionary.</p></li>
</ol>
<p>Given this information, the <b class="option">-errorcommand</b> can choose to log
the error, call <b class="cmd">interp bgerror</b>, delete the errant binding
(thus preventing the error from arising a second time) and so forth.</p></dd>
<dt><b class="option">-tracecommand</b> <i class="arg">cmdPrefix</i></dt>
<dd><p>The option's value should be a command prefix taking four 
arguments:</p>
<ol class="enumerated">
<li><p>a <i class="term"><a href="../../../../index.html#key631">subject</a></i>,</p></li>
<li><p>a <i class="term"><a href="../../../../index.html#key632">hook</a></i>,</p></li>
<li><p>a list of the hook's argument values, and</p></li>
<li><p>a list of <i class="term">objects</i> the hook was called for.</p></li>
</ol>
<p>The command will be called for each hook that is called. This allows
the application to trace hook execution for debugging purposes.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Example</a></h2>
<p>The <b class="cmd">::model</b> module calls the &lt;Update&gt; hook in response to
commands that change the model's data:</p>
<pre class="example">
     hook call ::model &lt;Update&gt;
</pre>
<p>The <b class="widget">.view</b> megawidget displays the model state, and needs to
know about model updates. Consequently, it subscribes to the ::model's
&lt;Update&gt; hook.</p>
<pre class="example">
     hook bind ::model &lt;Update&gt; .view [list .view ModelUpdate]
</pre>
<p>When the <b class="cmd">::model</b> calls the hook, the <b class="widget">.view</b>s
ModelUpdate subcommand will be called.</p>
<p>Later the <b class="widget">.view</b> megawidget is destroyed. In its destructor,
it tells the <i class="term"><a href="../../../../index.html#key632">hook</a></i> that it no longer exists:</p>
<pre class="example">
     hook forget .view
</pre>
<p>All bindings involving <b class="widget">.view</b> are deleted.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">Credits</a></h2>
<p>Hook has been designed and implemented by William H. Duquette.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>hook</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../uev/uevent.html">uevent(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key494">callback</a>, <a href="../../../../index.html#key496">event</a>, <a href="../../../../index.html#key632">hook</a>, <a href="../../../../index.html#key600">observer</a>, <a href="../../../../index.html#key630">producer</a>, <a href="../../../../index.html#key633">publisher</a>, <a href="../../../../index.html#key631">subject</a>, <a href="../../../../index.html#key629">subscriber</a>, <a href="../../../../index.html#key634">uevent</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2010, by William H. Duquette</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/html/html.html.













































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>html - HTML Generation</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/html/html.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ html.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">html(n) 1.4 tcllib &quot;HTML Generation&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>html - Procedures to generate HTML structures</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">html <span class="opt">?1.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::html::author</b> <i class="arg">author</i></a></li>
<li><a href="#2"><b class="cmd">::html::bodyTag</b> <i class="arg">args</i></a></li>
<li><a href="#3"><b class="cmd">::html::cell</b> <i class="arg">param value</i> <span class="opt">?<i class="arg">tag</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::html::checkbox</b> <i class="arg">name value</i></a></li>
<li><a href="#5"><b class="cmd">::html::checkSet</b> <i class="arg">key sep list</i></a></li>
<li><a href="#6"><b class="cmd">::html::checkValue</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::html::closeTag</b></a></li>
<li><a href="#8"><b class="cmd">::html::default</b> <i class="arg">key</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#9"><b class="cmd">::html::description</b> <i class="arg">description</i></a></li>
<li><a href="#10"><b class="cmd">::html::end</b></a></li>
<li><a href="#11"><b class="cmd">::html::eval</b> <i class="arg">arg</i> <span class="opt">?<i class="arg">args</i>?</span></a></li>
<li><a href="#12"><b class="cmd">::html::extractParam</b> <i class="arg">param key</i> <span class="opt">?<i class="arg">varName</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::html::font</b> <i class="arg">args</i></a></li>
<li><a href="#14"><b class="cmd">::html::for</b> <i class="arg">start test next body</i></a></li>
<li><a href="#15"><b class="cmd">::html::foreach</b> <i class="arg">varlist1 list1</i> <span class="opt">?<i class="arg">varlist2 list2 ...</i>?</span> <i class="arg">body</i></a></li>
<li><a href="#16"><b class="cmd">::html::formValue</b> <i class="arg">name</i> <span class="opt">?<i class="arg">defvalue</i>?</span></a></li>
<li><a href="#17"><b class="cmd">::html::getFormInfo</b> <i class="arg">args</i></a></li>
<li><a href="#18"><b class="cmd">::html::getTitle</b></a></li>
<li><a href="#19"><b class="cmd">::html::h</b> <i class="arg">level string</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#20"><b class="cmd">::html::h1</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#21"><b class="cmd">::html::h2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#22"><b class="cmd">::html::h3</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#23"><b class="cmd">::html::h4</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#24"><b class="cmd">::html::h5</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#25"><b class="cmd">::html::h6</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#26"><b class="cmd">::html::hdrRow</b> <i class="arg">args</i></a></li>
<li><a href="#27"><b class="cmd">::html::head</b> <i class="arg">title</i></a></li>
<li><a href="#28"><b class="cmd">::html::headTag</b> <i class="arg">string</i></a></li>
<li><a href="#29"><b class="cmd">::html::html_entities</b> <i class="arg">string</i></a></li>
<li><a href="#30"><b class="cmd">::html::if</b> <i class="arg">expr1 body1</i> <span class="opt">?<b class="const">elseif</b> <i class="arg">expr2 body2 ...</i>?</span> <span class="opt">?<b class="const">else</b> <i class="arg">bodyN</i>?</span></a></li>
<li><a href="#31"><b class="cmd">::html::init</b> <span class="opt">?<i class="arg">list</i>?</span></a></li>
<li><a href="#32"><b class="cmd">::html::keywords</b> <i class="arg">args</i></a></li>
<li><a href="#33"><b class="cmd">::html::mailto</b> <i class="arg">email</i> <span class="opt">?<i class="arg">subject</i>?</span></a></li>
<li><a href="#34"><b class="cmd">::html::meta</b> <i class="arg">args</i></a></li>
<li><a href="#35"><b class="cmd">::html::minorList</b> <i class="arg">list</i> <span class="opt">?<i class="arg">ordered</i>?</span></a></li>
<li><a href="#36"><b class="cmd">::html::minorMenu</b> <i class="arg">list</i> <span class="opt">?<i class="arg">sep</i>?</span></a></li>
<li><a href="#37"><b class="cmd">::html::nl2br</b> <i class="arg">string</i></a></li>
<li><a href="#38"><b class="cmd">::html::openTag</b> <i class="arg">tag</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#39"><b class="cmd">::html::paramRow</b> <i class="arg">list</i> <span class="opt">?<i class="arg">rparam</i>?</span> <span class="opt">?<i class="arg">cparam</i>?</span></a></li>
<li><a href="#40"><b class="cmd">::html::passwordInput</b> <span class="opt">?<i class="arg">name</i>?</span></a></li>
<li><a href="#41"><b class="cmd">::html::passwordInputRow</b> <i class="arg">label</i> <span class="opt">?<i class="arg">name</i>?</span></a></li>
<li><a href="#42"><b class="cmd">::html::quoteFormValue</b> <i class="arg">value</i></a></li>
<li><a href="#43"><b class="cmd">::html::radioSet</b> <i class="arg">key sep list</i></a></li>
<li><a href="#44"><b class="cmd">::html::radioValue</b> <i class="arg">name value</i></a></li>
<li><a href="#45"><b class="cmd">::html::refresh</b> <i class="arg">seconds url</i></a></li>
<li><a href="#46"><b class="cmd">::html::row</b> <i class="arg">args</i></a></li>
<li><a href="#47"><b class="cmd">::html::select</b> <i class="arg">name param choices</i> <span class="opt">?<i class="arg">current</i>?</span></a></li>
<li><a href="#48"><b class="cmd">::html::selectPlain</b> <i class="arg">name param choices</i> <span class="opt">?<i class="arg">current</i>?</span></a></li>
<li><a href="#49"><b class="cmd">::html::set</b> <i class="arg">var val</i></a></li>
<li><a href="#50"><b class="cmd">::html::submit</b> <i class="arg">label</i> <span class="opt">?<i class="arg">name</i>?</span></a></li>
<li><a href="#51"><b class="cmd">::html::tableFromArray</b> <i class="arg">arrname</i> <span class="opt">?<i class="arg">param</i>?</span> <span class="opt">?<i class="arg">pat</i>?</span></a></li>
<li><a href="#52"><b class="cmd">::html::tableFromList</b> <i class="arg">querylist</i> <span class="opt">?<i class="arg">param</i>?</span></a></li>
<li><a href="#53"><b class="cmd">::html::textarea</b> <i class="arg">name</i> <span class="opt">?<i class="arg">param</i>?</span> <span class="opt">?<i class="arg">current</i>?</span></a></li>
<li><a href="#54"><b class="cmd">::html::textInput</b> <i class="arg">name value args</i></a></li>
<li><a href="#55"><b class="cmd">::html::textInputRow</b> <i class="arg">label name value args</i></a></li>
<li><a href="#56"><b class="cmd">::html::varEmpty</b> <i class="arg">name</i></a></li>
<li><a href="#57"><b class="cmd">::html::while</b> <i class="arg">test body</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">html</b> provides commands that generate HTML.
These commands typically return an HTML string as their result. In
particular, they do not output their result to <b class="const">stdout</b>.</p>
<p>The command <b class="cmd">::html::init</b> should be called early to initialize
the module.  You can also use this procedure to define default values
for HTML tag parameters.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::html::author</b> <i class="arg">author</i></a></dt>
<dd><p><em>Side effect only</em>.  Call this before <b class="cmd">::html::head</b> to
define an author for the page.  The author is noted in a comment in
the HEAD section.</p></dd>
<dt><a name="2"><b class="cmd">::html::bodyTag</b> <i class="arg">args</i></a></dt>
<dd><p>Generate a <i class="term">body</i> tag.  The tag parameters are taken from <i class="arg">args</i> or
from the body.* attributes define with <b class="cmd">::html::init</b>.</p></dd>
<dt><a name="3"><b class="cmd">::html::cell</b> <i class="arg">param value</i> <span class="opt">?<i class="arg">tag</i>?</span></a></dt>
<dd><p>Generate a <i class="term">td</i> (or <i class="term">th</i>) tag, a value, and a closing
<i class="term">td</i> (or <i class="term">th</i>) tag. The
tag parameters come from <i class="arg">param</i> or TD.* attributes defined with
<b class="cmd">::html::init</b>.  This uses <b class="cmd">::html::font</b> to insert a standard
<i class="term">font</i> tag into the table cell. The <i class="arg">tag</i> argument defaults to &quot;td&quot;.</p></dd>
<dt><a name="4"><b class="cmd">::html::checkbox</b> <i class="arg">name value</i></a></dt>
<dd><p>Generate a <i class="term"><a href="../../../../index.html#key570">checkbox</a></i> form element with the specified name and value.
This uses <b class="cmd">::html::checkValue</b>.</p></dd>
<dt><a name="5"><b class="cmd">::html::checkSet</b> <i class="arg">key sep list</i></a></dt>
<dd><p>Generate a set of <i class="term"><a href="../../../../index.html#key570">checkbox</a></i> form elements and associated labels.  The
<i class="arg">list</i> should contain an alternating list of labels and values.
This uses <b class="cmd">::html::checkbox</b>. All the <i class="term"><a href="../../../../index.html#key570">checkbox</a></i> buttons share the
same <i class="arg">key</i> for their name. The <i class="arg">sep</i> is text used to separate
the elements.</p></dd>
<dt><a name="6"><b class="cmd">::html::checkValue</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Generate the &quot;name=<i class="arg">name</i> value=<i class="arg">value</i> for a <i class="term"><a href="../../../../index.html#key570">checkbox</a></i> form
element.  If the CGI variable <i class="arg">name</i> has the value <i class="arg">value</i>,
then SELECTED is added to the return value. <i class="arg">value</i> defaults to
&quot;1&quot;.</p></dd>
<dt><a name="7"><b class="cmd">::html::closeTag</b></a></dt>
<dd><p>Pop a tag off the stack created by <b class="cmd">::html::openTag</b> and generate
the corresponding close tag (e.g., &lt;/body&gt;).</p></dd>
<dt><a name="8"><b class="cmd">::html::default</b> <i class="arg">key</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>This procedure is used by <b class="cmd">::html::tagParam</b> to generate the name,
value list of parameters for a tag.  The <b class="cmd">::html::default</b>
procedure is used to generate default values for those items not
already in <i class="arg">param</i>.  If the value identified by <i class="arg">key</i> matches
a value in <i class="arg">param</i> then this procedure returns the empty string.
Otherwise, it returns a &quot;parameter=value&quot; string for a form element
identified by <i class="arg">key</i>.  The <i class="arg">key</i> has the form &quot;tag.parameter&quot;
(e.g., body.bgcolor).  Use <b class="cmd">::html::init</b> to register default
values. <i class="arg">param</i> defaults to the empty string.</p></dd>
<dt><a name="9"><b class="cmd">::html::description</b> <i class="arg">description</i></a></dt>
<dd><p><em>Side effect only</em>.  Call this before <b class="cmd">::html::head</b> to
define a description <i class="term">meta</i> tag for the page.  This tag is generated
later in the call to <b class="cmd">::html::head</b>.</p></dd>
<dt><a name="10"><b class="cmd">::html::end</b></a></dt>
<dd><p>Pop all open tags from the stack and generate the corresponding close
HTML tags, (e.g., &lt;/body&gt;&lt;/html&gt;).</p></dd>
<dt><a name="11"><b class="cmd">::html::eval</b> <i class="arg">arg</i> <span class="opt">?<i class="arg">args</i>?</span></a></dt>
<dd><p>This procedure is similar to the built-in Tcl <b class="cmd">eval</b> command.  The
only difference is that it returns &quot;&quot; so it can be called from an HTML
template file without appending unwanted results.</p></dd>
<dt><a name="12"><b class="cmd">::html::extractParam</b> <i class="arg">param key</i> <span class="opt">?<i class="arg">varName</i>?</span></a></dt>
<dd><p>This is a parsing procedure that extracts the value of <i class="arg">key</i> from
<i class="arg">param</i>, which is a HTML-style &quot;name=quotedvalue&quot; list.
<i class="arg">varName</i> is used as the name of a Tcl variable that is changed to
have the value found in the parameters.  The function returns 1 if the
parameter was found in <i class="arg">param</i>, otherwise it returns 0.  If the
<i class="arg">varName</i> is not specified, then <i class="arg">key</i> is used as the variable
name.</p></dd>
<dt><a name="13"><b class="cmd">::html::font</b> <i class="arg">args</i></a></dt>
<dd><p>Generate a standard <i class="term">font</i> tag.  The parameters to the tag are taken
from <i class="arg">args</i> and the HTML defaults defined with <b class="cmd">::html::init</b>.</p></dd>
<dt><a name="14"><b class="cmd">::html::for</b> <i class="arg">start test next body</i></a></dt>
<dd><p>This procedure is similar to the built-in Tcl <b class="cmd">for</b> control
structure.  Rather than evaluating the body, it returns the subst'ed
<i class="arg">body</i>. Each iteration of the loop causes another string to be
concatenated to the result value.</p></dd>
<dt><a name="15"><b class="cmd">::html::foreach</b> <i class="arg">varlist1 list1</i> <span class="opt">?<i class="arg">varlist2 list2 ...</i>?</span> <i class="arg">body</i></a></dt>
<dd><p>This procedure is similar to the built-in Tcl <b class="cmd"><a href="../../../../index.html#key199">foreach</a></b> control
structure.  Rather than evaluating the body, it returns the subst'ed
<i class="arg">body</i>.  Each iteration of the loop causes another string to be
concatenated to the result value.</p></dd>
<dt><a name="16"><b class="cmd">::html::formValue</b> <i class="arg">name</i> <span class="opt">?<i class="arg">defvalue</i>?</span></a></dt>
<dd><p>Return a name and value pair, where the value is initialized from
existing CGI data, if any.  The result has this form:</p>
<pre class="example">
  name=&quot;fred&quot; value=&quot;freds value&quot;
</pre>
</dd>
<dt><a name="17"><b class="cmd">::html::getFormInfo</b> <i class="arg">args</i></a></dt>
<dd><p>Generate hidden fields to capture form values.  If <i class="arg">args</i> is
empty, then hidden fields are generated for all CGI values.  Otherwise
args is a list of string match patterns for form element names.</p></dd>
<dt><a name="18"><b class="cmd">::html::getTitle</b></a></dt>
<dd><p>Return the title string, with out the surrounding <i class="term">title</i> tag,
set with a previous call to <b class="cmd">::html::title</b>.</p></dd>
<dt><a name="19"><b class="cmd">::html::h</b> <i class="arg">level string</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Generate a heading (e.g., <i class="term">h<b class="variable">level</b></i>) tag.  The <i class="arg">string</i> is nested in the
heading, and <i class="arg">param</i> is used for the tag parameters.</p></dd>
<dt><a name="20"><b class="cmd">::html::h1</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Generate an <i class="term">h1</i> tag.  See <b class="cmd">::html::h</b>.</p></dd>
<dt><a name="21"><b class="cmd">::html::h2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Generate an <i class="term">h2</i> tag.  See <b class="cmd">::html::h</b>.</p></dd>
<dt><a name="22"><b class="cmd">::html::h3</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Generate an <i class="term">h3</i> tag.  See <b class="cmd">::html::h</b>.</p></dd>
<dt><a name="23"><b class="cmd">::html::h4</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Generate an <i class="term">h4</i> tag.  See <b class="cmd">::html::h</b>.</p></dd>
<dt><a name="24"><b class="cmd">::html::h5</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Generate an <i class="term">h5</i> tag.  See <b class="cmd">::html::h</b>.</p></dd>
<dt><a name="25"><b class="cmd">::html::h6</b> <i class="arg">string</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Generate an <i class="term">h6</i> tag.  See <b class="cmd">::html::h</b>.</p></dd>
<dt><a name="26"><b class="cmd">::html::hdrRow</b> <i class="arg">args</i></a></dt>
<dd><p>Generate a table row, including <i class="term">tr</i> and <i class="term">th</i> tags.
Each value in <i class="arg">args</i> is place into its own table cell.
This uses <b class="cmd">::html::cell</b>.</p></dd>
<dt><a name="27"><b class="cmd">::html::head</b> <i class="arg">title</i></a></dt>
<dd><p>Generate the <i class="term">head</i> section that includes the page <i class="term">title</i>.
If previous calls have been made to
<b class="cmd">::html::author</b>, 
<b class="cmd">::html::keywords</b>, 
<b class="cmd">::html::description</b>, 
or
<b class="cmd">::html::meta</b>
then additional tags are inserted into the <i class="term">head</i> section.
This leaves an open <i class="term"><a href="../../../../index.html#key567">html</a></i> tag pushed on the stack with
<b class="cmd">::html::openTag</b>.</p></dd>
<dt><a name="28"><b class="cmd">::html::headTag</b> <i class="arg">string</i></a></dt>
<dd><p>Save a tag for inclusion in the <i class="term">head</i> section generated by
<b class="cmd">::html::head</b>.  The <i class="arg">string</i> is everything in the tag except
the enclosing angle brackets, &lt; &gt;.</p></dd>
<dt><a name="29"><b class="cmd">::html::html_entities</b> <i class="arg">string</i></a></dt>
<dd><p>This command replaces all special characters in the <i class="arg">string</i> with
their HTML entities and returns the modified text.</p></dd>
<dt><a name="30"><b class="cmd">::html::if</b> <i class="arg">expr1 body1</i> <span class="opt">?<b class="const">elseif</b> <i class="arg">expr2 body2 ...</i>?</span> <span class="opt">?<b class="const">else</b> <i class="arg">bodyN</i>?</span></a></dt>
<dd><p>This procedure is similar to the built-in Tcl <b class="cmd">if</b> control
structure.  Rather than evaluating the body of the branch that is
taken, it returns the subst'ed <i class="arg">body</i>.  Note that the syntax is
slightly more restrictive than that of the built-in Tcl <b class="cmd">if</b>
control structure.</p></dd>
<dt><a name="31"><b class="cmd">::html::init</b> <span class="opt">?<i class="arg">list</i>?</span></a></dt>
<dd><p><b class="cmd">::html::init</b> accepts a Tcl-style name-value list that defines
values for items with a name of the form &quot;tag.parameter&quot;.  For
example, a default with key &quot;body.bgcolor&quot; defines the background
color for the <i class="term">body</i> tag.</p></dd>
<dt><a name="32"><b class="cmd">::html::keywords</b> <i class="arg">args</i></a></dt>
<dd><p><em>Side effect only</em>.  Call this before <b class="cmd">::html::head</b> to
define a keyword <i class="term">meta</i> tag for the page.  The <i class="term">meta</i> tag
is included in the result of <b class="cmd">::html::head</b>.</p></dd>
<dt><a name="33"><b class="cmd">::html::mailto</b> <i class="arg">email</i> <span class="opt">?<i class="arg">subject</i>?</span></a></dt>
<dd><p>Generate a hypertext link to a mailto: URL.</p></dd>
<dt><a name="34"><b class="cmd">::html::meta</b> <i class="arg">args</i></a></dt>
<dd><p><em>Side effect only</em>.  Call this before <b class="cmd">::html::head</b> to
define a <i class="term">meta</i> tag for the page.  The <i class="arg">args</i> is a Tcl-style name,
value list that is used for the name= and value= parameters for the
<i class="term">meta</i> tag.  The <i class="term">meta</i> tag is included in the result of
<b class="cmd">::html::head</b>.</p></dd>
<dt><a name="35"><b class="cmd">::html::minorList</b> <i class="arg">list</i> <span class="opt">?<i class="arg">ordered</i>?</span></a></dt>
<dd><p>Generate an ordered or unordered list of links.  The <i class="arg">list</i> is a
Tcl-style name, value list of labels and urls for the links.
<i class="arg">ordered</i> is a boolean used to choose between an ordered or
unordered list. It defaults to <b class="const">false</b>.</p></dd>
<dt><a name="36"><b class="cmd">::html::minorMenu</b> <i class="arg">list</i> <span class="opt">?<i class="arg">sep</i>?</span></a></dt>
<dd><p>Generate a series of hypertext links.  The <i class="arg">list</i> is a Tcl-style
name, value list of labels and urls for the links.  The <i class="arg">sep</i> is
the text to put between each link. It defaults to &quot; | &quot;.</p></dd>
<dt><a name="37"><b class="cmd">::html::nl2br</b> <i class="arg">string</i></a></dt>
<dd><p>This command replaces all line-endings in the <i class="arg">string</i> with a
<i class="term">br</i> tag and returns the modified text.</p></dd>
<dt><a name="38"><b class="cmd">::html::openTag</b> <i class="arg">tag</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Push <i class="arg">tag</i> onto a stack and generate the opening tag for
<i class="arg">tag</i>. Use <b class="cmd">::html::closeTag</b> to pop the tag from the
stack. The second argument provides any tag arguments, as a
list whose elements are formatted to be in the form
&quot;<b class="variable">key</b>=<b class="const">value</b>&quot;.</p></dd>
<dt><a name="39"><b class="cmd">::html::paramRow</b> <i class="arg">list</i> <span class="opt">?<i class="arg">rparam</i>?</span> <span class="opt">?<i class="arg">cparam</i>?</span></a></dt>
<dd><p>Generate a table row, including <i class="term">tr</i> and <i class="term">td</i> tags. Each value in
<i class="arg">list</i> is placed into its own table cell. This uses
<b class="cmd">::html::cell</b>. The value of <i class="arg">rparam</i> is used as parameter for
the <i class="term">tr</i> tag. The value of <i class="arg">cparam</i> is passed to <b class="cmd">::html::cell</b>
as parameter for the <i class="term">td</i> tags.</p></dd>
<dt><a name="40"><b class="cmd">::html::passwordInput</b> <span class="opt">?<i class="arg">name</i>?</span></a></dt>
<dd><p>Generate an <i class="term">input</i> tag of type <i class="term"><a href="../../../../index.html#key644">password</a></i>. The <i class="arg">name</i> defaults to
&quot;password&quot;.</p></dd>
<dt><a name="41"><b class="cmd">::html::passwordInputRow</b> <i class="arg">label</i> <span class="opt">?<i class="arg">name</i>?</span></a></dt>
<dd><p>Format a table row containing a label and an <i class="term">input</i> tag of type
<i class="term"><a href="../../../../index.html#key644">password</a></i>. The <i class="arg">name</i> defaults to &quot;password&quot;.</p></dd>
<dt><a name="42"><b class="cmd">::html::quoteFormValue</b> <i class="arg">value</i></a></dt>
<dd><p>Quote special characters in <i class="arg">value</i> by replacing them with HTML
entities for quotes, ampersand, and angle brackets.</p></dd>
<dt><a name="43"><b class="cmd">::html::radioSet</b> <i class="arg">key sep list</i></a></dt>
<dd><p>Generate a set of <i class="term">input</i> tags of type <i class="term">radio</i> and an associated text
label.  All the radio buttons share the same <i class="arg">key</i> for their name.
The <i class="arg">sep</i> is text used to separate the elements.  The <i class="arg">list</i>
is a Tcl-style label, value list.</p></dd>
<dt><a name="44"><b class="cmd">::html::radioValue</b> <i class="arg">name value</i></a></dt>
<dd><p>Generate the &quot;name=<i class="arg">name</i> value=<i class="arg">value</i> for a <i class="term">radio</i> form
element.  If the CGI variable <i class="arg">name</i> has the value <i class="arg">value</i>,
then SELECTED is added to the return value.</p></dd>
<dt><a name="45"><b class="cmd">::html::refresh</b> <i class="arg">seconds url</i></a></dt>
<dd><p>Set up a refresh <i class="term">meta</i> tag. Call this before <b class="cmd">::html::head</b> and the
HEAD section will contain a <i class="term">meta</i> tag that causes the document to
refresh in <i class="arg">seconds</i> seconds.  The <i class="arg">url</i> is optional.  If
specified, it specifies a new page to load after the refresh interval.</p></dd>
<dt><a name="46"><b class="cmd">::html::row</b> <i class="arg">args</i></a></dt>
<dd><p>Generate a table row, including <i class="term">tr</i> and <i class="term">td</i> tags.  Each value in
<i class="arg">args</i> is place into its own table cell. This uses
<b class="cmd">::html::cell</b>. Ignores any default information set up via
<b class="cmd">::html::init</b>.</p></dd>
<dt><a name="47"><b class="cmd">::html::select</b> <i class="arg">name param choices</i> <span class="opt">?<i class="arg">current</i>?</span></a></dt>
<dd><p>Generate a <i class="term">select</i> form element and nested <i class="term">option</i> tags. The <i class="arg">name</i>
and <i class="arg">param</i> are used to generate the <i class="term">select</i> tag. The <i class="arg">choices</i>
list is a Tcl-style name, value list.</p></dd>
<dt><a name="48"><b class="cmd">::html::selectPlain</b> <i class="arg">name param choices</i> <span class="opt">?<i class="arg">current</i>?</span></a></dt>
<dd><p>Like <b class="cmd">::html::select</b> except that <i class="arg">choices</i> is a Tcl list of
values used for the <i class="term">option</i> tags.  The label and the value for each
<i class="term">option</i> are the same.</p></dd>
<dt><a name="49"><b class="cmd">::html::set</b> <i class="arg">var val</i></a></dt>
<dd><p>This procedure is similar to the built-in Tcl <b class="cmd"><a href="../../../../index.html#key253">set</a></b> command.  The
main difference is that it returns &quot;&quot; so it can be called from an HTML
template file without appending unwanted results.  The other
difference is that it must take two arguments.</p></dd>
<dt><a name="50"><b class="cmd">::html::submit</b> <i class="arg">label</i> <span class="opt">?<i class="arg">name</i>?</span></a></dt>
<dd><p>Generate an <i class="term">input</i> tag of type <i class="term">submit</i>. <i class="arg">name</i> defaults to &quot;submit&quot;.</p></dd>
<dt><a name="51"><b class="cmd">::html::tableFromArray</b> <i class="arg">arrname</i> <span class="opt">?<i class="arg">param</i>?</span> <span class="opt">?<i class="arg">pat</i>?</span></a></dt>
<dd><p>Generate a two-column <i class="term"><a href="../../../../index.html#key104">table</a></i> and nested rows to display a Tcl array. The
table gets a heading that matches the array name, and each generated row
contains a name, value pair. The array names are sorted (<b class="cmd">lsort</b> without
special options). The argument <i class="arg">param</i> is for the <i class="term"><a href="../../../../index.html#key104">table</a></i> tag and has
to contain a pre-formatted string. The <i class="arg">pat</i> is a <b class="cmd">string match</b>
pattern used to select the array elements to show in the table. It defaults to
<b class="const">*</b>, i.e. the whole array is shown.</p></dd>
<dt><a name="52"><b class="cmd">::html::tableFromList</b> <i class="arg">querylist</i> <span class="opt">?<i class="arg">param</i>?</span></a></dt>
<dd><p>Generate a two-column <i class="term"><a href="../../../../index.html#key104">table</a></i> and nested rows to display <i class="arg">querylist</i>,
which is a Tcl dictionary. Each generated row contains a name, value pair. The
information is shown in the same order as specified in the dictionary. The
argument <i class="arg">param</i> is for the <i class="term"><a href="../../../../index.html#key104">table</a></i> tag  and has to contain a
pre-formatted string.</p></dd>
<dt><a name="53"><b class="cmd">::html::textarea</b> <i class="arg">name</i> <span class="opt">?<i class="arg">param</i>?</span> <span class="opt">?<i class="arg">current</i>?</span></a></dt>
<dd><p>Generate a <i class="term">textarea</i> tag wrapped around its current values.</p></dd>
<dt><a name="54"><b class="cmd">::html::textInput</b> <i class="arg">name value args</i></a></dt>
<dd><p>Generate an <i class="term">input</i> form tag with type <i class="term"><a href="../../../../index.html#key454">text</a></i>.  This uses
<b class="cmd">::html::formValue</b>.  The args is any additional tag attributes
you want to put into the <i class="term">input</i> tag.</p></dd>
<dt><a name="55"><b class="cmd">::html::textInputRow</b> <i class="arg">label name value args</i></a></dt>
<dd><p>Generate an <i class="term">input</i> form tag with type <i class="term"><a href="../../../../index.html#key454">text</a></i> formatted into a table row
with an associated label.  The args is any additional tag attributes
you want to put into the <i class="term">input</i> tag.</p></dd>
<dt><a name="56"><b class="cmd">::html::varEmpty</b> <i class="arg">name</i></a></dt>
<dd><p>This returns 1 if the named variable either does not exist or has the
empty string for its value.</p></dd>
<dt><a name="57"><b class="cmd">::html::while</b> <i class="arg">test body</i></a></dt>
<dd><p>This procedure is similar to the built-in Tcl <b class="cmd">while</b> control
structure.  Rather than evaluating the body, it returns the subst'ed
<i class="arg">body</i>.  Each iteration of the loop causes another string to be
concatenated to the result value.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>html</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../htmlparse/htmlparse.html">htmlparse</a>, <a href="../ncgi/ncgi.html">ncgi</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key570">checkbox</a>, <a href="../../../../index.html#key568">checkbutton</a>, <a href="../../../../index.html#key566">form</a>, <a href="../../../../index.html#key567">html</a>, <a href="../../../../index.html#key569">radiobutton</a>, <a href="../../../../index.html#key104">table</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>CGI programming</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/htmlparse/htmlparse.html.































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>htmlparse - HTML Parser</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/htmlparse/htmlparse.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ htmlparse.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">htmlparse(n) 1.2.1 tcllib &quot;HTML Parser&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>htmlparse - Procedures to parse HTML strings</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::stack 1.3</b></li>
<li>package require <b class="pkgname">cmdline 1.1</b></li>
<li>package require <b class="pkgname">htmlparse <span class="opt">?1.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::htmlparse::parse</b> <span class="opt">?-cmd <i class="arg">cmd</i>?</span> <span class="opt">?-vroot <i class="arg">tag</i>?</span> <span class="opt">?-split <i class="arg">n</i>?</span> <span class="opt">?-incvar <i class="arg">var</i>?</span> <span class="opt">?-queue <i class="arg">q</i>?</span> <i class="arg">html</i></a></li>
<li><a href="#2"><b class="cmd">::htmlparse::debugCallback</b> <span class="opt">?<i class="arg">clientdata</i>?</span> <i class="arg">tag slash param textBehindTheTag</i></a></li>
<li><a href="#3"><b class="cmd">::htmlparse::mapEscapes</b> <i class="arg">html</i></a></li>
<li><a href="#4"><b class="cmd">::htmlparse::2tree</b> <i class="arg">html tree</i></a></li>
<li><a href="#5"><b class="cmd">::htmlparse::removeVisualFluff</b> <i class="arg">tree</i></a></li>
<li><a href="#6"><b class="cmd">::htmlparse::removeFormDefs</b> <i class="arg">tree</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">htmlparse</b> package provides commands that allow libraries
and applications to parse HTML in a string into a representation of
their choice.</p>
<p>The following commands are available:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::htmlparse::parse</b> <span class="opt">?-cmd <i class="arg">cmd</i>?</span> <span class="opt">?-vroot <i class="arg">tag</i>?</span> <span class="opt">?-split <i class="arg">n</i>?</span> <span class="opt">?-incvar <i class="arg">var</i>?</span> <span class="opt">?-queue <i class="arg">q</i>?</span> <i class="arg">html</i></a></dt>
<dd><p>This command is the basic parser for HTML. It takes an HTML string,
parses it and invokes a command prefix for every tag encountered. It
is not necessary for the HTML to be valid for this parser to
function. It is the responsibility of the command invoked for every
tag to check this. Another responsibility of the invoked command is
the handling of tag attributes and character entities (escaped
characters). The parser provides the un-interpreted tag attributes to
the invoked command to aid in the former, and the package at large
provides a helper command, <b class="cmd">::htmlparse::mapEscapes</b>, to aid in
the handling of the latter. The parser <em>does</em> ignore leading
DOCTYPE declarations and all valid HTML comments it encounters.</p>
<p>All information beyond the HTML string itself is specified via
options, these are explained below.</p>
<p>To help understand the options, some more background information about
the parser.</p>
<p>It is capable of detecting incomplete tags in the HTML string given to
it. Under normal circumstances this will cause the parser to throw an
error, but if the option <i class="arg">-incvar</i> is used to specify a global (or
namespace) variable, the parser will store the incomplete part of the
input into this variable instead. This will aid greatly in the
handling of incrementally arriving HTML, as the parser will handle
whatever it can and defer the handling of the incomplete part until
more data has arrived.</p>
<p>Another feature of the parser are its two possible modes of
operation. The normal mode is activated if the option <i class="arg">-queue</i> is
not present on the command line invoking the parser. If it is present,
the parser will go into the incremental mode instead.</p>
<p>The main difference is that a parser in normal mode will immediately
invoke the command prefix for each tag it encounters. In incremental
mode however the parser will generate a number of scripts which invoke
the command prefix for groups of tags in the HTML string and then
store these scripts in the specified queue. It is then the
responsibility of the caller of the parser to ensure the execution of
the scripts in the queue.</p>
<p><em>Note</em>: The queue object given to the parser has to provide the
same interface as the queue defined in tcllib -&gt; struct. This means,
for example, that all queues created via that tcllib module can be
immediately used here. Still, the queue doesn't have to come from
tcllib -&gt; struct as long as the same interface is provided.</p>
<p>In both modes the parser will return an empty string to the caller.</p>
<p>The <i class="arg">-split</i> option may be given to a parser in incremental mode to
specify the size of the groups it creates. In other words, -split 5
means that each of the generated scripts will invoke the command
prefix for 5 consecutive tags in the HTML string. A parser in normal
mode will ignore this option and its value.</p>
<p>The option <i class="arg">-vroot</i> specifies a virtual root tag. A parser in
normal mode will invoke the command prefix for it immediately before
and after it processes the tags in the HTML, thus simulating that the
HTML string is enclosed in a &lt;vroot&gt; &lt;/vroot&gt; combination. In
incremental mode however the parser is unable to provide the closing
virtual root as it never knows when the input is complete. In this
case the first script generated by each invocation of the parser will
contain an invocation of the command prefix for the virtual root as
its first command.
The following options are available:</p>
<dl class="definitions">
<dt><b class="option">-cmd</b> <i class="arg">cmd</i></dt>
<dd><p>The command prefix to invoke for every tag in the HTML
string. Defaults to <i class="arg">::htmlparse::debugCallback</i>.</p></dd>
<dt><b class="option">-vroot</b> <i class="arg">tag</i></dt>
<dd><p>The virtual root tag to add around the HTML in normal mode. In
incremental mode it is the first tag in each chunk processed by the
parser, but there will be no closing tags. Defaults to
<i class="arg">hmstart</i>.</p></dd>
<dt><b class="option">-split</b> <i class="arg">n</i></dt>
<dd><p>The size of the groups produced by an incremental mode parser. Ignored
when in normal mode. Defaults to 10. Values &lt;= 0 are not allowed.</p></dd>
<dt><b class="option">-incvar</b> <i class="arg">var</i></dt>
<dd><p>The name of the variable where to store any incomplete HTML into. This
makes most sense for the incremental mode. The parser will throw an
error if it sees incomplete HTML and has no place to store it to. This
makes sense for the normal mode. Only incomplete tags are detected,
not missing tags.  Optional, defaults to 'no variable'.</p></dd>
</dl>
<dl class="definitions">
<dt><em>Interface to the command prefix</em></dt>
<dd><p>In normal mode the parser will invoke the command prefix with four
arguments appended. See <b class="cmd">::htmlparse::debugCallback</b> for a
description.</p>
<p>In incremental mode, however, the generated scripts will invoke the
command prefix with five arguments appended. The last four of these
are the same which were mentioned above. The first is a placeholder
string (<b class="const">@win@</b>) for a clientdata value to be supplied later
during the actual execution of the generated scripts. This could be a
tk window path, for example. This allows the user of this package to
preprocess HTML strings without committing them to a specific window,
object, whatever during parsing. This connection can be made
later. This also means that it is possible to cache preprocessed
HTML. Of course, nothing prevents the user of the parser from
replacing the placeholder with an empty string.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::htmlparse::debugCallback</b> <span class="opt">?<i class="arg">clientdata</i>?</span> <i class="arg">tag slash param textBehindTheTag</i></a></dt>
<dd><p>This command is the standard callback used by the parser in
<b class="cmd">::htmlparse::parse</b> if none was specified by the user. It simply
dumps its arguments to stdout.  This callback can be used for both
normal and incremental mode of the calling parser. In other words, it
accepts four or five arguments. The last four arguments are described
below. The optional fifth argument contains the clientdata value
passed to the callback by a parser in incremental mode. All callbacks
have to follow the signature of this command in the last four
arguments, and callbacks used in incremental parsing have to follow
this signature in the last five arguments.</p>
<p>The first argument, <i class="arg">clientdata</i>, is optional and present only if
this command is invoked by a parser in incremental mode. It contains
whatever the user of this package wishes.</p>
<p>The second argument, <i class="arg">tag</i>, contains the name of the tag which is
currently processed by the parser.</p>
<p>The third argument, <i class="arg">slash</i>, is either empty or contains a slash
character. It allows the callback to distinguish between opening
(slash is empty) and closing tags (slash contains a slash character).</p>
<p>The fourth argument, <i class="arg">param</i>, contains the un-interpreted list of
parameters to the tag.</p>
<p>The fifth and last argument, <i class="arg">textBehindTheTag</i>, contains the text
found by the parser behind the tag named in <i class="arg">tag</i>.</p></dd>
<dt><a name="3"><b class="cmd">::htmlparse::mapEscapes</b> <i class="arg">html</i></a></dt>
<dd><p>This command takes a HTML string, substitutes all escape sequences
with their actual characters and then returns the resulting string.
HTML strings which do not contain escape sequences are returned
unchanged.</p></dd>
<dt><a name="4"><b class="cmd">::htmlparse::2tree</b> <i class="arg">html tree</i></a></dt>
<dd><p>This command is a wrapper around <b class="cmd">::htmlparse::parse</b> which takes
an HTML string (in <i class="arg">html</i>) and converts it into a tree containing
the logical structure of the parsed document. The name of the tree is
given to the command as its second argument (<i class="arg">tree</i>). The command
does <b class="cmd">not</b> generate the tree by itself but expects that the caller
provided it with an existing and empty tree. It also expects that the
specified tree object follows the same interface as the tree object in
tcllib -&gt; struct. It doesn't have to be from tcllib -&gt; struct, but it
must provide the same interface.</p>
<p>The internal callback does some basic checking of HTML validity and
tries to recover from the most basic errors. The command returns the
contents of its second argument. Side effects are the creation and
manipulation of a tree object.</p>
<p>Each node in the generated tree represent one tag in the input. The
name of the tag is stored in the attribute <em>type</em> of the
node. Any html attributes coming with the tag are stored unmodified in
the attribute <em>data</em> of the tag. In other words, the command does
<em>not</em> parse html attributes into their names and values.</p>
<p>If a tag contains text its node will have children of type
<em>PCDATA</em> containing this text. The text will be stored in the
attribute <em>data</em> of these children.</p></dd>
<dt><a name="5"><b class="cmd">::htmlparse::removeVisualFluff</b> <i class="arg">tree</i></a></dt>
<dd><p>This command walks a tree as generated by <b class="cmd">::htmlparse::2tree</b> and
removes all the nodes which represent visual tags and not structural
ones. The purpose of the command is to make the tree easier to
navigate without getting bogged down in visual information not
relevant to the search. Its only argument is the name of the tree to
cut down.</p></dd>
<dt><a name="6"><b class="cmd">::htmlparse::removeFormDefs</b> <i class="arg">tree</i></a></dt>
<dd><p>Like <b class="cmd">::htmlparse::removeVisualFluff</b> this command is here to cut
down on the size of the tree as generated by
<b class="cmd">::htmlparse::2tree</b>. It removes all nodes representing forms and
form elements. Its only argument is the name of the tree to cut down.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>htmlparse</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../struct/struct_tree.html">struct::tree</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key567">html</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key54">queue</a>, <a href="../../../../index.html#key254">tree</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/http/autoproxy.html.













































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>autoproxy - HTTP protocol helper modules</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/http/autoproxy.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ autoproxy.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">autoproxy(n) 1.5.3 tcllib &quot;HTTP protocol helper modules&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>autoproxy - Automatic HTTP proxy usage and authentication</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">OPTIONS</a></li>
<li class="section"><a href="#section4">Basic Authentication</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">REFERENCES</a></li>
<li class="section"><a href="#section7">BUGS</a></li>
<li class="section"><a href="#section8">AUTHORS</a></li>
<li class="section"><a href="#section9">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">http <span class="opt">?2.0?</span></b></li>
<li>package require <b class="pkgname">autoproxy <span class="opt">?1.5.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::autoproxy::init</b></a></li>
<li><a href="#2"><b class="cmd">::autoproxy::cget</b> <i class="arg">-option</i></a></li>
<li><a href="#3"><b class="cmd">::autoproxy::configure</b> <span class="opt">?-option <i class="arg">value</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::autoproxy::tls_connect</b> <i class="arg">args</i></a></li>
<li><a href="#5"><b class="cmd">::autoproxy::tunnel_connect</b> <i class="arg">args</i></a></li>
<li><a href="#6"><b class="cmd">::autoproxy::tls_socket</b> <i class="arg">args</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package attempts to automate the use of HTTP proxy servers in Tcl
HTTP client code. It tries to initialize the web access settings from
system standard locations and can be configured to negotiate
authentication with the proxy if required.</p>
<p>On Unix the standard for identifying the local HTTP proxy server
seems to be to use the environment variable http_proxy or ftp_proxy and
no_proxy to list those domains to be excluded from proxying.
On Windows we can retrieve the Internet Settings values from the registry
to obtain pretty much the same information.
With this information we can setup a suitable filter procedure for the 
Tcl http package and arrange for automatic use of the proxy.</p>
<p>There seem to be a number of ways that the http_proxy environment
variable may be set up. Either a plain host:port or more commonly a
URL and sometimes the URL may contain authentication parameters or
these may be requested from the user or provided via http_proxy_user
and http_proxy_pass. This package attempts to deal with all these
schemes. It will do it's best to get the required parameters from the
environment or registry and if it fails can be reconfigured.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::autoproxy::init</b></a></dt>
<dd><p>Initialize the autoproxy package from system resources. Under unix
this means we look for environment variables. Under windows we look
for the same environment variables but also look at the registry
settings used by Internet Explorer.</p></dd>
<dt><a name="2"><b class="cmd">::autoproxy::cget</b> <i class="arg">-option</i></a></dt>
<dd><p>Retrieve individual package configuration options. See <span class="sectref"><a href="#section3">OPTIONS</a></span>.</p></dd>
<dt><a name="3"><b class="cmd">::autoproxy::configure</b> <span class="opt">?-option <i class="arg">value</i>?</span></a></dt>
<dd><p>Configure the autoproxy package. Calling <b class="cmd">configure</b> with no
options will return a list of all option names and values. 
See <span class="sectref"><a href="#section3">OPTIONS</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::autoproxy::tls_connect</b> <i class="arg">args</i></a></dt>
<dd><p>Connect to a secure socket through a proxy. HTTP proxy servers permit
the use of the CONNECT HTTP command to open a link through the proxy
to the target machine. This function hides the details. For use with
the http package see <b class="cmd">tls_socket</b>.</p>
<p>The <i class="arg">args</i> list may contain any of the <b class="package"><a href="../../../../index.html#key289">tls</a></b> package options but
must end with the host and port as the last two items.</p></dd>
<dt><a name="5"><b class="cmd">::autoproxy::tunnel_connect</b> <i class="arg">args</i></a></dt>
<dd><p>Connect to a target host throught a proxy. This uses the same CONNECT
HTTP command as the <b class="cmd">tls_connect</b> but does not promote the link
security once the connection is established.</p>
<p>The <i class="arg">args</i> list may contain any of the <b class="package"><a href="../../../../index.html#key289">tls</a></b> package options but
must end with the host and port as the last two items.</p>
<p>Note that many proxy servers will permit CONNECT calls to a limited
set of ports - typically only port 443 (the secure HTTP port).</p></dd>
<dt><a name="6"><b class="cmd">::autoproxy::tls_socket</b> <i class="arg">args</i></a></dt>
<dd><p>This function is to be used to register a proxy-aware secure socket
handler for the https protocol. It may only be used with the Tcl http
package and should be registered using the http::register command (see
the examples below). The job of actually creating the tunnelled
connection is done by the tls_connect command and this may be used
when not registering with the http package.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OPTIONS</a></h2>
<dl class="options">
<dt><b class="option">-host</b> hostname</dt>
<dd></dd>
<dt><b class="option">-proxy_host</b> hostname</dt>
<dd><p>Set the proxy hostname. This is normally set up by <b class="cmd">init</b> but may
be configured here as well.</p></dd>
<dt><b class="option">-port</b> number</dt>
<dd></dd>
<dt><b class="option">-proxy_port</b> number</dt>
<dd><p>Set the proxy port number. This is normally set up by <b class="cmd">init</b>.
e.g. <b class="cmd">configure</b> <b class="option">-port</b> <i class="arg">3128</i></p></dd>
<dt><b class="option">-no_proxy</b> list</dt>
<dd><p>You may manipulate the <b class="option">no_proxy</b> list that was setup by 
<b class="cmd">init</b>. The value of this option is a tcl list of
strings that are matched against the http request host using the tcl
<b class="cmd">string match</b> command. Therefore glob patterns are permitted.
For instance, <b class="cmd">configure</b> <b class="option">-no_proxy</b> <i class="arg">*.localdomain</i></p></dd>
<dt><b class="option">-authProc</b> procedure</dt>
<dd><p>This option may be used to set an application defined procedure to be
called when <b class="cmd">configure</b> <b class="option">-basic</b> is called with either no or
insufficient authentication details. This can be used to present a
dialog to the user to request the additional information.</p></dd>
<dt><b class="option">-basic</b></dt>
<dd><p>Following options are for configuring the Basic authentication
scheme parameters. See <span class="sectref"><a href="#section4">Basic Authentication</a></span>.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Basic Authentication</a></h2>
<p>Basic is the simplest and most commonly use HTTP proxy authentication
scheme. It is described in (1 section 11) and also in (2). It offers
no privacy whatsoever and its use should be discouraged in favour of
more secure alternatives like Digest. To perform Basic authentication
the client base64 encodes the username and plaintext password
separated by a colon. This encoded text is prefixed with the word
&quot;Basic&quot; and a space.</p>
<p>The following options exists for this scheme:</p>
<dl class="options">
<dt><b class="option">-username</b> name</dt>
<dd><p>The username required to authenticate with the configured proxy.</p></dd>
<dt><b class="option">-password</b> password</dt>
<dd><p>The password required for the username specified.</p></dd>
<dt><b class="option">-realm</b> realm</dt>
<dd><p>This option is not used.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<pre class="example">
package require autoproxy
autoproxy::init
autoproxy::configure -basic -username ME -password SEKRET
set tok [http::geturl http://wiki.tcl.tk/]
http::data $tok
</pre>
<pre class="example">
package require http
package require tls
package require autoproxy
autoproxy::init
http::register https 443 autoproxy::tls_socket
set tok [http::geturl https://www.example.com/]
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Berners-Lee, T., Fielding R. and Frystyk, H.
      &quot;Hypertext Transfer Protocol -- HTTP/1.0&quot;,
      RFC 1945, May 1996,
      (<a href="http://www.rfc-editor.org/rfc/rfc1945.txt">http://www.rfc-editor.org/rfc/rfc1945.txt</a>)</p></li>
<li><p>Franks, J. et al.
      &quot;HTTP Authentication: Basic and Digest Access Authentication&quot;,
      RFC 2617, June 1999
      (<a href="http://www.rfc-editor.org/rfc/rfc2617.txt">http://www.rfc-editor.org/rfc/rfc2617.txt</a>)</p></li>
</ol>
</div>
<div id="section7" class="section"><h2><a name="section7">BUGS</a></h2>
<p>At this time only Basic authentication (1) (2) is supported. It is
planned to add support for Digest (2) and NTLM in the future.</p>
</div>
<div id="section8" class="section"><h2><a name="section8">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section9" class="section"><h2><a name="section9">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>http :: autoproxy</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>http(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key740">authentication</a>, <a href="../../../../index.html#key481">http</a>, <a href="../../../../index.html#key768">proxy</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ident/ident.html.




















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>ident - Identification protocol client</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ident/ident.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Reinhard Max &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ ident.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ident(n) 0.42 tcllib &quot;Identification protocol client&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ident - Ident protocol client</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">ident <span class="opt">?0.42?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ident::query</b> <i class="arg">socket</i> <span class="opt">?<i class="arg">callback</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">ident</b> package provides a client implementation of the ident
protocol as defined in
RFC 1413 (<a href="http://www.rfc-editor.org/rfc/rfc1413.txt">http://www.rfc-editor.org/rfc/rfc1413.txt</a>).</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ident::query</b> <i class="arg">socket</i> <span class="opt">?<i class="arg">callback</i>?</span></a></dt>
<dd><p>This command queries the ident daemon on the remote side of the given
socket, and returns the result of the query as a dictionary.
Interpreting the dictionary as list the first key will always be
<b class="const">resp-type</b>, and can have one of the values <b class="const">USERID</b>,
<b class="const">ERROR</b>, and <b class="const">FATAL</b>.  These <i class="term">response types</i> have
the following meanings:</p>
<dl class="definitions">
<dt>USERID</dt>
<dd><p>This indicates a successful response. Two more keys and associated
values are returned, <b class="const">opsys</b>, and <b class="const">user-id</b>.</p></dd>
<dt>ERROR</dt>
<dd><p>This means the ident server has returned an error.  A second key named
<b class="const">error</b> is present whose value contains the <b class="const">error-type</b>
field from the server response.</p></dd>
<dt>FATAL</dt>
<dd><p>Fatal errors happen when no ident server is listening on the remote
side, or when the ident server gives a response that does not conform
to the RFC. A detailed error message is returned under the
<b class="const">error</b> key.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ident</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key383">ident</a>, <a href="../../../../index.html#key385">identification</a>, <a href="../../../../index.html#key384">rfc 1413</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Reinhard Max &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/imap4/imap4.html.






































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>imap4 - imap client</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/imap4/imap4.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ imap4.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">imap4(n) 0.4 tcllib &quot;imap client&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>imap4 - imap client-side tcl implementation of imap protocol</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">imap4 <span class="opt">?0.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::imap4::open</b> <i class="arg">hostname</i> <span class="opt">?<i class="arg">port</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::imap4::login</b> <i class="arg">chan</i> <i class="arg">user</i> <i class="arg">pass</i></a></li>
<li><a href="#3"><b class="cmd">::imap4::folders</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">-inline</i>?</span> <span class="opt">?<i class="arg">mboxref</i>?</span> <span class="opt">?<i class="arg">mboxname</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::imap4::select</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">mailbox</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::imap4::examine</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">mailbox</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::imap4::fetch</b> <i class="arg">chan</i> <i class="arg">range</i> <span class="opt">?<i class="arg">-inline</i>?</span> <span class="opt">?<i class="arg">attr ...</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::imap4::noop</b> <i class="arg">chan</i></a></li>
<li><a href="#8"><b class="cmd">::imap4::check</b> <i class="arg">chan</i></a></li>
<li><a href="#9"><b class="cmd">::imap4::folderinfo</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">info</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::imap4::msginfo</b> <i class="arg">chan</i> <i class="arg">msgid</i> <span class="opt">?<i class="arg">info</i>?</span> <span class="opt">?<i class="arg">defval</i>?</span></a></li>
<li><a href="#11"><b class="cmd">::imap4::mboxinfo</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">info</i>?</span></a></li>
<li><a href="#12"><b class="cmd">::imap4::isableto</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">capability</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::imap4::create</b> <i class="arg">chan</i> <i class="arg">mailbox</i></a></li>
<li><a href="#14"><b class="cmd">::imap4::delete</b> <i class="arg">chan</i> <i class="arg">mailbox</i></a></li>
<li><a href="#15"><b class="cmd">::imap4::rename</b> <i class="arg">chan</i> <i class="arg">oldname</i> <i class="arg">newname</i></a></li>
<li><a href="#16"><b class="cmd">::imap4::subscribe</b> <i class="arg">chan</i> <i class="arg">mailbox</i></a></li>
<li><a href="#17"><b class="cmd">::imap4::unsubscribe</b> <i class="arg">chan</i> <i class="arg">mailbox</i></a></li>
<li><a href="#18"><b class="cmd">::imap4::search</b> <i class="arg">chan</i> <i class="arg">expr</i> <span class="opt">?<i class="arg">...</i>?</span></a></li>
<li><a href="#19"><b class="cmd">::imap4::close</b> <i class="arg">chan</i></a></li>
<li><a href="#20"><b class="cmd">::imap4::cleanup</b> <i class="arg">chan</i></a></li>
<li><a href="#21"><b class="cmd">::imap4::debugmode</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">errormsg</i>?</span></a></li>
<li><a href="#22"><b class="cmd">::imap4::store</b> <i class="arg">chan</i> <i class="arg">range</i> <i class="arg">data</i> <i class="arg">flaglist</i></a></li>
<li><a href="#23"><b class="cmd">::imap4::expunge</b> <i class="arg">chan</i></a></li>
<li><a href="#24"><b class="cmd">::imap4::logout</b> <i class="arg">chan</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">imap4</b> library package provides the client side of the
<em>Internet Message Access Protocol</em> (IMAP) using standard
sockets or secure connection via TLS/SSL.
The package is fully implemented in Tcl.</p>
<p>This document describes the procedures and explains their usage.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>This package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::imap4::open</b> <i class="arg">hostname</i> <span class="opt">?<i class="arg">port</i>?</span></a></dt>
<dd><p>Open a new IMAP connection and initalize the handler,
the imap communication channel (handler) is returned.</p>
<p><i class="arg">hostname</i> - mail server</p>
<p><i class="arg">port</i> - connection port, defaults to 143</p>
<p>The namespace variable <b class="option">::imap4::use_ssl</b>
can be used to establish to a secure connection
via TSL/SSL if set to true. In this case default connection port
defaults to 993.</p>
<p><em>Note:</em>
For connecting via SSL the Tcl module <em>tls</em> must be already
loaded otherwise an error is raised.</p>
<pre class="example">
    package require tls              ; # must be loaded for TLS/SSL   
    set ::imap4::use_ssl 1           ; # request a secure connection
    set chan [::imap4::open $server] ; # default port is now 993 </pre>
</dd>
<dt><a name="2"><b class="cmd">::imap4::login</b> <i class="arg">chan</i> <i class="arg">user</i> <i class="arg">pass</i></a></dt>
<dd><p>Login using the IMAP LOGIN command, 0 is returned on successful login.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">user</i> - username</p>
<p><i class="arg">pass</i> - password</p></dd>
<dt><a name="3"><b class="cmd">::imap4::folders</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">-inline</i>?</span> <span class="opt">?<i class="arg">mboxref</i>?</span> <span class="opt">?<i class="arg">mboxname</i>?</span></a></dt>
<dd><p>Get list of matching folders, 0 is returned on success.</p>
<p>Wildcards '*' as '%' are allowed for <i class="arg">mboxref</i> and <i class="arg">mboxname</i>,
command <b class="cmd">::imap4::folderinfo</b> can be used to retrieve folder information.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">mboxref</i> - mailbox reference, defaults to &quot;&quot;</p>
<p><i class="arg">mboxname</i> - mailbox name, defaults to &quot;*&quot;</p>
<p>If <b class="option">-inline</b> is specified a compact folderlist is
returned instead of the result code. All flags are converted to
lowercase and leading special characters are removed.</p>
<pre class="example">{{Arc08 noselect} {Arc08/Private {noinferiors unmarked}} {INBOX noinferiors}}</pre>
</dd>
<dt><a name="4"><b class="cmd">::imap4::select</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">mailbox</i>?</span></a></dt>
<dd><p>Select a mailbox, 0 is returned on success.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">mailbox</i> - Path of the mailbox,  defaults to <em>INBOX</em></p>
<p>Prior to examine/select an open mailbox must be closed - see: <b class="cmd">::imap4::close</b>.</p></dd>
<dt><a name="5"><b class="cmd">::imap4::examine</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">mailbox</i>?</span></a></dt>
<dd><p>&quot;Examines&quot; a mailbox, read-only equivalent of <b class="cmd">::imap4::select</b>.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">mailbox</i> - mailbox name or path to mailbox,
defaults to <em>INBOX</em></p>
<p>Prior to examine/select an open mailbox must be closed - see: <b class="cmd">::imap4::close</b>.</p></dd>
<dt><a name="6"><b class="cmd">::imap4::fetch</b> <i class="arg">chan</i> <i class="arg">range</i> <span class="opt">?<i class="arg">-inline</i>?</span> <span class="opt">?<i class="arg">attr ...</i>?</span></a></dt>
<dd><p>Fetch attributes from messages.</p>
<p>The attributes are fetched and stored in the internal state
which can be retrieved with command <b class="cmd">::imap4::msginfo</b>, 0 is returned
on success.
If <b class="option">-inline</b> is specified, alle records are returned as list
in order as defined in the <i class="arg">attr</i> argument.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">range</i> - message index in format <em>FROM</em>:<em>TO</em></p>
<p><i class="arg">attr</i> - imap attributes to fetch</p>
<p><em>Note:</em>
If <em>FROM</em> is omitted, the 1st message is assumed,
if <em>TO</em> is ommitted the last message is assumed.
All message index ranges are 1-based.</p></dd>
<dt><a name="7"><b class="cmd">::imap4::noop</b> <i class="arg">chan</i></a></dt>
<dd><p>Send NOOP command to server. May get information as untagged data.</p>
<p><i class="arg">chan</i> - imap channel</p></dd>
<dt><a name="8"><b class="cmd">::imap4::check</b> <i class="arg">chan</i></a></dt>
<dd><p>Send CHECK command to server. Flush to disk.</p>
<p><i class="arg">chan</i> - imap channel</p></dd>
<dt><a name="9"><b class="cmd">::imap4::folderinfo</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">info</i>?</span></a></dt>
<dd><p>Get information on the recently selected folderlist.
If the <i class="arg">info</i> argument is omitted or a null string, the full list
of information available for the mailbox is returned.</p>
<p>If the required information name is suffixed with a ? character,
the command returns true if the information is available, or
false if it is not.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">info</i> - folderlist options to retrieve</p>
<p>Currently supported options:
<em>delim</em> - hierarchy delimiter only,
<em>match</em> - ref and mbox search patterns (see <b class="cmd">::imap4::folders</b>),
<em>names</em> - list of folder names only,
<em>flags</em> - list of folder names with flags in format
<em>{ {name {flags}} ... }</em> (see also compact format in function
<b class="cmd">::imap4::folders</b>).</p>
<pre class="example">
{{Arc08 {{\NoSelect}}} {Arc08/Private {{\NoInferiors} {\UnMarked}}} {INBOX {\NoInferiors}}}
</pre>
</dd>
<dt><a name="10"><b class="cmd">::imap4::msginfo</b> <i class="arg">chan</i> <i class="arg">msgid</i> <span class="opt">?<i class="arg">info</i>?</span> <span class="opt">?<i class="arg">defval</i>?</span></a></dt>
<dd><p>Get information (from previously collected using fetch) from a given
<em>msgid</em>. If the 'info' argument is omitted or a null string,
the list of available information options for the given message is
returned.</p>
<p>If the required information name is suffixed with a ? character,
the command returns true if the information is available, or
false if it is not.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">msgid</i> - message number</p>
<p><i class="arg">info</i> - imap keyword to retrieve</p>
<p><i class="arg">defval</i> - default value, returned if info is empty</p>
<p><em>Note:</em>
All message index ranges are 1-based.</p></dd>
<dt><a name="11"><b class="cmd">::imap4::mboxinfo</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">info</i>?</span></a></dt>
<dd><p>Get information on the currently selected mailbox.
If the <i class="arg">info</i> argument is omitted or a null string, the list
of available information options for the mailbox is returned.</p>
<p>If the required information name is suffixed with a ? character,
the command returns true if the information is available, or
false if it is not.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">opt</i> - mailbox option to retrieve</p>
<p>Currently supported options:
<em>EXISTS</em> (noof msgs), 
<em>RECENT</em> (noof 'recent' flagged msgs), 
<em>FLAGS</em></p>
<p>In conjunction with OK:
<em>PERMFLAGS</em>, <em>UIDNEXT</em>, <em>UIDVAL</em>, <em>UNSEEN</em></p>
<p>Div. states:
<em>CURRENT</em>, <em>FOUND</em>, <em>PERM</em>.</p>
<pre class="example">
    ::imap4::select $chan INBOX
    puts &quot;[::imap4::mboxinfo $chan exists] mails in INBOX&quot;</pre>
</dd>
<dt><a name="12"><b class="cmd">::imap4::isableto</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">capability</i>?</span></a></dt>
<dd><p>Test for capability.
It returns 1 if requested capability is supported, 0 otherwise.
If <i class="arg">capability</i> is omitted all capability imap
codes are retured as list.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">info</i> - imap keyword to retrieve</p>
<p><em>Note:</em>
Use the capability command to ask the server if not
already done by the user.</p></dd>
<dt><a name="13"><b class="cmd">::imap4::create</b> <i class="arg">chan</i> <i class="arg">mailbox</i></a></dt>
<dd><p>Create a new mailbox.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">mailbox</i> - mailbox name</p></dd>
<dt><a name="14"><b class="cmd">::imap4::delete</b> <i class="arg">chan</i> <i class="arg">mailbox</i></a></dt>
<dd><p>Delete a new mailbox.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">mailbox</i> - mailbox name</p></dd>
<dt><a name="15"><b class="cmd">::imap4::rename</b> <i class="arg">chan</i> <i class="arg">oldname</i> <i class="arg">newname</i></a></dt>
<dd><p>Rename a new mailbox.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">mailbox</i> - old mailbox name</p>
<p><i class="arg">mailbox</i> - new mailbox name</p></dd>
<dt><a name="16"><b class="cmd">::imap4::subscribe</b> <i class="arg">chan</i> <i class="arg">mailbox</i></a></dt>
<dd><p>Subscribe a new mailbox.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">mailbox</i> - mailbox name</p></dd>
<dt><a name="17"><b class="cmd">::imap4::unsubscribe</b> <i class="arg">chan</i> <i class="arg">mailbox</i></a></dt>
<dd><p>Unsubscribe a new mailbox.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">mailbox</i> - mailbox name</p></dd>
<dt><a name="18"><b class="cmd">::imap4::search</b> <i class="arg">chan</i> <i class="arg">expr</i> <span class="opt">?<i class="arg">...</i>?</span></a></dt>
<dd><p>Search for mails matching search criterions, 0 is returned on success.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">expr</i> - imap search expression</p>
<p><em>Notes:</em>
Currently the following search expressions are handled:</p>
<p><em>Mail header flags:</em>
all mail header entries (ending with a colon &quot;:&quot;), like &quot;From:&quot;, &quot;Bcc:&quot;, ...</p>
<p><em>Imap message search flags:</em>
ANSWERED, DELETED, DRAFT, FLAGGED, RECENT,
SEEN, NEW, OLD, UNANSWERED, UNDELETED,
UNDRAFT, UNFLAGGED, UNSEEN, ALL</p>
<p><em>Imap header search flags:</em>
BODY, CC, FROM, SUBJECT, TEXT, KEYWORD, BCC</p>
<p><em>Imap conditional search flags:</em>
SMALLER, LARGER, ON, SENTBEFORE, SENTON, SENTSINCE, SINCE,
BEFORE (not implemented),
UID (not implemented)</p>
<p><em>Logical search conditions:</em>
OR, NOT</p>
<pre class="example">::imap4::search $chan larger 4000 seen
puts &quot;Found messages: [::imap4::mboxinfo $chan found]&quot;
Found messages: 1 3 6 7 8 9 13 14 15 19 20</pre>
</dd>
<dt><a name="19"><b class="cmd">::imap4::close</b> <i class="arg">chan</i></a></dt>
<dd><p>Close the mailbox. Permanently removes \Deleted messages and
return to the AUTH state.</p>
<p><i class="arg">chan</i> - imap channel</p></dd>
<dt><a name="20"><b class="cmd">::imap4::cleanup</b> <i class="arg">chan</i></a></dt>
<dd><p>Destroy an IMAP connection and free the used space.
Close the mailbox. Permanently removes \Deleted messages
and return to the AUTH state.</p>
<p><i class="arg">chan</i> - imap channel</p></dd>
<dt><a name="21"><b class="cmd">::imap4::debugmode</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">errormsg</i>?</span></a></dt>
<dd><p>Switch client into command line debug mode.</p>
<p>This is a developers mode only that pass the control to the
programmer. Every line entered is sent verbatim to the
server (after the addition of the request identifier).
The ::imap4::debug variable is automatically set to '1' on enter.</p>
<p>It's possible to execute Tcl commands starting the line
with a slash.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">errormsg</i> - optional error message to display</p></dd>
<dt><a name="22"><b class="cmd">::imap4::store</b> <i class="arg">chan</i> <i class="arg">range</i> <i class="arg">data</i> <i class="arg">flaglist</i></a></dt>
<dd><p>Alters data associated with a message in the selected
mailbox.</p>
<p><i class="arg">chan</i> - imap channel</p>
<p><i class="arg">range</i> - message index in format <em>FROM</em>:<em>TO</em></p>
<p><i class="arg">flaglist</i> - Flags the <i class="arg">data</i> operates on.</p>
<p><i class="arg">data</i> - The currently defined <i class="arg">data</i> items that can be
stored are shown below. <em>Note</em> that all of these data types may
also be suffixed with &quot;.SILENT&quot; to suppress the untagged FETCH
response.</p>
<dl class="definitions">
<dt>FLAGS</dt>
<dd><p>Replace the flags for the message (other than \Recent) with the
<i class="arg">flaglist</i>.</p></dd>
<dt>+FLAGS</dt>
<dd><p>Add the flags in <i class="arg">flaglist</i> to the existing flags for the message.</p></dd>
<dt>-FLAGS</dt>
<dd><p>Remove the flags in <i class="arg">flaglist</i> to the existing flags for the
message.</p></dd>
</dl>
<p>For example:</p>
<pre class="example">
	::imap4::store $chan $start_msgid:$end_msgid +FLAGS &quot;Deleted&quot;
</pre>
</dd>
<dt><a name="23"><b class="cmd">::imap4::expunge</b> <i class="arg">chan</i></a></dt>
<dd><p>Permanently removes all messages that have the \Deleted flag
set from the currently selected mailbox, without the need to close the
connection.</p>
<p><i class="arg">chan</i> - imap channel</p></dd>
<dt><a name="24"><b class="cmd">::imap4::logout</b> <i class="arg">chan</i></a></dt>
<dd><p>Informs the server that the client is done with the connection
and closes the network connection. Permanently removes \Deleted
messages.</p>
<p>A new connection will need to be established to login once
more.</p>
<p><i class="arg">chan</i> - imap channel</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<pre class="example">
    set user myusername
    set pass xtremescrt
    set server imap.test.tld 
    set FOLDER INBOX
    # Connect to server
    set imap [::imap4::open $server]
    ::imap4::login $imap $user $pass
    ::imap4::select $imap $FOLDER
    # Output all the information about that mailbox
    foreach info [::imap4::mboxinfo $imap] {
        puts &quot;$info -&gt; [::imap4::mboxinfo $imap $info]&quot;
    }
    # fetch 3 records inline 
    set fields {from: to: subject: size}
    foreach rec [::imap4::fetch $imap :3 -inline {*}$fields] {
        puts -nonewline &quot;#[incr idx])&quot;
        for {set j 0} {$j&lt;[llength $fields]} {incr j} {
            puts &quot;\t[lindex $fields $j] [lindex $rec $j]&quot;
        }
    }
    
    # Show all the information available about the message ID 1
    puts &quot;Available info about message 1: [::imap4::msginfo $imap 1]&quot;
    
    # Use the capability stuff
    puts &quot;Capabilities: [::imap4::isableto $imap]&quot;
    puts &quot;Is able to imap4rev1? [::imap4::isableto $imap imap4rev1]&quot;
    
    # Cleanup
    ::imap4::cleanup $imap
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<p>Mark R. Crispin, &quot;INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1&quot;,
RFC 3501, March 2003, <a href="http://www.rfc-editor.org/rfc/rfc3501.txt">http://www.rfc-editor.org/rfc/rfc3501.txt</a></p>
<p>OpenSSL, <a href="http://www.openssl.org/">http://www.openssl.org/</a></p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Only a small part of rfc3501 implemented.</p>
<p>Please report such in the category <em>imap4</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../ftp/ftp.html">ftp</a>, <a href="../../../../index.html#key481">http</a>, <a href="../../../../index.html#key743">imap</a>, <a href="../mime/mime.html">mime</a>, <a href="../pop3/pop3.html">pop3</a>, <a href="../../../../index.html#key289">tls</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key293">email</a>, <a href="../../../../index.html#key743">imap</a>, <a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key288">mail</a>, <a href="../../../../index.html#key250">net</a>, <a href="../../../../index.html#key742">rfc3501</a>, <a href="../../../../index.html#key318">ssl</a>, <a href="../../../../index.html#key289">tls</a></p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/inifile/ini.html.
















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>inifile - Parsing of Windows INI files</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/inifile/ini.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ inifile.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">inifile(n) 0.2.5 tcllib &quot;Parsing of Windows INI files&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>inifile - Parsing of Windows INI files</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">inifile <span class="opt">?0.2.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ini::open</b> <i class="arg">file</i> <span class="opt">?<i class="arg">access</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::ini::close</b> <i class="arg">ini</i></a></li>
<li><a href="#3"><b class="cmd">::ini::commit</b> <i class="arg">ini</i></a></li>
<li><a href="#4"><b class="cmd">::ini::revert</b> <i class="arg">ini</i></a></li>
<li><a href="#5"><b class="cmd">::ini::filename</b> <i class="arg">ini</i></a></li>
<li><a href="#6"><b class="cmd">::ini::sections</b> <i class="arg">ini</i></a></li>
<li><a href="#7"><b class="cmd">::ini::keys</b> <i class="arg">ini</i> <i class="arg">section</i></a></li>
<li><a href="#8"><b class="cmd">::ini::get</b> <i class="arg">ini</i> <i class="arg">section</i></a></li>
<li><a href="#9"><b class="cmd">::ini::exists</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::ini::value</b> <i class="arg">ini</i> <i class="arg">section</i> <i class="arg">key</i> <span class="opt">?<i class="arg">default</i>?</span></a></li>
<li><a href="#11"><b class="cmd">::ini::set</b> <i class="arg">ini</i> <i class="arg">section</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#12"><b class="cmd">::ini::delete</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::ini::comment</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span> <span class="opt">?<i class="arg">text</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::ini::commentchar</b> <span class="opt">?char?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides an interface for easy manipulation of Windows INI files.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ini::open</b> <i class="arg">file</i> <span class="opt">?<i class="arg">access</i>?</span></a></dt>
<dd><p>Opens an INI file and returns a handle that is used by other commands.
<i class="arg">access</i> is the same as the first form (non POSIX) of the <b class="const">open</b>
command, with the exception that mode <b class="const">a</b> is not supported. The
default mode is <b class="const">r+</b>.</p></dd>
<dt><a name="2"><b class="cmd">::ini::close</b> <i class="arg">ini</i></a></dt>
<dd><p>Close the specified handle. If any changes were made and not written by
<b class="const">commit</b> they are lost.</p></dd>
<dt><a name="3"><b class="cmd">::ini::commit</b> <i class="arg">ini</i></a></dt>
<dd><p>Writes the file and all changes to disk. The sections are written in
arbitrary order. The keys in a section are written in alphabetical
order. If the ini was opened in read only mode an error will be thrown.</p></dd>
<dt><a name="4"><b class="cmd">::ini::revert</b> <i class="arg">ini</i></a></dt>
<dd><p>Rolls all changes made to the inifile object back to the last
committed state.</p></dd>
<dt><a name="5"><b class="cmd">::ini::filename</b> <i class="arg">ini</i></a></dt>
<dd><p>Returns the name of the file the <i class="arg">ini</i> object is associated with.</p></dd>
<dt><a name="6"><b class="cmd">::ini::sections</b> <i class="arg">ini</i></a></dt>
<dd><p>Returns a list of all the names of the existing sections in the file handle
specified.</p></dd>
<dt><a name="7"><b class="cmd">::ini::keys</b> <i class="arg">ini</i> <i class="arg">section</i></a></dt>
<dd><p>Returns a list of all they key names in the section and file specified.</p></dd>
<dt><a name="8"><b class="cmd">::ini::get</b> <i class="arg">ini</i> <i class="arg">section</i></a></dt>
<dd><p>Returns a list of key value pairs that exist in the section and file specified.</p></dd>
<dt><a name="9"><b class="cmd">::ini::exists</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span></a></dt>
<dd><p>Returns a boolean value indicating the existance of the specified section as a
whole or the specified key within that section.</p></dd>
<dt><a name="10"><b class="cmd">::ini::value</b> <i class="arg">ini</i> <i class="arg">section</i> <i class="arg">key</i> <span class="opt">?<i class="arg">default</i>?</span></a></dt>
<dd><p>Returns the value of the named key and section. If specified,
the default value will be returned if the key does not exist. If the key does
not exist and no default is specified an error will be thrown.</p></dd>
<dt><a name="11"><b class="cmd">::ini::set</b> <i class="arg">ini</i> <i class="arg">section</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Sets the value of the key in the specified section. If the section does not
exist then a new one is created.</p></dd>
<dt><a name="12"><b class="cmd">::ini::delete</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span></a></dt>
<dd><p>Removes the key or the entire section and all its keys. A section is not
automatically deleted when it has no remaining keys.</p></dd>
<dt><a name="13"><b class="cmd">::ini::comment</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span> <span class="opt">?<i class="arg">text</i>?</span></a></dt>
<dd><p>Reads and modifies comments for sections and keys. To write a section comment use an
empty string for the <i class="arg">key</i>. To remove all comments use an empty string for <i class="arg">text</i>.
<i class="arg">text</i> may consist of a list of lines or one single line. Any embedded newlines in
<i class="arg">text</i> are properly handled.  Comments may be written to nonexistant
sections or keys and will not return an error. Reading a comment from a nonexistant
section or key will return an empty string.</p></dd>
<dt><a name="14"><b class="cmd">::ini::commentchar</b> <span class="opt">?char?</span></a></dt>
<dd><p>Reads and sets the comment character. Lines that begin with this character are treated as
comments. When comments are written out each line is preceded by this character. The default
is <b class="const">;</b>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>inifile</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/interp/deleg_method.html.















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>deleg_method - Interpreter utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/interp/deleg_method.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ deleg_method.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">deleg_method(n) 0.2 tcllib &quot;Interpreter utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>deleg_method - Creation of comm delegates (snit methods)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">snit <span class="opt">?1.1?</span></b></li>
<li>package require <b class="pkgname">interp::delegate::method <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::interp::delegate::method</b> <span class="opt">?<b class="option">-async</b>?</span> <i class="arg">name</i> <i class="arg">arguments</i> <i class="arg">comm</i> <i class="arg">id</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a single command for use within <b class="package"><a href="../snit/snit.html">snit</a></b>
type definition (i.e. actually a <b class="cmd">snit::macro</b>) for the convenient
creation of methods which delegate the actual work to a remote
location via a &quot;channel&quot; created by the package <b class="package"><a href="../comm/comm.html">comm</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::interp::delegate::method</b> <span class="opt">?<b class="option">-async</b>?</span> <i class="arg">name</i> <i class="arg">arguments</i> <i class="arg">comm</i> <i class="arg">id</i></a></dt>
<dd><p>This commands creates a method which is named by <i class="arg">name</i>. All
invokations of this method will delegate the actual work to the remote
location identified by the comm channel <i class="arg">comm</i> and the endpoint
<i class="arg">id</i>.</p>
<p>The name of the remote method invoked by the delegator is identical to
the name of the method itself.</p>
<p>Normally the generated method marshalls the <i class="arg">arguments</i>, and
returns the result from the remote method as its own result. If
however the option <b class="option">-async</b> was specified then the generated
method will not wait for a result and return immediately.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>interp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key38">comm</a>, <a href="../../../../index.html#key39">delegation</a>, <a href="../../../../index.html#key40">interpreter</a>, <a href="../../../../index.html#key332">method</a>, <a href="../../../../index.html#key333">snit</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/interp/deleg_proc.html.














































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>deleg_proc - Interpreter utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/interp/deleg_proc.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ deleg_proc.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">deleg_proc(n) 0.2 tcllib &quot;Interpreter utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>deleg_proc - Creation of comm delegates (procedures)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">interp::delegate::proc <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::interp::delegate::proc</b> <span class="opt">?<b class="option">-async</b>?</span> <i class="arg">name</i> <i class="arg">arguments</i> <i class="arg">comm</i> <i class="arg">id</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a single command for the convenient creation of
procedures which delegate the actual work to a remote location via a
&quot;channel&quot; created by the package <b class="package"><a href="../comm/comm.html">comm</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::interp::delegate::proc</b> <span class="opt">?<b class="option">-async</b>?</span> <i class="arg">name</i> <i class="arg">arguments</i> <i class="arg">comm</i> <i class="arg">id</i></a></dt>
<dd><p>This commands creates a procedure which is named by <i class="arg">name</i> and
returns its fully-qualified name. All invokations of this procedure
will delegate the actual work to the remote location identified by the
comm channel <i class="arg">comm</i> and the endpoint <i class="arg">id</i>.</p>
<p>The name of the remote procedure invoked by the delegator is
[namespace tail <i class="arg">name</i>]. I.e., namespace information is
stripped from the call.</p>
<p>Normally the generated procedure marshalls the <i class="arg">arguments</i>, and
returns the result from the remote procedure as its own result. If
however the option <b class="option">-async</b> was specified then the generated
procedure will not wait for a result and return immediately.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>interp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key38">comm</a>, <a href="../../../../index.html#key39">delegation</a>, <a href="../../../../index.html#key40">interpreter</a>, <a href="../../../../index.html#key41">procedure</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/interp/tcllib_interp.html.





























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>interp - Interpreter utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/interp/tcllib_interp.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ interp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">interp(n) 0.1.2 tcllib &quot;Interpreter utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>interp - Interp creation and aliasing</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">interp <span class="opt">?0.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::interp::createEmpty</b> <span class="opt">?<i class="arg">path</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::interp::snitLink</b> <i class="arg">path</i> <i class="arg">methodlist</i></a></li>
<li><a href="#3"><b class="cmd">::interp::snitDictLink</b> <i class="arg">path</i> <i class="arg">methoddict</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a number of commands for the convenient creation
of Tcl interpreters for highly restricted execution.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::interp::createEmpty</b> <span class="opt">?<i class="arg">path</i>?</span></a></dt>
<dd><p>This commands creates an empty Tcl interpreter and returns it
name. Empty means that the new interpreter has neither namespaces, nor
any commands. It is useful only for the creation of aliases.</p>
<p>If a <i class="arg">path</i> is specified then it is taken as the name of the new
interpreter.</p></dd>
<dt><a name="2"><b class="cmd">::interp::snitLink</b> <i class="arg">path</i> <i class="arg">methodlist</i></a></dt>
<dd><p>This command assumes that it was called from within a method of a snit
object, and that the command <b class="cmd">mymethod</b> is available.</p>
<p>It extends the interpreter specified by <i class="arg">path</i> with aliases for
all methods found in the <i class="arg">methodlist</i>, with the alias directing
execution to the same-named method of the snit object invoking this
command.
Each element of <i class="arg">methodlist</i> is actually interpreted as a command
prefix, with the first word of each prefix the name of the method to
link to.</p>
<p>The result of the command is the empty string.</p></dd>
<dt><a name="3"><b class="cmd">::interp::snitDictLink</b> <i class="arg">path</i> <i class="arg">methoddict</i></a></dt>
<dd><p>This command behaves like <b class="cmd">::interp::snitLink</b>, except that it
takes a dictionary mapping from commands to methods as its input, and
not a list of methods.
Like for <b class="cmd">::interp::snitLink</b> the method references are actually
command prefixes.
This command allows the creation of more complex command-method
mappings than <b class="cmd">::interp::snitLink</b>.</p>
<p>The result of the command is the empty string.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>interp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key713">alias</a>, <a href="../../../../index.html#key714">empty interpreter</a>, <a href="../../../../index.html#key40">interpreter</a>, <a href="../../../../index.html#key332">method</a>, <a href="../../../../index.html#key333">snit</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/irc/irc.html.



































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>irc - Low Level Tcl IRC Interface</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/irc/irc.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ irc.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">irc(n) 0.6.1 tcllib &quot;Low Level Tcl IRC Interface&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>irc - Create IRC connection and interface.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Per-connection Commands</a></li>
<li class="section"><a href="#section3">Callback Commands</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl</b></li>
<li>package require <b class="pkgname">irc <span class="opt">?0.6.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::irc::config</b> <span class="opt">?key?</span> <span class="opt">?value?</span></a></li>
<li><a href="#2"><b class="cmd">::irc::connection</b></a></li>
<li><a href="#3"><b class="cmd">::irc::connections</b></a></li>
<li><a href="#4"><i class="arg">net</i> <b class="method">registerevent</b> <i class="arg">event</i> <i class="arg">script</i></a></li>
<li><a href="#5"><i class="arg">net</i> <b class="method">getevent</b> <i class="arg">event</i> <i class="arg">script</i></a></li>
<li><a href="#6"><i class="arg">net</i> <b class="method">eventexists</b> <i class="arg">event</i> <i class="arg">script</i></a></li>
<li><a href="#7"><i class="arg">net</i> <b class="method">connect</b> <i class="arg">hostname</i> <span class="opt">?port?</span></a></li>
<li><a href="#8"><i class="arg">net</i> <b class="method">config</b> <span class="opt">?key?</span> <span class="opt">?value?</span></a></li>
<li><a href="#9"><i class="arg">net</i> <b class="method">log</b> <i class="arg">level</i> <i class="arg">message</i></a></li>
<li><a href="#10"><i class="arg">net</i> <b class="method">logname</b></a></li>
<li><a href="#11"><i class="arg">net</i> <b class="method">connected</b></a></li>
<li><a href="#12"><i class="arg">net</i> <b class="method">sockname</b></a></li>
<li><a href="#13"><i class="arg">net</i> <b class="method">peername</b></a></li>
<li><a href="#14"><i class="arg">net</i> <b class="method">socket</b></a></li>
<li><a href="#15"><i class="arg">net</i> <b class="method">user</b> <i class="arg">username</i> <i class="arg">localhostname</i> <i class="arg">localdomainname</i> <i class="arg">userinfo</i></a></li>
<li><a href="#16"><i class="arg">net</i> <b class="method">nick</b> <i class="arg">nick</i></a></li>
<li><a href="#17"><i class="arg">net</i> <b class="method">ping</b> <i class="arg">target</i></a></li>
<li><a href="#18"><i class="arg">net</i> <b class="method">serverping</b></a></li>
<li><a href="#19"><i class="arg">net</i> <b class="method">join</b> <i class="arg">channel</i> <span class="opt">?<i class="arg">key</i>?</span></a></li>
<li><a href="#20"><i class="arg">net</i> <b class="method">part</b> <i class="arg">channel</i> <span class="opt">?<i class="arg">message</i>?</span></a></li>
<li><a href="#21"><i class="arg">net</i> <b class="method">quit</b> <span class="opt">?<i class="arg">message</i>?</span></a></li>
<li><a href="#22"><i class="arg">net</i> <b class="method">privmsg</b> <i class="arg">target</i> <i class="arg">message</i></a></li>
<li><a href="#23"><i class="arg">net</i> <b class="method">notice</b> <i class="arg">target</i> <i class="arg">message</i></a></li>
<li><a href="#24"><i class="arg">net</i> <b class="method">ctcp</b> <i class="arg">target</i> <i class="arg">message</i></a></li>
<li><a href="#25"><i class="arg">net</i> <b class="method">kick</b> <i class="arg">channel</i> <i class="arg">target</i> <span class="opt">?<i class="arg">message</i>?</span></a></li>
<li><a href="#26"><i class="arg">net</i> <b class="method">mode</b> <i class="arg">target</i> <i class="arg">args</i></a></li>
<li><a href="#27"><i class="arg">net</i> <b class="method">topic</b> <i class="arg">channel</i> <i class="arg">message</i></a></li>
<li><a href="#28"><i class="arg">net</i> <b class="method">invite</b> <i class="arg">channel</i> <i class="arg">target</i></a></li>
<li><a href="#29"><i class="arg">net</i> <b class="method">send</b> <i class="arg">text</i></a></li>
<li><a href="#30"><i class="arg">net</i> <b class="method">destroy</b></a></li>
<li><a href="#31"><b class="cmd">who</b> <span class="opt">?<b class="const">address</b>?</span></a></li>
<li><a href="#32"><b class="cmd">action</b></a></li>
<li><a href="#33"><b class="cmd">target</b></a></li>
<li><a href="#34"><b class="cmd">additional</b></a></li>
<li><a href="#35"><b class="cmd">header</b></a></li>
<li><a href="#36"><b class="cmd">msg</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides low-level commands to deal with the IRC protocol
(Internet Relay Chat) for immediate and interactive multi-cast
communication.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::irc::config</b> <span class="opt">?key?</span> <span class="opt">?value?</span></a></dt>
<dd><p>Sets configuration <span class="opt">?key?</span> to <span class="opt">?value?</span>. The configuration keys
currently defined are the boolean flags <b class="const">logger</b> and <b class="const">debug</b>.
<b class="const">logger</b> makes <b class="package">irc</b> use the logger package for printing
error. <b class="const">debug</b> requires <b class="const">logger</b> and prints extra debug output.
If no <span class="opt">?key?</span> or <span class="opt">?value?</span> is given the current values are returned.</p></dd>
<dt><a name="2"><b class="cmd">::irc::connection</b></a></dt>
<dd><p>The command creates a new object to deal with an IRC connection.
Creating this IRC object does not automatically create the network
connection.  It returns a new irc namespace command which can be used
to interact with the new IRC connection.  NOTE: the old form of the
connection command, which took a hostname and port as arguments, is
deprecated.  Use <b class="cmd">connect</b> instead to specify this information.</p></dd>
<dt><a name="3"><b class="cmd">::irc::connections</b></a></dt>
<dd><p>Returns a list of all the current connections that were created with
<b class="const">connection</b></p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">Per-connection Commands</a></h2>
<p>In the following list of available connection methods <i class="arg">net</i>
represents a connection command as returned by
<b class="cmd">::irc::connection</b>.</p>
<dl class="definitions">
<dt><a name="4"><i class="arg">net</i> <b class="method">registerevent</b> <i class="arg">event</i> <i class="arg">script</i></a></dt>
<dd><p>Registers a callback handler for the specific event.  Events available
are those described in RFC 1459
<a href="http://www.rfc-editor.org/rfc/rfc1459.txt">http://www.rfc-editor.org/rfc/rfc1459.txt</a>.
In addition, there are several other events defined.
<b class="const">defaultcmd</b> adds a command that is called if no other callback
is present.  <b class="const">EOF</b> is called if the connection signals an End of
File condition. The events <b class="const">defaultcmd</b>, <b class="const">defaultnumeric</b>,
<b class="const">defaultevent</b>, and <b class="const">EOF</b> are required.
<i class="arg">script</i> is executed in the connection namespace, which can take
advantage of several commands (see <span class="sectref"><a href="#section3">Callback Commands</a></span>
below) to aid in the parsing of data.</p></dd>
<dt><a name="5"><i class="arg">net</i> <b class="method">getevent</b> <i class="arg">event</i> <i class="arg">script</i></a></dt>
<dd><p>Returns the current handler for the event if one exists. Otherwise an
empty string is returned.</p></dd>
<dt><a name="6"><i class="arg">net</i> <b class="method">eventexists</b> <i class="arg">event</i> <i class="arg">script</i></a></dt>
<dd><p>Returns a boolean value indicating the existence of the event handler.</p></dd>
<dt><a name="7"><i class="arg">net</i> <b class="method">connect</b> <i class="arg">hostname</i> <span class="opt">?port?</span></a></dt>
<dd><p>This causes the socket to be established.  <b class="cmd">::irc::connection</b>
created the namespace and the commands to be used, but did not
actually open the socket. This is done here.  NOTE: the older form of
'connect' did not require the user to specify a hostname and port,
which were specified with 'connection'.  That form is deprecated.</p></dd>
<dt><a name="8"><i class="arg">net</i> <b class="method">config</b> <span class="opt">?key?</span> <span class="opt">?value?</span></a></dt>
<dd><p>The same as <b class="cmd">::irc::config</b> but sets and gets options for the <i class="arg">net</i>
connection only.</p></dd>
<dt><a name="9"><i class="arg">net</i> <b class="method">log</b> <i class="arg">level</i> <i class="arg">message</i></a></dt>
<dd><p>If logger is turned on by <b class="method">config</b> this will write a log <i class="arg">message</i>
at <i class="arg">level</i>.</p></dd>
<dt><a name="10"><i class="arg">net</i> <b class="method">logname</b></a></dt>
<dd><p>Returns the name of the logger instance if logger is turned on.</p></dd>
<dt><a name="11"><i class="arg">net</i> <b class="method">connected</b></a></dt>
<dd><p>Returns a boolean value indicating if this connection is connected to a server.</p></dd>
<dt><a name="12"><i class="arg">net</i> <b class="method">sockname</b></a></dt>
<dd><p>Returns a 3 element list consisting of the ip address, the hostname, and the port
of the local end of the connection, if currently connected.</p></dd>
<dt><a name="13"><i class="arg">net</i> <b class="method">peername</b></a></dt>
<dd><p>Returns a 3 element list consisting of the ip address, the hostname, and the port
of the remote end of the connection, if currently connected.</p></dd>
<dt><a name="14"><i class="arg">net</i> <b class="method">socket</b></a></dt>
<dd><p>Return the Tcl channel for the socket used by the connection.</p></dd>
<dt><a name="15"><i class="arg">net</i> <b class="method">user</b> <i class="arg">username</i> <i class="arg">localhostname</i> <i class="arg">localdomainname</i> <i class="arg">userinfo</i></a></dt>
<dd><p>Sends USER command to server.  <i class="arg">username</i> is the username you want
to appear.  <i class="arg">localhostname</i> is the host portion of your hostname, <i class="arg">localdomainname</i>
is your domain name, and <i class="arg">userinfo</i> is a short description of who you are. The 2nd and 3rd
arguments are normally ignored by the IRC server.</p></dd>
<dt><a name="16"><i class="arg">net</i> <b class="method">nick</b> <i class="arg">nick</i></a></dt>
<dd><p>NICK command.  <i class="arg">nick</i> is the nickname you wish to use for the
particular connection.</p></dd>
<dt><a name="17"><i class="arg">net</i> <b class="method">ping</b> <i class="arg">target</i></a></dt>
<dd><p>Send a CTCP PING to <i class="arg">target</i>.</p></dd>
<dt><a name="18"><i class="arg">net</i> <b class="method">serverping</b></a></dt>
<dd><p>PING the server.</p></dd>
<dt><a name="19"><i class="arg">net</i> <b class="method">join</b> <i class="arg">channel</i> <span class="opt">?<i class="arg">key</i>?</span></a></dt>
<dd><p><i class="arg">channel</i> is the IRC channel to join.  IRC channels typically
begin with a hashmark (&quot;#&quot;) or ampersand (&quot;&amp;&quot;).</p></dd>
<dt><a name="20"><i class="arg">net</i> <b class="method">part</b> <i class="arg">channel</i> <span class="opt">?<i class="arg">message</i>?</span></a></dt>
<dd><p>Makes the client leave <i class="arg">channel</i>. Some networks may support the optional
argument <i class="arg">message</i></p></dd>
<dt><a name="21"><i class="arg">net</i> <b class="method">quit</b> <span class="opt">?<i class="arg">message</i>?</span></a></dt>
<dd><p>Instructs the IRC server to close the current connection. The package
will use a generic default if no <i class="arg">message</i> was specified.</p></dd>
<dt><a name="22"><i class="arg">net</i> <b class="method">privmsg</b> <i class="arg">target</i> <i class="arg">message</i></a></dt>
<dd><p>Sends <i class="arg">message</i> to <i class="arg">target</i>, which can be either a channel, or
another user, in which case their nick is used.</p></dd>
<dt><a name="23"><i class="arg">net</i> <b class="method">notice</b> <i class="arg">target</i> <i class="arg">message</i></a></dt>
<dd><p>Sends a <b class="const">notice</b> with message <i class="arg">message</i> to <i class="arg">target</i>,
which can be either a channel, or another user, in which case their nick is used.</p></dd>
<dt><a name="24"><i class="arg">net</i> <b class="method">ctcp</b> <i class="arg">target</i> <i class="arg">message</i></a></dt>
<dd><p>Sends a CTCP of type <i class="arg">message</i> to <i class="arg">target</i></p></dd>
<dt><a name="25"><i class="arg">net</i> <b class="method">kick</b> <i class="arg">channel</i> <i class="arg">target</i> <span class="opt">?<i class="arg">message</i>?</span></a></dt>
<dd><p>Kicks the user <i class="arg">target</i> from the channel <i class="arg">channel</i> with a <i class="arg">message</i>.
The latter can be left out.</p></dd>
<dt><a name="26"><i class="arg">net</i> <b class="method">mode</b> <i class="arg">target</i> <i class="arg">args</i></a></dt>
<dd><p>Sets the mode <i class="arg">args</i> on the target <i class="arg">target</i>. <i class="arg">target</i> may be a channel,
a channel user, or yourself.</p></dd>
<dt><a name="27"><i class="arg">net</i> <b class="method">topic</b> <i class="arg">channel</i> <i class="arg">message</i></a></dt>
<dd><p>Sets the topic on <i class="arg">channel</i> to <i class="arg">message</i> specifying an empty string
will remove the topic.</p></dd>
<dt><a name="28"><i class="arg">net</i> <b class="method">invite</b> <i class="arg">channel</i> <i class="arg">target</i></a></dt>
<dd><p>Invites <i class="arg">target</i> to join the channel <i class="arg">channel</i></p></dd>
<dt><a name="29"><i class="arg">net</i> <b class="method">send</b> <i class="arg">text</i></a></dt>
<dd><p>Sends <i class="arg">text</i> to the IRC server.</p></dd>
<dt><a name="30"><i class="arg">net</i> <b class="method">destroy</b></a></dt>
<dd><p>Deletes the connection and its associated namespace and information.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Callback Commands</a></h2>
<p>These commands can be used within callbacks</p>
<dl class="definitions">
<dt><a name="31"><b class="cmd">who</b> <span class="opt">?<b class="const">address</b>?</span></a></dt>
<dd><p>Returns the nick of the user who performed a command.  The optional
keyword <b class="const">address</b> causes the command to return the user in the
format &quot;username@address&quot;.</p></dd>
<dt><a name="32"><b class="cmd">action</b></a></dt>
<dd><p>Returns the action performed, such as KICK, PRIVMSG, MODE, etc...
Normally not useful, as callbacks are bound to a particular event.</p></dd>
<dt><a name="33"><b class="cmd">target</b></a></dt>
<dd><p>Returns the target of a particular command, such as the channel or
user to whom a PRIVMSG is sent.</p></dd>
<dt><a name="34"><b class="cmd">additional</b></a></dt>
<dd><p>Returns a list of any additional arguments after the target.</p></dd>
<dt><a name="35"><b class="cmd">header</b></a></dt>
<dd><p>Returns the entire event header (everything up to the :) as a proper list.</p></dd>
<dt><a name="36"><b class="cmd">msg</b></a></dt>
<dd><p>Returns the message portion of the command (the part after the :).</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>irc</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>rfc 1459</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key645">chat</a>, <a href="../../../../index.html#key687">irc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/irc/picoirc.html.
























































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>picoirc - Simple embeddable IRC interface</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/irc/picoirc.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ picoirc.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">picoirc(n) 0.5 tcllib &quot;Simple embeddable IRC interface&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>picoirc - Small and simple embeddable IRC client.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">CALLBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl</b></li>
<li>package require <b class="pkgname">picoirc <span class="opt">?0.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::picoirc::connect</b> <i class="arg">callback</i> <i class="arg">nick</i> <i class="arg">url</i></a></li>
<li><a href="#2"><b class="cmd">::picoirc::post</b> <i class="arg">context</i> <i class="arg">channel</i> <i class="arg">message</i></a></li>
<li><a href="#3"><b class="cmd">::picoirc::splituri</b> <i class="arg">uri</i></a></li>
<li><a href="#4"><b class="cmd">::picoirc::send</b> <i class="arg">context</i> <i class="arg">line</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a general purpose minimal IRC client suitable for 
embedding in other applications. All communication with the parent
application is done via an application provided callback procedure.
Each connection has its own state so you can hook up multiple servers
in a single application instance.</p>
<p>To initiate an IRC connection you must call <b class="cmd">picoirc::connect</b>
with a callback procedure, a nick-name to use on IRC and the IRC URL
that describes the connection. This will return a variable name that
is the irc connection context. See <span class="sectref"><a href="#section3">CALLBACK</a></span> for details.</p>
<p>This package is a fairly simple IRC client. If you need something with
more capability investigate the <b class="package"><a href="irc.html">irc</a></b> package.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::picoirc::connect</b> <i class="arg">callback</i> <i class="arg">nick</i> <i class="arg">url</i></a></dt>
<dd><p>Create a new irc connection to the server specified by <i class="arg">url</i> and
login using the <i class="arg">nick</i> as the username. The <i class="arg">callback</i> must be
as specified in <span class="sectref"><a href="#section3">CALLBACK</a></span>. Returns a package-specific variable
that is used when calling other commands in this package.</p></dd>
<dt><a name="2"><b class="cmd">::picoirc::post</b> <i class="arg">context</i> <i class="arg">channel</i> <i class="arg">message</i></a></dt>
<dd><p>This should be called to process user input and send it to the
server. A number of commands are recognised when prefixed with a
forward-slash (/). Such commands are converted to IRC command
sequences and then sent.</p></dd>
<dt><a name="3"><b class="cmd">::picoirc::splituri</b> <i class="arg">uri</i></a></dt>
<dd><p>Splits an IRC scheme uniform resource indicator into its component
parts. Returns a list of server, port and channel. The default port is
6667 and there is no default channel.</p></dd>
<dt><a name="4"><b class="cmd">::picoirc::send</b> <i class="arg">context</i> <i class="arg">line</i></a></dt>
<dd><p>This command is where all raw output to the server is handled. The
default action is to write the <i class="arg">line</i> to the irc socket. However,
before this happens the callback is called with &quot;debug write&quot;. This
permits the application author to inspect the raw IRC data and if
desired to return a break error code to halt further processing. In
this way the application can override the default send via the
callback procedure.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">CALLBACK</a></h2>
<p>The callback must look like:</p>
<pre class="example">
proc Callback {context state args} {
}
</pre>
<p>where context is the irc context variable name (in case you need to pass 
it back to a picoirc procedure). state is one of a number of states as
described below.</p>
<dl class="options">
<dt><b class="option">init</b></dt>
<dd><p>called just before the socket is created</p></dd>
<dt><b class="option">connect</b></dt>
<dd><p>called once we have connected, before we join any channels</p></dd>
<dt><b class="option">close</b></dt>
<dd><p>called when the socket gets closed, before the context is deleted. If
an error occurs before we get connected the only argument will be the
socket error message.</p></dd>
<dt><b class="option">userlist</b> <i class="arg">channel</i> <i class="arg">nicklist</i></dt>
<dd><p>called to notify the application of an updated userlist. This is
generated when the output of the NAMES irc command is seen. The
package collects the entire output which can span a number of output
lines from the server and calls this callback when they have all been
received.</p></dd>
<dt><b class="option">chat</b> <i class="arg">target</i> <i class="arg">nick</i> <i class="arg">message</i> <i class="arg">type</i></dt>
<dd><p>called when a message arrives. <i class="arg">target</i> is the identity that the
message was targetted for. This can be the logged in nick or a channel
name. <i class="arg">nick</i> is the name of the sender of the message. 
<i class="arg">message</i> is the message text. <i class="arg">type</i> is set to &quot;ACTION&quot; if the
message was sent as a CTCP ACTION</p></dd>
<dt><b class="option">system</b> <i class="arg">channel</i> <i class="arg">message</i></dt>
<dd><p>called when a system message is received</p></dd>
<dt><b class="option">topic</b> <i class="arg">channel</i> <i class="arg">topic</i></dt>
<dd><p>called when the channel topic string is seen. <i class="arg">topic</i> is the text
of the channel topic.</p></dd>
<dt><b class="option">traffic</b> <i class="arg">action</i> <i class="arg">channel</i> <i class="arg">nick</i> <span class="opt">?<i class="arg">newnick</i>?</span></dt>
<dd><p>called when users join, leave or change names.
<i class="arg">action</i> is either entered, left or nickchange and <i class="arg">nick</i>
is the user doing the action. <i class="arg">newnick</i> is
the new name if <i class="arg">action</i> is nickchange.</p>
<p><em>NOTE</em>: <i class="arg">channel</i> is often empty for these messages as nick
activities are global for the irc server. You will have
to manage the nick for all connected channels yourself.</p></dd>
<dt><b class="option">version</b></dt>
<dd><p>This is called to request a version string to use to
override the internal version. If implemented, you should
return as colon delimited string as</p>
<p>Appname:Appversion:LibraryVersion</p>
<p>For example, the default is</p>
<p>PicoIRC:[package provide picoirc]:Tcl [info patchlevel]</p></dd>
<dt><b class="option">debug</b> <i class="arg">type</i> <i class="arg">raw</i></dt>
<dd><p>called when data is either being read or written to the network
socket. <i class="arg">type</i> is set to <b class="const">read</b> when reading data and
<b class="const">write</b> if the data is to be written. <i class="arg">raw</i> is the
unprocessed IRC protocol data.</p>
<p>In both cases the application can return a break error code to
interrupt further processing of the raw data. If this is a 
<b class="const">read</b> operation then the package will not handle this line. If
the operation is <b class="const">write</b> then the package will not send the
data. This callback is intended for debugging protocol issues but
could be used to redirect all input and output if desired.</p></dd>
</dl>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>rfc 1459</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key645">chat</a>, <a href="../../../../index.html#key687">irc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/javascript/javascript.html.






















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>javascript - HTML and Java Script Generation</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/javascript/javascript.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ javascript.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">javascript(n) 1.0.2 tcllib &quot;HTML and Java Script Generation&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>javascript - Procedures to generate HTML and Java Script structures.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8</b></li>
<li>package require <b class="pkgname">javascript <span class="opt">?1.0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::javascript::makeSelectorWidget</b> <i class="arg">id leftLabel leftValueList rightLabel rightValueList rightNameList</i> <span class="opt">?<i class="arg">length</i>?</span> <span class="opt">?<i class="arg">minWidth</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::javascript::makeSubmitButton</b> <i class="arg">name value</i></a></li>
<li><a href="#3"><b class="cmd">::javascript::makeProtectedSubmitButton</b> <i class="arg">name value msg</i></a></li>
<li><a href="#4"><b class="cmd">::javascript::makeMasterButton</b> <i class="arg">master value slavePattern boolean</i></a></li>
<li><a href="#5"><b class="cmd">::javascript::makeParentCheckbox</b> <i class="arg">parentName childName</i></a></li>
<li><a href="#6"><b class="cmd">::javascript::makeChildCheckbox</b> <i class="arg">parentName childName</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">::javascript</b> package provides commands that generate
HTML and Java Script code.  These commands typically return an HTML
string as their result.  In particular, they do not output their
result to <b class="const">stdout</b>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::javascript::makeSelectorWidget</b> <i class="arg">id leftLabel leftValueList rightLabel rightValueList rightNameList</i> <span class="opt">?<i class="arg">length</i>?</span> <span class="opt">?<i class="arg">minWidth</i>?</span></a></dt>
<dd><p>Construct HTML code to create a dual-multi-selection megawidget.  This
megawidget consists of two side-by-side multi-selection boxes
separated by a left arrow and a right arrow button.  The right arrow
button moves all items selected in the left box to the right box.  The
left arrow button moves all items selected in the right box to the
left box.  The <i class="arg">id</i> argument is the suffix of all HTML objects in
this megawidget.  The <i class="arg">leftLabel</i> argument is the text that
appears above the left selection box.  The <i class="arg">leftValueList</i>
argument is the values of items in the left selection box.  The
<i class="arg">leftNameList</i> argument is the names to appear in the left
selection box.  The <i class="arg">rightLabel</i> argument is the text that appears
above the right selection box.  The <i class="arg">rightValueList</i> argument is
the values of items in the right selection box.  The
<i class="arg">rightNameList</i> argument is the names to appear in the right
selection box.  The <i class="arg">length</i> argument (optional) determines the
number of elts to show before adding a vertical scrollbar; it defaults
to 8.  The <i class="arg">minWidth</i> argument (optional) is the number of spaces
to determine the minimum box width; it defaults to 32.</p></dd>
<dt><a name="2"><b class="cmd">::javascript::makeSubmitButton</b> <i class="arg">name value</i></a></dt>
<dd><p>Create an HTML submit button that resets a hidden field for each
registered multi-selection box.  The <i class="arg">name</i> argument is the name
of the HTML button object to create.  The <i class="arg">value</i> argument is the
label of the HTML button object to create.</p></dd>
<dt><a name="3"><b class="cmd">::javascript::makeProtectedSubmitButton</b> <i class="arg">name value msg</i></a></dt>
<dd><p>Create an HTML submit button that prompts the user with a
continue/cancel shutdown warning before the form is submitted.  The
<i class="arg">name</i> argument is the name of the HTML button object to create.
The <i class="arg">value</i> argument is the label of the HTML button object to
create. The <i class="arg">msg</i> argument is the message to display when the
button is pressed.</p></dd>
<dt><a name="4"><b class="cmd">::javascript::makeMasterButton</b> <i class="arg">master value slavePattern boolean</i></a></dt>
<dd><p>Create an HTML button that sets its slave checkboxs to the boolean
value.  The <i class="arg">master</i> argument is the name of the child's parent
html checkbox object.  The <i class="arg">value</i> argument is the value of the
master.  The <i class="arg">slaves</i> argument is the name of child html checkbox
object to create.  The <i class="arg">boolean</i> argument is the java script
boolean value that will be given to all the slaves; it must be &quot;true&quot;
or &quot;false&quot;.</p></dd>
<dt><a name="5"><b class="cmd">::javascript::makeParentCheckbox</b> <i class="arg">parentName childName</i></a></dt>
<dd><p>Create an HTML checkbox and tie its value to that of its child
checkbox.  If the parent is unchecked, the child is automatically
unchecked.  The <i class="arg">parentName</i> argument is the name of parent html
checkbox object to create. The <i class="arg">childName</i> argument is the name of
the parent's child html checkbox object.</p></dd>
<dt><a name="6"><b class="cmd">::javascript::makeChildCheckbox</b> <i class="arg">parentName childName</i></a></dt>
<dd><p>Create an HTML checkbox and tie its value to that of its parent
checkbox.  If the child is checked, the parent is automatically
checked.  The <i class="arg">parentName</i> argument is the name of the child's
parent html checkbox object.  The <i class="arg">childName</i> argument is the name
of child html checkbox object to create.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>javascript</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../html/html.html">html</a>, <a href="../ncgi/ncgi.html">ncgi</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key570">checkbox</a>, <a href="../../../../index.html#key567">html</a>, <a href="../../../../index.html#key173">javascript</a>, <a href="../../../../index.html#key684">selectionbox</a>, <a href="../../../../index.html#key683">submitbutton</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>CGI programming</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/jpeg/jpeg.html.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>jpeg - JPEG image manipulation</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/jpeg/jpeg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004-2005, Code: Aaron Faupell &lt;[email protected]&gt;   -- Copyright &copy; 2007, Code:  Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2004-2009, Doc:  Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2011, Code: Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ jpeg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">jpeg(n) 0.4.0 tcllib &quot;JPEG image manipulation&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>jpeg - JPEG querying and manipulation of meta data</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">LIMITATIONS</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">jpeg <span class="opt">?0.4.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::jpeg::isJPEG</b> <i class="arg">file</i></a></li>
<li><a href="#2"><b class="cmd">::jpeg::imageInfo</b> <i class="arg">file</i></a></li>
<li><a href="#3"><b class="cmd">::jpeg::dimensions</b> <i class="arg">file</i></a></li>
<li><a href="#4"><b class="cmd">::jpeg::getThumbnail</b> <i class="arg">file</i></a></li>
<li><a href="#5"><b class="cmd">::jpeg::getExif</b> <i class="arg">file</i> <span class="opt">?<i class="arg">section</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::jpeg::getExifFromChannel</b> <i class="arg">channel</i> <span class="opt">?<i class="arg">section</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::jpeg::formatExif</b> <i class="arg">keys</i></a></li>
<li><a href="#8"><b class="cmd">::jpeg::exifKeys</b></a></li>
<li><a href="#9"><b class="cmd">::jpeg::removeExif</b> <i class="arg">file</i></a></li>
<li><a href="#10"><b class="cmd">::jpeg::stripJPEG</b> <i class="arg">file</i></a></li>
<li><a href="#11"><b class="cmd">::jpeg::getComments</b> <i class="arg">file</i></a></li>
<li><a href="#12"><b class="cmd">::jpeg::addComment</b> <i class="arg">file</i> <i class="arg">text</i>...</a></li>
<li><a href="#13"><b class="cmd">::jpeg::removeComments</b> <i class="arg">file</i></a></li>
<li><a href="#14"><b class="cmd">::jpeg::replaceComment</b> <i class="arg">file</i> <i class="arg">text</i></a></li>
<li><a href="#15"><b class="cmd">::jpeg::debug</b> <i class="arg">file</i></a></li>
<li><a href="#16"><b class="cmd">::jpeg::markers</b> <i class="arg">channel</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to query and modify JPEG images. JPEG
stands for <i class="term">Joint Photography Experts Group</i> and is a standard
for the lossy compression of photographical images. It is specified at
<a href="LINK_HERE">LINK_HERE</a>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::jpeg::isJPEG</b> <i class="arg">file</i></a></dt>
<dd><p>Returns a boolean value indicating if <i class="arg">file</i> is a
JPEG image.</p></dd>
<dt><a name="2"><b class="cmd">::jpeg::imageInfo</b> <i class="arg">file</i></a></dt>
<dd><p>Returns a dictionary with keys <b class="const">version</b>, <b class="const">units</b>,
<b class="const">xdensity</b>, <b class="const">ydensity</b>, <b class="const">xthumb</b>, and
<b class="const">ythumb</b>. The values are the associated properties of the JPEG
image in <i class="arg">file</i>.
Throws an error if <i class="arg">file</i> is not a JPEG image.</p></dd>
<dt><a name="3"><b class="cmd">::jpeg::dimensions</b> <i class="arg">file</i></a></dt>
<dd><p>Returns the dimensions of the JPEG <i class="arg">file</i> as a list of the
horizontal and vertical pixel count.
Throws an error if <i class="arg">file</i> is not a JPEG image.</p></dd>
<dt><a name="4"><b class="cmd">::jpeg::getThumbnail</b> <i class="arg">file</i></a></dt>
<dd><p>This procedure will return the binary thumbnail image data, if a JPEG
thumbnail is included in <i class="arg">file</i>, and the empty string
otherwise. Note that it is possible to include thumbnails in formats
other than JPEG although that is not common. The command finds
thumbnails that are encoded in either the JFXX or EXIF segments of the
JPEG information. If both are present the EXIF thumbnail will take precedence.
Throws an error if <i class="arg">file</i> is not a JPEG image.</p>
<pre class="example">
    set fh [open thumbnail.jpg w+]
    fconfigure $fh -translation binary -encoding binary
    puts -nonewline $fh [::jpeg::getThumbnail photo.jpg]
    close $fh
</pre>
</dd>
<dt><a name="5"><b class="cmd">::jpeg::getExif</b> <i class="arg">file</i> <span class="opt">?<i class="arg">section</i>?</span></a></dt>
<dd><p><i class="arg">section</i> must be one of <b class="const">main</b> or <b class="const">thumbnail</b>.
The default is <b class="const">main</b>.
Returns a dictionary containing the EXIF information for the specified section.
For example:</p>
<pre class="example">
    set exif {
	Make     Canon
	Model    {Canon DIGITAL IXUS}
	DateTime {2001:06:09 15:17:32}
    }
</pre>
<p>Throws an error if <i class="arg">file</i> is not a JPEG image.</p></dd>
<dt><a name="6"><b class="cmd">::jpeg::getExifFromChannel</b> <i class="arg">channel</i> <span class="opt">?<i class="arg">section</i>?</span></a></dt>
<dd><p>This command is as per <b class="cmd">::jpeg::getExif</b> except that it uses a
previously opened channel.  <i class="arg">channel</i> should be a seekable channel
and <i class="arg">section</i> is as described in the documentation of 
<b class="cmd">::jpeg::getExif</b>
Note: the jpeg parser expects that the start of the channel is the
start of the image data. If working with an image embedded in a
container file format it may be necessary to read the jpeg data into
a temporary container: either a temporary file or a memory channel.</p></dd>
<dt><a name="7"><b class="cmd">::jpeg::formatExif</b> <i class="arg">keys</i></a></dt>
<dd><p>Takes a list of key-value pairs as returned by <b class="cmd">getExif</b> and formats
many of the values into a more human readable form. As few as one key-value
may be passed in, the entire exif is not required.</p>
<pre class="example">
    foreach {key val} [::jpeg::formatExif [::jpeg::getExif photo.jpg]] {
        puts &quot;$key: $val&quot;
    }
</pre>
<pre class="example">
    array set exif [::jpeg::getExif photo.jpg]
    puts &quot;max f-stop: [::jpeg::formatExif [list MaxAperture $exif(MaxAperture)]]
</pre>
</dd>
<dt><a name="8"><b class="cmd">::jpeg::exifKeys</b></a></dt>
<dd><p>Returns a list of the EXIF keys which are currently understood.
There may be keys present in <b class="cmd">getExif</b> data that are not understood.
Those keys will appear in a 4 digit hexadecimal format.</p></dd>
<dt><a name="9"><b class="cmd">::jpeg::removeExif</b> <i class="arg">file</i></a></dt>
<dd><p>Removes the Exif data segment from the specified file and replaces
it with a standard JFIF segment.
Throws an error if <i class="arg">file</i> is not a JPEG image.</p></dd>
<dt><a name="10"><b class="cmd">::jpeg::stripJPEG</b> <i class="arg">file</i></a></dt>
<dd><p>Removes all metadata from the JPEG file leaving only
the image. This includes comments, EXIF segments, JFXX
segments, and application specific segments.
Throws an error if <i class="arg">file</i> is not a JPEG image.</p></dd>
<dt><a name="11"><b class="cmd">::jpeg::getComments</b> <i class="arg">file</i></a></dt>
<dd><p>Returns a list containing all the JPEG comments found in
the <i class="arg">file</i>.
Throws an error if <i class="arg">file</i> is not a valid JPEG image.</p></dd>
<dt><a name="12"><b class="cmd">::jpeg::addComment</b> <i class="arg">file</i> <i class="arg">text</i>...</a></dt>
<dd><p>Adds one or more plain <i class="arg">text</i> comments to the JPEG image
in <i class="arg">file</i>.
Throws an error if <i class="arg">file</i> is not a valid JPEG image.</p></dd>
<dt><a name="13"><b class="cmd">::jpeg::removeComments</b> <i class="arg">file</i></a></dt>
<dd><p>Removes all comments from the file specified.
Throws an error if <i class="arg">file</i> is not a valid JPEG image.</p></dd>
<dt><a name="14"><b class="cmd">::jpeg::replaceComment</b> <i class="arg">file</i> <i class="arg">text</i></a></dt>
<dd><p>Replaces the first comment in the file with the new <i class="arg">text</i>.
This is merely a shortcut for <b class="cmd">::jpeg::removeComments</b>
and <b class="cmd">::jpeg::addComment</b>
Throws an error if <i class="arg">file</i> is not a valid JPEG image.</p></dd>
<dt><a name="15"><b class="cmd">::jpeg::debug</b> <i class="arg">file</i></a></dt>
<dd><p>Prints everything we know about the given file in a nice format.</p></dd>
<dt><a name="16"><b class="cmd">::jpeg::markers</b> <i class="arg">channel</i></a></dt>
<dd><p>This is an internal helper command, we document it for use by advanced
users of the package. The argument <i class="arg">channel</i> is an open file
handle positioned at the start of the first marker (usually 2
bytes). The command returns a list with one element for each JFIF
marker found in the file. Each element consists of a list of the
marker name, its offset in the file, and its length. The offset points
to the beginning of the sections data, not the marker itself.  The
length is the length of the data from the offset listed to the start
of the next marker.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">LIMITATIONS</a></h2>
<p>can only work with files
cant write exif data
gps exif data not parsed
makernote data not yet implemented</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>jpeg</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key146">comment</a>, <a href="../../../../index.html#key143">exif</a>, <a href="../../../../index.html#key135">image</a>, <a href="../../../../index.html#key145">jfif</a>, <a href="../../../../index.html#key144">jpeg</a>, <a href="../../../../index.html#key142">thumbnail</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>File formats</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004-2005, Code: Aaron Faupell &lt;[email protected]&gt;<br>
Copyright &copy; 2007, Code:  Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2004-2009, Doc:  Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2011, Code: Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/json/json.html.

























































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>json - JSON</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/json/json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 ActiveState Software Inc.   -- Copyright &copy; 2009 Thomas Maeder, Glue Software Engineering AG
   -->
<! -- CVS: $Id$ json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">json(n) 1.1.2 tcllib &quot;JSON&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>json - JSON parser</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">json <span class="opt">?1.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::json::json2dict</b> <i class="arg">txt</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">json</b> package provides a simple Tcl-only library for parsing the
JSON <a href="http://www.json.org/">http://www.json.org/</a> data exchange format as specified in RFC 4627
<a href="http://www.ietf.org/rfc/rfc4627.txt">http://www.ietf.org/rfc/rfc4627.txt</a>.
There is some ambiguity in parsing JSON because JSON has type information that
is not maintained by the Tcl conversion.  The <b class="package">json</b> package returns
data as a Tcl <b class="cmd">dict</b>.  Either the <b class="package">dict</b> package or Tcl 8.5 is
required for use.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::json::json2dict</b> <i class="arg">txt</i></a></dt>
<dd><p>Parse JSON formatted text <i class="arg">txt</i> into a Tcl dict and return the value.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p>An example of a JSON array converted to Tcl.  A JSON array is returned as a
single item with multiple elements.</p>
<pre class="example">[
    {
       &quot;precision&quot;: &quot;zip&quot;,
       &quot;Latitude&quot;:  37.7668,
       &quot;Longitude&quot;: -122.3959,
       &quot;Address&quot;:   &quot;&quot;,
       &quot;City&quot;:      &quot;SAN FRANCISCO&quot;,
       &quot;State&quot;:     &quot;CA&quot;,
       &quot;Zip&quot;:       &quot;94107&quot;,
       &quot;Country&quot;:   &quot;US&quot;
    },
    {
       &quot;precision&quot;: &quot;zip&quot;,
       &quot;Latitude&quot;:  37.371991,
       &quot;Longitude&quot;: -122.026020,
       &quot;Address&quot;:   &quot;&quot;,
       &quot;City&quot;:      &quot;SUNNYVALE&quot;,
       &quot;State&quot;:     &quot;CA&quot;,
       &quot;Zip&quot;:       &quot;94085&quot;,
       &quot;Country&quot;:   &quot;US&quot;
    }
]
=&gt;
{Country US Latitude 37.7668 precision zip State CA City {SAN FRANCISCO} Address {} Zip 94107 Longitude -122.3959} {Country US Latitude 37.371991 precision zip State CA City SUNNYVALE Address {} Zip 94085 Longitude -122.026020}
</pre>
<p>An example of a JSON object converted to Tcl.  A JSON object is returned as a
multi-element list (a dict).</p>
<pre class="example">{
    &quot;Image&quot;: {
        &quot;Width&quot;:  800,
        &quot;Height&quot;: 600,
        &quot;Title&quot;:  &quot;View from 15th Floor&quot;,
        &quot;Thumbnail&quot;: {
            &quot;Url&quot;:    &quot;http://www.example.com/image/481989943&quot;,
            &quot;Height&quot;: 125,
            &quot;Width&quot;:  &quot;100&quot;
        },
        &quot;IDs&quot;: [116, 943, 234, 38793]
    }
}
=&gt;
Image {IDs {116 943 234 38793} Thumbnail {Width 100 Height 125 Url http://www.example.com/image/481989943} Width 800 Height 600 Title {View from 15th Floor}}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>json</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key171">data exchange</a>, <a href="../../../../index.html#key170">exchange format</a>, <a href="../../../../index.html#key173">javascript</a>, <a href="../../../../index.html#key172">json</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>CGI programming</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 ActiveState Software Inc.<br>
Copyright &copy; 2009 Thomas Maeder, Glue Software Engineering AG</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/json/json_write.html.








































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>json::write - JSON</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/json/json_write.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009-2013 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ json::write.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">json::write(n) 1.0.2 tcllib &quot;JSON&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>json::write - JSON generation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">json::write <span class="opt">?1.0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::json::write</b> <b class="method">indented</b></a></li>
<li><a href="#2"><b class="cmd">::json::write</b> <b class="method">indented</b> <i class="arg">flag</i></a></li>
<li><a href="#3"><b class="cmd">::json::write</b> <b class="method">aligned</b></a></li>
<li><a href="#4"><b class="cmd">::json::write</b> <b class="method">aligned</b> <i class="arg">flag</i></a></li>
<li><a href="#5"><b class="cmd">::json::write</b> <b class="method">string</b> <i class="arg">s</i></a></li>
<li><a href="#6"><b class="cmd">::json::write</b> <b class="method">array</b> <i class="arg">arg</i>...</a></li>
<li><a href="#7"><b class="cmd">::json::write</b> <b class="method">object</b> <i class="arg">key</i> <i class="arg">value</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">json::write</b> package provides a simple Tcl-only library
for generation of text in the JSON <a href="http://www.json.org/">http://www.json.org/</a> data
exchange format as specified in
RFC 4627 <a href="http://www.ietf.org/rfc/rfc4627.txt">http://www.ietf.org/rfc/rfc4627.txt</a>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::json::write</b> <b class="method">indented</b></a></dt>
<dd><p>This method returns the current state of the indentation setting.</p></dd>
<dt><a name="2"><b class="cmd">::json::write</b> <b class="method">indented</b> <i class="arg">flag</i></a></dt>
<dd><p>This and the method <b class="method">aligned</b> configure the layout of the JSON
generated by the package.</p>
<p>If this <i class="arg">flag</i> is set (default) the package will break the
generated JSON code across lines and indent it according to its inner
structure, with each key of an object on a separate line.</p>
<p>If this flag is not set, the whole JSON object will be written on a
single line, with minimum spacing between all elements.</p></dd>
<dt><a name="3"><b class="cmd">::json::write</b> <b class="method">aligned</b></a></dt>
<dd><p>This method returns the current state of the alignment setting.</p></dd>
<dt><a name="4"><b class="cmd">::json::write</b> <b class="method">aligned</b> <i class="arg">flag</i></a></dt>
<dd><p>This and the method <b class="method">indented</b> configure the layout of the JSON
generated by the package.</p>
<p>If this <i class="arg">flag</i> is set (default) the package ensures that the
values for the keys in an object are vertically aligned with each
other, for a nice table effect. To make this work this also implies
that <b class="variable">indented</b> is set as well.</p>
<p>If this flag is not set, the output is formatted as per the value of
<b class="variable">indented</b>, without trying to align the values for object keys.</p></dd>
<dt><a name="5"><b class="cmd">::json::write</b> <b class="method">string</b> <i class="arg">s</i></a></dt>
<dd><p>This method takes the string <i class="arg">s</i> and returns it properly quoted
for JSON as its result.</p></dd>
<dt><a name="6"><b class="cmd">::json::write</b> <b class="method">array</b> <i class="arg">arg</i>...</a></dt>
<dd><p>This method takes a series of JSON formatted arguments and returns
them as a properly formatted JSON array as its result.</p></dd>
<dt><a name="7"><b class="cmd">::json::write</b> <b class="method">object</b> <i class="arg">key</i> <i class="arg">value</i>...</a></dt>
<dd><p>This method takes a series of key/value arguments, the values already
formatted for JSON, and returns them as a properly formatted JSON
object as its result, with the keys formatted as JSON strings.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>json</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key171">data exchange</a>, <a href="../../../../index.html#key170">exchange format</a>, <a href="../../../../index.html#key173">javascript</a>, <a href="../../../../index.html#key172">json</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>CGI programming</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009-2013 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/lambda/lambda.html.


















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>lambda - Utility commands for anonymous procedures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/lambda/lambda.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2011 Andreas Kupries, BSD licensed
   -->
<! -- CVS: $Id$ lambda.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">lambda(n) 1 tcllib &quot;Utility commands for anonymous procedures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>lambda - Utility commands for anonymous procedures</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">AUTHORS</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">lambda <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::lambda</b> <i class="arg">arguments</i> <i class="arg">body</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">::lambda@</b> <i class="arg">namespace</i> <i class="arg">arguments</i> <i class="arg">body</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides two convenience commands to make the writing of
anonymous procedures, i.e. lambdas more <b class="cmd"><a href="../../../../index.html#key543">proc</a></b>-like. Instead of,
for example, to write</p>
<pre class="example">
     set f {::apply {{x} {
        ....
     }}}
</pre>
<p>with its deep nesting of braces, or</p>
<pre class="example">
     set f [list ::apply {{x y} {
        ....
     }} $value_for_x]
</pre>
<p>with a list command to insert some of the arguments of a partial
application, just write</p>
<pre class="example">
     set f [lambda {x} {
        ....
     }]
</pre>
<p>and</p>
<pre class="example">
     set f [lambda {x y} {
        ....
     } $value_for_x]
</pre>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::lambda</b> <i class="arg">arguments</i> <i class="arg">body</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>The command constructs an anonymous procedure from the list of
arguments, body script and (optional) predefined argument values and
returns a command prefix representing this anonymous procedure.</p>
<p>When invoked the <i class="arg">body</i> is run in a new procedure scope
just underneath the global scope, with the arguments set to the values
supplied at both construction and invokation time.</p></dd>
<dt><a name="2"><b class="cmd">::lambda@</b> <i class="arg">namespace</i> <i class="arg">arguments</i> <i class="arg">body</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>The command constructs an anonymous procedure from the namespace name,
list of arguments, body script and (optional) predefined argument
values and returns a command prefix representing this anonymous
procedure.</p>
<p>When invoked the <i class="arg">body</i> is run in a new procedure scope in
the <i class="arg">namespace</i>, with the arguments set to the values supplied at
both construction and invokation time.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">AUTHORS</a></h2>
<p>Andreas Kupries</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>lambda</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>apply(n), proc(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key547">anonymous procedure</a>, <a href="../../../../index.html#key494">callback</a>, <a href="../../../../index.html#key545">command prefix</a>, <a href="../../../../index.html#key548">currying</a>, <a href="../../../../index.html#key546">lambda</a>, <a href="../../../../index.html#key544">partial application</a>, <a href="../../../../index.html#key543">proc</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Utility</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Andreas Kupries, BSD licensed</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ldap/ldap.html.































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>ldap - LDAP client</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ldap/ldap.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2004 Jochen Loewer &lt;[email protected]&gt;   -- Copyright &copy; 2006 Michael Schlenker &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ ldap.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ldap(n) 1.6.9 tcllib &quot;LDAP client&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ldap - LDAP client</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">ldap <span class="opt">?1.8?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ldap::connect</b> <i class="arg">host</i> <span class="opt">?<i class="arg">port</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::ldap::secure_connect</b> <i class="arg">host</i> <span class="opt">?<i class="arg">port</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::ldap::disconnect</b> <i class="arg">handle</i></a></li>
<li><a href="#4"><b class="cmd">::ldap::starttls</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">cafile</i>?</span> <span class="opt">?<i class="arg">certfile</i>?</span> <span class="opt">?<i class="arg">keyfile</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::ldap::bind</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">name</i>?</span> <span class="opt">?<i class="arg">password</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::ldap::bindSASL</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">name</i>?</span> <span class="opt">?<i class="arg">password</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::ldap::unbind</b> <i class="arg">handle</i></a></li>
<li><a href="#8"><b class="cmd">::ldap::search</b> <i class="arg">handle</i> <i class="arg">baseObject</i> <i class="arg">filterString</i> <i class="arg">attributes</i> <i class="arg">options</i></a></li>
<li><a href="#9"><b class="cmd">::ldap::searchInit</b> <i class="arg">handle</i> <i class="arg">baseObject</i> <i class="arg">filterString</i> <i class="arg">attributes</i> <i class="arg">options</i></a></li>
<li><a href="#10"><b class="cmd">::ldap::searchNext</b> <i class="arg">handle</i></a></li>
<li><a href="#11"><b class="cmd">::ldap::searchEnd</b> <i class="arg">handle</i></a></li>
<li><a href="#12"><b class="cmd">::ldap::modify</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">attrValToReplace</i> <span class="opt">?<i class="arg">attrToDelete</i>?</span> <span class="opt">?<i class="arg">attrValToAdd</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::ldap::modifyMulti</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">attrValToReplace</i> <span class="opt">?<i class="arg">attrValToDelete</i>?</span> <span class="opt">?<i class="arg">attrValToAdd</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::ldap::add</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">attrValueTuples</i></a></li>
<li><a href="#15"><b class="cmd">::ldap::addMulti</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">attrValueTuples</i></a></li>
<li><a href="#16"><b class="cmd">::ldap::delete</b> <i class="arg">handle</i> <i class="arg">dn</i></a></li>
<li><a href="#17"><b class="cmd">::ldap::modifyDN</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">newrdn</i> <span class="opt">?<i class="arg">deleteOld</i>?</span> <span class="opt">?<i class="arg">newSuperior</i>?</span></a></li>
<li><a href="#18"><b class="cmd">::ldap::info</b> <b class="cmd"><a href="../../../../index.html#key398">ip</a></b> <i class="arg">handle</i></a></li>
<li><a href="#19"><b class="cmd">::ldap::info</b> <b class="cmd">bound</b> <i class="arg">handle</i></a></li>
<li><a href="#20"><b class="cmd">::ldap::info</b> <b class="cmd">bounduser</b> <i class="arg">handle</i></a></li>
<li><a href="#21"><b class="cmd">::ldap::info</b> <b class="cmd">connections</b></a></li>
<li><a href="#22"><b class="cmd">::ldap::info</b> <b class="cmd"><a href="../../../../index.html#key289">tls</a></b> <i class="arg">handle</i></a></li>
<li><a href="#23"><b class="cmd">::ldap::info</b> <b class="cmd">saslmechanisms</b> <i class="arg">handle</i></a></li>
<li><a href="#24"><b class="cmd">::ldap::info</b> <b class="cmd"><a href="../control/control.html">control</a></b> <i class="arg">handle</i></a></li>
<li><a href="#25"><b class="cmd">::ldap::info</b> <b class="cmd">extensions</b> <i class="arg">extensions</i></a></li>
<li><a href="#26"><b class="cmd">::ldap::info</b> <b class="cmd">whoami</b> <i class="arg">handle</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">ldap</b> package provides a Tcl-only client library
for the LDAPv3 protocol as specified in
RFC 4511 (<a href="http://www.rfc-editor.org/rfc/rfc4511.txt">http://www.rfc-editor.org/rfc/rfc4511.txt</a>).
It works by opening the standard (or secure) LDAP socket on the
server, and then providing a Tcl API to access the LDAP protocol
commands.  All server errors are returned as Tcl errors (thrown) which
must be caught with the Tcl <b class="cmd">catch</b> command.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ldap::connect</b> <i class="arg">host</i> <span class="opt">?<i class="arg">port</i>?</span></a></dt>
<dd><p>Opens a LDAPv3 connection to the specified <i class="arg">host</i>, at the given
<i class="arg">port</i>, and returns a token for the connection. This token is the
<i class="arg">handle</i> argument for all other commands. If no <i class="arg">port</i> is
specified it will default to <b class="const">389</b>.</p>
<p>The command blocks until the connection has been established, or
establishment definitely failed.</p></dd>
<dt><a name="2"><b class="cmd">::ldap::secure_connect</b> <i class="arg">host</i> <span class="opt">?<i class="arg">port</i>?</span></a></dt>
<dd><p>Like <b class="cmd">::ldap::connect</b>, except that the created connection is
secured by SSL. The port defaults to <b class="const">636</b>.  This command
depends on the availability of the package <b class="package"><a href="../../../../index.html#key289">TLS</a></b>, which is a
SSL binding for Tcl. If <b class="package"><a href="../../../../index.html#key289">TLS</a></b> is not available, then this
command will fail.</p>
<p>The command blocks until the connection has been established, or
establishment definitely failed.</p></dd>
<dt><a name="3"><b class="cmd">::ldap::disconnect</b> <i class="arg">handle</i></a></dt>
<dd><p>Closes the ldap connection refered to by the token
<i class="arg">handle</i>. Returns the empty string as its result.</p></dd>
<dt><a name="4"><b class="cmd">::ldap::starttls</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">cafile</i>?</span> <span class="opt">?<i class="arg">certfile</i>?</span> <span class="opt">?<i class="arg">keyfile</i>?</span></a></dt>
<dd><p>Start TLS negotiation on the connection denoted by <i class="arg">handle</i>.
This is currently experimental and subject to change, more control over the TLS details
will probably be exposed later, to allow users to fine tune the negotiation according
to their security needs.</p></dd>
<dt><a name="5"><b class="cmd">::ldap::bind</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">name</i>?</span> <span class="opt">?<i class="arg">password</i>?</span></a></dt>
<dd><p>This command authenticates the ldap connection refered to by the token
in <i class="arg">handle</i>, with a user name and associated password. It blocks
until a response from the ldap server arrives. Its result is the empty
string.
Both <i class="arg">name</i> and <i class="arg">passwd</i> default to the empty string if they
are not specified.
By leaving out <i class="arg">name</i> and <i class="arg">passwd</i> you can make an anonymous bind to 
the ldap server.
You can issue <b class="cmd">::ldap::bind</b> again to bind with different credentials.</p></dd>
<dt><a name="6"><b class="cmd">::ldap::bindSASL</b> <i class="arg">handle</i> <span class="opt">?<i class="arg">name</i>?</span> <span class="opt">?<i class="arg">password</i>?</span></a></dt>
<dd><p>This command uses SASL authentication mechanisms to do a multistage bind.
Its otherwise identical to the standard <b class="cmd">::ldap::bind</b>.
This feature is currently experimental and subject to change. See the documentation
for the <b class="package"><a href="../sasl/sasl.html">SASL</a></b> and the &quot;<b class="file">SASL.txt</b>&quot; in the tcllib CVS repository for 
details how to setup and use SASL with openldap.</p></dd>
<dt><a name="7"><b class="cmd">::ldap::unbind</b> <i class="arg">handle</i></a></dt>
<dd><p>This command asks the ldap server to release the last bind done for
the connection refered to by the token in <i class="arg">handle</i>.
The <i class="arg">handle</i> is invalid after the unbind, as the server closes the connection. 
So this is effectivly just a more polite disconnect operation.</p></dd>
<dt><a name="8"><b class="cmd">::ldap::search</b> <i class="arg">handle</i> <i class="arg">baseObject</i> <i class="arg">filterString</i> <i class="arg">attributes</i> <i class="arg">options</i></a></dt>
<dd><p>This command performs a LDAP search below the <i class="arg">baseObject</i> tree
using a complex LDAP search expression <i class="arg">filterString</i> and returns
the specified <i class="arg">attributes</i> of all matching objects (DNs). If the
list of <i class="arg">attributes</i> was empty all attributes are returned. The
command blocks until it has received all results.
The valid <i class="arg">options</i> are identical to the options listed for <b class="cmd">::ldap::searchInit</b>.</p>
<p>An example of a search expression is</p>
<pre class="example">
    set filterString &quot;|(cn=Linus*)(sn=Torvalds*)&quot;
</pre>
<p>The return value of the command is a list of nested dictionaries. The
first level keys are object identifiers (DNs), second levels keys are
attribute names. In other words, it is in the form</p>
<pre class="example">
    {dn1 {attr1 {val11 val12 ...} attr2 {val21...} ...}} {dn2 {a1 {v11 ...} ...}} ...
</pre>
</dd>
<dt><a name="9"><b class="cmd">::ldap::searchInit</b> <i class="arg">handle</i> <i class="arg">baseObject</i> <i class="arg">filterString</i> <i class="arg">attributes</i> <i class="arg">options</i></a></dt>
<dd><p>This command initiates a LDAP search below the <i class="arg">baseObject</i> tree
using a complex LDAP search expression <i class="arg">filterString</i>. 
The search gets the specified <i class="arg">attributes</i> of all matching objects (DNs). 
The command itself just starts the search, to retrieve the actual results, use 
<b class="cmd">::ldap::searchNext</b>. 
A search can be terminated at any time by
<b class="cmd">::ldap::searchEnd</b>. This informs the server that no further results should be sent by sending and ABANDON message
and cleans up the internal state of the search.
Only one <b class="cmd">::ldap::search</b> can be active at a given time, this
includes the introspection commands <b class="cmd">::ldap::info saslmechanisms</b>, <b class="cmd">ldap::info control</b> and 
<b class="cmd">ldap::info extensions</b>, which invoke a search internally.
Error responses from the server due to wrong arguments or similar things are returned
with the first <b class="cmd">::ldap::searchNext</b> call and should be checked and dealed with there.
If the list of requested <i class="arg">attributes</i> is empty all attributes will be returned.
The parameter <i class="arg">options</i> specifies the options to be used in the search,
and has the following format:</p>
<pre class="example">
    {-option1 value1 -option2 value2 ... }
</pre>
<p>Following options are available:</p>
<dl class="options">
<dt><b class="option">-scope</b> base one sub</dt>
<dd><p>Control the scope of the search to be one of <b class="const">base</b>, <b class="const">one</b>, or <b class="const">sub</b>,  to  specify  a  base
object,  one-level or  subtree  search.   The  default is <b class="const">sub</b>.</p></dd>
<dt><b class="option">-derefaliases</b> never search find always</dt>
<dd><p>Control how aliases dereferencing is done.  Should be one of <b class="const">never</b>, <b class="const">always</b>, <b class="const">search</b>,  or  <b class="const">find</b>  to
specify that aliases are never dereferenced, always dereferenced, dereferenced when searching, or
dereferenced only when locating the base object for the search.  
The default is to never dereference aliases.</p></dd>
<dt><b class="option">-sizelimit</b> num</dt>
<dd><p>Determines the maximum number of entries to return in a search. If specified as
0 no limit is enforced. The server may enforce a configuration dependent sizelimit,
which may be lower than the one given by this option. The default is 0, no limit.</p></dd>
<dt><b class="option">-timelimit</b> seconds</dt>
<dd><p>Asks the server to use a timelimit of <i class="arg">seconds</i> for the search. Zero means no 
limit. The default is 0, no limit.</p></dd>
<dt><b class="option">-attrsonly</b> boolean</dt>
<dd><p>If set to 1 only the attribute names but not the values will be present in the search result.
The default is to retrieve attribute names and values.</p></dd>
<dt><b class="option">-referencevar</b> varname</dt>
<dd><p>If set the search result reference LDAPURIs, if any, are returned in the given variable.
The caller can than decide to follow those references and query other LDAP servers for
further results.</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::ldap::searchNext</b> <i class="arg">handle</i></a></dt>
<dd><p>This command returns the next entry from a LDAP search initiated
by <b class="cmd">::ldap::searchInit</b>. It returns only after a new result is received
or when no further results are available, but takes care to keep
the event loop alive.
The returned entry is a list with
two elements: the first is the DN of the entry, the second is the
list of attributes and values, under the format:</p>
<pre class="example">
    dn {attr1 {val11 val12 ...} attr2 {val21...} ...}
</pre>
<p>The <b class="cmd">::ldap::searchNext</b> command returns an empty list at the
end of the search.</p></dd>
<dt><a name="11"><b class="cmd">::ldap::searchEnd</b> <i class="arg">handle</i></a></dt>
<dd><p>This command terminates a LDAP search initiated
by <b class="cmd">::ldap::searchInit</b>. It also cleans up
the internal state so a new search can be initiated.
If the client has not yet received all results, the client
sends an ABANDON message to inform the server that no
further results for the previous search should to be sent.</p></dd>
<dt><a name="12"><b class="cmd">::ldap::modify</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">attrValToReplace</i> <span class="opt">?<i class="arg">attrToDelete</i>?</span> <span class="opt">?<i class="arg">attrValToAdd</i>?</span></a></dt>
<dd><p>This command modifies the object <i class="arg">dn</i> on the ldap server we are
connected to via <i class="arg">handle</i>. It replaces attributes with new values,
deletes attributes, and adds new attributes with new values.
All arguments are dictionaries mapping attribute names to values. The
optional arguments default to the empty dictionary, which means that
no attributes will be deleted nor added.</p>
<dl class="arguments">
<dt>dictionary <i class="arg">attrValToReplace</i> (in)</dt>
<dd><p>No attributes will be changed if this argument is empty. The
dictionary contains the new attributes and their values. They
<em>replace all</em> attributes known to the object.</p></dd>
<dt>dictionary <i class="arg">attrToDelete</i> (in)</dt>
<dd><p>No attributes will be deleted if this argument is empty. The
dictionary values are restrictions on the deletion. An attribute
listed here will be deleted if and only if its current value at the
server matches the value specified in the dictionary, or if the value
in the dictionary is the empty string.</p></dd>
<dt>dictionary <i class="arg">attrValToAdd</i> (in)</dt>
<dd><p>No attributes will be added if this argument is empty. The dictionary
values are the values for the new attributes.</p></dd>
</dl>
<p>The command blocks until all modifications have completed. Its result
is the empty string.</p></dd>
<dt><a name="13"><b class="cmd">::ldap::modifyMulti</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">attrValToReplace</i> <span class="opt">?<i class="arg">attrValToDelete</i>?</span> <span class="opt">?<i class="arg">attrValToAdd</i>?</span></a></dt>
<dd><p>This command modifies the object <i class="arg">dn</i> on the ldap server we are
connected to via <i class="arg">handle</i>. It replaces attributes with new values,
deletes attributes, and adds new attributes with new values.
All arguments are lists with the format:</p>
<pre class="example">
    attr1 {val11 val12 ...} attr2 {val21...} ...
</pre>
<p>where each value list may be empty for deleting all attributes.
The optional arguments default to empty lists of attributes to
delete and to add.</p>
<dl class="arguments">
<dt>list <i class="arg">attrValToReplace</i> (in)</dt>
<dd><p>No attributes will be changed if this argument is empty. The
dictionary contains the new attributes and their values. They
<em>replace all</em> attributes known to the object.</p></dd>
<dt>list <i class="arg">attrValToDelete</i> (in)</dt>
<dd><p>No attributes will be deleted if this argument is empty. If no
value is specified, the whole set of values for an attribute
will be deleted.</p></dd>
<dt>list <i class="arg">attrValToAdd</i> (in)</dt>
<dd><p>No attributes will be added if this argument is empty.</p></dd>
</dl>
<p>The command blocks until all modifications have completed. Its result
is the empty string.</p></dd>
<dt><a name="14"><b class="cmd">::ldap::add</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">attrValueTuples</i></a></dt>
<dd><p>This command creates a new object using the specified <i class="arg">dn</i>. The
attributes of the new object are set to the values in the list
<i class="arg">attrValueTuples</i>.
Multiple valuated attributes may be specified using multiple tuples.
The command blocks until the operation has completed. Its result
is the empty string.</p></dd>
<dt><a name="15"><b class="cmd">::ldap::addMulti</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">attrValueTuples</i></a></dt>
<dd><p>This command is the preferred one to create
a new object using the specified <i class="arg">dn</i>. The
attributes of the new object are set to the values in the dictionary
<i class="arg">attrValueTuples</i> (which is keyed by the attribute names).
Each tuple is a list containing multiple values.
The command blocks until the operation has completed. Its result
is the empty string.</p></dd>
<dt><a name="16"><b class="cmd">::ldap::delete</b> <i class="arg">handle</i> <i class="arg">dn</i></a></dt>
<dd><p>This command removes the object specified by <i class="arg">dn</i>, and all its
attributes from the server.
The command blocks until the operation has completed. Its result
is the empty string.</p></dd>
<dt><a name="17"><b class="cmd">::ldap::modifyDN</b> <i class="arg">handle</i> <i class="arg">dn</i> <i class="arg">newrdn</i> <span class="opt">?<i class="arg">deleteOld</i>?</span> <span class="opt">?<i class="arg">newSuperior</i>?</span></a></dt>
<dd><p>]
This command moves or copies the object specified by <i class="arg">dn</i>
to a new location in the tree of object. This location is
specified by <i class="arg">newrdn</i>, a <em>relative</em> designation,
or by <i class="arg">newrdn</i> and <i class="arg">newSuperior</i>, a <em>absolute</em> designation.
The optional argument <i class="arg">deleteOld</i> defaults to <b class="const">true</b>,
i.e. a move operation. If <i class="arg">deleteOld</i> is not set, then the
operation will create a copy of <i class="arg">dn</i> in the new location.
The optional argument <i class="arg">newSuperior</i> defaults an empty string,
meaning that the object must not be relocated in another branch of
the tree. If this argument is given, the argument <i class="arg">deleteOld</i>
must be specified also.
The command blocks until the operation has completed. Its result
is the empty string.</p></dd>
<dt><a name="18"><b class="cmd">::ldap::info</b> <b class="cmd"><a href="../../../../index.html#key398">ip</a></b> <i class="arg">handle</i></a></dt>
<dd><p>This command returns the IP address of the remote LDAP server the handle is connected to.</p></dd>
<dt><a name="19"><b class="cmd">::ldap::info</b> <b class="cmd">bound</b> <i class="arg">handle</i></a></dt>
<dd><p>This command returns 1 if a handle has successfully completed a <b class="cmd">::ldap::bind</b>. 
If no bind was done or it failed, a 0 is returned.</p></dd>
<dt><a name="20"><b class="cmd">::ldap::info</b> <b class="cmd">bounduser</b> <i class="arg">handle</i></a></dt>
<dd><p>This command returns the username used in the bind operation if a handle has successfully completed a <b class="cmd">::ldap::bind</b>. 
If no bound was done or it failed, an empty string is returned.</p></dd>
<dt><a name="21"><b class="cmd">::ldap::info</b> <b class="cmd">connections</b></a></dt>
<dd><p>This command returns all currently existing ldap connection handles.</p></dd>
<dt><a name="22"><b class="cmd">::ldap::info</b> <b class="cmd"><a href="../../../../index.html#key289">tls</a></b> <i class="arg">handle</i></a></dt>
<dd><p>This command returns 1 if the ldap connection <i class="arg">handle</i> used TLS/SSL for
connection via <b class="cmd">ldap::secure_connect</b> or completed <b class="cmd">ldap::starttls</b>, 0 otherwise.</p></dd>
<dt><a name="23"><b class="cmd">::ldap::info</b> <b class="cmd">saslmechanisms</b> <i class="arg">handle</i></a></dt>
<dd><p>Return the supported SASL mechanisms advertised by the server. Only valid in a
bound state (anonymous or other).</p></dd>
<dt><a name="24"><b class="cmd">::ldap::info</b> <b class="cmd"><a href="../control/control.html">control</a></b> <i class="arg">handle</i></a></dt>
<dd><p>Return the supported controls advertised by the server as a list of OIDs. Only valid in a bound state.
This is currently experimental and subject to change.</p></dd>
<dt><a name="25"><b class="cmd">::ldap::info</b> <b class="cmd">extensions</b> <i class="arg">extensions</i></a></dt>
<dd><p>Returns the supported LDAP extensions as list of OIDs. Only valid in a bound state.
This is currently experimental and subject to change.</p></dd>
<dt><a name="26"><b class="cmd">::ldap::info</b> <b class="cmd">whoami</b> <i class="arg">handle</i></a></dt>
<dd><p>Returns authzId for the current connection. This implements the RFC 4532
protocol extension.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p>A small example, extracted from the test application coming with this
code.</p>
<pre class="example">
    package require ldap
    # Connect, bind, add a new object, modify it in various ways
    set handle [ldap::connect localhost 9009]
    set dn &quot;cn=Manager, o=University of Michigan, c=US&quot;
    set pw secret
    ldap::bind $handle $dn $pw
    set dn &quot;cn=Test User,ou=People,o=University of Michigan,c=US&quot;
    ldap::add $handle $dn {
	objectClass     OpenLDAPperson
	cn              {Test User}
	mail            [email protected]
	uid             testuid
	sn              User
	telephoneNumber +31415926535
	telephoneNumber +27182818285
    }
    set dn &quot;cn=Another User,ou=People,o=University of Michigan,c=US&quot;
    ldap::addMulti $handle $dn {
	objectClass     {OpenLDAPperson}
	cn              {{Anotther User}}
	mail            {[email protected]}
	uid             {testuid}
	sn              {User}
	telephoneNumber {+31415926535 +27182818285}
    }
    # Replace all attributes
    ldap::modify $handle $dn [list drink icetea uid JOLO]
    # Add some more
    ldap::modify $handle $dn {} {} [list drink water  drink orangeJuice pager &quot;+1 313 555 7671&quot;]
    # Delete
    ldap::modify $handle $dn {} [list drink water  pager &quot;&quot;]
    # Move
    ldap::modifyDN $handle $dn &quot;cn=Tester&quot;
    # Kill the test object, and shut the connection down.
    set dn &quot;cn=Tester,ou=People,o=University of Michigan,c=US&quot;
    ldap::delete $handle $dn
 
    ldap::unbind     $handle
    ldap::disconnect $handle
</pre>
<p>And a another example, a simple query, and processing the
results.</p>
<pre class="example">
    package require ldap
    set handle [ldap::connect ldap.acme.com 389]
    ldap::bind $handle
    set results [ldap::search $handle &quot;o=acme,dc=com&quot; &quot;(uid=jdoe)&quot; {}]
    foreach result $results {
	foreach {object attributes} $result break
	# The processing here is similar to what 'parray' does.
	# I.e. finding the longest attribute name and then
	# generating properly aligned output listing all attributes
	# and their values.
	set width 0
	set sortedAttribs {}
	foreach {type values} $attributes {
	    if {[string length $type] &gt; $width} {
		set width [string length $type] 
	    }
	    lappend sortedAttribs [list $type $values]
	}     
	puts &quot;object='$object'&quot;
	foreach sortedAttrib  $sortedAttribs {
	    foreach {type values} $sortedAttrib break
	    foreach value $values {
		regsub -all &quot;\[\x01-\x1f\]&quot; $value ? value
		puts [format &quot;  %-${width}s %s&quot; $type $value]
	    }
	}
	puts &quot;&quot;
    }
    ldap::unbind $handle
    ldap::disconnect $handle
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ldap</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.
One know bug is the usage of <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b> inside the dispatch mechanism, which makes
it currently unsafe to use this code in code that also enters the event loop.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key127">directory access</a>, <a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key124">ldap</a>, <a href="../../../../index.html#key121">ldap client</a>, <a href="../../../../index.html#key125">protocol</a>, <a href="../../../../index.html#key123">rfc 2251</a>, <a href="../../../../index.html#key126">rfc 4511</a>, <a href="../../../../index.html#key128">x.500</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2004 Jochen Loewer &lt;[email protected]&gt;<br>
Copyright &copy; 2006 Michael Schlenker &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ldap/ldapx.html.
















































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>ldapx - LDAP extended object interface</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ldap/ldapx.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Pierre David &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ ldapx.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ldapx(n) 0.2.5 tcllib &quot;LDAP extended object interface&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ldapx - LDAP extended object interface</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a></li>
<li class="section"><a href="#section3">ENTRY CLASS</a>
<ul>
<li class="subsection"><a href="#subsection1">Entry Instance Data</a></li>
<li class="subsection"><a href="#subsection2">Entry Options</a></li>
<li class="subsection"><a href="#subsection3">Methods for all kinds of entries</a></li>
<li class="subsection"><a href="#subsection4">Methods for standard entries only</a></li>
<li class="subsection"><a href="#subsection5">Methods for change entries only</a></li>
<li class="subsection"><a href="#subsection6">Entry Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">LDAP CLASS</a>
<ul>
<li class="subsection"><a href="#subsection7">Ldap Instance Data</a></li>
<li class="subsection"><a href="#subsection8">Ldap Options</a></li>
<li class="subsection"><a href="#subsection9">Ldap Methods</a></li>
<li class="subsection"><a href="#subsection10">Ldap Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">LDIF CLASS</a>
<ul>
<li class="subsection"><a href="#subsection11">Ldif Instance Data</a></li>
<li class="subsection"><a href="#subsection12">Ldif Options</a></li>
<li class="subsection"><a href="#subsection13">Ldif Methods</a></li>
<li class="subsection"><a href="#subsection14">Ldif Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">References</a></li>
<li class="section"><a href="#section7">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">ldapx <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><i class="arg">e</i> <b class="method">reset</b></a></li>
<li><a href="#2"><i class="arg">e</i> <b class="method">dn</b> <span class="opt">?<i class="arg">newdn</i>?</span></a></li>
<li><a href="#3"><i class="arg">e</i> <b class="method">rdn</b></a></li>
<li><a href="#4"><i class="arg">e</i> <b class="method">superior</b></a></li>
<li><a href="#5"><i class="arg">e</i> <b class="method">print</b></a></li>
<li><a href="#6"><i class="arg">se</i> <b class="method">isempty</b></a></li>
<li><a href="#7"><i class="arg">se</i> <b class="method">get</b> <i class="arg">attr</i></a></li>
<li><a href="#8"><i class="arg">se</i> <b class="method">get1</b> <i class="arg">attr</i></a></li>
<li><a href="#9"><i class="arg">se</i> <b class="method">set</b> <i class="arg">attr</i> <i class="arg">values</i></a></li>
<li><a href="#10"><i class="arg">se</i> <b class="method">set1</b> <i class="arg">attr</i> <i class="arg">value</i></a></li>
<li><a href="#11"><i class="arg">se</i> <b class="method">add</b> <i class="arg">attr</i> <i class="arg">values</i></a></li>
<li><a href="#12"><i class="arg">se</i> <b class="method">add1</b> <i class="arg">attr</i> <i class="arg">value</i></a></li>
<li><a href="#13"><i class="arg">se</i> <b class="method">del</b> <i class="arg">attr</i> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#14"><i class="arg">se</i> <b class="method">del1</b> <i class="arg">attr</i> <i class="arg">value</i></a></li>
<li><a href="#15"><i class="arg">se</i> <b class="method">getattr</b></a></li>
<li><a href="#16"><i class="arg">se</i> <b class="method">getall</b></a></li>
<li><a href="#17"><i class="arg">se</i> <b class="method">setall</b> <i class="arg">avpairs</i></a></li>
<li><a href="#18"><i class="arg">se</i> <b class="method">backup</b> <span class="opt">?<i class="arg">other</i>?</span></a></li>
<li><a href="#19"><i class="arg">se</i> <b class="method">swap</b></a></li>
<li><a href="#20"><i class="arg">se</i> <b class="method">restore</b> <span class="opt">?<i class="arg">other</i>?</span></a></li>
<li><a href="#21"><i class="arg">se</i> <b class="method">apply</b> <i class="arg">centry</i></a></li>
<li><a href="#22"><i class="arg">ce</i> <b class="method">change</b> <span class="opt">?<i class="arg">new</i>?</span></a></li>
<li><a href="#23"><i class="arg">ce</i> <b class="method">diff</b> <i class="arg">new</i> <span class="opt">?<i class="arg">old</i>?</span></a></li>
<li><a href="#24"><i class="arg">la</i> <b class="method">error</b> <span class="opt">?<i class="arg">newmsg</i>?</span></a></li>
<li><a href="#25"><i class="arg">la</i> <b class="method">connect</b> <i class="arg">url</i> <span class="opt">?<i class="arg">binddn</i>?</span> <span class="opt">?<i class="arg">bindpw</i>?</span></a></li>
<li><a href="#26"><i class="arg">la</i> <b class="method">disconnect</b></a></li>
<li><a href="#27"><i class="arg">la</i> <b class="method">traverse</b> <i class="arg">base</i> <i class="arg">filter</i> <i class="arg">attrs</i> <i class="arg">entry</i> <i class="arg">body</i></a></li>
<li><a href="#28"><i class="arg">la</i> <b class="method">search</b> <i class="arg">base</i> <i class="arg">filter</i> <i class="arg">attrs</i></a></li>
<li><a href="#29"><i class="arg">la</i> <b class="method">read</b> <i class="arg">base</i> <i class="arg">filter</i> <i class="arg">entry</i> ... <i class="arg">entry</i></a></li>
<li><a href="#30"><i class="arg">la</i> <b class="method">commit</b> <i class="arg">entry</i> ... <i class="arg">entry</i></a></li>
<li><a href="#31"><i class="arg">li</i> <b class="method">channel</b> <i class="arg">chan</i></a></li>
<li><a href="#32"><i class="arg">li</i> <b class="method">error</b> <span class="opt">?<i class="arg">newmsg</i>?</span></a></li>
<li><a href="#33"><i class="arg">li</i> <b class="method">read</b> <i class="arg">entry</i></a></li>
<li><a href="#34"><i class="arg">li</i> <b class="method">write</b> <i class="arg">entry</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">ldapx</b> package provides an extended Tcl interface to
LDAP directores and LDIF files. The <b class="package">ldapx</b> package is built
upon the <b class="package"><a href="ldap.html">ldap</a></b> package in order to get low level LDAP access.</p>
<p>LDAP access is compatible with RFC 2251
(<a href="http://www.rfc-editor.org/rfc/rfc2251.txt">http://www.rfc-editor.org/rfc/rfc2251.txt</a>).
LDIF access is compatible with RFC 2849
(<a href="http://www.rfc-editor.org/rfc/rfc2849.txt">http://www.rfc-editor.org/rfc/rfc2849.txt</a>).</p>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<p>The <b class="package">ldapx</b> package provides objects to interact with LDAP
directories and LDIF files with an easy to use programming interface.
It implements three <b class="package"><a href="../snit/snit.html">snit</a></b>::type classes.</p>
<p>The first class, <b class="class">entry</b>, is used to store individual entries.
Two different formats are available: the first one is the
<em>standard</em> format, which represents an entry as read from the
directory. The second format is the <em>change</em> format, which
stores differences between two standard entries.</p>
<p>With these entries, an application which wants to modify an entry
in a directory needs to read a (standard) entry from the directory,
create a fresh copy into a new (standard) entry, modify the new
copy, and then compute the differences between the two entries into
a new (change) entry, which may be commited to the directory.</p>
<p>Such kinds of modifications are so heavily used that standard entries
may contain their own copy of the original data. With such a copy,
the application described above reads a (standard) entry from the
directory, backs-up the original data, modifies the entry, and
computes the differences between the entry and its backup. These
differences are then commited to the directory.</p>
<p>Methods are provided to compute differences between two entries,
to apply differences to an entry in order to get a new entry, and
to get or set attributes in standard entries.</p>
<p>The second class is the <b class="class">ldap</b> class. It provides a method
to <b class="method">connect</b> and bind to the directory with a uniform access
to LDAP and LDAPS through an URL (ldap:// or ldaps://). The
<b class="method">traverse</b> control structure executes a body for each entry
found in the directory. The <b class="method">commit</b> method applies some
changes (represented as <b class="class">entry</b> objects) to the directory.
Since some attributes are represented as UTF-8 strings, the option
<b class="option">-utf8</b> controls which attributes must be converted and
which attributes must not be converted.</p>
<p>The last class is the <b class="class">ldif</b> class. It provides a method to
associate a standard Tcl <em>channel</em> to an LDIF object. Then,
methods <b class="method">read</b> and <b class="method">write</b> read or write entries from
or to this channel. This class can make use of standard or change
entries, according to the type of the LDIF file which may contain
either standard entries or change entries (but not both at the same
time). The option <b class="option">-utf8</b> works exactly as with the
<b class="class">ldap</b> class.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">ENTRY CLASS</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Entry Instance Data</a></h3>
<p>An instance of the <b class="class">entry</b> class keeps the following data:</p>
<dl class="definitions">
    
<dt>dn</dt>
<dd><p>This is the DN of the entry, which includes (in LDAP
	terminology) the RDN (relative DN) and the Superior parts.</p></dd>
<dt>format</dt>
<dd><p>The format may be <em>uninitialized</em> (entry not yet used),
	<em>standard</em> or <em>change</em>. Most methods check the
	format of the entry, which can be reset with the
	<b class="method">reset</b> method.</p></dd>
<dt>attrvals</dt>
<dd><p>In a <em>standard</em> entry, this is where the attributes
	and associated values are stored. Many methods provide
	access to these informations. Attribute names are always
	converted into lower case.</p></dd>
<dt>backup</dt>
<dd><p>In a <em>standard</em> entry, the backup may contain a copy
	of the dn and all attributes and values. Methods
	<b class="method">backup</b> and <b class="method">restore</b> manipulate these data,
	and method <b class="method">diff</b> may use this backup.</p></dd>
<dt>change</dt>
<dd><p>In a <em>change</em> entry, these data represent the
	modifications. Such modifications are handled by specialized
	methods such as <b class="method">apply</b> or <b class="method">commit</b>.
	Detailed format should not be used directly by programs.</p>
<p>Internally, modifications are represented as a list of
	elements, each element has one of the following formats
	(which match the corresponding LDAP operations):</p>
<ol class="enumerated">
	    
<li><p>{<b class="const">add</b> {attr1 {val1...valn} attr2 {...} ...}}</p>
<p>Addition of a new entry.</p></li>
<li><p>{<b class="const">mod</b> {modop {attr1 <span class="opt">?val1...valn?</span>} attr2 ...} {modop ...} ...}</p>
<p>Modification of one or more attributes and/or values,
		where &lt;modop&gt; can be <b class="const">modadd</b>, <b class="const">moddel</b>
		or <b class="const">modrepl</b> (see the LDAP modify operation).</p></li>
<li><p>{<b class="const">del</b>}</p>
<p>Deletion of an old entry.</p></li>
<li><p>{<b class="const">modrdn</b> newrdn deleteoldrdn <span class="opt">?newsuperior?</span>}</p>
<p>Renaming of an entry.</p></li>
</ol></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Entry Options</a></h3>
<p>No option is defined by this class.</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Methods for all kinds of entries</a></h3>
<dl class="definitions">
    
<dt><a name="1"><i class="arg">e</i> <b class="method">reset</b></a></dt>
<dd><p>This method resets the entry to an uninitialized state.</p></dd>
<dt><a name="2"><i class="arg">e</i> <b class="method">dn</b> <span class="opt">?<i class="arg">newdn</i>?</span></a></dt>
<dd><p>This method returns the current DN of the entry. If the
	optional <i class="arg">newdn</i> is specified, it replaces the current
	DN of the entry.</p></dd>
<dt><a name="3"><i class="arg">e</i> <b class="method">rdn</b></a></dt>
<dd><p>This method returns the RDN part of the DN of the entry.</p></dd>
<dt><a name="4"><i class="arg">e</i> <b class="method">superior</b></a></dt>
<dd><p>This method returns the superior part of the DN of the entry.</p></dd>
<dt><a name="5"><i class="arg">e</i> <b class="method">print</b></a></dt>
<dd><p>This method returns the entry as a string ready to be printed.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Methods for standard entries only</a></h3>
<p>In all methods, attribute names are converted in lower case.</p>
<dl class="definitions">
    
<dt><a name="6"><i class="arg">se</i> <b class="method">isempty</b></a></dt>
<dd><p>This method returns 1 if the entry is empty (i.e. without
	any attribute).</p></dd>
<dt><a name="7"><i class="arg">se</i> <b class="method">get</b> <i class="arg">attr</i></a></dt>
<dd><p>This method returns all values of the attribute <i class="arg">attr</i>,
	or the empty list if the attribute is not fond.</p></dd>
<dt><a name="8"><i class="arg">se</i> <b class="method">get1</b> <i class="arg">attr</i></a></dt>
<dd><p>This method returns the first value of the attribute.</p></dd>
<dt><a name="9"><i class="arg">se</i> <b class="method">set</b> <i class="arg">attr</i> <i class="arg">values</i></a></dt>
<dd><p>This method sets the values (list <i class="arg">values</i>) of the
	attribute <i class="arg">attr</i>. If the list is empty, this method
	deletes all</p></dd>
<dt><a name="10"><i class="arg">se</i> <b class="method">set1</b> <i class="arg">attr</i> <i class="arg">value</i></a></dt>
<dd><p>This method sets the values of the attribute <i class="arg">attr</i> to
	be an unique value <i class="arg">value</i>. Previous values, if any,
	are replaced by the new value.</p></dd>
<dt><a name="11"><i class="arg">se</i> <b class="method">add</b> <i class="arg">attr</i> <i class="arg">values</i></a></dt>
<dd><p>This method adds all elements the list <i class="arg">values</i> to the
	values of the attribute <i class="arg">attr</i>.</p></dd>
<dt><a name="12"><i class="arg">se</i> <b class="method">add1</b> <i class="arg">attr</i> <i class="arg">value</i></a></dt>
<dd><p>This method adds a single value given by the parameter
	<i class="arg">value</i> to the attribute <i class="arg">attr</i>.</p></dd>
<dt><a name="13"><i class="arg">se</i> <b class="method">del</b> <i class="arg">attr</i> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>If the optional list <i class="arg">values</i> is specified, this method
	deletes all specified values from the attribute <i class="arg">attr</i>.
	If the argument <i class="arg">values</i> is not specified, this method
	deletes all values.</p></dd>
<dt><a name="14"><i class="arg">se</i> <b class="method">del1</b> <i class="arg">attr</i> <i class="arg">value</i></a></dt>
<dd><p>This method deletes a unique <i class="arg">value</i> from the attribute
	<i class="arg">attr</i>.</p></dd>
<dt><a name="15"><i class="arg">se</i> <b class="method">getattr</b></a></dt>
<dd><p>This method returns all attributes names.</p></dd>
<dt><a name="16"><i class="arg">se</i> <b class="method">getall</b></a></dt>
<dd><p>This method returns all attributes and values from the
	entry, packed in a list of pairs &lt;attribute, list of values&gt;.</p></dd>
<dt><a name="17"><i class="arg">se</i> <b class="method">setall</b> <i class="arg">avpairs</i></a></dt>
<dd><p>This method sets at once all attributes and values. The
	format of the <i class="arg">avpairs</i> argument is the same as the one
	returned by method <b class="method">getall</b>.</p></dd>
<dt><a name="18"><i class="arg">se</i> <b class="method">backup</b> <span class="opt">?<i class="arg">other</i>?</span></a></dt>
<dd><p>This method stores in an <i class="arg">other</i> standard entry object
	a copy of the current DN and attributes/values. If the
	optional <i class="arg">other</i> argument is not specified, copy is
	done in the current entry (in a specific place, see section
	<span class="sectref"><a href="#section2">OVERVIEW</a></span>).</p></dd>
<dt><a name="19"><i class="arg">se</i> <b class="method">swap</b></a></dt>
<dd><p>This method swaps the current and backup contexts of the
	entry.</p></dd>
<dt><a name="20"><i class="arg">se</i> <b class="method">restore</b> <span class="opt">?<i class="arg">other</i>?</span></a></dt>
<dd><p>If the optional argument <i class="arg">other</i> is given, which must
	then be a <em>standard</em> entry, this method restores the
	current entry into the <i class="arg">other</i> entry. If the argument
	<i class="arg">other</i> argument is not specified, this methods restores
	the current entry from its internal backup (see section
	<span class="sectref"><a href="#section2">OVERVIEW</a></span>).</p></dd>
<dt><a name="21"><i class="arg">se</i> <b class="method">apply</b> <i class="arg">centry</i></a></dt>
<dd><p>This method applies changes defined in the <i class="arg">centry</i>
	argument, which must be a <em>change</em> entry.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Methods for change entries only</a></h3>
<dl class="definitions">
    
<dt><a name="22"><i class="arg">ce</i> <b class="method">change</b> <span class="opt">?<i class="arg">new</i>?</span></a></dt>
<dd><p>If the optional argument <i class="arg">new</i> is specified, this method
	modifies the change list (see subsection <span class="sectref"><a href="#subsection1">Entry Instance Data</a></span> for
	the exact format). In both cases, current change list is
	returned.
	Warning: values returned by this method should only be used
	by specialized methods such as <b class="method">apply</b> or
	<b class="method">commit</b>.</p></dd>
<dt><a name="23"><i class="arg">ce</i> <b class="method">diff</b> <i class="arg">new</i> <span class="opt">?<i class="arg">old</i>?</span></a></dt>
<dd><p>This method computes the differences between the <i class="arg">new</i>
	and <i class="arg">old</i> entries under the form of a change list, and
	stores this list into the current <em>change</em> entry. If
	the optional argument <i class="arg">old</i> is not specified, difference
	is computed from the entry and its internal backup (see
	section <span class="sectref"><a href="#section2">OVERVIEW</a></span>). Return value is the computed
	change list.</p></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Entry Example</a></h3>
<pre class="example">
    package require ldapx
    #
    # Create an entry and fill it as a standard entry with
    # attributes and values
    #
    ::ldapx::entry create e
    e dn &quot;uid=joe,ou=people,o=mycomp&quot;
    e set1 &quot;uid&quot;             &quot;joe&quot;
    e set  &quot;objectClass&quot;     {person anotherObjectClass}
    e set1 &quot;givenName&quot;       &quot;Joe&quot;
    e set1 &quot;sn&quot;              &quot;User&quot;
    e set  &quot;telephoneNumber&quot; {+31415926535 +2182818}
    e set1 &quot;anotherAttr&quot;     &quot;This is a beautiful day, isn't it?&quot;
    puts stdout &quot;e\n[e print]&quot;
    #
    # Create a second entry as a backup of the first, and
    # make some changes on it.
    # Entry is named automatically by snit.
    #
    set b [::ldapx::entry create %AUTO%]
    e backup $b
    puts stdout &quot;$b\n[$b print]&quot;
    $b del  &quot;anotherAttr&quot;
    $b del1 &quot;objectClass&quot; &quot;anotherObjectClass&quot;
    #
    # Create a change entry, a compute differences between first
    # and second entry.
    #
    ::ldapx::entry create c
    c diff e $b
    puts stdout &quot;$c\n[$c print]&quot;
    #
    # Apply changes to first entry. It should be the same as the
    # second entry, now.
    #
    e apply c
    ::ldapx::entry create nc
    nc diff e $b
    puts stdout &quot;nc\n[nc print]&quot;
    #
    # Clean-up
    #
    e destroy
    $b destroy
    c destroy
    nc destroy
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">LDAP CLASS</a></h2>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Ldap Instance Data</a></h3>
<p>An instance of the <b class="class">ldap</b> class keeps the following data:</p>
<dl class="definitions">
    
<dt>channel</dt>
<dd><p>This is the channel used by the <b class="package"><a href="ldap.html">ldap</a></b> package for
	communication with the LDAP server.</p></dd>
<dt>lastError</dt>
<dd><p>This variable contains the error message which appeared in
	the last method of the <b class="class">ldap</b> class (this string is
	modified in nearly all methods). The <b class="method">error</b> method
	may be used to fetch this message.</p></dd>
</dl>
</div>
<div id="subsection8" class="subsection"><h3><a name="subsection8">Ldap Options</a></h3>
<p>A first set of options of the <b class="class">ldap</b> class is used during
search operations (methods <b class="method">traverse</b>, <b class="method">search</b> and
<b class="method">read</b>, see below).</p>
<dl class="options">
    
<dt><b class="option">-scope</b> <b class="const">base</b>|<b class="const">one</b>|<b class="const">sub</b></dt>
<dd><p>Specify the scope of the LDAP search to be one of
	<b class="const">base</b>, <b class="const">one</b> or <b class="const">sub</b> to specify
	a base object, one-level or subtree search.</p>
<p>The default is <b class="const">sub</b>.</p></dd>
<dt><b class="option">-derefaliases</b> <b class="const">never</b>|<b class="const">seach</b>|<b class="const">find</b>|<b class="const">always</b></dt>
<dd><p>Specify how aliases dereferencing is handled:
	<b class="const">never</b> is used to specify that aliases are never derefenced,
	<b class="const">always</b> that aliases are always derefenced,
	<b class="const">search</b> that aliases are dereferenced when searching,
	or <b class="const">find</b> that aliases are dereferenced only  when
	locating  the  base object for the search.</p>
<p>The default is <b class="const">never</b>.</p></dd>
<dt><b class="option">-sizelimit</b> integer</dt>
<dd><p>Specify the maximum number of entries to be retreived
	during a search. A value of <b class="const">0</b> means no limit.</p>
<p>Default is <b class="const">0</b>.</p></dd>
<dt><b class="option">-timelimit</b> integer</dt>
<dd><p>Specify the time limit for a search to complete.
	A value of <b class="const">0</b> means no limit.</p>
<p>Default is <b class="const">0</b>.</p></dd>
<dt><b class="option">-attrsonly</b> <b class="const">0</b>|<b class="const">1</b></dt>
<dd><p>Specify if only attribute names are to be retrieved (value
	<b class="const">1</b>). Normally (value <b class="const">0</b>), attribute values
	are also retrieved.</p>
<p>Default is <b class="const">0</b>.</p></dd>
</dl>
<p>The last option is used when getting entries or committing changes
in the directory:</p>
<dl class="options">
    
<dt><b class="option">-utf8</b> pattern-yes pattern-no</dt>
<dd><p>Specify which attribute values are encoded in UTF-8. This
	information is specific to the LDAP schema in use by the
	application, since some attributes such as jpegPhoto, for
	example, are not encoded in UTF-8. This option takes the
	form of a list with two regular expressions suitable for
	the <b class="cmd">regexp</b> command (anchored by ^ and $).
	The first specifies which attribute names are to be UTF-8
	encoded, and the second selects, among those, the attribute
	names which will not be UTF-8 encoded.  It is thus possible
	to say: convert all attributes, except jpegPhoto.</p>
<p>Default is {{.*} {}}, meaning: all attributes are converted,
	without exception.</p></dd>
</dl>
</div>
<div id="subsection9" class="subsection"><h3><a name="subsection9">Ldap Methods</a></h3>
<dl class="definitions">
    
<dt><a name="24"><i class="arg">la</i> <b class="method">error</b> <span class="opt">?<i class="arg">newmsg</i>?</span></a></dt>
<dd><p>This method returns the error message that occurred in the
	last call to a <b class="class">ldap</b> class method. If the optional
	argument <i class="arg">newmsg</i> is supplied, it becomes the last
	error message.</p></dd>
<dt><a name="25"><i class="arg">la</i> <b class="method">connect</b> <i class="arg">url</i> <span class="opt">?<i class="arg">binddn</i>?</span> <span class="opt">?<i class="arg">bindpw</i>?</span></a></dt>
<dd><p>This method connects to the LDAP server using given URL
	(which can be of the form <a href="ldap://host:port">ldap://host:port</a> or
	<a href="ldaps://host:port">ldaps://host:port</a>). If an optional <i class="arg">binddn</i>
	argument is given together with the <i class="arg">bindpw</i> argument,
	the <b class="method">connect</b> binds to the LDAP server using the
	specified DN and password.</p></dd>
<dt><a name="26"><i class="arg">la</i> <b class="method">disconnect</b></a></dt>
<dd><p>This method disconnects (and unbinds, if necessary) from
	the LDAP server.</p></dd>
<dt><a name="27"><i class="arg">la</i> <b class="method">traverse</b> <i class="arg">base</i> <i class="arg">filter</i> <i class="arg">attrs</i> <i class="arg">entry</i> <i class="arg">body</i></a></dt>
<dd><p>This method is a new control structure. It searches the
	LDAP directory from the specified base DN (given by the
	<i class="arg">base</i> argument) and selects entries based on the
	argument <i class="arg">filter</i>. For each entry found, this method
	fetches attributes specified by the <i class="arg">attrs</i> argument
	(or all attributes if it is an empty list), stores them in
	the <i class="arg">entry</i> instance of class <b class="class">entry</b> and executes
	the script defined by the argument <i class="arg">body</i>. Options are
	used to refine the search.</p>
<p>Caution: when this method is used, the script <i class="arg">body</i>
	cannot perform another LDAP search (methods <b class="method">traverse</b>,
	<b class="method">search</b> or <b class="method">read</b>).</p></dd>
<dt><a name="28"><i class="arg">la</i> <b class="method">search</b> <i class="arg">base</i> <i class="arg">filter</i> <i class="arg">attrs</i></a></dt>
<dd><p>This method searches the directory using the same way as
	method <b class="method">traverse</b>. All found entries are stored in
	newly created instances of class <b class="class">entry</b>, which are
	returned in a list. The newly created instances should be
	destroyed when they are no longer used.</p></dd>
<dt><a name="29"><i class="arg">la</i> <b class="method">read</b> <i class="arg">base</i> <i class="arg">filter</i> <i class="arg">entry</i> ... <i class="arg">entry</i></a></dt>
<dd><p>This method reads one or more entries, using the same search
	criteria as methods <b class="method">traverse</b> and <b class="method">search</b>.
	All attributes are stored in the entries. This method
	provides a quick way to read some entries. It returns the
	number of entries found in the directory (which may be more
	than the number of read entries). If called without any
	<i class="arg">entry</i> argument, this method just returns the number
	of entries found, without returning any data.</p></dd>
<dt><a name="30"><i class="arg">la</i> <b class="method">commit</b> <i class="arg">entry</i> ... <i class="arg">entry</i></a></dt>
<dd><p>This method commits the changes stored in the <i class="arg">entry</i>
	arguments. Each <i class="arg">entry</i> may be either a <em>change</em>
	entry, or a <em>standard</em> entry with a backup.</p>
<p>Note: in the future, this method should use the LDAP
	transaction extension provided by OpenLDAP 2.3 and later.</p></dd>
</dl>
</div>
<div id="subsection10" class="subsection"><h3><a name="subsection10">Ldap Example</a></h3>
<pre class="example">
    package require ldapx
    #
    # Connects to the LDAP directory
    #
    ::ldapx::ldap create l
    set url &quot;ldap://server.mycomp.com&quot;
    if {! [l connect $url &quot;cn=admin,o=mycomp&quot; &quot;mypasswd&quot;]} then {
	puts stderr &quot;error: [l error]&quot;
	exit 1
    }
    #
    # Search all entries matching some criterion
    #
    l configure -scope one
    ::ldapx::ldap create e
    set n 0
    l traverse &quot;ou=people,o=mycomp&quot; &quot;(sn=Joe*)&quot; {sn givenName} e {
	puts &quot;dn: [e dn]&quot;
	puts &quot;  sn:        [e get1 sn]&quot;
	puts &quot;  givenName: [e get1 givenName]&quot;
	incr n
    }
    puts &quot;$n entries found&quot;
    e destroy
    #
    # Add a telephone number to some entries
    # Note this modification cannot be done in the &quot;traverse&quot; operation.
    #
    set lent [l search &quot;ou=people,o=mycomp&quot; &quot;(sn=Joe*)&quot; {}]
    ::ldapx::ldap create c
    foreach e $lent {
	$e backup
	$e add1 &quot;telephoneNumber&quot; &quot;+31415926535&quot;
	c diff $e
	if {! [l commit c]} then {
	    puts stderr &quot;error: [l error]&quot;
	    exit 1
	}
	$e destroy
    }
    l disconnect
    l destroy
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">LDIF CLASS</a></h2>
<div id="subsection11" class="subsection"><h3><a name="subsection11">Ldif Instance Data</a></h3>
<p>An instance of the <b class="class">ldif</b> class keeps the following data:</p>
<dl class="definitions">
    
<dt>channel</dt>
<dd><p>This is the Tcl channel used to retrieve or store LDIF file
	contents. The association between an instance and a channel
	is made by the method <b class="method">channel</b>. There is no need
	to disrupt this association when the LDIF file operation
	has ended.</p></dd>
<dt>format</dt>
<dd><p>LDIF files may contain <em>standard</em> entries or
	<em>change</em> entries, but not both. This variable contains
	the detected format of the file (when reading) or the format
	of entries written to the file (when writing).</p></dd>
<dt>lastError</dt>
<dd><p>This variable contains the error message which appeared in
	the last method of the <b class="class">ldif</b> class (this string is
	modified in nearly all methods). The <b class="method">error</b> method
	may be used to fetch this message.</p></dd>
<dt>version</dt>
<dd><p>This is the version of the LDIF file. Only version 1 is
	supported: the method <b class="method">read</b> can only read from
	version 1 files, and method <b class="method">write</b> only creates
	version 1 files.</p></dd>
</dl>
</div>
<div id="subsection12" class="subsection"><h3><a name="subsection12">Ldif Options</a></h3>
<p>This class defines two options:</p>
<dl class="options">
    
<dt><b class="option">-ignore</b> list-of-attributes</dt>
<dd><p>This option is used to ignore certain attribute names on
	reading. For example, to read OpenLDAP replica files (replog),
	one must ignore <b class="const">replica</b> and <b class="const">time</b> attributes
	since they do not conform to the RFC 2849 standard for LDIF
	files.</p>
<p>Default is empty list: no attribute is ignored.</p></dd>
<dt><b class="option">-utf8</b> pattern-yes pattern-no</dt>
<dd><p>Specify which attribute values are encoded in UTF-8. This
	information is specific to the LDAP schema in use by the
	application, since some attributes such as jpegPhoto, for
	example, are not encoded in UTF-8. This option takes the
	form of a list with two regular expressions suitable for
	the <b class="cmd">regexp</b> command (anchored by ^ and $).
	The first specifies which attribute names are to be UTF-8
	encoded, and the second selects, among those, the attribute
	names which will not be UTF-8 encoded.  It is thus possible
	to say: convert all attributes, except jpegPhoto.</p>
<p>Default is {{.*} {}}, meaning: all attributes are converted,
	without exception.</p></dd>
</dl>
</div>
<div id="subsection13" class="subsection"><h3><a name="subsection13">Ldif Methods</a></h3>
<dl class="definitions">
    
<dt><a name="31"><i class="arg">li</i> <b class="method">channel</b> <i class="arg">chan</i></a></dt>
<dd><p>This method associates the Tcl channel named <i class="arg">chan</i>
	with the LDIF instance. It resets the type of LDIF object
	to <em>uninitialized</em>.</p></dd>
<dt><a name="32"><i class="arg">li</i> <b class="method">error</b> <span class="opt">?<i class="arg">newmsg</i>?</span></a></dt>
<dd><p>This method returns the error message that occurred in the
	last call to a <b class="class">ldif</b> class method. If the optional
	argument <i class="arg">newmsg</i> is supplied, it becomes the last
	error message.</p></dd>
<dt><a name="33"><i class="arg">li</i> <b class="method">read</b> <i class="arg">entry</i></a></dt>
<dd><p>This method reads the next entry from the LDIF file and
	stores it in the <i class="arg">entry</i> object of class <b class="class">entry</b>.
	The entry may be a <em>standard</em> or <em>change</em> entry.</p></dd>
<dt><a name="34"><i class="arg">li</i> <b class="method">write</b> <i class="arg">entry</i></a></dt>
<dd><p>This method writes the entry given in the argument
	<i class="arg">entry</i> to the LDIF file.</p></dd>
</dl>
</div>
<div id="subsection14" class="subsection"><h3><a name="subsection14">Ldif Example</a></h3>
<pre class="example">
    package require ldapx
    # This examples reads a LDIF file containing entries,
    # compare them to a LDAP directory, and writes on standard
    # output an LDIF file containing changes to apply to the
    # LDAP directory to match exactly the LDIF file.
    ::ldapx::ldif create liin
    liin channel stdin
    ::ldapx::ldif create liout
    liout channel stdout
    ::ldapx::ldap create la
    if {! [la connect &quot;ldap://server.mycomp.com&quot;]} then {
	puts stderr &quot;error: [la error]&quot;
	exit 1
    }
    la configure -scope one
    # Reads LDIF file
    ::ldapx::entry create e1
    ::ldapx::entry create e2
    ::ldapx::entry create c
    while {[liin read e1] != 0} {
	set base [e1 superior]
	set id [e1 rdn]
	if {[la read $base &quot;($id)&quot; e2] == 0} then {
	    e2 reset
	}
	c diff e1 e2
	if {[llength [c change]] != 0} then {
	    liout write c
	}
    }
    la disconnect
    la destroy
    e1 destroy
    e2 destroy
    c destroy
    liout destroy
    liin destroy
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">References</a></h2>
</div>
<div id="section7" class="section"><h2><a name="section7">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ldap</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key127">directory access</a>, <a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key124">ldap</a>, <a href="../../../../index.html#key121">ldap client</a>, <a href="../../../../index.html#key452">ldif</a>, <a href="../../../../index.html#key125">protocol</a>, <a href="../../../../index.html#key123">rfc 2251</a>, <a href="../../../../index.html#key451">rfc 2849</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Pierre David &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/log/log.html.






























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>log - Logging facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/log/log.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2001-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ log.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">log(n) 1.3 tcllib &quot;Logging facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>log - Procedures to log messages of libraries and applications.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">LEVELS</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8</b></li>
<li>package require <b class="pkgname">log <span class="opt">?1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::log::levels</b></a></li>
<li><a href="#2"><b class="cmd">::log::lv2longform</b> <i class="arg">level</i></a></li>
<li><a href="#3"><b class="cmd">::log::lv2color</b> <i class="arg">level</i></a></li>
<li><a href="#4"><b class="cmd">::log::lv2priority</b> <i class="arg">level</i></a></li>
<li><a href="#5"><b class="cmd">::log::lv2cmd</b> <i class="arg">level</i></a></li>
<li><a href="#6"><b class="cmd">::log::lv2channel</b> <i class="arg">level</i></a></li>
<li><a href="#7"><b class="cmd">::log::lvCompare</b> <i class="arg">level1</i> <i class="arg">level2</i></a></li>
<li><a href="#8"><b class="cmd">::log::lvSuppress</b> <i class="arg">level</i> {<i class="arg">suppress</i> 1}</a></li>
<li><a href="#9"><b class="cmd">::log::lvSuppressLE</b> <i class="arg">level</i> {<i class="arg">suppress</i> 1}</a></li>
<li><a href="#10"><b class="cmd">::log::lvIsSuppressed</b> <i class="arg">level</i></a></li>
<li><a href="#11"><b class="cmd">::log::lvCmd</b> <i class="arg">level</i> <i class="arg">cmd</i></a></li>
<li><a href="#12"><b class="cmd">::log::lvCmdForall</b> <i class="arg">cmd</i></a></li>
<li><a href="#13"><b class="cmd">::log::lvChannel</b> <i class="arg">level</i> <i class="arg">chan</i></a></li>
<li><a href="#14"><b class="cmd">::log::lvChannelForall</b> <i class="arg">chan</i></a></li>
<li><a href="#15"><b class="cmd">::log::lvColor</b> <i class="arg">level</i> <i class="arg">color</i></a></li>
<li><a href="#16"><b class="cmd">::log::lvColorForall</b> <i class="arg">color</i></a></li>
<li><a href="#17"><b class="cmd">::log::log</b> <i class="arg">level</i> <i class="arg">text</i></a></li>
<li><a href="#18"><b class="cmd">::log::logarray</b> <i class="arg">level</i> <i class="arg">arrayvar</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#19"><b class="cmd">::log::loghex</b> <i class="arg">level</i> <i class="arg">text</i> <i class="arg">data</i></a></li>
<li><a href="#20"><b class="cmd">::log::logMsg</b> <i class="arg">text</i></a></li>
<li><a href="#21"><b class="cmd">::log::logError</b> <i class="arg">text</i></a></li>
<li><a href="#22"><b class="cmd">::log::Puts</b> <i class="arg">level</i> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">log</b> package provides commands that allow libraries and
applications to selectively log information about their internal
operation and state.</p>
<p>To use the package just execute</p>
<pre class="example">
    package require log
    log::log notice &quot;Some message&quot;
</pre>
<p>As can be seen above, each message given to the log facility is
associated with a <em>level</em> determining the importance of the
message. The user can then select which levels to log, what commands
to use for the logging of each level and the channel to write the
message to. In the following example the logging of all message with
level <b class="const">debug</b> is deactivated.</p>
<pre class="example">
    package require log
    log::lvSuppress debug
    log::log debug &quot;Unseen message&quot; ; # No output
</pre>
<p>By default all messages associated with an error-level
(<b class="const">emergency</b>, <b class="const">alert</b>, <b class="const">critical</b>, and
<b class="const">error</b>) are written to <b class="const">stderr</b>. Messages with any
other level are written to <b class="const">stdout</b>. In the following example
the log module is reconfigured to write <b class="const">debug</b> messages to
<b class="const">stderr</b> too.</p>
<pre class="example">
    package require log
    log::lvChannel debug stderr
    log::log debug &quot;Written to stderr&quot;
</pre>
<p>Each message level is also associated with a command to use when
logging a message with that level. The behaviour above for example
relies on the fact that all message levels use by default the standard
command <b class="cmd">::log::Puts</b> to log any message. In the following example
all messages of level <b class="const">notice</b> are given to the non-standard
command <b class="cmd">toText</b> for logging. This disables the channel setting
for such messages, assuming that <b class="cmd">toText</b> does not use it by
itself.</p>
<pre class="example">
    package require log
    log::lvCmd notice toText
    log::log notice &quot;Handled by \&quot;toText\&quot;&quot;
</pre>
<p>Another database maintained by this facility is a map from message
levels to colors. The information in this database has <em>no</em>
influence on the behaviour of the module. It is merely provided as a
convenience and in anticipation of the usage of this facility in
<b class="package">tk</b>-based application which may want to colorize message
logs.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The following commands are available:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::log::levels</b></a></dt>
<dd><p>Returns the names of all known levels, in alphabetical order.</p></dd>
<dt><a name="2"><b class="cmd">::log::lv2longform</b> <i class="arg">level</i></a></dt>
<dd><p>Converts any unique abbreviation of a level name to the full level
name.</p></dd>
<dt><a name="3"><b class="cmd">::log::lv2color</b> <i class="arg">level</i></a></dt>
<dd><p>Converts any level name including unique abbreviations to the
corresponding color.</p></dd>
<dt><a name="4"><b class="cmd">::log::lv2priority</b> <i class="arg">level</i></a></dt>
<dd><p>Converts any level name including unique abbreviations to the
corresponding priority.</p></dd>
<dt><a name="5"><b class="cmd">::log::lv2cmd</b> <i class="arg">level</i></a></dt>
<dd><p>Converts any level name including unique abbreviations to the command
prefix used to write messages with that level.</p></dd>
<dt><a name="6"><b class="cmd">::log::lv2channel</b> <i class="arg">level</i></a></dt>
<dd><p>Converts any level name including unique abbreviations to the channel
used by <b class="cmd">::log::Puts</b> to write messages with that level.</p></dd>
<dt><a name="7"><b class="cmd">::log::lvCompare</b> <i class="arg">level1</i> <i class="arg">level2</i></a></dt>
<dd><p>Compares two levels (including unique abbreviations) with respect to
their priority. This command can be used by the -command option of
lsort. The result is one of -1, 0 or 1 or an error. A result of -1
signals that level1 is of less priority than level2. 0 signals that
both levels have the same priority. 1 signals that level1 has higher
priority than level2.</p></dd>
<dt><a name="8"><b class="cmd">::log::lvSuppress</b> <i class="arg">level</i> {<i class="arg">suppress</i> 1}</a></dt>
<dd><p>]
(Un)suppresses the output of messages having the specified
level. Unique abbreviations for the level are allowed here too.</p></dd>
<dt><a name="9"><b class="cmd">::log::lvSuppressLE</b> <i class="arg">level</i> {<i class="arg">suppress</i> 1}</a></dt>
<dd><p>]
(Un)suppresses the output of messages having the specified level or
one of lesser priority. Unique abbreviations for the level are allowed
here too.</p></dd>
<dt><a name="10"><b class="cmd">::log::lvIsSuppressed</b> <i class="arg">level</i></a></dt>
<dd><p>Asks the package whether the specified level is currently
suppressed. Unique abbreviations of level names are allowed.</p></dd>
<dt><a name="11"><b class="cmd">::log::lvCmd</b> <i class="arg">level</i> <i class="arg">cmd</i></a></dt>
<dd><p>Defines for the specified level with which command to write the
messages having this level. Unique abbreviations of level names are
allowed. The command is actually a command prefix and this facility
will append 2 arguments before calling it, the level of the message
and the message itself, in this order.</p></dd>
<dt><a name="12"><b class="cmd">::log::lvCmdForall</b> <i class="arg">cmd</i></a></dt>
<dd><p>Defines for all known levels with which command to write the messages
having this level. The command is actually a command prefix and this
facility will append 2 arguments before calling it, the level of the
message and the message itself, in this order.</p></dd>
<dt><a name="13"><b class="cmd">::log::lvChannel</b> <i class="arg">level</i> <i class="arg">chan</i></a></dt>
<dd><p>Defines for the specified level into which channel <b class="cmd">::log::Puts</b>
(the standard command) shall write the messages having this
level. Unique abbreviations of level names are allowed. The command is
actually a command prefix and this facility will append 2 arguments
before calling it, the level of the message and the message itself, in
this order.</p></dd>
<dt><a name="14"><b class="cmd">::log::lvChannelForall</b> <i class="arg">chan</i></a></dt>
<dd><p>Defines for all known levels with which which channel
<b class="cmd">::log::Puts</b> (the standard command) shall write the messages
having this level. The command is actually a command prefix and this
facility will append 2 arguments before calling it, the level of the
message and the message itself, in this order.</p></dd>
<dt><a name="15"><b class="cmd">::log::lvColor</b> <i class="arg">level</i> <i class="arg">color</i></a></dt>
<dd><p>Defines for the specified level the color to return for it in a call
to <b class="cmd">::log::lv2color</b>. Unique abbreviations of level names are
allowed.</p></dd>
<dt><a name="16"><b class="cmd">::log::lvColorForall</b> <i class="arg">color</i></a></dt>
<dd><p>Defines for all known levels the color to return for it in a call to
<b class="cmd">::log::lv2color</b>. Unique abbreviations of level names are
allowed.</p></dd>
<dt><a name="17"><b class="cmd">::log::log</b> <i class="arg">level</i> <i class="arg">text</i></a></dt>
<dd><p>Log a message according to the specifications for commands, channels
and suppression. In other words: The command will do nothing if the
specified level is suppressed. If it is not suppressed the actual
logging is delegated to the specified command. If there is no command
specified for the level the message won't be logged. The standard
command <b class="cmd">::log::Puts</b> will write the message to the channel
specified for the given level. If no channel is specified for the
level the message won't be logged. Unique abbreviations of level names
are allowed. Errors in the actual logging command are <em>not</em>
caught, but propagated to the caller, as they may indicate
misconfigurations of the log facility or errors in the callers code
itself.</p></dd>
<dt><a name="18"><b class="cmd">::log::logarray</b> <i class="arg">level</i> <i class="arg">arrayvar</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Like <b class="cmd">::log::log</b>, but logs the contents of the specified array
variable <i class="arg">arrayvar</i>, possibly restricted to entries matching the
<i class="arg">pattern</i>. The pattern defaults to <b class="const">*</b> (i.e. all entries) if
none was specified.</p></dd>
<dt><a name="19"><b class="cmd">::log::loghex</b> <i class="arg">level</i> <i class="arg">text</i> <i class="arg">data</i></a></dt>
<dd><p>Like <b class="cmd">::log::log</b>, but assumes that <i class="arg">data</i> contains binary
data. It converts this into a mixed hex/ascii representation before
writing them to the log.</p></dd>
<dt><a name="20"><b class="cmd">::log::logMsg</b> <i class="arg">text</i></a></dt>
<dd><p>Convenience wrapper around <b class="cmd">::log::log</b>.
Equivalent to <b class="cmd">::log::log info text</b>.</p></dd>
<dt><a name="21"><b class="cmd">::log::logError</b> <i class="arg">text</i></a></dt>
<dd><p>Convenience wrapper around <b class="cmd">::log::log</b>.
Equivalent to <b class="cmd">::log::log error text</b>.</p></dd>
<dt><a name="22"><b class="cmd">::log::Puts</b> <i class="arg">level</i> <i class="arg">text</i></a></dt>
<dd><p>The standard log command, it writes messages and their levels to
user-specified channels. Assumes that the suppression checks were done
by the caller. Expects full level names, abbreviations are
<em>not allowed</em>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">LEVELS</a></h2>
<p>The package currently defines the following log levels, the level of
highest importance listed first.</p>
<ul class="itemized">
<li><p>emergency</p></li>
<li><p>alert</p></li>
<li><p>critical</p></li>
<li><p>error</p></li>
<li><p>warning</p></li>
<li><p>notice</p></li>
<li><p>info</p></li>
<li><p>debug</p></li>
</ul>
<p><em>Note</em> that by default all messages with levels <b class="const">warning</b> down to
<b class="const">debug</b> are suppressed. This is done intentionally, because (we believe
that) in most situations debugging output is not wanted. Most people wish to
have such output only when actually debugging an application.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>log</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key71">log</a>, <a href="../../../../index.html#key70">log level</a>, <a href="../../../../index.html#key320">message</a>, <a href="../../../../index.html#key735">message level</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2001-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/log/logger.html.



























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>logger - Object Oriented logging facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/log/logger.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ logger.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">logger(n) 0.9.3 tcllib &quot;Object Oriented logging facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>logger - System to control logging of events.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">IMPLEMENTATION</a></li>
<li class="section"><a href="#section3">Logprocs and Callstack</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">logger <span class="opt">?0.9.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">logger::init</b> <i class="arg">service</i></a></li>
<li><a href="#2"><b class="cmd">logger::import</b> <span class="opt">?<b class="option">-all</b>?</span> <span class="opt">?<b class="option">-force</b>?</span> <span class="opt">?<b class="option">-prefix</b> <i class="arg">prefix</i>?</span> <span class="opt">?<b class="option">-namespace</b> <i class="arg">namespace</i>?</span> <i class="arg">service</i></a></li>
<li><a href="#3"><b class="cmd">logger::initNamespace</b> <i class="arg">ns</i> <span class="opt">?<i class="arg">level</i>?</span></a></li>
<li><a href="#4"><b class="cmd">logger::services</b></a></li>
<li><a href="#5"><b class="cmd">logger::enable</b> <i class="arg">level</i></a></li>
<li><a href="#6"><b class="cmd">logger::disable</b> <i class="arg">level</i></a></li>
<li><a href="#7"><b class="cmd">logger::setlevel</b> <i class="arg">level</i></a></li>
<li><a href="#8"><b class="cmd">logger::levels</b></a></li>
<li><a href="#9"><b class="cmd">logger::servicecmd</b> <i class="arg">service</i></a></li>
<li><a href="#10"><b class="cmd">${log}::debug</b> <i class="arg">message</i></a></li>
<li><a href="#11"><b class="cmd">${log}::info</b> <i class="arg">message</i></a></li>
<li><a href="#12"><b class="cmd">${log}::notice</b> <i class="arg">message</i></a></li>
<li><a href="#13"><b class="cmd">${log}::warn</b> <i class="arg">message</i></a></li>
<li><a href="#14"><b class="cmd">${log}::error</b> <i class="arg">message</i></a></li>
<li><a href="#15"><b class="cmd">${log}::critical</b> <i class="arg">message</i></a></li>
<li><a href="#16"><b class="cmd">${log}::alert</b> <i class="arg">message</i></a></li>
<li><a href="#17"><b class="cmd">${log}::emergency</b> <i class="arg">message</i></a></li>
<li><a href="#18"><b class="cmd">${log}::setlevel</b> <i class="arg">level</i></a></li>
<li><a href="#19"><b class="cmd">${log}::enable</b> <i class="arg">level</i></a></li>
<li><a href="#20"><b class="cmd">${log}::disable</b> <i class="arg">level</i></a></li>
<li><a href="#21"><b class="cmd">${log}::lvlchangeproc</b> <i class="arg">command</i></a></li>
<li><a href="#22"><b class="cmd">${log}::lvlchangeproc</b></a></li>
<li><a href="#23"><b class="cmd">${log}::logproc</b> <i class="arg">level</i></a></li>
<li><a href="#24"><b class="cmd">${log}::logproc</b> <i class="arg">level</i> <i class="arg">command</i></a></li>
<li><a href="#25"><b class="cmd">${log}::logproc</b> <i class="arg">level</i> <i class="arg">argname</i> <i class="arg">body</i></a></li>
<li><a href="#26"><b class="cmd">${log}::services</b></a></li>
<li><a href="#27"><b class="cmd">${log}::servicename</b></a></li>
<li><a href="#28"><b class="cmd">${log}::currentloglevel</b></a></li>
<li><a href="#29"><b class="cmd">${log}::delproc</b> <i class="arg">command</i></a></li>
<li><a href="#30"><b class="cmd">${log}::delproc</b></a></li>
<li><a href="#31"><b class="cmd">${log}::delete</b></a></li>
<li><a href="#32"><b class="cmd">${log}::trace</b> <i class="arg">command</i></a></li>
<li><a href="#33"><b class="cmd">${log}::trace</b> <b class="cmd">on</b></a></li>
<li><a href="#34"><b class="cmd">${log}::trace</b> <b class="cmd">off</b></a></li>
<li><a href="#35"><b class="cmd">${log}::trace</b> <b class="cmd">status</b> <span class="opt">?procName?</span> <span class="opt">?...?</span></a></li>
<li><a href="#36"><b class="cmd">${log}::trace</b> <b class="cmd">add</b> <i class="arg">procName</i> <span class="opt">?...?</span></a></li>
<li><a href="#37"><b class="cmd">${log}::trace</b> <b class="cmd">add</b> <span class="opt">?-ns?</span> <i class="arg">nsName</i> <span class="opt">?...?</span></a></li>
<li><a href="#38"><b class="cmd">${log}::trace</b> <b class="cmd"><a href="../../../../index.html#key209">remove</a></b> <i class="arg">procName</i> <span class="opt">?...?</span></a></li>
<li><a href="#39"><b class="cmd">${log}::trace</b> <b class="cmd"><a href="../../../../index.html#key209">remove</a></b> <span class="opt">?-ns?</span> <i class="arg">nsName</i> <span class="opt">?...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">logger</b> package provides a flexible system for logging messages
from different services, at priority levels, with different commands.</p>
<p>To begin using the logger package, we do the following:</p>
<pre class="example">
    package require logger
    set log [logger::init myservice]
    ${log}::notice &quot;Initialized myservice logging&quot;
    ... code ...
    ${log}::notice &quot;Ending myservice logging&quot;
    ${log}::delete
</pre>
<p>In the above code, after the package is loaded, the following things
happen:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">logger::init</b> <i class="arg">service</i></a></dt>
<dd><p>Initializes the service <i class="arg">service</i> for logging.  The service names
are actually Tcl namespace names, so they are separated with '::'.
The service name may not be the empty string or only ':'s.
When a logger service is initialized, it &quot;inherits&quot; properties from its
parents.  For instance, if there were a service <i class="term">foo</i>, and
we did a <b class="cmd">logger::init</b> <i class="arg">foo::bar</i> (to create a <i class="term">bar</i>
service underneath <i class="term">foo</i>), <i class="term">bar</i> would copy the current
configuration of the <i class="term">foo</i> service, although it would of
course, also be possible to then separately configure <i class="term">bar</i>.
If a logger service is initialized and the parent does not yet exist, the
parent is also created. 
The new logger service is initialized with the default loglevel set 
with <b class="cmd">logger::setlevel</b>.</p></dd>
<dt><a name="2"><b class="cmd">logger::import</b> <span class="opt">?<b class="option">-all</b>?</span> <span class="opt">?<b class="option">-force</b>?</span> <span class="opt">?<b class="option">-prefix</b> <i class="arg">prefix</i>?</span> <span class="opt">?<b class="option">-namespace</b> <i class="arg">namespace</i>?</span> <i class="arg">service</i></a></dt>
<dd><p>Import the logger service commands into the current namespace. Without the <b class="option">-all</b> option
only the commands corresponding to the log levels are imported. If <b class="option">-all</b> is given, 
all the <b class="cmd">${log}::cmd</b> style commands are imported. If the import would overwrite a command
an error is returned and no command is imported. Use the <b class="option">-force</b> option to force the import
and overwrite existing commands without complaining.
If the <b class="option">-prefix</b> option is given, the commands are imported with the given <i class="arg">prefix</i>
prepended to their names. 
If the <b class="option">-namespace</b> option is given, the commands are imported into the given namespace. If the
namespace does not exist, it is created. If a namespace without a leading :: is given, it is interpreted as
a child namespace to the current namespace.</p></dd>
<dt><a name="3"><b class="cmd">logger::initNamespace</b> <i class="arg">ns</i> <span class="opt">?<i class="arg">level</i>?</span></a></dt>
<dd><p>Convenience command for setting up a namespace for logging. Creates a
logger service named after the namespace <i class="arg">ns</i> (a :: prefix is
stripped), imports all the log commands into the namespace, and sets
the default logging level, either to the specified <i class="arg">level</i>, or the
default level, &quot;warn&quot;.</p></dd>
<dt><a name="4"><b class="cmd">logger::services</b></a></dt>
<dd><p>Returns a list of all the available services.</p></dd>
<dt><a name="5"><b class="cmd">logger::enable</b> <i class="arg">level</i></a></dt>
<dd><p>Globally enables logging at and &quot;above&quot; the given level.  Levels are
<b class="const">debug</b>, <b class="const">info</b>, <b class="const">notice</b>, <b class="const">warn</b>, <b class="const">error</b>,
<b class="const">critical</b>, <b class="const">alert</b>, <b class="const">emergency</b>.</p></dd>
<dt><a name="6"><b class="cmd">logger::disable</b> <i class="arg">level</i></a></dt>
<dd><p>Globally disables logging at and &quot;below&quot; the given level.  Levels are
those listed above.</p></dd>
<dt><a name="7"><b class="cmd">logger::setlevel</b> <i class="arg">level</i></a></dt>
<dd><p>Globally enable logging at and &quot;above&quot; the given level. Levels are those
listed above. This command changes the default loglevel for new loggers
created with <b class="cmd">logger::init</b>.</p></dd>
<dt><a name="8"><b class="cmd">logger::levels</b></a></dt>
<dd><p>Returns a list of the available log levels (also listed above under <b class="cmd">enable</b>).</p></dd>
<dt><a name="9"><b class="cmd">logger::servicecmd</b> <i class="arg">service</i></a></dt>
<dd><p>Returns the <b class="cmd">${log}</b> token created by <b class="cmd">logger::init</b> for this service.</p></dd>
<dt><a name="10"><b class="cmd">${log}::debug</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="11"><b class="cmd">${log}::info</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="12"><b class="cmd">${log}::notice</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="13"><b class="cmd">${log}::warn</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="14"><b class="cmd">${log}::error</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="15"><b class="cmd">${log}::critical</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="16"><b class="cmd">${log}::alert</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="17"><b class="cmd">${log}::emergency</b> <i class="arg">message</i></a></dt>
<dd><p>These are the commands called to actually log a message about an
event.  <b class="variable">${log}</b> is the variable obtained from <b class="cmd">logger::init</b>.</p></dd>
<dt><a name="18"><b class="cmd">${log}::setlevel</b> <i class="arg">level</i></a></dt>
<dd><p>Enable logging, in the service referenced by <b class="variable">${log}</b>, and its
children, at and above the level specified, and disable logging below
it.</p></dd>
<dt><a name="19"><b class="cmd">${log}::enable</b> <i class="arg">level</i></a></dt>
<dd><p>Enable logging, in the service referenced by <b class="variable">${log}</b>, and its
children, at and above the level specified.  Note that this does <em>not</em> disable logging below this level, so you should probably use
<b class="cmd">setlevel</b> instead.</p></dd>
<dt><a name="20"><b class="cmd">${log}::disable</b> <i class="arg">level</i></a></dt>
<dd><p>Disable logging, in the service referenced by <b class="variable">${log}</b>, and its
children, at and below the level specified. Note that this does <em>not</em> enable logging above this level, 
so you should probably use <b class="cmd">setlevel</b> instead.
Disabling the loglevel <b class="const">emergency</b> switches logging off for the service and its children.</p></dd>
<dt><a name="21"><b class="cmd">${log}::lvlchangeproc</b> <i class="arg">command</i></a></dt>
<dd></dd>
<dt><a name="22"><b class="cmd">${log}::lvlchangeproc</b></a></dt>
<dd><p>Set the script to call when the log instance in question changes its log level.
If called without a command it returns the currently registered command. The command gets two arguments
appended, the old and the new loglevel. The callback is invoked after all changes have been done.
If child loggers are affected, their callbacks are called before their parents callback.</p>
<pre class="example">
 	proc lvlcallback {old new} {
 	    puts &quot;Loglevel changed from $old to $new&quot;
 	}
 	${log}::lvlchangeproc lvlcallback
 </pre>
</dd>
<dt><a name="23"><b class="cmd">${log}::logproc</b> <i class="arg">level</i></a></dt>
<dd></dd>
<dt><a name="24"><b class="cmd">${log}::logproc</b> <i class="arg">level</i> <i class="arg">command</i></a></dt>
<dd></dd>
<dt><a name="25"><b class="cmd">${log}::logproc</b> <i class="arg">level</i> <i class="arg">argname</i> <i class="arg">body</i></a></dt>
<dd><p>This command comes in three forms - the third, older one is deprecated
and may be removed from future versions of the logger package.  
The current set version takes one argument, a command to be executed when the
level is called.  The callback command takes on argument, the text to
be logged. If called only with a valid level <b class="cmd">logproc</b> returns the name of the command
currently registered as callback command.
<b class="cmd">logproc</b> specifies which command will perform the actual logging
for a given level.  The logger package ships with default commands for
all log levels, but with <b class="cmd">logproc</b> it is possible to replace them
with custom code.  This would let you send your logs over the network,
to a database, or anything else.  For example:</p>
<pre class="example">
    proc logtoserver {txt} {
        variable socket
        puts $socket &quot;Notice: $txt&quot;
    }
    ${log}::logproc notice logtoserver
</pre>
<p>Trace logs are slightly different: instead of a plain text argument,
the argument provided to the logproc is a dictionary consisting of the
<b class="const">enter</b> or <b class="const">leave</b> keyword along with another dictionary of
details about the trace.  These include:</p>
<ul class="itemized">
<li><p><b class="const">proc</b> - Name of the procedure being traced.</p></li>
<li><p><b class="const">level</b> - The stack level for the procedure invocation
(from <b class="cmd"><a href="../../../../index.html#key72">info</a></b> <b class="cmd">level</b>).</p></li>
<li><p><b class="const">script</b> - The name of the file in which the procedure is
defined, or an empty string if defined in interactive mode.</p></li>
<li><p><b class="const">caller</b> - The name of the procedure calling the procedure
being traced, or an empty string if the procedure was called from the
global scope (stack level 0).</p></li>
<li><p><b class="const">procargs</b> - A dictionary consisting of the names of arguments
to the procedure paired with values given for those arguments (<b class="const">enter</b>
traces only).</p></li>
<li><p><b class="const">status</b> - The Tcl return code (e.g. <b class="const">ok</b>,
<b class="const">continue</b>, etc.) (<b class="const">leave</b> traces only).</p></li>
<li><p><b class="const">result</b> - The value returned by the procedure (<b class="const">leave</b>
traces only).</p></li>
</ul></dd>
<dt><a name="26"><b class="cmd">${log}::services</b></a></dt>
<dd><p>Returns a list of the registered logging services which are children of this service.</p></dd>
<dt><a name="27"><b class="cmd">${log}::servicename</b></a></dt>
<dd><p>Returns the name of this service.</p></dd>
<dt><a name="28"><b class="cmd">${log}::currentloglevel</b></a></dt>
<dd><p>Returns the currently enabled log level for this service. If no logging is enabled returns <b class="const">none</b>.</p></dd>
<dt><a name="29"><b class="cmd">${log}::delproc</b> <i class="arg">command</i></a></dt>
<dd></dd>
<dt><a name="30"><b class="cmd">${log}::delproc</b></a></dt>
<dd><p>Set the script to call when the log instance in question is deleted.
If called without a command it returns the currently registered command.
For example:</p>
<pre class="example">
    ${log}::delproc [list closesock $logsock]
</pre>
</dd>
<dt><a name="31"><b class="cmd">${log}::delete</b></a></dt>
<dd><p>This command deletes a particular logging service, and its children.
You must call this to clean up the resources used by a service.</p></dd>
<dt><a name="32"><b class="cmd">${log}::trace</b> <i class="arg">command</i></a></dt>
<dd><p>This command controls logging of enter/leave traces for specified procedures.
It is used to enable and disable tracing, query tracing status, and
specify procedures are to be traced.  Trace handlers are unregistered when
tracing is disabled.  As a result, there is not performance impact to a
library when tracing is disabled, just as with other log level commands.</p>
<pre class="example">
  proc tracecmd { dict } {
      puts $dict
  }
  set log [::logger::init example]
  ${log}::logproc trace tracecmd
  proc foo { args } {
      puts &quot;In foo&quot;
      bar 1
      return &quot;foo_result&quot;
  }
    
  proc bar { x } {
      puts &quot;In bar&quot;
      return &quot;bar_result&quot;
  }
  ${log}::trace add foo bar
  ${log}::trace on
  foo
# Output:
enter {proc ::foo level 1 script {} caller {} procargs {args {}}}
In foo
enter {proc ::bar level 2 script {} caller ::foo procargs {x 1}}
In bar
leave {proc ::bar level 2 script {} caller ::foo status ok result bar_result}
leave {proc ::foo level 1 script {} caller {} status ok result foo_result}
</pre>
</dd>
<dt><a name="33"><b class="cmd">${log}::trace</b> <b class="cmd">on</b></a></dt>
<dd><p>Turns on trace logging for procedures registered through the <b class="cmd">trace</b>
<b class="cmd">add</b> command.  This is similar to the <b class="cmd">enable</b> command for other
logging levels, but allows trace logging to take place at any level.
The trace logging mechanism takes advantage of the execution trace feature
of Tcl 8.4 and later.  The <b class="cmd">trace</b> <b class="cmd">on</b> command will return an
error if called from earlier versions of Tcl.</p></dd>
<dt><a name="34"><b class="cmd">${log}::trace</b> <b class="cmd">off</b></a></dt>
<dd><p>Turns off trace logging for procedures registered for trace logging
through the <b class="cmd">trace</b> <b class="cmd">add</b> command.  This is similar to the
<b class="cmd">disable</b> command for other logging levels, but allows trace logging
to take place at any level.
Procedures are not unregistered, so logging for them can be turned back
on with the <b class="cmd">trace</b> <b class="cmd">on</b> command.  There is no overhead imposed
by trace registration when trace logging is disabled.</p></dd>
<dt><a name="35"><b class="cmd">${log}::trace</b> <b class="cmd">status</b> <span class="opt">?procName?</span> <span class="opt">?...?</span></a></dt>
<dd><p>This command returns a list of the procedures currently registered for
trace logging, or a flag indicating whether or not a trace is registered
for one or more specified procedures.</p></dd>
<dt><a name="36"><b class="cmd">${log}::trace</b> <b class="cmd">add</b> <i class="arg">procName</i> <span class="opt">?...?</span></a></dt>
<dd></dd>
<dt><a name="37"><b class="cmd">${log}::trace</b> <b class="cmd">add</b> <span class="opt">?-ns?</span> <i class="arg">nsName</i> <span class="opt">?...?</span></a></dt>
<dd><p>This command registers one or more procedures for logging of entry/exit
traces.  Procedures can be specified via a list of procedure names or
namespace names (in which case all procedure within the namespace
are targeted by the operation).  By default, each name is first
interpreted as a procedure name or glob-style search pattern, and if
not found its interpreted as a namespace name.  The <i class="arg">-ns</i> option can
be used to force interpretation of all provided arguments as namespace names.
Procedures must be defined prior to registering them for tracing
through the <b class="cmd">trace</b> <b class="cmd">add</b> command.  Any procedure or namespace
names/patterns that don't match any existing procedures will be
silently ignored.</p></dd>
<dt><a name="38"><b class="cmd">${log}::trace</b> <b class="cmd"><a href="../../../../index.html#key209">remove</a></b> <i class="arg">procName</i> <span class="opt">?...?</span></a></dt>
<dd></dd>
<dt><a name="39"><b class="cmd">${log}::trace</b> <b class="cmd"><a href="../../../../index.html#key209">remove</a></b> <span class="opt">?-ns?</span> <i class="arg">nsName</i> <span class="opt">?...?</span></a></dt>
<dd><p>This command unregisters one or more procedures so that they will no
longer have trace logging performed, with the same matching rules as
that of the <b class="cmd">trace</b> <b class="cmd">add</b> command.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">IMPLEMENTATION</a></h2>
<p>The logger package is implemented in such a way as to optimize (for
Tcl 8.4 and newer) log procedures which are disabled.  They are
aliased to a proc which has no body, which is compiled to a no op in
bytecode.  This should make the peformance hit minimal.  If you really
want to pull out all the stops, you can replace the ${log} token in
your code with the actual namespace and command (${log}::warn becomes
::logger::tree::myservice::warn), so that no variable lookup is done.
This puts the performance of disabled logger commands very close to no
logging at all.</p>
<p>The &quot;object orientation&quot; is done through a hierarchy of namespaces.
Using an actual object oriented system would probably be a better way
of doing things, or at least provide for a cleaner implementation.</p>
<p>The service &quot;object orientation&quot; is done with namespaces.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Logprocs and Callstack</a></h2>
<p>The logger package takes extra care to keep the logproc out of the call stack.
This enables logprocs to execute code in the callers scope by using uplevel or
linking to local variables by using upvar. This may fire traces with all usual
side effects.</p>
<pre class="example">
     # Print caller and current vars in the calling proc
     proc log_local_var {txt} {
          set caller [info level -1]
          set vars [uplevel 1 info vars]
          foreach var [lsort $vars] {
             if {[uplevel 1 [list array exists $var]] == 1} {
             	lappend val $var &lt;Array&gt;
             } else {
             	lappend val $var [uplevel 1 [list set $var]]
             }
          }
          puts &quot;$txt&quot;
          puts &quot;Caller: $caller&quot;
          puts &quot;Variables in callers scope:&quot;
          foreach {var value} $val {
          	puts &quot;$var = $value&quot;
          }
     }
     
     # install as logproc
     ${log}::logproc debug log_local_var
     </pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>logger</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key71">log</a>, <a href="../../../../index.html#key70">log level</a>, <a href="../../../../index.html#key68">logger</a>, <a href="../../../../index.html#key69">service</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/log/loggerAppender.html.


















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>logger::appender - Object Oriented logging facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/log/loggerAppender.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Aamer Akhter &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ logger::appender.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">logger::appender(n) 1.2 tcllib &quot;Object Oriented logging facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>logger::appender - Collection of predefined appenders for logger</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">logger::appender <span class="opt">?1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::logger::appender::console</b> <b class="option">-level</b> <i class="arg">level</i> <b class="option">-service</b> <i class="arg">service</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">::logger::appender::colorConsole</b> <b class="option">-level</b> <i class="arg">level</i> <b class="option">-service</b> <i class="arg">service</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a predefined set of logger templates.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::logger::appender::console</b> <b class="option">-level</b> <i class="arg">level</i> <b class="option">-service</b> <i class="arg">service</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><dl class="options">
<dt><b class="option">-level</b> level</dt>
<dd><p>Name of the level to fill in as &quot;priority&quot; in the log procedure.</p></dd>
<dt><b class="option">-service</b> service</dt>
<dd><p>Name of the service to fill in as &quot;category&quot; in the log procedure.</p></dd>
<dt><b class="option">-appenderArgs</b> appenderArgs</dt>
<dd><p>Any additional arguments for the log procedure in list form</p></dd>
<dt><b class="option">-conversionPattern</b> conversionPattern</dt>
<dd><p>The log pattern to use (see <b class="cmd">logger::utils::createLogProc</b> for the
allowed substitutions).</p></dd>
<dt><b class="option">-procName</b> procName</dt>
<dd><p>Explicitly set the name of the created procedure.</p></dd>
<dt><b class="option">-procNameVar</b> procNameVar</dt>
<dd><p>Name of the variable to set in the calling context. This variable will
contain the name of the procedure.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::logger::appender::colorConsole</b> <b class="option">-level</b> <i class="arg">level</i> <b class="option">-service</b> <i class="arg">service</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>See <b class="cmd">::logger::appender::colorConsole</b> for a description of the
applicable options.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>logger</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key360">appender</a>, <a href="../../../../index.html#key68">logger</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Aamer Akhter &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/log/loggerUtils.html.




















































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>logger::utils - Object Oriented logging facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/log/loggerUtils.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Aamer Akhter &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ logger::utils.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">logger::utils(n) 1.3 tcllib &quot;Object Oriented logging facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>logger::utils - Utilities for logger</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">logger::utils <span class="opt">?1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::logger::utils::createFormatCmd</b> <i class="arg">formatString</i></a></li>
<li><a href="#2"><b class="cmd">::logger::utils::createLogProc</b> <b class="option">-procName</b> <i class="arg">procName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">::logger::utils::applyAppender</b> <b class="option">-appender</b> <i class="arg">appenderType</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#4"><b class="cmd">::logger::utils::autoApplyAppender</b> <i class="arg">command</i> <i class="arg">command-string</i> <i class="arg">log</i> <i class="arg">op</i> <i class="arg">args</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package adds template based <i class="term">appenders</i>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::logger::utils::createFormatCmd</b> <i class="arg">formatString</i></a></dt>
<dd><p>This command translates <i class="arg">formatString</i> into an expandable command
string.
The following strings are the known substitutions (from log4perl)
allowed to occur in the <i class="arg">formatString</i>:</p>
<dl class="definitions">
<dt>%c</dt>
<dd><p>Category of the logging event</p></dd>
<dt>%C</dt>
<dd><p>Fully qualified name of logging event</p></dd>
<dt>%d</dt>
<dd><p>Current date in yyyy/MM/dd hh:mm:ss</p></dd>
<dt>%H</dt>
<dd><p>Hostname</p></dd>
<dt>%m</dt>
<dd><p>Message to be logged</p></dd>
<dt>%M</dt>
<dd><p>Method where logging event was issued</p></dd>
<dt>%p</dt>
<dd><p>Priority of logging event</p></dd>
<dt>%P</dt>
<dd><p>Pid of current process</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::logger::utils::createLogProc</b> <b class="option">-procName</b> <i class="arg">procName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command ...</p>
<dl class="options">
<dt><b class="option">-procName</b> procName</dt>
<dd><p>The name of the procedure to create.</p></dd>
<dt><b class="option">-conversionPattern</b> pattern</dt>
<dd><p>See <b class="cmd">::logger::utils::createFormatCmd</b> for the substitutions
allowed in the <i class="arg">pattern</i>.</p></dd>
<dt><b class="option">-category</b> category</dt>
<dd><p>The category (service).</p></dd>
<dt><b class="option">-priority</b> priority</dt>
<dd><p>The priority (level).</p></dd>
<dt><b class="option">-outputChannel</b> channel</dt>
<dd><p>channel to output on (default stdout)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::logger::utils::applyAppender</b> <b class="option">-appender</b> <i class="arg">appenderType</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command will create an appender for the specified logger
services. If no service is specified then the appender will be added
as the default appender for the specified levels. If no levels are
specified, then all levels are assumed.</p>
<dl class="options">
<dt><b class="option">-service</b> loggerservices</dt>
<dd></dd>
<dt><b class="option">-serviceCmd</b> loggerserviceCmds</dt>
<dd><p>Name of the logger instance to modify. <b class="option">-serviceCmd</b> takes as
input the return of <b class="cmd">logger::init</b>.</p></dd>
<dt><b class="option">-appender</b> appenderType</dt>
<dd><p>Type of the appender to use.
One of <b class="const">console</b>, <b class="const">colorConsole</b>.</p></dd>
<dt><b class="option">-conversionPattern</b> pattern</dt>
<dd><p>See <b class="cmd">::logger::utils::createFormatCmd</b> for the
format of the pattern. If this option is not provided
the default pattern</p>
<pre class="example">[%d] [%c] [%M] [%p] %m</pre>
<p>is used.</p></dd>
<dt><b class="option">-levels</b> levelList</dt>
<dd><p>The list of levels to apply this appender to. If not specified all
levels are assumed.</p></dd>
</dl>
<p>Example of usage:</p>
<pre class="example">
   % set log [logger::init testLog]
   ::logger::tree::testLog
   % logger::utils::applyAppender -appender console -serviceCmd $log
   % ${log}::error &quot;this is an error&quot;
   [2005/08/22 10:14:13] [testLog] [global] [error] this is an error
</pre>
</dd>
<dt><a name="4"><b class="cmd">::logger::utils::autoApplyAppender</b> <i class="arg">command</i> <i class="arg">command-string</i> <i class="arg">log</i> <i class="arg">op</i> <i class="arg">args</i>...</a></dt>
<dd><p>This command is designed to be added via <b class="cmd">trace leave</b> to calls
of <b class="cmd">logger::init</b>. It will look at preconfigured state (via
<b class="cmd">::logger::utils::applyAppender</b>) to autocreate appenders for
newly created logger instances.
It will return its argument <i class="arg">log</i>.</p>
<p>Example of usage:</p>
<pre class="example">
  logger::utils::applyAppender -appender console
  set log [logger::init applyAppender-3]
  ${log}::error &quot;this is an error&quot;
</pre>
</dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>logger</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key360">appender</a>, <a href="../../../../index.html#key68">logger</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Aamer Akhter &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/map/map_geocode_nominatim.html.

































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>map::geocode::nominatim - Mapping utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/map/map_geocode_nominatim.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ map::geocode::nominatim.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">map::geocode::nominatim(n) 0.1 tcllib &quot;Mapping utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>map::geocode::nominatim - Resolving geographical names with a Nominatim service</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Options</a></li>
<li class="subsection"><a href="#subsection2">Methods</a></li>
</ul>
</li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">http</b></li>
<li>package require <b class="pkgname">json</b></li>
<li>package require <b class="pkgname">uri</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">map::geocode::nominatim <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::map::geocode::nominatim</b> <i class="arg">requestor</i> <span class="opt">?<b class="option">-baseurl</b> <i class="arg">url</i>?</span> <span class="opt">?<b class="option">-callback</b> <i class="arg">callback</i>?</span> <span class="opt">?<b class="option">-error</b> <i class="arg">error callback</i>?</span></a></li>
<li><a href="#2"><b class="cmd">$cmdprefix</b> <i class="arg">result</i></a></li>
<li><a href="#3"><b class="cmd">$cmdprefix</b> <i class="arg">errorstring</i></a></li>
<li><a href="#4"><i class="arg">requestor</i> <b class="method">search</b> <i class="arg">query</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for accessing geocoding services which implement
the <i class="term"><a href="../../../../index.html#key538">Nominatim</a></i> interface (see <span class="sectref"><a href="#section3">References</a></span>)</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::map::geocode::nominatim</b> <i class="arg">requestor</i> <span class="opt">?<b class="option">-baseurl</b> <i class="arg">url</i>?</span> <span class="opt">?<b class="option">-callback</b> <i class="arg">callback</i>?</span> <span class="opt">?<b class="option">-error</b> <i class="arg">error callback</i>?</span></a></dt>
<dd><p>Creates a geocoding request object <i class="arg">requestor</i>, which will send its requests to
the <i class="term"><a href="../../../../index.html#key538">Nominatim</a></i> server.</p>
<p>The result of the command is <i class="arg">name</i>.</p></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Options</a></h3>
<dl class="options">
<dt><b class="option">-baseurl</b> <i class="arg">url</i></dt>
<dd><p>The base URL of the <i class="term"><a href="../../../../index.html#key538">Nominatim</a></i> service. Default value is <i class="term">OpenStreetMap's</i> service at
<a href="http://nominatim.openstreetmap.org/search">http://nominatim.openstreetmap.org/search</a> A possible free alternative is at
<a href="http://open.mapquestapi.com//nominatim/v1/search">http://open.mapquestapi.com//nominatim/v1/search</a></p></dd>
<dt><b class="option">-callback</b> <i class="arg">cmdprefix</i></dt>
<dd><p>A command prefix to be invoked when search result become available.
The default setting, active when nothing was specified on object creation, is to print
the <i class="arg">result</i> (see below) to <i class="term"><a href="../../../../index.html#key767">stdout</a></i>. The result of the command prefix is
ignored. Errors thrown by the command prefix are caught and cause the invokation of
the error callback (see option <b class="option">-error</b> below), with the error message as argument.</p>
<p>The signature of the command prefix is:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">$cmdprefix</b> <i class="arg">result</i></a></dt>
<dd><p>The <i class="arg">result</i> is a list of dictionaries, containing one item per hit.
Each dictionary will have the following entries:</p>
<dl class="definitions">
<dt>place_id</dt>
<dd><p>The place ID (FIXME: what's this?)</p></dd>
<dt>licence</dt>
<dd><p>The data licence string</p></dd>
<dt>osm_type</dt>
<dd><p>The OSM type of the location</p></dd>
<dt>osm_id</dt>
<dd><p>FIXME</p></dd>
<dt>boundingbox</dt>
<dd><p>The coordinates of the bounding box (min and max latitude, min and max longitude)</p></dd>
<dt>lat</dt>
<dd><p>The location's latitude</p></dd>
<dt>lon</dt>
<dd><p>The location's longitude</p></dd>
<dt>display_name</dt>
<dd><p>the location's human readable name</p></dd>
<dt>class</dt>
<dd><p>FIXME</p></dd>
<dt>type</dt>
<dd><p>FIXME</p></dd>
<dt>icon</dt>
<dd><p>FIXME</p></dd>
</dl></dd>
</dl></dd>
<dt><b class="option">-error</b> <i class="arg">cmdprefix</i></dt>
<dd><p>A command prefix to be invoked when encountering errors. Typically these are HTTP errors.
The default setting, active when nothing was specified on object creation, is to print
the <i class="arg">errorstring</i> (see below) to <i class="term">stderr</i>. The result of the command prefix is
ignored. Errors thrown by the command prefix are passed to higher levels.</p>
<p>The signature of the command prefix is:</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">$cmdprefix</b> <i class="arg">errorstring</i></a></dt>
<dd></dd>
</dl></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Methods</a></h3>
<dl class="definitions">
<dt><a name="4"><i class="arg">requestor</i> <b class="method">search</b> <i class="arg">query</i></a></dt>
<dd><p>This method returns a list of dictionaries, one item per hit for the specified <i class="arg">query</i>.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://wiki.openstreetmap.org/wiki/Nominatim">http://wiki.openstreetmap.org/wiki/Nominatim</a></p></li>
<li><p><a href="http://open.mapquestapi.com/nominatim/">http://open.mapquestapi.com/nominatim/</a></p></li>
</ol>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key539">geocoding</a>, <a href="../../../../index.html#key481">http</a>, <a href="../../../../index.html#key184">location</a>, <a href="../../../../index.html#key187">map</a>, <a href="../../../../index.html#key538">nominatim</a>, <a href="../../../../index.html#key57">server</a>, <a href="../../../../index.html#key483">url</a></p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/map/map_slippy.html.



























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>map::slippy - Mapping utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/map/map_slippy.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ map::slippy.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">map::slippy(n) 0.5 tcllib &quot;Mapping utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>map::slippy - Common code for slippy based map packages</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Coordinate systems</a>
<ul>
<li class="subsection"><a href="#subsection1">Geographic</a></li>
<li class="subsection"><a href="#subsection2">Tiles</a></li>
<li class="subsection"><a href="#subsection3">Pixels/Points</a></li>
</ul>
</li>
<li class="section"><a href="#section4">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">Tk 8.4</b></li>
<li>package require <b class="pkgname">map::slippy <span class="opt">?0.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::map::slippy</b> <b class="method">length</b> <i class="arg">level</i></a></li>
<li><a href="#2"><b class="cmd">::map::slippy</b> <b class="method">tiles</b> <i class="arg">level</i></a></li>
<li><a href="#3"><b class="cmd">::map::slippy</b> <b class="method">tile size</b></a></li>
<li><a href="#4"><b class="cmd">::map::slippy</b> <b class="method">tile valid</b> <i class="arg">tile</i> <i class="arg">levels</i> <span class="opt">?<i class="arg">msgvar</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::map::slippy</b> <b class="method">geo 2tile</b> <i class="arg">geo</i></a></li>
<li><a href="#6"><b class="cmd">::map::slippy</b> <b class="method">geo 2tile.float</b> <i class="arg">geo</i></a></li>
<li><a href="#7"><b class="cmd">::map::slippy</b> <b class="method">geo 2point</b> <i class="arg">geo</i></a></li>
<li><a href="#8"><b class="cmd">::map::slippy</b> <b class="method">tile 2geo</b> <i class="arg">tile</i></a></li>
<li><a href="#9"><b class="cmd">::map::slippy</b> <b class="method">tile 2point</b> <i class="arg">tile</i></a></li>
<li><a href="#10"><b class="cmd">::map::slippy</b> <b class="method">point 2geo</b> <i class="arg">point</i></a></li>
<li><a href="#11"><b class="cmd">::map::slippy</b> <b class="method">point 2tile</b> <i class="arg">point</i></a></li>
<li><a href="#12"><b class="cmd">::map::slippy</b> <b class="method">fit geobox</b> <i class="arg">canvdim</i> <i class="arg">geobox</i> <i class="arg">zmin</i> <i class="arg">zmax</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a number of methods doing things needed by all
types of slippy-based map packages.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::map::slippy</b> <b class="method">length</b> <i class="arg">level</i></a></dt>
<dd><p>This method returns the width/height of a slippy-based map at the
specified zoom <i class="arg">level</i>, in pixels. This is, in essence, the result
of</p>
<pre class="example">
	expr { [tiles $level] * [tile size] }
</pre>
</dd>
<dt><a name="2"><b class="cmd">::map::slippy</b> <b class="method">tiles</b> <i class="arg">level</i></a></dt>
<dd><p>This method returns the width/height of a slippy-based map at the
specified zoom <i class="arg">level</i>, in <i class="term">tiles</i>.</p></dd>
<dt><a name="3"><b class="cmd">::map::slippy</b> <b class="method">tile size</b></a></dt>
<dd><p>This method returns the width/height of a tile in a slippy-based map,
in pixels.</p></dd>
<dt><a name="4"><b class="cmd">::map::slippy</b> <b class="method">tile valid</b> <i class="arg">tile</i> <i class="arg">levels</i> <span class="opt">?<i class="arg">msgvar</i>?</span></a></dt>
<dd><p>This method checks whether <i class="arg">tile</i> described a valid tile in a
slippy-based map containing that many zoom <i class="arg">levels</i>. The result is
a boolean value, <b class="const">true</b> if the tile is valid, and <b class="const">false</b>
otherwise. For the latter a message is left in the variable named by
<i class="arg">msgvar</i>, should it be specified.</p>
<p>A tile identifier as stored in <i class="arg">tile</i> is a list containing zoom
level, tile row, and tile column, in this order. The command
essentially checks this, i.e. the syntax, that the zoom level is
between 0 and &quot;<i class="arg">levels</i>-1&quot;, and that the row/col information is
within the boundaries for the zoom level, i.e. 0 ...
&quot;[tiles $zoom]-1&quot;.</p></dd>
<dt><a name="5"><b class="cmd">::map::slippy</b> <b class="method">geo 2tile</b> <i class="arg">geo</i></a></dt>
<dd><p>Converts a geographical location at a zoom level (<i class="arg">geo</i>, a list
containing zoom level, latitude, and longitude, in this order) to a
tile identifier (list containing zoom level, row, and column) at that
level. The tile identifier uses pure integer numbers for the tile
coordinates, for all geographic coordinates mapping to that tile.</p></dd>
<dt><a name="6"><b class="cmd">::map::slippy</b> <b class="method">geo 2tile.float</b> <i class="arg">geo</i></a></dt>
<dd><p>Converts a geographical location at a zoom level (<i class="arg">geo</i>, a list
containing zoom level, latitude, and longitude, in this order) to a
tile identifier (list containing zoom level, row, and column) at that
level. The tile identifier uses floating point numbers for the tile
coordinates, representing not only the tile the geographic coordinates
map to, but also the fractional location inside of that tile.</p></dd>
<dt><a name="7"><b class="cmd">::map::slippy</b> <b class="method">geo 2point</b> <i class="arg">geo</i></a></dt>
<dd><p>Converts a geographical location at a zoom level (<i class="arg">geo</i>, a list
containing zoom level, latitude, and longitude, in this order) to a
pixel position (list containing zoom level, y, and x) at that level.</p></dd>
<dt><a name="8"><b class="cmd">::map::slippy</b> <b class="method">tile 2geo</b> <i class="arg">tile</i></a></dt>
<dd><p>Converts a tile identifier at a zoom level (<i class="arg">tile</i>, list
containing zoom level, row, and column) to a geographical location
(list containing zoom level, latitude, and longitude, in this order)
at that level.</p></dd>
<dt><a name="9"><b class="cmd">::map::slippy</b> <b class="method">tile 2point</b> <i class="arg">tile</i></a></dt>
<dd><p>Converts a tile identifier at a zoom level (<i class="arg">tile</i>, a list
containing zoom level, row, and column, in this order) to a pixel
position (list containing zoom level, y, and x) at that level.</p></dd>
<dt><a name="10"><b class="cmd">::map::slippy</b> <b class="method">point 2geo</b> <i class="arg">point</i></a></dt>
<dd><p>Converts a pixel position at a zoom level (<i class="arg">point</i>, list
containing zoom level, y, and x) to a geographical location (list
containing zoom level, latitude, and longitude, in this order) at that
level.</p></dd>
<dt><a name="11"><b class="cmd">::map::slippy</b> <b class="method">point 2tile</b> <i class="arg">point</i></a></dt>
<dd><p>Converts a pixel position at a zoom level (<i class="arg">point</i>, a list
containing zoom level, y, and x, in this order) to a tile identifier
(list containing zoom level, row, and column) at that level.</p></dd>
<dt><a name="12"><b class="cmd">::map::slippy</b> <b class="method">fit geobox</b> <i class="arg">canvdim</i> <i class="arg">geobox</i> <i class="arg">zmin</i> <i class="arg">zmax</i></a></dt>
<dd><p>Calculates the zoom level (whithin the bounds <i class="arg">zmin</i> and
<i class="arg">zmax</i>) such that <i class="arg">geobox</i> (a 4-element list containing the
latitudes and longitudes lat0, lat1, lon0 and lon1 of a geo box,
in this order) fits into a viewport given by <i class="arg">canvdim</i>, a
2-element list containing the width and height of the viewport, in
this order.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Coordinate systems</a></h2>
<p>The commands of this package operate on three distinct coordinate
systems, which are explained below.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Geographic</a></h3>
<p><i class="term">Geographic</i>al coordinates are represented by <i class="term">Latitude</i> and
<i class="term"><a href="../../../../index.html#key188">Longitude</a></i>, each of which is measured in degrees, as they are
essentially angles.</p>
<p><b class="const">Zero</b> longitude is the <i class="term">Greenwich meridian</i>, with
positive values going <i class="term">east</i>, and negative values going
<i class="term">west</i>, for a total range of +/- 180 degrees. Note that +180 and
-180 longitude are the same <i class="term">meridian</i>, opposite to greenwich.</p>
<p><b class="const">zero</b> latitude the <i class="term">Equator</i>, with positive values
going <i class="term">north</i> and negative values going <i class="term">south</i>. While the
true range is +/- 90 degrees the projection used by the package
requires us to cap the range at +/- 85.05112877983284 degrees. This
means that north and south pole are not representable and not part of
any map.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Tiles</a></h3>
<p>While <span class="sectref"><a href="#subsection1">Geographic</a></span>al coordinates of the previous section are
independent of zoom level the <i class="term">tile coordinates</i> are not.</p>
<p>Generally the integer part of tile coordinates represent the
row and column number of the tile in question, wheras the fractional
parts signal how far inside the tile the location in question is, with
pure integer coordinates (no fractional part) representing the upper
left corner of the tile.</p>
<p>The zero point of the map is at the upper left corner,
regardless of zoom level, with larger coordinates going right (east)
and down (south), and smaller coordinates going left (west) and up
(north). Again regardless of zxoom level.</p>
<p>Negative tile coordinates are not allowed.</p>
<p>At zoom level 0 the whole map is represented by a single,
putting the geographic zero at 1/2, 1/2 of tile coordinates, and the
range of tile coordinates as [0...1].</p>
<p>To go from a zoom level N to the next deeper level N+1 each
tile of level N is split into its four quadrants, which then are the
tiles of level N+1.</p>
<p>This means that at zoom level N the map is sliced (horizontally
and vertically) into 2^N stripes, for a total of 4^N tiles, with tile
coordinates ranging from 0 to 2^N+1.</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Pixels/Points</a></h3>
<p><i class="term">pixel coordinates</i>, also called <i class="term">point coordinates</i> are
in essence <span class="sectref"><a href="#subsection2">tile coordinates</a></span> scaled by the size of
the image representing a tile. This tile size currently has a fixed
value, <b class="const">256</b>.</p>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://wiki.openstreetmap.org/wiki/Main_Page">http://wiki.openstreetmap.org/wiki/Main_Page</a></p></li>
</ol>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key182">geodesy</a>, <a href="../../../../index.html#key186">geography</a>, <a href="../../../../index.html#key181">latitute</a>, <a href="../../../../index.html#key184">location</a>, <a href="../../../../index.html#key188">longitude</a>, <a href="../../../../index.html#key187">map</a>, <a href="../../../../index.html#key185">slippy</a>, <a href="../../../../index.html#key183">zoom</a></p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/map/map_slippy_cache.html.








































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>map::slippy::cache - Mapping utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/map/map_slippy_cache.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ map::slippy::cache.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">map::slippy::cache(n) 0.2 tcllib &quot;Mapping utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>map::slippy::cache - Management of a tile cache in the local filesystem</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Methods</a></li>
</ul>
</li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">Tk 8.4</b></li>
<li>package require <b class="pkgname">img::png</b></li>
<li>package require <b class="pkgname">map::slippy</b></li>
<li>package require <b class="pkgname">map::slippy::cache <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::map::slippy::cache</b> <i class="arg">cacheName</i> <i class="arg">cachedir</i> <i class="arg">provider</i></a></li>
<li><a href="#2"><i class="arg">cacheName</i> <b class="method">valid</b> <i class="arg">tile</i> <span class="opt">?<i class="arg">msgvar</i>?</span></a></li>
<li><a href="#3"><i class="arg">cacheName</i> <b class="method">exists</b> <i class="arg">tile</i></a></li>
<li><a href="#4"><i class="arg">cacheName</i> <b class="method">get</b> <i class="arg">tile</i> <i class="arg">donecmd</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for managing a cache of tiles for
slippy-based maps in the local filesystem.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::map::slippy::cache</b> <i class="arg">cacheName</i> <i class="arg">cachedir</i> <i class="arg">provider</i></a></dt>
<dd><p>Creates the cache <i class="arg">cacheName</i> and configures it with both the path
to the directory contaiing the locally cached tiles (<i class="arg">cachedir</i>),
and the command prefix from which it will pull tiles asked for and not
yet known to the cache itself (<i class="arg">provider</i>).</p>
<p>The result of the command is <i class="arg">cacheName</i>.</p></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Methods</a></h3>
<dl class="definitions">
<dt><a name="2"><i class="arg">cacheName</i> <b class="method">valid</b> <i class="arg">tile</i> <span class="opt">?<i class="arg">msgvar</i>?</span></a></dt>
<dd><p>This method checks the validity of a the given <i class="arg">tile</i> identifier.
This is a convenience wrapper to <b class="cmd">::map::slippy tile valid</b> and
has the same interface.</p></dd>
<dt><a name="3"><i class="arg">cacheName</i> <b class="method">exists</b> <i class="arg">tile</i></a></dt>
<dd><p>This methods tests whether the cache contains the specified <i class="arg">tile</i>
or not. The result is a boolean value, <b class="const">true</b> if the tile is
known, and <b class="const">false</b> otherwise. The tile is identified by a list
containing three elements, zoom level, row, and column number, in this
order.</p></dd>
<dt><a name="4"><i class="arg">cacheName</i> <b class="method">get</b> <i class="arg">tile</i> <i class="arg">donecmd</i></a></dt>
<dd><p>This is the main method of the cache, retrieving the image for the
specified <i class="arg">tile</i> from the cache. The tile identifier is a list
containing three elements, the zoom level, row, and column number of
the tile, in this order.</p>
<p>The command refix <i class="arg">donecmd</i> will be invoked when the cache
either knows the image for the tile or that no image will forthcoming.
It will be invoked with either 2 or 3 arguments, i.e.</p>
<ol class="enumerated">
<li><p>The string <b class="const">set</b>, the <i class="arg">tile</i>, and the image.</p></li>
<li><p>The string <b class="const">unset</b>, and the <i class="arg">tile</i>.</p></li>
</ol>
<p>These two possibilities are used to either signal the image for the
<i class="arg">tile</i>, or that the <i class="arg">tile</i> has no image defined for it.</p>
<p>When the cache has no information about the tile it will invoke the
<i class="arg">provider</i> command prefix specified during its construction,
adding three arguments: The string <b class="const">get</b>, the <i class="arg">tile</i>, and a
callback into the cache. The latter will be invoked by the provider to
either transfer the image to the cache, or signal that the tile has no
image.</p>
<p>When multiple requests for the same tile are made only one request
will be issued to the provider.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://wiki.openstreetmap.org/wiki/Main_Page">http://wiki.openstreetmap.org/wiki/Main_Page</a></p></li>
</ol>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key338">cache</a>, <a href="../../../../index.html#key339">filesystem</a>, <a href="../../../../index.html#key184">location</a>, <a href="../../../../index.html#key187">map</a>, <a href="../../../../index.html#key185">slippy</a>, <a href="../../../../index.html#key340">tile</a>, <a href="../../../../index.html#key183">zoom</a></p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/map/map_slippy_fetcher.html.





























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>map::slippy::fetcher - Mapping utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/map/map_slippy_fetcher.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ map::slippy::fetcher.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">map::slippy::fetcher(n) 0.3 tcllib &quot;Mapping utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>map::slippy::fetcher - Accessing a server providing tiles for slippy-based maps</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Methods</a></li>
</ul>
</li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">Tk 8.4</b></li>
<li>package require <b class="pkgname">img::png</b></li>
<li>package require <b class="pkgname">map::slippy</b></li>
<li>package require <b class="pkgname">map::slippy::fetcher <span class="opt">?0.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::map::slippy::fetcher</b> <i class="arg">fetcherName</i> <i class="arg">levels</i> <i class="arg">url</i></a></li>
<li><a href="#2"><i class="arg">fetcherName</i> <b class="method">levels</b></a></li>
<li><a href="#3"><i class="arg">fetcherName</i> <b class="method">tileheight</b></a></li>
<li><a href="#4"><i class="arg">fetcherName</i> <b class="method">tilewidth</b></a></li>
<li><a href="#5"><i class="arg">fetcherName</i> <b class="method">get</b> <i class="arg">tile</i> <i class="arg">donecmd</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for accessing http servers providing
tiles for slippy-based maps.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::map::slippy::fetcher</b> <i class="arg">fetcherName</i> <i class="arg">levels</i> <i class="arg">url</i></a></dt>
<dd><p>Creates the fetcher <i class="arg">fetcherName</i> and configures it with the
number of zoom <i class="arg">levels</i> supported by the tile server, and the
<i class="arg">url</i> it is listening on for tile requests.</p>
<p>The result of the command is <i class="arg">fetcherName</i>.</p></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Methods</a></h3>
<dl class="definitions">
<dt><a name="2"><i class="arg">fetcherName</i> <b class="method">levels</b></a></dt>
<dd><p>This method returns the number of zoom levels supported by the fetcher
object, and the tile server it is accessing.</p></dd>
<dt><a name="3"><i class="arg">fetcherName</i> <b class="method">tileheight</b></a></dt>
<dd><p>This method returns the height of tiles served, in pixels.</p></dd>
<dt><a name="4"><i class="arg">fetcherName</i> <b class="method">tilewidth</b></a></dt>
<dd><p>This method returns the width of tiles served, in pixels.</p></dd>
<dt><a name="5"><i class="arg">fetcherName</i> <b class="method">get</b> <i class="arg">tile</i> <i class="arg">donecmd</i></a></dt>
<dd><p>This is the main method of the fetcher, retrieving the image for the
specified <i class="arg">tile</i>. The tile identifier is a list containing three
elements, the zoom level, row, and column number of the tile, in this
order.</p>
<p>The command refix <i class="arg">donecmd</i> will be invoked when the fetcher
either knows the image for the tile or that no image will forthcoming.
It will be invoked with either 2 or 3 arguments, i.e.</p>
<ol class="enumerated">
<li><p>The string <b class="const">set</b>, the <i class="arg">tile</i>, and the image.</p></li>
<li><p>The string <b class="const">unset</b>, and the <i class="arg">tile</i>.</p></li>
</ol>
<p>These two possibilities are used to either signal the image for the
<i class="arg">tile</i>, or that the <i class="arg">tile</i> has no image defined for it.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://wiki.openstreetmap.org/wiki/Main_Page">http://wiki.openstreetmap.org/wiki/Main_Page</a></p></li>
</ol>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key481">http</a>, <a href="../../../../index.html#key184">location</a>, <a href="../../../../index.html#key187">map</a>, <a href="../../../../index.html#key57">server</a>, <a href="../../../../index.html#key185">slippy</a>, <a href="../../../../index.html#key340">tile</a>, <a href="../../../../index.html#key483">url</a>, <a href="../../../../index.html#key183">zoom</a></p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/mapproj/mapproj.html.






































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>mapproj - Tcl Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/mapproj/mapproj.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Kevin B. Kenny &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ mapproj.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">mapproj(n) 0.1 tcllib &quot;Tcl Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>mapproj - Map projection routines</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Commands</a></li>
<li class="section"><a href="#section3">Arguments</a></li>
<li class="section"><a href="#section4">Results</a></li>
<li class="section"><a href="#section5">Choosing a projection</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.4?</span></b></li>
<li>package require <b class="pkgname">math::interpolate <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">math::special <span class="opt">?0.2.1?</span></b></li>
<li>package require <b class="pkgname">mapproj <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::mapproj::toPlateCarree</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#2"><b class="cmd">::mapproj::fromPlateCarree</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#3"><b class="cmd">::mapproj::toCylindricalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#4"><b class="cmd">::mapproj::fromCylindricalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#5"><b class="cmd">::mapproj::toMercator</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#6"><b class="cmd">::mapproj::fromMercator</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#7"><b class="cmd">::mapproj::toMillerCylindrical</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#8"><b class="cmd">::mapproj::fromMillerCylindrical</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#9"><b class="cmd">::mapproj::toSinusoidal</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#10"><b class="cmd">::mapproj::fromSinusoidal</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#11"><b class="cmd">::mapproj::toMollweide</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#12"><b class="cmd">::mapproj::fromMollweide</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#13"><b class="cmd">::mapproj::toEckertIV</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#14"><b class="cmd">::mapproj::fromEckertIV</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#15"><b class="cmd">::mapproj::toEckertVI</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#16"><b class="cmd">::mapproj::fromEckertVI</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#17"><b class="cmd">::mapproj::toRobinson</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#18"><b class="cmd">::mapproj::fromRobinson</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#19"><b class="cmd">::mapproj::toCassini</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#20"><b class="cmd">::mapproj::fromCassini</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#21"><b class="cmd">::mapproj::toPeirceQuincuncial</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#22"><b class="cmd">::mapproj::fromPeirceQuincuncial</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#23"><b class="cmd">::mapproj::toOrthographic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#24"><b class="cmd">::mapproj::fromOrthographic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#25"><b class="cmd">::mapproj::toStereographic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#26"><b class="cmd">::mapproj::fromStereographic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#27"><b class="cmd">::mapproj::toGnomonic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#28"><b class="cmd">::mapproj::fromGnomonic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#29"><b class="cmd">::mapproj::toAzimuthalEquidistant</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#30"><b class="cmd">::mapproj::fromAzimuthalEquidistant</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#31"><b class="cmd">::mapproj::toLambertAzimuthalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#32"><b class="cmd">::mapproj::fromLambertAzimuthalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#33"><b class="cmd">::mapproj::toHammer</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#34"><b class="cmd">::mapproj::fromHammer</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#35"><b class="cmd">::mapproj::toConicEquidistant</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#36"><b class="cmd">::mapproj::fromConicEquidistant</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#37"><b class="cmd">::mapproj::toAlbersEqualAreaConic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#38"><b class="cmd">::mapproj::fromAlbersEqualAreaConic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#39"><b class="cmd">::mapproj::toLambertConformalConic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#40"><b class="cmd">::mapproj::fromLambertConformalConic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#41"><b class="cmd">::mapproj::toLambertCylindricalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#42"><b class="cmd">::mapproj::fromLambertCylindricalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#43"><b class="cmd">::mapproj::toBehrmann</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#44"><b class="cmd">::mapproj::fromBehrmann</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#45"><b class="cmd">::mapproj::toTrystanEdwards</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#46"><b class="cmd">::mapproj::fromTrystanEdwards</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#47"><b class="cmd">::mapproj::toHoboDyer</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#48"><b class="cmd">::mapproj::fromHoboDyer</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#49"><b class="cmd">::mapproj::toGallPeters</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#50"><b class="cmd">::mapproj::fromGallPeters</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#51"><b class="cmd">::mapproj::toBalthasart</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></li>
<li><a href="#52"><b class="cmd">::mapproj::fromBalthasart</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">mapproj</b> package provides a set of procedures for
converting between world co-ordinates (latitude and longitude) and map
co-ordinates on a number of different map projections.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Commands</a></h2>
<p>The following commands convert between world co-ordinates and
map co-ordinates:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::mapproj::toPlateCarree</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the <em>plate carr&eacute;e</em> (cylindrical equidistant)
projection.</p></dd>
<dt><a name="2"><b class="cmd">::mapproj::fromPlateCarree</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the <em>plate carr&eacute;e</em> (cylindrical equidistant)
projection.</p></dd>
<dt><a name="3"><b class="cmd">::mapproj::toCylindricalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the cylindrical equal-area projection.</p></dd>
<dt><a name="4"><b class="cmd">::mapproj::fromCylindricalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the cylindrical equal-area projection.</p></dd>
<dt><a name="5"><b class="cmd">::mapproj::toMercator</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Mercator (cylindrical conformal) projection.</p></dd>
<dt><a name="6"><b class="cmd">::mapproj::fromMercator</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Mercator (cylindrical conformal) projection.</p></dd>
<dt><a name="7"><b class="cmd">::mapproj::toMillerCylindrical</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Miller Cylindrical projection.</p></dd>
<dt><a name="8"><b class="cmd">::mapproj::fromMillerCylindrical</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Miller Cylindrical projection.</p></dd>
<dt><a name="9"><b class="cmd">::mapproj::toSinusoidal</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the sinusoidal (Sanson-Flamsteed) projection.
projection.</p></dd>
<dt><a name="10"><b class="cmd">::mapproj::fromSinusoidal</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the sinusoidal (Sanson-Flamsteed) projection.
projection.</p></dd>
<dt><a name="11"><b class="cmd">::mapproj::toMollweide</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Mollweide projection.</p></dd>
<dt><a name="12"><b class="cmd">::mapproj::fromMollweide</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Mollweide projection.</p></dd>
<dt><a name="13"><b class="cmd">::mapproj::toEckertIV</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Eckert IV projection.</p></dd>
<dt><a name="14"><b class="cmd">::mapproj::fromEckertIV</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Eckert IV projection.</p></dd>
<dt><a name="15"><b class="cmd">::mapproj::toEckertVI</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Eckert VI projection.</p></dd>
<dt><a name="16"><b class="cmd">::mapproj::fromEckertVI</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Eckert VI projection.</p></dd>
<dt><a name="17"><b class="cmd">::mapproj::toRobinson</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Robinson projection.</p></dd>
<dt><a name="18"><b class="cmd">::mapproj::fromRobinson</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Robinson projection.</p></dd>
<dt><a name="19"><b class="cmd">::mapproj::toCassini</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Cassini (transverse cylindrical equidistant)
projection.</p></dd>
<dt><a name="20"><b class="cmd">::mapproj::fromCassini</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Cassini (transverse cylindrical equidistant)
projection.</p></dd>
<dt><a name="21"><b class="cmd">::mapproj::toPeirceQuincuncial</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Peirce Quincuncial Projection.</p></dd>
<dt><a name="22"><b class="cmd">::mapproj::fromPeirceQuincuncial</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Peirce Quincuncial Projection.</p></dd>
<dt><a name="23"><b class="cmd">::mapproj::toOrthographic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the orthographic projection.</p></dd>
<dt><a name="24"><b class="cmd">::mapproj::fromOrthographic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the orthographic projection.</p></dd>
<dt><a name="25"><b class="cmd">::mapproj::toStereographic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the stereographic (azimuthal conformal) projection.</p></dd>
<dt><a name="26"><b class="cmd">::mapproj::fromStereographic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the stereographic (azimuthal conformal) projection.</p></dd>
<dt><a name="27"><b class="cmd">::mapproj::toGnomonic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the gnomonic projection.</p></dd>
<dt><a name="28"><b class="cmd">::mapproj::fromGnomonic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the gnomonic projection.</p></dd>
<dt><a name="29"><b class="cmd">::mapproj::toAzimuthalEquidistant</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the azimuthal equidistant projection.</p></dd>
<dt><a name="30"><b class="cmd">::mapproj::fromAzimuthalEquidistant</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the azimuthal equidistant projection.</p></dd>
<dt><a name="31"><b class="cmd">::mapproj::toLambertAzimuthalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Lambert azimuthal equal-area projection.</p></dd>
<dt><a name="32"><b class="cmd">::mapproj::fromLambertAzimuthalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Lambert azimuthal equal-area projection.</p></dd>
<dt><a name="33"><b class="cmd">::mapproj::toHammer</b> <i class="arg">lambda_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Hammer projection.</p></dd>
<dt><a name="34"><b class="cmd">::mapproj::fromHammer</b> <i class="arg">lambda_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Hammer projection.</p></dd>
<dt><a name="35"><b class="cmd">::mapproj::toConicEquidistant</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the conic equidistant projection.</p></dd>
<dt><a name="36"><b class="cmd">::mapproj::fromConicEquidistant</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the conic equidistant projection.</p></dd>
<dt><a name="37"><b class="cmd">::mapproj::toAlbersEqualAreaConic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Albers equal-area conic projection.</p></dd>
<dt><a name="38"><b class="cmd">::mapproj::fromAlbersEqualAreaConic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Albers equal-area conic projection.</p></dd>
<dt><a name="39"><b class="cmd">::mapproj::toLambertConformalConic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Lambert conformal conic projection.</p></dd>
<dt><a name="40"><b class="cmd">::mapproj::fromLambertConformalConic</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">phi_1</i> <i class="arg">phi_2</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Lambert conformal conic projection.</p></dd>
</dl>
<p>Among the cylindrical equal-area projections, there are a number of
choices of standard parallels that have names:</p>
<dl class="definitions">
<dt><a name="41"><b class="cmd">::mapproj::toLambertCylindricalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Lambert cylindrical equal area projection. (standard parallel
is the Equator.)</p></dd>
<dt><a name="42"><b class="cmd">::mapproj::fromLambertCylindricalEqualArea</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Lambert cylindrical equal area projection. (standard parallel
is the Equator.)</p></dd>
<dt><a name="43"><b class="cmd">::mapproj::toBehrmann</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Behrmann cylindrical equal area projection. (standard parallels
are 30 degrees North and South)</p></dd>
<dt><a name="44"><b class="cmd">::mapproj::fromBehrmann</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Behrmann cylindrical equal area projection. (standard parallels
are 30 degrees North and South.)</p></dd>
<dt><a name="45"><b class="cmd">::mapproj::toTrystanEdwards</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Trystan Edwards cylindrical equal area projection. (standard parallels
are 37.4 degrees North and South)</p></dd>
<dt><a name="46"><b class="cmd">::mapproj::fromTrystanEdwards</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Trystan Edwards cylindrical equal area projection. (standard parallels
are 37.4 degrees North and South.)</p></dd>
<dt><a name="47"><b class="cmd">::mapproj::toHoboDyer</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Hobo-Dyer cylindrical equal area projection. (standard parallels
are 37.5 degrees North and South)</p></dd>
<dt><a name="48"><b class="cmd">::mapproj::fromHoboDyer</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Hobo-Dyer cylindrical equal area projection. (standard parallels
are 37.5 degrees North and South.)</p></dd>
<dt><a name="49"><b class="cmd">::mapproj::toGallPeters</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Gall-Peters cylindrical equal area projection. (standard parallels
are 45 degrees North and South)</p></dd>
<dt><a name="50"><b class="cmd">::mapproj::fromGallPeters</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Gall-Peters cylindrical equal area projection. (standard parallels
are 45 degrees North and South.)</p></dd>
<dt><a name="51"><b class="cmd">::mapproj::toBalthasart</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">lambda</i> <i class="arg">phi</i></a></dt>
<dd><p>Converts to the Balthasart cylindrical equal area projection. (standard parallels
are 50 degrees North and South)</p></dd>
<dt><a name="52"><b class="cmd">::mapproj::fromBalthasart</b> <i class="arg">lambda_0</i> <i class="arg">phi_0</i> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Converts from the Balthasart cylindrical equal area projection. (standard parallels
are 50 degrees North and South.)</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Arguments</a></h2>
<p>The following arguments are accepted by the projection commands:</p>
<dl class="definitions">
<dt><i class="arg">lambda</i></dt>
<dd><p>Longitude of the point to be projected, in degrees.</p></dd>
<dt><i class="arg">phi</i></dt>
<dd><p>Latitude of the point to be projected, in degrees.</p></dd>
<dt><i class="arg">lambda_0</i></dt>
<dd><p>Longitude of the center of the sheet, in degrees.  For many projections,
this figure is also the reference meridian of the projection.</p></dd>
<dt><i class="arg">phi_0</i></dt>
<dd><p>Latitude of the center of the sheet, in degrees.  For the azimuthal 
projections, this figure is also the latitude of the center of the projection.</p></dd>
<dt><i class="arg">phi_1</i></dt>
<dd><p>Latitude of the first reference parallel, for projections that use reference
parallels.</p></dd>
<dt><i class="arg">phi_2</i></dt>
<dd><p>Latitude of the second reference parallel, for projections that use reference 
parallels.</p></dd>
<dt><i class="arg">x</i></dt>
<dd><p>X co-ordinate of a point on the map, in units of Earth radii.</p></dd>
<dt><i class="arg">y</i></dt>
<dd><p>Y co-ordinate of a point on the map, in units of Earth radii.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Results</a></h2>
<p>For all of the procedures whose names begin with 'to', the return value 
is a list comprising an <em>x</em> co-ordinate and a <em>y</em> co-ordinate.
The co-ordinates are relative to the center of the map sheet to be drawn,
measured in Earth radii at the reference location on the map.
For all of the functions whose names begin with 'from', the return value
is a list comprising the longitude and latitude, in degrees.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">Choosing a projection</a></h2>
<p>This package offers a great many projections, because no single projection
is appropriate to all maps.  This section attempts to provide guidance
on how to choose a projection.</p>
<p>First, consider the type of data that you intend to display on the map.
If the data are <em>directional</em> (<em>e.g.,</em> winds, ocean currents, or 
magnetic fields) then you need to use a projection that preserves
angles; these are known as <em>conformal</em> projections.  Conformal
projections include the Mercator, the Albers azimuthal equal-area,
the stereographic, and the Peirce Quincuncial projection.  If the
data are <em>thematic</em>, describing properties of land or water, such
as temperature, population density, land use, or demographics; then
you need a projection that will show these data with the areas on the map
proportional to the areas in real life.  These so-called <em>equal area</em>
projections include the various cylindrical equal area projections,
the sinusoidal projection, the Lambert azimuthal equal-area projection, 
the Albers equal-area conic projection, and several of the world-map 
projections (Miller Cylindrical, Mollweide, Eckert IV, Eckert VI, Robinson,
and Hammer). If the significant factor in your data is distance from a
central point or line (such as air routes), then you will do best with
an <em>equidistant</em> projection such as <em>plate carr&eacute;e</em>,
Cassini, azimuthal equidistant, or conic equidistant.  If direction from 
a central point is a critical factor in your data (for instance,
air routes, radio antenna pointing), then you will almost surely want to
use one of the azimuthal projections. Appropriate choices are azimuthal
equidistant, azimuthal equal-area, stereographic, and perhaps orthographic.</p>
<p>Next, consider how much of the Earth your map will cover, and the general
shape of the area of interest.  For maps of the entire Earth,
the cylindrical equal area, Eckert IV and VI, Mollweide, Robinson, and Hammer
projections are good overall choices.  The Mercator projection is traditional,
but the extreme distortions of area at high latitudes make it
a poor choice unless a conformal projection is required. The Peirce
projection is a better choice of conformal projection, having less distortion
of landforms.  The Miller Cylindrical is a compromise designed to give 
shapes similar to the traditional Mercator, but with less polar stretching.
The Peirce Quincuncial projection shows all the continents with acceptable
distortion if a reference meridian close to +20 degrees is chosen.
The Robinson projection yields attractive maps for things like political
divisions, but should be avoided in presenting scientific data, since other
projections have moe useful geometric properties.</p>
<p>If the map will cover a hemisphere, then choose stereographic, 
azimuthal-equidistant, Hammer, or Mollweide projections; these all project
the hemisphere into a circle.</p>
<p>If the map will cover a large area (at least a few hundred km on a side), 
but less than
a hemisphere, then you have several choices.  Azimuthal projections
are usually good (choose stereographic, azimuthal equidistant, or
Lambert azimuthal equal-area according to whether shapes, distances from 
a central point, or areas are important).  Azimuthal projections (and possibly 
the Cassini projection) are the only
really good choices for mapping the polar regions.</p>
<p>If the large area is in one of the temperate zones and is round or has
a primarily east-west extent, then the conic projections are good choices.
Choose the Lambert conformal conic, the conic equidistant, or the Albers
equal-area conic according to whether shape, distance, or area are the
most important parameters.  For any of these, the reference parallels
should be chosen at approximately 1/6 and 5/6 of the range of latitudes
to be displayed.  For instance, maps of the 48 coterminous United States
are attractive with reference parallels of 28.5 and 45.5 degrees.</p>
<p>If the large area is equatorial and is round or has a primarily east-west
extent, then the Mercator projection is a good choice for a conformal 
projection; Lambert cylindrical equal-area and sinusoidal projections are
good equal-area projections; and the <em>plate carr&eacute;e</em> is a
good equidistant projection.</p>
<p>Large areas having a primarily North-South aspect, particularly those
spanning the Equator, need some other choices.  The Cassini projection
is a good choice for an equidistant projection (for instance, a Cassini
projection with a central meridian of 80 degrees West produces an
attractive map of the Americas). The cylindrical equal-area, Albers
equal-area conic, sinusoidal, Mollweide and Hammer
projections are possible choices for equal-area projections.
A good conformal projection in this situation is the Transverse
Mercator, which alas, is not yet implemented.</p>
<p>Small areas begin to get into a realm where the ellipticity of the
Earth affects the map scale.  This package does not attempt to
handle accurate mapping for large-scale topographic maps.  If
slight scale errors are acceptable in your application, then any
of the projections appropriate to large areas should work for
small ones as well.</p>
<p>There are a few projections that are included for their special
properties.  The orthographic projection produces views of the
Earth as seen from space.  The gnomonic projection produces a
map on which all great circles (the shortest distance between
two points on the Earth's surface) are rendered as straight lines.
While this projection is useful for navigational planning, it
has extreme distortions of shape and area, and can display
only a limited area of the Earth (substantially less than a hemisphere).</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key182">geodesy</a>, <a href="../../../../index.html#key187">map</a>, <a href="../../../../index.html#key595">projection</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Kevin B. Kenny &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/bigfloat.html.
































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math::bigfloat - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/bigfloat.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004-2008, by Stephane Arnold &lt;stephanearnold at yahoo dot fr&gt;
   -->
<! -- CVS: $Id$ math::bigfloat.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::bigfloat(n) 2.0.1 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::bigfloat - Arbitrary precision floating-point numbers</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">INTRODUCTION</a></li>
<li class="section"><a href="#section3">ARITHMETICS</a></li>
<li class="section"><a href="#section4">COMPARISONS</a></li>
<li class="section"><a href="#section5">ANALYSIS</a></li>
<li class="section"><a href="#section6">ROUNDING</a></li>
<li class="section"><a href="#section7">PRECISION</a></li>
<li class="section"><a href="#section8">WHAT ABOUT TCL 8.4 ?</a></li>
<li class="section"><a href="#section9">NAMESPACES AND OTHER PACKAGES</a></li>
<li class="section"><a href="#section10">EXAMPLES</a></li>
<li class="section"><a href="#section11">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">math::bigfloat <span class="opt">?2.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">fromstr</b> <i class="arg">number</i> <span class="opt">?<i class="arg">trailingZeros</i>?</span></a></li>
<li><a href="#2"><b class="cmd">tostr</b> <span class="opt">?<b class="option">-nosci</b>?</span> <i class="arg">number</i></a></li>
<li><a href="#3"><b class="cmd">fromdouble</b> <i class="arg">double</i> <span class="opt">?<i class="arg">decimals</i>?</span></a></li>
<li><a href="#4"><b class="cmd">todouble</b> <i class="arg">number</i></a></li>
<li><a href="#5"><b class="cmd">isInt</b> <i class="arg">number</i></a></li>
<li><a href="#6"><b class="cmd">isFloat</b> <i class="arg">number</i></a></li>
<li><a href="#7"><b class="cmd">int2float</b> <i class="arg">integer</i> <span class="opt">?<i class="arg">decimals</i>?</span></a></li>
<li><a href="#8"><b class="cmd">add</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#9"><b class="cmd">sub</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#10"><b class="cmd">mul</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#11"><b class="cmd">div</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#12"><b class="cmd">mod</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#13"><b class="cmd">abs</b> <i class="arg">x</i></a></li>
<li><a href="#14"><b class="cmd">opp</b> <i class="arg">x</i></a></li>
<li><a href="#15"><b class="cmd">pow</b> <i class="arg">x</i> <i class="arg">n</i></a></li>
<li><a href="#16"><b class="cmd">iszero</b> <i class="arg">x</i></a></li>
<li><a href="#17"><b class="cmd"><a href="../../../../index.html#key511">equal</a></b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#18"><b class="cmd">compare</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#19"><b class="cmd">sqrt</b> <i class="arg">x</i></a></li>
<li><a href="#20"><b class="cmd"><a href="../log/log.html">log</a></b> <i class="arg">x</i></a></li>
<li><a href="#21"><b class="cmd">exp</b> <i class="arg">x</i></a></li>
<li><a href="#22"><b class="cmd">cos</b> <i class="arg">x</i></a></li>
<li><a href="#23"><b class="cmd">sin</b> <i class="arg">x</i></a></li>
<li><a href="#24"><b class="cmd">tan</b> <i class="arg">x</i></a></li>
<li><a href="#25"><b class="cmd">cotan</b> <i class="arg">x</i></a></li>
<li><a href="#26"><b class="cmd">acos</b> <i class="arg">x</i></a></li>
<li><a href="#27"><b class="cmd">asin</b> <i class="arg">x</i></a></li>
<li><a href="#28"><b class="cmd">atan</b> <i class="arg">x</i></a></li>
<li><a href="#29"><b class="cmd">cosh</b> <i class="arg">x</i></a></li>
<li><a href="#30"><b class="cmd">sinh</b> <i class="arg">x</i></a></li>
<li><a href="#31"><b class="cmd">tanh</b> <i class="arg">x</i></a></li>
<li><a href="#32"><b class="cmd"><a href="../../../../index.html#key745">pi</a></b> <i class="arg">n</i></a></li>
<li><a href="#33"><b class="cmd">rad2deg</b> <i class="arg">radians</i></a></li>
<li><a href="#34"><b class="cmd">deg2rad</b> <i class="arg">degrees</i></a></li>
<li><a href="#35"><b class="cmd">round</b> <i class="arg">x</i></a></li>
<li><a href="#36"><b class="cmd">ceil</b> <i class="arg">x</i></a></li>
<li><a href="#37"><b class="cmd">floor</b> <i class="arg">x</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The bigfloat package provides arbitrary precision floating-point math
capabilities to the Tcl language. It is designed to work with Tcl 8.5,
but for Tcl 8.4 is provided an earlier version of this package.
See <span class="sectref"><a href="#section8">WHAT ABOUT TCL 8.4 ?</a></span> for more explanations.
By convention, we will talk about the numbers treated in this library as :</p>
<ul class="itemized">
<li><p>BigFloat for floating-point numbers of arbitrary length.</p></li>
<li><p>integers for arbitrary length signed integers, just as basic integers since Tcl 8.5.</p></li>
</ul>
<p>Each BigFloat is an interval, namely [<em>m-d, m+d</em>],
where <em>m</em> is the mantissa and <em>d</em> the uncertainty, representing the
limitation of that number's precision.
This is why we call such mathematics <em>interval computations</em>.
Just take an example in physics : when you measure a temperature, not all
digits you read are <em>significant</em>. Sometimes you just cannot trust all digits - not to mention if doubles (f.p. numbers) can handle all these digits.
BigFloat can handle this problem - trusting the digits you get - plus the ability to store numbers with an arbitrary precision.
BigFloats are internally represented at Tcl lists: this
package provides a set of procedures operating against
the internal representation in order to :</p>
<ul class="itemized">
<li><p>perform math operations on BigFloats and (optionnaly) with integers.</p></li>
<li><p>convert BigFloats from their internal representations to strings, and vice versa.</p></li>
</ul>
</div>
<div id="section2" class="section"><h2><a name="section2">INTRODUCTION</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">fromstr</b> <i class="arg">number</i> <span class="opt">?<i class="arg">trailingZeros</i>?</span></a></dt>
<dd><p>Converts <em>number</em> into a BigFloat. Its precision
is at least the number of digits provided by <em>number</em>.
If the <i class="arg">number</i> contains only digits and eventually a minus sign, it is considered as
an integer. Subsequently, no conversion is done at all.</p>
<p><i class="arg">trailingZeros</i> - the number of zeros to append at the end of the floating-point number
to get more precision. It cannot be applied to an integer.</p>
<pre class="example">
# x and y are BigFloats : the first string contained a dot, and the second an e sign
set x [fromstr -1.000000]
set y [fromstr 2000e30]
# let's see how we get integers
set t 20000000000000
# the old way (package 1.2) is still supported for backwards compatibility :
set m [fromstr 10000000000]
# but we do not need fromstr for integers anymore
set n -39
# t, m and n are integers
</pre>
<p>The <em>number</em>'s last digit is considered by the procedure to be true at +/-1,
For example, 1.00 is the interval [0.99, 1.01],
and 0.43 the interval [0.42, 0.44].
The Pi constant may be approximated by the number &quot;3.1415&quot;.
This string could be considered as the interval [3.1414 , 3.1416] by <b class="cmd">fromstr</b>.
So, when you mean 1.0 as a double, you may have to write 1.000000 to get enough precision.
To learn more about this subject, see <span class="sectref"><a href="#section7">PRECISION</a></span>.</p>
<p>For example :</p>
<pre class="example">
set x [fromstr 1.0000000000]
# the next line does the same, but smarter
set y [fromstr 1. 10]
</pre>
</dd>
<dt><a name="2"><b class="cmd">tostr</b> <span class="opt">?<b class="option">-nosci</b>?</span> <i class="arg">number</i></a></dt>
<dd><p>Returns a string form of a BigFloat, in which all digits are exacts.
<em>All exact digits</em> means a rounding may occur, for example to zero,
if the uncertainty interval does not clearly show the true digits.
<em>number</em> may be an integer, causing the command to return exactly the input argument.
With the <b class="option">-nosci</b> option, the number returned is never shown in scientific
notation, i.e. not like '3.4523e+5' but like '345230.'.</p>
<pre class="example">
puts [tostr [fromstr 0.99999]] ;# 1.0000
puts [tostr [fromstr 1.00001]] ;# 1.0000
puts [tostr [fromstr 0.002]] ;# 0.e-2
</pre>
<p>See <span class="sectref"><a href="#section7">PRECISION</a></span> for that matter.
See also <b class="cmd">iszero</b> for how to detect zeros, which is useful when performing a division.</p></dd>
<dt><a name="3"><b class="cmd">fromdouble</b> <i class="arg">double</i> <span class="opt">?<i class="arg">decimals</i>?</span></a></dt>
<dd><p>Converts a double (a simple floating-point value) to a BigFloat, with
exactly <i class="arg">decimals</i> digits.  Without the <i class="arg">decimals</i> argument,
it behaves like <b class="cmd">fromstr</b>. 
Here, the only important feature you might care of is the ability
to create BigFloats with a fixed number of <i class="arg">decimals</i>.</p>
<pre class="example">
tostr [fromstr 1.111 4]
# returns : 1.111000 (3 zeros)
tostr [fromdouble 1.111 4]
# returns : 1.111
</pre>
</dd>
<dt><a name="4"><b class="cmd">todouble</b> <i class="arg">number</i></a></dt>
<dd><p>Returns a double, that may be used in <em>expr</em>,
from a BigFloat.</p></dd>
<dt><a name="5"><b class="cmd">isInt</b> <i class="arg">number</i></a></dt>
<dd><p>Returns 1 if <em>number</em> is an integer, 0 otherwise.</p></dd>
<dt><a name="6"><b class="cmd">isFloat</b> <i class="arg">number</i></a></dt>
<dd><p>Returns 1 if <em>number</em> is a BigFloat, 0 otherwise.</p></dd>
<dt><a name="7"><b class="cmd">int2float</b> <i class="arg">integer</i> <span class="opt">?<i class="arg">decimals</i>?</span></a></dt>
<dd><p>Converts an integer to a BigFloat with <em>decimals</em> trailing zeros.
The default, and minimal, number of <em>decimals</em> is 1.
When converting back to string, one decimal is lost:</p>
<pre class="example">
set n 10
set x [int2float $n]; # like fromstr 10.0
puts [tostr $x]; # prints &quot;10.&quot;
set x [int2float $n 3]; # like fromstr 10.000
puts [tostr $x]; # prints &quot;10.00&quot;
</pre>
</dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">ARITHMETICS</a></h2>
<dl class="definitions">
<dt><a name="8"><b class="cmd">add</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd></dd>
<dt><a name="9"><b class="cmd">sub</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd></dd>
<dt><a name="10"><b class="cmd">mul</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Return the sum, difference and product of <em>x</em> by <em>y</em>.
<i class="arg">x</i> - may be either a BigFloat or an integer
<i class="arg">y</i> - may be either a BigFloat or an integer
When both are integers, these commands behave like <b class="cmd">expr</b>.</p></dd>
<dt><a name="11"><b class="cmd">div</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd></dd>
<dt><a name="12"><b class="cmd">mod</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Return the quotient and the rest of <em>x</em> divided by <em>y</em>.
Each argument (<em>x</em> and <em>y</em>) can be either a BigFloat or an integer,
but you cannot divide an integer by a BigFloat
Divide by zero throws an error.</p></dd>
<dt><a name="13"><b class="cmd">abs</b> <i class="arg">x</i></a></dt>
<dd><p>Returns the absolute value of <em>x</em></p></dd>
<dt><a name="14"><b class="cmd">opp</b> <i class="arg">x</i></a></dt>
<dd><p>Returns the opposite of <em>x</em></p></dd>
<dt><a name="15"><b class="cmd">pow</b> <i class="arg">x</i> <i class="arg">n</i></a></dt>
<dd><p>Returns <em>x</em> taken to the <em>n</em>th power.
It only works if <em>n</em> is an integer.
<em>x</em> might be a BigFloat or an integer.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">COMPARISONS</a></h2>
<dl class="definitions">
<dt><a name="16"><b class="cmd">iszero</b> <i class="arg">x</i></a></dt>
<dd><p>Returns 1 if <em>x</em> is :</p>
<ul class="itemized">
<li><p>a BigFloat close enough to zero to raise &quot;divide by zero&quot;.</p></li>
<li><p>the integer 0.</p></li>
</ul>
<p>See here how numbers that are close to zero are converted to strings:</p>
<pre class="example">
tostr [fromstr 0.001] ; # -&gt; 0.e-2
tostr [fromstr 0.000000] ; # -&gt; 0.e-5
tostr [fromstr -0.000001] ; # -&gt; 0.e-5
tostr [fromstr 0.0] ; # -&gt; 0.
tostr [fromstr 0.002] ; # -&gt; 0.e-2
set a [fromstr 0.002] ; # uncertainty interval : 0.001, 0.003
tostr  $a ; # 0.e-2
iszero $a ; # false
set a [fromstr 0.001] ; # uncertainty interval : 0.000, 0.002
tostr  $a ; # 0.e-2
iszero $a ; # true
</pre>
</dd>
<dt><a name="17"><b class="cmd"><a href="../../../../index.html#key511">equal</a></b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Returns 1 if <em>x</em> and <em>y</em> are equal, 0 elsewhere.</p></dd>
<dt><a name="18"><b class="cmd">compare</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Returns 0 if both BigFloat arguments are equal,
1 if <em>x</em> is greater than <em>y</em>,
and -1 if <em>x</em> is lower than <em>y</em>.
You would not be able to compare an integer to a BigFloat :
the operands should be both BigFloats, or both integers.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">ANALYSIS</a></h2>
<dl class="definitions">
<dt><a name="19"><b class="cmd">sqrt</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="20"><b class="cmd"><a href="../log/log.html">log</a></b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="21"><b class="cmd">exp</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="22"><b class="cmd">cos</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="23"><b class="cmd">sin</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="24"><b class="cmd">tan</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="25"><b class="cmd">cotan</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="26"><b class="cmd">acos</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="27"><b class="cmd">asin</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="28"><b class="cmd">atan</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="29"><b class="cmd">cosh</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="30"><b class="cmd">sinh</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="31"><b class="cmd">tanh</b> <i class="arg">x</i></a></dt>
<dd><p>The above functions return, respectively, the following :
square root, logarithm, exponential, cosine, sine,
tangent, cotangent, arc cosine, arc sine, arc tangent, hyperbolic
cosine, hyperbolic sine, hyperbolic tangent, of a BigFloat named <em>x</em>.</p></dd>
<dt><a name="32"><b class="cmd"><a href="../../../../index.html#key745">pi</a></b> <i class="arg">n</i></a></dt>
<dd><p>Returns a BigFloat representing the Pi constant with <em>n</em> digits after the dot.
<em>n</em> is a positive integer.</p></dd>
<dt><a name="33"><b class="cmd">rad2deg</b> <i class="arg">radians</i></a></dt>
<dd></dd>
<dt><a name="34"><b class="cmd">deg2rad</b> <i class="arg">degrees</i></a></dt>
<dd><p><i class="arg">radians</i> - angle expressed in radians (BigFloat)</p>
<p><i class="arg">degrees</i> - angle expressed in degrees (BigFloat)</p>
<p>Convert an angle from radians to degrees, and <em>vice versa</em>.</p></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">ROUNDING</a></h2>
<dl class="definitions">
<dt><a name="35"><b class="cmd">round</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="36"><b class="cmd">ceil</b> <i class="arg">x</i></a></dt>
<dd></dd>
<dt><a name="37"><b class="cmd">floor</b> <i class="arg">x</i></a></dt>
<dd><p>The above functions return the <em>x</em> BigFloat,
rounded like with the same mathematical function in <em>expr</em>,
and returns it as an integer.</p></dd>
</dl>
</div>
<div id="section7" class="section"><h2><a name="section7">PRECISION</a></h2>
<p>How do conversions work with precision ?</p>
<ul class="itemized">
<li><p>When a BigFloat is converted from string, the internal representation
holds its uncertainty as 1 at the level of the last digit.</p></li>
<li><p>During computations, the uncertainty of each result
is internally computed the closest to the reality, thus saving the memory used.</p></li>
<li><p>When converting back to string, the digits that are printed
are not subject to uncertainty. However, some rounding is done, as not doing so
causes severe problems.</p></li>
</ul>
<p>Uncertainties are kept in the internal representation of the number ; 
it is recommended to use <b class="cmd">tostr</b> only for outputting data (on the screen or in a file),
and NEVER call <b class="cmd">fromstr</b> with the result of <b class="cmd">tostr</b>.
It is better to always keep operands in their internal representation.
Due to the internals of this library, the uncertainty interval may be slightly
wider than expected, but this should not cause false digits.</p>
<p>Now you may ask this question : What precision am I going to get
after calling add, sub, mul or div?
First you set a number from the string representation and,
by the way, its uncertainty is set:</p>
<pre class="example">
set a [fromstr 1.230]
# $a belongs to [1.229, 1.231]
set a [fromstr 1.000]
# $a belongs to [0.999, 1.001]
# $a has a relative uncertainty of 0.1% : 0.001(the uncertainty)/1.000(the medium value)
</pre>
<p>The uncertainty of the sum, or the difference, of two numbers, is the sum 
of their respective uncertainties.</p>
<pre class="example">
set a [fromstr 1.230]
set b [fromstr 2.340]
set sum [add $a $b]]
# the result is : [3.568, 3.572] (the last digit is known with an uncertainty of 2)
tostr $sum ; # 3.57
</pre>
<p>But when, for example, we add or substract an integer to a BigFloat, 
the relative uncertainty of the result is unchanged. So it is desirable 
not to convert integers to BigFloats:</p>
<pre class="example">
set a [fromstr 0.999999999]
# now something dangerous
set b [fromstr 2.000]
# the result has only 3 digits
tostr [add $a $b]
# how to keep precision at its maximum
puts [tostr [add $a 2]]
</pre>
<p>For multiplication and division, the relative uncertainties of the product
or the quotient, is the sum of the relative uncertainties of the operands.
Take care of division by zero : check each divider with <b class="cmd">iszero</b>.</p>
<pre class="example">
set num [fromstr 4.00]
set denom [fromstr 0.01]
puts [iszero $denom];# true
set quotient [div $num $denom];# error : divide by zero
# opposites of our operands
puts [compare $num [opp $num]]; # 1
puts [compare $denom [opp $denom]]; # 0 !!!
# No suprise ! 0 and its opposite are the same...
</pre>
<p>Effects of the precision of a number considered equal to zero
to the cos function:</p>
<pre class="example">
puts [tostr [cos [fromstr 0. 10]]]; # -&gt; 1.000000000
puts [tostr [cos [fromstr 0. 5]]]; # -&gt; 1.0000
puts [tostr [cos [fromstr 0e-10]]]; # -&gt; 1.000000000
puts [tostr [cos [fromstr 1e-10]]]; # -&gt; 1.000000000
</pre>
<p>BigFloats with different internal representations may be converted 
to the same string.</p>
<p>For most analysis functions (cosine, square root, logarithm, etc.), determining the precision
of the result is difficult.
It seems however that in many cases, the loss of precision in the result
is of one or two digits.
There are some exceptions : for example,</p>
<pre class="example">
tostr [exp [fromstr 100.0 10]]
# returns : 2.688117142e+43 which has only 10 digits of precision, although the entry
# has 14 digits of precision.
</pre>
</div>
<div id="section8" class="section"><h2><a name="section8">WHAT ABOUT TCL 8.4 ?</a></h2>
<p>If your setup do not provide Tcl 8.5 but supports 8.4, the package can still be loaded,
switching back to <em>math::bigfloat</em> 1.2. Indeed, an important function introduced in Tcl 8.5
is required - the ability to handle bignums, that we can do with <b class="cmd">expr</b>.
Before 8.5, this ability was provided by several packages,
including the pure-Tcl <em>math::bignum</em> package provided by <em>tcllib</em>.
In this case, all you need to know, is that arguments to the commands explained here,
are expected to be in their internal representation.
So even with integers, you will need to call <b class="cmd">fromstr</b>
and <b class="cmd">tostr</b> in order to convert them between string and internal representations.</p>
<pre class="example">
#
# with Tcl 8.5
# ============
set a [pi 20]
# round returns an integer and 'everything is a string' applies to integers
# whatever big they are
puts [round [mul $a 10000000000]]
#
# the same with Tcl 8.4
# =====================
set a [pi 20]
# bignums (arbitrary length integers) need a conversion hook
set b [fromstr 10000000000]
# round returns a bignum:
# before printing it, we need to convert it with 'tostr'
puts [tostr [round [mul $a $b]]]
</pre>
</div>
<div id="section9" class="section"><h2><a name="section9">NAMESPACES AND OTHER PACKAGES</a></h2>
<p>We have not yet discussed about namespaces
because we assumed that you had imported public commands into the global namespace,
like this:</p>
<pre class="example">
namespace import ::math::bigfloat::*
</pre>
<p>If you matter much about avoiding names conflicts,
I considere it should be resolved by the following :</p>
<pre class="example">
package require math::bigfloat
# beware: namespace ensembles are not available in Tcl 8.4 
namespace eval ::math::bigfloat {namespace ensemble create -command ::bigfloat}
# from now, the bigfloat command takes as subcommands all original math::bigfloat::* commands
set a [bigfloat sub [bigfloat fromstr 2.000] [bigfloat fromstr 0.530]]
puts [bigfloat tostr $a]
</pre>
</div>
<div id="section10" class="section"><h2><a name="section10">EXAMPLES</a></h2>
<p>Guess what happens when you are doing some astronomy. Here is an example :</p>
<pre class="example">
# convert acurrate angles with a millisecond-rated accuracy
proc degree-angle {degrees minutes seconds milliseconds} {
    set result 0
    set div 1
    foreach factor {1 1000 60 60} var [list $milliseconds $seconds $minutes $degrees] {
        # we convert each entry var into milliseconds
        set div [expr {$div*$factor}]
        incr result [expr {$var*$div}]
    }
    return [div [int2float $result] $div]
}
# load the package
package require math::bigfloat
namespace import ::math::bigfloat::*
# work with angles : a standard formula for navigation (taking bearings)
set angle1 [deg2rad [degree-angle 20 30 40   0]]
set angle2 [deg2rad [degree-angle 21  0 50 500]]
set opposite3 [deg2rad [degree-angle 51  0 50 500]]
set sinProduct [mul [sin $angle1] [sin $angle2]]
set cosProduct [mul [cos $angle1] [cos $angle2]]
set angle3 [asin [add [mul $sinProduct [cos $opposite3]] $cosProduct]]
puts &quot;angle3 : [tostr [rad2deg $angle3]]&quot;
</pre>
</div>
<div id="section11" class="section"><h2><a name="section11">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: bignum :: float</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key691">computations</a>, <a href="../../../../index.html#key347">floating-point</a>, <a href="../../../../index.html#key690">interval</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key245">multiprecision</a>, <a href="../../../../index.html#key246">tcl</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004-2008, by Stephane Arnold &lt;stephanearnold at yahoo dot fr&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/bignum.html.






























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::bignum - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/bignum.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Salvatore Sanfilippo &lt;antirez at invece dot org&gt;   -- Copyright &copy; 2004 Arjen Markus &lt;arjenmarkus at users dot sourceforge dot net&gt;
   -->
<! -- CVS: $Id$ math::bignum.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::bignum(n) 3.1 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::bignum - Arbitrary precision integer numbers</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">API</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.4?</span></b></li>
<li>package require <b class="pkgname">math::bignum <span class="opt">?3.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::bignum::fromstr</b> <i class="arg">string</i> ?<i class="arg">radix</i>?</a></li>
<li><a href="#2"><b class="cmd">::math::bignum::tostr</b> <i class="arg">bignum</i> ?<i class="arg">radix</i>?</a></li>
<li><a href="#3"><b class="cmd">::math::bignum::sign</b> <i class="arg">bignum</i></a></li>
<li><a href="#4"><b class="cmd">::math::bignum::abs</b> <i class="arg">bignum</i></a></li>
<li><a href="#5"><b class="cmd">::math::bignum::cmp</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#6"><b class="cmd">::math::bignum::iszero</b> <i class="arg">bignum</i></a></li>
<li><a href="#7"><b class="cmd">::math::bignum::lt</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#8"><b class="cmd">::math::bignum::le</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#9"><b class="cmd">::math::bignum::gt</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#10"><b class="cmd">::math::bignum::ge</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#11"><b class="cmd">::math::bignum::eq</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#12"><b class="cmd">::math::bignum::ne</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#13"><b class="cmd">::math::bignum::isodd</b> <i class="arg">bignum</i></a></li>
<li><a href="#14"><b class="cmd">::math::bignum::iseven</b> <i class="arg">bignum</i></a></li>
<li><a href="#15"><b class="cmd">::math::bignum::add</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#16"><b class="cmd">::math::bignum::sub</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#17"><b class="cmd">::math::bignum::mul</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#18"><b class="cmd">::math::bignum::divqr</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#19"><b class="cmd">::math::bignum::div</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#20"><b class="cmd">::math::bignum::rem</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#21"><b class="cmd">::math::bignum::mod</b> <i class="arg">n</i> <i class="arg">m</i></a></li>
<li><a href="#22"><b class="cmd">::math::bignum::pow</b> <i class="arg">base</i> <i class="arg">exp</i></a></li>
<li><a href="#23"><b class="cmd">::math::bignum::powm</b> <i class="arg">base</i> <i class="arg">exp</i> <i class="arg">m</i></a></li>
<li><a href="#24"><b class="cmd">::math::bignum::sqrt</b> <i class="arg">bignum</i></a></li>
<li><a href="#25"><b class="cmd">::math::bignum::rand</b> <i class="arg">bits</i></a></li>
<li><a href="#26"><b class="cmd">::math::bignum::lshift</b> <i class="arg">bignum</i> <i class="arg">bits</i></a></li>
<li><a href="#27"><b class="cmd">::math::bignum::rshift</b> <i class="arg">bignum</i> <i class="arg">bits</i></a></li>
<li><a href="#28"><b class="cmd">::math::bignum::bitand</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#29"><b class="cmd">::math::bignum::bitor</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#30"><b class="cmd">::math::bignum::bitxor</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#31"><b class="cmd">::math::bignum::setbit</b> <i class="arg">bignumVar</i> <i class="arg">bit</i></a></li>
<li><a href="#32"><b class="cmd">::math::bignum::clearbit</b> <i class="arg">bignumVar</i> <i class="arg">bit</i></a></li>
<li><a href="#33"><b class="cmd">::math::bignum::testbit</b> <i class="arg">bignum</i> <i class="arg">bit</i></a></li>
<li><a href="#34"><b class="cmd">::math::bignum::bits</b> <i class="arg">bignum</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The bignum package provides arbitrary precision integer math
(also known as &quot;big numbers&quot;) capabilities to the Tcl language.
Big numbers are internally represented at Tcl lists: this
package provides a set of procedures operating against
the internal representation in order to:</p>
<ul class="itemized">
<li><p>perform math operations</p></li>
<li><p>convert bignums from the internal representation to a string in
the desired radix and vice versa.</p></li>
</ul>
<p>But the two constants &quot;0&quot; and &quot;1&quot; are automatically converted to
the internal representation, in order to easily compare a number to zero,
or increment a big number.</p>
<p>The bignum interface is opaque, so
operations on bignums that are not returned by procedures
in this package (but created by hand) may lead to unspecified behaviours.
It's safe to treat bignums as pure values, so there is no need
to free a bignum, or to duplicate it via a special operation.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<p>This section shows some simple example. This library being just
a way to perform math operations, examples may be the simplest way
to learn how to work with it. Consult the API section of
this man page for information about individual procedures.</p>
<pre class="example">
    package require math::bignum
    # Multiplication of two bignums
    set a [::math::bignum::fromstr 88888881111111]
    set b [::math::bignum::fromstr 22222220000000]
    set c [::math::bignum::mul $a $b]
    puts [::math::bignum::tostr $c] ; # =&gt; will output 1975308271604953086420000000
    set c [::math::bignum::sqrt $c]
    puts [::math::bignum::tostr $c] ; # =&gt; will output 44444440277777
    # From/To string conversion in different radix
    set a [::math::bignum::fromstr 1100010101010111001001111010111 2]
    puts [::math::bignum::tostr $a 16] ; # =&gt; will output 62ab93d7
    # Factorial example
    proc fact n {
        # fromstr is not needed for 0 and 1
        set z 1
        for {set i 2} {$i &lt;= $n} {incr i} {
            set z [::math::bignum::mul $z [::math::bignum::fromstr $i]]
        }
        return $z
    }
    puts [::math::bignum::tostr [fact 100]]
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::bignum::fromstr</b> <i class="arg">string</i> ?<i class="arg">radix</i>?</a></dt>
<dd><p>Convert <em>string</em> into a bignum. If <em>radix</em> is omitted or zero,
the string is interpreted in hex if prefixed with
<em>0x</em>, in octal if prefixed with <em>ox</em>,
in binary if it's pefixed with <em>bx</em>, as a number in
radix 10 otherwise. If instead the <em>radix</em> argument
is specified in the range 2-36, the <em>string</em> is interpreted
in the given radix. Please note that this conversion is
not needed for two constants : <em>0</em> and <em>1</em>. (see the example)</p></dd>
<dt><a name="2"><b class="cmd">::math::bignum::tostr</b> <i class="arg">bignum</i> ?<i class="arg">radix</i>?</a></dt>
<dd><p>Convert <em>bignum</em> into a string representing the number
in the specified radix. If <em>radix</em> is omitted, the
default is 10.</p></dd>
<dt><a name="3"><b class="cmd">::math::bignum::sign</b> <i class="arg">bignum</i></a></dt>
<dd><p>Return the sign of the bignum.
The procedure returns 0 if the number is positive, 1 if it's negative.</p></dd>
<dt><a name="4"><b class="cmd">::math::bignum::abs</b> <i class="arg">bignum</i></a></dt>
<dd><p>Return the absolute value of the bignum.</p></dd>
<dt><a name="5"><b class="cmd">::math::bignum::cmp</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Compare the two bignums a and b, returning <em>0</em> if <em>a == b</em>,
<em>1</em> if <em>a &gt; b</em>, and <em>-1</em> if <em>a &lt; b</em>.</p></dd>
<dt><a name="6"><b class="cmd">::math::bignum::iszero</b> <i class="arg">bignum</i></a></dt>
<dd><p>Return true if <em>bignum</em> value is zero, otherwise false is returned.</p></dd>
<dt><a name="7"><b class="cmd">::math::bignum::lt</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return true if <em>a &lt; b</em>, otherwise false is returned.</p></dd>
<dt><a name="8"><b class="cmd">::math::bignum::le</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return true if <em>a &lt;= b</em>, otherwise false is returned.</p></dd>
<dt><a name="9"><b class="cmd">::math::bignum::gt</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return true if <em>a &gt; b</em>, otherwise false is returned.</p></dd>
<dt><a name="10"><b class="cmd">::math::bignum::ge</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return true if <em>a &gt;= b</em>, otherwise false is returned.</p></dd>
<dt><a name="11"><b class="cmd">::math::bignum::eq</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return true if <em>a == b</em>, otherwise false is returned.</p></dd>
<dt><a name="12"><b class="cmd">::math::bignum::ne</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return true if <em>a != b</em>, otherwise false is returned.</p></dd>
<dt><a name="13"><b class="cmd">::math::bignum::isodd</b> <i class="arg">bignum</i></a></dt>
<dd><p>Return true if <em>bignum</em> is odd.</p></dd>
<dt><a name="14"><b class="cmd">::math::bignum::iseven</b> <i class="arg">bignum</i></a></dt>
<dd><p>Return true if <em>bignum</em> is even.</p></dd>
<dt><a name="15"><b class="cmd">::math::bignum::add</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the sum of the two bignums <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="16"><b class="cmd">::math::bignum::sub</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the difference of the two bignums <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="17"><b class="cmd">::math::bignum::mul</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the product of the two bignums <em>a</em> and <em>b</em>.
The implementation uses Karatsuba multiplication if both
the numbers are bigger than a given threshold, otherwise
the direct algorith is used.</p></dd>
<dt><a name="18"><b class="cmd">::math::bignum::divqr</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return a two-elements list containing as first element
the quotient of the division between the two bignums
<em>a</em> and <em>b</em>, and the remainder of the division as second element.</p></dd>
<dt><a name="19"><b class="cmd">::math::bignum::div</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the quotient of the division between the two
bignums <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="20"><b class="cmd">::math::bignum::rem</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the remainder of the division between the two
bignums <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="21"><b class="cmd">::math::bignum::mod</b> <i class="arg">n</i> <i class="arg">m</i></a></dt>
<dd><p>Return <em>n</em> modulo <em>m</em>. This operation is
called modular reduction.</p></dd>
<dt><a name="22"><b class="cmd">::math::bignum::pow</b> <i class="arg">base</i> <i class="arg">exp</i></a></dt>
<dd><p>Return <em>base</em> raised to the exponent <em>exp</em>.</p></dd>
<dt><a name="23"><b class="cmd">::math::bignum::powm</b> <i class="arg">base</i> <i class="arg">exp</i> <i class="arg">m</i></a></dt>
<dd><p>Return <em>base</em> raised to the exponent <em>exp</em>,
modulo <em>m</em>. This function is often used in the field
of cryptography.</p></dd>
<dt><a name="24"><b class="cmd">::math::bignum::sqrt</b> <i class="arg">bignum</i></a></dt>
<dd><p>Return the integer part of the square root of <em>bignum</em></p></dd>
<dt><a name="25"><b class="cmd">::math::bignum::rand</b> <i class="arg">bits</i></a></dt>
<dd><p>Return a random number of at most <em>bits</em> bits.
The returned number is internally generated using Tcl's <em>expr rand()</em>
function and is not suitable where an unguessable and cryptographically
secure random number is needed.</p></dd>
<dt><a name="26"><b class="cmd">::math::bignum::lshift</b> <i class="arg">bignum</i> <i class="arg">bits</i></a></dt>
<dd><p>Return the result of left shifting <em>bignum</em>'s binary
representation of <em>bits</em> positions on the left.
This is equivalent to multiplying by 2^<em>bits</em> but much faster.</p></dd>
<dt><a name="27"><b class="cmd">::math::bignum::rshift</b> <i class="arg">bignum</i> <i class="arg">bits</i></a></dt>
<dd><p>Return the result of right shifting <em>bignum</em>'s binary
representation of <em>bits</em> positions on the right.
This is equivalent to dividing by <em>2^bits</em> but much faster.</p></dd>
<dt><a name="28"><b class="cmd">::math::bignum::bitand</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the result of doing a bitwise AND operation on a
and b. The operation is restricted to positive numbers,
including zero. When negative numbers are provided as
arguments the result is undefined.</p></dd>
<dt><a name="29"><b class="cmd">::math::bignum::bitor</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the result of doing a bitwise OR operation on a
and b. The operation is restricted to positive numbers,
including zero. When negative numbers are provided as
arguments the result is undefined.</p></dd>
<dt><a name="30"><b class="cmd">::math::bignum::bitxor</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the result of doing a bitwise XOR operation on a
and b. The operation is restricted to positive numbers,
including zero. When negative numbers are provided as
arguments the result is undefined.</p></dd>
<dt><a name="31"><b class="cmd">::math::bignum::setbit</b> <i class="arg">bignumVar</i> <i class="arg">bit</i></a></dt>
<dd><p>Set the bit at <em>bit</em> position to 1 in the bignum stored
in the variable <em>bignumVar</em>. Bit 0 is the least significant.</p></dd>
<dt><a name="32"><b class="cmd">::math::bignum::clearbit</b> <i class="arg">bignumVar</i> <i class="arg">bit</i></a></dt>
<dd><p>Set the bit at <em>bit</em> position to 0 in the bignum stored
in the variable <em>bignumVar</em>. Bit 0 is the least significant.</p></dd>
<dt><a name="33"><b class="cmd">::math::bignum::testbit</b> <i class="arg">bignum</i> <i class="arg">bit</i></a></dt>
<dd><p>Return true if the bit at the <em>bit</em> position of <em>bignum</em>
is on, otherwise false is returned. If <em>bit</em> is out of
range, it is considered as set to zero.</p></dd>
<dt><a name="34"><b class="cmd">::math::bignum::bits</b> <i class="arg">bignum</i></a></dt>
<dd><p>Return the number of bits needed to represent bignum in radix 2.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: bignum</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key244">bignums</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key245">multiprecision</a>, <a href="../../../../index.html#key246">tcl</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Salvatore Sanfilippo &lt;antirez at invece dot org&gt;<br>
Copyright &copy; 2004 Arjen Markus &lt;arjenmarkus at users dot sourceforge dot net&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/calculus.html.



























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math::calculus - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/calculus.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002,2003,2004 Arjen Markus
   -->
<! -- CVS: $Id$ math::calculus.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::calculus(n) 0.7.1 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::calculus - Integration and ordinary differential equations</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">math::calculus 0.7.1</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::calculus::integral</b> <i class="arg">begin</i> <i class="arg">end</i> <i class="arg">nosteps</i> <i class="arg">func</i></a></li>
<li><a href="#2"><b class="cmd">::math::calculus::integralExpr</b> <i class="arg">begin</i> <i class="arg">end</i> <i class="arg">nosteps</i> <i class="arg">expression</i></a></li>
<li><a href="#3"><b class="cmd">::math::calculus::integral2D</b> <i class="arg">xinterval</i> <i class="arg">yinterval</i> <i class="arg">func</i></a></li>
<li><a href="#4"><b class="cmd">::math::calculus::integral2D_accurate</b> <i class="arg">xinterval</i> <i class="arg">yinterval</i> <i class="arg">func</i></a></li>
<li><a href="#5"><b class="cmd">::math::calculus::integral3D</b> <i class="arg">xinterval</i> <i class="arg">yinterval</i> <i class="arg">zinterval</i> <i class="arg">func</i></a></li>
<li><a href="#6"><b class="cmd">::math::calculus::integral3D_accurate</b> <i class="arg">xinterval</i> <i class="arg">yinterval</i> <i class="arg">zinterval</i> <i class="arg">func</i></a></li>
<li><a href="#7"><b class="cmd">::math::calculus::eulerStep</b> <i class="arg">t</i> <i class="arg">tstep</i> <i class="arg">xvec</i> <i class="arg">func</i></a></li>
<li><a href="#8"><b class="cmd">::math::calculus::heunStep</b> <i class="arg">t</i> <i class="arg">tstep</i> <i class="arg">xvec</i> <i class="arg">func</i></a></li>
<li><a href="#9"><b class="cmd">::math::calculus::rungeKuttaStep</b> <i class="arg">t</i> <i class="arg">tstep</i> <i class="arg">xvec</i> <i class="arg">func</i></a></li>
<li><a href="#10"><b class="cmd">::math::calculus::boundaryValueSecondOrder</b> <i class="arg">coeff_func</i> <i class="arg">force_func</i> <i class="arg">leftbnd</i> <i class="arg">rightbnd</i> <i class="arg">nostep</i></a></li>
<li><a href="#11"><b class="cmd">::math::calculus::solveTriDiagonal</b> <i class="arg">acoeff</i> <i class="arg">bcoeff</i> <i class="arg">ccoeff</i> <i class="arg">dvalue</i></a></li>
<li><a href="#12"><b class="cmd">::math::calculus::newtonRaphson</b> <i class="arg">func</i> <i class="arg">deriv</i> <i class="arg">initval</i></a></li>
<li><a href="#13"><b class="cmd">::math::calculus::newtonRaphsonParameters</b> <i class="arg">maxiter</i> <i class="arg">tolerance</i></a></li>
<li><a href="#14"><b class="cmd">::math::calculus::regula_falsi</b> <i class="arg">f</i> <i class="arg">xb</i> <i class="arg">xe</i> <i class="arg">eps</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements several simple mathematical algorithms:</p>
<ul class="itemized">
<li><p>The integration of a function over an interval</p></li>
<li><p>The numerical integration of a system of ordinary differential
equations.</p></li>
<li><p>Estimating the root(s) of an equation of one variable.</p></li>
</ul>
<p>The package is fully implemented in Tcl. No particular attention has
been paid to the accuracy of the calculations. Instead, well-known
algorithms have been used in a straightforward manner.</p>
<p>This document describes the procedures and explains their usage.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>This package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::calculus::integral</b> <i class="arg">begin</i> <i class="arg">end</i> <i class="arg">nosteps</i> <i class="arg">func</i></a></dt>
<dd><p>Determine the integral of the given function using the Simpson
rule. The interval for the integration is [<i class="arg">begin</i>, <i class="arg">end</i>].
The remaining arguments are:</p>
<dl class="definitions">
<dt><i class="arg">nosteps</i></dt>
<dd><p>Number of steps in which the interval is divided.</p></dd>
<dt><i class="arg">func</i></dt>
<dd><p>Function to be integrated. It should take one single argument.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::calculus::integralExpr</b> <i class="arg">begin</i> <i class="arg">end</i> <i class="arg">nosteps</i> <i class="arg">expression</i></a></dt>
<dd><p>Similar to the previous proc, this one determines the integral of
the given <i class="arg">expression</i> using the Simpson rule.
The interval for the integration is [<i class="arg">begin</i>, <i class="arg">end</i>].
The remaining arguments are:</p>
<dl class="definitions">
<dt><i class="arg">nosteps</i></dt>
<dd><p>Number of steps in which the interval is divided.</p></dd>
<dt><i class="arg">expression</i></dt>
<dd><p>Expression to be integrated. It should
use the variable &quot;x&quot; as the only variable (the &quot;integrate&quot;)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::calculus::integral2D</b> <i class="arg">xinterval</i> <i class="arg">yinterval</i> <i class="arg">func</i></a></dt>
<dd></dd>
<dt><a name="4"><b class="cmd">::math::calculus::integral2D_accurate</b> <i class="arg">xinterval</i> <i class="arg">yinterval</i> <i class="arg">func</i></a></dt>
<dd><p>The commands <b class="cmd">integral2D</b> and <b class="cmd">integral2D_accurate</b> calculate the
integral of a function of two variables over the rectangle given by the
first two arguments, each a list of three items, the start and
stop interval for the variable and the number of steps.</p>
<p>The command <b class="cmd">integral2D</b> evaluates the function at the centre of
each rectangle, whereas the command <b class="cmd">integral2D_accurate</b> uses a
four-point quadrature formula. This results in an exact integration of
polynomials of third degree or less.</p>
<p>The function must take two arguments and return the function
value.</p></dd>
<dt><a name="5"><b class="cmd">::math::calculus::integral3D</b> <i class="arg">xinterval</i> <i class="arg">yinterval</i> <i class="arg">zinterval</i> <i class="arg">func</i></a></dt>
<dd></dd>
<dt><a name="6"><b class="cmd">::math::calculus::integral3D_accurate</b> <i class="arg">xinterval</i> <i class="arg">yinterval</i> <i class="arg">zinterval</i> <i class="arg">func</i></a></dt>
<dd><p>The commands <b class="cmd">integral3D</b> and <b class="cmd">integral3D_accurate</b> are the
three-dimensional equivalent of <b class="cmd">integral2D</b> and <b class="cmd">integral3D_accurate</b>.
The function <em>func</em> takes three arguments and is integrated over the block in
3D space given by three intervals.</p></dd>
<dt><a name="7"><b class="cmd">::math::calculus::eulerStep</b> <i class="arg">t</i> <i class="arg">tstep</i> <i class="arg">xvec</i> <i class="arg">func</i></a></dt>
<dd><p>Set a single step in the numerical integration of a system of
differential equations. The method used is Euler's.</p>
<dl class="definitions">
<dt><i class="arg">t</i></dt>
<dd><p>Value of the independent variable (typically time)
at the beginning of the step.</p></dd>
<dt><i class="arg">tstep</i></dt>
<dd><p>Step size for the independent variable.</p></dd>
<dt><i class="arg">xvec</i></dt>
<dd><p>List (vector) of dependent values</p></dd>
<dt><i class="arg">func</i></dt>
<dd><p>Function of t and the dependent values, returning
a list of the derivatives of the dependent values. (The lengths of
xvec and the return value of &quot;func&quot; must match).</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::math::calculus::heunStep</b> <i class="arg">t</i> <i class="arg">tstep</i> <i class="arg">xvec</i> <i class="arg">func</i></a></dt>
<dd><p>Set a single step in the numerical integration of a system of
differential equations. The method used is Heun's.</p>
<dl class="definitions">
<dt><i class="arg">t</i></dt>
<dd><p>Value of the independent variable (typically time)
at the beginning of the step.</p></dd>
<dt><i class="arg">tstep</i></dt>
<dd><p>Step size for the independent variable.</p></dd>
<dt><i class="arg">xvec</i></dt>
<dd><p>List (vector) of dependent values</p></dd>
<dt><i class="arg">func</i></dt>
<dd><p>Function of t and the dependent values, returning
a list of the derivatives of the dependent values. (The lengths of
xvec and the return value of &quot;func&quot; must match).</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::math::calculus::rungeKuttaStep</b> <i class="arg">t</i> <i class="arg">tstep</i> <i class="arg">xvec</i> <i class="arg">func</i></a></dt>
<dd><p>Set a single step in the numerical integration of a system of
differential equations. The method used is Runge-Kutta 4th
order.</p>
<dl class="definitions">
<dt><i class="arg">t</i></dt>
<dd><p>Value of the independent variable (typically time)
at the beginning of the step.</p></dd>
<dt><i class="arg">tstep</i></dt>
<dd><p>Step size for the independent variable.</p></dd>
<dt><i class="arg">xvec</i></dt>
<dd><p>List (vector) of dependent values</p></dd>
<dt><i class="arg">func</i></dt>
<dd><p>Function of t and the dependent values, returning
a list of the derivatives of the dependent values. (The lengths of
xvec and the return value of &quot;func&quot; must match).</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::math::calculus::boundaryValueSecondOrder</b> <i class="arg">coeff_func</i> <i class="arg">force_func</i> <i class="arg">leftbnd</i> <i class="arg">rightbnd</i> <i class="arg">nostep</i></a></dt>
<dd><p>Solve a second order linear differential equation with boundary
values at two sides. The equation has to be of the form (the
&quot;conservative&quot; form):</p>
<pre class="example">
         d      dy     d
         -- A(x)--  +  -- B(x)y + C(x)y  =  D(x)
         dx     dx     dx
</pre>
<p>Ordinarily, such an equation would be written as:</p>
<pre class="example">
             d2y        dy
         a(x)---  + b(x)-- + c(x) y  =  D(x)
             dx2        dx
</pre>
<p>The first form is easier to discretise (by integrating over a
finite volume) than the second form. The relation between the two
forms is fairly straightforward:</p>
<pre class="example">
         A(x)  =  a(x)
         B(x)  =  b(x) - a'(x)
         C(x)  =  c(x) - B'(x)  =  c(x) - b'(x) + a''(x)
</pre>
<p>Because of the differentiation, however, it is much easier to ask
the user to provide the functions A, B and C directly.</p>
<dl class="definitions">
<dt><i class="arg">coeff_func</i></dt>
<dd><p>Procedure returning the three coefficients
(A, B, C) of the equation, taking as its one argument the x-coordinate.</p></dd>
<dt><i class="arg">force_func</i></dt>
<dd><p>Procedure returning the right-hand side
(D) as a function of the x-coordinate.</p></dd>
<dt><i class="arg">leftbnd</i></dt>
<dd><p>A list of two values: the x-coordinate of the
left boundary and the value at that boundary.</p></dd>
<dt><i class="arg">rightbnd</i></dt>
<dd><p>A list of two values: the x-coordinate of the
right boundary and the value at that boundary.</p></dd>
<dt><i class="arg">nostep</i></dt>
<dd><p>Number of steps by which to discretise the
interval.
The procedure returns a list of x-coordinates and the approximated
values of the solution.</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::math::calculus::solveTriDiagonal</b> <i class="arg">acoeff</i> <i class="arg">bcoeff</i> <i class="arg">ccoeff</i> <i class="arg">dvalue</i></a></dt>
<dd><p>Solve a system of linear equations Ax = b with A a tridiagonal
matrix. Returns the solution as a list.</p>
<dl class="definitions">
<dt><i class="arg">acoeff</i></dt>
<dd><p>List of values on the lower diagonal</p></dd>
<dt><i class="arg">bcoeff</i></dt>
<dd><p>List of values on the main diagonal</p></dd>
<dt><i class="arg">ccoeff</i></dt>
<dd><p>List of values on the upper diagonal</p></dd>
<dt><i class="arg">dvalue</i></dt>
<dd><p>List of values on the righthand-side</p></dd>
</dl></dd>
<dt><a name="12"><b class="cmd">::math::calculus::newtonRaphson</b> <i class="arg">func</i> <i class="arg">deriv</i> <i class="arg">initval</i></a></dt>
<dd><p>Determine the root of an equation given by</p>
<pre class="example">
    func(x) = 0
</pre>
<p>using the method of Newton-Raphson. The procedure takes the following
arguments:</p>
<dl class="definitions">
<dt><i class="arg">func</i></dt>
<dd><p>Procedure that returns the value the function at x</p></dd>
<dt><i class="arg">deriv</i></dt>
<dd><p>Procedure that returns the derivative of the function at x</p></dd>
<dt><i class="arg">initval</i></dt>
<dd><p>Initial value for x</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::math::calculus::newtonRaphsonParameters</b> <i class="arg">maxiter</i> <i class="arg">tolerance</i></a></dt>
<dd><p>Set the numerical parameters for the Newton-Raphson method:</p>
<dl class="definitions">
<dt><i class="arg">maxiter</i></dt>
<dd><p>Maximum number of iteration steps (defaults to 20)</p></dd>
<dt><i class="arg">tolerance</i></dt>
<dd><p>Relative precision (defaults to 0.001)</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">::math::calculus::regula_falsi</b> <i class="arg">f</i> <i class="arg">xb</i> <i class="arg">xe</i> <i class="arg">eps</i></a></dt>
<dd><p>Return an estimate of the zero or one of the zeros of the function
contained in the interval [xb,xe]. The error in this estimate is of the
order of eps*abs(xe-xb), the actual error may be slightly larger.</p>
<p>The method used is the so-called <em>regula falsi</em> or
<em>false position</em> method. It is a straightforward implementation.
The method is robust, but requires that the interval brackets a zero or
at least an uneven number of zeros, so that the value of the function at
the start has a different sign than the value at the end.</p>
<p>In contrast to Newton-Raphson there is no need for the computation of
the function's derivative.</p>
<dl class="arguments">
<dt>command <i class="arg">f</i></dt>
<dd><p>Name of the command that evaluates the function for
which the zero is to be returned</p></dd>
<dt>float <i class="arg">xb</i></dt>
<dd><p>Start of the interval in which the zero is supposed
to lie</p></dd>
<dt>float <i class="arg">xe</i></dt>
<dd><p>End of the interval</p></dd>
<dt>float <i class="arg">eps</i></dt>
<dd><p>Relative allowed error (defaults to 1.0e-4)</p></dd>
</dl></dd>
</dl>
<p><em>Notes:</em></p>
<p>Several of the above procedures take the <em>names</em> of procedures as
arguments. To avoid problems with the <em>visibility</em> of these
procedures, the fully-qualified name of these procedures is determined
inside the calculus routines. For the user this has only one
consequence: the named procedure must be visible in the calling
procedure. For instance:</p>
<pre class="example">
    namespace eval ::mySpace {
       namespace export calcfunc
       proc calcfunc { x } { return $x }
    }
    #
    # Use a fully-qualified name
    #
    namespace eval ::myCalc {
       proc detIntegral { begin end } {
          return [integral $begin $end 100 ::mySpace::calcfunc]
       }
    }
    #
    # Import the name
    #
    namespace eval ::myCalc {
       namespace import ::mySpace::calcfunc
       proc detIntegral { begin end } {
          return [integral $begin $end 100 calcfunc]
       }
    }
</pre>
<p>Enhancements for the second-order boundary value problem:</p>
<ul class="itemized">
<li><p>Other types of boundary conditions (zero gradient, zero flux)</p></li>
<li><p>Other schematisation of the first-order term (now central
differences are used, but upstream differences might be useful too).</p></li>
</ul>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p>Let us take a few simple examples:</p>
<p>Integrate x over the interval [0,100] (20 steps):</p>
<pre class="example">
proc linear_func { x } { return $x }
puts &quot;Integral: [::math::calculus::integral 0 100 20 linear_func]&quot;
</pre>
<p>For simple functions, the alternative could be:</p>
<pre class="example">
puts &quot;Integral: [::math::calculus::integralExpr 0 100 20 {$x}]&quot;
</pre>
<p>Do not forget the braces!</p>
<p>The differential equation for a dampened oscillator:</p>
<pre class="example">
x'' + rx' + wx = 0
</pre>
<p>can be split into a system of first-order equations:</p>
<pre class="example">
x' = y
y' = -ry - wx
</pre>
<p>Then this system can be solved with code like this:</p>
<pre class="example">
proc dampened_oscillator { t xvec } {
   set x  [lindex $xvec 0]
   set x1 [lindex $xvec 1]
   return [list $x1 [expr {-$x1-$x}]]
}
set xvec   { 1.0 0.0 }
set t      0.0
set tstep  0.1
for { set i 0 } { $i &lt; 20 } { incr i } {
   set result [::math::calculus::eulerStep $t $tstep $xvec dampened_oscillator]
   puts &quot;Result ($t): $result&quot;
   set t      [expr {$t+$tstep}]
   set xvec   $result
}
</pre>
<p>Suppose we have the boundary value problem:</p>
<pre class="example">
    Dy'' + ky = 0
    x = 0: y = 1
    x = L: y = 0
</pre>
<p>This boundary value problem could originate from the diffusion of a
decaying substance.</p>
<p>It can be solved with the following fragment:</p>
<pre class="example">
   proc coeffs { x } { return [list $::Diff 0.0 $::decay] }
   proc force  { x } { return 0.0 }
   set Diff   1.0e-2
   set decay  0.0001
   set length 100.0
   set y [::math::calculus::boundaryValueSecondOrder \
      coeffs force {0.0 1.0} [list $length 0.0] 100]
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: calculus</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>romberg</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key722">calculus</a>, <a href="../../../../index.html#key723">differential equations</a>, <a href="../../../../index.html#key721">integration</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key724">roots</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002,2003,2004 Arjen Markus</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/combinatorics.html.










































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::combinatorics - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/combinatorics.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ math::combinatorics.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::combinatorics(n) 1.2.3 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::combinatorics - Combinatorial functions in the Tcl Math Library</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">math <span class="opt">?1.2.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::ln_Gamma</b> <i class="arg">z</i></a></li>
<li><a href="#2"><b class="cmd">::math::factorial</b> <i class="arg">x</i></a></li>
<li><a href="#3"><b class="cmd">::math::choose</b> <i class="arg">n k</i></a></li>
<li><a href="#4"><b class="cmd">::math::Beta</b> <i class="arg">z w</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package"><a href="math.html">math</a></b> package contains implementations of several
functions useful in combinatorial problems.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::ln_Gamma</b> <i class="arg">z</i></a></dt>
<dd><p>Returns the natural logarithm of the Gamma function for the argument
<i class="arg">z</i>.</p>
<p>The Gamma function is defined as the improper integral from zero to
positive infinity of</p>
<pre class="example">
  t**(x-1)*exp(-t) dt
</pre>
<p>The approximation used in the Tcl Math Library is from Lanczos,
<em>ISIAM J. Numerical Analysis, series B,</em> volume 1, p. 86.
For &quot;<b class="variable">x</b> &gt; 1&quot;, the absolute error of the result is claimed to be
smaller than 5.5*10**-10 -- that is, the resulting value of Gamma when</p>
<pre class="example">
  exp( ln_Gamma( x) ) 
</pre>
<p>is computed is expected to be precise to better than nine significant
figures.</p></dd>
<dt><a name="2"><b class="cmd">::math::factorial</b> <i class="arg">x</i></a></dt>
<dd><p>Returns the factorial of the argument <i class="arg">x</i>.</p>
<p>For integer <i class="arg">x</i>, 0 &lt;= <i class="arg">x</i> &lt;= 12, an exact integer result is
returned.</p>
<p>For integer <i class="arg">x</i>, 13 &lt;= <i class="arg">x</i> &lt;= 21, an exact floating-point
result is returned on machines with IEEE floating point.</p>
<p>For integer <i class="arg">x</i>, 22 &lt;= <i class="arg">x</i> &lt;= 170, the result is exact to 1
ULP.</p>
<p>For real <i class="arg">x</i>, <i class="arg">x</i> &gt;= 0, the result is approximated by
computing <i class="term">Gamma(x+1)</i> using the <b class="cmd">::math::ln_Gamma</b>
function, and the result is expected to be precise to better than nine
significant figures.</p>
<p>It is an error to present <i class="arg">x</i> &lt;= -1 or <i class="arg">x</i> &gt; 170, or a value
of <i class="arg">x</i> that is not numeric.</p></dd>
<dt><a name="3"><b class="cmd">::math::choose</b> <i class="arg">n k</i></a></dt>
<dd><p>Returns the binomial coefficient <i class="term">C(n, k)</i></p>
<pre class="example">
   C(n,k) = n! / k! (n-k)!
</pre>
<p>If both parameters are integers and the result fits in 32 bits, the
result is rounded to an integer.</p>
<p>Integer results are exact up to at least <i class="arg">n</i> = 34.  Floating point
results are precise to better than nine significant figures.</p></dd>
<dt><a name="4"><b class="cmd">::math::Beta</b> <i class="arg">z w</i></a></dt>
<dd><p>Returns the Beta function of the parameters <i class="arg">z</i> and <i class="arg">w</i>.</p>
<pre class="example">
   Beta(z,w) = Beta(w,z) = Gamma(z) * Gamma(w) / Gamma(z+w)
</pre>
<p>Results are returned as a floating point number precise to better than
nine significant digits provided that <i class="arg">w</i> and <i class="arg">z</i> are both at
least 1.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/constants.html.





















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::constants - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/constants.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::constants.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::constants(n) 1.0.1 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::constants - Mathematical and numerical constants</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.3?</span></b></li>
<li>package require <b class="pkgname">math::constants <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::constants::constants</b> <i class="arg">args</i></a></li>
<li><a href="#2"><b class="cmd">::math::constants::print-constants</b> <i class="arg">args</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package defines some common mathematical and numerical constants.
By using the package you get consistent values for numbers like pi and
ln(10).</p>
<p>It defines two commands:</p>
<ul class="itemized">
<li><p>One for importing the constants</p></li>
<li><p>One for reporting which constants are defined and what values they
actually have.</p></li>
</ul>
<p>The motivation for this package is that quite often, with
(mathematical) computations, you need a good approximation to, say,
the ratio of degrees to radians. You can, of course, define this
like:</p>
<pre class="example">
    variable radtodeg [expr {180.0/(4.0*atan(1.0))}]
</pre>
<p>and use the variable radtodeg whenever you need the conversion.</p>
<p>This has two drawbacks:</p>
<ul class="itemized">
<li><p>You need to remember the proper formula or value and that is
error-prone.</p></li>
<li><p>Especially with the use of mathematical functions like <em>atan</em>
you assume that they have been accurately implemented. This is seldom or
never the case and for each platform you can get subtle differences.</p></li>
</ul>
<p>Here is the way you can do it with the <em>math::constants</em> package:</p>
<pre class="example">
    package require math::constants
    ::math::constants::constants radtodeg degtorad
</pre>
<p>which creates two variables, radtodeg and (its reciprocal) degtorad
in the calling namespace.</p>
<p>Constants that have been defined (their values are mostly taken
from mathematical tables with more precision than usually can be
handled) include:</p>
<ul class="itemized">
<li><p>basic constants like pi, e, gamma (Euler's constant)</p></li>
<li><p>derived values like ln(10) and sqrt(2)</p></li>
<li><p>purely numerical values such as 1/3 that are included for convenience
and for the fact that certain seemingly trivial computations like:</p>
<pre class="example">
    set value [expr {3.0*$onethird}]
</pre>
<p>give <em>exactly</em> the value you expect (if IEEE arithmetic is
available).</p></li>
</ul>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::constants::constants</b> <i class="arg">args</i></a></dt>
<dd><p>Import the constants whose names are given as arguments</p></dd>
<dt><a name="2"><b class="cmd">::math::constants::print-constants</b> <i class="arg">args</i></a></dt>
<dd><p>Print the constants whose names are given as arguments on the screen
(name, value and description) or, if no arguments are given, print all
defined constants. This is mainly a convenience procedure.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: constants</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key560">constants</a>, <a href="../../../../index.html#key746">degrees</a>, <a href="../../../../index.html#key744">e</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key745">pi</a>, <a href="../../../../index.html#key561">radians</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/decimal.html.






































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::decimal - Tcl Decimal Arithmetic Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/decimal.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2011 Mark Alston &lt;mark at beernut dot com&gt;
   -->
<! -- CVS: $Id$ math::decimal.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::decimal(n) 1.0.2 tcllib &quot;Tcl Decimal Arithmetic Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::decimal - General decimal arithmetic</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">API</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::decimal::fromstr</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::math::decimal::tostr</b> <i class="arg">decimal</i></a></li>
<li><a href="#3"><b class="cmd">::math::decimal::setVariable</b> <i class="arg">variable</i> <i class="arg">setting</i></a></li>
<li><a href="#4"><b class="cmd">::math::decimal::add</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#5"><b class="cmd">::math::decimal::+</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#6"><b class="cmd">::math::decimal::subtract</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#7"><b class="cmd">::math::decimal::-</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#8"><b class="cmd">::math::decimal::multiply</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#9"><b class="cmd">::math::decimal::*</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#10"><b class="cmd">::math::decimal::divide</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#11"><b class="cmd">::math::decimal::/</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#12"><b class="cmd">::math::decimal::divideint</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#13"><b class="cmd">::math::decimal::remainder</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#14"><b class="cmd">::math::decimal::abs</b> <i class="arg">decimal</i></a></li>
<li><a href="#15"><b class="cmd">::math::decimal::compare</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#16"><b class="cmd">::math::decimal::max</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#17"><b class="cmd">::math::decimal::maxmag</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#18"><b class="cmd">::math::decimal::min</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#19"><b class="cmd">::math::decimal::minmag</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#20"><b class="cmd">::math::decimal::plus</b> <i class="arg">a</i></a></li>
<li><a href="#21"><b class="cmd">::math::decimal::minus</b> <i class="arg">a</i></a></li>
<li><a href="#22"><b class="cmd">::math::decimal::copynegate</b> <i class="arg">a</i></a></li>
<li><a href="#23"><b class="cmd">::math::decimal::copysign</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#24"><b class="cmd">::math::decimal::is-signed</b> <i class="arg">decimal</i></a></li>
<li><a href="#25"><b class="cmd">::math::decimal::is-zero</b> <i class="arg">decimal</i></a></li>
<li><a href="#26"><b class="cmd">::math::decimal::is-NaN</b> <i class="arg">decimal</i></a></li>
<li><a href="#27"><b class="cmd">::math::decimal::is-infinite</b> <i class="arg">decimal</i></a></li>
<li><a href="#28"><b class="cmd">::math::decimal::is-finite</b> <i class="arg">decimal</i></a></li>
<li><a href="#29"><b class="cmd">::math::decimal::fma</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i></a></li>
<li><a href="#30"><b class="cmd">::math::decimal::round_half_even</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></li>
<li><a href="#31"><b class="cmd">::math::decimal::round_half_up</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></li>
<li><a href="#32"><b class="cmd">::math::decimal::round_half_down</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></li>
<li><a href="#33"><b class="cmd">::math::decimal::round_down</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></li>
<li><a href="#34"><b class="cmd">::math::decimal::round_up</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></li>
<li><a href="#35"><b class="cmd">::math::decimal::round_floor</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></li>
<li><a href="#36"><b class="cmd">::math::decimal::round_ceiling</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></li>
<li><a href="#37"><b class="cmd">::math::decimal::round_05up</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The decimal package provides decimal arithmetic support for both limited
precision floating point and arbitrary precision floating point.
Additionally, integer arithmetic is supported.</p>
<p>More information and the specifications on which this package depends can be
found on the general decimal arithmetic page at http://speleotrove.com/decimal
This package provides for:</p>
<ul class="itemized">
<li><p>A new data type decimal which is represented as a list containing sign,
mantissa and exponent.</p></li>
<li><p>Arithmetic operations on those decimal numbers such as addition, subtraction,
multiplication, etc...</p></li>
</ul>
<p>Numbers are converted to decimal format using the operation ::math::decimal::fromstr.</p>
<p>Numbers are converted back to string format using the operation
::math::decimal::tostr.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<p>This section shows some simple examples. Since the purpose of this library
is to perform decimal math operations, examples may be the simplest way
to learn how to work with it and to see the difference between using this
package and sticking with expr. Consult the API section of
this man page for information about individual procedures.</p>
<pre class="example">
    package require decimal
    # Various operations on two numbers.
    # We first convert them to decimal format.
    set a [::math::decimal::fromstr 8.2]
    set b [::math::decimal::fromstr .2]
    # Then we perform our operations. Here we multiply
    set c [::math::decimal::* $a $b]
    # Finally we convert back to string format for presentation to the user.
    puts [::math::decimal::tostr $c] ; # =&gt; will output 8.4
    # Other examples
    #
    # Subtraction
    set c [::math::decimal::- $a $b]
    puts [::math::decimal::tostr $c] ; # =&gt; will output 8.0
    # Why bother using this instead of simply expr?
    puts 8.399999999999999 ; # =&gt; will output 8.399999999999999
    puts 7.999999999999999 ; # =&gt; will output 7.999999999999999
    # See http://speleotrove.com/decimal to learn more about why this happens.
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::decimal::fromstr</b> <i class="arg">string</i></a></dt>
<dd><p>Convert <em>string</em> into a decimal.</p></dd>
<dt><a name="2"><b class="cmd">::math::decimal::tostr</b> <i class="arg">decimal</i></a></dt>
<dd><p>Convert <em>decimal</em> into a string representing the number in base 10.</p></dd>
<dt><a name="3"><b class="cmd">::math::decimal::setVariable</b> <i class="arg">variable</i> <i class="arg">setting</i></a></dt>
<dd><p>Sets the <em>variable</em> to <em>setting</em>. Valid variables are:</p>
<ul class="itemized">
<li><p><i class="arg">rounding</i> - Method of rounding to use during rescale. Valid
	methods are round_half_even, round_half_up, round_half_down,
	round_down, round_up, round_floor, round_ceiling.</p></li>
<li><p><i class="arg">precision</i> - Maximum number of digits allowed in mantissa.</p></li>
<li><p><i class="arg">extended</i> - Set to 1 for extended mode. 0 for simplified mode.</p></li>
<li><p><i class="arg">maxExponent</i> - Maximum value for the exponent. Defaults to 999.</p></li>
<li><p><i class="arg">minExponent</i> - Minimum value for the exponent. Default to -998.</p></li>
</ul></dd>
<dt><a name="4"><b class="cmd">::math::decimal::add</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd></dd>
<dt><a name="5"><b class="cmd">::math::decimal::+</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the sum of the two decimals <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="6"><b class="cmd">::math::decimal::subtract</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd></dd>
<dt><a name="7"><b class="cmd">::math::decimal::-</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the differnece of the two decimals <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="8"><b class="cmd">::math::decimal::multiply</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd></dd>
<dt><a name="9"><b class="cmd">::math::decimal::*</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the product of the two decimals <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="10"><b class="cmd">::math::decimal::divide</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd></dd>
<dt><a name="11"><b class="cmd">::math::decimal::/</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the quotient of the division between the two
decimals <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="12"><b class="cmd">::math::decimal::divideint</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return a the integer portion of the quotient of the division between
decimals <em>a</em> and <em>b</em></p></dd>
<dt><a name="13"><b class="cmd">::math::decimal::remainder</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Return the remainder of the division between the two
decimals <em>a</em> and <em>b</em>.</p></dd>
<dt><a name="14"><b class="cmd">::math::decimal::abs</b> <i class="arg">decimal</i></a></dt>
<dd><p>Return the absolute value of the decimal.</p></dd>
<dt><a name="15"><b class="cmd">::math::decimal::compare</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Compare the two decimals a and b, returning <em>0</em> if <em>a == b</em>,
<em>1</em> if <em>a &gt; b</em>, and <em>-1</em> if <em>a &lt; b</em>.</p></dd>
<dt><a name="16"><b class="cmd">::math::decimal::max</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Compare the two decimals a and b, and return <em>a</em> if <em>a &gt;= b</em>, and <em>b</em> if <em>a &lt; b</em>.</p></dd>
<dt><a name="17"><b class="cmd">::math::decimal::maxmag</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Compare the two decimals a and b while ignoring their signs, and return <em>a</em> if <em>abs(a) &gt;= abs(b)</em>, and <em>b</em> if <em>abs(a) &lt; abs(b)</em>.</p></dd>
<dt><a name="18"><b class="cmd">::math::decimal::min</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Compare the two decimals a and b, and return <em>a</em> if <em>a &lt;= b</em>, and <em>b</em> if <em>a &gt; b</em>.</p></dd>
<dt><a name="19"><b class="cmd">::math::decimal::minmag</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Compare the two decimals a and b while ignoring their signs, and return <em>a</em> if <em>abs(a) &lt;= abs(b)</em>, and <em>b</em> if <em>abs(a) &gt; abs(b)</em>.</p></dd>
<dt><a name="20"><b class="cmd">::math::decimal::plus</b> <i class="arg">a</i></a></dt>
<dd><p>Return the result from <em>::math::decimal::+ 0 $a</em>.</p></dd>
<dt><a name="21"><b class="cmd">::math::decimal::minus</b> <i class="arg">a</i></a></dt>
<dd><p>Return the result from <em>::math::decimal::- 0 $a</em>.</p></dd>
<dt><a name="22"><b class="cmd">::math::decimal::copynegate</b> <i class="arg">a</i></a></dt>
<dd><p>Returns <em>a</em> with the sign flipped.</p></dd>
<dt><a name="23"><b class="cmd">::math::decimal::copysign</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Returns <em>a</em> with the sign set to the sign of the <em>b</em>.</p></dd>
<dt><a name="24"><b class="cmd">::math::decimal::is-signed</b> <i class="arg">decimal</i></a></dt>
<dd><p>Return the sign of the decimal.
The procedure returns 0 if the number is positive, 1 if it's negative.</p></dd>
<dt><a name="25"><b class="cmd">::math::decimal::is-zero</b> <i class="arg">decimal</i></a></dt>
<dd><p>Return true if <em>decimal</em> value is zero, otherwise false is returned.</p></dd>
<dt><a name="26"><b class="cmd">::math::decimal::is-NaN</b> <i class="arg">decimal</i></a></dt>
<dd><p>Return true if <em>decimal</em> value is NaN (not a number), otherwise false is returned.</p></dd>
<dt><a name="27"><b class="cmd">::math::decimal::is-infinite</b> <i class="arg">decimal</i></a></dt>
<dd><p>Return true if <em>decimal</em> value is Infinite, otherwise false is returned.</p></dd>
<dt><a name="28"><b class="cmd">::math::decimal::is-finite</b> <i class="arg">decimal</i></a></dt>
<dd><p>Return true if <em>decimal</em> value is finite, otherwise false is returned.</p></dd>
<dt><a name="29"><b class="cmd">::math::decimal::fma</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i></a></dt>
<dd><p>Return the result from first multiplying <em>a</em> by <em>b</em> and then adding <em>c</em>. Rescaling only occurs after completion of all operations. In this way the result may vary from that returned by performing the operations individually.</p></dd>
<dt><a name="30"><b class="cmd">::math::decimal::round_half_even</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></dt>
<dd><p>Rounds <em>decimal</em> to <em>digits</em> number of decimal points with the following rules: Round to the nearest. If equidistant, round so the final digit is even.</p></dd>
<dt><a name="31"><b class="cmd">::math::decimal::round_half_up</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></dt>
<dd><p>Rounds <em>decimal</em> to <em>digits</em> number of decimal points with the following rules: Round to the nearest. If equidistant, round up.</p></dd>
<dt><a name="32"><b class="cmd">::math::decimal::round_half_down</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></dt>
<dd><p>Rounds <em>decimal</em> to <em>digits</em> number of decimal points with the following rules: Round to the nearest. If equidistant, round down.</p></dd>
<dt><a name="33"><b class="cmd">::math::decimal::round_down</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></dt>
<dd><p>Rounds <em>decimal</em> to <em>digits</em> number of decimal points with the following rules: Round toward 0.  (Truncate)</p></dd>
<dt><a name="34"><b class="cmd">::math::decimal::round_up</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></dt>
<dd><p>Rounds <em>decimal</em> to <em>digits</em> number of decimal points with the following rules: Round away from 0</p></dd>
<dt><a name="35"><b class="cmd">::math::decimal::round_floor</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></dt>
<dd><p>Rounds <em>decimal</em> to <em>digits</em> number of decimal points with the following rules: Round toward -Infinity.</p></dd>
<dt><a name="36"><b class="cmd">::math::decimal::round_ceiling</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></dt>
<dd><p>Rounds <em>decimal</em> to <em>digits</em> number of decimal points with the following rules: Round toward Infinity</p></dd>
<dt><a name="37"><b class="cmd">::math::decimal::round_05up</b> <i class="arg">decimal</i> <i class="arg">digits</i></a></dt>
<dd><p>Rounds <em>decimal</em> to <em>digits</em> number of decimal points with the following rules: Round zero or five away from 0. The same as round-up, except that rounding up only occurs if the digit to be rounded up is 0 or 5, and after overflow
the result is the same as for round-down.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>Decimal</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key702">decimal</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key246">tcl</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Mark Alston &lt;mark at beernut dot com&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/fourier.html.























































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math::fourier - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/fourier.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ math::fourier.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::fourier(n) 1.0.2 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::fourier - Discrete and fast fourier transforms</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">GENERAL INFORMATION</a></li>
<li class="section"><a href="#section3">PROCEDURES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">math::fourier 1.0.2</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::fourier::dft</b> <i class="arg">in_data</i></a></li>
<li><a href="#2"><b class="cmd">::math::fourier::inverse_dft</b> <i class="arg">in_data</i></a></li>
<li><a href="#3"><b class="cmd">::math::fourier::lowpass</b> <i class="arg">cutoff</i> <i class="arg">in_data</i></a></li>
<li><a href="#4"><b class="cmd">::math::fourier::highpass</b> <i class="arg">cutoff</i> <i class="arg">in_data</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">math::fourier</b> package implements two versions of discrete
Fourier transforms, the ordinary transform and the fast Fourier
transform. It also provides a few simple filter procedures as an
illustrations of how such filters can be implemented.</p>
<p>The purpose of this document is to describe the implemented procedures
and provide some examples of their usage. As there is ample literature
on the algorithms involved, we refer to relevant text books for more
explanations. We also refer to the original Wiki page on the subject
which describes some of the considerations behind the current
implementation.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">GENERAL INFORMATION</a></h2>
<p>The two top-level procedures defined are</p>
<ul class="itemized">
<li><p>dft data-list</p></li>
<li><p>inverse_dft data-list</p></li>
</ul>
<p>Both take a list of <em>complex numbers</em> and apply a Discrete Fourier
Transform (DFT) or its inverse respectively to these lists of numbers.
A &quot;complex number&quot; in this case is either (i) a pair (two element list) of
numbers, interpreted as the real and imaginary parts of the complex number,
or (ii) a single number, interpreted as the real part of a complex number
whose imaginary part is zero. The return value is always in the
first format. (The DFT generally produces complex results even if the
input is purely real.) Applying first one and then the other of these
procedures to a list of complex numbers will (modulo rounding errors
due to floating point arithmetic) return the original list of numbers.</p>
<p>If the input length N is a power of two then these procedures will
utilize the O(N log N) Fast Fourier Transform algorithm. If input
length is not a power of two then the DFT will instead be computed
using a the naive quadratic algorithm.</p>
<p>Some examples:</p>
<pre class="example">
    % dft {1 2 3 4}
    {10 0.0} {-2.0 2.0} {-2 0.0} {-2.0 -2.0}
    % inverse_dft {{10 0.0} {-2.0 2.0} {-2 0.0} {-2.0 -2.0}}
    {1.0 0.0} {2.0 0.0} {3.0 0.0} {4.0 0.0}
    % dft {1 2 3 4 5}
    {15.0 0.0} {-2.5 3.44095480118} {-2.5 0.812299240582} {-2.5 -0.812299240582} {-2.5 -3.44095480118}
    % inverse_dft {{15.0 0.0} {-2.5 3.44095480118} {-2.5 0.812299240582} {-2.5 -0.812299240582} {-2.5 -3.44095480118}}
    {1.0 0.0} {2.0 8.881784197e-17} {3.0 4.4408920985e-17} {4.0 4.4408920985e-17} {5.0 -8.881784197e-17}
</pre>
<p>In the last case, the imaginary parts &lt;1e-16 would have been zero in exact
arithmetic, but aren't here due to rounding errors.</p>
<p>Internally, the procedures use a flat list format where every even
index element of a list is a real part and every odd index element
is an imaginary part. This is reflected in the variable names by Re_
and Im_ prefixes.</p>
<p>The package includes two simple filters. They have an analogue
equivalent in a simple electronic circuit, a resistor and a capacitance
in series. Using these filters requires the
<b class="package"><a href="qcomplex.html">math::complexnumbers</a></b> package.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">PROCEDURES</a></h2>
<p>The public Fourier transform procedures are:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::fourier::dft</b> <i class="arg">in_data</i></a></dt>
<dd><p>Determine the <em>Fourier transform</em> of the given list of complex
numbers. The result is a list of complex numbers representing the
(complex) amplitudes of the Fourier components.</p>
<dl class="arguments">
<dt>list <i class="arg">in_data</i></dt>
<dd><p>List of data</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::fourier::inverse_dft</b> <i class="arg">in_data</i></a></dt>
<dd><p>Determine the <em>inverse Fourier transform</em> of the given list of
complex numbers (interpreted as amplitudes). The result is a list of
complex numbers representing the original (complex) data</p>
<dl class="arguments">
<dt>list <i class="arg">in_data</i></dt>
<dd><p>List of data (amplitudes)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::fourier::lowpass</b> <i class="arg">cutoff</i> <i class="arg">in_data</i></a></dt>
<dd><p>Filter the (complex) amplitudes so that high-frequency components
are suppressed. The implemented filter is a first-order low-pass filter,
the discrete equivalent of a simple electronic circuit with a resistor
and a capacitance.</p>
<dl class="arguments">
<dt>float <i class="arg">cutoff</i></dt>
<dd><p>Cut-off frequency</p></dd>
<dt>list <i class="arg">in_data</i></dt>
<dd><p>List of data (amplitudes)</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::math::fourier::highpass</b> <i class="arg">cutoff</i> <i class="arg">in_data</i></a></dt>
<dd><p>Filter the (complex) amplitudes so that low-frequency components
are suppressed. The implemented filter is a first-order low-pass filter,
the discrete equivalent of a simple electronic circuit with a resistor
and a capacitance.</p>
<dl class="arguments">
<dt>float <i class="arg">cutoff</i></dt>
<dd><p>Cut-off frequency</p></dd>
<dt>list <i class="arg">in_data</i></dt>
<dd><p>List of data (amplitudes)</p></dd>
</dl></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: fourier</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key739">FFT</a>, <a href="../../../../index.html#key738">Fourier transform</a>, <a href="../../../../index.html#key730">complex numbers</a>, <a href="../../../../index.html#key579">mathematics</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/fuzzy.html.
























































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math::fuzzy - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/fuzzy.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ math::fuzzy.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::fuzzy(n) 0.2 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::fuzzy - Fuzzy comparison of floating-point numbers</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">TEST CASES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.3?</span></b></li>
<li>package require <b class="pkgname">math::fuzzy <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::fuzzy::teq</b> <i class="arg">value1</i> <i class="arg">value2</i></a></li>
<li><a href="#2"><b class="cmd">::math::fuzzy::tne</b> <i class="arg">value1</i> <i class="arg">value2</i></a></li>
<li><a href="#3"><b class="cmd">::math::fuzzy::tge</b> <i class="arg">value1</i> <i class="arg">value2</i></a></li>
<li><a href="#4"><b class="cmd">::math::fuzzy::tle</b> <i class="arg">value1</i> <i class="arg">value2</i></a></li>
<li><a href="#5"><b class="cmd">::math::fuzzy::tlt</b> <i class="arg">value1</i> <i class="arg">value2</i></a></li>
<li><a href="#6"><b class="cmd">::math::fuzzy::tgt</b> <i class="arg">value1</i> <i class="arg">value2</i></a></li>
<li><a href="#7"><b class="cmd">::math::fuzzy::tfloor</b> <i class="arg">value</i></a></li>
<li><a href="#8"><b class="cmd">::math::fuzzy::tceil</b> <i class="arg">value</i></a></li>
<li><a href="#9"><b class="cmd">::math::fuzzy::tround</b> <i class="arg">value</i></a></li>
<li><a href="#10"><b class="cmd">::math::fuzzy::troundn</b> <i class="arg">value</i> <i class="arg">ndigits</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package Fuzzy is meant to solve common problems with floating-point
numbers in a systematic way:</p>
<ul class="itemized">
<li><p>Comparing two numbers that are &quot;supposed&quot; to be identical, like
1.0 and 2.1/(1.2+0.9) is not guaranteed to give the
intuitive result.</p></li>
<li><p>Rounding a number that is halfway two integer numbers can cause
strange errors, like int(100.0*2.8) != 28 but 27</p></li>
</ul>
<p>The Fuzzy package is meant to help sorting out this type of problems
by defining &quot;fuzzy&quot; comparison procedures for floating-point numbers.
It does so by allowing for a small margin that is determined
automatically - the margin is three times the &quot;epsilon&quot; value, that is
three times the smallest number <em>eps</em> such that 1.0 and 1.0+$eps
canbe distinguished. In Tcl, which uses double precision floating-point
numbers, this is typically 1.1e-16.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>Effectively the package provides the following procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::fuzzy::teq</b> <i class="arg">value1</i> <i class="arg">value2</i></a></dt>
<dd><p>Compares two floating-point numbers and returns 1 if their values
fall within a small range. Otherwise it returns 0.</p></dd>
<dt><a name="2"><b class="cmd">::math::fuzzy::tne</b> <i class="arg">value1</i> <i class="arg">value2</i></a></dt>
<dd><p>Returns the negation, that is, if the difference is larger than
the margin, it returns 1.</p></dd>
<dt><a name="3"><b class="cmd">::math::fuzzy::tge</b> <i class="arg">value1</i> <i class="arg">value2</i></a></dt>
<dd><p>Compares two floating-point numbers and returns 1 if their values
either fall within a small range or if the first number is larger
than the second. Otherwise it returns 0.</p></dd>
<dt><a name="4"><b class="cmd">::math::fuzzy::tle</b> <i class="arg">value1</i> <i class="arg">value2</i></a></dt>
<dd><p>Returns 1 if the two numbers are equal according to
[teq] or if the first is smaller than the second.</p></dd>
<dt><a name="5"><b class="cmd">::math::fuzzy::tlt</b> <i class="arg">value1</i> <i class="arg">value2</i></a></dt>
<dd><p>Returns the opposite of [tge].</p></dd>
<dt><a name="6"><b class="cmd">::math::fuzzy::tgt</b> <i class="arg">value1</i> <i class="arg">value2</i></a></dt>
<dd><p>Returns the opposite of [tle].</p></dd>
<dt><a name="7"><b class="cmd">::math::fuzzy::tfloor</b> <i class="arg">value</i></a></dt>
<dd><p>Returns the integer number that is lower or equal
to the given floating-point number, within a well-defined
tolerance.</p></dd>
<dt><a name="8"><b class="cmd">::math::fuzzy::tceil</b> <i class="arg">value</i></a></dt>
<dd><p>Returns the integer number that is greater or equal to the given
floating-point number, within a well-defined tolerance.</p></dd>
<dt><a name="9"><b class="cmd">::math::fuzzy::tround</b> <i class="arg">value</i></a></dt>
<dd><p>Rounds the floating-point number off.</p></dd>
<dt><a name="10"><b class="cmd">::math::fuzzy::troundn</b> <i class="arg">value</i> <i class="arg">ndigits</i></a></dt>
<dd><p>Rounds the floating-point number off to the
specified number of decimals (Pro memorie).</p></dd>
</dl>
<p>Usage:</p>
<pre class="example">
if { [teq $x $y] } { puts &quot;x == y&quot; }
if { [tne $x $y] } { puts &quot;x != y&quot; }
if { [tge $x $y] } { puts &quot;x &gt;= y&quot; }
if { [tgt $x $y] } { puts &quot;x &gt; y&quot; }
if { [tlt $x $y] } { puts &quot;x &lt; y&quot; }
if { [tle $x $y] } { puts &quot;x &lt;= y&quot; }
set fx      [tfloor $x]
set fc      [tceil  $x]
set rounded [tround $x]
set roundn  [troundn $x $nodigits]
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">TEST CASES</a></h2>
<p>The problems that can occur with floating-point numbers are illustrated
by the test cases in the file &quot;fuzzy.test&quot;:</p>
<ul class="itemized">
<li><p>Several test case use the ordinary comparisons, and they
fail invariably to produce understandable results</p></li>
<li><p>One test case uses [expr] without braces ({ and }). It too
fails.</p></li>
</ul>
<p>The conclusion from this is that any expression should be surrounded by
braces, because otherwise very awkward things can happen if you need
accuracy. Furthermore, accuracy and understandable results are
enhanced by using these &quot;tolerant&quot; or fuzzy comparisons.</p>
<p>Note that besides the Tcl-only package, there is also a C-based version.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<p>Original implementation in Fortran by dr. H.D. Knoble (Penn State
University).</p>
<p>P. E. Hagerty, &quot;More on Fuzzy Floor and Ceiling,&quot;
APL QUOTE QUAD 8(4):20-24, June 1978. Note that TFLOOR=FL5 took five
years of refereed evolution (publication).</p>
<p>L. M. Breed, &quot;Definitions for Fuzzy Floor and Ceiling&quot;,
APL QUOTE QUAD 8(3):16-23, March 1978.</p>
<p>D. Knuth, Art of Computer Programming,
Vol. 1, Problem 1.2.4-5.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: fuzzy</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key347">floating-point</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key346">rounding</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/interpolate.html.



















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::interpolate - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/interpolate.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;   -- Copyright &copy; 2004 Kevn B. Kenny &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::interpolate.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::interpolate(n) 1.0.2 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::interpolate - Interpolation routines</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.4?</span></b></li>
<li>package require <b class="pkgname">struct</b></li>
<li>package require <b class="pkgname">math::interpolate <span class="opt">?1.0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::interpolate::defineTable</b> <i class="arg">name</i> <i class="arg">colnames</i> <i class="arg">values</i></a></li>
<li><a href="#2"><b class="cmd">::math::interpolate::interp-1d-table</b> <i class="arg">name</i> <i class="arg">xval</i></a></li>
<li><a href="#3"><b class="cmd">::math::interpolate::interp-table</b> <i class="arg">name</i> <i class="arg">xval</i> <i class="arg">yval</i></a></li>
<li><a href="#4"><b class="cmd">::math::interpolate::interp-linear</b> <i class="arg">xyvalues</i> <i class="arg">xval</i></a></li>
<li><a href="#5"><b class="cmd">::math::interpolate::interp-lagrange</b> <i class="arg">xyvalues</i> <i class="arg">xval</i></a></li>
<li><a href="#6"><b class="cmd">::math::interpolate::prepare-cubic-splines</b> <i class="arg">xcoord</i> <i class="arg">ycoord</i></a></li>
<li><a href="#7"><b class="cmd">::math::interpolate::interp-cubic-splines</b> <i class="arg">coeffs</i> <i class="arg">x</i></a></li>
<li><a href="#8"><b class="cmd">::math::interpolate::interp-spatial</b> <i class="arg">xyvalues</i> <i class="arg">coord</i></a></li>
<li><a href="#9"><b class="cmd">::math::interpolate::interp-spatial-params</b> <i class="arg">max_search</i> <i class="arg">power</i></a></li>
<li><a href="#10"><b class="cmd">::math::interpolate::neville</b> <i class="arg">xlist</i> <i class="arg">ylist</i> <i class="arg">x</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements several interpolation algorithms:</p>
<ul class="itemized">
<li><p>Interpolation into a table (one or two independent variables), this is useful
for example, if the data are static, like with tables of statistical functions.</p></li>
<li><p>Linear interpolation into a given set of data (organised as (x,y) pairs).</p></li>
<li><p>Lagrange interpolation. This is mainly of theoretical interest, because there is
no guarantee about error bounds. One possible use: if you need a line or
a parabola through given points (it will calculate the values, but not return
the coefficients).</p>
<p>A variation is Neville's method which has better behaviour and error
bounds.</p></li>
<li><p>Spatial interpolation using a straightforward distance-weight method. This procedure
allows any number of spatial dimensions and any number of dependent variables.</p></li>
<li><p>Interpolation in one dimension using cubic splines.</p></li>
</ul>
<p>This document describes the procedures and explains their usage.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The interpolation package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::interpolate::defineTable</b> <i class="arg">name</i> <i class="arg">colnames</i> <i class="arg">values</i></a></dt>
<dd><p>Define a table with one or two independent variables (the distinction is implicit in
the data). The procedure returns the name of the table - this name is used whenever you
want to interpolate the values. <em>Note:</em> this procedure is a convenient wrapper for the
struct::matrix procedure. Therefore you can access the data at any location in your program.</p>
<dl class="arguments">
<dt>string <i class="arg">name</i> (in)</dt>
<dd><p>Name of the table to be created</p></dd>
<dt>list <i class="arg">colnames</i> (in)</dt>
<dd><p>List of column names</p></dd>
<dt>list <i class="arg">values</i> (in)</dt>
<dd><p>List of values (the number of elements should be a
multiple of the number of columns. See <span class="sectref"><a href="#section3">EXAMPLES</a></span> for more information on the
interpretation of the data.</p>
<p>The values must be sorted with respect to the independent variable(s).</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::interpolate::interp-1d-table</b> <i class="arg">name</i> <i class="arg">xval</i></a></dt>
<dd><p>Interpolate into the one-dimensional table &quot;name&quot; and return a list of values, one for
each dependent column.</p>
<dl class="arguments">
<dt>string <i class="arg">name</i> (in)</dt>
<dd><p>Name of an existing table</p></dd>
<dt>float <i class="arg">xval</i> (in)</dt>
<dd><p>Value of the independent <em>row</em> variable</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::interpolate::interp-table</b> <i class="arg">name</i> <i class="arg">xval</i> <i class="arg">yval</i></a></dt>
<dd><p>Interpolate into the two-dimensional table &quot;name&quot; and return the interpolated value.</p>
<dl class="arguments">
<dt>string <i class="arg">name</i> (in)</dt>
<dd><p>Name of an existing table</p></dd>
<dt>float <i class="arg">xval</i> (in)</dt>
<dd><p>Value of the independent <em>row</em> variable</p></dd>
<dt>float <i class="arg">yval</i> (in)</dt>
<dd><p>Value of the independent <em>column</em> variable</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::math::interpolate::interp-linear</b> <i class="arg">xyvalues</i> <i class="arg">xval</i></a></dt>
<dd><p>Interpolate linearly into the list of x,y pairs and return the interpolated value.</p>
<dl class="arguments">
<dt>list <i class="arg">xyvalues</i> (in)</dt>
<dd><p>List of pairs of (x,y) values, sorted to increasing x.
They are used as the breakpoints of a piecewise linear function.</p></dd>
<dt>float <i class="arg">xval</i> (in)</dt>
<dd><p>Value of the independent variable for which the value of y
must be computed.</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::math::interpolate::interp-lagrange</b> <i class="arg">xyvalues</i> <i class="arg">xval</i></a></dt>
<dd><p>Use the list of x,y pairs to construct the unique polynomial of lowest degree
that passes through all points and return the interpolated value.</p>
<dl class="arguments">
<dt>list <i class="arg">xyvalues</i> (in)</dt>
<dd><p>List of pairs of (x,y) values</p></dd>
<dt>float <i class="arg">xval</i> (in)</dt>
<dd><p>Value of the independent variable for which the value of y
must be computed.</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::math::interpolate::prepare-cubic-splines</b> <i class="arg">xcoord</i> <i class="arg">ycoord</i></a></dt>
<dd><p>Returns a list of coefficients for the second routine
<em>interp-cubic-splines</em> to actually interpolate.</p>
<dl class="arguments">
<dt>list <i class="arg">xcoord</i></dt>
<dd><p>List of x-coordinates for the value of the
function to be interpolated is known. The coordinates must be strictly
ascending. At least three points are required.</p></dd>
<dt>list <i class="arg">ycoord</i></dt>
<dd><p>List of y-coordinates (the values of the
function at the given x-coordinates).</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::math::interpolate::interp-cubic-splines</b> <i class="arg">coeffs</i> <i class="arg">x</i></a></dt>
<dd><p>Returns the interpolated value at coordinate x. The coefficients are
computed by the procedure <em>prepare-cubic-splines</em>.</p>
<dl class="arguments">
<dt>list <i class="arg">coeffs</i></dt>
<dd><p>List of coefficients as returned by
prepare-cubic-splines</p></dd>
<dt>float <i class="arg">x</i></dt>
<dd><p>x-coordinate at which to estimate the function. Must
be between the first and last x-coordinate for which values were given.</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::math::interpolate::interp-spatial</b> <i class="arg">xyvalues</i> <i class="arg">coord</i></a></dt>
<dd><p>Use a straightforward interpolation method with weights as function of the
inverse distance to interpolate in 2D and N-dimensional space</p>
<p>The list xyvalues is a list of lists:</p>
<pre class="example">
    {   {x1 y1 z1 {v11 v12 v13 v14}}
	{x2 y2 z2 {v21 v22 v23 v24}}
	...
    }
</pre>
<p>The last element of each inner list is either a single number or a list in itself.
In the latter case the return value is a list with the same number of elements.</p>
<p>The method is influenced by the search radius and the power of the inverse distance</p>
<dl class="arguments">
<dt>list <i class="arg">xyvalues</i> (in)</dt>
<dd><p>List of lists, each sublist being a list of coordinates and
of dependent values.</p></dd>
<dt>list <i class="arg">coord</i> (in)</dt>
<dd><p>List of coordinates for which the values must be calculated</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::math::interpolate::interp-spatial-params</b> <i class="arg">max_search</i> <i class="arg">power</i></a></dt>
<dd><p>Set the parameters for spatial interpolation</p>
<dl class="arguments">
<dt>float <i class="arg">max_search</i> (in)</dt>
<dd><p>Search radius (data points further than this are ignored)</p></dd>
<dt>integer <i class="arg">power</i> (in)</dt>
<dd><p>Power for the distance (either 1 or 2; defaults to 2)</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::math::interpolate::neville</b> <i class="arg">xlist</i> <i class="arg">ylist</i> <i class="arg">x</i></a></dt>
<dd><p>Interpolates between the tabulated values of a function
whose abscissae are <i class="arg">xlist</i>
and whose ordinates are <i class="arg">ylist</i> to produce an estimate for the value
of the function at <i class="arg">x</i>.  The result is a two-element list; the first
element is the function's estimated value, and the second is an estimate
of the absolute error of the result.  Neville's algorithm for polynomial
interpolation is used.  Note that a large table of values will use an
interpolating polynomial of high degree, which is likely to result in
numerical instabilities; one is better off using only a few tabulated
values near the desired abscissa.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p><em>TODO</em>
Example of using the cubic splines:</p>
<p>Suppose the following values are given:</p>
<pre class="example">
    x       y
  0.1     1.0
  0.3     2.1
  0.4     2.2
  0.8     4.11
  1.0     4.12
</pre>
<p>Then to estimate the values at 0.1, 0.2, 0.3, ... 1.0, you can use:</p>
<pre class="example">
   set coeffs [::math::interpolate::prepare-cubic-splines  {0.1 0.3 0.4 0.8  1.0}  {1.0 2.1 2.2 4.11 4.12}]
   foreach x {0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0} {
      puts &quot;$x: [::math::interpolate::interp-cubic-splines $coeffs $x]&quot;
   }
</pre>
<p>to get the following output:</p>
<pre class="example">
0.1: 1.0
0.2: 1.68044117647
0.3: 2.1
0.4: 2.2
0.5: 3.11221507353
0.6: 4.25242647059
0.7: 5.41804227941
0.8: 4.11
0.9: 3.95675857843
1.0: 4.12
</pre>
<p>As you can see, the values at the abscissae are reproduced perfectly.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: interpolate</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key773">interpolation</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key774">spatial interpolation</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;<br>
Copyright &copy; 2004 Kevn B. Kenny &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/linalg.html.


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::linearalgebra - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/linalg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004-2008 Arjen Markus &lt;[email protected]&gt;   -- Copyright &copy; 2004 Ed Hume &lt;http://www.hume.com/contact.us.htm&gt;   -- Copyright &copy; 2008 Michael Buadin &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::linearalgebra.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::linearalgebra(n) 1.1 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::linearalgebra - Linear Algebra</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">STORAGE</a></li>
<li class="section"><a href="#section4">REMARKS ON THE IMPLEMENTATION</a></li>
<li class="section"><a href="#section5">TODO</a></li>
<li class="section"><a href="#section6">NAMING CONFLICT</a></li>
<li class="section"><a href="#section7">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.4?</span></b></li>
<li>package require <b class="pkgname">math::linearalgebra <span class="opt">?1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::linearalgebra::mkVector</b> <i class="arg">ndim</i> <i class="arg">value</i></a></li>
<li><a href="#2"><b class="cmd">::math::linearalgebra::mkUnitVector</b> <i class="arg">ndim</i> <i class="arg">ndir</i></a></li>
<li><a href="#3"><b class="cmd">::math::linearalgebra::mkMatrix</b> <i class="arg">nrows</i> <i class="arg">ncols</i> <i class="arg">value</i></a></li>
<li><a href="#4"><b class="cmd">::math::linearalgebra::getrow</b> <i class="arg">matrix</i> <i class="arg">row</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></li>
<li><a href="#5"><b class="cmd">::math::linearalgebra::setrow</b> <i class="arg">matrix</i> <i class="arg">row</i> <i class="arg">newvalues</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></li>
<li><a href="#6"><b class="cmd">::math::linearalgebra::getcol</b> <i class="arg">matrix</i> <i class="arg">col</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></li>
<li><a href="#7"><b class="cmd">::math::linearalgebra::setcol</b> <i class="arg">matrix</i> <i class="arg">col</i> <i class="arg">newvalues</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></li>
<li><a href="#8"><b class="cmd">::math::linearalgebra::getelem</b> <i class="arg">matrix</i> <i class="arg">row</i> <i class="arg">col</i></a></li>
<li><a href="#9"><b class="cmd">::math::linearalgebra::setelem</b> <i class="arg">matrix</i> <i class="arg">row</i> <span class="opt">?col?</span> <i class="arg">newvalue</i></a></li>
<li><a href="#10"><b class="cmd">::math::linearalgebra::swaprows</b> <i class="arg">matrix</i> <i class="arg">irow1</i> <i class="arg">irow2</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></li>
<li><a href="#11"><b class="cmd">::math::linearalgebra::swapcols</b> <i class="arg">matrix</i> <i class="arg">icol1</i> <i class="arg">icol2</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></li>
<li><a href="#12"><b class="cmd">::math::linearalgebra::show</b> <i class="arg">obj</i> <span class="opt">?format?</span> <span class="opt">?rowsep?</span> <span class="opt">?colsep?</span></a></li>
<li><a href="#13"><b class="cmd">::math::linearalgebra::dim</b> <i class="arg">obj</i></a></li>
<li><a href="#14"><b class="cmd">::math::linearalgebra::shape</b> <i class="arg">obj</i></a></li>
<li><a href="#15"><b class="cmd">::math::linearalgebra::conforming</b> <i class="arg">type</i> <i class="arg">obj1</i> <i class="arg">obj2</i></a></li>
<li><a href="#16"><b class="cmd">::math::linearalgebra::symmetric</b> <i class="arg">matrix</i> <span class="opt">?eps?</span></a></li>
<li><a href="#17"><b class="cmd">::math::linearalgebra::norm</b> <i class="arg">vector</i> <i class="arg">type</i></a></li>
<li><a href="#18"><b class="cmd">::math::linearalgebra::norm_one</b> <i class="arg">vector</i></a></li>
<li><a href="#19"><b class="cmd">::math::linearalgebra::norm_two</b> <i class="arg">vector</i></a></li>
<li><a href="#20"><b class="cmd">::math::linearalgebra::norm_max</b> <i class="arg">vector</i> <span class="opt">?index?</span></a></li>
<li><a href="#21"><b class="cmd">::math::linearalgebra::normMatrix</b> <i class="arg">matrix</i> <i class="arg">type</i></a></li>
<li><a href="#22"><b class="cmd">::math::linearalgebra::dotproduct</b> <i class="arg">vect1</i> <i class="arg">vect2</i></a></li>
<li><a href="#23"><b class="cmd">::math::linearalgebra::unitLengthVector</b> <i class="arg">vector</i></a></li>
<li><a href="#24"><b class="cmd">::math::linearalgebra::normalizeStat</b> <i class="arg">mv</i></a></li>
<li><a href="#25"><b class="cmd">::math::linearalgebra::axpy</b> <i class="arg">scale</i> <i class="arg">mv1</i> <i class="arg">mv2</i></a></li>
<li><a href="#26"><b class="cmd">::math::linearalgebra::add</b> <i class="arg">mv1</i> <i class="arg">mv2</i></a></li>
<li><a href="#27"><b class="cmd">::math::linearalgebra::sub</b> <i class="arg">mv1</i> <i class="arg">mv2</i></a></li>
<li><a href="#28"><b class="cmd">::math::linearalgebra::scale</b> <i class="arg">scale</i> <i class="arg">mv</i></a></li>
<li><a href="#29"><b class="cmd">::math::linearalgebra::rotate</b> <i class="arg">c</i> <i class="arg">s</i> <i class="arg">vect1</i> <i class="arg">vect2</i></a></li>
<li><a href="#30"><b class="cmd">::math::linearalgebra::transpose</b> <i class="arg">matrix</i></a></li>
<li><a href="#31"><b class="cmd">::math::linearalgebra::matmul</b> <i class="arg">mv1</i> <i class="arg">mv2</i></a></li>
<li><a href="#32"><b class="cmd">::math::linearalgebra::angle</b> <i class="arg">vect1</i> <i class="arg">vect2</i></a></li>
<li><a href="#33"><b class="cmd">::math::linearalgebra::crossproduct</b> <i class="arg">vect1</i> <i class="arg">vect2</i></a></li>
<li><a href="#34"><b class="cmd">::math::linearalgebra::matmul</b> <i class="arg">mv1</i> <i class="arg">mv2</i></a></li>
<li><a href="#35"><b class="cmd">::math::linearalgebra::mkIdentity</b> <i class="arg">size</i></a></li>
<li><a href="#36"><b class="cmd">::math::linearalgebra::mkDiagonal</b> <i class="arg">diag</i></a></li>
<li><a href="#37"><b class="cmd">::math::linearalgebra::mkRandom</b> <i class="arg">size</i></a></li>
<li><a href="#38"><b class="cmd">::math::linearalgebra::mkTriangular</b> <i class="arg">size</i> <span class="opt">?uplo?</span> <span class="opt">?value?</span></a></li>
<li><a href="#39"><b class="cmd">::math::linearalgebra::mkHilbert</b> <i class="arg">size</i></a></li>
<li><a href="#40"><b class="cmd">::math::linearalgebra::mkDingdong</b> <i class="arg">size</i></a></li>
<li><a href="#41"><b class="cmd">::math::linearalgebra::mkOnes</b> <i class="arg">size</i></a></li>
<li><a href="#42"><b class="cmd">::math::linearalgebra::mkMoler</b> <i class="arg">size</i></a></li>
<li><a href="#43"><b class="cmd">::math::linearalgebra::mkFrank</b> <i class="arg">size</i></a></li>
<li><a href="#44"><b class="cmd">::math::linearalgebra::mkBorder</b> <i class="arg">size</i></a></li>
<li><a href="#45"><b class="cmd">::math::linearalgebra::mkWilkinsonW+</b> <i class="arg">size</i></a></li>
<li><a href="#46"><b class="cmd">::math::linearalgebra::mkWilkinsonW-</b> <i class="arg">size</i></a></li>
<li><a href="#47"><b class="cmd">::math::linearalgebra::solveGauss</b> <i class="arg">matrix</i> <i class="arg">bvect</i></a></li>
<li><a href="#48"><b class="cmd">::math::linearalgebra::solvePGauss</b> <i class="arg">matrix</i> <i class="arg">bvect</i></a></li>
<li><a href="#49"><b class="cmd">::math::linearalgebra::solveTriangular</b> <i class="arg">matrix</i> <i class="arg">bvect</i> <span class="opt">?uplo?</span></a></li>
<li><a href="#50"><b class="cmd">::math::linearalgebra::solveGaussBand</b> <i class="arg">matrix</i> <i class="arg">bvect</i></a></li>
<li><a href="#51"><b class="cmd">::math::linearalgebra::solveTriangularBand</b> <i class="arg">matrix</i> <i class="arg">bvect</i></a></li>
<li><a href="#52"><b class="cmd">::math::linearalgebra::determineSVD</b> <i class="arg">A</i> <i class="arg">eps</i></a></li>
<li><a href="#53"><b class="cmd">::math::linearalgebra::eigenvectorsSVD</b> <i class="arg">A</i> <i class="arg">eps</i></a></li>
<li><a href="#54"><b class="cmd">::math::linearalgebra::leastSquaresSVD</b> <i class="arg">A</i> <i class="arg">y</i> <i class="arg">qmin</i> <i class="arg">eps</i></a></li>
<li><a href="#55"><b class="cmd">::math::linearalgebra::choleski</b> <i class="arg">matrix</i></a></li>
<li><a href="#56"><b class="cmd">::math::linearalgebra::orthonormalizeColumns</b> <i class="arg">matrix</i></a></li>
<li><a href="#57"><b class="cmd">::math::linearalgebra::orthonormalizeRows</b> <i class="arg">matrix</i></a></li>
<li><a href="#58"><b class="cmd">::math::linearalgebra::dger</b> <i class="arg">matrix</i> <i class="arg">alpha</i> <i class="arg">x</i> <i class="arg">y</i> <span class="opt">?scope?</span></a></li>
<li><a href="#59"><b class="cmd">::math::linearalgebra::dgetrf</b> <i class="arg">matrix</i></a></li>
<li><a href="#60"><b class="cmd">::math::linearalgebra::det</b> <i class="arg">matrix</i></a></li>
<li><a href="#61"><b class="cmd">::math::linearalgebra::largesteigen</b> <i class="arg">matrix</i> <i class="arg">tolerance</i> <i class="arg">maxiter</i></a></li>
<li><a href="#62"><b class="cmd">::math::linearalgebra::to_LA</b> <i class="arg">mv</i></a></li>
<li><a href="#63"><b class="cmd">::math::linearalgebra::from_LA</b> <i class="arg">mv</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package offers both low-level procedures and high-level algorithms
to deal with linear algebra problems:</p>
<ul class="itemized">
<li><p>robust solution of linear equations or least squares problems</p></li>
<li><p>determining eigenvectors and eigenvalues of symmetric matrices</p></li>
<li><p>various decompositions of general matrices or matrices of a specific
form</p></li>
<li><p>(limited) support for matrices in band storage, a common type of sparse
matrices</p></li>
</ul>
<p>It arose as a re-implementation of Hume's LA package and the desire to
offer low-level procedures as found in the well-known BLAS library.
Matrices are implemented as lists of lists rather linear lists with
reserved elements, as in the original LA package, as it was found that
such an implementation is actually faster.</p>
<p>It is advisable, however, to use the procedures that are offered, such
as <em>setrow</em> and <em>getrow</em>, rather than rely on this
representation explicitly: that way it is to switch to a possibly even
faster compiled implementation that supports the same API.</p>
<p><em>Note:</em> When using this package in combination with Tk, there may
be a naming conflict, as both this package and Tk define a command
<em>scale</em>. See the <span class="sectref"><a href="#section6">NAMING CONFLICT</a></span> section below.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The package defines the following public procedures (several exist as
specialised procedures, see below):</p>
<p><em>Constructing matrices and vectors</em></p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::linearalgebra::mkVector</b> <i class="arg">ndim</i> <i class="arg">value</i></a></dt>
<dd><p>Create a vector with ndim elements, each with the value <em>value</em>.</p>
<dl class="arguments">
<dt>integer <i class="arg">ndim</i></dt>
<dd><p>Dimension of the vector (number of components)</p></dd>
<dt>double <i class="arg">value</i></dt>
<dd><p>Uniform value to be used (default: 0.0)</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::linearalgebra::mkUnitVector</b> <i class="arg">ndim</i> <i class="arg">ndir</i></a></dt>
<dd><p>Create a unit vector in <em>ndim</em>-dimensional space, along the
<em>ndir</em>-th direction.</p>
<dl class="arguments">
<dt>integer <i class="arg">ndim</i></dt>
<dd><p>Dimension of the vector (number of components)</p></dd>
<dt>integer <i class="arg">ndir</i></dt>
<dd><p>Direction (0, ..., ndim-1)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::linearalgebra::mkMatrix</b> <i class="arg">nrows</i> <i class="arg">ncols</i> <i class="arg">value</i></a></dt>
<dd><p>Create a matrix with <em>nrows</em> rows and <em>ncols</em> columns. All
elements have the value <em>value</em>.</p>
<dl class="arguments">
<dt>integer <i class="arg">nrows</i></dt>
<dd><p>Number of rows</p></dd>
<dt>integer <i class="arg">ncols</i></dt>
<dd><p>Number of columns</p></dd>
<dt>double <i class="arg">value</i></dt>
<dd><p>Uniform value to be used (default: 0.0)</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::math::linearalgebra::getrow</b> <i class="arg">matrix</i> <i class="arg">row</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></dt>
<dd><p>Returns a single row of a matrix as a list</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix in question</p></dd>
<dt>integer <i class="arg">row</i></dt>
<dd><p>Index of the row to return</p></dd>
<dt>integer <i class="arg">imin</i></dt>
<dd><p>Minimum index of the column (default: 0)</p></dd>
<dt>integer <i class="arg">imax</i></dt>
<dd><p>Maximum index of the column (default: ncols-1)</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::math::linearalgebra::setrow</b> <i class="arg">matrix</i> <i class="arg">row</i> <i class="arg">newvalues</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></dt>
<dd><p>Set a single row of a matrix to new values (this list must have the same
number of elements as the number of <em>columns</em> in the matrix)</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p><em>name</em> of the matrix in question</p></dd>
<dt>integer <i class="arg">row</i></dt>
<dd><p>Index of the row to update</p></dd>
<dt>list <i class="arg">newvalues</i></dt>
<dd><p>List of new values for the row</p></dd>
<dt>integer <i class="arg">imin</i></dt>
<dd><p>Minimum index of the column (default: 0)</p></dd>
<dt>integer <i class="arg">imax</i></dt>
<dd><p>Maximum index of the column (default: ncols-1)</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::math::linearalgebra::getcol</b> <i class="arg">matrix</i> <i class="arg">col</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></dt>
<dd><p>Returns a single column of a matrix as a list</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix in question</p></dd>
<dt>integer <i class="arg">col</i></dt>
<dd><p>Index of the column to return</p></dd>
<dt>integer <i class="arg">imin</i></dt>
<dd><p>Minimum index of the row (default: 0)</p></dd>
<dt>integer <i class="arg">imax</i></dt>
<dd><p>Maximum index of the row (default: nrows-1)</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::math::linearalgebra::setcol</b> <i class="arg">matrix</i> <i class="arg">col</i> <i class="arg">newvalues</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></dt>
<dd><p>Set a single column of a matrix to new values (this list must have
the same number of elements as the number of <em>rows</em> in the matrix)</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p><em>name</em> of the matrix in question</p></dd>
<dt>integer <i class="arg">col</i></dt>
<dd><p>Index of the column to update</p></dd>
<dt>list <i class="arg">newvalues</i></dt>
<dd><p>List of new values for the column</p></dd>
<dt>integer <i class="arg">imin</i></dt>
<dd><p>Minimum index of the row (default: 0)</p></dd>
<dt>integer <i class="arg">imax</i></dt>
<dd><p>Maximum index of the row (default: nrows-1)</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::math::linearalgebra::getelem</b> <i class="arg">matrix</i> <i class="arg">row</i> <i class="arg">col</i></a></dt>
<dd><p>Returns a single element of a matrix/vector</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix or vector in question</p></dd>
<dt>integer <i class="arg">row</i></dt>
<dd><p>Row of the element</p></dd>
<dt>integer <i class="arg">col</i></dt>
<dd><p>Column of the element (not present for vectors)</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::math::linearalgebra::setelem</b> <i class="arg">matrix</i> <i class="arg">row</i> <span class="opt">?col?</span> <i class="arg">newvalue</i></a></dt>
<dd><p>Set a single element of a matrix (or vector) to a new value</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p><em>name</em> of the matrix in question</p></dd>
<dt>integer <i class="arg">row</i></dt>
<dd><p>Row of the element</p></dd>
<dt>integer <i class="arg">col</i></dt>
<dd><p>Column of the element (not present for vectors)</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::math::linearalgebra::swaprows</b> <i class="arg">matrix</i> <i class="arg">irow1</i> <i class="arg">irow2</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></dt>
<dd><p>Swap two rows in a matrix completely or only a selected part</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p><em>name</em> of the matrix in question</p></dd>
<dt>integer <i class="arg">irow1</i></dt>
<dd><p>Index of first row</p></dd>
<dt>integer <i class="arg">irow2</i></dt>
<dd><p>Index of second row</p></dd>
<dt>integer <i class="arg">imin</i></dt>
<dd><p>Minimum column index (default: 0)</p></dd>
<dt>integer <i class="arg">imin</i></dt>
<dd><p>Maximum column index (default: ncols-1)</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::math::linearalgebra::swapcols</b> <i class="arg">matrix</i> <i class="arg">icol1</i> <i class="arg">icol2</i> <span class="opt">?imin?</span> <span class="opt">?imax?</span></a></dt>
<dd><p>Swap two columns in a matrix completely or only a selected part</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p><em>name</em> of the matrix in question</p></dd>
<dt>integer <i class="arg">irow1</i></dt>
<dd><p>Index of first column</p></dd>
<dt>integer <i class="arg">irow2</i></dt>
<dd><p>Index of second column</p></dd>
<dt>integer <i class="arg">imin</i></dt>
<dd><p>Minimum row index (default: 0)</p></dd>
<dt>integer <i class="arg">imin</i></dt>
<dd><p>Maximum row index (default: nrows-1)</p></dd>
</dl></dd>
</dl>
<p><em>Querying matrices and vectors</em></p>
<dl class="definitions">
<dt><a name="12"><b class="cmd">::math::linearalgebra::show</b> <i class="arg">obj</i> <span class="opt">?format?</span> <span class="opt">?rowsep?</span> <span class="opt">?colsep?</span></a></dt>
<dd><p>Return a string representing the vector or matrix, for easy printing.
(There is currently no way to print fixed sets of columns)</p>
<dl class="arguments">
<dt>list <i class="arg">obj</i></dt>
<dd><p>Matrix or vector in question</p></dd>
<dt>string <i class="arg">format</i></dt>
<dd><p>Format for printing the numbers (default: %6.4f)</p></dd>
<dt>string <i class="arg">rowsep</i></dt>
<dd><p>String to use for separating rows (default: newline)</p></dd>
<dt>string <i class="arg">colsep</i></dt>
<dd><p>String to use for separating columns (default: space)</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::math::linearalgebra::dim</b> <i class="arg">obj</i></a></dt>
<dd><p>Returns the number of dimensions for the object (either 0 for a scalar,
1 for a vector and 2 for a matrix)</p>
<dl class="arguments">
<dt>any <i class="arg">obj</i></dt>
<dd><p>Scalar, vector, or matrix</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">::math::linearalgebra::shape</b> <i class="arg">obj</i></a></dt>
<dd><p>Returns the number of elements in each dimension for the object (either
an empty list for a scalar, a single number for a vector and a list of
the number of rows and columns for a matrix)</p>
<dl class="arguments">
<dt>any <i class="arg">obj</i></dt>
<dd><p>Scalar, vector, or matrix</p></dd>
</dl></dd>
<dt><a name="15"><b class="cmd">::math::linearalgebra::conforming</b> <i class="arg">type</i> <i class="arg">obj1</i> <i class="arg">obj2</i></a></dt>
<dd><p>Checks if two objects (vector or matrix) have conforming shapes, that is
if they can be applied in an operation like addition or matrix
multiplication.</p>
<dl class="arguments">
<dt>string <i class="arg">type</i></dt>
<dd><p>Type of check:</p>
<ul class="itemized">
<li><p>&quot;shape&quot; - the two objects have the same shape (for all element-wise
operations)</p></li>
<li><p>&quot;rows&quot; - the two objects have the same number of rows (for use as A and
b in a system of linear equations <em>Ax = b</em></p></li>
<li><p>&quot;matmul&quot; - the first object has the same number of columns as the number
of rows of the second object. Useful for matrix-matrix or matrix-vector
multiplication.</p></li>
</ul></dd>
<dt>list <i class="arg">obj1</i></dt>
<dd><p>First vector or matrix (left operand)</p></dd>
<dt>list <i class="arg">obj2</i></dt>
<dd><p>Second vector or matrix (right operand)</p></dd>
</dl></dd>
<dt><a name="16"><b class="cmd">::math::linearalgebra::symmetric</b> <i class="arg">matrix</i> <span class="opt">?eps?</span></a></dt>
<dd><p>Checks if the given (square) matrix is symmetric. The argument eps
is the tolerance.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix to be inspected</p></dd>
<dt>float <i class="arg">eps</i></dt>
<dd><p>Tolerance for determining approximate equality
(defaults to 1.0e-8)</p></dd>
</dl></dd>
</dl>
<p><em>Basic operations</em></p>
<dl class="definitions">
<dt><a name="17"><b class="cmd">::math::linearalgebra::norm</b> <i class="arg">vector</i> <i class="arg">type</i></a></dt>
<dd><p>Returns the norm of the given vector. The type argument can be: 1,
2, inf or max, respectively the sum of absolute values, the ordinary
Euclidean norm or the max norm.</p>
<dl class="arguments">
<dt>list <i class="arg">vector</i></dt>
<dd><p>Vector, list of coefficients</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>Type of norm (default: 2, the Euclidean norm)</p></dd>
</dl></dd>
<dt><a name="18"><b class="cmd">::math::linearalgebra::norm_one</b> <i class="arg">vector</i></a></dt>
<dd><p>Returns the L1 norm of the given vector, the sum of absolute values</p>
<dl class="arguments">
<dt>list <i class="arg">vector</i></dt>
<dd><p>Vector, list of coefficients</p></dd>
</dl></dd>
<dt><a name="19"><b class="cmd">::math::linearalgebra::norm_two</b> <i class="arg">vector</i></a></dt>
<dd><p>Returns the L2 norm of the given vector, the ordinary Euclidean norm</p>
<dl class="arguments">
<dt>list <i class="arg">vector</i></dt>
<dd><p>Vector, list of coefficients</p></dd>
</dl></dd>
<dt><a name="20"><b class="cmd">::math::linearalgebra::norm_max</b> <i class="arg">vector</i> <span class="opt">?index?</span></a></dt>
<dd><p>Returns the Linf norm of the given vector, the maximum absolute
coefficient</p>
<dl class="arguments">
<dt>list <i class="arg">vector</i></dt>
<dd><p>Vector, list of coefficients</p></dd>
<dt>integer <i class="arg">index</i></dt>
<dd><p>(optional) if non zero, returns a list made of the maximum
value and the index where that maximum was found.
if zero, returns the maximum value.</p></dd>
</dl></dd>
<dt><a name="21"><b class="cmd">::math::linearalgebra::normMatrix</b> <i class="arg">matrix</i> <i class="arg">type</i></a></dt>
<dd><p>Returns the norm of the given matrix. The type argument can be: 1,
2, inf or max, respectively the sum of absolute values, the ordinary
Euclidean norm or the max norm.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix, list of row vectors</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>Type of norm (default: 2, the Euclidean norm)</p></dd>
</dl></dd>
<dt><a name="22"><b class="cmd">::math::linearalgebra::dotproduct</b> <i class="arg">vect1</i> <i class="arg">vect2</i></a></dt>
<dd><p>Determine the inproduct or dot product of two vectors. These must have
the same shape (number of dimensions)</p>
<dl class="arguments">
<dt>list <i class="arg">vect1</i></dt>
<dd><p>First vector, list of coefficients</p></dd>
<dt>list <i class="arg">vect2</i></dt>
<dd><p>Second vector, list of coefficients</p></dd>
</dl></dd>
<dt><a name="23"><b class="cmd">::math::linearalgebra::unitLengthVector</b> <i class="arg">vector</i></a></dt>
<dd><p>Return a vector in the same direction with length 1.</p>
<dl class="arguments">
<dt>list <i class="arg">vector</i></dt>
<dd><p>Vector to be normalized</p></dd>
</dl></dd>
<dt><a name="24"><b class="cmd">::math::linearalgebra::normalizeStat</b> <i class="arg">mv</i></a></dt>
<dd><p>Normalize the matrix or vector in a statistical sense: the mean of the
elements of the columns of the result is zero and the standard deviation
is 1.</p>
<dl class="arguments">
<dt>list <i class="arg">mv</i></dt>
<dd><p>Vector or matrix to be normalized in the above sense</p></dd>
</dl></dd>
<dt><a name="25"><b class="cmd">::math::linearalgebra::axpy</b> <i class="arg">scale</i> <i class="arg">mv1</i> <i class="arg">mv2</i></a></dt>
<dd><p>Return a vector or matrix that results from a &quot;daxpy&quot; operation, that
is: compute a*x+y (a a scalar and x and y both vectors or matrices of
the same shape) and return the result.</p>
<p>Specialised variants are: axpy_vect and axpy_mat (slightly faster,
but no check on the arguments)</p>
<dl class="arguments">
<dt>double <i class="arg">scale</i></dt>
<dd><p>The scale factor for the first vector/matrix (a)</p></dd>
<dt>list <i class="arg">mv1</i></dt>
<dd><p>First vector or matrix (x)</p></dd>
<dt>list <i class="arg">mv2</i></dt>
<dd><p>Second vector or matrix (y)</p></dd>
</dl></dd>
<dt><a name="26"><b class="cmd">::math::linearalgebra::add</b> <i class="arg">mv1</i> <i class="arg">mv2</i></a></dt>
<dd><p>Return a vector or matrix that is the sum of the two arguments (x+y)</p>
<p>Specialised variants are: add_vect and add_mat (slightly faster,
but no check on the arguments)</p>
<dl class="arguments">
<dt>list <i class="arg">mv1</i></dt>
<dd><p>First vector or matrix (x)</p></dd>
<dt>list <i class="arg">mv2</i></dt>
<dd><p>Second vector or matrix (y)</p></dd>
</dl></dd>
<dt><a name="27"><b class="cmd">::math::linearalgebra::sub</b> <i class="arg">mv1</i> <i class="arg">mv2</i></a></dt>
<dd><p>Return a vector or matrix that is the difference of the two arguments
(x-y)</p>
<p>Specialised variants are: sub_vect and sub_mat (slightly faster,
but no check on the arguments)</p>
<dl class="arguments">
<dt>list <i class="arg">mv1</i></dt>
<dd><p>First vector or matrix (x)</p></dd>
<dt>list <i class="arg">mv2</i></dt>
<dd><p>Second vector or matrix (y)</p></dd>
</dl></dd>
<dt><a name="28"><b class="cmd">::math::linearalgebra::scale</b> <i class="arg">scale</i> <i class="arg">mv</i></a></dt>
<dd><p>Scale a vector or matrix and return the result, that is: compute a*x.</p>
<p>Specialised variants are: scale_vect and scale_mat (slightly faster,
but no check on the arguments)</p>
<dl class="arguments">
<dt>double <i class="arg">scale</i></dt>
<dd><p>The scale factor for the vector/matrix (a)</p></dd>
<dt>list <i class="arg">mv</i></dt>
<dd><p>Vector or matrix (x)</p></dd>
</dl></dd>
<dt><a name="29"><b class="cmd">::math::linearalgebra::rotate</b> <i class="arg">c</i> <i class="arg">s</i> <i class="arg">vect1</i> <i class="arg">vect2</i></a></dt>
<dd><p>Apply a planar rotation to two vectors and return the result as a list
of two vectors: c*x-s*y and s*x+c*y. In algorithms you can often easily
determine the cosine and sine of the angle, so it is more efficient to
pass that information directly.</p>
<dl class="arguments">
<dt>double <i class="arg">c</i></dt>
<dd><p>The cosine of the angle</p></dd>
<dt>double <i class="arg">s</i></dt>
<dd><p>The sine of the angle</p></dd>
<dt>list <i class="arg">vect1</i></dt>
<dd><p>First vector (x)</p></dd>
<dt>list <i class="arg">vect2</i></dt>
<dd><p>Seocnd vector (x)</p></dd>
</dl></dd>
<dt><a name="30"><b class="cmd">::math::linearalgebra::transpose</b> <i class="arg">matrix</i></a></dt>
<dd><p>Transpose a matrix</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix to be transposed</p></dd>
</dl></dd>
<dt><a name="31"><b class="cmd">::math::linearalgebra::matmul</b> <i class="arg">mv1</i> <i class="arg">mv2</i></a></dt>
<dd><p>Multiply a vector/matrix with another vector/matrix. The result is
a matrix, if both x and y are matrices or both are vectors, in
which case the &quot;outer product&quot; is computed. If one is a vector and the
other is a matrix, then the result is a vector.</p>
<dl class="arguments">
<dt>list <i class="arg">mv1</i></dt>
<dd><p>First vector/matrix (x)</p></dd>
<dt>list <i class="arg">mv2</i></dt>
<dd><p>Second vector/matrix (y)</p></dd>
</dl></dd>
<dt><a name="32"><b class="cmd">::math::linearalgebra::angle</b> <i class="arg">vect1</i> <i class="arg">vect2</i></a></dt>
<dd><p>Compute the angle between two vectors (in radians)</p>
<dl class="arguments">
<dt>list <i class="arg">vect1</i></dt>
<dd><p>First vector</p></dd>
<dt>list <i class="arg">vect2</i></dt>
<dd><p>Second vector</p></dd>
</dl></dd>
<dt><a name="33"><b class="cmd">::math::linearalgebra::crossproduct</b> <i class="arg">vect1</i> <i class="arg">vect2</i></a></dt>
<dd><p>Compute the cross product of two (three-dimensional) vectors</p>
<dl class="arguments">
<dt>list <i class="arg">vect1</i></dt>
<dd><p>First vector</p></dd>
<dt>list <i class="arg">vect2</i></dt>
<dd><p>Second vector</p></dd>
</dl></dd>
<dt><a name="34"><b class="cmd">::math::linearalgebra::matmul</b> <i class="arg">mv1</i> <i class="arg">mv2</i></a></dt>
<dd><p>Multiply a vector/matrix with another vector/matrix. The result is
a matrix, if both x and y are matrices or both are vectors, in
which case the &quot;outer product&quot; is computed. If one is a vector and the
other is a matrix, then the result is a vector.</p>
<dl class="arguments">
<dt>list <i class="arg">mv1</i></dt>
<dd><p>First vector/matrix (x)</p></dd>
<dt>list <i class="arg">mv2</i></dt>
<dd><p>Second vector/matrix (y)</p></dd>
</dl></dd>
</dl>
<p><em>Common matrices and test matrices</em></p>
<dl class="definitions">
<dt><a name="35"><b class="cmd">::math::linearalgebra::mkIdentity</b> <i class="arg">size</i></a></dt>
<dd><p>Create an identity matrix of dimension <em>size</em>.</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="36"><b class="cmd">::math::linearalgebra::mkDiagonal</b> <i class="arg">diag</i></a></dt>
<dd><p>Create a diagonal matrix whose diagonal elements are the elements of the
vector <em>diag</em>.</p>
<dl class="arguments">
<dt>list <i class="arg">diag</i></dt>
<dd><p>Vector whose elements are used for the diagonal</p></dd>
</dl></dd>
<dt><a name="37"><b class="cmd">::math::linearalgebra::mkRandom</b> <i class="arg">size</i></a></dt>
<dd><p>Create a square matrix whose elements are uniformly distributed random
numbers between 0 and 1 of dimension <em>size</em>.</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="38"><b class="cmd">::math::linearalgebra::mkTriangular</b> <i class="arg">size</i> <span class="opt">?uplo?</span> <span class="opt">?value?</span></a></dt>
<dd><p>Create a triangular matrix with non-zero elements in the upper or lower
part, depending on argument <em>uplo</em>.</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
<dt>string <i class="arg">uplo</i></dt>
<dd><p>Fill the upper (U) or lower part (L)</p></dd>
<dt>double <i class="arg">value</i></dt>
<dd><p>Value to fill the matrix with</p></dd>
</dl></dd>
<dt><a name="39"><b class="cmd">::math::linearalgebra::mkHilbert</b> <i class="arg">size</i></a></dt>
<dd><p>Create a Hilbert matrix of dimension <em>size</em>.
Hilbert matrices are very ill-conditioned with respect to
eigenvalue/eigenvector problems. Therefore they
are good candidates for testing the accuracy
of algorithms and implementations.</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="40"><b class="cmd">::math::linearalgebra::mkDingdong</b> <i class="arg">size</i></a></dt>
<dd><p>Create a &quot;dingdong&quot; matrix of dimension <em>size</em>.
Dingdong matrices are imprecisely represented,
but have the property of being very stable in
such algorithms as Gauss elimination.</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="41"><b class="cmd">::math::linearalgebra::mkOnes</b> <i class="arg">size</i></a></dt>
<dd><p>Create a square matrix of dimension <em>size</em> whose entries are all 1.</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="42"><b class="cmd">::math::linearalgebra::mkMoler</b> <i class="arg">size</i></a></dt>
<dd><p>Create a Moler matrix of size <em>size</em>. (Moler matrices have
a very simple Choleski decomposition. It has one small eigenvalue
and it can easily upset elimination methods for systems of linear
equations.)</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="43"><b class="cmd">::math::linearalgebra::mkFrank</b> <i class="arg">size</i></a></dt>
<dd><p>Create a Frank matrix of size <em>size</em>. (Frank matrices are
fairly well-behaved matrices)</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="44"><b class="cmd">::math::linearalgebra::mkBorder</b> <i class="arg">size</i></a></dt>
<dd><p>Create a bordered matrix of size <em>size</em>. (Bordered matrices have
a very low rank and can upset certain specialised algorithms.)</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="45"><b class="cmd">::math::linearalgebra::mkWilkinsonW+</b> <i class="arg">size</i></a></dt>
<dd><p>Create a Wilkinson W+ of size <em>size</em>. This kind of matrix
has pairs of eigenvalues that are very close together. Usually
the order (size) is odd.</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
<dt><a name="46"><b class="cmd">::math::linearalgebra::mkWilkinsonW-</b> <i class="arg">size</i></a></dt>
<dd><p>Create a Wilkinson W- of size <em>size</em>. This kind of matrix
has pairs of eigenvalues with opposite signs, when the order (size)
is odd.</p>
<dl class="arguments">
<dt>integer <i class="arg">size</i></dt>
<dd><p>Dimension of the matrix</p></dd>
</dl></dd>
</dl>
<p><em>Common algorithms</em></p>
<dl class="definitions">
<dt><a name="47"><b class="cmd">::math::linearalgebra::solveGauss</b> <i class="arg">matrix</i> <i class="arg">bvect</i></a></dt>
<dd><p>Solve a system of linear equations (Ax=b) using Gauss elimination.
Returns the solution (x) as a vector or matrix of the same shape as
bvect.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Square matrix (matrix A)</p></dd>
<dt>list <i class="arg">bvect</i></dt>
<dd><p>Vector or matrix whose columns are the individual
b-vectors</p></dd>
</dl></dd>
<dt><a name="48"><b class="cmd">::math::linearalgebra::solvePGauss</b> <i class="arg">matrix</i> <i class="arg">bvect</i></a></dt>
<dd><p>Solve a system of linear equations (Ax=b) using Gauss elimination with
partial pivoting. Returns the solution (x) as a vector or matrix of the
same shape as bvect.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Square matrix (matrix A)</p></dd>
<dt>list <i class="arg">bvect</i></dt>
<dd><p>Vector or matrix whose columns are the individual
b-vectors</p></dd>
</dl></dd>
<dt><a name="49"><b class="cmd">::math::linearalgebra::solveTriangular</b> <i class="arg">matrix</i> <i class="arg">bvect</i> <span class="opt">?uplo?</span></a></dt>
<dd><p>Solve a system of linear equations (Ax=b) by backward substitution. The
matrix is supposed to be upper-triangular.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Lower or upper-triangular matrix (matrix A)</p></dd>
<dt>list <i class="arg">bvect</i></dt>
<dd><p>Vector or matrix whose columns are the individual
b-vectors</p></dd>
<dt>string <i class="arg">uplo</i></dt>
<dd><p>Indicates whether the matrix is lower-triangular
(L) or upper-triangular (U). Defaults to &quot;U&quot;.</p></dd>
</dl></dd>
<dt><a name="50"><b class="cmd">::math::linearalgebra::solveGaussBand</b> <i class="arg">matrix</i> <i class="arg">bvect</i></a></dt>
<dd><p>Solve a system of linear equations (Ax=b) using Gauss elimination,
where the matrix is stored as a band matrix (<em>cf.</em> <span class="sectref"><a href="#section3">STORAGE</a></span>).
Returns the solution (x) as a vector or matrix of the same shape as
bvect.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Square matrix (matrix A; in band form)</p></dd>
<dt>list <i class="arg">bvect</i></dt>
<dd><p>Vector or matrix whose columns are the individual
b-vectors</p></dd>
</dl></dd>
<dt><a name="51"><b class="cmd">::math::linearalgebra::solveTriangularBand</b> <i class="arg">matrix</i> <i class="arg">bvect</i></a></dt>
<dd><p>Solve a system of linear equations (Ax=b) by backward substitution. The
matrix is supposed to be upper-triangular and stored in band form.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Upper-triangular matrix (matrix A)</p></dd>
<dt>list <i class="arg">bvect</i></dt>
<dd><p>Vector or matrix whose columns are the individual
b-vectors</p></dd>
</dl></dd>
<dt><a name="52"><b class="cmd">::math::linearalgebra::determineSVD</b> <i class="arg">A</i> <i class="arg">eps</i></a></dt>
<dd><p>Determines the Singular Value Decomposition of a matrix: A = U S Vtrans.
Returns a list with the matrix U, the vector of singular values S and
the matrix V.</p>
<dl class="arguments">
<dt>list <i class="arg">A</i></dt>
<dd><p>Matrix to be decomposed</p></dd>
<dt>float <i class="arg">eps</i></dt>
<dd><p>Tolerance (defaults to 2.3e-16)</p></dd>
</dl></dd>
<dt><a name="53"><b class="cmd">::math::linearalgebra::eigenvectorsSVD</b> <i class="arg">A</i> <i class="arg">eps</i></a></dt>
<dd><p>Determines the eigenvectors and eigenvalues of a real
<em>symmetric</em> matrix, using SVD. Returns a list with the matrix of
normalized eigenvectors and their eigenvalues.</p>
<dl class="arguments">
<dt>list <i class="arg">A</i></dt>
<dd><p>Matrix whose eigenvalues must be determined</p></dd>
<dt>float <i class="arg">eps</i></dt>
<dd><p>Tolerance (defaults to 2.3e-16)</p></dd>
</dl></dd>
<dt><a name="54"><b class="cmd">::math::linearalgebra::leastSquaresSVD</b> <i class="arg">A</i> <i class="arg">y</i> <i class="arg">qmin</i> <i class="arg">eps</i></a></dt>
<dd><p>Determines the solution to a least-sqaures problem Ax ~ y via singular
value decomposition. The result is the vector x.</p>
<p>Note that if you add a column of 1s to the matrix, then this column will
represent a constant like in: y = a*x1 + b*x2 + c. To force the
intercept to be zero, simply leave it out.</p>
<dl class="arguments">
<dt>list <i class="arg">A</i></dt>
<dd><p>Matrix of independent variables</p></dd>
<dt>list <i class="arg">y</i></dt>
<dd><p>List of observed values</p></dd>
<dt>float <i class="arg">qmin</i></dt>
<dd><p>Minimum singular value to be considered (defaults to 0.0)</p></dd>
<dt>float <i class="arg">eps</i></dt>
<dd><p>Tolerance (defaults to 2.3e-16)</p></dd>
</dl></dd>
<dt><a name="55"><b class="cmd">::math::linearalgebra::choleski</b> <i class="arg">matrix</i></a></dt>
<dd><p>Determine the Choleski decomposition of a symmetric positive
semidefinite matrix (this condition is not checked!). The result
is the lower-triangular matrix L such that L Lt = matrix.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix to be decomposed</p></dd>
</dl></dd>
<dt><a name="56"><b class="cmd">::math::linearalgebra::orthonormalizeColumns</b> <i class="arg">matrix</i></a></dt>
<dd><p>Use the modified Gram-Schmidt method to orthogonalize and normalize
the <em>columns</em> of the given matrix and return the result.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix whose columns must be orthonormalized</p></dd>
</dl></dd>
<dt><a name="57"><b class="cmd">::math::linearalgebra::orthonormalizeRows</b> <i class="arg">matrix</i></a></dt>
<dd><p>Use the modified Gram-Schmidt method to orthogonalize and normalize
the <em>rows</em> of the given matrix and return the result.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix whose rows must be orthonormalized</p></dd>
</dl></dd>
<dt><a name="58"><b class="cmd">::math::linearalgebra::dger</b> <i class="arg">matrix</i> <i class="arg">alpha</i> <i class="arg">x</i> <i class="arg">y</i> <span class="opt">?scope?</span></a></dt>
<dd><p>Perform the rank 1 operation A + alpha*x*y' inline (that is: the matrix A is adjusted).
For convenience the new matrix is also returned as the result.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Matrix whose rows must be adjusted</p></dd>
<dt>double <i class="arg">alpha</i></dt>
<dd><p>Scale factor</p></dd>
<dt>list <i class="arg">x</i></dt>
<dd><p>A column vector</p></dd>
<dt>list <i class="arg">y</i></dt>
<dd><p>A column vector</p></dd>
<dt>list <i class="arg">scope</i></dt>
<dd><p>If not provided, the operation is performed on all rows/columns of A
if provided, it is expected to be the list {imin imax jmin jmax}
where:</p>
<ul class="itemized">
<li><p><i class="term">imin</i> Minimum row index</p></li>
<li><p><i class="term">imax</i> Maximum row index</p></li>
<li><p><i class="term">jmin</i> Minimum column index</p></li>
<li><p><i class="term">jmax</i> Maximum column index</p></li>
</ul></dd>
</dl></dd>
<dt><a name="59"><b class="cmd">::math::linearalgebra::dgetrf</b> <i class="arg">matrix</i></a></dt>
<dd><p>Computes an LU factorization of a general matrix, using partial,
pivoting with row interchanges. Returns the permutation vector.</p>
<p>The factorization has the form</p>
<pre class="example">
   P * A = L * U
</pre>
<p>where P is a permutation matrix, L is lower triangular with unit
diagonal elements, and U is upper triangular.
Returns the permutation vector, as a list of length n-1.
The last entry of the permutation is not stored, since it is
implicitely known, with value n (the last row is not swapped
with any other row).
At index #i of the permutation is stored the index of the row #j
which is swapped with row #i at step #i. That means that each
index of the permutation gives the permutation at each step, not the
cumulated permutation matrix, which is the product of permutations.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>On entry, the matrix to be factored.
On exit, the factors L and U from the factorization
P*A = L*U; the unit diagonal elements of L are not stored.</p></dd>
</dl></dd>
<dt><a name="60"><b class="cmd">::math::linearalgebra::det</b> <i class="arg">matrix</i></a></dt>
<dd><p>Returns the determinant of the given matrix, based on PA=LU
decomposition, i.e. Gauss partial pivotal.</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Square matrix (matrix A)</p></dd>
<dt>list <i class="arg">ipiv</i></dt>
<dd><p>The pivots (optionnal).
If the pivots are not provided, a PA=LU decomposition
is performed.
If the pivots are provided, we assume that it
contains the pivots and that the matrix A contains the
L and U factors, as provided by dgterf.
b-vectors</p></dd>
</dl></dd>
<dt><a name="61"><b class="cmd">::math::linearalgebra::largesteigen</b> <i class="arg">matrix</i> <i class="arg">tolerance</i> <i class="arg">maxiter</i></a></dt>
<dd><p>Returns a list made of the largest eigenvalue (in magnitude)
and associated eigenvector.
Uses iterative Power Method as provided as algorithm #7.3.3 of Golub &amp; Van Loan.
This algorithm is used here for a dense matrix (but is usually
used for sparse matrices).</p>
<dl class="arguments">
<dt>list <i class="arg">matrix</i></dt>
<dd><p>Square matrix (matrix A)</p></dd>
<dt>double <i class="arg">tolerance</i></dt>
<dd><p>The relative tolerance of the eigenvalue (default:1.e-8).</p></dd>
<dt>integer <i class="arg">maxiter</i></dt>
<dd><p>The maximum number of iterations (default:10).</p></dd>
</dl></dd>
</dl>
<p><em>Compability with the LA package</em>
Two procedures are provided for compatibility with Hume's LA package:</p>
<dl class="definitions">
<dt><a name="62"><b class="cmd">::math::linearalgebra::to_LA</b> <i class="arg">mv</i></a></dt>
<dd><p>Transforms a vector or matrix into the format used by the original LA
package.</p>
<dl class="arguments">
<dt>list <i class="arg">mv</i></dt>
<dd><p>Matrix or vector</p></dd>
</dl></dd>
<dt><a name="63"><b class="cmd">::math::linearalgebra::from_LA</b> <i class="arg">mv</i></a></dt>
<dd><p>Transforms a vector or matrix from the format used by the original LA
package into the format used by the present implementation.</p>
<dl class="arguments">
<dt>list <i class="arg">mv</i></dt>
<dd><p>Matrix or vector as used by the LA package</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">STORAGE</a></h2>
<p>While most procedures assume that the matrices are given in full form,
the procedures <em>solveGaussBand</em> and <em>solveTriangularBand</em>
assume that the matrices are stored as <em>band matrices</em>. This
common type of &quot;sparse&quot; matrices is related to ordinary matrices as
follows:</p>
<ul class="itemized">
<li><p>&quot;A&quot; is a full-size matrix with N rows and M columns.</p></li>
<li><p>&quot;B&quot; is a band matrix, with m upper and lower diagonals and n rows.</p></li>
<li><p>&quot;B&quot; can be stored in an ordinary matrix of (2m+1) columns (one for
each off-diagonal and the main diagonal) and n rows.</p></li>
<li><p>Element i,j (i = -m,...,m; j =1,...,n) of &quot;B&quot; corresponds to element
k,j of &quot;A&quot; where k = M+i-1 and M is at least (!) n, the number of rows
in &quot;B&quot;.</p></li>
<li><p>To set element (i,j) of matrix &quot;B&quot; use:</p>
<pre class="example">
    setelem B $j [expr {$N+$i-1}] $value
</pre>
</li>
</ul>
<p>(There is no convenience procedure for this yet)</p>
</div>
<div id="section4" class="section"><h2><a name="section4">REMARKS ON THE IMPLEMENTATION</a></h2>
<p>There is a difference between the original LA package by Hume and the
current implementation. Whereas the LA package uses a linear list, the
current package uses lists of lists to represent matrices. It turns out
that with this representation, the algorithms are faster and easier to
implement.</p>
<p>The LA package was used as a model and in fact the implementation of,
for instance, the SVD algorithm was taken from that package. The set of
procedures was expanded using ideas from the well-known BLAS library and
some algorithms were updated from the second edition of J.C. Nash's
book, Compact Numerical Methods for Computers, (Adam Hilger, 1990) that
inspired the LA package.</p>
<p>Two procedures are provided to make the transition between the two
implementations easier: <em>to_LA</em> and <em>from_LA</em>. They are
described above.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">TODO</a></h2>
<p>Odds and ends: the following algorithms have not been implemented yet:</p>
<ul class="itemized">
<li><p>determineQR</p></li>
<li><p>certainlyPositive, diagonallyDominant</p></li>
</ul>
</div>
<div id="section6" class="section"><h2><a name="section6">NAMING CONFLICT</a></h2>
<p>If you load this package in a Tk-enabled shell like wish, then the
command</p>
<pre class="example">namespace import ::math::linearalgebra</pre>
<p>results in an error
message about &quot;scale&quot;. This is due to the fact that Tk defines all
its commands in the global namespace. The solution is to import
the linear algebra commands in a namespace that is not the global one:</p>
<pre class="example">
package require math::linearalgebra
namespace eval compute {
    namespace import ::math::linearalgebra::*
    ... use the linear algebra version of scale ...
}
</pre>
<p>To use Tk's scale command in that same namespace you can rename it:</p>
<pre class="example">
namespace eval compute {
    rename ::scale scaleTk
    scaleTk .scale ...
}
</pre>
</div>
<div id="section7" class="section"><h2><a name="section7">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: linearalgebra</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key64">least squares</a>, <a href="../../../../index.html#key65">linear algebra</a>, <a href="../../../../index.html#key62">linear equations</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key63">matrices</a>, <a href="../../../../index.html#key55">matrix</a>, <a href="../../../../index.html#key66">vectors</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004-2008 Arjen Markus &lt;[email protected]&gt;<br>
Copyright &copy; 2004 Ed Hume &lt;http://www.hume.com/contact.us.htm&gt;<br>
Copyright &copy; 2008 Michael Buadin &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/machineparameters.html.




























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tclrep/machineparameters - tclrep</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/machineparameters.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Michael Baudin &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tclrep/machineparameters.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tclrep/machineparameters(n) 1.0 tcllib &quot;tclrep&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tclrep/machineparameters - Compute double precision machine parameters.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLE</a></li>
<li class="section"><a href="#section3">REFERENCES</a></li>
<li class="section"><a href="#section4">CLASS API</a></li>
<li class="section"><a href="#section5">OBJECT API</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">machineparameters</b> create <i class="arg">objectname</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><i class="arg">objectname</i> <b class="method">configure</b> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#3"><i class="arg">objectname</i> <b class="method">cget</b> <i class="arg">opt</i></a></li>
<li><a href="#4"><i class="arg">objectname</i> <b class="method">destroy</b></a></li>
<li><a href="#5"><i class="arg">objectname</i> <b class="method">compute</b></a></li>
<li><a href="#6"><i class="arg">objectname</i> <b class="method">get</b> <i class="arg">key</i></a></li>
<li><a href="#7"><i class="arg">objectname</i> <b class="method">tostring</b></a></li>
<li><a href="#8"><i class="arg">objectname</i> <b class="method">print</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <em>math::machineparameters</em> package
is the Tcl equivalent of the DLAMCH LAPACK function.
In floating point systems, a floating point number is represented
by</p>
<pre class="example">
x = +/- d1 d2 ... dt basis^e
</pre>
<p>where digits satisfy</p>
<pre class="example">
0 &lt;= di &lt;= basis - 1, i = 1, t
</pre>
<p>with the convention :</p>
<ul class="itemized">
<li><p>t is the size of the mantissa</p></li>
<li><p>basis is the basis (the &quot;radix&quot;)</p></li>
</ul>
<p>The <b class="method">compute</b> method computes all machine parameters.
   Then, the <b class="method">get</b> method can be used to get each
   parameter.
   The <b class="method">print</b> method prints a report on standard output.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLE</a></h2>
<p>In the following example, one compute the parameters of a desktop
under Linux with the following Tcl 8.4.19 properties :</p>
<pre class="example">
% parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine)   = i686
tcl_platform(os)        = Linux
tcl_platform(osVersion) = 2.6.24-19-generic
tcl_platform(platform)  = unix
tcl_platform(tip,268)   = 1
tcl_platform(tip,280)   = 1
tcl_platform(user)      = &lt;username&gt;
tcl_platform(wordSize)  = 4
</pre>
<p>The following example creates a machineparameters object,
   computes the properties and displays it.</p>
<pre class="example">
     set pp [machineparameters create %AUTO%]
     $pp compute
     $pp print
     $pp destroy
</pre>
<p>This prints out :</p>
<pre class="example">
     Machine parameters
     Epsilon : 1.11022302463e-16
     Beta : 2
     Rounding : proper
     Mantissa : 53
     Maximum exponent : 1024
     Minimum exponent : -1021
     Overflow threshold : 8.98846567431e+307
     Underflow threshold : 2.22507385851e-308
</pre>
<p>That compares well with the results produced by Lapack 3.1.1 :</p>
<pre class="example">
     Epsilon                      =   1.11022302462515654E-016
     Safe minimum                 =   2.22507385850720138E-308
     Base                         =    2.0000000000000000
     Precision                    =   2.22044604925031308E-016
     Number of digits in mantissa =    53.000000000000000
     Rounding mode                =   1.00000000000000000
     Minimum exponent             =   -1021.0000000000000
     Underflow threshold          =   2.22507385850720138E-308
     Largest exponent             =    1024.0000000000000
     Overflow threshold           =   1.79769313486231571E+308
     Reciprocal of safe minimum   =   4.49423283715578977E+307
</pre>
<p>The following example creates a machineparameters object,
   computes the properties and gets the epsilon for
   the machine.</p>
<pre class="example">
     set pp [machineparameters create %AUTO%]
     $pp compute
     set eps [$pp get -epsilon]
     $pp destroy
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">REFERENCES</a></h2>
<ul class="itemized">
<li><p>&quot;Algorithms to Reveal Properties of Floating-Point Arithmetic&quot;, Michael A. Malcolm, Stanford University, Communications of the ACM, Volume 15 ,  Issue 11  (November 1972), Pages: 949 - 951</p></li>
<li><p>&quot;More on Algorithms that Reveal Properties of Floating, Point Arithmetic Units&quot;, W. Morven Gentleman, University of Waterloo, Scott B. Marovich, Purdue University, Communications of the ACM, Volume 17 ,  Issue 5  (May 1974), Pages: 276 - 277</p></li>
</ul>
</div>
<div id="section4" class="section"><h2><a name="section4">CLASS API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">machineparameters</b> create <i class="arg">objectname</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>The command creates a new machineparameters object and returns the fully
qualified name of the object command as its result.</p>
<dl class="options">
<dt><b class="option">-verbose</b> <i class="arg">verbose</i></dt>
<dd><p>Set this option to 1 to enable verbose logging.
This option is mainly for debug purposes.
The default value of <i class="arg">verbose</i> is 0.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">OBJECT API</a></h2>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectname</i> <b class="method">configure</b> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>The command configure the options of the object <i class="arg">objectname</i>. The options
are the same as the static method <b class="method">create</b>.</p></dd>
<dt><a name="3"><i class="arg">objectname</i> <b class="method">cget</b> <i class="arg">opt</i></a></dt>
<dd><p>Returns the value of the option which name is <i class="arg">opt</i>. The options
are the same as the method <b class="method">create</b> and <b class="method">configure</b>.</p></dd>
<dt><a name="4"><i class="arg">objectname</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the object <i class="arg">objectname</i>.</p></dd>
<dt><a name="5"><i class="arg">objectname</i> <b class="method">compute</b></a></dt>
<dd><p>Computes the machine parameters.</p></dd>
<dt><a name="6"><i class="arg">objectname</i> <b class="method">get</b> <i class="arg">key</i></a></dt>
<dd><p>Returns the value corresponding with given key.
The following is the list of available keys.</p>
<ul class="itemized">
<li><p>-epsilon : smallest value so that 1+epsilon&gt;1 is false</p></li>
<li><p>-rounding : The rounding mode used on the machine.
The rounding occurs when more than t digits would be required to
represent the number.
Two modes can be determined with the current system :
&quot;chop&quot; means than only t digits are kept, no matter the value of the number
&quot;proper&quot; means that another rounding mode is used, be it &quot;round to nearest&quot;,
&quot;round up&quot;, &quot;round down&quot;.</p></li>
<li><p>-basis : the basis of the floating-point representation.
The basis is usually 2, i.e. binary representation (for example IEEE 754 machines),
but some machines (like HP calculators for example) uses 10, or 16, etc...</p></li>
<li><p>-mantissa : the number of bits in the mantissa</p></li>
<li><p>-exponentmax :  the largest positive exponent before overflow occurs</p></li>
<li><p>-exponentmin : the largest negative exponent before (gradual) underflow occurs</p></li>
<li><p>-vmax : largest positive value before overflow occurs</p></li>
<li><p>-vmin : largest negative value before (gradual) underflow occurs</p></li>
</ul></dd>
<dt><a name="7"><i class="arg">objectname</i> <b class="method">tostring</b></a></dt>
<dd><p>Return a report for machine parameters.</p></dd>
<dt><a name="8"><i class="arg">objectname</i> <b class="method">print</b></a></dt>
<dd><p>Print machine parameters on standard output.</p></dd>
</dl>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Michael Baudin &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/math.html.































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/math.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ math.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math(n) 1.2.5 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math - Tcl Math Library</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BASIC COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">math <span class="opt">?1.2.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::cov</b> <i class="arg">value</i> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::math::integrate</b> <i class="arg">list of xy value pairs</i></a></li>
<li><a href="#3"><b class="cmd">::math::fibonacci</b> <i class="arg">n</i></a></li>
<li><a href="#4"><b class="cmd">::math::max</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::math::mean</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::math::min</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::math::product</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::math::random</b> <span class="opt">?<i class="arg">value1</i>?</span> <span class="opt">?<i class="arg">value2</i>?</span></a></li>
<li><a href="#9"><b class="cmd">::math::sigma</b> <i class="arg">value</i> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::math::stats</b> <i class="arg">value</i> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
<li><a href="#11"><b class="cmd">::math::sum</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">math</b> package provides utility math functions.</p>
<p>Besides a set of basic commands, available via the package <em>math</em>,
there are more specialised packages:</p>
<ul class="itemized">
<li><p><b class="package"><a href="bigfloat.html">math::bigfloat</a></b> - Arbitrary-precision floating-point
arithmetic</p></li>
<li><p><b class="package"><a href="bignum.html">math::bignum</a></b> - Arbitrary-precision integer arithmetic</p></li>
<li><p><b class="package"><a href="romberg.html">math::calculus::romberg</a></b> - Robust integration methods for
functions of one variable, using Romberg integration</p></li>
<li><p><b class="package"><a href="calculus.html">math::calculus</a></b> - Integration of functions, solving ordinary
differential equations</p></li>
<li><p><b class="package"><a href="combinatorics.html">math::combinatorics</a></b> - Procedures for various combinatorial
functions (for instance the Gamma function and &quot;k out of n&quot;)</p></li>
<li><p><b class="package"><a href="qcomplex.html">math::complexnumbers</a></b> - Complex number arithmetic</p></li>
<li><p><b class="package"><a href="constants.html">math::constants</a></b> - A set of well-known mathematical
constants, such as Pi, E, and the golden ratio</p></li>
<li><p><b class="package"><a href="fourier.html">math::fourier</a></b> - Discrete Fourier transforms</p></li>
<li><p><b class="package"><a href="fuzzy.html">math::fuzzy</a></b> - Fuzzy comparisons of floating-point numbers</p></li>
<li><p><b class="package"><a href="math_geometry.html">math::geometry</a></b> - 2D geometrical computations</p></li>
<li><p><b class="package"><a href="interpolate.html">math::interpolate</a></b> - Various interpolation methods</p></li>
<li><p><b class="package"><a href="linalg.html">math::linearalgebra</a></b> - Linear algebra package</p></li>
<li><p><b class="package"><a href="optimize.html">math::optimize</a></b> - Optimization methods</p></li>
<li><p><b class="package"><a href="polynomials.html">math::polynomials</a></b> - Polynomial arithmetic (includes families
of classical polynomials)</p></li>
<li><p><b class="package"><a href="rational_funcs.html">math::rationalfunctions</a></b> - Arithmetic of rational functions</p></li>
<li><p><b class="package"><a href="roman.html">math::roman</a></b> - Manipulation (including arithmetic) of Roman
numerals</p></li>
<li><p><b class="package"><a href="special.html">math::special</a></b> - Approximations of special functions from
mathematical physics</p></li>
<li><p><b class="package"><a href="statistics.html">math::statistics</a></b> - Statistical operations and tests</p></li>
</ul>
</div>
<div id="section2" class="section"><h2><a name="section2">BASIC COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::cov</b> <i class="arg">value</i> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Return the coefficient of variation expressed as percent of two or
more numeric values.</p></dd>
<dt><a name="2"><b class="cmd">::math::integrate</b> <i class="arg">list of xy value pairs</i></a></dt>
<dd><p>Return the area under a &quot;curve&quot; defined by a set of x,y pairs and the
error bound as a list.</p></dd>
<dt><a name="3"><b class="cmd">::math::fibonacci</b> <i class="arg">n</i></a></dt>
<dd><p>Return the <i class="arg">n</i>'th Fibonacci number.</p></dd>
<dt><a name="4"><b class="cmd">::math::max</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Return the maximum of one or more numeric values.</p></dd>
<dt><a name="5"><b class="cmd">::math::mean</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Return the mean, or &quot;average&quot; of one or more numeric values.</p></dd>
<dt><a name="6"><b class="cmd">::math::min</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Return the minimum of one or more numeric values.</p></dd>
<dt><a name="7"><b class="cmd">::math::product</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Return the product of one or more numeric values.</p></dd>
<dt><a name="8"><b class="cmd">::math::random</b> <span class="opt">?<i class="arg">value1</i>?</span> <span class="opt">?<i class="arg">value2</i>?</span></a></dt>
<dd><p>Return a random number.  If no arguments are given, the number is a
floating point value between 0 and 1.  If one argument is given, the
number is an integer value between 0 and <i class="arg">value1</i>.  If two
arguments are given, the number is an integer value between
<i class="arg">value1</i> and <i class="arg">value2</i>.</p></dd>
<dt><a name="9"><b class="cmd">::math::sigma</b> <i class="arg">value</i> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Return the population standard deviation of two or more numeric
values.</p></dd>
<dt><a name="10"><b class="cmd">::math::stats</b> <i class="arg">value</i> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Return the mean, standard deviation, and coefficient of variation (as
percent) as a list.</p></dd>
<dt><a name="11"><b class="cmd">::math::sum</b> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Return the sum of one or more numeric values.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key174">statistics</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/math_geometry.html.









































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::geometry - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/math_geometry.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2001 by Ideogramic ApS and other parties   -- Copyright &copy; 2004 by Arjen Markus   -- Copyright &copy; 2010 by Andreas Kupries   -- Copyright &copy; 2010 by Kevin Kenny
   -->
<! -- CVS: $Id$ math::geometry.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::geometry(n) 1.1.2 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::geometry - Geometrical computations</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.3?</span></b></li>
<li>package require <b class="pkgname">math::geometry <span class="opt">?1.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::geometry::+</b> <i class="arg">point1</i> <i class="arg">point2</i></a></li>
<li><a href="#2"><b class="cmd">::math::geometry::-</b> <i class="arg">point1</i> <i class="arg">point2</i></a></li>
<li><a href="#3"><b class="cmd">::math::geometry::p</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#4"><b class="cmd">::math::geometry::distance</b> <i class="arg">point1</i> <i class="arg">point2</i></a></li>
<li><a href="#5"><b class="cmd">::math::geometry::length</b> <i class="arg">point</i></a></li>
<li><a href="#6"><b class="cmd">::math::geometry::s*</b> <i class="arg">factor</i> <i class="arg">point</i></a></li>
<li><a href="#7"><b class="cmd">::math::geometry::direction</b> <i class="arg">angle</i></a></li>
<li><a href="#8"><b class="cmd">::math::geometry::h</b> <i class="arg">length</i></a></li>
<li><a href="#9"><b class="cmd">::math::geometry::v</b> <i class="arg">length</i></a></li>
<li><a href="#10"><b class="cmd">::math::geometry::between</b> <i class="arg">point1</i> <i class="arg">point2</i> <i class="arg">s</i></a></li>
<li><a href="#11"><b class="cmd">::math::geometry::octant</b> <i class="arg">point</i></a></li>
<li><a href="#12"><b class="cmd">::math::geometry::rect</b> <i class="arg">nw</i> <i class="arg">se</i></a></li>
<li><a href="#13"><b class="cmd">::math::geometry::nwse</b> <i class="arg">rect</i></a></li>
<li><a href="#14"><b class="cmd">::math::geometry::angle</b> <i class="arg">line</i></a></li>
<li><a href="#15"><b class="cmd">::math::geometry::calculateDistanceToLine</b> <i class="arg">P</i> <i class="arg">line</i></a></li>
<li><a href="#16"><b class="cmd">::math::geometry::calculateDistanceToLineSegment</b> <i class="arg">P</i> <i class="arg">linesegment</i></a></li>
<li><a href="#17"><b class="cmd">::math::geometry::calculateDistanceToPolyline</b> <i class="arg">P</i> <i class="arg">polyline</i></a></li>
<li><a href="#18"><b class="cmd">::math::geometry::findClosestPointOnLine</b> <i class="arg">P</i> <i class="arg">line</i></a></li>
<li><a href="#19"><b class="cmd">::math::geometry::findClosestPointOnLineSegment</b> <i class="arg">P</i> <i class="arg">linesegment</i></a></li>
<li><a href="#20"><b class="cmd">::math::geometry::findClosestPointOnPolyline</b> <i class="arg">P</i> <i class="arg">polyline</i></a></li>
<li><a href="#21"><b class="cmd">::math::geometry::lengthOfPolyline</b> <i class="arg">polyline</i></a></li>
<li><a href="#22"><b class="cmd">::math::geometry::movePointInDirection</b> <i class="arg">P</i> <i class="arg">direction</i> <i class="arg">dist</i></a></li>
<li><a href="#23"><b class="cmd">::math::geometry::lineSegmentsIntersect</b> <i class="arg">linesegment1</i> <i class="arg">linesegment2</i></a></li>
<li><a href="#24"><b class="cmd">::math::geometry::findLineSegmentIntersection</b> <i class="arg">linesegment1</i> <i class="arg">linesegment2</i></a></li>
<li><a href="#25"><b class="cmd">::math::geometry::findLineIntersection</b> <i class="arg">line1</i> <i class="arg">line2</i></a></li>
<li><a href="#26"><b class="cmd">::math::geometry::polylinesIntersect</b> <i class="arg">polyline1</i> <i class="arg">polyline2</i></a></li>
<li><a href="#27"><b class="cmd">::math::geometry::polylinesBoundingIntersect</b> <i class="arg">polyline1</i> <i class="arg">polyline2</i> <i class="arg">granularity</i></a></li>
<li><a href="#28"><b class="cmd">::math::geometry::intervalsOverlap</b> <i class="arg">y1</i> <i class="arg">y2</i> <i class="arg">y3</i> <i class="arg">y4</i> <i class="arg">strict</i></a></li>
<li><a href="#29"><b class="cmd">::math::geometry::rectanglesOverlap</b> <i class="arg">P1</i> <i class="arg">P2</i> <i class="arg">Q1</i> <i class="arg">Q2</i> <i class="arg">strict</i></a></li>
<li><a href="#30"><b class="cmd">::math::geometry::bbox</b> <i class="arg">polyline</i></a></li>
<li><a href="#31"><b class="cmd">::math::geometry::pointInsidePolygon</b> <i class="arg">P</i> <i class="arg">polyline</i></a></li>
<li><a href="#32"><b class="cmd">::math::geometry::rectangleInsidePolygon</b> <i class="arg">P1</i> <i class="arg">P2</i> <i class="arg">polyline</i></a></li>
<li><a href="#33"><b class="cmd">::math::geometry::areaPolygon</b> <i class="arg">polygon</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">math::geometry</b> package is a collection of functions for
computations and manipulations on two-dimensional geometrical objects,
such as points, lines and polygons.</p>
<p>The geometrical objects are implemented as plain lists of coordinates.
For instance a line is defined by a list of four numbers, the x- and
y-coordinate of a first point and the x- and y-coordinates of a second
point on the line.</p>
<p>The various types of object are recognised by the number of coordinate
pairs and the context in which they are used: a list of four elements
can be regarded as an infinite line, a finite line segment but also
as a polyline of one segment and a point set of two points.</p>
<p>Currently the following types of objects are distinguished:</p>
<ul class="itemized">
<li><p><em>point</em> - a list of two coordinates representing the x- and
y-coordinates respectively.</p></li>
<li><p><em>line</em> - a list of four coordinates, interpreted as the x- and
y-coordinates of two distinct points on the line.</p></li>
<li><p><em>line segment</em> - a list of four coordinates, interpreted as the
x- and y-coordinates of the first and the last points on the line
segment.</p></li>
<li><p><em>polyline</em> - a list of an even number of coordinates,
interpreted as the x- and y-coordinates of an ordered set of points.</p></li>
<li><p><em>polygon</em> - like a polyline, but the implicit assumption is that
the polyline is closed (if the first and last points do not coincide,
the missing segment is automatically added).</p></li>
<li><p><em>point set</em> - again a list of an even number of coordinates, but
the points are regarded without any ordering.</p></li>
</ul>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::geometry::+</b> <i class="arg">point1</i> <i class="arg">point2</i></a></dt>
<dd><p>Compute the sum of the two vectors given as points and return it.
The result is a vector as well.</p></dd>
<dt><a name="2"><b class="cmd">::math::geometry::-</b> <i class="arg">point1</i> <i class="arg">point2</i></a></dt>
<dd><p>Compute the difference (point1 - point2) of the two vectors
given as points and return it. The result is a vector as well.</p></dd>
<dt><a name="3"><b class="cmd">::math::geometry::p</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Construct a point from its coordinates and return it as the
result of the command.</p></dd>
<dt><a name="4"><b class="cmd">::math::geometry::distance</b> <i class="arg">point1</i> <i class="arg">point2</i></a></dt>
<dd><p>Compute the distance between the two points and return it as the
result of the command. This is in essence the same as</p>
<pre class="example">
    math::geometry::length [math::geomtry::- point1 point2]
</pre>
</dd>
<dt><a name="5"><b class="cmd">::math::geometry::length</b> <i class="arg">point</i></a></dt>
<dd><p>Compute the length of the vector and return it as the
result of the command.</p></dd>
<dt><a name="6"><b class="cmd">::math::geometry::s*</b> <i class="arg">factor</i> <i class="arg">point</i></a></dt>
<dd><p>Scale the vector by the factor and return it as the
result of the command. This is a vector as well.</p></dd>
<dt><a name="7"><b class="cmd">::math::geometry::direction</b> <i class="arg">angle</i></a></dt>
<dd><p>Given the angle in degrees this command computes and returns
the unit vector pointing into this direction. The vector for
angle == 0 points to the right (up), and for angle == 90 up (north).</p></dd>
<dt><a name="8"><b class="cmd">::math::geometry::h</b> <i class="arg">length</i></a></dt>
<dd><p>Returns a horizontal vector on the X-axis of the specified length.
Positive lengths point to the right (east).</p></dd>
<dt><a name="9"><b class="cmd">::math::geometry::v</b> <i class="arg">length</i></a></dt>
<dd><p>Returns a vertical vector on the Y-axis of the specified length.
Positive lengths point down (south).</p></dd>
<dt><a name="10"><b class="cmd">::math::geometry::between</b> <i class="arg">point1</i> <i class="arg">point2</i> <i class="arg">s</i></a></dt>
<dd><p>Compute the point which is at relative distance <i class="arg">s</i> between the two
points and return it as the result of the command. A relative distance of
<b class="const">0</b> returns <i class="arg">point1</i>, the distance <b class="const">1</b> returns <i class="arg">point2</i>.
Distances &lt; 0 or &gt; 1 extrapolate along the line between the two point.</p></dd>
<dt><a name="11"><b class="cmd">::math::geometry::octant</b> <i class="arg">point</i></a></dt>
<dd><p>Compute the octant of the circle the point is in and return it as the result
of the command. The possible results are</p>
<ol class="enumerated">
<li><p>east</p></li>
<li><p>northeast</p></li>
<li><p>north</p></li>
<li><p>northwest</p></li>
<li><p>west</p></li>
<li><p>southwest</p></li>
<li><p>south</p></li>
<li><p>southeast</p></li>
</ol>
<p>Each octant is the arc of the circle +/- 22.5 degrees from the cardinal direction
the octant is named for.</p></dd>
<dt><a name="12"><b class="cmd">::math::geometry::rect</b> <i class="arg">nw</i> <i class="arg">se</i></a></dt>
<dd><p>Construct a rectangle from its northwest and southeast corners and return
it as the result of the command.</p></dd>
<dt><a name="13"><b class="cmd">::math::geometry::nwse</b> <i class="arg">rect</i></a></dt>
<dd><p>Extract the northwest and southeast corners of the rectangle and return
them as the result of the command (a 2-element list containing the
points, in the named order).</p></dd>
<dt><a name="14"><b class="cmd">::math::geometry::angle</b> <i class="arg">line</i></a></dt>
<dd><p>Calculate the angle from the positive x-axis to a given line
(in two dimensions only).</p>
<dl class="arguments">
<dt>list <i class="arg">line</i></dt>
<dd><p>Coordinates of the line</p></dd>
</dl></dd>
<dt><a name="15"><b class="cmd">::math::geometry::calculateDistanceToLine</b> <i class="arg">P</i> <i class="arg">line</i></a></dt>
<dd><p>Calculate the distance of point P to the (infinite) line and return the
result</p>
<dl class="arguments">
<dt>list <i class="arg">P</i></dt>
<dd><p>List of two numbers, the coordinates of the point</p></dd>
<dt>list <i class="arg">line</i></dt>
<dd><p>List of four numbers, the coordinates of two points
on the line</p></dd>
</dl></dd>
<dt><a name="16"><b class="cmd">::math::geometry::calculateDistanceToLineSegment</b> <i class="arg">P</i> <i class="arg">linesegment</i></a></dt>
<dd><p>Calculate the distance of point P to the (finite) line segment and
return the result.</p>
<dl class="arguments">
<dt>list <i class="arg">P</i></dt>
<dd><p>List of two numbers, the coordinates of the point</p></dd>
<dt>list <i class="arg">linesegment</i></dt>
<dd><p>List of four numbers, the coordinates of the
first and last points of the line segment</p></dd>
</dl></dd>
<dt><a name="17"><b class="cmd">::math::geometry::calculateDistanceToPolyline</b> <i class="arg">P</i> <i class="arg">polyline</i></a></dt>
<dd><p>Calculate the distance of point P to the polyline and
return the result.</p>
<dl class="arguments">
<dt>list <i class="arg">P</i></dt>
<dd><p>List of two numbers, the coordinates of the point</p></dd>
<dt>list <i class="arg">polyline</i></dt>
<dd><p>List of numbers, the coordinates of the
vertices of the polyline</p></dd>
</dl></dd>
<dt><a name="18"><b class="cmd">::math::geometry::findClosestPointOnLine</b> <i class="arg">P</i> <i class="arg">line</i></a></dt>
<dd><p>Return the point on a line which is closest to a given point.</p>
<dl class="arguments">
<dt>list <i class="arg">P</i></dt>
<dd><p>List of two numbers, the coordinates of the point</p></dd>
<dt>list <i class="arg">line</i></dt>
<dd><p>List of four numbers, the coordinates of two points
on the line</p></dd>
</dl></dd>
<dt><a name="19"><b class="cmd">::math::geometry::findClosestPointOnLineSegment</b> <i class="arg">P</i> <i class="arg">linesegment</i></a></dt>
<dd><p>Return the point on a <em>line segment</em> which is closest to a given
point.</p>
<dl class="arguments">
<dt>list <i class="arg">P</i></dt>
<dd><p>List of two numbers, the coordinates of the point</p></dd>
<dt>list <i class="arg">linesegment</i></dt>
<dd><p>List of four numbers, the first and last
points on the line segment</p></dd>
</dl></dd>
<dt><a name="20"><b class="cmd">::math::geometry::findClosestPointOnPolyline</b> <i class="arg">P</i> <i class="arg">polyline</i></a></dt>
<dd><p>Return the point on a <em>polyline</em> which is closest to a given
point.</p>
<dl class="arguments">
<dt>list <i class="arg">P</i></dt>
<dd><p>List of two numbers, the coordinates of the point</p></dd>
<dt>list <i class="arg">polyline</i></dt>
<dd><p>List of numbers, the vertices of the polyline</p></dd>
</dl></dd>
<dt><a name="21"><b class="cmd">::math::geometry::lengthOfPolyline</b> <i class="arg">polyline</i></a></dt>
<dd><p>Return the length of the <em>polyline</em> (note: it not regarded as a
polygon)</p>
<dl class="arguments">
<dt>list <i class="arg">polyline</i></dt>
<dd><p>List of numbers, the vertices of the polyline</p></dd>
</dl></dd>
<dt><a name="22"><b class="cmd">::math::geometry::movePointInDirection</b> <i class="arg">P</i> <i class="arg">direction</i> <i class="arg">dist</i></a></dt>
<dd><p>Move a point over a given distance in a given direction and return the
new coordinates (in two dimensions only).</p>
<dl class="arguments">
<dt>list <i class="arg">P</i></dt>
<dd><p>Coordinates of the point to be moved</p></dd>
<dt>double <i class="arg">direction</i></dt>
<dd><p>Direction (in degrees; 0 is to the right, 90
upwards)</p></dd>
<dt>list <i class="arg">dist</i></dt>
<dd><p>Distance over which to move the point</p></dd>
</dl></dd>
<dt><a name="23"><b class="cmd">::math::geometry::lineSegmentsIntersect</b> <i class="arg">linesegment1</i> <i class="arg">linesegment2</i></a></dt>
<dd><p>Check if two line segments intersect or coincide. Returns 1 if that is
the case, 0 otherwise (in two dimensions only).</p>
<dl class="arguments">
<dt>list <i class="arg">linesegment1</i></dt>
<dd><p>First line segment</p></dd>
<dt>list <i class="arg">linesegment2</i></dt>
<dd><p>Second line segment</p></dd>
</dl></dd>
<dt><a name="24"><b class="cmd">::math::geometry::findLineSegmentIntersection</b> <i class="arg">linesegment1</i> <i class="arg">linesegment2</i></a></dt>
<dd><p>Find the intersection point of two line segments. Return the coordinates
or the keywords &quot;coincident&quot; or &quot;none&quot; if the line segments coincide or
have no points in common (in two dimensions only).</p>
<dl class="arguments">
<dt>list <i class="arg">linesegment1</i></dt>
<dd><p>First line segment</p></dd>
<dt>list <i class="arg">linesegment2</i></dt>
<dd><p>Second line segment</p></dd>
</dl></dd>
<dt><a name="25"><b class="cmd">::math::geometry::findLineIntersection</b> <i class="arg">line1</i> <i class="arg">line2</i></a></dt>
<dd><p>Find the intersection point of two (infinite) lines. Return the coordinates
or the keywords &quot;coincident&quot; or &quot;none&quot; if the lines coincide or
have no points in common (in two dimensions only).</p>
<dl class="arguments">
<dt>list <i class="arg">line1</i></dt>
<dd><p>First line</p></dd>
<dt>list <i class="arg">line2</i></dt>
<dd><p>Second line</p></dd>
</dl>
<p>See section <span class="sectref"><a href="#section3">References</a></span> for details on the algorithm and math behind it.</p></dd>
<dt><a name="26"><b class="cmd">::math::geometry::polylinesIntersect</b> <i class="arg">polyline1</i> <i class="arg">polyline2</i></a></dt>
<dd><p>Check if two polylines intersect or not (in two dimensions only).</p>
<dl class="arguments">
<dt>list <i class="arg">polyline1</i></dt>
<dd><p>First polyline</p></dd>
<dt>list <i class="arg">polyline2</i></dt>
<dd><p>Second polyline</p></dd>
</dl></dd>
<dt><a name="27"><b class="cmd">::math::geometry::polylinesBoundingIntersect</b> <i class="arg">polyline1</i> <i class="arg">polyline2</i> <i class="arg">granularity</i></a></dt>
<dd><p>Check whether two polylines intersect, but reduce
the correctness of the result to the given granularity.
Use this for faster, but weaker, intersection checking.</p>
<p>How it works:</p>
<p>Each polyline is split into a number of smaller polylines,
consisting of granularity points each. If a pair of those smaller
lines' bounding boxes intersect, then this procedure returns 1,
otherwise it returns 0.</p>
<dl class="arguments">
<dt>list <i class="arg">polyline1</i></dt>
<dd><p>First polyline</p></dd>
<dt>list <i class="arg">polyline2</i></dt>
<dd><p>Second polyline</p></dd>
<dt>int <i class="arg">granularity</i></dt>
<dd><p>Number of points in each part (&lt;=1 means check
every edge)</p></dd>
</dl></dd>
<dt><a name="28"><b class="cmd">::math::geometry::intervalsOverlap</b> <i class="arg">y1</i> <i class="arg">y2</i> <i class="arg">y3</i> <i class="arg">y4</i> <i class="arg">strict</i></a></dt>
<dd><p>Check if two intervals overlap.</p>
<dl class="arguments">
<dt>double <i class="arg">y1,y2</i></dt>
<dd><p>Begin and end of first interval</p></dd>
<dt>double <i class="arg">y3,y4</i></dt>
<dd><p>Begin and end of second interval</p></dd>
<dt>logical <i class="arg">strict</i></dt>
<dd><p>Check for strict or non-strict overlap</p></dd>
</dl></dd>
<dt><a name="29"><b class="cmd">::math::geometry::rectanglesOverlap</b> <i class="arg">P1</i> <i class="arg">P2</i> <i class="arg">Q1</i> <i class="arg">Q2</i> <i class="arg">strict</i></a></dt>
<dd><p>Check if two rectangles overlap.</p>
<dl class="arguments">
<dt>list <i class="arg">P1</i></dt>
<dd><p>upper-left corner of the first rectangle</p></dd>
<dt>list <i class="arg">P2</i></dt>
<dd><p>lower-right corner of the first rectangle</p></dd>
<dt>list <i class="arg">Q1</i></dt>
<dd><p>upper-left corner of the second rectangle</p></dd>
<dt>list <i class="arg">Q2</i></dt>
<dd><p>lower-right corner of the second rectangle</p></dd>
<dt>list <i class="arg">strict</i></dt>
<dd><p>choosing strict or non-strict interpretation</p></dd>
</dl></dd>
<dt><a name="30"><b class="cmd">::math::geometry::bbox</b> <i class="arg">polyline</i></a></dt>
<dd><p>Calculate the bounding box of a polyline. Returns a list of four
coordinates: the upper-left and the lower-right corner of the box.</p>
<dl class="arguments">
<dt>list <i class="arg">polyline</i></dt>
<dd><p>The polyline to be examined</p></dd>
</dl></dd>
<dt><a name="31"><b class="cmd">::math::geometry::pointInsidePolygon</b> <i class="arg">P</i> <i class="arg">polyline</i></a></dt>
<dd><p>Determine if a point is completely inside a polygon. If the point
touches the polygon, then the point is not completely inside the
polygon.</p>
<dl class="arguments">
<dt>list <i class="arg">P</i></dt>
<dd><p>Coordinates of the point</p></dd>
<dt>list <i class="arg">polyline</i></dt>
<dd><p>The polyline to be examined</p></dd>
</dl></dd>
<dt><a name="32"><b class="cmd">::math::geometry::rectangleInsidePolygon</b> <i class="arg">P1</i> <i class="arg">P2</i> <i class="arg">polyline</i></a></dt>
<dd><p>Determine if a rectangle is completely inside a polygon. If polygon
touches the rectangle, then the rectangle is not complete inside the
polygon.</p>
<dl class="arguments">
<dt>list <i class="arg">P1</i></dt>
<dd><p>Upper-left corner of the rectangle</p></dd>
<dt>list <i class="arg">P2</i></dt>
<dd><p>Lower-right corner of the rectangle</p></dd>
<dt>list <i class="arg">polygon</i></dt>
<dd><p>The polygon in question</p></dd>
</dl></dd>
<dt><a name="33"><b class="cmd">::math::geometry::areaPolygon</b> <i class="arg">polygon</i></a></dt>
<dd><p>Calculate the area of a polygon.</p>
<dl class="arguments">
<dt>list <i class="arg">polygon</i></dt>
<dd><p>The polygon in question</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="http:/wiki.tcl.tk/12070">Polygon Intersection</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Line-line_intersection">http://en.wikipedia.org/wiki/Line-line_intersection</a></p></li>
<li><p><a href="http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/">http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/</a></p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: geometry</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key532">angle</a>, <a href="../../../../index.html#key428">distance</a>, <a href="../../../../index.html#key529">line</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key530">plane geometry</a>, <a href="../../../../index.html#key531">point</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2001 by Ideogramic ApS and other parties<br>
Copyright &copy; 2004 by Arjen Markus<br>
Copyright &copy; 2010 by Andreas Kupries<br>
Copyright &copy; 2010 by Kevin Kenny</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/numtheory.html.
















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math::numtheory - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/numtheory.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2010 Lars Hellstr&ouml;m &lt;Lars dot Hellstrom at residenset dot net&gt;
   -->
<! -- CVS: $Id$ math::numtheory.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::numtheory(n) 1.0 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::numtheory - Number Theory</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.5?</span></b></li>
<li>package require <b class="pkgname">math::numtheory <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">math::numtheory::isprime</b> <i class="arg">N</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is for collecting various number-theoretic operations,
though at the moment it only provides that of testing whether an
integer is a prime.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">math::numtheory::isprime</b> <i class="arg">N</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>The <b class="cmd">isprime</b> command tests whether the integer <i class="arg">N</i> is a
  prime, returning a boolean true value for prime <i class="arg">N</i> and a
  boolean false value for non-prime <i class="arg">N</i>. The formal definition of
  'prime' used is the conventional, that the number being tested is
  greater than 1 and only has trivial divisors.</p>
<p>To be precise, the return value is one of <b class="const">0</b> (if <i class="arg">N</i> is
  definitely not a prime), <b class="const">1</b> (if <i class="arg">N</i> is definitely a
  prime), and <b class="const">on</b> (if <i class="arg">N</i> is probably prime); the latter
  two are both boolean true values. The case that an integer may be
  classified as &quot;probably prime&quot; arises because the Miller-Rabin
  algorithm used in the test implementation is basically probabilistic,
  and may if we are unlucky fail to detect that a number is in fact
  composite. Options may be used to select the risk of such
  &quot;false positives&quot; in the test. <b class="const">1</b> is returned for &quot;small&quot;
  <i class="arg">N</i> (which currently means <i class="arg">N</i> &lt; 118670087467), where it is
  known that no false positives are possible.</p>
<p>The only option currently defined is:</p>
<dl class="options">
  
<dt><b class="option">-randommr</b> <i class="arg">repetitions</i></dt>
<dd><p>which controls how many times the Miller-Rabin test should be
    repeated with randomly chosen bases. Each repetition reduces the
    probability of a false positive by a factor at least 4. The
    default for <i class="arg">repetitions</i> is 4.</p></dd>
</dl>
<p>Unknown options are silently ignored.</p></dd>
</dl>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key703">number theory</a>, <a href="../../../../index.html#key704">prime</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2010 Lars Hellstr&ouml;m &lt;Lars dot Hellstrom at residenset dot net&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/optimize.html.









































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::optimize - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/optimize.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;   -- Copyright &copy; 2004,2005 Kevn B. Kenny &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::optimize.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::optimize(n) 1.0 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::optimize - Optimisation routines</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">NOTES</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">math::optimize <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::optimize::minimum</b> <i class="arg">begin</i> <i class="arg">end</i> <i class="arg">func</i> <i class="arg">maxerr</i></a></li>
<li><a href="#2"><b class="cmd">::math::optimize::maximum</b> <i class="arg">begin</i> <i class="arg">end</i> <i class="arg">func</i> <i class="arg">maxerr</i></a></li>
<li><a href="#3"><b class="cmd">::math::optimize::min_bound_1d</b> <i class="arg">func</i> <i class="arg">begin</i> <i class="arg">end</i> <span class="opt">?<b class="option">-relerror</b> <i class="arg">reltol</i>?</span> <span class="opt">?<b class="option">-abserror</b> <i class="arg">abstol</i>?</span> <span class="opt">?<b class="option">-maxiter</b> <i class="arg">maxiter</i>?</span> <span class="opt">?<b class="option">-trace</b> <i class="arg">traceflag</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::math::optimize::min_unbound_1d</b> <i class="arg">func</i> <i class="arg">begin</i> <i class="arg">end</i> <span class="opt">?<b class="option">-relerror</b> <i class="arg">reltol</i>?</span> <span class="opt">?<b class="option">-abserror</b> <i class="arg">abstol</i>?</span> <span class="opt">?<b class="option">-maxiter</b> <i class="arg">maxiter</i>?</span> <span class="opt">?<b class="option">-trace</b> <i class="arg">traceflag</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::math::optimize::solveLinearProgram</b> <i class="arg">objective</i> <i class="arg">constraints</i></a></li>
<li><a href="#6"><b class="cmd">::math::optimize::linearProgramMaximum</b> <i class="arg">objective</i> <i class="arg">result</i></a></li>
<li><a href="#7"><b class="cmd">::math::optimize::nelderMead</b> <i class="arg">objective</i> <i class="arg">xVector</i> <span class="opt">?<b class="option">-scale</b> <i class="arg">xScaleVector</i>?</span> <span class="opt">?<b class="option">-ftol</b> <i class="arg">epsilon</i>?</span> <span class="opt">?<b class="option">-maxiter</b> <i class="arg">count</i>?</span> <span class="opt">?<span class="opt">?-trace?</span> <i class="arg">flag</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements several optimisation algorithms:</p>
<ul class="itemized">
<li><p>Minimize or maximize a function over a given interval</p></li>
<li><p>Solve a linear program (maximize a linear function subject to linear
constraints)</p></li>
<li><p>Minimize a function of several variables given an initial guess for the
location of the minimum.</p></li>
</ul>
<p>The package is fully implemented in Tcl. No particular attention has
been paid to the accuracy of the calculations. Instead, the
algorithms have been used in a straightforward manner.</p>
<p>This document describes the procedures and explains their usage.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>This package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::optimize::minimum</b> <i class="arg">begin</i> <i class="arg">end</i> <i class="arg">func</i> <i class="arg">maxerr</i></a></dt>
<dd><p>Minimize the given (continuous) function by examining the values in the
given interval. The procedure determines the values at both ends and in the
centre of the interval and then constructs a new interval of 1/2 length
that includes the minimum. No guarantee is made that the <em>global</em>
minimum is found.</p>
<p>The procedure returns the &quot;x&quot; value for which the function is minimal.</p>
<p><em>This procedure has been deprecated - use min_bound_1d instead</em></p>
<p><i class="arg">begin</i> - Start of the interval</p>
<p><i class="arg">end</i> - End of the interval</p>
<p><i class="arg">func</i> - Name of the function to be minimized (a procedure taking
one argument).</p>
<p><i class="arg">maxerr</i> - Maximum relative error (defaults to 1.0e-4)</p></dd>
<dt><a name="2"><b class="cmd">::math::optimize::maximum</b> <i class="arg">begin</i> <i class="arg">end</i> <i class="arg">func</i> <i class="arg">maxerr</i></a></dt>
<dd><p>Maximize the given (continuous) function by examining the values in the
given interval. The procedure determines the values at both ends and in the
centre of the interval and then constructs a new interval of 1/2 length
that includes the maximum. No guarantee is made that the <em>global</em>
maximum is found.</p>
<p>The procedure returns the &quot;x&quot; value for which the function is maximal.</p>
<p><em>This procedure has been deprecated - use max_bound_1d instead</em></p>
<p><i class="arg">begin</i> - Start of the interval</p>
<p><i class="arg">end</i> - End of the interval</p>
<p><i class="arg">func</i> - Name of the function to be maximized (a procedure taking
one argument).</p>
<p><i class="arg">maxerr</i> - Maximum relative error (defaults to 1.0e-4)</p></dd>
<dt><a name="3"><b class="cmd">::math::optimize::min_bound_1d</b> <i class="arg">func</i> <i class="arg">begin</i> <i class="arg">end</i> <span class="opt">?<b class="option">-relerror</b> <i class="arg">reltol</i>?</span> <span class="opt">?<b class="option">-abserror</b> <i class="arg">abstol</i>?</span> <span class="opt">?<b class="option">-maxiter</b> <i class="arg">maxiter</i>?</span> <span class="opt">?<b class="option">-trace</b> <i class="arg">traceflag</i>?</span></a></dt>
<dd><p>Miminizes a function of one variable in the given interval.  The procedure
uses Brent's method of parabolic interpolation, protected by golden-section
subdivisions if the interpolation is not converging.  No guarantee is made
that a <em>global</em> minimum is found.  The function to evaluate, <i class="arg">func</i>,
must be a single Tcl command; it will be evaluated with an abscissa appended
as the last argument.</p>
<p><i class="arg">x1</i> and <i class="arg">x2</i> are the two bounds of
the interval in which the minimum is to be found.  They need not be in
increasing order.</p>
<p><i class="arg">reltol</i>, if specified, is the desired upper bound
on the relative error of the result; default is 1.0e-7.  The given value
should never be smaller than the square root of the machine's floating point
precision, or else convergence is not guaranteed.  <i class="arg">abstol</i>, if specified,
is the desired upper bound on the absolute error of the result; default
is 1.0e-10.  Caution must be used with small values of <i class="arg">abstol</i> to
avoid overflow/underflow conditions; if the minimum is expected to lie
about a small but non-zero abscissa, you consider either shifting the
function or changing its length scale.</p>
<p><i class="arg">maxiter</i> may be used to constrain the number of function evaluations
to be performed; default is 100.  If the command evaluates the function
more than <i class="arg">maxiter</i> times, it returns an error to the caller.</p>
<p><i class="arg">traceFlag</i> is a Boolean value. If true, it causes the command to
print a message on the standard output giving the abscissa and ordinate
at each function evaluation, together with an indication of what type
of interpolation was chosen.  Default is 0 (no trace).</p></dd>
<dt><a name="4"><b class="cmd">::math::optimize::min_unbound_1d</b> <i class="arg">func</i> <i class="arg">begin</i> <i class="arg">end</i> <span class="opt">?<b class="option">-relerror</b> <i class="arg">reltol</i>?</span> <span class="opt">?<b class="option">-abserror</b> <i class="arg">abstol</i>?</span> <span class="opt">?<b class="option">-maxiter</b> <i class="arg">maxiter</i>?</span> <span class="opt">?<b class="option">-trace</b> <i class="arg">traceflag</i>?</span></a></dt>
<dd><p>Miminizes a function of one variable over the entire real number line.
The procedure uses parabolic extrapolation combined with golden-section
dilatation to search for a region where a minimum exists, followed by
Brent's method of parabolic interpolation, protected by golden-section
subdivisions if the interpolation is not converging.  No guarantee is made
that a <em>global</em> minimum is found.  The function to evaluate, <i class="arg">func</i>,
must be a single Tcl command; it will be evaluated with an abscissa appended
as the last argument.</p>
<p><i class="arg">x1</i> and <i class="arg">x2</i> are two initial guesses at where the minimum
may lie.  <i class="arg">x1</i> is the starting point for the minimization, and
the difference between <i class="arg">x2</i> and <i class="arg">x1</i> is used as a hint at the
characteristic length scale of the problem.</p>
<p><i class="arg">reltol</i>, if specified, is the desired upper bound
on the relative error of the result; default is 1.0e-7.  The given value
should never be smaller than the square root of the machine's floating point
precision, or else convergence is not guaranteed.  <i class="arg">abstol</i>, if specified,
is the desired upper bound on the absolute error of the result; default
is 1.0e-10.  Caution must be used with small values of <i class="arg">abstol</i> to
avoid overflow/underflow conditions; if the minimum is expected to lie
about a small but non-zero abscissa, you consider either shifting the
function or changing its length scale.</p>
<p><i class="arg">maxiter</i> may be used to constrain the number of function evaluations
to be performed; default is 100.  If the command evaluates the function
more than <i class="arg">maxiter</i> times, it returns an error to the caller.</p>
<p><i class="arg">traceFlag</i> is a Boolean value. If true, it causes the command to
print a message on the standard output giving the abscissa and ordinate
at each function evaluation, together with an indication of what type
of interpolation was chosen.  Default is 0 (no trace).</p></dd>
<dt><a name="5"><b class="cmd">::math::optimize::solveLinearProgram</b> <i class="arg">objective</i> <i class="arg">constraints</i></a></dt>
<dd><p>Solve a <em>linear program</em> in standard form using a straightforward
implementation of the Simplex algorithm. (In the explanation below: The
linear program has N constraints and M variables).</p>
<p>The procedure returns a list of M values, the values for which the
objective function is maximal or a single keyword if the linear program
is not feasible or unbounded (either &quot;unfeasible&quot; or &quot;unbounded&quot;)</p>
<p><i class="arg">objective</i> - The M coefficients of the objective function</p>
<p><i class="arg">constraints</i> - Matrix of coefficients plus maximum values that
implement the linear constraints. It is expected to be a list of N lists
of M+1 numbers each, M coefficients and the maximum value.</p></dd>
<dt><a name="6"><b class="cmd">::math::optimize::linearProgramMaximum</b> <i class="arg">objective</i> <i class="arg">result</i></a></dt>
<dd><p>Convenience function to return the maximum for the solution found by the
solveLinearProgram procedure.</p>
<p><i class="arg">objective</i> - The M coefficients of the objective function</p>
<p><i class="arg">result</i> - The result as returned by solveLinearProgram</p></dd>
<dt><a name="7"><b class="cmd">::math::optimize::nelderMead</b> <i class="arg">objective</i> <i class="arg">xVector</i> <span class="opt">?<b class="option">-scale</b> <i class="arg">xScaleVector</i>?</span> <span class="opt">?<b class="option">-ftol</b> <i class="arg">epsilon</i>?</span> <span class="opt">?<b class="option">-maxiter</b> <i class="arg">count</i>?</span> <span class="opt">?<span class="opt">?-trace?</span> <i class="arg">flag</i>?</span></a></dt>
<dd><p>Minimizes, in unconstrained fashion, a function of several variable over all
of space.  The function to evaluate, <i class="arg">objective</i>, must be a single Tcl
command. To it will be appended as many elements as appear in the initial guess at
the location of the minimum, passed in as a Tcl list, <i class="arg">xVector</i>.</p>
<p><i class="arg">xScaleVector</i> is an initial guess at the problem scale; the first
function evaluations will be made by varying the co-ordinates in <i class="arg">xVector</i>
by the amounts in <i class="arg">xScaleVector</i>.  If <i class="arg">xScaleVector</i> is not supplied,
the co-ordinates will be varied by a factor of 1.0001 (if the co-ordinate
is non-zero) or by a constant 0.0001 (if the co-ordinate is zero).</p>
<p><i class="arg">epsilon</i> is the desired relative error in the value of the function
evaluated at the minimum. The default is 1.0e-7, which usually gives three
significant digits of accuracy in the values of the x's.</p>
<p>pp
<i class="arg">count</i> is a limit on the number of trips through the main loop of
the optimizer.  The number of function evaluations may be several times
this number.  If the optimizer fails to find a minimum to within <i class="arg">ftol</i>
in <i class="arg">maxiter</i> iterations, it returns its current best guess and an
error status. Default is to allow 500 iterations.</p>
<p><i class="arg">flag</i> is a flag that, if true, causes a line to be written to the
standard output for each evaluation of the objective function, giving
the arguments presented to the function and the value returned. Default is
false.</p>
<p>The <b class="cmd">nelderMead</b> procedure returns a list of alternating keywords and
values suitable for use with <b class="cmd">array set</b>. The meaning of the keywords is:</p>
<p><i class="arg">x</i> is the approximate location of the minimum.</p>
<p><i class="arg">y</i> is the value of the function at <i class="arg">x</i>.</p>
<p><i class="arg">yvec</i> is a vector of the best N+1 function values achieved, where
N is the dimension of <i class="arg">x</i></p>
<p><i class="arg">vertices</i> is a list of vectors giving the function arguments
corresponding to the values in <i class="arg">yvec</i>.</p>
<p><i class="arg">nIter</i> is the number of iterations required to achieve convergence or
fail.</p>
<p><i class="arg">status</i> is 'ok' if the operation succeeded, or 'too-many-iterations'
if the maximum iteration count was exceeded.</p>
<p><b class="cmd">nelderMead</b> minimizes the given function using the downhill
simplex method of Nelder and Mead.  This method is quite slow - much
faster methods for minimization are known - but has the advantage of being
extremely robust in the face of problems where the minimum lies in
a valley of complex topology.</p>
<p><b class="cmd">nelderMead</b> can occasionally find itself &quot;stuck&quot; at a point where
it can make no further progress; it is recommended that the caller
run it at least a second time, passing as the initial guess the
result found by the previous call.  The second run is usually very
fast.</p>
<p><b class="cmd">nelderMead</b> can be used in some cases for constrained optimization.
To do this, add a large value to the objective function if the parameters
are outside the feasible region.  To work effectively in this mode,
<b class="cmd">nelderMead</b> requires that the initial guess be feasible and
usually requires that the feasible region be convex.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">NOTES</a></h2>
<p>Several of the above procedures take the <em>names</em> of procedures as
arguments. To avoid problems with the <em>visibility</em> of these
procedures, the fully-qualified name of these procedures is determined
inside the optimize routines. For the user this has only one
consequence: the named procedure must be visible in the calling
procedure. For instance:</p>
<pre class="example">
    namespace eval ::mySpace {
       namespace export calcfunc
       proc calcfunc { x } { return $x }
    }
    #
    # Use a fully-qualified name
    #
    namespace eval ::myCalc {
       puts [min_bound_1d ::myCalc::calcfunc $begin $end]
    }
    #
    # Import the name
    #
    namespace eval ::myCalc {
       namespace import ::mySpace::calcfunc
       puts [min_bound_1d calcfunc $begin $end]
    }
</pre>
<p>The simple procedures <em>minimum</em> and <em>maximum</em> have been
deprecated: the alternatives are much more flexible, robust and
require less function evaluations.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<p>Let us take a few simple examples:</p>
<p>Determine the maximum of f(x) = x^3 exp(-3x), on the interval (0,10):</p>
<pre class="example">
proc efunc { x } { expr {$x*$x*$x * exp(-3.0*$x)} }
puts &quot;Maximum at: [::math::optimize::max_bound_1d efunc 0.0 10.0]&quot;
</pre>
<p>The maximum allowed error determines the number of steps taken (with
each step in the iteration the interval is reduced with a factor 1/2).
Hence, a maximum error of 0.0001 is achieved in approximately 14 steps.</p>
<p>An example of a <em>linear program</em> is:</p>
<p>Optimise the expression 3x+2y, where:</p>
<pre class="example">
   x &gt;= 0 and y &gt;= 0 (implicit constraints, part of the
                     definition of linear programs)
   x + y   &lt;= 1      (constraints specific to the problem)
   2x + 5y &lt;= 10
</pre>
<p>This problem can be solved as follows:</p>
<pre class="example">
   set solution [::math::optimize::solveLinearProgram  { 3.0   2.0 }  { { 1.0   1.0   1.0 }
        { 2.0   5.0  10.0 } } ]
</pre>
<p>Note, that a constraint like:</p>
<pre class="example">
   x + y &gt;= 1
</pre>
<p>can be turned into standard form using:</p>
<pre class="example">
   -x  -y &lt;= -1
</pre>
<p>The theory of linear programming is the subject of many a text book and
the Simplex algorithm that is implemented here is the best-known
method to solve this type of problems, but it is not the only one.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: optimize</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key263">linear program</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key262">maximum</a>, <a href="../../../../index.html#key261">minimum</a>, <a href="../../../../index.html#key264">optimization</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;<br>
Copyright &copy; 2004,2005 Kevn B. Kenny &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/polynomials.html.













































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::polynomials - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/polynomials.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::polynomials.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::polynomials(n) 1.0.1 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::polynomials - Polynomial functions</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">REMARKS ON THE IMPLEMENTATION</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.3?</span></b></li>
<li>package require <b class="pkgname">math::polynomials <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::polynomials::polynomial</b> <i class="arg">coeffs</i></a></li>
<li><a href="#2"><b class="cmd">::math::polynomials::polynCmd</b> <i class="arg">coeffs</i></a></li>
<li><a href="#3"><b class="cmd">::math::polynomials::evalPolyn</b> <i class="arg">polynomial</i> <i class="arg">x</i></a></li>
<li><a href="#4"><b class="cmd">::math::polynomials::addPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></li>
<li><a href="#5"><b class="cmd">::math::polynomials::subPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></li>
<li><a href="#6"><b class="cmd">::math::polynomials::multPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></li>
<li><a href="#7"><b class="cmd">::math::polynomials::divPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></li>
<li><a href="#8"><b class="cmd">::math::polynomials::remainderPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></li>
<li><a href="#9"><b class="cmd">::math::polynomials::derivPolyn</b> <i class="arg">polyn</i></a></li>
<li><a href="#10"><b class="cmd">::math::polynomials::primitivePolyn</b> <i class="arg">polyn</i></a></li>
<li><a href="#11"><b class="cmd">::math::polynomials::degreePolyn</b> <i class="arg">polyn</i></a></li>
<li><a href="#12"><b class="cmd">::math::polynomials::coeffPolyn</b> <i class="arg">polyn</i> <i class="arg">index</i></a></li>
<li><a href="#13"><b class="cmd">::math::polynomials::allCoeffsPolyn</b> <i class="arg">polyn</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package deals with polynomial functions of one variable:</p>
<ul class="itemized">
<li><p>the basic arithmetic operations are extended to polynomials</p></li>
<li><p>computing the derivatives and primitives of these functions</p></li>
<li><p>evaluation through a general procedure or via specific procedures)</p></li>
</ul>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::polynomials::polynomial</b> <i class="arg">coeffs</i></a></dt>
<dd><p>Return an (encoded) list that defines the polynomial. A polynomial</p>
<pre class="example">
   f(x) = a + b.x + c.x**2 + d.x**3
</pre>
<p>can be defined via:</p>
<pre class="example">
   set f [::math::polynomials::polynomial [list $a $b $c $d]
</pre>
<dl class="arguments">
<dt>list <i class="arg">coeffs</i></dt>
<dd><p>Coefficients of the polynomial (in ascending
order)</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::polynomials::polynCmd</b> <i class="arg">coeffs</i></a></dt>
<dd><p>Create a new procedure that evaluates the polynomial. The name of the
polynomial is automatically generated. Useful if you need to evualuate
the polynomial many times, as the procedure consists of a single
[expr] command.</p>
<dl class="arguments">
<dt>list <i class="arg">coeffs</i></dt>
<dd><p>Coefficients of the polynomial (in ascending
order) or the polynomial definition returned by the <em>polynomial</em>
command.</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::polynomials::evalPolyn</b> <i class="arg">polynomial</i> <i class="arg">x</i></a></dt>
<dd><p>Evaluate the polynomial at x.</p>
<dl class="arguments">
<dt>list <i class="arg">polynomial</i></dt>
<dd><p>The polynomial's definition (as returned by
the polynomial command).
order)</p></dd>
<dt>float <i class="arg">x</i></dt>
<dd><p>The coordinate at which to evaluate the polynomial</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::math::polynomials::addPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></dt>
<dd><p>Return a new polynomial which is the sum of the two others.</p>
<dl class="arguments">
<dt>list <i class="arg">polyn1</i></dt>
<dd><p>The first polynomial operand</p></dd>
<dt>list <i class="arg">polyn2</i></dt>
<dd><p>The second polynomial operand</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::math::polynomials::subPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></dt>
<dd><p>Return a new polynomial which is the difference of the two others.</p>
<dl class="arguments">
<dt>list <i class="arg">polyn1</i></dt>
<dd><p>The first polynomial operand</p></dd>
<dt>list <i class="arg">polyn2</i></dt>
<dd><p>The second polynomial operand</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::math::polynomials::multPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></dt>
<dd><p>Return a new polynomial which is the product of the two others. If one
of the arguments is a scalar value, the other polynomial is simply
scaled.</p>
<dl class="arguments">
<dt>list <i class="arg">polyn1</i></dt>
<dd><p>The first polynomial operand or a scalar</p></dd>
<dt>list <i class="arg">polyn2</i></dt>
<dd><p>The second polynomial operand or a scalar</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::math::polynomials::divPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></dt>
<dd><p>Divide the first polynomial by the second polynomial and return the
result. The remainder is dropped</p>
<dl class="arguments">
<dt>list <i class="arg">polyn1</i></dt>
<dd><p>The first polynomial operand</p></dd>
<dt>list <i class="arg">polyn2</i></dt>
<dd><p>The second polynomial operand</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::math::polynomials::remainderPolyn</b> <i class="arg">polyn1</i> <i class="arg">polyn2</i></a></dt>
<dd><p>Divide the first polynomial by the second polynomial and return the
remainder.</p>
<dl class="arguments">
<dt>list <i class="arg">polyn1</i></dt>
<dd><p>The first polynomial operand</p></dd>
<dt>list <i class="arg">polyn2</i></dt>
<dd><p>The second polynomial operand</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::math::polynomials::derivPolyn</b> <i class="arg">polyn</i></a></dt>
<dd><p>Differentiate the polynomial and return the result.</p>
<dl class="arguments">
<dt>list <i class="arg">polyn</i></dt>
<dd><p>The polynomial to be differentiated</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::math::polynomials::primitivePolyn</b> <i class="arg">polyn</i></a></dt>
<dd><p>Integrate the polynomial and return the result. The integration
constant is set to zero.</p>
<dl class="arguments">
<dt>list <i class="arg">polyn</i></dt>
<dd><p>The polynomial to be integrated</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::math::polynomials::degreePolyn</b> <i class="arg">polyn</i></a></dt>
<dd><p>Return the degree of the polynomial.</p>
<dl class="arguments">
<dt>list <i class="arg">polyn</i></dt>
<dd><p>The polynomial to be examined</p></dd>
</dl></dd>
<dt><a name="12"><b class="cmd">::math::polynomials::coeffPolyn</b> <i class="arg">polyn</i> <i class="arg">index</i></a></dt>
<dd><p>Return the coefficient of the term of the index'th degree of the
polynomial.</p>
<dl class="arguments">
<dt>list <i class="arg">polyn</i></dt>
<dd><p>The polynomial to be examined</p></dd>
<dt>int <i class="arg">index</i></dt>
<dd><p>The degree of the term</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::math::polynomials::allCoeffsPolyn</b> <i class="arg">polyn</i></a></dt>
<dd><p>Return the coefficients of the polynomial (in ascending order).</p>
<dl class="arguments">
<dt>list <i class="arg">polyn</i></dt>
<dd><p>The polynomial in question</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">REMARKS ON THE IMPLEMENTATION</a></h2>
<p>The implementation for evaluating the polynomials at some point uses
Horn's rule, which guarantees numerical stability and a minimum of
arithmetic operations.
To recognise that a polynomial definition is indeed a correct
definition, it consists of a list of two elements: the keyword
&quot;POLYNOMIAL&quot; and the list of coefficients in descending order. The
latter makes it easier to implement Horner's rule.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: polynomials</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key753">polynomial functions</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/qcomplex.html.


















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::complexnumbers - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/qcomplex.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::complexnumbers.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::complexnumbers(n) 1.0.2 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::complexnumbers - Straightforward complex number package</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">AVAILABLE PROCEDURES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">math::complexnumbers <span class="opt">?1.0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::complexnumbers::+</b> <i class="arg">z1</i> <i class="arg">z2</i></a></li>
<li><a href="#2"><b class="cmd">::math::complexnumbers::-</b> <i class="arg">z1</i> <i class="arg">z2</i></a></li>
<li><a href="#3"><b class="cmd">::math::complexnumbers::*</b> <i class="arg">z1</i> <i class="arg">z2</i></a></li>
<li><a href="#4"><b class="cmd">::math::complexnumbers::/</b> <i class="arg">z1</i> <i class="arg">z2</i></a></li>
<li><a href="#5"><b class="cmd">::math::complexnumbers::conj</b> <i class="arg">z1</i></a></li>
<li><a href="#6"><b class="cmd">::math::complexnumbers::real</b> <i class="arg">z1</i></a></li>
<li><a href="#7"><b class="cmd">::math::complexnumbers::imag</b> <i class="arg">z1</i></a></li>
<li><a href="#8"><b class="cmd">::math::complexnumbers::mod</b> <i class="arg">z1</i></a></li>
<li><a href="#9"><b class="cmd">::math::complexnumbers::arg</b> <i class="arg">z1</i></a></li>
<li><a href="#10"><b class="cmd">::math::complexnumbers::complex</b> <i class="arg">real</i> <i class="arg">imag</i></a></li>
<li><a href="#11"><b class="cmd">::math::complexnumbers::tostring</b> <i class="arg">z1</i></a></li>
<li><a href="#12"><b class="cmd">::math::complexnumbers::exp</b> <i class="arg">z1</i></a></li>
<li><a href="#13"><b class="cmd">::math::complexnumbers::sin</b> <i class="arg">z1</i></a></li>
<li><a href="#14"><b class="cmd">::math::complexnumbers::cos</b> <i class="arg">z1</i></a></li>
<li><a href="#15"><b class="cmd">::math::complexnumbers::tan</b> <i class="arg">z1</i></a></li>
<li><a href="#16"><b class="cmd">::math::complexnumbers::log</b> <i class="arg">z1</i></a></li>
<li><a href="#17"><b class="cmd">::math::complexnumbers::sqrt</b> <i class="arg">z1</i></a></li>
<li><a href="#18"><b class="cmd">::math::complexnumbers::pow</b> <i class="arg">z1</i> <i class="arg">z2</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The mathematical module <em>complexnumbers</em> provides a straightforward
implementation of complex numbers in pure Tcl. The philosophy is that
the user knows he or she is dealing with complex numbers in an abstract
way and wants as high a performance as can be had within the limitations
of an interpreted language.</p>
<p>Therefore the procedures defined in this package assume that the
arguments are valid (representations of) &quot;complex numbers&quot;, that is,
lists of two numbers defining the real and imaginary part of a
complex number (though this is a mere detail: rely on the
<em>complex</em> command to construct a valid number.)</p>
<p>Most procedures implement the basic arithmetic operations or elementary
functions whereas several others convert to and from different
representations:</p>
<pre class="example">
    set z [complex 0 1]
    puts &quot;z = [tostring $z]&quot;
    puts &quot;z**2 = [* $z $z]
</pre>
<p>would result in:</p>
<pre class="example">
    z = i
    z**2 = -1
</pre>
</div>
<div id="section2" class="section"><h2><a name="section2">AVAILABLE PROCEDURES</a></h2>
<p>The package implements all or most basic operations and elementary
functions.</p>
<p><em>The arithmetic operations are:</em></p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::complexnumbers::+</b> <i class="arg">z1</i> <i class="arg">z2</i></a></dt>
<dd><p>Add the two arguments and return the resulting complex number</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>First argument in the summation</p></dd>
<dt>complex <i class="arg">z2</i> (in)</dt>
<dd><p>Second argument in the summation</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::complexnumbers::-</b> <i class="arg">z1</i> <i class="arg">z2</i></a></dt>
<dd><p>Subtract the second argument from the first and return the
resulting complex number. If there is only one argument, the
opposite of z1 is returned (i.e. -z1)</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>First argument in the subtraction</p></dd>
<dt>complex <i class="arg">z2</i> (in)</dt>
<dd><p>Second argument in the subtraction (optional)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::complexnumbers::*</b> <i class="arg">z1</i> <i class="arg">z2</i></a></dt>
<dd><p>Multiply the two arguments and return the resulting complex number</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>First argument in the multiplication</p></dd>
<dt>complex <i class="arg">z2</i> (in)</dt>
<dd><p>Second argument in the multiplication</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::math::complexnumbers::/</b> <i class="arg">z1</i> <i class="arg">z2</i></a></dt>
<dd><p>Divide the first argument by the second and return the resulting complex
number</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>First argument (numerator) in the division</p></dd>
<dt>complex <i class="arg">z2</i> (in)</dt>
<dd><p>Second argument (denominator) in the division</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::math::complexnumbers::conj</b> <i class="arg">z1</i></a></dt>
<dd><p>Return the conjugate of the given complex number</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>Complex number in question</p></dd>
</dl></dd>
</dl>
<p><em>Conversion/inquiry procedures:</em></p>
<dl class="definitions">
<dt><a name="6"><b class="cmd">::math::complexnumbers::real</b> <i class="arg">z1</i></a></dt>
<dd><p>Return the real part of the given complex number</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>Complex number in question</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::math::complexnumbers::imag</b> <i class="arg">z1</i></a></dt>
<dd><p>Return the imaginary part of the given complex number</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>Complex number in question</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::math::complexnumbers::mod</b> <i class="arg">z1</i></a></dt>
<dd><p>Return the modulus of the given complex number</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>Complex number in question</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::math::complexnumbers::arg</b> <i class="arg">z1</i></a></dt>
<dd><p>Return the argument (&quot;angle&quot; in radians) of the given complex number</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>Complex number in question</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::math::complexnumbers::complex</b> <i class="arg">real</i> <i class="arg">imag</i></a></dt>
<dd><p>Construct the complex number &quot;real + imag*i&quot; and return it</p>
<dl class="arguments">
<dt>float <i class="arg">real</i> (in)</dt>
<dd><p>The real part of the new complex number</p></dd>
<dt>float <i class="arg">imag</i> (in)</dt>
<dd><p>The imaginary part of the new complex number</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::math::complexnumbers::tostring</b> <i class="arg">z1</i></a></dt>
<dd><p>Convert the complex number to the form &quot;real + imag*i&quot; and return the
string</p>
<dl class="arguments">
<dt>float <i class="arg">complex</i> (in)</dt>
<dd><p>The complex number to be converted</p></dd>
</dl></dd>
</dl>
<p><em>Elementary functions:</em></p>
<dl class="definitions">
<dt><a name="12"><b class="cmd">::math::complexnumbers::exp</b> <i class="arg">z1</i></a></dt>
<dd><p>Calculate the exponential for the given complex argument and return the
result</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>The complex argument for the function</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::math::complexnumbers::sin</b> <i class="arg">z1</i></a></dt>
<dd><p>Calculate the sine function for the given complex argument and return
the result</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>The complex argument for the function</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">::math::complexnumbers::cos</b> <i class="arg">z1</i></a></dt>
<dd><p>Calculate the cosine function for the given complex argument and return
the result</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>The complex argument for the function</p></dd>
</dl></dd>
<dt><a name="15"><b class="cmd">::math::complexnumbers::tan</b> <i class="arg">z1</i></a></dt>
<dd><p>Calculate the tangent function for the given complex argument and
return the result</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>The complex argument for the function</p></dd>
</dl></dd>
<dt><a name="16"><b class="cmd">::math::complexnumbers::log</b> <i class="arg">z1</i></a></dt>
<dd><p>Calculate the (principle value of the) logarithm for the given complex
argument and return the result</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>The complex argument for the function</p></dd>
</dl></dd>
<dt><a name="17"><b class="cmd">::math::complexnumbers::sqrt</b> <i class="arg">z1</i></a></dt>
<dd><p>Calculate the (principle value of the) square root for the given complex
argument and return the result</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>The complex argument for the function</p></dd>
</dl></dd>
<dt><a name="18"><b class="cmd">::math::complexnumbers::pow</b> <i class="arg">z1</i> <i class="arg">z2</i></a></dt>
<dd><p>Calculate &quot;z1 to the power of z2&quot; and return the result</p>
<dl class="arguments">
<dt>complex <i class="arg">z1</i> (in)</dt>
<dd><p>The complex number to be raised to a power</p></dd>
<dt>complex <i class="arg">z2</i> (in)</dt>
<dd><p>The complex power to be used</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: complexnumbers</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key730">complex numbers</a>, <a href="../../../../index.html#key67">math</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/rational_funcs.html.























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::rationalfunctions - Math</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/rational_funcs.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Arjen Markus &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::rationalfunctions.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::rationalfunctions(n) 1.0.1 tcllib &quot;Math&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::rationalfunctions - Polynomial functions</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">REMARKS ON THE IMPLEMENTATION</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.4?</span></b></li>
<li>package require <b class="pkgname">math::rationalfunctions <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::rationalfunctions::rationalFunction</b> <i class="arg">num</i> <i class="arg">den</i></a></li>
<li><a href="#2"><b class="cmd">::math::rationalfunctions::ratioCmd</b> <i class="arg">num</i> <i class="arg">den</i></a></li>
<li><a href="#3"><b class="cmd">::math::rationalfunctions::evalRatio</b> <i class="arg">rational</i> <i class="arg">x</i></a></li>
<li><a href="#4"><b class="cmd">::math::rationalfunctions::addRatio</b> <i class="arg">ratio1</i> <i class="arg">ratio2</i></a></li>
<li><a href="#5"><b class="cmd">::math::rationalfunctions::subRatio</b> <i class="arg">ratio1</i> <i class="arg">ratio2</i></a></li>
<li><a href="#6"><b class="cmd">::math::rationalfunctions::multRatio</b> <i class="arg">ratio1</i> <i class="arg">ratio2</i></a></li>
<li><a href="#7"><b class="cmd">::math::rationalfunctions::divRatio</b> <i class="arg">ratio1</i> <i class="arg">ratio2</i></a></li>
<li><a href="#8"><b class="cmd">::math::rationalfunctions::derivPolyn</b> <i class="arg">ratio</i></a></li>
<li><a href="#9"><b class="cmd">::math::rationalfunctions::coeffsNumerator</b> <i class="arg">ratio</i></a></li>
<li><a href="#10"><b class="cmd">::math::rationalfunctions::coeffsDenominator</b> <i class="arg">ratio</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package deals with rational functions of one variable:</p>
<ul class="itemized">
<li><p>the basic arithmetic operations are extended to rational functions</p></li>
<li><p>computing the derivatives of these functions</p></li>
<li><p>evaluation through a general procedure or via specific procedures)</p></li>
</ul>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::rationalfunctions::rationalFunction</b> <i class="arg">num</i> <i class="arg">den</i></a></dt>
<dd><p>Return an (encoded) list that defines the rational function. A
rational function</p>
<pre class="example">
             1 + x^3
   f(x) = ------------
          1 + 2x + x^2
</pre>
<p>can be defined via:</p>
<pre class="example">
   set f [::math::rationalfunctions::rationalFunction [list 1 0 0 1]  [list 1 2 1]]
</pre>
<dl class="arguments">
<dt>list <i class="arg">num</i></dt>
<dd><p>Coefficients of the numerator of the rational
function (in ascending order)</p></dd>
<dt>list <i class="arg">den</i></dt>
<dd><p>Coefficients of the denominator of the rational
function (in ascending order)</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::rationalfunctions::ratioCmd</b> <i class="arg">num</i> <i class="arg">den</i></a></dt>
<dd><p>Create a new procedure that evaluates the rational function. The name of the
function is automatically generated. Useful if you need to evaluate
the function many times, as the procedure consists of a single
[expr] command.</p>
<dl class="arguments">
<dt>list <i class="arg">num</i></dt>
<dd><p>Coefficients of the numerator of the rational
function (in ascending order)</p></dd>
<dt>list <i class="arg">den</i></dt>
<dd><p>Coefficients of the denominator of the rational
function (in ascending order)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::rationalfunctions::evalRatio</b> <i class="arg">rational</i> <i class="arg">x</i></a></dt>
<dd><p>Evaluate the rational function at x.</p>
<dl class="arguments">
<dt>list <i class="arg">rational</i></dt>
<dd><p>The rational function's definition (as returned
by the rationalFunction command).
order)</p></dd>
<dt>float <i class="arg">x</i></dt>
<dd><p>The coordinate at which to evaluate the function</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::math::rationalfunctions::addRatio</b> <i class="arg">ratio1</i> <i class="arg">ratio2</i></a></dt>
<dd><p>Return a new rational function which is the sum of the two others.</p>
<dl class="arguments">
<dt>list <i class="arg">ratio1</i></dt>
<dd><p>The first rational function operand</p></dd>
<dt>list <i class="arg">ratio2</i></dt>
<dd><p>The second rational function operand</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::math::rationalfunctions::subRatio</b> <i class="arg">ratio1</i> <i class="arg">ratio2</i></a></dt>
<dd><p>Return a new rational function which is the difference of the two
others.</p>
<dl class="arguments">
<dt>list <i class="arg">ratio1</i></dt>
<dd><p>The first rational function operand</p></dd>
<dt>list <i class="arg">ratio2</i></dt>
<dd><p>The second rational function operand</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::math::rationalfunctions::multRatio</b> <i class="arg">ratio1</i> <i class="arg">ratio2</i></a></dt>
<dd><p>Return a new rational function which is the product of the two others.
If one of the arguments is a scalar value, the other rational function is
simply scaled.</p>
<dl class="arguments">
<dt>list <i class="arg">ratio1</i></dt>
<dd><p>The first rational function operand or a scalar</p></dd>
<dt>list <i class="arg">ratio2</i></dt>
<dd><p>The second rational function operand or a scalar</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::math::rationalfunctions::divRatio</b> <i class="arg">ratio1</i> <i class="arg">ratio2</i></a></dt>
<dd><p>Divide the first rational function by the second rational function and
return the result. The remainder is dropped</p>
<dl class="arguments">
<dt>list <i class="arg">ratio1</i></dt>
<dd><p>The first rational function operand</p></dd>
<dt>list <i class="arg">ratio2</i></dt>
<dd><p>The second rational function operand</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::math::rationalfunctions::derivPolyn</b> <i class="arg">ratio</i></a></dt>
<dd><p>Differentiate the rational function and return the result.</p>
<dl class="arguments">
<dt>list <i class="arg">ratio</i></dt>
<dd><p>The rational function to be differentiated</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::math::rationalfunctions::coeffsNumerator</b> <i class="arg">ratio</i></a></dt>
<dd><p>Return the coefficients of the numerator of the rational function.</p>
<dl class="arguments">
<dt>list <i class="arg">ratio</i></dt>
<dd><p>The rational function to be examined</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::math::rationalfunctions::coeffsDenominator</b> <i class="arg">ratio</i></a></dt>
<dd><p>Return the coefficients of the denominator of the rational
function.</p>
<dl class="arguments">
<dt>list <i class="arg">ratio</i></dt>
<dd><p>The rational function to be examined</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">REMARKS ON THE IMPLEMENTATION</a></h2>
<p>The implementation of the rational functions relies on the
math::polynomials package. For further remarks see the documentation on
that package.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: rationalfunctions</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key612">rational functions</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Arjen Markus &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/roman.html.

























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::roman - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/roman.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Kenneth Green &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::roman.
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::roman() 1.0 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::roman - Tools for creating and manipulating roman numerals</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">math::roman <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::roman::toroman</b> <i class="arg">i</i></a></li>
<li><a href="#2"><b class="cmd">::math::roman::tointeger</b> <i class="arg">r</i></a></li>
<li><a href="#3"><b class="cmd">::math::roman::sort</b> <i class="arg">list</i></a></li>
<li><a href="#4"><b class="cmd">::math::roman::expr</b> <i class="arg">args</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><b class="cmd">::math::roman</b> is a pure-Tcl library for converting between integers
    and roman numerals. It also provides utility functions for sorting and performing
    arithmetic on roman numerals.</p>
<p>This code was originally harvested from the Tcler's wiki at
    http://wiki.tcl.tk/1823 and as such is free for any use for
    any purpose. Many thanks to the ingeneous folk who devised
    these clever routines and generously contributed them to the
    Tcl community.</p>
<p>While written and tested under Tcl 8.3, I expect this library
    will work under all 8.x versions of Tcl.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
    
<dt><a name="1"><b class="cmd">::math::roman::toroman</b> <i class="arg">i</i></a></dt>
<dd><p>Convert an integer to roman numerals. The result is always in
      upper case. The value zero is converted to an empty string.</p></dd>
<dt><a name="2"><b class="cmd">::math::roman::tointeger</b> <i class="arg">r</i></a></dt>
<dd><p>Convert a roman numeral into an integer.</p></dd>
<dt><a name="3"><b class="cmd">::math::roman::sort</b> <i class="arg">list</i></a></dt>
<dd><p>Sort a list of roman numerals from smallest to largest.</p></dd>
<dt><a name="4"><b class="cmd">::math::roman::expr</b> <i class="arg">args</i></a></dt>
<dd><p>Evaluate an expression where the operands are all roman numerals.</p></dd>
</dl>
<p>Of these commands both <em>toroman</em> and <em>tointeger</em> are exported
for easier use. The other two are not, as they could interfer or be
confused with existing Tcl commands.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: roman</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key310">integer</a>, <a href="../../../../index.html#key309">roman numeral</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Kenneth Green &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/romberg.html.

















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math::calculus::romberg - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/romberg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Kevin B. Kenny &lt;[email protected]&gt;. All rights reserved. Redistribution permitted under the terms of the Open Publication License &lt;http://www.opencontent.org/openpub/&gt;
   -->
<! -- CVS: $Id$ math::calculus::romberg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::calculus::romberg(n) 0.6 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::calculus::romberg - Romberg integration</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">PARAMETERS</a></li>
<li class="section"><a href="#section4">OPTIONS</a></li>
<li class="section"><a href="#section5">DESCRIPTION</a></li>
<li class="section"><a href="#section6">IMPROPER INTEGRALS</a></li>
<li class="section"><a href="#section7">OTHER CHANGES OF VARIABLE</a></li>
<li class="section"><a href="#section8">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">math::calculus 0.6</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::calculus::romberg</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">::math::calculus::romberg_infinity</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">::math::calculus::romberg_sqrtSingLower</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></li>
<li><a href="#4"><b class="cmd">::math::calculus::romberg_sqrtSingUpper</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></li>
<li><a href="#5"><b class="cmd">::math::calculus::romberg_powerLawLower</b> <i class="arg">gamma</i> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></li>
<li><a href="#6"><b class="cmd">::math::calculus::romberg_powerLawUpper</b> <i class="arg">gamma</i> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></li>
<li><a href="#7"><b class="cmd">::math::calculus::romberg_expLower</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></li>
<li><a href="#8"><b class="cmd">::math::calculus::romberg_expUpper</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">romberg</b> procedures in the <b class="cmd"><a href="calculus.html">math::calculus</a></b> package
perform numerical integration of a function of one variable.  They
are intended to be of &quot;production quality&quot; in that they are robust,
precise, and reasonably efficient in terms of the number of function
evaluations.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The following procedures are available for Romberg integration:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::calculus::romberg</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></dt>
<dd><p>Integrates an analytic function over a given interval.</p></dd>
<dt><a name="2"><b class="cmd">::math::calculus::romberg_infinity</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></dt>
<dd><p>Integrates an analytic function over a half-infinite interval.</p></dd>
<dt><a name="3"><b class="cmd">::math::calculus::romberg_sqrtSingLower</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></dt>
<dd><p>Integrates a function that is expected to be analytic over an interval
except for the presence of an inverse square root singularity at the
lower limit.</p></dd>
<dt><a name="4"><b class="cmd">::math::calculus::romberg_sqrtSingUpper</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></dt>
<dd><p>Integrates a function that is expected to be analytic over an interval
except for the presence of an inverse square root singularity at the
upper limit.</p></dd>
<dt><a name="5"><b class="cmd">::math::calculus::romberg_powerLawLower</b> <i class="arg">gamma</i> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></dt>
<dd><p>Integrates a function that is expected to be analytic over an interval
except for the presence of a power law singularity at the
lower limit.</p></dd>
<dt><a name="6"><b class="cmd">::math::calculus::romberg_powerLawUpper</b> <i class="arg">gamma</i> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></dt>
<dd><p>Integrates a function that is expected to be analytic over an interval
except for the presence of a power law singularity at the
upper limit.</p></dd>
<dt><a name="7"><b class="cmd">::math::calculus::romberg_expLower</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></dt>
<dd><p>Integrates an exponentially growing function; the lower limit of the
region of integration may be arbitrarily large and negative.</p></dd>
<dt><a name="8"><b class="cmd">::math::calculus::romberg_expUpper</b> <i class="arg">f</i> <i class="arg">a</i> <i class="arg">b</i> <span class="opt">?<i class="arg">-option value</i>...?</span></a></dt>
<dd><p>Integrates an exponentially decaying function; the upper limit of the
region of integration may be arbitrarily large.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PARAMETERS</a></h2>
<dl class="definitions">
<dt><i class="arg">f</i></dt>
<dd><p>Function to integrate.  Must be expressed as a single Tcl command,
to which will be appended a single argument, specifically, the
abscissa at which the function is to be evaluated. The first word
of the command will be processed with <b class="cmd">namespace which</b> in the
caller's scope prior to any evaluation. Given this processing, the
command may local to the calling namespace rather than needing to be
global.</p></dd>
<dt><i class="arg">a</i></dt>
<dd><p>Lower limit of the region of integration.</p></dd>
<dt><i class="arg">b</i></dt>
<dd><p>Upper limit of the region of integration.  For the
<b class="cmd">romberg_sqrtSingLower</b>, <b class="cmd">romberg_sqrtSingUpper</b>,
<b class="cmd">romberg_powerLawLower</b>, <b class="cmd">romberg_powerLawUpper</b>,
<b class="cmd">romberg_expLower</b>, and <b class="cmd">romberg_expUpper</b> procedures,
the lower limit must be strictly less than the upper.  For
the other procedures, the limits may appear in either order.</p></dd>
<dt><i class="arg">gamma</i></dt>
<dd><p>Power to use for a power law singularity; see section
<span class="sectref"><a href="#section6">IMPROPER INTEGRALS</a></span> for details.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">OPTIONS</a></h2>
<dl class="definitions">
<dt><b class="option">-abserror</b> <i class="arg">epsilon</i></dt>
<dd><p>Requests that the integration machinery proceed at most until
the estimated absolute error of the integral is less than
<i class="arg">epsilon</i>. The error may be seriously over- or underestimated
if the function (or any of its derivatives) contains singularities;
see section <span class="sectref"><a href="#section6">IMPROPER INTEGRALS</a></span> for details. Default
is 1.0e-08.</p></dd>
<dt><b class="option">-relerror</b> <i class="arg">epsilon</i></dt>
<dd><p>Requests that the integration machinery proceed at most until
the estimated relative error of the integral is less than
<i class="arg">epsilon</i>. The error may be seriously over- or underestimated
if the function (or any of its derivatives) contains singularities;
see section <span class="sectref"><a href="#section6">IMPROPER INTEGRALS</a></span> for details.  Default is
1.0e-06.</p></dd>
<dt><b class="option">-maxiter</b> <i class="arg">m</i></dt>
<dd><p>Requests that integration terminate after at most <i class="arg">n</i> triplings of
the number of evaluations performed.  In other words, given <i class="arg">n</i>
for <b class="option">-maxiter</b>, the integration machinery will make at most
3**<i class="arg">n</i> evaluations of the function.  Default is 14, corresponding
to a limit approximately 4.8 million evaluations. (Well-behaved
functions will seldom require more than a few hundred evaluations.)</p></dd>
<dt><b class="option">-degree</b> <i class="arg">d</i></dt>
<dd><p>Requests that an extrapolating polynomial of degree <i class="arg">d</i> be used
in Romberg integration; see section <span class="sectref"><a href="#section5">DESCRIPTION</a></span> for
details. Default is 4.  Can be at most <i class="arg">m</i>-1.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">DESCRIPTION</a></h2>
<p>The <b class="cmd">romberg</b> procedure performs Romberg integration using
the modified midpoint rule. Romberg integration is an iterative
process.  At the first step, the function is evaluated at the
midpoint of the region of integration, and the value is multiplied by
the width of the interval for the coarsest possible estimate.
At the second step, the interval is divided into three parts,
and the function is evaluated at the midpoint of each part; the
sum of the values is multiplied by three.  At the third step,
nine parts are used, at the fourth twenty-seven, and so on,
tripling the number of subdivisions at each step.</p>
<p>Once the interval has been divided at least <i class="arg">d</i> times,
a polynomial is fitted to the integrals estimated in the last
<i class="arg">d</i>+1 divisions.  The integrals are considered to be a
function of the square of the width of the subintervals
(any good numerical analysis text will discuss this process
under &quot;Romberg integration&quot;).  The polynomial is extrapolated
to a step size of zero, computing a value for the integral and
an estimate of the error.</p>
<p>This process will be well-behaved only if the function is analytic
over the region of integration; there may be removable singularities
at either end of the region provided that the limit of the function
(and of all its derivatives) exists as the ends are approached.
Thus, <b class="cmd">romberg</b> may be used to integrate a function like
f(x)=sin(x)/x over an interval beginning or ending at zero.</p>
<p>Note that <b class="cmd">romberg</b> will either fail to converge or else return
incorrect error estimates if the function, or any of its derivatives,
has a singularity anywhere in the region of integration (except for
the case mentioned above).  Care must be used, therefore, in
integrating a function like 1/(1-x**2) to avoid the places
where the derivative is singular.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">IMPROPER INTEGRALS</a></h2>
<p>Romberg integration is also useful for integrating functions over
half-infinite intervals or functions that have singularities.
The trick is to make a change of variable to eliminate the
singularity, and to put the singularity at one end or the other
of the region of integration.  The <b class="cmd"><a href="calculus.html">math::calculus</a></b> package
supplies a number of <b class="cmd">romberg</b> procedures to deal with the
commoner cases.</p>
<dl class="definitions">
<dt><b class="cmd">romberg_infinity</b></dt>
<dd><p>Integrates a function over a half-infinite interval; either
<i class="arg">a</i> or <i class="arg">b</i> may be infinite.  <i class="arg">a</i> and <i class="arg">b</i> must be
of the same sign; if you need to integrate across the axis,
say, from a negative value to positive infinity,
use <b class="cmd">romberg</b> to integrate from the negative
value to a small positive value, and then <b class="cmd">romberg_infinity</b>
to integrate from the positive value to positive infinity.  The
<b class="cmd">romberg_infinity</b> procedure works by making the change of
variable u=1/x, so that the integral from a to b of f(x) is
evaluated as the integral from 1/a to 1/b of f(1/u)/u**2.</p></dd>
<dt><b class="cmd">romberg_powerLawLower</b> and <b class="cmd">romberg_powerLawUpper</b></dt>
<dd><p>Integrate a function that has an integrable power law singularity
at either the lower or upper bound of the region of integration
(or has a derivative with a power law singularity there).
These procedures take a first parameter, <i class="arg">gamma</i>, which gives
the power law.  The function or its first derivative are presumed to diverge as
(x-<i class="arg">a</i>)**(-<i class="arg">gamma</i>) or (<i class="arg">b</i>-x)**(-<i class="arg">gamma</i>).  <i class="arg">gamma</i>
must be greater than zero and less than 1.</p>
<p>These procedures are useful not only in integrating functions
that go to infinity at one end of the region of integration, but
also functions whose derivatives do not exist at the end of
the region.  For instance, integrating f(x)=pow(x,0.25) with the
origin as one end of the region will result in the <b class="cmd">romberg</b>
procedure greatly underestimating the error in the integral.
The problem can be fixed by observing that the first derivative
of f(x), f'(x)=x**(-3/4)/4, goes to infinity at the origin.  Integrating
using <b class="cmd">romberg_powerLawLower</b> with <i class="arg">gamma</i> set to 0.75
gives much more orderly convergence.</p>
<p>These procedures operate by making the change of variable
u=(x-a)**(1-gamma) (<b class="cmd">romberg_powerLawLower</b>) or
u=(b-x)**(1-gamma) (<b class="cmd">romberg_powerLawUpper</b>).</p>
<p>To summarize the meaning of gamma:</p>
<ul class="itemized">
<li><p>If f(x) ~ x**(-a) (0 &lt; a &lt; 1), use gamma = a</p></li>
<li><p>If f'(x) ~ x**(-b) (0 &lt; b &lt; 1), use gamma = b</p></li>
</ul></dd>
<dt><b class="cmd">romberg_sqrtSingLower</b> and <b class="cmd">romberg_sqrtSingUpper</b></dt>
<dd><p>These procedures behave identically to <b class="cmd">romberg_powerLawLower</b> and
<b class="cmd">romberg_powerLawUpper</b> for the common case of <i class="arg">gamma</i>=0.5;
that is, they integrate a function with an inverse square root
singularity at one end of the interval.  They have a simpler
implementation involving square roots rather than arbitrary powers.</p></dd>
<dt><b class="cmd">romberg_expLower</b> and <b class="cmd">romberg_expUpper</b></dt>
<dd><p>These procedures are for integrating a function that grows or
decreases exponentially over a half-infinite interval.
<b class="cmd">romberg_expLower</b> handles exponentially growing functions, and
allows the lower limit of integration to be an arbitrarily large
negative number.  <b class="cmd">romberg_expUpper</b> handles exponentially
decaying functions and allows the upper limit of integration to
be an arbitrary large positive number.  The functions make the
change of variable u=exp(-x) and u=exp(x) respectively.</p></dd>
</dl>
</div>
<div id="section7" class="section"><h2><a name="section7">OTHER CHANGES OF VARIABLE</a></h2>
<p>If you need an improper integral other than the ones listed here,
a change of variable can be written in very few lines of Tcl.
Because the Tcl coding that does it is somewhat arcane,
we offer a worked example here.</p>
<p>Let's say that the function that we want to integrate is
f(x)=exp(x)/sqrt(1-x*x) (not a very natural
function, but a good example), and we want to integrate
it over the interval (-1,1).  The denominator falls to zero
at both ends of the interval. We wish to make a change of variable
from x to u
so that dx/sqrt(1-x**2) maps to du.  Choosing x=sin(u), we can
find that dx=cos(u)*du, and sqrt(1-x**2)=cos(u).  The integral
from a to b of f(x) is the integral from asin(a) to asin(b)
of f(sin(u))*cos(u).</p>
<p>We can make a function <b class="cmd">g</b> that accepts an arbitrary function
<b class="cmd">f</b> and the parameter u, and computes this new integrand.</p>
<pre class="example">
proc g { f u } {
    set x [expr { sin($u) }]
    set cmd $f; lappend cmd $x; set y [eval $cmd]
    return [expr { $y / cos($u) }]
}
</pre>
<p>Now integrating <b class="cmd">f</b> from <i class="arg">a</i> to <i class="arg">b</i> is the same
as integrating <b class="cmd">g</b> from <i class="arg">asin(a)</i> to <i class="arg">asin(b)</i>.
It's a little tricky to get <b class="cmd">f</b> consistently evaluated in
the caller's scope; the following procedure does it.</p>
<pre class="example">
proc romberg_sine { f a b args } {
    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
    set f [list g $f]
    return [eval [linsert $args 0 romberg $f [expr { asin($a) }] [expr { asin($b) }]]]
}
</pre>
<p>This <b class="cmd">romberg_sine</b> procedure will do any function with
sqrt(1-x*x) in the denominator. Our sample function is
f(x)=exp(x)/sqrt(1-x*x):</p>
<pre class="example">
proc f { x } {
    expr { exp($x) / sqrt( 1. - $x*$x ) }
}
</pre>
<p>Integrating it is a matter of applying <b class="cmd">romberg_sine</b>
as we would any of the other <b class="cmd">romberg</b> procedures:</p>
<pre class="example">
foreach { value error } [romberg_sine f -1.0 1.0] break
puts [format &quot;integral is %.6g +/- %.6g&quot; $value $error]
integral is 3.97746 +/- 2.3557e-010
</pre>
</div>
<div id="section8" class="section"><h2><a name="section8">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: calculus</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="calculus.html">math::calculus</a>, <a href="interpolate.html">math::interpolate</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Kevin B. Kenny &lt;[email protected]&gt;. All rights reserved. Redistribution permitted under the terms of the Open Publication License &lt;http://www.opencontent.org/openpub/&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/special.html.























































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>math::special - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/special.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ math::special.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::special(n) 0.2 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::special - Special mathematical functions</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a></li>
<li class="section"><a href="#section3">PROCEDURES</a></li>
<li class="section"><a href="#section4">THE ORTHOGONAL POLYNOMIALS</a></li>
<li class="section"><a href="#section5">REMARKS ON THE IMPLEMENTATION</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.3?</span></b></li>
<li>package require <b class="pkgname">math::special <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::special::Beta</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#2"><b class="cmd">::math::special::Gamma</b> <i class="arg">x</i> <i class="arg">y</i></a></li>
<li><a href="#3"><b class="cmd">::math::special::erf</b> <i class="arg">x</i></a></li>
<li><a href="#4"><b class="cmd">::math::special::erfc</b> <i class="arg">x</i></a></li>
<li><a href="#5"><b class="cmd">::math::special::J0</b> <i class="arg">x</i></a></li>
<li><a href="#6"><b class="cmd">::math::special::J1</b> <i class="arg">x</i></a></li>
<li><a href="#7"><b class="cmd">::math::special::Jn</b> <i class="arg">n</i> <i class="arg">x</i></a></li>
<li><a href="#8"><b class="cmd">::math::special::J1/2</b> <i class="arg">x</i></a></li>
<li><a href="#9"><b class="cmd">::math::special::J-1/2</b> <i class="arg">x</i></a></li>
<li><a href="#10"><b class="cmd">::math::special::I_n</b> <i class="arg">x</i></a></li>
<li><a href="#11"><b class="cmd">::math::special::cn</b> <i class="arg">u</i> <i class="arg">k</i></a></li>
<li><a href="#12"><b class="cmd">::math::special::dn</b> <i class="arg">u</i> <i class="arg">k</i></a></li>
<li><a href="#13"><b class="cmd">::math::special::sn</b> <i class="arg">u</i> <i class="arg">k</i></a></li>
<li><a href="#14"><b class="cmd">::math::special::elliptic_K</b> <i class="arg">k</i></a></li>
<li><a href="#15"><b class="cmd">::math::special::elliptic_E</b> <i class="arg">k</i></a></li>
<li><a href="#16"><b class="cmd">::math::special::exponential_Ei</b> <i class="arg">x</i></a></li>
<li><a href="#17"><b class="cmd">::math::special::exponential_En</b> <i class="arg">n</i> <i class="arg">x</i></a></li>
<li><a href="#18"><b class="cmd">::math::special::exponential_li</b> <i class="arg">x</i></a></li>
<li><a href="#19"><b class="cmd">::math::special::exponential_Ci</b> <i class="arg">x</i></a></li>
<li><a href="#20"><b class="cmd">::math::special::exponential_Si</b> <i class="arg">x</i></a></li>
<li><a href="#21"><b class="cmd">::math::special::exponential_Chi</b> <i class="arg">x</i></a></li>
<li><a href="#22"><b class="cmd">::math::special::exponential_Shi</b> <i class="arg">x</i></a></li>
<li><a href="#23"><b class="cmd">::math::special::fresnel_C</b> <i class="arg">x</i></a></li>
<li><a href="#24"><b class="cmd">::math::special::fresnel_S</b> <i class="arg">x</i></a></li>
<li><a href="#25"><b class="cmd">::math::special::sinc</b> <i class="arg">x</i></a></li>
<li><a href="#26"><b class="cmd">::math::special::legendre</b> <i class="arg">n</i></a></li>
<li><a href="#27"><b class="cmd">::math::special::chebyshev</b> <i class="arg">n</i></a></li>
<li><a href="#28"><b class="cmd">::math::special::laguerre</b> <i class="arg">alpha</i> <i class="arg">n</i></a></li>
<li><a href="#29"><b class="cmd">::math::special::hermite</b> <i class="arg">n</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements several so-called special functions, like
the Gamma function, the Bessel functions and such.</p>
<p>Each function is implemented by a procedure that bears its name (well,
in close approximation):</p>
<ul class="itemized">
<li><p>J0 for the zeroth-order Bessel function of the first kind</p></li>
<li><p>J1 for the first-order Bessel function of the first kind</p></li>
<li><p>Jn for the nth-order Bessel function of the first kind</p></li>
<li><p>J1/2 for the half-order Bessel function of the first kind</p></li>
<li><p>J-1/2 for the minus-half-order Bessel function of the first kind</p></li>
<li><p>I_n for the modified Bessel function of the first kind of order n</p></li>
<li><p>Gamma for the Gamma function, erf and erfc for the error function and
the complementary error function</p></li>
<li><p>fresnel_C and fresnel_S for the Fresnel integrals</p></li>
<li><p>elliptic_K and elliptic_E (complete elliptic integrals)</p></li>
<li><p>exponent_Ei and other functions related to the so-called exponential
integrals</p></li>
<li><p>legendre, hermite: some of the classical orthogonal polynomials.</p></li>
</ul>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<p>In the following table several characteristics of the functions in this
package are summarized: the domain for the argument, the values for the
parameters and error bounds.</p>
<pre class="example">
Family       | Function    | Domain x    | Parameter   | Error bound
-------------+-------------+-------------+-------------+--------------
Bessel       | J0, J1,     | all of R    | n = integer |   &lt; 1.0e-8
             | Jn          |             |             |  (|x|&lt;20, n&lt;20)
Bessel       | J1/2, J-1/2,|  x &gt; 0      | n = integer |   exact
Bessel       | I_n         | all of R    | n = integer |   &lt; 1.0e-6
             |             |             |             |
Elliptic     | cn          | 0 &lt;= x &lt;= 1 |     --      |   &lt; 1.0e-10
functions    | dn          | 0 &lt;= x &lt;= 1 |     --      |   &lt; 1.0e-10
             | sn          | 0 &lt;= x &lt;= 1 |     --      |   &lt; 1.0e-10
Elliptic     | K           | 0 &lt;= x &lt; 1  |     --      |   &lt; 1.0e-6
integrals    | E           | 0 &lt;= x &lt; 1  |     --      |   &lt; 1.0e-6
             |             |             |             |
Error        | erf         |             |     --      |
functions    | erfc        |             |             |
             | ierfc_n     |             |             |
             |             |             |             |
Exponential  | Ei          |  x != 0     |     --      |   &lt; 1.0e-10 (relative)
integrals    | En          |  x &gt;  0     |     --      |   as Ei
             | li          |  x &gt; 0      |     --      |   as Ei
             | Chi         |  x &gt; 0      |     --      |   &lt; 1.0e-8
             | Shi         |  x &gt; 0      |     --      |   &lt; 1.0e-8
             | Ci          |  x &gt; 0      |     --      |   &lt; 2.0e-4
             | Si          |  x &gt; 0      |     --      |   &lt; 2.0e-4
             |             |             |             |
Fresnel      | C           |  all of R   |     --      |   &lt; 2.0e-3
integrals    | S           |  all of R   |     --      |   &lt; 2.0e-3
             |             |             |             |
general      | Beta        | (see Gamma) |     --      |   &lt; 1.0e-9
             | Gamma       |  x != 0,-1, |     --      |   &lt; 1.0e-9
             |             |  -2, ...    |             |
             | sinc        |  all of R   |     --      |   exact
             |             |             |             |
orthogonal   | Legendre    |  all of R   | n = 0,1,... |   exact
polynomials  | Chebyshev   |  all of R   | n = 0,1,... |   exact
             | Laguerre    |  all of R   | n = 0,1,... |   exact
             |             |             | alpha el. R |
             | Hermite     |  all of R   | n = 0,1,... |   exact
</pre>
<p><em>Note:</em> Some of the error bounds are estimated, as no
&quot;formal&quot; bounds were available with the implemented approximation
method, others hold for the auxiliary functions used for estimating
the primary functions.</p>
<p>The following well-known functions are currently missing from the package:</p>
<ul class="itemized">
<li><p>Bessel functions of the second kind (Y_n, K_n)</p></li>
<li><p>Bessel functions of arbitrary order (and hence the Airy functions)</p></li>
<li><p>Chebyshev polynomials of the second kind (U_n)</p></li>
<li><p>The digamma function (psi)</p></li>
<li><p>The incomplete gamma and beta functions</p></li>
</ul>
</div>
<div id="section3" class="section"><h2><a name="section3">PROCEDURES</a></h2>
<p>The package defines the following public procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::special::Beta</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Compute the Beta function for arguments &quot;x&quot; and &quot;y&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>First argument for the Beta function</p></dd>
<dt>float <i class="arg">y</i></dt>
<dd><p>Second argument for the Beta function</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::special::Gamma</b> <i class="arg">x</i> <i class="arg">y</i></a></dt>
<dd><p>Compute the Gamma function for argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the Gamma function</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::special::erf</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the error function for argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the error function</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::math::special::erfc</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the complementary error function for argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the complementary error function</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::math::special::J0</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the zeroth-order Bessel function of the first kind for the
argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the Bessel function</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::math::special::J1</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the first-order Bessel function of the first kind for the
argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the Bessel function</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::math::special::Jn</b> <i class="arg">n</i> <i class="arg">x</i></a></dt>
<dd><p>Compute the nth-order Bessel function of the first kind for the
argument &quot;x&quot;</p>
<dl class="arguments">
<dt>integer <i class="arg">n</i></dt>
<dd><p>Order of the Bessel function</p></dd>
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the Bessel function</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::math::special::J1/2</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the half-order Bessel function of the first kind for the
argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the Bessel function</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::math::special::J-1/2</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the minus-half-order Bessel function of the first kind for the
argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the Bessel function</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::math::special::I_n</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the modified Bessel function of the first kind of order n for
the argument &quot;x&quot;</p>
<dl class="arguments">
<dt>int <i class="arg">x</i></dt>
<dd><p>Positive integer order of the function</p></dd>
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::math::special::cn</b> <i class="arg">u</i> <i class="arg">k</i></a></dt>
<dd><p>Compute the elliptic function <em>cn</em> for the argument &quot;u&quot; and
parameter &quot;k&quot;.</p>
<dl class="arguments">
<dt>float <i class="arg">u</i></dt>
<dd><p>Argument for the function</p></dd>
<dt>float <i class="arg">k</i></dt>
<dd><p>Parameter</p></dd>
</dl></dd>
<dt><a name="12"><b class="cmd">::math::special::dn</b> <i class="arg">u</i> <i class="arg">k</i></a></dt>
<dd><p>Compute the elliptic function <em>dn</em> for the argument &quot;u&quot; and
parameter &quot;k&quot;.</p>
<dl class="arguments">
<dt>float <i class="arg">u</i></dt>
<dd><p>Argument for the function</p></dd>
<dt>float <i class="arg">k</i></dt>
<dd><p>Parameter</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::math::special::sn</b> <i class="arg">u</i> <i class="arg">k</i></a></dt>
<dd><p>Compute the elliptic function <em>sn</em> for the argument &quot;u&quot; and
parameter &quot;k&quot;.</p>
<dl class="arguments">
<dt>float <i class="arg">u</i></dt>
<dd><p>Argument for the function</p></dd>
<dt>float <i class="arg">k</i></dt>
<dd><p>Parameter</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">::math::special::elliptic_K</b> <i class="arg">k</i></a></dt>
<dd><p>Compute the complete elliptic integral of the first kind
for the argument &quot;k&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">k</i></dt>
<dd><p>Argument for the function</p></dd>
</dl></dd>
<dt><a name="15"><b class="cmd">::math::special::elliptic_E</b> <i class="arg">k</i></a></dt>
<dd><p>Compute the complete elliptic integral of the second kind
for the argument &quot;k&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">k</i></dt>
<dd><p>Argument for the function</p></dd>
</dl></dd>
<dt><a name="16"><b class="cmd">::math::special::exponential_Ei</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the exponential integral of the second kind
for the argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function (x != 0)</p></dd>
</dl></dd>
<dt><a name="17"><b class="cmd">::math::special::exponential_En</b> <i class="arg">n</i> <i class="arg">x</i></a></dt>
<dd><p>Compute the exponential integral of the first kind
for the argument &quot;x&quot; and order n</p>
<dl class="arguments">
<dt>int <i class="arg">n</i></dt>
<dd><p>Order of the integral (n &gt;= 0)</p></dd>
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function (x &gt;= 0)</p></dd>
</dl></dd>
<dt><a name="18"><b class="cmd">::math::special::exponential_li</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the logarithmic integral for the argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function (x &gt; 0)</p></dd>
</dl></dd>
<dt><a name="19"><b class="cmd">::math::special::exponential_Ci</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the cosine integral for the argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function (x &gt; 0)</p></dd>
</dl></dd>
<dt><a name="20"><b class="cmd">::math::special::exponential_Si</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the sine integral for the argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function (x &gt; 0)</p></dd>
</dl></dd>
<dt><a name="21"><b class="cmd">::math::special::exponential_Chi</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the hyperbolic cosine integral for the argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function (x &gt; 0)</p></dd>
</dl></dd>
<dt><a name="22"><b class="cmd">::math::special::exponential_Shi</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the hyperbolic sine integral for the argument &quot;x&quot;</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function (x &gt; 0)</p></dd>
</dl></dd>
<dt><a name="23"><b class="cmd">::math::special::fresnel_C</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the Fresnel cosine integral for real argument x</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function</p></dd>
</dl></dd>
<dt><a name="24"><b class="cmd">::math::special::fresnel_S</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the Fresnel sine integral for real argument x</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function</p></dd>
</dl></dd>
<dt><a name="25"><b class="cmd">::math::special::sinc</b> <i class="arg">x</i></a></dt>
<dd><p>Compute the sinc function for real argument x</p>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>Argument for the function</p></dd>
</dl></dd>
<dt><a name="26"><b class="cmd">::math::special::legendre</b> <i class="arg">n</i></a></dt>
<dd><p>Return the Legendre polynomial of degree n
(see <span class="sectref"><a href="#section4">THE ORTHOGONAL POLYNOMIALS</a></span>)</p>
<dl class="arguments">
<dt>int <i class="arg">n</i></dt>
<dd><p>Degree of the polynomial</p></dd>
</dl></dd>
<dt><a name="27"><b class="cmd">::math::special::chebyshev</b> <i class="arg">n</i></a></dt>
<dd><p>Return the Chebyshev polynomial of degree n (of the first kind)</p>
<dl class="arguments">
<dt>int <i class="arg">n</i></dt>
<dd><p>Degree of the polynomial</p></dd>
</dl></dd>
<dt><a name="28"><b class="cmd">::math::special::laguerre</b> <i class="arg">alpha</i> <i class="arg">n</i></a></dt>
<dd><p>Return the Laguerre polynomial of degree n with parameter alpha</p>
<dl class="arguments">
<dt>float <i class="arg">alpha</i></dt>
<dd><p>Parameter of the Laguerre polynomial</p></dd>
<dt>int <i class="arg">n</i></dt>
<dd><p>Degree of the polynomial</p></dd>
</dl></dd>
<dt><a name="29"><b class="cmd">::math::special::hermite</b> <i class="arg">n</i></a></dt>
<dd><p>Return the Hermite polynomial of degree n</p>
<dl class="arguments">
<dt>int <i class="arg">n</i></dt>
<dd><p>Degree of the polynomial</p></dd>
</dl></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">THE ORTHOGONAL POLYNOMIALS</a></h2>
<p>For dealing with the classical families of orthogonal polynomials, the
package relies on the <em>math::polynomials</em> package. To evaluate the
polynomial at some coordinate, use the <em>evalPolyn</em> command:</p>
<pre class="example">
   set leg2 [::math::special::legendre 2]
   puts &quot;Value at x=$x: [::math::polynomials::evalPolyn $leg2 $x]&quot;
</pre>
<p>The return value from the <em>legendre</em> and other commands is actually
the definition of the corresponding polynomial as used in that package.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">REMARKS ON THE IMPLEMENTATION</a></h2>
<p>It should be noted, that the actual implementation of J0 and J1 depends
on straightforward Gaussian quadrature formulas. The (absolute) accuracy
of the results is of the order 1.0e-4 or better. The main reason to
implement them like that was that it was fast to do (the formulas are
simple) and the computations are fast too.</p>
<p>The implementation of J1/2 does not suffer from this: this function can
be expressed exactly in terms of elementary functions.</p>
<p>The functions J0 and J1 are the ones you will encounter most frequently
in practice.</p>
<p>The computation of I_n is based on Miller's algorithm for computing the
minimal function from recurrence relations.</p>
<p>The computation of the Gamma and Beta functions relies on the
combinatorics package, whereas that of the error functions relies on the
statistics package.</p>
<p>The computation of the complete elliptic integrals uses the AGM
algorithm.</p>
<p>Much information about these functions can be found in:</p>
<p>Abramowitz and Stegun: <em>Handbook of Mathematical Functions</em>
(Dover, ISBN 486-61272-4)</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: special</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key637">Bessel functions</a>, <a href="../../../../index.html#key635">error function</a>, <a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key636">special functions</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/statistics.html.
















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math::statistics - Tcl Math Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/statistics.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ math::statistics.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::statistics(n) 0.8 tcllib &quot;Tcl Math Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::statistics - Basic statistical functions and procedures</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">GENERAL PROCEDURES</a></li>
<li class="section"><a href="#section3">MULTIVARIATE LINEAR REGRESSION</a></li>
<li class="section"><a href="#section4">STATISTICAL DISTRIBUTIONS</a></li>
<li class="section"><a href="#section5">DATA MANIPULATION</a></li>
<li class="section"><a href="#section6">PLOT PROCEDURES</a></li>
<li class="section"><a href="#section7">THINGS TO DO</a></li>
<li class="section"><a href="#section8">EXAMPLES</a></li>
<li class="section"><a href="#section9">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">math::statistics 0.8</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::math::statistics::mean</b> <i class="arg">data</i></a></li>
<li><a href="#2"><b class="cmd">::math::statistics::min</b> <i class="arg">data</i></a></li>
<li><a href="#3"><b class="cmd">::math::statistics::max</b> <i class="arg">data</i></a></li>
<li><a href="#4"><b class="cmd">::math::statistics::number</b> <i class="arg">data</i></a></li>
<li><a href="#5"><b class="cmd">::math::statistics::stdev</b> <i class="arg">data</i></a></li>
<li><a href="#6"><b class="cmd">::math::statistics::var</b> <i class="arg">data</i></a></li>
<li><a href="#7"><b class="cmd">::math::statistics::pstdev</b> <i class="arg">data</i></a></li>
<li><a href="#8"><b class="cmd">::math::statistics::pvar</b> <i class="arg">data</i></a></li>
<li><a href="#9"><b class="cmd">::math::statistics::median</b> <i class="arg">data</i></a></li>
<li><a href="#10"><b class="cmd">::math::statistics::basic-stats</b> <i class="arg">data</i></a></li>
<li><a href="#11"><b class="cmd">::math::statistics::histogram</b> <i class="arg">limits</i> <i class="arg">values</i></a></li>
<li><a href="#12"><b class="cmd">::math::statistics::corr</b> <i class="arg">data1</i> <i class="arg">data2</i></a></li>
<li><a href="#13"><b class="cmd">::math::statistics::interval-mean-stdev</b> <i class="arg">data</i> <i class="arg">confidence</i></a></li>
<li><a href="#14"><b class="cmd">::math::statistics::t-test-mean</b> <i class="arg">data</i> <i class="arg">est_mean</i> <i class="arg">est_stdev</i> <i class="arg">confidence</i></a></li>
<li><a href="#15"><b class="cmd">::math::statistics::test-normal</b> <i class="arg">data</i> <i class="arg">confidence</i></a></li>
<li><a href="#16"><b class="cmd">::math::statistics::lillieforsFit</b> <i class="arg">data</i></a></li>
<li><a href="#17"><b class="cmd">::math::statistics::quantiles</b> <i class="arg">data</i> <i class="arg">confidence</i></a></li>
<li><a href="#18"><b class="cmd">::math::statistics::quantiles</b> <i class="arg">limits</i> <i class="arg">counts</i> <i class="arg">confidence</i></a></li>
<li><a href="#19"><b class="cmd">::math::statistics::autocorr</b> <i class="arg">data</i></a></li>
<li><a href="#20"><b class="cmd">::math::statistics::crosscorr</b> <i class="arg">data1</i> <i class="arg">data2</i></a></li>
<li><a href="#21"><b class="cmd">::math::statistics::mean-histogram-limits</b> <i class="arg">mean</i> <i class="arg">stdev</i> <i class="arg">number</i></a></li>
<li><a href="#22"><b class="cmd">::math::statistics::minmax-histogram-limits</b> <i class="arg">min</i> <i class="arg">max</i> <i class="arg">number</i></a></li>
<li><a href="#23"><b class="cmd">::math::statistics::linear-model</b> <i class="arg">xdata</i> <i class="arg">ydata</i> <i class="arg">intercept</i></a></li>
<li><a href="#24"><b class="cmd">::math::statistics::linear-residuals</b> <i class="arg">xdata</i> <i class="arg">ydata</i> <i class="arg">intercept</i></a></li>
<li><a href="#25"><b class="cmd">::math::statistics::test-2x2</b> <i class="arg">n11</i> <i class="arg">n21</i> <i class="arg">n12</i> <i class="arg">n22</i></a></li>
<li><a href="#26"><b class="cmd">::math::statistics::print-2x2</b> <i class="arg">n11</i> <i class="arg">n21</i> <i class="arg">n12</i> <i class="arg">n22</i></a></li>
<li><a href="#27"><b class="cmd">::math::statistics::control-xbar</b> <i class="arg">data</i> <span class="opt">?nsamples?</span></a></li>
<li><a href="#28"><b class="cmd">::math::statistics::control-Rchart</b> <i class="arg">data</i> <span class="opt">?nsamples?</span></a></li>
<li><a href="#29"><b class="cmd">::math::statistics::test-xbar</b> <i class="arg">control</i> <i class="arg">data</i></a></li>
<li><a href="#30"><b class="cmd">::math::statistics::test-Rchart</b> <i class="arg">control</i> <i class="arg">data</i></a></li>
<li><a href="#31"><b class="cmd">::math::statistics::tstat</b> <i class="arg">dof</i> <span class="opt">?alpha?</span></a></li>
<li><a href="#32"><b class="cmd">::math::statistics::mv-wls</b> <i class="arg">wt1</i> <i class="arg">weights_and_values</i></a></li>
<li><a href="#33"><b class="cmd">::math::statistics::mv-ols</b> <i class="arg">values</i></a></li>
<li><a href="#34"><b class="cmd">::math::statistics::pdf-normal</b> <i class="arg">mean</i> <i class="arg">stdev</i> <i class="arg">value</i></a></li>
<li><a href="#35"><b class="cmd">::math::statistics::pdf-exponential</b> <i class="arg">mean</i> <i class="arg">value</i></a></li>
<li><a href="#36"><b class="cmd">::math::statistics::pdf-uniform</b> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">value</i></a></li>
<li><a href="#37"><b class="cmd">::math::statistics::pdf-gamma</b> <i class="arg">alpha</i> <i class="arg">beta</i> <i class="arg">value</i></a></li>
<li><a href="#38"><b class="cmd">::math::statistics::pdf-poisson</b> <i class="arg">mu</i> <i class="arg">k</i></a></li>
<li><a href="#39"><b class="cmd">::math::statistics::pdf-chisquare</b> <i class="arg">df</i> <i class="arg">value</i></a></li>
<li><a href="#40"><b class="cmd">::math::statistics::pdf-student-t</b> <i class="arg">df</i> <i class="arg">value</i></a></li>
<li><a href="#41"><b class="cmd">::math::statistics::pdf-beta</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">value</i></a></li>
<li><a href="#42"><b class="cmd">::math::statistics::cdf-normal</b> <i class="arg">mean</i> <i class="arg">stdev</i> <i class="arg">value</i></a></li>
<li><a href="#43"><b class="cmd">::math::statistics::cdf-exponential</b> <i class="arg">mean</i> <i class="arg">value</i></a></li>
<li><a href="#44"><b class="cmd">::math::statistics::cdf-uniform</b> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">value</i></a></li>
<li><a href="#45"><b class="cmd">::math::statistics::cdf-students-t</b> <i class="arg">degrees</i> <i class="arg">value</i></a></li>
<li><a href="#46"><b class="cmd">::math::statistics::cdf-gamma</b> <i class="arg">alpha</i> <i class="arg">beta</i> <i class="arg">value</i></a></li>
<li><a href="#47"><b class="cmd">::math::statistics::cdf-poisson</b> <i class="arg">mu</i> <i class="arg">k</i></a></li>
<li><a href="#48"><b class="cmd">::math::statistics::cdf-beta</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">value</i></a></li>
<li><a href="#49"><b class="cmd">::math::statistics::random-normal</b> <i class="arg">mean</i> <i class="arg">stdev</i> <i class="arg">number</i></a></li>
<li><a href="#50"><b class="cmd">::math::statistics::random-exponential</b> <i class="arg">mean</i> <i class="arg">number</i></a></li>
<li><a href="#51"><b class="cmd">::math::statistics::random-uniform</b> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">number</i></a></li>
<li><a href="#52"><b class="cmd">::math::statistics::random-gamma</b> <i class="arg">alpha</i> <i class="arg">beta</i> <i class="arg">number</i></a></li>
<li><a href="#53"><b class="cmd">::math::statistics::random-chisquare</b> <i class="arg">df</i> <i class="arg">number</i></a></li>
<li><a href="#54"><b class="cmd">::math::statistics::random-student-t</b> <i class="arg">df</i> <i class="arg">number</i></a></li>
<li><a href="#55"><b class="cmd">::math::statistics::random-beta</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">number</i></a></li>
<li><a href="#56"><b class="cmd">::math::statistics::histogram-uniform</b> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">limits</i> <i class="arg">number</i></a></li>
<li><a href="#57"><b class="cmd">::math::statistics::incompleteGamma</b> <i class="arg">x</i> <i class="arg">p</i> <span class="opt">?tol?</span></a></li>
<li><a href="#58"><b class="cmd">::math::statistics::incompleteBeta</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">x</i> <span class="opt">?tol?</span></a></li>
<li><a href="#59"><b class="cmd">::math::statistics::filter</b> <i class="arg">varname</i> <i class="arg">data</i> <i class="arg">expression</i></a></li>
<li><a href="#60"><b class="cmd">::math::statistics::map</b> <i class="arg">varname</i> <i class="arg">data</i> <i class="arg">expression</i></a></li>
<li><a href="#61"><b class="cmd">::math::statistics::samplescount</b> <i class="arg">varname</i> <i class="arg">list</i> <i class="arg">expression</i></a></li>
<li><a href="#62"><b class="cmd">::math::statistics::subdivide</b></a></li>
<li><a href="#63"><b class="cmd">::math::statistics::test-Kruskal-Wallis</b> <i class="arg">confidence</i> <i class="arg">args</i></a></li>
<li><a href="#64"><b class="cmd">::math::statistics::analyse-Kruskal-Wallis</b> <i class="arg">args</i></a></li>
<li><a href="#65"><b class="cmd">::math::statistics::group-rank</b> <i class="arg">args</i></a></li>
<li><a href="#66"><b class="cmd">::math::statistics::test-Wilcoxon</b> <i class="arg">sample_a</i> <i class="arg">sample_b</i></a></li>
<li><a href="#67"><b class="cmd">::math::statistics::spearman-rank</b> <i class="arg">sample_a</i> <i class="arg">sample_b</i></a></li>
<li><a href="#68"><b class="cmd">::math::statistics::spearman-rank-extended</b> <i class="arg">sample_a</i> <i class="arg">sample_b</i></a></li>
<li><a href="#69"><b class="cmd">::math::statistics::plot-scale</b> <i class="arg">canvas</i> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">ymin</i> <i class="arg">ymax</i></a></li>
<li><a href="#70"><b class="cmd">::math::statistics::plot-xydata</b> <i class="arg">canvas</i> <i class="arg">xdata</i> <i class="arg">ydata</i> <i class="arg">tag</i></a></li>
<li><a href="#71"><b class="cmd">::math::statistics::plot-xyline</b> <i class="arg">canvas</i> <i class="arg">xdata</i> <i class="arg">ydata</i> <i class="arg">tag</i></a></li>
<li><a href="#72"><b class="cmd">::math::statistics::plot-tdata</b> <i class="arg">canvas</i> <i class="arg">tdata</i> <i class="arg">tag</i></a></li>
<li><a href="#73"><b class="cmd">::math::statistics::plot-tline</b> <i class="arg">canvas</i> <i class="arg">tdata</i> <i class="arg">tag</i></a></li>
<li><a href="#74"><b class="cmd">::math::statistics::plot-histogram</b> <i class="arg">canvas</i> <i class="arg">counts</i> <i class="arg">limits</i> <i class="arg">tag</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">math::statistics</b> package contains functions and procedures for
basic statistical data analysis, such as:</p>
<ul class="itemized">
<li><p>Descriptive statistical parameters (mean, minimum, maximum, standard
deviation)</p></li>
<li><p>Estimates of the distribution in the form of histograms and quantiles</p></li>
<li><p>Basic testing of hypotheses</p></li>
<li><p>Probability and cumulative density functions</p></li>
</ul>
<p>It is meant to help in developing data analysis applications or doing
ad hoc data analysis, it is not in itself a full application, nor is it
intended to rival with full (non-)commercial statistical packages.</p>
<p>The purpose of this document is to describe the implemented procedures
and provide some examples of their usage. As there is ample literature
on the algorithms involved, we refer to relevant text books for more
explanations.
The package contains a fairly large number of public procedures. They
can be distinguished in three sets: general procedures, procedures
that deal with specific statistical distributions, list procedures to
select or transform data and simple plotting procedures (these require
Tk).
<em>Note:</em> The data that need to be analyzed are always contained in a
simple list. Missing values are represented as empty list elements.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">GENERAL PROCEDURES</a></h2>
<p>The general statistical procedures are:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::math::statistics::mean</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term">mean</i> value of the given list of data.</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::math::statistics::min</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term"><a href="../../../../index.html#key261">minimum</a></i> value of the given list of data.</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::math::statistics::max</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term"><a href="../../../../index.html#key262">maximum</a></i> value of the given list of data.</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::math::statistics::number</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term">number</i> of non-missing data in the given list</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::math::statistics::stdev</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term">sample standard deviation</i> of the data in the
given list</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::math::statistics::var</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term">sample variance</i> of the data in the given list</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::math::statistics::pstdev</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term">population standard deviation</i> of the data
in the given list</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::math::statistics::pvar</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term">population variance</i> of the data in the
given list</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::math::statistics::median</b> <i class="arg">data</i></a></dt>
<dd><p>Determine the <i class="term">median</i> of the data in the given list
(Note that this requires sorting the data, which may be a
costly operation)</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::math::statistics::basic-stats</b> <i class="arg">data</i></a></dt>
<dd><p>Determine a list of all the descriptive parameters: mean, minimum,
maximum, number of data, sample standard deviation, sample variance,
population standard deviation and population variance.</p>
<p>(This routine is called whenever either or all of the basic statistical
parameters are required. Hence all calculations are done and the
relevant values are returned.)</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::math::statistics::histogram</b> <i class="arg">limits</i> <i class="arg">values</i></a></dt>
<dd><p>Determine histogram information for the given list of data. Returns a
list consisting of the number of values that fall into each interval.
(The first interval consists of all values lower than the first limit,
the last interval consists of all values greater than the last limit.
There is one more interval than there are limits.)</p>
<dl class="arguments">
<dt>list <i class="arg">limits</i></dt>
<dd><p>- List of upper limits (in ascending order) for the
intervals of the histogram.</p></dd>
<dt>list <i class="arg">values</i></dt>
<dd><p>- List of data</p></dd>
</dl></dd>
<dt><a name="12"><b class="cmd">::math::statistics::corr</b> <i class="arg">data1</i> <i class="arg">data2</i></a></dt>
<dd><p>Determine the correlation coefficient between two sets of data.</p>
<dl class="arguments">
<dt>list <i class="arg">data1</i></dt>
<dd><p>- First list of data</p></dd>
<dt>list <i class="arg">data2</i></dt>
<dd><p>- Second list of data</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::math::statistics::interval-mean-stdev</b> <i class="arg">data</i> <i class="arg">confidence</i></a></dt>
<dd><p>Return the interval containing the mean value and one
containing the standard deviation with a certain
level of confidence (assuming a normal distribution)</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of raw data values (small sample)</p></dd>
<dt>float <i class="arg">confidence</i></dt>
<dd><p>- Confidence level (0.95 or 0.99 for instance)</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">::math::statistics::t-test-mean</b> <i class="arg">data</i> <i class="arg">est_mean</i> <i class="arg">est_stdev</i> <i class="arg">confidence</i></a></dt>
<dd><p>Test whether the mean value of a sample is in accordance with the
estimated normal distribution with a certain level of confidence.
Returns 1 if the test succeeds or 0 if the mean is unlikely to fit
the given distribution.</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of raw data values (small sample)</p></dd>
<dt>float <i class="arg">est_mean</i></dt>
<dd><p>- Estimated mean of the distribution</p></dd>
<dt>float <i class="arg">est_stdev</i></dt>
<dd><p>- Estimated stdev of the distribution</p></dd>
<dt>float <i class="arg">confidence</i></dt>
<dd><p>- Confidence level (0.95 or 0.99 for instance)</p></dd>
</dl></dd>
<dt><a name="15"><b class="cmd">::math::statistics::test-normal</b> <i class="arg">data</i> <i class="arg">confidence</i></a></dt>
<dd><p>Test whether the given data follow a normal distribution
with a certain level of confidence.
Returns 1 if the data are normally distributed within the level of
confidence, returns 0 if not. The underlying test is the Lilliefors
test.</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of raw data values</p></dd>
<dt>float <i class="arg">confidence</i></dt>
<dd><p>- Confidence level (one of 0.80, 0.90, 0.95 or 0.99)</p></dd>
</dl></dd>
<dt><a name="16"><b class="cmd">::math::statistics::lillieforsFit</b> <i class="arg">data</i></a></dt>
<dd><p>Returns the goodness of fit to a normal distribution according to
Lilliefors. The higher the number, the more likely the data are indeed
normally distributed. The test requires at least <em>five</em> data
points.</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of raw data values</p></dd>
</dl></dd>
<dt><a name="17"><b class="cmd">::math::statistics::quantiles</b> <i class="arg">data</i> <i class="arg">confidence</i></a></dt>
<dd><p>Return the quantiles for a given set of data</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of raw data values</p></dd>
<dt>float <i class="arg">confidence</i></dt>
<dd><p>- Confidence level (0.95 or 0.99 for instance)</p></dd>
</dl></dd>
<dt><a name="18"><b class="cmd">::math::statistics::quantiles</b> <i class="arg">limits</i> <i class="arg">counts</i> <i class="arg">confidence</i></a></dt>
<dd><p>Return the quantiles based on histogram information (alternative to the
call with two arguments)</p>
<dl class="arguments">
<dt>list <i class="arg">limits</i></dt>
<dd><p>- List of upper limits from histogram</p></dd>
<dt>list <i class="arg">counts</i></dt>
<dd><p>- List of counts for for each interval in histogram</p></dd>
<dt>float <i class="arg">confidence</i></dt>
<dd><p>-  Confidence level (0.95 or 0.99 for instance)</p></dd>
</dl></dd>
<dt><a name="19"><b class="cmd">::math::statistics::autocorr</b> <i class="arg">data</i></a></dt>
<dd><p>Return the autocorrelation function as a list of values (assuming
equidistance between samples, about 1/2 of the number of raw data)</p>
<p>The correlation is determined in such a way that the first value is
always 1 and all others are equal to or smaller than 1. The number of
values involved will diminish as the &quot;time&quot; (the index in the list of
returned values) increases</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- Raw data for which the autocorrelation must be determined</p></dd>
</dl></dd>
<dt><a name="20"><b class="cmd">::math::statistics::crosscorr</b> <i class="arg">data1</i> <i class="arg">data2</i></a></dt>
<dd><p>Return the cross-correlation function as a list of values (assuming
equidistance between samples, about 1/2 of the number of raw data)</p>
<p>The correlation is determined in such a way that the values can never
exceed 1 in magnitude. The number of values involved will diminish
as the &quot;time&quot; (the index in the list of returned values) increases.</p>
<dl class="arguments">
<dt>list <i class="arg">data1</i></dt>
<dd><p>- First list of data</p></dd>
<dt>list <i class="arg">data2</i></dt>
<dd><p>- Second list of data</p></dd>
</dl></dd>
<dt><a name="21"><b class="cmd">::math::statistics::mean-histogram-limits</b> <i class="arg">mean</i> <i class="arg">stdev</i> <i class="arg">number</i></a></dt>
<dd><p>Determine reasonable limits based on mean and standard deviation
for a histogram
Convenience function - the result is suitable for the histogram function.</p>
<dl class="arguments">
<dt>float <i class="arg">mean</i></dt>
<dd><p>- Mean of the data</p></dd>
<dt>float <i class="arg">stdev</i></dt>
<dd><p>- Standard deviation</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of limits to generate (defaults to 8)</p></dd>
</dl></dd>
<dt><a name="22"><b class="cmd">::math::statistics::minmax-histogram-limits</b> <i class="arg">min</i> <i class="arg">max</i> <i class="arg">number</i></a></dt>
<dd><p>Determine reasonable limits based on a minimum and maximum for a histogram</p>
<p>Convenience function - the result is suitable for the histogram function.</p>
<dl class="arguments">
<dt>float <i class="arg">min</i></dt>
<dd><p>- Expected minimum</p></dd>
<dt>float <i class="arg">max</i></dt>
<dd><p>- Expected maximum</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of limits to generate (defaults to 8)</p></dd>
</dl></dd>
<dt><a name="23"><b class="cmd">::math::statistics::linear-model</b> <i class="arg">xdata</i> <i class="arg">ydata</i> <i class="arg">intercept</i></a></dt>
<dd><p>Determine the coefficients for a linear regression between
two series of data (the model: Y = A + B*X). Returns a list of
parameters describing the fit</p>
<dl class="arguments">
<dt>list <i class="arg">xdata</i></dt>
<dd><p>- List of independent data</p></dd>
<dt>list <i class="arg">ydata</i></dt>
<dd><p>- List of dependent data to be fitted</p></dd>
<dt>boolean <i class="arg">intercept</i></dt>
<dd><p>- (Optional) compute the intercept (1, default) or fit
to a line through the origin (0)</p>
<p>The result consists of the following list:</p>
<ul class="itemized">
<li><p>(Estimate of) Intercept A</p></li>
<li><p>(Estimate of) Slope B</p></li>
<li><p>Standard deviation of Y relative to fit</p></li>
<li><p>Correlation coefficient R2</p></li>
<li><p>Number of degrees of freedom df</p></li>
<li><p>Standard error of the intercept A</p></li>
<li><p>Significance level of A</p></li>
<li><p>Standard error of the slope B</p></li>
<li><p>Significance level of B</p></li>
</ul></dd>
</dl></dd>
<dt><a name="24"><b class="cmd">::math::statistics::linear-residuals</b> <i class="arg">xdata</i> <i class="arg">ydata</i> <i class="arg">intercept</i></a></dt>
<dd><p>Determine the difference between actual data and predicted from
the linear model.</p>
<p>Returns a list of the differences between the actual data and the
predicted values.</p>
<dl class="arguments">
<dt>list <i class="arg">xdata</i></dt>
<dd><p>- List of independent data</p></dd>
<dt>list <i class="arg">ydata</i></dt>
<dd><p>- List of dependent data to be fitted</p></dd>
<dt>boolean <i class="arg">intercept</i></dt>
<dd><p>- (Optional) compute the intercept (1, default) or fit
to a line through the origin (0)</p></dd>
</dl></dd>
<dt><a name="25"><b class="cmd">::math::statistics::test-2x2</b> <i class="arg">n11</i> <i class="arg">n21</i> <i class="arg">n12</i> <i class="arg">n22</i></a></dt>
<dd><p>Determine if two set of samples, each from a binomial distribution,
differ significantly or not (implying a different parameter).</p>
<p>Returns the &quot;chi-square&quot; value, which can be used to the determine the
significance.</p>
<dl class="arguments">
<dt>int <i class="arg">n11</i></dt>
<dd><p>- Number of outcomes with the first value from the first sample.</p></dd>
<dt>int <i class="arg">n21</i></dt>
<dd><p>- Number of outcomes with the first value from the second sample.</p></dd>
<dt>int <i class="arg">n12</i></dt>
<dd><p>- Number of outcomes with the second value from the first sample.</p></dd>
<dt>int <i class="arg">n22</i></dt>
<dd><p>- Number of outcomes with the second value from the second sample.</p></dd>
</dl></dd>
<dt><a name="26"><b class="cmd">::math::statistics::print-2x2</b> <i class="arg">n11</i> <i class="arg">n21</i> <i class="arg">n12</i> <i class="arg">n22</i></a></dt>
<dd><p>Determine if two set of samples, each from a binomial distribution,
differ significantly or not (implying a different parameter).</p>
<p>Returns a short report, useful in an interactive session.</p>
<dl class="arguments">
<dt>int <i class="arg">n11</i></dt>
<dd><p>- Number of outcomes with the first value from the first sample.</p></dd>
<dt>int <i class="arg">n21</i></dt>
<dd><p>- Number of outcomes with the first value from the second sample.</p></dd>
<dt>int <i class="arg">n12</i></dt>
<dd><p>- Number of outcomes with the second value from the first sample.</p></dd>
<dt>int <i class="arg">n22</i></dt>
<dd><p>- Number of outcomes with the second value from the second sample.</p></dd>
</dl></dd>
<dt><a name="27"><b class="cmd">::math::statistics::control-xbar</b> <i class="arg">data</i> <span class="opt">?nsamples?</span></a></dt>
<dd><p>Determine the control limits for an xbar chart. The number of data
in each subsample defaults to 4. At least 20 subsamples are required.</p>
<p>Returns the mean, the lower limit, the upper limit and the number of
data per subsample.</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of observed data</p></dd>
<dt>int <i class="arg">nsamples</i></dt>
<dd><p>- Number of data per subsample</p></dd>
</dl></dd>
<dt><a name="28"><b class="cmd">::math::statistics::control-Rchart</b> <i class="arg">data</i> <span class="opt">?nsamples?</span></a></dt>
<dd><p>Determine the control limits for an R chart. The number of data
in each subsample (nsamples) defaults to 4. At least 20 subsamples are required.</p>
<p>Returns the mean range, the lower limit, the upper limit and the number
of data per subsample.</p>
<dl class="arguments">
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of observed data</p></dd>
<dt>int <i class="arg">nsamples</i></dt>
<dd><p>- Number of data per subsample</p></dd>
</dl></dd>
<dt><a name="29"><b class="cmd">::math::statistics::test-xbar</b> <i class="arg">control</i> <i class="arg">data</i></a></dt>
<dd><p>Determine if the data exceed the control limits for the xbar chart.</p>
<p>Returns a list of subsamples (their indices) that indeed violate the
limits.</p>
<dl class="arguments">
<dt>list <i class="arg">control</i></dt>
<dd><p>- Control limits as returned by the &quot;control-xbar&quot; procedure</p></dd>
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of observed data</p></dd>
</dl></dd>
<dt><a name="30"><b class="cmd">::math::statistics::test-Rchart</b> <i class="arg">control</i> <i class="arg">data</i></a></dt>
<dd><p>Determine if the data exceed the control limits for the R chart.</p>
<p>Returns a list of subsamples (their indices) that indeed violate the
limits.</p>
<dl class="arguments">
<dt>list <i class="arg">control</i></dt>
<dd><p>- Control limits as returned by the &quot;control-Rchart&quot; procedure</p></dd>
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of observed data</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">MULTIVARIATE LINEAR REGRESSION</a></h2>
<p>Besides the linear regression with a single independent variable, the
statistics package provides two procedures for doing ordinary
least squares (OLS) and weighted least squares (WLS) linear regression
with several variables. They were written by Eric Kemp-Benedict.</p>
<p>In addition to these two, it provides a procedure (tstat)
for calculating the value of the t-statistic for the specified number of
degrees of freedom that is required to demonstrate a given level of
significance.</p>
<p>Note: These procedures depend on the math::linearalgebra package.</p>
<p><em>Description of the procedures</em></p>
<dl class="definitions">
<dt><a name="31"><b class="cmd">::math::statistics::tstat</b> <i class="arg">dof</i> <span class="opt">?alpha?</span></a></dt>
<dd><p>Returns the value of the t-distribution t* satisfying</p>
<pre class="example">
    P(t*)  =  1 - alpha/2
    P(-t*) =  alpha/2
</pre>
<p>for the number of degrees of freedom dof.</p>
<p>Given a sample of normally-distributed data x, with an
estimate xbar for the mean and sbar for the standard deviation,
the alpha confidence interval for the estimate of the mean can
be calculated as</p>
<pre class="example">
      ( xbar - t* sbar , xbar + t* sbar)
</pre>
<p>The return values from this procedure can be compared to
an estimated t-statistic to determine whether the estimated
value of a parameter is significantly different from zero at
the given confidence level.</p>
<dl class="arguments">
<dt>int <i class="arg">dof</i></dt>
<dd><p>Number of degrees of freedom</p></dd>
<dt>float <i class="arg">alpha</i></dt>
<dd><p>Confidence level of the t-distribution. Defaults to 0.05.</p></dd>
</dl></dd>
<dt><a name="32"><b class="cmd">::math::statistics::mv-wls</b> <i class="arg">wt1</i> <i class="arg">weights_and_values</i></a></dt>
<dd><p>Carries out a weighted least squares linear regression for
the data points provided, with weights assigned to each point.</p>
<p>The linear model is of the form</p>
<pre class="example">
    y = b0 + b1 * x1 + b2 * x2 ... + bN * xN + error
</pre>
<p>and each point satisfies</p>
<pre class="example">
    yi = b0 + b1 * xi1 + b2 * xi2 + ... + bN * xiN + Residual_i
</pre>
<p>The procedure returns a list with the following elements:</p>
<ul class="itemized">
<li><p>The r-squared statistic</p></li>
<li><p>The adjusted r-squared statistic</p></li>
<li><p>A list containing the estimated coefficients b1, ... bN, b0
(The constant b0 comes last in the list.)</p></li>
<li><p>A list containing the standard errors of the coefficients</p></li>
<li><p>A list containing the 95% confidence bounds of the coefficients,
with each set of bounds returned as a list with two values</p></li>
</ul>
<p>Arguments:</p>
<dl class="arguments">
<dt>list <i class="arg">weights_and_values</i></dt>
<dd><p>A list consisting of: the weight for the first observation, the data
for the first observation (as a sublist), the weight for the second
observation (as a sublist) and so on. The sublists of data are organised
as lists of the value of the dependent variable y and the independent
variables x1, x2 to xN.</p></dd>
</dl></dd>
<dt><a name="33"><b class="cmd">::math::statistics::mv-ols</b> <i class="arg">values</i></a></dt>
<dd><p>Carries out an ordinary least squares linear regression for
the data points provided.</p>
<p>This procedure simply calls ::mvlinreg::wls with the weights
set to 1.0, and returns the same information.</p></dd>
</dl>
<p><em>Example of the use:</em></p>
<pre class="example">
# Store the value of the unicode value for the &quot;+/-&quot; character
set pm &quot;\u00B1&quot;
# Provide some data
set data {{  -.67  14.18  60.03 -7.5  }
          { 36.97  15.52  34.24 14.61 }
          {-29.57  21.85  83.36 -7.   }
          {-16.9   11.79  51.67 -6.56 }
          { 14.09  16.24  36.97 -12.84}
          { 31.52  20.93  45.99 -25.4 }
          { 24.05  20.69  50.27  17.27}
          { 22.23  16.91  45.07  -4.3 }
          { 40.79  20.49  38.92  -.73 }
          {-10.35  17.24  58.77  18.78}}
# Call the ols routine
set results [::math::statistics::mv-ols $data]
# Pretty-print the results
puts &quot;R-squared: [lindex $results 0]&quot;
puts &quot;Adj R-squared: [lindex $results 1]&quot;
puts &quot;Coefficients $pm s.e. -- \[95% confidence interval\]:&quot;
foreach val [lindex $results 2] se [lindex $results 3] bounds [lindex $results 4] {
    set lb [lindex $bounds 0]
    set ub [lindex $bounds 1]
    puts &quot;   $val $pm $se -- \[$lb to $ub\]&quot;
}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">STATISTICAL DISTRIBUTIONS</a></h2>
<p>In the literature a large number of probability distributions can be
found. The statistics package supports:</p>
<ul class="itemized">
<li><p>The normal or Gaussian distribution</p></li>
<li><p>The uniform distribution - equal probability for all data within a given
interval</p></li>
<li><p>The exponential distribution - useful as a model for certain
extreme-value distributions.</p></li>
<li><p>The gamma distribution - based on the incomplete Gamma integral</p></li>
<li><p>The chi-square distribution</p></li>
<li><p>The student's T distribution</p></li>
<li><p>The Poisson distribution</p></li>
<li><p>PM - binomial,F.</p></li>
</ul>
<p>In principle for each distribution one has procedures for:</p>
<ul class="itemized">
<li><p>The probability density (pdf-*)</p></li>
<li><p>The cumulative density (cdf-*)</p></li>
<li><p>Quantiles for the given distribution (quantiles-*)</p></li>
<li><p>Histograms for the given distribution (histogram-*)</p></li>
<li><p>List of random values with the given distribution (random-*)</p></li>
</ul>
<p>The following procedures have been implemented:</p>
<dl class="definitions">
<dt><a name="34"><b class="cmd">::math::statistics::pdf-normal</b> <i class="arg">mean</i> <i class="arg">stdev</i> <i class="arg">value</i></a></dt>
<dd><p>Return the probability of a given value for a normal distribution with
given mean and standard deviation.</p>
<dl class="arguments">
<dt>float <i class="arg">mean</i></dt>
<dd><p>- Mean value of the distribution</p></dd>
<dt>float <i class="arg">stdev</i></dt>
<dd><p>- Standard deviation of the distribution</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="35"><b class="cmd">::math::statistics::pdf-exponential</b> <i class="arg">mean</i> <i class="arg">value</i></a></dt>
<dd><p>Return the probability of a given value for an exponential
distribution with given mean.</p>
<dl class="arguments">
<dt>float <i class="arg">mean</i></dt>
<dd><p>- Mean value of the distribution</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="36"><b class="cmd">::math::statistics::pdf-uniform</b> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">value</i></a></dt>
<dd><p>Return the probability of a given value for a uniform
distribution with given extremes.</p>
<dl class="arguments">
<dt>float <i class="arg">xmin</i></dt>
<dd><p>- Minimum value of the distribution</p></dd>
<dt>float <i class="arg">xmin</i></dt>
<dd><p>- Maximum value of the distribution</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="37"><b class="cmd">::math::statistics::pdf-gamma</b> <i class="arg">alpha</i> <i class="arg">beta</i> <i class="arg">value</i></a></dt>
<dd><p>Return the probability of a given value for a Gamma
distribution with given shape and rate parameters</p>
<dl class="arguments">
<dt>float <i class="arg">alpha</i></dt>
<dd><p>- Shape parameter</p></dd>
<dt>float <i class="arg">beta</i></dt>
<dd><p>- Rate parameter</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="38"><b class="cmd">::math::statistics::pdf-poisson</b> <i class="arg">mu</i> <i class="arg">k</i></a></dt>
<dd><p>Return the probability of a given number of occurrences in the same
interval (k) for a Poisson distribution with given mean (mu)</p>
<dl class="arguments">
<dt>float <i class="arg">mu</i></dt>
<dd><p>- Mean number of occurrences</p></dd>
<dt>int <i class="arg">k</i></dt>
<dd><p>- Number of occurences</p></dd>
</dl></dd>
<dt><a name="39"><b class="cmd">::math::statistics::pdf-chisquare</b> <i class="arg">df</i> <i class="arg">value</i></a></dt>
<dd><p>Return the probability of a given value for a chi square
distribution with given degrees of freedom</p>
<dl class="arguments">
<dt>float <i class="arg">df</i></dt>
<dd><p>- Degrees of freedom</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="40"><b class="cmd">::math::statistics::pdf-student-t</b> <i class="arg">df</i> <i class="arg">value</i></a></dt>
<dd><p>Return the probability of a given value for a Student's t
distribution with given degrees of freedom</p>
<dl class="arguments">
<dt>float <i class="arg">df</i></dt>
<dd><p>- Degrees of freedom</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="41"><b class="cmd">::math::statistics::pdf-beta</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">value</i></a></dt>
<dd><p>Return the probability of a given value for a Beta
distribution with given shape parameters</p>
<dl class="arguments">
<dt>float <i class="arg">a</i></dt>
<dd><p>- First shape parameter</p></dd>
<dt>float <i class="arg">b</i></dt>
<dd><p>- First shape parameter</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="42"><b class="cmd">::math::statistics::cdf-normal</b> <i class="arg">mean</i> <i class="arg">stdev</i> <i class="arg">value</i></a></dt>
<dd><p>Return the cumulative probability of a given value for a normal
distribution with given mean and standard deviation, that is the
probability for values up to the given one.</p>
<dl class="arguments">
<dt>float <i class="arg">mean</i></dt>
<dd><p>- Mean value of the distribution</p></dd>
<dt>float <i class="arg">stdev</i></dt>
<dd><p>- Standard deviation of the distribution</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="43"><b class="cmd">::math::statistics::cdf-exponential</b> <i class="arg">mean</i> <i class="arg">value</i></a></dt>
<dd><p>Return the cumulative probability of a given value for an exponential
distribution with given mean.</p>
<dl class="arguments">
<dt>float <i class="arg">mean</i></dt>
<dd><p>- Mean value of the distribution</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="44"><b class="cmd">::math::statistics::cdf-uniform</b> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">value</i></a></dt>
<dd><p>Return the cumulative probability of a given value for a uniform
distribution with given extremes.</p>
<dl class="arguments">
<dt>float <i class="arg">xmin</i></dt>
<dd><p>- Minimum value of the distribution</p></dd>
<dt>float <i class="arg">xmin</i></dt>
<dd><p>- Maximum value of the distribution</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="45"><b class="cmd">::math::statistics::cdf-students-t</b> <i class="arg">degrees</i> <i class="arg">value</i></a></dt>
<dd><p>Return the cumulative probability of a given value for a Student's t
distribution with given number of degrees.</p>
<dl class="arguments">
<dt>int <i class="arg">degrees</i></dt>
<dd><p>- Number of degrees of freedom</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="46"><b class="cmd">::math::statistics::cdf-gamma</b> <i class="arg">alpha</i> <i class="arg">beta</i> <i class="arg">value</i></a></dt>
<dd><p>Return the cumulative probability of a given value for a Gamma
distribution with given shape and rate parameters</p>
<dl class="arguments">
<dt>float <i class="arg">alpha</i></dt>
<dd><p>- Shape parameter</p></dd>
<dt>float <i class="arg">beta</i></dt>
<dd><p>- Rate parameter</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the cumulative probability is required</p></dd>
</dl></dd>
<dt><a name="47"><b class="cmd">::math::statistics::cdf-poisson</b> <i class="arg">mu</i> <i class="arg">k</i></a></dt>
<dd><p>Return the cumulative probability of a given number of occurrences in
the same interval (k) for a Poisson distribution with given mean (mu)</p>
<dl class="arguments">
<dt>float <i class="arg">mu</i></dt>
<dd><p>- Mean number of occurrences</p></dd>
<dt>int <i class="arg">k</i></dt>
<dd><p>- Number of occurences</p></dd>
</dl></dd>
<dt><a name="48"><b class="cmd">::math::statistics::cdf-beta</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">value</i></a></dt>
<dd><p>Return the cumulative probability of a given value for a Beta
distribution with given shape parameters</p>
<dl class="arguments">
<dt>float <i class="arg">a</i></dt>
<dd><p>- First shape parameter</p></dd>
<dt>float <i class="arg">b</i></dt>
<dd><p>- First shape parameter</p></dd>
<dt>float <i class="arg">value</i></dt>
<dd><p>- Value for which the probability is required</p></dd>
</dl></dd>
<dt><a name="49"><b class="cmd">::math::statistics::random-normal</b> <i class="arg">mean</i> <i class="arg">stdev</i> <i class="arg">number</i></a></dt>
<dd><p>Return a list of &quot;number&quot; random values satisfying a normal
distribution with given mean and standard deviation.</p>
<dl class="arguments">
<dt>float <i class="arg">mean</i></dt>
<dd><p>- Mean value of the distribution</p></dd>
<dt>float <i class="arg">stdev</i></dt>
<dd><p>- Standard deviation of the distribution</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of values to be returned</p></dd>
</dl></dd>
<dt><a name="50"><b class="cmd">::math::statistics::random-exponential</b> <i class="arg">mean</i> <i class="arg">number</i></a></dt>
<dd><p>Return a list of &quot;number&quot; random values satisfying an exponential
distribution with given mean.</p>
<dl class="arguments">
<dt>float <i class="arg">mean</i></dt>
<dd><p>- Mean value of the distribution</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of values to be returned</p></dd>
</dl></dd>
<dt><a name="51"><b class="cmd">::math::statistics::random-uniform</b> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">number</i></a></dt>
<dd><p>Return a list of &quot;number&quot; random values satisfying a uniform
distribution with given extremes.</p>
<dl class="arguments">
<dt>float <i class="arg">xmin</i></dt>
<dd><p>- Minimum value of the distribution</p></dd>
<dt>float <i class="arg">xmax</i></dt>
<dd><p>- Maximum value of the distribution</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of values to be returned</p></dd>
</dl></dd>
<dt><a name="52"><b class="cmd">::math::statistics::random-gamma</b> <i class="arg">alpha</i> <i class="arg">beta</i> <i class="arg">number</i></a></dt>
<dd><p>Return a list of &quot;number&quot; random values satisfying
a Gamma distribution with given shape and rate parameters</p>
<dl class="arguments">
<dt>float <i class="arg">alpha</i></dt>
<dd><p>- Shape parameter</p></dd>
<dt>float <i class="arg">beta</i></dt>
<dd><p>- Rate parameter</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of values to be returned</p></dd>
</dl></dd>
<dt><a name="53"><b class="cmd">::math::statistics::random-chisquare</b> <i class="arg">df</i> <i class="arg">number</i></a></dt>
<dd><p>Return a list of &quot;number&quot; random values satisfying
a chi square distribution with given degrees of freedom</p>
<dl class="arguments">
<dt>float <i class="arg">df</i></dt>
<dd><p>- Degrees of freedom</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of values to be returned</p></dd>
</dl></dd>
<dt><a name="54"><b class="cmd">::math::statistics::random-student-t</b> <i class="arg">df</i> <i class="arg">number</i></a></dt>
<dd><p>Return a list of &quot;number&quot; random values satisfying
a Student's t distribution with given degrees of freedom</p>
<dl class="arguments">
<dt>float <i class="arg">df</i></dt>
<dd><p>- Degrees of freedom</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of values to be returned</p></dd>
</dl></dd>
<dt><a name="55"><b class="cmd">::math::statistics::random-beta</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">number</i></a></dt>
<dd><p>Return a list of &quot;number&quot; random values satisfying
a Beta distribution with given shape parameters</p>
<dl class="arguments">
<dt>float <i class="arg">a</i></dt>
<dd><p>- First shape parameter</p></dd>
<dt>float <i class="arg">b</i></dt>
<dd><p>- Second shape parameter</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Number of values to be returned</p></dd>
</dl></dd>
<dt><a name="56"><b class="cmd">::math::statistics::histogram-uniform</b> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">limits</i> <i class="arg">number</i></a></dt>
<dd><p>Return the expected histogram for a uniform distribution.</p>
<dl class="arguments">
<dt>float <i class="arg">xmin</i></dt>
<dd><p>- Minimum value of the distribution</p></dd>
<dt>float <i class="arg">xmax</i></dt>
<dd><p>- Maximum value of the distribution</p></dd>
<dt>list <i class="arg">limits</i></dt>
<dd><p>- Upper limits for the buckets in the histogram</p></dd>
<dt>int <i class="arg">number</i></dt>
<dd><p>- Total number of &quot;observations&quot; in the histogram</p></dd>
</dl></dd>
<dt><a name="57"><b class="cmd">::math::statistics::incompleteGamma</b> <i class="arg">x</i> <i class="arg">p</i> <span class="opt">?tol?</span></a></dt>
<dd><p>Evaluate the incomplete Gamma integral</p>
<pre class="example">
                    1       / x               p-1
      P(p,x) =  --------   |   dt exp(-t) * t
                Gamma(p)  / 0
</pre>
<dl class="arguments">
<dt>float <i class="arg">x</i></dt>
<dd><p>- Value of x (limit of the integral)</p></dd>
<dt>float <i class="arg">p</i></dt>
<dd><p>- Value of p in the integrand</p></dd>
<dt>float <i class="arg">tol</i></dt>
<dd><p>- Required tolerance (default: 1.0e-9)</p></dd>
</dl></dd>
<dt><a name="58"><b class="cmd">::math::statistics::incompleteBeta</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">x</i> <span class="opt">?tol?</span></a></dt>
<dd><p>Evaluate the incomplete Beta integral</p>
<dl class="arguments">
<dt>float <i class="arg">a</i></dt>
<dd><p>- First shape parameter</p></dd>
<dt>float <i class="arg">b</i></dt>
<dd><p>- Second shape parameter</p></dd>
<dt>float <i class="arg">x</i></dt>
<dd><p>- Value of x (limit of the integral)</p></dd>
<dt>float <i class="arg">tol</i></dt>
<dd><p>- Required tolerance (default: 1.0e-9)</p></dd>
</dl></dd>
</dl>
<p>TO DO: more function descriptions to be added</p>
</div>
<div id="section5" class="section"><h2><a name="section5">DATA MANIPULATION</a></h2>
<p>The data manipulation procedures act on lists or lists of lists:</p>
<dl class="definitions">
<dt><a name="59"><b class="cmd">::math::statistics::filter</b> <i class="arg">varname</i> <i class="arg">data</i> <i class="arg">expression</i></a></dt>
<dd><p>Return a list consisting of the data for which the logical
expression is true (this command works analogously to the command <b class="cmd"><a href="../../../../index.html#key199">foreach</a></b>).</p>
<dl class="arguments">
<dt>string <i class="arg">varname</i></dt>
<dd><p>- Name of the variable used in the expression</p></dd>
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
<dt>string <i class="arg">expression</i></dt>
<dd><p>- Logical expression using the variable name</p></dd>
</dl></dd>
<dt><a name="60"><b class="cmd">::math::statistics::map</b> <i class="arg">varname</i> <i class="arg">data</i> <i class="arg">expression</i></a></dt>
<dd><p>Return a list consisting of the data that are transformed via the
expression.</p>
<dl class="arguments">
<dt>string <i class="arg">varname</i></dt>
<dd><p>- Name of the variable used in the expression</p></dd>
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of data</p></dd>
<dt>string <i class="arg">expression</i></dt>
<dd><p>- Expression to be used to transform (map) the data</p></dd>
</dl></dd>
<dt><a name="61"><b class="cmd">::math::statistics::samplescount</b> <i class="arg">varname</i> <i class="arg">list</i> <i class="arg">expression</i></a></dt>
<dd><p>Return a list consisting of the <i class="term">counts</i> of all data in the
sublists of the &quot;list&quot; argument for which the expression is true.</p>
<dl class="arguments">
<dt>string <i class="arg">varname</i></dt>
<dd><p>- Name of the variable used in the expression</p></dd>
<dt>list <i class="arg">data</i></dt>
<dd><p>- List of sublists, each containing the data</p></dd>
<dt>string <i class="arg">expression</i></dt>
<dd><p>- Logical expression to test the data (defaults to
&quot;true&quot;).</p></dd>
</dl></dd>
<dt><a name="62"><b class="cmd">::math::statistics::subdivide</b></a></dt>
<dd><p>Routine <em>PM</em> - not implemented yet</p></dd>
<dt><a name="63"><b class="cmd">::math::statistics::test-Kruskal-Wallis</b> <i class="arg">confidence</i> <i class="arg">args</i></a></dt>
<dd><p>Check if the population medians of two or more groups are equal with a
given confidence level, using the Kruskal-Wallis test.</p>
<dl class="arguments">
<dt>float <i class="arg">confidence</i></dt>
<dd><p>- Confidence level to be used (0-1)</p></dd>
<dt>list <i class="arg">args</i></dt>
<dd><p>- Two or more lists of data</p></dd>
</dl></dd>
<dt><a name="64"><b class="cmd">::math::statistics::analyse-Kruskal-Wallis</b> <i class="arg">args</i></a></dt>
<dd><p>Compute the statistical parameters for the Kruskal-Wallis test.
Returns the Kruskal-Wallis statistic and the probability that that
value would occur assuming the medians of the populations are
equal.</p>
<dl class="arguments">
<dt>list <i class="arg">args</i></dt>
<dd><p>- Two or more lists of data</p></dd>
</dl></dd>
<dt><a name="65"><b class="cmd">::math::statistics::group-rank</b> <i class="arg">args</i></a></dt>
<dd><p>Rank the groups of data with respect to the complete set.
Returns a list consisting of the group ID, the value and the rank
(possibly a rational number, in case of ties) for each data item.</p>
<dl class="arguments">
<dt>list <i class="arg">args</i></dt>
<dd><p>- Two or more lists of data</p></dd>
</dl></dd>
<dt><a name="66"><b class="cmd">::math::statistics::test-Wilcoxon</b> <i class="arg">sample_a</i> <i class="arg">sample_b</i></a></dt>
<dd><p>Compute the Wilcoxon test statistic to determine if two samples have the
same median or not. (The statistic can be regarded as standard normal, if the
sample sizes are both larger than 10. Returns the value of this statistic.</p>
<dl class="arguments">
<dt>list <i class="arg">sample_a</i></dt>
<dd><p>- List of data comprising the first sample</p></dd>
<dt>list <i class="arg">sample_b</i></dt>
<dd><p>- List of data comprising the second sample</p></dd>
</dl></dd>
<dt><a name="67"><b class="cmd">::math::statistics::spearman-rank</b> <i class="arg">sample_a</i> <i class="arg">sample_b</i></a></dt>
<dd><p>Return the Spearman rank correlation as an alternative to the ordinary (Pearson's) correlation
coefficient. The two samples should have the same number of data.</p>
<dl class="arguments">
<dt>list <i class="arg">sample_a</i></dt>
<dd><p>- First list of data</p></dd>
<dt>list <i class="arg">sample_b</i></dt>
<dd><p>- Second list of data</p></dd>
</dl></dd>
<dt><a name="68"><b class="cmd">::math::statistics::spearman-rank-extended</b> <i class="arg">sample_a</i> <i class="arg">sample_b</i></a></dt>
<dd><p>Return the Spearman rank correlation as an alternative to the ordinary (Pearson's) correlation
coefficient as well as additional data. The two samples should have the same number of data.
The procedure returns the correlation coefficient, the number of data pairs used and the
z-score, an approximately standard normal statistic, indicating the significance of the correlation.</p>
<dl class="arguments">
<dt>list <i class="arg">sample_a</i></dt>
<dd><p>- First list of data</p></dd>
<dt>list <i class="arg">sample_b</i></dt>
<dd><p>- Second list of data</p></dd>
</dl></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">PLOT PROCEDURES</a></h2>
<p>The following simple plotting procedures are available:</p>
<dl class="definitions">
<dt><a name="69"><b class="cmd">::math::statistics::plot-scale</b> <i class="arg">canvas</i> <i class="arg">xmin</i> <i class="arg">xmax</i> <i class="arg">ymin</i> <i class="arg">ymax</i></a></dt>
<dd><p>Set the scale for a plot in the given canvas. All plot routines expect
this function to be called first. There is no automatic scaling
provided.</p>
<dl class="arguments">
<dt>widget <i class="arg">canvas</i></dt>
<dd><p>- Canvas widget to use</p></dd>
<dt>float <i class="arg">xmin</i></dt>
<dd><p>- Minimum x value</p></dd>
<dt>float <i class="arg">xmax</i></dt>
<dd><p>- Maximum x value</p></dd>
<dt>float <i class="arg">ymin</i></dt>
<dd><p>- Minimum y value</p></dd>
<dt>float <i class="arg">ymax</i></dt>
<dd><p>- Maximum y value</p></dd>
</dl></dd>
<dt><a name="70"><b class="cmd">::math::statistics::plot-xydata</b> <i class="arg">canvas</i> <i class="arg">xdata</i> <i class="arg">ydata</i> <i class="arg">tag</i></a></dt>
<dd><p>Create a simple XY plot in the given canvas - the data are
shown as a collection of dots. The tag can be used to manipulate the
appearance.</p>
<dl class="arguments">
<dt>widget <i class="arg">canvas</i></dt>
<dd><p>- Canvas widget to use</p></dd>
<dt>float <i class="arg">xdata</i></dt>
<dd><p>- Series of independent data</p></dd>
<dt>float <i class="arg">ydata</i></dt>
<dd><p>- Series of dependent data</p></dd>
<dt>string <i class="arg">tag</i></dt>
<dd><p>- Tag to give to the plotted data (defaults to xyplot)</p></dd>
</dl></dd>
<dt><a name="71"><b class="cmd">::math::statistics::plot-xyline</b> <i class="arg">canvas</i> <i class="arg">xdata</i> <i class="arg">ydata</i> <i class="arg">tag</i></a></dt>
<dd><p>Create a simple XY plot in the given canvas - the data are
shown as a line through the data points. The tag can be used to
manipulate the appearance.</p>
<dl class="arguments">
<dt>widget <i class="arg">canvas</i></dt>
<dd><p>- Canvas widget to use</p></dd>
<dt>list <i class="arg">xdata</i></dt>
<dd><p>- Series of independent data</p></dd>
<dt>list <i class="arg">ydata</i></dt>
<dd><p>- Series of dependent data</p></dd>
<dt>string <i class="arg">tag</i></dt>
<dd><p>- Tag to give to the plotted data (defaults to xyplot)</p></dd>
</dl></dd>
<dt><a name="72"><b class="cmd">::math::statistics::plot-tdata</b> <i class="arg">canvas</i> <i class="arg">tdata</i> <i class="arg">tag</i></a></dt>
<dd><p>Create a simple XY plot in the given canvas - the data are
shown as a collection of dots. The horizontal coordinate is equal to the
index. The tag can be used to manipulate the appearance.
This type of presentation is suitable for autocorrelation functions for
instance or for inspecting the time-dependent behaviour.</p>
<dl class="arguments">
<dt>widget <i class="arg">canvas</i></dt>
<dd><p>- Canvas widget to use</p></dd>
<dt>list <i class="arg">tdata</i></dt>
<dd><p>- Series of dependent data</p></dd>
<dt>string <i class="arg">tag</i></dt>
<dd><p>- Tag to give to the plotted data (defaults to xyplot)</p></dd>
</dl></dd>
<dt><a name="73"><b class="cmd">::math::statistics::plot-tline</b> <i class="arg">canvas</i> <i class="arg">tdata</i> <i class="arg">tag</i></a></dt>
<dd><p>Create a simple XY plot in the given canvas - the data are
shown as a line. See plot-tdata for an explanation.</p>
<dl class="arguments">
<dt>widget <i class="arg">canvas</i></dt>
<dd><p>- Canvas widget to use</p></dd>
<dt>list <i class="arg">tdata</i></dt>
<dd><p>- Series of dependent data</p></dd>
<dt>string <i class="arg">tag</i></dt>
<dd><p>- Tag to give to the plotted data (defaults to xyplot)</p></dd>
</dl></dd>
<dt><a name="74"><b class="cmd">::math::statistics::plot-histogram</b> <i class="arg">canvas</i> <i class="arg">counts</i> <i class="arg">limits</i> <i class="arg">tag</i></a></dt>
<dd><p>Create a simple histogram in the given canvas</p>
<dl class="arguments">
<dt>widget <i class="arg">canvas</i></dt>
<dd><p>- Canvas widget to use</p></dd>
<dt>list <i class="arg">counts</i></dt>
<dd><p>- Series of bucket counts</p></dd>
<dt>list <i class="arg">limits</i></dt>
<dd><p>- Series of upper limits for the buckets</p></dd>
<dt>string <i class="arg">tag</i></dt>
<dd><p>- Tag to give to the plotted data (defaults to xyplot)</p></dd>
</dl></dd>
</dl>
</div>
<div id="section7" class="section"><h2><a name="section7">THINGS TO DO</a></h2>
<p>The following procedures are yet to be implemented:</p>
<ul class="itemized">
<li><p>F-test-stdev</p></li>
<li><p>interval-mean-stdev</p></li>
<li><p>histogram-normal</p></li>
<li><p>histogram-exponential</p></li>
<li><p>test-histogram</p></li>
<li><p>test-corr</p></li>
<li><p>quantiles-*</p></li>
<li><p>fourier-coeffs</p></li>
<li><p>fourier-residuals</p></li>
<li><p>onepar-function-fit</p></li>
<li><p>onepar-function-residuals</p></li>
<li><p>plot-linear-model</p></li>
<li><p>subdivide</p></li>
</ul>
</div>
<div id="section8" class="section"><h2><a name="section8">EXAMPLES</a></h2>
<p>The code below is a small example of how you can examine a set of
data:</p>
<pre class="example">
# Simple example:
# - Generate data (as a cheap way of getting some)
# - Perform statistical analysis to describe the data
#
package require math::statistics
#
# Two auxiliary procs
#
proc pause {time} {
   set wait 0
   after [expr {$time*1000}] {set ::wait 1}
   vwait wait
}
proc print-histogram {counts limits} {
   foreach count $counts limit $limits {
      if { $limit != {} } {
         puts [format &quot;&lt;%12.4g\t%d&quot; $limit $count]
         set prev_limit $limit
      } else {
         puts [format &quot;&gt;%12.4g\t%d&quot; $prev_limit $count]
      }
   }
}
#
# Our source of arbitrary data
#
proc generateData { data1 data2 } {
   upvar 1 $data1 _data1
   upvar 1 $data2 _data2
   set d1 0.0
   set d2 0.0
   for { set i 0 } { $i &lt; 100 } { incr i } {
      set d1 [expr {10.0-2.0*cos(2.0*3.1415926*$i/24.0)+3.5*rand()}]
      set d2 [expr {0.7*$d2+0.3*$d1+0.7*rand()}]
      lappend _data1 $d1
      lappend _data2 $d2
   }
   return {}
}
#
# The analysis session
#
package require Tk
console show
canvas .plot1
canvas .plot2
pack   .plot1 .plot2 -fill both -side top
generateData data1 data2
puts &quot;Basic statistics:&quot;
set b1 [::math::statistics::basic-stats $data1]
set b2 [::math::statistics::basic-stats $data2]
foreach label {mean min max number stdev var} v1 $b1 v2 $b2 {
   puts &quot;$label\t$v1\t$v2&quot;
}
puts &quot;Plot the data as function of \&quot;time\&quot; and against each other&quot;
::math::statistics::plot-scale .plot1  0 100  0 20
::math::statistics::plot-scale .plot2  0 20   0 20
::math::statistics::plot-tline .plot1 $data1
::math::statistics::plot-tline .plot1 $data2
::math::statistics::plot-xydata .plot2 $data1 $data2
puts &quot;Correlation coefficient:&quot;
puts [::math::statistics::corr $data1 $data2]
pause 2
puts &quot;Plot histograms&quot;
.plot2 delete all
::math::statistics::plot-scale .plot2  0 20 0 100
set limits         [::math::statistics::minmax-histogram-limits 7 16]
set histogram_data [::math::statistics::histogram $limits $data1]
::math::statistics::plot-histogram .plot2 $histogram_data $limits
puts &quot;First series:&quot;
print-histogram $histogram_data $limits
pause 2
set limits         [::math::statistics::minmax-histogram-limits 0 15 10]
set histogram_data [::math::statistics::histogram $limits $data2]
::math::statistics::plot-histogram .plot2 $histogram_data $limits d2
.plot2 itemconfigure d2 -fill red
puts &quot;Second series:&quot;
print-histogram $histogram_data $limits
puts &quot;Autocorrelation function:&quot;
set  autoc [::math::statistics::autocorr $data1]
puts [::math::statistics::map $autoc {[format &quot;%.2f&quot; $x]}]
puts &quot;Cross-correlation function:&quot;
set  crossc [::math::statistics::crosscorr $data1 $data2]
puts [::math::statistics::map $crossc {[format &quot;%.2f&quot; $x]}]
::math::statistics::plot-scale .plot1  0 100 -1  4
::math::statistics::plot-tline .plot1  $autoc &quot;autoc&quot;
::math::statistics::plot-tline .plot1  $crossc &quot;crossc&quot;
.plot1 itemconfigure autoc  -fill green
.plot1 itemconfigure crossc -fill yellow
puts &quot;Quantiles: 0.1, 0.2, 0.5, 0.8, 0.9&quot;
puts &quot;First:  [::math::statistics::quantiles $data1 {0.1 0.2 0.5 0.8 0.9}]&quot;
puts &quot;Second: [::math::statistics::quantiles $data2 {0.1 0.2 0.5 0.8 0.9}]&quot;
</pre>
<p>If you run this example, then the following should be clear:</p>
<ul class="itemized">
<li><p>There is a strong correlation between two time series, as displayed by
the raw data and especially by the correlation functions.</p></li>
<li><p>Both time series show a significant periodic component</p></li>
<li><p>The histograms are not very useful in identifying the nature of the time
series - they do not show the periodic nature.</p></li>
</ul>
</div>
<div id="section9" class="section"><h2><a name="section9">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: statistics</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key580">data analysis</a>, <a href="../../../../index.html#key579">mathematics</a>, <a href="../../../../index.html#key174">statistics</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/math/symdiff.html.




















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>math::calculus::symdiff - Symbolic differentiation for Tcl</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/math/symdiff.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2010 by Kevin B. Kenny &lt;[email protected]&gt;   -- Redistribution permitted under the terms of the Open Publication License &lt;http://www.opencontent.org/openpub/&gt;
   -->
<! -- CVS: $Id$ math::calculus::symdiff.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">math::calculus::symdiff(n) 1.0 tcllib &quot;Symbolic differentiation for Tcl&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>math::calculus::symdiff - Symbolic differentiation for Tcl</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Procedures</a></li>
<li class="section"><a href="#section3">Expressions</a></li>
<li class="section"><a href="#section4">Examples</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">grammar::aycock 1.0</b></li>
<li>package require <b class="pkgname">math::calculus::symdiff 1.0</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">math::calculus::symdiff::symdiff</b> <i class="arg">expression</i> <i class="arg">variable</i></a></li>
<li><a href="#2"><b class="cmd">math::calculus::jacobian</b> <i class="arg">variableDict</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">math::calculus::symdiff</b> package provides a symbolic differentiation
facility for Tcl math expressions. It is useful for providing derivatives
to packages that either require the Jacobian of a set of functions or else
are more efficient or stable when the Jacobian is provided.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Procedures</a></h2>
<p>The <b class="cmd">math::calculus::symdiff</b> package exports the two procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">math::calculus::symdiff::symdiff</b> <i class="arg">expression</i> <i class="arg">variable</i></a></dt>
<dd><p>Differentiates the given <i class="arg">expression</i> with respect to the specified
<i class="arg">variable</i>. (See <span class="sectref"><a href="#section3">Expressions</a></span> below for a discussion of the
subset of Tcl math expressions that are acceptable to 
<b class="cmd">math::calculus::symdiff</b>.)
The result is a Tcl expression that evaluates the derivative. Returns an
error if <i class="arg">expression</i> is not a well-formed expression or is not
differentiable.</p></dd>
<dt><a name="2"><b class="cmd">math::calculus::jacobian</b> <i class="arg">variableDict</i></a></dt>
<dd><p>Computes the Jacobian of a system of equations.
The system is given by the dictionary <i class="arg">variableDict</i>, whose keys
are the names of variables in the system, and whose values are Tcl expressions
giving the values of those variables. (See <span class="sectref"><a href="#section3">Expressions</a></span> below
for a discussion of the subset of Tcl math expressions that are acceptable
to <b class="cmd">math::calculus::symdiff</b>. The result is a list of lists: 
the i'th element of the j'th sublist is the partial derivative of 
the i'th variable with respect to the j'th variable. Returns an error if
any of the expressions cannot be differentiated, or if <i class="arg">variableDict</i> 
is not a well-formed dictionary.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Expressions</a></h2>
<p>The <b class="cmd">math::calculus::symdiff</b> package accepts only a small subset of the expressions
that are acceptable to Tcl commands such as <b class="cmd">expr</b> or <b class="cmd">if</b>.
Specifically, the only constructs accepted are:</p>
<ul class="itemized">
<li><p>Floating-point constants such as <b class="const">5</b> or <b class="const">3.14159e+00</b>.</p></li>
<li><p>References to Tcl variable using $-substitution. The variable names
must consist of alphanumerics and underscores: the <b class="const">${...}</b> notation
is not accepted.</p></li>
<li><p>Parentheses.</p></li>
<li><p>The <b class="const">+</b>, <b class="const">-</b>, <b class="const">*</b>, <b class="const">/</b>. and <b class="const">**</b> 
operators.</p></li>
<li><p>Calls to the functions <b class="cmd">acos</b>, <b class="cmd">asin</b>, <b class="cmd">atan</b>,
<b class="cmd">atan2</b>, <b class="cmd">cos</b>, <b class="cmd">cosh</b>, <b class="cmd">exp</b>, <b class="cmd">hypot</b>, <b class="cmd"><a href="../log/log.html">log</a></b>,
<b class="cmd">log10</b>, <b class="cmd">pow</b>, <b class="cmd">sin</b>, <b class="cmd">sinh</b>. <b class="cmd">sqrt</b>, <b class="cmd">tan</b>,
and <b class="cmd">tanh</b>.</p></li>
</ul>
<p>Command substitution, backslash substitution, and argument expansion are
not accepted.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Examples</a></h2>
<pre class="example">
math::calculus::symdiff::symdiff {($a*$x+$b)*($c*$x+$d)} x
==&gt; (($c * (($a * $x) + $b)) + ($a * (($c * $x) + $d)))
math::calculus::symdiff::jacobian {x {$a * $x + $b * $y}
                         y {$c * $x + $d * $y}}
==&gt; {{$a} {$b}} {{$c} {$d}}
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>math :: calculus</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="calculus.html">math::calculus</a>, <a href="interpolate.html">math::interpolate</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2010 by Kevin B. Kenny &lt;[email protected]&gt;<br>
Redistribution permitted under the terms of the Open Publication License &lt;http://www.opencontent.org/openpub/&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/md4/md4.html.









































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>md4 - MD4 Message-Digest Algorithm</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/md4/md4.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ md4.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">md4(n) 1.0.5 tcllib &quot;MD4 Message-Digest Algorithm&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>md4 - MD4 Message-Digest Algorithm</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">md4 <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::md4::md4</b> <span class="opt">?<i class="arg">-hex</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#2"><b class="cmd">::md4::hmac</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#3"><b class="cmd">::md4::MD4Init</b></a></li>
<li><a href="#4"><b class="cmd">::md4::MD4Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#5"><b class="cmd">::md4::MD4Final</b> <i class="arg">token</i></a></li>
<li><a href="#6"><b class="cmd">::md4::HMACInit</b> <i class="arg">key</i></a></li>
<li><a href="#7"><b class="cmd">::md4::HMACUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#8"><b class="cmd">::md4::HMACFinal</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is an implementation in Tcl of the MD4 message-digest
algorithm as described in RFC 1320 (1) and (2). This algorithm takes
an arbitrary quantity of data and generates a 128-bit message digest
from the input. The MD4 algorithm is faster but potentially weaker than
the related MD5 algorithm (3).</p>
<p>If you have <b class="package">critcl</b> and have built the <b class="package">tcllibc</b> package
then the implementation of the hashing function will be performed by compiled
code. Alternatively if <b class="package">cryptkit</b> is available this will be
used. If no accelerator package can be found then the pure-tcl
implementation is used. The programming interface remains the same in
all cases.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::md4::md4</b> <span class="opt">?<i class="arg">-hex</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate the MD4 digest of the data given in string. This is returned
as a binary string by default. Giving the <i class="arg">-hex</i> option will
return a hexadecimal encoded version of the digest.</p>
<p>The data to be hashed can be specified either as a string argument to
the md4 command, or as a filename or a pre-opened channel. If the 
<i class="arg">-filename</i> argument is given then the file is opened, the data read
and hashed and the file is closed. If the <i class="arg">-channel</i> argument is
given then data is read from the channel until the end of file. The
channel is not closed.</p>
<p>Only one of <i class="arg">-file</i>, <i class="arg">-channel</i> or <i class="arg">string</i> should be given.</p></dd>
<dt><a name="2"><b class="cmd">::md4::hmac</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate an Hashed Message Authentication digest (HMAC) using the MD4
digest algorithm. HMACs are described in RFC 2104 (4) and provide an MD4
digest that includes a key. All options other than <i class="arg">-key</i> are as
for the <b class="cmd">::md4::md4</b> command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<p>For the programmer, the MD4 hash can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
derived from the data that was poured into the bucket. The programming
interface to the MD4 hash operates on a token (equivalent to the
bucket). You call <b class="cmd">MD4Init</b> to obtain a token and then call 
<b class="cmd">MD4Update</b> as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call 
<b class="cmd">MD4Final</b>. An equivalent set of functions gives you a keyed digest (HMAC).</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">::md4::MD4Init</b></a></dt>
<dd><p>Begins a new MD4 hash. Returns a token ID that must be used for the
remaining functions.</p></dd>
<dt><a name="4"><b class="cmd">::md4::MD4Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd><p>Add data to the hash identified by token. Calling 
<em>MD4Update $token &quot;abcd&quot;</em> is equivalent to calling
<em>MD4Update $token &quot;ab&quot;</em> followed by 
<em>MD4Update $token &quot;cb&quot;</em>. See <span class="sectref"><a href="#section4">EXAMPLES</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::md4::MD4Final</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 16 bytes representing the 128 bit MD4
digest value.</p></dd>
<dt><a name="6"><b class="cmd">::md4::HMACInit</b> <i class="arg">key</i></a></dt>
<dd><p>This is equivalent to the <b class="cmd">::md4::MD4Init</b> command except that
it requires the key that will be included in the HMAC.</p></dd>
<dt><a name="7"><b class="cmd">::md4::HMACUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">::md4::HMACFinal</b> <i class="arg">token</i></a></dt>
<dd><p>These commands are identical to the MD4 equivalent commands.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% md4::md4 -hex &quot;Tcl does MD4&quot;
858da9b31f57648a032230447bd15f25
</pre>
<pre class="example">
% md4::hmac -hex -key Sekret &quot;Tcl does MD4&quot;
c324088e5752872689caedf2a0464758
</pre>
<pre class="example">
% set tok [md4::MD4Init]
::md4::1
% md4::MD4Update $tok &quot;Tcl &quot;
% md4::MD4Update $tok &quot;does &quot;
% md4::MD4Update $tok &quot;MD4&quot;
% md4::Hex [md4::MD4Final $tok]
858da9b31f57648a032230447bd15f25
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Rivest, R., &quot;The MD4 Message Digest Algorithm&quot;, RFC 1320, MIT,
       April 1992. (<a href="http://www.rfc-editor.org/rfc/rfc1320.txt">http://www.rfc-editor.org/rfc/rfc1320.txt</a>)</p></li>
<li><p>Rivest, R., &quot;The MD4 message digest algorithm&quot;, in A.J.  Menezes
       and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90
       Proceedings, pages 303-311, Springer-Verlag, 1991.</p></li>
<li><p>Rivest, R., &quot;The MD5 Message-Digest Algorithm&quot;, RFC 1321, MIT and
       RSA Data Security, Inc, April 1992.
	(<a href="http://www.rfc-editor.org/rfc/rfc1321.txt">http://www.rfc-editor.org/rfc/rfc1321.txt</a>)</p></li>
<li><p>Krawczyk, H., Bellare, M. and Canetti, R. &quot;HMAC: Keyed-Hashing for 
      Message Authentication&quot;, RFC 2104, February 1997.
	(<a href="http://www.rfc-editor.org/rfc/rfc2104.txt">http://www.rfc-editor.org/rfc/rfc2104.txt</a>)</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>md4</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../md5/md5.html">md5</a>, <a href="../sha1/sha1.html">sha1</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key195">hashing</a>, <a href="../../../../index.html#key335">md4</a>, <a href="../../../../index.html#key194">message-digest</a>, <a href="../../../../index.html#key334">rfc 1320</a>, <a href="../../../../index.html#key337">rfc 1321</a>, <a href="../../../../index.html#key193">rfc 2104</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/md5/md5.html.















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>md5 - MD5 Message-Digest Algorithm</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/md5/md5.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ md5.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">md5(n) 2.0.7 tcllib &quot;MD5 Message-Digest Algorithm&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>md5 - MD5 Message-Digest Algorithm</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">md5 <span class="opt">?2.0.7?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::md5::md5</b> <span class="opt">?<i class="arg">-hex</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#2"><b class="cmd">::md5::hmac</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#3"><b class="cmd">::md5::MD5Init</b></a></li>
<li><a href="#4"><b class="cmd">::md5::MD5Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#5"><b class="cmd">::md5::MD5Final</b> <i class="arg">token</i></a></li>
<li><a href="#6"><b class="cmd">::md5::HMACInit</b> <i class="arg">key</i></a></li>
<li><a href="#7"><b class="cmd">::md5::HMACUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#8"><b class="cmd">::md5::HMACFinal</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is an implementation in Tcl of the MD5 message-digest
algorithm as described in RFC 1321 (1). This algorithm takes
an arbitrary quantity of data and generates a 128-bit message digest
from the input. The MD5 algorithm is related to the MD4 algorithm (2)
but has been strengthened against certain types of potential
attack. MD5 should be used in preference to MD4 for new applications.</p>
<p>If you have <b class="package">critcl</b> and have built the <b class="package">tcllibc</b>
package then the implementation of the hashing function will be
performed by compiled code. Alternatively if you have either 
<b class="package">cryptkit</b> or <b class="package">Trf</b> then either of these can be used to
accelerate the digest computation. If no suitable compiled package is
available then the pure-Tcl implementation wil be used. The
programming interface remains the same in all cases.</p>
<p><em>Note</em> the previous version of this package always returned a
hex encoded string. This has been changed to simplify the programming
interface and to make this version more compatible with other
implementations. To obtain the previous usage, either explicitly
specify package version 1 or use the <i class="arg">-hex</i> option to the 
<b class="cmd">md5</b> command.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::md5::md5</b> <span class="opt">?<i class="arg">-hex</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate the MD5 digest of the data given in string. This is returned
as a binary string by default. Giving the <i class="arg">-hex</i> option will
return a hexadecimal encoded version of the digest.</p>
<p>The data to be hashed can be specified either as a string argument to
the <b class="cmd">md5</b> command, or as a filename or a pre-opened channel. If the 
<i class="arg">-filename</i> argument is given then the file is opened, the data read
and hashed and the file is closed. If the <i class="arg">-channel</i> argument is
given then data is read from the channel until the end of file. The
channel is not closed.</p>
<p>Only one of <i class="arg">-file</i>, <i class="arg">-channel</i> or <i class="arg">string</i> should be given.</p></dd>
<dt><a name="2"><b class="cmd">::md5::hmac</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate an Hashed Message Authentication digest (HMAC) using the MD5
digest algorithm. HMACs are described in RFC 2104 (3) and provide an MD5
digest that includes a key. All options other than <i class="arg">-key</i> are as
for the <b class="cmd">::md5::md5</b> command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<p>For the programmer, the MD5 hash can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
derived from the data that was poured into the bucket. The programming
interface to the MD5 hash operates on a token (equivalent to the
bucket). You call <b class="cmd">MD5Init</b> to obtain a token and then call 
<b class="cmd">MD5Update</b> as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call 
<b class="cmd">MD5Final</b>. An equivalent set of functions gives you a keyed digest
(HMAC).</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">::md5::MD5Init</b></a></dt>
<dd><p>Begins a new MD5 hash. Returns a token ID that must be used for the
remaining functions.</p></dd>
<dt><a name="4"><b class="cmd">::md5::MD5Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd><p>Add data to the hash identified by token. Calling 
<em>MD5Update $token &quot;abcd&quot;</em> is equivalent to calling
<em>MD5Update $token &quot;ab&quot;</em> followed by 
<em>MD5Update $token &quot;cb&quot;</em>. See <span class="sectref"><a href="#section4">EXAMPLES</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::md5::MD5Final</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 16 bytes representing the 128 bit MD5
digest value.</p></dd>
<dt><a name="6"><b class="cmd">::md5::HMACInit</b> <i class="arg">key</i></a></dt>
<dd><p>This is equivalent to the <b class="cmd">::md5::MD5Init</b> command except that
it requires the key that will be included in the HMAC.</p></dd>
<dt><a name="7"><b class="cmd">::md5::HMACUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">::md5::HMACFinal</b> <i class="arg">token</i></a></dt>
<dd><p>These commands are identical to the MD5 equivalent commands.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% md5::md5 -hex &quot;Tcl does MD5&quot;
8AAC1EE01E20BB347104FABB90310433
</pre>
<pre class="example">
% md5::hmac -hex -key Sekret &quot;Tcl does MD5&quot;
35BBA244FD56D3EDF5F3C47474DACB5D
</pre>
<pre class="example">
% set tok [md5::MD5Init]
::md5::1
% md5::MD5Update $tok &quot;Tcl &quot;
% md5::MD5Update $tok &quot;does &quot;
% md5::MD5Update $tok &quot;MD5&quot;
% md5::Hex [md5::MD5Final $tok]
8AAC1EE01E20BB347104FABB90310433
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Rivest, R., &quot;The MD5 Message-Digest Algorithm&quot;, RFC 1321, MIT and
       RSA Data Security, Inc, April 1992.
	(<a href="http://www.rfc-editor.org/rfc/rfc1321.txt">http://www.rfc-editor.org/rfc/rfc1321.txt</a>)</p></li>
<li><p>Rivest, R., &quot;The MD4 Message Digest Algorithm&quot;, RFC 1320, MIT,
       April 1992. (<a href="http://www.rfc-editor.org/rfc/rfc1320.txt">http://www.rfc-editor.org/rfc/rfc1320.txt</a>)</p></li>
<li><p>Krawczyk, H., Bellare, M. and Canetti, R. &quot;HMAC: Keyed-Hashing for 
      Message Authentication&quot;, RFC 2104, February 1997.
	(<a href="http://www.rfc-editor.org/rfc/rfc2104.txt">http://www.rfc-editor.org/rfc/rfc2104.txt</a>)</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>md5</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../md4/md4.html">md4</a>, <a href="../sha1/sha1.html">sha1</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key195">hashing</a>, <a href="../../../../index.html#key614">md5</a>, <a href="../../../../index.html#key194">message-digest</a>, <a href="../../../../index.html#key334">rfc 1320</a>, <a href="../../../../index.html#key337">rfc 1321</a>, <a href="../../../../index.html#key193">rfc 2104</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/md5crypt/md5crypt.html.

















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>md5crypt - MD5-based password encryption</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/md5crypt/md5crypt.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ md5crypt.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">md5crypt(n) 1.1.0 tcllib &quot;MD5-based password encryption&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>md5crypt - MD5-based password encryption</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">SALT</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">md5 2.0</b></li>
<li>package require <b class="pkgname">md5crypt <span class="opt">?1.1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::md5crypt::md5crypt</b> <i class="arg">password</i> <i class="arg">salt</i></a></li>
<li><a href="#2"><b class="cmd">::md5crypt::aprcrypt</b> <i class="arg">password</i> <i class="arg">salt</i></a></li>
<li><a href="#3"><b class="cmd">::md5crypt::salt</b> <span class="opt">?<i class="arg">length</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides an implementation of the MD5-crypt password
encryption algorithm as pioneered by FreeBSD and currently in use as a
replacement for the unix crypt(3) function in many modern
systems. An implementation of the closely related Apache MD5-crypt is
also available.
The output of these commands are compatible with the BSD and OpenSSL
implementation of md5crypt and the Apache 2 htpasswd program.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::md5crypt::md5crypt</b> <i class="arg">password</i> <i class="arg">salt</i></a></dt>
<dd><p>Generate a BSD compatible md5-encoded password hash from the plaintext
password and a random salt (see SALT).</p></dd>
<dt><a name="2"><b class="cmd">::md5crypt::aprcrypt</b> <i class="arg">password</i> <i class="arg">salt</i></a></dt>
<dd><p>Generate an Apache compatible md5-encoded password hash from the plaintext
password and a random salt (see SALT).</p></dd>
<dt><a name="3"><b class="cmd">::md5crypt::salt</b> <span class="opt">?<i class="arg">length</i>?</span></a></dt>
<dd><p>Generate a random salt string suitable for use with the <b class="cmd">md5crypt</b> and
<b class="cmd">aprcrypt</b> commands.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">SALT</a></h2>
<p>The salt passed to either of the encryption schemes implemented here
is checked to see if it begins with the encryption scheme magic string
(either &quot;$1$&quot; for MD5-crypt or &quot;$apr1$&quot; for Apache crypt). If so, this
is removed. The remaining characters up to the next $ and up to a
maximum of 8 characters are then used as the salt. The salt text
should probably be restricted the set of ASCII alphanumeric characters
plus &quot;./&quot; (dot and forward-slash) - this is to preserve maximum
compatability with the unix password file format.</p>
<p>If a password is being generated rather than checked from a password
file then the <b class="cmd">salt</b> command may be used to generate a random salt.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% md5crypt::md5crypt password 01234567
$1$01234567$b5lh2mHyD2PdJjFfALlEz1
</pre>
<pre class="example">
% md5crypt::aprcrypt password 01234567
$apr1$01234567$IXBaQywhAhc0d75ZbaSDp/
</pre>
<pre class="example">
% md5crypt::md5crypt password [md5crypt::salt]
$1$dFmvyRmO$T.V3OmzqeEf3hqJp2WFcb.
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>md5crypt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../md5/md5.html">md5</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key195">hashing</a>, <a href="../../../../index.html#key614">md5</a>, <a href="../../../../index.html#key701">md5crypt</a>, <a href="../../../../index.html#key194">message-digest</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/mime/mime.html.




















































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>mime - Mime</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/mime/mime.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 1999-2000 Marshall T. Rose
   -->
<! -- CVS: $Id$ mime.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">mime(n) 1.5.6 tcllib &quot;Mime&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>mime - Manipulation of MIME body parts</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">KNOWN BUGS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl</b></li>
<li>package require <b class="pkgname">mime <span class="opt">?1.5.6?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::mime::initialize</b> <span class="opt">?<b class="option">-canonical</b> <i class="arg">type/subtype</i> <span class="opt">?<b class="option">-param</b> {<i class="arg">key value</i>}...?</span> <span class="opt">?<b class="option">-encoding</b> <i class="arg">value</i>?</span> <span class="opt">?<b class="option">-header</b> {<i class="arg">key value</i>}...?</span>?</span> (<b class="option">-file</b> <i class="arg">name</i> | <b class="option">-string</b> <i class="arg">value</i> | <b class="option">-parts</b> {<i class="arg">token1</i> ... <i class="arg">tokenN</i>})</a></li>
<li><a href="#2"><b class="cmd">::mime::finalize</b> <i class="arg">token</i> <span class="opt">?<b class="option">-subordinates</b> <b class="const">all</b> | <b class="const">dynamic</b> | <b class="const">none</b>?</span></a></li>
<li><a href="#3"><b class="cmd">::mime::getproperty</b> <i class="arg">token</i> <span class="opt">?<i class="arg">property</i> | <b class="option">-names</b>?</span></a></li>
<li><a href="#4"><b class="cmd">::mime::getheader</b> <i class="arg">token</i> <span class="opt">?<i class="arg">key</i> | <b class="option">-names</b>?</span></a></li>
<li><a href="#5"><b class="cmd">::mime::setheader</b> <i class="arg">token</i> <i class="arg">key value</i> <span class="opt">?<b class="option">-mode</b> <b class="const">write</b> | <b class="const">append</b> | <b class="const">delete</b>?</span></a></li>
<li><a href="#6"><b class="cmd">::mime::getbody</b> <i class="arg">token</i> <span class="opt">?<b class="option">-decode</b>?</span> <span class="opt">?<b class="option">-command</b> <i class="arg">callback</i> <span class="opt">?<b class="option">-blocksize</b> <i class="arg">octets</i>?</span>?</span></a></li>
<li><a href="#7"><b class="cmd">::mime::copymessage</b> <i class="arg">token</i> <i class="arg">channel</i></a></li>
<li><a href="#8"><b class="cmd">::mime::buildmessage</b> <i class="arg">token</i></a></li>
<li><a href="#9"><b class="cmd">::mime::parseaddress</b> <i class="arg">string</i></a></li>
<li><a href="#10"><b class="cmd">::mime::parsedatetime</b> (<i class="arg">string</i> | <b class="option">-now</b>) <i class="arg">property</i></a></li>
<li><a href="#11"><b class="cmd">::mime::mapencoding</b> <i class="arg">encoding_name</i></a></li>
<li><a href="#12"><b class="cmd">::mime::reversemapencoding</b> <i class="arg">charset_type</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">mime</b> library package provides the commands to create and
manipulate MIME body parts.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::mime::initialize</b> <span class="opt">?<b class="option">-canonical</b> <i class="arg">type/subtype</i> <span class="opt">?<b class="option">-param</b> {<i class="arg">key value</i>}...?</span> <span class="opt">?<b class="option">-encoding</b> <i class="arg">value</i>?</span> <span class="opt">?<b class="option">-header</b> {<i class="arg">key value</i>}...?</span>?</span> (<b class="option">-file</b> <i class="arg">name</i> | <b class="option">-string</b> <i class="arg">value</i> | <b class="option">-parts</b> {<i class="arg">token1</i> ... <i class="arg">tokenN</i>})</a></dt>
<dd><p>This command creates a MIME part and returns a token representing it.</p>
<ul class="itemized">
<li><p>If the <b class="option">-canonical</b> option is present, then the body is in
canonical (raw) form and is found by consulting either the
<b class="option">-file</b>, <b class="option">-string</b>, or <b class="option">-parts</b> option.</p>
<p>In addition, both the <b class="option">-param</b> and <b class="option">-header</b> options may
occur zero or more times to specify <b class="const">Content-Type</b> parameters
(e.g., <b class="const">charset</b>) and header keyword/values (e.g.,
<b class="const">Content-Disposition</b>), respectively.</p>
<p>Also, <b class="option">-encoding</b>, if present, specifies the
<b class="const">Content-Transfer-Encoding</b> when copying the body.</p></li>
<li><p>If the <b class="option">-canonical</b> option is not present, then the MIME part
contained in either the <b class="option">-file</b> or the <b class="option">-string</b> option
is parsed, dynamically generating subordinates as appropriate.</p></li>
</ul></dd>
<dt><a name="2"><b class="cmd">::mime::finalize</b> <i class="arg">token</i> <span class="opt">?<b class="option">-subordinates</b> <b class="const">all</b> | <b class="const">dynamic</b> | <b class="const">none</b>?</span></a></dt>
<dd><p>This command destroys the MIME part represented by <i class="arg">token</i>. It
returns an empty string.</p>
<p>If the <b class="option">-subordinates</b> option is present, it specifies which
subordinates should also be destroyed. The default value is
<b class="const">dynamic</b>, destroying all subordinates which were created by
<b class="cmd">::mime::initialize</b> together with the containing body part.</p></dd>
<dt><a name="3"><b class="cmd">::mime::getproperty</b> <i class="arg">token</i> <span class="opt">?<i class="arg">property</i> | <b class="option">-names</b>?</span></a></dt>
<dd><p>This command returns a string or a list of strings containing the
properties of a MIME part. If the command is invoked with the name of
a specific property, then the corresponding value is returned;
instead, if <b class="option">-names</b> is specified, a list of all properties is
returned; otherwise, a serialized array of properties and values is
returned.</p>
<p>The possible properties are:</p>
<dl class="definitions">
<dt><b class="const">content</b></dt>
<dd><p>The type/subtype describing the content</p></dd>
<dt><b class="const">encoding</b></dt>
<dd><p>The &quot;Content-Transfer-Encoding&quot;</p></dd>
<dt><b class="const">params</b></dt>
<dd><p>A list of &quot;Content-Type&quot; parameters</p></dd>
<dt><b class="const">parts</b></dt>
<dd><p>A list of tokens for the part's subordinates.  This property is
present only if the MIME part has subordinates.</p></dd>
<dt><b class="const">size</b></dt>
<dd><p>The approximate size of the content (unencoded)</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::mime::getheader</b> <i class="arg">token</i> <span class="opt">?<i class="arg">key</i> | <b class="option">-names</b>?</span></a></dt>
<dd><p>This command returns the header of a MIME part, as a list of strings.</p>
<p>A header consists of zero or more key/value pairs. Each value is a
list containing one or more strings.</p>
<p>If this command is invoked with the name of a specific <i class="arg">key</i>, then
a list containing the corresponding value(s) is returned; instead, if
-names is specified, a list of all keys is returned; otherwise, a
serialized array of keys and values is returned. Note that when a key
is specified (e.g., &quot;Subject&quot;), the list returned usually contains
exactly one string; however, some keys (e.g., &quot;Received&quot;) often occur
more than once in the header, accordingly the list returned usually
contains more than one string.</p></dd>
<dt><a name="5"><b class="cmd">::mime::setheader</b> <i class="arg">token</i> <i class="arg">key value</i> <span class="opt">?<b class="option">-mode</b> <b class="const">write</b> | <b class="const">append</b> | <b class="const">delete</b>?</span></a></dt>
<dd><p>This command writes, appends to, or deletes the <i class="arg">value</i> associated
with a <i class="arg">key</i> in the header. It returns a list of strings
containing the previous value associated with the key.</p>
<p>The value for <b class="option">-mode</b> is one of:</p>
<dl class="definitions">
<dt><b class="const">write</b></dt>
<dd><p>The <i class="arg">key</i>/<i class="arg">value</i> is either created or overwritten (the default).</p></dd>
<dt><b class="const">append</b></dt>
<dd><p>A new <i class="arg">value</i> is appended for the <i class="arg">key</i> (creating it as necessary).</p></dd>
<dt><b class="const">delete</b></dt>
<dd><p>All values associated with the key are removed (the <i class="arg">value</i>
parameter is ignored).</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::mime::getbody</b> <i class="arg">token</i> <span class="opt">?<b class="option">-decode</b>?</span> <span class="opt">?<b class="option">-command</b> <i class="arg">callback</i> <span class="opt">?<b class="option">-blocksize</b> <i class="arg">octets</i>?</span>?</span></a></dt>
<dd><p>This command returns a string containing the body of the leaf MIME
part represented by <i class="arg">token</i> in canonical form.</p>
<p>If the <b class="option">-command</b> option is present, then it is repeatedly
invoked with a fragment of the body as this:</p>
<pre class="example">
  uplevel #0 $callback [list &quot;data&quot; $fragment]
</pre>
<p>(The <b class="option">-blocksize</b> option, if present, specifies the maximum
size of each fragment passed to the callback.)</p>
<p>When the end of the body is reached, the callback is invoked as:</p>
<pre class="example">
    uplevel #0 $callback &quot;end&quot;
</pre>
<p>Alternatively, if an error occurs, the callback is invoked as:</p>
<pre class="example">
    uplevel #0 $callback [list &quot;error&quot; reason]
</pre>
<p>Regardless, the return value of the final invocation of the callback
is propagated upwards by <b class="cmd">::mime::getbody</b>.</p>
<p>If the <b class="option">-command</b> option is absent, then the return value of
<b class="cmd">::mime::getbody</b> is a string containing the MIME part's entire
body.</p>
<p>If the option <b class="option">-decode</b> is absent the return value computed
above is returned as is. This means that it will be in the charset
specified for the token and not the usual utf-8.
If the option <b class="option">-decode</b> is present however the command will use
the charset information associated with the token to convert the
string from its encoding into utf-8 before returning it.</p></dd>
<dt><a name="7"><b class="cmd">::mime::copymessage</b> <i class="arg">token</i> <i class="arg">channel</i></a></dt>
<dd><p>This command copies the MIME represented by <i class="arg">token</i> part to the
specified <i class="arg">channel</i>. The command operates synchronously, and uses
fileevent to allow asynchronous operations to proceed
independently. It returns an empty string.</p></dd>
<dt><a name="8"><b class="cmd">::mime::buildmessage</b> <i class="arg">token</i></a></dt>
<dd><p>This command returns the MIME part represented by <i class="arg">token</i> as a
string.  It is similar to <b class="cmd">::mime::copymessage</b>, only it returns
the data as a return string instead of writing to a channel.</p></dd>
<dt><a name="9"><b class="cmd">::mime::parseaddress</b> <i class="arg">string</i></a></dt>
<dd><p>This command takes a string containing one or more 822-style address
specifications and returns a list of serialized arrays, one element
for each address specified in the argument. If the string contains
more than one address they will be separated by commas.</p>
<p>Each serialized array contains the properties below. Note that one or
more of these properties may be empty.</p>
<dl class="definitions">
<dt><b class="const">address</b></dt>
<dd><p>local@domain</p></dd>
<dt><b class="const">comment</b></dt>
<dd><p>822-style comment</p></dd>
<dt><b class="const">domain</b></dt>
<dd><p>the domain part (rhs)</p></dd>
<dt><b class="const">error</b></dt>
<dd><p>non-empty on a parse error</p></dd>
<dt><b class="const">group</b></dt>
<dd><p>this address begins a group</p></dd>
<dt><b class="const">friendly</b></dt>
<dd><p>user-friendly rendering</p></dd>
<dt><b class="const">local</b></dt>
<dd><p>the local part (lhs)</p></dd>
<dt><b class="const">memberP</b></dt>
<dd><p>this address belongs to a group</p></dd>
<dt><b class="const">phrase</b></dt>
<dd><p>the phrase part</p></dd>
<dt><b class="const">proper</b></dt>
<dd><p>822-style address specification</p></dd>
<dt><b class="const">route</b></dt>
<dd><p>822-style route specification (obsolete)</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::mime::parsedatetime</b> (<i class="arg">string</i> | <b class="option">-now</b>) <i class="arg">property</i></a></dt>
<dd><p>This command takes a string containing an 822-style date-time
specification and returns the specified property as a serialized
array.</p>
<p>The list of properties and their ranges are:</p>
<dl class="definitions">
<dt><b class="const">hour</b></dt>
<dd><p>0 .. 23</p></dd>
<dt><b class="const">lmonth</b></dt>
<dd><p>January, February, ..., December</p></dd>
<dt><b class="const">lweekday</b></dt>
<dd><p>Sunday, Monday, ... Saturday</p></dd>
<dt><b class="const">mday</b></dt>
<dd><p>1 .. 31</p></dd>
<dt><b class="const">min</b></dt>
<dd><p>0 .. 59</p></dd>
<dt><b class="const">mon</b></dt>
<dd><p>1 .. 12</p></dd>
<dt><b class="const">month</b></dt>
<dd><p>Jan, Feb, ..., Dec</p></dd>
<dt><b class="const">proper</b></dt>
<dd><p>822-style date-time specification</p></dd>
<dt><b class="const">rclock</b></dt>
<dd><p>elapsed seconds between then and now</p></dd>
<dt><b class="const">sec</b></dt>
<dd><p>0 .. 59</p></dd>
<dt><b class="const">wday</b></dt>
<dd><p>0 .. 6 (Sun .. Mon)</p></dd>
<dt><b class="const">weekday</b></dt>
<dd><p>Sun, Mon, ..., Sat</p></dd>
<dt><b class="const">yday</b></dt>
<dd><p>1 .. 366</p></dd>
<dt><b class="const">year</b></dt>
<dd><p>1900 ...</p></dd>
<dt><b class="const">zone</b></dt>
<dd><p>-720 .. 720 (minutes east of GMT)</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::mime::mapencoding</b> <i class="arg">encoding_name</i></a></dt>
<dd><p>This commansd maps tcl encodings onto the proper names for their MIME
charset type.  This is only done for encodings whose charset types
were known.  The remaining encodings return &quot;&quot; for now.</p></dd>
<dt><a name="12"><b class="cmd">::mime::reversemapencoding</b> <i class="arg">charset_type</i></a></dt>
<dd><p>This command maps MIME charset types onto tcl encoding names.  Those
that are unknown return &quot;&quot;.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">KNOWN BUGS</a></h2>
<dl class="definitions">
<dt>SourceForge Tcllib Bug #447037</dt>
<dd><p>This problem affects only people which are using Tcl and Mime on a
64-bit system. The currently recommended fix for this problem is to
upgrade to Tcl version 8.4. This version has extended 64 bit support
and the bug does not appear anymore.</p>
<p>The problem could have been generally solved by requiring the use of
Tcl 8.4 for this package. We decided against this solution as it would
force a large number of unaffected users to upgrade their Tcl
interpreter for no reason.</p>
<p>See <a href="http://sourceforge.net/tracker/?func=detail&aid=447037&group_id=12883&atid=112883">http://sourceforge.net/tracker/?func=detail&amp;aid=447037&amp;group_id=12883&amp;atid=112883</a>
for additional information.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>mime</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../ftp/ftp.html">ftp</a>, <a href="../../../../index.html#key481">http</a>, <a href="../pop3/pop3.html">pop3</a>, <a href="smtp.html">smtp</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key293">email</a>, <a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key288">mail</a>, <a href="../../../../index.html#key211">mime</a>, <a href="../../../../index.html#key250">net</a>, <a href="../../../../index.html#key750">rfc 2045</a>, <a href="../../../../index.html#key751">rfc 2046</a>, <a href="../../../../index.html#key749">rfc 2049</a>, <a href="../../../../index.html#key290">rfc 821</a>, <a href="../../../../index.html#key291">rfc 822</a>, <a href="../../../../index.html#key295">smtp</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 1999-2000 Marshall T. Rose</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/mime/smtp.html.




















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>smtp - smtp client</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/mime/smtp.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 1999-2000 Marshall T. Rose and others
   -->
<! -- CVS: $Id$ smtp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">smtp(n) 1.4.5 tcllib &quot;smtp client&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>smtp - Client-side tcl implementation of the smtp protocol</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Authentication</a></li>
<li class="section"><a href="#section3">EXAMPLE</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl</b></li>
<li>package require <b class="pkgname">mime <span class="opt">?1.5.4?</span></b></li>
<li>package require <b class="pkgname">smtp <span class="opt">?1.4.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::smtp::sendmessage</b> <i class="arg">token</i> <i class="arg">option</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">smtp</b> library package provides the client side of the
Simple Mail Transfer Protocol (SMTP) (1) (2).</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::smtp::sendmessage</b> <i class="arg">token</i> <i class="arg">option</i>...</a></dt>
<dd><p>This command sends the MIME part (see package <b class="package"><a href="mime.html">mime</a></b>)
represented by <i class="arg">token</i> to an SMTP server. <i class="arg">options</i> is a list
of options and their associated values.  The recognized options are:</p>
<dl class="definitions">
<dt><b class="option">-servers</b></dt>
<dd><p>A list of SMTP servers. The default is <b class="const">localhost</b>.</p></dd>
<dt><b class="option">-ports</b></dt>
<dd><p>A list of SMTP ports. The default is <b class="const">25</b>.</p></dd>
<dt><b class="option">-client</b></dt>
<dd><p>The name to use as our hostname when connecting to the server. By
default this is either localhost if one of the servers is localhost,
or is set to the string returned by <b class="cmd">info hostname</b>.</p></dd>
<dt><b class="option">-queue</b></dt>
<dd><p>Indicates that the SMTP server should be asked to queue the message
for later processing. A boolean value.</p></dd>
<dt><b class="option">-atleastone</b></dt>
<dd><p>Indicates that the SMTP server must find at least one recipient
acceptable for the message to be sent. A boolean value.</p></dd>
<dt><b class="option">-originator</b></dt>
<dd><p>A string containing an 822-style address specification. If present the
header isn't examined for an originator address.</p></dd>
<dt><b class="option">-recipients</b></dt>
<dd><p>A string containing one or more 822-style address specifications. If
present the header isn't examined for recipient addresses). If the
string contains more than one address they will be separated by
commas.</p></dd>
<dt><b class="option">-header</b></dt>
<dd><p>A list containing two elements, an smtp header and its associated
value (the -header option may occur zero or more times).</p></dd>
<dt><b class="option">-usetls</b></dt>
<dd><p>This package supports the RFC 3207 TLS extension (3) by default provided the 
tls package is available. You can turn this off with this boolean option.</p></dd>
<dt><b class="option">-tlspolicy</b></dt>
<dd><p>This option lets you specify a command to be called if an error occurs 
during TLS setup. The command is called with the SMTP code and diagnostic
message appended. The command should return 'secure' or 'insecure' where
insecure will cause the package to continue on the unencrypted channel.
Returning 'secure' will cause the socket to be closed and the next server
in the <b class="option">-servers</b> list to be tried.</p></dd>
<dt><b class="option">-username</b></dt>
<dd></dd>
<dt><b class="option">-password</b></dt>
<dd><p>If your SMTP server requires authentication (RFC 2554 (4)) before
accepting mail you can use <b class="option">-username</b> and <b class="option">-password</b>
to provide your authentication details to the server. Currently this
package supports DIGEST-MD5, CRAM-MD5, LOGIN and PLAIN authentication
methods. The most secure method will be tried first and each method
tried in turn until we are either authorized or we run out of
methods. Note that if the server permits a TLS connection, then the
authorization will occur after we begin using the secure channel.</p>
<p>Please also read the section on <span class="sectref"><a href="#section2">Authentication</a></span>, it details
the necessary prequisites, i.e. packages needed to support these
options and authentication.</p></dd>
</dl>
<p>If the <b class="option">-originator</b> option is not present, the originator
address is taken from <b class="const">From</b> (or <b class="const">Resent-From</b>);
similarly, if the <b class="option">-recipients</b> option is not present,
recipient addresses are taken from <b class="const">To</b>, <b class="const">cc</b>, and
<b class="const">Bcc</b> (or <b class="const">Resent-To</b>, and so on). Note that the header
key/values supplied by the <b class="option">-header</b> option (not those present
in the MIME part) are consulted. Regardless, header key/values are
added to the outgoing message as necessary to ensure that a valid
822-style message is sent.</p>
<p>The command returns a list indicating which recipients were
unacceptable to the SMTP server. Each element of the list is another
list, containing the address, an SMTP error code, and a textual
diagnostic. Depending on the <b class="option">-atleastone</b> option and the
intended recipients, a non-empty list may still indicate that the
message was accepted by the server.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">Authentication</a></h2>
<p>Beware. SMTP authentication uses <b class="package"><a href="../sasl/sasl.html">SASL</a></b>. I.e. if the user
has to authenticate a connection, i.e. use the options <b class="option">-user</b>
and <b class="option">-password</b> (see above) it is necessary to have the
<b class="package">sasl</b> package available so that <b class="package">smtp</b> can load it.</p>
<p>This is a soft dependency because not everybody requires authentication,
and <b class="package">sasl</b> depends on a lot of the cryptographic (secure) hashes,
i.e. all of <b class="package"><a href="../md5/md5.html">md5</a></b>, <b class="package"><a href="../otp/otp.html">otp</a></b>, <b class="package"><a href="../md4/md4.html">md4</a></b>, <b class="package"><a href="../sha1/sha1.html">sha1</a></b>,
and <b class="package"><a href="../ripemd/ripemd160.html">ripemd160</a></b>.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLE</a></h2>
<pre class="example">
proc send_simple_message {recipient email_server subject body} {
    package require smtp
    package require mime
    set token [mime::initialize -canonical text/plain \\
	-string $body]
    mime::setheader $token Subject $subject
    smtp::sendmessage $token \\
	-recipients $recipient -servers $email_server
    mime::finalize $token
}
send_simple_message [email protected] localhost \\
    &quot;This is the subject.&quot; &quot;This is the message.&quot;
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Jonathan B. Postel, &quot;SIMPLE MAIL TRANSFER PROTOCOL&quot;, RFC 821, August 1982.
    (<a href="http://www.rfc-editor.org/rfc/rfc821.txt">http://www.rfc-editor.org/rfc/rfc821.txt</a>)</p></li>
<li><p>J. Klensin, &quot;Simple Mail Transfer Protocol&quot;, RFC 2821, April 2001.
    (<a href="http://www.rfc-editor.org/rfc/rfc2821.txt">http://www.rfc-editor.org/rfc/rfc2821.txt</a>)</p></li>
<li><p>P. Hoffman, &quot;SMTP Service Extension for Secure SMTP over Transport
    Layer Security&quot;, RFC 3207, February 2002.
    (<a href="http://www.rfc-editor.org/rfc/rfc3207.txt">http://www.rfc-editor.org/rfc/rfc3207.txt</a>)</p></li>
<li><p>J. Myers, &quot;SMTP Service Extension for Authentication&quot;, 
    RFC 2554, March 1999.
    (<a href="http://www.rfc-editor.org/rfc/rfc2554.txt">http://www.rfc-editor.org/rfc/rfc2554.txt</a>)</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>smtp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../ftp/ftp.html">ftp</a>, <a href="../../../../index.html#key481">http</a>, <a href="mime.html">mime</a>, <a href="../pop3/pop3.html">pop3</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key293">email</a>, <a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key288">mail</a>, <a href="../../../../index.html#key211">mime</a>, <a href="../../../../index.html#key250">net</a>, <a href="../../../../index.html#key294">rfc 2554</a>, <a href="../../../../index.html#key287">rfc 2821</a>, <a href="../../../../index.html#key292">rfc 3207</a>, <a href="../../../../index.html#key290">rfc 821</a>, <a href="../../../../index.html#key291">rfc 822</a>, <a href="../../../../index.html#key295">smtp</a>, <a href="../../../../index.html#key289">tls</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 1999-2000 Marshall T. Rose and others</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/multiplexer/multiplexer.html.









































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>multiplexer - One-to-many communication with sockets.</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/multiplexer/multiplexer.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ multiplexer.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">multiplexer(n) 0.2 tcllib &quot;One-to-many communication with sockets.&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>multiplexer - One-to-many communication with sockets.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">multiplexer <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::multiplexer::create</b></a></li>
<li><a href="#2"><b class="cmd">${multiplexer_instance}::Init</b> <i class="arg">port</i></a></li>
<li><a href="#3"><b class="cmd">${multiplexer_instance}::Config</b> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#4"><b class="cmd">${multiplexer_instance}::AddFilter</b> <i class="arg">cmdprefix</i></a></li>
<li><a href="#5"><b class="cmd">cmdprefix</b> <i class="arg">data</i> <i class="arg">chan</i> <i class="arg">clientaddress</i> <i class="arg">clientport</i></a></li>
<li><a href="#6"><b class="cmd">${multiplexer_instance}::AddAccessFilter</b> <i class="arg">cmdprefix</i></a></li>
<li><a href="#7"><b class="cmd">cmdprefix</b> <i class="arg">chan</i> <i class="arg">clientaddress</i> <i class="arg">clientport</i></a></li>
<li><a href="#8"><b class="cmd">${multiplexer_instance}::AddExitFilter</b> <i class="arg">cmdprefix</i></a></li>
<li><a href="#9"><b class="cmd">cmdprefix</b> <i class="arg">chan</i> <i class="arg">clientaddress</i> <i class="arg">clientport</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">multiplexer</b> package provides a generic system for one-to-many
communication utilizing sockets.  For example, think of a chat system
where one user sends a message which is then broadcast to all the
other connected users.</p>
<p>It is possible to have different multiplexers running concurrently.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::multiplexer::create</b></a></dt>
<dd><p>The <b class="cmd">create</b> command creates a new multiplexer 'instance'.  For
example:</p>
<pre class="example">set mp [::multiplexer::create]</pre>
<p>This instance can then be manipulated like so:</p>
<pre class="example">${mp}::Init 35100</pre>
</dd>
<dt><a name="2"><b class="cmd">${multiplexer_instance}::Init</b> <i class="arg">port</i></a></dt>
<dd><p>This starts the multiplexer listening on the specified port.</p></dd>
<dt><a name="3"><b class="cmd">${multiplexer_instance}::Config</b> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Use <b class="cmd">Config</b> to configure the multiplexer instance.  Configuration
options currently include:</p>
<dl class="options">
<dt><b class="option">sendtoorigin</b></dt>
<dd><p>A boolean flag. If <b class="const">true</b>, the sender will receive a copy of the
sent message.  Defaults to <b class="const">false</b>.</p></dd>
<dt><b class="option">debuglevel</b></dt>
<dd><p>Sets the debug level to use for the multiplexer instance, according to
those specified by the <b class="package"><a href="../log/logger.html">logger</a></b> package (debug, info, notice,
warn, error, critical).</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">${multiplexer_instance}::AddFilter</b> <i class="arg">cmdprefix</i></a></dt>
<dd><p>Command to add a filter for data that passes through the multiplexer
instance. 
The registered <i class="arg">cmdprefix</i> is called when data arrives at a
multiplexer instance. If there is more than one filter command
registered at the instance they will be called in the order of
registristation, and each filter will get the result of the preceding
filter as its argument. The first filter gets the incoming data as its
argument. The result returned by the last filter is the data which
will be broadcast to all clients of the multiplexer instance.
The command prefix is called as</p>
<dl class="definitions">
<dt><a name="5"><b class="cmd">cmdprefix</b> <i class="arg">data</i> <i class="arg">chan</i> <i class="arg">clientaddress</i> <i class="arg">clientport</i></a></dt>
<dd><p>Takes the incoming <i class="arg">data</i>, modifies it, and returns that as its
result. The last three arguments contain information about the client
which sent the data to filter: The channel connecting us to the
client, its ip-address, and its ip-port.</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">${multiplexer_instance}::AddAccessFilter</b> <i class="arg">cmdprefix</i></a></dt>
<dd><p>Command to add an access filter.
The registered <i class="arg">cmdprefix</i> is called when a new client socket
tries to connect to the multixer instance. If there is more than one
access filter command registered at the instance they will be called
in the order of registristation. If any of the called commands returns
<b class="const">-1</b> the access to the multiplexer instance is denied and the
client channel is closed immediately. Any other result grants the
client access to the multiplexer instance.
The command prefix is called as</p>
<dl class="definitions">
<dt><a name="7"><b class="cmd">cmdprefix</b> <i class="arg">chan</i> <i class="arg">clientaddress</i> <i class="arg">clientport</i></a></dt>
<dd><p>The arguments contain information about the client which tries to
connected to the instance: The channel connecting us to the client,
its ip-address, and its ip-port.</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">${multiplexer_instance}::AddExitFilter</b> <i class="arg">cmdprefix</i></a></dt>
<dd><p>Adds filter to be run when client socket generates an EOF condition.
The registered <i class="arg">cmdprefix</i> is called when a client socket of the
multixer signals EOF. If there is more than one exit filter command
registered at the instance they will be called in the order of
registristation. Errors thrown by an exit filter are ignored, but
logged. Any result returned by an exit filter is ignored.
The command prefix is called as</p>
<dl class="definitions">
<dt><a name="9"><b class="cmd">cmdprefix</b> <i class="arg">chan</i> <i class="arg">clientaddress</i> <i class="arg">clientport</i></a></dt>
<dd><p>The arguments contain information about the client which signaled the
EOF: The channel connecting us to the client, its ip-address, and its
ip-port.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>multiplexer</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key645">chat</a>, <a href="../../../../index.html#key646">multiplexer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/namespacex/namespacex.html.
































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>namespacex - Namespace utility commands</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/namespacex/namespacex.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 200? Neil Madden (http://wiki.tcl.tk/12790)   -- Copyright &copy; 200? Various (http://wiki.tcl.tk/1489)   -- Copyright &copy; 2010 Documentation, Andreas Kupries
   -->
<! -- CVS: $Id$ namespacex.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">namespacex(n) 0.1 tcllib &quot;Namespace utility commands&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>namespacex - Namespace utility commands</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">namespacex <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::namespacex hook add</b> <span class="opt">?<i class="arg">namespace</i>?</span> <i class="arg">cmdprefix</i></a></li>
<li><a href="#2"><b class="cmd">::namespacex hook proc</b> <span class="opt">?<i class="arg">namespace</i>?</span> <i class="arg">arguments</i> <i class="arg">body</i></a></li>
<li><a href="#3"><b class="cmd">::namespacex hook on</b> <span class="opt">?<i class="arg">namespace</i>?</span> <i class="arg">guardcmdprefix</i> <i class="arg">actioncmdprefix</i></a></li>
<li><a href="#4"><b class="cmd">::namespacex hook next</b> <i class="arg">arg</i>...</a></li>
<li><a href="#5"><b class="cmd">::namespacex info allchildren</b> <i class="arg">namespace</i></a></li>
<li><a href="#6"><b class="cmd">::namespacex info allvars</b> <i class="arg">namespace</i></a></li>
<li><a href="#7"><b class="cmd">::namespacex info vars</b> <i class="arg">namespace</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::namespacex state get</b> <i class="arg">namespace</i></a></li>
<li><a href="#9"><b class="cmd">::namespacex state set</b> <i class="arg">namespace</i> <i class="arg">dict</i></a></li>
<li><a href="#10"><b class="cmd">::namespacex state drop</b> <i class="arg">namespace</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a number of utility commands for working with
namespaces.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::namespacex hook add</b> <span class="opt">?<i class="arg">namespace</i>?</span> <i class="arg">cmdprefix</i></a></dt>
<dd></dd>
<dt><a name="2"><b class="cmd">::namespacex hook proc</b> <span class="opt">?<i class="arg">namespace</i>?</span> <i class="arg">arguments</i> <i class="arg">body</i></a></dt>
<dd></dd>
<dt><a name="3"><b class="cmd">::namespacex hook on</b> <span class="opt">?<i class="arg">namespace</i>?</span> <i class="arg">guardcmdprefix</i> <i class="arg">actioncmdprefix</i></a></dt>
<dd></dd>
<dt><a name="4"><b class="cmd">::namespacex hook next</b> <i class="arg">arg</i>...</a></dt>
<dd></dd>
<dt><a name="5"><b class="cmd">::namespacex info allchildren</b> <i class="arg">namespace</i></a></dt>
<dd><p>This command returns a list containing the names of all child
namespaces in the specified <i class="arg">namespace</i> and its children. The
names are all fully qualified.</p></dd>
<dt><a name="6"><b class="cmd">::namespacex info allvars</b> <i class="arg">namespace</i></a></dt>
<dd><p>This command returns a list containing the names of all variables in
the specified <i class="arg">namespace</i> and its children. The names are all
relative to <i class="arg">namespace</i>, and <em>not</em> fully qualified.</p></dd>
<dt><a name="7"><b class="cmd">::namespacex info vars</b> <i class="arg">namespace</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>This command returns a list containing the names of all variables in
the specified <i class="arg">namespace</i>.</p></dd>
<dt><a name="8"><b class="cmd">::namespacex state get</b> <i class="arg">namespace</i></a></dt>
<dd><p>This command returns a dictionary holding the names and values of all
variables in the specified <i class="arg">namespace</i> and its child namespaces.</p>
<p>Note that the names are all relative to <i class="arg">namespace</i>,
and <em>not</em> fully qualified.</p></dd>
<dt><a name="9"><b class="cmd">::namespacex state set</b> <i class="arg">namespace</i> <i class="arg">dict</i></a></dt>
<dd><p>This command takes a dictionary holding the names and values for a set
of variables and replaces the current state of the specified
<i class="arg">namespace</i> and its child namespaces with this state.
The result of the command is the empty string.</p></dd>
<dt><a name="10"><b class="cmd">::namespacex state drop</b> <i class="arg">namespace</i></a></dt>
<dd><p>This command unsets all variables in the specified <i class="arg">namespace</i> and
its child namespaces.
The result of the command is the empty string.</p></dd>
</dl>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key77">extended namespace</a>, <a href="../../../../index.html#key72">info</a>, <a href="../../../../index.html#key75">namespace unknown</a>, <a href="../../../../index.html#key76">namespace utilities</a>, <a href="../../../../index.html#key74">state (de)serialization</a>, <a href="../../../../index.html#key78">unknown hooking</a>, <a href="../../../../index.html#key73">utilities</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 200? Neil Madden (http://wiki.tcl.tk/12790)<br>
Copyright &copy; 200? Various (http://wiki.tcl.tk/1489)<br>
Copyright &copy; 2010 Documentation, Andreas Kupries</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ncgi/ncgi.html.























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>ncgi - CGI Support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ncgi/ncgi.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ ncgi.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ncgi(n) 1.4.1 tcllib &quot;CGI Support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ncgi - Procedures to manipulate CGI values.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">ncgi <span class="opt">?1.4.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ncgi::cookie</b> <i class="arg">cookie</i></a></li>
<li><a href="#2"><b class="cmd">::ncgi::decode</b> <i class="arg">str</i></a></li>
<li><a href="#3"><b class="cmd">::ncgi::empty</b> <i class="arg">name</i></a></li>
<li><a href="#4"><b class="cmd">::ncgi::exists</b> <i class="arg">name</i></a></li>
<li><a href="#5"><b class="cmd">::ncgi::encode</b> <i class="arg">string</i></a></li>
<li><a href="#6"><b class="cmd">::ncgi::header</b> <span class="opt">?<i class="arg">type</i>?</span> <i class="arg">args</i></a></li>
<li><a href="#7"><b class="cmd">::ncgi::import</b> <i class="arg">cginame</i> <span class="opt">?<i class="arg">tclname</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::ncgi::importAll</b> <i class="arg">args</i></a></li>
<li><a href="#9"><b class="cmd">::ncgi::importFile</b> <i class="arg">cmd</i> <i class="arg">cginame</i> <span class="opt">?<i class="arg">filename</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::ncgi::input</b> <span class="opt">?<i class="arg">fakeinput</i>?</span> <span class="opt">?<i class="arg">fakecookie</i>?</span></a></li>
<li><a href="#11"><b class="cmd">::ncgi::multipart</b> <i class="arg">type query</i></a></li>
<li><a href="#12"><b class="cmd">::ncgi::nvlist</b></a></li>
<li><a href="#13"><b class="cmd">::ncgi::names</b></a></li>
<li><a href="#14"><b class="cmd">::ncgi::parse</b></a></li>
<li><a href="#15"><b class="cmd">::ncgi::parseMimeValue</b> <i class="arg">value</i></a></li>
<li><a href="#16"><b class="cmd">::ncgi::query</b></a></li>
<li><a href="#17"><b class="cmd">::ncgi::redirect</b> <i class="arg">url</i></a></li>
<li><a href="#18"><b class="cmd">::ncgi::reset</b> <i class="arg">query type</i></a></li>
<li><a href="#19"><b class="cmd">::ncgi::setCookie</b> <i class="arg">args</i></a></li>
<li><a href="#20"><b class="cmd">::ncgi::setDefaultValue</b> <i class="arg">key defvalue</i></a></li>
<li><a href="#21"><b class="cmd">::ncgi::setDefaultValueList</b> <i class="arg">key defvaluelist</i></a></li>
<li><a href="#22"><b class="cmd">::ncgi::setValue</b> <i class="arg">key value</i></a></li>
<li><a href="#23"><b class="cmd">::ncgi::setValueList</b> <i class="arg">key valuelist</i></a></li>
<li><a href="#24"><b class="cmd">::ncgi::type</b></a></li>
<li><a href="#25"><b class="cmd">::ncgi::urlStub</b> <span class="opt">?<i class="arg">url</i>?</span></a></li>
<li><a href="#26"><b class="cmd">::ncgi::value</b> <i class="arg">key</i> <span class="opt">?<i class="arg">default</i>?</span></a></li>
<li><a href="#27"><b class="cmd">::ncgi::valueList</b> <i class="arg">key</i> <span class="opt">?<i class="arg">default</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">ncgi</b> package provides commands that manipulate CGI
values.  These are values that come from Web forms and are processed
either by CGI scripts or web pages with embedded Tcl code.  Use the
<b class="package">ncgi</b> package to query these values, set and get cookies, and
encode and decode www-url-encoded values.</p>
<p>In the simplest case, a CGI script first calls <b class="cmd">::ncgi::parse</b> and
then calls <b class="cmd">::ncgi::value</b> to get different form values.  If a CGI
value is repeated, you should use <b class="cmd">::ncgi::valueList</b> to get back
the complete list of values.</p>
<p>An alternative to <b class="cmd">::ncgi::parse</b> is <b class="cmd">::ncgi::input</b>, which
has semantics similar to Don Libes' <b class="cmd">cgi_input</b> procedure.
<b class="cmd">::ncgi::input</b> restricts repeated CGI values to have names that
end with &quot;List&quot;.  In this case, <b class="cmd">::ncgi::value</b> will return the
complete list of values, and <b class="cmd">::ncgi::input</b> will raise errors if
it find repeated form elements without the right name.</p>
<p>The <b class="cmd">::ncgi::reset</b> procedure can be used in test suites and Web
servers to initialize the source of the CGI values.  Otherwise the
values are read in from the CGI environment.</p>
<p>The complete set of procedures is described below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ncgi::cookie</b> <i class="arg">cookie</i></a></dt>
<dd><p>Return a list of values for <i class="arg">cookie</i>, if any.  It is possible that
more than one cookie with the same name can be present, so this
procedure returns a list.</p></dd>
<dt><a name="2"><b class="cmd">::ncgi::decode</b> <i class="arg">str</i></a></dt>
<dd><p>Decode strings in www-url-encoding, which represents special
characters with a %xx sequence, where xx is the character code in hex.</p></dd>
<dt><a name="3"><b class="cmd">::ncgi::empty</b> <i class="arg">name</i></a></dt>
<dd><p>Returns 1 if the CGI variable <i class="arg">name</i> is not present or has the
empty string as its value.</p></dd>
<dt><a name="4"><b class="cmd">::ncgi::exists</b> <i class="arg">name</i></a></dt>
<dd><p>The return value is a boolean. It returns <b class="const">0</b> if the CGI
variable <i class="arg">name</i> is not present, and <b class="const">1</b> otherwise.</p></dd>
<dt><a name="5"><b class="cmd">::ncgi::encode</b> <i class="arg">string</i></a></dt>
<dd><p>Encode <i class="arg">string</i> into www-url-encoded format.</p></dd>
<dt><a name="6"><b class="cmd">::ncgi::header</b> <span class="opt">?<i class="arg">type</i>?</span> <i class="arg">args</i></a></dt>
<dd><p>Output the CGI header to standard output.  This emits a Content-Type:
header and additional headers based on <i class="arg">args</i>, which is a list of
header names and header values. The <i class="arg">type</i> defaults to
&quot;text/html&quot;.</p></dd>
<dt><a name="7"><b class="cmd">::ncgi::import</b> <i class="arg">cginame</i> <span class="opt">?<i class="arg">tclname</i>?</span></a></dt>
<dd><p>This creates a variable in the current scope with the value of the CGI
variable <i class="arg">cginame</i>.  The name of the variable is <i class="arg">tclname</i>, or
<i class="arg">cginame</i> if <i class="arg">tclname</i> is empty (default).</p></dd>
<dt><a name="8"><b class="cmd">::ncgi::importAll</b> <i class="arg">args</i></a></dt>
<dd><p>This imports several CGI variables as Tcl variables.  If <i class="arg">args</i> is
empty, then every CGI value is imported.  Otherwise each CGI variable
listed in <i class="arg">args</i> is imported.</p></dd>
<dt><a name="9"><b class="cmd">::ncgi::importFile</b> <i class="arg">cmd</i> <i class="arg">cginame</i> <span class="opt">?<i class="arg">filename</i>?</span></a></dt>
<dd><p>This provides information about an uploaded file from a form input
field of type <b class="const">file</b> with name <i class="arg">cginame</i>.  <i class="arg">cmd</i> can be
one of <b class="option">-server</b> <b class="option">-client</b>, <b class="option">-type</b> or
<b class="option">-data</b>.</p>
<dl class="definitions">
<dt><b class="option">-client</b> <i class="arg">cginame</i></dt>
<dd><p>returns the filename as sent by the client.</p></dd>
<dt><b class="option">-type</b> <i class="arg">cginame</i></dt>
<dd><p>returns the mime type of the uploaded file.</p></dd>
<dt><b class="option">-data</b> <i class="arg">cginame</i></dt>
<dd><p>returns the contents of the file.</p></dd>
<dt><b class="option">-server</b> <i class="arg">cginame</i> <i class="arg">filename</i></dt>
<dd><p>writes the file contents to a local temporary file (or <i class="arg">filename</i>
if supplied) and returns the name of the file. The caller is
responsible for deleting this file after use.</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::ncgi::input</b> <span class="opt">?<i class="arg">fakeinput</i>?</span> <span class="opt">?<i class="arg">fakecookie</i>?</span></a></dt>
<dd><p>This reads and decodes the CGI values from the environment.  It
restricts repeated form values to have a trailing &quot;List&quot; in their
name.  The CGI values are obtained later with the <b class="cmd">::ncgi::value</b>
procedure.</p></dd>
<dt><a name="11"><b class="cmd">::ncgi::multipart</b> <i class="arg">type query</i></a></dt>
<dd><p>This procedure parses a multipart/form-data <i class="arg">query</i>.  This is used
by <b class="cmd">::ncgi::nvlist</b> and not normally called directly.  It returns
an alternating list of names and structured values.  Each structure
value is in turn a list of two elements.  The first element is
meta-data from the multipart/form-data structure.  The second element
is the form value.  If you use <b class="cmd">::ncgi::value</b> you just get the
form value.  If you use <b class="cmd">::ncgi::valueList</b> you get the structured
value with meta data and the value.</p>
<p>The <i class="arg">type</i> is the whole Content-Type, including the parameters
like <i class="arg">boundary</i>.  This returns a list of names and values that
describe the multipart data.  The values are a nested list structure
that has some descriptive information first, and the actual form value
second.  The descriptive information is list of header names and
values that describe the content.</p></dd>
<dt><a name="12"><b class="cmd">::ncgi::nvlist</b></a></dt>
<dd><p>This returns all the query data as a name, value list.  In the case of
multipart/form-data, the values are structured as described in
<b class="cmd">::ncgi::multipart</b>.</p></dd>
<dt><a name="13"><b class="cmd">::ncgi::names</b></a></dt>
<dd><p>This returns all names found in the query data, as a list.
<b class="cmd">::ncgi::multipart</b>.</p></dd>
<dt><a name="14"><b class="cmd">::ncgi::parse</b></a></dt>
<dd><p>This reads and decodes the CGI values from the environment.  The CGI
values are obtained later with the <b class="cmd">::ncgi::value</b> procedure.  IF
a CGI value is repeated, then you should use <b class="cmd">::ncgi::valueList</b>
to get the complete list of values.</p></dd>
<dt><a name="15"><b class="cmd">::ncgi::parseMimeValue</b> <i class="arg">value</i></a></dt>
<dd><p>This decodes the Content-Type and other MIME headers that have the
form of &quot;primary value; param=val; p2=v2&quot; It returns a list, where the
first element is the primary value, and the second element is a list
of parameter names and values.</p></dd>
<dt><a name="16"><b class="cmd">::ncgi::query</b></a></dt>
<dd><p>This returns the raw query data.</p></dd>
<dt><a name="17"><b class="cmd">::ncgi::redirect</b> <i class="arg">url</i></a></dt>
<dd><p>Generate a response that causes a 302 redirect by the Web server.  The
<i class="arg">url</i> is the new URL that is the target of the redirect.  The URL
will be qualified with the current server and current directory, if
necessary, to convert it into a full URL.</p></dd>
<dt><a name="18"><b class="cmd">::ncgi::reset</b> <i class="arg">query type</i></a></dt>
<dd><p>Set the query data and Content-Type for the current CGI session.  This
is used by the test suite and by Web servers to initialize the ncgi
module so it does not try to read standard input or use environment
variables to get its data.  If neither <i class="arg">query</i> or <i class="arg">type</i> are
specified, then the <b class="package">ncgi</b> module will look in the standard
CGI environment for its data.</p></dd>
<dt><a name="19"><b class="cmd">::ncgi::setCookie</b> <i class="arg">args</i></a></dt>
<dd><p>Set a cookie value that will be returned as part of the reply.  This
must be done before <b class="cmd">::ncgi::header</b> or <b class="cmd">::ncgi::redirect</b> is
called in order for the cookie to be returned properly.  The
<i class="arg">args</i> are a set of flags and values:</p>
<dl class="definitions">
<dt><b class="option">-name</b> <i class="arg">name</i></dt>
<dd></dd>
<dt><b class="option">-value</b> <i class="arg">value</i></dt>
<dd></dd>
<dt><b class="option">-expires</b> <i class="arg">date</i></dt>
<dd></dd>
<dt><b class="option">-path</b> <i class="arg">path restriction</i></dt>
<dd></dd>
<dt><b class="option">-domain</b> <i class="arg">domain restriction</i></dt>
<dd></dd>
</dl></dd>
<dt><a name="20"><b class="cmd">::ncgi::setDefaultValue</b> <i class="arg">key defvalue</i></a></dt>
<dd><p>Set a CGI value if it does not already exists.  This affects future
calls to <b class="cmd">::ncgi::value</b> (but not future calls to
<b class="cmd">::ncgi::nvlist</b>).  If the CGI value already is present, then this
procedure has no side effects.</p></dd>
<dt><a name="21"><b class="cmd">::ncgi::setDefaultValueList</b> <i class="arg">key defvaluelist</i></a></dt>
<dd><p>Like <b class="cmd">::ncgi::setDefaultValue</b> except that the value already has
list structure to represent multiple checkboxes or a multi-selection.</p></dd>
<dt><a name="22"><b class="cmd">::ncgi::setValue</b> <i class="arg">key value</i></a></dt>
<dd><p>Set a CGI value, overriding whatever was present in the CGI
environment already.  This affects future calls to <b class="cmd">::ncgi::value</b>
(but not future calls to <b class="cmd">::ncgi::nvlist</b>).</p></dd>
<dt><a name="23"><b class="cmd">::ncgi::setValueList</b> <i class="arg">key valuelist</i></a></dt>
<dd><p>Like <b class="cmd">::ncgi::setValue</b> except that the value already has list
structure to represent multiple checkboxes or a multi-selection.</p></dd>
<dt><a name="24"><b class="cmd">::ncgi::type</b></a></dt>
<dd><p>Returns the Content-Type of the current CGI values.</p></dd>
<dt><a name="25"><b class="cmd">::ncgi::urlStub</b> <span class="opt">?<i class="arg">url</i>?</span></a></dt>
<dd><p>Returns the current URL, but without the protocol, server, and port.
If <i class="arg">url</i> is specified, then it defines the URL for the current
session.  That value will be returned by future calls to
<b class="cmd">::ncgi::urlStub</b></p></dd>
<dt><a name="26"><b class="cmd">::ncgi::value</b> <i class="arg">key</i> <span class="opt">?<i class="arg">default</i>?</span></a></dt>
<dd><p>Return the CGI value identified by <i class="arg">key</i>.  If the CGI value is not
present, then the <i class="arg">default</i> value is returned instead. This value
defaults to the empty string.</p>
<p>If the form value <i class="arg">key</i> is repeated, then there are two cases: if
<b class="cmd">::ncgi::parse</b> was called, then <b class="cmd">::ncgi::value</b> only returns
the first value associated with <i class="arg">key</i>.  If <b class="cmd">::ncgi::input</b> was
called, then <b class="cmd">::ncgi::value</b> returns a Tcl list value and
<i class="arg">key</i> must end in &quot;List&quot; (e.g., &quot;skuList&quot;).  In the case of
multipart/form-data, this procedure just returns the value of the form
element.  If you want the meta-data associated with each form value,
then use <b class="cmd">::ncgi::valueList</b>.</p></dd>
<dt><a name="27"><b class="cmd">::ncgi::valueList</b> <i class="arg">key</i> <span class="opt">?<i class="arg">default</i>?</span></a></dt>
<dd><p>Like <b class="cmd">::ncgi::value</b>, but this always returns a list of values
(even if there is only one value).  In the case of
multipart/form-data, this procedure returns a list of two elements.
The first element is meta-data in the form of a parameter, value list.
The second element is the form value.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<p>Uploading a file</p>
<pre class="example">
HTML:
&lt;html&gt;
&lt;form action=&quot;/cgi-bin/upload.cgi&quot; method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&gt;
Path: &lt;input type=&quot;file&quot; name=&quot;filedata&quot;&gt;&lt;br&gt;
Name: &lt;input type=&quot;text&quot; name=&quot;filedesc&quot;&gt;&lt;br&gt;
&lt;input type=&quot;submit&quot;&gt;
&lt;/form&gt;
&lt;/html&gt;
TCL: upload.cgi
#!/usr/local/bin/tclsh
::ncgi::parse
set filedata [::ncgi::value filedata]
set filedesc [::ncgi::value filedesc]
puts &quot;&lt;html&gt; File uploaded at &lt;a href=\&quot;/images/$filedesc\&quot;&gt;$filedesc&lt;/a&gt; &lt;/html&gt;&quot;
set filename /www/images/$filedesc
set fh [open $filename w]
puts -nonewline $fh $filedata
close $fh
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ncgi</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../html/html.html">html</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key628">CGI</a>, <a href="../../../../index.html#key627">cookie</a>, <a href="../../../../index.html#key566">form</a>, <a href="../../../../index.html#key567">html</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>CGI programming</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/nmea/nmea.html.











































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>nmea - NMEA protocol implementation</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/nmea/nmea.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2009, Aaron Faupell &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nmea.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nmea(n) 1.0.0 tcllib &quot;NMEA protocol implementation&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nmea - Process NMEA data</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">nmea <span class="opt">?1.0.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::nmea::input</b> <i class="arg">sentence</i></a></li>
<li><a href="#2"><b class="cmd">::nmea::open_port</b> <i class="arg">port</i> <span class="opt">?speed?</span></a></li>
<li><a href="#3"><b class="cmd">::nmea::close_port</b></a></li>
<li><a href="#4"><b class="cmd">::nmea::configure_port</b> <i class="arg">settings</i></a></li>
<li><a href="#5"><b class="cmd">::nmea::open_file</b> <i class="arg">file</i> <span class="opt">?rate?</span></a></li>
<li><a href="#6"><b class="cmd">::nmea::close_file</b></a></li>
<li><a href="#7"><b class="cmd">::nmea::do_line</b></a></li>
<li><a href="#8"><b class="cmd">::nmea::rate</b></a></li>
<li><a href="#9"><b class="cmd">::nmea::log</b> <span class="opt">?file?</span></a></li>
<li><a href="#10"><b class="cmd">::nmea::checksum</b> <i class="arg">data</i></a></li>
<li><a href="#11"><b class="cmd">::nmea::write</b> <i class="arg">sentence</i> <i class="arg">data</i></a></li>
<li><a href="#12"><b class="cmd">::nmea::event</b> <i class="arg">setence</i> <span class="opt">?command?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a standard interface for writing software which recieves
NMEA standard input data. It allows for reading data from COM ports, files,
or programmatic input. It also supports the checksumming and logging of incoming data.
After parsing, input is dispatched to user defined handler commands for processing.
To define a handler, see the <b class="cmd"><a href="../../../../index.html#key496">event</a></b> command. There are no GPS specific functions
in this package. NMEA data consists of a sentence type, followed by a list of data.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::nmea::input</b> <i class="arg">sentence</i></a></dt>
<dd><p>Processes and dispatches the supplied sentence. If <i class="arg">sentence</i> contains no commas it is treated as a Tcl list, otherwise it must be standard comma delimited NMEA data, with an optional checksum and leading <b class="const">$</b>.</p>
<pre class="example">
nmea::input {$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39}
nmea::input [list GPGSA A 3 04 05  09 12 &quot;&quot; &quot;&quot; 24 &quot;&quot; &quot;&quot; &quot;&quot;  2.5 1.3 2.1]
</pre>
</dd>
<dt><a name="2"><b class="cmd">::nmea::open_port</b> <i class="arg">port</i> <span class="opt">?speed?</span></a></dt>
<dd><p>Open the specified COM port and read NMEA sentences when available. Port speed is set to
4800bps by default or to <i class="arg">speed</i>.</p></dd>
<dt><a name="3"><b class="cmd">::nmea::close_port</b></a></dt>
<dd><p>Close the com port connection if one is open.</p></dd>
<dt><a name="4"><b class="cmd">::nmea::configure_port</b> <i class="arg">settings</i></a></dt>
<dd><p>Changes the current port settings. <i class="arg">settings</i> has the same format as fconfigure -mode.</p></dd>
<dt><a name="5"><b class="cmd">::nmea::open_file</b> <i class="arg">file</i> <span class="opt">?rate?</span></a></dt>
<dd><p>Open file <i class="arg">file</i> and read NMEA sentences, one per line, at the rate specified by <span class="opt">?rate?</span> in milliseconds.
The file format may omit the leading <b class="const">$</b> and/or the checksum. If rate is &lt;= 0 (the default) then lines
will only be processed when a call to <b class="cmd">do_line</b> is made.</p></dd>
<dt><a name="6"><b class="cmd">::nmea::close_file</b></a></dt>
<dd><p>Close the open file if one exists.</p></dd>
<dt><a name="7"><b class="cmd">::nmea::do_line</b></a></dt>
<dd><p>If there is a currently open file, this command will read and process a single line from it.
Returns the number of lines read.</p></dd>
<dt><a name="8"><b class="cmd">::nmea::rate</b></a></dt>
<dd><p>Sets the rate at which lines are processed from the open file, in milliseconds. The rate remains
consistant across files, there does not need to be a file currently open to use this command.
Set to 0 to disable automatic line processing.</p></dd>
<dt><a name="9"><b class="cmd">::nmea::log</b> <span class="opt">?file?</span></a></dt>
<dd><p>Starts or stops input logging. If a file name is specified then all NMEA data recieved on
the open port will be logged to the <span class="opt">?file?</span> in append mode. If file is an empty string then
any logging will be stopped. If no file is specified then returns a boolean value indicating
if logging is currently enabled. Data written to the port by <b class="cmd">write</b>, 
 data read from files, or input made using <b class="cmd">input</b>, is not logged.</p></dd>
<dt><a name="10"><b class="cmd">::nmea::checksum</b> <i class="arg">data</i></a></dt>
<dd><p>Returns the checksum of the supplied data.</p></dd>
<dt><a name="11"><b class="cmd">::nmea::write</b> <i class="arg">sentence</i> <i class="arg">data</i></a></dt>
<dd><p>If there is a currently open port, this command will write the specified sentence and data to the port
in proper NMEA checksummed format.</p></dd>
<dt><a name="12"><b class="cmd">::nmea::event</b> <i class="arg">setence</i> <span class="opt">?command?</span></a></dt>
<dd><p>Registers a handler proc for a given NMEA <i class="arg">sentence</i>. There may be at most one handler per
sentence, any existing handler is replaced.  
If no command is specified, returns the name of the current handler for the given <i class="arg">setence</i>
or an empty string if none exists. In addition to the incoming sentences there are 2 builtin types,
EOF and DEFAULT. The handler for the DEFAULT setence is invoked if there is not a specific handler
for that sentence. The EOF handler is invoked when End Of File is reached on the open file or port.</p>
<p>The handler procedures, with the exception of the builtin types,must take exactly one argument,
which is a list of the data values.
The DEFAULT handler should have two arguments, the sentence type and the data values.
The EOF handler has no arguments.</p>
<pre class="example">
nmea::event gpgsa parse_sat_detail
nmea::event default handle_unknown
proc parse_sat_detail {data} {
    puts [lindex $data 1]
}
proc handle_unknown {name data} {
    puts &quot;unknown data type $name&quot;
}
</pre>
</dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>nmea</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key359">gps</a>, <a href="../../../../index.html#key358">nmea</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006-2009, Aaron Faupell &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/nns/nns_auto.html.

































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>nameserv::auto - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/nns/nns_auto.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nameserv::auto.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nameserv::auto(n) 0.3 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nameserv::auto - Name service facility, Client Extension</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">OPTIONS</a></li>
<li class="section"><a href="#section4">EVENTS</a></li>
<li class="section"><a href="#section5">DESIGN</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">nameserv::auto <span class="opt">?0.3?</span></b></li>
<li>package require <b class="pkgname">nameserv</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Please read the document <i class="term"><a href="nns_intro.html">Name service facility, introduction</a></i>
first.</p>
<p>This package provides the <em>exact</em> same API as is provided by
package <b class="package"><a href="nns_client.html">nameserv</a></b>, i.e the regular name service client. It
differs from the former by taking measures to ensure that longer-lived
data, i.e. bound names, continuous and unfulfilled async searches,
survive the loss of the connection to the name server as much as is
possible.</p>
<p>This means that the bound names and continuous and unfulfilled async
searches are remembered client-side and automatically re-entered into
the server when the connection comes back after its loss. For bound
names there is one important limitation to such restoration: It is
possible that a name of this client was bound by a different client
while the connection was gone. Such names are fully lost, and the best
the package can and will do is to inform the user of this.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The user-visible API is mainly identical the API of <b class="package"><a href="nns_client.html">nameserv</a></b>
and is therefore not described here. Please read the documentation of
<b class="package"><a href="nns_client.html">nameserv</a></b>.</p>
<p>The differences are explained in the sections <span class="sectref"><a href="#section3">OPTIONS</a></span> and
<span class="sectref"><a href="#section4">EVENTS</a></span>.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">OPTIONS</a></h2>
<p>This package supports all the option of package <b class="package"><a href="nns_client.html">nameserv</a></b>,
and one more. The additional option allows the user to specifies the
time interval between attempts to restore a lost connection.</p>
<dl class="options">
<dt><b class="option">-delay</b> <i class="arg">milliseconds</i></dt>
<dd><p>The value of this option is an integer value &gt; 0 which specifies the
interval to wait between attempts to restore a lost connection, in
milliseconds. The default value is <b class="const">1000</b>, i.e. one second.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EVENTS</a></h2>
<p>This package generates all of the events of package <b class="package"><a href="nns_client.html">nameserv</a></b>,
and two more. Both events are generated for the tag <i class="term"><a href="nns_client.html">nameserv</a></i>.</p>
<dl class="definitions">
<dt><i class="term">lost-name</i></dt>
<dd><p>This event is generated when a bound name is truly lost, i.e. could
not be restored after the temporary loss of the connection to the name
server. It indicates that a different client took ownership of the
name while this client was out of contact.</p>
<p>The detail information of the event will be a Tcl dictionary
containing two keys, <b class="const">name</b>, and <b class="const">data</b>. Their values hold
all the information about the lost name.</p></dd>
<dt><i class="term">re-connection</i></dt>
<dd><p>This event is generated when the connection to the server is
restored. The remembered data has been restored when the event is
posted.</p>
<p>The event has no detail information.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">DESIGN</a></h2>
<p>The package is implemented on top of the regular nameservice client,
i.e.  package <b class="package"><a href="nns_client.html">nameserv</a></b>. It detects the loss of the
connection by listening for <i class="term">lost-connection</i> events, on the tag
<i class="term"><a href="nns_client.html">nameserv</a></i>.</p>
<p>It reacts to such events by starting a periodic timer and trying to
reconnect to the server whenver this timer triggers. On success the
timer is canceled, a <i class="term">re-connection</i> event generated, and the
package proceeds to re-enter the remembered bound names and continous
searches.</p>
<p>Another loss of the connection, be it during or after re-entering the
remembered information simply restarts the timer and subsequent
reconnection attempts.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="nns_client.html">nameserv(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key468">automatic</a>, <a href="../../../../index.html#key30">client</a>, <a href="../../../../index.html#key29">name service</a>, <a href="../../../../index.html#key467">reconnect</a>, <a href="../../../../index.html#key466">restore</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/nns/nns_client.html.
















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>nameserv - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/nns/nns_client.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nameserv.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nameserv(n) 0.4.2 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nameserv - Name service facility, Client</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">CONNECTION HANDLING</a></li>
<li class="section"><a href="#section4">EVENTS</a></li>
<li class="section"><a href="#section5">OPTIONS</a></li>
<li class="section"><a href="#section6">ASYNCHRONOUS AND CONTINUOUS SEARCHES</a></li>
<li class="section"><a href="#section7">HISTORY</a></li>
<li class="section"><a href="#section8">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">nameserv <span class="opt">?0.4.2?</span></b></li>
<li>package require <b class="pkgname">comm</b></li>
<li>package require <b class="pkgname">logger</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::nameserv::bind</b> <i class="arg">name</i> <i class="arg">data</i></a></li>
<li><a href="#2"><b class="cmd">::nameserv::release</b></a></li>
<li><a href="#3"><b class="cmd">::nameserv::search</b> <span class="opt">?<b class="option">-async</b>|<b class="option">-continuous</b>?</span> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::nameserv::protocol</b></a></li>
<li><a href="#5"><b class="cmd">::nameserv::server_protocol</b></a></li>
<li><a href="#6"><b class="cmd">::nameserv::server_features</b></a></li>
<li><a href="#7"><b class="cmd">::nameserv::cget</b> <b class="option">-option</b></a></li>
<li><a href="#8"><b class="cmd">::nameserv::configure</b></a></li>
<li><a href="#9"><b class="cmd">::nameserv::configure</b> <b class="option">-option</b></a></li>
<li><a href="#10"><b class="cmd">::nameserv::configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
<li><a href="#11"><b class="cmd">$result</b> <b class="method">destroy</b></a></li>
<li><a href="#12"><b class="cmd">$result</b> <b class="method">filled</b></a></li>
<li><a href="#13"><b class="cmd">$result</b> <b class="method">get</b> <i class="arg">name</i></a></li>
<li><a href="#14"><b class="cmd">$result</b> <b class="method">names</b></a></li>
<li><a href="#15"><b class="cmd">$result</b> <b class="method">size</b></a></li>
<li><a href="#16"><b class="cmd">$result</b> <b class="method">getall</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Please read <i class="term"><a href="nns_intro.html">Name service facility, introduction</a></i> first.</p>
<p>This package provides a client for the name service facility
implemented by the package <b class="package"><a href="nns_server.html">nameserv::server</a></b>.</p>
<p>This service is built in top of and for the package <b class="package"><a href="../comm/comm.html">comm</a></b>.
It has nothing to do with the Internet's Domain Name System. If the
reader is looking for a package dealing with that please see Tcllib's
packages <b class="package"><a href="../dns/tcllib_dns.html">dns</a></b> and <b class="package">resolv</b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports eight commands, as specified below:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::nameserv::bind</b> <i class="arg">name</i> <i class="arg">data</i></a></dt>
<dd><p>The caller of this command registers the given <i class="arg">name</i> as its name
in the configured name service, and additionally associates a piece of
<i class="arg">data</i> with it. The service does nothing with this information
beyond storing it and delivering it as part of search results. The
meaning is entirely up to the applications using the name service.</p>
<p>A generally useful choice would for example be an identifier for a
communication endpoint managed by the package <b class="package"><a href="../comm/comm.html">comm</a></b>. Anybody
retrieving the name becomes immediately able to talk to this endpoint,
i.e. the registering application.</p>
<p>Of further importance is that a caller can register itself under more
than one name, and each name can have its own piece of <i class="arg">data</i>.</p>
<p>Note that the name service, and thwerefore this command, will throw an
error if the chosen name is already registered.</p></dd>
<dt><a name="2"><b class="cmd">::nameserv::release</b></a></dt>
<dd><p>Invoking this command releases all names (and their data) registered
by all previous calls to <b class="cmd">::nameserv::bind</b> of this client. Note
that the name service will run this command implicitly when it loses
the connection to this client.</p></dd>
<dt><a name="3"><b class="cmd">::nameserv::search</b> <span class="opt">?<b class="option">-async</b>|<b class="option">-continuous</b>?</span> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>This command searches the name service for all registered names
matching the specified glob-<i class="arg">pattern</i>. If not specified the
pattern defaults to <b class="const">*</b>, matching everything. The result of the
command is a dictionary mapping the matching names to the data
associated with them at <i class="term"><a href="../../../../index.html#key659">bind</a></i>-time.</p>
<p>If either option <b class="option">-async</b> or <b class="option">-continuous</b> were
specified the result of this command changes and becomes the Tcl
command of an object holding the actual result.
These two options are supported if and only if the service the client
is connected to supports the protocol feature
<i class="term">Search/Continuous</i>.</p>
<p>For <b class="option">-async</b> the result object is asynchronously filled with
the entries matching the pattern at the time of the search and then
not modified any more.
The option <b class="option">-continuous</b> extends this behaviour by additionally
continuously monitoring the service for the addition and removal of
entries which match the pattern, and updating the object's contents
appropriately.</p>
<p><em>Note</em> that the caller is responsible for configuring the object
with a callback for proper notification when the current result (or
further changes) arrive.</p>
<p>For more information about this object see section
<span class="sectref"><a href="#section6">ASYNCHRONOUS AND CONTINUOUS SEARCHES</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::nameserv::protocol</b></a></dt>
<dd><p>This command returns the highest version of the name service protocol
supported by the package.</p></dd>
<dt><a name="5"><b class="cmd">::nameserv::server_protocol</b></a></dt>
<dd><p>This command returns the highest version of the name service protocol
supported by the name service the client is currently connected to.</p></dd>
<dt><a name="6"><b class="cmd">::nameserv::server_features</b></a></dt>
<dd><p>This command returns a list containing the names of the features of
the name service protocol which are supported by the name service the
client is currently connected to.</p></dd>
<dt><a name="7"><b class="cmd">::nameserv::cget</b> <b class="option">-option</b></a></dt>
<dd><p>This command returns the currently configured value for the specified
<b class="option">-option</b>. The list of supported options and their meaning can
be found in section <span class="sectref"><a href="#section5">OPTIONS</a></span>.</p></dd>
<dt><a name="8"><b class="cmd">::nameserv::configure</b></a></dt>
<dd><p>In this form the command returns a dictionary of all supported
options, and their current values. The list of supported options and
their meaning can be found in section <span class="sectref"><a href="#section5">OPTIONS</a></span>.</p></dd>
<dt><a name="9"><b class="cmd">::nameserv::configure</b> <b class="option">-option</b></a></dt>
<dd><p>In this form the command is an alias for
&quot;<b class="cmd">::nameserv::cget</b> <b class="option">-option</b>]&quot;.
The list of supported options and their meaning can be found in
section <span class="sectref"><a href="#section5">OPTIONS</a></span>.</p></dd>
<dt><a name="10"><b class="cmd">::nameserv::configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>In this form the command is used to configure one or more of the
supported options. At least one option has to be specified, and each
option is followed by its new value.
The list of supported options and their meaning can be found in
section <span class="sectref"><a href="#section5">OPTIONS</a></span>.</p>
<p>This form can be used only as long as the client has not contacted the
name service yet. After contact has been made reconfiguration is not
possible anymore. This means that this form of the command is for the
initalization of the client before it use.
The command forcing a contact with the name service are</p>
<dl class="commands">
<dt><b class="cmd"><a href="../../../../index.html#key659">bind</a></b></dt>
<dd></dd>
<dt><b class="cmd">release</b></dt>
<dd></dd>
<dt><b class="cmd">search</b></dt>
<dd></dd>
<dt><b class="cmd">server_protocol</b></dt>
<dd></dd>
<dt><b class="cmd">server_features</b></dt>
<dd></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">CONNECTION HANDLING</a></h2>
<p>The client automatically connects to the service when one of the
commands below is run for the first time, or whenever one of the
commands is run after the connection was lost, when it was lost.</p>
<dl class="commands">
<dt><b class="cmd"><a href="../../../../index.html#key659">bind</a></b></dt>
<dd></dd>
<dt><b class="cmd">release</b></dt>
<dd></dd>
<dt><b class="cmd">search</b></dt>
<dd></dd>
<dt><b class="cmd">server_protocol</b></dt>
<dd></dd>
<dt><b class="cmd">server_features</b></dt>
<dd></dd>
</dl>
<p>Since version 0.2 of the client it will generate an event when the
connection is lost, allowing higher layers to perform additional
actions. This is done via the support package <b class="package"><a href="../uev/uevent.html">uevent</a></b>. This
and all other name service related packages hereby reserve the
uevent-tag <i class="term">nameserv</i>. All their events will be posted to that
tag.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">EVENTS</a></h2>
<p>This package generates only one event, <i class="term">lost-connection</i>. The
detail information provided to that event is a Tcl dictionary. The
only key contained in the dictionnary is <b class="const">reason</b>, and its value
will be a string describing why the connection was lost.
This string is supplied by the underlying communication package,
i.e. <b class="package"><a href="../comm/comm.html">comm</a></b>.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">OPTIONS</a></h2>
<p>The options supported by the client are for the specification of which
name service to contact, i.e. of the location of the name service.
They are:</p>
<dl class="options">
<dt><b class="option">-host</b> <i class="arg">name</i>|<i class="arg">ipaddress</i></dt>
<dd><p>This option specifies the host name service to contact is running on,
either by <i class="arg">name</i>, or by <i class="arg">ipaddress</i>. The initial default is
<b class="const">localhost</b>, i.e. it is expected to contact a name service
running on the same host as the application using this package.</p></dd>
<dt><b class="option">-port</b> <i class="arg">number</i></dt>
<dd><p>This option specifies the port the name service to contact is
listening on. It has to be a positive integer number (&gt; 0) not greater
than 65536 (unsigned short). The initial default is the number
returned by the command <b class="cmd">::nameserv::common::port</b>, as provided by
the package <b class="package">::nameserv::common</b>.</p></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">ASYNCHRONOUS AND CONTINUOUS SEARCHES</a></h2>
<p>Asynchronous and continuous searches are invoked by using either
option <b class="option">-async</b> or <b class="option">-continuous</b> as argument to the
command <b class="cmd">::nameserv::search</b>.</p>
<p><em>Note</em> that these two options are supported if and only if the
service the client is connected to supports the protocol feature
<i class="term">Search/Continuous</i>. The service provided by the package
<b class="package">::nameserv::server</b> does this since version 0.3.</p>
<p>For such searches the result of the search command is the Tcl command
of an object holding the actual result. The API provided by these
objects is:</p>
<dl class="definitions">
<dt>Options:</dt>
<dd><dl class="options">
<dt><b class="option">-command</b> <i class="arg">command_prefix</i></dt>
<dd><p>This option has to be set if a user of the result object wishes to get
asynchronous notifications when the search result or changes to it
arrive.</p>
<p><em>Note</em> that while it is possible to poll for the arrival of the
initial search result via the method <b class="method">filled</b>, and for
subsequent changes by comparing the output of method <b class="method">getall</b>
against a saved copy, this is not the recommended behaviour. Setting
the <b class="option">-command</b> callback and processing the notifications as
they arrive is much more efficient.</p>
<p>The <i class="arg">command_prefix</i> is called with two arguments, the type of
change, and the data of the change. The type is either <b class="const">add</b> or
<b class="const">remove</b>, indicating new data, or deleted data, respectively.
The data of the change is always a dictionary listing the
added/removed names and their associated data.</p>
<p>The first change reported for a search is always the set of matching
entries at the time of the search.</p></dd>
</dl></dd>
<dt>Methods:</dt>
<dd><dl class="definitions">
<dt><a name="11"><b class="cmd">$result</b> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the object and cancels any continuous monitoring of the
service the object may have had active.</p></dd>
<dt><a name="12"><b class="cmd">$result</b> <b class="method">filled</b></a></dt>
<dd><p>The result is a boolean value indicating whether the search result has
already arrived (<b class="const">True</b>), or not (<b class="const">False</b>).</p></dd>
<dt><a name="13"><b class="cmd">$result</b> <b class="method">get</b> <i class="arg">name</i></a></dt>
<dd><p>Returns the data associated with the given <i class="arg">name</i> at
<i class="term"><a href="../../../../index.html#key659">bind</a></i>-time.</p></dd>
<dt><a name="14"><b class="cmd">$result</b> <b class="method">names</b></a></dt>
<dd><p>Returns a list containing all names known to the object at the time of
the invokation.</p></dd>
<dt><a name="15"><b class="cmd">$result</b> <b class="method">size</b></a></dt>
<dd><p>Returns an integer value specifying the size of the result at the time
of the invokation.</p></dd>
<dt><a name="16"><b class="cmd">$result</b> <b class="method">getall</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a dictionary containing the search result at the time of the
invokation, mapping the matching names to the data associated with
them at <i class="term"><a href="../../../../index.html#key659">bind</a></i>-time.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section7" class="section"><h2><a name="section7">HISTORY</a></h2>
<dl class="definitions">
<dt>0.3.1</dt>
<dd><p>Fixed SF Bug 1954771.</p></dd>
<dt>0.3</dt>
<dd><p>Extended the client with the ability to perform asynchronous and
continuous searches.</p></dd>
<dt>0.2</dt>
<dd><p>Extended the client with the ability to generate events when it loses
its connection to the name service. Based on package <b class="package"><a href="../uev/uevent.html">uevent</a></b>.</p></dd>
<dt>0.1</dt>
<dd><p>Initial implementation of the client.</p></dd>
</dl>
</div>
<div id="section8" class="section"><h2><a name="section8">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="nns_common.html">nameserv::common(n)</a>, <a href="nns_server.html">nameserv::server(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key30">client</a>, <a href="../../../../index.html#key29">name service</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/nns/nns_common.html.
















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>nameserv::common - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/nns/nns_common.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nameserv::common.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nameserv::common(n) 0.1 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nameserv::common - Name service facility, shared definitions</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8</b></li>
<li>package require <b class="pkgname">nameserv::common <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::nameserv::common::port</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Please read <i class="term"><a href="nns_intro.html">Name service facility, introduction</a></i> first.</p>
<p>This package is internal and of no interest to users. It provides the
commands of the name service facility which are shared by the client
and server implemented by the packages <b class="package"><a href="nns_server.html">nameserv::server</a></b> and
<b class="package"><a href="nns_client.html">nameserv</a></b> (the client).</p>
<p>This service is built in top of and for the package <b class="package"><a href="../comm/comm.html">comm</a></b>.
It has nothing to do with the Internet's Domain Name System. If the
reader is looking for a package dealing with that please see Tcllib's
packages <b class="package"><a href="../dns/tcllib_dns.html">dns</a></b> and <b class="package">resolv</b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports a single command, as specified below:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::nameserv::common::port</b></a></dt>
<dd><p>The result returned by the command is the id of the default TCP/IP
port a nameservice server will listen on, and a name service client
will try to connect to.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>nameserv::client(n), <a href="nns_server.html">nameserv::server(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key30">client</a>, <a href="../../../../index.html#key29">name service</a>, <a href="../../../../index.html#key57">server</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/nns/nns_intro.html.






















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>nns_intro - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/nns/nns_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nns_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nns_intro(n) 1.0 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nns_intro - Name service facility, introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Applications</a></li>
<li class="section"><a href="#section3">Packages</a></li>
<li class="section"><a href="#section4">Internals</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><i class="term"><a href="../../apps/nns.html">nns</a></i> (short for <em>nano nameservice</em>) is a facility built
for the package <b class="package"><a href="../comm/comm.html">comm</a></b>, adding a simple name service to it.
It is also built on top of <b class="package"><a href="../comm/comm.html">comm</a></b>, using it for the exchange
of messages between the client and server parts.</p>
<p>This name service facility has nothing to do with the Internet's
<i class="term">Domain Name System</i>, otherwise known as <i class="term"><a href="../../../../index.html#key550">DNS</a></i>. If the
reader is looking for a package dealing with that please see either of
the packages <b class="package"><a href="../dns/tcllib_dns.html">dns</a></b> and <b class="package">resolv</b>, both found in Tcllib
too.</p>
<p>Tcllib provides 2 applications and 4 packages which are working
together and provide access to the facility at different levels.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Applications</a></h2>
<p>The application <b class="syscmd"><a href="../../apps/nnsd.html">nnsd</a></b> provides a simple name server which can
be run by anybody anywhere on their system, as they see fit.
It is also an example on the use of the server-side package
<b class="package"><a href="nns_server.html">nameserv::server</a></b>.</p>
<p>Complementing this server is the <b class="syscmd"><a href="../../apps/nns.html">nns</a></b> client application.
A possible, but no very sensible use would be to enter name/port
bindings into a server from a shell script. Not sensible, as shell
scripts normally do not provide a <b class="package"><a href="../comm/comm.html">comm</a></b>-based service.</p>
<p>The only case for this to make some sense would be in a shell script
wrapped around a Tcl script FOO which is using comm, to register the
listening port used by FOO.
However even there it would much more sensible to extend FOO to use
the nameservice directly. And in regard on how to that <b class="syscmd"><a href="../../apps/nns.html">nns</a></b>
can be used as both example and template.
Beyond that it may also be useful to perform nameservice queries from
shell scripts.</p>
<p>The third application, <b class="syscmd"><a href="../../apps/nnslog.html">nnslog</a></b> is a stripped down form of the
<b class="syscmd"><a href="../../apps/nns.html">nns</a></b> client application. It is reduced to perform a continuous
search for all changes and logs all received events to stdout.</p>
<p>Both clients use the <b class="package"><a href="nns_auto.html">nameserv::auto</a></b> package to automatically
hande the loss and restoration of the connection to the server.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">Packages</a></h2>
<p>The two main packages implementing the service are <b class="package"><a href="nns_client.html">nameserv</a></b>
and <b class="package"><a href="nns_server.html">nameserv::server</a></b>, i.e. client and server. The latter has
not much of an API, just enough to start, stop, and configure it. See
the application <b class="syscmd"><a href="../../apps/nnsd.html">nnsd</a></b> on how to use it.</p>
<p>The basic client, in package <b class="package"><a href="nns_client.html">nameserv</a></b>, provides the main API
to manipulate and query the service. An example of its use is the
application <b class="syscmd"><a href="../../apps/nns.html">nns</a></b>.</p>
<p>The second client package, <b class="package"><a href="nns_auto.html">nameserv::auto</a></b> is API compatible
to the basic client, but provides the additional functionality that it
will automatically restore data like bound names when the connection
to the name service was lost and then reestablished. I.e. it
automatically detects the loss of the server and re-enters the data
when the server comes back.</p>
<p>The package <b class="package"><a href="nns_common.html">nameserv::common</a></b> is of no interest to users. It
is an internal package containing code and definitions common to the
packages <b class="package"><a href="nns_client.html">nameserv</a></b> and <b class="package"><a href="nns_server.html">nameserv::server</a></b>.</p>
<p>All packages use the <b class="package"><a href="../uev/uevent.html">uevent</a></b> package for the reporting of
special circumstances via events, and reserve the uevent-tag
<i class="term"><a href="nns_client.html">nameserv</a></i> for their exclusive use. All their events will be
posted to that tag.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Internals</a></h2>
<p>The document <i class="term"><a href="nns_protocol.html">Name service facility, client/server protocol</a></i>
specifies the protocol used by the packages <b class="package"><a href="nns_client.html">nameserv</a></b> and
<b class="package"><a href="nns_server.html">nameserv::server</a></b> to talk to each other. It is of no interest
to users of either the packages or applications.</p>
<p>Developers wishing to modify and/or extend or to just understand the
internals of the nameservice facility however are strongly advised to
read it.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="nns_client.html">nameserv(n)</a>, <a href="nns_auto.html">nameserv::auto(n)</a>, <a href="nns_common.html">nameserv::common(n)</a>, <a href="nns_protocol.html">nameserv::protocol(n)</a>, <a href="nns_server.html">nameserv::server(n)</a>, <a href="../../apps/nnsd.html">nnsd(n)</a>, nss(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key30">client</a>, <a href="../../../../index.html#key29">name service</a>, <a href="../../../../index.html#key57">server</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/nns/nns_protocol.html.












































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>nameserv::protocol - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/nns/nns_protocol.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nameserv::protocol.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nameserv::protocol(n) 0.1 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nameserv::protocol - Name service facility, client/server protocol</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Nano Name Service Protocol Version 1</a>
<ul>
<li class="subsection"><a href="#subsection1">Basic Layer</a></li>
<li class="subsection"><a href="#subsection2">Message Layer</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Nano Name Service Protocol Extension: Continuous Search</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="method">Bind</b> <i class="arg">name</i> <i class="arg">data</i></a></li>
<li><a href="#2"><b class="method">Release</b></a></li>
<li><a href="#3"><b class="method">Search</b> <i class="arg">pattern</i></a></li>
<li><a href="#4"><b class="method">ProtocolVersion</b></a></li>
<li><a href="#5"><b class="method">ProtocolFeatures</b></a></li>
<li><a href="#6"><b class="method">Search/Continuous/Start</b> <i class="arg">tag</i> <i class="arg">pattern</i></a></li>
<li><a href="#7"><b class="method">Search/Continuous/Stop</b> <i class="arg">tag</i></a></li>
<li><a href="#8"><b class="method">Search/Continuous/Change</b> <i class="arg">tag</i> <b class="method">add</b>|<b class="method">remove</b> <i class="arg">response</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The packages <b class="package"><a href="nns_server.html">nameserv::server</a></b>, <b class="package"><a href="nns_client.html">nameserv</a></b>, and
<b class="package"><a href="nns_common.html">nameserv::common</a></b> provide a simple unprotected name service
facility for use in small trusted environments.</p>
<p>Please read <i class="term"><a href="nns_intro.html">Name service facility, introduction</a></i> first.</p>
<p>This document contains the specification of the network protocol which
is used by client and server to talk to each other, enabling
implementations of the same protocol in other languages.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Nano Name Service Protocol Version 1</a></h2>
<p>This protocol defines the basic set of messages to be supported by a
name service, also called the <i class="term">Core</i> feature.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Basic Layer</a></h3>
<p>The basic communication between client and server is done using the
remote-execution protocol specified by the Tcl package <b class="package"><a href="../comm/comm.html">comm</a></b>.
The relevant document specifying its on-the-wire protocol can be found
in <i class="term"><a href="../comm/comm_wire.html">comm_wire</a></i>.</p>
<p>All the scripts exchanged via this protocol are single commands in
list form and thus can be interpreted as plain messages instead of as
Tcl commands. The commands/messages specified in the next section are
the only commands understood by the server-side. Command and variable
substitutions are not allowed within the messages, i.e. arguments have
to be literal values.</p>
<p>The protocol is synchronous. I.e. for each message sent a response is
expected, and has to be generated. All messages are sent by the client.
The server does not sent messages, only responses to messages.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Message Layer</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="method">Bind</b> <i class="arg">name</i> <i class="arg">data</i></a></dt>
<dd><p>The client sends this message when it registers itself at the service
with a <i class="arg">name</i> and some associated <i class="arg">data</i>. The server has to
send an error response if the <i class="arg">name</i> is already in use. Otherwise
the response has to be an empty string.</p>
<p>The server has to accept multiple names for the same client.</p></dd>
<dt><a name="2"><b class="method">Release</b></a></dt>
<dd><p>The client sends this message to unregister all names it is known
under at the service. The response has to be an empty string, always.</p></dd>
<dt><a name="3"><b class="method">Search</b> <i class="arg">pattern</i></a></dt>
<dd><p>The client sends this message to search the service for names matching
the glob-<i class="arg">pattern</i>. The response has to be a dictionary containing
the matching names as keys, and mapping them to the data associated
with it at <b class="method">Bind</b>-time.</p></dd>
<dt><a name="4"><b class="method">ProtocolVersion</b></a></dt>
<dd><p>The client sends this message to query the service for the highest
version of the name service protocol it supports. The response has to
be a positive integer number.</p>
<p>Servers supporting only <i class="term">Nano Name Service Protocol Version 1</i>
have to return <b class="const">1</b>.</p></dd>
<dt><a name="5"><b class="method">ProtocolFeatures</b></a></dt>
<dd><p>The client sends this message to query the service for the features of
the name service protocol it supports. The response has to be a
list containing feature names.</p>
<p>Servers supporting only <i class="term">Nano Name Service Protocol Version 1</i>
have to return <b class="const">{Core}</b>.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Nano Name Service Protocol Extension: Continuous Search</a></h2>
<p>This protocol defines an extended set of messages to be supported by a
name service, also called the <i class="term">Search/Continuous</i> feature. This
feature defines additional messages between client and server, and is
otherwise identical to version 1 of the protocol. See the last section
for the details of our foundation.</p>
<p>A service supporting this feature has to put the feature name
<b class="const">Search/Continuous</b> into the list of features returned by the
message <i class="term">ProtocolFeatures</i>.</p>
<p>For this extension the protocol is asynchronous. No direct response is
expected for any of the messages in the extension. Furthermore the
server will start sending messages on its own, instead of only
responses to messages, and the client has to be able to handle these
notifications.</p>
<dl class="definitions">
<dt><a name="6"><b class="method">Search/Continuous/Start</b> <i class="arg">tag</i> <i class="arg">pattern</i></a></dt>
<dd><p>The client sends this message to start searching the service for names
matching the glob-<i class="arg">pattern</i>.
In contrast to the regular <i class="term">Search</i> request this one asks the
server to continuously monitor the database for the addition and
removal of matching entries and to notify the client of all such
changes. The particular search is identified by the <i class="arg">tag</i>.</p>
<p>No direct response is expected, rather the clients expect to be
notified of changes via explicit <i class="term">Search/Continuous/Result</i>
messages generated by the service.</p>
<p>It is further expected that the <i class="arg">tag</i> information is passed
unchanged to the <i class="term">Search/Continuous/Result</i> messages. This
tagging of the results enables clients to start multiple searches and
distinguish between the different results.</p></dd>
<dt><a name="7"><b class="method">Search/Continuous/Stop</b> <i class="arg">tag</i></a></dt>
<dd><p>The client sends this message to stop the continuous search identified
by the <i class="arg">tag</i>.</p></dd>
<dt><a name="8"><b class="method">Search/Continuous/Change</b> <i class="arg">tag</i> <b class="method">add</b>|<b class="method">remove</b> <i class="arg">response</i></a></dt>
<dd><p>This message is sent by the service to clients with active continuous
searches to transfer found changes. The first such message for a new
continuous search has to contains the current set of matching entries.</p>
<p>To ensure this a service has to generate an <b class="method">add</b>-message with
an empty <i class="arg">response</i> if there were no matching entries at the time.</p>
<p>The <i class="arg">response</i> has to be a dictionary containing the matching
names as keys, and mapping them to the data associated with it at
<b class="method">Bind</b>-time.
The argument coming before the response tells the client whether the
names in the response were added or removed from the service.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../comm/comm_wire.html">comm_wire(n)</a>, <a href="nns_client.html">nameserv(n)</a>, <a href="nns_server.html">nameserv::server(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key38">comm</a>, <a href="../../../../index.html#key29">name service</a>, <a href="../../../../index.html#key125">protocol</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/nns/nns_server.html.



























































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>nameserv::server - Name service facility</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/nns/nns_server.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ nameserv::server.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nameserv::server(n) 0.3.2 tcllib &quot;Name service facility&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nameserv::server - Name service facility, Server</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">OPTIONS</a></li>
<li class="section"><a href="#section4">HISTORY</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">nameserv::server <span class="opt">?0.3.2?</span></b></li>
<li>package require <b class="pkgname">comm</b></li>
<li>package require <b class="pkgname">interp</b></li>
<li>package require <b class="pkgname">logger</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::nameserv::server::start</b></a></li>
<li><a href="#2"><b class="cmd">::nameserv::server::stop</b></a></li>
<li><a href="#3"><b class="cmd">::nameserv::server::active?</b></a></li>
<li><a href="#4"><b class="cmd">::nameserv::server::cget</b> <b class="option">-option</b></a></li>
<li><a href="#5"><b class="cmd">::nameserv::server::configure</b></a></li>
<li><a href="#6"><b class="cmd">::nameserv::server::configure</b> <b class="option">-option</b></a></li>
<li><a href="#7"><b class="cmd">::nameserv::server::configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Please read <i class="term"><a href="nns_intro.html">Name service facility, introduction</a></i> first.</p>
<p>This package provides an implementation of the serviver side of the
name service facility queried by the client provided by the package
<b class="package"><a href="nns_client.html">nameserv</a></b>. All information required by the server will be
held in memory. There is no persistent state.</p>
<p>This service is built in top of and for the package <b class="package"><a href="../comm/comm.html">comm</a></b>.
It has nothing to do with the Internet's Domain Name System. If the
reader is looking for a package dealing with that please see Tcllib's
packages <b class="package"><a href="../dns/tcllib_dns.html">dns</a></b> and <b class="package">resolv</b>.</p>
<p>This server supports the <i class="term">Core</i> protocol feature, and since
version 0.3 the <i class="term">Search/Continuous</i> feature as well.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports five commands, as specified below:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::nameserv::server::start</b></a></dt>
<dd><p>This command starts the server and causes it to listen on the
configured port. From now on clients are able to connect and make
requests. The result of the command is the empty string.</p>
<p>Note that any incoming requests will only be handled if the
application the server is part of does enter an event loop after this
command has been run.</p></dd>
<dt><a name="2"><b class="cmd">::nameserv::server::stop</b></a></dt>
<dd><p>Invoking this command stops the server and releases all information it
had. Existing connections are shut down, and no new connections will
be accepted any longer. The result of the command is the empty string.</p></dd>
<dt><a name="3"><b class="cmd">::nameserv::server::active?</b></a></dt>
<dd><p>This command returns a boolean value indicating the state of the
server. The result will be <b class="const">true</b> if the server is active,
i.e. has been started, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="4"><b class="cmd">::nameserv::server::cget</b> <b class="option">-option</b></a></dt>
<dd><p>This command returns the currently configured value for the specified
<b class="option">-option</b>. The list of supported options and their meaning can
be found in section <span class="sectref"><a href="#section3">OPTIONS</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::nameserv::server::configure</b></a></dt>
<dd><p>In this form the command returns a dictionary of all supported
options, and their current values. The list of supported options and
their meaning can be found in section <span class="sectref"><a href="#section3">OPTIONS</a></span>.</p></dd>
<dt><a name="6"><b class="cmd">::nameserv::server::configure</b> <b class="option">-option</b></a></dt>
<dd><p>In this form the command is an alias for
&quot;<b class="cmd">::nameserv::server::cget</b> <b class="option">-option</b>]&quot;.
The list of supported options and their meaning can be found in
section <span class="sectref"><a href="#section3">OPTIONS</a></span>.</p></dd>
<dt><a name="7"><b class="cmd">::nameserv::server::configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>In this form the command is used to configure one or more of the
supported options. At least one option has to be specified, and each
option is followed by its new value.
The list of supported options and their meaning can be found in
section <span class="sectref"><a href="#section3">OPTIONS</a></span>.</p>
<p>This form can be used only if the server is not active, i.e. has not
been started yet, or has been stopped. While the server is active it
cannot be reconfigured.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OPTIONS</a></h2>
<p>The options supported by the server are for the specification of the
TCP port to listen on, and whether to accept non-local connections or
not.
They are:</p>
<dl class="options">
<dt><b class="option">-localonly</b> <i class="arg">bool</i></dt>
<dd><p>This option specifies whether to accept only local connections
(-localonly 1) or remote connections as well (-localonly 0). The
default is to accept only local connections.</p></dd>
<dt><b class="option">-port</b> <i class="arg">number</i></dt>
<dd><p>This option specifies the port the name service will listen on after
it has been started. It has to be a positive integer number (&gt; 0) not
greater than 65536 (unsigned short). The initial default is the number
returned by the command <b class="cmd">::nameserv::server::common::port</b>, as
provided by the package <b class="package">::nameserv::server::common</b>.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">HISTORY</a></h2>
<dl class="definitions">
<dt>0.3</dt>
<dd><p>Extended the server with the ability to perform asynchronous and
continuous searches.</p></dd>
<dt>0.2</dt>
<dd><p>Changed name of -local switch to -localonly.</p></dd>
<dt>0.1</dt>
<dd><p>Initial implementation of the server.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>nameserv</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>nameserv::client(n), <a href="nns_common.html">nameserv::common(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key29">name service</a>, <a href="../../../../index.html#key57">server</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/nntp/nntp.html.




















































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>nntp - Tcl NNTP Client Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/nntp/nntp.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ nntp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">nntp(n) 1.5.1 tcllib &quot;Tcl NNTP Client Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>nntp - Tcl client for the NNTP protocol</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLE</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">nntp <span class="opt">?0.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::nntp::nntp</b> <span class="opt">?<i class="arg">host</i>?</span> <span class="opt">?<i class="arg">port</i>?</span> <span class="opt">?<i class="arg">nntpName</i>?</span></a></li>
<li><a href="#2"><i class="arg">nntpName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">nntpName</i> <b class="method">article</b> <span class="opt">?<i class="arg">msgid</i>?</span></a></li>
<li><a href="#4"><i class="arg">nntpName</i> <b class="method">authinfo</b> <span class="opt">?<i class="arg">user</i>?</span> <span class="opt">?<i class="arg">pass</i>?</span></a></li>
<li><a href="#5"><i class="arg">nntpName</i> <b class="method">body</b> <span class="opt">?<i class="arg">msgid</i>?</span></a></li>
<li><a href="#6"><i class="arg">nntpName</i> <b class="method">configure</b></a></li>
<li><a href="#7"><i class="arg">nntpName</i> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#8"><i class="arg">nntpName</i> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i> ...</a></li>
<li><a href="#9"><i class="arg">nntpName</i> <b class="method">cget</b> <i class="arg">option</i></a></li>
<li><a href="#10"><i class="arg">nntpName</i> <b class="method">date</b></a></li>
<li><a href="#11"><i class="arg">nntpName</i> <b class="method">group</b> <span class="opt">?<i class="arg">group</i>?</span></a></li>
<li><a href="#12"><i class="arg">nntpName</i> <b class="method">head</b> <span class="opt">?<i class="arg">msgid</i>?</span></a></li>
<li><a href="#13"><i class="arg">nntpName</i> <b class="method">help</b></a></li>
<li><a href="#14"><i class="arg">nntpName</i> <b class="method">last</b></a></li>
<li><a href="#15"><i class="arg">nntpName</i> <b class="method">list</b></a></li>
<li><a href="#16"><i class="arg">nntpName</i> <b class="method">listgroup</b> <span class="opt">?<i class="arg">group</i>?</span></a></li>
<li><a href="#17"><i class="arg">nntpName</i> <b class="method">mode_reader</b></a></li>
<li><a href="#18"><i class="arg">nntpName</i> <b class="method">newgroups</b> <i class="arg">since</i></a></li>
<li><a href="#19"><i class="arg">nntpName</i> <b class="method">newnews</b></a></li>
<li><a href="#20"><i class="arg">nntpName</i> <b class="method">newnews</b> <i class="arg">since</i></a></li>
<li><a href="#21"><i class="arg">nntpName</i> <b class="method">newnews</b> <i class="arg">group</i> <span class="opt">?<i class="arg">since</i>?</span></a></li>
<li><a href="#22"><i class="arg">nntpName</i> <b class="method">next</b></a></li>
<li><a href="#23"><i class="arg">nntpName</i> <b class="method">post</b> <i class="arg">article</i></a></li>
<li><a href="#24"><i class="arg">nntpName</i> <b class="method">slave</b></a></li>
<li><a href="#25"><i class="arg">nntpName</i> <b class="method">stat</b> <span class="opt">?<i class="arg">msgid</i>?</span></a></li>
<li><a href="#26"><i class="arg">nntpName</i> <b class="method">quit</b></a></li>
<li><a href="#27"><i class="arg">nntpName</i> <b class="method">xgtitle</b> <span class="opt">?<i class="arg">group_pattern</i>?</span></a></li>
<li><a href="#28"><i class="arg">nntpName</i> <b class="method">xhdr</b> <i class="arg">field</i> <span class="opt">?<i class="arg">range</i>?</span></a></li>
<li><a href="#29"><i class="arg">nntpName</i> <b class="method">xover</b> <span class="opt">?<i class="arg">range</i>?</span></a></li>
<li><a href="#30"><i class="arg">nntpName</i> <b class="method">xpat</b> <i class="arg">field</i> <i class="arg">range</i> <span class="opt">?<i class="arg">pattern_list</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">nntp</b> provides a simple Tcl-only client library
for the NNTP protocol.  It works by opening the standard NNTP socket
on the server, and then providing a Tcl API to access the NNTP
protocol commands.  All server errors are returned as Tcl errors
(thrown) which must be caught with the Tcl <b class="cmd">catch</b> command.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::nntp::nntp</b> <span class="opt">?<i class="arg">host</i>?</span> <span class="opt">?<i class="arg">port</i>?</span> <span class="opt">?<i class="arg">nntpName</i>?</span></a></dt>
<dd><p>The command opens a socket connection to the specified NNTP server and
creates a new nntp object with an associated global Tcl command whose
name is <i class="arg">nntpName</i>. This command may be used to access the various
NNTP protocol commands for the new connection. The default <i class="arg">port</i>
number is &quot;119&quot; and the default <i class="arg">host</i> is &quot;news&quot;. These defaults
can be overridden with the environment variables <b class="variable">NNTPPORT</b> and
<b class="variable">NNTPHOST</b> respectively.</p>
<p>Some of the commands supported by this package are not part of the
nntp rfc 977 (<a href="http://www.rfc-editor.org/rfc/rfc977.txt">http://www.rfc-editor.org/rfc/rfc977.txt</a>) and will
not be available (or implemented) on all nntp servers.</p>
<p>The access command <i class="arg">nntpName</i> has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">nntpName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl></dd>
<dt><a name="3"><i class="arg">nntpName</i> <b class="method">article</b> <span class="opt">?<i class="arg">msgid</i>?</span></a></dt>
<dd><p>Query the server for article <i class="arg">msgid</i> from the current group.  The article
is returned as a valid tcl list which contains the headers, followed by
a blank line, and then followed by the body of the article. Each element
in the list is one line of the article.</p></dd>
<dt><a name="4"><i class="arg">nntpName</i> <b class="method">authinfo</b> <span class="opt">?<i class="arg">user</i>?</span> <span class="opt">?<i class="arg">pass</i>?</span></a></dt>
<dd><p>Send authentication information (username and password) to the server.</p></dd>
<dt><a name="5"><i class="arg">nntpName</i> <b class="method">body</b> <span class="opt">?<i class="arg">msgid</i>?</span></a></dt>
<dd><p>Query the server for the body of the article <i class="arg">msgid</i> from the current
group.  The body of the article is returned as a valid tcl list. Each element
in the list is one line of the body of the article.</p></dd>
<dt><a name="6"><i class="arg">nntpName</i> <b class="method">configure</b></a></dt>
<dd></dd>
<dt><a name="7"><i class="arg">nntpName</i> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd></dd>
<dt><a name="8"><i class="arg">nntpName</i> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i> ...</a></dt>
<dd></dd>
<dt><a name="9"><i class="arg">nntpName</i> <b class="method">cget</b> <i class="arg">option</i></a></dt>
<dd><p>Query and configure options of the nntp connection object. Currently
only one option is supported, <b class="option">-binary</b>. When set articles are
retrieved as binary data instead of text. The only methods affected by
this are <b class="method">article</b> and <b class="method">body</b>.</p>
<p>One application of this option would be the download of articles
containing yEnc encoded images. Although encoded the data is still
mostly binary and retrieving it as text will corrupt the information.</p>
<p>See package <b class="package"><a href="../base64/yencode.html">yencode</a></b> for both encoder and decoder of such data.</p></dd>
<dt><a name="10"><i class="arg">nntpName</i> <b class="method">date</b></a></dt>
<dd><p>Query the server for the servers current date.  The date is returned in the
format <em>YYYYMMDDHHMMSS</em>.</p></dd>
<dt><a name="11"><i class="arg">nntpName</i> <b class="method">group</b> <span class="opt">?<i class="arg">group</i>?</span></a></dt>
<dd><p>Optionally set the current group, and retrieve information about the
currently selected group.  Returns the estimated number of articles in
the group followed by the number of the first article in the group, followed
by the last article in the group, followed by the name of the group.</p></dd>
<dt><a name="12"><i class="arg">nntpName</i> <b class="method">head</b> <span class="opt">?<i class="arg">msgid</i>?</span></a></dt>
<dd><p>Query the server for the headers of the article <i class="arg">msgid</i> from the current
group.  The headers of the article are returned as a valid tcl list. Each element
in the list is one line of the headers of the article.</p></dd>
<dt><a name="13"><i class="arg">nntpName</i> <b class="method">help</b></a></dt>
<dd><p>Retrieves a list of the commands that are supported by the news server that
is currently attached to.</p></dd>
<dt><a name="14"><i class="arg">nntpName</i> <b class="method">last</b></a></dt>
<dd><p>Sets the current article pointer to point to the previous message (if there is
one) and returns the msgid of that message.</p></dd>
<dt><a name="15"><i class="arg">nntpName</i> <b class="method">list</b></a></dt>
<dd><p>Returns a tcl list of valid newsgroups and associated information.  Each
newsgroup is returned as an element in the tcl list with the following format:</p>
<pre class="example">
      group last first p
</pre>
<p>where &lt;group&gt; is the name of the newsgroup, &lt;last&gt; is the number of
the last known article currently in that newsgroup, &lt;first&gt; is the
number of the first article currently in the newsgroup, and &lt;p&gt; is
either 'y' or 'n' indicating whether posting to this newsgroup is
allowed ('y') or prohibited ('n').</p>
<p>The &lt;first&gt; and &lt;last&gt; fields will always be numeric.  They may have
leading zeros.  If the &lt;last&gt; field evaluates to less than the
&lt;first&gt; field, there are no articles currently on file in the
newsgroup.</p></dd>
<dt><a name="16"><i class="arg">nntpName</i> <b class="method">listgroup</b> <span class="opt">?<i class="arg">group</i>?</span></a></dt>
<dd><p>Query the server for a list of all the messages (message numbers) in the
group specified by the argument <i class="arg">group</i> or by the current group if
the <i class="arg">group</i> argument was not passed.</p></dd>
<dt><a name="17"><i class="arg">nntpName</i> <b class="method">mode_reader</b></a></dt>
<dd><p>Query the server for its nntp 'MODE READER' response string.</p></dd>
<dt><a name="18"><i class="arg">nntpName</i> <b class="method">newgroups</b> <i class="arg">since</i></a></dt>
<dd><p>Query the server for a list of all the new newsgroups created since the time
specified by the argument <i class="arg">since</i>.  The argument <i class="arg">since</i> can be any
time string that is understood by <b class="cmd">clock scan</b>. The tcl list of newsgroups
is returned in a similar form to the list of groups returned by the
<b class="cmd">nntpName list</b> command.  Each element of the list has the form:</p>
<pre class="example">
      group last first p
</pre>
<p>where &lt;group&gt; is the name of the newsgroup, &lt;last&gt; is the number of
the last known article currently in that newsgroup, &lt;first&gt; is the
number of the first article currently in the newsgroup, and &lt;p&gt; is
either 'y' or 'n' indicating whether posting to this newsgroup is
allowed ('y') or prohibited ('n').</p></dd>
<dt><a name="19"><i class="arg">nntpName</i> <b class="method">newnews</b></a></dt>
<dd><p>Query the server for a list of new articles posted to the current group in the
last day.</p></dd>
<dt><a name="20"><i class="arg">nntpName</i> <b class="method">newnews</b> <i class="arg">since</i></a></dt>
<dd><p>Query the server for a list of new articles posted to the current group since
the time specified by the argument <i class="arg">since</i>.  The argument <i class="arg">since</i> can
be any time string that is understood by <b class="cmd">clock scan</b>.</p></dd>
<dt><a name="21"><i class="arg">nntpName</i> <b class="method">newnews</b> <i class="arg">group</i> <span class="opt">?<i class="arg">since</i>?</span></a></dt>
<dd><p>Query the server for a list of new articles posted to the group specified by
the argument <i class="arg">group</i> since the time specified by the argument <i class="arg">since</i>
(or in the past day if no <i class="arg">since</i> argument is passed.  The argument
<i class="arg">since</i> can be any time string that is understood by <b class="cmd">clock scan</b>.</p></dd>
<dt><a name="22"><i class="arg">nntpName</i> <b class="method">next</b></a></dt>
<dd><p>Sets the current article pointer to point to the next message (if there is
one) and returns the msgid of that message.</p></dd>
<dt><a name="23"><i class="arg">nntpName</i> <b class="method">post</b> <i class="arg">article</i></a></dt>
<dd><p>Posts an article of the form specified in
RFC 1036 (<a href="http://www.rfc-editor.org/rfc/rfc1036.txt">http://www.rfc-editor.org/rfc/rfc1036.txt</a>, successor
to RFC 850) to the current news group.</p></dd>
<dt><a name="24"><i class="arg">nntpName</i> <b class="method">slave</b></a></dt>
<dd><p>Identifies a connection as being made from a slave nntp server. This might
be used to indicate that the connection is serving multiple people and should
be given priority.  Actual use is entirely implementation dependent and may
vary from server to server.</p></dd>
<dt><a name="25"><i class="arg">nntpName</i> <b class="method">stat</b> <span class="opt">?<i class="arg">msgid</i>?</span></a></dt>
<dd><p>The stat command is similar to the article command except that no
text is returned.  When selecting by message number within a group,
the stat command serves to set the current article pointer without
sending text. The returned acknowledgment response will contain the
message-id, which may be of some value.  Using the stat command to
select by message-id is valid but of questionable value, since a
selection by message-id does NOT alter the &quot;current article pointer&quot;</p></dd>
<dt><a name="26"><i class="arg">nntpName</i> <b class="method">quit</b></a></dt>
<dd><p>Gracefully close the connection after sending a NNTP QUIT command down
the socket.</p></dd>
<dt><a name="27"><i class="arg">nntpName</i> <b class="method">xgtitle</b> <span class="opt">?<i class="arg">group_pattern</i>?</span></a></dt>
<dd><p>Returns a tcl list where each element is of the form:</p>
<pre class="example">
newsgroup description
</pre>
<p>If a <i class="arg">group_pattern</i> is specified then only newsgroups that match
the pattern will have their name and description returned.</p></dd>
<dt><a name="28"><i class="arg">nntpName</i> <b class="method">xhdr</b> <i class="arg">field</i> <span class="opt">?<i class="arg">range</i>?</span></a></dt>
<dd><p>Returns the specified header field value for the current message or for a
list of messages from the current group.  <i class="arg">field</i> is the title of a
field in the header such as from, subject, date, etc.  If <i class="arg">range</i> is
not specified or is &quot;&quot; then the current message is queried.  The command
returns a list of elements where each element has the form of:</p>
<pre class="example">
    msgid value
</pre>
<p>Where msgid is the number of the message and value is the value set for the
queried field.  The <i class="arg">range</i> argument can be in any of the following forms:</p>
<dl class="definitions">
<dt><b class="const">&quot;&quot;</b></dt>
<dd><p>The current message is queried.</p></dd>
<dt><i class="arg">msgid1</i>-<i class="arg">msgid2</i></dt>
<dd><p>All messages between <i class="arg">msgid1</i> and <i class="arg">msgid2</i>
(including <i class="arg">msgid1</i> and <i class="arg">msgid2</i>) are queried.</p></dd>
<dt><i class="arg">msgid1</i> <i class="arg">msgid2</i></dt>
<dd><p>All messages between <i class="arg">msgid1</i> and <i class="arg">msgid2</i>
(including <i class="arg">msgid1</i> and <i class="arg">msgid2</i>) are queried.</p></dd>
</dl></dd>
<dt><a name="29"><i class="arg">nntpName</i> <b class="method">xover</b> <span class="opt">?<i class="arg">range</i>?</span></a></dt>
<dd><p>Returns header information for the current message or for a range of messages
from the current group.  The information is returned in a tcl list
where each element is of the form:</p>
<pre class="example">
    msgid subject from date idstring bodysize headersize xref
</pre>
<p>If <i class="arg">range</i> is not specified or is &quot;&quot; then the current message is queried.
The <i class="arg">range</i> argument can be in any of the following forms:</p>
<dl class="definitions">
<dt><b class="const">&quot;&quot;</b></dt>
<dd><p>The current message is queried.</p></dd>
<dt><i class="arg">msgid1</i>-<i class="arg">msgid2</i></dt>
<dd><p>All messages between <i class="arg">msgid1</i> and <i class="arg">msgid2</i>
(including <i class="arg">msgid1</i> and <i class="arg">msgid2</i>) are queried.</p></dd>
<dt><i class="arg">msgid1</i> <i class="arg">msgid2</i></dt>
<dd><p>All messages between <i class="arg">msgid1</i> and <i class="arg">msgid2</i>
(including <i class="arg">msgid1</i> and <i class="arg">msgid2</i>) are queried.</p></dd>
</dl></dd>
<dt><a name="30"><i class="arg">nntpName</i> <b class="method">xpat</b> <i class="arg">field</i> <i class="arg">range</i> <span class="opt">?<i class="arg">pattern_list</i>?</span></a></dt>
<dd><p>Returns the specified header field value for a specified message or for a
list of messages from the current group where the messages match the
pattern(s) given in the pattern_list.  <i class="arg">field</i> is the title of a
field in the header such as from, subject, date, etc.  The information is
returned in a tcl list where each element is of the form:</p>
<pre class="example">
    msgid value
</pre>
<p>Where msgid is the number of the message and value is the value set for the
queried field.  The <i class="arg">range</i> argument can be in any of the following forms:</p>
<dl class="definitions">
<dt><i class="arg">msgid</i></dt>
<dd><p>The message specified by <i class="arg">msgid</i> is queried.</p></dd>
<dt><i class="arg">msgid1</i>-<i class="arg">msgid2</i></dt>
<dd><p>All messages between <i class="arg">msgid1</i> and <i class="arg">msgid2</i>
(including <i class="arg">msgid1</i> and <i class="arg">msgid2</i>) are queried.</p></dd>
<dt><i class="arg">msgid1</i> <i class="arg">msgid2</i></dt>
<dd><p>All messages between <i class="arg">msgid1</i> and <i class="arg">msgid2</i>
(including <i class="arg">msgid1</i> and <i class="arg">msgid2</i>) are queried.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLE</a></h2>
<p>A bigger example for posting a single article.</p>
<pre class="example">
    package require nntp 
    set n [nntp::nntp NNTP_SERVER] 
    $n post &quot;From: [email protected] (USER_FULL) 
    Path: COMPUTERNAME!USERNAME 
    Newsgroups: alt.test 
    Subject: Tcl test post -ignore 
    Message-ID: &lt;[pid][clock seconds] 
    @COMPUTERNAME&gt; 
    Date: [clock format [clock seconds] -format &quot;%a, %d % 
    b %y %H:%M:%S GMT&quot; -gmt true] 
    
    Test message body&quot; 
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>nntp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key485">news</a>, <a href="../../../../index.html#key602">nntp</a>, <a href="../../../../index.html#key605">nntpclient</a>, <a href="../../../../index.html#key603">rfc 1036</a>, <a href="../../../../index.html#key604">rfc 977</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ntp/ntp_time.html.

































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>ntp_time - Network Time Facilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ntp/ntp_time.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ ntp_time.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ntp_time(n) 1.2.1 tcllib &quot;Network Time Facilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ntp_time - Tcl Time Service Client</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">AUTHORS</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.0</b></li>
<li>package require <b class="pkgname">time <span class="opt">?1.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::time::gettime</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">timeserver</i> <span class="opt">?<i class="arg">port</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::time::getsntp</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">timeserver</i> <span class="opt">?<i class="arg">port</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::time::configure</b> <span class="opt">?<i class="arg">options</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::time::cget</b> <i class="arg">name</i></a></li>
<li><a href="#5"><b class="cmd">::time::unixtime</b> <i class="arg">token</i></a></li>
<li><a href="#6"><b class="cmd">::time::status</b> <i class="arg">token</i></a></li>
<li><a href="#7"><b class="cmd">::time::error</b> <i class="arg">token</i></a></li>
<li><a href="#8"><b class="cmd">::time::reset</b> <i class="arg">token</i> <i class="arg"><span class="opt">?reason?</span></i></a></li>
<li><a href="#9"><b class="cmd">::time::wait</b> <i class="arg">token</i></a></li>
<li><a href="#10"><b class="cmd">::time::cleanup</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements a client for the RFC 868 TIME protocol
(<a href="http://www.rfc-editor.org/rfc/rfc868.txt">http://www.rfc-editor.org/rfc/rfc868.txt</a>) and also a minimal
client for the RFC 2030 Simple Network Time Protocol 
(<a href="http://www.rfc-editor.org/rfc/rfc2030.txt">http://www.rfc-editor.org/rfc/rfc2030.txt</a>).
RFC 868 returns the time in seconds since 1 January 1900
to either tcp or udp clients. RFC 2030 also gives this time but also
provides a fractional part which is not used in this client.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::time::gettime</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">timeserver</i> <span class="opt">?<i class="arg">port</i>?</span></a></dt>
<dd><p>Get the time from <i class="arg">timeserver</i>. You may specify any of the options
listed for the <b class="cmd">configure</b> command here. This command returns a
token which must then be used with the remaining commands in this
package. Once you have finished, you should use <b class="cmd"><a href="../../../../index.html#key151">cleanup</a></b> to
release all resources. The default port is <b class="const">37</b>.</p></dd>
<dt><a name="2"><b class="cmd">::time::getsntp</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">timeserver</i> <span class="opt">?<i class="arg">port</i>?</span></a></dt>
<dd><p>Get the time from an SNTP server. This accepts exactly the same
arguments as <b class="cmd">::time::gettime</b> except that the default port is 
<b class="const">123</b>. The result is a token as per <b class="cmd">::time::gettime</b> and
should be handled in the same way.</p>
<p>Note that it is unlikely that any SNTP server will reply using tcp so
you will require the <b class="package">tcludp</b> or the <b class="package">ceptcl</b>
package. If a suitable package can be loaded then the udp protocol
will be used by default.</p></dd>
<dt><a name="3"><b class="cmd">::time::configure</b> <span class="opt">?<i class="arg">options</i>?</span></a></dt>
<dd><p>Called with no arguments this command returns all the current
configuration options and values. Otherwise it should be called with
pairs of option name and value.</p>
<dl class="definitions">
<dt><b class="cmd">-protocol</b> <i class="arg">number</i></dt>
<dd><p>Set the default network protocol. This defaults to udp if the tcludp
  package is available. Otherwise it will use tcp.</p></dd>
<dt><b class="cmd">-port</b> <i class="arg">number</i></dt>
<dd><p>Set the default port to use. RFC 868 uses port <b class="const">37</b>, RFC 2030 uses
port <b class="const">123</b>.</p></dd>
<dt><b class="cmd">-timeout</b> <i class="arg">number</i></dt>
<dd><p>Set the default timeout value in milliseconds. The default is 10 seconds.</p></dd>
<dt><b class="cmd">-command</b> <i class="arg">number</i></dt>
<dd><p>Set a command procedure to be run when a reply is received. The
  procedure is called with the time token appended to the argument list.</p></dd>
<dt><b class="cmd">-loglevel</b> <i class="arg">number</i></dt>
<dd><p>Set the logging level. The default is 'warning'.</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::time::cget</b> <i class="arg">name</i></a></dt>
<dd><p>Get the current value for the named configuration option.</p></dd>
<dt><a name="5"><b class="cmd">::time::unixtime</b> <i class="arg">token</i></a></dt>
<dd><p>Format the returned time for the unix epoch. RFC 868 time defines
  time 0 as 1 Jan 1900, while unix time defines time 0 as 1 Jan
  1970. This command converts the reply to unix time.</p></dd>
<dt><a name="6"><b class="cmd">::time::status</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the status flag. For a successfully completed query this will be
  <em>ok</em>. May be <em>error</em> or <em>timeout</em> or <em>eof</em>.
  See also <b class="cmd">::time::error</b></p></dd>
<dt><a name="7"><b class="cmd">::time::error</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the error message provided for requests whose status is <em>error</em>.
  If there is no error message then an empty string is returned.</p></dd>
<dt><a name="8"><b class="cmd">::time::reset</b> <i class="arg">token</i> <i class="arg"><span class="opt">?reason?</span></i></a></dt>
<dd><p>Reset or cancel the query optionally specfying the reason to record
  for the <b class="cmd"><a href="../../../../index.html#key154">error</a></b> command.</p></dd>
<dt><a name="9"><b class="cmd">::time::wait</b> <i class="arg">token</i></a></dt>
<dd><p>Wait for a query to complete and return the status upon completion.</p></dd>
<dt><a name="10"><b class="cmd">::time::cleanup</b> <i class="arg">token</i></a></dt>
<dd><p>Remove all state variables associated with the request.</p></dd>
</dl>
<pre class="example">
% set tok [::time::gettime ntp2a.mcc.ac.uk]
% set t [::time::unixtime $tok]
% ::time::cleanup $tok
</pre>
<pre class="example">
% set tok [::time::getsntp pool.ntp.org]
% set t [::time::unixtime $tok]
% ::time::cleanup $tok
</pre>
<pre class="example">
proc on_time {token} {
   if {[time::status $token] eq &quot;ok&quot;} {
      puts [clock format [time::unixtime $token]]
   } else {
      puts [time::error $token]
   }
   time::cleanup $token
}
time::getsntp -command on_time pool.ntp.org
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ntp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>ntp</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key82">NTP</a>, <a href="../../../../index.html#key80">SNTP</a>, <a href="../../../../index.html#key79">rfc 2030</a>, <a href="../../../../index.html#key81">rfc 868</a>, <a href="../../../../index.html#key83">time</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ooutil/ooutil.html.
































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>oo::util - Utility commands for TclOO</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ooutil/ooutil.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2011-2013 Andreas Kupries, BSD licensed
   -->
<! -- CVS: $Id$ oo::util.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">oo::util(n) 1.1 tcllib &quot;Utility commands for TclOO&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>oo::util - Utility commands for TclOO</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">AUTHORS</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">oo::util <span class="opt">?1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">mymethod</b> <i class="arg">method</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">classmethod</b> <i class="arg">name</i> <i class="arg">arguments</i> <i class="arg">body</i></a></li>
<li><a href="#3"><b class="cmd">classvariable</b> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#4"><b class="cmd">ooutil::singleton</b> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a convenience command for the easy specification
of instance methods as callback commands, like timers, file events, Tk
bindings, etc.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">mymethod</b> <i class="arg">method</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This command is available within instance methods. It takes a method
name and, possibly, arguments for the method and returns a command
prefix which, when executed, will invoke the named method of the
object we are in, with the provided arguments, and any others supplied
at the time of actual invokation.</p>
<p>Note: The command is equivalent to and named after the command
provided by the OO package <b class="package"><a href="../snit/snit.html">snit</a></b> for the same purpose.</p></dd>
<dt><a name="2"><b class="cmd">classmethod</b> <i class="arg">name</i> <i class="arg">arguments</i> <i class="arg">body</i></a></dt>
<dd><p>This command is available within class definitions. It takes a method
name and, possibly, arguments for the method and creates a method on the
class, available to a user of the class and of derived classes.</p>
<p>Note: The command is equivalent to the command <b class="cmd">typemethod</b>
provided by the OO package <b class="package"><a href="../snit/snit.html">snit</a></b> for the same purpose.</p>
<p>Example</p>
<pre class="example">
oo::class create ActiveRecord {
    classmethod find args { puts &quot;[self] called with arguments: $args&quot; }
}
oo::class create Table {
    superclass ActiveRecord
}
puts [Table find foo bar]
# ======
# which will write
# ======
# ::Table called with arguments: foo bar
</pre>
</dd>
<dt><a name="3"><b class="cmd">classvariable</b> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This command is available within instance methods. It takes a series
of variable names and makes them available in the method's scope. The
originating scope for the variables is the class (instance) the object
instance belongs to. In other words, the referenced variables are shared
between all instances of their class.</p>
<p>Note: The command is roughly equivalent to the command
<b class="cmd">typevariable</b> provided by the OO package <b class="package"><a href="../snit/snit.html">snit</a></b> for the
same purpose. The difference is that it cannot be used in the class
definition itself.</p>
<p>Example:</p>
<pre class="example">
% oo::class create Foo {
    method bar {z} {
        classvariable x y
        return [incr x $z],[incr y]
    }
}
::Foo
% Foo create a
::a
% Foo create b
::b
% a bar 2
2,1
% a bar 3
5,2
% b bar 7
12,3
% b bar -1
11,4
% a bar 0
11,5
</pre>
</dd>
<dt><a name="4"><b class="cmd">ooutil::singleton</b> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This command is a meta-class, i.e. a variant of the builtin
<b class="cmd">oo::class</b> which ensures that it creates only a single
instance of the classes defined with it.</p>
<p>Syntax and results are like for <b class="cmd">oo::class</b>.</p>
<p>Example:</p>
<pre class="example">
% oo::class create example {
   self mixin singleton
   method foo {} {self}
}
::example
% [example new] foo
::oo::Obj22
% [example new] foo
::oo::Obj22
</pre>
</dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">AUTHORS</a></h2>
<p>Donal Fellows, Andreas Kupries</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>oo::util</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../snit/snit.html">snit(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key706">TclOO</a>, <a href="../../../../index.html#key494">callback</a>, <a href="../../../../index.html#key707">class methods</a>, <a href="../../../../index.html#key709">class variables</a>, <a href="../../../../index.html#key545">command prefix</a>, <a href="../../../../index.html#key548">currying</a>, <a href="../../../../index.html#key705">method reference</a>, <a href="../../../../index.html#key710">my method</a>, <a href="../../../../index.html#key708">singleton</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Utility</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011-2013 Andreas Kupries, BSD licensed</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/otp/otp.html.




















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>otp - RFC 2289 A One-Time Password System</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/otp/otp.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ otp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">otp(n) 1.0.0 tcllib &quot;RFC 2289 A One-Time Password System&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>otp - One-Time Passwords</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">otp <span class="opt">?1.0.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::otp::otp-md4</b> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-words</i>?</span> <i class="arg">-seed seed</i> <i class="arg">-count count</i> <i class="arg">data</i></a></li>
<li><a href="#2"><b class="cmd">::otp::otp-md5</b> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-words</i>?</span> <i class="arg">-seed seed</i> <i class="arg">-count count</i> <i class="arg">data</i></a></li>
<li><a href="#3"><b class="cmd">::otp::otp-sha1</b> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-words</i>?</span> <i class="arg">-seed seed</i> <i class="arg">-count count</i> <i class="arg">data</i></a></li>
<li><a href="#4"><b class="cmd">::otp::otp-rmd160</b> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-words</i>?</span> <i class="arg">-seed seed</i> <i class="arg">-count count</i> <i class="arg">data</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is an implementation in Tcl of the One-Time Password
system as described in RFC 2289 (1). This system uses message-digest
algorithms to sequentially hash a passphrase to create single-use
passwords. The resulting data is then provided to the user as either
hexadecimal digits or encoded using a dictionary of 2048 words. This
system is used by OpenBSD for secure login and can be used as a SASL
mechanism for authenticating users.</p>
<p>In this implementation we provide support for four algorithms that are
included in the tcllib distribution: MD5 (2), MD4 (3), RIPE-MD160 (4) 
and SHA-1 (5).</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::otp::otp-md4</b> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-words</i>?</span> <i class="arg">-seed seed</i> <i class="arg">-count count</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="2"><b class="cmd">::otp::otp-md5</b> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-words</i>?</span> <i class="arg">-seed seed</i> <i class="arg">-count count</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="3"><b class="cmd">::otp::otp-sha1</b> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-words</i>?</span> <i class="arg">-seed seed</i> <i class="arg">-count count</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="4"><b class="cmd">::otp::otp-rmd160</b> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-words</i>?</span> <i class="arg">-seed seed</i> <i class="arg">-count count</i> <i class="arg">data</i></a></dt>
<dd></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<pre class="example">
% otp::otp-md5 -count 99 -seed host67821 &quot;My Secret Pass Phrase&quot;
(binary gibberish)
% otp::otp-md5 -words -count 99 -seed host67821 &quot;My Secret Pass Phrase&quot;
SOON ARAB BURG LIMB FILE WAD
% otp::otp-md5 -hex -count 99 -seed host67821 &quot;My Secret Pass Phrase&quot;
e249b58257c80087
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Haller, N. et al., &quot;A One-Time Password System&quot;, RFC 2289, February 1998.
	<a href="http://www.rfc-editor.org/rfc/rfc2289.txt">http://www.rfc-editor.org/rfc/rfc2289.txt</a></p></li>
<li><p>Rivest, R., &quot;The MD5 Message-Digest Algorithm&quot;, RFC 1321, MIT and
       RSA Data Security, Inc, April 1992.
	(<a href="http://www.rfc-editor.org/rfc/rfc1321.txt">http://www.rfc-editor.org/rfc/rfc1321.txt</a>)</p></li>
<li><p>Rivest, R., &quot;The MD4 Message Digest Algorithm&quot;, RFC 1320, MIT,
       April 1992. (<a href="http://www.rfc-editor.org/rfc/rfc1320.txt">http://www.rfc-editor.org/rfc/rfc1320.txt</a>)</p></li>
<li><p>H. Dobbertin, A. Bosselaers, B. Preneel, 
        &quot;RIPEMD-160, a strengthened version of RIPEMD&quot;
        <a href="http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf">http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf</a></p></li>
<li><p>&quot;Secure Hash Standard&quot;, National Institute of Standards
        and Technology, U.S. Department Of Commerce, April 1995.
	(<a href="http://www.itl.nist.gov/fipspubs/fip180-1.htm">http://www.itl.nist.gov/fipspubs/fip180-1.htm</a>)</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>otp</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../sasl/sasl.html">SASL</a>, <a href="../md4/md4.html">md4</a>, <a href="../md5/md5.html">md5</a>, <a href="../ripemd/ripemd160.html">ripemd160</a>, <a href="../sha1/sha1.html">sha1</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key195">hashing</a>, <a href="../../../../index.html#key194">message-digest</a>, <a href="../../../../index.html#key644">password</a>, <a href="../../../../index.html#key643">rfc 2289</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/page/page_intro.html.

























































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>page_intro - Parser generator tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/page/page_intro.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ page_intro.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">page_intro(n) 1.0 tcllib &quot;Parser generator tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>page_intro - page introduction</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><i class="term"><a href="../../../../index.html#key177">page</a></i> (short for <em>parser generator</em>) stands for a set of
related packages which help in the construction of parser generators,
and other utilities doing text processing.</p>
<p>They are mainly geared towards supporting the Tcllib application
<b class="syscmd"><a href="../../apps/page.html">page</a></b>, with the package <b class="package">page::pluginmgr</b> in a central
role as the plugin management for the application. The other packages
are performing low-level text processing and utility tasks geared
towards parser generation and mainly accessed by <b class="syscmd"><a href="../../apps/page.html">page</a></b> through
plugins.</p>
<p>The packages implementing the plugins are not documented as regular
packages, as they cannot be loaded into a general interpreter, like
tclsh, without extensive preparation of the interpreter. Preparation
which is done for them by the plugin manager.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>page</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key177">page</a>, <a href="../../../../index.html#key175">parser generator</a>, <a href="../../../../index.html#key178">text processing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Page Parser Generator</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/page/page_pluginmgr.html.







































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>page_pluginmgr - Parser generator tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/page/page_pluginmgr.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ page_pluginmgr.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">page_pluginmgr(n) 1.0 tcllib &quot;Parser generator tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>page_pluginmgr - page plugin manager</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">CONFIG PLUGIN API</a></li>
<li class="section"><a href="#section4">READER PLUGIN API</a></li>
<li class="section"><a href="#section5">WRITER PLUGIN API</a></li>
<li class="section"><a href="#section6">TRANSFORM PLUGIN API</a></li>
<li class="section"><a href="#section7">PREDEFINED PLUGINS</a></li>
<li class="section"><a href="#section8">FEATURES</a></li>
<li class="section"><a href="#section9">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">page::pluginmgr <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">fileutil</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::page::pluginmgr::reportvia</b> <i class="arg">cmd</i></a></li>
<li><a href="#2"><b class="cmd">::page::pluginmgr::report</b> <i class="arg">level</i> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#3"><b class="cmd">::page::pluginmgr::log</b> <i class="arg">cmd</i></a></li>
<li><a href="#4"><b class="cmd">::page::pluginmgr::configuration</b> <i class="arg">name</i></a></li>
<li><a href="#5"><b class="cmd">::page::pluginmgr::reader</b> <i class="arg">name</i></a></li>
<li><a href="#6"><b class="cmd">::page::pluginmgr::rconfigure</b> <i class="arg">dict</i></a></li>
<li><a href="#7"><b class="cmd">::page::pluginmgr::rtimeable</b></a></li>
<li><a href="#8"><b class="cmd">::page::pluginmgr::rtime</b></a></li>
<li><a href="#9"><b class="cmd">::page::pluginmgr::rgettime</b></a></li>
<li><a href="#10"><b class="cmd">::page::pluginmgr::rhelp</b></a></li>
<li><a href="#11"><b class="cmd">::page::pluginmgr::rlabel</b></a></li>
<li><a href="#12"><b class="cmd">::page::pluginmgr::read</b> <i class="arg">read</i> <i class="arg">eof</i> <span class="opt">?<i class="arg">complete</i>?</span></a></li>
<li><a href="#13"><i class="arg">read</i> <i class="arg">num</i></a></li>
<li><a href="#14"><i class="arg">eof</i></a></li>
<li><a href="#15"><i class="arg">done</i></a></li>
<li><a href="#16"><b class="cmd">::page::pluginmgr::writer</b> <i class="arg">name</i></a></li>
<li><a href="#17"><b class="cmd">::page::pluginmgr::wconfigure</b> <i class="arg">dict</i></a></li>
<li><a href="#18"><b class="cmd">::page::pluginmgr::wtimeable</b></a></li>
<li><a href="#19"><b class="cmd">::page::pluginmgr::wtime</b></a></li>
<li><a href="#20"><b class="cmd">::page::pluginmgr::wgettime</b></a></li>
<li><a href="#21"><b class="cmd">::page::pluginmgr::whelp</b></a></li>
<li><a href="#22"><b class="cmd">::page::pluginmgr::wlabel</b></a></li>
<li><a href="#23"><b class="cmd">::page::pluginmgr::write</b> <i class="arg">chan</i> <i class="arg">data</i></a></li>
<li><a href="#24"><b class="cmd">::page::pluginmgr::transform</b> <i class="arg">name</i></a></li>
<li><a href="#25"><b class="cmd">::page::pluginmgr::tconfigure</b> <i class="arg">id</i> <i class="arg">dict</i></a></li>
<li><a href="#26"><b class="cmd">::page::pluginmgr::ttimeable</b> <i class="arg">id</i></a></li>
<li><a href="#27"><b class="cmd">::page::pluginmgr::ttime</b> <i class="arg">id</i></a></li>
<li><a href="#28"><b class="cmd">::page::pluginmgr::tgettime</b> <i class="arg">id</i></a></li>
<li><a href="#29"><b class="cmd">::page::pluginmgr::thelp</b> <i class="arg">id</i></a></li>
<li><a href="#30"><b class="cmd">::page::pluginmgr::tlabel</b> <i class="arg">id</i></a></li>
<li><a href="#31"><b class="cmd">::page::pluginmgr::transform_do</b> <i class="arg">id</i> <i class="arg">data</i></a></li>
<li><a href="#32"><b class="cmd">page_cdefinition</b></a></li>
<li><a href="#33"><b class="cmd">page_rfeature</b> <i class="arg">name</i></a></li>
<li><a href="#34"><b class="cmd">page_rtime</b></a></li>
<li><a href="#35"><b class="cmd">page_rgettime</b></a></li>
<li><a href="#36"><b class="cmd">page_rlabel</b></a></li>
<li><a href="#37"><b class="cmd">page_rhelp</b></a></li>
<li><a href="#38"><b class="cmd">page_roptions</b></a></li>
<li><a href="#39"><b class="cmd">page_rconfigure</b> <i class="arg">option</i> <i class="arg">value</i></a></li>
<li><a href="#40"><b class="cmd">page_rrun</b></a></li>
<li><a href="#41"><b class="cmd">page_read</b> <i class="arg">num</i></a></li>
<li><a href="#42"><b class="cmd">page_read_done</b></a></li>
<li><a href="#43"><b class="cmd">page_eof</b></a></li>
<li><a href="#44"><b class="cmd">page_info</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#45"><b class="cmd">page_warning</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#46"><b class="cmd">page_error</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#47"><b class="cmd">page_log_info</b> <i class="arg">text</i></a></li>
<li><a href="#48"><b class="cmd">page_log_warning</b> <i class="arg">text</i></a></li>
<li><a href="#49"><b class="cmd">page_log_error</b> <i class="arg">text</i></a></li>
<li><a href="#50"><b class="cmd">page_wfeature</b></a></li>
<li><a href="#51"><b class="cmd">page_wtime</b></a></li>
<li><a href="#52"><b class="cmd">page_wgettime</b></a></li>
<li><a href="#53"><b class="cmd">page_wlabel</b></a></li>
<li><a href="#54"><b class="cmd">page_whelp</b></a></li>
<li><a href="#55"><b class="cmd">page_woptions</b></a></li>
<li><a href="#56"><b class="cmd">page_wconfigure</b> <i class="arg">option</i> <i class="arg">value</i></a></li>
<li><a href="#57"><b class="cmd">page_wrun</b> <i class="arg">chan</i> <i class="arg">data</i></a></li>
<li><a href="#58"><b class="cmd">page_info</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#59"><b class="cmd">page_warning</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#60"><b class="cmd">page_error</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#61"><b class="cmd">page_log_info</b> <i class="arg">text</i></a></li>
<li><a href="#62"><b class="cmd">page_log_warning</b> <i class="arg">text</i></a></li>
<li><a href="#63"><b class="cmd">page_log_error</b> <i class="arg">text</i></a></li>
<li><a href="#64"><b class="cmd">page_tfeature</b></a></li>
<li><a href="#65"><b class="cmd">page_ttime</b></a></li>
<li><a href="#66"><b class="cmd">page_tgettime</b></a></li>
<li><a href="#67"><b class="cmd">page_tlabel</b></a></li>
<li><a href="#68"><b class="cmd">page_thelp</b></a></li>
<li><a href="#69"><b class="cmd">page_toptions</b></a></li>
<li><a href="#70"><b class="cmd">page_tconfigure</b> <i class="arg">option</i> <i class="arg">value</i></a></li>
<li><a href="#71"><b class="cmd">page_trun</b> <i class="arg">chan</i> <i class="arg">data</i></a></li>
<li><a href="#72"><b class="cmd">page_info</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#73"><b class="cmd">page_warning</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#74"><b class="cmd">page_error</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#75"><b class="cmd">page_log_info</b> <i class="arg">text</i></a></li>
<li><a href="#76"><b class="cmd">page_log_warning</b> <i class="arg">text</i></a></li>
<li><a href="#77"><b class="cmd">page_log_error</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides the plugin manager central to the <b class="syscmd"><a href="../../apps/page.html">page</a></b>
application. It manages the various reader, writer, configuration, and
transformation plugins which actually process the text (read,
transform, and write).</p>
<p>All plugins are loaded into slave interpreters specially prepared for
them. While implemented using packages they need this special
environment and are not usable in a plain interpreter, like
tclsh. Because of that they are only described in general terms in
section <span class="sectref"><a href="#section7">PREDEFINED PLUGINS</a></span>, and not documented as regular
packages. It is expected that they follow the APIs specified in the
sections</p>
<ol class="enumerated">
<li><p><span class="sectref"><a href="#section3">CONFIG PLUGIN API</a></span></p></li>
<li><p><span class="sectref"><a href="#section4">READER PLUGIN API</a></span></p></li>
<li><p><span class="sectref"><a href="#section5">WRITER PLUGIN API</a></span></p></li>
<li><p><span class="sectref"><a href="#section6">TRANSFORM PLUGIN API</a></span></p></li>
</ol>
<p>as per their type.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::page::pluginmgr::reportvia</b> <i class="arg">cmd</i></a></dt>
<dd><p>This command defines the callback command used by
<b class="cmd">::page::pluginmgr::report</b> (see below) to report input errors and
warnings. The default is to write such reports to the standard error
channel.</p></dd>
<dt><a name="2"><b class="cmd">::page::pluginmgr::report</b> <i class="arg">level</i> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>This command is used to report input errors and warnings. By default
such reports are written to the standard error. This can be changed by
setting a user-specific callback command with
<b class="cmd">::page::pluginmgr::reportvia</b> (see above).</p>
<p>The arguments <i class="arg">level</i> and <i class="arg">text</i> specify both the importance
of the message, and the message itself. For the former see the package
<b class="package"><a href="../log/logger.html">logger</a></b> for the allowed values.</p>
<p>The optional argument <i class="arg">from</i> and <i class="arg">to</i> can be used by the
caller to indicate the location (or range) in the input where the
reported problem occured. Each is a list containing two elements, the
line and the column in the input, in this order.</p></dd>
<dt><a name="3"><b class="cmd">::page::pluginmgr::log</b> <i class="arg">cmd</i></a></dt>
<dd><p>This command defines a log callback command to be used by loaded
plugins for the reporting of internal errors, warnings, and general
information. Specifying the empty string as callback disables logging.</p>
<p>Note: The <i class="arg">cmd</i> has to be created by the <b class="package"><a href="../log/logger.html">logger</a></b> package,
or follow the same API as such.</p>
<p>The command returns the empty string as its result.</p></dd>
<dt><a name="4"><b class="cmd">::page::pluginmgr::configuration</b> <i class="arg">name</i></a></dt>
<dd><p>This command loads the named configuration plugin, retrieves the
options encoded in it, and then immediately unloads it again.</p>
<p>If the <i class="arg">name</i> is the path to a file, then this files will be tried
to be loaded as a plugin first, and, if that fails, opened and its
contents read as a list of options and their arguments, separated by
spaces, tabs and newlines, possibly quotes with single and double
quotes.</p>
<p>See section <span class="sectref"><a href="#section3">CONFIG PLUGIN API</a></span> for the API expected of
configuration plugins.</p>
<p>The result of the command is the list of options retrieved.</p></dd>
<dt><a name="5"><b class="cmd">::page::pluginmgr::reader</b> <i class="arg">name</i></a></dt>
<dd><p>This command loads the named reader plugin and initializes it. The
result of the command is a list of options the plugin understands.</p>
<p>Only a single reader plugin can be loaded. Loading another reader
plugin causes the previously loaded reader plugin to be de-initialized
and unloaded.</p>
<p>See section <span class="sectref"><a href="#section4">READER PLUGIN API</a></span> for the API expected of
reader plugins.</p></dd>
<dt><a name="6"><b class="cmd">::page::pluginmgr::rconfigure</b> <i class="arg">dict</i></a></dt>
<dd><p>This commands configures the loaded reader plugin. The options and
their values are provided as a Tcl dictionary. The result of the
command is the empty string.</p></dd>
<dt><a name="7"><b class="cmd">::page::pluginmgr::rtimeable</b></a></dt>
<dd><p>This commands checks if the loaded reader plugin is able to collect
timing statistics. The result of the command is a boolean flag. The
result is <b class="const">true</b> if the plugin can be timed, and <b class="const">false</b>
otherwise.</p></dd>
<dt><a name="8"><b class="cmd">::page::pluginmgr::rtime</b></a></dt>
<dd><p>This command activates the collection of timing statistics in the
loaded reader plugin.</p></dd>
<dt><a name="9"><b class="cmd">::page::pluginmgr::rgettime</b></a></dt>
<dd><p>This command retrieves the collected timing statistics of the loaded
reader plugin after it was executed.</p></dd>
<dt><a name="10"><b class="cmd">::page::pluginmgr::rhelp</b></a></dt>
<dd><p>This command retrieves the help string of the loaded reader
plugin. This is expected to be in <i class="term"><a href="../../../../index.html#key51">doctools</a></i> format.</p></dd>
<dt><a name="11"><b class="cmd">::page::pluginmgr::rlabel</b></a></dt>
<dd><p>This command retrieves the human-readable name of the loaded reader
plugin.</p></dd>
<dt><a name="12"><b class="cmd">::page::pluginmgr::read</b> <i class="arg">read</i> <i class="arg">eof</i> <span class="opt">?<i class="arg">complete</i>?</span></a></dt>
<dd><p>This command invokes the loaded reader plugin to process the input,
and returns the results of the plugin as its own result. The input is
accessible through the callback commands <i class="arg">read</i>, and <i class="arg">eof</i>. The
optional <i class="arg">done</i> can be used to intrecept when the plugin has
completed its processing. All arguments are command prefixes.</p>
<p>The plugin will invoke the various callbacks in the following
situations:</p>
<dl class="definitions">
<dt><a name="13"><i class="arg">read</i> <i class="arg">num</i></a></dt>
<dd><p>is invoked whenever input to process is needed, with the number of
characters/bytes it asks for. The result is expected to be the input
the plugin is in need of.</p></dd>
<dt><a name="14"><i class="arg">eof</i></a></dt>
<dd><p>is invoked by the plugin to check if the input has reached the of the
stream. The result is expected to be a boolean flag, <b class="const">true</b> when
the input has hit EOF, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="15"><i class="arg">done</i></a></dt>
<dd><p>is invoked when the plugin has completed the processing of the input.</p></dd>
</dl></dd>
<dt><a name="16"><b class="cmd">::page::pluginmgr::writer</b> <i class="arg">name</i></a></dt>
<dd><p>This command loads the named writer plugin and initializes it. The
result of the command is a list of options the plugin understands.</p>
<p>Only a single reader plugin can be loaded. Loading another reader
plugin causes the previously loaded reader plugin to be de-initialized
and unloaded.</p>
<p>See section <span class="sectref"><a href="#section5">WRITER PLUGIN API</a></span> for the API expected of
writer plugins.</p></dd>
<dt><a name="17"><b class="cmd">::page::pluginmgr::wconfigure</b> <i class="arg">dict</i></a></dt>
<dd><p>This commands configures the loaded writer plugin. The options and
their values are provided as a Tcl dictionary. The result of the
command is the empty string.</p></dd>
<dt><a name="18"><b class="cmd">::page::pluginmgr::wtimeable</b></a></dt>
<dd><p>This commands checks if the loaded writer plugin is able to measure
execution times. The result of the command is a boolean flag. The
result is <b class="const">true</b> if the plugin can be timed, and <b class="const">false</b>
otherwise.</p></dd>
<dt><a name="19"><b class="cmd">::page::pluginmgr::wtime</b></a></dt>
<dd><p>This command activates the collection of timing statistics in the
loaded writer plugin.</p></dd>
<dt><a name="20"><b class="cmd">::page::pluginmgr::wgettime</b></a></dt>
<dd><p>This command retrieves the collected timing statistics of the loaded
writer plugin after it was executed.</p></dd>
<dt><a name="21"><b class="cmd">::page::pluginmgr::whelp</b></a></dt>
<dd><p>This command retrieves the help string of the loaded writer
plugin. This is expected to be in <i class="term"><a href="../../../../index.html#key51">doctools</a></i> format.</p></dd>
<dt><a name="22"><b class="cmd">::page::pluginmgr::wlabel</b></a></dt>
<dd><p>This command retrieves the human-readable name of the loaded writer
plugin.</p></dd>
<dt><a name="23"><b class="cmd">::page::pluginmgr::write</b> <i class="arg">chan</i> <i class="arg">data</i></a></dt>
<dd><p>The loaded writer plugin is invoked to generate the output. It is
given the <i class="arg">data</i> to generate the outpout from, and the Tcl handle
<i class="arg">chan</i> of the channel to write the generated output to. The
command returns th empty string as its result.</p></dd>
<dt><a name="24"><b class="cmd">::page::pluginmgr::transform</b> <i class="arg">name</i></a></dt>
<dd><p>This command loads the named transformation plugin and initializes
it. The result of the command is a 2-element list containing the
plugin id and a list of options the plugin understands, in this order.</p>
<p>Multiple transformations plugins can be loaded and are identified by
handles.</p>
<p>See section <span class="sectref"><a href="#section6">TRANSFORM PLUGIN API</a></span> for the API expected of
transformation plugins.</p></dd>
<dt><a name="25"><b class="cmd">::page::pluginmgr::tconfigure</b> <i class="arg">id</i> <i class="arg">dict</i></a></dt>
<dd><p>This commands configures the identified transformation plugin. The
options and their values are provided as a Tcl dictionary. The result
of the command is the empty string.</p></dd>
<dt><a name="26"><b class="cmd">::page::pluginmgr::ttimeable</b> <i class="arg">id</i></a></dt>
<dd><p>This commands checks if the identified transformation plugin is able
to collect timing statistics. The result of the command is a boolean
flag. The result is <b class="const">true</b> if the plugin can be timed, and
<b class="const">false</b> otherwise.</p></dd>
<dt><a name="27"><b class="cmd">::page::pluginmgr::ttime</b> <i class="arg">id</i></a></dt>
<dd><p>This command activates the collection of timing statistics in the
identified transformation plugin.</p></dd>
<dt><a name="28"><b class="cmd">::page::pluginmgr::tgettime</b> <i class="arg">id</i></a></dt>
<dd><p>This command retrieves the collected timing statistics of the
identified transformation plugin after it was executed.</p></dd>
<dt><a name="29"><b class="cmd">::page::pluginmgr::thelp</b> <i class="arg">id</i></a></dt>
<dd><p>This command retrieves the help string of the identified
transformation plugin. This is expected to be in <i class="term"><a href="../../../../index.html#key51">doctools</a></i>
format.</p></dd>
<dt><a name="30"><b class="cmd">::page::pluginmgr::tlabel</b> <i class="arg">id</i></a></dt>
<dd><p>This command retrieves the human-readable name of the identified
transformation plugin.</p></dd>
<dt><a name="31"><b class="cmd">::page::pluginmgr::transform_do</b> <i class="arg">id</i> <i class="arg">data</i></a></dt>
<dd><p>The identified transformation plugin is invoked to process the
specified <i class="arg">data</i>. The result of the plugin is returned as the
result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">CONFIG PLUGIN API</a></h2>
<p>Configuration plugins are expected to provide a single command,
described below.</p>
<dl class="definitions">
<dt><a name="32"><b class="cmd">page_cdefinition</b></a></dt>
<dd><p>This command of a configuration plugin is called by the plugin manager
to execute it. Its result has to be a list of options and values to
process.</p></dd>
</dl>
<p>Configuration plugins do not expect the environment to provide any
special commands.</p>
<p>It is expected that a configuration plugin <b class="const">FOO</b> is implemented
by the package <b class="package">page::config::<b class="const">FOO</b></b>.</p>
<p>Configuration plugins are loaded, executed, and unloaded in one step,
they are not kept in memory. The command for doing this is
<b class="cmd">::page::pluginmgr::configuration</b>.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">READER PLUGIN API</a></h2>
<p>Reader plugins are expected to provide the following commands,
described below.</p>
<dl class="definitions">
<dt><a name="33"><b class="cmd">page_rfeature</b> <i class="arg">name</i></a></dt>
<dd><p>This command takes a feature <i class="arg">name</i> and returns a boolean flag
indicating whether the feature is supported by the plugin, or not.
The result has to be <b class="const">true</b> if the feature is supported, and
<b class="const">false</b> otherwise.</p>
<p>See section <span class="sectref"><a href="#section8">FEATURES</a></span> for the possible features the plugin
manager will ask for.</p></dd>
<dt><a name="34"><b class="cmd">page_rtime</b></a></dt>
<dd><p>This command is invoked to activate the collection of timing
statistics.</p></dd>
<dt><a name="35"><b class="cmd">page_rgettime</b></a></dt>
<dd><p>This command is invoked to retrieve the collected timing statistics.</p></dd>
<dt><a name="36"><b class="cmd">page_rlabel</b></a></dt>
<dd><p>This command is invoked to retrieve a human-readable label for the
plugin.</p></dd>
<dt><a name="37"><b class="cmd">page_rhelp</b></a></dt>
<dd><p>This command is invoked to retrieve a help text for plugin. The text
is expected to be in <i class="term"><a href="../../../../index.html#key51">doctools</a></i> format.</p></dd>
<dt><a name="38"><b class="cmd">page_roptions</b></a></dt>
<dd><p>This command is invoked to retrieve the options understood by the
plugin.</p></dd>
<dt><a name="39"><b class="cmd">page_rconfigure</b> <i class="arg">option</i> <i class="arg">value</i></a></dt>
<dd><p>This command is invoked to reconfigure the plugin, specifically the
given <i class="arg">option</i> is set to the new <i class="arg">value</i>.</p></dd>
<dt><a name="40"><b class="cmd">page_rrun</b></a></dt>
<dd><p>This command is invoked to process the input stream per the current
plugin configuration.  The result of the command is the result of the
processing.</p></dd>
</dl>
<p>Reader plugins expect the environment to provide the following special
commands.</p>
<dl class="definitions">
<dt><a name="41"><b class="cmd">page_read</b> <i class="arg">num</i></a></dt>
<dd><p>This command is invoked to read <i class="arg">num</i> characters/bytes from the
input. Its result has to be read characters/bytes.</p></dd>
<dt><a name="42"><b class="cmd">page_read_done</b></a></dt>
<dd><p>This command is invoked to signal that the plugin has completed the
processing of the input.</p></dd>
<dt><a name="43"><b class="cmd">page_eof</b></a></dt>
<dd><p>This command is invoked to check if the input stream has reached its
end. Its result has to be a boolean flag, <b class="const">true</b> when the input
has reached the end, <b class="const">false</b> otherwise.</p></dd>
<dt><a name="44"><b class="cmd">page_info</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report some information to the user. May indicate a
location or range in the input. Each piece of location data, if
provided, is a 2-element list containing line and column numbers.</p></dd>
<dt><a name="45"><b class="cmd">page_warning</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report a warning to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.</p></dd>
<dt><a name="46"><b class="cmd">page_error</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report an error to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.</p></dd>
<dt><a name="47"><b class="cmd">page_log_info</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report some internal information.</p></dd>
<dt><a name="48"><b class="cmd">page_log_warning</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report an internal warning.</p></dd>
<dt><a name="49"><b class="cmd">page_log_error</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report an internal error.</p></dd>
</dl>
<p>It is expected that a reader plugin <b class="const">FOO</b> is implemented
by the package <b class="package">page::reader::<b class="const">FOO</b></b>.</p>
<p>Reader plugins are loaded by the command
<b class="cmd">::page::pluginmgr::reader</b>. At most one reader plugin can be kept
in memory.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">WRITER PLUGIN API</a></h2>
<p>Writer plugins are expected to provide the following commands,
described below.</p>
<dl class="definitions">
<dt><a name="50"><b class="cmd">page_wfeature</b></a></dt>
<dd><p>This command takes a feature <i class="arg">name</i> and returns a boolean flag
indicating whether the feature is supported by the plugin, or not.
The result has to be <b class="const">true</b> if the feature is supported, and
<b class="const">false</b> otherwise.</p>
<p>See section <span class="sectref"><a href="#section8">FEATURES</a></span> for the possible features the plugin
manager will ask for.</p></dd>
<dt><a name="51"><b class="cmd">page_wtime</b></a></dt>
<dd><p>This command is invoked to activate the collection of timing
statistics.</p></dd>
<dt><a name="52"><b class="cmd">page_wgettime</b></a></dt>
<dd><p>This command is invoked to retrieve the collected timing statistics.</p></dd>
<dt><a name="53"><b class="cmd">page_wlabel</b></a></dt>
<dd><p>This command is invoked to retrieve a human-readable label for the
plugin.</p></dd>
<dt><a name="54"><b class="cmd">page_whelp</b></a></dt>
<dd><p>This command is invoked to retrieve a help text for plugin. The text
is expected to be in <i class="term"><a href="../../../../index.html#key51">doctools</a></i> format.</p></dd>
<dt><a name="55"><b class="cmd">page_woptions</b></a></dt>
<dd><p>This command is invoked to retrieve the options understood by the
plugin.</p></dd>
<dt><a name="56"><b class="cmd">page_wconfigure</b> <i class="arg">option</i> <i class="arg">value</i></a></dt>
<dd><p>This command is invoked to reconfigure the plugin, specifically the
given <i class="arg">option</i> is set to the new <i class="arg">value</i>.</p></dd>
<dt><a name="57"><b class="cmd">page_wrun</b> <i class="arg">chan</i> <i class="arg">data</i></a></dt>
<dd><p>This command is invoked to process the specified <i class="arg">data</i> and write
it to the output stream <i class="arg">chan</i>. The latter is a Tcl channel handle
opened for writing. The result of the command is the empty string.</p></dd>
</dl>
<p>Writer plugins expect the environment to provide the following special
commands.</p>
<dl class="definitions">
<dt><a name="58"><b class="cmd">page_info</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report some information to the user. May indicate a
location or range in the input. Each piece of location data, if
provided, is a 2-element list containing line and column numbers.</p></dd>
<dt><a name="59"><b class="cmd">page_warning</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report a warning to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.</p></dd>
<dt><a name="60"><b class="cmd">page_error</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report an error to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.</p></dd>
<dt><a name="61"><b class="cmd">page_log_info</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report some internal information.</p></dd>
<dt><a name="62"><b class="cmd">page_log_warning</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report an internal warning.</p></dd>
<dt><a name="63"><b class="cmd">page_log_error</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report an internal error.</p></dd>
</dl>
<p>It is expected that a writer plugin <b class="const">FOO</b> is implemented
by the package <b class="package">page::writer::<b class="const">FOO</b></b>.</p>
<p>Writer plugins are loaded by the command
<b class="cmd">::page::pluginmgr::writer</b>. At most one writer plugin can be kept
in memory.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">TRANSFORM PLUGIN API</a></h2>
<p>page::transform::*
Transformation plugins are expected to provide the following commands,
described below.</p>
<dl class="definitions">
<dt><a name="64"><b class="cmd">page_tfeature</b></a></dt>
<dd><p>This command takes a feature <i class="arg">name</i> and returns a boolean flag
indicating whether the feature is supported by the plugin, or not.
The result has to be <b class="const">true</b> if the feature is supported, and
<b class="const">false</b> otherwise.</p>
<p>See section <span class="sectref"><a href="#section8">FEATURES</a></span> for the possible features the plugin
manager will ask for.</p></dd>
<dt><a name="65"><b class="cmd">page_ttime</b></a></dt>
<dd><p>This command is invoked to activate the collection of timing
statistics.</p></dd>
<dt><a name="66"><b class="cmd">page_tgettime</b></a></dt>
<dd><p>This command is invoked to retrieve the collected timing statistics.</p></dd>
<dt><a name="67"><b class="cmd">page_tlabel</b></a></dt>
<dd><p>This command is invoked to retrieve a human-readable label for the
plugin.</p></dd>
<dt><a name="68"><b class="cmd">page_thelp</b></a></dt>
<dd><p>This command is invoked to retrieve a help text for plugin. The text
is expected to be in <i class="term"><a href="../../../../index.html#key51">doctools</a></i> format.</p></dd>
<dt><a name="69"><b class="cmd">page_toptions</b></a></dt>
<dd><p>This command is invoked to retrieve the options understood by the
plugin.</p></dd>
<dt><a name="70"><b class="cmd">page_tconfigure</b> <i class="arg">option</i> <i class="arg">value</i></a></dt>
<dd><p>This command is invoked to reconfigure the plugin, specifically the
given <i class="arg">option</i> is set to the new <i class="arg">value</i>.</p></dd>
<dt><a name="71"><b class="cmd">page_trun</b> <i class="arg">chan</i> <i class="arg">data</i></a></dt>
<dd><p>This command is invoked to process the specified <i class="arg">data</i> and write
it to the output stream <i class="arg">chan</i>. The latter is a Tcl channel handle
opened for writing. The result of the command is the empty string.</p></dd>
</dl>
<p>Transformation plugins expect the environment to provide the following
special commands.</p>
<dl class="definitions">
<dt><a name="72"><b class="cmd">page_info</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report some information to the user. May indicate a
location or range in the input. Each piece of location data, if
provided, is a 2-element list containing line and column numbers.</p></dd>
<dt><a name="73"><b class="cmd">page_warning</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report a warning to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.</p></dd>
<dt><a name="74"><b class="cmd">page_error</b> <i class="arg">text</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>Invoked to report an error to the user. May indicate a location or
range in the input. Each piece of location data, if provided, is a
2-element list containing line and column numbers.</p></dd>
<dt><a name="75"><b class="cmd">page_log_info</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report some internal information.</p></dd>
<dt><a name="76"><b class="cmd">page_log_warning</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report an internal warning.</p></dd>
<dt><a name="77"><b class="cmd">page_log_error</b> <i class="arg">text</i></a></dt>
<dd><p>Invoked to report an internal error.</p></dd>
</dl>
<p>It is expected that a transformation plugin <b class="const">FOO</b> is implemented
by the package <b class="package">page::transform::<b class="const">FOO</b></b>.</p>
<p>Transformation plugins are loaded by the command
<b class="cmd">::page::pluginmgr::transform</b>. More than one transformation
plugin can be kept in memory.</p>
</div>
<div id="section7" class="section"><h2><a name="section7">PREDEFINED PLUGINS</a></h2>
<p>The following predefined plugins are known, i.e. provided by the page
module.</p>
<dl class="definitions">
<dt>Configuration</dt>
<dd><dl class="definitions">
<dt>peg</dt>
<dd><p>Returns a set of options to configure the <b class="syscmd"><a href="../../apps/page.html">page</a></b> application
for the processing of a PEG grammar and the generation of ME code. See
the packages <b class="package">grammar_peg</b>, <b class="package">grammar_me</b> and relations
for more details.</p></dd>
</dl></dd>
<dt>Reader</dt>
<dd><dl class="definitions">
<dt>hb</dt>
<dd><p>Expects a so-called <i class="term">half-baked PEG container</i> as input and
returns the equivalent abstract syntax tree. See the writer plugin
<i class="term">hb</i> for the plugin generating this type of input.</p></dd>
<dt>lemon</dt>
<dd><p>Expects a grammar specification as understood by Richar Hipp's LEMON
parser generator and returns an abstract syntax tree for it.</p></dd>
<dt>peg</dt>
<dd><p>Expects a grammar specification in the form of a parsing expression
grammar (PEG) and returns an abstract syntax tree for it.</p></dd>
<dt>ser</dt>
<dd><p>Expect the serialized form of a parsing expression grammar as
generated by the package <b class="package"><a href="../grammar_peg/peg.html">grammar::peg</a></b> as input, converts it
into an equivalent abstract syntax tree and returns that.</p></dd>
<dt>treeser</dt>
<dd><p>Expects the serialized form of a tree as generated by the package
<b class="package"><a href="../struct/struct_tree.html">struct::tree</a></b> as input and returns it, after validation.</p></dd>
</dl></dd>
<dt>Writer</dt>
<dd><dl class="definitions">
<dt>hb</dt>
<dd><p>Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out in the form of a so-called
<i class="term">half-baked PEG container</i>.</p></dd>
<dt>identity</dt>
<dd><p>Takes any input and writes it as is.</p></dd>
<dt>mecpu</dt>
<dd><p>Expects symbolic assembler code for the MatchEngine CPU (See the
package <b class="package"><a href="../grammar_me/me_cpu.html">grammar::me::cpu</a></b> and relatives) and writes it out as
Tcl code for a parser.</p></dd>
<dt>me</dt>
<dd><p>Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out as Tcl code for the MatchEngine (See the
package <b class="package">grammar::me</b> and relatives) which parses input in
that grammar.</p></dd>
<dt>null</dt>
<dd><p>Takes any input and writes nothing. The logical equivalent of
/dev/null.</p></dd>
<dt>peg</dt>
<dd><p>Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out in the form of a canonical PEG which can be
read by the reader plugin <i class="term">peg</i>.</p></dd>
<dt>ser</dt>
<dd><p>Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out as a serialized PEG container which can be
read by the reader plugin <i class="term">ser</i>.</p></dd>
<dt>tpc</dt>
<dd><p>Expects an abstract syntax tree for a parsing expression grammar as
input and writes it out as Tcl code initializing a PEG container as
provided by the package <b class="package"><a href="../grammar_peg/peg.html">grammar::peg</a></b>.</p></dd>
<dt>tree</dt>
<dd><p>Takes any serialized tree (per package <b class="package"><a href="../struct/struct_tree.html">struct::tree</a></b>) as
input and writes it out in a generic indented format.</p></dd>
</dl></dd>
<dt>Transformation</dt>
<dd><dl class="definitions">
<dt>mecpu</dt>
<dd><p>Takes an abstract syntax tree for a parsing expression grammer as
input, generates symbolic assembler code for the MatchEngine CPU, and
returns that as its result (See the package <b class="package"><a href="../grammar_me/me_cpu.html">grammar::me::cpu</a></b>
and relatives).</p></dd>
<dt>reachable</dt>
<dd><p>Takes an abstract syntax tree for a parsing expression grammer as
input, performs a reachability analysis, and returns the modified and
annotated tree.</p></dd>
<dt>realizable</dt>
<dd><p>Takes an abstract syntax tree for a parsing expression grammer as
input, performs an analysis of realizability, and returns the modified
and annotated tree.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section8" class="section"><h2><a name="section8">FEATURES</a></h2>
<p>The plugin manager currently checks the plugins for only one feature,
<b class="const">timeable</b>. A plugin supporting this feature is assumed to be
able to collect timing statistics on request.</p>
</div>
<div id="section9" class="section"><h2><a name="section9">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>page</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key177">page</a>, <a href="../../../../index.html#key175">parser generator</a>, <a href="../../../../index.html#key178">text processing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Page Parser Generator</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/page/page_util_flow.html.













































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>page_util_flow - Parser generator tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/page/page_util_flow.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ page_util_flow.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">page_util_flow(n) 1.0 tcllib &quot;Parser generator tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>page_util_flow - page dataflow/treewalker utility</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">FLOW API</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">page::util::flow <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::page::util::flow</b> <i class="arg">start</i> <i class="arg">flowvar</i> <i class="arg">nodevar</i> <i class="arg">script</i></a></li>
<li><a href="#2"><i class="arg">flow</i> <b class="method">visit</b> <i class="arg">node</i></a></li>
<li><a href="#3"><i class="arg">flow</i> <b class="method">visitl</b> <i class="arg">nodelist</i></a></li>
<li><a href="#4"><i class="arg">flow</i> <b class="method">visita</b> <i class="arg">node</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a single utility command for easy dataflow based
manipulation of arbitrary data structures, especially abstract syntax
trees.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::page::util::flow</b> <i class="arg">start</i> <i class="arg">flowvar</i> <i class="arg">nodevar</i> <i class="arg">script</i></a></dt>
<dd><p>This command contains the core logic to drive the walking of an
arbitrary data structure which can partitioned into separate
parts. Examples of such structures are trees and graphs.</p>
<p>The command makes no assumptions at all about the API of the structure
to be walked, except that that its parts, here called <i class="term">nodes</i>,
are identified by strings. These strings are taken as is, from the
arguments, and the body, and handed back to the body, without
modification.</p>
<p>Access to the actual data structure, and all decisions regarding which
nodes to visit in what order are delegated to the body of the loop,
i.e. the <i class="arg">script</i>.</p>
<p>The body is invoked first for the nodes in the start-set specified via
<i class="arg">start</i>), and from then on for the nodes the body has requested to
be visited. The command stops when the set of nodes to visit becomes
empty. Note that a node can be visited more than once. The body has
complete control about this.</p>
<p>The body is invoked in the context of the caller. The variable named
by <i class="arg">nodevar</i> will be set to the current node, and the variable
named by <i class="arg">flowvar</i> will be set to the command of the flow object
through which the body can request the nodes to visit next. The API
provided by this object is described in the next section,
<span class="sectref"><a href="#section3">FLOW API</a></span>.</p>
<p>Note that the command makes no promises regarding the order in which
nodes are visited, excpt that the nodes requested to be visited by the
current iteration will be visited afterward, in some order.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">FLOW API</a></h2>
<p>This section describes the API provided by the flow object made
accessible to the body script of <b class="cmd">::page::util::flow</b>.</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">flow</i> <b class="method">visit</b> <i class="arg">node</i></a></dt>
<dd><p>Invoking this method requests that the node <i class="arg">n</i> is visited after
the current iteration.</p></dd>
<dt><a name="3"><i class="arg">flow</i> <b class="method">visitl</b> <i class="arg">nodelist</i></a></dt>
<dd><p>Invoking this method requests that all the nodes found in the list
<i class="arg">nodelist</i> are visited after the current iteration.</p></dd>
<dt><a name="4"><i class="arg">flow</i> <b class="method">visita</b> <i class="arg">node</i>...</a></dt>
<dd><p>This is the variadic arguments form of the method <b class="method">visitl</b>, see
above.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>page</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key352">dataflow</a>, <a href="../../../../index.html#key179">graph walking</a>, <a href="../../../../index.html#key177">page</a>, <a href="../../../../index.html#key175">parser generator</a>, <a href="../../../../index.html#key178">text processing</a>, <a href="../../../../index.html#key176">tree walking</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Page Parser Generator</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/page/page_util_norm_lemon.html.







































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>page_util_norm_lemon - Parser generator tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/page/page_util_norm_lemon.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ page_util_norm_lemon.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">page_util_norm_lemon(n) 1.0 tcllib &quot;Parser generator tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>page_util_norm_lemon - page AST normalization, LEMON</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">page::util::norm_lemon <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::page::util::norm::lemon</b> <i class="arg">tree</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a single utility command which takes an AST for a
lemon  grammar and normalizes it in various ways. The result
is called a <i class="term">Normalized Lemon Grammar Tree</i>.</p>
<p><em>Note</em> that this package can only be used from within a plugin
managed by the package <b class="package">page::pluginmgr</b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::page::util::norm::lemon</b> <i class="arg">tree</i></a></dt>
<dd><p>This command assumes the <i class="arg">tree</i> object contains for a lemon
grammar. It normalizes this tree in place. The result is called a
<i class="term">Normalized Lemon Grammar Tree</i>.</p>
<p>The exact operations performed are left undocumented for the moment.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>page</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key179">graph walking</a>, <a href="../../../../index.html#key180">lemon</a>, <a href="../../../../index.html#key100">normalization</a>, <a href="../../../../index.html#key177">page</a>, <a href="../../../../index.html#key175">parser generator</a>, <a href="../../../../index.html#key178">text processing</a>, <a href="../../../../index.html#key176">tree walking</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Page Parser Generator</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/page/page_util_norm_peg.html.













































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>page_util_norm_peg - Parser generator tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/page/page_util_norm_peg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ page_util_norm_peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">page_util_norm_peg(n) 1.0 tcllib &quot;Parser generator tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>page_util_norm_peg - page AST normalization, PEG</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">page::util::norm_peg <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::page::util::norm::peg</b> <i class="arg">tree</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a single utility command which takes an AST for a
parsing expression grammar and normalizes it in various ways. The result
is called a <i class="term">Normalized PE Grammar Tree</i>.</p>
<p><em>Note</em> that this package can only be used from within a plugin
managed by the package <b class="package">page::pluginmgr</b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::page::util::norm::peg</b> <i class="arg">tree</i></a></dt>
<dd><p>This command assumes the <i class="arg">tree</i> object contains for a
parsing expression grammar. It normalizes this tree in place.
The result is called a  <i class="term">Normalized PE Grammar Tree</i>.</p>
<p>The following operations are performd</p>
<ol class="enumerated">
<li><p>The data for all terminals is stored in their grandparental
nodes. The terminal nodes and their parents are removed. Type
information is dropped.</p></li>
<li><p>All nodes which have exactly one child are irrelevant and are
removed, with the exception of the root node. The immediate
child of the root is irrelevant as well, and removed as well.</p></li>
<li><p>The name of the grammar is moved from the tree node it is stored
in to an attribute of the root node, and the tree node removed.</p>
<p>The node keeping the start expression separate is removed as
irrelevant and the root node of the start expression tagged with
a marker attribute, and its handle saved in an attribute of the
root node for quick access.</p></li>
<li><p>Nonterminal hint information is moved from nodes into attributes,
and the now irrelevant nodes are deleted.</p>
<p><em>Note:</em> This transformation is dependent on the removal of all
nodes with exactly one child, as it removes the all 'Attribute'
nodes already. Otherwise this transformation would have to put
the information into the grandparental node.</p>
<p>The default mode given to the nonterminals is <b class="const">value</b>.</p>
<p>Like with the global metadata definition specific information
is moved out out of nodes into attributes, the now irrelevant
nodes are deleted, and the root nodes of all definitions are
tagged with marker attributes. This provides us with a mapping
from nonterminal names to their defining nodes as well, which
is saved in an attribute of the root node for quick reference.</p>
<p>At last the range in the input covered by a definition is
computed. The left extent comes from the terminal for the
nonterminal symbol it defines. The right extent comes from
the rightmost child under the definition. While this not an
expression tree yet the location data is sound already.</p></li>
<li><p>The remaining nodes under all definitions are transformed
into proper expression trees. First character ranges, followed
by unary operations, characters, and nonterminals. At last the
tree is flattened by the removal of superfluous inner nodes.</p>
<p>The order matters, to shed as much nodes as possible early, and
to avoid unnecessary work later.</p></li>
</ol></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>page</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key179">graph walking</a>, <a href="../../../../index.html#key100">normalization</a>, <a href="../../../../index.html#key177">page</a>, <a href="../../../../index.html#key175">parser generator</a>, <a href="../../../../index.html#key178">text processing</a>, <a href="../../../../index.html#key176">tree walking</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Page Parser Generator</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/page/page_util_peg.html.


























































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>page_util_peg - Parser generator tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/page/page_util_peg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ page_util_peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">page_util_peg(n) 1.0 tcllib &quot;Parser generator tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>page_util_peg - page PEG transformation utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">page::util::peg <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::page::util::peg::symbolNodeOf</b> <i class="arg">tree</i> <i class="arg">node</i></a></li>
<li><a href="#2"><b class="cmd">::page::util::peg::symbolOf</b> <i class="arg">tree</i> <i class="arg">node</i></a></li>
<li><a href="#3"><b class="cmd">::page::util::peg::updateUndefinedDueRemoval</b> <i class="arg">tree</i></a></li>
<li><a href="#4"><b class="cmd">::page::util::peg::flatten</b> <i class="arg">treequery</i> <i class="arg">tree</i></a></li>
<li><a href="#5"><b class="cmd">::page::util::peg::getWarnings</b> <i class="arg">tree</i></a></li>
<li><a href="#6"><b class="cmd">::page::util::peg::printWarnings</b> <i class="arg">msg</i></a></li>
<li><a href="#7"><b class="cmd">::page::util::peg::peOf</b> <i class="arg">tree</i> <i class="arg">eroot</i></a></li>
<li><a href="#8"><b class="cmd">::page::util::peg::printTclExpr</b> <i class="arg">pe</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a few common operations to PEG transformations.
They assume a <i class="term">Normalized PE Grammar Tree</i> as input, see the
package <b class="package">page::util::norm::peg</b>, possibly augmented with
attributes coming from transformations not in conflict with the base
definition.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::page::util::peg::symbolNodeOf</b> <i class="arg">tree</i> <i class="arg">node</i></a></dt>
<dd><p>Given an arbitrary expression <i class="arg">node</i> in the AST <i class="arg">tree</i> it
determines the node (itself or an ancestor) containing the name of the
nonterminal symbol the node belongs to, and returns its id. The result
is either the root of the tree (for the start expression), or a
definition node.</p></dd>
<dt><a name="2"><b class="cmd">::page::util::peg::symbolOf</b> <i class="arg">tree</i> <i class="arg">node</i></a></dt>
<dd><p>As <b class="cmd">::page::util::peg::symbolNodeOf</b>, but returns the symbol name
instead of the node.</p></dd>
<dt><a name="3"><b class="cmd">::page::util::peg::updateUndefinedDueRemoval</b> <i class="arg">tree</i></a></dt>
<dd><p>The removal of nodes in the AST <i class="arg">tree</i> can cause symbols to lose
one or more users.</p>
<pre class="example">
	A used by B and C,
	B is reachable,
	C is not,
	so A now loses the node in the expression for C calling it,
	or rather, not calling it anymore.
</pre>
<p>This command updates the cross-references and which nonterminals are
now undefined.</p></dd>
<dt><a name="4"><b class="cmd">::page::util::peg::flatten</b> <i class="arg">treequery</i> <i class="arg">tree</i></a></dt>
<dd><p>This commands flattens nested sequence and choice operators in the AST
<i class="arg">tree</i>, re-using the <b class="package"><a href="../treeql/treeql.html">treeql</a></b> object <i class="arg">treequery</i> to
run the query determining which nodes to cut.</p></dd>
<dt><a name="5"><b class="cmd">::page::util::peg::getWarnings</b> <i class="arg">tree</i></a></dt>
<dd><p>This command looks at the attributes of the AST <i class="arg">tree</i> for
problems with the grammar and issues warnings. They do not prevent us
from writing the grammar, but still represent problems with it the
user should be made aware of.</p>
<p>The result of the command is a dictionary mapping nonterminal names to
their associated warnings.</p></dd>
<dt><a name="6"><b class="cmd">::page::util::peg::printWarnings</b> <i class="arg">msg</i></a></dt>
<dd><p>The argument of the command is a dictionary mapping nonterminal names
to their associated warnings, as generated by, for example, the
command <b class="cmd">::page::util::peg::getWarnings</b>.</p>
<p>The warnings contained therein are formatted and then printed via the
log command <b class="cmd">page_info</b>. This means that this command can be used
only from within a plugin managed by the package
<b class="package">page::pluginmgr</b>.</p></dd>
<dt><a name="7"><b class="cmd">::page::util::peg::peOf</b> <i class="arg">tree</i> <i class="arg">eroot</i></a></dt>
<dd><p>This command converts the parsing expression starting at the node
<i class="arg">eroot</i> in the AST <i class="arg">tree</i> into a nested list. The exact syntax
of this list specified by the package <b class="package"><a href="../grammar_peg/peg.html">grammar::peg</a></b>.</p></dd>
<dt><a name="8"><b class="cmd">::page::util::peg::printTclExpr</b> <i class="arg">pe</i></a></dt>
<dd><p>This command converts the parsing expression contained in the nested
list <i class="arg">pe</i> into a Tcl string which can be placed into a Tcl script.
See the package <b class="package"><a href="../grammar_peg/peg.html">grammar::peg</a></b> for the exact syntax of
<i class="arg">pe</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>page</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key177">page</a>, <a href="../../../../index.html#key175">parser generator</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key178">text processing</a>, <a href="../../../../index.html#key274">transformation</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Page Parser Generator</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/page/page_util_quote.html.



























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>page_util_quote - Parser generator tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/page/page_util_quote.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ page_util_quote.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">page_util_quote(n) 1.0 tcllib &quot;Parser generator tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>page_util_quote - page character quoting utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">page::util::quote <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::page::util::quote::unquote</b> <i class="arg">char</i></a></li>
<li><a href="#2"><b class="cmd">::page::util::quote::quote'tcl</b> <i class="arg">char</i></a></li>
<li><a href="#3"><b class="cmd">::page::util::quote::quote'tclstr</b> <i class="arg">char</i></a></li>
<li><a href="#4"><b class="cmd">::page::util::quote::quote'tclcom</b> <i class="arg">char</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a few utility commands to convert characters
into various forms.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::page::util::quote::unquote</b> <i class="arg">char</i></a></dt>
<dd><p>A character, as stored in an abstract syntax tree by a PEG processor
(See the packages <b class="package">grammar::peg::interpreter</b>,
<b class="package">grammar::me</b>, and their relations), i.e. in some quoted form,
is converted into the equivalent Tcl character. The character is returned
as the result of the command.</p></dd>
<dt><a name="2"><b class="cmd">::page::util::quote::quote'tcl</b> <i class="arg">char</i></a></dt>
<dd><p>This command takes a Tcl character (internal representation) and
converts it into a string which is accepted by the Tcl parser, will
regenerate the character in question and is 7bit ASCII. The string is
returned as the result of this command.</p></dd>
<dt><a name="3"><b class="cmd">::page::util::quote::quote'tclstr</b> <i class="arg">char</i></a></dt>
<dd><p>This command takes a Tcl character (internal representation) and
converts it into a string which is accepted by the Tcl parser and will
generate a human readable representation of the character in question.
The string is returned as the result of this command.</p>
<p>The string does not use any unprintable characters. It may use
backslash-quoting. High UTF characters are quoted to avoid problems
with the still prevalent ascii terminals. It is assumed that the
string will be used in a double-quoted environment.</p></dd>
<dt><a name="4"><b class="cmd">::page::util::quote::quote'tclcom</b> <i class="arg">char</i></a></dt>
<dd><p>This command takes a Tcl character (internal representation) and
converts it into a string which is accepted by the Tcl parser when
used within a Tcl comment. The string is returned as the result of
this command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, will undoubtedly contain bugs and other problems.
Please report such in the category <em>page</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key177">page</a>, <a href="../../../../index.html#key175">parser generator</a>, <a href="../../../../index.html#key558">quoting</a>, <a href="../../../../index.html#key178">text processing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Page Parser Generator</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pki/pki.html.





































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pki - public key encryption</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pki/pki.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2010, 2011, 2012, 2013, Roy Keene, Andreas Kupries
   -->
<! -- CVS: $Id$ pki.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pki(n) 0.6 tcllib &quot;public key encryption&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pki - Implementation of the public key cipher</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">AUTHORS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pki <span class="opt">?0.6?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pki::encrypt</b> <span class="opt">?<i class="arg">-binary</i>?</span> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-pad</i>?</span> <span class="opt">?<i class="arg">-nopad</i>?</span> <span class="opt">?<i class="arg">-priv</i>?</span> <span class="opt">?<i class="arg">-pub</i>?</span> <span class="opt">?<i class="arg">--</i>?</span> <i class="arg">input</i> <i class="arg">key</i></a></li>
<li><a href="#2"><b class="cmd">::pki::decrypt</b> <span class="opt">?<i class="arg">-binary</i>?</span> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-unpad</i>?</span> <span class="opt">?<i class="arg">-nounpad</i>?</span> <span class="opt">?<i class="arg">-priv</i>?</span> <span class="opt">?<i class="arg">-pub</i>?</span> <span class="opt">?<i class="arg">--</i>?</span> <i class="arg">input</i> <i class="arg">key</i></a></li>
<li><a href="#3"><b class="cmd">::pki::sign</b> <i class="arg">input</i> <i class="arg">key</i> <span class="opt">?<i class="arg">algo</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::pki::verify</b> <i class="arg">signedmessage</i> <i class="arg">plaintext</i> <i class="arg">key</i> <span class="opt">?<i class="arg">algo</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::pki::key</b> <i class="arg">key</i> <span class="opt">?<i class="arg">password</i>?</span> <span class="opt">?<i class="arg">encodePem</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::pki::pkcs::parse_key</b> <i class="arg">key</i> <span class="opt">?<i class="arg">password</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::pki::x509::parse_cert</b> <i class="arg">cert</i></a></li>
<li><a href="#8"><b class="cmd">::pki::rsa::generate</b> <i class="arg">bitlength</i> <span class="opt">?<i class="arg">exponent</i>?</span></a></li>
<li><a href="#9"><b class="cmd">::pki::x509::verify_cert</b> <i class="arg">cert</i> <i class="arg">trustedcerts</i> <span class="opt">?<i class="arg">intermediatecerts</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::pki::x509::validate_cert</b> <i class="arg">cert</i> <span class="opt">?<b class="option">-sign_message</b> <i class="arg">dn_of_signer</i>?</span> <span class="opt">?<b class="option">-encrypt_message</b> <i class="arg">dn_of_signer</i>?</span> <span class="opt">?<b class="option">-sign_cert</b> <i class="arg">dn_to_be_signed</i> <i class="arg">ca_depth</i>?</span> <span class="opt">?<b class="option">-ssl</b> <i class="arg">dn</i>?</span></a></li>
<li><a href="#11"><b class="cmd">::pki::pkcs::create_csr</b> <i class="arg">keylist</i> <i class="arg">namelist</i> <span class="opt">?<i class="arg">encodePem</i>?</span> <span class="opt">?<i class="arg">algo</i>?</span></a></li>
<li><a href="#12"><b class="cmd">::pki::pkcs::parse_csr</b> <i class="arg">csr</i></a></li>
<li><a href="#13"><b class="cmd">::pki::x509::create_cert</b> <i class="arg">signreqlist</i> <i class="arg">cakeylist</i> <i class="arg">serial_number</i> <i class="arg">notBefore</i> <i class="arg">notAfter</i> <i class="arg">isCA</i> <i class="arg">extensions</i> <span class="opt">?<i class="arg">encodePem</i>?</span> <span class="opt">?<i class="arg">algo</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pki::encrypt</b> <span class="opt">?<i class="arg">-binary</i>?</span> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-pad</i>?</span> <span class="opt">?<i class="arg">-nopad</i>?</span> <span class="opt">?<i class="arg">-priv</i>?</span> <span class="opt">?<i class="arg">-pub</i>?</span> <span class="opt">?<i class="arg">--</i>?</span> <i class="arg">input</i> <i class="arg">key</i></a></dt>
<dd><p>Encrypt a message using PKI (probably RSA).
Requires the caller to specify either <b class="option">-priv</b> to encrypt with
the private key or <b class="option">-pub</b> to encrypt with the public key.  The
default option is to pad and return in hex.  One of <b class="option">-pub</b> or
<b class="option">-priv</b> must be specified.
The <b class="option">-hex</b> option causes the data to be returned in encoded as
a hexidecimal string, while the <b class="option">-binary</b> option causes the data
to be returned as a binary string.  If they are specified multiple
times, the last one specified is used.
The <b class="option">-pad</b> option causes the data to be padded per PKCS#1 prior
to being encrypted.  The <b class="option">-nopad</b> inhibits this behaviour.  If
they are specified multiple times, the last one specified is used.
The input to encrypt is specified as <i class="arg">input</i>.
The <i class="arg">key</i> parameter, holding the key to use, is a return value
from either
<b class="cmd">::pki::pkcs::parse_key</b>,
<b class="cmd">::pki::x509::parse_cert</b>, or
<b class="cmd">::pki::rsa::generate</b>.</p>
<p>Mapping to OpenSSL's <b class="syscmd">openssl</b> application:</p>
<ol class="enumerated">
<li><p>&quot;openssl rsautl -encrypt&quot; == &quot;::pki::encrypt -binary -pub&quot;</p></li>
<li><p>&quot;openssl rsautl -sign&quot;    == &quot;::pki::encrypt -binary -priv&quot;</p></li>
</ol></dd>
<dt><a name="2"><b class="cmd">::pki::decrypt</b> <span class="opt">?<i class="arg">-binary</i>?</span> <span class="opt">?<i class="arg">-hex</i>?</span> <span class="opt">?<i class="arg">-unpad</i>?</span> <span class="opt">?<i class="arg">-nounpad</i>?</span> <span class="opt">?<i class="arg">-priv</i>?</span> <span class="opt">?<i class="arg">-pub</i>?</span> <span class="opt">?<i class="arg">--</i>?</span> <i class="arg">input</i> <i class="arg">key</i></a></dt>
<dd><p>Decrypt a message using PKI (probably RSA). See <b class="cmd">::pki::encrypt</b> for option handling.</p>
<p>Mapping to OpenSSL's <b class="syscmd">openssl</b> application:</p>
<ol class="enumerated">
<li><p>&quot;openssl rsautl -decrypt&quot; == &quot;::pki::decrypt -binary -priv&quot;</p></li>
<li><p>&quot;openssl rsautl -verify&quot;  == &quot;::pki::decrypt -binary -pub&quot;</p></li>
</ol></dd>
<dt><a name="3"><b class="cmd">::pki::sign</b> <i class="arg">input</i> <i class="arg">key</i> <span class="opt">?<i class="arg">algo</i>?</span></a></dt>
<dd><p>Digitally sign message <i class="arg">input</i> using the private <i class="arg">key</i>.  If <i class="arg">algo</i>
is ommited &quot;sha1&quot; is assumed.  Possible values for <i class="arg">algo</i> include
&quot;md5&quot;, &quot;sha1&quot;, &quot;sha256&quot;, and &quot;raw&quot;.  Specifyin &quot;raw&quot; for <i class="arg">algo</i> will
inhibit the building of an ASN.1 structure to encode which hashing
algorithm was chosen.
The <i class="arg">input</i> should be the plain text, hashing will be performed on it.
The <i class="arg">key</i> should include the private key.</p></dd>
<dt><a name="4"><b class="cmd">::pki::verify</b> <i class="arg">signedmessage</i> <i class="arg">plaintext</i> <i class="arg">key</i> <span class="opt">?<i class="arg">algo</i>?</span></a></dt>
<dd><p>Verify a digital signature using a public <i class="arg">key</i>.  Returns true or false.</p></dd>
<dt><a name="5"><b class="cmd">::pki::key</b> <i class="arg">key</i> <span class="opt">?<i class="arg">password</i>?</span> <span class="opt">?<i class="arg">encodePem</i>?</span></a></dt>
<dd><p>Convert a key structure into a serialized PEM (default) or DER encoded private key suitable for other applications.  For RSA keys this means PKCS#1.</p></dd>
<dt><a name="6"><b class="cmd">::pki::pkcs::parse_key</b> <i class="arg">key</i> <span class="opt">?<i class="arg">password</i>?</span></a></dt>
<dd><p>Convert a PKCS#1 private <i class="arg">key</i> into a usable key, i.e. one which
can be used as argument for
<b class="cmd">::pki::encrypt</b>,
<b class="cmd">::pki::decrypt</b>,
<b class="cmd">::pki::sign</b>, and
<b class="cmd">::pki::verify</b>.</p></dd>
<dt><a name="7"><b class="cmd">::pki::x509::parse_cert</b> <i class="arg">cert</i></a></dt>
<dd><p>Convert an X.509 certificate to a usable (public) key, i.e. one which
can be used as argument for
<b class="cmd">::pki:encrypt</b>,
<b class="cmd">::pki::decrypt</b>, and
<b class="cmd">::pki::verify</b>.
The <i class="arg">cert</i> argument can be either PEM or DER encoded.</p></dd>
<dt><a name="8"><b class="cmd">::pki::rsa::generate</b> <i class="arg">bitlength</i> <span class="opt">?<i class="arg">exponent</i>?</span></a></dt>
<dd><p>Generate a new RSA key pair, the parts of which can be used as
argument for
<b class="cmd">::pki::encrypt</b>,
<b class="cmd">::pki::decrypt</b>,
<b class="cmd">::pki::sign</b>, and
<b class="cmd">::pki::verify</b>.
The <i class="arg">bitlength</i> argument is the length of the public key modulus.
The <i class="arg">exponent</i> argument should generally not be specified unless
you really know what you are doing.</p></dd>
<dt><a name="9"><b class="cmd">::pki::x509::verify_cert</b> <i class="arg">cert</i> <i class="arg">trustedcerts</i> <span class="opt">?<i class="arg">intermediatecerts</i>?</span></a></dt>
<dd><p>Verify that a trust can be found between the certificate specified in the
<i class="arg">cert</i> argument and one of the certificates specified in the list
of certificates in the <i class="arg">trustedcerts</i> argument.  (Eventually the
chain can be through untrusted certificates listed in the <i class="arg">intermediatecerts</i>
argument, but this is currently unimplemented).
The certificates specified in the <i class="arg">cert</i> and <i class="arg">trustedcerts</i> option
should be parsed (from <b class="cmd">::pki::x509::parse_cert</b>).</p></dd>
<dt><a name="10"><b class="cmd">::pki::x509::validate_cert</b> <i class="arg">cert</i> <span class="opt">?<b class="option">-sign_message</b> <i class="arg">dn_of_signer</i>?</span> <span class="opt">?<b class="option">-encrypt_message</b> <i class="arg">dn_of_signer</i>?</span> <span class="opt">?<b class="option">-sign_cert</b> <i class="arg">dn_to_be_signed</i> <i class="arg">ca_depth</i>?</span> <span class="opt">?<b class="option">-ssl</b> <i class="arg">dn</i>?</span></a></dt>
<dd><p>Validate that a certificate is valid to be used in some capacity.  If
multiple options are specified they must all be met for this procedure
to return &quot;true&quot;.
Currently, only the <b class="option">-sign_cert</b> option is functional.
Arguments for the <b class="option">-sign_cert</b> option are <i class="arg">dn_to_be_signed</i>
and <i class="arg">ca_depth</i>.  The <i class="arg">dn_to_be_signed</i> is the distinguished from
the subject of a certificate to verify that the certificate specified in
the <i class="arg">cert</i> argument can sign.  The <i class="arg">ca_depth</i> argument is used to
indicate at which depth the verification should be done at.  Some
certificates are limited to how far down the chain they can be used to
verify a given certificate.</p></dd>
<dt><a name="11"><b class="cmd">::pki::pkcs::create_csr</b> <i class="arg">keylist</i> <i class="arg">namelist</i> <span class="opt">?<i class="arg">encodePem</i>?</span> <span class="opt">?<i class="arg">algo</i>?</span></a></dt>
<dd><p>Generate a certificate signing request from a key pair specified in
the <i class="arg">keylist</i> argument.
The <i class="arg">namelist</i> argument is a list of &quot;name&quot; followed by &quot;value&quot;
pairs to encoding as the requested distinguished name in the CSR.
The <i class="arg">encodePem</i> option specifies whether or not the result should
be PEM encoded or DER encoded.  A &quot;true&quot; value results in the result
being PEM encoded, while any other value 9results in the the result
being DER encoded.  DER encoding is the default.
The <i class="arg">algo</i> argument specifies the hashing algorithm we should use
to sign this certificate signing request with.  The default is &quot;sha1&quot;.
Other possible values include &quot;md5&quot; and &quot;sha256&quot;.</p></dd>
<dt><a name="12"><b class="cmd">::pki::pkcs::parse_csr</b> <i class="arg">csr</i></a></dt>
<dd><p>Parse a Certificate Signing Request.  The <i class="arg">csr</i> argument can be
either PEM or DER encoded.</p></dd>
<dt><a name="13"><b class="cmd">::pki::x509::create_cert</b> <i class="arg">signreqlist</i> <i class="arg">cakeylist</i> <i class="arg">serial_number</i> <i class="arg">notBefore</i> <i class="arg">notAfter</i> <i class="arg">isCA</i> <i class="arg">extensions</i> <span class="opt">?<i class="arg">encodePem</i>?</span> <span class="opt">?<i class="arg">algo</i>?</span></a></dt>
<dd><p>Sign a signing request (usually from <b class="cmd">::pki::pkcs::create_csr</b> or
<b class="cmd">::pki::pkcs::parse_csr</b>) with a Certificate Authority (CA) certificate.
The <i class="arg">signreqlist</i> argument should be the parsed signing request.
The <i class="arg">cakeylist</i> argument should be the parsed CA certificate.
The <i class="arg">serial_number</i> argument should be a serial number unique to
this certificate from this certificate authority.  
The <i class="arg">notBefore</i> and <i class="arg">notAfter</i> arguments should contain the
time before and after which (respectively) the certificate should
be considered invalid.  The time should be encoded as something
<b class="cmd">clock format</b> will accept (i.e., the results of <b class="cmd">clock seconds</b>
and <b class="cmd">clock add</b>).
The <i class="arg">isCA</i> argument is a boolean argumen describing whether or not
the signed certificate should be a a CA certificate.  If specified as
true the &quot;id-ce-basicConstraints&quot; extension is added with the arguments
of &quot;critical&quot; being true, &quot;allowCA&quot; being true, and caDepth being
-1 (infinite).
The <i class="arg">extensions</i> argument is a list of extensions and their parameters
that should be encoded into the created certificate.   Currently only one
extension is understood (&quot;id-ce-basicConstraints&quot;).  It accepts three
arguments <i class="arg">critical</i> <i class="arg">allowCA</i> <i class="arg">caDepth</i>.  The <i class="arg">critical</i>
argument to this extension (and any extension) whether or not the
validator should reject the certificate as invalid if it does not
understand the extension (if set to &quot;true&quot;) or should ignore the extension
(if set to &quot;false&quot;).  The <i class="arg">allowCA</i> argument is used to specify
as a boolean value whether or not we can be used a certificate
authority (CA).  The <i class="arg">caDepth</i> argument indicates how many children 
CAs can be children of this CA in a depth-wise fashion.  A value of &quot;0&quot;
for the <i class="arg">caDepth</i> argument means that this CA cannot sign a CA
certificate and have the result be valid.  A value of &quot;-1&quot; indicates
infinite depth.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<pre class="example">
</pre>
<pre class="example">
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<ol class="enumerated">
<li></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">AUTHORS</a></h2>
<p>Roy Keene</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>rsa</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../aes/aes.html">aes(n)</a>, <a href="../blowfish/blowfish.html">blowfish(n)</a>, <a href="../des/des.html">des(n)</a>, <a href="../md5/md5.html">md5(n)</a>, <a href="../sha1/sha1.html">sha1(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key162">cipher</a>, <a href="../../../../index.html#key111">data integrity</a>, <a href="../../../../index.html#key114">encryption</a>, <a href="../../../../index.html#key161">public key cipher</a>, <a href="../../../../index.html#key160">rsa</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2010, 2011, 2012, 2013, Roy Keene, Andreas Kupries</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pluginmgr/pluginmgr.html.





































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pluginmgr - Plugin management</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pluginmgr/pluginmgr.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pluginmgr.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pluginmgr(n) 0.3 tcllib &quot;Plugin management&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pluginmgr - Manage a plugin</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PUBLIC API</a>
<ul>
<li class="subsection"><a href="#subsection1">PACKAGE COMMANDS</a></li>
<li class="subsection"><a href="#subsection2">OBJECT COMMAND</a></li>
<li class="subsection"><a href="#subsection3">OBJECT METHODS</a></li>
<li class="subsection"><a href="#subsection4">OBJECT CONFIGURATION</a></li>
</ul>
</li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">pluginmgr <span class="opt">?0.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pluginmgr</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">option value</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">::pluginmgr::paths</b> <i class="arg">objectName</i> <i class="arg">name</i>...</a></li>
<li><a href="#3"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">clone</b></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">configure</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">cget</b> <b class="option">-option</b></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">do</b> <i class="arg">arg</i>...</a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">interpreter</b></a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">plugin</b></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">load</b> <i class="arg">string</i></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">unload</b></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">list</b></a></li>
<li><a href="#16"><i class="arg">objectName</i> <b class="method">path</b> <i class="arg">path</i></a></li>
<li><a href="#17"><i class="arg">objectName</i> <b class="method">paths</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands and objects for the generic management
of plugins which can be loaded into an application.</p>
<p>To avoid the implementation of yet another system to locate Tcl code
the system provides by this package is built on top of the regular
package management system. Each plugin is considered as a package and
a simple invokation of <b class="cmd">package require</b> is enough to locate and
load it, if it exists. The only time we will need additional paths is
when a plugin manager is part of a wrapped application and has to be
able to search for plugins existing outside of that application. For
this situation the package provides a command to create a general set
of such paths based on names for the plugin manager and/or application
in question.</p>
<p>The main contribution of this package is a generic framework which
allows the easy declaration of</p>
<ol class="enumerated">
<li><p>How to translate a plugin name to the name of the package implementing
it, and vice versa.</p></li>
<li><p>The list of commands a plugin has to provide as API, and also of more
complex checks as code.</p></li>
<li><p>The list of commands expected by the plugin from the environment.</p></li>
</ol>
<p>This then allows the easy generation of plugin managers customized to
particular types of plugins for an application.</p>
<p>It should be noted that all plugin code is considered untrusted and
will always be executed within a safe interpreter. The interpreter is
enabled enough to allow plugins the loading of all additional packages
they may need.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PUBLIC API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">PACKAGE COMMANDS</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pluginmgr</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">option value</i>...?</span></a></dt>
<dd><p>This command creates a new plugin manager object with an associated
Tcl command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command
is explained in full detail in the sections <span class="sectref"><a href="#subsection2">OBJECT COMMAND</a></span>
and <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p>
<p>The options and their values coming after the name of the object are
used to set the initial configuration of the mamager object,
specifying the applicable plugins and their API.</p></dd>
<dt><a name="2"><b class="cmd">::pluginmgr::paths</b> <i class="arg">objectName</i> <i class="arg">name</i>...</a></dt>
<dd><p>This utility command adds a set of paths to the specified object,
based on the given <i class="arg">name</i>s.
It will search for:</p>
<ol class="enumerated">
<li><p>The environment variable <b class="variable"><i class="arg">name</i>_PLUGINS</b>. Its contents will
be interpreted as a list of package paths. The entries have to be
separated by either <b class="const">:</b> (unix) or <b class="const">;</b> (windows).</p>
<p>The name will be converted to upper-case letters.</p></li>
<li><p>The registry entry &quot;HKEY_LOCAL_MACHINE\SOFTWARE\<i class="arg">name</i>\PLUGINS&quot;.
Its contents will be interpreted as a list of package paths. The
entries have to be separated by <b class="const">;</b>. This item is considered
only when on Windows (tm).</p>
<p>The casing of letters is not changed.</p></li>
<li><p>The registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\<i class="arg">name</i>\PLUGINS&quot;.
Its contents will be interpreted as a list of package paths. The
entries have to be separated by <b class="const">;</b>. This item is considered
only when on Windows (tm).</p>
<p>The casing of letters is not changed.</p></li>
<li><p>The directory &quot;<b class="file">~/.<i class="arg">name</i>/plugin</b>&quot;.</p></li>
<li><p>The directory &quot;<b class="file">~/.<i class="arg">name</i>/plugins</b>&quot;.</p>
<p>The casing of letters is not changed.</p></li>
</ol>
<p>and add all the paths found that way to the list of package paths
maintained by the object.</p>
<p>If <i class="arg">name</i> is namespaced each item in the list will be repeated per
prefix of <i class="arg">name</i>, with conversion of :-sequences into the proper
separator (underscore for environment variables, backslash for
registry entries, and / for directories).</p>
<p>Examples:</p>
<pre class="example">
    ::pluginmgr::paths ::obj docidx
    =&gt; env  DOCIDX_PLUGINS
       reg  HKEY_LOCAL_MACHINE\SOFTWARE\docidx\PLUGINS
       reg  HKEY_CURRENT_USER\SOFTWARE\docidx\PLUGINS
       path ~/.docidx/plugins
    ::pluginmgr::paths ::obj doctools::idx
    =&gt; env  DOCTOOLS_PLUGINS
       env  DOCTOOLS_IDX_PLUGINS
       reg  HKEY_LOCAL_MACHINE\SOFTWARE\doctools\PLUGINS
       reg  HKEY_LOCAL_MACHINE\SOFTWARE\doctools\idx\PLUGINS
       reg  HKEY_CURRENT_USER\SOFTWARE\doctools\PLUGINS
       reg  HKEY_CURRENT_USER\SOFTWARE\doctools\idx\PLUGINS
       path ~/.doctools/plugin
       path ~/.doctools/idx/plugin
</pre>
</dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">OBJECT COMMAND</a></h3>
<p>All commands created by the command <b class="cmd">::pluginmgr</b> (See section
<span class="sectref"><a href="#subsection1">PACKAGE COMMANDS</a></span>) have the following general form and may
be used to invoke various operations on their plugin manager object.</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the exact
behavior of the command. See section <span class="sectref"><a href="#subsection3">OBJECT METHODS</a></span> for
the detailed specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">OBJECT METHODS</a></h3>
<dl class="definitions">
<dt><a name="4"><i class="arg">objectName</i> <b class="method">clone</b></a></dt>
<dd><p>This method creates a new plugin management object and returns the
associated object command. The generated object is a clone of the
object the method was invoked on. I.e. the new object will have the
same configuration as the current object. With regard to state, if the
current object has a plugin loaded then this plugin and all associated
state is moved to the generated clone and the current object is reset
into the base state (no plugin loaded). In this manner a configured
plugin manager is also a factory for loaded plugins.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">configure</b></a></dt>
<dd><p>The method returns a list of all known options and their current
values when called without any arguments.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>The method behaves like the method <b class="method">cget</b> when called with a
single argument and returns the value of the option specified by said
argument.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">configure</b> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>The method reconfigures the specified <b class="option">option</b>s of the object,
setting them to the associated <i class="arg">value</i>s, when called with an even
number of arguments, at least two.</p>
<p>The legal options are described in the section
<span class="sectref"><a href="#subsection4">OBJECT CONFIGURATION</a></span>.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">cget</b> <b class="option">-option</b></a></dt>
<dd><p>This method expects a legal configuration option as argument and will
return the current value of that option for the object the method was
invoked for.</p>
<p>The legal configuration options are described in section
<span class="sectref"><a href="#subsection4">OBJECT CONFIGURATION</a></span>.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">do</b> <i class="arg">arg</i>...</a></dt>
<dd><p>This method interprets its list of arguments as the words of a command
and invokes this command in the execution context of the plugin.
The result of the invoked command is made the result of the method.
The call will fail with an error if no valid plugin has been loaded
into the manager object.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">interpreter</b></a></dt>
<dd><p>This method returns the handle of the safe interpreter the current
plugin is loaded into. An empty string as return value signals that
the manager currently has no valid plugin loaded.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">plugin</b></a></dt>
<dd><p>This method returns the name of the plugin currently loaded. An empty
string as return value signals that the manager currently has no valid
plugin loaded.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">load</b> <i class="arg">string</i></a></dt>
<dd><p>This method loads, validates, and initializes a named plugin into the
manager object.</p>
<p>The algorithm to locate and load the plugin employed is:</p>
<ol class="enumerated">
<li><p>If the <i class="arg">string</i> contains the path to an existing file then this
file is taken as the implementation of the plugin.</p></li>
<li><p>Otherwise the plugin name is translated into a package name via the value
of the option <b class="option">-pattern</b> and then loaded through the
regular package management.</p></li>
<li><p>The load fails.</p></li>
</ol>
<p>The algorithm to validate and initialize the loaded code is:</p>
<ol class="enumerated">
<li><p>If the option <b class="option">-api</b> is non-empty introspection commands are
used to ascertain that the plugin provides the listed commands.</p></li>
<li><p>If the option <b class="option">-check</b> is non-empty the specified command
prefix is called.</p></li>
<li><p>If either of the above fails the candidate plugin is unloaded again</p></li>
<li><p>Otherwise all the commands specified via the option
<b class="option">-cmds</b> are installed in the plugin.</p></li>
</ol>
<p>A previously loaded plugin is discarded, but only if the new plugin
was found and sucessfully validated and initialized. Note that there
will be no intereference between old and new plugin as both will be
put into separate safe interpreters.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">unload</b></a></dt>
<dd><p>This method unloads the currently loaded plugin. It returns the empty
string. The call will be silently ignored if no plugin is loaded at
all.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">list</b></a></dt>
<dd><p>This method uses the contents of the option <b class="option">-pattern</b> to find
all packages which can be plugins under the purview of this manager
object. It translates their names into plugin names and returns a list
containing them.</p></dd>
<dt><a name="16"><i class="arg">objectName</i> <b class="method">path</b> <i class="arg">path</i></a></dt>
<dd><p>This methods adds the specified <i class="arg">path</i> to the list of additional
package paths to look at when searching for a plugin. It returns the
empty string. Duplicate paths are ignored, i.e. each path is added
only once. Paths are made absolute, but are not normalized.</p></dd>
<dt><a name="17"><i class="arg">objectName</i> <b class="method">paths</b></a></dt>
<dd><p>This method returns a list containing all additional paths which have
been added to the plugin manager object since its creation.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">OBJECT CONFIGURATION</a></h3>
<p>All plugin manager objects understand the following configuration options:</p>
<dl class="options">
<dt><b class="option">-pattern</b> <i class="arg">string</i></dt>
<dd><p>The value of this option is a glob pattern which has to contain
exactly one '*'-operator. All packages whose names match this pattern
are the plugins recognized by the manager object. And vice versa, the
replacement of the '*'-operator with a plugin name will yield the name
of the package implementing that plugin.</p>
<p>This option has no default, except if option <b class="option">-name</b> was set.
It has to be set before attempting to load a plugin, either directly,
or through option <b class="option">-name</b>.</p></dd>
<dt><b class="option">-api</b> <i class="arg">list</i></dt>
<dd><p>The value of this option is a list of command names, and any plugin
loaded has to provide these commands. Names which are not fully
qualified are considered to be rooted in the global namespace.
If empty no expectations are made on the plugin. The default value is
the empty list.</p></dd>
<dt><b class="option">-check</b> <i class="arg">cmdprefix</i></dt>
<dd><p>The value of this option is interpreted as a command prefix.
Its purpose is to perform complex checks on a loaded plugin package to
validate it, which go beyond a simple list of provided commands.</p>
<p>It is called with the manager object command as the only argument and
has to return a boolean value. A value of <b class="const">true</b> will be
interpreted to mean that the candidate plugin passed the test.
The call will happen if and only if the candidate plugin already
passed the basic API check specified through the option <b class="option">-api</b>.</p>
<p>The default value is the empty list, which causes the manager object
to suppress the call and to assume the candidate plugin passes.</p></dd>
<dt><b class="option">-cmds</b> <i class="arg">dict</i></dt>
<dd><p>The value of this option is a dictionary.  It specifies the commands
which will be made available to the plugin (as keys), and the trusted
commands in the environment which implement them (as values).
The trusted commands will be executed in the interpreter specified by
the option <b class="option">-cmdip</b>.
The default value is the empty dictionary.</p></dd>
<dt><b class="option">-cmdip</b> <i class="arg">ipspec</i></dt>
<dd><p>The value of this option is the path of the interpreter where the
trusted commands given to the plugin will be executed in.
The default is the empty string, referring to the current interpreter.</p></dd>
<dt><b class="option">-setup</b> <i class="arg">cmdprefix</i></dt>
<dd><p>The value of this option is interpreted as a command prefix.</p>
<p>It is called whenever a new safe interpreter for a plugin has been
created, but before a plugin is loaded. It is provided with the
manager object command and the interpreter handle as its only
arguments. Any return value will be ignored.</p>
<p>Its purpose is give a user of the plugin management the ability to
define commands, packages, etc. a chosen plugin may need while being
loaded.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pluginmgr</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key168">plugin management</a>, <a href="../../../../index.html#key169">plugin search</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/png/png.html.































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>png - Image manipulation</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/png/png.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004, Code: Aaron Faupell &lt;[email protected]&gt;   -- Copyright &copy; 2004, Doc:  Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ png.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">png(n) 0.1.2 tcllib &quot;Image manipulation&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>png - PNG querying and manipulation of meta data</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">crc32</b></li>
<li>package require <b class="pkgname">png <span class="opt">?0.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::png::validate</b> <i class="arg">file</i></a></li>
<li><a href="#2"><b class="cmd">::png::isPNG</b> <i class="arg">file</i></a></li>
<li><a href="#3"><b class="cmd">::png::imageInfo</b> <i class="arg">file</i></a></li>
<li><a href="#4"><b class="cmd">::png::getTimestamp</b> <i class="arg">file</i></a></li>
<li><a href="#5"><b class="cmd">::png::setTimestamp</b> <i class="arg">file</i> <i class="arg">time</i></a></li>
<li><a href="#6"><b class="cmd">::png::getComments</b> <i class="arg">file</i></a></li>
<li><a href="#7"><b class="cmd">::png::removeComments</b> <i class="arg">file</i></a></li>
<li><a href="#8"><b class="cmd">::png::addComment</b> <i class="arg">file</i> <i class="arg">keyword</i> <i class="arg">text</i></a></li>
<li><a href="#9"><b class="cmd">::png::addComment</b> <i class="arg">file</i> <i class="arg">keyword</i> <i class="arg">lang</i> <i class="arg">keyword2</i> <i class="arg">text</i></a></li>
<li><a href="#10"><b class="cmd">::png::image</b> <i class="arg">file</i></a></li>
<li><a href="#11"><b class="cmd">::png::write</b> <i class="arg">file</i> <i class="arg">data</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to query and modify PNG images. PNG
stands for <i class="term">Portable Network Graphics</i> and is specified at
<a href="http://www.libpng.org/pub/png/spec/1.2">http://www.libpng.org/pub/png/spec/1.2</a>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::png::validate</b> <i class="arg">file</i></a></dt>
<dd><p>Returns a value indicating if <i class="arg">file</i> is a valid PNG file. The file
is checked for PNG signature, each chunks checksum is verified,
existence of a data chunk is verified, first chunk is checked for
header, last chunk is checked for ending. Things <em>not</em> checked
for are: validity of values within a chunk, multiple header chunks,
noncontiguous data chunks, end chunk before actual eof. This procedure
can take lots of time.</p>
<p>Possible return values:</p>
<dl class="definitions">
<dt>OK</dt>
<dd><p>File is a valid PNG file.</p></dd>
<dt>SIG</dt>
<dd><p>no/broken PNG signature.</p></dd>
<dt>BADLEN</dt>
<dd><p>corrupt chunk length.</p></dd>
<dt>EOF</dt>
<dd><p>premature end of file.</p></dd>
<dt>NOHDR</dt>
<dd><p>missing header chunk.</p></dd>
<dt>CKSUM</dt>
<dd><p>crc mismatch.</p></dd>
<dt>NODATA</dt>
<dd><p>missing data chunk(s).</p></dd>
<dt>NOEND</dt>
<dd><p>missing end marker.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::png::isPNG</b> <i class="arg">file</i></a></dt>
<dd><p>Returns a boolean value indicating if the file <i class="arg">file</i> starts with
a PNG signature. This is a much faster and less intensive check than
<b class="cmd">::png::validate</b> as it does not check if the PNG data is valid.</p></dd>
<dt><a name="3"><b class="cmd">::png::imageInfo</b> <i class="arg">file</i></a></dt>
<dd><p>Returns a dictionary with keys <b class="const">width</b>, <b class="const">height</b>,
<b class="const">depth</b>, <b class="const">color</b>, <b class="const">compression</b>, <b class="const">filter</b>, and
<b class="const">interlace</b>. The values are the associated properties of the PNG
image in <i class="arg">file</i>.
Throws an error if file is not a PNG image, or if the checksum of the
header is invalid. For information on interpreting the values for the
returned properties see
<a href="http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html">http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html</a>.</p></dd>
<dt><a name="4"><b class="cmd">::png::getTimestamp</b> <i class="arg">file</i></a></dt>
<dd><p>Returns the epoch time if a timestamp chunk is found in the PNG image
contained in the <i class="arg">file</i>, otherwise returns the empty string. Does
not attempt to verify the checksum of the timestamp chunk.
Throws an error if the <i class="arg">file</i> is not a valid PNG image.</p></dd>
<dt><a name="5"><b class="cmd">::png::setTimestamp</b> <i class="arg">file</i> <i class="arg">time</i></a></dt>
<dd><p>Writes a new timestamp to the <i class="arg">file</i>, either replacing the old
timestamp, or adding one just before the data chunks if there was no
previous timestamp. <i class="arg">time</i> is the new time in the gmt epoch
format.
Throws an error if <i class="arg">file</i> is not a valid PNG image.</p></dd>
<dt><a name="6"><b class="cmd">::png::getComments</b> <i class="arg">file</i></a></dt>
<dd><p>Currently supports only uncompressed comments. Does not attempt to
verify the checksums of the comment chunks. Returns a list where each
element is a comment. Each comment is itself a list. The list for a
plain text comment consists of 2 elements: the human readable keyword,
and the text data. A unicode (international) comment consists of 4
elements: the human readable keyword, the language identifier, the
translated keyword, and the unicode text data.
Throws an error if <i class="arg">file</i> is not a valid PNG image.</p></dd>
<dt><a name="7"><b class="cmd">::png::removeComments</b> <i class="arg">file</i></a></dt>
<dd><p>Removes all comments from the PNG image in <i class="arg">file</i>. Beware - This
uses memory equal to the file size minus comments, to hold the
intermediate result.
Throws an error if <i class="arg">file</i> is not a valid PNG image.</p></dd>
<dt><a name="8"><b class="cmd">::png::addComment</b> <i class="arg">file</i> <i class="arg">keyword</i> <i class="arg">text</i></a></dt>
<dd><p>Adds a plain <i class="arg">text</i> comment to the PNG image in <i class="arg">file</i>, just
before the first data chunk. Will throw an error if no data chunk is
found. <i class="arg">keyword</i> has to be less than 80 characters long to conform
to the PNG specification.</p></dd>
<dt><a name="9"><b class="cmd">::png::addComment</b> <i class="arg">file</i> <i class="arg">keyword</i> <i class="arg">lang</i> <i class="arg">keyword2</i> <i class="arg">text</i></a></dt>
<dd><p>Adds a unicode (international) comment to the PNG image in <i class="arg">file</i>,
just before the first data chunk. Will throw an error if no data chunk
is found. <i class="arg">keyword</i> has to be less than 80 characters long to
conform to the PNG specification. <i class="arg">keyword2</i> is the translated
<i class="arg">keyword</i>, in the language specified by the language identifier
<i class="arg">lang</i>.</p></dd>
<dt><a name="10"><b class="cmd">::png::image</b> <i class="arg">file</i></a></dt>
<dd><p>Given a PNG file returns the image in the list of scanlines format used by Tk_GetColor.</p></dd>
<dt><a name="11"><b class="cmd">::png::write</b> <i class="arg">file</i> <i class="arg">data</i></a></dt>
<dd><p>Takes a list of scanlines in the Tk_GetColor format and writes the represented image
to <i class="arg">file</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>png</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key146">comment</a>, <a href="../../../../index.html#key135">image</a>, <a href="../../../../index.html#key653">png</a>, <a href="../../../../index.html#key652">timestamp</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>File formats</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004, Code: Aaron Faupell &lt;[email protected]&gt;<br>
Copyright &copy; 2004, Doc:  Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pop3/pop3.html.




































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>pop3 - Tcl POP3 Client Library</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pop3/pop3.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ pop3.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pop3(n) 1.9 tcllib &quot;Tcl POP3 Client Library&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pop3 - Tcl client for POP3 email protocol</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Secure mail transfer</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">pop3 <span class="opt">?1.9?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pop3::open</b> <span class="opt">?<b class="option">-msex</b> 0|1?</span> <span class="opt">?<b class="option">-retr-mode</b> retr|list|slow?</span> <span class="opt">?<b class="option">-socketcmd</b> cmdprefix?</span> <span class="opt">?<b class="option">-stls</b> 0|1?</span> <span class="opt">?<b class="option">-tls-callback</b> stls-callback-command?</span> <i class="arg">host username password</i> <span class="opt">?<i class="arg">port</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::pop3::config</b> <i class="arg">chan</i></a></li>
<li><a href="#3"><b class="cmd">::pop3::status</b> <i class="arg">chan</i></a></li>
<li><a href="#4"><b class="cmd">::pop3::last</b> <i class="arg">chan</i></a></li>
<li><a href="#5"><b class="cmd">::pop3::retrieve</b> <i class="arg">chan startIndex</i> <span class="opt">?<i class="arg">endIndex</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::pop3::delete</b> <i class="arg">chan startIndex</i> <span class="opt">?<i class="arg">endIndex</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::pop3::list</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">msg</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::pop3::top</b> <i class="arg">chan</i> <i class="arg">msg</i> <i class="arg">n</i></a></li>
<li><a href="#9"><b class="cmd">::pop3::uidl</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">msg</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::pop3::capa</b> <i class="arg">chan</i></a></li>
<li><a href="#11"><b class="cmd">::pop3::close</b> <i class="arg">chan</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">pop3</b> package provides a simple Tcl-only client library
for the POP3 email protocol as specified in
<a href="http://www.rfc-editor.org/rfc/rfc1939.txt">RFC 1939</a>.
It works by opening the standard POP3 socket on the server,
transmitting the username and password, then providing a Tcl API to
access the POP3 protocol commands.  All server errors are returned as
Tcl errors (thrown) which must be caught with the Tcl <b class="cmd">catch</b>
command.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pop3::open</b> <span class="opt">?<b class="option">-msex</b> 0|1?</span> <span class="opt">?<b class="option">-retr-mode</b> retr|list|slow?</span> <span class="opt">?<b class="option">-socketcmd</b> cmdprefix?</span> <span class="opt">?<b class="option">-stls</b> 0|1?</span> <span class="opt">?<b class="option">-tls-callback</b> stls-callback-command?</span> <i class="arg">host username password</i> <span class="opt">?<i class="arg">port</i>?</span></a></dt>
<dd><p>Open a socket connection to the server specified by <i class="arg">host</i>,
transmit the <i class="arg">username</i> and <i class="arg">password</i> as login information to
the server.  The default port number is <b class="const">110</b>, which can be
overridden using the optional <i class="arg">port</i> argument.  The return value
is a channel used by all of the other ::pop3 functions.</p>
<p>The command recognizes three options</p>
<dl class="options">
<dt><b class="option">-msex</b> boolean</dt>
<dd><p>Setting this option tells the package that the server we are talking
to is an MS Exchange server (which has some oddities we have to work
around). The default is <b class="const">False</b>.</p></dd>
<dt><b class="option">-retr-mode</b> retr|list|slow</dt>
<dd><p>The retrieval mode determines how exactly messages are read from the
server.
The allowed values are <b class="const">retr</b>, <b class="const">list</b> and <b class="const">slow</b>.
The default is <b class="const">retr</b>. See <b class="cmd">::pop3::retrieve</b> for more
information.</p></dd>
<dt><b class="option">-socketcmd</b> cmdprefix</dt>
<dd><p>This option allows the user to overide the use of the builtin
<b class="cmd"><a href="../../../../index.html#key311">socket</a></b> command with any API-compatible command. The envisioned
main use is the securing of the new connection via SSL, through the
specification of the command <b class="cmd">tls::socket</b>. This command is
specially recognized as well, changing the default port of the
connection to <b class="const">995</b>.</p></dd>
<dt><b class="option">-stls</b> boolean</dt>
<dd><p>Setting this option tells the package to secure the connection using
SSL or TLS. It performs STARTTLS as described in IETF RFC 2595, it
first opens a normal, unencrypted connection and then negotiates a
SSLv3 or TLSv1 connection. If the connection cannot be secured, the
connection will be closed and an error will be returned</p></dd>
<dt><b class="option">-tls-callback</b> stls-callback-command</dt>
<dd><p>This option allows the user to overide the <b class="cmd">tls::callback</b> used during
the <b class="const">-stls</b> SSL/TLS handshake. See the TLS manual for details on how
to implement this callback.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::pop3::config</b> <i class="arg">chan</i></a></dt>
<dd><p>Returns the configuration of the pop3 connection identified by the
channel handle <i class="arg">chan</i> as a serialized array.</p></dd>
<dt><a name="3"><b class="cmd">::pop3::status</b> <i class="arg">chan</i></a></dt>
<dd><p>Query the server for the status of the mail spool.  The status is
returned as a list containing two elements, the first is the number of
email messages on the server and the second is the size (in octets, 8
bit blocks) of the entire mail spool.</p></dd>
<dt><a name="4"><b class="cmd">::pop3::last</b> <i class="arg">chan</i></a></dt>
<dd><p>Query the server for the last email message read from the spool.  This
value includes all messages read from all clients connecting to the
login account.  This command may not be supported by the email server,
in which case the server may return 0 or an error.</p></dd>
<dt><a name="5"><b class="cmd">::pop3::retrieve</b> <i class="arg">chan startIndex</i> <span class="opt">?<i class="arg">endIndex</i>?</span></a></dt>
<dd><p>Retrieve a range of messages from the server.  If the <i class="arg">endIndex</i>
is not specified, only one message will be retrieved.  The return
value is a list containing each message as a separate element.  See
the <i class="arg">startIndex</i> and <i class="arg">endIndex</i> descriptions below.</p>
<p>The retrieval mode determines how exactly messages are read from the
server. The mode <b class="const">retr</b> assumes that the RETR command delivers
the size of the message as part of the command status and uses this to
read the message efficiently. In mode <b class="const">list</b> RETR does not
deliver the size, but the LIST command does and we use this to
retrieve the message size before the actual retrieval, which can then
be done efficiently. In the last mode, <b class="const">slow</b>, the system is
unable to obtain the size of the message to retrieve in any manner and
falls back to reading the message from the server line by line.</p>
<p>It should also be noted that the system checks upon the configured
mode and falls back to the slower modes if the above assumptions are
not true.</p></dd>
<dt><a name="6"><b class="cmd">::pop3::delete</b> <i class="arg">chan startIndex</i> <span class="opt">?<i class="arg">endIndex</i>?</span></a></dt>
<dd><p>Delete a range of messages from the server.  If the <i class="arg">endIndex</i> is
not specified, only one message will be deleted.  Note, the indices
are not reordered on the server, so if you delete message 1, then the
first message in the queue is message 2 (message index 1 is no longer
valid).  See the <i class="arg">startIndex</i> and <i class="arg">endIndex</i> descriptions
below.</p>
<dl class="definitions">
<dt><i class="arg">startIndex</i></dt>
<dd><p>The <i class="arg">startIndex</i> may be an index of a specific message starting
with the index 1, or it have any of the following values:</p>
<dl class="definitions">
<dt><b class="const">start</b></dt>
<dd><p>This is a logical value for the first message in the spool, equivalent
to the value 1.</p></dd>
<dt><b class="const">next</b></dt>
<dd><p>The message immediately following the last message read, see
<b class="cmd">::pop3::last</b>.</p></dd>
<dt><b class="const">end</b></dt>
<dd><p>The most recent message in the spool (the end of the spool).  This is
useful to retrieve only the most recent message.</p></dd>
</dl></dd>
<dt><i class="arg">endIndex</i></dt>
<dd><p>The <i class="arg">endIndex</i> is an optional parameter and defaults to the value
&quot;-1&quot;, which indicates to only retrieve the one message specified by
<i class="arg">startIndex</i>.  If specified, it may be an index of a specific
message starting with the index &quot;1&quot;, or it may have any of the
following values:</p>
<dl class="definitions">
<dt><b class="const">last</b></dt>
<dd><p>The message is the last message read by a POP3 client, see
<b class="cmd">::pop3::last</b>.</p></dd>
<dt><b class="const">end</b></dt>
<dd><p>The most recent message in the spool (the end of the spool).</p></dd>
</dl></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::pop3::list</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">msg</i>?</span></a></dt>
<dd><p>Returns the scan listing of the mailbox. If parameter <i class="arg">msg</i> is
given, then the listing only for that message is returned.</p></dd>
<dt><a name="8"><b class="cmd">::pop3::top</b> <i class="arg">chan</i> <i class="arg">msg</i> <i class="arg">n</i></a></dt>
<dd><p>Optional POP3 command, not all servers may support this.
<b class="cmd">::pop3::top</b> retrieves headers of a message, specified by
parameter <i class="arg">msg</i>, and number of <i class="arg">n</i> lines from the message
body.</p></dd>
<dt><a name="9"><b class="cmd">::pop3::uidl</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">msg</i>?</span></a></dt>
<dd><p>Optional POP3 command, not all servers may support this. 
<b class="cmd">::pop3::uidl</b> returns the uid listing of the mailbox. If the
parameter <i class="arg">msg</i> is specified, then the listing only for that
message is returned.</p></dd>
<dt><a name="10"><b class="cmd">::pop3::capa</b> <i class="arg">chan</i></a></dt>
<dd><p>Optional POP3 command, not all servers may support this. 
<b class="cmd">::pop3::capa</b> returns a list of the capabilities of the server.
TOP, SASL, UIDL, LOGIN-DELAY and STLS are typical capabilities.
See IETF RFC 2449.</p></dd>
<dt><a name="11"><b class="cmd">::pop3::close</b> <i class="arg">chan</i></a></dt>
<dd><p>Gracefully close the connect after sending a POP3 QUIT command down
the socket.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Secure mail transfer</a></h2>
<p>A pop3 connection can be secured with SSL/TLS by requiring the package
<b class="package"><a href="../../../../index.html#key289">TLS</a></b> and then using either the option <b class="option">-socketcmd</b> or
the option <b class="option">-stls</b> of the command <b class="cmd">pop3::open</b>.
The first method, option <b class="option">-socketcmd</b>, will force the use
of the <b class="cmd">tls::socket</b> command when opening the connection. This is
suitable for POP3 servers which expect SSL connections only. These will
generally be listening on port 995.</p>
<pre class="example">
	package require tls
	tls::init -cafile /path/to/ca/cert -keyfile ...
	# Create secured pop3 channel
	pop3::open -socketcmd tls::socket \\
		$thehost $theuser $thepassword
	...
</pre>
<p>The second method, option <b class="option">-stls</b>, will connect to the standard POP3
port and then perform an STARTTLS handshake. This will only work for POP3
servers which have this capability. The package will confirm that the
server supports STARTTLS and the handshake was performed correctly before
proceeding with authentication.</p>
<pre class="example">
	package require tls
	tls::init -cafile /path/to/ca/cert -keyfile ...
	# Create secured pop3 channel
	pop3::open -stls 1 \\
		$thehost $theuser $thepassword
	...
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pop3</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key293">email</a>, <a href="../../../../index.html#key288">mail</a>, <a href="../../../../index.html#key396">pop</a>, <a href="../../../../index.html#key395">pop3</a>, <a href="../../../../index.html#key394">rfc 1939</a>, <a href="../../../../index.html#key315">secure</a>, <a href="../../../../index.html#key318">ssl</a>, <a href="../../../../index.html#key289">tls</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pop3d/pop3d.html.















































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pop3d - Tcl POP3 Server Package</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pop3d/pop3d.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002-2009 Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2005 Reinhard Max  &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pop3d.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pop3d(n) 1.1.0 tcllib &quot;Tcl POP3 Server Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pop3d - Tcl POP3 server implementation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Options</a></li>
<li class="section"><a href="#section3">Authentication</a></li>
<li class="section"><a href="#section4">Mailboxes</a></li>
<li class="section"><a href="#section5">Secure mail transfer</a></li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">pop3d <span class="opt">?1.1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pop3d::new</b> <span class="opt">?<i class="arg">serverName</i>?</span></a></li>
<li><a href="#2"><b class="cmd">serverName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">serverName</i> <b class="method">up</b></a></li>
<li><a href="#4"><i class="arg">serverName</i> <b class="method">down</b></a></li>
<li><a href="#5"><i class="arg">serverName</i> <b class="method">destroy</b> <span class="opt">?<i class="arg">mode</i>?</span></a></li>
<li><a href="#6"><i class="arg">serverName</i> <b class="method">configure</b></a></li>
<li><a href="#7"><i class="arg">serverName</i> <b class="method">configure</b> <i class="arg">-option</i></a></li>
<li><a href="#8"><i class="arg">serverName</i> <b class="method">configure</b> <i class="arg">-option value</i>...</a></li>
<li><a href="#9"><i class="arg">serverName</i> <b class="method">cget</b> <i class="arg">-option</i></a></li>
<li><a href="#10"><i class="arg">serverName</i> <b class="method">conn</b> list</a></li>
<li><a href="#11"><i class="arg">serverName</i> <b class="method">conn</b> state <i class="arg">id</i></a></li>
<li><a href="#12"><i class="arg">authCmd</i> <b class="method">exists</b> <i class="arg">name</i></a></li>
<li><a href="#13"><i class="arg">authCmd</i> <b class="method">lookup</b> <i class="arg">name</i></a></li>
<li><a href="#14"><i class="arg">storageCmd</i> <b class="method">dele</b> <i class="arg">mbox</i> <i class="arg">msgList</i></a></li>
<li><a href="#15"><i class="arg">storageCmd</i> <b class="method">lock</b> <i class="arg">mbox</i></a></li>
<li><a href="#16"><i class="arg">storageCmd</i> <b class="method">unlock</b> <i class="arg">mbox</i></a></li>
<li><a href="#17"><i class="arg">storageCmd</i> <b class="method">size</b> <i class="arg">mbox</i> <span class="opt">?<i class="arg">msgId</i>?</span></a></li>
<li><a href="#18"><i class="arg">storageCmd</i> <b class="method">stat</b> <i class="arg">mbox</i></a></li>
<li><a href="#19"><i class="arg">storageCmd</i> <b class="method">get</b> <i class="arg">mbox</i> <i class="arg">msgId</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pop3d::new</b> <span class="opt">?<i class="arg">serverName</i>?</span></a></dt>
<dd><p>This command creates a new server object with an associated global Tcl
command whose name is <i class="arg">serverName</i>.</p></dd>
</dl>
<p>The command <b class="cmd">serverName</b> may be used to invoke various operations
on the server.  It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">serverName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>A pop3 server can be started on any port the caller has permission for
from the operating system. The default port will be 110, which is the
port defined by the standard specified in
RFC 1939 (<a href="http://www.rfc-editor.org/rfc/rfc1939.txt">http://www.rfc-editor.org/rfc/rfc1939.txt</a>).
After creating, configuring and starting a the server object will
listen for and accept connections on that port and handle them
according to the POP3 protocol.</p>
<p><em>Note:</em> The server provided by this module will handle only the
basic protocol by itself. For the higher levels of user authentication
and handling of the actual mailbox contents callbacks will be invoked.</p>
<p>The following commands are possible for server objects:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">serverName</i> <b class="method">up</b></a></dt>
<dd><p>After this call the server will listen for connections on its configured port.</p></dd>
<dt><a name="4"><i class="arg">serverName</i> <b class="method">down</b></a></dt>
<dd><p>After this call the server will stop listening for connections. This
does not affect existing connections.</p></dd>
<dt><a name="5"><i class="arg">serverName</i> <b class="method">destroy</b> <span class="opt">?<i class="arg">mode</i>?</span></a></dt>
<dd><p>Destroys the server object. Currently open connections are handled
depending on the chosen mode.
The provided <i class="arg">mode</i>s are:</p>
<dl class="definitions">
<dt><b class="const">kill</b></dt>
<dd><p>Destroys the server immediately, and forcefully closes all currently
open connections. This is the default mode.</p></dd>
<dt><b class="const">defer</b></dt>
<dd><p>Stops the server from accepting new connections and will actually
destroy it only after the last of the currently open connections for
the server is closed.</p></dd>
</dl></dd>
<dt><a name="6"><i class="arg">serverName</i> <b class="method">configure</b></a></dt>
<dd><p>Returns a list containing all options and their current values in a
format suitable for use by the command <b class="cmd">array set</b>. The options
themselves are described in section <span class="sectref"><a href="#section2">Options</a></span>.</p></dd>
<dt><a name="7"><i class="arg">serverName</i> <b class="method">configure</b> <i class="arg">-option</i></a></dt>
<dd><p>Returns the current value of the specified option. This is an alias
for the method <b class="method">cget</b>. The options themselves are described in
section <span class="sectref"><a href="#section2">Options</a></span>.</p></dd>
<dt><a name="8"><i class="arg">serverName</i> <b class="method">configure</b> <i class="arg">-option value</i>...</a></dt>
<dd><p>Sets the specified option to the provided value. The options
themselves are described in section <span class="sectref"><a href="#section2">Options</a></span>.</p></dd>
<dt><a name="9"><i class="arg">serverName</i> <b class="method">cget</b> <i class="arg">-option</i></a></dt>
<dd><p>Returns the current value of the specified option. The options
themselves are described in section <span class="sectref"><a href="#section2">Options</a></span>.</p></dd>
<dt><a name="10"><i class="arg">serverName</i> <b class="method">conn</b> list</a></dt>
<dd><p>Returns a list containing the ids of all connections currently open.</p></dd>
<dt><a name="11"><i class="arg">serverName</i> <b class="method">conn</b> state <i class="arg">id</i></a></dt>
<dd><p>Returns a list suitable for [<b class="cmd">array set</b>] containing the
state of the connection referenced by <i class="arg">id</i>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">Options</a></h2>
<p>The following options are available to pop3 server objects.</p>
<dl class="definitions">
<dt><b class="option">-port</b> <i class="arg">port</i></dt>
<dd><p>Defines the <i class="arg">port</i> to listen on for new connections. Default is
110. This option is a bit special. If <i class="arg">port</i> is set to &quot;0&quot; the
server, or rather the operating system, will select a free port on its
own. When querying <b class="option">-port</b> the id of this chosen port will be
returned. Changing the port while the server is up will neither change
the returned value, nor will it change on which port the server is
listening on. Only after resetting the server via a call to
<b class="method">down</b> followed by a call to <b class="method">up</b> will the new port take
effect. It is at that time that the value returned when querying
<b class="option">-port</b> will change too.</p></dd>
<dt><b class="option">-auth</b> <i class="arg">command</i></dt>
<dd><p>Defines a <i class="arg">command</i> prefix to call whenever the authentication of
a user is required. If no such command is specified the server will
reject all users. The interface which has to be provided by the
command prefix is described in section <span class="sectref"><a href="#section3">Authentication</a></span>.</p></dd>
<dt><b class="option">-storage</b> <i class="arg">command</i></dt>
<dd><p>Defines a <i class="arg">command</i> prefix to call whenever the handling of
mailbox contents is required. If no such command is specified the
server will claim that all mailboxes are empty. The interface which
has to be provided by the command prefix is described in section
<span class="sectref"><a href="#section4">Mailboxes</a></span>.</p></dd>
<dt><b class="option">-socket</b> <i class="arg">command</i></dt>
<dd><p>Defines a <i class="arg">command</i> prefix to call for opening the listening socket.
This can be used to make the pop3 server listen on a SSL socket
as provided by the <b class="package"><a href="../../../../index.html#key289">tls</a></b> package, see the command <b class="cmd">tls::socket</b>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Authentication</a></h2>
<p>Here we describe the interface which has to be provided by the
authentication callback so that pop3 servers following the interface
of this module are able to use it.</p>
<dl class="definitions">
<dt><a name="12"><i class="arg">authCmd</i> <b class="method">exists</b> <i class="arg">name</i></a></dt>
<dd><p>This method is given a user<i class="arg">name</i> and has to return a boolean
value telling whether or not the specified user exists.</p></dd>
<dt><a name="13"><i class="arg">authCmd</i> <b class="method">lookup</b> <i class="arg">name</i></a></dt>
<dd><p>This method is given a user<i class="arg">name</i> and has to return a two-element
list containing the password for this user and a storage reference, in
this order.</p>
<p>The storage reference is passed unchanged to the storage callback, see
sections <span class="sectref"><a href="#section2">Options</a></span> and <span class="sectref"><a href="#section4">Mailboxes</a></span> for either the
option defining it and or the interface to provide, respectively.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Mailboxes</a></h2>
<p>Here we describe the interface which has to be provided by the storage
callback so that pop3 servers following the interface of this module
are able to use it. The <i class="arg">mbox</i> argument is the storage reference
as returned by the <b class="method">lookup</b> method of the authentication
command, see section <span class="sectref"><a href="#section3">Authentication</a></span>.</p>
<dl class="definitions">
<dt><a name="14"><i class="arg">storageCmd</i> <b class="method">dele</b> <i class="arg">mbox</i> <i class="arg">msgList</i></a></dt>
<dd><p>]
Deletes the messages whose numeric ids are contained in the
<i class="arg">msgList</i> from the mailbox specified via <i class="arg">mbox</i>.</p></dd>
<dt><a name="15"><i class="arg">storageCmd</i> <b class="method">lock</b> <i class="arg">mbox</i></a></dt>
<dd><p>This method locks the specified mailbox for use by a single connection
to the server. This is necessary to prevent havoc if several
connections to the same mailbox are open. The complementary method is
<b class="method">unlock</b>. The command will return true if the lock could be set
successfully or false if not.</p></dd>
<dt><a name="16"><i class="arg">storageCmd</i> <b class="method">unlock</b> <i class="arg">mbox</i></a></dt>
<dd><p>This is the complementary method to <b class="method">lock</b>, it revokes the lock
on the specified mailbox.</p></dd>
<dt><a name="17"><i class="arg">storageCmd</i> <b class="method">size</b> <i class="arg">mbox</i> <span class="opt">?<i class="arg">msgId</i>?</span></a></dt>
<dd><p>Determines the size of the message specified through its id in
<i class="arg">msgId</i>, in bytes, and returns this number. The command will
return the size of the whole maildrop if no message id was specified.</p></dd>
<dt><a name="18"><i class="arg">storageCmd</i> <b class="method">stat</b> <i class="arg">mbox</i></a></dt>
<dd><p>Determines the number of messages in the specified mailbox and returns
this number.</p></dd>
<dt><a name="19"><i class="arg">storageCmd</i> <b class="method">get</b> <i class="arg">mbox</i> <i class="arg">msgId</i></a></dt>
<dd><p>Returns a handle for the specified message. This handle is a mime
token following the interface described in the documentation of
package <b class="package"><a href="../mime/mime.html">mime</a></b>. The pop3 server will use the functionality of
the mime token to send the mail to the requestor at the other end of a
pop3 connection.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Secure mail transfer</a></h2>
<p>The option <b class="option">-socket</b> (see <span class="sectref"><a href="#section2">Options</a></span>) enables users of
the package to override how the server opens its listening socket.
The envisioned main use is the specification of the <b class="cmd">tls::socket</b>
command, see package <b class="package"><a href="../../../../index.html#key289">tls</a></b>, to secure the communication.</p>
<pre class="example">
	package require tls
	tls::init \\
		...
	pop3d::new S -socket tls::socket
	...
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pop3d</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key624">network</a>, <a href="../../../../index.html#key395">pop3</a>, <a href="../../../../index.html#key125">protocol</a>, <a href="../../../../index.html#key394">rfc 1939</a>, <a href="../../../../index.html#key315">secure</a>, <a href="../../../../index.html#key318">ssl</a>, <a href="../../../../index.html#key289">tls</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002-2009 Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2005 Reinhard Max  &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pop3d/pop3d_dbox.html.





































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pop3d::dbox - Tcl POP3 Server Package</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pop3d/pop3d_dbox.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pop3d::dbox.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pop3d::dbox(n) 1.0.2 tcllib &quot;Tcl POP3 Server Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pop3d::dbox - Simple mailbox database for pop3d</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">pop3d::dbox <span class="opt">?1.0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pop3d::dbox::new</b> <span class="opt">?<i class="arg">dbName</i>?</span></a></li>
<li><a href="#2"><b class="cmd">dbName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">dbName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">dbName</i> <b class="method">base</b> <i class="arg">base</i></a></li>
<li><a href="#5"><i class="arg">dbName</i> <b class="method">add</b> <i class="arg">mbox</i></a></li>
<li><a href="#6"><i class="arg">dbName</i> <b class="method">remove</b> <i class="arg">mbox</i></a></li>
<li><a href="#7"><i class="arg">dbName</i> <b class="method">move</b> <i class="arg">old new</i></a></li>
<li><a href="#8"><i class="arg">dbName</i> <b class="method">list</b></a></li>
<li><a href="#9"><i class="arg">dbName</i> <b class="method">exists</b> <i class="arg">mbox</i></a></li>
<li><a href="#10"><i class="arg">dbName</i> <b class="method">locked</b> <i class="arg">mbox</i></a></li>
<li><a href="#11"><i class="arg">dbName</i> <b class="method">lock</b> <i class="arg">mbox</i></a></li>
<li><a href="#12"><i class="arg">dbName</i> <b class="method">unlock</b> <i class="arg">mbox</i></a></li>
<li><a href="#13"><i class="arg">dbName</i> <b class="method">stat</b> <i class="arg">mbox</i></a></li>
<li><a href="#14"><i class="arg">dbName</i> <b class="method">size</b> <i class="arg">mbox</i> <span class="opt">?<i class="arg">msgId</i>?</span></a></li>
<li><a href="#15"><i class="arg">dbName</i> <b class="method">dele</b> <i class="arg">mbox msgList</i></a></li>
<li><a href="#16"><i class="arg">storageCmd</i> <b class="method">get</b> <i class="arg">mbox</i> <i class="arg">msgId</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">pop3d::dbox</b> provides simple/basic mailbox
management facilities. Each mailbox object manages a single base
directory whose subdirectories represent the managed mailboxes. Mails
in a mailbox are represented by files in a mailbox directory, where
each of these files contains a single mail, both headers and body, in
RFC 822 (<a href="http://www.rfc-editor.org/rfc/rfc822.txt">http://www.rfc-editor.org/rfc/rfc822.txt</a>) conformant
format.</p>
<p>Any mailbox object following the interface described below can be used
in conjunction with the pop3 server core provided by the package
<b class="package"><a href="pop3d.html">pop3d</a></b>. It is especially possible to directly use the objects
created by this package in the storage callback of pop3 servers
following the same interface as servers created by the package
<b class="package"><a href="pop3d.html">pop3d</a></b>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pop3d::dbox::new</b> <span class="opt">?<i class="arg">dbName</i>?</span></a></dt>
<dd><p>This command creates a new database object with an associated global
Tcl command whose name is <i class="arg">dbName</i>.</p></dd>
</dl>
<p>The command <b class="cmd">dbName</b> may be used to invoke various operations on
the database.  It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">dbName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>The following commands are possible for database objects:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">dbName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the mailbox database and all transient data. The directory
associated with the object is not destroyed.</p></dd>
<dt><a name="4"><i class="arg">dbName</i> <b class="method">base</b> <i class="arg">base</i></a></dt>
<dd><p>Defines the base directory containing the mailboxes to manage. If this
method is not called none of the following methods will work.</p></dd>
<dt><a name="5"><i class="arg">dbName</i> <b class="method">add</b> <i class="arg">mbox</i></a></dt>
<dd><p>Adds a mailbox of name <i class="arg">mbox</i> to the database. The name must be a
valid path component.</p></dd>
<dt><a name="6"><i class="arg">dbName</i> <b class="method">remove</b> <i class="arg">mbox</i></a></dt>
<dd><p>Removes the mailbox specified through <i class="arg">mbox</i>, and the mails
contained therein, from the database. This method will fail if the
specified mailbox is locked.</p></dd>
<dt><a name="7"><i class="arg">dbName</i> <b class="method">move</b> <i class="arg">old new</i></a></dt>
<dd><p>Changes the name of the mailbox <i class="arg">old</i> to <i class="arg">new</i>.</p></dd>
<dt><a name="8"><i class="arg">dbName</i> <b class="method">list</b></a></dt>
<dd><p>Returns a list containing the names of all mailboxes in the directory
associated with the database.</p></dd>
<dt><a name="9"><i class="arg">dbName</i> <b class="method">exists</b> <i class="arg">mbox</i></a></dt>
<dd><p>Returns true if the mailbox with name <i class="arg">mbox</i> exists in the
database, or false if not.</p></dd>
<dt><a name="10"><i class="arg">dbName</i> <b class="method">locked</b> <i class="arg">mbox</i></a></dt>
<dd><p>Checks if the mailbox specified through <i class="arg">mbox</i> is currently locked.</p></dd>
<dt><a name="11"><i class="arg">dbName</i> <b class="method">lock</b> <i class="arg">mbox</i></a></dt>
<dd><p>This method locks the specified mailbox for use by a single connection
to the server. This is necessary to prevent havoc if several
connections to the same mailbox are open. The complementary method is
<b class="method">unlock</b>. The command will return true if the lock could be set
successfully or false if not.</p></dd>
<dt><a name="12"><i class="arg">dbName</i> <b class="method">unlock</b> <i class="arg">mbox</i></a></dt>
<dd><p>This is the complementary method to <b class="method">lock</b>, it revokes the lock
on the specified mailbox.</p></dd>
<dt><a name="13"><i class="arg">dbName</i> <b class="method">stat</b> <i class="arg">mbox</i></a></dt>
<dd><p>Determines the number of messages in the specified mailbox and returns
this number. This method fails if the mailbox <i class="arg">mbox</i> is not
locked.</p></dd>
<dt><a name="14"><i class="arg">dbName</i> <b class="method">size</b> <i class="arg">mbox</i> <span class="opt">?<i class="arg">msgId</i>?</span></a></dt>
<dd><p>Determines the size of the message specified through its id in
<i class="arg">msgId</i>, in bytes, and returns this number. The command will
return the size of the whole maildrop if no message id was specified.
If specified the <i class="arg">msgId</i> has to be in the range &quot;1 ... [<i class="arg">dbName</i> <b class="method">stat</b>]&quot;
or this call will fail. If <b class="method">stat</b> was not called before this
call, <b class="method">size</b> will assume that there are zero messages in the
mailbox.</p></dd>
<dt><a name="15"><i class="arg">dbName</i> <b class="method">dele</b> <i class="arg">mbox msgList</i></a></dt>
<dd><p>Deletes the messages whose numeric ids are contained in the
<i class="arg">msgList</i> from the mailbox specified via <i class="arg">mbox</i>.
The <i class="arg">msgList</i> must not be empty or this call will fail.
The numeric ids in <i class="arg">msgList</i> have to be in the range &quot;1 ...
[<i class="arg">dbName</i> <b class="method">stat</b>]&quot; or this
call will fail. If <b class="method">stat</b> was not called
before this call, <b class="method">dele</b> will assume
that there are zero messages in the mailbox.</p></dd>
<dt><a name="16"><i class="arg">storageCmd</i> <b class="method">get</b> <i class="arg">mbox</i> <i class="arg">msgId</i></a></dt>
<dd><p>Returns a handle for the specified message. This handle is a mime
token following the interface described in the documentation of
package <b class="package"><a href="../mime/mime.html">mime</a></b>. The token is <em>read-only</em>. In other
words, the caller is allowed to do anything with the token except to
modify it.
The <i class="arg">msgId</i> has to be in the range &quot;1 ...
[<i class="arg">dbName</i> <b class="method">stat</b>]&quot; or this
call will fail. If <b class="method">stat</b> was not called
before this call, <b class="method">get</b> will assume
that there are zero messages in the mailbox.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pop3d</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key624">network</a>, <a href="../../../../index.html#key395">pop3</a>, <a href="../../../../index.html#key125">protocol</a>, <a href="../../../../index.html#key291">rfc 822</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pop3d/pop3d_udb.html.




























































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pop3d::udb - Tcl POP3 Server Package</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pop3d/pop3d_udb.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pop3d::udb.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pop3d::udb(n) 1.0.1 tcllib &quot;Tcl POP3 Server Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pop3d::udb - Simple user database for pop3d</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">pop3d::udb <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pop3d::udb::new</b> <span class="opt">?<i class="arg">dbName</i>?</span></a></li>
<li><a href="#2"><b class="cmd">dbName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">dbName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">dbName</i> <b class="method">add</b> <i class="arg">user pwd storage</i></a></li>
<li><a href="#5"><i class="arg">dbName</i> <b class="method">remove</b> <i class="arg">user</i></a></li>
<li><a href="#6"><i class="arg">dbName</i> <b class="method">rename</b> <i class="arg">user newName</i></a></li>
<li><a href="#7"><i class="arg">dbName</i> <b class="method">lookup</b> <i class="arg">user</i></a></li>
<li><a href="#8"><i class="arg">dbName</i> <b class="method">exists</b> <i class="arg">user</i></a></li>
<li><a href="#9"><i class="arg">dbName</i> <b class="method">who</b></a></li>
<li><a href="#10"><i class="arg">dbName</i> <b class="method">save</b> <span class="opt">?<i class="arg">file</i>?</span></a></li>
<li><a href="#11"><i class="arg">dbName</i> <b class="method">read</b> <i class="arg">file</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">pop3d::udb</b> provides simple in memory databases
which can be used in conjunction with the pop3 server core provided by
the package <b class="package"><a href="pop3d.html">pop3d</a></b>. The databases will use the names of users
as keys and associates passwords and storage references with them.</p>
<p>Objects created by this package can be directly used in the
authentication callback of pop3 servers following the same interface
as servers created by the package <b class="package"><a href="pop3d.html">pop3d</a></b>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pop3d::udb::new</b> <span class="opt">?<i class="arg">dbName</i>?</span></a></dt>
<dd><p>This command creates a new database object with an associated global
Tcl command whose name is <i class="arg">dbName</i>.</p></dd>
</dl>
<p>The command <b class="cmd">dbName</b> may be used to invoke various operations on
the database.  It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">dbName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>The following commands are possible for database objects:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">dbName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the database object.</p></dd>
<dt><a name="4"><i class="arg">dbName</i> <b class="method">add</b> <i class="arg">user pwd storage</i></a></dt>
<dd><p>Add a new user or changes the data of an existing user. Stores
<i class="arg">password</i> and <i class="arg">storage</i> reference for the given <i class="arg">user</i>.</p></dd>
<dt><a name="5"><i class="arg">dbName</i> <b class="method">remove</b> <i class="arg">user</i></a></dt>
<dd><p>Removes the specified <i class="arg">user</i> from the database.</p></dd>
<dt><a name="6"><i class="arg">dbName</i> <b class="method">rename</b> <i class="arg">user newName</i></a></dt>
<dd><p>Changes the name of the specified <i class="arg">user</i> to <i class="arg">newName</i>.</p></dd>
<dt><a name="7"><i class="arg">dbName</i> <b class="method">lookup</b> <i class="arg">user</i></a></dt>
<dd><p>Searches the database for the specified <i class="arg">user</i> and returns a
two-element list containing the associated password and storage
reference, in this order. Throws an error if the user could not be
found. This is the interface as expected by the authentication
callback of package <b class="package"><a href="pop3d.html">pop3d</a></b>.</p></dd>
<dt><a name="8"><i class="arg">dbName</i> <b class="method">exists</b> <i class="arg">user</i></a></dt>
<dd><p>Returns true if the specified <i class="arg">user</i> is known to the database,
else false.</p></dd>
<dt><a name="9"><i class="arg">dbName</i> <b class="method">who</b></a></dt>
<dd><p>Returns a list of users known to the database.</p></dd>
<dt><a name="10"><i class="arg">dbName</i> <b class="method">save</b> <span class="opt">?<i class="arg">file</i>?</span></a></dt>
<dd><p>Saves the contents of the database into the given <i class="arg">file</i>. If the
file is not specified the system will use the path last used in a call
to <i class="arg">dbName</i> <b class="method">read</b>. The generated file can be read by the
<b class="method">read</b> method.</p></dd>
<dt><a name="11"><i class="arg">dbName</i> <b class="method">read</b> <i class="arg">file</i></a></dt>
<dd><p>Reads the specified <i class="arg">file</i> and adds the contained user definitions
to the database. As the file is actually <b class="cmd"><a href="../../../../index.html#key388">source</a></b>'d a safe
interpreter is employed to safeguard against malicious code. This
interpreter knows the <b class="cmd">add</b> command for adding users and their
associated data to this database. This command has the same argument
signature as the method <b class="method">add</b>. The path of the <i class="arg">file</i> is
remembered internally so that it can be used in the next call of
<i class="arg">dbName</i> <b class="method">save</b> without an argument.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pop3d</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key122">internet</a>, <a href="../../../../index.html#key624">network</a>, <a href="../../../../index.html#key395">pop3</a>, <a href="../../../../index.html#key125">protocol</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/profiler/profiler.html.































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>profiler - Tcl Profiler</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/profiler/profiler.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ profiler.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">profiler(n) 0.3 tcllib &quot;Tcl Profiler&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>profiler - Tcl source code profiler</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">profiler <span class="opt">?0.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::profiler::init</b></a></li>
<li><a href="#2"><b class="cmd">::profiler::dump</b> <i class="arg">pattern</i></a></li>
<li><a href="#3"><b class="cmd">::profiler::print</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::profiler::reset</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::profiler::suspend</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::profiler::resume</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::profiler::sortFunctions</b> <i class="arg">key</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">profiler</b> package provides a simple Tcl source code
profiler.  It is a function-level profiler; that is, it collects only
function-level information, not the more detailed line-level
information.  It operates by redefining the Tcl <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> command.
Profiling is initiated via the <b class="cmd">::profiler::init</b> command.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::profiler::init</b></a></dt>
<dd><p>Initiate profiling.  All procedures created after this command is
called will be profiled.  To profile an entire application, this
command must be called before any other commands.</p></dd>
<dt><a name="2"><b class="cmd">::profiler::dump</b> <i class="arg">pattern</i></a></dt>
<dd><p>Dump profiling information for the all functions matching
<i class="arg">pattern</i>.  If no pattern is specified, information for all
functions will be returned.  The result is a list of key/value pairs
that maps function names to information about that function.  The
information about each function is in turn a list of key/value pairs.
The keys used and their values are:</p>
<dl class="definitions">
<dt><b class="const">totalCalls</b></dt>
<dd><p>The total number of times <i class="arg">functionName</i> was called.</p></dd>
<dt><b class="const">callerDist</b></dt>
<dd><p>A list of key/value pairs mapping each calling function that called
<i class="arg">functionName</i> to the number of times it called
<i class="arg">functionName</i>.</p></dd>
<dt><b class="const">compileTime</b></dt>
<dd><p>The runtime, in clock clicks, of <i class="arg">functionName</i> the first time
that it was called.</p></dd>
<dt><b class="const">totalRuntime</b></dt>
<dd><p>The sum of the runtimes of all calls of <i class="arg">functionName</i>.</p></dd>
<dt><b class="const">averageRuntime</b></dt>
<dd><p>Average runtime of <i class="arg">functionName</i>.</p></dd>
<dt><b class="const">descendantTime</b></dt>
<dd><p>Sum of the time spent in descendants of <i class="arg">functionName</i>.</p></dd>
<dt><b class="const">averageDescendantTime</b></dt>
<dd><p>Average time spent in descendants of <i class="arg">functionName</i>.</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::profiler::print</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Print profiling information for all functions matching <i class="arg">pattern</i>.
If no pattern is specified, information about all functions will be
displayed.  The return result is a human readable display of the
profiling information.</p></dd>
<dt><a name="4"><b class="cmd">::profiler::reset</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Reset profiling information for all functions matching <i class="arg">pattern</i>.
If no pattern is specified, information will be reset for all
functions.</p></dd>
<dt><a name="5"><b class="cmd">::profiler::suspend</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Suspend profiling for all functions matching <i class="arg">pattern</i>.  If no
pattern is specified, profiling will be suspended for all
functions. It stops gathering profiling information after this command
is issued. However, it does not erase any profiling information that
has been gathered previously.  Use resume command to re-enable
profiling.</p></dd>
<dt><a name="6"><b class="cmd">::profiler::resume</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Resume profiling for all functions matching <i class="arg">pattern</i>.  If no
pattern is specified, profiling will be resumed for all functions.
This command should be invoked after suspending the profiler in the
code.</p></dd>
<dt><a name="7"><b class="cmd">::profiler::sortFunctions</b> <i class="arg">key</i></a></dt>
<dd><p>Return a list of functions sorted by a particular profiling statistic.
Supported values for <i class="arg">key</i> are: <b class="const">calls</b>,
<b class="const">exclusiveTime</b>, <b class="const">compileTime</b>, <b class="const">nonCompileTime</b>,
<b class="const">totalRuntime</b>, <b class="const">avgExclusiveTime</b>, and
<b class="const">avgRuntime</b>.  The return result is a list of lists, where each
sublist consists of a function name and the value of <i class="arg">key</i> for
that function.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>profiler</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key85">performance</a>, <a href="../../../../index.html#key599">profile</a>, <a href="../../../../index.html#key598">speed</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt.html.


































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt - Parser Tools Application</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Command Line</a></li>
<li class="section"><a href="#section3">PEG Specification Language</a></li>
<li class="section"><a href="#section4">JSON Grammar Exchange</a></li>
<li class="section"><a href="#section5">C Parser Embedded In Tcl</a></li>
<li class="section"><a href="#section6">C Parser</a></li>
<li class="section"><a href="#section7">Snit Parser</a></li>
<li class="section"><a href="#section8">TclOO Parser</a></li>
<li class="section"><a href="#section9">Grammar Container</a></li>
<li class="section"><a href="#section10">Example</a></li>
<li class="section"><a href="#section11">Internals</a></li>
<li class="section"><a href="#section12">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt</b> <b class="method">generate</b> <i class="arg">resultformat</i> <span class="opt">?<i class="arg">options...</i>?</span> <i class="arg">resultfile</i> <i class="arg">inputformat</i> <i class="arg">inputfile</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This document describes <b class="cmd">pt</b>, the main application of the module,
a <i class="term"><a href="../../../../index.html#key175">parser generator</a></i>. Its intended audience are people who wish
to create a parser for some language of theirs. Should you wish to
modify the application instead, please see the section about the
application's <span class="sectref"><a href="#section11">Internals</a></span> for the basic references.</p>
<p>It resides in the User Application Layer of Parser Tools.</p>
<p><img alt="arch_user_app" src="../../../../image/arch_user_app.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">Command Line</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt</b> <b class="method">generate</b> <i class="arg">resultformat</i> <span class="opt">?<i class="arg">options...</i>?</span> <i class="arg">resultfile</i> <i class="arg">inputformat</i> <i class="arg">inputfile</i></a></dt>
<dd><p>This sub-command of the application reads the parsing expression
grammar stored in the <i class="arg">inputfile</i> in the format <i class="arg">inputformat</i>,
converts it to the <i class="arg">resultformat</i> under the direction of the
(format-specific) set of options specified by the user and stores the
result in the <i class="arg">resultfile</i>.</p>
<p>The <i class="arg">inputfile</i> has to exist, while the <i class="arg">resultfile</i> may be
created, overwriting any pre-existing content of the file. Any missing
directory in the path to the <i class="arg">resultfile</i> will be created as well.</p>
<p>The exact form of the result for, and the set of options supported by
the known result-formats, are explained in the upcoming sections of
this document, with the list below providing an index mapping between
format name and its associated section. In alphabetical order:</p>
<dl class="definitions">
<dt><b class="const">c</b></dt>
<dd><p>A <i class="term">resultformat</i>. See section <span class="sectref"><a href="#section6">C Parser</a></span>.</p></dd>
<dt><b class="const">container</b></dt>
<dd><p>A <i class="term">resultformat</i>. See section <span class="sectref"><a href="#section9">Grammar Container</a></span>.</p></dd>
<dt><b class="const">critcl</b></dt>
<dd><p>A <i class="term">resultformat</i>. See section <span class="sectref"><a href="#section5">C Parser Embedded In Tcl</a></span>.</p></dd>
<dt><b class="const">json</b></dt>
<dd><p>A <i class="term">input</i>- and <i class="term">resultformat</i>. See section <span class="sectref"><a href="#section4">JSON Grammar Exchange</a></span>.</p></dd>
<dt><b class="const">oo</b></dt>
<dd><p>A <i class="term">resultformat</i>. See section <span class="sectref"><a href="#section8">TclOO Parser</a></span>.</p></dd>
<dt><b class="const">peg</b></dt>
<dd><p>A <i class="term">input</i>- and <i class="term">resultformat</i>. See section <span class="sectref"><a href="#section3">PEG Specification Language</a></span>.</p></dd>
<dt><b class="const">snit</b></dt>
<dd><p>A <i class="term">resultformat</i>. See section <span class="sectref"><a href="#section7">Snit Parser</a></span>.</p></dd>
</dl></dd>
</dl>
<p>Of the seven possible results four are parsers outright (<b class="const">c</b>,
<b class="const">critcl</b>, <b class="const">oo</b>, and <b class="const">snit</b>), one (<b class="const">container</b>)
provides code which can be used in conjunction with a generic parser
(also known as a grammar interpreter), and the last two (<b class="const">json</b>
and <b class="const">peg</b>) are doing double-duty as input formats, allowing the
transformation of grammars for exchange, reformatting, and the like.</p>
<p>The created parsers fall into three categories:</p>
<p><img alt="gen_options" src="../../../../image/gen_options.png"></p>
<dl class="definitions">
<dt><b class="const">Specialized parsers implemented in C</b></dt>
<dd><p>The fastest parsers are created when using the result formats
<b class="const">c</b> and <b class="const">critcl</b>. The first returns the raw C code for the
parser, while the latter wraps it into a Tcl package using
<i class="term">CriTcl</i>.</p>
<p>This makes the latter much easier to use than the former. On the other
hand, the former can be adapted to the users' requirements through a
multitude of options, allowing for things like usage of the parser
outside of a Tcl environment, something the <b class="const">critcl</b> format
doesn't support. As such the <b class="const">c</b> format is meant for more
advanced users, or users with special needs.</p>
<p>A disadvantage of all the parsers in this section is the need to run
them through a C compiler to make them actually executable. This is
not something everyone has the necessary tools for. The parsers in the
next section are for people under such restrictions.</p></dd>
<dt><b class="const">Specialized parsers implemented in Tcl</b></dt>
<dd><p>As the parsers in this section are implemented in Tcl they are quite a
bit slower than anything from the previous section. On the other hand
this allows them to be used in pure-Tcl environments, or in
environments which allow only a limited set of binary packages. In the
latter case it will be advantageous to lobby for the inclusion of the
C-based runtime support (notes below) into the environment to reduce
the impact of Tcl's on the speed of these parsers.</p>
<p>The relevant formats are <b class="const">snit</b> and <b class="const">oo</b>. Both place their
result into a Tcl package containing a <b class="cmd">snit::type</b>, or TclOO
<b class="cmd"><a href="../../../../index.html#key219">class</a></b> respectively.</p>
<p>Of the supporting runtime, which is the package <b class="package"><a href="pt_rdengine.html">pt::rde</a></b>, the
user has to know nothing but that it does exist and that the parsers
are dependent on it. Knowledge of the API exported by the runtime for
the parsers' consumption is <em>not</em> required by the parsers' users.</p></dd>
<dt><b class="const">Interpreted parsing implemented in Tcl</b></dt>
<dd><p>The last category, grammar interpretation. This means that an
interpreter for parsing expression grammars takes the description of
the grammar to parse input for, and uses it guide the parsing process.
This is the slowest of the available options, as the interpreter has
to continually run through the configured grammar, whereas the
specialized parsers of the previous sections have the relevant
knowledge about the grammar baked into them.</p>
<p>The only places where using interpretation make sense is where the
grammar for some input may be changed interactively by the user, as
the interpretation allows for quick turnaround after each change,
whereas the previous methods require the generation of a whole new
parser, which is not as fast.
On the other hand, wherever the grammar to use is fixed, the previous
methods are much more advantageous as the time to generate the parser
is minuscule compared to the time the parser code is in use.</p>
<p>The relevant result format is <b class="const">container</b>.
It (quickly) generates grammar descriptions (instead of a full parser)
which match the API expected by ParserTools' grammar interpreter.
The latter is provided by the package <b class="package"><a href="pt_peg_interp.html">pt::peg::interp</a></b>.</p></dd>
</dl>
<p>All the parsers generated by <b class="const">critcl</b>, <b class="const">snit</b>, and
<b class="const">oo</b>, and the grammar interpreter share a common API for access
to the actual parsing functionality, making them all
plug-compatible.
It is described in the <i class="term"><a href="pt_parser_api.html">Parser API</a></i> specification document.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">PEG Specification Language</a></h2>
<p><b class="const">peg</b>, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.</p>
<p>For either an introduction to or the formal specification of the
language, please go and read the <i class="term"><a href="pt_peg_language.html">PEG Language Tutorial</a></i>.</p>
<p>When used as a result-format this format supports the following
options:</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-template</b> string</dt>
<dd><p>The value of this option is a string into which to put the generated
text and the values of the other options. The various locations for
user-data are expected to be specified with the placeholders listed
below. The default value is &quot;<b class="const">@code@</b>&quot;.</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">PEG</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-name</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated text.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">JSON Grammar Exchange</a></h2>
<p>The <b class="const">json</b> format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.</p>
<p>For the formal specification of the JSON grammar exchange format,
please go and read <i class="term"><a href="pt_json_language.html">The JSON Grammar Exchange Format</a></i>.</p>
<p>When used as a result-format this format supports the following
options:</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-indented</b> boolean</dt>
<dd><p>If this option is set the system will break the generated JSON across
lines and indent it according to its inner structure, with each key of
a dictionary on a separate line.</p>
<p>If the option is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt><b class="option">-aligned</b> boolean</dt>
<dd><p>If this option is set the system will ensure that the values for the
keys in a dictionary are vertically aligned with each other, for a
nice table effect.
To make this work this also implies that <b class="option">-indented</b> is set.</p>
<p>If the option is not set (the default), the output is formatted as per
the value of <b class="variable">indented</b>, without trying to align the values for
dictionary keys.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">C Parser Embedded In Tcl</a></h2>
<p>The <b class="const">critcl</b> format is executable code, a parser for the
grammar. It is a Tcl package with the actual parser implementation
written in C and embedded in Tcl via the <b class="package">critcl</b> package.</p>
<p>This result-format supports the following options:</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-class</b> string</dt>
<dd><p>The value of this option is the name of the class to generate, without
leading colons.
The default value is <b class="const">CLASS</b>.</p>
<p>For a simple value <b class="variable">X</b> without colons, like CLASS, the parser
command will be <b class="variable">X</b>::<b class="variable">X</b>. Whereas for a namespaced value
<b class="variable">X::Y</b> the parser command will be <b class="variable">X::Y</b>.</p></dd>
<dt><b class="option">-package</b> string</dt>
<dd><p>The value of this option is the name of the package to generate.
The default value is <b class="const">PACKAGE</b>.</p></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">C Parser</a></h2>
<p>The <b class="const">c</b> format is executable code, a parser for the grammar. The
parser implementation is written in C and can be tweaked to the users'
needs through a multitude of options.</p>
<p>The <b class="cmd">critcl</b> format, for example, is implemented as a canned
configuration of these options on top of the generator for <b class="const">c</b>.</p>
<p>This result-format supports the following options:</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-template</b> string</dt>
<dd><p>The value of this option is a string into which to put
the generated text and the other configuration settings. The various
locations for user-data are expected to be specified with the
placeholders listed below. The default value is &quot;<b class="const">@code@</b>&quot;.</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">C/PARAM</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-name</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated Tcl code.</p></dd>
</dl>
<p>The following options are special, in that they will
occur within the generated code, and are replaced there as well.</p>
<dl class="definitions">
<dt><b class="const">@statedecl@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">state-decl</b>.</p></dd>
<dt><b class="const">@stateref@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">state-ref</b>.</p></dd>
<dt><b class="const">@strings@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">string-varname</b>.</p></dd>
<dt><b class="const">@self@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">self-command</b>.</p></dd>
<dt><b class="const">@def@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">fun-qualifier</b>.</p></dd>
<dt><b class="const">@ns@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">namespace</b>.</p></dd>
<dt><b class="const">@main@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">main</b>.</p></dd>
<dt><b class="const">@prelude@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">prelude</b>.</p></dd>
</dl></dd>
<dt><b class="option">-state-decl</b> string</dt>
<dd><p>A C string representing the argument declaration to use in the
generated parsing functions to refer to the parsing state. In essence
type and argument name.
The default value is the string <b class="const">RDE_PARAM p</b>.</p></dd>
<dt><b class="option">-state-ref</b> string</dt>
<dd><p>A C string representing the argument named used in the generated
parsing functions to refer to the parsing state.
The default value is the string <b class="const">p</b>.</p></dd>
<dt><b class="option">-self-command</b> string</dt>
<dd><p>A C string representing the reference needed to call the generated
parser function (methods ...) from another parser fonction, per the
chosen framework (template).
The default value is the empty string.</p></dd>
<dt><b class="option">-fun-qualifier</b> string</dt>
<dd><p>A C string containing the attributes to give to the generated
functions (methods ...), per the chosen framework (template).
The default value is <b class="const">static</b>.</p></dd>
<dt><b class="option">-namespace</b> string</dt>
<dd><p>The name of the C namespace the parser functions (methods, ...) shall
reside in, or a general prefix to add to the function names.
The default value is the empty string.</p></dd>
<dt><b class="option">-main</b> string</dt>
<dd><p>The name of the main function (method, ...) to be called by the chosen
framework (template) to start parsing input.
The default value is <b class="const">__main</b>.</p></dd>
<dt><b class="option">-string-varname</b> string</dt>
<dd><p>The name of the variable used for the table of strings used by the
generated parser, i.e. error messages, symbol names, etc.
The default value is <b class="const">p_string</b>.</p></dd>
<dt><b class="option">-prelude</b> string</dt>
<dd><p>A snippet of code to be inserted at the head of each generated parsing
function.
The default value is the empty string.</p></dd>
<dt><b class="option">-indent</b> integer</dt>
<dd><p>The number of characters to indent each line of the generated code by.
The default value is <b class="const">0</b>.</p></dd>
</dl>
</div>
<div id="section7" class="section"><h2><a name="section7">Snit Parser</a></h2>
<p>The <b class="const">snit</b> format is executable code, a parser for the
grammar. It is a Tcl package holding a <b class="cmd">snit::type</b>, i.e. a class,
whose instances are parsers for the input grammar.</p>
<p>This result-format supports the following options:</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-class</b> string</dt>
<dd><p>The value of this option is the name of the class to generate, without
leading colons. Note, it serves double-duty as the name of the package
to generate too, if option <b class="option">-package</b> is not specified, see below.
The default value is <b class="const">CLASS</b>, applying if neither option
<b class="option">-class</b> nor <b class="option">-package</b> were specified.</p></dd>
<dt><b class="option">-package</b> string</dt>
<dd><p>The value of this option is the name of the package to generate, without
leading colons. Note, it serves double-duty as the name of the class
to generate too, if option <b class="option">-class</b> is not specified, see above.
The default value is <b class="const">PACKAGE</b>, applying if neither option
<b class="option">-package</b> nor <b class="option">-class</b> were specified.</p></dd>
</dl>
</div>
<div id="section8" class="section"><h2><a name="section8">TclOO Parser</a></h2>
<p>The <b class="const">oo</b> format is executable code, a parser for the grammar. It
is a Tcl package holding a <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class, whose instances are
parsers for the input grammar.</p>
<p>This result-format supports the following options:</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-class</b> string</dt>
<dd><p>The value of this option is the name of the class to generate, without
leading colons. Note, it serves double-duty as the name of the package
to generate too, if option <b class="option">-package</b> is not specified, see below.
The default value is <b class="const">CLASS</b>, applying if neither option
<b class="option">-class</b> nor <b class="option">-package</b> were specified.</p></dd>
<dt><b class="option">-package</b> string</dt>
<dd><p>The value of this option is the name of the package to generate, without
leading colons. Note, it serves double-duty as the name of the class
to generate too, if option <b class="option">-class</b> is not specified, see above.
The default value is <b class="const">PACKAGE</b>, applying if neither option
<b class="option">-package</b> nor <b class="option">-class</b> were specified.</p></dd>
</dl>
</div>
<div id="section9" class="section"><h2><a name="section9">Grammar Container</a></h2>
<p>The <b class="const">container</b> format is another form of describing parsing
expression grammars. While data in this format is executable it does
not constitute a parser for the grammar. It always has to be used in
conjunction with the package <b class="package"><a href="pt_peg_interp.html">pt::peg::interp</a></b>, a grammar
interpreter.</p>
<p>The format represents grammars by a <b class="cmd">snit::type</b>, i.e. class,
whose instances are API-compatible to the instances of the
<b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b> package, and which are preloaded with the
grammar in question.</p>
<p>This result-format supports the following options:</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-mode</b> <b class="const">bulk</b>|<b class="const">incremental</b></dt>
<dd><p>The value of this option controls which methods of
<b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b> instances are used to specify the
grammar, i.e. preload it into the container. There are two legal
values, as listed below. The default is <b class="const">bulk</b>.</p>
<dl class="definitions">
<dt><b class="const">bulk</b></dt>
<dd><p>In this mode the methods <b class="method">start</b>, <b class="method">add</b>, <b class="method">modes</b>,
and <b class="method">rules</b> are used to specify the grammar in a bulk manner,
i.e. as a set of nonterminal symbols, and two dictionaries mapping
from the symbols to their semantic modes and parsing expressions.</p>
<p>This mode is the default.</p></dd>
<dt><b class="const">incremental</b></dt>
<dd><p>In this mode the methods <b class="method">start</b>, <b class="method">add</b>, <b class="method">mode</b>,
and <b class="method">rule</b> are used to specify the grammar piecemal, with each
nonterminal having its own block of defining commands.</p></dd>
</dl></dd>
<dt><b class="option">-template</b> string</dt>
<dd><p>The value of this option is a string into which to put the generated
code and the other configuration settings. The various locations for
user-data are expected to be specified with the placeholders listed
below. The default value is &quot;<b class="const">@code@</b>&quot;.</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">CONTAINER</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-name</b>.</p></dd>
<dt><b class="const">@mode@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-mode</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated code.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section10" class="section"><h2><a name="section10">Example</a></h2>
<p>In this section we are working a complete example, starting with a PEG
grammar and ending with running the parser generated from it over some
input, following the outline shown in the figure below:</p>
<p><img alt="flow" src="../../../../image/flow.png"></p>
<p>Our grammar, assumed to the stored in the file &quot;<b class="file">calculator.peg</b>&quot;
is</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>From this we create a snit-based parser
via</p>
<pre class="example">
pt generate snit calculator.tcl -class calculator -name calculator peg calculator.peg
</pre>
<p>which leaves us with the parser package and class written to the file
&quot;<b class="file">calculator.tcl</b>&quot;.
Assuming that this package is then properly installed in a place where
Tcl can find it we can now use this class via a script like</p>
<pre class="example">
    package require calculator
    lassign $argv input
    set channel [open $input r]
    set parser [calculator]
    set ast [$parser parse $channel]
    $parser destroy
    close $channel
    ... now process the returned abstract syntax tree ...
</pre>
<p>where the abstract syntax tree stored in the variable will look like</p>
<pre class="example">
set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}
</pre>
<p>assuming that the input file and channel contained the text</p>
<pre class="example"> 120+5 </pre>
<p>A more graphical representation of the tree would be</p>
<p><img alt="expr_ast" src="../../../../image/expr_ast.png"></p>
<p>Regardless, at this point it is the user's responsibility to work with
the tree to reach whatever goal she desires. I.e. analyze it,
transform it, etc. The package <b class="package"><a href="pt_astree.html">pt::ast</a></b> should be of help
here, providing commands to walk such ASTs structures in various ways.</p>
<p>One important thing to note is that the parsers used here return a
data structure representing the structure of the input per the grammar
underlying the parser. There are <em>no</em> callbacks during the
parsing process, i.e. no <i class="term">parsing actions</i>, as most other
parsers will have.</p>
<p>Going back to the last snippet of code, the execution of the parser
for some input, note how the parser instance follows the specified
<i class="term"><a href="pt_parser_api.html">Parser API</a></i>.</p>
</div>
<div id="section11" class="section"><h2><a name="section11">Internals</a></h2>
<p>This section is intended for users of the application which wish to
modify or extend it. Users only interested in the generation of
parsers can ignore it.</p>
<p>The main functionality of the application is encapsulated in the
package <b class="package"><a href="pt_pgen.html">pt::pgen</a></b>. Please read it for more information.</p>
</div>
<div id="section12" class="section"><h2><a name="section12">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_astree.html.



























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::ast - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_astree.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::ast.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::ast(n) 1.1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::ast - Abstract Syntax Tree Serialization</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">AST serialization format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::ast <span class="opt">?1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::ast</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::pt::ast</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></li>
<li><a href="#3"><b class="cmd">::pt::ast</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></li>
<li><a href="#4"><b class="cmd">::pt::ast</b> <b class="method">print</b> <i class="arg">serial</i></a></li>
<li><a href="#5"><b class="cmd">::pt::ast</b> <b class="method">bottomup</b> <i class="arg">cmdprefix</i> <i class="arg">ast</i></a></li>
<li><a href="#6"><b class="cmd">cmdprefix</b> <i class="arg">ast</i></a></li>
<li><a href="#7"><b class="cmd">::pt::ast</b> <b class="method">topdown</b> <i class="arg">cmdprefix</i> <i class="arg">pe</i></a></li>
<li><a href="#8"><b class="cmd">::pt::ast</b> <b class="method">equal</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></li>
<li><a href="#9"><b class="cmd">::pt::ast</b> <b class="method">terminal</b> <i class="arg">loc</i></a></li>
<li><a href="#10"><b class="cmd">::pt::ast</b> <b class="method">nonterminal</b> <i class="arg">s</i> <i class="arg">start</i> <i class="arg">end</i> <span class="opt">?<i class="arg">child</i>...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides commands to work with the serializations of
abstract syntax trees as managed by the Parser Tools, and specified in
section <span class="sectref"><a href="#section3">AST serialization format</a></span>.</p>
<p>This is a supporting package in the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_support" src="../../../../image/arch_core_support.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::ast</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
serialization of an abstract syntax tree and will throw an error if
that is not the case. The result of the command is the empty string.</p>
<p>If the argument <i class="arg">canonvar</i> is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if <i class="arg">serial</i> is a valid regular
serialization. Its value will be a boolean, with <b class="const">True</b>
indicating that the serialization is not only valid, but also
<i class="term">canonical</i>. <b class="const">False</b> will be written for a valid, but
non-canonical serialization.</p>
<p>For the specification of serializations see the section
<span class="sectref"><a href="#section3">AST serialization format</a></span>.</p></dd>
<dt><a name="2"><b class="cmd">::pt::ast</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
<i class="term">canonical</i> serialization of an abstract syntax tree and will
throw an error if that is not the case. The result of the command is
the empty string.</p>
<p>For the specification of canonical serializations see the section
<span class="sectref"><a href="#section3">AST serialization format</a></span>.</p></dd>
<dt><a name="3"><b class="cmd">::pt::ast</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the content of <i class="arg">serial</i> is a valid
<i class="term">regular</i> serialization of an abstract syntax and will throw an
error if that is not the case.</p>
<p>It will then convert the input into the <i class="term">canonical</i> serialization
of the contained tree and return it as its result. If the input is
already canonical it will be returned unchanged.</p>
<p>For the specification of regular and canonical serializations see the
section <span class="sectref"><a href="#section3">AST serialization format</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::pt::ast</b> <b class="method">print</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the argument <i class="arg">serial</i> contains a valid
serialization of an abstract syntax tree and returns a string
containing that tree in a human readable form.</p>
<p>The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.</p>
<p>For the specification of serializations see the section
<span class="sectref"><a href="#section3">AST serialization format</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::pt::ast</b> <b class="method">bottomup</b> <i class="arg">cmdprefix</i> <i class="arg">ast</i></a></dt>
<dd><p>This command walks the abstract syntax tree <i class="arg">ast</i> from the bottom
up to the root, invoking the command prefix <i class="arg">cmdprefix</i> for each
node. This implies that the children of a node N are handled before N.</p>
<p>The command prefix has the signature</p>
<dl class="definitions">
<dt><a name="6"><b class="cmd">cmdprefix</b> <i class="arg">ast</i></a></dt>
<dd><p>I.e. it is invoked with the ast node the walk is currently at.</p>
<p>The result returned by the command prefix replaces <i class="arg">ast</i> in the
node it was a child of, allowing transformations of the tree.</p>
<p>This also means that for all inner node the contents of the children
elements are the results of the command prefix invoked for the
children of this node.</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::pt::ast</b> <b class="method">topdown</b> <i class="arg">cmdprefix</i> <i class="arg">pe</i></a></dt>
<dd><p>This command walks the abstract syntax tree <i class="arg">ast</i> from the root
down to the leaves, invoking the command prefix <i class="arg">cmdprefix</i> for
each node. This implies that the children of a node N are handled
after N.</p>
<p>The command prefix has the same signature as for <b class="method">bottomup</b>,
see above.</p>
<p>The result returned by the command prefix is <em>ignored</em>.</p></dd>
<dt><a name="8"><b class="cmd">::pt::ast</b> <b class="method">equal</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></dt>
<dd><p>This command tests the two sbstract syntax trees <i class="arg">seriala</i> and
<i class="arg">serialb</i> for structural equality. The result of the command is a
boolean value. It will be set to <b class="const">true</b> if the trees are
identical, and <b class="const">false</b> otherwise.</p>
<p>String equality is usable only if we can assume that the two trees are
pure Tcl lists.</p></dd>
<dt><a name="9"><b class="cmd">::pt::ast</b> <b class="method">terminal</b> <i class="arg">loc</i></a></dt>
<dd><p>This command command constructs the ast for a terminal node refering
to the position <i class="arg">loc</i> in the input, and returns it as the result
of the command.</p></dd>
<dt><a name="10"><b class="cmd">::pt::ast</b> <b class="method">nonterminal</b> <i class="arg">s</i> <i class="arg">start</i> <i class="arg">end</i> <span class="opt">?<i class="arg">child</i>...?</span></a></dt>
<dd><p>This command command constructs the ast for a nonterminal node
refering to the symbol <i class="arg">s</i> covering the range of positions
<i class="arg">start</i> to <i class="arg">end</i> in the input, and the set of child nodes
<i class="arg">child</i> ..., from left right. The latter may be empty. The
constructed node is returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">AST serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Abstract Syntax Trees (ASTs) as immutable values for transport,
comparison, etc.</p>
<p>Each node in an AST represents a nonterminal symbol of a grammar, and
the range of tokens/characters in the input covered by it. ASTs do not
contain terminal symbols, i.e. tokens/characters. These can be
recovered from the input given a symbol's location.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a tree may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any AST is the serialization of its root node.</p></li>
<li><p>The serialization of any node is a Tcl list containing at least three
elements.</p>
<ol class="enumerated">
<li><p>The first element is the name of the nonterminal symbol stored in the
node.</p></li>
<li><p>The second and third element are the locations of the first and last
token in the token stream the node represents (covers).</p>
<ol class="enumerated">
<li><p>Locations are provided as non-negative integer offsets from the
beginning of the token stream, with the first token found in the
stream located at offset 0 (zero).</p></li>
<li><p>The end location has to be equal to or larger than the start location.</p></li>
</ol>
</li>
<li><p>All elements after the first three represent the children of the node,
which are themselves nodes. This means that the serializations of
nodes without children, i.e. leaf nodes, have exactly three elements.
The children are stored in the list with the leftmost child first, and
the rightmost child last.</p></li>
</ol>
</li>
</ol></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of an abstract syntax tree has the format
as specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this tree.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the parsing expression grammar below</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>and the input string</p>
<pre class="example"> 120+5 </pre>
<p>then a parser should deliver the abstract syntax tree below (except for whitespace)</p>
<pre class="example">
set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}
</pre>
<p>Or, more graphical</p>
<p><img alt="expr_ast" src="../../../../image/expr_ast.png"></p>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_cparam_config_critcl.html.






















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::cparam::configuration::critcl - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_cparam_config_critcl.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::cparam::configuration::critcl.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::cparam::configuration::critcl(n) 1.0.1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::cparam::configuration::critcl - C/PARAM, Canned configuration, Critcl</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::cparam::configuration::critcl <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::cparam::configuration::critcl</b> <b class="method">def</b> <i class="arg">name</i> <i class="arg">cmdprefix</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package is an adjunct to <b class="package"><a href="pt_peg_to_cparam.html">pt::peg::to::cparam</a></b>, to make
the use of this highly configurable package easier by providing a
canned configuration. When applied this configuration causes the
package <b class="package"><a href="pt_peg_to_cparam.html">pt::peg::to::cparam</a></b> to generate
<b class="package">critcl</b>-based parser packages.</p>
<p>It is a supporting package in the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_support" src="../../../../image/arch_core_support.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::cparam::configuration::critcl</b> <b class="method">def</b> <i class="arg">name</i> <i class="arg">cmdprefix</i></a></dt>
<dd><p>The command applies the configuration provided by this package to the
<i class="arg">cmdprefix</i>, causing the creation of <b class="package">critcl</b>-based parsers
whose class is <i class="arg">name</i>.</p>
<p>The use of a command prefix as API allows application of the
configuration to not only <b class="package"><a href="pt_peg_to_cparam.html">pt::peg::to::cparam</a></b>
(<b class="cmd">pt::peg::to::cparam configure</b>), but also export manager
instances and PEG containers (<b class="cmd">$export configuration set</b> and
<b class="cmd">[$container exporter] configuration set</b> respectively).</p>
<p>Or anything other command prefix accepting two arguments, option and
value.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_from_api.html.




























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt_import_api - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_from_api.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt_import_api.i
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt_import_api(i) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt_import_api - Parser Tools Import API</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Converter API</a></li>
<li class="section"><a href="#section3">Plugin API</a></li>
<li class="section"><a href="#section4">Usage</a></li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">CONVERTER</b> <b class="method">convert</b> <i class="arg">text</i></a></li>
<li><a href="#2"><b class="cmd">IncludeFile</b> <i class="arg">currentfile</i> <i class="arg">path</i></a></li>
<li><a href="#3"><b class="cmd">::import</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This document describes two APIs. First the API shared by all packages
for the conversion of some other format into Parsing Expression
Grammars , and then the API shared by the packages which implement the
import plugins sitting on top of the conversion packages.</p>
<p>Its intended audience are people who wish to create their own
converter for some type of input, and/or an import plugin for their or
some other converter.</p>
<p>It resides in the Import section of the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_import" src="../../../../image/arch_core_import.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">Converter API</a></h2>
<p>Any (grammar) import converter has to follow the rules set out below:</p>
<ol class="enumerated">
<li><p>A converter is a package. Its name is arbitrary, however it is
	recommended to put it under the <b class="namespace">::pt::peg::from</b>
	namespace.</p></li>
<li><p>The package provides either a single Tcl command following the
	API outlined below, or a class command whose instances follow
	the same API. The commands which follow the API are called
	<i class="term">converter commands</i>.</p></li>
<li><p>A converter command has to provide the following single method
	with the given signature and semantic. Converter commands
	are allowed to provide more methods of their own, but not
	less, and they may not provide different semantics for the
	standardized method.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">CONVERTER</b> <b class="method">convert</b> <i class="arg">text</i></a></dt>
<dd><p>This method has to accept some <i class="arg">text</i>, a parsing expression
grammar in some format.
The result of the method has to be the canonical serialization of a
parsing expression grammar, as specified in section
<span class="sectref"><a href="#section5">PEG serialization format</a></span>, the result of reading and
converting the input text.</p></dd>
</dl>
</li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">Plugin API</a></h2>
<p>Any (grammar) import plugin has to follow the rules set out below:</p>
<ol class="enumerated">
<li><p>A plugin is a package.</p></li>
<li><p>The name of a plugin package has the form
		pt::peg::import::<b class="variable">FOO</b>,
	where <b class="variable">FOO</b> is the name of the format the plugin will
	accept input for.</p></li>
<li><p>The plugin can expect that the package
	<b class="package">pt::peg::import::plugin</b> is present, as
	indicator that it was invoked from a genuine plugin manager.</p>
<p>It is recommended that a plugin does check for the presence of
	this package.</p></li>
<li><p>The plugin can expect that a command named <b class="cmd">IncludeFile</b>
	is present, with the signature</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">IncludeFile</b> <i class="arg">currentfile</i> <i class="arg">path</i></a></dt>
<dd><p>This command has to be invoked by the plugin when it has to process an
included file, if the format has the concept of such.</p>
<p>The plugin has to supply the following arguments</p>
<dl class="arguments">
<dt>string <i class="arg">currentfile</i></dt>
<dd><p>The path of the file it is currently processing. This may be the empty
string if no such is known.</p></dd>
<dt>string <i class="arg">path</i></dt>
<dd><p>The path of the include file as specified in the include directive
being processed.</p></dd>
</dl>
<p>The result of the command will be a 5-element list containing</p>
<ol class="enumerated">
<li><p>A boolean flag indicating the success (<b class="const">True</b>) or failure
       (<b class="const">False</b>) of the operation.</p></li>
<li><p>In case of success the contents of the included file, and the
       empty string otherwise.</p></li>
<li><p>The resolved, i.e. absolute path of the included file, if
       possible, or the unchanged <i class="arg">path</i> argument. This is for
       display in an error message, or as the <i class="arg">currentfile</i>
       argument of another call to <b class="cmd">IncludeFile</b> should this file
       contain more files.</p></li>
<li><p>In case of success an empty string, and for failure a code
       indicating the reason for it, one of</p>
<dl class="definitions">
<dt>notfound</dt>
<dd><p>The specified file could not be found.</p></dd>
<dt>notread</dt>
<dd><p>The specified file was found, but not be read into memory.</p></dd>
</dl>
</li>
<li><p>An empty string in case of success of a <b class="const">notfound</b>
       failure, and an additional error message describing the reason
       for a <b class="const">notread</b> error in more detail.</p></li>
</ol></dd>
</dl>
</li>
<li><p>A plugin has to provide a single command, in the global
	namespace, with the signature shown below. Plugins are allowed
	to provide more commands of their own, but not less, and they
	may not provide different semantics for the standardized
	command.</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">::import</b> <i class="arg">text</i></a></dt>
<dd><p>This command has to accept the a text containing a parsing expression
grammar in some format. The result of the command has to be the result
of the converter invoked by the plugin for the input grammar, the
canonical serialization of the parsing expression grammar contained in
the input.</p>
<dl class="arguments">
<dt>string <i class="arg">text</i></dt>
<dd><p>This argument will contain the parsing expression grammar for which to
generate the serialization.
The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section5">PEG serialization format</a></span>.</p></dd>
</dl></dd>
</dl>
</li>
<li><p>A single usage cycle of a plugin consists of an invokation of
	the command <b class="cmd"><a href="../../../../index.html#key247">import</a></b>. This call has to leave the plugin in
	a state where another usage cycle can be run without problems.</p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">Usage</a></h2>
<p>To use a converter do</p>
<pre class="example">
    # Get the converter (single command here, not class)
    package require the-converter-package
    # Perform the conversion
    set serial [theconverter convert $thegrammartext]
    ... process the result ...
</pre>
<p>To use a plugin <b class="variable">FOO</b> do</p>
<pre class="example">
    # Get an import plugin manager
    package require pt::peg::import
    pt::peg::import I
    # Run the plugin, and the converter inside.
    set serial [I import serial $thegrammartext FOO]
    ... process the result ...
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_introduction.html.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt_introduction - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_introduction.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt_introduction.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt_introduction(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt_introduction - Introduction to Parser Tools</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Parser Tools Architecture</a>
<ul>
<li class="subsection"><a href="#subsection1">User Packages</a></li>
<li class="subsection"><a href="#subsection2">Core Packages</a></li>
<li class="subsection"><a href="#subsection3">Support Packages</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Welcome to the Parser Tools, a system for the creation and
manipulation of parsers and the grammars driving them.</p>
<p>What are your goals which drove you here ?</p>
<ol class="enumerated">
<li><p>Do you simply wish to create a parser for some language ?</p>
<p>In that case have a look at our parser generator application,
<b class="cmd"><a href="pt.html">pt</a></b>, or, for a slightly deeper access, the package underneath it,
<b class="package"><a href="pt_pgen.html">pt::pgen</a></b>.</p></li>
<li><p>Do you wish to know more about the architecture of the system ?</p>
<p>This is described in the section
<span class="sectref"><a href="#section2">Parser Tools Architecture</a></span>, below</p></li>
<li><p>Is your interest in the theoretical background upon which the packages
and tools are build ?</p>
<p>See the <i class="term"><a href="pt_peg_introduction.html">Introduction to Parsing Expression Grammars</a></i>.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">Parser Tools Architecture</a></h2>
<p>The system can be split into roughly three layers, as seen in the
figure below</p>
<p><img alt="architecture" src="../../../../image/architecture.png"></p>
<p>These layers are, from high to low:</p>
<ol class="enumerated">
<li><p>At the top we have the application and the packages using the packages
of the layer below to implement common usecases. One example is the
aforementioned <b class="package"><a href="pt_pgen.html">pt::pgen</a></b> which provides a parser generator.</p>
<p>The list of packages belonging to this layer can be found in section
<span class="sectref"><a href="#subsection1">User Packages</a></span></p></li>
<li><p>In this layer we have the packages which provide the core of the
functionality for the whole system. They are, in essence, a set of
blocks which can be combined in myriad ways, like Lego (tm). The
packages in the previous level are 'just' pre-fabricated combinations
to cover the most important use cases.</p>
<p>The list of packages belonging to this layer can be found in section
<span class="sectref"><a href="#subsection2">Core Packages</a></span></p></li>
<li><p>Last, but not least is the layer containing support packages providing
generic functionality which not necessarily belong into the module.</p>
<p>The list of packages belonging to this layer can be found in section
<span class="sectref"><a href="#subsection3">Support Packages</a></span></p></li>
</ol>
<div id="subsection1" class="subsection"><h3><a name="subsection1">User Packages</a></h3>
<dl class="definitions">
<dt><b class="package"><a href="pt_pgen.html">pt::pgen</a></b></dt>
<dd></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Core Packages</a></h3>
<p>This layer is further split into six sections handling the storage,
import, export, transformation, and execution of grammars, plus
grammar specific support packages.</p>
<dl class="definitions">
<dt>Storage</dt>
<dd><dl class="definitions">
<dt><b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b></dt>
<dd></dd>
</dl></dd>
<dt>Export</dt>
<dd><dl class="definitions">
<dt><b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_export_container.html">pt::peg::export::container</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_export_json.html">pt::peg::export::json</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_export_peg.html">pt::peg::export::peg</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_to_container.html">pt::peg::to::container</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_to_json.html">pt::peg::to::json</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_to_peg.html">pt::peg::to::peg</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_to_param.html">pt::peg::to::param</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_to_cparam.html">pt::peg::to::cparam</a></b></dt>
<dd></dd>
</dl></dd>
<dt>Import</dt>
<dd><dl class="definitions">
<dt><b class="package"><a href="pt_peg_import.html">pt::peg::import</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_import_container.html">pt::peg::import::container</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_import_json.html">pt::peg::import::json</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_import_peg.html">pt::peg::import::peg</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_from_container.html">pt::peg::from::container</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_from_json.html">pt::peg::from::json</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_peg_from_peg.html">pt::peg::from::peg</a></b></dt>
<dd></dd>
</dl></dd>
<dt>Transformation</dt>
<dd></dd>
<dt>Execution</dt>
<dd><dl class="definitions">
<dt><b class="package"><a href="pt_peg_interp.html">pt::peg::interp</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_rdengine.html">pt::rde</a></b></dt>
<dd></dd>
</dl></dd>
<dt>Support</dt>
<dd><dl class="definitions">
<dt><b class="package"><a href="pt_tclparam_config_snit.html">pt::tclparam::configuration::snit</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_tclparam_config_tcloo.html">pt::tclparam::configuration::tcloo</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_cparam_config_critcl.html">pt::cparam::configuration::critcl</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_astree.html">pt::ast</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_pexpression.html">pt::pe</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="pt_pegrammar.html">pt::peg</a></b></dt>
<dd></dd>
</dl></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Support Packages</a></h3>
<dl class="definitions">
<dt><b class="package"><a href="pt_peg_container_peg.html">pt::peg::container::peg</a></b></dt>
<dd></dd>
<dt><b class="package">text::write</b></dt>
<dd></dd>
<dt><b class="package">configuration</b></dt>
<dd></dd>
<dt><b class="package">paths</b></dt>
<dd></dd>
<dt><b class="package">char</b></dt>
<dd></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_json_language.html.


























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::json_language - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_json_language.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::json_language.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::json_language(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::json_language - The JSON Grammar Exchange Format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section2">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section3">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>The <b class="const">json</b> format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.</p>
<p>It is formally specified by the rules below:</p>
<ol class="enumerated">
<li><p>The JSON of any PEG is a JSON object.</p></li>
<li><p>This object holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
<span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol>
<p>As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
<span class="sectref"><a href="#section2">PEG serialization format</a></span>, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>a JSON serialization for it is</p>
<pre class="example">
{
    &quot;pt::grammar::peg&quot; : {
        &quot;rules&quot; : {
            &quot;AddOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Digit&quot;     : {
                &quot;is&quot;   : &quot;\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Expression&quot; : {
                &quot;is&quot;   : &quot;\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Factor&quot;    : {
                &quot;is&quot;   : &quot;x {n Term} {* {x {n AddOp} {n Term}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;MulOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t *} {t \/}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Number&quot;    : {
                &quot;is&quot;   : &quot;x {? {n Sign}} {+ {n Digit}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Sign&quot;      : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Term&quot;      : {
                &quot;is&quot;   : &quot;n Number&quot;,
                &quot;mode&quot; : &quot;value&quot;
            }
        },
        &quot;start&quot; : &quot;n Expression&quot;
    }
}
</pre>
<p>and a Tcl serialization of the same is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
<p>The similarity of the latter to the JSON should be quite obvious.</p>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_param.html.










































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::param - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_param.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::param.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::param(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::param - PackRat Machine Specification</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Architectural State</a></li>
<li class="section"><a href="#section3">Instruction Set</a>
<ul>
<li class="subsection"><a href="#subsection1">Input Handling</a></li>
<li class="subsection"><a href="#subsection2">Character Processing</a></li>
<li class="subsection"><a href="#subsection3">Error Handling</a></li>
<li class="subsection"><a href="#subsection4">Status Control</a></li>
<li class="subsection"><a href="#subsection5">Location Handling</a></li>
<li class="subsection"><a href="#subsection6">Nonterminal Execution</a></li>
<li class="subsection"><a href="#subsection7">Value Construction</a></li>
<li class="subsection"><a href="#subsection8">AST Construction</a></li>
<li class="subsection"><a href="#subsection9">Control Flow</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Interaction of the Instructions with the Architectural State</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>Welcome to the PackRat Machine (short: <i class="term"><a href="../../../../index.html#key471">PARAM</a></i>), a virtual
machine geared towards the support of recursive descent parsers,
especially packrat parsers. Towards this end it has features like the
caching and reuse of partial results, the caching of the encountered
input, and the ability to backtrack in both input and AST creation.</p>
<p>This document specifies the machine in terms of its architectural
state and instruction set.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Architectural State</a></h2>
<p>Any PARAM implementation has to manage at least the following state:</p>
<dl class="definitions">
<dt><i class="term">Input</i> (IN)</dt>
<dd><p>This is the channel the characters to process are read from.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the section <span class="sectref"><a href="#subsection1">Input Handling</a></span>.</p></dd>
<dt><i class="term">Current Character</i> (CC)</dt>
<dd><p>The character from the <i class="term">input</i> currently tested against its
possible alternatives.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the section <span class="sectref"><a href="#subsection2">Character Processing</a></span>.</p></dd>
<dt><i class="term">Current Location</i> (CL)</dt>
<dd><p>The location of the <i class="term">current character</i> in the <i class="term">input</i>, as
offset relative to the beginning of the input. Character offsets are
counted from <b class="const">0</b>.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the sections <span class="sectref"><a href="#subsection2">Character Processing</a></span>,
<span class="sectref"><a href="#subsection5">Location Handling</a></span>, and <span class="sectref"><a href="#subsection6">Nonterminal Execution</a></span>.</p></dd>
<dt><i class="term">Location Stack</i> (LS)</dt>
<dd><p>A stack of locations in the <i class="term">input</i>, saved for possible
backtracking.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the sections <span class="sectref"><a href="#subsection2">Character Processing</a></span>,
<span class="sectref"><a href="#subsection5">Location Handling</a></span>, and <span class="sectref"><a href="#subsection6">Nonterminal Execution</a></span>.</p></dd>
<dt><i class="term">Status</i> (ST)</dt>
<dd><p>The status of the last attempt of testing the <i class="term">input</i>, indicating
either success or failure.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the sections <span class="sectref"><a href="#subsection4">Status Control</a></span>,
<span class="sectref"><a href="#subsection2">Character Processing</a></span>, and <span class="sectref"><a href="#subsection6">Nonterminal Execution</a></span>.</p></dd>
<dt><i class="term">Semantic Value</i> (SV)</dt>
<dd><p>The current semantic value, either empty, or a node for AST
constructed from the input.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the sections <span class="sectref"><a href="#subsection7">Value Construction</a></span>, and
<span class="sectref"><a href="#subsection8">AST Construction</a></span>.</p></dd>
<dt><i class="term">AST Reduction Stack</i> (ARS)</dt>
<dd><p>The stack of partial ASTs constructed during the processing of
nonterminal symbols.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the sections <span class="sectref"><a href="#subsection7">Value Construction</a></span>, and
<span class="sectref"><a href="#subsection8">AST Construction</a></span>.</p></dd>
<dt><i class="term">AST Stack</i> (AS)</dt>
<dd><p>The stack of reduction stacks, saved for possible backtracking.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the sections <span class="sectref"><a href="#subsection7">Value Construction</a></span>, and
<span class="sectref"><a href="#subsection8">AST Construction</a></span>.</p></dd>
<dt><i class="term">Error Status</i> (ER)</dt>
<dd><p>The machine's current knowledge of errors. This is either empty, or
set to a pair of location in the input and the set of messages for
that location.</p>
<p><em>Note</em> that this part of the machine's state can be set even if
the last test of the <i class="term">current character</i> was successful. For
example, the *-operator (matching a sub-expression zero or more times)
in a PEG is always successful, even if it encounters a problem further
in the input and has to backtrack. Such problems must not be forgotten
when continuing the parsing.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the sections <span class="sectref"><a href="#subsection3">Error Handling</a></span>,
<span class="sectref"><a href="#subsection2">Character Processing</a></span>, and <span class="sectref"><a href="#subsection6">Nonterminal Execution</a></span>.</p></dd>
<dt><i class="term">Error Stack</i> (ES)</dt>
<dd><p>The stack of error stati, saved for backtracking. This enables the
machine to merge current and older error stati when performing
backtracking in choices after an failed match.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the sections <span class="sectref"><a href="#subsection3">Error Handling</a></span>,
<span class="sectref"><a href="#subsection2">Character Processing</a></span>, and <span class="sectref"><a href="#subsection6">Nonterminal Execution</a></span>.</p></dd>
<dt><i class="term">Nonterminal Cache</i> (NC)</dt>
<dd><p>A cache of machine states keyed by pairs name of nonterminal symbol
and location in the input. Each pair (N, L) is associated with a
4-tuple holding the values to use for CL, ST, SV, and ER after the
nonterminal N was parsed starting from the location L.
It is a performance aid for backtracking parsers, allowing them to
avoid an expensive reparsing of complex nonterminal symbols if they
have been encountered before at a given location.</p>
<p>The key location is where machine started the attempt to match the
named nonterminal symbol, and the location in the saved 4-tuple is
where machine ended up after the attempt completed, independent of the
success of the attempt.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the section <span class="sectref"><a href="#subsection6">Nonterminal Execution</a></span>.</p></dd>
<dt><i class="term">Terminal Cache</i> (TC)</dt>
<dd><p>A cache of characters read from IN, with their location in IN as pair
of line and column, keyed by the location in IN, this time as
character offset from the beginning of IN.
It is a performance aid for backtracking parsers, allowing them to
avoid a possibly expensive rereading of characters from IN, or even
enabling backtracking at, i.e. in the case of IN not randomly
seekable.</p>
<p>This part of the machine's state is used and modified by the
instructions defined in the section <span class="sectref"><a href="#subsection1">Input Handling</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Instruction Set</a></h2>
<p>With the machine's architectural state specified it is now possible to
specify the instruction set operating on that state and to be
implemented by any realization of the PARAM. The 37 instructions are
grouped roughly by the state they influence and/or query during their
execution.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Input Handling</a></h3>
<p>The instructions in this section mainly access IN, pulling the
characters to process into the machine.</p>
<dl class="definitions">
<dt><b class="cmd">input_next</b> <i class="arg">msg</i></dt>
<dd><p>This method reads the next character, i.e. the character after CL,
from IN. If successful this character becomes CC, CL is advanced by
one, ES is cleared, and the operation is recorded as a success in ST.</p>
<p>The operation may read the character from IN if the next character
is not yet known to TC. If successful the new character is stored in
TC, with its location (line, column), and the operation otherwise
behaves as specified above. Future reads from the same location,
possible due to backtracking, will then be satisfied from TC instead
of IN.</p>
<p>If, on the other hand, the end of IN was reached, the operation is
recorded as failed in ST, CL is left unchanged, and the pair of CL and
<i class="arg">msg</i> becomes the new ES.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Character Processing</a></h3>
<p>The instructions in this section mainly access CC, testing it against
character classes, ranges, and individual characters.</p>
<dl class="definitions">
<dt><b class="cmd">test_alnum</b></dt>
<dd><p>This instruction implements the special PE operator &quot;alnum&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_alpha</b></dt>
<dd><p>This instruction implements the special PE operator &quot;alpha&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_ascii</b></dt>
<dd><p>This instruction implements the special PE operator &quot;ascii&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_char</b> <i class="arg">char</i></dt>
<dd><p>This instruction implements the character matching operator, i.e. it
checks if CC is <i class="arg">char</i>.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_ddigit</b></dt>
<dd><p>This instruction implements the special PE operator &quot;ddigit&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_digit</b></dt>
<dd><p>This instruction implements the special PE operator &quot;digit&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_graph</b></dt>
<dd><p>This instruction implements the special PE operator &quot;graph&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_lower</b></dt>
<dd><p>This instruction implements the special PE operator &quot;lower&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_print</b></dt>
<dd><p>This instruction implements the special PE operator &quot;print&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_punct</b></dt>
<dd><p>This instruction implements the special PE operator &quot;punct&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_range</b> <i class="arg">chars</i> <i class="arg">chare</i></dt>
<dd><p>This instruction implements the range matching operator, i.e. it
checks if CC falls into the interval of characters spanned up by the
two characters from <i class="arg">chars</i> to <i class="arg">chare</i>, both inclusive.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_space</b></dt>
<dd><p>This instruction implements the special PE operator &quot;space&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_upper</b></dt>
<dd><p>This instruction implements the special PE operator &quot;upper&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_wordchar</b></dt>
<dd><p>This instruction implements the special PE operator &quot;wordchar&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
<dt><b class="cmd">test_xdigit</b></dt>
<dd><p>This instruction implements the special PE operator &quot;xdigit&quot;, which
checks if CC falls into the character class of the same name, or not.</p>
<p>Success and failure of the test are both recorded directly in ST.
Success further clears ES, wheras failure sets the pair of CL and
expected input (encoded as a leaf parsing expression) as the new ES
and then rewinds CL by one character, preparing the machine for
another parse attempt by a possible alternative.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Error Handling</a></h3>
<p>The instructions in this section mainly access ER and ES.</p>
<dl class="definitions">
<dt><b class="cmd">error_clear</b></dt>
<dd><p>This instruction clears ER.</p></dd>
<dt><b class="cmd">error_push</b></dt>
<dd><p>This instruction makes a copy of ER and pushes it on ES.</p></dd>
<dt><b class="cmd">error_pop_merge</b></dt>
<dd><p>This instruction takes the topmost entry of ES and merges the error
status it contains with ES, making the result the new ES.</p>
<p>The merge is governed by four rules, with the merge result</p>
<ol class="enumerated">
<li><p>Empty if both states are empty.</p></li>
<li><p>The non-empty state if only one of the two states is non-empty.</p></li>
<li><p>The state with the larger location, if the two states specify
different locations.</p></li>
<li><p>The pair of the location shared by the two states, and the set-union
of their messages for states at the same location.</p></li>
</ol></dd>
<dt><b class="cmd">error_nonterminal</b> <i class="arg">symbol</i></dt>
<dd><p>This is a guarded instruction. It does nothing if either ES is empty,
or if the location in ES is not just past the last location saved in
LS. Otherwise it sets the pair of that location and the nonterminal
<i class="arg">symbol</i> as the new ES.</p>
<p><em>Note</em>: In the above &quot;just past&quot; means &quot;that location plus one&quot;,
or also &quot;the location of the next character after that location&quot;.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Status Control</a></h3>
<p>The instructions in this section directly manipulate ST.</p>
<dl class="definitions">
<dt><b class="cmd">status_ok</b></dt>
<dd><p>This instruction sets ST to <b class="const">true</b>, recording a success.</p></dd>
<dt><b class="cmd">status_fail</b></dt>
<dd><p>This instruction sets ST to <b class="const">false</b>, recording a failure.</p></dd>
<dt><b class="cmd">status_negate</b></dt>
<dd><p>This instruction negates ST, turning a failure into a success and vice
versa.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Location Handling</a></h3>
<p>The instructions in this section access CL and LS.</p>
<dl class="definitions">
<dt><b class="cmd">loc_push</b></dt>
<dd><p>This instruction makes a copy of CL and pushes it on LS.</p></dd>
<dt><b class="cmd">loc_pop_discard</b></dt>
<dd><p>This instructions pops the last saved location from LS.</p></dd>
<dt><b class="cmd">loc_pop_rewind</b></dt>
<dd><p>This instruction pops the last saved location from LS and restores it
as CL.</p></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Nonterminal Execution</a></h3>
<p>The instructions in this section access and manipulate NC.</p>
<dl class="definitions">
<dt><b class="cmd">symbol_restore</b> <i class="arg">symbol</i></dt>
<dd><p>This instruction checks if NC contains data for the nonterminal
<i class="arg">symbol</i> at CL, or not. The result of the instruction is a boolean
flag, with <b class="const">True</b> indicating that data was found in the
cache. In that case the instruction has further updated the
architectural state of the machine with the cached information, namely
CL, ST, ER, and SV.</p>
<p>The method with which the instruction's result is transformed into
control flow is left undefined and the responsibility of the
implementation.</p></dd>
<dt><b class="cmd">symbol_save</b> <i class="arg">symbol</i></dt>
<dd><p>This instructions saves the current settings of CL, ST, ER, and SV in
NC, using the pair of nonterminal <i class="arg">symbol</i> and the last location
saved in LS as key.</p></dd>
</dl>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Value Construction</a></h3>
<p>The instructions in this section manipulate SV.</p>
<dl class="definitions">
<dt><b class="cmd">value_clear</b></dt>
<dd><p>This instruction clears SV.</p></dd>
<dt><b class="cmd">value_leaf</b> <i class="arg">symbol</i></dt>
<dd><p>This instruction constructs an AST node for <i class="arg">symbol</i> covering the
range of IN from one character after the last location saved on LS to
CL and stores it in SV. ...</p></dd>
<dt><b class="cmd">value_reduce</b> <i class="arg">symbol</i></dt>
<dd><p>This instruction generally behaves like <b class="cmd">value_nonterminal_leaf</b>,
except that it takes all AST nodes on ARS, if any, and makes them the
children of the new node, with the last node saved on ARS becoming the
right-most / last child. Note that ARS is not modfied by this
operation.</p></dd>
</dl>
</div>
<div id="subsection8" class="subsection"><h3><a name="subsection8">AST Construction</a></h3>
<p>The instructions in this section manipulate ARS and AS.</p>
<dl class="definitions">
<dt><b class="cmd">ast_value_push</b></dt>
<dd><p>This instruction makes a copy of SV and pushes it on ARS.</p></dd>
<dt><b class="cmd">ast_push</b></dt>
<dd><p>This instruction pushes the current state of ARS on AS and then clears
ARS.</p></dd>
<dt><b class="cmd">ast_pop_rewind</b></dt>
<dd><p>This instruction pops the last entry saved on AS and restores it as
the new state of ARS.</p></dd>
<dt><b class="cmd">ast_pop_discard</b></dt>
<dd><p>This instruction pops the last entry saved on AS.</p></dd>
</dl>
</div>
<div id="subsection9" class="subsection"><h3><a name="subsection9">Control Flow</a></h3>
<p>Normally this section would contain the specifications of the control
flow instructions of the PARAM, i.e. (un)conditional jumps and the
like. However, this part of the PARAM is intentionally left
unspecified. This allows the implementations to freely choose how to
implement control flow.</p>
<p>The implementation of this machine in Parser Tools, i.e the package
<b class="package"><a href="pt_rdengine.html">pt::rde</a></b>, is not only coded in Tcl, but also relies on Tcl
commands to provide it with control flow (instructions).</p>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Interaction of the Instructions with the Architectural State</a></h2>
<pre class="example">
Instruction		Inputs				Outputs
======================= =======================		====================
ast_pop_discard		AS			-&gt;	AS
ast_pop_rewind		AS			-&gt;	AS, ARS
ast_push		ARS, AS			-&gt;	AS
ast_value_push		SV, ARS			-&gt;	ARS
======================= =======================		====================
error_clear		-			-&gt;	ER
error_nonterminal sym	ER, LS			-&gt;	ER
error_pop_merge   	ES, ER			-&gt;	ER
error_push		ES, ER			-&gt;	ES
======================= =======================		====================
input_next msg		IN			-&gt;	TC, CL, CC, ST, ER
======================= =======================		====================
loc_pop_discard		LS			-&gt;	LS
loc_pop_rewind		LS			-&gt;	LS, CL
loc_push		CL, LS			-&gt;	LS
======================= =======================		====================
status_fail		-			-&gt;	ST
status_negate		ST			-&gt;	ST
status_ok		-			-&gt;	ST
======================= =======================		====================
symbol_restore sym	NC			-&gt;	CL, ST, ER, SV
symbol_save    sym	CL, ST, ER, SV LS	-&gt;	NC
======================= =======================		====================
test_alnum  		CC			-&gt;	ST, ER
test_alpha		CC			-&gt;	ST, ER
test_ascii		CC			-&gt;	ST, ER
test_char char		CC			-&gt;	ST, ER
test_ddigit		CC			-&gt;	ST, ER
test_digit		CC			-&gt;	ST, ER
test_graph		CC			-&gt;	ST, ER
test_lower		CC			-&gt;	ST, ER
test_print		CC			-&gt;	ST, ER
test_punct		CC			-&gt;	ST, ER
test_range chars chare	CC			-&gt;	ST, ER
test_space		CC			-&gt;	ST, ER
test_upper		CC			-&gt;	ST, ER
test_wordchar		CC			-&gt;	ST, ER
test_xdigit		CC			-&gt;	ST, ER
======================= =======================		====================
value_clear		-			-&gt;	SV
value_leaf symbol	LS, CL			-&gt;	SV
value_reduce symbol	ARS, LS, CL		-&gt;	SV
======================= =======================		====================
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a>, <a href="../../../../index.html#key25">virtual machine</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_parser_api.html.


































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt_parser_api - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_parser_api.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt_parser_api.i
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt_parser_api(i) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt_parser_api - Parser API</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Class API</a></li>
<li class="section"><a href="#section3">Instance API</a></li>
<li class="section"><a href="#section4">Usage</a></li>
<li class="section"><a href="#section5">AST serialization format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">className</b> <span class="opt">?<i class="arg">objectName</i>?</span></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">parse</b> <i class="arg">chan</i></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">parset</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This document describes the API shared by the grammar interpreter
provided by the package <b class="package"><a href="pt_peg_interp.html">pt::peg::interp</a></b> and the parsers
generated by the <b class="cmd"><a href="pt.html">pt</a></b> application for the result formats
<b class="const">critcl</b>, <b class="const">snit</b>, and <b class="const">oo</b> regarding access
to the actual parsing functionality.</p>
<p>Its intended audience are people who wish to create a parser for some
language of theirs and then use that parser within a Tcl-based package
or application.</p>
<p>It resides in the User Layer of Parser Tools.</p>
<p><img alt="arch_user_pkg" src="../../../../image/arch_user_pkg.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">Class API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">className</b> <span class="opt">?<i class="arg">objectName</i>?</span></a></dt>
<dd><p>The class command constructs parser instances, i.e. objects. The
result of the command is the fully-qualified name of the instance
command.</p>
<p>If no <i class="arg">objectName</i> is specified the class will generate and use an
automatic name. If the <i class="arg">objectName</i> was specified, but is not
fully qualified the command will be created in the curent namespace.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Instance API</a></h2>
<p>All parser instances provide at least the methods shown below:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the parser instance, releasing all claimed memory
and other resources, and deleting the instance command.</p>
<p>The result of the command is the empty string.</p></dd>
<dt><a name="3"><i class="arg">objectName</i> <b class="method">parse</b> <i class="arg">chan</i></a></dt>
<dd><p>This method runs the parser using the contents of <i class="arg">chan</i> as input
(starting at the current location in the channel), until parsing is
not possible anymore, either because parsing has completed, or run
into a syntax error.</p>
<p>Note here that the Parser Tools are based on Tcl 8.5+. In other words,
the channel argument is not restricted to files, sockets, etc. We have
the full power of <i class="term">reflected channels</i> available.</p>
<p>It should also be noted that the parser pulls the characters from the
input stream as it needs them. If a parser created by this package has
to be operated in a push aka event-driven manner it will be necessary
to go to Tcl 8.6+ and use the <b class="package"><a href="../coroutine/coro_auto.html">coroutine::auto</a></b> to wrap it
into a coroutine where <b class="cmd"><a href="../../../../index.html#key362">read</a></b> is properly changed for
push-operation.</p>
<p>Upon successful completion the command returns an abstract syntax tree
as its result.
This AST is in the form specified in section
<span class="sectref"><a href="#section5">AST serialization format</a></span>.
As a plain nested Tcl-list it can then be processed with any Tcl
commands the user likes, doing transformations, semantic checks, etc.
To help in this the package <b class="package"><a href="pt_astree.html">pt::ast</a></b> provides a set of
convenience commands for validation of the tree's basic structure,
printing it for debugging, and walking it either from the bottom up,
or top down.</p>
<p>When encountering a syntax error the command will throw an error instead.
This error will be a 4-element Tcl-list, containing, in the order
listed below:</p>
<ol class="enumerated">
<li><p>The string <b class="const">pt::rde</b> identifying it as parser runtime error.</p></li>
<li><p>The location of the parse error, as character offset from the
beginning of the parsed input.</p></li>
<li><p>The location of parse error, now as a 2-element list containing
line-number and column in the line.</p></li>
<li><p>A set of atomic parsing expressions indicating encoding the characters
and/or nonterminal symbols the parser expected to see at the location
of the parse error, but did not get.
 For the specification of atomic parsing expressions please see the
section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></li>
</ol></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">parset</b> <i class="arg">text</i></a></dt>
<dd><p>This method runs the parser using the string in <i class="arg">text</i> as input.
In all other ways it behaves like the method <b class="method">parse</b>, shown
above.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Usage</a></h2>
<p>A generated parser is used like this</p>
<pre class="example">
    package require the-parser-package ;# Generated by result-formats 'critcl', 'snit' or 'oo' of 'pt'.
    set parser [the-parser-class]
    set ast [$parser parse $channel]
    ... process the abstract syntax tree ...
</pre>
<p>When using a grammar interpreter for parsing some differences creep in</p>
<pre class="example">
    package require the-grammar-package ;# Generated by result-format 'container' of 'pt'.
    set grammar [the-grammar-class]
    package require pt::peg::interp
    set parser [pt::peg::interp]
    $parser use $grammar
    set ast [$parser parse $channel]
    $parser destroy
    ... process the abstract syntax tree ...
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">AST serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Abstract Syntax Trees (ASTs) as immutable values for transport,
comparison, etc.</p>
<p>Each node in an AST represents a nonterminal symbol of a grammar, and
the range of tokens/characters in the input covered by it. ASTs do not
contain terminal symbols, i.e. tokens/characters. These can be
recovered from the input given a symbol's location.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a tree may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any AST is the serialization of its root node.</p></li>
<li><p>The serialization of any node is a Tcl list containing at least three
elements.</p>
<ol class="enumerated">
<li><p>The first element is the name of the nonterminal symbol stored in the
node.</p></li>
<li><p>The second and third element are the locations of the first and last
token in the token stream the node represents (covers).</p>
<ol class="enumerated">
<li><p>Locations are provided as non-negative integer offsets from the
beginning of the token stream, with the first token found in the
stream located at offset 0 (zero).</p></li>
<li><p>The end location has to be equal to or larger than the start location.</p></li>
</ol>
</li>
<li><p>All elements after the first three represent the children of the node,
which are themselves nodes. This means that the serializations of
nodes without children, i.e. leaf nodes, have exactly three elements.
The children are stored in the list with the leftmost child first, and
the rightmost child last.</p></li>
</ol>
</li>
</ol></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of an abstract syntax tree has the format
as specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this tree.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the parsing expression grammar below</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>and the input string</p>
<pre class="example"> 120+5 </pre>
<p>then a parser should deliver the abstract syntax tree below (except for whitespace)</p>
<pre class="example">
set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}
</pre>
<p>Or, more graphical</p>
<p><img alt="expr_ast" src="../../../../image/expr_ast.png"></p>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_container.html.

























































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::container - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_container.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::container.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::container(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::container - PEG Storage</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Class API</a></li>
<li class="subsection"><a href="#subsection2">Object API</a></li>
</ul>
</li>
<li class="section"><a href="#section2">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section3">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection4">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">pt::peg::container <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::peg</b> <i class="arg">objectName</i> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">&lt;--</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">src</i>?</span></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">clear</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">importer</b></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">importer</b> <i class="arg">object</i></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">exporter</b></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">exporter</b> <i class="arg">object</i></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">=</b> <i class="arg">source</i></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">--&gt;</b> <i class="arg">destination</i></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">deserialize =</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">deserialize +=</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">start</b></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">start</b> <i class="arg">pe</i></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">nonterminals</b></a></li>
<li><a href="#16"><i class="arg">objectName</i> <b class="method">modes</b></a></li>
<li><a href="#17"><i class="arg">objectName</i> <b class="method">modes</b> <i class="arg">dict</i></a></li>
<li><a href="#18"><i class="arg">objectName</i> <b class="method">rules</b></a></li>
<li><a href="#19"><i class="arg">objectName</i> <b class="method">rules</b> <i class="arg">dict</i></a></li>
<li><a href="#20"><i class="arg">objectName</i> <b class="method">add</b> <span class="opt">?<i class="arg">nt</i>...?</span></a></li>
<li><a href="#21"><i class="arg">objectName</i> <b class="method">remove</b> <span class="opt">?<i class="arg">nt</i>...?</span></a></li>
<li><a href="#22"><i class="arg">objectName</i> <b class="method">exists</b> <i class="arg">nt</i></a></li>
<li><a href="#23"><i class="arg">objectName</i> <b class="method">rename</b> <i class="arg">ntold</i> <i class="arg">ntnew</i></a></li>
<li><a href="#24"><i class="arg">objectName</i> <b class="method">mode</b> <i class="arg">nt</i></a></li>
<li><a href="#25"><i class="arg">objectName</i> <b class="method">mode</b> <i class="arg">nt</i> <i class="arg">mode</i></a></li>
<li><a href="#26"><i class="arg">objectName</i> <b class="method">rule</b> <i class="arg">nt</i></a></li>
<li><a href="#27"><i class="arg">objectName</i> <b class="method">rule</b> <i class="arg">nt</i> <i class="arg">pe</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides a container class for parsing expression
grammars, with each instance storing a single grammar and allowing the
user to manipulate and query its definition.</p>
<p>It resides in the Storage section of the Core Layer of Parser Tools,
and is one of the three pillars the management of parsing expression
grammars resides on.</p>
<p><img alt="arch_core_container" src="../../../../image/arch_core_container.png"></p>
<p>The other two pillars are, as shown above</p>
<ol class="enumerated">
<li><p><i class="term"><a href="pt_peg_import.html">PEG Import</a></i>, and</p></li>
<li><p><i class="term"><a href="pt_peg_export.html">PEG Export</a></i></p></li>
</ol>
<p>Packages related to this are:</p>
<dl class="definitions">
<dt><b class="package"><a href="pt_rdengine.html">pt::rde</a></b></dt>
<dd><p>This package provides an implementation of PARAM, a virtual machine
for the parsing of a channel, geared towards the needs of handling
PEGs.</p></dd>
<dt><b class="package"><a href="pt_peg_interp.html">pt::peg::interp</a></b></dt>
<dd><p>This package implements an interpreter for PEGs on top of the virtual
machine provided by <b class="package">pt::peg::rde</b></p></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Class API</a></h3>
<p>The package exports the API described here.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::peg</b> <i class="arg">objectName</i> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">&lt;--</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">src</i>?</span></a></dt>
<dd><p>The command creates a new container object for a parsing expression
grammar and returns the fully qualified name of the object command as
its result. The API of this object command is described in the section
<span class="sectref"><a href="#subsection2">Object API</a></span>. It may be used to invoke various operations on
the object.</p>
<p>The new container will be empty if no <i class="arg">src</i> is specified. Otherwise
it will contain a copy of the grammar contained in the <i class="arg">src</i>.
All operators except <b class="const">deserialize</b> interpret <i class="arg">src</i> as a
container object command. The <b class="const">deserialize</b> operator interprets
<i class="arg">src</i> as the serialization of a parsing expression grammar
instead, as specified in section <span class="sectref"><a href="#section2">PEG serialization format</a></span>.</p>
<p>An empty grammar has no nonterminal symbols, and the start expression
is the empty expression, i.e. epsilon. It is <i class="term">valid</i>, but not
<i class="term">useful</i>.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object API</a></h3>
<p>All objects created by this package provide the following methods for
the manipulation and querying of their contents:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object, releasing all claimed memory, and
deleting the associated object command.</p></dd>
<dt><a name="3"><i class="arg">objectName</i> <b class="method">clear</b></a></dt>
<dd><p>This method resets the object to contain the empty grammar. It does
<em>not</em> destroy the object itself.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">importer</b></a></dt>
<dd><p>This method returns the import manager object currently attached to
the container, if any.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">importer</b> <i class="arg">object</i></a></dt>
<dd><p>This method attaches the <i class="arg">object</i> as import manager to the
container, and returns it as the result of the command.
Note that the <i class="arg">object</i> is <em>not</em> put into ownership of the
container. I.e., destruction of the container will <em>not</em> destroy
the <i class="arg">object</i>.</p>
<p>It is expected that <i class="arg">object</i> provides a method named
<b class="method">import text</b> which takes a text and a format name, and
returns the canonical serialization of the table of contents contained in
the text, assuming the given format.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">exporter</b></a></dt>
<dd><p>This method returns the export manager object currently attached to
the container, if any.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">exporter</b> <i class="arg">object</i></a></dt>
<dd><p>This method attaches the <i class="arg">object</i> as export manager to the
container, and returns it as the result of the command.
Note that the <i class="arg">object</i> is <em>not</em> put into ownership of the
container. I.e., destruction of the container will <em>not</em> destroy
the <i class="arg">object</i>.</p>
<p>It is expected that <i class="arg">object</i> provides a method named
<b class="method">export object</b> which takes the container and a format name,
and returns a text encoding table of contents stored in the container, in
the given format. It is further expected that the <i class="arg">object</i> will
use the container's method <b class="method">serialize</b> to obtain the
serialization of the table of contents from which to generate the text.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">=</b> <i class="arg">source</i></a></dt>
<dd><p>This method assigns the contents of the PEG object <i class="arg">source</i> to
ourselves, overwriting the existing definition. This is the assignment
operator for grammars.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">objectName</i> <b class="method">deserialize =</b> [<i class="arg">source</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">--&gt;</b> <i class="arg">destination</i></a></dt>
<dd><p>This method assigns our contents to the PEG object <i class="arg">destination</i>,
overwriting the existing definition. This is the reverse assignment
operator for grammars.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">destination</i> <b class="method">deserialize =</b> [<i class="arg">objectName</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method returns our grammar in some textual form usable for
transfer, persistent storage, etc. If no <i class="arg">format</i> is not specified
the returned result is the canonical serialization of the grammar, as
specified in the section <span class="sectref"><a href="#section2">PEG serialization format</a></span>.</p>
<p>Otherwise the object will use the attached export manager to convert
the data to the specified format. In that case the method will fail
with an error if the container has no export manager attached to it.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">deserialize =</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This is the complementary method to <b class="method">serialize</b>.
It replaces the current definition with the grammar contained in the
<i class="arg">data</i>. If no <i class="arg">format</i> was specified it is assumed to be the
regular serialization of a grammar, as specified in the section
<span class="sectref"><a href="#section2">PEG serialization format</a></span></p>
<p>Otherwise the object will use the attached import manager to convert
the data from the specified format to a serialization it can handle.
In that case the method will fail with an error if the container has
no import manager attached to it.</p>
<p>The result of the method is the empty string.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">deserialize +=</b> <i class="arg">data</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method behaves like <b class="method">deserialize =</b> in its essentials,
except that it merges the grammar in the <i class="arg">data</i> to its
contents instead of replacing it. 
The method will fail with an error and leave the grammar unchanged if
merging is not possible, i.e. would produce an invalid grammar.</p>
<p>The result of the method is the empty string.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">start</b></a></dt>
<dd><p>This method returns the current start expression of the grammar.</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">start</b> <i class="arg">pe</i></a></dt>
<dd><p>This method defines the <i class="term">start expression</i> of the grammar. It
replaces the current start expression with the parsing expression
<i class="arg">pe</i>, and returns the new start expression.</p>
<p>The method will fail with an error and leave the grammar unchanged if
<i class="arg">pe</i> does not contain a valid parsing expression as specified in
the section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">nonterminals</b></a></dt>
<dd><p>This method returns the set of all nonterminal symbols known to the
grammar.</p></dd>
<dt><a name="16"><i class="arg">objectName</i> <b class="method">modes</b></a></dt>
<dd><p>This method returns a dictionary mapping the set of all nonterminal
symbols known to the grammar to their semantic modes.</p></dd>
<dt><a name="17"><i class="arg">objectName</i> <b class="method">modes</b> <i class="arg">dict</i></a></dt>
<dd><p>This method takes a dictionary mapping a set of nonterminal symbols
known to the grammar to their semantic modes, and returns the new full
mapping of nonterminal symbols to semantic modes.</p>
<p>The method will fail with an error if any of the nonterminal symbols
in the dictionary is not known to the grammar, or the empty string,
i.e. an invalid nonterminal symbol, or if any the chosen <i class="arg">mode</i>s
is not one of the legal values.</p></dd>
<dt><a name="18"><i class="arg">objectName</i> <b class="method">rules</b></a></dt>
<dd><p>This method returns a dictionary mapping the set of all nonterminal
symbols known to the grammar to their parsing expressions (right-hand
sides).</p></dd>
<dt><a name="19"><i class="arg">objectName</i> <b class="method">rules</b> <i class="arg">dict</i></a></dt>
<dd><p>This method takes a dictionary mapping a set of nonterminal symbols
known to the grammar to their parsing expressions (right-hand sides),
and returns the new full mapping of nonterminal symbols to parsing
expressions.</p>
<p>The method will fail with an error any of the nonterminal symbols in
the dictionary is not known to the grammar, or the empty string,
i.e. an invalid nonterminal symbol, or any of the chosen parsing
expressions is not a valid parsing expression as specified in the
section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><a name="20"><i class="arg">objectName</i> <b class="method">add</b> <span class="opt">?<i class="arg">nt</i>...?</span></a></dt>
<dd><p>This method adds the nonterminal symbols <i class="arg">nt</i>, etc. to the
grammar, and defines default semantic mode and expression for it
(<b class="const">value</b> and <b class="const">epsilon</b> respectively).
The method returns the empty string as its result.</p>
<p>The method will fail with an error and leaves the grammar unchanged if
any of the nonterminal symbols are either already defined in our
grammar, or are the empty string (an invalid nonterminal symbol).</p>
<p>The method does nothing if no symbol was specified as argument.</p></dd>
<dt><a name="21"><i class="arg">objectName</i> <b class="method">remove</b> <span class="opt">?<i class="arg">nt</i>...?</span></a></dt>
<dd><p>This method removes the named nonterminal symbols <i class="arg">nt</i>, etc. from
the set of nonterminal symbols known to our grammar.
The method returns the empty string as its result.</p>
<p>The method will fail with an error and leave the grammar unchanged if
any of the nonterminal symbols is not known to the grammar, or is the
empty string, i.e. an invalid nonterminal symbol.</p></dd>
<dt><a name="22"><i class="arg">objectName</i> <b class="method">exists</b> <i class="arg">nt</i></a></dt>
<dd><p>This method tests whether the nonterminal symbol <i class="arg">nt</i> is known
to our grammar or not.
The result is a boolean value. It will be set to <b class="const">true</b> if
<i class="arg">nt</i> is known, and <b class="const">false</b> otherwise.</p>
<p>The method will fail with an error if <i class="arg">nt</i> is the empty string,
i.e. an invalid nonterminal symbol.</p></dd>
<dt><a name="23"><i class="arg">objectName</i> <b class="method">rename</b> <i class="arg">ntold</i> <i class="arg">ntnew</i></a></dt>
<dd><p>This method renames the nonterminal symbol <i class="arg">ntold</i> to <i class="arg">ntnew</i>.
The method returns the empty string as its result.</p>
<p>The method will fail with an error and leave the grammar unchanged if
either <i class="arg">ntold</i> is not known to the grammar, or <i class="arg">ntnew</i> is
already known, or any of them is the empty string, i.e. an invalid
nonterminal symbol.</p></dd>
<dt><a name="24"><i class="arg">objectName</i> <b class="method">mode</b> <i class="arg">nt</i></a></dt>
<dd><p>This method returns the current semantic mode for the nonterminal
symbol <i class="arg">nt</i>.</p>
<p>The method will fail with an error if <i class="arg">nt</i> is not known to the
grammar, or the empty string, i.e. an invalid nonterminal symbol.</p></dd>
<dt><a name="25"><i class="arg">objectName</i> <b class="method">mode</b> <i class="arg">nt</i> <i class="arg">mode</i></a></dt>
<dd><p>This mode sets the semantic mode for the nonterminal symbol <i class="arg">nt</i>,
and returns the new mode.
The method will fail with an error if <i class="arg">nt</i> is not known to the
grammar, or the empty string, i.e. an invalid nonterminal symbol, or
the chosen <i class="arg">mode</i> is not one of the legal values.</p>
<p>The following modes are legal:</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
<dt><a name="26"><i class="arg">objectName</i> <b class="method">rule</b> <i class="arg">nt</i></a></dt>
<dd><p>This method returns the current parsing expression (right-hand side)
for the nonterminal symbol <i class="arg">nt</i>.</p>
<p>The method will fail with an error if <i class="arg">nt</i> is not known to the
grammar, or the empty string, i.e. an invalid nonterminal symbol.</p></dd>
<dt><a name="27"><i class="arg">objectName</i> <b class="method">rule</b> <i class="arg">nt</i> <i class="arg">pe</i></a></dt>
<dd><p>This method set the parsing expression (right-hand side) of the
nonterminal <i class="arg">nt</i> to <i class="arg">pe</i>, and returns the new parsing
expression.</p>
<p>The method will fail with an error if <i class="arg">nt</i> is not known to the
grammar, or the empty string, i.e. an invalid nonterminal symbol, or
<i class="arg">pe</i> does not contain a valid parsing expression as specified in
the section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_container_peg.html.




































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::container::peg - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_container_peg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::container::peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::container::peg(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::container::peg - PEG Storage. Canned PEG grammar specification</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">pt::peg::container::peg <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg::container</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides a sub-type of <b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b> which
is preloaded with a parsing expression grammar describing a textual
format for parsing expression grammars.</p>
<p>The sub-type provides the exact same API as
<b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b>. Instead of duplicating its contents the
reader is asked to read the referenced document.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_export.html.

























































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::export - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_export.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::export.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::export(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::export - PEG Export</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section3">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection4">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection5">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">configuration</b></li>
<li>package require <b class="pkgname">pt::peg</b></li>
<li>package require <b class="pkgname">pluginmgr</b></li>
<li>package require <b class="pkgname">pt::peg::export <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::peg::export</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">export serial</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">export object</b> <i class="arg">object</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">configuration names</b></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">configuration get</b></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">configuration set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">configuration unset</b> <i class="arg">pattern</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides a manager for parsing expression grammars, with
each instance handling a set of plugins for the export of them to
other formats, i.e. their conversion to, for example <i class="term"><a href="../../../../index.html#key5">nroff</a></i>,
<i class="term"><a href="../../../../index.html#key1">HTML</a></i>, etc.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools,
and is one of the three pillars the management of parsing expression
grammars resides on.</p>
<p><img alt="arch_core_export" src="../../../../image/arch_core_export.png"></p>
<p>The other two pillars are, as shown above</p>
<ol class="enumerated">
<li><p><i class="term"><a href="pt_peg_import.html">PEG Import</a></i>, and</p></li>
<li><p><i class="term"><a href="pt_peg_container.html">PEG Storage</a></i></p></li>
</ol>
<p>For information about the data structure which is the major input to
the manager objects provided by this package see the section
<span class="sectref"><a href="#section3">PEG serialization format</a></span>.</p>
<p>The plugin system of this class is based on the package
<b class="package"><a href="../pluginmgr/pluginmgr.html">pluginmgr</a></b>, and configured to look for plugins using</p>
<ol class="enumerated">
<li><p>the environment variable <b class="variable">GRAMMAR_PEG_EXPORT_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">GRAMMAR_PEG_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">GRAMMAR_PLUGINS</b>,</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/peg/export/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/peg/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/peg/export/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/peg/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/plugins</b>&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\GRAMMAR\PEG\EXPORT\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\GRAMMAR\PEG\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\GRAMMAR\PLUGINS&quot;</p></li>
</ol>
<p>The last three are used only when the package is run on a machine
using the Windows(tm) operating system.</p>
<p>The whole system is delivered with three predefined export plugins,
namely</p>
<dl class="definitions">
<dt>container</dt>
<dd><p>See <i class="term">PEG Export Plugin. To CONTAINER format</i> for details.</p></dd>
<dt>json</dt>
<dd><p>See <i class="term">PEG Export Plugin. To JSON format</i> for details.</p></dd>
<dt>peg</dt>
<dd><p>See <i class="term">PEG Export Plugin. To PEG format</i> for details.</p></dd>
</dl>
<p>For readers wishing to write their own export plugin for some format,
i.e. <i class="term">plugin writer</i>s, reading and understanding the
<i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i> specification is an absolute
necessity, as it documents the interaction between this package and
its plugins in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::peg::export</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new export manager object with an associated
Tcl command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command
is explained in full detail in the sections <span class="sectref"><a href="#subsection2">Object command</a></span>
and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::pt::peg::export</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">export serial</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method takes the canonical serialization of a parsing expression
grammar stored in <i class="arg">serial</i> and converts it to the specified
<i class="arg">format</i>, using the export plugin for the format. This will fail
with an error if no plugin could be found for the format.
The string generated by the conversion process is returned as
the result of this method.</p>
<p>If no format is specified the method defaults to <b class="const">text</b>.</p>
<p>The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section3">PEG serialization format</a></span>.</p>
<p>The plugin has to conform to the interface documented in the
<i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i> specification.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">export object</b> <i class="arg">object</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">export serial</b>
method described by the previous item.
It expects that <i class="arg">object</i> is an object command supporting a
<b class="method">serialize</b> method returning the canonical serialization of a
parsing expression grammar. It invokes that method, feeds the result
into <b class="method">export serial</b> and returns the resulting string as its
own result.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">configuration names</b></a></dt>
<dd><p>This method returns a list containing the names of all configuration
options currently known to the object.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">configuration get</b></a></dt>
<dd><p>This method returns a dictionary containing the names and values of
all configuration options currently known to the object.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">configuration set</b> <i class="arg">name</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>This method sets the configuration option <i class="arg">name</i> to the
specified <i class="arg">value</i> and returns the new value of the option.</p>
<p>If no value is specified it simply returns the current value, without
changing it.</p>
<p>Note that these configuration options and their values are simply
passed to a plugin when the actual export is performed. It is the
plugin which checks the validity, not the manager.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">configuration unset</b> <i class="arg">pattern</i>...</a></dt>
<dd><p>This method unsets all configuration options matching the specified
glob <i class="arg">pattern</i>s. If no pattern is specified it will unset all
currently defined configuration options.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section4">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section4">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_export_container.html.






































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::export::container - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_export_container.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::export::container.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::export::container(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::export::container - PEG Export Plugin. Write CONTAINER format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">Grammar Container</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::export::container <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg::to::container</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the parsing expression grammar export plugin
for the generation of CONTAINER markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools and
is intended to be used by <b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>, the export
manager, sitting between it and the corresponding core conversion
functionality provided by <b class="package"><a href="pt_peg_to_container.html">pt::peg::to::container</a></b>.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
<p>While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:</p>
<ol class="enumerated">
<li><p>In an untrusted environment the proper access is through the package
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b> and the export manager objects it
provides.</p></li>
<li><p>In a trusted environment however simply use the package
<b class="package"><a href="pt_peg_to_container.html">pt::peg::to::container</a></b> and access the core
conversion functionality directly.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Plugin API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates CONTAINER markup encoding the grammar.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The CONTAINER export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>enum <i class="arg">mode</i></dt>
<dd><p>The value of this configuration variable controls which methods of
<b class="package"><a href="pt_pegrammar.html">pt::peg</a></b> instances the plugin will use to specify the
grammar. There are two legal values</p>
<dl class="definitions">
<dt><b class="const">bulk</b></dt>
<dd><p>In this mode the methods <b class="method">start</b>, <b class="method">add</b>, <b class="method">modes</b>,
and <b class="method">rules</b> are used to specify the grammar in a bulk manner,
i.e. as a set of nonterminal symbols, and two dictionaries mapping
from the symbols to their semantic modes and parsing expressions.</p>
<p>This mode is the default.</p></dd>
<dt><b class="const">incremental</b></dt>
<dd><p>In this mode the methods <b class="method">start</b>, <b class="method">add</b>, <b class="method">mode</b>,
and <b class="method">rule</b> are used to specify the grammar piecemal, with each
nonterminal having its own block of defining commands.</p></dd>
</dl></dd>
<dt>string <i class="arg">template</i></dt>
<dd><p>If this configuration variable is set it is assumed to contain a
string into which to put the generated code and other configuration
data. The various locations are expected to be specified with the
following placeholders:</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">CONTAINER</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">name</b>.</p></dd>
<dt><b class="const">@mode@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">mode</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated code.</p></dd>
</dl>
<p>If this configuration variable is not set, or empty, then the plugin
falls back to a standard template, which is defined as &quot;<b class="const">@code@</b>&quot;.</p></dd>
</dl>
<p><em>Note</em> that this plugin may ignore the standard configuration
variables <b class="variable">user</b>, <b class="variable">format</b>, <b class="variable">file</b>, and their values,
depending on the chosen template.</p>
<p>The content of the standard configuration variable <b class="variable">name</b>, if set,
is used as name of the grammar in the output. Otherwise the plugin
falls back to the default name <b class="const">a_pe_grammar</b>.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Grammar Container</a></h2>
<p>The <b class="const">container</b> format is another form of describing parsing
expression grammars. While data in this format is executable it does
not constitute a parser for the grammar. It always has to be used in
conjunction with the package <b class="package"><a href="pt_peg_interp.html">pt::peg::interp</a></b>, a grammar
interpreter.</p>
<p>The format represents grammars by a <b class="cmd">snit::type</b>, i.e. class,
whose instances are API-compatible to the instances of the
<b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b> package, and which are preloaded with the
grammar in question.</p>
<p>It has no direct formal specification beyond what was said above.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>one possible CONTAINER serialization for it is</p>
<pre class="example">
snit::type a_pe_grammar {
    constructor {} {
        install myg using pt::peg::container ${selfns}::G
        $myg start {n Expression}
        $myg add   AddOp Digit Expression Factor MulOp Number Sign Term
        $myg modes {
            AddOp      value
            Digit      value
            Expression value
            Factor     value
            MulOp      value
            Number     value
            Sign       value
            Term       value
        }
        $myg rules {
            AddOp      {/ {t -} {t +}}
            Digit      {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}
            Expression {/ {x {t \50} {n Expression} {t \51}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}}
            Factor     {x {n Term} {* {x {n AddOp} {n Term}}}}
            MulOp      {/ {t *} {t /}}
            Number     {x {? {n Sign}} {+ {n Digit}}}
            Sign       {/ {t -} {t +}}
            Term       {n Number}
        }
        return
    }
    component myg
    delegate method * to myg
}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key308">CONTAINER</a>, <a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_export_json.html.



























































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::export::json - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_export_json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::export::json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::export::json(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::export::json - PEG Export Plugin. Write JSON format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">JSON Grammar Exchange Format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::export::json <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg::to::json</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the parsing expression grammar export plugin
for the generation of JSON markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools and
is intended to be used by <b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>, the export
manager, sitting between it and the corresponding core conversion
functionality provided by <b class="package"><a href="pt_peg_to_json.html">pt::peg::to::json</a></b>.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
<p>While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:</p>
<ol class="enumerated">
<li><p>In an untrusted environment the proper access is through the package
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b> and the export manager objects it
provides.</p></li>
<li><p>In a trusted environment however simply use the package
<b class="package"><a href="pt_peg_to_json.html">pt::peg::to::json</a></b> and access the core
conversion functionality directly.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Plugin API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates JSON markup encoding the grammar.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The JSON export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>boolean <i class="arg">indented</i></dt>
<dd><p>If this flag is set the plugin will break the generated JSON code
across lines and indent it according to its inner structure, with each
key of a dictionary on a separate line.</p>
<p>If this flag is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt>boolean <i class="arg">aligned</i></dt>
<dd><p>If this flag is set the generator ensures that the values for the keys
in a dictionary are vertically aligned with each other, for a nice
table effect. To make this work this also implies that <b class="variable">indented</b>
is set.</p>
<p>If this flag is not set (the default), the output is formatted as per
the value of <b class="variable">indented</b>, without trying to align the values for
dictionary keys.</p></dd>
</dl>
<p><em>Note</em> that this plugin ignores the standard configuration
variables <b class="variable">user</b>, <b class="variable">format</b>, <b class="variable">file</b>, and <b class="variable">name</b>, and
their values.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">JSON Grammar Exchange Format</a></h2>
<p>The <b class="const">json</b> format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.</p>
<p>It is formally specified by the rules below:</p>
<ol class="enumerated">
<li><p>The JSON of any PEG is a JSON object.</p></li>
<li><p>This object holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol>
<p>As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
<span class="sectref"><a href="#section5">PEG serialization format</a></span>, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>a JSON serialization for it is</p>
<pre class="example">
{
    &quot;pt::grammar::peg&quot; : {
        &quot;rules&quot; : {
            &quot;AddOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Digit&quot;     : {
                &quot;is&quot;   : &quot;\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Expression&quot; : {
                &quot;is&quot;   : &quot;\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Factor&quot;    : {
                &quot;is&quot;   : &quot;x {n Term} {* {x {n AddOp} {n Term}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;MulOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t *} {t \/}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Number&quot;    : {
                &quot;is&quot;   : &quot;x {? {n Sign}} {+ {n Digit}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Sign&quot;      : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Term&quot;      : {
                &quot;is&quot;   : &quot;n Number&quot;,
                &quot;mode&quot; : &quot;value&quot;
            }
        },
        &quot;start&quot; : &quot;n Expression&quot;
    }
}
</pre>
<p>and a Tcl serialization of the same is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
<p>The similarity of the latter to the JSON should be quite obvious.</p>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key232">JSON</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_export_peg.html.

















































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::export::peg - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_export_peg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::export::peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::export::peg(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::export::peg - PEG Export Plugin. Write PEG format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Configuration</a></li>
<li class="section"><a href="#section4">PEG Specification Language</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::export::peg <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg::to::peg</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the parsing expression grammar export plugin
for the generation of PEG markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools and
is intended to be used by <b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>, the export
manager, sitting between it and the corresponding core conversion
functionality provided by <b class="package"><a href="pt_peg_to_peg.html">pt::peg::to::peg</a></b>.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
<p>While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:</p>
<ol class="enumerated">
<li><p>In an untrusted environment the proper access is through the package
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b> and the export manager objects it
provides.</p></li>
<li><p>In a trusted environment however simply use the package
<b class="package"><a href="pt_peg_to_peg.html">pt::peg::to::peg</a></b> and access the core
conversion functionality directly.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Plugin API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key148">export</a></b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, the <i class="arg">configuration</i>, a dictionary,
and generates PEG markup encoding the grammar.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Configuration</a></h2>
<p>The PEG export plugin recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="arguments">
<dt>string <i class="arg">template</i></dt>
<dd><p>If this configuration variable is set it is assumed to contain a
string into which to put the generated text and other configuration
data. The various locations are expected to be specified with the
following placeholders:</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">PEG</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">name</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated text.</p></dd>
</dl>
<p>If this configuration variable is not set, or empty, then the plugin
falls back to a standard template, which is defined as &quot;<b class="const">@code@</b>&quot;.</p></dd>
</dl>
<p><em>Note</em> that this plugin may ignore the standard configuration
variables <b class="variable">user</b>, <b class="variable">format</b>, <b class="variable">file</b>, and their values,
depending on the chosen template.</p>
<p>The content of the standard configuration variable <b class="variable">name</b>, if set,
is used as name of the grammar in the output. Otherwise the plugin
falls back to the default name <b class="const">a_pe_grammar</b>.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">PEG Specification Language</a></h2>
<p><b class="const">peg</b>, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.</p>
<p>It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the <i class="term"><a href="pt_peg_language.html">PEG Language Tutorial</a></i>.</p>
<pre class="example">
PEG pe-grammar-for-peg (Grammar)
	# --------------------------------------------------------------------
        # Syntactical constructs
        Grammar         &lt;- WHITESPACE Header Definition* Final EOF ;
        Header          &lt;- PEG Identifier StartExpr ;
        Definition      &lt;- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       &lt;- (VOID / LEAF) COLON ;
        Expression      &lt;- Sequence (SLASH Sequence)* ;
        Sequence        &lt;- Prefix+ ;
        Prefix          &lt;- (AND / NOT)? Suffix ;
        Suffix          &lt;- Primary (QUESTION / STAR / PLUS)? ;
        Primary         &lt;- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         &lt;- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           &lt;- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           &lt;- Char TO Char / Char ;
        StartExpr       &lt;- OPEN Expression CLOSE ;
void:   Final           &lt;- END SEMICOLON WHITESPACE ;
        # --------------------------------------------------------------------
        # Lexing constructs
        Identifier      &lt;- Ident WHITESPACE ;
leaf:   Ident           &lt;- ('_' / ':' / &lt;alpha&gt;) ('_' / ':' / &lt;alnum&gt;)* ;
        Char            &lt;- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;
leaf:   CharSpecial     &lt;- &quot;\\&quot; [nrt'&quot;\[\]\\] ;
leaf:   CharOctalFull   &lt;- &quot;\\&quot; [0-2][0-7][0-7] ;
leaf:   CharOctalPart   &lt;- &quot;\\&quot; [0-7][0-7]? ;
leaf:   CharUnicode     &lt;- &quot;\\&quot; 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   &lt;- !&quot;\\&quot; . ;
void:   HexDigit        &lt;- [0-9a-fA-F] ;
void:   TO              &lt;- '-'           ;
void:   OPENB           &lt;- &quot;[&quot;           ;
void:   CLOSEB          &lt;- &quot;]&quot;           ;
void:   APOSTROPH       &lt;- &quot;'&quot;           ;
void:   DAPOSTROPH      &lt;- '&quot;'           ;
void:   PEG             &lt;- &quot;PEG&quot;   WHITESPACE ;
void:   IS              &lt;- &quot;&lt;-&quot;    WHITESPACE ;
leaf:   VOID            &lt;- &quot;void&quot;  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            &lt;- &quot;leaf&quot;  WHITESPACE ; # Implies that definition has no terminals.
void:   END             &lt;- &quot;END&quot;   WHITESPACE ;
void:   SEMICOLON       &lt;- &quot;;&quot;     WHITESPACE ;
void:   COLON           &lt;- &quot;:&quot;     WHITESPACE ;
void:   SLASH           &lt;- &quot;/&quot;     WHITESPACE ;
leaf:   AND             &lt;- &quot;&amp;&quot;     WHITESPACE ;
leaf:   NOT             &lt;- &quot;!&quot;     WHITESPACE ;
leaf:   QUESTION        &lt;- &quot;?&quot;     WHITESPACE ;
leaf:   STAR            &lt;- &quot;*&quot;     WHITESPACE ;
leaf:   PLUS            &lt;- &quot;+&quot;     WHITESPACE ;
void:   OPEN            &lt;- &quot;(&quot;     WHITESPACE ;
void:   CLOSE           &lt;- &quot;)&quot;     WHITESPACE ;
leaf:   DOT             &lt;- &quot;.&quot;     WHITESPACE ;
leaf:   ALNUM           &lt;- &quot;&lt;alnum&gt;&quot;    WHITESPACE ;
leaf:   ALPHA           &lt;- &quot;&lt;alpha&gt;&quot;    WHITESPACE ;
leaf:   ASCII           &lt;- &quot;&lt;ascii&gt;&quot;    WHITESPACE ;
leaf:   CONTROL         &lt;- &quot;&lt;control&gt;&quot;  WHITESPACE ;
leaf:   DDIGIT          &lt;- &quot;&lt;ddigit&gt;&quot;   WHITESPACE ;
leaf:   DIGIT           &lt;- &quot;&lt;digit&gt;&quot;    WHITESPACE ;
leaf:   GRAPH           &lt;- &quot;&lt;graph&gt;&quot;    WHITESPACE ;
leaf:   LOWER           &lt;- &quot;&lt;lower&gt;&quot;    WHITESPACE ;
leaf:   PRINTABLE       &lt;- &quot;&lt;print&gt;&quot;    WHITESPACE ;
leaf:   PUNCT           &lt;- &quot;&lt;punct&gt;&quot;    WHITESPACE ;
leaf:   SPACE           &lt;- &quot;&lt;space&gt;&quot;    WHITESPACE ;
leaf:   UPPER           &lt;- &quot;&lt;upper&gt;&quot;    WHITESPACE ;
leaf:   WORDCHAR        &lt;- &quot;&lt;wordchar&gt;&quot; WHITESPACE ;
leaf:   XDIGIT          &lt;- &quot;&lt;xdigit&gt;&quot;   WHITESPACE ;
void:   WHITESPACE      &lt;- (&quot; &quot; / &quot;\t&quot; / EOL / COMMENT)* ;
void:   COMMENT         &lt;- '#' (!EOL .)* EOL ;
void:   EOL             &lt;- &quot;\n\r&quot; / &quot;\n&quot; / &quot;\r&quot; ;
void:   EOF             &lt;- !. ;
        # --------------------------------------------------------------------
END;
</pre>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Our example specifies the grammar for a basic 4-operation calculator.</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as</p>
<pre class="example">
PEG calculator (Expression)
    Sign       &lt;- [-+] 						;
    Number     &lt;- Sign? &lt;ddigit&gt;+				;
    Expression &lt;- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      &lt;- [*/]						;
    Factor     &lt;- Term (AddOp Term)*				;
    AddOp      &lt;- [-+]						;
    Term       &lt;- Number					;
END;
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key148">export</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_from_container.html.


































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::from::container - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_from_container.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::from::container.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::from::container(n) 0 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::from::container - PEG Conversion. From CONTAINER format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package does not exist.
There is no need for it.
The CONTAINER format for parsing expression grammars is a piece of Tcl
code which, then sourced, provides a class whose instances have the
grammar we wish to import loaded.
Another way of looking at this is, the CONTAINER output is its own
import package.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_from_json.html.



























































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::from::json - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_from_json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::from::json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::from::json(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::from::json - PEG Conversion. Read JSON format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">JSON Grammar Exchange Format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::from::json <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg</b></li>
<li>package require <b class="pkgname">json</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt::peg::from::json</b> <b class="method">convert</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the converter from JSON markup to
parsing expression grammars.</p>
<p>It resides in the Import section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the import manager provided by
<b class="package"><a href="pt_peg_import.html">pt::peg::import</a></b>. The latter is intented for use in untrusted
environments and done through the corresponding import plugin
<b class="package"><a href="pt_peg_import_json.html">pt::peg::import::json</a></b> sitting between converter
and import manager.</p>
<p><img alt="arch_core_iplugins" src="../../../../image/arch_core_iplugins.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Converter API found in the <i class="term"><a href="pt_from_api.html">Parser Tools Import API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt::peg::from::json</b> <b class="method">convert</b> <i class="arg">text</i></a></dt>
<dd><p>This command takes the JSON markup encoding a parsing
expression grammar and contained in <i class="arg">text</i>, and generates the
canonical serialization of said grammar, as specified in section
<span class="sectref"><a href="#section4">PEG serialization format</a></span>.
The created value is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">JSON Grammar Exchange Format</a></h2>
<p>The <b class="const">json</b> format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.</p>
<p>It is formally specified by the rules below:</p>
<ol class="enumerated">
<li><p>The JSON of any PEG is a JSON object.</p></li>
<li><p>This object holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section <span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
<span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol>
<p>As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
<span class="sectref"><a href="#section4">PEG serialization format</a></span>, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>a JSON serialization for it is</p>
<pre class="example">
{
    &quot;pt::grammar::peg&quot; : {
        &quot;rules&quot; : {
            &quot;AddOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Digit&quot;     : {
                &quot;is&quot;   : &quot;\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Expression&quot; : {
                &quot;is&quot;   : &quot;\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Factor&quot;    : {
                &quot;is&quot;   : &quot;x {n Term} {* {x {n AddOp} {n Term}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;MulOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t *} {t \/}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Number&quot;    : {
                &quot;is&quot;   : &quot;x {? {n Sign}} {+ {n Digit}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Sign&quot;      : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Term&quot;      : {
                &quot;is&quot;   : &quot;n Number&quot;,
                &quot;mode&quot; : &quot;value&quot;
            }
        },
        &quot;start&quot; : &quot;n Expression&quot;
    }
}
</pre>
<p>and a Tcl serialization of the same is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
<p>The similarity of the latter to the JSON should be quite obvious.</p>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key232">JSON</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key103">format conversion</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_from_peg.html.







































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::from::peg - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_from_peg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::from::peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::from::peg(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::from::peg - PEG Conversion. Read PEG format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">PEG Specification Language</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::from::peg <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt::peg::from::peg</b> <b class="method">convert</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the converter from PEG markup to
parsing expression grammars.</p>
<p>It resides in the Import section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the import manager provided by
<b class="package"><a href="pt_peg_import.html">pt::peg::import</a></b>. The latter is intented for use in untrusted
environments and done through the corresponding import plugin
<b class="package"><a href="pt_peg_import_peg.html">pt::peg::import::peg</a></b> sitting between converter
and import manager.</p>
<p><img alt="arch_core_iplugins" src="../../../../image/arch_core_iplugins.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Converter API found in the <i class="term"><a href="pt_from_api.html">Parser Tools Import API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt::peg::from::peg</b> <b class="method">convert</b> <i class="arg">text</i></a></dt>
<dd><p>This command takes the PEG markup encoding a parsing
expression grammar and contained in <i class="arg">text</i>, and generates the
canonical serialization of said grammar, as specified in section
<span class="sectref"><a href="#section4">PEG serialization format</a></span>.
The created value is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PEG Specification Language</a></h2>
<p><b class="const">peg</b>, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.</p>
<p>It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the <i class="term"><a href="pt_peg_language.html">PEG Language Tutorial</a></i>.</p>
<pre class="example">
PEG pe-grammar-for-peg (Grammar)
	# --------------------------------------------------------------------
        # Syntactical constructs
        Grammar         &lt;- WHITESPACE Header Definition* Final EOF ;
        Header          &lt;- PEG Identifier StartExpr ;
        Definition      &lt;- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       &lt;- (VOID / LEAF) COLON ;
        Expression      &lt;- Sequence (SLASH Sequence)* ;
        Sequence        &lt;- Prefix+ ;
        Prefix          &lt;- (AND / NOT)? Suffix ;
        Suffix          &lt;- Primary (QUESTION / STAR / PLUS)? ;
        Primary         &lt;- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         &lt;- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           &lt;- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           &lt;- Char TO Char / Char ;
        StartExpr       &lt;- OPEN Expression CLOSE ;
void:   Final           &lt;- END SEMICOLON WHITESPACE ;
        # --------------------------------------------------------------------
        # Lexing constructs
        Identifier      &lt;- Ident WHITESPACE ;
leaf:   Ident           &lt;- ('_' / ':' / &lt;alpha&gt;) ('_' / ':' / &lt;alnum&gt;)* ;
        Char            &lt;- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;
leaf:   CharSpecial     &lt;- &quot;\\&quot; [nrt'&quot;\[\]\\] ;
leaf:   CharOctalFull   &lt;- &quot;\\&quot; [0-2][0-7][0-7] ;
leaf:   CharOctalPart   &lt;- &quot;\\&quot; [0-7][0-7]? ;
leaf:   CharUnicode     &lt;- &quot;\\&quot; 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   &lt;- !&quot;\\&quot; . ;
void:   HexDigit        &lt;- [0-9a-fA-F] ;
void:   TO              &lt;- '-'           ;
void:   OPENB           &lt;- &quot;[&quot;           ;
void:   CLOSEB          &lt;- &quot;]&quot;           ;
void:   APOSTROPH       &lt;- &quot;'&quot;           ;
void:   DAPOSTROPH      &lt;- '&quot;'           ;
void:   PEG             &lt;- &quot;PEG&quot;   WHITESPACE ;
void:   IS              &lt;- &quot;&lt;-&quot;    WHITESPACE ;
leaf:   VOID            &lt;- &quot;void&quot;  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            &lt;- &quot;leaf&quot;  WHITESPACE ; # Implies that definition has no terminals.
void:   END             &lt;- &quot;END&quot;   WHITESPACE ;
void:   SEMICOLON       &lt;- &quot;;&quot;     WHITESPACE ;
void:   COLON           &lt;- &quot;:&quot;     WHITESPACE ;
void:   SLASH           &lt;- &quot;/&quot;     WHITESPACE ;
leaf:   AND             &lt;- &quot;&amp;&quot;     WHITESPACE ;
leaf:   NOT             &lt;- &quot;!&quot;     WHITESPACE ;
leaf:   QUESTION        &lt;- &quot;?&quot;     WHITESPACE ;
leaf:   STAR            &lt;- &quot;*&quot;     WHITESPACE ;
leaf:   PLUS            &lt;- &quot;+&quot;     WHITESPACE ;
void:   OPEN            &lt;- &quot;(&quot;     WHITESPACE ;
void:   CLOSE           &lt;- &quot;)&quot;     WHITESPACE ;
leaf:   DOT             &lt;- &quot;.&quot;     WHITESPACE ;
leaf:   ALNUM           &lt;- &quot;&lt;alnum&gt;&quot;    WHITESPACE ;
leaf:   ALPHA           &lt;- &quot;&lt;alpha&gt;&quot;    WHITESPACE ;
leaf:   ASCII           &lt;- &quot;&lt;ascii&gt;&quot;    WHITESPACE ;
leaf:   CONTROL         &lt;- &quot;&lt;control&gt;&quot;  WHITESPACE ;
leaf:   DDIGIT          &lt;- &quot;&lt;ddigit&gt;&quot;   WHITESPACE ;
leaf:   DIGIT           &lt;- &quot;&lt;digit&gt;&quot;    WHITESPACE ;
leaf:   GRAPH           &lt;- &quot;&lt;graph&gt;&quot;    WHITESPACE ;
leaf:   LOWER           &lt;- &quot;&lt;lower&gt;&quot;    WHITESPACE ;
leaf:   PRINTABLE       &lt;- &quot;&lt;print&gt;&quot;    WHITESPACE ;
leaf:   PUNCT           &lt;- &quot;&lt;punct&gt;&quot;    WHITESPACE ;
leaf:   SPACE           &lt;- &quot;&lt;space&gt;&quot;    WHITESPACE ;
leaf:   UPPER           &lt;- &quot;&lt;upper&gt;&quot;    WHITESPACE ;
leaf:   WORDCHAR        &lt;- &quot;&lt;wordchar&gt;&quot; WHITESPACE ;
leaf:   XDIGIT          &lt;- &quot;&lt;xdigit&gt;&quot;   WHITESPACE ;
void:   WHITESPACE      &lt;- (&quot; &quot; / &quot;\t&quot; / EOL / COMMENT)* ;
void:   COMMENT         &lt;- '#' (!EOL .)* EOL ;
void:   EOL             &lt;- &quot;\n\r&quot; / &quot;\n&quot; / &quot;\r&quot; ;
void:   EOF             &lt;- !. ;
        # --------------------------------------------------------------------
END;
</pre>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Our example specifies the grammar for a basic 4-operation calculator.</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as</p>
<pre class="example">
PEG calculator (Expression)
    Sign       &lt;- [-+] 						;
    Number     &lt;- Sign? &lt;ddigit&gt;+				;
    Expression &lt;- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      &lt;- [*/]						;
    Factor     &lt;- Term (AddOp Term)*				;
    AddOp      &lt;- [-+]						;
    Term       &lt;- Number					;
END;
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key103">format conversion</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_import.html.









































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::import - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_import.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::import.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::import(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::import - PEG Import</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section3">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection4">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection5">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">configuration</b></li>
<li>package require <b class="pkgname">pt::peg</b></li>
<li>package require <b class="pkgname">pluginmgr</b></li>
<li>package require <b class="pkgname">pt::peg::import <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::peg::import</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">import text</b> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">import file</b> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">import object text</b> <i class="arg">object</i> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">import object file</b> <i class="arg">object</i> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">includes</b></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">include add</b> <i class="arg">path</i></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">include remove</b> <i class="arg">path</i></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">include clear</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides a manager for parsing expression grammars, with
each instance handling a set of plugins for the import of them from
other formats, i.e. their conversion from, for example <i class="term">peg</i>,
<i class="term">container</i>, <i class="term"><a href="../../../../index.html#key172">json</a></i>, etc.</p>
<p>It resides in the Import section of the Core Layer of Parser Tools,
and is one of the three pillars the management of parsing expression
grammars resides on.</p>
<p><img alt="arch_core_import" src="../../../../image/arch_core_import.png"></p>
<p>The other two pillars are, as shown above</p>
<ol class="enumerated">
<li><p><i class="term"><a href="pt_peg_export.html">PEG Export</a></i>, and</p></li>
<li><p><i class="term"><a href="pt_peg_container.html">PEG Storage</a></i></p></li>
</ol>
<p>For information about the data structure which is the major output of
the manager objects provided by this package see the section
<span class="sectref"><a href="#section3">PEG serialization format</a></span>.</p>
<p>The plugin system of our class is based on the package
<b class="package"><a href="../pluginmgr/pluginmgr.html">pluginmgr</a></b>, and configured to look for plugins using</p>
<ol class="enumerated">
<li><p>the environment variable <b class="variable">GRAMMAR_PEG_IMPORT_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">GRAMMAR_PEG_PLUGINS</b>,</p></li>
<li><p>the environment variable <b class="variable">GRAMMAR_PLUGINS</b>,</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/peg/import/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/peg/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/plugin</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/peg/import/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/peg/plugins</b>&quot;</p></li>
<li><p>the path &quot;<b class="file">~/.grammar/plugins</b>&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\GRAMMAR\PEG\IMPORT\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\GRAMMAR\PEG\PLUGINS&quot;</p></li>
<li><p>the registry entry &quot;HKEY_CURRENT_USER\SOFTWARE\GRAMMAR\PLUGINS&quot;</p></li>
</ol>
<p>The last three are used only when the package is run on a machine
using the Windows(tm) operating system.</p>
<p>The whole system is delivered with three predefined import plugins,
namely</p>
<dl class="definitions">
<dt>container</dt>
<dd><p>See <i class="term"><a href="pt_peg_import_container.html">PEG Import Plugin. From CONTAINER format</a></i> for details.</p></dd>
<dt>json</dt>
<dd><p>See <i class="term">PEG Import Plugin. From JSON format</i> for details.</p></dd>
<dt>peg</dt>
<dd><p>See <i class="term">PEG Import Plugin. From PEG format</i> for details.</p></dd>
</dl>
<p>For readers wishing to write their own import plugin for some format,
i.e. <i class="term">plugin writer</i>s, reading and understanding the
<i class="term">Parser Tools Impport API</i> specification is an absolute
necessity, as it documents the interaction between this package and
its plugins in detail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::peg::import</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new import manager object with an associated
Tcl command whose name is <i class="arg">objectName</i>. This <i class="term"><a href="../../../../index.html#key221">object</a></i> command
is explained in full detail in the sections <span class="sectref"><a href="#subsection2">Object command</a></span>
and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The object command will be created
under the current namespace if the <i class="arg">objectName</i> is not fully
qualified, and in the specified namespace otherwise.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::pt::peg::import</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">objectName</b> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object it is invoked for.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">import text</b> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method takes the <i class="arg">text</i> and converts it from the specified
<i class="arg">format</i> to the canonical serialization of a parsing expression
grammar using the import plugin for the format. An error is thrown if
no plugin could be found for the format.
The serialization generated by the conversion process is returned as
the result of this method.</p>
<p>If no format is specified the method defaults to <b class="const">text</b>.</p>
<p>The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section3">PEG serialization format</a></span>.</p>
<p>The plugin has to conform to the interface documented in the
<i class="term"><a href="pt_from_api.html">Parser Tools Import API</a></i> specification.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">import file</b> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">import text</b>
method described by the previous item.
It reads the contents of the specified file into memory, feeds the
result into <b class="method">import text</b> and returns the resulting
serialization as its own result.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">import object text</b> <i class="arg">object</i> <i class="arg">text</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method is a convenient wrapper around the <b class="method">import text</b>
method described by the previous item.
It expects that <i class="arg">object</i> is an object command supporting a
<b class="method">deserialize</b> method expecting the canonical serialization of a
parsing expression grammar.
It imports the text using <b class="method">import text</b> and then feeds the
resulting serialization into the <i class="arg">object</i> via <b class="method">deserialize</b>.
This method returns the empty string as it result.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">import object file</b> <i class="arg">object</i> <i class="arg">path</i> <span class="opt">?<i class="arg">format</i>?</span></a></dt>
<dd><p>This method behaves like <b class="method">import object text</b>, except that it
reads the text to convert from the specified file instead of being
given it as argument.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">includes</b></a></dt>
<dd><p>This method returns a list containing the currently specified paths to
use to search for include files when processing input.
The order of paths in the list corresponds to the order in which they
are used, from first to last, and also corresponds to the order in
which they were added to the object.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">include add</b> <i class="arg">path</i></a></dt>
<dd><p>This methods adds the specified <i class="arg">path</i> to the list of paths to use
to search for include files when processing input. The path is added
to the end of the list, causing it to be searched after all previously
added paths. The result of the command is the empty string.</p>
<p>The method does nothing if the path is already known.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">include remove</b> <i class="arg">path</i></a></dt>
<dd><p>This methods removes the specified <i class="arg">path</i> from the list of paths
to use to search for include files when processing input. The result
of the command is the empty string.</p>
<p>The method does nothing if the path is not known.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">include clear</b></a></dt>
<dd><p>This method clears the list of paths to use to search for include
files when processing input. The result of the command is the empty
string.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section4">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section4">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_import_container.html.


































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::import::container - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_import_container.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::import::container.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::import::container(n) 0 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::import::container - PEG Import Plugin. From CONTAINER format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package does not exist.
There is no need for it.
The CONTAINER format for parsing expression grammars is a piece of Tcl
code which, then sourced, provides a class whose instances have the
grammar we wish to import loaded.
Another way of looking at this is, the CONTAINER output is its own
import package.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_import_json.html.



































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::import::json - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_import_json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::import::json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::import::json(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::import::json - PEG Import Plugin. Read JSON format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">JSON Grammar Exchange Format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::import::json <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg::to::json</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the parsing expression grammar import plugin
processing JSON markup.</p>
<p>It resides in the Import section of the Core Layer of Parser Tools and
is intended to be used by <b class="package"><a href="pt_peg_import.html">pt::peg::import</a></b>, the import
manager, sitting between it and the corresponding core conversion
functionality provided by <b class="package"><a href="pt_peg_from_json.html">pt::peg::from::json</a></b>.</p>
<p><img alt="arch_core_iplugins" src="../../../../image/arch_core_iplugins.png"></p>
<p>While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:</p>
<ol class="enumerated">
<li><p>In an untrusted environment the proper access is through the package
<b class="package"><a href="pt_peg_import.html">pt::peg::import</a></b> and the import manager objects it
provides.</p></li>
<li><p>In a trusted environment however simply use the package
<b class="package"><a href="pt_peg_from_json.html">pt::peg::from::json</a></b> and access the core
conversion functionality directly.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Plugin API found in the <i class="term"><a href="pt_from_api.html">Parser Tools Import API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">text</i></a></dt>
<dd><p>This command takes the JSON markup encoding a parsing
expression grammar and contained in <i class="arg">text</i>, and generates the
canonical serialization of said grammar, as specified in section
<span class="sectref"><a href="#section4">PEG serialization format</a></span>.
The created value is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">JSON Grammar Exchange Format</a></h2>
<p>The <b class="const">json</b> format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.</p>
<p>It is formally specified by the rules below:</p>
<ol class="enumerated">
<li><p>The JSON of any PEG is a JSON object.</p></li>
<li><p>This object holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section <span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
<span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol>
<p>As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
<span class="sectref"><a href="#section4">PEG serialization format</a></span>, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>a JSON serialization for it is</p>
<pre class="example">
{
    &quot;pt::grammar::peg&quot; : {
        &quot;rules&quot; : {
            &quot;AddOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Digit&quot;     : {
                &quot;is&quot;   : &quot;\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Expression&quot; : {
                &quot;is&quot;   : &quot;\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Factor&quot;    : {
                &quot;is&quot;   : &quot;x {n Term} {* {x {n AddOp} {n Term}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;MulOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t *} {t \/}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Number&quot;    : {
                &quot;is&quot;   : &quot;x {? {n Sign}} {+ {n Digit}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Sign&quot;      : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Term&quot;      : {
                &quot;is&quot;   : &quot;n Number&quot;,
                &quot;mode&quot; : &quot;value&quot;
            }
        },
        &quot;start&quot; : &quot;n Expression&quot;
    }
}
</pre>
<p>and a Tcl serialization of the same is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
<p>The similarity of the latter to the JSON should be quite obvious.</p>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key232">JSON</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key247">import</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_import_peg.html.

















































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::import::peg - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_import_peg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::import::peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::import::peg(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::import::peg - PEG Import Plugin. Read PEG format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">PEG Specification Language</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::import::peg <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg::to::peg</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the parsing expression grammar import plugin
processing PEG markup.</p>
<p>It resides in the Import section of the Core Layer of Parser Tools and
is intended to be used by <b class="package"><a href="pt_peg_import.html">pt::peg::import</a></b>, the import
manager, sitting between it and the corresponding core conversion
functionality provided by <b class="package"><a href="pt_peg_from_peg.html">pt::peg::from::peg</a></b>.</p>
<p><img alt="arch_core_iplugins" src="../../../../image/arch_core_iplugins.png"></p>
<p>While the direct use of this package with a regular interpreter is
possible, this is strongly disrecommended and requires a number of
contortions to provide the expected environment.
The proper way to use this functionality depends on the situation:</p>
<ol class="enumerated">
<li><p>In an untrusted environment the proper access is through the package
<b class="package"><a href="pt_peg_import.html">pt::peg::import</a></b> and the import manager objects it
provides.</p></li>
<li><p>In a trusted environment however simply use the package
<b class="package"><a href="pt_peg_from_peg.html">pt::peg::from::peg</a></b> and access the core
conversion functionality directly.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Plugin API found in the <i class="term"><a href="pt_from_api.html">Parser Tools Import API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd"><a href="../../../../index.html#key247">import</a></b> <i class="arg">text</i></a></dt>
<dd><p>This command takes the PEG markup encoding a parsing
expression grammar and contained in <i class="arg">text</i>, and generates the
canonical serialization of said grammar, as specified in section
<span class="sectref"><a href="#section4">PEG serialization format</a></span>.
The created value is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PEG Specification Language</a></h2>
<p><b class="const">peg</b>, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.</p>
<p>It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the <i class="term"><a href="pt_peg_language.html">PEG Language Tutorial</a></i>.</p>
<pre class="example">
PEG pe-grammar-for-peg (Grammar)
	# --------------------------------------------------------------------
        # Syntactical constructs
        Grammar         &lt;- WHITESPACE Header Definition* Final EOF ;
        Header          &lt;- PEG Identifier StartExpr ;
        Definition      &lt;- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       &lt;- (VOID / LEAF) COLON ;
        Expression      &lt;- Sequence (SLASH Sequence)* ;
        Sequence        &lt;- Prefix+ ;
        Prefix          &lt;- (AND / NOT)? Suffix ;
        Suffix          &lt;- Primary (QUESTION / STAR / PLUS)? ;
        Primary         &lt;- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         &lt;- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           &lt;- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           &lt;- Char TO Char / Char ;
        StartExpr       &lt;- OPEN Expression CLOSE ;
void:   Final           &lt;- END SEMICOLON WHITESPACE ;
        # --------------------------------------------------------------------
        # Lexing constructs
        Identifier      &lt;- Ident WHITESPACE ;
leaf:   Ident           &lt;- ('_' / ':' / &lt;alpha&gt;) ('_' / ':' / &lt;alnum&gt;)* ;
        Char            &lt;- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;
leaf:   CharSpecial     &lt;- &quot;\\&quot; [nrt'&quot;\[\]\\] ;
leaf:   CharOctalFull   &lt;- &quot;\\&quot; [0-2][0-7][0-7] ;
leaf:   CharOctalPart   &lt;- &quot;\\&quot; [0-7][0-7]? ;
leaf:   CharUnicode     &lt;- &quot;\\&quot; 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   &lt;- !&quot;\\&quot; . ;
void:   HexDigit        &lt;- [0-9a-fA-F] ;
void:   TO              &lt;- '-'           ;
void:   OPENB           &lt;- &quot;[&quot;           ;
void:   CLOSEB          &lt;- &quot;]&quot;           ;
void:   APOSTROPH       &lt;- &quot;'&quot;           ;
void:   DAPOSTROPH      &lt;- '&quot;'           ;
void:   PEG             &lt;- &quot;PEG&quot;   WHITESPACE ;
void:   IS              &lt;- &quot;&lt;-&quot;    WHITESPACE ;
leaf:   VOID            &lt;- &quot;void&quot;  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            &lt;- &quot;leaf&quot;  WHITESPACE ; # Implies that definition has no terminals.
void:   END             &lt;- &quot;END&quot;   WHITESPACE ;
void:   SEMICOLON       &lt;- &quot;;&quot;     WHITESPACE ;
void:   COLON           &lt;- &quot;:&quot;     WHITESPACE ;
void:   SLASH           &lt;- &quot;/&quot;     WHITESPACE ;
leaf:   AND             &lt;- &quot;&amp;&quot;     WHITESPACE ;
leaf:   NOT             &lt;- &quot;!&quot;     WHITESPACE ;
leaf:   QUESTION        &lt;- &quot;?&quot;     WHITESPACE ;
leaf:   STAR            &lt;- &quot;*&quot;     WHITESPACE ;
leaf:   PLUS            &lt;- &quot;+&quot;     WHITESPACE ;
void:   OPEN            &lt;- &quot;(&quot;     WHITESPACE ;
void:   CLOSE           &lt;- &quot;)&quot;     WHITESPACE ;
leaf:   DOT             &lt;- &quot;.&quot;     WHITESPACE ;
leaf:   ALNUM           &lt;- &quot;&lt;alnum&gt;&quot;    WHITESPACE ;
leaf:   ALPHA           &lt;- &quot;&lt;alpha&gt;&quot;    WHITESPACE ;
leaf:   ASCII           &lt;- &quot;&lt;ascii&gt;&quot;    WHITESPACE ;
leaf:   CONTROL         &lt;- &quot;&lt;control&gt;&quot;  WHITESPACE ;
leaf:   DDIGIT          &lt;- &quot;&lt;ddigit&gt;&quot;   WHITESPACE ;
leaf:   DIGIT           &lt;- &quot;&lt;digit&gt;&quot;    WHITESPACE ;
leaf:   GRAPH           &lt;- &quot;&lt;graph&gt;&quot;    WHITESPACE ;
leaf:   LOWER           &lt;- &quot;&lt;lower&gt;&quot;    WHITESPACE ;
leaf:   PRINTABLE       &lt;- &quot;&lt;print&gt;&quot;    WHITESPACE ;
leaf:   PUNCT           &lt;- &quot;&lt;punct&gt;&quot;    WHITESPACE ;
leaf:   SPACE           &lt;- &quot;&lt;space&gt;&quot;    WHITESPACE ;
leaf:   UPPER           &lt;- &quot;&lt;upper&gt;&quot;    WHITESPACE ;
leaf:   WORDCHAR        &lt;- &quot;&lt;wordchar&gt;&quot; WHITESPACE ;
leaf:   XDIGIT          &lt;- &quot;&lt;xdigit&gt;&quot;   WHITESPACE ;
void:   WHITESPACE      &lt;- (&quot; &quot; / &quot;\t&quot; / EOL / COMMENT)* ;
void:   COMMENT         &lt;- '#' (!EOL .)* EOL ;
void:   EOL             &lt;- &quot;\n\r&quot; / &quot;\n&quot; / &quot;\r&quot; ;
void:   EOF             &lt;- !. ;
        # --------------------------------------------------------------------
END;
</pre>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Our example specifies the grammar for a basic 4-operation calculator.</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as</p>
<pre class="example">
PEG calculator (Expression)
    Sign       &lt;- [-+] 						;
    Number     &lt;- Sign? &lt;ddigit&gt;+				;
    Expression &lt;- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      &lt;- [*/]						;
    Factor     &lt;- Term (AddOp Term)*				;
    AddOp      &lt;- [-+]						;
    Term       &lt;- Number					;
END;
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section5">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key247">import</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key357">plugin</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_interp.html.































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::interp - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_interp.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::interp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::interp(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::interp - Interpreter for parsing expression grammars</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Class API</a></li>
<li class="subsection"><a href="#subsection2">Object API</a></li>
</ul>
</li>
<li class="section"><a href="#section2">AST serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section3">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection4">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::interp <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::rde <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">snit</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::peg::interpreter</b> <i class="arg">objectName</i> <i class="arg">grammar</i></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">use</b> <i class="arg">grammar</i></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">parse</b> <i class="arg">chan</i></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">parset</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides a class whose instances are Packrat parsers
configurable with a parsing expression grammar. The grammar is
executed directly, i.e. interpreted, with the underlying runtime
provided by the package <b class="package"><a href="pt_rdengine.html">pt::rde</a></b>, basing everything on the
PARAM.</p>
<p>Like the supporting runtime this package resides in the Execution
section of the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_transform" src="../../../../image/arch_core_transform.png"></p>
<p>The interpreted grammar is copied from an instance of <b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b>, or anything providing the same API, like the
container classes created by <b class="package"><a href="pt_peg_to_container.html">pt::peg::to::container</a></b> or the
associated export plugin <b class="package"><a href="pt_peg_export_container.html">pt::peg::export::container</a></b>.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Class API</a></h3>
<p>The package exports the API described here.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::peg::interpreter</b> <i class="arg">objectName</i> <i class="arg">grammar</i></a></dt>
<dd><p>The command creates a new parser object and returns the fully
qualified name of the object command as its result. The API of this
object command is described in the section <span class="sectref"><a href="#subsection2">Object API</a></span>. It
may be used to invoke various operations on the object.</p>
<p>This new parser is configured for the execution of an empty PEG. To
configure the object for any other PEG use the method <b class="method">use</b> of
the <span class="sectref"><a href="#subsection2">Object API</a></span>.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object API</a></h3>
<p>All objects created by this package provide the following methods.</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">use</b> <i class="arg">grammar</i></a></dt>
<dd><p>This method configures the grammar interpreter / parser for the
execution of the PEG stored in <i class="arg">grammar</i>, an object which is
API-compatible to instances of <b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b>. The
parser copies the relevant information of the grammar, and does
<em>not</em> take ownership of the object.</p>
<p>The information of any previously used grammar is overwritten.</p>
<p>The result of the method the empty string.</p></dd>
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the parser instance, releasing all claimed memory
and other resources, and deleting the instance command.</p>
<p>The result of the command is the empty string.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">parse</b> <i class="arg">chan</i></a></dt>
<dd><p>This method runs the parser using the contents of <i class="arg">chan</i> as input
(starting at the current location in the channel), until parsing is
not possible anymore, either because parsing has completed, or run
into a syntax error.</p>
<p>Note here that the Parser Tools are based on Tcl 8.5+. In other words,
the channel argument is not restricted to files, sockets, etc. We have
the full power of <i class="term">reflected channels</i> available.</p>
<p>It should also be noted that the parser pulls the characters from the
input stream as it needs them. If a parser created by this package has
to be operated in a push aka event-driven manner it will be necessary
to go to Tcl 8.6+ and use the <b class="package"><a href="../coroutine/coro_auto.html">coroutine::auto</a></b> to wrap it
into a coroutine where <b class="cmd"><a href="../../../../index.html#key362">read</a></b> is properly changed for
push-operation.</p>
<p>Upon successful completion the command returns an abstract syntax tree
as its result.
This AST is in the form specified in section
<span class="sectref"><a href="#section2">AST serialization format</a></span>.
As a plain nested Tcl-list it can then be processed with any Tcl
commands the user likes, doing transformations, semantic checks, etc.
To help in this the package <b class="package"><a href="pt_astree.html">pt::ast</a></b> provides a set of
convenience commands for validation of the tree's basic structure,
printing it for debugging, and walking it either from the bottom up,
or top down.</p>
<p>When encountering a syntax error the command will throw an error instead.
This error will be a 4-element Tcl-list, containing, in the order
listed below:</p>
<ol class="enumerated">
<li><p>The string <b class="const">pt::rde</b> identifying it as parser runtime error.</p></li>
<li><p>The location of the parse error, as character offset from the
beginning of the parsed input.</p></li>
<li><p>The location of parse error, now as a 2-element list containing
line-number and column in the line.</p></li>
<li><p>A set of atomic parsing expressions indicating encoding the characters
and/or nonterminal symbols the parser expected to see at the location
of the parse error, but did not get.
 For the specification of atomic parsing expressions please see the
section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></li>
</ol></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">parset</b> <i class="arg">text</i></a></dt>
<dd><p>This method runs the parser using the string in <i class="arg">text</i> as input.
In all other ways it behaves like the method <b class="method">parse</b>, shown
above.</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">AST serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Abstract Syntax Trees (ASTs) as immutable values for transport,
comparison, etc.</p>
<p>Each node in an AST represents a nonterminal symbol of a grammar, and
the range of tokens/characters in the input covered by it. ASTs do not
contain terminal symbols, i.e. tokens/characters. These can be
recovered from the input given a symbol's location.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a tree may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any AST is the serialization of its root node.</p></li>
<li><p>The serialization of any node is a Tcl list containing at least three
elements.</p>
<ol class="enumerated">
<li><p>The first element is the name of the nonterminal symbol stored in the
node.</p></li>
<li><p>The second and third element are the locations of the first and last
token in the token stream the node represents (covers).</p>
<ol class="enumerated">
<li><p>Locations are provided as non-negative integer offsets from the
beginning of the token stream, with the first token found in the
stream located at offset 0 (zero).</p></li>
<li><p>The end location has to be equal to or larger than the start location.</p></li>
</ol>
</li>
<li><p>All elements after the first three represent the children of the node,
which are themselves nodes. This means that the serializations of
nodes without children, i.e. leaf nodes, have exactly three elements.
The children are stored in the list with the leftmost child first, and
the rightmost child last.</p></li>
</ol>
</li>
</ol></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of an abstract syntax tree has the format
as specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this tree.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression grammar below</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>and the input string</p>
<pre class="example"> 120+5 </pre>
<p>then a parser should deliver the abstract syntax tree below (except for whitespace)</p>
<pre class="example">
set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}
</pre>
<p>Or, more graphical</p>
<p><img alt="expr_ast" src="../../../../image/expr_ast.png"></p>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_introduction.html.












































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::pegrammar - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_introduction.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::pegrammar.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::pegrammar(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::pegrammar - Introduction to Parsing Expression Grammars</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Formal definition</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>Welcome to the introduction to <i class="term"><a href="../../../../index.html#key20">Parsing Expression Grammar</a></i>s
(short: <i class="term"><a href="../../../../index.html#key12">PEG</a></i>), the formalism used by the Parser Tools.
It is assumed that the reader has a basic knowledge of parsing theory,
i.e. <i class="term">Context-Free Grammars</i> (short: <i class="term"><a href="../../../../index.html#key22">CFG</a></i>),
<i class="term">languages</i>, and associated terms like <i class="term"><a href="../../../../index.html#key21">LL(k)</a></i>,
<i class="term">LR(k)</i>, <i class="term"><a href="../../../../index.html#key88">terminal</a></i> and <i class="term">nonterminal</i> <i class="term">symbols</i>,
etc.
We do not intend to recapitulate such basic definitions or terms like
<i class="term">useful</i>, <i class="term">reachable</i>, (left/right) <i class="term">recursive</i>,
<i class="term">nullable</i>, first/last/follow sets, etc.
Please see the <span class="sectref"><a href="#section3">References</a></span> at the end instead if you are in
need of places and books which provide such background information.</p>
<p>PEGs are formally very similar to CFGs, with terminal and nonterminal
symbols, start symbol, and rules defining the structure of each
nonterminal symbol.
The main difference lies in the choice(sic!) of <i class="term">choice</i>
operators. Where CFGs use an <i class="term">unordered choice</i> to represent
alternatives PEGs use <i class="term">prioritized choice</i>. Which is fancy way
of saying that a parser has to try the first alternative first and can
try the other alternatives if only if it fails for the first, and so
on.</p>
<p>On the CFG side this gives rise to LL(k) and LR(k) for making the
choice <i class="term">deterministic</i> with a bounded <i class="term">lookahead</i> of k
terminal symbols, where LL is in essence <i class="term">topdown</i> aka
<i class="term"><a href="../../../../index.html#key16">recursive descent</a></i> parsing, and LR <i class="term">bottomup</i> aka
<i class="term">shift reduce</i> parsing.</p>
<p>On the PEG side we can parse input with recursive descent and
<i class="term">backtracking</i> of failed choices, the latter of which amounts to
unlimited lookahead.
By additionally recording the success or failure of nonterminals at
the specific locations they were tried at and reusing this information
after backtracking we can avoid the exponential blowup of running time
usually associated with backtracking and keep the parsing linear. The
memory requirements are of course higher due to this cache, as we are
trading space for time.</p>
<p>This is the basic concept behind <i class="term">packrat parsers</i>.</p>
<p>A limitation pure PEGs share with LL(k) CFGs is that
<i class="term">left-recursive</i> grammars cannot be parsed, with the associated
recursive descent parser entering an infinite recursion.
This limitation is usually overcome by extending pure PEGs with
explicit operators to specify repetition, zero or more, and one or
more, or, formally spoken, for the <i class="term">kleene closure</i> and
<i class="term">positive kleene closure</i>.
This is what the Parser Tools are doing.</p>
<p>Another extension, specific to Parser Tools, is a set of operators
which map more or less directly to various character classes built
into Tcl, i.e. the classes reachable via <b class="cmd">string is</b>.</p>
<p>The remainder of this document consists of the formal definition of
PEGs for the mathematically inclined, and an appendix listing
references to places with more information on PEGs specifically, and
parsing in general.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Formal definition</a></h2>
<p>For the mathematically inclined, a Parsing Expression Grammar is a
4-tuple (VN,VT,R,eS) where</p>
<ul class="itemized">
<li><p>VN is a set of <i class="term">nonterminal symbols</i>,</p></li>
<li><p>VT is a set of <i class="term">terminal symbols</i>,</p></li>
<li><p>R is a finite set of rules, where each rule is a pair (A,e), A in VN,
and <i class="term"><a href="../../../../index.html#key744">e</a></i> a <i class="term"><a href="../../../../index.html#key14">parsing expression</a></i>.</p></li>
<li><p>eS is a parsing expression, the <i class="term">start expression</i>.</p></li>
</ul>
<p>Further constraints are</p>
<ul class="itemized">
<li><p>The intersection of VN and VT is empty.</p></li>
<li><p>For all A in VT exists exactly one pair (A,e) in R. In other words, R
is a function from nonterminal symbols to parsing expressions.</p></li>
</ul>
<p>Parsing expressions are inductively defined via</p>
<ul class="itemized">
<li><p>The empty string (epsilon) is a parsing expression.</p></li>
<li><p>A terminal symbol <i class="term">a</i> is a parsing expression.</p></li>
<li><p>A nonterminal symbol <i class="term">A</i> is a parsing expression.</p></li>
<li><p><i class="term">e1</i><i class="term">e2</i> is a parsing expression for parsing expressions
<i class="term">e1</i> and <i class="term">2</i>. This is called <i class="term">sequence</i>.</p></li>
<li><p><i class="term">e1</i>/<i class="term">e2</i> is a parsing expression for parsing expressions
<i class="term">e1</i> and <i class="term">2</i>. This is called <i class="term">ordered choice</i>.</p></li>
<li><p><i class="term"><a href="../../../../index.html#key744">e</a></i>* is a parsing expression for parsing expression
<i class="term"><a href="../../../../index.html#key744">e</a></i>. This is called <i class="term">zero-or-more repetitions</i>, also known
as <i class="term">kleene closure</i>.</p></li>
<li><p><i class="term"><a href="../../../../index.html#key744">e</a></i>+ is a parsing expression for parsing expression
<i class="term"><a href="../../../../index.html#key744">e</a></i>. This is called <i class="term">one-or-more repetitions</i>, also known
as <i class="term">positive kleene closure</i>.</p></li>
<li><p>!<i class="term"><a href="../../../../index.html#key744">e</a></i> is a parsing expression for parsing expression
<i class="term">e1</i>. This is called a <i class="term">not lookahead predicate</i>.</p></li>
<li><p>&amp;<i class="term"><a href="../../../../index.html#key744">e</a></i> is a parsing expression for parsing expression
<i class="term">e1</i>. This is called an <i class="term">and lookahead predicate</i>.</p></li>
</ul>
<p>PEGs are used to define a grammatical structure for streams of symbols
over VT. They are a modern phrasing of older formalisms invented by
Alexander Birham. These formalisms were called TS (TMG recognition
scheme), and gTS (generalized TS). Later they were renamed to TPDL
(Top-Down Parsing Languages) and gTPDL (generalized TPDL).</p>
<p>They can be easily implemented by recursive descent parsers with
backtracking. This makes them relatives of LL(k) Context-Free
Grammars.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://www.pdos.lcs.mit.edu/~baford/packrat/">The Packrat Parsing and Parsing Expression Grammars Page</a>,
by Bryan Ford, Massachusetts Institute of Technology. This is the main
entry page to PEGs, and their realization through Packrat Parsers.</p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Parsing_expression_grammar">http://en.wikipedia.org/wiki/Parsing_expression_grammar</a>
Wikipedia's entry about Parsing Expression Grammars.</p></li>
<li><p><a href="http://www.cs.vu.nl/~dick/PTAPG.html">Parsing Techniques - A Practical Guide </a>, an online book
offering a clear, accessible, and thorough discussion of many
different parsing techniques with their interrelations and
applicabilities, including error recovery techniques.</p></li>
<li><p><a href="http://scifac.ru.ac.za/compilers/">Compilers and Compiler Generators</a>, an online book using
CoCo/R, a generator for recursive descent parsers.</p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_language.html.
















































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg_language - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_language.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg_language.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg_language(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg_language - PEG Language Tutorial</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">What is it?</a></li>
<li class="section"><a href="#section3">The elements of the language</a>
<ul>
<li class="subsection"><a href="#subsection1">Basic structure</a></li>
<li class="subsection"><a href="#subsection2">Names</a></li>
<li class="subsection"><a href="#subsection3">Rules</a></li>
<li class="subsection"><a href="#subsection4">Expressions</a></li>
<li class="subsection"><a href="#subsection5">Whitespace and comments</a></li>
<li class="subsection"><a href="#subsection6">Nonterminal attributes</a></li>
</ul>
</li>
<li class="section"><a href="#section4">PEG Specification Language</a>
<ul>
<li class="subsection"><a href="#subsection7">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>Welcome to the tutorial / introduction for the
<span class="sectref"><a href="#section4">PEG Specification Language</a></span>.
If you are already familiar with the language we are about to discuss,
and only wish to refresh your memory you can, of course, skip ahead to
the aforementioned section and just read the full formal specification.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">What is it?</a></h2>
<p><b class="const">peg</b>, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">The elements of the language</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Basic structure</a></h3>
<p>The general outline of a textual PEG is</p>
<pre class="example">
PEG &lt;&lt;name&gt;&gt; (&lt;&lt;start-expression&gt;&gt;)
   &lt;&lt;rules&gt;&gt;
END;
</pre>
<p><em>Note</em>: We are using text in double angle-brackets as
place-holders for things not yet explained.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Names</a></h3>
<p>Names are mostly used to identify the nonterminal symbols of the
grammar, i.e. that which occurs on the left-hand side of a &lt;rule&gt;.
The exception to that is the name given after the keyword <b class="const">PEG</b>
(see previous section), which is the name of the whole grammar itself.</p>
<p>The structure of a name is simple:</p>
<ol class="enumerated">
<li><p>It begins with a letter, underscore, or colon, followed by</p></li>
<li><p>zero or more letters, digits, underscores, or colons.</p></li>
</ol>
<p>Or, in formal textual notation:</p>
<pre class="example">
    ([_:] / &lt;alpha&gt;) ([_:] / &lt;alnum&gt;)*
</pre>
<p>Examples of names:</p>
<pre class="example">
    Hello
    ::world
    _:submarine55_
</pre>
<p>Examples of text which are <em>not</em> names:</p>
<pre class="example">
    12
    .bogus
    0wrong
    @location
</pre>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Rules</a></h3>
<p>The main body of the text of a grammar specification is taken up by
the rules. Each rule defines the sentence structure of one nonterminal
symbol. Their basic structure is</p>
<pre class="example">
     &lt;&lt;name&gt;&gt;  &lt;-  &lt;&lt;expression&gt;&gt; ;
</pre>
<p>The &lt;name&gt; specifies the nonterminal symbol to be defined, the
&lt;expression&gt; after the arrow (&lt;-) then declares its structure.</p>
<p>Note that each rule ends in a single semicolon, even the last.
I.e. the semicolon is a rule <em>terminator</em>, not a separator.</p>
<p>We can have as many rules as we like, as long as we define each
nonterminal symbol at most once, and have at least one rule for each
nonterminal symbol which occured in an expression, i.e. in either the
start expression of the grammar, or the right-hande side of a rule.</p>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Expressions</a></h3>
<p>The <em>parsing</em> expressions are the meat of any specification. They
declare the structure of the whole document (&lt;&lt;start-expression&gt;&gt;),
and of all nonterminal symbols.</p>
<p>All expressions are made up out of <i class="term">atomic expressions</i> and
<i class="term">operators</i> combining them. We have operators for choosing
between alternatives, repetition of parts, and for look-ahead
constraints. There is no explicit operator for the sequencing (also
known as <i class="term">concatenation</i>) of parts however. This is specified by
simply placing the parts adjacent to each other.</p>
<p>Here are the operators, from highest to lowest priority (i.e. strength
of binding):</p>
<pre class="example">
    # Binary operators.
    &lt;&lt;expression-1&gt;&gt;     &lt;&lt;expression-2&gt;&gt;  # sequence. parse 1, then 2.
    &lt;&lt;expression-1&gt;&gt;  /  &lt;&lt;expression-2&gt;&gt;  # alternative. try to parse 1, and parse 2 if 1 failed to parse.
    # Prefix operators. Lookahead constraints. Same priority. 
    &amp; &lt;&lt;expression&gt;&gt;  # Parse expression, ok on successful parse.
    ! &lt;&lt;expression&gt;&gt;  # Ditto, except ok on failure to parse.
    # Suffix operators. Repetition. Same priority.
    &lt;&lt;expression&gt;&gt; ?  # Parse expression none, or once (repeat 0 or 1).
    &lt;&lt;expression&gt;&gt; *  # Parse expression zero or more times.
    &lt;&lt;expression&gt;&gt; +  # Parse expression one or more times.
    # Expression nesting
    ( &lt;&lt;expression&gt;&gt; ) # Put an expression in parens to change its priority.
</pre>
<p>With this we can now deconstruct the formal expression for names given
in section <span class="sectref"><a href="#subsection2">Names</a></span>:</p>
<pre class="example">
    ([_:] / &lt;alpha&gt;) ([_:] / &lt;alnum&gt;)*
</pre>
<p>It is a sequence of two parts,</p>
<pre class="example">    [_:] / &lt;alpha&gt; </pre>
<p>and</p>
<pre class="example">    ([_:] / &lt;alnum&gt;)* </pre>
<p>The parentheses around the parts kept their inner alternatives bound
together against the normally higher priority of the sequence. Each of
the two parts is an alternative, with the second part additionally
repeated zero or more times, leaving us with the three atomic
expressions</p>
<pre class="example">
    [_:]
    &lt;alpha&gt;
    &lt;alnum&gt;
</pre>
<p>And <i class="term">atomic expressions</i> are our next topic. They
fall into three classes:</p>
<ol class="enumerated">
<li><p>names, i.e. nonterminal symbols,</p></li>
<li><p>string literals, and</p></li>
<li><p>character classes.</p></li>
</ol>
<p>Names we know about already, or see section <span class="sectref"><a href="#subsection2">Names</a></span> for a
refresher.</p>
<p>String literals are simple. They are delimited by (i.e. start and end
with) either a single or double-apostroph, and in between the
delimiters we can have any character but the delimiter itself. They
can be empty as well. Examples of strings are</p>
<pre class="example">
    ''
    &quot;&quot;
    'hello'
    &quot;umbra&quot;
    &quot;'&quot;
    '&quot;'
</pre>
<p>The last two examples show how to place any of the delimiters into a
string.</p>
<p>For the last, but not least of our atomic expressions, character
classes, we have a number of predefined classes, shown below, and the
ability to construct or own. The predefined classes are:</p>
<pre class="example">
    &lt;alnum&gt;    # Any unicode alphabet or digit character (string is alnum).
    &lt;alpha&gt;    # Any unicode alphabet character (string is alpha).
    &lt;ascii&gt;    # Any unicode character below codepoint 0x80 (string is ascii).
    &lt;control&gt;  # Any unicode control character (string is control).
    &lt;ddigit&gt;   # The digit characters [0-9].
    &lt;digit&gt;    # Any unicode digit character (string is digit).
    &lt;graph&gt;    # Any unicode printing character, except space (string is graph).
    &lt;lower&gt;    # Any unicode lower-case alphabet character (string is lower).
    &lt;print&gt;    # Any unicode printing character, incl. space (string is print).
    &lt;punct&gt;    # Any unicode punctuation character (string is punct).
    &lt;space&gt;    # Any unicode space character (string is space).
    &lt;upper&gt;    # Any unicode upper-case alphabet character (string is upper).
    &lt;wordchar&gt; # Any unicode word character (string is wordchar).
    &lt;xdigit&gt;   # The hexadecimal digit characters [0-9a-fA-F].
    .          # Any character, except end of input.
</pre>
<p>And the syntax of custom-defined character classes is</p>
<pre class="example">
    [ &lt;&lt;range&gt;&gt;* ]
</pre>
<p>where each range is either a single character, or of the form</p>
<pre class="example">
   &lt;&lt;character&gt;&gt; - &lt;character&gt;&gt;
</pre>
<p>Examples for character classes we have seen already in the course of
this introduction are</p>
<pre class="example">
    [_:]
    [0-9]
    [0-9a-fA-F]
</pre>
<p>We are nearly done with expressions. The only piece left is to tell
how the characters in character classes and string literals are
specified.</p>
<p>Basically characters in the input stand for themselves, and in
addition to that we several types of escape syntax to to repesent
control characters, or characters outside of the encoding the text is
in.</p>
<p>All the escaped forms are started with a backslash character ('\',
unicode codepoint 0x5C). This is then followed by a series of octal
digits, or 'u' and hexedecimal digits, or a regular character from a
fixed set for various control characters. Some examples:</p>
<pre class="example">
    \n \r \t \' \&quot; \[ \] \\ # 
    \000 up to \277         # octal escape, all ascii character, leading 0's can be removed.
    \u2CA7                  # hexadecimal escape, all unicode characters.
    #                       # Here 2ca7 &lt;=&gt; Koptic Small Letter Tau
</pre>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Whitespace and comments</a></h3>
<p>One issue not touched upon so far is whitespace and comments.</p>
<p>Whitespace is any unicode space character, i.e. anything in the
character class &lt;space&gt;, and comments. The latter are sequences of
characters starting with a '#' (hash, unicode codepoint 0x23) and
ending at the next end-of-line.</p>
<p>Whitespace can be freely used between all syntactical elements of a
grammar specification. It cannot be used inside of syntactical
elements, like names, string literals, predefined character classes,
etc.</p>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Nonterminal attributes</a></h3>
<p>Lastly, a more advanced topic. In the section <span class="sectref"><a href="#subsection3">Rules</a></span> we gave
the structure of a rule as</p>
<pre class="example">
     &lt;&lt;name&gt;&gt;  &lt;-  &lt;&lt;expression&gt;&gt; ;
</pre>
<p>This is not quite true. It is possible to associate a semantic mode
with the nonterminal in the rule, by writing it before the name,
separated from it by a colon, i.e. writing</p>
<pre class="example">
    &lt;&lt;mode&gt;&gt; : &lt;&lt;name&gt;&gt;  &lt;-  &lt;&lt;expression&gt;&gt; ;
</pre>
<p>is also allowed. This mode is optional. The known modes and their
meanings are:</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl>
<p>Of these three modes only <b class="const">leaf</b> and <b class="const">void</b> can be
specified directly. <b class="const">value</b> is implicitly specified by the
absence of a mode before the nonterminal.</p>
<p>Now, with all the above under our belt it should be possible to not
only read, but understand the formal specification of the text
representation shown in the next section, written in itself.</p>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">PEG Specification Language</a></h2>
<p><b class="const">peg</b>, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.</p>
<p>It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the <i class="term">PEG Language Tutorial</i>.</p>
<pre class="example">
PEG pe-grammar-for-peg (Grammar)
	# --------------------------------------------------------------------
        # Syntactical constructs
        Grammar         &lt;- WHITESPACE Header Definition* Final EOF ;
        Header          &lt;- PEG Identifier StartExpr ;
        Definition      &lt;- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       &lt;- (VOID / LEAF) COLON ;
        Expression      &lt;- Sequence (SLASH Sequence)* ;
        Sequence        &lt;- Prefix+ ;
        Prefix          &lt;- (AND / NOT)? Suffix ;
        Suffix          &lt;- Primary (QUESTION / STAR / PLUS)? ;
        Primary         &lt;- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         &lt;- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           &lt;- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           &lt;- Char TO Char / Char ;
        StartExpr       &lt;- OPEN Expression CLOSE ;
void:   Final           &lt;- END SEMICOLON WHITESPACE ;
        # --------------------------------------------------------------------
        # Lexing constructs
        Identifier      &lt;- Ident WHITESPACE ;
leaf:   Ident           &lt;- ('_' / ':' / &lt;alpha&gt;) ('_' / ':' / &lt;alnum&gt;)* ;
        Char            &lt;- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;
leaf:   CharSpecial     &lt;- &quot;\\&quot; [nrt'&quot;\[\]\\] ;
leaf:   CharOctalFull   &lt;- &quot;\\&quot; [0-2][0-7][0-7] ;
leaf:   CharOctalPart   &lt;- &quot;\\&quot; [0-7][0-7]? ;
leaf:   CharUnicode     &lt;- &quot;\\&quot; 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   &lt;- !&quot;\\&quot; . ;
void:   HexDigit        &lt;- [0-9a-fA-F] ;
void:   TO              &lt;- '-'           ;
void:   OPENB           &lt;- &quot;[&quot;           ;
void:   CLOSEB          &lt;- &quot;]&quot;           ;
void:   APOSTROPH       &lt;- &quot;'&quot;           ;
void:   DAPOSTROPH      &lt;- '&quot;'           ;
void:   PEG             &lt;- &quot;PEG&quot;   WHITESPACE ;
void:   IS              &lt;- &quot;&lt;-&quot;    WHITESPACE ;
leaf:   VOID            &lt;- &quot;void&quot;  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            &lt;- &quot;leaf&quot;  WHITESPACE ; # Implies that definition has no terminals.
void:   END             &lt;- &quot;END&quot;   WHITESPACE ;
void:   SEMICOLON       &lt;- &quot;;&quot;     WHITESPACE ;
void:   COLON           &lt;- &quot;:&quot;     WHITESPACE ;
void:   SLASH           &lt;- &quot;/&quot;     WHITESPACE ;
leaf:   AND             &lt;- &quot;&amp;&quot;     WHITESPACE ;
leaf:   NOT             &lt;- &quot;!&quot;     WHITESPACE ;
leaf:   QUESTION        &lt;- &quot;?&quot;     WHITESPACE ;
leaf:   STAR            &lt;- &quot;*&quot;     WHITESPACE ;
leaf:   PLUS            &lt;- &quot;+&quot;     WHITESPACE ;
void:   OPEN            &lt;- &quot;(&quot;     WHITESPACE ;
void:   CLOSE           &lt;- &quot;)&quot;     WHITESPACE ;
leaf:   DOT             &lt;- &quot;.&quot;     WHITESPACE ;
leaf:   ALNUM           &lt;- &quot;&lt;alnum&gt;&quot;    WHITESPACE ;
leaf:   ALPHA           &lt;- &quot;&lt;alpha&gt;&quot;    WHITESPACE ;
leaf:   ASCII           &lt;- &quot;&lt;ascii&gt;&quot;    WHITESPACE ;
leaf:   CONTROL         &lt;- &quot;&lt;control&gt;&quot;  WHITESPACE ;
leaf:   DDIGIT          &lt;- &quot;&lt;ddigit&gt;&quot;   WHITESPACE ;
leaf:   DIGIT           &lt;- &quot;&lt;digit&gt;&quot;    WHITESPACE ;
leaf:   GRAPH           &lt;- &quot;&lt;graph&gt;&quot;    WHITESPACE ;
leaf:   LOWER           &lt;- &quot;&lt;lower&gt;&quot;    WHITESPACE ;
leaf:   PRINTABLE       &lt;- &quot;&lt;print&gt;&quot;    WHITESPACE ;
leaf:   PUNCT           &lt;- &quot;&lt;punct&gt;&quot;    WHITESPACE ;
leaf:   SPACE           &lt;- &quot;&lt;space&gt;&quot;    WHITESPACE ;
leaf:   UPPER           &lt;- &quot;&lt;upper&gt;&quot;    WHITESPACE ;
leaf:   WORDCHAR        &lt;- &quot;&lt;wordchar&gt;&quot; WHITESPACE ;
leaf:   XDIGIT          &lt;- &quot;&lt;xdigit&gt;&quot;   WHITESPACE ;
void:   WHITESPACE      &lt;- (&quot; &quot; / &quot;\t&quot; / EOL / COMMENT)* ;
void:   COMMENT         &lt;- '#' (!EOL .)* EOL ;
void:   EOL             &lt;- &quot;\n\r&quot; / &quot;\n&quot; / &quot;\r&quot; ;
void:   EOF             &lt;- !. ;
        # --------------------------------------------------------------------
END;
</pre>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Example</a></h3>
<p>Our example specifies the grammar for a basic 4-operation calculator.</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as</p>
<pre class="example">
PEG calculator (Expression)
    Sign       &lt;- [-+] 						;
    Number     &lt;- Sign? &lt;ddigit&gt;+				;
    Expression &lt;- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      &lt;- [*/]						;
    Factor     &lt;- Term (AddOp Term)*				;
    AddOp      &lt;- [-+]						;
    Term       &lt;- Number					;
END;
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_to_container.html.




















































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::to::container - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_to_container.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::to::container.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::to::container(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::to::container - PEG Conversion. Write CONTAINER format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Options</a></li>
<li class="section"><a href="#section4">Grammar Container</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::to::container <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg</b></li>
<li>package require <b class="pkgname">text::write</b></li>
<li>package require <b class="pkgname">char</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt::peg::to::container</b> <b class="method">reset</b></a></li>
<li><a href="#2"><b class="cmd">pt::peg::to::container</b> <b class="method">configure</b></a></li>
<li><a href="#3"><b class="cmd">pt::peg::to::container</b> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#4"><b class="cmd">pt::peg::to::container</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#5"><b class="cmd">pt::peg::to::container</b> <b class="method">convert</b> <i class="arg">serial</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the converter from parsing expression grammars
to CONTAINER markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
<b class="package"><a href="pt_peg_export_container.html">pt::peg::export::container</a></b> sitting between converter
and export manager.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Converter API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt::peg::to::container</b> <b class="method">reset</b></a></dt>
<dd><p>This command resets the configuration of the package to its default
settings.</p></dd>
<dt><a name="2"><b class="cmd">pt::peg::to::container</b> <b class="method">configure</b></a></dt>
<dd><p>This command returns a dictionary containing the current configuration
of the package.</p></dd>
<dt><a name="3"><b class="cmd">pt::peg::to::container</b> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>This command returns the current value of the specified configuration
<i class="arg">option</i> of the package. For the set of legal options, please read
the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">pt::peg::to::container</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd><p>This command sets the given configuration <i class="arg">option</i>s of the
package, to the specified <i class="arg">value</i>s. For the set of legal options,
please read the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">pt::peg::to::container</b> <b class="method">convert</b> <i class="arg">serial</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, and generates CONTAINER markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Options</a></h2>
<p>The converter to the CONTAINER format recognizes the following options
and changes its behaviour as they specify.</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-mode</b> <b class="const">bulk</b>|<b class="const">incremental</b></dt>
<dd><p>The value of this option controls which methods of
<b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b> instances are used to specify the
grammar, i.e. preload it into the container. There are two legal
values, as listed below. The default is <b class="const">bulk</b>.</p>
<dl class="definitions">
<dt><b class="const">bulk</b></dt>
<dd><p>In this mode the methods <b class="method">start</b>, <b class="method">add</b>, <b class="method">modes</b>,
and <b class="method">rules</b> are used to specify the grammar in a bulk manner,
i.e. as a set of nonterminal symbols, and two dictionaries mapping
from the symbols to their semantic modes and parsing expressions.</p>
<p>This mode is the default.</p></dd>
<dt><b class="const">incremental</b></dt>
<dd><p>In this mode the methods <b class="method">start</b>, <b class="method">add</b>, <b class="method">mode</b>,
and <b class="method">rule</b> are used to specify the grammar piecemal, with each
nonterminal having its own block of defining commands.</p></dd>
</dl></dd>
<dt><b class="option">-template</b> string</dt>
<dd><p>The value of this option is a string into which to put the generated
code and the other configuration settings. The various locations for
user-data are expected to be specified with the placeholders listed
below. The default value is &quot;<b class="const">@code@</b>&quot;.</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">CONTAINER</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-name</b>.</p></dd>
<dt><b class="const">@mode@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-mode</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated code.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Grammar Container</a></h2>
<p>The <b class="const">container</b> format is another form of describing parsing
expression grammars. While data in this format is executable it does
not constitute a parser for the grammar. It always has to be used in
conjunction with the package <b class="package"><a href="pt_peg_interp.html">pt::peg::interp</a></b>, a grammar
interpreter.</p>
<p>The format represents grammars by a <b class="cmd">snit::type</b>, i.e. class,
whose instances are API-compatible to the instances of the
<b class="package"><a href="pt_peg_container.html">pt::peg::container</a></b> package, and which are preloaded with the
grammar in question.</p>
<p>It has no direct formal specification beyond what was said above.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>one possible CONTAINER serialization for it is</p>
<pre class="example">
snit::type a_pe_grammar {
    constructor {} {
        install myg using pt::peg::container ${selfns}::G
        $myg start {n Expression}
        $myg add   AddOp Digit Expression Factor MulOp Number Sign Term
        $myg modes {
            AddOp      value
            Digit      value
            Expression value
            Factor     value
            MulOp      value
            Number     value
            Sign       value
            Term       value
        }
        $myg rules {
            AddOp      {/ {t -} {t +}}
            Digit      {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}
            Expression {/ {x {t \50} {n Expression} {t \51}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}}
            Factor     {x {n Term} {* {x {n AddOp} {n Term}}}}
            MulOp      {/ {t *} {t /}}
            Number     {x {? {n Sign}} {+ {n Digit}}}
            Sign       {/ {t -} {t +}}
            Term       {n Number}
        }
        return
    }
    component myg
    delegate method * to myg
}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key308">CONTAINER</a>, <a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key103">format conversion</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_to_cparam.html.









































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::to::cparam - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_to_cparam.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::to::cparam.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::to::cparam(n) 1.0.1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::to::cparam - PEG Conversion. Write CPARAM format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Options</a></li>
<li class="section"><a href="#section4">C/PARAM code representation of parsing expression grammars</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::to::cparam <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt::peg::to::cparam</b> <b class="method">reset</b></a></li>
<li><a href="#2"><b class="cmd">pt::peg::to::cparam</b> <b class="method">configure</b></a></li>
<li><a href="#3"><b class="cmd">pt::peg::to::cparam</b> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#4"><b class="cmd">pt::peg::to::cparam</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#5"><b class="cmd">pt::peg::to::cparam</b> <b class="method">convert</b> <i class="arg">serial</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the converter from parsing expression grammars
to CPARAM markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
<b class="package">pt::peg::export::cparam</b> sitting between converter
and export manager.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Converter API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt::peg::to::cparam</b> <b class="method">reset</b></a></dt>
<dd><p>This command resets the configuration of the package to its default
settings.</p></dd>
<dt><a name="2"><b class="cmd">pt::peg::to::cparam</b> <b class="method">configure</b></a></dt>
<dd><p>This command returns a dictionary containing the current configuration
of the package.</p></dd>
<dt><a name="3"><b class="cmd">pt::peg::to::cparam</b> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>This command returns the current value of the specified configuration
<i class="arg">option</i> of the package. For the set of legal options, please read
the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">pt::peg::to::cparam</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd><p>This command sets the given configuration <i class="arg">option</i>s of the
package, to the specified <i class="arg">value</i>s. For the set of legal options,
please read the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">pt::peg::to::cparam</b> <b class="method">convert</b> <i class="arg">serial</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, and generates CPARAM markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Options</a></h2>
<p>The converter to C code recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-template</b> string</dt>
<dd><p>The value of this option is a string into which to put
the generated text and the other configuration settings. The various
locations for user-data are expected to be specified with the
placeholders listed below. The default value is &quot;<b class="const">@code@</b>&quot;.</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">C/PARAM</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-name</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated Tcl code.</p></dd>
</dl>
<p>The following options are special, in that they will
occur within the generated code, and are replaced there as well.</p>
<dl class="definitions">
<dt><b class="const">@statedecl@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">state-decl</b>.</p></dd>
<dt><b class="const">@stateref@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">state-ref</b>.</p></dd>
<dt><b class="const">@strings@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">string-varname</b>.</p></dd>
<dt><b class="const">@self@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">self-command</b>.</p></dd>
<dt><b class="const">@def@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">fun-qualifier</b>.</p></dd>
<dt><b class="const">@ns@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">namespace</b>.</p></dd>
<dt><b class="const">@main@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">main</b>.</p></dd>
<dt><b class="const">@prelude@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">prelude</b>.</p></dd>
</dl></dd>
<dt><b class="option">-state-decl</b> string</dt>
<dd><p>A C string representing the argument declaration to use in the
generated parsing functions to refer to the parsing state. In essence
type and argument name.
The default value is the string <b class="const">RDE_PARAM p</b>.</p></dd>
<dt><b class="option">-state-ref</b> string</dt>
<dd><p>A C string representing the argument named used in the generated
parsing functions to refer to the parsing state.
The default value is the string <b class="const">p</b>.</p></dd>
<dt><b class="option">-self-command</b> string</dt>
<dd><p>A C string representing the reference needed to call the generated
parser function (methods ...) from another parser fonction, per the
chosen framework (template).
The default value is the empty string.</p></dd>
<dt><b class="option">-fun-qualifier</b> string</dt>
<dd><p>A C string containing the attributes to give to the generated
functions (methods ...), per the chosen framework (template).
The default value is <b class="const">static</b>.</p></dd>
<dt><b class="option">-namespace</b> string</dt>
<dd><p>The name of the C namespace the parser functions (methods, ...) shall
reside in, or a general prefix to add to the function names.
The default value is the empty string.</p></dd>
<dt><b class="option">-main</b> string</dt>
<dd><p>The name of the main function (method, ...) to be called by the chosen
framework (template) to start parsing input.
The default value is <b class="const">__main</b>.</p></dd>
<dt><b class="option">-string-varname</b> string</dt>
<dd><p>The name of the variable used for the table of strings used by the
generated parser, i.e. error messages, symbol names, etc.
The default value is <b class="const">p_string</b>.</p></dd>
<dt><b class="option">-prelude</b> string</dt>
<dd><p>A snippet of code to be inserted at the head of each generated parsing
function.
The default value is the empty string.</p></dd>
<dt><b class="option">-indent</b> integer</dt>
<dd><p>The number of characters to indent each line of the generated code by.
The default value is <b class="const">0</b>.</p></dd>
</dl>
<p>While the high parameterizability of this converter, as shown by the
multitude of options it supports, is an advantage to the advanced
user, allowing her to customize the output of the converter as needed,
a novice user will likely not see the forest for the trees.</p>
<p>To help these latter users an adjunct package is provided, containing
a canned configuration which will generate immediately useful full
parsers. It is</p>
<dl class="definitions">
<dt><b class="package"><a href="pt_cparam_config_critcl.html">pt::cparam::configuration::critcl</a></b></dt>
<dd><p>Generated parsers are embedded into a <b class="package">Critcl</b>-based framework.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">C/PARAM code representation of parsing expression grammars</a></h2>
<p>The <b class="const">c</b> format is executable code, a parser for the grammar. The
parser implementation is written in C and can be tweaked to the users'
needs through a multitude of options.</p>
<p>The <b class="cmd">critcl</b> format, for example, is implemented as a canned
configuration of these options on top of the generator for <b class="const">c</b>.</p>
<p>The bulk of such a framework has to be specified through the option
<b class="option">-template</b>. The additional options</p>
<dl class="options">
<dt><b class="option">-fun-qualifier</b> string</dt>
<dd></dd>
<dt><b class="option">-indent</b> integer</dt>
<dd></dd>
<dt><b class="option">-main</b> string</dt>
<dd></dd>
<dt><b class="option">-namespace</b> string</dt>
<dd></dd>
<dt><b class="option">-prelude</b> string</dt>
<dd></dd>
<dt><b class="option">-self-command</b> string</dt>
<dd></dd>
<dt><b class="option">-state-decl</b> string</dt>
<dd></dd>
<dt><b class="option">-state-ref</b> string</dt>
<dd></dd>
<dt><b class="option">-string-varname</b> string</dt>
<dd></dd>
</dl>
<p>provide code snippets which help to glue framework and generated code
together. Their placeholders are in the <em>generated</em> code.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>We are forgoing an example of this representation, with apologies.
It would be way to large for this document.</p>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key748">CPARAM</a>, <a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key103">format conversion</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_to_json.html.













































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::to::json - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_to_json.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::to::json.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::to::json(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::to::json - PEG Conversion. Write JSON format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Options</a></li>
<li class="section"><a href="#section4">JSON Grammar Exchange Format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::to::json <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg</b></li>
<li>package require <b class="pkgname">json::write</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt::peg::to::json</b> <b class="method">reset</b></a></li>
<li><a href="#2"><b class="cmd">pt::peg::to::json</b> <b class="method">configure</b></a></li>
<li><a href="#3"><b class="cmd">pt::peg::to::json</b> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#4"><b class="cmd">pt::peg::to::json</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#5"><b class="cmd">pt::peg::to::json</b> <b class="method">convert</b> <i class="arg">serial</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the converter from parsing expression grammars
to JSON markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
<b class="package"><a href="pt_peg_export_json.html">pt::peg::export::json</a></b> sitting between converter
and export manager.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Converter API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt::peg::to::json</b> <b class="method">reset</b></a></dt>
<dd><p>This command resets the configuration of the package to its default
settings.</p></dd>
<dt><a name="2"><b class="cmd">pt::peg::to::json</b> <b class="method">configure</b></a></dt>
<dd><p>This command returns a dictionary containing the current configuration
of the package.</p></dd>
<dt><a name="3"><b class="cmd">pt::peg::to::json</b> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>This command returns the current value of the specified configuration
<i class="arg">option</i> of the package. For the set of legal options, please read
the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">pt::peg::to::json</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd><p>This command sets the given configuration <i class="arg">option</i>s of the
package, to the specified <i class="arg">value</i>s. For the set of legal options,
please read the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">pt::peg::to::json</b> <b class="method">convert</b> <i class="arg">serial</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, and generates JSON markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Options</a></h2>
<p>The converter to the JSON grammar exchange format recognizes the
following configuration variables and changes its behaviour as they
specify.</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-indented</b> boolean</dt>
<dd><p>If this option is set the system will break the generated JSON across
lines and indent it according to its inner structure, with each key of
a dictionary on a separate line.</p>
<p>If the option is not set (the default), the whole JSON object will be
written on a single line, with minimum spacing between all elements.</p></dd>
<dt><b class="option">-aligned</b> boolean</dt>
<dd><p>If this option is set the system will ensure that the values for the
keys in a dictionary are vertically aligned with each other, for a
nice table effect.
To make this work this also implies that <b class="option">-indented</b> is set.</p>
<p>If the option is not set (the default), the output is formatted as per
the value of <b class="variable">indented</b>, without trying to align the values for
dictionary keys.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">JSON Grammar Exchange Format</a></h2>
<p>The <b class="const">json</b> format for parsing expression grammars was written as
a data exchange format not bound to Tcl. It was defined to allow the
exchange of grammars with PackRat/PEG based parser generators for
other languages.</p>
<p>It is formally specified by the rules below:</p>
<ol class="enumerated">
<li><p>The JSON of any PEG is a JSON object.</p></li>
<li><p>This object holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a JSON object holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a JSON object whose keys are the names of the nonterminal
symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a JSON object itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the
parsing expression describing the symbols sentennial structure, as
specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value is a JSON holding holding one of three values specifying how
a parser should handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is a JSON string holding the Tcl serialization of the start
parsing expression of the grammar, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol>
<p>As an aside to the advanced reader, this is pretty much the same as
the Tcl serialization of PE grammars, as specified in section
<span class="sectref"><a href="#section5">PEG serialization format</a></span>, except that the Tcl dictionaries
and lists of that format are mapped to JSON objects and arrays. Only
the parsing expressions themselves are not translated further, but
kept as JSON strings containing a nested Tcl list, and there is no
concept of canonicity for the JSON either.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>a JSON serialization for it is</p>
<pre class="example">
{
    &quot;pt::grammar::peg&quot; : {
        &quot;rules&quot; : {
            &quot;AddOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Digit&quot;     : {
                &quot;is&quot;   : &quot;\/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Expression&quot; : {
                &quot;is&quot;   : &quot;\/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Factor&quot;    : {
                &quot;is&quot;   : &quot;x {n Term} {* {x {n AddOp} {n Term}}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;MulOp&quot;     : {
                &quot;is&quot;   : &quot;\/ {t *} {t \/}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Number&quot;    : {
                &quot;is&quot;   : &quot;x {? {n Sign}} {+ {n Digit}}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Sign&quot;      : {
                &quot;is&quot;   : &quot;\/ {t -} {t +}&quot;,
                &quot;mode&quot; : &quot;value&quot;
            },
            &quot;Term&quot;      : {
                &quot;is&quot;   : &quot;n Number&quot;,
                &quot;mode&quot; : &quot;value&quot;
            }
        },
        &quot;start&quot; : &quot;n Expression&quot;
    }
}
</pre>
<p>and a Tcl serialization of the same is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
<p>The similarity of the latter to the JSON should be quite obvious.</p>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key232">JSON</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key103">format conversion</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_to_param.html.


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::to::param - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_to_param.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::to::param.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::to::param(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::to::param - PEG Conversion. Write PARAM format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Options</a></li>
<li class="section"><a href="#section4">PARAM code representation of parsing expression grammars</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::to::param <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg</b></li>
<li>package require <b class="pkgname">pt::pe</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt::peg::to::param</b> <b class="method">reset</b></a></li>
<li><a href="#2"><b class="cmd">pt::peg::to::param</b> <b class="method">configure</b></a></li>
<li><a href="#3"><b class="cmd">pt::peg::to::param</b> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#4"><b class="cmd">pt::peg::to::param</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#5"><b class="cmd">pt::peg::to::param</b> <b class="method">convert</b> <i class="arg">serial</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the converter from parsing expression grammars
to PARAM markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
<b class="package">pt::peg::export::param</b> sitting between converter
and export manager.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Converter API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt::peg::to::param</b> <b class="method">reset</b></a></dt>
<dd><p>This command resets the configuration of the package to its default
settings.</p></dd>
<dt><a name="2"><b class="cmd">pt::peg::to::param</b> <b class="method">configure</b></a></dt>
<dd><p>This command returns a dictionary containing the current configuration
of the package.</p></dd>
<dt><a name="3"><b class="cmd">pt::peg::to::param</b> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>This command returns the current value of the specified configuration
<i class="arg">option</i> of the package. For the set of legal options, please read
the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">pt::peg::to::param</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd><p>This command sets the given configuration <i class="arg">option</i>s of the
package, to the specified <i class="arg">value</i>s. For the set of legal options,
please read the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">pt::peg::to::param</b> <b class="method">convert</b> <i class="arg">serial</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, and generates PARAM markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Options</a></h2>
<p>The converter to PARAM markup recognizes the following configuration
variables and changes its behaviour as they specify.</p>
<dl class="options">
<dt><b class="option">-template</b> string</dt>
<dd><p>The value of this configuration variable is a string into which to put
the generated text and the other configuration settings. The various
locations for user-data are expected to be specified with the
placeholders listed below. The default value is &quot;<b class="const">@code@</b>&quot;.</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">-user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">PARAM</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">-file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">-name</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated text.</p></dd>
</dl></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this configuration variable is the name of the grammar
for which the conversion is run. The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this configuration variable is the name of the user for
which the conversion is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this configuration variable is the name of the file or
other entity from which the grammar came, for which the conversion is
run. The default value is <b class="const">unknown</b>.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">PARAM code representation of parsing expression grammars</a></h2>
<p>The PARAM code representation of parsing expression grammars is
assembler-like text using the instructions of the virtual machine
documented in the <i class="term"><a href="pt_param.html">PackRat Machine Specification</a></i>, plus a
few more for control flow (jump ok, jump fail, call symbol, return).</p>
<p>It is not really useful, except possibly as a tool demonstrating how a
grammar is compiled in general, without getting distracted by the
incidentials of a framework, i.e. like the supporting C and Tcl code
generated by the other PARAM-derived formats.</p>
<p>It has no direct formal specification beyond what was said above.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>one possible PARAM serialization for it is</p>
<pre class="example">
# -*- text -*-
# Parsing Expression Grammar 'TEMPLATE'.
# Generated for unknown, from file 'TEST'
#
# Grammar Start Expression
#
&lt;&lt;MAIN&gt;&gt;:
         call              sym_Expression
         halt
#
# value Symbol 'AddOp'
#
sym_AddOp:
# /
#     '-'
#     '+'
         symbol_restore    AddOp
  found! jump              found_7
         loc_push
         call              choice_5
   fail! value_clear
     ok! value_leaf        AddOp
         symbol_save       AddOp
         error_nonterminal AddOp
         loc_pop_discard
found_7:
     ok! ast_value_push
         return
choice_5:
# /
#     '-'
#     '+'
         error_clear
         loc_push
         error_push
         input_next        &quot;t -&quot;
     ok! test_char         &quot;-&quot;
         error_pop_merge
     ok! jump              oknoast_4
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t +&quot;
     ok! test_char         &quot;+&quot;
         error_pop_merge
     ok! jump              oknoast_4
         loc_pop_rewind
         status_fail
         return
oknoast_4:
         loc_pop_discard
         return
#
# value Symbol 'Digit'
#
sym_Digit:
# /
#     '0'
#     '1'
#     '2'
#     '3'
#     '4'
#     '5'
#     '6'
#     '7'
#     '8'
#     '9'
         symbol_restore    Digit
  found! jump              found_22
         loc_push
         call              choice_20
   fail! value_clear
     ok! value_leaf        Digit
         symbol_save       Digit
         error_nonterminal Digit
         loc_pop_discard
found_22:
     ok! ast_value_push
         return
choice_20:
# /
#     '0'
#     '1'
#     '2'
#     '3'
#     '4'
#     '5'
#     '6'
#     '7'
#     '8'
#     '9'
         error_clear
         loc_push
         error_push
         input_next        &quot;t 0&quot;
     ok! test_char         &quot;0&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 1&quot;
     ok! test_char         &quot;1&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 2&quot;
     ok! test_char         &quot;2&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 3&quot;
     ok! test_char         &quot;3&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 4&quot;
     ok! test_char         &quot;4&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 5&quot;
     ok! test_char         &quot;5&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 6&quot;
     ok! test_char         &quot;6&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 7&quot;
     ok! test_char         &quot;7&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 8&quot;
     ok! test_char         &quot;8&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t 9&quot;
     ok! test_char         &quot;9&quot;
         error_pop_merge
     ok! jump              oknoast_19
         loc_pop_rewind
         status_fail
         return
oknoast_19:
         loc_pop_discard
         return
#
# value Symbol 'Expression'
#
sym_Expression:
# /
#     x
#         '\('
#         (Expression)
#         '\)'
#     x
#         (Factor)
#         *
#             x
#                 (MulOp)
#                 (Factor)
         symbol_restore    Expression
  found! jump              found_46
         loc_push
         ast_push
         call              choice_44
   fail! value_clear
     ok! value_reduce      Expression
         symbol_save       Expression
         error_nonterminal Expression
         ast_pop_rewind
         loc_pop_discard
found_46:
     ok! ast_value_push
         return
choice_44:
# /
#     x
#         '\('
#         (Expression)
#         '\)'
#     x
#         (Factor)
#         *
#             x
#                 (MulOp)
#                 (Factor)
         error_clear
         ast_push
         loc_push
         error_push
         call              sequence_27
         error_pop_merge
     ok! jump              ok_43
         ast_pop_rewind
         loc_pop_rewind
         ast_push
         loc_push
         error_push
         call              sequence_40
         error_pop_merge
     ok! jump              ok_43
         ast_pop_rewind
         loc_pop_rewind
         status_fail
         return
ok_43:
         ast_pop_discard
         loc_pop_discard
         return
sequence_27:
# x
#     '\('
#     (Expression)
#     '\)'
         loc_push
         error_clear
         error_push
         input_next        &quot;t (&quot;
     ok! test_char         &quot;(&quot;
         error_pop_merge
   fail! jump              failednoast_29
         ast_push
         error_push
         call              sym_Expression
         error_pop_merge
   fail! jump              failed_28
         error_push
         input_next        &quot;t )&quot;
     ok! test_char         &quot;)&quot;
         error_pop_merge
   fail! jump              failed_28
         ast_pop_discard
         loc_pop_discard
         return
failed_28:
         ast_pop_rewind
failednoast_29:
         loc_pop_rewind
         return
sequence_40:
# x
#     (Factor)
#     *
#         x
#             (MulOp)
#             (Factor)
         ast_push
         loc_push
         error_clear
         error_push
         call              sym_Factor
         error_pop_merge
   fail! jump              failed_41
         error_push
         call              kleene_37
         error_pop_merge
   fail! jump              failed_41
         ast_pop_discard
         loc_pop_discard
         return
failed_41:
         ast_pop_rewind
         loc_pop_rewind
         return
kleene_37:
# *
#     x
#         (MulOp)
#         (Factor)
         loc_push
         error_push
         call              sequence_34
         error_pop_merge
   fail! jump              failed_38
         loc_pop_discard
         jump              kleene_37
failed_38:
         loc_pop_rewind
         status_ok
         return
sequence_34:
# x
#     (MulOp)
#     (Factor)
         ast_push
         loc_push
         error_clear
         error_push
         call              sym_MulOp
         error_pop_merge
   fail! jump              failed_35
         error_push
         call              sym_Factor
         error_pop_merge
   fail! jump              failed_35
         ast_pop_discard
         loc_pop_discard
         return
failed_35:
         ast_pop_rewind
         loc_pop_rewind
         return
#
# value Symbol 'Factor'
#
sym_Factor:
# x
#     (Term)
#     *
#         x
#             (AddOp)
#             (Term)
         symbol_restore    Factor
  found! jump              found_60
         loc_push
         ast_push
         call              sequence_57
   fail! value_clear
     ok! value_reduce      Factor
         symbol_save       Factor
         error_nonterminal Factor
         ast_pop_rewind
         loc_pop_discard
found_60:
     ok! ast_value_push
         return
sequence_57:
# x
#     (Term)
#     *
#         x
#             (AddOp)
#             (Term)
         ast_push
         loc_push
         error_clear
         error_push
         call              sym_Term
         error_pop_merge
   fail! jump              failed_58
         error_push
         call              kleene_54
         error_pop_merge
   fail! jump              failed_58
         ast_pop_discard
         loc_pop_discard
         return
failed_58:
         ast_pop_rewind
         loc_pop_rewind
         return
kleene_54:
# *
#     x
#         (AddOp)
#         (Term)
         loc_push
         error_push
         call              sequence_51
         error_pop_merge
   fail! jump              failed_55
         loc_pop_discard
         jump              kleene_54
failed_55:
         loc_pop_rewind
         status_ok
         return
sequence_51:
# x
#     (AddOp)
#     (Term)
         ast_push
         loc_push
         error_clear
         error_push
         call              sym_AddOp
         error_pop_merge
   fail! jump              failed_52
         error_push
         call              sym_Term
         error_pop_merge
   fail! jump              failed_52
         ast_pop_discard
         loc_pop_discard
         return
failed_52:
         ast_pop_rewind
         loc_pop_rewind
         return
#
# value Symbol 'MulOp'
#
sym_MulOp:
# /
#     '*'
#     '/'
         symbol_restore    MulOp
  found! jump              found_67
         loc_push
         call              choice_65
   fail! value_clear
     ok! value_leaf        MulOp
         symbol_save       MulOp
         error_nonterminal MulOp
         loc_pop_discard
found_67:
     ok! ast_value_push
         return
choice_65:
# /
#     '*'
#     '/'
         error_clear
         loc_push
         error_push
         input_next        &quot;t *&quot;
     ok! test_char         &quot;*&quot;
         error_pop_merge
     ok! jump              oknoast_64
         loc_pop_rewind
         loc_push
         error_push
         input_next        &quot;t /&quot;
     ok! test_char         &quot;/&quot;
         error_pop_merge
     ok! jump              oknoast_64
         loc_pop_rewind
         status_fail
         return
oknoast_64:
         loc_pop_discard
         return
#
# value Symbol 'Number'
#
sym_Number:
# x
#     ?
#         (Sign)
#     +
#         (Digit)
         symbol_restore    Number
  found! jump              found_80
         loc_push
         ast_push
         call              sequence_77
   fail! value_clear
     ok! value_reduce      Number
         symbol_save       Number
         error_nonterminal Number
         ast_pop_rewind
         loc_pop_discard
found_80:
     ok! ast_value_push
         return
sequence_77:
# x
#     ?
#         (Sign)
#     +
#         (Digit)
         ast_push
         loc_push
         error_clear
         error_push
         call              optional_70
         error_pop_merge
   fail! jump              failed_78
         error_push
         call              poskleene_73
         error_pop_merge
   fail! jump              failed_78
         ast_pop_discard
         loc_pop_discard
         return
failed_78:
         ast_pop_rewind
         loc_pop_rewind
         return
optional_70:
# ?
#     (Sign)
         loc_push
         error_push
         call              sym_Sign
         error_pop_merge
   fail! loc_pop_rewind
     ok! loc_pop_discard
         status_ok
         return
poskleene_73:
# +
#     (Digit)
         loc_push
         call              sym_Digit
   fail! jump              failed_74
loop_75:
         loc_pop_discard
         loc_push
         error_push
         call              sym_Digit
         error_pop_merge
     ok! jump              loop_75
         status_ok
failed_74:
         loc_pop_rewind
         return
#
# value Symbol 'Sign'
#
sym_Sign:
# /
#     '-'
#     '+'
         symbol_restore    Sign
  found! jump              found_86
         loc_push
         call              choice_5
   fail! value_clear
     ok! value_leaf        Sign
         symbol_save       Sign
         error_nonterminal Sign
         loc_pop_discard
found_86:
     ok! ast_value_push
         return
#
# value Symbol 'Term'
#
sym_Term:
# (Number)
         symbol_restore    Term
  found! jump              found_89
         loc_push
         ast_push
         call              sym_Number
   fail! value_clear
     ok! value_reduce      Term
         symbol_save       Term
         error_nonterminal Term
         ast_pop_rewind
         loc_pop_discard
found_89:
     ok! ast_value_push
         return
#
#
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key471">PARAM</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key103">format conversion</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_to_peg.html.






























































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::to::peg - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_to_peg.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::to::peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::to::peg(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::to::peg - PEG Conversion. Write PEG format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Options</a></li>
<li class="section"><a href="#section4">PEG Specification Language</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection3">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::to::peg <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::peg</b></li>
<li>package require <b class="pkgname">pt::pe</b></li>
<li>package require <b class="pkgname">text::write</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt::peg::to::peg</b> <b class="method">reset</b></a></li>
<li><a href="#2"><b class="cmd">pt::peg::to::peg</b> <b class="method">configure</b></a></li>
<li><a href="#3"><b class="cmd">pt::peg::to::peg</b> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#4"><b class="cmd">pt::peg::to::peg</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#5"><b class="cmd">pt::peg::to::peg</b> <b class="method">convert</b> <i class="arg">serial</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the converter from parsing expression grammars
to PEG markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
<b class="package"><a href="pt_peg_export_peg.html">pt::peg::export::peg</a></b> sitting between converter
and export manager.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Converter API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt::peg::to::peg</b> <b class="method">reset</b></a></dt>
<dd><p>This command resets the configuration of the package to its default
settings.</p></dd>
<dt><a name="2"><b class="cmd">pt::peg::to::peg</b> <b class="method">configure</b></a></dt>
<dd><p>This command returns a dictionary containing the current configuration
of the package.</p></dd>
<dt><a name="3"><b class="cmd">pt::peg::to::peg</b> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>This command returns the current value of the specified configuration
<i class="arg">option</i> of the package. For the set of legal options, please read
the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">pt::peg::to::peg</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd><p>This command sets the given configuration <i class="arg">option</i>s of the
package, to the specified <i class="arg">value</i>s. For the set of legal options,
please read the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">pt::peg::to::peg</b> <b class="method">convert</b> <i class="arg">serial</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, and generates PEG markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Options</a></h2>
<p>The converter to the PEG language recognizes the following options and
changes its behaviour as they specify.</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-template</b> string</dt>
<dd><p>The value of this option is a string into which to put the generated
text and the values of the other options. The various locations for
user-data are expected to be specified with the placeholders listed
below. The default value is &quot;<b class="const">@code@</b>&quot;.</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">PEG</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the option <b class="option">-name</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated text.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">PEG Specification Language</a></h2>
<p><b class="const">peg</b>, a language for the specification of parsing expression
grammars is meant to be human readable, and writable as well, yet
strict enough to allow its processing by machine. Like any computer
language. It was defined to make writing the specification of a
grammar easy, something the other formats found in the Parser Tools do
not lend themselves too.</p>
<p>It is formally specified by the grammar shown below, written in
itself. For a tutorial / introduction to the language please go and
read the <i class="term"><a href="pt_peg_language.html">PEG Language Tutorial</a></i>.</p>
<pre class="example">
PEG pe-grammar-for-peg (Grammar)
	# --------------------------------------------------------------------
        # Syntactical constructs
        Grammar         &lt;- WHITESPACE Header Definition* Final EOF ;
        Header          &lt;- PEG Identifier StartExpr ;
        Definition      &lt;- Attribute? Identifier IS Expression SEMICOLON ;
        Attribute       &lt;- (VOID / LEAF) COLON ;
        Expression      &lt;- Sequence (SLASH Sequence)* ;
        Sequence        &lt;- Prefix+ ;
        Prefix          &lt;- (AND / NOT)? Suffix ;
        Suffix          &lt;- Primary (QUESTION / STAR / PLUS)? ;
        Primary         &lt;- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT
                        /  GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER
                        /  WORDCHAR / XDIGIT
                        / Identifier
                        /  OPEN Expression CLOSE
                        /  Literal
                        /  Class
                        /  DOT
                        ;
        Literal         &lt;- APOSTROPH  (!APOSTROPH  Char)* APOSTROPH  WHITESPACE
                        /  DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
        Class           &lt;- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
        Range           &lt;- Char TO Char / Char ;
        StartExpr       &lt;- OPEN Expression CLOSE ;
void:   Final           &lt;- END SEMICOLON WHITESPACE ;
        # --------------------------------------------------------------------
        # Lexing constructs
        Identifier      &lt;- Ident WHITESPACE ;
leaf:   Ident           &lt;- ('_' / ':' / &lt;alpha&gt;) ('_' / ':' / &lt;alnum&gt;)* ;
        Char            &lt;- CharSpecial / CharOctalFull / CharOctalPart
                        /  CharUnicode / CharUnescaped
                        ;
leaf:   CharSpecial     &lt;- &quot;\\&quot; [nrt'&quot;\[\]\\] ;
leaf:   CharOctalFull   &lt;- &quot;\\&quot; [0-2][0-7][0-7] ;
leaf:   CharOctalPart   &lt;- &quot;\\&quot; [0-7][0-7]? ;
leaf:   CharUnicode     &lt;- &quot;\\&quot; 'u' HexDigit (HexDigit (HexDigit HexDigit?)?)? ;
leaf:   CharUnescaped   &lt;- !&quot;\\&quot; . ;
void:   HexDigit        &lt;- [0-9a-fA-F] ;
void:   TO              &lt;- '-'           ;
void:   OPENB           &lt;- &quot;[&quot;           ;
void:   CLOSEB          &lt;- &quot;]&quot;           ;
void:   APOSTROPH       &lt;- &quot;'&quot;           ;
void:   DAPOSTROPH      &lt;- '&quot;'           ;
void:   PEG             &lt;- &quot;PEG&quot;   WHITESPACE ;
void:   IS              &lt;- &quot;&lt;-&quot;    WHITESPACE ;
leaf:   VOID            &lt;- &quot;void&quot;  WHITESPACE ; # Implies that definition has no semantic value.
leaf:   LEAF            &lt;- &quot;leaf&quot;  WHITESPACE ; # Implies that definition has no terminals.
void:   END             &lt;- &quot;END&quot;   WHITESPACE ;
void:   SEMICOLON       &lt;- &quot;;&quot;     WHITESPACE ;
void:   COLON           &lt;- &quot;:&quot;     WHITESPACE ;
void:   SLASH           &lt;- &quot;/&quot;     WHITESPACE ;
leaf:   AND             &lt;- &quot;&amp;&quot;     WHITESPACE ;
leaf:   NOT             &lt;- &quot;!&quot;     WHITESPACE ;
leaf:   QUESTION        &lt;- &quot;?&quot;     WHITESPACE ;
leaf:   STAR            &lt;- &quot;*&quot;     WHITESPACE ;
leaf:   PLUS            &lt;- &quot;+&quot;     WHITESPACE ;
void:   OPEN            &lt;- &quot;(&quot;     WHITESPACE ;
void:   CLOSE           &lt;- &quot;)&quot;     WHITESPACE ;
leaf:   DOT             &lt;- &quot;.&quot;     WHITESPACE ;
leaf:   ALNUM           &lt;- &quot;&lt;alnum&gt;&quot;    WHITESPACE ;
leaf:   ALPHA           &lt;- &quot;&lt;alpha&gt;&quot;    WHITESPACE ;
leaf:   ASCII           &lt;- &quot;&lt;ascii&gt;&quot;    WHITESPACE ;
leaf:   CONTROL         &lt;- &quot;&lt;control&gt;&quot;  WHITESPACE ;
leaf:   DDIGIT          &lt;- &quot;&lt;ddigit&gt;&quot;   WHITESPACE ;
leaf:   DIGIT           &lt;- &quot;&lt;digit&gt;&quot;    WHITESPACE ;
leaf:   GRAPH           &lt;- &quot;&lt;graph&gt;&quot;    WHITESPACE ;
leaf:   LOWER           &lt;- &quot;&lt;lower&gt;&quot;    WHITESPACE ;
leaf:   PRINTABLE       &lt;- &quot;&lt;print&gt;&quot;    WHITESPACE ;
leaf:   PUNCT           &lt;- &quot;&lt;punct&gt;&quot;    WHITESPACE ;
leaf:   SPACE           &lt;- &quot;&lt;space&gt;&quot;    WHITESPACE ;
leaf:   UPPER           &lt;- &quot;&lt;upper&gt;&quot;    WHITESPACE ;
leaf:   WORDCHAR        &lt;- &quot;&lt;wordchar&gt;&quot; WHITESPACE ;
leaf:   XDIGIT          &lt;- &quot;&lt;xdigit&gt;&quot;   WHITESPACE ;
void:   WHITESPACE      &lt;- (&quot; &quot; / &quot;\t&quot; / EOL / COMMENT)* ;
void:   COMMENT         &lt;- '#' (!EOL .)* EOL ;
void:   EOL             &lt;- &quot;\n\r&quot; / &quot;\n&quot; / &quot;\r&quot; ;
void:   EOF             &lt;- !. ;
        # --------------------------------------------------------------------
END;
</pre>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Our example specifies the grammar for a basic 4-operation calculator.</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>Using higher-level features of the notation, i.e. the character
classes (predefined and custom), this example can be rewritten as</p>
<pre class="example">
PEG calculator (Expression)
    Sign       &lt;- [-+] 						;
    Number     &lt;- Sign? &lt;ddigit&gt;+				;
    Expression &lt;- '(' Expression ')' / (Factor (MulOp Factor)*)	;
    MulOp      &lt;- [*/]						;
    Factor     &lt;- Term (AddOp Term)*				;
    AddOp      &lt;- [-+]						;
    Term       &lt;- Number					;
END;
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key103">format conversion</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_peg_to_tclparam.html.
























































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg::to::tclparam - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_peg_to_tclparam.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg::to::tclparam.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg::to::tclparam(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg::to::tclparam - PEG Conversion. Write TCLPARAM format</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Options</a></li>
<li class="section"><a href="#section4">Tcl/PARAM code representation of parsing expression grammars</a></li>
<li class="section"><a href="#section5">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg::to::tclparam <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">reset</b></a></li>
<li><a href="#2"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">configure</b></a></li>
<li><a href="#3"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#4"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#5"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">convert</b> <i class="arg">serial</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package implements the converter from parsing expression grammars
to TCLPARAM markup.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools,
and can be used either directly with the other packages of this layer,
or indirectly through the export manager provided by
<b class="package"><a href="pt_peg_export.html">pt::peg::export</a></b>. The latter is intented for use in untrusted
environments and done through the corresponding export plugin
<b class="package">pt::peg::export::tclparam</b> sitting between converter
and export manager.</p>
<p><img alt="arch_core_eplugins" src="../../../../image/arch_core_eplugins.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The API provided by this package satisfies the specification of the
Converter API found in the <i class="term"><a href="pt_to_api.html">Parser Tools Export API</a></i>
specification.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">reset</b></a></dt>
<dd><p>This command resets the configuration of the package to its default
settings.</p></dd>
<dt><a name="2"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">configure</b></a></dt>
<dd><p>This command returns a dictionary containing the current configuration
of the package.</p></dd>
<dt><a name="3"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>This command returns the current value of the specified configuration
<i class="arg">option</i> of the package. For the set of legal options, please read
the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd><p>This command sets the given configuration <i class="arg">option</i>s of the
package, to the specified <i class="arg">value</i>s. For the set of legal options,
please read the section <span class="sectref"><a href="#section3">Options</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">pt::peg::to::tclparam</b> <b class="method">convert</b> <i class="arg">serial</i></a></dt>
<dd><p>This command takes the canonical serialization of a parsing expression
grammar, as specified in section <span class="sectref"><a href="#section5">PEG serialization format</a></span>,
and contained in <i class="arg">serial</i>, and generates TCLPARAM markup
encoding the grammar, per the current package configuration.
The created string is then returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Options</a></h2>
<p>The converter to Tcl/PARAM markup recognizes the following
configuration variables and changes its behaviour as they specify.</p>
<dl class="options">
<dt><b class="option">-template</b> string</dt>
<dd><p>The value of this configuration variable is a string into which to put
the generated text and the other configuration settings. The various
locations for user-data are expected to be specified with the
placeholders listed below. The default value is &quot;<b class="const">@code@</b>&quot;.</p>
<dl class="definitions">
<dt><b class="const">@user@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">-user</b>.</p></dd>
<dt><b class="const">@format@</b></dt>
<dd><p>To be replaced with the the constant <b class="const">Tcl/PARAM</b>.</p></dd>
<dt><b class="const">@file@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">-file</b>.</p></dd>
<dt><b class="const">@name@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">-name</b>.</p></dd>
<dt><b class="const">@code@</b></dt>
<dd><p>To be replaced with the generated Tcl code.</p></dd>
</dl>
<p>The following configuration variables are special, in that they will
occur within the generated code, and are replaced there as well.</p>
<dl class="definitions">
<dt><b class="const">@runtime@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">runtime-command</b>.</p></dd>
<dt><b class="const">@self@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">self-command</b>.</p></dd>
<dt><b class="const">@def@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">proc-command</b>.</p></dd>
<dt><b class="const">@ns@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">namespace</b>.</p></dd>
<dt><b class="const">@main@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">main</b>.</p></dd>
<dt><b class="const">@prelude@</b></dt>
<dd><p>To be replaced with the value of the configuration variable <b class="option">prelude</b>.</p></dd>
</dl></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this configuration variable is the name of the grammar
for which the conversion is run. The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this configuration variable is the name of the user for
which the conversion is run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this configuration variable is the name of the file or
other entity from which the grammar came, for which the conversion is
run. The default value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-runtime-command</b> string</dt>
<dd><p>A Tcl string representing the Tcl command or reference to it used to
call PARAM instruction from parser procedures, per the chosen
framework (template).
The default value is the empty string.</p></dd>
<dt><b class="option">-self-command</b> string</dt>
<dd><p>A Tcl string representing the Tcl command or reference to it used to
call the parser procedures (methods ...) from another parser
procedure, per the chosen framework (template).
The default value is the empty string.</p></dd>
<dt><b class="option">-proc-command</b> string</dt>
<dd><p>The name of the Tcl command used to define procedures (methods ...),
per the chosen framework (template).
The default value is <b class="const">proc</b>.</p></dd>
<dt><b class="option">-namespace</b> string</dt>
<dd><p>The name of the namespace the parser procedures (methods, ...) shall
reside in, including the trailing '::' needed to separate it from the
actual procedure name.
The default value is <b class="const">::</b>.</p></dd>
<dt><b class="option">-main</b> string</dt>
<dd><p>The name of the main procedure (method, ...) to be called by the
chosen framework (template) to start parsing input.
The default value is <b class="const">__main</b>.</p></dd>
<dt><b class="option">-prelude</b> string</dt>
<dd><p>A snippet of code to be insert at the head of each generated parsing
command.
The default value is the empty string.</p></dd>
<dt><b class="option">-indent</b> integer</dt>
<dd><p>The number of characters to indent each line of the generated code by.
The default value is <b class="const">0</b>.</p></dd>
</dl>
<p>While the high parameterizability of this converter, as shown by the
multitude of options it supports, is an advantage to the advanced
user, allowing her to customize the output of the converter as needed,
a novice user will likely not see the forest for the trees.</p>
<p>To help these latter users two adjunct packages are provided, each
containing a canned configuration which will generate immediately
useful full parsers. These are</p>
<dl class="definitions">
<dt><b class="package"><a href="pt_tclparam_config_snit.html">pt::tclparam::configuration::snit</a></b></dt>
<dd><p>Generated parsers are classes based on the <b class="package"><a href="../snit/snit.html">snit</a></b> package,
i.e. snit::type's.</p></dd>
<dt><b class="package"><a href="pt_tclparam_config_tcloo.html">pt::tclparam::configuration::tcloo</a></b></dt>
<dd><p>Generated parsers are classes based on the <b class="package">OO</b> package.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Tcl/PARAM code representation of parsing expression grammars</a></h2>
<p>The Tcl/PARAM representation of parsing expression grammars is Tcl
code whose execution will parse input per the grammar. The code is
based on the virtual machine documented in the
<i class="term"><a href="pt_param.html">PackRat Machine Specification</a></i>, using its instructions
and a few more to handle control flow.</p>
<p>Note that the generated code by itself is not functional. It expects
to be embedded into a framework which provides services like the PARAM
state, implementations for the PARAM instructions, etc.
The bulk of such a framework has to be specified through the option
<b class="option">-template</b>. The additional options</p>
<dl class="options">
<dt><b class="option">-indent</b> integer</dt>
<dd></dd>
<dt><b class="option">-main</b> string</dt>
<dd></dd>
<dt><b class="option">-namespace</b> string</dt>
<dd></dd>
<dt><b class="option">-prelude</b> string</dt>
<dd></dd>
<dt><b class="option">-proc-command</b> string</dt>
<dd></dd>
<dt><b class="option">-runtime-command</b> string</dt>
<dd></dd>
<dt><b class="option">-self-command</b> string</dt>
<dd></dd>
</dl>
<p>provide code snippets which help to glue framework and generated code
together. Their placeholders are in the <em>generated</em> code.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section6">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key101">TCLPARAM</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key103">format conversion</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_pegrammar.html.


































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::peg - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_pegrammar.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::peg.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::peg(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::peg - Parsing Expression Grammar Serialization</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::peg <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::pe</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::peg</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::pt::peg</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></li>
<li><a href="#3"><b class="cmd">::pt::peg</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></li>
<li><a href="#4"><b class="cmd">::pt::peg</b> <b class="method">print</b> <i class="arg">serial</i></a></li>
<li><a href="#5"><b class="cmd">::pt::peg</b> <b class="method">merge</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></li>
<li><a href="#6"><b class="cmd">::pt::peg</b> <b class="method">equal</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides commands to work with the serializations of
parsing expression grammars as managed by the Parser Tools, and
specified in section <span class="sectref"><a href="#section3">PEG serialization format</a></span>.</p>
<p>This is a supporting package in the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_support" src="../../../../image/arch_core_support.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::peg</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
serialization of a parsing expression and will throw an error if that
is not the case. The result of the command is the empty string.</p>
<p>If the argument <i class="arg">canonvar</i> is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if <i class="arg">serial</i> is a valid regular
serialization. Its value will be a boolean, with <b class="const">True</b>
indicating that the serialization is not only valid, but also
<i class="term">canonical</i>. <b class="const">False</b> will be written for a valid, but
non-canonical serialization.</p>
<p>For the specification of serializations see the section
<span class="sectref"><a href="#section4">PE serialization format</a></span>.</p></dd>
<dt><a name="2"><b class="cmd">::pt::peg</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
<i class="term">canonical</i> serialization of a PEG and will throw an error if
that is not the case. The result of the command is the empty string.</p>
<p>For the specification of canonical serializations see the section
<span class="sectref"><a href="#section3">PEG serialization format</a></span>.</p></dd>
<dt><a name="3"><b class="cmd">::pt::peg</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the content of <i class="arg">serial</i> is a valid
<i class="term">regular</i> serialization of a PEG and will throw an error if that
is not the case.</p>
<p>It will then convert the input into the <i class="term">canonical</i> serialization
of the contained PEG and return it as its result. If the input is
already canonical it will be returned unchanged.</p>
<p>For the specification of regular and canonical serializations see the
section <span class="sectref"><a href="#section3">PEG serialization format</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::pt::peg</b> <b class="method">print</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the argument <i class="arg">serial</i> contains a valid
serialization of a parsing expression and returns a string containing
that PE in a human readable form.</p>
<p>The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.</p>
<p>For the specification of serializations see the section
<span class="sectref"><a href="#section3">PEG serialization format</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::pt::peg</b> <b class="method">merge</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></dt>
<dd><p>This command accepts the regular serializations of two grammars and
uses them to create their union.  The result of the command is the
canonical serialization of this unified grammar.</p>
<p>A merge errors occurs if for any nonterminal symbol S occuring in both
input grammars the two input grammars specify different semantic
modes.</p>
<p>The semantic mode of each nonterminal symbol S is the semantic mode of
S in any of its input grammars. The previous rule made sure that for
symbols occuring in both grammars these values are identical.</p>
<p>The right-hand side of each nonterminal symbol S occuring in both
input grammars is the choice between the right-hand sides of S in the
input grammars, with the parsing expression of S in <i class="arg">seriala</i>
coming first, except if both expressions are identical. In that case
the first expression is taken.</p>
<p>The right-hand side of each nonterminal symbol S occuring in only one
of the input grammars is the right-hand side of S in its input
grammar.</p>
<p>The start expression of the unified grammar is the choice between the
start expressions of the input grammars, with the start expression of
<i class="arg">seriala</i> coming first, except if both expressions are identical.
In that case the first expression is taken</p></dd>
<dt><a name="6"><b class="cmd">::pt::peg</b> <b class="method">equal</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></dt>
<dd><p>This command tests the two grammars <i class="arg">seriala</i> and <i class="arg">serialb</i>
for structural equality. The result of the command is a boolean
value. It will be set to <b class="const">true</b> if the expressions are
identical, and <b class="const">false</b> otherwise.</p>
<p>String equality is usable only if we can assume that the two grammars
are pure Tcl lists and dictionaries.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section4">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section4">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_pexpr_op.html.

























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::pe::op - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_pexpr_op.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::pe::op.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::pe::op(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::pe::op - Parsing Expression Utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::pe::op <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">pt::pe <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">struct::set</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::pe::op</b> <b class="method">drop</b> <i class="arg">dropset</i> <i class="arg">pe</i></a></li>
<li><a href="#2"><b class="cmd">::pt::pe::op</b> <b class="method">rename</b> <i class="arg">nt</i> <i class="arg">ntnew</i> <i class="arg">pe</i></a></li>
<li><a href="#3"><b class="cmd">::pt::pe::op</b> <b class="method">called</b> <i class="arg">pe</i></a></li>
<li><a href="#4"><b class="cmd">::pt::pe::op</b> <b class="method">flatten</b> <i class="arg">pe</i></a></li>
<li><a href="#5"><b class="cmd">::pt::pe::op</b> <b class="method">fusechars</b> <i class="arg">pe</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides additional commands to work with the
serializations of parsing expressions as managed by the PEG and
related packages, and specified in section
<span class="sectref"><a href="#section3">PE serialization format</a></span>.</p>
<p>This is an internal package, for use by the higher level packages
handling PEGs, their conversion into and out of various other formats,
or other uses.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::pe::op</b> <b class="method">drop</b> <i class="arg">dropset</i> <i class="arg">pe</i></a></dt>
<dd><p>This command removes all occurences of any of the nonterminals symbols
in the set <i class="arg">dropset</i> from the parsing expression <i class="arg">pe</i>, and
simplifies it. This may result in the expression becoming &quot;epsilon&quot;,
i.e. matching nothing.</p></dd>
<dt><a name="2"><b class="cmd">::pt::pe::op</b> <b class="method">rename</b> <i class="arg">nt</i> <i class="arg">ntnew</i> <i class="arg">pe</i></a></dt>
<dd><p>This command renames all occurences of the nonterminal <i class="arg">nt</i> in the
parsing expression <i class="arg">pe</i> into <i class="arg">ntnew</i>.</p></dd>
<dt><a name="3"><b class="cmd">::pt::pe::op</b> <b class="method">called</b> <i class="arg">pe</i></a></dt>
<dd><p>This command extracts the set of all nonterminal symbols used,
i.e. 'called', in the parsing expression <i class="arg">pe</i>.</p></dd>
<dt><a name="4"><b class="cmd">::pt::pe::op</b> <b class="method">flatten</b> <i class="arg">pe</i></a></dt>
<dd><p>This command transforms the parsing expression by eliminating
sequences nested in sequences, and choices in choices, lifting the
children of the nested expression into the parent. It further
eliminates all sequences and choices with only one child, as these are
redundant.</p>
<p>The resulting parsing expression is returned as the result of the
command.</p></dd>
<dt><a name="5"><b class="cmd">::pt::pe::op</b> <b class="method">fusechars</b> <i class="arg">pe</i></a></dt>
<dd><p>This command transforms the parsing expression by fusing adjacent
terminals in sequences and adjacent terminals and ranges in choices,
it (re)constructs highlevel <i class="term">strings</i> and
<i class="term">character classes</i>.</p>
<p>The resulting pseudo-parsing expression is returned as the result of
the command and may contain the pseudo-operators <b class="const">str</b> for
character sequences, aka strings, and <b class="const">cl</b> for character
choices, aka character classes.</p>
<p>The result is called a <i class="term">pseudo-parsing expression</i> because it
is not a true parsing expression anymore, and will fail a check with
<b class="cmd">::pt::peg verify</b> if the new pseudo-operators
are present in the result, but is otherwise of sound structure for a
parsing expression.
Notably, the commands <b class="cmd">::pt::peg bottomup</b> and
<b class="cmd">::pt::peg topdown</b> will process them without
trouble.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_pexpression.html.























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::pe - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_pexpression.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::pe.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::pe(n) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::pe - Parsing Expression Serialization</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::pe <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">char</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::pe</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::pt::pe</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></li>
<li><a href="#3"><b class="cmd">::pt::pe</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></li>
<li><a href="#4"><b class="cmd">::pt::pe</b> <b class="method">print</b> <i class="arg">serial</i></a></li>
<li><a href="#5"><b class="cmd">::pt::pe</b> <b class="method">bottomup</b> <i class="arg">cmdprefix</i> <i class="arg">pe</i></a></li>
<li><a href="#6"><b class="cmd">cmdprefix</b> <i class="arg">pe</i> <i class="arg">op</i> <i class="arg">arguments</i></a></li>
<li><a href="#7"><b class="cmd">::pt::pe</b> <b class="method">topdown</b> <i class="arg">cmdprefix</i> <i class="arg">pe</i></a></li>
<li><a href="#8"><b class="cmd">::pt::pe</b> <b class="method">equal</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></li>
<li><a href="#9"><b class="cmd">::pt::pe</b> <b class="method">epsilon</b></a></li>
<li><a href="#10"><b class="cmd">::pt::pe</b> <b class="method">dot</b></a></li>
<li><a href="#11"><b class="cmd">::pt::pe</b> <b class="method">alnum</b></a></li>
<li><a href="#12"><b class="cmd">::pt::pe</b> <b class="method">alpha</b></a></li>
<li><a href="#13"><b class="cmd">::pt::pe</b> <b class="method">ascii</b></a></li>
<li><a href="#14"><b class="cmd">::pt::pe</b> <b class="method">control</b></a></li>
<li><a href="#15"><b class="cmd">::pt::pe</b> <b class="method">digit</b></a></li>
<li><a href="#16"><b class="cmd">::pt::pe</b> <b class="method">graph</b></a></li>
<li><a href="#17"><b class="cmd">::pt::pe</b> <b class="method">lower</b></a></li>
<li><a href="#18"><b class="cmd">::pt::pe</b> <b class="method">print</b></a></li>
<li><a href="#19"><b class="cmd">::pt::pe</b> <b class="method">punct</b></a></li>
<li><a href="#20"><b class="cmd">::pt::pe</b> <b class="method">space</b></a></li>
<li><a href="#21"><b class="cmd">::pt::pe</b> <b class="method">upper</b></a></li>
<li><a href="#22"><b class="cmd">::pt::pe</b> <b class="method">wordchar</b></a></li>
<li><a href="#23"><b class="cmd">::pt::pe</b> <b class="method">xdigit</b></a></li>
<li><a href="#24"><b class="cmd">::pt::pe</b> <b class="method">ddigit</b></a></li>
<li><a href="#25"><b class="cmd">::pt::pe</b> <b class="method">terminal</b> <i class="arg">t</i></a></li>
<li><a href="#26"><b class="cmd">::pt::pe</b> <b class="method">range</b> <i class="arg">ta</i> <i class="arg">tb</i></a></li>
<li><a href="#27"><b class="cmd">::pt::pe</b> <b class="method">nonterminal</b> <i class="arg">nt</i></a></li>
<li><a href="#28"><b class="cmd">::pt::pe</b> <b class="method">choice</b> <i class="arg">pe</i>...</a></li>
<li><a href="#29"><b class="cmd">::pt::pe</b> <b class="method">sequence</b> <i class="arg">pe</i>...</a></li>
<li><a href="#30"><b class="cmd">::pt::pe</b> <b class="method">repeat0</b> <i class="arg">pe</i></a></li>
<li><a href="#31"><b class="cmd">::pt::pe</b> <b class="method">repeat1</b> <i class="arg">pe</i></a></li>
<li><a href="#32"><b class="cmd">::pt::pe</b> <b class="method">optional</b> <i class="arg">pe</i></a></li>
<li><a href="#33"><b class="cmd">::pt::pe</b> <b class="method">ahead</b> <i class="arg">pe</i></a></li>
<li><a href="#34"><b class="cmd">::pt::pe</b> <b class="method">notahead</b> <i class="arg">pe</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides commands to work with the serializations of
parsing expressions as managed by the Parser Tools, and specified in
section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p>
<p>This is a supporting package in the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_support" src="../../../../image/arch_core_support.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::pe</b> <b class="method">verify</b> <i class="arg">serial</i> <span class="opt">?<i class="arg">canonvar</i>?</span></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
serialization of a parsing expression and will throw an error if that
is not the case. The result of the command is the empty string.</p>
<p>If the argument <i class="arg">canonvar</i> is specified it is interpreted as the
name of a variable in the calling context. This variable will be
written to if and only if <i class="arg">serial</i> is a valid regular
serialization. Its value will be a boolean, with <b class="const">True</b>
indicating that the serialization is not only valid, but also
<i class="term">canonical</i>. <b class="const">False</b> will be written for a valid, but
non-canonical serialization.</p>
<p>For the specification of serializations see the section
<span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><a name="2"><b class="cmd">::pt::pe</b> <b class="method">verify-as-canonical</b> <i class="arg">serial</i></a></dt>
<dd><p>This command verifies that the content of <i class="arg">serial</i> is a valid
<i class="term">canonical</i> serialization of a parsing expression and will throw
an error if that is not the case. The result of the command is the
empty string.</p>
<p>For the specification of canonical serializations see the section
<span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><a name="3"><b class="cmd">::pt::pe</b> <b class="method">canonicalize</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the content of <i class="arg">serial</i> is a valid
<i class="term">regular</i> serialization of a parsing expression and will throw an
error if that is not the case.</p>
<p>It will then convert the input into the <i class="term">canonical</i> serialization
of this parsing expression and return it as its result. If the input
is already canonical it will be returned unchanged.</p>
<p>For the specification of regular and canonical serializations see the
section <span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><a name="4"><b class="cmd">::pt::pe</b> <b class="method">print</b> <i class="arg">serial</i></a></dt>
<dd><p>This command assumes that the argument <i class="arg">serial</i> contains a valid
serialization of a parsing expression and returns a string containing
that PE in a human readable form.</p>
<p>The exact format of this form is not specified and cannot be relied on
for parsing or other machine-based activities.</p>
<p>For the specification of serializations see the section
<span class="sectref"><a href="#section3">PE serialization format</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::pt::pe</b> <b class="method">bottomup</b> <i class="arg">cmdprefix</i> <i class="arg">pe</i></a></dt>
<dd><p>This command walks the parsing expression <i class="arg">pe</i> from the bottom up
to the root, invoking the command prefix <i class="arg">cmdprefix</i> for each
partial expression. This implies that the children of a parsing
expression PE are handled before PE.</p>
<p>The command prefix has the signature</p>
<dl class="definitions">
<dt><a name="6"><b class="cmd">cmdprefix</b> <i class="arg">pe</i> <i class="arg">op</i> <i class="arg">arguments</i></a></dt>
<dd><p>I.e. it is invoked with the parsing expression <i class="arg">pe</i> the walk is
currently at, the <i class="arg">op</i>'erator in the <i class="arg">pe</i>, and the operator's
<i class="arg">arguments</i>.</p>
<p>The result returned by the command prefix replaces <i class="arg">pe</i> in the
parsing expression it was a child of, allowing transformations of the
expression tree.</p>
<p>This also means that for all inner parsing expressions the contents of
<i class="arg">arguments</i> are the results of the command prefix invoked for the
children of this inner parsing expression.</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::pt::pe</b> <b class="method">topdown</b> <i class="arg">cmdprefix</i> <i class="arg">pe</i></a></dt>
<dd><p>This command walks the parsing expression <i class="arg">pe</i> from the root down
to the leaves, invoking the command prefix <i class="arg">cmdprefix</i> for each
partial expression. This implies that the children of a parsing
expression PE are handled after PE.</p>
<p>The command prefix has the same signature as for <b class="method">bottomup</b>,
see above.</p>
<p>The result returned by the command prefix is <em>ignored</em>.</p></dd>
<dt><a name="8"><b class="cmd">::pt::pe</b> <b class="method">equal</b> <i class="arg">seriala</i> <i class="arg">serialb</i></a></dt>
<dd><p>This command tests the two parsing expressions <i class="arg">seriala</i> and
<i class="arg">serialb</i> for structural equality. The result of the command is a
boolean value. It will be set to <b class="const">true</b> if the expressions are
identical, and <b class="const">false</b> otherwise.</p>
<p>String equality is usable only if we can assume that the two parsing
expressions are pure Tcl lists.</p></dd>
<dt><a name="9"><b class="cmd">::pt::pe</b> <b class="method">epsilon</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for epsilon.</p></dd>
<dt><a name="10"><b class="cmd">::pt::pe</b> <b class="method">dot</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for dot.</p></dd>
<dt><a name="11"><b class="cmd">::pt::pe</b> <b class="method">alnum</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for alnum.</p></dd>
<dt><a name="12"><b class="cmd">::pt::pe</b> <b class="method">alpha</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for alpha.</p></dd>
<dt><a name="13"><b class="cmd">::pt::pe</b> <b class="method">ascii</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for ascii.</p></dd>
<dt><a name="14"><b class="cmd">::pt::pe</b> <b class="method">control</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for control.</p></dd>
<dt><a name="15"><b class="cmd">::pt::pe</b> <b class="method">digit</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for digit.</p></dd>
<dt><a name="16"><b class="cmd">::pt::pe</b> <b class="method">graph</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for graph.</p></dd>
<dt><a name="17"><b class="cmd">::pt::pe</b> <b class="method">lower</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for lower.</p></dd>
<dt><a name="18"><b class="cmd">::pt::pe</b> <b class="method">print</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for print.</p></dd>
<dt><a name="19"><b class="cmd">::pt::pe</b> <b class="method">punct</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for punct.</p></dd>
<dt><a name="20"><b class="cmd">::pt::pe</b> <b class="method">space</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for space.</p></dd>
<dt><a name="21"><b class="cmd">::pt::pe</b> <b class="method">upper</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for upper.</p></dd>
<dt><a name="22"><b class="cmd">::pt::pe</b> <b class="method">wordchar</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for wordchar.</p></dd>
<dt><a name="23"><b class="cmd">::pt::pe</b> <b class="method">xdigit</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for xdigit.</p></dd>
<dt><a name="24"><b class="cmd">::pt::pe</b> <b class="method">ddigit</b></a></dt>
<dd><p>This command constructs the atomic parsing expression for ddigit.</p></dd>
<dt><a name="25"><b class="cmd">::pt::pe</b> <b class="method">terminal</b> <i class="arg">t</i></a></dt>
<dd><p>This command constructs the atomic parsing expression for the terminal
symbol <i class="arg">t</i>.</p></dd>
<dt><a name="26"><b class="cmd">::pt::pe</b> <b class="method">range</b> <i class="arg">ta</i> <i class="arg">tb</i></a></dt>
<dd><p>This command constructs the atomic parsing expression for the range of
terminal symbols <i class="arg">ta</i> ... <i class="arg">tb</i>.</p></dd>
<dt><a name="27"><b class="cmd">::pt::pe</b> <b class="method">nonterminal</b> <i class="arg">nt</i></a></dt>
<dd><p>This command constructs the atomic parsing expression for the
nonterminal symbol <i class="arg">nt</i>.</p></dd>
<dt><a name="28"><b class="cmd">::pt::pe</b> <b class="method">choice</b> <i class="arg">pe</i>...</a></dt>
<dd><p>This command constructs the parsing expression representing the
ordered or prioritized choice between the argument parsing
expressions. The first argument has the highest priority.</p></dd>
<dt><a name="29"><b class="cmd">::pt::pe</b> <b class="method">sequence</b> <i class="arg">pe</i>...</a></dt>
<dd><p>This command constructs the parsing expression representing the
sequence of the argument parsing expression. The first argument is the
first element of the sequence.</p></dd>
<dt><a name="30"><b class="cmd">::pt::pe</b> <b class="method">repeat0</b> <i class="arg">pe</i></a></dt>
<dd><p>This command constructs the parsing expression representing the zero
or more repetition of the argument parsing expression <i class="arg">pe</i>, also
known as the kleene closure.</p></dd>
<dt><a name="31"><b class="cmd">::pt::pe</b> <b class="method">repeat1</b> <i class="arg">pe</i></a></dt>
<dd><p>This command constructs the parsing expression representing the one or
more repetition of the argument parsing expression <i class="arg">pe</i>, also
known as the positive kleene closure.</p></dd>
<dt><a name="32"><b class="cmd">::pt::pe</b> <b class="method">optional</b> <i class="arg">pe</i></a></dt>
<dd><p>This command constructs the parsing expression representing the
optionality of the argument parsing expression <i class="arg">pe</i>.</p></dd>
<dt><a name="33"><b class="cmd">::pt::pe</b> <b class="method">ahead</b> <i class="arg">pe</i></a></dt>
<dd><p>This command constructs the parsing expression representing the
positive lookahead of the argument parsing expression <i class="arg">pe</i>.</p></dd>
<dt><a name="34"><b class="cmd">::pt::pe</b> <b class="method">notahead</b> <i class="arg">pe</i></a></dt>
<dd><p>This command constructs the parsing expression representing the
negative lookahead of the argument parsing expression <i class="arg">pe</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_pgen.html.










































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::pgen - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_pgen.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::pgen.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::pgen(n) 1.0.1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::pgen - Parser Generator</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Example</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::pgen <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::pgen</b> <i class="arg">inputformat</i> <i class="arg">text</i> <i class="arg">resultformat</i> <span class="opt">?<i class="arg">options...</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides a command implementing a
<i class="term"><a href="../../../../index.html#key175">parser generator</a></i>
taking parsing expression grammars as input.</p>
<p>It is the implementation of method <b class="method">generate</b> of <b class="cmd"><a href="pt.html">pt</a></b>, the
<i class="term"><a href="pt.html">Parser Tools Application</a></i>.</p>
<p>As such the intended audience of this document are people wishing to
modify and/or extend this part of <b class="cmd"><a href="pt.html">pt</a></b>'s functionality. Users of
<b class="cmd"><a href="pt.html">pt</a></b> on the other hand are hereby refered to the applications'
manpage, i.e. <i class="term"><a href="pt.html">Parser Tools Application</a></i>.</p>
<p>It resides in the User Package Layer of Parser Tools.</p>
<p><img alt="arch_user_pkg" src="../../../../image/arch_user_pkg.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::pgen</b> <i class="arg">inputformat</i> <i class="arg">text</i> <i class="arg">resultformat</i> <span class="opt">?<i class="arg">options...</i>?</span></a></dt>
<dd><p>This command takes the parsing expression grammar in <i class="arg">text</i> (in
the format specified by <i class="arg">inputformat</i>), and returns the same
grammar in the format <i class="arg">resultformat</i> as the result of the command.</p>
<p>The two known input formats are <b class="const">peg</b> and <b class="const">json</b>.
Introductions to them, including their formal specifications, can be
found in the <i class="term"><a href="pt_peg_language.html">PEG Language Tutorial</a></i> and
<i class="term"><a href="pt_json_language.html">The JSON Grammar Exchange Format</a></i>. The packages used to
parse these formats are</p>
<dl class="definitions">
<dt><b class="const">peg</b></dt>
<dd><p><b class="package"><a href="pt_peg_from_peg.html">pt::peg::from::peg</a></b></p></dd>
<dt><b class="const">json</b></dt>
<dd><p><b class="package"><a href="pt_peg_from_json.html">pt::peg::from::json</a></b></p></dd>
</dl>
<p>On the output side the known formats, and the packages used to
generate them are</p>
<dl class="definitions">
<dt><b class="const">c</b></dt>
<dd><p><b class="package"><a href="pt_peg_to_cparam.html">pt::peg::to::cparam</a></b></p></dd>
<dt><b class="const">container</b></dt>
<dd><p><b class="package"><a href="pt_peg_to_container.html">pt::peg::to::container</a></b></p></dd>
<dt><b class="const">critcl</b></dt>
<dd><p><b class="package"><a href="pt_peg_to_cparam.html">pt::peg::to::cparam</a></b> +
                        <b class="package"><a href="pt_cparam_config_critcl.html">pt::cparam::configuration::critcl</a></b></p></dd>
<dt><b class="const">json</b></dt>
<dd><p><b class="package"><a href="pt_peg_to_json.html">pt::peg::to::json</a></b></p></dd>
<dt><b class="const">oo</b></dt>
<dd><p><b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b> +
                        <b class="package"><a href="pt_tclparam_config_tcloo.html">pt::tclparam::configuration::tcloo</a></b></p></dd>
<dt><b class="const">peg</b></dt>
<dd><p><b class="package"><a href="pt_peg_to_peg.html">pt::peg::to::peg</a></b></p></dd>
<dt><b class="const">snit</b></dt>
<dd><p><b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b> +
                        <b class="package"><a href="pt_tclparam_config_snit.html">pt::tclparam::configuration::snit</a></b></p></dd>
</dl>
<p>The options supported by each of these formats are documented
with their respective packages.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Example</a></h2>
<p>In this section we are working a complete example, starting with a PEG
grammar and ending with running the parser generated from it over some
input, following the outline shown in the figure below:</p>
<p><img alt="flow" src="../../../../image/flow.png"></p>
<p>Our grammar, assumed to the stored in the file &quot;<b class="file">calculator.peg</b>&quot;
is</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>From this we create a snit-based parser
using the script &quot;<b class="file">gen</b>&quot;</p>
<pre class="example">
package require Tcl 8.5
package require fileutil
package require pt::pgen
lassign $argv name
set grammar [fileutil::cat $name.peg]
set pclass  [pt::pgen peg $gr snit -class $name -file  $name.peg -name  $name]
fileutil::writeFile $name.tcl $pclass
exit 0
</pre>
<p>calling it like</p>
<pre class="example"> tclsh8.5 gen calculator </pre>
<p>which leaves us with the parser package and class written to the file
&quot;<b class="file">calculator.tcl</b>&quot;.
Assuming that this package is then properly installed in a place where
Tcl can find it we can now use this class via a script like</p>
<pre class="example">
    package require calculator
    lassign $argv input
    set channel [open $input r]
    set parser [calculator]
    set ast [$parser parse $channel]
    $parser destroy
    close $channel
    ... now process the returned abstract syntax tree ...
</pre>
<p>where the abstract syntax tree stored in the variable will look like</p>
<pre class="example">
set ast {Expression 0 4
    {Factor 0 4
        {Term 0 2
            {Number 0 2
                {Digit 0 0}
                {Digit 1 1}
                {Digit 2 2}
            }
        }
        {AddOp 3 3}
        {Term 4 4
            {Number 4 4
                {Digit 4 4}
            }
        }
    }
}
</pre>
<p>assuming that the input file and channel contained the text</p>
<pre class="example"> 120+5 </pre>
<p>A more graphical representation of the tree would be</p>
<p><img alt="expr_ast" src="../../../../image/expr_ast.png"></p>
<p>Regardless, at this point it is the user's responsibility to work with
the tree to reach whatever goal she desires. I.e. analyze it,
transform it, etc. The package <b class="package"><a href="pt_astree.html">pt::ast</a></b> should be of help
here, providing commands to walk such ASTs structures in various ways.</p>
<p>One important thing to note is that the parsers used here return a
data structure representing the structure of the input per the grammar
underlying the parser. There are <em>no</em> callbacks during the
parsing process, i.e. no <i class="term">parsing actions</i>, as most other
parsers will have.</p>
<p>Going back to the last snippet of code, the execution of the parser
for some input, note how the parser instance follows the specified
<i class="term"><a href="pt_parser_api.html">Parser API</a></i>.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_rdengine.html.































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::rde - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_rdengine.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::rde.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::rde(n) 1.0.2 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::rde - Parsing Runtime Support, PARAM based</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a>
<ul>
<li class="subsection"><a href="#subsection1">Class API</a></li>
<li class="subsection"><a href="#subsection2">Object API</a></li>
</ul>
</li>
<li class="section"><a href="#section2">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::rde <span class="opt">?1.0.2?</span></b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">struct::stack 1.4</b></li>
<li>package require <b class="pkgname">pt::ast 1.1</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::rde</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">reset</b> <i class="arg">chan</i></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">complete</b></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">chan</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">line</b></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">column</b></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">current</b></a></li>
<li><a href="#9"><i class="arg">objectName</i> <b class="method">location</b></a></li>
<li><a href="#10"><i class="arg">objectName</i> <b class="method">locations</b></a></li>
<li><a href="#11"><i class="arg">objectName</i> <b class="method">ok</b></a></li>
<li><a href="#12"><i class="arg">objectName</i> <b class="method">value</b></a></li>
<li><a href="#13"><i class="arg">objectName</i> <b class="method">error</b></a></li>
<li><a href="#14"><i class="arg">objectName</i> <b class="method">errors</b></a></li>
<li><a href="#15"><i class="arg">objectName</i> <b class="method">tokens</b> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#16"><i class="arg">objectName</i> <b class="method">symbols</b></a></li>
<li><a href="#17"><i class="arg">objectName</i> <b class="method">known</b></a></li>
<li><a href="#18"><i class="arg">objectName</i> <b class="method">reducible</b></a></li>
<li><a href="#19"><i class="arg">objectName</i> <b class="method">asts</b></a></li>
<li><a href="#20"><i class="arg">objectName</i> <b class="method">ast</b></a></li>
<li><a href="#21"><i class="arg">objectName</i> <b class="method">position</b> <i class="arg">loc</i></a></li>
<li><a href="#22"><i class="arg">objectName</i> <b class="method">i_input_next</b> <i class="arg">msg</i></a></li>
<li><a href="#23"><i class="arg">objectName</i> <b class="method">i_test_alnum</b></a></li>
<li><a href="#24"><i class="arg">objectName</i> <b class="method">i_test_alpha</b></a></li>
<li><a href="#25"><i class="arg">objectName</i> <b class="method">i_test_ascii</b></a></li>
<li><a href="#26"><i class="arg">objectName</i> <b class="method">i_test_char</b> <i class="arg">char</i></a></li>
<li><a href="#27"><i class="arg">objectName</i> <b class="method">i_test_ddigit</b></a></li>
<li><a href="#28"><i class="arg">objectName</i> <b class="method">i_test_digit</b></a></li>
<li><a href="#29"><i class="arg">objectName</i> <b class="method">i_test_graph</b></a></li>
<li><a href="#30"><i class="arg">objectName</i> <b class="method">i_test_lower</b></a></li>
<li><a href="#31"><i class="arg">objectName</i> <b class="method">i_test_print</b></a></li>
<li><a href="#32"><i class="arg">objectName</i> <b class="method">i_test_punct</b></a></li>
<li><a href="#33"><i class="arg">objectName</i> <b class="method">i_test_range</b> <i class="arg">chars</i> <i class="arg">chare</i></a></li>
<li><a href="#34"><i class="arg">objectName</i> <b class="method">i_test_space</b></a></li>
<li><a href="#35"><i class="arg">objectName</i> <b class="method">i_test_upper</b></a></li>
<li><a href="#36"><i class="arg">objectName</i> <b class="method">i_test_wordchar</b></a></li>
<li><a href="#37"><i class="arg">objectName</i> <b class="method">i_test_xdigit</b></a></li>
<li><a href="#38"><i class="arg">objectName</i> <b class="method">i_error_clear</b></a></li>
<li><a href="#39"><i class="arg">objectName</i> <b class="method">i_error_push</b></a></li>
<li><a href="#40"><i class="arg">objectName</i> <b class="method">i_error_pop_merge</b></a></li>
<li><a href="#41"><i class="arg">objectName</i> <b class="method">i_error_nonterminal</b> <i class="arg">symbol</i></a></li>
<li><a href="#42"><i class="arg">objectName</i> <b class="method">i_status_ok</b></a></li>
<li><a href="#43"><i class="arg">objectName</i> <b class="method">i_status_fail</b></a></li>
<li><a href="#44"><i class="arg">objectName</i> <b class="method">i_status_negate</b></a></li>
<li><a href="#45"><i class="arg">objectName</i> <b class="method">i_loc_push</b></a></li>
<li><a href="#46"><i class="arg">objectName</i> <b class="method">i_loc_pop_discard</b></a></li>
<li><a href="#47"><i class="arg">objectName</i> <b class="method">i_loc_pop_rewind</b></a></li>
<li><a href="#48"><i class="arg">objectName</i> <b class="method">i:ok_loc_pop_rewind</b></a></li>
<li><a href="#49"><i class="arg">objectName</i> <b class="method">i_loc_pop_rewind/discard</b></a></li>
<li><a href="#50"><i class="arg">objectName</i> <b class="method">i_symbol_restore</b> <i class="arg">symbol</i></a></li>
<li><a href="#51"><i class="arg">objectName</i> <b class="method">i_symbol_save</b> <i class="arg">symbol</i></a></li>
<li><a href="#52"><i class="arg">objectName</i> <b class="method">i_value_clear</b></a></li>
<li><a href="#53"><i class="arg">objectName</i> <b class="method">i_value_clear/leaf</b></a></li>
<li><a href="#54"><i class="arg">objectName</i> <b class="method">i_value_clear/reduce</b></a></li>
<li><a href="#55"><i class="arg">objectName</i> <b class="method">i:ok_ast_value_push</b></a></li>
<li><a href="#56"><i class="arg">objectName</i> <b class="method">i_ast_push</b></a></li>
<li><a href="#57"><i class="arg">objectName</i> <b class="method">i_ast_pop_rewind</b></a></li>
<li><a href="#58"><i class="arg">objectName</i> <b class="method">i:fail_ast_pop_rewind</b></a></li>
<li><a href="#59"><i class="arg">objectName</i> <b class="method">i_ast_pop_rewind/discard</b></a></li>
<li><a href="#60"><i class="arg">objectName</i> <b class="method">i_ast_pop_discard</b></a></li>
<li><a href="#61"><i class="arg">objectName</i> <b class="method">i_ast_pop_discard/rewind</b></a></li>
<li><a href="#62"><i class="arg">objectName</i> <b class="method">i:ok_continue</b></a></li>
<li><a href="#63"><i class="arg">objectName</i> <b class="method">i:fail_continue</b></a></li>
<li><a href="#64"><i class="arg">objectName</i> <b class="method">i:fail_return</b></a></li>
<li><a href="#65"><i class="arg">objectName</i> <b class="method">i:ok_return</b></a></li>
<li><a href="#66"><i class="arg">objectName</i> <b class="method">si:void_state_push</b></a></li>
<li><a href="#67"><i class="arg">objectName</i> <b class="method">si:void2_state_push</b></a></li>
<li><a href="#68"><i class="arg">objectName</i> <b class="method">si:value_state_push</b></a></li>
<li><a href="#69"><i class="arg">objectName</i> <b class="method">si:void_state_merge</b></a></li>
<li><a href="#70"><i class="arg">objectName</i> <b class="method">si:void_state_merge_ok</b></a></li>
<li><a href="#71"><i class="arg">objectName</i> <b class="method">si:value_state_merge</b></a></li>
<li><a href="#72"><i class="arg">objectName</i> <b class="method">si:value_notahead_start</b></a></li>
<li><a href="#73"><i class="arg">objectName</i> <b class="method">si:void_notahead_exit</b></a></li>
<li><a href="#74"><i class="arg">objectName</i> <b class="method">si:value_notahead_exit</b></a></li>
<li><a href="#75"><i class="arg">objectName</i> <b class="method">si:kleene_abort</b></a></li>
<li><a href="#76"><i class="arg">objectName</i> <b class="method">si:kleene_close</b></a></li>
<li><a href="#77"><i class="arg">objectName</i> <b class="method">si:voidvoid_branch</b></a></li>
<li><a href="#78"><i class="arg">objectName</i> <b class="method">si:voidvalue_branch</b></a></li>
<li><a href="#79"><i class="arg">objectName</i> <b class="method">si:valuevoid_branch</b></a></li>
<li><a href="#80"><i class="arg">objectName</i> <b class="method">si:valuevalue_branch</b></a></li>
<li><a href="#81"><i class="arg">objectName</i> <b class="method">si:voidvoid_part</b></a></li>
<li><a href="#82"><i class="arg">objectName</i> <b class="method">si:voidvalue_part</b></a></li>
<li><a href="#83"><i class="arg">objectName</i> <b class="method">si:valuevalue_part</b></a></li>
<li><a href="#84"><i class="arg">objectName</i> <b class="method">si:value_symbol_start</b> <i class="arg">symbol</i></a></li>
<li><a href="#85"><i class="arg">objectName</i> <b class="method">si:value_void_symbol_start</b> <i class="arg">symbol</i></a></li>
<li><a href="#86"><i class="arg">objectName</i> <b class="method">si:void_symbol_start</b> <i class="arg">symbol</i></a></li>
<li><a href="#87"><i class="arg">objectName</i> <b class="method">si:void_void_symbol_start</b> <i class="arg">symbol</i></a></li>
<li><a href="#88"><i class="arg">objectName</i> <b class="method">si:reduce_symbol_end</b> <i class="arg">symbol</i></a></li>
<li><a href="#89"><i class="arg">objectName</i> <b class="method">si:void_leaf_symbol_end</b> <i class="arg">symbol</i></a></li>
<li><a href="#90"><i class="arg">objectName</i> <b class="method">si:value_leaf_symbol_end</b> <i class="arg">symbol</i></a></li>
<li><a href="#91"><i class="arg">objectName</i> <b class="method">si:value_clear_symbol_end</b> <i class="arg">symbol</i></a></li>
<li><a href="#92"><i class="arg">objectName</i> <b class="method">si:void_clear_symbol_end</b> <i class="arg">symbol</i></a></li>
<li><a href="#93"><i class="arg">objectName</i> <b class="method">si:next_char</b> <i class="arg">tok</i></a></li>
<li><a href="#94"><i class="arg">objectName</i> <b class="method">si:next_range</b> <i class="arg">toks</i> <i class="arg">toke</i></a></li>
<li><a href="#95"><i class="arg">objectName</i> <b class="method">si:next_alnum</b></a></li>
<li><a href="#96"><i class="arg">objectName</i> <b class="method">si:next_alpha</b></a></li>
<li><a href="#97"><i class="arg">objectName</i> <b class="method">si:next_ascii</b></a></li>
<li><a href="#98"><i class="arg">objectName</i> <b class="method">si:next_ddigit</b></a></li>
<li><a href="#99"><i class="arg">objectName</i> <b class="method">si:next_digit</b></a></li>
<li><a href="#100"><i class="arg">objectName</i> <b class="method">si:next_graph</b></a></li>
<li><a href="#101"><i class="arg">objectName</i> <b class="method">si:next_lower</b></a></li>
<li><a href="#102"><i class="arg">objectName</i> <b class="method">si:next_print</b></a></li>
<li><a href="#103"><i class="arg">objectName</i> <b class="method">si:next_punct</b></a></li>
<li><a href="#104"><i class="arg">objectName</i> <b class="method">si:next_space</b></a></li>
<li><a href="#105"><i class="arg">objectName</i> <b class="method">si:next_upper</b></a></li>
<li><a href="#106"><i class="arg">objectName</i> <b class="method">si:next_wordchar</b></a></li>
<li><a href="#107"><i class="arg">objectName</i> <b class="method">si:next_xdigit</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package provides a class whose instances provide the runtime
support for recursive descent parsers with backtracking, as is needed
for the execution of, for example, parsing expression grammars. It
implements the <i class="term"><a href="pt_param.html">PackRat Machine Specification</a></i>, as such that
document is <em>required</em> reading to understand both this manpage,
and the package itself. The description below does make numerous
shorthand references to the PARAM's instructions and the various parts
of its architectural state.</p>
<p>The package resides in the Execution section of the Core Layer of
Parser Tools.</p>
<p><img alt="arch_core_transform" src="../../../../image/arch_core_transform.png"></p>
<p>Note: This package not only has the standard Tcl implementation, but
also an accelerator, i.e. a C implementation, based on Critcl.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Class API</a></h3>
<p>The package exports the API described here.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::rde</b> <i class="arg">objectName</i></a></dt>
<dd><p>The command creates a new runtime object for a recursive descent
parser with backtracking and returns the fully qualified name of the
object command as its result. The API of this object command is
described in the section <span class="sectref"><a href="#subsection2">Object API</a></span>. It may be used to
invoke various operations on the object.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object API</a></h3>
<p>All objects created by this package provide the following 63 methods
for the manipulation and querying of their state, which is, in essence
the architectural state of a PARAM.</p>
<p>First some general methods and the state accessors.</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object, releasing all claimed memory, and
deleting the associated object command.</p></dd>
<dt><a name="3"><i class="arg">objectName</i> <b class="method">reset</b> <i class="arg">chan</i></a></dt>
<dd><p>This method resets the state of the runtme to its defaults, preparing
it for the parsing of the character in the channel <i class="arg">chan</i>, which
becomes IN.</p>
<p>Note here that the Parser Tools are based on Tcl 8.5+. In other words,
the channel argument is not restricted to files, sockets, etc. We have
the full power of <i class="term">reflected channels</i> available.</p>
<p>It should also be noted that the parser pulls the characters from the
input stream as it needs them. If a parser created by this package has
to be operated in a push aka event-driven manner it will be necessary
to go to Tcl 8.6+ and use the <b class="package"><a href="../coroutine/coro_auto.html">coroutine::auto</a></b> to wrap it
into a coroutine where <b class="cmd"><a href="../../../../index.html#key362">read</a></b> is properly changed for
push-operation.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">complete</b></a></dt>
<dd><p>This method completes parsing, either returning the AST made from the
elements of ARS, or throwing an error containing the current ER.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">chan</b></a></dt>
<dd><p>This method returns the handle of the channel which is IN.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">line</b></a></dt>
<dd><p>This method returns the line number for the position IN is currently
at. Note that this may not match with the line number for CL, due to
backtracking.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">column</b></a></dt>
<dd><p>This method returns the column for the position IN is currently
at. Note that this may not match with the column for CL, due to
backtracking.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">current</b></a></dt>
<dd><p>This method returns CC.</p></dd>
<dt><a name="9"><i class="arg">objectName</i> <b class="method">location</b></a></dt>
<dd><p>This method returns CL.</p></dd>
<dt><a name="10"><i class="arg">objectName</i> <b class="method">locations</b></a></dt>
<dd><p>This method returns the LS. The topmost entry of the stack will be the
first element of the returned list.</p></dd>
<dt><a name="11"><i class="arg">objectName</i> <b class="method">ok</b></a></dt>
<dd><p>This method returns ST.</p></dd>
<dt><a name="12"><i class="arg">objectName</i> <b class="method">value</b></a></dt>
<dd><p>This method returns SV.</p></dd>
<dt><a name="13"><i class="arg">objectName</i> <b class="method">error</b></a></dt>
<dd><p>This method returns ER. This is either the empty string for an empty
ER, or a list of 2 elements, the location the error is for, and a set
of messages which specify which symbols were expected at the
location. The messages are encoded as one of the possible atomic
parsing expressions (special operators, terminal, range, and
nonterminal operator).</p></dd>
<dt><a name="14"><i class="arg">objectName</i> <b class="method">errors</b></a></dt>
<dd><p>This method returns ES. The topmost entry of the stack will be the
first element of the returned list. Each entry is encoded as described
for <b class="method">error</b>.</p></dd>
<dt><a name="15"><i class="arg">objectName</i> <b class="method">tokens</b> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>This method returns the part of TC for the range of locations of IN
starting at <i class="arg">from</i> and ending at <i class="arg">to</i>. If <i class="arg">to</i> is not
specified it is taken as identical to <i class="arg">from</i>. If neither argument
is specified the whole of TC is returned.</p>
<p>Each token in the returned list is a list of three elements itself,
containing the character at the location, and the associated line and
column numbers, in this order.</p></dd>
<dt><a name="16"><i class="arg">objectName</i> <b class="method">symbols</b></a></dt>
<dd><p>This method returns a dictionary containing NC. Keys are two-element
lists containing nonterminal symbol and location, in this order. The
values are 4-tuples containing CL, ST, ER, and SV, in this order. ER
is encoded as specified for the method <b class="method">error</b>.</p></dd>
<dt><a name="17"><i class="arg">objectName</i> <b class="method">known</b></a></dt>
<dd><p>This method returns a list containing the keys of SC. They are
encoded in the same manner as is done by method <b class="method">symbols</b>.</p></dd>
<dt><a name="18"><i class="arg">objectName</i> <b class="method">reducible</b></a></dt>
<dd><p>This method returns ARS. The topmost entry of the stack will be the
first element of the returned list</p></dd>
<dt><a name="19"><i class="arg">objectName</i> <b class="method">asts</b></a></dt>
<dd><p>This method returns AS. The topmost entry of the stack will be the
first element of the returned list</p></dd>
<dt><a name="20"><i class="arg">objectName</i> <b class="method">ast</b></a></dt>
<dd><p>This is a convenience method returning the topmost element of ARS.</p></dd>
<dt><a name="21"><i class="arg">objectName</i> <b class="method">position</b> <i class="arg">loc</i></a></dt>
<dd><p>This method returns the line and column numbers for the specified
location of IN, assuming that this location has already been reached
during the parsing process.</p></dd>
</dl>
<p>The following methods implement all PARAM instructions. They all have
the prefix &quot;i_&quot;.</p>
<p>The control flow is mainly provided by Tcl's builtin commands, like
<b class="cmd">if</b>, <b class="cmd">while</b>, etc., plus a few guarded variants of PARAM
instructions and Tcl commands.. That means that these instruction
variants will do nothing if their guard condition is not
fulfilled. They can be recognized by the prefix &quot;i:ok_&quot; and &quot;i:fail_&quot;,
which denote the value ST has to have for the instruction to execute.</p>
<p>The instructions are listed in the same order they occur in the
<i class="term"><a href="pt_param.html">PackRat Machine Specification</a></i>, with the guard variants
listed after their regular implementation, if any, or in their place.</p>
<dl class="definitions">
<dt><a name="22"><i class="arg">objectName</i> <b class="method">i_input_next</b> <i class="arg">msg</i></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">input_next</b>.</p></dd>
<dt><a name="23"><i class="arg">objectName</i> <b class="method">i_test_alnum</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_alnum</b>.</p></dd>
<dt><a name="24"><i class="arg">objectName</i> <b class="method">i_test_alpha</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_alpha</b>.</p></dd>
<dt><a name="25"><i class="arg">objectName</i> <b class="method">i_test_ascii</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_ascii</b>.</p></dd>
<dt><a name="26"><i class="arg">objectName</i> <b class="method">i_test_char</b> <i class="arg">char</i></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_char</b>.</p></dd>
<dt><a name="27"><i class="arg">objectName</i> <b class="method">i_test_ddigit</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_ddigit</b>.</p></dd>
<dt><a name="28"><i class="arg">objectName</i> <b class="method">i_test_digit</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_digit</b>.</p></dd>
<dt><a name="29"><i class="arg">objectName</i> <b class="method">i_test_graph</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_graph</b>.</p></dd>
<dt><a name="30"><i class="arg">objectName</i> <b class="method">i_test_lower</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_lower</b>.</p></dd>
<dt><a name="31"><i class="arg">objectName</i> <b class="method">i_test_print</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_print</b>.</p></dd>
<dt><a name="32"><i class="arg">objectName</i> <b class="method">i_test_punct</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_punct</b>.</p></dd>
<dt><a name="33"><i class="arg">objectName</i> <b class="method">i_test_range</b> <i class="arg">chars</i> <i class="arg">chare</i></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_range</b>.</p></dd>
<dt><a name="34"><i class="arg">objectName</i> <b class="method">i_test_space</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_space</b>.</p></dd>
<dt><a name="35"><i class="arg">objectName</i> <b class="method">i_test_upper</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_upper</b>.</p></dd>
<dt><a name="36"><i class="arg">objectName</i> <b class="method">i_test_wordchar</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_wordchar</b>.</p></dd>
<dt><a name="37"><i class="arg">objectName</i> <b class="method">i_test_xdigit</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">test_xdigit</b>.</p></dd>
<dt><a name="38"><i class="arg">objectName</i> <b class="method">i_error_clear</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">error_clear</b>.</p></dd>
<dt><a name="39"><i class="arg">objectName</i> <b class="method">i_error_push</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">error_push</b>.</p></dd>
<dt><a name="40"><i class="arg">objectName</i> <b class="method">i_error_pop_merge</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">error_pop_merge</b>.</p></dd>
<dt><a name="41"><i class="arg">objectName</i> <b class="method">i_error_nonterminal</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">error_nonterminal</b>.</p></dd>
<dt><a name="42"><i class="arg">objectName</i> <b class="method">i_status_ok</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">status_ok</b>.</p></dd>
<dt><a name="43"><i class="arg">objectName</i> <b class="method">i_status_fail</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">status_fail</b>.</p></dd>
<dt><a name="44"><i class="arg">objectName</i> <b class="method">i_status_negate</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">status_negate</b>.</p></dd>
<dt><a name="45"><i class="arg">objectName</i> <b class="method">i_loc_push</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">loc_push</b>.</p></dd>
<dt><a name="46"><i class="arg">objectName</i> <b class="method">i_loc_pop_discard</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">loc_pop_discard</b>.</p></dd>
<dt><a name="47"><i class="arg">objectName</i> <b class="method">i_loc_pop_rewind</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">loc_pop_rewind</b>.</p></dd>
<dt><a name="48"><i class="arg">objectName</i> <b class="method">i:ok_loc_pop_rewind</b></a></dt>
<dd><p>This guarded method, a variant of <b class="method">i_loc_pop_rewind</b>, executes only
for &quot;ST == ok&quot;.</p></dd>
<dt><a name="49"><i class="arg">objectName</i> <b class="method">i_loc_pop_rewind/discard</b></a></dt>
<dd><p>This method is a convenient combination of control flow and the two
PARAM instructions <b class="cmd">loc_pop_rewind</b> and <b class="cmd">loc_pop_discard</b>. The former
is executed for &quot;ST == fail&quot;, the latter for &quot;ST == ok&quot;.</p></dd>
<dt><a name="50"><i class="arg">objectName</i> <b class="method">i_symbol_restore</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">symbol_restore</b>.</p>
<p>The boolean result of the check is returned as the result of
the method and can be used with standard Tcl control flow commands.</p></dd>
<dt><a name="51"><i class="arg">objectName</i> <b class="method">i_symbol_save</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">symbol_save</b>.</p></dd>
<dt><a name="52"><i class="arg">objectName</i> <b class="method">i_value_clear</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">value_clear</b>.</p></dd>
<dt><a name="53"><i class="arg">objectName</i> <b class="method">i_value_clear/leaf</b></a></dt>
<dd><p>This method is a convenient combination of control flow and the two
PARAM instructions <b class="cmd">value_clear</b> and <b class="cmd">value_leaf</b>. The former
is executed for &quot;ST == fail&quot;, the latter for &quot;ST == ok&quot;.</p></dd>
<dt><a name="54"><i class="arg">objectName</i> <b class="method">i_value_clear/reduce</b></a></dt>
<dd><p>This method is a convenient combination of control flow and the two
PARAM instructions <b class="cmd">value_clear</b> and <b class="cmd">value_reduce</b>. The former
is executed for &quot;ST == fail&quot;, the latter for &quot;ST == ok&quot;.</p></dd>
<dt><a name="55"><i class="arg">objectName</i> <b class="method">i:ok_ast_value_push</b></a></dt>
<dd><p>This method implements a guarded variant of the the PARAM instruction
<b class="cmd">ast_value_push</b>, which executes only for &quot;ST == ok&quot;.</p></dd>
<dt><a name="56"><i class="arg">objectName</i> <b class="method">i_ast_push</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">ast_push</b>.</p></dd>
<dt><a name="57"><i class="arg">objectName</i> <b class="method">i_ast_pop_rewind</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">ast_pop_rewind</b>.</p></dd>
<dt><a name="58"><i class="arg">objectName</i> <b class="method">i:fail_ast_pop_rewind</b></a></dt>
<dd><p>This guarded method, a variant of <b class="method">i_ast_pop_rewind</b>, executes only
for &quot;ST == fail&quot;.</p></dd>
<dt><a name="59"><i class="arg">objectName</i> <b class="method">i_ast_pop_rewind/discard</b></a></dt>
<dd><p>This method is a convenient combination of control flow and the two
PARAM instructions <b class="cmd">ast_pop_rewind</b> and <b class="cmd">ast_pop_discard</b>. The former
is executed for &quot;ST == fail&quot;, the latter for &quot;ST == ok&quot;.</p></dd>
<dt><a name="60"><i class="arg">objectName</i> <b class="method">i_ast_pop_discard</b></a></dt>
<dd><p>This method implements the PARAM instruction <b class="cmd">ast_pop_discard</b>.</p></dd>
<dt><a name="61"><i class="arg">objectName</i> <b class="method">i_ast_pop_discard/rewind</b></a></dt>
<dd><p>This method is a convenient combination of control flow and the two
PARAM instructions <b class="cmd">ast_pop_discard</b> and <b class="cmd">ast_pop_rewind</b>. The former
is executed for &quot;ST == fail&quot;, the latter for &quot;ST == ok&quot;.</p></dd>
<dt><a name="62"><i class="arg">objectName</i> <b class="method">i:ok_continue</b></a></dt>
<dd><p>This guarded method executes only for &quot;ST == ok&quot;. Then it aborts the
current iteration of the innermost loop in the calling Tcl procedure.</p></dd>
<dt><a name="63"><i class="arg">objectName</i> <b class="method">i:fail_continue</b></a></dt>
<dd><p>This guarded method executes only for &quot;ST == fail&quot;. Then it aborts the
current iteration of the innermost loop in the calling Tcl procedure.</p></dd>
<dt><a name="64"><i class="arg">objectName</i> <b class="method">i:fail_return</b></a></dt>
<dd><p>This guarded method executes only for &quot;ST == fail&quot;. Then it aborts the
calling Tcl procedure.</p></dd>
<dt><a name="65"><i class="arg">objectName</i> <b class="method">i:ok_return</b></a></dt>
<dd><p>This guarded method executes only for &quot;ST == ok&quot;. Then it aborts the
calling Tcl procedure.</p></dd>
</dl>
<p>The next set of methods are <i class="term">super instructions</i>, meaning that
each implements a longer sequence of instructions commonly used in
parsers. The combinated instructions of the previous set, i.e. those
with names matching the pattern &quot;i_*/*&quot;, are actually super
instructions as well, albeit with limited scope, handling 2
instructions with their control flow. The upcoming set is much broader
in scope, folding as much as six or more PARAM instructions into a
single method call.</p>
<p>In this we can see the reasoning behind their use well:</p>
<ol class="enumerated">
<li><p>By using less instructions the generated parsers become smaller, as
the common parts are now truly part of the common runtime, and not
explicitly written in the parser's code over and over again.</p></li>
<li><p>Using less instructions additionally reduces the overhead associated
with calls into the runtime, i.e. the cost of method dispatch and of
setting up the variable context.</p></li>
<li><p>Another effect of the super instructions is that their internals can
be optimized as well, especially regarding control flow, and stack
use, as the runtime internals are accessible to all instructions
folded into the sequence.</p></li>
</ol>
<dl class="definitions">
<dt><a name="66"><i class="arg">objectName</i> <b class="method">si:void_state_push</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_loc_push
i_error_clear
i_error_push
</pre>
<p>Parsers use it at the beginning of <i class="term">void</i> sequences and choices
with a <i class="term">void</i> initial branch.</p></dd>
<dt><a name="67"><i class="arg">objectName</i> <b class="method">si:void2_state_push</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_loc_push
i_error_clear
i_error_push
</pre>
<p>Parsers use it at the beginning of optional and repeated expressions.</p></dd>
<dt><a name="68"><i class="arg">objectName</i> <b class="method">si:value_state_push</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_ast_push
i_loc_push
i_error_clear
i_error_push
</pre>
<p>Parsers use it at the beginning of sequences generating an AST and
choices with an initial branch generating an AST.</p></dd>
<dt><a name="69"><i class="arg">objectName</i> <b class="method">si:void_state_merge</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i_loc_pop_rewind/discard
</pre>
<p>Parsers use it at the end of void sequences and choices whose last
branch is void.</p></dd>
<dt><a name="70"><i class="arg">objectName</i> <b class="method">si:void_state_merge_ok</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i_loc_pop_rewind/discard
i_status_ok
</pre>
<p>Parsers use it at the end of optional expressions</p></dd>
<dt><a name="71"><i class="arg">objectName</i> <b class="method">si:value_state_merge</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i_ast_pop_rewind/discard
i_loc_pop_rewind/discard
</pre>
<p>Parsers use it at the end of sequences generating ASTs and choices
whose last branch generates an AST</p></dd>
<dt><a name="72"><i class="arg">objectName</i> <b class="method">si:value_notahead_start</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_loc_push
i_ast_push
</pre>
<p>Parsers use it at the beginning of negative lookahead predicates which
generate ASTs.</p></dd>
<dt><a name="73"><i class="arg">objectName</i> <b class="method">si:void_notahead_exit</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_loc_pop_rewind
i_status_negate
</pre>
<p>Parsers use it at the end of void negative lookahead predicates.</p></dd>
<dt><a name="74"><i class="arg">objectName</i> <b class="method">si:value_notahead_exit</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_ast_pop_discard/rewind
i_loc_pop_rewind
i_status_negate
</pre>
<p>Parsers use it at the end of negative lookahead predicates which
generate ASTs.</p></dd>
<dt><a name="75"><i class="arg">objectName</i> <b class="method">si:kleene_abort</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_loc_pop_rewind/discard
i:fail_return
</pre>
<p>Parsers use it to stop a positive repetition when its first, required, expression fails.</p></dd>
<dt><a name="76"><i class="arg">objectName</i> <b class="method">si:kleene_close</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i_loc_pop_rewind/discard
i:fail_status_ok
i:fail_return
</pre>
<p>Parsers use it at the end of repetitions.</p></dd>
<dt><a name="77"><i class="arg">objectName</i> <b class="method">si:voidvoid_branch</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i:ok_loc_pop_discard
i:ok_return
i_loc_rewind
i_error_push
</pre>
<p>Parsers use it when transiting between branches of a choice when both are void.</p></dd>
<dt><a name="78"><i class="arg">objectName</i> <b class="method">si:voidvalue_branch</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i:ok_loc_pop_discard
i:ok_return
i_ast_push
i_loc_rewind
i_error_push
</pre>
<p>Parsers use it when transiting between branches of a choice when the
failing branch is void, and the next to test generates an AST.</p></dd>
<dt><a name="79"><i class="arg">objectName</i> <b class="method">si:valuevoid_branch</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i_ast_pop_rewind/discard
i:ok_loc_pop_discard
i:ok_return
i_loc_rewind
i_error_push
</pre>
<p>Parsers use it when transiting between branches of a choice when the
failing branch generates an AST, and the next to test is void.</p></dd>
<dt><a name="80"><i class="arg">objectName</i> <b class="method">si:valuevalue_branch</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i_ast_pop_discard
i:ok_loc_pop_discard
i:ok_return
i_ast_rewind
i_loc_rewind
i_error_push
</pre>
<p>Parsers use it when transiting between branches of a choice when both
generate ASTs.</p></dd>
<dt><a name="81"><i class="arg">objectName</i> <b class="method">si:voidvoid_part</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i:fail_loc_pop_rewind
i:fail_return
i_error_push
</pre>
<p>Parsers use it when transiting between parts of a sequence and both
are void.</p></dd>
<dt><a name="82"><i class="arg">objectName</i> <b class="method">si:voidvalue_part</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i:fail_loc_pop_rewind
i:fail_return
i_ast_push
i_error_push
</pre>
<p>Parsers use it when transiting between parts of a sequence and the
sucessfully matched part is void, and after it an AST is generated.</p></dd>
<dt><a name="83"><i class="arg">objectName</i> <b class="method">si:valuevalue_part</b></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_error_pop_merge
i:fail_ast_pop_rewind
i:fail_loc_pop_rewind
i:fail_return
i_error_push
</pre>
<p>Parsers use it when transiting between parts of a sequence and both
parts generate ASTs.</p></dd>
<dt><a name="84"><i class="arg">objectName</i> <b class="method">si:value_symbol_start</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
if/found? i_symbol_restore $symbol
i:found:ok_ast_value_push
i:found_return
i_loc_push
i_ast_push
</pre>
<p>Parsers use it at the beginning of a nonterminal symbol generating an
AST, whose right-hand side may have generated an AST as well.</p></dd>
<dt><a name="85"><i class="arg">objectName</i> <b class="method">si:value_void_symbol_start</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
if/found? i_symbol_restore $symbol
i:found:ok_ast_value_push
i:found_return
i_loc_push
i_ast_push
</pre>
<p>Parsers use it at the beginning of a void nonterminal symbol whose
right-hand side may generate an AST.</p></dd>
<dt><a name="86"><i class="arg">objectName</i> <b class="method">si:void_symbol_start</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
if/found? i_symbol_restore $symbol
i:found_return
i_loc_push
i_ast_push
</pre>
<p>Parsers use it at the beginning of a nonterminal symbol generating an
AST whose right-hand side is void.</p></dd>
<dt><a name="87"><i class="arg">objectName</i> <b class="method">si:void_void_symbol_start</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
if/found? i_symbol_restore $symbol
i:found_return
i_loc_push
</pre>
<p>Parsers use it at  the beginning of a void nonterminal symbol whose
right-hand side is void as well.</p></dd>
<dt><a name="88"><i class="arg">objectName</i> <b class="method">si:reduce_symbol_end</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_value_clear/reduce $symbol
i_symbol_save        $symbol
i_error_nonterminal  $symbol
i_ast_pop_rewind
i_loc_pop_discard
i:ok_ast_value_push
</pre>
<p>Parsers use it at the end of a non-terminal symbol generating an AST
using the AST generated by the right-hand side as child.</p></dd>
<dt><a name="89"><i class="arg">objectName</i> <b class="method">si:void_leaf_symbol_end</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_value_clear/leaf  $symbol
i_symbol_save       $symbol
i_error_nonterminal $symbol
i_loc_pop_discard
i:ok_ast_value_push
</pre>
<p>Parsers use it at the end of a non-terminal symbol generating an AST
whose right-hand side is void.</p></dd>
<dt><a name="90"><i class="arg">objectName</i> <b class="method">si:value_leaf_symbol_end</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_value_clear/leaf  $symbol
i_symbol_save       $symbol
i_error_nonterminal $symbol
i_loc_pop_discard
i_ast_pop_rewind
i:ok_ast_value_push
</pre>
<p>Parsers use it at the end of a non-terminal symbol generating an AST
discarding the AST generated by the right-hand side.</p></dd>
<dt><a name="91"><i class="arg">objectName</i> <b class="method">si:value_clear_symbol_end</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_value_clear
i_symbol_save       $symbol
i_error_nonterminal $symbol
i_loc_pop_discard
i_ast_pop_rewind
</pre>
<p>Parsers use it at the end of a void non-terminal symbol, discarding
the AST generated by the right-hand side.</p></dd>
<dt><a name="92"><i class="arg">objectName</i> <b class="method">si:void_clear_symbol_end</b> <i class="arg">symbol</i></a></dt>
<dd><p>This method combines</p>
<pre class="example">
i_value_clear
i_symbol_save       $symbol
i_error_nonterminal $symbol
i_loc_pop_discard
</pre>
<p>Parsers use it at the end of a void non-terminal symbol with a void
right-hand side.</p></dd>
<dt><a name="93"><i class="arg">objectName</i> <b class="method">si:next_char</b> <i class="arg">tok</i></a></dt>
<dd></dd>
<dt><a name="94"><i class="arg">objectName</i> <b class="method">si:next_range</b> <i class="arg">toks</i> <i class="arg">toke</i></a></dt>
<dd></dd>
<dt><a name="95"><i class="arg">objectName</i> <b class="method">si:next_alnum</b></a></dt>
<dd></dd>
<dt><a name="96"><i class="arg">objectName</i> <b class="method">si:next_alpha</b></a></dt>
<dd></dd>
<dt><a name="97"><i class="arg">objectName</i> <b class="method">si:next_ascii</b></a></dt>
<dd></dd>
<dt><a name="98"><i class="arg">objectName</i> <b class="method">si:next_ddigit</b></a></dt>
<dd></dd>
<dt><a name="99"><i class="arg">objectName</i> <b class="method">si:next_digit</b></a></dt>
<dd></dd>
<dt><a name="100"><i class="arg">objectName</i> <b class="method">si:next_graph</b></a></dt>
<dd></dd>
<dt><a name="101"><i class="arg">objectName</i> <b class="method">si:next_lower</b></a></dt>
<dd></dd>
<dt><a name="102"><i class="arg">objectName</i> <b class="method">si:next_print</b></a></dt>
<dd></dd>
<dt><a name="103"><i class="arg">objectName</i> <b class="method">si:next_punct</b></a></dt>
<dd></dd>
<dt><a name="104"><i class="arg">objectName</i> <b class="method">si:next_space</b></a></dt>
<dd></dd>
<dt><a name="105"><i class="arg">objectName</i> <b class="method">si:next_upper</b></a></dt>
<dd></dd>
<dt><a name="106"><i class="arg">objectName</i> <b class="method">si:next_wordchar</b></a></dt>
<dd></dd>
<dt><a name="107"><i class="arg">objectName</i> <b class="method">si:next_xdigit</b></a></dt>
<dd><p>These methods all combine</p>
<pre class="example">
i_input_next $msg
i:fail_return
</pre>
<p>with the appropriate <b class="cmd">i_test_xxx</b> instruction. Parsers use them for
handling atomic expressions.</p></dd>
</dl>
</div>
</div>
<div id="section2" class="section"><h2><a name="section2">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_tclparam_config_snit.html.






















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::tclparam::configuration::snit - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_tclparam_config_snit.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::tclparam::configuration::snit.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::tclparam::configuration::snit(n) 1.0.1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::tclparam::configuration::snit - Tcl/PARAM, Canned configuration, Snit</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::tclparam::configuration::snit <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::tclparam::configuration::snit</b> <b class="method">def</b> <i class="arg">name</i> <i class="arg">cmdprefix</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package is an adjunct to <b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b>, to make
the use of this highly configurable package easier by providing a
canned configuration. When applied this configuration causes the
package <b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b> to generate
<b class="package"><a href="../snit/snit.html">snit</a></b>-based parser packages.</p>
<p>It is a supporting package in the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_support" src="../../../../image/arch_core_support.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::tclparam::configuration::snit</b> <b class="method">def</b> <i class="arg">name</i> <i class="arg">cmdprefix</i></a></dt>
<dd><p>The command applies the configuration provided by this package to the
<i class="arg">cmdprefix</i>, causing the creation of <b class="package"><a href="../snit/snit.html">snit</a></b>-based parsers
whose class is <i class="arg">name</i>.</p>
<p>The use of a command prefix as API allows application of the
configuration to not only <b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b>
(<b class="cmd">pt::peg::to::tclparam configure</b>), but also export manager
instances and PEG containers (<b class="cmd">$export configuration set</b> and
<b class="cmd">[$container exporter] configuration set</b> respectively).</p>
<p>Or anything other command prefix accepting two arguments, option and
value.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_tclparam_config_tcloo.html.






















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt::tclparam::configuration::tcloo - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_tclparam_config_tcloo.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt::tclparam::configuration::tcloo.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt::tclparam::configuration::tcloo(n) 1.0.1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt::tclparam::configuration::tcloo - Tcl/PARAM, Canned configuration, Tcloo</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">pt::tclparam::configuration::tcloo <span class="opt">?1.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::pt::tclparam::configuration::tcloo</b> <b class="method">def</b> <i class="arg">name</i> <i class="arg">cmdprefix</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This package is an adjunct to <b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b>, to make
the use of this highly configurable package easier by providing a
canned configuration. When applied this configuration causes the
package <b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b> to generate
<b class="package">OO</b>-based parser packages.</p>
<p>It is a supporting package in the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_support" src="../../../../image/arch_core_support.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::pt::tclparam::configuration::tcloo</b> <b class="method">def</b> <i class="arg">name</i> <i class="arg">cmdprefix</i></a></dt>
<dd><p>The command applies the configuration provided by this package to the
<i class="arg">cmdprefix</i>, causing the creation of <b class="package">OO</b>-based parsers
whose class is <i class="arg">name</i>.</p>
<p>The use of a command prefix as API allows application of the
configuration to not only <b class="package"><a href="pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></b>
(<b class="cmd">pt::peg::to::tclparam configure</b>), but also export manager
instances and PEG containers (<b class="cmd">$export configuration set</b> and
<b class="cmd">[$container exporter] configuration set</b> respectively).</p>
<p>Or anything other command prefix accepting two arguments, option and
value.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/pt/pt_to_api.html.










































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>pt_export_api - Parser Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/pt/pt_to_api.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ pt_export_api.i
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">pt_export_api(i) 1 tcllib &quot;Parser Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>pt_export_api - Parser Tools Export API</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Converter API</a></li>
<li class="section"><a href="#section3">Plugin API</a></li>
<li class="section"><a href="#section4">Options</a></li>
<li class="section"><a href="#section5">Usage</a></li>
<li class="section"><a href="#section6">PEG serialization format</a>
<ul>
<li class="subsection"><a href="#subsection1">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section7">PE serialization format</a>
<ul>
<li class="subsection"><a href="#subsection2">Example</a></li>
</ul>
</li>
<li class="section"><a href="#section8">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">CONVERTER</b> <b class="method">reset</b></a></li>
<li><a href="#2"><b class="cmd">CONVERTER</b> <b class="method">configure</b></a></li>
<li><a href="#3"><b class="cmd">CONVERTER</b> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#4"><b class="cmd">CONVERTER</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#5"><b class="cmd">CONVERTER</b> <b class="method">convert</b> <i class="arg">serial</i></a></li>
<li><a href="#6"><b class="cmd">::export</b> <i class="arg">serial</i> <i class="arg">configuration</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Are you lost ?
Do you have trouble understanding this document ?
In that case please read the overview provided by the
<i class="term"><a href="pt_introduction.html">Introduction to Parser Tools</a></i>. This document is the
entrypoint to the whole system the current package is a part of.</p>
<p>This document describes two APIs. First the API shared by all packages
for the conversion of Parsing Expression Grammars into some other
format, and then the API shared by the packages which implement the
export plugins sitting on top of the conversion packages.</p>
<p>Its intended audience are people who wish to create their own
converter for some type of output, and/or an export plugin for
their or some other converter.</p>
<p>It resides in the Export section of the Core Layer of Parser Tools.</p>
<p><img alt="arch_core_export" src="../../../../image/arch_core_export.png"></p>
</div>
<div id="section2" class="section"><h2><a name="section2">Converter API</a></h2>
<p>Any (grammar) export converter has to follow the rules set out below:</p>
<ol class="enumerated">
<li><p>A converter is a package. Its name is arbitrary, however it is
	recommended to put it under the <b class="namespace">::pt::peg::to</b>
	namespace.</p></li>
<li><p>The package provides either a single Tcl command following the
	API outlined below, or a class command whose instances follow
	the same API. The commands which follow the API are called
	<i class="term">converter commands</i>.</p></li>
<li><p>A converter command has to provide the following three methods
	with the given signatures and semantics. Converter commands
	are allowed to provide more methods of their own, but not
	less, and they may not provide different semantics for the
	standardized methods.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">CONVERTER</b> <b class="method">reset</b></a></dt>
<dd><p>This method has to reset the configuration of the converter to its
default settings. The result of the method has to be the empty
string.</p></dd>
<dt><a name="2"><b class="cmd">CONVERTER</b> <b class="method">configure</b></a></dt>
<dd><p>This method, in this form, has to return a dictionary containing the
current configuration of the converter.</p></dd>
<dt><a name="3"><b class="cmd">CONVERTER</b> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd><p>This method, in this form, has to return the current value of the
specified configuration <i class="arg">option</i> of the converter.</p>
<p>Please read the section <span class="sectref"><a href="#section4">Options</a></span> for the set of standard
options any converter has to accept.
Any other options accepted by a specific converter will be described
in its manpage.</p></dd>
<dt><a name="4"><b class="cmd">CONVERTER</b> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd><p>This command, in this form, sets the specified <i class="arg">option</i>s of the
converter to the given <i class="arg">value</i>s.</p>
<p>Please read the section <span class="sectref"><a href="#section4">Options</a></span> for the set of standard
options a converter has to accept.
Any other options accepted by a specific converter will be described
in its manpage.</p></dd>
<dt><a name="5"><b class="cmd">CONVERTER</b> <b class="method">convert</b> <i class="arg">serial</i></a></dt>
<dd><p>This method has to accept the canonical serialization of a parsing
expression grammar, as specified in section
<span class="sectref"><a href="#section6">PEG serialization format</a></span>, and contained in <i class="arg">serial</i>.
The result of the method has to be the result of converting the input
grammar into whatever the converter is for, per its configuration.</p></dd>
</dl>
</li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">Plugin API</a></h2>
<p>Any (grammar) export plugin has to follow the rules set out below:</p>
<ol class="enumerated">
<li><p>A plugin is a package.</p></li>
<li><p>The name of a plugin package has the form
		pt::peg::export::<b class="variable">FOO</b>,
	where <b class="variable">FOO</b> is the name of the format the plugin will
	generate output for.</p></li>
<li><p>The plugin can expect that the package
	<b class="package">pt::peg::export::plugin</b> is present, as
	indicator that it was invoked from a genuine plugin manager.</p>
<p>It is recommended that a plugin does check for the presence of
	this package.</p></li>
<li><p>A plugin has to provide a single command, in the global
	namespace, with the signature shown below. Plugins are allowed
	to provide more command of their own, but not less, and they
	may not provide different semantics for the standardized
	command.</p>
<dl class="definitions">
<dt><a name="6"><b class="cmd">::export</b> <i class="arg">serial</i> <i class="arg">configuration</i></a></dt>
<dd><p>This command has to accept the canonical serialization of a parsing
expression grammar and the configuration for the converter invoked by
the plugin. The result of the command has to be the result of the
converter invoked by the plugin for th input grammar and
configuration.</p>
<dl class="arguments">
<dt>string <i class="arg">serial</i></dt>
<dd><p>This argument will contain the <i class="term">canonical</i> serialization of the
parsing expression grammar for which to generate the output.
The specification of what a <i class="term">canonical</i> serialization is can be
found in the section <span class="sectref"><a href="#section6">PEG serialization format</a></span>.</p></dd>
<dt>dictionary <i class="arg">configuration</i></dt>
<dd><p>This argument will contain the configuration to configure the
converter with before invoking it, as a dictionary mapping from
options to values.</p>
<p>Please read the section <span class="sectref"><a href="#section4">Options</a></span> for the set of standard
options any converter has to accept, and thus any plugin as well.
Any other options accepted by a specific plugin will be described in
its manpage.</p></dd>
</dl></dd>
</dl>
</li>
<li><p>A single usage cycle of a plugin consists of an invokation of
	the command <b class="cmd"><a href="../../../../index.html#key148">export</a></b>. This call has to leave the plugin in
	a state where another usage cycle can be run without problems.</p></li>
</ol>
</div>
<div id="section4" class="section"><h2><a name="section4">Options</a></h2>
<p>Each export converter and plugin for an export converter has to accept
the options below in their <b class="method">configure</b> method. Converters are
allowed to ignore the contents of these options when performing a
conversion, but they must not reject them. Plugins are expected to
pass the options given to them to the converter they are invoking.</p>
<dl class="options">
<dt><b class="option">-file</b> string</dt>
<dd><p>The value of this option is the name of the file or other entity from
which the grammar came, for which the command is run. The default
value is <b class="const">unknown</b>.</p></dd>
<dt><b class="option">-name</b> string</dt>
<dd><p>The value of this option is the name of the grammar we are processing.
The default value is <b class="const">a_pe_grammar</b>.</p></dd>
<dt><b class="option">-user</b> string</dt>
<dd><p>The value of this option is the name of the user for which the command
is run. The default value is <b class="const">unknown</b>.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Usage</a></h2>
<p>To use a converter do</p>
<pre class="example">
    # Get the converter (single command here, not class)
    package require the-converter-package
    # Provide a configuration
    theconverter configure ...
    # Perform the conversion
    set result [theconverter convert $thegrammarserial]
    ... process the result ...
</pre>
<p>To use a plugin <b class="variable">FOO</b> do</p>
<pre class="example">
    # Get an export plugin manager
    package require pt::peg::export
    pt::peg::export E
    # Provide a configuration
    E configuration set ...
    # Run the plugin, and the converter inside.
    set result [E export serial $grammarserial FOO]
    ... process the result ...
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">PEG serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expression Grammars as immutable values for transport,
comparison, etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a PEG may have more than one regular serialization only exactly
one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>regular serialization</dt>
<dd><ol class="enumerated">
<li><p>The serialization of any PEG is a nested Tcl dictionary.</p></li>
<li><p>This dictionary holds a single key, <b class="const">pt::grammar::peg</b>, and its
value. This value holds the contents of the grammar.</p></li>
<li><p>The contents of the grammar are a Tcl dictionary holding the set of
nonterminal symbols and the starting expression. The relevant keys and
their values are</p>
<dl class="definitions">
<dt><b class="const">rules</b></dt>
<dd><p>The value is a Tcl dictionary whose keys are the names of the
nonterminal symbols known to the grammar.</p>
<ol class="enumerated">
<li><p>Each nonterminal symbol may occur only once.</p></li>
<li><p>The empty string is not a legal nonterminal symbol.</p></li>
<li><p>The value for each symbol is a Tcl dictionary itself. The relevant
keys and their values in this dictionary are</p>
<dl class="definitions">
<dt><b class="const">is</b></dt>
<dd><p>The value is the serialization of the parsing expression describing
the symbols sentennial structure, as specified in the section
<span class="sectref"><a href="#section7">PE serialization format</a></span>.</p></dd>
<dt><b class="const">mode</b></dt>
<dd><p>The value can be one of three values specifying how a parser should
handle the semantic value produced by the symbol.</p>
<dl class="definitions">
<dt><b class="const">value</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal itself,
which has the ASTs of the symbol's right hand side as its children.</p></dd>
<dt><b class="const">leaf</b></dt>
<dd><p>The semantic value of the nonterminal symbol is an abstract syntax
tree consisting of a single node node for the nonterminal, without any
children. Any ASTs generated by the symbol's right hand side are
discarded.</p></dd>
<dt><b class="const">void</b></dt>
<dd><p>The nonterminal has no semantic value. Any ASTs generated by the
symbol's right hand side are discarded (as well).</p></dd>
</dl></dd>
</dl>
</li>
</ol></dd>
<dt><b class="const">start</b></dt>
<dd><p>The value is the serialization of the start parsing expression of the
grammar, as specified in the section <span class="sectref"><a href="#section7">PE serialization format</a></span>.</p></dd>
</dl>
</li>
<li><p>The terminal symbols of the grammar are specified implicitly as the
set of all terminal symbols used in the start expression and on the
RHS of the grammar rules.</p></li>
</ol></dd>
<dt>canonical serialization</dt>
<dd><p>The canonical serialization of a grammar has the format as specified
in the previous item, and then additionally satisfies the constraints
below, which make it unique among all the possible serializations of
this grammar.</p>
<ol class="enumerated">
<li><p>The keys found in all the nested Tcl dictionaries are sorted in
ascending dictionary order, as generated by Tcl's builtin command
<b class="cmd">lsort -increasing -dict</b>.</p></li>
<li><p>The string representation of the value is the canonical representation
of a Tcl dictionary. I.e. it does not contain superfluous whitespace.</p></li>
</ol></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example</a></h3>
<p>Assuming the following PEG for simple mathematical expressions</p>
<pre class="example">
PEG calculator (Expression)
    Digit      &lt;- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       &lt;- '-' / '+'                                     ;
    Number     &lt;- Sign? Digit+                                  ;
    Expression &lt;- Term (AddOp Term)*                            ;
    MulOp      &lt;- '*' / '/'                                     ;
    Term       &lt;- Factor (MulOp Factor)*                        ;
    AddOp      &lt;- '+'/'-'                                       ;
    Factor     &lt;- '(' Expression ')' / Number                   ;
END;
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
pt::grammar::peg {
    rules {
        AddOp      {is {/ {t -} {t +}}                                                                mode value}
        Digit      {is {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}                mode value}
        Expression {is {x {n Term} {* {x {n AddOp} {n Term}}}}                                        mode value}
        Factor     {is {/ {x {t (} {n Expression} {t )}} {n Number}}                                  mode value}
        MulOp      {is {/ {t *} {t /}}                                                                mode value}
        Number     {is {x {? {n Sign}} {+ {n Digit}}}                                                 mode value}
        Sign       {is {/ {t -} {t +}}                                                                mode value}
        Term       {is {x {n Factor} {* {x {n MulOp} {n Factor}}}}                                    mode value}
    }
    start {n Expression}
}
</pre>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">PE serialization format</a></h2>
<p>Here we specify the format used by the Parser Tools to serialize
Parsing Expressions as immutable values for transport, comparison,
etc.</p>
<p>We distinguish between <i class="term">regular</i> and <i class="term">canonical</i>
serializations.
While a parsing expression may have more than one regular
serialization only exactly one of them will be <i class="term">canonical</i>.</p>
<dl class="definitions">
<dt>Regular serialization</dt>
<dd><dl class="definitions">
<dt><b class="const">Atomic Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>The string <b class="const">epsilon</b> is an atomic parsing expression. It matches
the empty string.</p></li>
<li><p>The string <b class="const">dot</b> is an atomic parsing expression. It matches
any character.</p></li>
<li><p>The string <b class="const">alnum</b> is an atomic parsing expression. It matches
any Unicode alphabet or digit character. This is a custom extension of
PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">alpha</b> is an atomic parsing expression. It matches
any Unicode alphabet character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ascii</b> is an atomic parsing expression. It matches
any Unicode character below U0080. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">control</b> is an atomic parsing expression. It matches
any Unicode control character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">digit</b> is an atomic parsing expression. It matches
any Unicode digit character. Note that this includes characters
outside of the [0..9] range. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">graph</b> is an atomic parsing expression. It matches
any Unicode printing character, except for space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">lower</b> is an atomic parsing expression. It matches
any Unicode lower-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">print</b> is an atomic parsing expression. It matches
any Unicode printing character, including space. This is a custom
extension of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">punct</b> is an atomic parsing expression. It matches
any Unicode punctuation character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">space</b> is an atomic parsing expression. It matches
any Unicode space character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">upper</b> is an atomic parsing expression. It matches
any Unicode upper-case alphabet character. This is a custom extension
of PEs based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">wordchar</b> is an atomic parsing expression. It
matches any Unicode word character. This is any alphanumeric character
(see alnum), and any connector punctuation characters (e.g.
underscore). This is a custom extension of PEs based on Tcl's builtin
command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">xdigit</b> is an atomic parsing expression. It matches
any hexadecimal digit character. This is a custom extension of PEs
based on Tcl's builtin command <b class="cmd">string is</b>.</p></li>
<li><p>The string <b class="const">ddigit</b> is an atomic parsing expression. It matches
any decimal digit character. This is a custom extension of PEs based
on Tcl's builtin command <b class="cmd">regexp</b>.</p></li>
<li><p>The expression
    [list t <b class="variable">x</b>]
is an atomic parsing expression. It matches the terminal string <b class="variable">x</b>.</p></li>
<li><p>The expression
    [list n <b class="variable">A</b>]
is an atomic parsing expression. It matches the nonterminal <b class="variable">A</b>.</p></li>
</ol></dd>
<dt><b class="const">Combined Parsing Expressions</b></dt>
<dd><ol class="enumerated">
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list / <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">ordered choice</i>, aka <i class="term">prioritized choice</i>.</p></li>
<li><p>For parsing expressions <b class="variable">e1</b>, <b class="variable">e2</b>, ... the result of
    [list x <b class="variable">e1</b> <b class="variable">e2</b> ... ]
is a parsing expression as well.
This is the <i class="term">sequence</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list * <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">kleene closure</i>, describing zero or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list + <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">positive kleene closure</i>, describing one or more
repetitions.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list &amp; <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">and lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ! <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">not lookahead predicate</i>.</p></li>
<li><p>For a parsing expression <b class="variable">e</b> the result of
    [list ? <b class="variable">e</b>]
is a parsing expression as well.
This is the <i class="term">optional input</i>.</p></li>
</ol></dd>
</dl></dd>
<dt>Canonical serialization</dt>
<dd><p>The canonical serialization of a parsing expression has the format as
specified in the previous item, and then additionally satisfies the
constraints below, which make it unique among all the possible
serializations of this parsing expression.</p>
<ol class="enumerated">
<li><p>The string representation of the value is the canonical representation
of a pure Tcl list. I.e. it does not contain superfluous whitespace.</p></li>
<li><p>Terminals are <em>not</em> encoded as ranges (where start and end of the
range are identical).</p></li>
</ol></dd>
</dl>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Example</a></h3>
<p>Assuming the parsing expression shown on the right-hand side of the
rule</p>
<pre class="example">
    Expression &lt;- Term (AddOp Term)*
</pre>
<p>then its canonical serialization (except for whitespace) is</p>
<pre class="example">
    {x {n Term} {* {x {n AddOp} {n Term}}}}
</pre>
</div>
</div>
<div id="section8" class="section"><h2><a name="section8">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>pt</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key9">EBNF</a>, <a href="../../../../index.html#key21">LL(k)</a>, <a href="../../../../index.html#key12">PEG</a>, <a href="../../../../index.html#key13">TDPL</a>, <a href="../../../../index.html#key10">context-free languages</a>, <a href="../../../../index.html#key6">expression</a>, <a href="../../../../index.html#key17">grammar</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key15">parser</a>, <a href="../../../../index.html#key14">parsing expression</a>, <a href="../../../../index.html#key20">parsing expression grammar</a>, <a href="../../../../index.html#key7">push down automaton</a>, <a href="../../../../index.html#key16">recursive descent</a>, <a href="../../../../index.html#key8">state</a>, <a href="../../../../index.html#key19">top-down parsing languages</a>, <a href="../../../../index.html#key18">transducer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Parsing and Grammars</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/rc4/rc4.html.







































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>rc4 - RC4 Stream Cipher</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/rc4/rc4.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ rc4.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">rc4(n) 1.1.0 tcllib &quot;RC4 Stream Cipher&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>rc4 - Implementation of the RC4 stream cipher</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">AUTHORS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">rc4 <span class="opt">?1.1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::rc4::rc4</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key keyvalue</i> <span class="opt">?<i class="arg">-command lst</i>?</span> <span class="opt">?<i class="arg">-out channel</i>?</span> [ <i class="arg">-in channel</i> | <i class="arg">-infile filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#2"><b class="cmd">::rc4::RC4Init</b> <i class="arg">keydata</i></a></li>
<li><a href="#3"><b class="cmd">::rc4::RC4</b> <i class="arg">Key</i> <i class="arg">data</i></a></li>
<li><a href="#4"><b class="cmd">::rc4::RC4Final</b> <i class="arg">Key</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is an implementation in Tcl of the RC4 stream cipher 
developed by Ron Rivest of RSA Data Security Inc. The cipher was a
trade secret of RSA but was reverse-engineered and published to the
internet in 1994. It is used in a number of network protocols for
securing communications. To evade trademark restrictions this cipher
is sometimes known as ARCFOUR.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::rc4::rc4</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key keyvalue</i> <span class="opt">?<i class="arg">-command lst</i>?</span> <span class="opt">?<i class="arg">-out channel</i>?</span> [ <i class="arg">-in channel</i> | <i class="arg">-infile filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Perform the RC4 algorithm on either the data provided by the argument
or on the data read from the <i class="arg">-in</i> channel. If an <i class="arg">-out</i>
channel is given then the result will be written to this channel.
Giving the <i class="arg">-hex</i> option will return a hexadecimal encoded
version of the result if not using an <i class="arg">-out</i> channel.</p>
<p>The data to be processes can be specified either as a string argument to
the rc4 command, or as a filename or a pre-opened channel. If the 
<i class="arg">-infile</i> argument is given then the file is opened, the data read
and processed and the file is closed. If the <i class="arg">-in</i> argument is
given then data is read from the channel until the end of file. The
channel is not closed. If the <i class="arg">-out</i> argument is given then the
processing result is written to this channel.</p>
<p>If <i class="arg">-command</i> is provided then the rc4 command does not return
anything. Instead the command provided is called with the rc4 result data
appended as the final parameter. This is most useful when reading from Tcl
channels as a fileevent is setup on the channel and the data processed in
chunks</p>
<p>Only one of <i class="arg">-infile</i>, <i class="arg">-in</i> or <i class="arg">string</i> should be given.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<dl class="definitions">
<dt><a name="2"><b class="cmd">::rc4::RC4Init</b> <i class="arg">keydata</i></a></dt>
<dd><p>Initialize a new RC4 key. The <i class="arg">keydata</i> is any amount of binary
data and is used to initialize the cipher internal state.</p></dd>
<dt><a name="3"><b class="cmd">::rc4::RC4</b> <i class="arg">Key</i> <i class="arg">data</i></a></dt>
<dd><p>Encrypt or decrypt the input data using the key obtained by calling
<b class="cmd">RC4Init</b>.</p></dd>
<dt><a name="4"><b class="cmd">::rc4::RC4Final</b> <i class="arg">Key</i></a></dt>
<dd><p>This should be called to clean up resources associated with 
<i class="arg">Key</i>. Once this function has been called the key is destroyed.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% set keydata [binary format H* 0123456789abcdef]
% rc4::rc4 -hex -key $keydata HelloWorld
3cf1ae8b7f1c670b612f
% rc4::rc4 -hex -key $keydata [binary format H* 3cf1ae8b7f1c670b612f]
HelloWorld
</pre>
<pre class="example">
 set Key [rc4::RC4Init &quot;key data&quot;]
 append ciphertext [rc4::RC4 $Key $plaintext]
 append ciphertext [rc4::RC4 $Key $additional_plaintext]
 rc4::RC4Final $Key
</pre>
<pre class="example">
 proc ::Finish {myState data} {
     DoStuffWith $myState $data
 }
 rc4::rc4 -in $socket -command [list ::Finish $ApplicationState]
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>rc4</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../aes/aes.html">aes(n)</a>, <a href="../blowfish/blowfish.html">blowfish(n)</a>, <a href="../des/des.html">des(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key113">arcfour</a>, <a href="../../../../index.html#key111">data integrity</a>, <a href="../../../../index.html#key114">encryption</a>, <a href="../../../../index.html#key112">rc4</a>, <a href="../../../../index.html#key110">security</a>, <a href="../../../../index.html#key115">stream cipher</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/rcs/rcs.html.





























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>rcs - RCS low level utilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/rcs/rcs.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005, Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2005, Colin McCormack &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ rcs.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">rcs(n) 2.0.2 tcllib &quot;RCS low level utilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>rcs - RCS low level utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">TEXT DICT DATA STRUCTURE</a></li>
<li class="section"><a href="#section4">RCS PATCH FORMAT</a></li>
<li class="section"><a href="#section5">RCS PATCH COMMAND LIST</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">rcs <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::rcs::text2dict</b> <i class="arg">text</i></a></li>
<li><a href="#2"><b class="cmd">::rcs::dict2text</b> <i class="arg">dict</i></a></li>
<li><a href="#3"><b class="cmd">::rcs::file2dict</b> <i class="arg">filename</i></a></li>
<li><a href="#4"><b class="cmd">::rcs::dict2file</b> <i class="arg">filename</i> <i class="arg">dict</i></a></li>
<li><a href="#5"><b class="cmd">::rcs::decodeRcsPatch</b> <i class="arg">text</i></a></li>
<li><a href="#6"><b class="cmd">::rcs::encodeRcsPatch</b> <i class="arg">pcmds</i></a></li>
<li><a href="#7"><b class="cmd">::rcs::applyRcsPatch</b> <i class="arg">text</i> <i class="arg">pcmds</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <i class="term">Revision Control System</i>, short <i class="term"><a href="../../../../index.html#key584">RCS</a></i>, is a set of
applications and related data formats which allow a system to persist
the history of changes to a text. It, and its relative SCCS are the
basis for many other such systems, like <i class="term"><a href="../../../../index.html#key583">CVS</a></i>, etc.</p>
<p>This package <em>does not</em> implement RCS.</p>
<p>It only provides a number of low level commands which should be useful
in the implementation of any revision management system, namely:</p>
<ol class="enumerated">
<li><p>The conversion of texts into and out of a data structures which allow
the easy modification of such text by <i class="term">patches</i>, i.e. sequences
of instructions for the transformation of one text into an other.</p></li>
<li><p>And the conversion of one particular format for patches, the so-called
<i class="term">RCS patches</i>, into and out of data structures which allow
their easy application to texts.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::rcs::text2dict</b> <i class="arg">text</i></a></dt>
<dd><p>Converts the argument <i class="arg">text</i> into a dictionary containing and
representing the same text in an indexed form and returns that
dictionary as its result.
More information about the format of the result can be found in
section <span class="sectref"><a href="#section3">TEXT DICT DATA STRUCTURE</a></span>. This command returns the
<i class="term">canonical</i> representation of the input.</p></dd>
<dt><a name="2"><b class="cmd">::rcs::dict2text</b> <i class="arg">dict</i></a></dt>
<dd><p>This command provides the complementary operation to
<b class="cmd">::rcs::text2dict</b>. It converts a dictionary in the form described
in section <span class="sectref"><a href="#section3">TEXT DICT DATA STRUCTURE</a></span> back into a text and
returns that text as its result. The command does accept non-canonical
representations of the text as its input.</p></dd>
<dt><a name="3"><b class="cmd">::rcs::file2dict</b> <i class="arg">filename</i></a></dt>
<dd><p>This command is identical to <b class="cmd">::rcs::text2dict</b>, except that it
reads the text to convert from the file with path <i class="arg">filename</i>. The
file has to exist and must be readable as well.</p></dd>
<dt><a name="4"><b class="cmd">::rcs::dict2file</b> <i class="arg">filename</i> <i class="arg">dict</i></a></dt>
<dd><p>This command is identical to <b class="cmd">::rcs::2dict2text</b>, except that it
stores the resulting text in the file with path <i class="arg">filename</i>. The
file is created if it did not exist, and must be writable. The result
of the command is the empty string.</p></dd>
<dt><a name="5"><b class="cmd">::rcs::decodeRcsPatch</b> <i class="arg">text</i></a></dt>
<dd><p>Converts the <i class="arg">text</i> argument into a patch command list (PCL) as
specified in the section <span class="sectref"><a href="#section5">RCS PATCH COMMAND LIST</a></span> and
returns this list as its result.
It is assumed that the input text is in <i class="term"><a href="../../../../index.html#key585">diff -n format</a></i>, also
known as <i class="term"><a href="../../../../index.html#key581">RCS patch</a></i> format, as specified in the section
<span class="sectref"><a href="#section4">RCS PATCH FORMAT</a></span>.
Please note that the command ignores no-ops in the input, in other
words the resulting PCL contains only instructions doing something.</p></dd>
<dt><a name="6"><b class="cmd">::rcs::encodeRcsPatch</b> <i class="arg">pcmds</i></a></dt>
<dd><p>This command provides the complementary operation to
<b class="cmd">::rcs::decodeRcsPatch</b>. It convert a patch comand list (PCL) list
as specified in the section <span class="sectref"><a href="#section5">RCS PATCH COMMAND LIST</a></span> back
into a text in <span class="sectref"><a href="#section4">RCS PATCH FORMAT</a></span> and returns that text as its result.</p>
<p>Note that this command and <b class="cmd">::rcs::decodeRcsPatch</b> are not exactly
complementary, as the latter strips no-ops from its input, which the
encoder cannot put back anymore into the generated RCS patch. In other
words, the result of a decode/encode step may not match the original
input at the character level, but it will match it at the functional
level.</p></dd>
<dt><a name="7"><b class="cmd">::rcs::applyRcsPatch</b> <i class="arg">text</i> <i class="arg">pcmds</i></a></dt>
<dd><p>This operation applies a patch in the form of a PCL to a text given in
the form of a dictionary and returns the modified text, again as
dictionary, as its result.</p>
<p>To handle actual text use the commands <b class="cmd">::rcs::text2dict</b> (or
equivalent) and <b class="cmd">::rcs::decodeRcsPatch</b> to transform the inputs
into data structures acceptable to this command. Analogously use the
command <b class="cmd">::rcs::dict2text</b> (or equivalent) to transform the
result of this command into actuall text as required.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">TEXT DICT DATA STRUCTURE</a></h2>
<p>A text dictionary is a dictionary whose keys are integer numbers and
text strings as the associated values. The keys represent the line
numbers of a text and the values the text of that line.  Note that one
text can have many representations as a dictionary, as the index
values only have to be properly ordered for reconstruction, their
exact values do not matter. Similarly the strings may actually span
multiple physical lines.</p>
<p>The text</p>
<pre class="example">Hello World,
how are you ?
Fine, and you ?</pre>
<p>for example can be represented by</p>
<pre class="example">{{1 {Hello World,}} {2 {how are you ?}} {3 {Fine, and you ?}}}</pre>
<p>or</p>
<pre class="example">{{5 {Hello World,}} {8 {how are you ?}} {9 {Fine, and you ?}}}</pre>
<p>or</p>
<pre class="example">{{-1 {Hello World,
how are you ?}} {4 {Fine, and you ?}}}</pre>
<p>The first dictionary is the <i class="term">canonical</i> representation of the
text, with line numbers starting at <b class="const">1</b>, increasing in steps of
<b class="const">1</b> and without gaps, and each value representing exactly one
physical line.</p>
<p>All the commands creating dictionaries from text will return the
canonical representation of their input text. The commands taking a
dictionary and returning text will generally accept all
representations, canonical or not.</p>
<p>The result of applying a patch to a text dictionary will in general
cause the dictionary to become non-canonical.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">RCS PATCH FORMAT</a></h2>
<p>A <i class="term"><a href="../../../../index.html#key615">patch</a></i> is in general a series of instructions how to transform
an input text T into a different text T', and also encoded in text
form as well.</p>
<p>The text format for patches understood by this package is a very
simple one, known under the names <i class="term"><a href="../../../../index.html#key581">RCS patch</a></i> or
<i class="term"><a href="../../../../index.html#key585">diff -n format</a></i>.</p>
<p>Patches in this format contain only two different commands, for the
deletion of old text, and addition of new text. The replacement of
some text by a different text is handled as combination of a deletion
following by an addition.</p>
<p>The format is line oriented, with each line containing either a
command or text data associated with the preceding command.
The first line of a <i class="term"><a href="../../../../index.html#key581">RCS patch</a></i> is always a command line.</p>
<p>The commands are:</p>
<dl class="definitions">
<dt>&quot;&quot;</dt>
<dd><p>The empty line is a command which does nothing.</p></dd>
<dt>&quot;a<b class="variable">start</b> <b class="variable">n</b>&quot;</dt>
<dd><p>A line starting with the character <b class="const">a</b> is a command for the
addition of text to the output. It is followed by <b class="variable">n</b> lines of
text data. When applying the patch the data is added just between the
lines <b class="variable">start</b> and <b class="variable">start</b>+1. The same effect is had by
appending the data to the existing text on line <b class="variable">start</b>. A
non-existing line <b class="variable">start</b> is created.</p></dd>
<dt>&quot;d<b class="variable">start</b> <b class="variable">n</b>&quot;</dt>
<dd><p>A line starting with the character <b class="const">d</b> is a command for the
deletion of text from the output. When applied it deletes <b class="variable">n</b>
lines of text, and the first line deleted is at index <b class="variable">start</b>.</p></dd>
</dl>
<p>Note that the line indices <b class="variable">start</b> always refer to the text which
is transformed as it is in its original state, without taking the
precending changes into account.</p>
<p>Note also that the instruction have to be applied in the order they
occur in the patch, or in a manner which produces the same result as
in-order application.</p>
<p>This is the format of results returned by the command
<b class="cmd">::rcs::decodeRcsPatch</b> and accepted by the commands
<b class="cmd">::rcs::encodeRcsPatch</b> and <b class="cmd">::rcs::appplyRcsPatch</b>
resp.
Note however that the decoder will strip no-op commands, and the
encoder will not generate no-ops, making them not fully complementary
at the textual level, only at the functional level.</p>
<p>And example of a RCS patch is</p>
<pre class="example">d1 2
d4 1
a4 2
The named is the mother of all things.
a11 3
They both may be called deep and profound.
Deeper and more profound,
The door of all subtleties!</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">RCS PATCH COMMAND LIST</a></h2>
<p>Patch command lists (sort: PCL's) are the data structures generated by
patch decoder command and accepted by the patch encoder and applicator
commands. They represent RCS patches in the form of Tcl data
structures.</p>
<p>A PCL is a list where each element represents a single patch
instruction, either an addition, or a deletion. The elements are lists
themselves, where the first item specifies the command and the
remainder represent the arguments of the command.</p>
<dl class="definitions">
<dt>a</dt>
<dd><p>This is the instruction for the addition of text. It has two
arguments, the index of the line where to add the text, and the text
to add, in this order.</p></dd>
<dt>d</dt>
<dd><p>This is the instruction for the deletion of text. It has two
arguments, the index of the line where to start deleting text, and the
number of lines to delete, in this order.</p></dd>
</dl>
<p>This is the format returned by the patch decoder command and accepted
as input by the patch encoder and applicator commands.</p>
<p>An example for a patch command is shown below, it represents the
example RCS patch found in section <span class="sectref"><a href="#section4">RCS PATCH FORMAT</a></span>.</p>
<pre class="example">{{d 1 2} {d 4 1} {a 4 {The named is the mother of all things.
}} {a 11 {They both may be called deep and profound.
Deeper and more profound,
The door of all subtleties!}}}</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>rcs</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../../../../index.html#key285">struct</a>, <a href="../textutil/textutil.html">textutil</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key583">CVS</a>, <a href="../../../../index.html#key584">RCS</a>, <a href="../../../../index.html#key581">RCS patch</a>, <a href="../../../../index.html#key582">SCCS</a>, <a href="../../../../index.html#key585">diff -n format</a>, <a href="../../../../index.html#key586">patching</a>, <a href="../../../../index.html#key588">text conversion</a>, <a href="../../../../index.html#key587">text differences</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005, Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2005, Colin McCormack &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/report/report.html.





























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>report - Matrix reports</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/report/report.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ report.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">report(n) 0.3.1 tcllib &quot;Matrix reports&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>report - Create and manipulate report objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">REGIONS</a></li>
<li class="section"><a href="#section3">LINES</a></li>
<li class="section"><a href="#section4">TEMPLATES</a></li>
<li class="section"><a href="#section5">STYLES</a></li>
<li class="section"><a href="#section6">REPORT METHODS</a></li>
<li class="section"><a href="#section7">EXAMPLES</a></li>
<li class="section"><a href="#section8">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">report <span class="opt">?0.3.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::report::report</b> <i class="arg">reportName</i> <i class="arg">columns</i> <span class="opt">?<b class="const">style</b> <i class="arg">style arg...</i>?</span></a></li>
<li><a href="#2"><b class="cmd">reportName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::report::defstyle</b> <i class="arg">styleName arguments script</i></a></li>
<li><a href="#4"><b class="cmd">::report::rmstyle</b> <i class="arg">styleName</i></a></li>
<li><a href="#5"><b class="cmd">::report::stylearguments</b> <i class="arg">styleName</i></a></li>
<li><a href="#6"><b class="cmd">::report::stylebody</b> <i class="arg">styleName</i></a></li>
<li><a href="#7"><b class="cmd">::report::styles</b></a></li>
<li><a href="#8"><i class="arg">reportName</i> <b class="method">destroy</b></a></li>
<li><a href="#9"><i class="arg">reportName</i> <i class="arg">templatecode</i> <b class="method">disable</b>|<b class="method">enable</b></a></li>
<li><a href="#10"><i class="arg">reportName</i> <i class="arg">templatecode</i> <b class="method">enabled</b></a></li>
<li><a href="#11"><i class="arg">reportName</i> <i class="arg">templatecode</i> <b class="method">get</b></a></li>
<li><a href="#12"><i class="arg">reportName</i> <i class="arg">templatecode</i> <b class="method">set</b> <i class="arg">templatedata</i></a></li>
<li><a href="#13"><i class="arg">reportName</i> <b class="method">tcaption</b> <span class="opt">?<i class="arg">size</i>?</span></a></li>
<li><a href="#14"><i class="arg">reportName</i> <b class="method">bcaption</b> <i class="arg">size</i></a></li>
<li><a href="#15"><i class="arg">reportName</i> <b class="cmd">size</b> <i class="arg">column</i> <span class="opt">?<i class="arg">number</i>|<b class="const">dyn</b>?</span></a></li>
<li><a href="#16"><i class="arg">reportName</i> <b class="cmd">sizes</b> <span class="opt">?<i class="arg">size-list</i>?</span></a></li>
<li><a href="#17"><i class="arg">reportName</i> <b class="cmd">pad</b> <i class="arg">column</i> <span class="opt">?<b class="const">left</b>|<b class="const">right</b>|<b class="const">both</b> <span class="opt">?<i class="arg">padstring</i>?</span>?</span></a></li>
<li><a href="#18"><i class="arg">reportName</i> <b class="cmd">justify</b> <i class="arg">column</i> <span class="opt">?<b class="const">left</b>|<b class="const">right</b>|<b class="const">center</b>?</span></a></li>
<li><a href="#19"><i class="arg">reportName</i> <b class="cmd">printmatrix</b> <i class="arg">matrix</i></a></li>
<li><a href="#20"><i class="arg">reportName</i> <b class="cmd">printmatrix2channel</b> <i class="arg">matrix chan</i></a></li>
<li><a href="#21"><i class="arg">reportName</i> <b class="cmd"><a href="../../../../index.html#key457">columns</a></b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides report objects which can be used by the
formatting methods of matrix objects to generate tabular reports of
the matrix in various forms. The report objects defined here break
each report down into three <span class="sectref"><a href="#section2">REGIONS</a></span> and ten classes of
<i class="term"><a href="../../../../index.html#key462">lines</a></i> (various separator- and data-lines). See the following
section for more detailed explanations.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::report::report</b> <i class="arg">reportName</i> <i class="arg">columns</i> <span class="opt">?<b class="const">style</b> <i class="arg">style arg...</i>?</span></a></dt>
<dd><p>Creates a new report object for a report having <i class="arg">columns</i> columns
with an associated global Tcl command whose name is
<i class="arg">reportName</i>. This command may be used to invoke various
configuration operations on the report. It has the following general
form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">reportName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command. See section <span class="sectref"><a href="#section6">REPORT METHODS</a></span> for more
explanations. If no <b class="const">style</b> is specified the report will use
the builtin style <b class="const">plain</b> as its default configuration.</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::report::defstyle</b> <i class="arg">styleName arguments script</i></a></dt>
<dd><p>Defines the new style <i class="arg">styleName</i>. See section <span class="sectref"><a href="#section5">STYLES</a></span>
for more information.</p></dd>
<dt><a name="4"><b class="cmd">::report::rmstyle</b> <i class="arg">styleName</i></a></dt>
<dd><p>Deletes the style <i class="arg">styleName</i>. Trying to delete an unknown or
builtin style will result in an error. Beware, this command will not
check that there are no other styles depending on the deleted
one. Deleting a style which is still used by another style FOO will
result in a runtime error when FOO is applied to a newly instantiated
report.</p></dd>
<dt><a name="5"><b class="cmd">::report::stylearguments</b> <i class="arg">styleName</i></a></dt>
<dd><p>This introspection command returns the list of arguments associated
with the style <i class="arg">styleName</i>.</p></dd>
<dt><a name="6"><b class="cmd">::report::stylebody</b> <i class="arg">styleName</i></a></dt>
<dd><p>This introspection command returns the script associated with the
style <i class="arg">styleName</i>.</p></dd>
<dt><a name="7"><b class="cmd">::report::styles</b></a></dt>
<dd><p>This introspection command returns a list containing the names of all
styles known to the package at the time of the call. The order of the
names in the list reflects the order in which the styles were
created. In other words, the first item is the predefined style
<b class="const">plain</b>, followed by the first style defined by the user, and
so on.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">REGIONS</a></h2>
<p>The three regions are the <i class="term">top caption</i>,
<i class="term">data area</i> and <i class="term">bottom caption</i>. These are,
roughly speaking, the title, the values to report and a title at the
bottom. The size of the caption regions can be specified by the user
as the number of rows they occupy in the matrix to format. The size of
the data area is specified implicitly.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">LINES</a></h2>
<p><span class="sectref"><a href="#section4">TEMPLATES</a></span> are associated with each of the ten line classes,
defining the formatting for this kind of line. The user is able to
enable and disable the separator lines at will, but not the data
lines. Their usage is solely determined by the number of rows
contained in the three regions. Data lines and all enabled separators
must have a template associated with them.</p>
<p>Note that the data-lines in a report and the rows in the matrix the
report was generated from are <em>not</em> in a 1:1 relationship if
any row in the matrix has a height greater than one.</p>
<p>The different kinds of lines and the codes used by the report methods
to address them are:</p>
<dl class="definitions">
<dt><b class="const">top</b></dt>
<dd><p>The topmost line of a report. Separates the report from anything which
came before it. The user can enable the usage of this line at will.</p></dd>
<dt><b class="const">topdatasep</b></dt>
<dd><p>This line is used to separate the data rows in the top caption region,
if it contains more than one row and the user enabled its usage.</p></dd>
<dt><b class="const">topcapsep</b></dt>
<dd><p>This line is used to separate the top caption and data regions, if the
top caption is not empty and the user enabled its usage.</p></dd>
<dt><b class="const">datasep</b></dt>
<dd><p>This line is used to separate the data rows in the data region, if it
contains more than one row and the user enabled its usage.</p></dd>
<dt><b class="const">botcapsep</b></dt>
<dd><p>This line is used to separate the data and bottom caption regions, if
the bottom caption is not empty and the user enabled its usage.</p></dd>
<dt><b class="const">botdatasep</b></dt>
<dd><p>This line is used to separate the data rows in the bottom caption
region, if it contains more than one row and the user enabled its
usage.</p></dd>
<dt><b class="const">bottom</b></dt>
<dd><p>The bottommost line of a report. Separates the report from anything
which comes after it. The user can enable the usage of this line at
will.</p></dd>
<dt><b class="const">topdata</b></dt>
<dd><p>This line defines the format of data lines in the top caption region
of the report.</p></dd>
<dt><b class="const">data</b></dt>
<dd><p>This line defines the format of data lines in the data region of the
report.</p></dd>
<dt><b class="const">botdata</b></dt>
<dd><p>This line defines the format of data lines in the bottom caption
region of the report.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">TEMPLATES</a></h2>
<p>Each template is a list of strings used to format the line it is
associated with. For a report containing <b class="variable">n</b> columns a template
for a data line has to contain &quot;<b class="variable">n</b>+1&quot; items and a template for a
separator line &quot;2*<b class="variable">n</b>+1&quot; items.</p>
<p>The items in a data template specify the strings used to separate the
column information. Together with the corresponding items in the
separator templates they form the vertical lines in the report.</p>
<p><em>Note</em> that the corresponding items in all defined templates
have to be of equal length. This will be checked by the report
object. The first item defines the leftmost vertical line and the last
item defines the rightmost vertical line. The item at index <b class="variable">k</b>
(&quot;1&quot;,...,&quot;<b class="variable">n</b>-2&quot;) separates the information in the columns
&quot;<b class="variable">k</b>-1&quot; and &quot;<b class="variable">k</b>&quot;.</p>
<p>The items in a separator template having an even-numbered index
(&quot;0&quot;,&quot;2&quot;,...)  specify the column separators. The item at index
&quot;2*<b class="variable">k</b>&quot; (&quot;0&quot;,&quot;2&quot;,...,&quot;2*<b class="variable">n</b>&quot;) corresponds to the items at
index &quot;<b class="variable">k</b>&quot; in the data templates.</p>
<p>The items in a separator template having an odd-numbered index
(&quot;1&quot;,&quot;3&quot;,...) specify the strings used to form the horizontal lines in
the separator lines. The item at index &quot;2*<b class="variable">k</b>+1&quot;
(&quot;1&quot;,&quot;3&quot;,...,&quot;2*<b class="variable">n</b>+1&quot;) corresponds to column &quot;<b class="variable">k</b>&quot;. When
generating the horizontal lines the items are replicated to be at
least as long as the size of their column and then cut to the exact
size.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">STYLES</a></h2>
<p>Styles are a way for the user of this package to define common
configurations for report objects and then use them later during the
actual instantiation of report objects. They are defined as tcl
scripts which when executed configure the report object into the
requested configuration.</p>
<p>The command to define styles is <b class="cmd">::report::defstyle</b>. Its last
argument is the tcl <b class="type">script</b> performing the actual
reconfiguration of the report object to obtain the requested style.</p>
<p>In this script the names of all previously defined styles are
available as commands, as are all commands found in a safe interpreter
and the configuration methods of report objects. The latter implicitly
operate on the object currently executing the style script. The
<b class="variable">arguments</b> declared here are available in the <b class="type">script</b> as
variables. When calling the command of a previously declared style all
the arguments expected by it have to be defined in the call.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">REPORT METHODS</a></h2>
<p>The following commands are possible for report objects:</p>
<dl class="definitions">
<dt><a name="8"><i class="arg">reportName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the report, including its storage space and associated
command.</p></dd>
<dt><a name="9"><i class="arg">reportName</i> <i class="arg">templatecode</i> <b class="method">disable</b>|<b class="method">enable</b></a></dt>
<dd><p>Enables or disables the usage of the template addressed by the
<i class="arg">templatecode</i>. Only the codes for separator lines are allowed
here. It is not possible to enable or disable data lines.</p>
<p>Enabling a template causes the report to check all used templates for
inconsistencies in the definition of the vertical lines (See section
<span class="sectref"><a href="#section4">TEMPLATES</a></span>).</p></dd>
<dt><a name="10"><i class="arg">reportName</i> <i class="arg">templatecode</i> <b class="method">enabled</b></a></dt>
<dd><p>Returns the whether the template addressed by the <i class="arg">templatecode</i>
is currently enabled or not.</p></dd>
<dt><a name="11"><i class="arg">reportName</i> <i class="arg">templatecode</i> <b class="method">get</b></a></dt>
<dd><p>Returns the template currently associated with the kind of line
addressed by the <i class="arg">templatecode</i>. All known templatecodes are
allowed here.</p></dd>
<dt><a name="12"><i class="arg">reportName</i> <i class="arg">templatecode</i> <b class="method">set</b> <i class="arg">templatedata</i></a></dt>
<dd><p>Sets the template associated with the kind of line addressed by the
<i class="arg">templatecode</i> to the new value in <i class="arg">templatedata</i>. See section
<span class="sectref"><a href="#section4">TEMPLATES</a></span> for constraints on the length of templates.</p></dd>
<dt><a name="13"><i class="arg">reportName</i> <b class="method">tcaption</b> <span class="opt">?<i class="arg">size</i>?</span></a></dt>
<dd><p>Specifies the <i class="arg">size</i> of the top caption region as the number rows
it occupies in the matrix to be formatted. Only numbers greater than
or equal to zero are allowed. If no <i class="arg">size</i> is specified the
command will return the current size instead.</p>
<p>Setting the size of the top caption to a value greater than zero
enables the corresponding data template and causes the report to check
all used templates for inconsistencies in the definition of the
vertical lines (See section <span class="sectref"><a href="#section4">TEMPLATES</a></span>).</p></dd>
<dt><a name="14"><i class="arg">reportName</i> <b class="method">bcaption</b> <i class="arg">size</i></a></dt>
<dd><p>Specifies the <i class="arg">size</i> of the bottom caption region as the number
rows it occupies in the matrix to be formatted. Only numbers greater
than or equal to zero are allowed. If no <i class="arg">size</i> is specified the
command will return the current size instead.</p>
<p>Setting the size of the bottom caption to a value greater than zero
enables the corresponding data template and causes the report to check
all used templates for inconsistencies in the definition of the
vertical lines (See section <span class="sectref"><a href="#section4">TEMPLATES</a></span>).</p></dd>
<dt><a name="15"><i class="arg">reportName</i> <b class="cmd">size</b> <i class="arg">column</i> <span class="opt">?<i class="arg">number</i>|<b class="const">dyn</b>?</span></a></dt>
<dd><p>Specifies the size of the <i class="arg">column</i> in the output. The value
<b class="const">dyn</b> means that the columnwidth returned by the matrix to be
formatted for the specified column shall be used. The formatting of
the column is dynamic. If a fixed <i class="arg">number</i> is used instead of
<b class="const">dyn</b> it means that the column has a width of that many
characters (padding excluded). Only numbers greater than zero are
allowed here.</p>
<p>If no size specification is given the command will return the current
size of the <i class="arg">column</i> instead.</p></dd>
<dt><a name="16"><i class="arg">reportName</i> <b class="cmd">sizes</b> <span class="opt">?<i class="arg">size-list</i>?</span></a></dt>
<dd><p>This method allows the user to specify the sizes of all columns in one
call. Its argument is a list containing the sizes to associate with
the columns. The first item is associated with column 0, the next with
column 1, and so on.</p>
<p>If no <i class="arg">size-list</i> is specified the command will return a list
containing the currently set sizes instead.</p></dd>
<dt><a name="17"><i class="arg">reportName</i> <b class="cmd">pad</b> <i class="arg">column</i> <span class="opt">?<b class="const">left</b>|<b class="const">right</b>|<b class="const">both</b> <span class="opt">?<i class="arg">padstring</i>?</span>?</span></a></dt>
<dd><p>This method allows the user to specify padding on the left, right or
both sides of a <i class="arg">column</i>. If the <i class="arg">padstring</i> is not specified
it defaults to a single space character. <em>Note</em>: An alternative
way of specifying the padding is to use vertical separator strings
longer than one character in the templates (See section
<span class="sectref"><a href="#section4">TEMPLATES</a></span>).</p>
<p>If no pad specification is given at all the command will return the
current state of padding for the column instead. This will be a list
containing two elements, the first element the left padding, the
second describing the right padding.</p></dd>
<dt><a name="18"><i class="arg">reportName</i> <b class="cmd">justify</b> <i class="arg">column</i> <span class="opt">?<b class="const">left</b>|<b class="const">right</b>|<b class="const">center</b>?</span></a></dt>
<dd><p>Declares how the cell values for a <i class="arg">column</i> are filled into the
report given the specified size of a column in the report.</p>
<p>For <b class="const">left</b> and <b class="const">right</b> justification a cell value
shorter than the width of the column is bound with its named edge to
the same edge of the column. The other side is filled with spaces. In
the case of <b class="const">center</b> the spaces are placed to both sides of the
value and the left number of spaces is at most one higher than the
right number of spaces.</p>
<p>For a value longer than the width of the column the value is cut at
the named edge. This means for <b class="const">left</b> justification that the
<em>tail</em> (i.e. the <b class="const">right</b> part) of the value is made
visible in the output. For <b class="const">center</b> the value is cut at both
sides to fit into the column and the number of characters cut at the
left side of the value is at most one less than the number of
characters cut from the right side.</p>
<p>If no justification was specified the command will return the current
justification for the column instead.</p></dd>
<dt><a name="19"><i class="arg">reportName</i> <b class="cmd">printmatrix</b> <i class="arg">matrix</i></a></dt>
<dd><p>Formats the <i class="arg">matrix</i> according to the configuration of the report
and returns the resulting string. The matrix has to have the same
number of columns as the report. The matrix also has to have enough
rows so that the top and bottom caption regions do not overlap. The
data region is allowed to be empty.</p></dd>
<dt><a name="20"><i class="arg">reportName</i> <b class="cmd">printmatrix2channel</b> <i class="arg">matrix chan</i></a></dt>
<dd><p>Formats the <i class="arg">matrix</i> according to the configuration of the report
and writes the result into the channel <i class="arg">chan</i>. The matrix has to
have the same number of columns as the report. The matrix also has to
have enough rows so that the top and bottom caption regions do not
overlap. The data region is allowed to be empty.</p></dd>
<dt><a name="21"><i class="arg">reportName</i> <b class="cmd"><a href="../../../../index.html#key457">columns</a></b></a></dt>
<dd><p>Returns the number of columns in the report.</p></dd>
</dl>
<p>The methods <b class="method">size</b>, <b class="method">pad</b> and <b class="method">justify</b> all take
a column index as their first argument. This index is allowed to use
all the forms of an index as accepted by the <b class="cmd">lindex</b> command. The
allowed range for indices is
	&quot;0,...,[<b class="variable">reportName</b> columns]-1&quot;.</p>
</div>
<div id="section7" class="section"><h2><a name="section7">EXAMPLES</a></h2>
<p>Our examples define some generally useful report styles.</p>
<p>A simple table with lines surrounding all information and vertical
separators, but without internal horizontal separators.</p>
<pre class="example">
    ::report::defstyle simpletable {} {
	data	set [split &quot;[string repeat &quot;| &quot;   [columns]]|&quot;]
	top	set [split &quot;[string repeat &quot;+ - &quot; [columns]]+&quot;]
	bottom	set [top get]
	top	enable
	bottom	enable
    }
</pre>
<p>An extension of a <b class="cmd">simpletable</b>, see above, with a title area.</p>
<pre class="example">
    ::report::defstyle captionedtable {{n 1}} {
	simpletable
	topdata   set [data get]
	topcapsep set [top get]
	topcapsep enable
	tcaption $n
    }
</pre>
<p>Given the definitions above now an example which actually formats a
matrix into a tabular report. It assumes that the matrix actually
contains useful data.</p>
<pre class="example">
    % ::struct::matrix m
    % # ... fill m with data, assume 5 columns
    % ::report::report r 5 style captionedtable 1
    % r printmatrix m
    +---+-------------------+-------+-------+--------+
    |000|VERSIONS:          |2:8.4a3|1:8.4a3|1:8.4a3%|
    +---+-------------------+-------+-------+--------+
    |001|CATCH return ok    |7      |13     |53.85   |
    |002|CATCH return error |68     |91     |74.73   |
    |003|CATCH no catch used|7      |14     |50.00   |
    |004|IF if true numeric |12     |33     |36.36   |
    |005|IF elseif          |15     |47     |31.91   |
    |   |true numeric       |       |       |        |
    +---+-------------------+-------+-------+--------+
    %
    % # alternate way of doing the above
    % m format 2string r
</pre>
</div>
<div id="section8" class="section"><h2><a name="section8">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>report</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key55">matrix</a>, <a href="../../../../index.html#key105">report</a>, <a href="../../../../index.html#key104">table</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/rest/rest.html.


































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>rest - A framework for RESTful web services</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/rest/rest.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ rest.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">rest(n) 1.0 tcllib &quot;A framework for RESTful web services&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>rest - define REST web APIs and call them inline or asychronously</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">INCLUDED</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">rest <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::rest::simple</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></li>
<li><a href="#2"><b class="cmd">::rest::get</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></li>
<li><a href="#3"><b class="cmd">::rest::post</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></li>
<li><a href="#4"><b class="cmd">::rest::head</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></li>
<li><a href="#5"><b class="cmd">::rest::put</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></li>
<li><a href="#6"><b class="cmd">::rest::delete</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></li>
<li><a href="#7"><b class="cmd">::rest::save</b> <i class="arg">name</i> <i class="arg">file</i></a></li>
<li><a href="#8"><b class="cmd">::rest::describe</b> <i class="arg">name</i></a></li>
<li><a href="#9"><b class="cmd">::rest::parameters</b> <i class="arg">url</i> <span class="opt">?args?</span></a></li>
<li><a href="#10"><b class="cmd">::rest::parse_opts</b> <i class="arg">static</i> <i class="arg">required</i> <i class="arg">optional</i> <i class="arg">string</i></a></li>
<li><a href="#11"><b class="cmd">::rest::substitute</b> <i class="arg">string</i> <span class="opt">?var?</span></a></li>
<li><a href="#12"><b class="cmd">::rest::create_interface</b> <i class="arg">name</i></a></li>
<li><a href="#13">describe</a></li>
<li><a href="#14">uplevel token token</a></li>
<li><a href="#15">upvar body body</a></li>
<li><a href="#16">uplevel token token</a></li>
<li><a href="#17">uplevel token token</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>There are 2 types of usage this package supports: simple calls, and complete interfaces. In an interface you specify a set of rules and then the package builds commands which correspond to the REST methods. These commands can have many options such as input and output transformations and data type specific formatting. This results in a cleaner and simpler script. On the other hand, a simple call is easier and quicker to implement but less featureful. It takes the url and a few options on the command and returns the result directly. Any formatting or checking is up to rest of the script.
Simple usage
In simple usage you make calls using http method procedures and then check or process the returned data yourself</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::rest::simple</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></dt>
<dd></dd>
<dt><a name="2"><b class="cmd">::rest::get</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></dt>
<dd></dd>
<dt><a name="3"><b class="cmd">::rest::post</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></dt>
<dd></dd>
<dt><a name="4"><b class="cmd">::rest::head</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></dt>
<dd></dd>
<dt><a name="5"><b class="cmd">::rest::put</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></dt>
<dd></dd>
<dt><a name="6"><b class="cmd">::rest::delete</b> <i class="arg">url</i> <i class="arg">query</i> <span class="opt">?config?</span> <span class="opt">?body?</span></a></dt>
<dd></dd>
</dl>
<p>The above commands are all equivalent except for the http method used. If you use <b class="cmd">simple</b> then the method should be specified as an option in the <span class="opt">?config?</span> dict, otherwise it defaults to <b class="const">get</b>. If a body is needed then the config dict must be present, however it may be empty.</p>
<pre class="example">
    set appid APPID
    set search tcl
    set res [rest::get http://boss.yahooapis.com/ysearch/web/v1/$search [list appid $appid]]
    set res [rest::format_json $res]
</pre>
<pre class="example">
    set res [rest::simple http://twitter.com/statuses/update.json  [list status $text]  {
          method post
          auth {basic user password}
          format json
        }
    ]
</pre>
<p>the options supported in the config dict are as follows
headers
cookie
auth
format
method
content-type
Interface usage
An interface to a REST API consists of a series of definitions of REST calls contained in an array. The array name becomes a namespace containing the defined commands. Each array element defines the name of the call and takes the form of a dict, aka key/value pairs. These keys are the defined configuration options below.
After creating the definitions simply call rest::create_interface on the array to create the commands.</p>
<pre class="example">
package require rest
set yweather(forecast) {
   url http://weather.yahooapis.com/forecastrss
   req_args { p: }
   opt_args { u: }
}
rest::create_interface yweather
puts [yweather::forecast -p 94089]
</pre>
<p>::${name}::basic_auth <i class="arg">u</i> <i class="arg">p</i>
::${name}::set_static_args <span class="opt">?args?</span>]</p>
<dl class="definitions">
<dt><a name="7"><b class="cmd">::rest::save</b> <i class="arg">name</i> <i class="arg">file</i></a></dt>
<dd><p>saves a copy of the dynamically created procs to a file for later loading</p></dd>
<dt><a name="8"><b class="cmd">::rest::describe</b> <i class="arg">name</i></a></dt>
<dd><p>print a description of defined api calls</p></dd>
<dt><a name="9"><b class="cmd">::rest::parameters</b> <i class="arg">url</i> <span class="opt">?args?</span></a></dt>
<dd><p>parse a url query string into a dict</p></dd>
<dt><a name="10"><b class="cmd">::rest::parse_opts</b> <i class="arg">static</i> <i class="arg">required</i> <i class="arg">optional</i> <i class="arg">string</i></a></dt>
<dd></dd>
<dt><a name="11"><b class="cmd">::rest::substitute</b> <i class="arg">string</i> <span class="opt">?var?</span></a></dt>
<dd><p>take a string and substitute real values for any option identifiers</p></dd>
<dt><a name="12"><b class="cmd">::rest::create_interface</b> <i class="arg">name</i></a></dt>
<dd><p>TOKENS
     the value is substituted into the url at call time. tokens in the form of %name:default_value% will be an optional argument with a default value.
url
    the target of the http request
description
    a string which describes the call. used only for</p></dd>
<dt><a name="13">describe</a></dt>
<dd><p>body
    indicates if arguments are required for the request body or not. should
    be one of none, optional, required, argument or mime_multipart. default is optional.
    if <b class="const">argument</b> is used then the option is parsed as a list where the second value is the name
    of a option. the body will then be used as the value for that option.
    if the value is <b class="const">mime_multipart</b> then the body is required and interpreted as each argument
    representing one part of a mime multipart document. each argument should be a 2 item list with the first being
    a list of header keys and values, and the second being the mime part body.</p>
<pre class="example">
set ygeo(parse) {
    url http://wherein.yahooapis.com/v1/document
    method post
    body { arg documentContent }
}
ygeo::parse &quot;san jose ca&quot;
# &quot;san jose ca&quot; will be interpreted as if it were specified as the -documentContent option
</pre>
<pre class="example">
set gdocs(upload) {
    url http://docs.google.com/feeds/default/private/full
    body mime_multipart
}
gdocs::upload [list {Content-Type application/atom+xml} $xml] [list {Content-Type image/jpeg} $filedata]
</pre>
<p>method
    The HTTP method to call on the url. The default is GET.
copy
    this copies the definition of a previously defined call. after copying you can override selected options by defining them again.
unset
    removes the named option. useful when using copy of another definition.
headers
    the value must be another dict containing header fields and their values. The default is to not add any additional headers.
content-type
    Specifies the content type for the request data.
req_args
    a list of the required arguments. names ending in a colon will require a value.
opt_args
    arguments that may be present but are not required.
static_args
    arguments that are always the same. no sense in troubling the user with these. A leading - is allowed but not required to maintain consistancy with the command line.
auth
    should be one of basic or sign. if basic is used you can configure basic auth with the proc auth_basic which takes 2 arguments, the username and password.
    if sign is specified then the value must be a list with the second element being the name of a proc which will be called to perform the request signing.</p>
<pre class="example">
set delicious(updated) {
    url https://api.del.icio.us/v1/posts/update
    auth basic
}
rest::create_interface flickr
flickr::basic_auth username password
</pre>
<pre class="example">
set flickr(auth.getToken) {
   url http://api.flickr.com/services/rest/
   req_args { api_key: secret: }
   auth { sign do_signature }
}
rest::create_interface flickr
proc ::flickr::do_signature {query} {
    # perform some operations on the query here
    return $query
}
</pre>
<p>callback
    If this option is present then the method will be created as an async call. An async call will return immediately with the value of the http token. The event loop must be active to use this option. The value of this option is the name of a proc which is invoked when the HTTP call is complete. The proc receives three arguments, the name of the calling procedure, the status of the result (one of OK or ERROR), and the data associated with the result.
    the http request header is available via</p></dd>
<dt><a name="14">uplevel token token</a></dt>
<dd><p>cookie
    a list of cookies to be passed in the http header. this is just a shortcut to the headers option
input_transform
    commands which take the variable $query and transform it in some manner before returning a new value. return value must be a dict which will be passed to http::formatQuery
    the request body is accessible via</p></dd>
<dt><a name="15">upvar body body</a></dt>
<dd><p>format or result
    defines the format of the returned data. should be one of discard, raw, json, xml, or tdom. the default is auto which should auto detect between xml and json. rss is formated as
    a special case of xml.
pre_transform
    this value takes the form of a proc which should perform some action on $result and return a value. it is run on the result before the output (xml/json/etc) transformation is done.
    the http request header is available via</p></dd>
<dt><a name="16">uplevel token token</a></dt>
<dd><p>result
    may have the value xml, json, tdom, raw, or auto. the default is auto and should auto detect json or xml results and transform them into a tcl list. this is here if you want to specify it explicitly.
post_transform
    this value takes the form of a proc which should perform some action on $result and return a value. it is run on the result after the output transformation but before returning the value to the calling procedure.
    the http request header is available via</p></dd>
<dt><a name="17">uplevel token token</a></dt>
<dd><p>check_result
    this value should be a list of 2 expressions either of which may be empty. the first expression is checks the OK condition, it must return true when the result is satisfactory. the second expression is the error condition, it must return false unless there is an error.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">INCLUDED</a></h2>
<p>functional but incomplete implementations are included for the following services:
flickr
twitter
yahoo boss
yahoo weather
google calendar
facebook
del.icio.us
read the file or source it and use <b class="cmd">describe</b> for more information. also see the
developers documentation on the respective sites.</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ripemd/ripemd128.html.






















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>ripemd128 - RIPEMD Message-Digest Algorithm</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ripemd/ripemd128.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ ripemd128.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ripemd128(n) 1.0.3 tcllib &quot;RIPEMD Message-Digest Algorithm&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ripemd128 - RIPEMD-128 Message-Digest Algorithm</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">ripemd128 <span class="opt">?1.0.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ripemd::ripemd128</b> <span class="opt">?<i class="arg">-hex</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#2"><b class="cmd">::ripemd::hmac128</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#3"><b class="cmd">::ripemd::RIPEMD128Init</b></a></li>
<li><a href="#4"><b class="cmd">::ripemd::RIPEMD128Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#5"><b class="cmd">::ripemd::RIPEMD128Final</b> <i class="arg">token</i></a></li>
<li><a href="#6"><b class="cmd">::ripemd::RIPEHMAC128Init</b> <i class="arg">key</i></a></li>
<li><a href="#7"><b class="cmd">::ripemd::RIPEHMAC128Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#8"><b class="cmd">::ripemd::RIPEHMAC128Final</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is an implementation in Tcl of the RIPEMD-128 message-digest
algorithm (1). This algorithm takes an arbitrary quantity of data and
generates a 128-bit message digest from the input. The RIPEMD-128 
algorithm is based upon the MD4 algorithm (2, 4) but has been
cryptographically strengthened against weaknesses that have been found
in MD4 (4). RIPEMD-128 has been designed to be a drop-in replacement
for MD4 and MD5 (5). If security is the major consideration, then
RIPEMD-160 or SHA1 should be considered.</p>
<p>This package will use <b class="package">Trf</b> to
accelerate the digest computation if available. In
the absence of an accelerator package the pure-Tcl implementation will
be used.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ripemd::ripemd128</b> <span class="opt">?<i class="arg">-hex</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate the RIPEMD-128 digest of the data given in string. This is
returned as a binary string by default. Giving the <i class="arg">-hex</i> option
will return a hexadecimal encoded version of the digest.</p>
<p>The data to be hashed can be specified either as a string argument to
the ripemd128 command, or as a filename or a pre-opened channel. If the 
<i class="arg">-filename</i> argument is given then the file is opened, the data read
and hashed and the file is closed. If the <i class="arg">-channel</i> argument is
given then data is read from the channel until the end of file. The
channel is not closed.</p>
<p>Only one of <i class="arg">-file</i>, <i class="arg">-channel</i> or <i class="arg">string</i> should be given.</p></dd>
<dt><a name="2"><b class="cmd">::ripemd::hmac128</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate an Hashed Message Authentication digest (HMAC) using the
RIPEMD-128 digest algorithm. HMACs are described in RFC 2104 (6) and
provide a RIPEMD-128 digest that includes a key. All options other
than <i class="arg">-key</i> are as for the <b class="cmd">::ripemd::ripemd128</b> command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<p>For the programmer, hash functions can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
uniquely derived from the data that was poured into the bucket. The 
programming interface to the hash operates on a token (equivalent to the
bucket). You call <b class="cmd">RIPEMD128Init</b> to obtain a token and then call 
<b class="cmd">RIPEMD128Update</b> as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call 
<b class="cmd">RIPEMD128Final</b>. An equivalent set of functions gives you a keyed
digest (HMAC).</p>
<p>If you have <b class="package">critcl</b> and have built the <b class="package">tcllibc</b>
package then the implementation of the hashing function will be
performed by compiled code. Alternatively if both the Trf and Memchan
extensions are available then these will be used. Finally the package
will revert to a pure-Tcl implementation.  The programming interface
remains the same, however.</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">::ripemd::RIPEMD128Init</b></a></dt>
<dd><p>Begins a new RIPEMD-128 hash. Returns a token ID that must be used for the
remaining functions.</p></dd>
<dt><a name="4"><b class="cmd">::ripemd::RIPEMD128Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd><p>Add data to the hash identified by token. Calling 
<em>RIPEMD128Update $token &quot;abcd&quot;</em> is equivalent to calling
<em>RIPEMD128Update $token &quot;ab&quot;</em> followed by 
<em>RIPEMD128Update $token &quot;cb&quot;</em>. See <span class="sectref"><a href="#section4">EXAMPLES</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::ripemd::RIPEMD128Final</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 16 bytes representing the 128 bit
RIPEMD-128 digest value.</p></dd>
<dt><a name="6"><b class="cmd">::ripemd::RIPEHMAC128Init</b> <i class="arg">key</i></a></dt>
<dd><p>This is equivalent to the <b class="cmd">::ripemd::RIPEMD128Init</b> command
except that it requires the key that will be included in the HMAC.</p></dd>
<dt><a name="7"><b class="cmd">::ripemd::RIPEHMAC128Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">::ripemd::RIPEHMAC128Final</b> <i class="arg">token</i></a></dt>
<dd><p>These commands are identical to the RIPEMD128 equivalent commands.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% ripemd::ripemd128 -hex &quot;Tcl does RIPEMD-128&quot;
3cab177bae65205d81e7978f63556c63
</pre>
<pre class="example">
% ripemd::hmac128 -hex -key Sekret &quot;Tcl does RIPEMD-128&quot;
b359dc5971a05beea0be7b106b30e389
</pre>
<pre class="example">
% set tok [ripemd::RIPEMD128Init]
::ripemd::1
% ripemd::RIPEMD128Update $tok &quot;Tcl &quot;
% ripemd::RIPEMD128Update $tok &quot;does &quot;
% ripemd::RIPEMD128Update $tok &quot;RIPEMD-128&quot;
% ripemd::Hex [ripemd::RIPEMD128Final $tok]
3cab177bae65205d81e7978f63556c63
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>H. Dobbertin, A. Bosselaers, B. Preneel, 
        &quot;RIPEMD-160, a strengthened version of RIPEMD&quot;
        <a href="http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf">http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf</a></p></li>
<li><p>Rivest, R., &quot;The MD4 Message Digest Algorithm&quot;, RFC 1320, MIT,
       April 1992. (<a href="http://www.rfc-editor.org/rfc/rfc1320.txt">http://www.rfc-editor.org/rfc/rfc1320.txt</a>)</p></li>
<li><p>Rivest, R., &quot;The MD4 message digest algorithm&quot;, in A.J.  Menezes
       and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90
       Proceedings, pages 303-311, Springer-Verlag, 1991.</p></li>
<li><p>Dobbertin, H., &quot;Cryptanalysis of MD4&quot;, Journal of Cryptology
        vol 11 (4), pp. 253-271 (1998)</p></li>
<li><p>Rivest, R., &quot;The MD5 Message-Digest Algorithm&quot;, RFC 1321, MIT and
       RSA Data Security, Inc, April 1992.
	(<a href="http://www.rfc-editor.org/rfc/rfc1321.txt">http://www.rfc-editor.org/rfc/rfc1321.txt</a>)</p></li>
<li><p>Krawczyk, H., Bellare, M. and Canetti, R. &quot;HMAC: Keyed-Hashing for 
      Message Authentication&quot;, RFC 2104, February 1997.
	(<a href="http://www.rfc-editor.org/rfc/rfc2104.txt">http://www.rfc-editor.org/rfc/rfc2104.txt</a>)</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ripemd</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../md4/md4.html">md4</a>, <a href="../md5/md5.html">md5</a>, <a href="ripemd160.html">ripemd160</a>, <a href="../sha1/sha1.html">sha1</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key336">RIPEMD</a>, <a href="../../../../index.html#key195">hashing</a>, <a href="../../../../index.html#key335">md4</a>, <a href="../../../../index.html#key194">message-digest</a>, <a href="../../../../index.html#key334">rfc 1320</a>, <a href="../../../../index.html#key337">rfc 1321</a>, <a href="../../../../index.html#key193">rfc 2104</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/ripemd/ripemd160.html.











































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>ripemd160 - RIPEMD Message-Digest Algorithm</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/ripemd/ripemd160.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ ripemd160.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">ripemd160(n) 1.0.3 tcllib &quot;RIPEMD Message-Digest Algorithm&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>ripemd160 - RIPEMD-160 Message-Digest Algorithm</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">ripemd160 <span class="opt">?1.0.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::ripemd::ripemd160</b> <span class="opt">?<i class="arg">-hex</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#2"><b class="cmd">::ripemd::hmac160</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#3"><b class="cmd">::ripemd::RIPEMD160Init</b></a></li>
<li><a href="#4"><b class="cmd">::ripemd::RIPEMD160Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#5"><b class="cmd">::ripemd::RIPEMD160Final</b> <i class="arg">token</i></a></li>
<li><a href="#6"><b class="cmd">::ripemd::RIPEHMAC160Init</b> <i class="arg">key</i></a></li>
<li><a href="#7"><b class="cmd">::ripemd::RIPEHMAC160Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#8"><b class="cmd">::ripemd::RIPEHMAC160Final</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is an implementation in Tcl of the RIPEMD-160 message-digest
algorithm (1). This algorithm takes an arbitrary quantity of data and
generates a 160-bit message digest from the input. The RIPEMD-160 
algorithm is based upon the MD4 algorithm (2, 4) but has been
cryptographically strengthened against weaknesses that have been found
in MD4 (4).</p>
<p>This package will use <b class="package">cryptkit</b> or <b class="package">Trf</b> to
accelerate the digest computation if either package is available. In
the absence of an accelerator package the pure-Tcl implementation will
be used.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::ripemd::ripemd160</b> <span class="opt">?<i class="arg">-hex</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate the RIPEMD-160 digest of the data given in string. This is
returned as a binary string by default. Giving the <i class="arg">-hex</i> option
will return a hexadecimal encoded version of the digest.</p>
<p>The data to be hashed can be specified either as a string argument to
the ripemd160 command, or as a filename or a pre-opened channel. If the 
<i class="arg">-filename</i> argument is given then the file is opened, the data read
and hashed and the file is closed. If the <i class="arg">-channel</i> argument is
given then data is read from the channel until the end of file. The
channel is not closed.</p>
<p>Only one of <i class="arg">-file</i>, <i class="arg">-channel</i> or <i class="arg">string</i> should be given.</p></dd>
<dt><a name="2"><b class="cmd">::ripemd::hmac160</b> <span class="opt">?<i class="arg">-hex</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate an Hashed Message Authentication digest (HMAC) using the
RIPEMD-160 digest algorithm. HMACs are described in RFC 2104 (5) and
provide a RIPEMD-160 digest that includes a key. All options other
than <i class="arg">-key</i> are as for the <b class="cmd">::ripemd::ripemd160</b> command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<p>For the programmer, hash functions can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
uniquely derived from the data that was poured into the bucket. The 
programming interface to the hash operates on a token (equivalent to the
bucket). You call <b class="cmd">RIPEMD160Init</b> to obtain a token and then call 
<b class="cmd">RIPEMD160Update</b> as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call 
<b class="cmd">RIPEMD160Final</b>. An equivalent set of functions gives you a keyed
digest (HMAC).</p>
<dl class="definitions">
<dt><a name="3"><b class="cmd">::ripemd::RIPEMD160Init</b></a></dt>
<dd><p>Begins a new RIPEMD-160 hash. Returns a token ID that must be used for the
remaining functions.</p></dd>
<dt><a name="4"><b class="cmd">::ripemd::RIPEMD160Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd><p>Add data to the hash identified by token. Calling 
<em>RIPEMD160Update $token &quot;abcd&quot;</em> is equivalent to calling
<em>RIPEMD160Update $token &quot;ab&quot;</em> followed by 
<em>RIPEMD160Update $token &quot;cb&quot;</em>. See <span class="sectref"><a href="#section4">EXAMPLES</a></span>.</p></dd>
<dt><a name="5"><b class="cmd">::ripemd::RIPEMD160Final</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 16 bytes representing the 160 bit
RIPEMD-160 digest value.</p></dd>
<dt><a name="6"><b class="cmd">::ripemd::RIPEHMAC160Init</b> <i class="arg">key</i></a></dt>
<dd><p>This is equivalent to the <b class="cmd">::ripemd::RIPEMD160Init</b> command
except that it requires the key that will be included in the HMAC.</p></dd>
<dt><a name="7"><b class="cmd">::ripemd::RIPEHMAC160Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">::ripemd::RIPEHMAC160Final</b> <i class="arg">token</i></a></dt>
<dd><p>These commands are identical to the RIPEMD160 equivalent commands.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% ripemd::ripemd160 -hex &quot;Tcl does RIPEMD-160&quot;
0829dea75a1a7074c702896723fe37763481a0a7
</pre>
<pre class="example">
% ripemd::hmac160 -hex -key Sekret &quot;Tcl does RIPEMD-160&quot;
bf0c927231733686731dddb470b64a9c23f7f53b
</pre>
<pre class="example">
% set tok [ripemd::RIPEMD160Init]
::ripemd::1
% ripemd::RIPEMD160Update $tok &quot;Tcl &quot;
% ripemd::RIPEMD160Update $tok &quot;does &quot;
% ripemd::RIPEMD160Update $tok &quot;RIPEMD-160&quot;
% ripemd::Hex [ripemd::RIPEMD160Final $tok]
0829dea75a1a7074c702896723fe37763481a0a7
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>H. Dobbertin, A. Bosselaers, B. Preneel, 
        &quot;RIPEMD-160, a strengthened version of RIPEMD&quot;
        <a href="http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf">http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf</a></p></li>
<li><p>Rivest, R., &quot;The MD4 Message Digest Algorithm&quot;, RFC 1320, MIT,
       April 1992. (<a href="http://www.rfc-editor.org/rfc/rfc1320.txt">http://www.rfc-editor.org/rfc/rfc1320.txt</a>)</p></li>
<li><p>Rivest, R., &quot;The MD4 message digest algorithm&quot;, in A.J.  Menezes
       and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90
       Proceedings, pages 303-311, Springer-Verlag, 1991.</p></li>
<li><p>Dobbertin, H., &quot;Cryptanalysis of MD4&quot;, Journal of Cryptology
        vol 11 (4), pp. 253-271 (1998)</p></li>
<li><p>Krawczyk, H., Bellare, M. and Canetti, R. &quot;HMAC: Keyed-Hashing for 
      Message Authentication&quot;, RFC 2104, February 1997.
	(<a href="http://www.rfc-editor.org/rfc/rfc2104.txt">http://www.rfc-editor.org/rfc/rfc2104.txt</a>)</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>ripemd</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../md4/md4.html">md4</a>, <a href="../md5/md5.html">md5</a>, <a href="ripemd128.html">ripemd128</a>, <a href="../sha1/sha1.html">sha1</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key336">RIPEMD</a>, <a href="../../../../index.html#key195">hashing</a>, <a href="../../../../index.html#key335">md4</a>, <a href="../../../../index.html#key194">message-digest</a>, <a href="../../../../index.html#key334">rfc 1320</a>, <a href="../../../../index.html#key337">rfc 1321</a>, <a href="../../../../index.html#key193">rfc 2104</a>, <a href="../../../../index.html#key110">security</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/sasl/sasl.html.











































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>SASL - Simple Authentication and Security Layer (SASL)</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/sasl/sasl.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005-2006, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ SASL.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">SASL(n) 1.3.0 tcllib &quot;Simple Authentication and Security Layer (SASL)&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>SASL - Implementation of SASL mechanisms for Tcl</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">OPTIONS</a></li>
<li class="section"><a href="#section4">CALLBACK PROCEDURE</a></li>
<li class="section"><a href="#section5">MECHANISMS</a></li>
<li class="section"><a href="#section6">EXAMPLES</a></li>
<li class="section"><a href="#section7">REFERENCES</a></li>
<li class="section"><a href="#section8">AUTHORS</a></li>
<li class="section"><a href="#section9">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">SASL <span class="opt">?1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::SASL::new</b> <i class="arg">option value <span class="opt">?...?</span></i></a></li>
<li><a href="#2"><b class="cmd">::SASL::configure</b> <i class="arg">option value</i> <span class="opt">?<i class="arg">...</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::SASL::step</b> <i class="arg">context</i> <i class="arg">challenge</i> <span class="opt">?<i class="arg">...</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::SASL::response</b> <i class="arg">context</i></a></li>
<li><a href="#5"><b class="cmd">::SASL::reset</b> <i class="arg">context</i></a></li>
<li><a href="#6"><b class="cmd">::SASL::cleanup</b> <i class="arg">context</i></a></li>
<li><a href="#7"><b class="cmd">::SASL::mechanisms</b> <span class="opt">?<i class="arg">type</i>?</span> <span class="opt">?<i class="arg">minimum</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::SASL::register</b> <i class="arg">mechanism</i> <i class="arg">preference</i> <i class="arg">clientproc</i> <span class="opt">?<i class="arg">serverproc</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The Simple Authentication and Security Layer (SASL) is a framework
for providing authentication and authorization to comunications
protocols. The SASL framework is structured to permit negotiation
among a number of authentication mechanisms. SASL may be used in
SMTP, IMAP and HTTP authentication. It is also in use in XMPP, LDAP
and BEEP. See <span class="sectref"><a href="#section5">MECHANISMS</a></span> for the set of available SASL
mechanisms provided with tcllib.</p>
<p>The SASL framework operates using a simple multi-step challenge
response mechanism. All the mechanisms work the same way although the
number of steps may vary. In this implementation a callback procedure
must be provided from which the SASL framework will obtain users
details. See <span class="sectref"><a href="#section4">CALLBACK PROCEDURE</a></span> for details of this
procedure.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::SASL::new</b> <i class="arg">option value <span class="opt">?...?</span></i></a></dt>
<dd><p>Contruct a new SASL context. See <span class="sectref"><a href="#section3">OPTIONS</a></span> for details of the
possible options to this command. A context token is required for most
of the SASL procedures.</p></dd>
<dt><a name="2"><b class="cmd">::SASL::configure</b> <i class="arg">option value</i> <span class="opt">?<i class="arg">...</i>?</span></a></dt>
<dd><p>Modify and inspect the SASL context option. See <span class="sectref"><a href="#section3">OPTIONS</a></span> for
further details.</p></dd>
<dt><a name="3"><b class="cmd">::SASL::step</b> <i class="arg">context</i> <i class="arg">challenge</i> <span class="opt">?<i class="arg">...</i>?</span></a></dt>
<dd><p>This is the core procedure for using the SASL framework. The 
<b class="cmd">step</b> procedure should be called until it returns 0. Each step takes a
server challenge string and the response is calculated and stored in
the context. Each mechanism may require one or more steps. For some
steps there may be no server challenge required in which case an empty
string should be provided for this parameter. All mechanisms should accept
an initial empty challenge.</p></dd>
<dt><a name="4"><b class="cmd">::SASL::response</b> <i class="arg">context</i></a></dt>
<dd><p>Returns the next response string that should be sent to the server.</p></dd>
<dt><a name="5"><b class="cmd">::SASL::reset</b> <i class="arg">context</i></a></dt>
<dd><p>Re-initialize the SASL context. Discards any internal state and
permits the token to be reused.</p></dd>
<dt><a name="6"><b class="cmd">::SASL::cleanup</b> <i class="arg">context</i></a></dt>
<dd><p>Release all resources associated with the SASL context. The context
token may not be used again after this procedure has been called.</p></dd>
<dt><a name="7"><b class="cmd">::SASL::mechanisms</b> <span class="opt">?<i class="arg">type</i>?</span> <span class="opt">?<i class="arg">minimum</i>?</span></a></dt>
<dd><p>Returns a list of all the available SASL mechanisms. The list is
sorted by the mechanism preference value (see <b class="cmd">register</b>) with the
preferred mechanisms and the head of the list. Any mechanism with a 
preference value less than the<i class="arg">minimum</i> (which defaults to 0) is removed
from the returned list. This permits a security threshold to be set. Mechanisms
with a preference less that 25 transmit authentication are particularly
susceptible to eavesdropping and should not be provided unless a secure
channel is in use (eg: tls).</p>
<p>The <i class="arg">type</i> parameter
may be one of <i class="arg">client</i> or <i class="arg">server</i> and defaults to <i class="arg">client</i>.
Only mechanisms that have an implementation matching the <i class="arg">type</i> are 
returned (this permits servers to correctly declare support only for 
mechanisms that actually provide a server implementation).</p></dd>
<dt><a name="8"><b class="cmd">::SASL::register</b> <i class="arg">mechanism</i> <i class="arg">preference</i> <i class="arg">clientproc</i> <span class="opt">?<i class="arg">serverproc</i>?</span></a></dt>
<dd><p>New mechanisms can be added to the package by registering the
mechanism name and the implementing procedures. The server procedure
is optional. The preference value is an integer that is used to order
the list returned by the <b class="cmd">mechanisms</b> command. Higher values
indicate a preferred mechanism. If the mechanism is already registered
then the recorded values are updated.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">OPTIONS</a></h2>
<dl class="definitions">
<dt><b class="option">-callback</b></dt>
<dd><p>Specify a command to be evaluated when the SASL mechanism requires
information about the user. The command is called with the current
SASL context and a name specifying the information desired. See
<span class="sectref"><a href="#section6">EXAMPLES</a></span>.</p></dd>
<dt><b class="option">-mechanism</b></dt>
<dd><p>Set the SASL mechanism to be used. See <b class="cmd">mechanisms</b> for a list of
supported authentication mechanisms.</p></dd>
<dt><b class="option">-service</b></dt>
<dd><p>Set the service type for this context. Some mechanisms may make use of
this parameter (eg DIGEST-MD5, GSSAPI and Kerberos). If not set it
defaults to an empty string. If the <b class="option">-type</b> is set to 'server'
then this option should be set to a valid service identity. Some
examples of valid service names are smtp, ldap, beep and xmpp.</p></dd>
<dt><b class="option">-server</b></dt>
<dd><p>This option is used to set the server name used in SASL challenges
when operating as a SASL server.</p></dd>
<dt><b class="option">-type</b></dt>
<dd><p>The context type may be one of 'client' or 'server'. The default is to
operate as a client application and respond to server
challenges. Mechanisms may be written to support server-side SASL and
setting this option will cause each <b class="cmd">step</b> to issue the next
challenge. A new context must be created for each incoming client
connection when in server mode.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">CALLBACK PROCEDURE</a></h2>
<p>When the SASL framework requires any user details it will call the
procedure provided when the context was created with an argument that
specfies the item of information required.</p>
<p>In all cases a single response string should be returned.</p>
<dl class="definitions">
<dt>login</dt>
<dd><p>The callback procedure should return the users authorization identity.
Return an empty string unless this is to be different to the authentication
identity. Read [1] for a discussion about the specific meaning of
authorization and authentication identities within SASL.</p></dd>
<dt>username</dt>
<dd><p>The callback procedure should return the users authentication identity.
Read [1] for a discussion about the specific meaning of
authorization and authentication identities within SASL.</p></dd>
<dt>password</dt>
<dd><p>The callback procedure should return the password that matches the
authentication identity as used within the current realm.</p>
<p>For server mechanisms the password callback should always be called with 
the authentication identity and the realm as the first two parameters.</p></dd>
<dt>realm</dt>
<dd><p>Some SASL mechanisms use realms to partition authentication identities.
The realm string is protocol dependent and is often the current DNS
domain or in the case of the NTLM mechanism it is the Windows NT domain name.</p></dd>
<dt>hostname</dt>
<dd><p>Returns the client host name - typically [info host].</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">MECHANISMS</a></h2>
<dl class="definitions">
<dt>ANONYMOUS</dt>
<dd><p>As used in FTP this mechanism only passes an email address for
authentication. The ANONYMOUS mechanism is specified in [2].</p></dd>
<dt>PLAIN</dt>
<dd><p>This is the simplest mechanism. The users authentication details are
transmitted in plain text. This mechanism should not be provided
unless an encrypted link is in use - typically after SSL or TLS has
been negotiated.</p></dd>
<dt>LOGIN</dt>
<dd><p>The LOGIN [1] mechanism transmits the users details with base64
encoding. This is no more secure than PLAIN and likewise should not be
used without a secure link.</p></dd>
<dt>CRAM-MD5</dt>
<dd><p>This mechanism avoids sending the users password over the network in
plain text by hashing the password with a server provided random value
(known as a nonce). A disadvantage of this mechanism is that the
server must maintain a database of plaintext passwords for
comparison. CRAM-MD5 was defined in [4].</p></dd>
<dt>DIGEST-MD5</dt>
<dd><p>This mechanism improves upon the CRAM-MD5 mechanism by avoiding the
need for the server to store plaintext passwords. With digest
authentication the server needs to store the MD5 digest of the users
password which helps to make the system more secure. As in CRAM-MD5
the password is hashed with a server nonce and other data before being
transmitted across the network. Specified in [3].</p></dd>
<dt>OTP</dt>
<dd><p>OTP is the One-Time Password system described in RFC 2289 [6].
This mechanism is secure against replay attacks and also avoids storing
password or password equivalents on the server. Only a digest of a seed
and a passphrase is ever transmitted across the network. Requires the 
<b class="package"><a href="../otp/otp.html">otp</a></b> package from tcllib and one or more of the cryptographic 
digest packages (md5 or sha-1 are the most commonly used).</p></dd>
<dt>NTLM</dt>
<dd><p>This is a proprietary protocol developed by Microsoft [5] and is
in common use for authenticating users in a Windows network
environment. NTLM uses DES encryption and MD4 digests of the users
password to authenticate a connection. Certain weaknesses have been
found in NTLM and thus there are a number of versions of the protocol.
As this mechanism has additional dependencies it is made available as
a separate sub-package. To enable this mechanism your application must 
load the SASL::NTLM package.</p></dd>
<dt>X-GOOGLE-TOKEN</dt>
<dd><p>This is a proprietary protocol developed by Google and used for 
authenticating users for the Google Talk service. This mechanism makes
a pair of HTTP requests over an SSL channel and so this mechanism 
depends upon the availability of the tls and http packages. To enable
this mechanism your application must load the SASL::XGoogleToken package.
In addition you are recommended to make use of the autoproxy package to 
handle HTTP proxies reasonably transparently.</p></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">EXAMPLES</a></h2>
<p>See the examples subdirectory for more complete samples using SASL
with network protocols. The following should give an idea how the SASL
commands are to be used. In reality this should be event
driven. Each time the <b class="cmd">step</b> command is called, the last server
response should be provided as the command argument so that the SASL
mechanism can take appropriate action.</p>
<pre class="example">
proc ClientCallback {context command args} {
    switch -exact -- $command {
        login    { return &quot;&quot; }
        username { return $::tcl_platform(user) }
        password { return &quot;SecRet&quot; }
        realm    { return &quot;&quot; }
        hostname { return [info host] }
        default  { return -code error unxpected }
    }
}
proc Demo {{mech PLAIN}} {
    set ctx [SASL::new -mechanism $mech -callback ClientCallback]
    set challenge &quot;&quot;
    while {1} {
        set more_steps [SASL::step $ctx challenge]
        puts &quot;Send '[SASL::response $ctx]'&quot;
        puts &quot;Read server response into challenge var&quot;
        if {!$more_steps} {break}
    }
    SASL::cleanup $ctx
}
</pre>
</div>
<div id="section7" class="section"><h2><a name="section7">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Myers, J. &quot;Simple Authentication and Security Layer (SASL)&quot;,
    RFC 2222, October 1997.
    (<a href="http://www.ietf.org/rfc/rfc2222.txt">http://www.ietf.org/rfc/rfc2222.txt</a>)</p></li>
<li><p>Newman, C. &quot;Anonymous SASL Mechanism&quot;,
    RFC 2245, November 1997.
    (<a href="http://www.ietf.org/rfc/rfc2245.txt">http://www.ietf.org/rfc/rfc2245.txt</a>)</p></li>
<li><p>Leach, P., Newman, C. &quot;Using Digest Authentication as a SASL
    Mechanism&quot;, RFC 2831, May 2000,
    (<a href="http://www.ietf.org/rfc/rfc2831.txt">http://www.ietf.org/rfc/rfc2831.txt</a>)</p></li>
<li><p>Klensin, J., Catoe, R. and Krumviede, P.,
    &quot;IMAP/POP AUTHorize Extension for Simple Challenge/Response&quot;
    RFC 2195, September 1997.
    (<a href="http://www.ietf.org/rfc/rfc2195.txt">http://www.ietf.org/rfc/rfc2195.txt</a>)</p></li>
<li><p>No official specification is available. However,
    <a href="http://davenport.sourceforge.net/ntlm.html">http://davenport.sourceforge.net/ntlm.html</a> provides a good
    description.</p></li>
<li><p>Haller, N. et al., &quot;A One-Time Password System&quot;,
    RFC 2289, February 1998,
    (<a href="http://www.ieft.org/rfc/rfc2289.txt">http://www.ieft.org/rfc/rfc2289.txt</a>)</p></li>
</ol>
</div>
<div id="section8" class="section"><h2><a name="section8">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section9" class="section"><h2><a name="section9">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>sasl</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key741">SASL</a>, <a href="../../../../index.html#key740">authentication</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005-2006, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/sha1/sha1.html.
















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>sha1 - SHA-x Message-Digest Algorithm</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/sha1/sha1.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ sha1.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">sha1(n) 2.0.3 tcllib &quot;SHA-x Message-Digest Algorithm&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>sha1 - SHA1 Message-Digest Algorithm</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">sha1 <span class="opt">?2.0.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::sha1::sha1</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#2"><b class="cmd">::sha1::hmac</b> <i class="arg">key</i> <i class="arg">string</i></a></li>
<li><a href="#3"><b class="cmd">::sha1::hmac</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#4"><b class="cmd">::sha1::SHA1Init</b></a></li>
<li><a href="#5"><b class="cmd">::sha1::SHA1Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#6"><b class="cmd">::sha1::SHA1Final</b> <i class="arg">token</i></a></li>
<li><a href="#7"><b class="cmd">::sha1::HMACInit</b> <i class="arg">key</i></a></li>
<li><a href="#8"><b class="cmd">::sha1::HMACUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#9"><b class="cmd">::sha1::HMACFinal</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides an implementation in Tcl of the SHA1
message-digest algorithm as specified by FIPS PUB 180-1 (1). This
algorithm takes a message and generates a 160-bit digest from the
input. The SHA1 algorithm is related to the MD4 algorithm (2) but has
been strengthend against certain types of cryptographic attack. SHA1
should be used in preference to MD4 or MD5 in new applications.</p>
<p>This package also includes support for creating keyed message-digests
using the HMAC algorithm from RFC 2104 (3) with SHA1 as the
message-digest.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::sha1::sha1</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>The command takes a message and returns the SHA1 digest of this message
as a hexadecimal string. You may request the result as binary data by
giving <i class="arg">-bin</i>.</p>
<p>The data to be hashed can be specified either as a string argument to
the <b class="cmd">sha1</b> command, or as a filename or a pre-opened channel. If the 
<i class="arg">-filename</i> argument is given then the file is opened, the data read
and hashed and the file is closed. If the <i class="arg">-channel</i> argument is
given then data is read from the channel until the end of file. The
channel is not closed. <em>NOTE</em> use of the channel or filename
options results in the internal use of <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>. To avoid nested
event loops in Tk or tclhttpd applications you should use the
incremental programming API (see below).</p>
<p>Only one of <i class="arg">-file</i>, <i class="arg">-channel</i> or <i class="arg">string</i> should be given.</p></dd>
<dt><a name="2"><b class="cmd">::sha1::hmac</b> <i class="arg">key</i> <i class="arg">string</i></a></dt>
<dd></dd>
<dt><a name="3"><b class="cmd">::sha1::hmac</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate an Hashed Message Authentication digest (HMAC) using the SHA1
digest algorithm. HMACs are described in RFC 2104 (3) and provide an SHA1
digest that includes a key. All options other than <i class="arg">-key</i> are as
for the <b class="cmd">::sha1::sha1</b> command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<p>For the programmer, the SHA1 hash can be viewed as a bucket into which
one pours data. When you have finished, you extract a value that is
derived from the data that was poured into the bucket. The programming
interface to the SHA1 hash operates on a token (equivalent to the
bucket). You call <b class="cmd">SHA1Init</b> to obtain a token and then call 
<b class="cmd">SHA1Update</b> as many times as required to add data to the hash. To
release any resources and obtain the hash value, you then call 
<b class="cmd">SHA1Final</b>. An equivalent set of functions gives you a keyed digest
(HMAC).</p>
<p>If you have <b class="package">critcl</b> and have built the <b class="package">tcllibc</b> package
then the implementation of the hashing function will be performed by compiled
code. Failing that if you have the <b class="package">Trf</b> package then this can
be used otherwise there is a pure-tcl equivalent. The programming
interface remains the same in all cases.</p>
<dl class="definitions">
<dt><a name="4"><b class="cmd">::sha1::SHA1Init</b></a></dt>
<dd><p>Begins a new SHA1 hash. Returns a token ID that must be used for the
remaining functions.</p></dd>
<dt><a name="5"><b class="cmd">::sha1::SHA1Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd><p>Add data to the hash identified by token. Calling 
<em>SHA1Update $token &quot;abcd&quot;</em> is equivalent to calling
<em>SHA1Update $token &quot;ab&quot;</em> followed by 
<em>SHA1Update $token &quot;cb&quot;</em>. See <span class="sectref"><a href="#section4">EXAMPLES</a></span>.</p></dd>
<dt><a name="6"><b class="cmd">::sha1::SHA1Final</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 20 bytes representing the 160 bit SHA1
digest value.</p></dd>
<dt><a name="7"><b class="cmd">::sha1::HMACInit</b> <i class="arg">key</i></a></dt>
<dd><p>This is equivalent to the <b class="cmd">::sha1::SHA1Init</b> command except that
it requires the key that will be included in the HMAC.</p></dd>
<dt><a name="8"><b class="cmd">::sha1::HMACUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="9"><b class="cmd">::sha1::HMACFinal</b> <i class="arg">token</i></a></dt>
<dd><p>These commands are identical to the SHA1 equivalent commands.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% sha1::sha1 &quot;Tcl does SHA1&quot;
285a6a91c45a9066bf39fcf24425796ef0b2a8bf
</pre>
<pre class="example">
% sha1::hmac Sekret &quot;Tcl does SHA1&quot;
ae6251fa51b95b18cba2be95eb031d07475ff03c
</pre>
<pre class="example">
% set tok [sha1::SHA1Init]
::sha1::1
% sha1::SHA1Update $tok &quot;Tcl &quot;
% sha1::SHA1Update $tok &quot;does &quot;
% sha1::SHA1Update $tok &quot;SHA1&quot;
% sha1::Hex [sha1::SHA1Final $tok]
285a6a91c45a9066bf39fcf24425796ef0b2a8bf
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>&quot;Secure Hash Standard&quot;, National Institute of Standards
        and Technology, U.S. Department Of Commerce, April 1995.
	(<a href="http://www.itl.nist.gov/fipspubs/fip180-1.htm">http://www.itl.nist.gov/fipspubs/fip180-1.htm</a>)</p></li>
<li><p>Rivest, R., &quot;The MD4 Message Digest Algorithm&quot;, RFC 1320, MIT,
       April 1992. (<a href="http://www.rfc-editor.org/rfc/rfc1320.txt">http://www.rfc-editor.org/rfc/rfc1320.txt</a>)</p></li>
<li><p>Krawczyk, H., Bellare, M. and Canetti, R. &quot;HMAC: Keyed-Hashing for 
      Message Authentication&quot;, RFC 2104, February 1997.
	(<a href="http://www.rfc-editor.org/rfc/rfc2104.txt">http://www.rfc-editor.org/rfc/rfc2104.txt</a>)</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>sha1</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../md4/md4.html">md4</a>, <a href="../md5/md5.html">md5</a>, <a href="../ripemd/ripemd128.html">ripemd128</a>, <a href="../ripemd/ripemd160.html">ripemd160</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key191">FIPS 180-1</a>, <a href="../../../../index.html#key195">hashing</a>, <a href="../../../../index.html#key194">message-digest</a>, <a href="../../../../index.html#key193">rfc 2104</a>, <a href="../../../../index.html#key110">security</a>, <a href="../../../../index.html#key392">sha1</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/sha1/sha256.html.

























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>sha256 - SHA-x Message-Digest Algorithm</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/sha1/sha256.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008, Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ sha256.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">sha256(n) 1.0.3 tcllib &quot;SHA-x Message-Digest Algorithm&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>sha256 - SHA256 Message-Digest Algorithm</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">PROGRAMMING INTERFACE</a></li>
<li class="section"><a href="#section4">EXAMPLES</a></li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">sha256 <span class="opt">?1.0.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::sha2::sha256</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#2"><b class="cmd">::sha2::sha224</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#3"><b class="cmd">::sha2::hmac</b> <i class="arg">key</i> <i class="arg">string</i></a></li>
<li><a href="#4"><b class="cmd">::sha2::hmac</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></li>
<li><a href="#5"><b class="cmd">::sha2::SHA256Init</b></a></li>
<li><a href="#6"><b class="cmd">::sha2::SHA224Init</b></a></li>
<li><a href="#7"><b class="cmd">::sha2::SHA256Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#8"><b class="cmd">::sha2::SHA256Final</b> <i class="arg">token</i></a></li>
<li><a href="#9"><b class="cmd">::sha2::SHA224Final</b> <i class="arg">token</i></a></li>
<li><a href="#10"><b class="cmd">::sha2::HMACInit</b> <i class="arg">key</i></a></li>
<li><a href="#11"><b class="cmd">::sha2::HMACUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></li>
<li><a href="#12"><b class="cmd">::sha2::HMACFinal</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides an implementation in Tcl of the SHA256 and
SHA224 message-digest algorithms as specified by FIPS PUB 180-1
(1). These algorithms take a message and generates a 256-bit (224-bit)
digest from the input. The SHA2 algorithms are related to the SHA1
algorithm.</p>
<p>This package also includes support for creating keyed message-digests
using the HMAC algorithm from RFC 2104 (3) with SHA256 as the
message-digest.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::sha2::sha256</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>The command takes a message and returns the SHA256 digest of this
message as a hexadecimal string. You may request the result as binary
data by giving <i class="arg">-bin</i>.</p>
<p>The data to be hashed can be specified either as a string argument to
the <b class="cmd">sha256</b> command, or as a filename or a pre-opened channel. If the 
<i class="arg">-filename</i> argument is given then the file is opened, the data read
and hashed and the file is closed. If the <i class="arg">-channel</i> argument is
given then data is read from the channel until the end of file. The
channel is not closed. <em>NOTE</em> use of the channel or filename
options results in the internal use of <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>. To avoid nested
event loops in Tk or tclhttpd applications you should use the
incremental programming API (see below).</p>
<p>Only one of <i class="arg">-file</i>, <i class="arg">-channel</i> or <i class="arg">string</i> should be given.</p></dd>
<dt><a name="2"><b class="cmd">::sha2::sha224</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Like <b class="cmd">::sha2::sha256</b>, except that the SHA224 digest is returned.</p></dd>
<dt><a name="3"><b class="cmd">::sha2::hmac</b> <i class="arg">key</i> <i class="arg">string</i></a></dt>
<dd></dd>
<dt><a name="4"><b class="cmd">::sha2::hmac</b> <span class="opt">?<i class="arg">-hex|-bin</i>?</span> <i class="arg">-key key</i> [ <i class="arg">-channel channel</i> | <i class="arg">-file filename</i> | <i class="arg">string</i> ]</a></dt>
<dd><p>Calculate an Hashed Message Authentication digest (HMAC) using the
SHA256 digest algorithm. HMACs are described in RFC 2104 (3) and
provide an SHA256 digest that includes a key. All options other than
<i class="arg">-key</i> are as for the <b class="cmd">::sha2::sha256</b> command.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROGRAMMING INTERFACE</a></h2>
<p>For the programmer, the SHA256 hash can be viewed as a bucket into
which one pours data. When you have finished, you extract a value that
is derived from the data that was poured into the bucket. The
programming interface to the SHA256 hash operates on a token
(equivalent to the bucket). You call <b class="cmd">SHA256Init</b> to obtain a
token and then call <b class="cmd">SHA256Update</b> as many times as required to
add data to the hash. To release any resources and obtain the hash
value, you then call <b class="cmd">SHA256Final</b>. An equivalent set of
functions gives you a keyed digest (HMAC).</p>
<p>If you have <b class="package">critcl</b> and have built the <b class="package">tcllibc</b>
package then the implementation of the hashing function will be
performed by compiled code. Failing that there is a pure-tcl
equivalent. The programming interface remains the same in all cases.</p>
<dl class="definitions">
<dt><a name="5"><b class="cmd">::sha2::SHA256Init</b></a></dt>
<dd></dd>
<dt><a name="6"><b class="cmd">::sha2::SHA224Init</b></a></dt>
<dd><p>Begins a new SHA256/SHA224 hash. Returns a token ID that must be used
for the remaining functions.</p></dd>
<dt><a name="7"><b class="cmd">::sha2::SHA256Update</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd><p>Add data to the hash identified by token. Calling 
<em>SHA256Update $token &quot;abcd&quot;</em> is equivalent to calling
<em>SHA256Update $token &quot;ab&quot;</em> followed by 
<em>SHA256Update $token &quot;cb&quot;</em>. See <span class="sectref"><a href="#section4">EXAMPLES</a></span>.
Note that this command is used for both SHA256 and SHA224. Only the
initialization and finalization commands of both hashes differ.</p></dd>
<dt><a name="8"><b class="cmd">::sha2::SHA256Final</b> <i class="arg">token</i></a></dt>
<dd></dd>
<dt><a name="9"><b class="cmd">::sha2::SHA224Final</b> <i class="arg">token</i></a></dt>
<dd><p>Returns the hash value and releases any resources held by this
token. Once this command completes the token will be invalid. The
result is a binary string of 32/28 bytes representing the 256/224 bit
SHA256 / SHA224 digest value.</p></dd>
<dt><a name="10"><b class="cmd">::sha2::HMACInit</b> <i class="arg">key</i></a></dt>
<dd><p>This is equivalent to the <b class="cmd">::sha2::SHA256Init</b> command except
that it requires the key that will be included in the HMAC.</p></dd>
<dt><a name="11"><b class="cmd">::sha2::HMACUpdate</b> <i class="arg">token</i> <i class="arg">data</i></a></dt>
<dd></dd>
<dt><a name="12"><b class="cmd">::sha2::HMACFinal</b> <i class="arg">token</i></a></dt>
<dd><p>These commands are identical to the SHA256 equivalent commands.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="example">
% sha2::sha256 &quot;Tcl does SHA256&quot;
0b91043ee484abd83c3e4b08d6034d71b937026379f0f59bda6e625e6e214789
</pre>
<pre class="example">
% sha2::hmac Sekret &quot;Tcl does SHA256&quot;
4f9352c64d655e8a36abe73e6163a9d7a54039877c1c92ec90b07d48d4e854e0
</pre>
<pre class="example">
% set tok [sha2::SHA256Init]
::sha2::1
% sha2::SHA256Update $tok &quot;Tcl &quot;
% sha2::SHA256Update $tok &quot;does &quot;
% sha2::SHA256Update $tok &quot;SHA256&quot;
% sha2::Hex [sha2::SHA256Final $tok]
0b91043ee484abd83c3e4b08d6034d71b937026379f0f59bda6e625e6e214789
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>&quot;Secure Hash Standard&quot;, National Institute of Standards
        and Technology, U.S. Department Of Commerce, April 1995.
	(<a href="http://www.itl.nist.gov/fipspubs/fip180-1.htm">http://www.itl.nist.gov/fipspubs/fip180-1.htm</a>)</p></li>
<li><p>Rivest, R., &quot;The MD4 Message Digest Algorithm&quot;, RFC 1320, MIT,
       April 1992. (<a href="http://www.rfc-editor.org/rfc/rfc1320.txt">http://www.rfc-editor.org/rfc/rfc1320.txt</a>)</p></li>
<li><p>Krawczyk, H., Bellare, M. and Canetti, R. &quot;HMAC: Keyed-Hashing for 
      Message Authentication&quot;, RFC 2104, February 1997.
	(<a href="http://www.rfc-editor.org/rfc/rfc2104.txt">http://www.rfc-editor.org/rfc/rfc2104.txt</a>)</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>sha1</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../md4/md4.html">md4</a>, <a href="../md5/md5.html">md5</a>, <a href="../ripemd/ripemd128.html">ripemd128</a>, <a href="../ripemd/ripemd160.html">ripemd160</a>, <a href="sha1.html">sha1</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key191">FIPS 180-1</a>, <a href="../../../../index.html#key195">hashing</a>, <a href="../../../../index.html#key194">message-digest</a>, <a href="../../../../index.html#key193">rfc 2104</a>, <a href="../../../../index.html#key110">security</a>, <a href="../../../../index.html#key192">sha256</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008, Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/simulation/annealing.html.





































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>simulation::annealing - Tcl Simulation Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/simulation/annealing.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Arjen Markus &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ simulation::annealing.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">simulation::annealing(n) 0.2 tcllib &quot;Tcl Simulation Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>simulation::annealing - Simulated annealing</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">TIPS</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.4?</span></b></li>
<li>package require <b class="pkgname">simulation::annealing 0.2</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::simulation::annealing::getOption</b> <i class="arg">keyword</i></a></li>
<li><a href="#2"><b class="cmd">::simulation::annealing::hasOption</b> <i class="arg">keyword</i></a></li>
<li><a href="#3"><b class="cmd">::simulation::annealing::setOption</b> <i class="arg">keyword</i> <i class="arg">value</i></a></li>
<li><a href="#4"><b class="cmd">::simulation::annealing::findMinimum</b> <i class="arg">args</i></a></li>
<li><a href="#5"><b class="cmd">::simulation::annealing::findCombinatorialMinimum</b> <i class="arg">args</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The technique of <em>simulated annealing</em> provides methods to
estimate the global optimum of a function. It is described in some
detail on the Wiki <a href="http://wiki.tcl.tk/...">http://wiki.tcl.tk/...</a>. The idea is simple:</p>
<ul class="itemized">
<li><p>randomly select points within a given search space</p></li>
<li><p>evaluate the function to be optimised for each of these
points and select the point that has the lowest (or highest)
function value or - sometimes - accept a point that has a less optimal
value. The chance by which such a non-optimal point is accepted diminishes over
time.</p></li>
<li><p>Accepting less optimal points means the method does not necessarily get
stuck in a local optimum and theoretically it is capable of finding the
global optimum within the search space.</p></li>
</ul>
<p>The method resembles the cooling of material, hence the name.</p>
<p>The package <i class="term">simulation::annealing</i> offers the command <i class="term">findMinimum</i>:</p>
<pre class="example">
    puts [::simulation::annealing::findMinimum  -trials 300  -parameters {x -5.0 5.0 y -5.0 5.0}  -function {$x*$x+$y*$y+sin(10.0*$x)+4.0*cos(20.0*$y)}]
</pre>
<p>prints the estimated minimum value of the function f(x,y) =
<em>x**2+y**2+sin(10*x)+4*cos(20*y)</em> and the values of x and y where
the minimum was attained:</p>
<pre class="example">
result -4.9112922923 x -0.181647676593 y 0.155743646974
</pre>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The package defines the following auxiliary procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::simulation::annealing::getOption</b> <i class="arg">keyword</i></a></dt>
<dd><p>Get the value of an option given as part of the <i class="term">findMinimum</i>
command.</p>
<dl class="arguments">
<dt>string <i class="arg">keyword</i></dt>
<dd><p>Given keyword (without leading minus)</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::simulation::annealing::hasOption</b> <i class="arg">keyword</i></a></dt>
<dd><p>Returns 1 if the option is available, 0 if not.</p>
<dl class="arguments">
<dt>string <i class="arg">keyword</i></dt>
<dd><p>Given keyword (without leading minus)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::simulation::annealing::setOption</b> <i class="arg">keyword</i> <i class="arg">value</i></a></dt>
<dd><p>Set the value of the given option.</p>
<dl class="arguments">
<dt>string <i class="arg">keyword</i></dt>
<dd><p>Given keyword (without leading minus)</p></dd>
<dt>string <i class="arg">value</i></dt>
<dd><p>(New) value for the option</p></dd>
</dl></dd>
</dl>
<p>The main procedures are <i class="term">findMinimum</i> and <i class="term">findCombinatorialMinimum</i>:</p>
<dl class="definitions">
<dt><a name="4"><b class="cmd">::simulation::annealing::findMinimum</b> <i class="arg">args</i></a></dt>
<dd><p>Find the minimum of a function using simulated annealing. The function
and the method's parameters is given via a list of
keyword-value pairs.</p>
<dl class="arguments">
<dt>int <i class="arg">n</i></dt>
<dd><p>List of keyword-value pairs, all of which are available
during the execution via the <i class="term">getOption</i> command.</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::simulation::annealing::findCombinatorialMinimum</b> <i class="arg">args</i></a></dt>
<dd><p>Find the minimum of a function of discrete variables using simulated
annealing. The function and the method's parameters is given via a list of
keyword-value pairs.</p>
<dl class="arguments">
<dt>int <i class="arg">n</i></dt>
<dd><p>List of keyword-value pairs, all of which are available
during the execution via the <i class="term">getOption</i> command.</p></dd>
</dl></dd>
</dl>
<p>The <i class="term">findMinimum</i> command predefines the following options:</p>
<ul class="itemized">
<li><p><i class="term">-parameters list</i>: triples defining parameters and ranges</p></li>
<li><p><i class="term">-function expr</i>: expression defining the function</p></li>
<li><p><i class="term">-code body</i>: body of code to define the function (takes
precedence over <i class="term">-function</i>). The code should set the variable
&quot;result&quot;</p></li>
<li><p><i class="term">-init code</i>: code to be run at start up
<i class="term">-final code</i>: code to be run at the end
<i class="term">-trials n</i>: number of trials before reducing the temperature
<i class="term">-reduce factor</i>: reduce the temperature by this factor (between 0 and 1)
<i class="term">-initial-temp t</i>: initial temperature
<i class="term">-scale s</i>: scale of the function (order of magnitude of the values)
<i class="term">-estimate-scale y/n</i>: estimate the scale (only if <i class="term">-scale</i>
is not present)
<i class="term">-verbose y/n</i>: print detailed information on progress to the
report file (1) or not (0)
<i class="term">-reportfile file</i>: opened file to print to (defaults to stdout)</p></li>
</ul>
<p>Any other options can be used via the getOption procedure
in the body.
The <i class="term">findCombinatorialMinimum</i> command predefines the following
options:</p>
<ul class="itemized">
<li><p><i class="term">-number-params n</i>: number of binary parameters (the solution
space consists of lists of 1s and 0s). This is a required option.</p></li>
<li><p><i class="term">-initial-values</i>: list of 1s and 0s constituting the start of
the search.</p></li>
</ul>
<p>The other predefined options are identical to those of <i class="term">findMinimum</i>.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">TIPS</a></h2>
<p>The procedure <i class="term">findMinimum</i> works by constructing a temporary
procedure that does the actual work. It loops until the point
representing the estimated optimum does not change anymore within the
given number of trials. As the temperature gets lower and lower the
chance of accepting a point with a higher value becomes lower too, so
the procedure will in practice terminate.</p>
<p>It is possible to optimise over a non-rectangular region, but some care
must be taken:</p>
<ul class="itemized">
<li><p>If the point is outside the region of interest, you can specify a very
high value.</p></li>
<li><p>This does mean that the automatic determination of a scale factor is
out of the question - the high function values that force the point
inside the region would distort the estimation.</p></li>
</ul>
<p>Here is an example of finding an optimum inside a circle:</p>
<pre class="example">
    puts [::simulation::annealing::findMinimum  -trials 3000  -reduce 0.98  -parameters {x -5.0 5.0 y -5.0 5.0}  -code {
            if { hypot($x-5.0,$y-5.0) &lt; 4.0 } {
                set result [expr {$x*$x+$y*$y+sin(10.0*$x)+4.0*cos(20.0*$y)}]
            } else {
                set result 1.0e100
            }
        }]
</pre>
<p>The method is theoretically capable of determining the global optimum,
but often you need to use a large number of trials and a slow reduction
of temperature to get reliable and repeatable estimates.</p>
<p>You can use the <i class="term">-final</i> option to use a deterministic optimization
method, once you are sure you are near the required optimum.</p>
<p>The <i class="term">findCombinatorialMinimum</i> procedure is suited for situations
where the parameters have the values 0 or 1 (and there can be many of
them). Here is an example:</p>
<ul class="itemized">
<li><p>We have a function that attains an absolute minimum if the first ten
numbers are 1 and the rest is 0:</p>
<pre class="example">
proc cost {params} {
    set cost 0
    foreach p [lrange $params 0 9] {
        if { $p == 0 } {
            incr cost
        }
    }
    foreach p [lrange $params 10 end] {
        if { $p == 1 } {
            incr cost
        }
    }
    return $cost
}
</pre>
</li>
<li><p>We want to find the solution that gives this minimum for various lengths
of the solution vector <i class="term">params</i>:</p>
<pre class="example">
foreach n {100 1000 10000} {
    break
    puts &quot;Problem size: $n&quot;
    puts [::simulation::annealing::findCombinatorialMinimum  -trials 300  -verbose 0  -number-params $n  -code {set result [cost $params]}]
}
</pre>
</li>
<li><p>As the vector grows, the computation time increases, but the procedure
will stop if some kind of equilibrium is reached. To achieve a useful
solution you may want to try different values of the trials parameter
for instance. Also ensure that the function to be minimized depends on
all or most parameters - see the source code for a counter example and
run that.</p></li>
</ul>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key264">optimization</a>, <a href="../../../../index.html#key284">simulated annealing</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Arjen Markus &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/simulation/montecarlo.html.








































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>simulation::montecarlo - Tcl Simulation Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/simulation/montecarlo.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Arjen Markus &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ simulation::montecarlo.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">simulation::montecarlo(n) 0.1 tcllib &quot;Tcl Simulation Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>simulation::montecarlo - Monte Carlo simulations</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#section3">TIPS</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.4?</span></b></li>
<li>package require <b class="pkgname">simulation::montecarlo 0.1</b></li>
<li>package require <b class="pkgname">simulation::random</b></li>
<li>package require <b class="pkgname">math::statistics</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::simulation::montecarlo::getOption</b> <i class="arg">keyword</i></a></li>
<li><a href="#2"><b class="cmd">::simulation::montecarlo::hasOption</b> <i class="arg">keyword</i></a></li>
<li><a href="#3"><b class="cmd">::simulation::montecarlo::setOption</b> <i class="arg">keyword</i> <i class="arg">value</i></a></li>
<li><a href="#4"><b class="cmd">::simulation::montecarlo::setTrialResult</b> <i class="arg">values</i></a></li>
<li><a href="#5"><b class="cmd">::simulation::montecarlo::setExpResult</b> <i class="arg">values</i></a></li>
<li><a href="#6"><b class="cmd">::simulation::montecarlo::getTrialResults</b></a></li>
<li><a href="#7"><b class="cmd">::simulation::montecarlo::getExpResult</b></a></li>
<li><a href="#8"><b class="cmd">::simulation::montecarlo::transposeData</b> <i class="arg">values</i></a></li>
<li><a href="#9"><b class="cmd">::simulation::montecarlo::integral2D</b> <i class="arg">...</i></a></li>
<li><a href="#10"><b class="cmd">::simulation::montecarlo::singleExperiment</b> <i class="arg">args</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The technique of <em>Monte Carlo simulations</em> is basically simple:</p>
<ul class="itemized">
<li><p>generate random values for one or more parameters.</p></li>
<li><p>evaluate the model of some system you are interested in and record the
interesting results for each realisation of these parameters.</p></li>
<li><p>after a suitable number of such trials, deduce an overall characteristic
of the model.</p></li>
</ul>
<p>You can think of a model of a network of computers, an ecosystem of some
kind or in fact anything that can be quantitatively described and has
some stochastic element in it.</p>
<p>The package <i class="term">simulation::montecarlo</i> offers a basic framework for
such a modelling technique:</p>
<pre class="example">
#
# MC experiments:
# Determine the mean and median of a set of points and compare them
#
::simulation::montecarlo::singleExperiment -init {
    package require math::statistics
    set prng [::simulation::random::prng_Normal 0.0 1.0]
} -loop {
    set numbers {}
    for { set i 0 } { $i &lt; [getOption samples] } { incr i } {
        lappend numbers [$prng]
    }
    set mean   [::math::statistics::mean $numbers]
    set median [::math::statistics::median $numbers] ;# ? Exists?
    setTrialResult [list $mean $median]
} -final {
    set result [getTrialResults]
    set means   {}
    set medians {}
    foreach r $result {
        foreach {m M} $r break
        lappend means   $m
        lappend medians $M
    }
    puts [getOption reportfile] &quot;Correlation: [::math::statistics::corr $means $medians]&quot;
} -trials 100 -samples 10 -verbose 1 -columns {Mean Median}
</pre>
<p>This example attemps to find out how well the median value and the mean
value of a random set of numbers correlate. Sometimes a median value is
a more robust characteristic than a mean value - especially if you have
a statistical distribution with &quot;fat&quot; tails.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The package defines the following auxiliary procedures:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::simulation::montecarlo::getOption</b> <i class="arg">keyword</i></a></dt>
<dd><p>Get the value of an option given as part of the <i class="term">singeExperiment</i> command.</p>
<dl class="arguments">
<dt>string <i class="arg">keyword</i></dt>
<dd><p>Given keyword (without leading minus)</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::simulation::montecarlo::hasOption</b> <i class="arg">keyword</i></a></dt>
<dd><p>Returns 1 if the option is available, 0 if not.</p>
<dl class="arguments">
<dt>string <i class="arg">keyword</i></dt>
<dd><p>Given keyword (without leading minus)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::simulation::montecarlo::setOption</b> <i class="arg">keyword</i> <i class="arg">value</i></a></dt>
<dd><p>Set the value of the given option.</p>
<dl class="arguments">
<dt>string <i class="arg">keyword</i></dt>
<dd><p>Given keyword (without leading minus)</p></dd>
<dt>string <i class="arg">value</i></dt>
<dd><p>(New) value for the option</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::simulation::montecarlo::setTrialResult</b> <i class="arg">values</i></a></dt>
<dd><p>Store the results of the trial for later analysis</p>
<dl class="arguments">
<dt>list <i class="arg">values</i></dt>
<dd><p>List of values to be stored</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::simulation::montecarlo::setExpResult</b> <i class="arg">values</i></a></dt>
<dd><p>Set the results of the entire experiment (typically used in the final
phase).</p>
<dl class="arguments">
<dt>list <i class="arg">values</i></dt>
<dd><p>List of values to be stored</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::simulation::montecarlo::getTrialResults</b></a></dt>
<dd><p>Get the results of all individual trials for analysis (typically used in
the final phase or after completion of the command).</p></dd>
<dt><a name="7"><b class="cmd">::simulation::montecarlo::getExpResult</b></a></dt>
<dd><p>Get the results of the entire experiment (typically used in the final
phase or even after completion of the <i class="term">singleExperiment</i> command).</p></dd>
<dt><a name="8"><b class="cmd">::simulation::montecarlo::transposeData</b> <i class="arg">values</i></a></dt>
<dd><p>Interchange columns and rows of a list of lists and return the result.</p>
<dl class="arguments">
<dt>list <i class="arg">values</i></dt>
<dd><p>List of lists of values</p></dd>
</dl></dd>
</dl>
<p>There are two main procedures: <i class="term">integral2D</i> and <i class="term">singleExperiment</i>.</p>
<dl class="definitions">
<dt><a name="9"><b class="cmd">::simulation::montecarlo::integral2D</b> <i class="arg">...</i></a></dt>
<dd><p>Integrate a function over a two-dimensional region using a Monte Carlo
approach.</p>
<p>Arguments PM</p></dd>
<dt><a name="10"><b class="cmd">::simulation::montecarlo::singleExperiment</b> <i class="arg">args</i></a></dt>
<dd><p>Iterate code over a number of trials and store the results. The
iteration is gouverned by parameters given via a list of
keyword-value pairs.</p>
<dl class="arguments">
<dt>int <i class="arg">n</i></dt>
<dd><p>List of keyword-value pairs, all of which are available
during the execution via the <i class="term">getOption</i> command.</p></dd>
</dl></dd>
</dl>
<p>The <i class="term">singleExperiment</i> command predefines the following
options:</p>
<ul class="itemized">
<li><p><i class="term">-init code</i>: code to be run at start up</p></li>
<li><p><i class="term">-loop body</i>: body of code that defines the computation to
be run time and again. The code should use <i class="term">setTrialResult</i>
to store the results of each trial (typically a list of numbers,
but the interpretation is up to the implementation). Note: Required keyword.</p></li>
<li><p><i class="term">-final code</i>: code to be run at the end</p></li>
<li><p><i class="term">-trials n</i>: number of trials in the experiment (required)</p></li>
<li><p><i class="term">-reportfile file</i>: opened file to send the output to (default: stdout)</p></li>
<li><p><i class="term">-verbose</i>: write the intermediate results (1) or not (0) (default: 0)</p></li>
<li><p><i class="term">-analysis proc</i>: either &quot;none&quot; (no automatic analysis), standard
(basic statistics of the trial results and a correlation matrix) or the
name of a procedure that will take care of the analysis.</p></li>
<li><p><i class="term">-columns list</i>: list of column names, useful for verbose output
and the analysis</p></li>
</ul>
<p>Any other options can be used via the getOption procedure
in the body.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">TIPS</a></h2>
<p>The procedure <i class="term">singleExperiment</i> works by constructing a
temporary procedure that does the actual work. It loops for the given
number of trials.</p>
<p>As it constructs a temporary procedure, local variables defined at the
start continue to exist in the loop.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key689">montecarlo simulation</a>, <a href="../../../../index.html#key688">stochastic modelling</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Arjen Markus &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/simulation/simulation_random.html.
















































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>simulation::random - Tcl Simulation Tools</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/simulation/simulation_random.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ simulation::random.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">simulation::random(n) 0.1 tcllib &quot;Tcl Simulation Tools&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>simulation::random - Pseudo-random number generators</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">PROCEDURES</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl <span class="opt">?8.4?</span></b></li>
<li>package require <b class="pkgname">simulation::random 0.1</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::simulation::random::prng_Bernoulli</b> <i class="arg">p</i></a></li>
<li><a href="#2"><b class="cmd">::simulation::random::prng_Discrete</b> <i class="arg">n</i></a></li>
<li><a href="#3"><b class="cmd">::simulation::random::prng_Poisson</b> <i class="arg">lambda</i></a></li>
<li><a href="#4"><b class="cmd">::simulation::random::prng_Uniform</b> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#5"><b class="cmd">::simulation::random::prng_Exponential</b> <i class="arg">min</i> <i class="arg">mean</i></a></li>
<li><a href="#6"><b class="cmd">::simulation::random::prng_Normal</b> <i class="arg">mean</i> <i class="arg">stdev</i></a></li>
<li><a href="#7"><b class="cmd">::simulation::random::prng_Pareto</b> <i class="arg">min</i> <i class="arg">steep</i></a></li>
<li><a href="#8"><b class="cmd">::simulation::random::prng_Gumbel</b> <i class="arg">min</i> <i class="arg">f</i></a></li>
<li><a href="#9"><b class="cmd">::simulation::random::prng_chiSquared</b> <i class="arg">df</i></a></li>
<li><a href="#10"><b class="cmd">::simulation::random::prng_Disk</b> <i class="arg">rad</i></a></li>
<li><a href="#11"><b class="cmd">::simulation::random::prng_Sphere</b> <i class="arg">rad</i></a></li>
<li><a href="#12"><b class="cmd">::simulation::random::prng_Ball</b> <i class="arg">rad</i></a></li>
<li><a href="#13"><b class="cmd">::simulation::random::prng_Rectangle</b> <i class="arg">length</i> <i class="arg">width</i></a></li>
<li><a href="#14"><b class="cmd">::simulation::random::prng_Block</b> <i class="arg">length</i> <i class="arg">width</i> <i class="arg">depth</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package consists of commands to generate pseudo-random number
generators. These new commands deliver</p>
<ul class="itemized">
<li><p>numbers that are distributed normally, uniformly, according to a
Pareto or Gumbel distribution and so on</p></li>
<li><p>coordinates of points uniformly spread inside a sphere or a rectangle</p></li>
</ul>
<p>For example:</p>
<pre class="example">
    set p [::simulation::random::prng_Normal -1.0 10.0]
</pre>
<p>produces a new command (whose name is stored in the variable &quot;p&quot;) that
generates normally distributed numbers with a mean of -1.0 and a
standard deviation of 10.0.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">PROCEDURES</a></h2>
<p>The package defines the following public procedures for <em>discrete</em>
distributions:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::simulation::random::prng_Bernoulli</b> <i class="arg">p</i></a></dt>
<dd><p>Create a command (PRNG) that generates numbers with a Bernoulli
distribution: the value is either 1 or 0, with a chance p to be 1</p>
<dl class="arguments">
<dt>float <i class="arg">p</i></dt>
<dd><p>Chance the outcome is 1</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::simulation::random::prng_Discrete</b> <i class="arg">n</i></a></dt>
<dd><p>Create a command (PRNG) that generates numbers 0 to n-1 with equal
probability.</p>
<dl class="arguments">
<dt>int <i class="arg">n</i></dt>
<dd><p>Number of different values (ranging from 0 to n-1)</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::simulation::random::prng_Poisson</b> <i class="arg">lambda</i></a></dt>
<dd><p>Create a command (PRNG) that generates numbers according to the Poisson
distribution.</p>
<dl class="arguments">
<dt>float <i class="arg">lambda</i></dt>
<dd><p>Mean number per time interval</p></dd>
</dl></dd>
</dl>
<p>The package defines the following public procedures for <em>continuous</em> distributions:</p>
<dl class="definitions">
<dt><a name="4"><b class="cmd">::simulation::random::prng_Uniform</b> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>Create a command (PRNG) that generates uniformly distributed numbers
between &quot;min&quot; and &quot;max&quot;.</p>
<dl class="arguments">
<dt>float <i class="arg">min</i></dt>
<dd><p>Minimum number that will be generated</p></dd>
<dt>float <i class="arg">max</i></dt>
<dd><p>Maximum number that will be generated</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::simulation::random::prng_Exponential</b> <i class="arg">min</i> <i class="arg">mean</i></a></dt>
<dd><p>Create a command (PRNG) that generates exponentially distributed numbers
with a given minimum value and a given mean value.</p>
<dl class="arguments">
<dt>float <i class="arg">min</i></dt>
<dd><p>Minimum number that will be generated</p></dd>
<dt>float <i class="arg">mean</i></dt>
<dd><p>Mean value for the numbers</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::simulation::random::prng_Normal</b> <i class="arg">mean</i> <i class="arg">stdev</i></a></dt>
<dd><p>Create a command (PRNG) that generates normally distributed numbers
with a given mean value and a given standard deviation.</p>
<dl class="arguments">
<dt>float <i class="arg">mean</i></dt>
<dd><p>Mean value for the numbers</p></dd>
<dt>float <i class="arg">stdev</i></dt>
<dd><p>Standard deviation</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::simulation::random::prng_Pareto</b> <i class="arg">min</i> <i class="arg">steep</i></a></dt>
<dd><p>Create a command (PRNG) that generates numbers distributed according to
Pareto with a given minimum value and a given distribution steepness.</p>
<dl class="arguments">
<dt>float <i class="arg">min</i></dt>
<dd><p>Minimum number that will be generated</p></dd>
<dt>float <i class="arg">steep</i></dt>
<dd><p>Steepness of the distribution</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::simulation::random::prng_Gumbel</b> <i class="arg">min</i> <i class="arg">f</i></a></dt>
<dd><p>Create a command (PRNG) that generates numbers distributed according to
Gumbel with a given minimum value and a given scale factor. The
probability density function is:</p>
<pre class="example">
     P(v) = exp( -exp(f*(v-min)))
</pre>
<dl class="arguments">
<dt>float <i class="arg">min</i></dt>
<dd><p>Minimum number that will be generated</p></dd>
<dt>float <i class="arg">f</i></dt>
<dd><p>Scale factor for the values</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::simulation::random::prng_chiSquared</b> <i class="arg">df</i></a></dt>
<dd><p>Create a command (PRNG) that generates numbers distributed according to
the chi-squared distribution with df degrees of freedom. The mean is 0
and the standard deviation is 1.</p>
<dl class="arguments">
<dt>float <i class="arg">df</i></dt>
<dd><p>Degrees of freedom</p></dd>
</dl></dd>
</dl>
<p>The package defines the following public procedures for random point sets:</p>
<dl class="definitions">
<dt><a name="10"><b class="cmd">::simulation::random::prng_Disk</b> <i class="arg">rad</i></a></dt>
<dd><p>Create a command (PRNG) that generates (x,y)-coordinates for points
uniformly spread over a disk of given radius.</p>
<dl class="arguments">
<dt>float <i class="arg">rad</i></dt>
<dd><p>Radius of the disk</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::simulation::random::prng_Sphere</b> <i class="arg">rad</i></a></dt>
<dd><p>Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread over the surface of a sphere of given radius.</p>
<dl class="arguments">
<dt>float <i class="arg">rad</i></dt>
<dd><p>Radius of the disk</p></dd>
</dl></dd>
<dt><a name="12"><b class="cmd">::simulation::random::prng_Ball</b> <i class="arg">rad</i></a></dt>
<dd><p>Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread within a ball of given radius.</p>
<dl class="arguments">
<dt>float <i class="arg">rad</i></dt>
<dd><p>Radius of the ball</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::simulation::random::prng_Rectangle</b> <i class="arg">length</i> <i class="arg">width</i></a></dt>
<dd><p>Create a command (PRNG) that generates (x,y)-coordinates for points
uniformly spread over a rectangle.</p>
<dl class="arguments">
<dt>float <i class="arg">length</i></dt>
<dd><p>Length of the rectangle (x-direction)</p></dd>
<dt>float <i class="arg">width</i></dt>
<dd><p>Width of the rectangle (y-direction)</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">::simulation::random::prng_Block</b> <i class="arg">length</i> <i class="arg">width</i> <i class="arg">depth</i></a></dt>
<dd><p>Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread over a block</p>
<dl class="arguments">
<dt>float <i class="arg">length</i></dt>
<dd><p>Length of the block (x-direction)</p></dd>
<dt>float <i class="arg">width</i></dt>
<dd><p>Width of the block (y-direction)</p></dd>
<dt>float <i class="arg">depth</i></dt>
<dd><p>Depth of the block (z-direction)</p></dd>
</dl></dd>
</dl>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key67">math</a>, <a href="../../../../index.html#key592">random numbers</a>, <a href="../../../../index.html#key593">simulation</a>, <a href="../../../../index.html#key594">statistical distribution</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Mathematics</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Arjen Markus &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/smtpd/smtpd.html.























































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>smtpd - Tcl SMTP Server Package</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/smtpd/smtpd.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ smtpd.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">smtpd(n) 1.5 tcllib &quot;Tcl SMTP Server Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>smtpd - Tcl SMTP server implementation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">SECURITY</a></li>
<li class="section"><a href="#section3">COMMANDS</a></li>
<li class="section"><a href="#section4">CALLBACKS</a></li>
<li class="section"><a href="#section5">VARIABLES</a></li>
<li class="section"><a href="#section6">AUTHOR</a></li>
<li class="section"><a href="#section7">LICENSE</a></li>
<li class="section"><a href="#section8">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">smtpd <span class="opt">?1.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::smtpd::start</b> <span class="opt">?<i class="arg">myaddr</i>?</span> <span class="opt">?<i class="arg">port</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::smtpd::stop</b></a></li>
<li><a href="#3"><b class="cmd">::smptd::configure</b> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>?</span> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> <i class="arg">...</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::smtpd::cget</b> <span class="opt">?<i class="arg">option</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">smtpd</b> package provides a simple Tcl-only server library
for the Simple Mail Transfer Protocol as described in
RFC  821 (<a href="http://www.rfc-editor.org/rfc/rfc821.txt">http://www.rfc-editor.org/rfc/rfc821.txt</a>) and
RFC 2821 (<a href="http://www.rfc-editor.org/rfc/rfc2821.txt">http://www.rfc-editor.org/rfc/rfc2821.txt</a>).
By default the server will bind to the default network address and the
standard SMTP port (25).</p>
<p>This package was designed to permit testing of Mail User Agent code
from a developers workstation. <em>It does not attempt to deliver  mail to your mailbox.</em> Instead users of this package are expected to
write a procedure that will be called when mail arrives. Once this
procedure returns, the server has nothing further to do with the mail.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">SECURITY</a></h2>
<p>On Unix platforms binding to the SMTP port requires root privileges. I
would not recommend running any script-based server as root unless
there is some method for dropping root privileges immediately after
the socket is bound. Under Windows platforms, it is not necessary to
have root or administrator privileges to bind low numbered
sockets. However, security on these platforms is weak anyway.</p>
<p>In short, this code should probably not be used as a permanently
running Mail Transfer Agent on an Internet connected server, even
though we are careful not to evaluate remote user input. There are
many other well tested and security audited programs that can be used
as mail servers for internet connected hosts.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::smtpd::start</b> <span class="opt">?<i class="arg">myaddr</i>?</span> <span class="opt">?<i class="arg">port</i>?</span></a></dt>
<dd><p>Start the service listening on <i class="arg">port</i> or the default port 25. If
<i class="arg">myaddr</i> is given as a domain-style name or numerical
dotted-quad IP address then the server socket will be bound to that
network interface. By default the server is bound to all network
interfaces. For example:</p>
<pre class="example">
  set sock [::smtpd::start [info hostname] 0]
</pre>
<p>will bind to the hosts internet interface on the first available port.</p>
<p>At present the package only supports a single instance of a SMTP
server. This could be changed if required at the cost of making the
package a little more complicated to read. If there is a good reason
for running multiple SMTP services then it will only be necessary to
fix the <b class="variable">options</b> array and the <b class="variable">::smtpd::stopped</b> variable
usage.</p>
<p>As the server code uses <b class="cmd">fileevent</b>(n) handlers to process the
input on sockets you will need to run the event loop. This means
either you should be running from within <b class="syscmd">wish</b>(1) or you
should <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>(n) on the <b class="variable">::smtpd::stopped</b> variable which is
set when the server is stopped.</p></dd>
<dt><a name="2"><b class="cmd">::smtpd::stop</b></a></dt>
<dd><p>Halt the server and release the listening socket. If the server has
not been started then this command does nothing.
The <b class="variable">::smtpd::stopped</b> variable is set for use with
<b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>(n).</p>
<p>It should be noted that stopping the server does not disconnect any
currently active sessions as these are operating over an independent
channel. Only explicitly tracking and closing these sessions, or
exiting the server process will close down all the running
sessions. This is similar to the usual unix daemon practice where the
server performs a <b class="syscmd">fork</b>(2) and the client session continues on
the child process.</p></dd>
<dt><a name="3"><b class="cmd">::smptd::configure</b> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>?</span> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> <i class="arg">...</i>?</span></a></dt>
<dd><p>Set configuration options for the SMTP server. Most values are the
name of a callback procedure to be called at various points in the
SMTP protocol. See the <span class="sectref"><a href="#section4">CALLBACKS</a></span> section for details of the
procedures.</p>
<dl class="definitions">
<dt><b class="option">-banner</b> <i class="arg">text</i></dt>
<dd><p>Text of a custom banner message. The default banner is &quot;tcllib smtpd 1.5&quot;.
Note that changing the banner does not affect the bracketing text
in the full greeting, printing status 220, server-address, and timestamp.</p></dd>
<dt><b class="option">-validate_host</b> <i class="arg">proc</i></dt>
<dd><p>Callback to authenticate new connections based on the ip-address of
the client.</p></dd>
<dt><b class="option">-validate_sender</b> <i class="arg">proc</i></dt>
<dd><p>Callback to authenticate new connections based on the senders email
address.</p></dd>
<dt><b class="option">-validate_recipient</b> <i class="arg">proc</i></dt>
<dd><p>Callback to validate and authorize a recipient email address</p></dd>
<dt><b class="option">-deliverMIME</b> <i class="arg">proc</i></dt>
<dd><p>Callback used to deliver mail as a mime token created by the tcllib
<b class="package"><a href="../mime/mime.html">mime</a></b> package.</p></dd>
<dt><b class="option">-deliver</b> <i class="arg">proc</i></dt>
<dd><p>Callback used to deliver email. This option has no effect if
the <b class="option">-deliverMIME</b> option has been set.</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::smtpd::cget</b> <span class="opt">?<i class="arg">option</i>?</span></a></dt>
<dd><p>If no <i class="arg">option</i> is specified the command will return a list of all
options and their current values. If an option is specified it will
return the value of that option.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">CALLBACKS</a></h2>
<dl class="definitions">
<dt><b class="cmd">validate_host</b> callback</dt>
<dd><p>This procedure is called with the clients ip address as soon as a
connection request has been accepted and before any protocol commands
are processed. If you wish to deny access to a specific host then an
error should be returned by this callback. For example:</p>
<pre class="example">
 proc validate_host {ipnum} {
    if {[string match &quot;192.168.1.*&quot; $ipnum]} {
       error &quot;go away!&quot;
    }
 }
</pre>
<p>If access is denied the client will receive a standard message that
includes the text of your error, such as:</p>
<pre class="example">
 550 Access denied: I hate you.
</pre>
<p>As per the SMTP protocol, the connection is not closed but we wait for
the client to send a QUIT command. Any other commands cause a
<b class="const">503 Bad Sequence</b> error.</p></dd>
<dt><b class="cmd">validate_sender</b> callback</dt>
<dd><p>The validate_sender callback is called with the senders mail address
during processing of a MAIL command to allow you to accept or reject
mail based upon the declared sender. To reject mail you should throw
an error. For example, to reject mail from user &quot;denied&quot;:</p>
<pre class="example">
 proc validate_sender {address} {
    eval array set addr [mime::parseaddress $address]
    if {[string match &quot;denied&quot; $addr(local)]} {
         error &quot;mailbox $addr(local) denied&quot;
    }
    return    
 }
</pre>
<p>The content of any error message will not be passed back to the client.</p></dd>
<dt><b class="cmd">validate_recipient</b> callback</dt>
<dd><p>The validate_recipient callback is similar to the validate_sender
callback and permits you to verify a local mailbox and accept mail for
a local user address during RCPT command handling. To reject mail,
throw an error as above. The error message is ignored.</p></dd>
<dt><b class="cmd">deliverMIME</b> callback</dt>
<dd><p>]
The deliverMIME callback is called once a mail message has been
successfully passed to the server. A mime token is constructed from
the sender, recipients and data and the users procedure it called with
this single argument. When the call returns, the mime token is cleaned
up so if the user wishes to preserve the data she must make a copy.</p>
<pre class="example">
 proc deliverMIME {token} {
     set sender [lindex [mime::getheader $token From] 0]
     set recipients [lindex [mime::getheader $token To] 0]
     set mail &quot;From $sender [clock format [clock seconds]]&quot;
     append mail &quot;\n&quot; [mime::buildmessage $token]
     puts $mail
 }
</pre>
</dd>
<dt><b class="cmd">deliver</b> callback</dt>
<dd><p>The deliver callback is called once a mail message has been
successfully passed to the server and there is no -deliverMIME option
set. The procedure is called with the sender, a list of recipients and
the text of the mail as a list of lines. For example:</p>
<pre class="example">
 proc deliver {sender recipients data} {
    set mail &quot;From $sender  [clock format [clock seconds]]&quot;
    append mail &quot;\n&quot; [join $data &quot;\n&quot;]
    puts &quot;$mail&quot;
 }
</pre>
<p>Note that the DATA command will return an error if no sender or
recipient has yet been defined.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">VARIABLES</a></h2>
<dl class="definitions">
<dt><b class="variable">::smtpd::stopped</b></dt>
<dd><p>This variable is set to <b class="const">true</b> during the <b class="cmd">::smtpd::stop</b>
command to permit the use of the <b class="cmd"><a href="../../../../index.html#key367">vwait</a></b>(n) command.</p></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">AUTHOR</a></h2>
<p>Written by Pat Thoyts <a href="mailto:[email protected]">mailto:[email protected]</a>.</p>
</div>
<div id="section7" class="section"><h2><a name="section7">LICENSE</a></h2>
<p>This software is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file
&quot;<b class="file">license.terms</b>&quot; for more details.</p>
</div>
<div id="section8" class="section"><h2><a name="section8">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>smtpd</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key287">rfc 2821</a>, <a href="../../../../index.html#key290">rfc 821</a>, <a href="../../../../index.html#key555">services</a>, <a href="../../../../index.html#key295">smtp</a>, <a href="../../../../index.html#key623">smtpd</a>, <a href="../../../../index.html#key311">socket</a>, <a href="../../../../index.html#key367">vwait</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/snit/snit.html.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>snit - Snit's Not Incr Tcl, OO system</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/snit/snit.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003-2009, by William H. Duquette
   -->
<! -- CVS: $Id$ snit.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">snit(n) 2.3.2 tcllib &quot;Snit's Not Incr Tcl, OO system&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>snit - Snit's Not Incr Tcl</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">SNIT VERSIONS</a></li>
<li class="section"><a href="#section3">REFERENCE</a>
<ul>
<li class="subsection"><a href="#subsection1">Type and Widget Definitions</a></li>
<li class="subsection"><a href="#subsection2">The Type Command</a></li>
<li class="subsection"><a href="#subsection3">Standard Type Methods</a></li>
<li class="subsection"><a href="#subsection4">The Instance Command</a></li>
<li class="subsection"><a href="#subsection5">Standard Instance Methods</a></li>
<li class="subsection"><a href="#subsection6">Commands for use in Object Code</a></li>
<li class="subsection"><a href="#subsection7">Components and Delegation</a></li>
<li class="subsection"><a href="#subsection8">Type Components and Delegation</a></li>
<li class="subsection"><a href="#subsection9">The Tk Option Database</a></li>
<li class="subsection"><a href="#subsection10">Macros and Meta-programming</a></li>
<li class="subsection"><a href="#subsection11">Validation Types</a></li>
<li class="subsection"><a href="#subsection12">Defining Validation Types</a></li>
</ul>
</li>
<li class="section"><a href="#section4">CAVEATS</a></li>
<li class="section"><a href="#section5">KNOWN BUGS</a></li>
<li class="section"><a href="#section6">HISTORY</a></li>
<li class="section"><a href="#section7">CREDITS</a></li>
<li class="section"><a href="#section8">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">snit <span class="opt">?2.3.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">snit::type</b> <i class="arg">name</i> <i class="arg">definition</i></a></li>
<li><a href="#2"><b class="cmd">typevariable</b> <i class="arg">name</i> <span class="opt">?<b class="const">-array</b>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#3"><b class="cmd">typemethod</b> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></li>
<li><a href="#4"><b class="cmd">typeconstructor</b> <i class="arg">body</i></a></li>
<li><a href="#5"><b class="cmd">variable</b> <i class="arg">name</i> <span class="opt">?<b class="const">-array</b>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#6"><b class="cmd"><a href="../../../../index.html#key332">method</a></b> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></li>
<li><a href="#7"><b class="cmd">option</b> <i class="arg">namespec</i> <span class="opt">?<i class="arg">defaultValue</i>?</span></a></li>
<li><a href="#8"><b class="cmd">option</b> <i class="arg">namespec</i> <span class="opt">?<i class="arg">options...</i>?</span></a></li>
<li><a href="#9"><b class="cmd">constructor</b> <i class="arg">arglist</i> <i class="arg">body</i></a></li>
<li><a href="#10"><b class="cmd">destructor</b> <i class="arg">body</i></a></li>
<li><a href="#11"><b class="cmd"><a href="../../../../index.html#key543">proc</a></b> <i class="arg">name</i> <i class="arg">args</i> <i class="arg">body</i></a></li>
<li><a href="#12"><b class="cmd">delegate</b> <b class="const">method</b> <i class="arg">name</i> <b class="const">to</b> <i class="arg">comp</i> <span class="opt">?<b class="const">as</b> <i class="arg">target</i>?</span></a></li>
<li><a href="#13"><b class="cmd">delegate</b> <b class="const">method</b> <i class="arg">name</i> <span class="opt">?<b class="const">to</b> <i class="arg">comp</i>?</span> <b class="const">using</b> <i class="arg">pattern</i></a></li>
<li><a href="#14"><b class="cmd">delegate</b> <b class="const">method</b> <b class="const">*</b> <span class="opt">?<b class="const">to</b> <i class="arg">comp</i>?</span> <span class="opt">?<b class="const">using</b> <i class="arg">pattern</i>?</span> <span class="opt">?<b class="const">except</b> <i class="arg">exceptions</i>?</span></a></li>
<li><a href="#15"><b class="cmd">delegate</b> <b class="const">option</b> <i class="arg">namespec</i> <b class="const">to</b> <i class="arg">comp</i></a></li>
<li><a href="#16"><b class="cmd">delegate</b> <b class="const">option</b> <i class="arg">namespec</i> <b class="const">to</b> <i class="arg">comp</i> <b class="const">as</b> <i class="arg">target</i></a></li>
<li><a href="#17"><b class="cmd">delegate</b> <b class="const">option</b> <b class="const">*</b> <b class="const">to</b> <i class="arg">comp</i></a></li>
<li><a href="#18"><b class="cmd">delegate</b> <b class="const">option</b> <b class="const">*</b> <b class="const">to</b> <i class="arg">comp</i> <b class="const">except</b> <i class="arg">exceptions</i></a></li>
<li><a href="#19"><b class="cmd">component</b> <i class="arg">comp</i> <span class="opt">?<b class="const">-public</b> <i class="arg">method</i>?</span> <span class="opt">?<b class="const">-inherit</b> <i class="arg">flag</i>?</span></a></li>
<li><a href="#20"><b class="cmd">delegate</b> <b class="const">typemethod</b> <i class="arg">name</i> <b class="const">to</b> <i class="arg">comp</i> <span class="opt">?<b class="const">as</b> <i class="arg">target</i>?</span></a></li>
<li><a href="#21"><b class="cmd">delegate</b> <b class="const">typemethod</b> <i class="arg">name</i> <span class="opt">?<b class="const">to</b> <i class="arg">comp</i>?</span> <b class="const">using</b> <i class="arg">pattern</i></a></li>
<li><a href="#22"><b class="cmd">delegate</b> <b class="const">typemethod</b> <b class="const">*</b> <span class="opt">?<b class="const">to</b> <i class="arg">comp</i>?</span> <span class="opt">?<b class="const">using</b> <i class="arg">pattern</i>?</span> <span class="opt">?<b class="const">except</b> <i class="arg">exceptions</i>?</span></a></li>
<li><a href="#23"><b class="cmd">typecomponent</b> <i class="arg">comp</i> <span class="opt">?<b class="const">-public</b> <i class="arg">typemethod</i>?</span> <span class="opt">?<b class="const">-inherit</b> <i class="arg">flag</i>?</span></a></li>
<li><a href="#24"><b class="cmd">pragma</b> <span class="opt">?<i class="arg">options...</i>?</span></a></li>
<li><a href="#25"><b class="cmd">expose</b> <i class="arg">comp</i></a></li>
<li><a href="#26"><b class="cmd">expose</b> <i class="arg">comp</i> <b class="const">as</b> <i class="arg">method</i></a></li>
<li><a href="#27"><b class="cmd">onconfigure</b> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></li>
<li><a href="#28"><b class="cmd">oncget</b> <i class="arg">name</i> <i class="arg">body</i></a></li>
<li><a href="#29"><b class="cmd">snit::widget</b> <i class="arg">name</i> <i class="arg">definition</i></a></li>
<li><a href="#30"><b class="cmd">widgetclass</b> <i class="arg">name</i></a></li>
<li><a href="#31"><b class="cmd">hulltype</b> <i class="arg">type</i></a></li>
<li><a href="#32"><b class="cmd">snit::widgetadaptor</b> <i class="arg">name</i> <i class="arg">definition</i></a></li>
<li><a href="#33"><b class="cmd">snit::typemethod</b> <i class="arg">type</i> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></li>
<li><a href="#34"><b class="cmd">snit::method</b> <i class="arg">type</i> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></li>
<li><a href="#35"><b class="cmd">snit::macro</b> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></li>
<li><a href="#36"><b class="cmd">snit::compile</b> <i class="arg">which</i> <i class="arg">type</i> <i class="arg">body</i></a></li>
<li><a href="#37"><b class="cmd">$type</b> <i class="arg">typemethod</i> <i class="arg">args</i>...</a></li>
<li><a href="#38"><b class="cmd">$type</b> <b class="method">create</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></li>
<li><a href="#39"><b class="cmd">$type</b> <b class="method">info typevars</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#40"><b class="cmd">$type</b> <b class="method">info typemethods</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#41"><b class="cmd">$type</b> <b class="method">info args</b> <i class="arg">method</i></a></li>
<li><a href="#42"><b class="cmd">$type</b> <b class="method">info body</b> <i class="arg">method</i></a></li>
<li><a href="#43"><b class="cmd">$type</b> <b class="method">info default</b> <i class="arg">method</i> <i class="arg">aname</i> <i class="arg">varname</i></a></li>
<li><a href="#44"><b class="cmd">$type</b> <b class="method">info instances</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#45"><b class="cmd">$type</b> <b class="method">destroy</b></a></li>
<li><a href="#46"><b class="cmd">$object</b> <i class="arg">method</i> <i class="arg">args...</i></a></li>
<li><a href="#47"><b class="cmd">$object</b> <b class="method">configure</b> <span class="opt">?<i class="arg">option</i>?</span> <span class="opt">?<i class="arg">value</i>?</span> ...</a></li>
<li><a href="#48"><b class="cmd">$object</b> <b class="method">configurelist</b> <i class="arg">optionlist</i></a></li>
<li><a href="#49"><b class="cmd">$object</b> <b class="method">cget</b> <i class="arg">option</i></a></li>
<li><a href="#50"><b class="cmd">$object</b> <b class="method">destroy</b></a></li>
<li><a href="#51"><b class="cmd">$object</b> <b class="method">info type</b></a></li>
<li><a href="#52"><b class="cmd">$object</b> <b class="method">info vars</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#53"><b class="cmd">$object</b> <b class="method">info typevars</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#54"><b class="cmd">$object</b> <b class="method">info typemethods</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#55"><b class="cmd">$object</b> <b class="method">info options</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#56"><b class="cmd">$object</b> <b class="method">info methods</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#57"><b class="cmd">$object</b> <b class="method">info args</b> <i class="arg">method</i></a></li>
<li><a href="#58"><b class="cmd">$object</b> <b class="method">info body</b> <i class="arg">method</i></a></li>
<li><a href="#59"><b class="cmd">$object</b> <b class="method">info default</b> <i class="arg">method</i> <i class="arg">aname</i> <i class="arg">varname</i></a></li>
<li><a href="#60"><b class="cmd">mymethod</b> <i class="arg">name</i> <span class="opt">?<i class="arg">args...</i>?</span></a></li>
<li><a href="#61"><b class="cmd">mytypemethod</b> <i class="arg">name</i> <span class="opt">?<i class="arg">args...</i>?</span></a></li>
<li><a href="#62"><b class="cmd">myproc</b> <i class="arg">name</i> <span class="opt">?<i class="arg">args...</i>?</span></a></li>
<li><a href="#63"><b class="cmd">myvar</b> <i class="arg">name</i></a></li>
<li><a href="#64"><b class="cmd">mytypevar</b> <i class="arg">name</i></a></li>
<li><a href="#65"><b class="cmd">from</b> <i class="arg">argvName</i> <i class="arg">option</i> <span class="opt">?<i class="arg">defvalue</i>?</span></a></li>
<li><a href="#66"><b class="cmd">install</b> <i class="arg">compName</i> <b class="const">using</b> <i class="arg">objType</i> <i class="arg">objName</i> <i class="arg">args...</i></a></li>
<li><a href="#67"><b class="cmd">installhull</b> <b class="const">using</b> <i class="arg">widgetType</i> <i class="arg">args...</i></a></li>
<li><a href="#68"><b class="cmd">installhull</b> <i class="arg">name</i></a></li>
<li><a href="#69"><b class="cmd">variable</b> <i class="arg">name</i></a></li>
<li><a href="#70"><b class="cmd">typevariable</b> <i class="arg">name</i></a></li>
<li><a href="#71"><b class="cmd">varname</b> <i class="arg">name</i></a></li>
<li><a href="#72"><b class="cmd">typevarname</b> <i class="arg">name</i></a></li>
<li><a href="#73"><b class="cmd">codename</b> <i class="arg">name</i></a></li>
<li><a href="#74"><b class="cmd">snit::boolean</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#75"><b class="cmd">snit::boolean</b> <i class="arg">name</i></a></li>
<li><a href="#76"><b class="cmd">snit::double</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#77"><b class="cmd">snit::double</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#78"><b class="cmd">snit::enum</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#79"><b class="cmd">snit::enum</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#80"><b class="cmd">snit::fpixels</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#81"><b class="cmd">snit::fpixels</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#82"><b class="cmd">snit::integer</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#83"><b class="cmd">snit::integer</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#84"><b class="cmd">snit::listtype</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#85"><b class="cmd">snit::listtype</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#86"><b class="cmd">snit::pixels</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#87"><b class="cmd">snit::pixels</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#88"><b class="cmd">snit::stringtype</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#89"><b class="cmd">snit::stringtype</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#90"><b class="cmd">snit::window</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#91"><b class="cmd">snit::window</b> <i class="arg">name</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Snit is a pure Tcl object and megawidget system.  It's
unique among Tcl object systems in that it's based not on inheritance
but on delegation.  Object systems based on inheritance only allow you
to inherit from classes defined using the same system, which is
limiting.  In Tcl, an object is 
anything that acts like an object; it shouldn't matter how the object
was implemented.  Snit is intended to help you build applications out of
the materials at hand; thus, Snit is designed to be able to
incorporate and build on any object, whether it's a hand-coded object,
a <b class="package"><a href="../../../../index.html#key190">Tk</a></b> widget, an <b class="package"><a href="../../../../index.html#key220">Incr Tcl</a></b> object,
a <b class="package"><a href="../../../../index.html#key218">BWidget</a></b> or almost anything else.</p>
<p>This man page is intended to be a reference only; see the accompanying
<b class="cmd"><a href="snitfaq.html">snitfaq</a></b> for a gentler, more tutorial introduction to Snit
concepts.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">SNIT VERSIONS</a></h2>
<p>This man page covers both Snit 2.2 and Snit 1.3.  The primary
difference between the two versions is simply that Snit 2.2 contains
speed optimizations based on new features of Tcl 8.5; Snit 1.3
supports all of Tcl 8.3, 8.4 and Tcl 8.5.  There are a few minor
inconsistencies; they are flagged in the body of the man page with the
label &quot;Snit 1.x Incompatibility&quot;; they are also discussed in the <b class="cmd"><a href="snitfaq.html">snitfaq</a></b>.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">REFERENCE</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Type and Widget Definitions</a></h3>
<p>Snit provides the following commands for defining new types:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">snit::type</b> <i class="arg">name</i> <i class="arg">definition</i></a></dt>
<dd><p>Defines a new abstract data type called <i class="arg">name</i>.  If <i class="arg">name</i> is
not a fully qualified command name, it is assumed to be a name in the
namespace in which the <b class="cmd">snit::type</b> command was called (usually the
global namespace).  It returns the fully qualified name of the new type.</p>
<p>The type name is then a command that is used to create objects of the
new type, along with other activities.</p>
<p>The <b class="cmd">snit::type</b> <i class="arg">definition</i> block is a script that may
contain the following definitions:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">typevariable</b> <i class="arg">name</i> <span class="opt">?<b class="const">-array</b>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Defines a type variable with the specified <i class="arg">name</i>, and optionally
the specified <i class="arg">value</i>.  Type variables are shared by all instances
of the type.  If the <b class="const">-array</b> option is included, then 
<i class="arg">value</i> should be a dictionary; it will be
assigned to the variable using <b class="cmd">array set</b>.</p></dd>
<dt><a name="3"><b class="cmd">typemethod</b> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></dt>
<dd><p>Defines a type method, a subcommand of the new type command,
with the specified name, argument list, and
body.  The <i class="arg">arglist</i> is a normal Tcl argument list and may contain
default arguments and the <b class="variable">args</b> argument; however, it may not
contain the argument names <b class="variable">type</b>, <b class="variable">self</b>, <b class="variable">selfns</b>, or
<b class="variable">win</b>.</p>
<p>The variable <b class="variable">type</b> is automatically defined in the <i class="arg">body</i> to
the type's fully-qualified name.  In addition,
type variables are automatically visible in the <i class="arg">body</i> 
of every type method.</p>
<p>If the <i class="arg">name</i> consists of two or more tokens, Snit handles it specially:</p>
<pre class="example">    typemethod {a b} {arg} { puts &quot;Got $arg&quot; }
</pre>
<p>This statement implicitly defines a type method called <b class="const">a</b> which
has a subcommand <b class="const">b</b>.  <b class="const">b</b> is called like this:</p>
<pre class="example">    $type a b &quot;Hello, world!&quot;
</pre>
<p><b class="const">a</b> may have any number of subcommands.  This makes it possible
to define a hierarchical command structure; see <b class="cmd"><a href="../../../../index.html#key332">method</a></b>, below, 
for more examples.</p>
<p>Type methods can call commands from the namespace in which the type is
defined without importing them, e.g., if the type name is 
<b class="cmd">::parentns::typename</b>, then the type's type methods can call
<b class="cmd">::parentns::someproc</b> just as <b class="cmd">someproc</b>.  
<em>Snit 1.x Incompatibility:</em> This does not work in Snit 1.x, as
it depends on <b class="cmd">namespace path</b>, a new command in Tcl 8.5.</p>
<p><em>Snit 1.x Incompatibility:</em> In Snit 1.x, the following
following two calls to this type method are equivalent:</p>
<pre class="example">    $type a b &quot;Hello, world!&quot;
    $type {a b} &quot;Hello, world!&quot;
</pre>
<p>In Snit 2.2, the second form is invalid.</p></dd>
<dt><a name="4"><b class="cmd">typeconstructor</b> <i class="arg">body</i></a></dt>
<dd><p>The type constructor's <i class="arg">body</i> is executed once when the
type is first defined; it is typically used to
initialize array-valued type variables and to add
entries to <span class="sectref"><a href="#subsection9">The Tk Option Database</a></span>.</p>
<p>The variable <b class="variable">type</b> is automatically defined in the <i class="arg">body</i>, 
and contains the type's fully-qualified name.  In addition,
type variables are automatically visible in the <i class="arg">body</i> of the type 
constructor.</p>
<p>A type may define at most one type constructor.</p>
<p>The type constructor can call commands from the namespace in which the type is
defined without importing them, e.g., if the type name is 
<b class="cmd">::parentns::typename</b>, then the type constructor can call
<b class="cmd">::parentns::someproc</b> just as <b class="cmd">someproc</b>.  
<em>Snit 1.x Incompatibility:</em> This does not work in Snit 1.x, as
it depends on <b class="cmd">namespace path</b>, a new command in Tcl 8.5.</p></dd>
<dt><a name="5"><b class="cmd">variable</b> <i class="arg">name</i> <span class="opt">?<b class="const">-array</b>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Defines an instance variable, a private variable associated with each
instance of this type, and optionally its initial value.  
If the <b class="const">-array</b> option is included, then 
<i class="arg">value</i> should be a dictionary; it will be
assigned to the variable using <b class="cmd">array set</b>.</p></dd>
<dt><a name="6"><b class="cmd"><a href="../../../../index.html#key332">method</a></b> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></dt>
<dd><p>Defines an instance method, a subcommand of each instance of this
type, with the specified name, argument list and body.
The <i class="arg">arglist</i> is a normal Tcl argument list and may contain
default arguments and the <b class="variable">args</b> argument.</p>
<p>The method is implicitly passed the following arguments as well:
<b class="variable">type</b>, which contains the fully-qualified type name; <b class="variable">self</b>,
which contains the current instance command name; <b class="variable">selfns</b>, which
contains the name of the instance's private namespace; and <b class="variable">win</b>,
which contains the original instance name.
Consequently, the <i class="arg">arglist</i> may not contain the argument names
<b class="const">type</b>, <b class="const">self</b>, <b class="const">selfns</b>, or <b class="const">win</b>.</p>
<p>An instance method defined in this way is said to be
<i class="term">locally defined</i>.</p>
<p>Type and instance variables are
automatically visible in all instance methods.  If the type has
locally defined options, the <b class="variable">options</b> array is also visible.</p>
<p>If the <i class="arg">name</i> consists of two or more tokens, Snit handles it specially:</p>
<pre class="example">    method {a b} {} { ... }
</pre>
<p>This statement implicitly defines a method called <b class="const">a</b> which
has a subcommand <b class="const">b</b>.  <b class="const">b</b> is called like this:</p>
<pre class="example">    $self a b &quot;Hello, world!&quot;
</pre>
<p><b class="const">a</b> may have any number of subcommands.  This makes it possible
to define a hierarchical command structure:</p>
<pre class="example">% snit::type dog {
    method {tail wag}   {} {return &quot;Wag, wag&quot;}
    method {tail droop} {} {return &quot;Droop, droop&quot;}
}
::dog
% dog spot
::spot
% spot tail wag
Wag, wag
% spot tail droop
Droop, droop
%
</pre>
<p>What we've done is implicitly defined a &quot;tail&quot; method with subcommands
&quot;wag&quot; and &quot;droop&quot;.  Consequently, it's an error to define &quot;tail&quot;
explicitly.</p>
<p>Methods can call commands from the namespace in which the type is
defined without importing them, e.g., if the type name is 
<b class="cmd">::parentns::typename</b>, then the type's methods can call
<b class="cmd">::parentns::someproc</b> just as <b class="cmd">someproc</b>.  
<em>Snit 1.x Incompatibility:</em> This does not work in Snit 1.x, as
it depends on <b class="cmd">namespace path</b>, a new command in Tcl 8.5.</p>
<p><em>Snit 1.x Incompatibility:</em> In Snit 1.x, the following
following two calls to this method are equivalent:</p>
<pre class="example">    $self a b &quot;Hello, world!&quot;
    $self {a b} &quot;Hello, world!&quot;
</pre>
<p>In Snit 2.2, the second form is invalid.</p></dd>
<dt><a name="7"><b class="cmd">option</b> <i class="arg">namespec</i> <span class="opt">?<i class="arg">defaultValue</i>?</span></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">option</b> <i class="arg">namespec</i> <span class="opt">?<i class="arg">options...</i>?</span></a></dt>
<dd><p>Defines an option for instances of this type, and optionally gives it
an initial value.  The initial value defaults to the empty string if
no <i class="arg">defaultValue</i> is specified.</p>
<p>An option defined in this way is said to be <i class="term">locally defined</i>.</p>
<p>The <i class="arg">namespec</i> is a list defining the option's
name, resource name, and class name, e.g.:</p>
<pre class="example">    option {-font font Font} {Courier 12}
</pre>
<p>The option name must begin with a hyphen, and must not contain any
upper case letters. The resource name and class name are optional; if
not specified, the resource name defaults to the option name, minus
the hyphen, and the class name defaults to the resource name with the
first letter capitalized.  Thus, the following statement is equivalent
to the previous example:</p>
<pre class="example">    option -font {Courier 12}
</pre>
<p>See <span class="sectref"><a href="#subsection9">The Tk Option Database</a></span> for more information about
resource and class names.</p>
<p>Options are normally set and retrieved using the standard
instance methods <b class="method">configure</b> and <b class="method">cget</b>; within instance code
(method bodies, etc.), option values are available through the 
<b class="variable">options</b> array:</p>
<pre class="example">    set myfont $options(-font)
</pre>
<p>If the type defines any option handlers (e.g., <b class="const">-configuremethod</b>), 
then it should probably use <b class="method">configure</b> and <b class="method">cget</b> to 
access its options to avoid subtle errors.</p>
<p>The <b class="cmd">option</b> statement may include the following options:</p>
<dl class="definitions">
<dt><b class="const">-default</b> <i class="arg">defvalue</i></dt>
<dd><p>Defines the option's default value; the option's default value 
will be &quot;&quot; otherwise.</p></dd>
<dt><b class="const">-readonly</b> <i class="arg">flag</i></dt>
<dd><p>The <i class="arg">flag</i> can be any Boolean value recognized by Tcl.  
If <i class="arg">flag</i> is true, then the option is read-only--it can only
be set using <b class="method">configure</b> or <b class="method">configurelist</b> 
at creation time, i.e., in the type's constructor.</p></dd>
<dt><b class="const">-type</b> <i class="arg">type</i></dt>
<dd><p>Every locally-defined option may define its validation type, which may
be either the name of a validation type or a specification for a
validation subtype</p>
<p>For example, an option may declare that its value must be an integer
by specifying <b class="cmd">snit::integer</b> as its validation type:</p>
<pre class="example">    option -number -type snit::integer
</pre>
<p>It may also declare that its value is an integer between 1 and 10
by specifying a validation subtype:</p>
<pre class="example">    option -number -type {snit::integer -min 1 -max 10}
</pre>
<p>If a validation type or subtype is defined for an option, then
it will be used to validate the option's value whenever it is
changed by the object's <b class="method">configure</b> or 
<b class="method">configurelist</b> methods.  In addition, all such options
will have their values validated automatically immediately
after the constructor executes.</p>
<p>Snit defines a family of validation types and subtypes, and it's
quite simple to define new ones.  See
<span class="sectref"><a href="#subsection11">Validation Types</a></span> for the complete list, and
<span class="sectref"><a href="#subsection12">Defining Validation Types</a></span> for an explanation of how
to define your own.</p></dd>
<dt><b class="const">-cgetmethod</b> <i class="arg">methodName</i></dt>
<dd><p>Every locally-defined option may define a <b class="const">-cgetmethod</b>;
it is called when the option's value is retrieved using the
<b class="method">cget</b> method.  Whatever the method's <i class="arg">body</i> returns will
be the return value of the call to <b class="method">cget</b>.</p>
<p>The named method must take one argument, the option name.
For example, this code is equivalent to (though slower than)
Snit's default handling of <b class="cmd">cget</b>:</p>
<pre class="example">    option -font -cgetmethod GetOption
    method GetOption {option} {
        return $options($option)
    }
</pre>
<p>Note that it's possible for any number of options to share a 
<b class="const">-cgetmethod</b>.</p></dd>
<dt><b class="const">-configuremethod</b> <i class="arg">methodName</i></dt>
<dd><p>Every locally-defined option may define a <b class="const">-configuremethod</b>;
it is called when the option's value is set using the
<b class="method">configure</b> or <b class="method">configurelist</b> methods.  It is the
named method's responsibility to save the option's value; in other
words, the value will not be saved to the <b class="variable">options()</b> array unless
the method saves it there.</p>
<p>The named method must take two arguments, the option name and
its new value.  For example, this code is equivalent to 
(though slower than) Snit's default handling of <b class="cmd">configure</b>:</p>
<pre class="example">    option -font -configuremethod SetOption
    method SetOption {option value} {
        set options($option) $value
    }
</pre>
<p>Note that it's possible for any number of options to share a 
single <b class="const">-configuremethod</b>.</p></dd>
<dt><b class="const">-validatemethod</b> <i class="arg">methodName</i></dt>
<dd><p>Every locally-defined option may define a <b class="const">-validatemethod</b>;
it is called when the option's value is set using the
<b class="method">configure</b> or <b class="method">configurelist</b> methods, just before
the <b class="const">-configuremethod</b> (if any).  It is the
named method's responsibility to validate the option's new value,
and to throw an error if the value is invalid.</p>
<p>The named method must take two arguments, the option name and
its new value.  For example, this code verifies that 
<b class="const">-flag</b>'s value is a valid Boolean value:</p>
<pre class="example">    option -font -validatemethod CheckBoolean
    method CheckBoolean {option value} {
        if {![string is boolean -strict $value]} {
            error &quot;option $option must have a boolean value.&quot;
        }
    }
</pre>
<p>Note that it's possible for any number of options to share a 
single <b class="const">-validatemethod</b>.</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">constructor</b> <i class="arg">arglist</i> <i class="arg">body</i></a></dt>
<dd><p>The constructor definition specifies a <i class="arg">body</i> of code to be
executed when a new instance is created.  The <i class="arg">arglist</i> is a 
normal Tcl argument list and may contain default arguments and 
the <b class="variable">args</b> argument.</p>
<p>As with methods, the arguments <b class="variable">type</b>, <b class="variable">self</b>, <b class="variable">selfns</b>, 
and <b class="variable">win</b> are defined implicitly, and all type and instance 
variables are automatically visible in its <i class="arg">body</i>.</p>
<p>If the <i class="arg">definition</i> doesn't explicitly define the constructor,
Snit defines one implicitly.  If the type declares at least one option
(whether locally or by delegation), the default constructor will 
be defined as follows:</p>
<pre class="example">    constructor {args} {
        $self configurelist $args
    }
</pre>
<p>For standard Tk widget behavior, the argument list should be 
the single name <b class="const">args</b>, as shown.</p>
<p>If the <i class="arg">definition</i> defines neither a constructor nor
any options, the default constructor is defined as follows:</p>
<pre class="example">    constructor {} {}
</pre>
<p>As with methods, the constructor can call commands from the namespace
in which the type is
defined without importing them, e.g., if the type name is 
<b class="cmd">::parentns::typename</b>, then the constructor can call
<b class="cmd">::parentns::someproc</b> just as <b class="cmd">someproc</b>.  
<em>Snit 1.x Incompatibility:</em> This does not work in Snit 1.x, as
it depends on <b class="cmd">namespace path</b>, a new command in Tcl 8.5.</p></dd>
<dt><a name="10"><b class="cmd">destructor</b> <i class="arg">body</i></a></dt>
<dd><p>The destructor is used to code any actions that must take place when
an instance of the type is destroyed: typically, the destruction of
anything created in the constructor.</p>
<p>The destructor takes no explicit arguments; as with methods, the 
arguments <b class="variable">type</b>, <b class="variable">self</b>, <b class="variable">selfns</b>, and <b class="variable">win</b>, are 
defined implicitly, and all type and instance 
variables are automatically visible in its <i class="arg">body</i>.
As with methods, the destructor can call commands from the namespace
in which the type is
defined without importing them, e.g., if the type name is 
<b class="cmd">::parentns::typename</b>, then the destructor can call
<b class="cmd">::parentns::someproc</b> just as <b class="cmd">someproc</b>.  
<em>Snit 1.x Incompatibility:</em> This does not work in Snit 1.x, as
it depends on <b class="cmd">namespace path</b>, a new command in Tcl 8.5.</p></dd>
<dt><a name="11"><b class="cmd"><a href="../../../../index.html#key543">proc</a></b> <i class="arg">name</i> <i class="arg">args</i> <i class="arg">body</i></a></dt>
<dd><p>Defines a new Tcl procedure in the type's namespace.</p>
<p>The defined proc differs from a normal Tcl proc in that all type
variables are automatically visible.  The proc can access 
instance variables as well, provided that it is passed
<b class="variable">selfns</b> (with precisely that name) as one of its arguments.</p>
<p>Although they are not implicitly defined for procs, the argument names
<b class="const">type</b>, <b class="const">self</b>, and <b class="const">win</b> should be avoided.</p>
<p>As with methods and typemethods, procs can call commands from the namespace
in which the type is
defined without importing them, e.g., if the type name is 
<b class="cmd">::parentns::typename</b>, then the proc can call
<b class="cmd">::parentns::someproc</b> just as <b class="cmd">someproc</b>.  
<em>Snit 1.x Incompatibility:</em> This does not work in Snit 1.x, as
it depends on <b class="cmd">namespace path</b>, a new command in Tcl 8.5.</p></dd>
<dt><a name="12"><b class="cmd">delegate</b> <b class="const">method</b> <i class="arg">name</i> <b class="const">to</b> <i class="arg">comp</i> <span class="opt">?<b class="const">as</b> <i class="arg">target</i>?</span></a></dt>
<dd><p>Delegates method <i class="arg">name</i> to component <i class="arg">comp</i>.  That is, when
method <i class="arg">name</i> is called on an instance of this type, the method
and its arguments will be passed to the named component's command
instead.  That is, the following statement</p>
<pre class="example">    delegate method wag to tail
</pre>
<p>is roughly equivalent to this explicitly defined method:</p>
<pre class="example">    method wag {args} {
        uplevel $tail wag $args
    }
</pre>
<p>As with methods, the <i class="arg">name</i> may have multiple tokens; in this
case, the last token of the name is assumed to be the name of the
component's method.</p>
<p>The optional <b class="const">as</b> clause allows you to specify the delegated
method name and possibly add some arguments:</p>
<pre class="example">    delegate method wagtail to tail as &quot;wag briskly&quot;
</pre>
<p>A method cannot be both locally defined and delegated.</p>
<p><b class="const">Note:</b> All forms of <b class="cmd">delegate method</b> can delegate to
both instance components and type components.</p></dd>
<dt><a name="13"><b class="cmd">delegate</b> <b class="const">method</b> <i class="arg">name</i> <span class="opt">?<b class="const">to</b> <i class="arg">comp</i>?</span> <b class="const">using</b> <i class="arg">pattern</i></a></dt>
<dd><p>In this form of the <b class="cmd">delegate</b> statement, the <b class="const">using</b> clause
is used to specify the precise form of the command to which method 
<i class="arg">name</i> name is delegated.  In this form, the <b class="const">to</b> clause is
optional, since the chosen command might not involve any particular
component.</p>
<p>The value of the <b class="const">using</b> clause is a list that may contain 
any or all of the following substitution codes; these codes are
substituted with the described value to build the delegated command
prefix.  Note that the following two statements are equivalent:</p>
<pre class="example">    delegate method wag to tail
    delegate method wag to tail using &quot;%c %m&quot;
</pre>
<p>Each element of the list becomes a single element of the delegated
command--it is never reparsed as a string.</p>
<p>Substitutions:</p>
<dl class="definitions">
<dt><b class="const">%%</b></dt>
<dd><p>This is replaced with a single &quot;%&quot;.  Thus, to pass the string &quot;%c&quot;
to the command as an argument, you'd write &quot;%%c&quot;.</p></dd>
<dt><b class="const">%c</b></dt>
<dd><p>This is replaced with the named component's command.</p></dd>
<dt><b class="const">%m</b></dt>
<dd><p>This is replaced with the final token of the method <i class="arg">name</i>; if
the method <i class="arg">name</i> has one token, this is identical to <b class="const">%M</b>.</p></dd>
<dt><b class="const">%M</b></dt>
<dd><p>This is replaced by the method <i class="arg">name</i>; if the <i class="arg">name</i> consists
of multiple tokens, they are joined by space characters.</p></dd>
<dt><b class="const">%j</b></dt>
<dd><p>This is replaced by the method <i class="arg">name</i>; if the <i class="arg">name</i> consists
of multiple tokens, they are joined by underscores (&quot;_&quot;).</p></dd>
<dt><b class="const">%t</b></dt>
<dd><p>This is replaced with the fully qualified type name.</p></dd>
<dt><b class="const">%n</b></dt>
<dd><p>This is replaced with the name of the instance's private namespace.</p></dd>
<dt><b class="const">%s</b></dt>
<dd><p>This is replaced with the name of the instance command.</p></dd>
<dt><b class="const">%w</b></dt>
<dd><p>This is replaced with the original name of the instance command; for
Snit widgets and widget adaptors, it will be the Tk window name.
It remains constant, even if the instance command is renamed.</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">delegate</b> <b class="const">method</b> <b class="const">*</b> <span class="opt">?<b class="const">to</b> <i class="arg">comp</i>?</span> <span class="opt">?<b class="const">using</b> <i class="arg">pattern</i>?</span> <span class="opt">?<b class="const">except</b> <i class="arg">exceptions</i>?</span></a></dt>
<dd><p>The form <b class="cmd">delegate method *</b> delegates all unknown method names to the
specified <i class="arg">comp</i>onent.  The <b class="const">except</b> clause can be used to
specify a list of <i class="arg">exceptions</i>, i.e., method names that will not
be so delegated. The <b class="const">using</b> clause is defined as given above.
In this form, the statement must contain the <b class="const">to</b> clause, the
<b class="const">using</b> clause, or both.</p>
<p>In fact, the &quot;*&quot; can be a list of two or more tokens whose last
element is &quot;*&quot;, as in the following example:</p>
<pre class="example">    delegate method {tail *} to tail
</pre>
<p>This implicitly defines the method <b class="cmd">tail</b> whose subcommands will
be delegated to the <b class="variable">tail</b> component.</p></dd>
<dt><a name="15"><b class="cmd">delegate</b> <b class="const">option</b> <i class="arg">namespec</i> <b class="const">to</b> <i class="arg">comp</i></a></dt>
<dd></dd>
<dt><a name="16"><b class="cmd">delegate</b> <b class="const">option</b> <i class="arg">namespec</i> <b class="const">to</b> <i class="arg">comp</i> <b class="const">as</b> <i class="arg">target</i></a></dt>
<dd></dd>
<dt><a name="17"><b class="cmd">delegate</b> <b class="const">option</b> <b class="const">*</b> <b class="const">to</b> <i class="arg">comp</i></a></dt>
<dd></dd>
<dt><a name="18"><b class="cmd">delegate</b> <b class="const">option</b> <b class="const">*</b> <b class="const">to</b> <i class="arg">comp</i> <b class="const">except</b> <i class="arg">exceptions</i></a></dt>
<dd><p>Defines a delegated option; the <i class="arg">namespec</i> is defined as for the
<b class="cmd">option</b> statement.
When the <b class="method">configure</b>, <b class="method">configurelist</b>, or <b class="method">cget</b>
instance method is used to set or retrieve the option's value, the
equivalent <b class="method">configure</b> or <b class="method">cget</b> command will be applied
to the component as though the option was defined with the following
<b class="const">-configuremethod</b> and <b class="const">-cgetmethod</b>:</p>
<pre class="example">    method ConfigureMethod {option value} {
        $comp configure $option $value
    }
    method CgetMethod {option} {
        return [$comp cget $option]
    }
</pre>
<p>Note that delegated options never appear in the <b class="variable">options</b> array.</p>
<p>If the <b class="const">as</b> clause is specified, then the <i class="arg">target</i> option
name is used in place of <i class="arg">name</i>.</p>
<p>The form <b class="cmd">delegate option *</b> delegates all unknown options to the
specified <i class="arg">comp</i>onent.  The <b class="const">except</b> clause can be used to
specify a list of <i class="arg">exceptions</i>, i.e., option names that will not
be so delegated.</p>
<p>Warning: options can only be delegated to a component if it supports
the <b class="method">configure</b> and <b class="method">cget</b> instance methods.</p>
<p>An option cannot be both locally defined and delegated.
TBD: Continue from here.</p></dd>
<dt><a name="19"><b class="cmd">component</b> <i class="arg">comp</i> <span class="opt">?<b class="const">-public</b> <i class="arg">method</i>?</span> <span class="opt">?<b class="const">-inherit</b> <i class="arg">flag</i>?</span></a></dt>
<dd><p>Explicitly declares a component called <i class="arg">comp</i>, and automatically
defines the component's instance variable.</p>
<p>If the <b class="const">-public</b> option is specified, then the option is made
public by defining a <i class="arg">method</i> whose subcommands are delegated
to the component e.g., specifying <b class="const">-public mycomp</b> is
equivalent to the following:</p>
<pre class="example">    component mycomp
    delegate method {mymethod *} to mycomp
</pre>
<p>If the <b class="const">-inherit</b> option is specified, then <i class="arg">flag</i> must be a
Boolean value; if <i class="arg">flag</i> is true then all unknown methods and
options will be delegated to this component.  The name <b class="const">-inherit</b>
implies that instances of this new type inherit, in a sense, the
methods and options of the component. That is, <b class="const">-inherit yes</b> is
equivalent to:</p>
<pre class="example">    component mycomp
    delegate option * to mycomp
    delegate method * to mycomp
</pre>
</dd>
<dt><a name="20"><b class="cmd">delegate</b> <b class="const">typemethod</b> <i class="arg">name</i> <b class="const">to</b> <i class="arg">comp</i> <span class="opt">?<b class="const">as</b> <i class="arg">target</i>?</span></a></dt>
<dd><p>Delegates type method <i class="arg">name</i> to type component <i class="arg">comp</i>.  That is, when
type method <i class="arg">name</i> is called on this type, the type method
and its arguments will be passed to the named type component's command
instead.  That is, the following statement</p>
<pre class="example">    delegate typemethod lostdogs to pound
</pre>
<p>is roughly equivalent to this explicitly defined method:</p>
<pre class="example">    typemethod lostdogs {args} {
        uplevel $pound lostdogs $args
    }
</pre>
<p>As with type methods, the <i class="arg">name</i> may have multiple tokens; in this
case, the last token of the name is assumed to be the name of the
component's method.</p>
<p>The optional <b class="const">as</b> clause allows you to specify the delegated
method name and possibly add some arguments:</p>
<pre class="example">    delegate typemethod lostdogs to pound as &quot;get lostdogs&quot;
</pre>
<p>A type method cannot be both locally defined and delegated.</p></dd>
<dt><a name="21"><b class="cmd">delegate</b> <b class="const">typemethod</b> <i class="arg">name</i> <span class="opt">?<b class="const">to</b> <i class="arg">comp</i>?</span> <b class="const">using</b> <i class="arg">pattern</i></a></dt>
<dd><p>In this form of the <b class="cmd">delegate</b> statement, the <b class="const">using</b> clause
is used to specify the precise form of the command to which type method 
<i class="arg">name</i> name is delegated.  In this form, the <b class="const">to</b> clause is
optional, since the chosen command might not involve any particular
type component.</p>
<p>The value of the <b class="const">using</b> clause is a list that may contain 
any or all of the following substitution codes; these codes are
substituted with the described value to build the delegated command
prefix.  Note that the following two statements are equivalent:</p>
<pre class="example">    delegate typemethod lostdogs to pound
    delegate typemethod lostdogs to pound using &quot;%c %m&quot;
</pre>
<p>Each element of the list becomes a single element of the delegated
command--it is never reparsed as a string.</p>
<p>Substitutions:</p>
<dl class="definitions">
<dt><b class="const">%%</b></dt>
<dd><p>This is replaced with a single &quot;%&quot;.  Thus, to pass the string &quot;%c&quot;
to the command as an argument, you'd write &quot;%%c&quot;.</p></dd>
<dt><b class="const">%c</b></dt>
<dd><p>This is replaced with the named type component's command.</p></dd>
<dt><b class="const">%m</b></dt>
<dd><p>This is replaced with the final token of the type method <i class="arg">name</i>; if
the type method <i class="arg">name</i> has one token, this is identical to <b class="const">%M</b>.</p></dd>
<dt><b class="const">%M</b></dt>
<dd><p>This is replaced by the type method <i class="arg">name</i>; if the <i class="arg">name</i> consists
of multiple tokens, they are joined by space characters.</p></dd>
<dt><b class="const">%j</b></dt>
<dd><p>This is replaced by the type method <i class="arg">name</i>; if the <i class="arg">name</i> consists
of multiple tokens, they are joined by underscores (&quot;_&quot;).</p></dd>
<dt><b class="const">%t</b></dt>
<dd><p>This is replaced with the fully qualified type name.</p></dd>
</dl></dd>
<dt><a name="22"><b class="cmd">delegate</b> <b class="const">typemethod</b> <b class="const">*</b> <span class="opt">?<b class="const">to</b> <i class="arg">comp</i>?</span> <span class="opt">?<b class="const">using</b> <i class="arg">pattern</i>?</span> <span class="opt">?<b class="const">except</b> <i class="arg">exceptions</i>?</span></a></dt>
<dd><p>The form <b class="cmd">delegate typemethod *</b> delegates all unknown type
method names to the
specified type component.  The <b class="const">except</b> clause can be used to
specify a list of <i class="arg">exceptions</i>, i.e., type method names that will not
be so delegated. The <b class="const">using</b> clause is defined as given above.
In this form, the statement must contain the <b class="const">to</b> clause, the
<b class="const">using</b> clause, or both.</p>
<p><b class="const">Note:</b> By default, Snit interprets <b class="cmd">$type foo</b>, where
<b class="const">foo</b> is
not a defined type method, as equivalent to <b class="cmd">$type create foo</b>, where
<b class="const">foo</b> is the name of a new instance of the type.  If you 
use <b class="const">delegate typemethod *</b>, then the <b class="method">create</b> type
method must always be used explicitly.</p>
<p>The &quot;*&quot; can be a list of two or more tokens whose last
element is &quot;*&quot;, as in the following example:</p>
<pre class="example">    delegate typemethod {tail *} to tail
</pre>
<p>This implicitly defines the type method <b class="cmd">tail</b> whose subcommands will
be delegated to the <b class="variable">tail</b> type component.</p></dd>
<dt><a name="23"><b class="cmd">typecomponent</b> <i class="arg">comp</i> <span class="opt">?<b class="const">-public</b> <i class="arg">typemethod</i>?</span> <span class="opt">?<b class="const">-inherit</b> <i class="arg">flag</i>?</span></a></dt>
<dd><p>Explicitly declares a type component called <i class="arg">comp</i>, and automatically
defines the component's type variable.  A type component is an arbitrary
command to which type methods and instance methods can be delegated;
the command's name is stored in a type variable.</p>
<p>If the <b class="const">-public</b> option is specified, then the type component is made
public by defining a <i class="arg">typemethod</i> whose subcommands are delegated to
the type component, e.g., specifying <b class="const">-public mytypemethod</b> 
is equivalent to the following:</p>
<pre class="example">    typecomponent mycomp
    delegate typemethod {mytypemethod *} to mycomp
</pre>
<p>If the <b class="const">-inherit</b> option is specified, then <i class="arg">flag</i> must be a
Boolean value; if <i class="arg">flag</i> is true then all unknown type methods
will be delegated to this type component. (See the note on &quot;delegate
typemethod *&quot;, above.) The name <b class="const">-inherit</b>
implies that this type inherits, in a sense, the behavior of
the type component. That is, <b class="const">-inherit yes</b> is equivalent to:</p>
<pre class="example">    typecomponent mycomp
    delegate typemethod * to mycomp
</pre>
</dd>
<dt><a name="24"><b class="cmd">pragma</b> <span class="opt">?<i class="arg">options...</i>?</span></a></dt>
<dd><p>The <b class="cmd">pragma</b> statement provides control over how Snit generates a
type.  It takes the following options; in each case, <i class="arg">flag</i> must
be a Boolean value recognized by Tcl, e.g., <b class="const">0</b>, <b class="const">1</b>, 
<b class="const">yes</b>, <b class="const">no</b>, and so
on.</p>
<p>By setting the <b class="const">-hastypeinfo</b>, <b class="const">-hastypedestroy</b>, and
<b class="const">-hasinstances</b> pragmas to false and defining appropriate
type methods, you can create an ensemble command without any extraneous
behavior.</p>
<dl class="definitions">
<dt><b class="const">-canreplace</b> <i class="arg">flag</i></dt>
<dd><p>If false (the default) Snit will not create an instance of a
<b class="cmd">snit::type</b> that has the same name as an existing command; this
prevents subtle errors.  Setting this pragma to true restores the
behavior of Snit V0.93 and earlier versions.</p></dd>
<dt><b class="const">-hastypeinfo</b> <i class="arg">flag</i></dt>
<dd><p>If true (the default), the generated type will have a type method
called <b class="cmd"><a href="../../../../index.html#key72">info</a></b> that is used for type introspection; the <b class="cmd"><a href="../../../../index.html#key72">info</a></b>
type method is documented below.  If false, it will not.</p></dd>
<dt><b class="const">-hastypedestroy</b> <i class="arg">flag</i></dt>
<dd><p>If true (the default), the generated type will have a type method
called <b class="cmd">destroy</b> that is used to destroy the type and all of its
instances.  The <b class="cmd">destroy</b> type method is documented below.  If
false, it will not.</p></dd>
<dt><b class="const">-hastypemethods</b> <i class="arg">flag</i></dt>
<dd><p>If true (the default), the generated type's type command will have 
subcommands (type methods) as usual.  If false, the type command
will serve only to create instances of the type; the first argument
is the instance name.</p>
<p>This pragma and <b class="const">-hasinstances</b> cannot both be set false.</p></dd>
<dt><b class="const">-hasinstances</b> <i class="arg">flag</i></dt>
<dd><p>If true (the default), the generated type will have a type method 
called <b class="cmd">create</b> that is used to create instances of the type,
along with a variety of instance-related features.  If false, it will
not.</p>
<p>This pragma and <b class="const">-hastypemethods</b> cannot both be set false.</p></dd>
<dt><b class="const">-hasinfo</b> <i class="arg">flag</i></dt>
<dd><p>If true (the default), instances of the generated type will have 
an instance method called <b class="method">info</b> that is used for 
instance introspection; the <b class="method">info</b>
method is documented below.  If false, it will not.</p></dd>
<dt><b class="const">-simpledispatch</b> <i class="arg">flag</i></dt>
<dd><p>This pragma is intended to make simple, heavily-used abstract
data types (e.g., stacks and queues) more efficient.</p>
<p>If false (the default), instance methods are dispatched normally.  If
true, a faster dispatching scheme is used instead.
The speed comes at a price; with <b class="const">-simpledispatch yes</b> you 
get the following limitations:</p>
<ul class="itemized">
<li><p>Methods cannot be delegated.</p></li>
<li><p><b class="cmd">uplevel</b> and <b class="cmd">upvar</b> do not work as expected: the
caller's scope is two levels up rather than one.</p></li>
<li><p>The option-handling methods 
(<b class="cmd">cget</b>, <b class="cmd">configure</b>, and <b class="cmd">configurelist</b>) are very
slightly slower.</p></li>
</ul></dd>
</dl></dd>
<dt><a name="25"><b class="cmd">expose</b> <i class="arg">comp</i></a></dt>
<dd></dd>
<dt><a name="26"><b class="cmd">expose</b> <i class="arg">comp</i> <b class="const">as</b> <i class="arg">method</i></a></dt>
<dd><p><b class="const">Deprecated.</b>  To expose component <i class="arg">comp</i> publicly, use
<b class="cmd">component</b>'s <b class="const">-public</b> option.</p></dd>
<dt><a name="27"><b class="cmd">onconfigure</b> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></dt>
<dd><p><b class="const">Deprecated.</b>  Define <b class="cmd">option</b>'s <b class="const">-configuremethod</b> 
option instead.</p>
<p>As of version 0.95, the following definitions,</p>
<pre class="example">    option -myoption
    onconfigure -myoption {value} {
        # Code to save the option's value
    }
</pre>
<p>are implemented as follows:</p>
<pre class="example">    option -myoption -configuremethod _configure-myoption
    method _configure-myoption {_option value} {
        # Code to save the option's value
    }
</pre>
</dd>
<dt><a name="28"><b class="cmd">oncget</b> <i class="arg">name</i> <i class="arg">body</i></a></dt>
<dd><p><b class="const">Deprecated.</b>  Define <b class="cmd">option</b>'s <b class="const">-cgetmethod</b> 
option instead.</p>
<p>As of version 0.95, the following definitions,</p>
<pre class="example">    option -myoption
    oncget -myoption {
        # Code to return the option's value
    }
</pre>
<p>are implemented as follows:</p>
<pre class="example">    option -myoption -cgetmethod _cget-myoption
    method _cget-myoption {_option} {
        # Code to return the option's value
    }
</pre>
</dd>
</dl></dd>
<dt><a name="29"><b class="cmd">snit::widget</b> <i class="arg">name</i> <i class="arg">definition</i></a></dt>
<dd><p>This command defines a Snit megawidget type with the specified
<i class="arg">name</i>.  The <i class="arg">definition</i> is defined as for <b class="cmd">snit::type</b>.
 A <b class="cmd">snit::widget</b> differs from a <b class="cmd">snit::type</b>
in these ways:</p>
<ul class="itemized">
<li><p>Every instance of a <b class="cmd">snit::widget</b> has an automatically-created
component called <b class="variable">hull</b>, which is normally a Tk frame widget.
Other widgets created as part of the megawidget will be created within
this widget.</p>
<p>The hull component is initially created with the requested widget
name; then Snit does some magic, renaming the hull component and
installing its own instance command in its place.
The hull component's new name is saved in an instance variable called
<b class="variable">hull</b>.</p></li>
<li><p>The name of an instance must be valid Tk window name, and the parent
window must exist.</p></li>
</ul>
<p>A <b class="cmd">snit::widget</b> definition can include any of statements allowed
in a <b class="cmd">snit::type</b> definition, and may also include the following:</p>
<dl class="definitions">
<dt><a name="30"><b class="cmd">widgetclass</b> <i class="arg">name</i></a></dt>
<dd><p>Sets the <b class="cmd">snit::widget</b>'s widget class to <i class="arg">name</i>, overriding
the default.  See <span class="sectref"><a href="#subsection9">The Tk Option Database</a></span> for more
information.</p></dd>
<dt><a name="31"><b class="cmd">hulltype</b> <i class="arg">type</i></a></dt>
<dd><p>Determines the kind of widget used as the <b class="cmd">snit::widget</b>'s hull.
The <i class="arg">type</i> may be <b class="const">frame</b> (the default), <b class="const">toplevel</b>,
<b class="const">labelframe</b>; the qualified equivalents of these, 
<b class="const">tk::frame</b>, <b class="const">tk::toplevel</b>, and <b class="const">tk::labelframe</b>;
or, if available, the equivalent Tile widgets:
<b class="const">ttk::frame</b>, <b class="const">ttk::toplevel</b>, and 
<b class="const">ttk::labelframe</b>.  In practice, any widget that supports the
<b class="const">-class</b> option can be used as a hull widget by 
<b class="cmd">lappend</b>'ing its name to the variable <b class="variable">snit::hulltypes</b>.</p></dd>
</dl></dd>
<dt><a name="32"><b class="cmd">snit::widgetadaptor</b> <i class="arg">name</i> <i class="arg">definition</i></a></dt>
<dd><p>This command defines a Snit megawidget type with the specified name.
It differs from <b class="cmd">snit::widget</b> in that the instance's <b class="variable">hull</b>
component is not created automatically, but is created in the
constructor and installed using the <b class="cmd">installhull</b> command.  Once
the hull is installed, its instance command is renamed and replaced as
with normal <b class="cmd">snit::widget</b>s.  The original command is again
accessible in the instance variable <b class="variable">hull</b>.</p>
<p>Note that in general it is not possible to change the
<em>widget class</em> of a <b class="cmd">snit::widgetadaptor</b>'s hull widget.</p>
<p>See <span class="sectref"><a href="#subsection9">The Tk Option Database</a></span> for information on how
<b class="cmd">snit::widgetadaptor</b>s interact with the option database.</p></dd>
<dt><a name="33"><b class="cmd">snit::typemethod</b> <i class="arg">type</i> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></dt>
<dd><p>Defines a new type method (or redefines an existing type method)
for a previously existing <i class="arg">type</i>.</p></dd>
<dt><a name="34"><b class="cmd">snit::method</b> <i class="arg">type</i> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></dt>
<dd><p>Defines a new instance method (or redefines an existing instance
method) for a previously existing <i class="arg">type</i>.  Note that delegated
instance methods can't be redefined.</p></dd>
<dt><a name="35"><b class="cmd">snit::macro</b> <i class="arg">name</i> <i class="arg">arglist</i> <i class="arg">body</i></a></dt>
<dd><p>Defines a Snit macro with the specified <i class="arg">name</i>, <i class="arg">arglist</i>, and
<i class="arg">body</i>.  Macros are used to define new type and widget
definition statements in terms of the statements defined in this man
page.</p>
<p>A macro is simply a Tcl proc that is defined in the slave interpreter
used to compile type and widget definitions.  Thus, macros have 
access to all of the type and widget definition statements.  See 
<span class="sectref"><a href="#subsection10">Macros and Meta-programming</a></span> for more details.</p>
<p>The macro <i class="arg">name</i> cannot be the same as any standard Tcl command, 
or any Snit type or widget definition statement, e.g., you can't
redefine the <b class="cmd"><a href="../../../../index.html#key332">method</a></b> or <b class="cmd">delegate</b> statements, or the 
standard <b class="cmd"><a href="../../../../index.html#key253">set</a></b>, <b class="cmd"><a href="../../../../index.html#key252">list</a></b>, or <b class="cmd"><a href="../../../../index.html#key239">string</a></b> commands.</p></dd>
<dt><a name="36"><b class="cmd">snit::compile</b> <i class="arg">which</i> <i class="arg">type</i> <i class="arg">body</i></a></dt>
<dd><p>Snit defines a type, widget, or widgetadaptor by &quot;compiling&quot; the
definition into a Tcl script; this script is then evaluated in the
Tcl interpreter, which actually defines the new type.</p>
<p>This command exposes the &quot;compiler&quot;.  Given a definition <i class="arg">body</i>
for the named <i class="arg">type</i>, where <i class="arg">which</i> is <b class="const">type</b>, 
<b class="const">widget</b>, or <b class="const">widgetadaptor</b>, <b class="cmd">snit::compile</b> returns a list
of two elements.  The first element is the fully qualified type name;
the second element is the definition script.</p>
<p><b class="cmd">snit::compile</b> is useful when additional processing
must be done on the Snit-generated code--if it must be instrumented,
for example, or run through the TclDevKit compiler.  In addition, the
returned script could be saved in a &quot;.tcl&quot; file and used to define the
type as part of an application or library, thus saving the compilation
overhead at application start-up.  Note that the
same version of Snit must be used at run-time as at compile-time.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">The Type Command</a></h3>
<p>A type or widget definition creates a type command, which is used to
create instances of the type.  The type command has this form:</p>
<dl class="definitions">
<dt><a name="37"><b class="cmd">$type</b> <i class="arg">typemethod</i> <i class="arg">args</i>...</a></dt>
<dd><p>The <i class="arg">typemethod</i> can be any of the 
<span class="sectref"><a href="#subsection3">Standard Type Methods</a></span> (e.g., <b class="method">create</b>), 
or any type method defined in the type
definition.
The subsequent <i class="arg">args</i> depend on the specific <i class="arg">typemethod</i>
chosen.</p>
<p>The type command is most often used to create new instances of the 
type; hence, the <b class="method">create</b> method is assumed if the first
argument to the type command doesn't name a valid type method, unless
the type definition includes <b class="cmd">delegate typemethod *</b> or the 
<b class="const">-hasinstances</b> pragma is set to false.</p>
<p>Furthermore, if the <b class="const">-hastypemethods</b> pragma is false, then
Snit type commands can be called with no arguments at
all; in this case, the type command creates an instance with an
automatically generated name.  In other words, provided that the 
<b class="const">-hastypemethods</b> pragma is false and the type
has instances, the following commands are equivalent:</p>
<pre class="example">snit::type dog { ... }
set mydog [dog create %AUTO%]
set mydog [dog %AUTO%]
set mydog [dog]
</pre>
<p>This doesn't work for Snit widgets, for obvious reasons.</p>
<p><em>Snit 1.x Incompatibility:</em> In Snit 1.x, the above behavior is
available whether <b class="const">-hastypemethods</b> is true (the default) or false.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Standard Type Methods</a></h3>
<p>In addition to any type methods in the type's definition, all type and
widget commands will usually have at least the following subcommands:</p>
<dl class="definitions">
<dt><a name="38"><b class="cmd">$type</b> <b class="method">create</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i> ...?</span></a></dt>
<dd><p>Creates a new instance of the type, giving it the specified <i class="arg">name</i>
and calling the type's constructor.</p>
<p>For <b class="cmd">snit::type</b>s, if <i class="arg">name</i> is not a fully-qualified command
name, it is assumed to be a name in the namespace in which the call to
<b class="cmd">snit::type</b> appears.  The method returns the fully-qualified
instance name.</p>
<p>For <b class="cmd">snit::widget</b>s and <b class="cmd">snit::widgetadaptor</b>s, <i class="arg">name</i>
must be a valid widget name; the method returns the widget name.</p>
<p>So long as <i class="arg">name</i> does not conflict with any defined type method
name the <b class="method">create</b> keyword may be omitted, unless
the type definition includes <b class="cmd">delegate typemethod *</b> or the 
<b class="const">-hasinstances</b> pragma is set to false.</p>
<p>If the <i class="arg">name</i> includes the string <b class="const">%AUTO%</b>, it will be
replaced with the string <b class="const">$type$counter</b> where <b class="const">$type</b> is
the type name and <b class="const">$counter</b> is a counter that increments each
time <b class="const">%AUTO%</b> is used for this type.</p>
<p>By default, any arguments following the <i class="arg">name</i> will be a list of
<i class="arg">option</i> names and their <i class="arg">value</i>s; however, a type's
constructor can specify a different argument list.</p>
<p>As of Snit V0.95, <b class="method">create</b> will throw an error if the <i class="arg">name</i>
is the same as any existing command--note that this was always true
for <b class="cmd">snit::widget</b>s and <b class="cmd">snit::widgetadaptor</b>s.  You can
restore the previous behavior using the <b class="const">-canreplace</b> pragma.</p></dd>
<dt><a name="39"><b class="cmd">$type</b> <b class="method">info typevars</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of the type's type variables (excluding Snit internal
variables); all variable names are fully-qualified.</p>
<p>If <i class="arg">pattern</i> is given, it's used as a <b class="cmd">string match</b>
pattern; only names that match the pattern are returned.</p></dd>
<dt><a name="40"><b class="cmd">$type</b> <b class="method">info typemethods</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of the names of the  type's type methods.  
If the type has hierarchical 
type methods, whether locally-defined or delegated, only the first
word of each will be included in the list.</p>
<p>If the type
definition includes <b class="cmd">delegate typemethod *</b>, the list will
include only the names of those implicitly delegated type methods 
that have been called at least once and are still in the type method cache.</p>
<p>If <i class="arg">pattern</i> is given, it's used as a <b class="cmd">string match</b>
pattern; only names that match the pattern are returned.</p></dd>
<dt><a name="41"><b class="cmd">$type</b> <b class="method">info args</b> <i class="arg">method</i></a></dt>
<dd><p>Returns a list containing the names of the arguments to the type's
<i class="arg">method</i>, in order. This method cannot be applied to delegated
type methods.</p></dd>
<dt><a name="42"><b class="cmd">$type</b> <b class="method">info body</b> <i class="arg">method</i></a></dt>
<dd><p>Returns the body of typemethod <i class="arg">method</i>. This method cannot be
applied to delegated type methods.</p></dd>
<dt><a name="43"><b class="cmd">$type</b> <b class="method">info default</b> <i class="arg">method</i> <i class="arg">aname</i> <i class="arg">varname</i></a></dt>
<dd><p>Returns a boolean value indicating whether the argument <i class="arg">aname</i> of
the type's <i class="arg">method</i> has a default value (<b class="const">true</b>) or not
(<b class="const">false</b>). If the argument has a default its value is placed into
the variable <i class="arg">varname</i>.</p></dd>
<dt><a name="44"><b class="cmd">$type</b> <b class="method">info instances</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of the type's instances.  For <b class="cmd">snit::type</b>s, it
will be a list of fully-qualified instance names;
for <b class="cmd">snit::widget</b>s, it will be a list of Tk widget names.</p>
<p>If <i class="arg">pattern</i> is given, it's used as a <b class="cmd">string match</b>
pattern; only names that match the pattern are returned.</p>
<p><em>Snit 1.x Incompatibility:</em>  In Snit 1.x, the full multi-word
names of hierarchical type methods are included in the return value.</p></dd>
<dt><a name="45"><b class="cmd">$type</b> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the type's instances, the type's namespace, and the type
command itself.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">The Instance Command</a></h3>
<p>A Snit type or widget's <b class="method">create</b> type method creates objects of
the type; each object has a unique name that is also a Tcl command.
This command is used to access the object's methods and data, and has
this form:</p>
<dl class="definitions">
<dt><a name="46"><b class="cmd">$object</b> <i class="arg">method</i> <i class="arg">args...</i></a></dt>
<dd><p>The <i class="arg">method</i> can be any of the 
<span class="sectref"><a href="#subsection5">Standard Instance Methods</a></span>, or any instance method 
defined in the type definition.
The subsequent <i class="arg">args</i> depend on the specific <i class="arg">method</i> chosen.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Standard Instance Methods</a></h3>
<p>In addition to any delegated or locally-defined instance methods in
the type's definition, all Snit objects will have at least the
following subcommands:</p>
<dl class="definitions">
<dt><a name="47"><b class="cmd">$object</b> <b class="method">configure</b> <span class="opt">?<i class="arg">option</i>?</span> <span class="opt">?<i class="arg">value</i>?</span> ...</a></dt>
<dd><p>Assigns new values to one or more options.  If called with one
argument, an <i class="arg">option</i> name, returns a list describing the option,
as Tk widgets do; if called with no arguments, returns a list of lists
describing all options, as Tk widgets do.</p>
<p>Warning: This information will be available for delegated options only
if the component to which they are delegated has a <b class="method">configure</b>
method that returns this same kind of information.</p>
<p>Note: Snit defines this method only if the type has at least one
option.</p></dd>
<dt><a name="48"><b class="cmd">$object</b> <b class="method">configurelist</b> <i class="arg">optionlist</i></a></dt>
<dd><p>Like <b class="method">configure</b>, but takes one argument, a list of options and
their values.  It's mostly useful in the type constructor, but can be
used anywhere.</p>
<p>Note: Snit defines this method only if the type has at least one
option.</p></dd>
<dt><a name="49"><b class="cmd">$object</b> <b class="method">cget</b> <i class="arg">option</i></a></dt>
<dd><p>Returns the option's value.</p>
<p>Note: Snit defines this method only if the type has at least one
option.</p></dd>
<dt><a name="50"><b class="cmd">$object</b> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the object, calling the <b class="cmd">destructor</b> and freeing all
related memory.</p>
<p><em>Note:</em>
The <b class="method">destroy</b> method isn't defined for <b class="cmd">snit::widget</b> or
<b class="cmd">snit::widgetadaptor</b> objects; instances of these are destroyed by
calling <b class="package"><a href="../../../../index.html#key190">Tk</a></b>'s <b class="cmd">destroy</b> command, just as normal
widgets are.</p></dd>
<dt><a name="51"><b class="cmd">$object</b> <b class="method">info type</b></a></dt>
<dd><p>Returns the instance's type.</p></dd>
<dt><a name="52"><b class="cmd">$object</b> <b class="method">info vars</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of the object's instance variables (excluding Snit
internal variables).  The names are fully qualified.</p>
<p>If <i class="arg">pattern</i> is given, it's used as a <b class="cmd">string match</b>
pattern; only names that match the pattern are returned.</p></dd>
<dt><a name="53"><b class="cmd">$object</b> <b class="method">info typevars</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of the object's type's type variables (excluding Snit
internal variables).  The names are fully qualified.</p>
<p>If <i class="arg">pattern</i> is given, it's used as a <b class="cmd">string match</b>
pattern; only names that match the pattern are returned.</p></dd>
<dt><a name="54"><b class="cmd">$object</b> <b class="method">info typemethods</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of the names of the  type's type methods.  
If the type has hierarchical 
type methods, whether locally-defined or delegated, only the first
word of each will be included in the list.</p>
<p>If the type
definition includes <b class="cmd">delegate typemethod *</b>, the list will
include only the names of those implicitly delegated type methods 
that have been called at least once and are still in the type method cache.</p>
<p>If <i class="arg">pattern</i> is given, it's used as a <b class="cmd">string match</b>
pattern; only names that match the pattern are returned.</p>
<p><em>Snit 1.x Incompatibility:</em>  In Snit 1.x, the full multi-word
names of hierarchical type methods are included in the return value.</p></dd>
<dt><a name="55"><b class="cmd">$object</b> <b class="method">info options</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of the object's option names.  This always includes
local options and explicitly delegated options.  If unknown options
are delegated as well, and if the component to which they are
delegated responds to <b class="cmd">$object configure</b> like Tk widgets do,
then the result will include all possible unknown options that can
be delegated to the component.</p>
<p>If <i class="arg">pattern</i> is given, it's used as a <b class="cmd">string match</b>
pattern; only names that match the pattern are returned.</p>
<p>Note that the return value might be different for different instances
of the same type, if component object types can vary from one instance
to another.</p></dd>
<dt><a name="56"><b class="cmd">$object</b> <b class="method">info methods</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of the names of the instance's methods.
If the type has hierarchical methods, whether locally-defined or 
delegated, only the first word of each will be included in the list.</p>
<p>If the type
definition includes <b class="cmd">delegate method *</b>, the list will
include only the names of those implicitly delegated methods that have
been called at least once and are still in the method cache.</p>
<p>If <i class="arg">pattern</i> is given, it's used as a <b class="cmd">string match</b>
pattern; only names that match the pattern are returned.</p>
<p><em>Snit 1.x Incompatibility:</em>  In Snit 1.x, the full multi-word
names of hierarchical type methods are included in the return value.</p></dd>
<dt><a name="57"><b class="cmd">$object</b> <b class="method">info args</b> <i class="arg">method</i></a></dt>
<dd><p>Returns a list containing the names of the arguments to the instance's
<i class="arg">method</i>, in order. This method cannot be applied to delegated methods.</p></dd>
<dt><a name="58"><b class="cmd">$object</b> <b class="method">info body</b> <i class="arg">method</i></a></dt>
<dd><p>Returns the body of the instance's method <i class="arg">method</i>. This method
cannot be applied to delegated methods.</p></dd>
<dt><a name="59"><b class="cmd">$object</b> <b class="method">info default</b> <i class="arg">method</i> <i class="arg">aname</i> <i class="arg">varname</i></a></dt>
<dd><p>Returns a boolean value indicating whether the argument <i class="arg">aname</i> of
the instance's <i class="arg">method</i> has a default value (<b class="const">true</b>) or not
(<b class="const">false</b>). If the argument has a default its value is placed into
the variable <i class="arg">varname</i>.</p></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Commands for use in Object Code</a></h3>
<p>Snit defines the following commands for use in your object code:
that is, for use in type methods, instance methods, constructors,
destructors, onconfigure handlers, oncget handlers, and procs.
They do not reside in the ::snit:: namespace; instead, they are
created with the type, and can be used without qualification.</p>
<dl class="definitions">
<dt><a name="60"><b class="cmd">mymethod</b> <i class="arg">name</i> <span class="opt">?<i class="arg">args...</i>?</span></a></dt>
<dd><p>The <b class="cmd">mymethod</b> command is used for formatting callback commands to
be passed to other objects.  It returns a command that when called
will invoke method <i class="arg">name</i> with the specified arguments, plus of
course any arguments added by the caller.  In other words, both of the
following commands will cause the object's 
<b class="method">dosomething</b> method to be called when the <b class="cmd">$button</b> is pressed:</p>
<pre class="example">    $button configure -command [list $self dosomething myargument]
       
    $button configure -command [mymethod dosomething myargument]
</pre>
<p>The chief distinction between the two is that the latter form will not
break if the object's command is renamed.</p></dd>
<dt><a name="61"><b class="cmd">mytypemethod</b> <i class="arg">name</i> <span class="opt">?<i class="arg">args...</i>?</span></a></dt>
<dd><p>The <b class="cmd">mytypemethod</b> command is used for formatting callback commands to
be passed to other objects.  It returns a command that when called
will invoke type method <i class="arg">name</i> with the specified arguments, plus of
course any arguments added by the caller.  In other words, both of the
following commands will cause the object's <b class="method">dosomething</b> type method
to be called when <b class="cmd">$button</b> is pressed:</p>
<pre class="example">    $button configure -command [list $type dosomething myargument]
       
    $button configure -command [mytypemethod dosomething myargument]
</pre>
<p>Type commands cannot be renamed, so in practice there's little
difference between the two forms.  <b class="cmd">mytypemethod</b> is provided for
parallelism with <b class="cmd">mymethod</b>.</p></dd>
<dt><a name="62"><b class="cmd">myproc</b> <i class="arg">name</i> <span class="opt">?<i class="arg">args...</i>?</span></a></dt>
<dd><p>The <b class="cmd">myproc</b> command is used for formatting callback commands to
be passed to other objects.  It returns a command that when called
will invoke the type proc <i class="arg">name</i> with the specified arguments, plus of
course any arguments added by the caller.  In other words, both of the
following commands will cause the object's <b class="method">dosomething</b> proc
to be called when <b class="cmd">$button</b> is pressed:</p>
<pre class="example">    $button configure -command [list ${type}::dosomething myargument]
       
    $button configure -command [myproc dosomething myargument]
</pre>
</dd>
<dt><a name="63"><b class="cmd">myvar</b> <i class="arg">name</i></a></dt>
<dd><p>Given an instance variable name, returns the fully qualified name.
Use this if you're passing the variable to some other object, e.g., as
a <b class="option">-textvariable</b> to a Tk label widget.</p></dd>
<dt><a name="64"><b class="cmd">mytypevar</b> <i class="arg">name</i></a></dt>
<dd><p>Given an type variable name, returns the fully qualified name.  Use
this if you're passing the variable to some other object, e.g., as a
<b class="option">-textvariable</b> to a Tk label widget.</p></dd>
<dt><a name="65"><b class="cmd">from</b> <i class="arg">argvName</i> <i class="arg">option</i> <span class="opt">?<i class="arg">defvalue</i>?</span></a></dt>
<dd><p>The <b class="cmd">from</b> command plucks an option value from a list of options
and their values, such as is passed into a type's <b class="cmd">constructor</b>.
<i class="arg">argvName</i> must be the name of a variable containing such a list;
<i class="arg">option</i> is the name of the specific option.</p>
<p><b class="cmd">from</b> looks for <i class="arg">option</i> in the option list.  If it is found,
it and its value are removed from the list, and the value is returned.
If <i class="arg">option</i> doesn't appear in the list, then the <i class="arg">defvalue</i> is
returned.
If the option is locally-defined option, and <i class="arg">defvalue</i> is
not specified, then the option's default value as specified in the
type definition will be returned instead.</p></dd>
<dt><a name="66"><b class="cmd">install</b> <i class="arg">compName</i> <b class="const">using</b> <i class="arg">objType</i> <i class="arg">objName</i> <i class="arg">args...</i></a></dt>
<dd><p>Creates a new object of type <i class="arg">objType</i> called <i class="arg">objName</i>
and installs it as component <i class="arg">compName</i>, 
as described in <span class="sectref"><a href="#subsection7">Components and Delegation</a></span>.  Any additional
<i class="arg">args...</i> are passed along with the name to the <i class="arg">objType</i>
command.
If this is a <b class="cmd">snit::type</b>, then the following two commands are
equivalent:</p>
<pre class="example">    install myComp using myObjType $self.myComp args...
    set myComp [myObjType $self.myComp args...]
</pre>
<p>Note that whichever method is used, <i class="arg">compName</i> must still be
declared in the type definition using <b class="cmd">component</b>, or must be
referenced in at least one <b class="cmd">delegate</b> statement.</p>
<p>If this is a <b class="cmd">snit::widget</b> or <b class="cmd">snit::widgetadaptor</b>, and if
options have been delegated to component <i class="arg">compName</i>, then those
options will receive default values from the Tk option database.  Note
that it doesn't matter whether the component to be installed is a
widget or not.  See <span class="sectref"><a href="#subsection9">The Tk Option Database</a></span> for more
information.</p>
<p><b class="cmd">install</b> cannot be used to install type components; just assign
the type component's command name to the type component's variable
instead.</p></dd>
<dt><a name="67"><b class="cmd">installhull</b> <b class="const">using</b> <i class="arg">widgetType</i> <i class="arg">args...</i></a></dt>
<dd></dd>
<dt><a name="68"><b class="cmd">installhull</b> <i class="arg">name</i></a></dt>
<dd><p>The constructor of a <b class="cmd">snit::widgetadaptor</b> must create a widget to
be the object's hull component; the widget is installed as the hull
component using this command.  Note that the installed widget's name
must be <b class="const">$win</b>.
This command has two forms.</p>
<p>The first form specifies the <i class="arg">widgetType</i> and the <i class="arg">args...</i>
(that is, the hardcoded option list) to use in creating the hull.
Given this form, <b class="cmd">installhull</b> creates the hull widget, and
initializes any options delegated to the hull from the Tk option
database.</p>
<p>In the second form, the hull widget has already been created; note
that its name must be &quot;$win&quot;.  In this case, the Tk option database is
<em>not</em> queried for any options delegated to the hull.
The longer form is preferred; however, the shorter form allows the
programmer to adapt a widget created elsewhere, which is sometimes
useful.  For example, it can be used to adapt a &quot;page&quot; widget created
by a <b class="package">BWidgets</b> tabbed notebook or pages manager widget.</p>
<p>See <span class="sectref"><a href="#subsection9">The Tk Option Database</a></span> for more information
about <b class="cmd">snit::widgetadaptor</b>s and the option database.</p></dd>
<dt><a name="69"><b class="cmd">variable</b> <i class="arg">name</i></a></dt>
<dd><p>Normally, instance variables are defined in the type definition along
with the options, methods, and so forth; such instance variables are
automatically visible in all instance code (e.g., method bodies).  However,
instance code can use the <b class="cmd">variable</b> command to declare instance variables
that don't appear in the type definition, and also to bring variables
from other namespaces into scope in the usual way.</p>
<p>It's generally clearest to define all instance variables in the type
definition, and omit declaring them in methods and so forth.</p>
<p>Note that this is an instance-specific version of the standard Tcl 
<b class="cmd">::variable</b> command.</p></dd>
<dt><a name="70"><b class="cmd">typevariable</b> <i class="arg">name</i></a></dt>
<dd><p>Normally, type variables are defined in the type definition, along
with the instance variables; such type variables are automatically
visible in all of the type's code.  However, type methods, instance
methods and so forth can use <b class="cmd">typevariable</b> to declare type 
variables that don't appear in the type definition.</p>
<p>It's generally clearest to declare all type variables in the type
definition, and omit declaring them in methods, type methods, etc.</p></dd>
<dt><a name="71"><b class="cmd">varname</b> <i class="arg">name</i></a></dt>
<dd><p><b class="const">Deprecated.</b>  Use <b class="cmd">myvar</b> instead.</p>
<p>Given an instance variable name, returns the fully qualified name.
Use this if you're passing the variable to some other object, e.g., as
a <b class="option">-textvariable</b> to a Tk label widget.</p></dd>
<dt><a name="72"><b class="cmd">typevarname</b> <i class="arg">name</i></a></dt>
<dd><p><b class="const">Deprecated.</b>  Use <b class="cmd">mytypevar</b> instead.</p>
<p>Given a type variable name, returns the fully qualified name.  Use
this if you're passing the type variable to some other object, e.g., as a
<b class="option">-textvariable</b> to a Tk label widget.</p></dd>
<dt><a name="73"><b class="cmd">codename</b> <i class="arg">name</i></a></dt>
<dd><p><b class="const">Deprecated.</b>  Use <b class="cmd">myproc</b> instead.
Given the name of a proc (but not a type or instance method), returns
the fully-qualified command name, suitable for passing as a callback.</p></dd>
</dl>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Components and Delegation</a></h3>
<p>When an object includes other objects, as when a toolbar contains
buttons or a GUI object contains an object that references a database,
the included object is called a component.  The standard way to handle
component objects owned by a Snit object is to declare them using
<b class="cmd">component</b>, which creates a component instance variable.  
In the following example, a <b class="cmd">dog</b> object has a
<b class="cmd">tail</b> object:</p>
<pre class="example">    snit::type dog {
        component mytail
    
        constructor {args} {
            set mytail [tail %AUTO% -partof $self]
            $self configurelist $args
        }
    
        method wag {} {
            $mytail wag
        }
    }
    
    snit::type tail {
        option -length 5
        option -partof
        method wag {} { return &quot;Wag, wag, wag.&quot;}
    }
</pre>
<p>Because the <b class="cmd">tail</b> object's name is stored in an instance
variable, it's easily accessible in any method.</p>
<p>The <b class="cmd">install</b> command provides an alternate way
to create and install the component:</p>
<pre class="example">    snit::type dog {
        component mytail
        constructor {args} {
            install mytail using tail %AUTO% -partof $self
            $self configurelist $args
        }
        method wag {} {
            $mytail wag
        }
    }
</pre>
<p>For <b class="cmd">snit::type</b>s, the two methods are equivalent; for
<b class="cmd">snit::widget</b>s and <b class="cmd">snit::widgetadaptor</b>s, the <b class="cmd">install</b>
command properly initializes the widget's options by querying
<span class="sectref"><a href="#subsection9">The Tk Option Database</a></span>.</p>
<p>In the above examples, the <b class="cmd">dog</b> object's <b class="method">wag</b> method
simply calls the <b class="cmd">tail</b> component's <b class="method">wag</b> method.  In OO
jargon, this is called delegation.  Snit provides an easier way to do
this:</p>
<pre class="example">    snit::type dog {
        delegate method wag to mytail
    
        constructor {args} {
            install mytail using tail %AUTO% -partof $self
            $self configurelist $args
        }
    }
</pre>
<p>The <b class="cmd">delegate</b> statement in the type definition implicitly defines
the instance variable <b class="variable">mytail</b> to hold the component's name
(though it's good form to use <b class="cmd">component</b> to declare it explicitly); it
also defines the <b class="cmd">dog</b> object's <b class="method">wag</b> method, delegating it
to the <b class="variable">mytail</b> component.</p>
<p>If desired, all otherwise unknown methods can be delegated to a
specific component:</p>
<pre class="example">
    snit::type dog {
	delegate method * to mytail
	constructor {args} {
	    set mytail [tail %AUTO% -partof $self]
	    $self configurelist $args
	}
	method bark { return &quot;Bark, bark, bark!&quot; }
    }
</pre>
<p>In this case, a <b class="cmd">dog</b> object will handle its own <b class="method">bark</b>
method; but <b class="method">wag</b> will be passed along to <b class="cmd">mytail</b>.  Any
other method, being recognized by neither <b class="cmd">dog</b> nor <b class="cmd">tail</b>,
will simply raise an error.</p>
<p>Option delegation is similar to method delegation, except for the
interactions with the Tk option database; this is described in 
<span class="sectref"><a href="#subsection9">The Tk Option Database</a></span>.</p>
</div>
<div id="subsection8" class="subsection"><h3><a name="subsection8">Type Components and Delegation</a></h3>
<p>The relationship between type components and instance components is
identical to that between type variables and instance variables, and
that between type methods and instance methods.  Just as an instance
component is an instance variable that holds the name of a command, so
a type component is a type variable that holds the name of a command.
In essence, a type component is a component that's shared by every
instance of the type.</p>
<p>Just as <b class="cmd">delegate method</b> can be used to delegate methods to
instance components, as described in 
<span class="sectref"><a href="#subsection7">Components and Delegation</a></span>, so <b class="cmd">delegate typemethod</b>
can be used to delegate type methods to type components.</p>
<p>Note also that as of Snit 0.95 <b class="cmd">delegate method</b> can delegate
methods to both instance components and type components.</p>
</div>
<div id="subsection9" class="subsection"><h3><a name="subsection9">The Tk Option Database</a></h3>
<p>This section describes how Snit interacts with the Tk option database,
and assumes the reader has a working knowledge of the option database
and its uses.  The book <em>Practical Programming in Tcl and Tk</em>
by Welch et al has a good introduction to the option database, as does
<em>Effective Tcl/Tk Programming</em>.</p>
<p>Snit is implemented so that most of the time it will simply do the
right thing with respect to the option database, provided that the
widget developer does the right thing by Snit.  The body of this
section goes into great deal about what Snit requires.  The following
is a brief statement of the requirements, for reference.</p>
<ul class="itemized">
<li><p>If the <b class="cmd">snit::widget</b>'s default widget class is not what is desired, set it
explicitly using <b class="cmd">widgetclass</b> in the widget definition.</p></li>
<li><p>When defining or delegating options, specify the resource and class
names explicitly when if the defaults aren't what you want.</p></li>
<li><p>Use <b class="cmd">installhull using</b> to install the hull for
<b class="cmd">snit::widgetadaptor</b>s.</p></li>
<li><p>Use <b class="cmd">install</b> to install all other components.</p></li>
</ul>
<p>The interaction of Tk widgets with the option database is a complex
thing; the interaction of Snit with the option database is even more
so, and repays attention to detail.</p>
<p><b class="const">Setting the widget class:</b> Every Tk widget has a widget class.
For Tk widgets, the widget class name is the just the widget type name
with an initial capital letter, e.g., the widget class for
<b class="cmd">button</b> widgets is &quot;Button&quot;.</p>
<p>Similarly, the widget class of a <b class="cmd">snit::widget</b> defaults to the
unqualified type name with the first letter capitalized.  For example,
the widget class of</p>
<pre class="example">    snit::widget ::mylibrary::scrolledText { ... }</pre>
<p>is &quot;ScrolledText&quot;.  The widget class can also be set explicitly using
the <b class="cmd">widgetclass</b> statement within the <b class="cmd">snit::widget</b>
definition.</p>
<p>Any widget can be used as the <b class="cmd">hulltype</b> provided that it supports
the <b class="const">-class</b> option for changing its widget class name.  See
the discussion of the <b class="cmd">hulltype</b> command, above.  The user may pass
<b class="const">-class</b> to the widget at instantion.</p>
<p>The widget class of a <b class="cmd">snit::widgetadaptor</b> is just the widget
class of its hull widget; this cannot be changed unless the hull
widget supports <b class="const">-class</b>, in which case it will
usually make more sense to use <b class="cmd">snit::widget</b> rather than
<b class="cmd">snit::widgetadaptor</b>.</p>
<p><b class="const">Setting option resource names and classes:</b> In Tk, every
option has three names: the option name, the resource name, and the
class name.  The option name begins with a hyphen and is all lowercase;
it's used when creating widgets, and with the <b class="cmd">configure</b> and
<b class="cmd">cget</b> commands.</p>
<p>The resource and class names are used to initialize option default
values by querying the Tk option database.  The resource name is
usually just the option name minus the hyphen, but may contain
uppercase letters at word boundaries; the class name is usually just
the resource name with an initial capital, but not always.  For
example, here are the option, resource, and class names for several
<b class="cmd"><a href="../../../../index.html#key454">text</a></b> widget options:</p>
<pre class="example">    -background         background         Background 
    -borderwidth        borderWidth        BorderWidth 
    -insertborderwidth  insertBorderWidth  BorderWidth 
    -padx               padX               Pad 
</pre>
<p>As is easily seen, sometimes the resource and class names can be
inferred from the option name, but not always.</p>
<p>Snit options also have a resource name and a class name.  By default,
these names follow the rule given above: the resource name is the
option name without the hyphen, and the class name is the resource
name with an initial capital.  This is true for both locally-defined
options and explicitly delegated options:</p>
<pre class="example">    snit::widget mywidget {
        option -background
        delegate option -borderwidth to hull
        delegate option * to text
	# ...
    }
</pre>
<p>In this case, the widget class name is &quot;Mywidget&quot;.  The widget has the
following options: <b class="option">-background</b>, which is locally defined, and
<b class="option">-borderwidth</b>, which is explicitly delegated; all other widgets are
delegated to a component called &quot;text&quot;, which is probably a Tk
<b class="cmd"><a href="../../../../index.html#key454">text</a></b> widget.  If so, <b class="cmd">mywidget</b> has all the same options as
a <b class="cmd"><a href="../../../../index.html#key454">text</a></b> widget.  The option, resource, and class names are as
follows:</p>
<pre class="example">    -background  background  Background
    -borderwidth borderwidth Borderwidth
    -padx        padX        Pad
</pre>
<p>Note that the locally defined option, <b class="option">-background</b>, happens to have
the same three names as the standard Tk <b class="option">-background</b> option; and
<b class="option">-pad</b>, which is delegated implicitly to the <b class="variable">text</b>
component, has the
same three names for <b class="cmd">mywidget</b> as it does for the <b class="cmd"><a href="../../../../index.html#key454">text</a></b>
widget.  <b class="option">-borderwidth</b>, on the other hand, has different resource and
class names than usual, because the internal word &quot;width&quot; isn't
capitalized.  For consistency, it should be; this is done as follows:</p>
<pre class="example">    snit::widget mywidget {
	option -background
	delegate option {-borderwidth borderWidth} to hull
	delegate option * to text
	# ...
    }
</pre>
<p>The class name will default to &quot;BorderWidth&quot;, as expected.</p>
<p>Suppose, however, that <b class="cmd">mywidget</b> also delegated 
<b class="option">-padx</b> and
<b class="option">-pady</b> to the hull.  In this case, both the resource name and the
class name must be specified explicitly:</p>
<pre class="example">    snit::widget mywidget {
	option -background
	delegate option {-borderwidth borderWidth} to hull
	delegate option {-padx padX Pad} to hull
	delegate option {-pady padY Pad} to hull
	delegate option * to text
	# ...
    }
</pre>
<p><b class="const">Querying the option database:</b> If you set your widgetclass and
option names as described above, Snit will query the option database
when each instance is created, and will generally do the right thing
when it comes to querying the option database.  The remainder of this
section goes into the gory details.</p>
<p><b class="const">Initializing locally defined options:</b>
When an instance of a snit::widget is created, its locally defined
options are initialized as follows: each option's resource and class
names are used to query the Tk option database.  If the result is
non-empty, it is used as the option's default; otherwise, the default
hardcoded in the type definition is used.  In either case, the default
can be overridden by the caller.  For example,</p>
<pre class="example">    option add *Mywidget.texture pebbled
    snit::widget mywidget {
	option -texture smooth
	# ...
    }
    mywidget .mywidget -texture greasy
</pre>
<p>Here, <b class="option">-texture</b> would normally default to &quot;smooth&quot;, but because of
the entry added to the option database it defaults to &quot;pebbled&quot;.
However, the caller has explicitly overridden the default, and so the
new widget will be &quot;greasy&quot;.</p>
<p><b class="const">Initializing options delegated to the hull:</b>
A <b class="cmd">snit::widget</b>'s hull is a widget, and given that its class has
been set it is expected to query the option database for itself.  The
only exception concerns options that are delegated to it with a
different name.  Consider the following code:</p>
<pre class="example">    option add *Mywidget.borderWidth 5
    option add *Mywidget.relief sunken
    option add *Mywidget.hullbackground red
    option add *Mywidget.background green
    snit::widget mywidget {
	delegate option -borderwidth to hull
	delegate option -hullbackground to hull as -background
	delegate option * to hull
	# ...
    }
    mywidget .mywidget
    set A [.mywidget cget -relief]
    set B [.mywidget cget -hullbackground]
    set C [.mywidget cget -background]
    set D [.mywidget cget -borderwidth]
</pre>
<p>The question is, what are the values of variables A, B, C and D?</p>
<p>The value of A is &quot;sunken&quot;.  The hull is a Tk frame that has been
given the widget class &quot;Mywidget&quot;; it will automatically query the
option database and pick up this value.  Since the <b class="option">-relief</b>
option is implicitly delegated to the hull, Snit takes no action.</p>
<p>The value of B is &quot;red&quot;.  The hull will automatically pick up the
value &quot;green&quot; for its <b class="option">-background</b> option, just as it picked up the
<b class="option">-relief</b> value.  However, Snit knows that 
<b class="option">-hullbackground</b> is mapped to
the hull's <b class="option">-background</b> option; hence, it queries the option database
for <b class="option">-hullbackground</b> and gets &quot;red&quot; and updates the hull 
accordingly.</p>
<p>The value of C is also &quot;red&quot;, because <b class="option">-background</b> is implicitly
delegated to the hull; thus, retrieving it is the same as retrieving
<b class="option">-hullbackground</b>.  Note that this case is unusual; in practice,
<b class="option">-background</b> would probably be explicitly delegated to some other
component.</p>
<p>The value of D is &quot;5&quot;, but not for the reason you think.  Note that as
it is defined above, the resource name for <b class="option">-borderwidth</b>
defaults to &quot;borderwidth&quot;, whereas the option database entry is 
&quot;borderWidth&quot;.  As with <b class="option">-relief</b>, the hull picks up its 
own <b class="option">-borderwidth</b> option before Snit does anything.  Because the
option is delegated under its own name, Snit assumes that the correct 
thing has happened, and doesn't worry about it any further.</p>
<p>For <b class="cmd">snit::widgetadaptor</b>s, the case is somewhat altered.  Widget
adaptors retain the widget class of their hull, and the hull is not
created automatically by Snit.  Instead, the <b class="cmd">snit::widgetadaptor</b>
must call <b class="cmd">installhull</b> in its constructor.  The normal way to do
this is as follows:</p>
<pre class="example">    snit::widgetadaptor mywidget {
	# ...
	constructor {args} {
	    # ...
	    installhull using text -foreground white
	    #
	}
	#...
    }
</pre>
<p>In this case, the <b class="cmd">installhull</b> command will create the hull using
a command like this:</p>
<pre class="example">    set hull [text $win -foreground white]
</pre>
<p>The hull is a <b class="cmd"><a href="../../../../index.html#key454">text</a></b> widget, so its widget class is &quot;Text&quot;.  Just
as with <b class="cmd">snit::widget</b> hulls, Snit assumes that it will pick up
all of its normal option values automatically; options delegated from
a different name are initialized from the option database in the same
way.</p>
<p><b class="const">Initializing options delegated to other components:</b>
Non-hull components are matched against the option database in two
ways.  First, a component widget remains a widget still, and therefore
is initialized from the option database in the usual way.
Second, the option database is queried for all options delegated to
the component, and the component is initialized accordingly--provided
that the <b class="cmd">install</b> command is used to create it.</p>
<p>Before option database support was added to Snit, the usual way to
create a component was to simply create it in the constructor and
assign its command name to the component variable:</p>
<pre class="example">    snit::widget mywidget {
	delegate option -background to myComp
	constructor {args} {
	    set myComp [text $win.text -foreground black]
	}
    }
</pre>
<p>The drawback of this method is that Snit has no opportunity to
initialize the component properly.  Hence, the following approach is
now used:</p>
<pre class="example">    snit::widget mywidget {
	delegate option -background to myComp
	constructor {args} {
	    install myComp using text $win.text -foreground black
	}
    }
</pre>
<p>The <b class="cmd">install</b> command does the following:</p>
<ul class="itemized">
<li><p>Builds a list of the options explicitly included in the <b class="cmd">install</b>
command -- in this case, <b class="option">-foreground</b>.</p></li>
<li><p>Queries the option database for all options delegated explicitly to
the named component.</p></li>
<li><p>Creates the component using the specified command, after inserting
into it a list of options and values read from the option database.
Thus, the explicitly included options (<b class="option">-foreground</b>) will override
anything read from the option database.</p></li>
<li><p>If the widget definition implicitly delegated options to the component
using <b class="cmd">delegate option *</b>, then Snit calls the newly created
component's <b class="cmd">configure</b> method to receive a list of all of the
component's options.  From this Snit builds a list of options
implicitly delegated to the component that were not explicitly
included in the <b class="cmd">install</b> command.  For all such options, Snit
queries the option database and configures the component accordingly.</p></li>
</ul>
<p><b class="const">Non-widget components:</b> The option database is never queried
for <b class="cmd">snit::type</b>s, since it can only be queried given a Tk widget
name.
However, <b class="cmd">snit::widget</b>s can have non-widget components.  And if
options are delegated to those components, and if the <b class="cmd">install</b>
command is used to install those components, then they will be
initialized from the option database just as widget components are.</p>
</div>
<div id="subsection10" class="subsection"><h3><a name="subsection10">Macros and Meta-programming</a></h3>
<p>The <b class="cmd">snit::macro</b> command enables a certain amount of
meta-programming with Snit classes.  For example, suppose you like to
define properties: instance variables that have set/get methods.  Your
code might look like this:</p>
<pre class="example">    snit::type dog {
        variable mood happy
        method getmood {} {
            return $mood
        }
        method setmood {newmood} {
            set mood $newmood
        }
    }
</pre>
<p>That's nine lines of text per property.  Or, you could define the
following <b class="cmd">snit::macro</b>:</p>
<pre class="example">    snit::macro property {name initValue} {
        variable $name $initValue
        method get$name {} &quot;return $name&quot;
        method set$name {value} &quot;set $name \$value&quot;
    }
</pre>
<p>Note that a <b class="cmd">snit::macro</b> is just a normal Tcl proc defined in
the slave interpreter used to compile type and widget definitions; as
a result, it has access to all the commands used to define types and
widgets.</p>
<p>Given this new macro, you can define a property in one line of code:</p>
<pre class="example">    snit::type dog {
        property mood happy
    }
</pre>
<p>Within a macro, the commands <b class="cmd">variable</b> and <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> refer to
the Snit type-definition commands, not the standard Tcl commands.  To
get the standard Tcl commands, use <b class="cmd">_variable</b> and <b class="cmd">_proc</b>.</p>
<p>Because a single slave interpreter is used for compiling all Snit
types and widgets in the application, there's the possibility of macro
name collisions.  If you're writing a reuseable package using Snit,
and you use some <b class="cmd">snit::macro</b>s, define them in your package
namespace:</p>
<pre class="example">    snit::macro mypkg::property {name initValue} { ... }
    snit::type dog {
        mypkg::property mood happy
    }
</pre>
<p>This leaves the global namespace open for application authors.</p>
</div>
<div id="subsection11" class="subsection"><h3><a name="subsection11">Validation Types</a></h3>
<p>A validation type is an object that can be used to validate
Tcl values of a particular kind.  For example, 
<b class="cmd">snit::integer</b> is used to validate that a Tcl value is
an integer.</p>
<p>Every validation type has a <b class="method">validate</b> method which is used to
do the validation. This method must take a single argument, the value
to be validated; further, it must do nothing if the value is valid,
but throw an error if the value is invalid:</p>
<pre class="example">    snit::integer validate 5     ;# Does nothing
    snit::integer validate 5.0   ;# Throws an error (not an integer!)
</pre>
<p>The <b class="method">validate</b> method will always return the validated value on success,
and throw the <b class="cmd">-errorcode</b> INVALID on error.</p>
<p>Snit defines a family of validation types, all of which are
implemented as <b class="cmd">snit::type</b>'s.  They can be used as is;
in addition, their instances serve as parameterized
subtypes.  For example, a probability is a number between 0.0 and 1.0
inclusive:</p>
<pre class="example">    snit::double probability -min 0.0 -max 1.0
</pre>
<p>The example above creates an instance of <b class="cmd">snit::double</b>--a
validation subtype--called
<b class="cmd">probability</b>, which can be used to validate probability values:</p>
<pre class="example">    probability validate 0.5   ;# Does nothing
    probability validate 7.9   ;# Throws an error
</pre>
<p>Validation subtypes can be defined explicitly, as in the above
example; when a locally-defined option's <b class="const">-type</b> is specified,
they may also be created on the fly:</p>
<pre class="example">    snit::enum ::dog::breed -values {mutt retriever sheepdog}
    snit::type dog {
        # Define subtypes on the fly...
        option -breed -type {
            snit::enum -values {mutt retriever sheepdog}
        }
        # Or use predefined subtypes...
        option -breed -type ::dog::breed 
    }
</pre>
<p>Any object that has a <b class="method">validate</b> method with the semantics
described above can be used as a validation type; see 
<span class="sectref"><a href="#subsection12">Defining Validation Types</a></span> for information on how to define
new ones.</p>
<p>Snit defines the following validation types:</p>
<dl class="definitions">
<dt><a name="74"><b class="cmd">snit::boolean</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="75"><b class="cmd">snit::boolean</b> <i class="arg">name</i></a></dt>
<dd><p>Validates Tcl boolean values: 1, 0, <b class="const">on</b>, <b class="const">off</b>,
<b class="const">yes</b>, <b class="const">no</b>, <b class="const">true</b>, <b class="const">false</b>.
It's possible to define subtypes--that is, instances--of
<b class="cmd">snit::boolean</b>, but as it has no options there's no reason to do
so.</p></dd>
<dt><a name="76"><b class="cmd">snit::double</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="77"><b class="cmd">snit::double</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></dt>
<dd><p>Validates floating-point values.  Subtypes may be created with the
following options:</p>
<dl class="definitions">
<dt><b class="const">-min</b> <i class="arg">min</i></dt>
<dd><p>Specifies a floating-point minimum bound; a value is invalid if it is strictly
less than <i class="arg">min</i>.</p></dd>
<dt><b class="const">-max</b> <i class="arg">max</i></dt>
<dd><p>Specifies a floating-point maximum bound; a value is invalid if it is strictly
greater than <i class="arg">max</i>.</p></dd>
</dl></dd>
<dt><a name="78"><b class="cmd">snit::enum</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="79"><b class="cmd">snit::enum</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></dt>
<dd><p>Validates that a value comes from an enumerated list.  The base
type is of little use by itself, as only subtypes actually have
an enumerated list to validate against.  Subtypes may be created
with the following options:</p>
<dl class="definitions">
<dt><b class="const">-values</b> <i class="arg">list</i></dt>
<dd><p>Specifies a list of valid values.  A value is valid if and only if
it's included in the list.</p></dd>
</dl></dd>
<dt><a name="80"><b class="cmd">snit::fpixels</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="81"><b class="cmd">snit::fpixels</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></dt>
<dd><p><em>Tk programs only.</em> Validates screen distances, in any of the
forms accepted by <b class="cmd">winfo fpixels</b>. Subtypes may be created with the
following options:</p>
<dl class="definitions">
<dt><b class="const">-min</b> <i class="arg">min</i></dt>
<dd><p>Specifies a minimum bound; a value is invalid if it is strictly
less than <i class="arg">min</i>.  The bound may be expressed in any of the 
forms accepted by <b class="cmd">winfo fpixels</b>.</p></dd>
<dt><b class="const">-max</b> <i class="arg">max</i></dt>
<dd><p>Specifies a maximum bound; a value is invalid if it is strictly
greater than <i class="arg">max</i>.  The bound may be expressed in any of the 
forms accepted by <b class="cmd">winfo fpixels</b>.</p></dd>
</dl></dd>
<dt><a name="82"><b class="cmd">snit::integer</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="83"><b class="cmd">snit::integer</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></dt>
<dd><p>Validates integer values.  Subtypes may be created with the
following options:</p>
<dl class="definitions">
<dt><b class="const">-min</b> <i class="arg">min</i></dt>
<dd><p>Specifies an integer minimum bound; a value is invalid if it is strictly
less than <i class="arg">min</i>.</p></dd>
<dt><b class="const">-max</b> <i class="arg">max</i></dt>
<dd><p>Specifies an integer maximum bound; a value is invalid if it is strictly
greater than <i class="arg">max</i>.</p></dd>
</dl></dd>
<dt><a name="84"><b class="cmd">snit::listtype</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="85"><b class="cmd">snit::listtype</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></dt>
<dd><p>Validates Tcl lists. Subtypes may be created with the
following options:</p>
<dl class="definitions">
<dt><b class="const">-minlen</b> <i class="arg">min</i></dt>
<dd><p>Specifies a minimum list length; the value is invalid if it has
fewer than <i class="arg">min</i> elements.  Defaults to 0.</p></dd>
<dt><b class="const">-maxlen</b> <i class="arg">max</i></dt>
<dd><p>Specifies a maximum list length; the value is invalid if it 
more than <i class="arg">max</i> elements.</p></dd>
<dt><b class="const">-type</b> <i class="arg">type</i></dt>
<dd><p>Specifies the type of the list elements; <i class="arg">type</i> must be
the name of a validation type or subtype.  In the
following example, the value of <b class="const">-numbers</b> must be a list
of integers.</p>
<pre class="example">    option -numbers -type {snit::listtype -type snit::integer}
</pre>
<p>Note that this option doesn't support defining new validation subtypes
on the fly; that is, the following code will not work (yet, anyway):</p>
<pre class="example">    option -numbers -type {
        snit::listtype -type {snit::integer -min 5}
    }
</pre>
<p>Instead, define the subtype explicitly:</p>
<pre class="example">    snit::integer gt4 -min 5
    snit::type mytype {
        option -numbers -type {snit::listtype -type gt4}
    }
</pre>
</dd>
</dl></dd>
<dt><a name="86"><b class="cmd">snit::pixels</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="87"><b class="cmd">snit::pixels</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></dt>
<dd><p><em>Tk programs only.</em> Validates screen distances, in any of the
forms accepted by <b class="cmd">winfo pixels</b>. Subtypes may be created with the
following options:</p>
<dl class="definitions">
<dt><b class="const">-min</b> <i class="arg">min</i></dt>
<dd><p>Specifies a minimum bound; a value is invalid if it is strictly
less than <i class="arg">min</i>.  The bound may be expressed in any of the 
forms accepted by <b class="cmd">winfo pixels</b>.</p></dd>
<dt><b class="const">-max</b> <i class="arg">max</i></dt>
<dd><p>Specifies a maximum bound; a value is invalid if it is strictly
greater than <i class="arg">max</i>.  The bound may be expressed in any of the 
forms accepted by <b class="cmd">winfo pixels</b>.</p></dd>
</dl></dd>
<dt><a name="88"><b class="cmd">snit::stringtype</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="89"><b class="cmd">snit::stringtype</b> <i class="arg">name</i> <span class="opt">?<i class="arg">option</i> <i class="arg">value</i>...?</span></a></dt>
<dd><p>Validates Tcl strings. The base type is of little use by itself,
since very Tcl value is also a valid string.  Subtypes may be created with the
following options:</p>
<dl class="definitions">
<dt><b class="const">-minlen</b> <i class="arg">min</i></dt>
<dd><p>Specifies a minimum string length; the value is invalid if it has
fewer than <i class="arg">min</i> characters.  Defaults to 0.</p></dd>
<dt><b class="const">-maxlen</b> <i class="arg">max</i></dt>
<dd><p>Specifies a maximum string length; the value is invalid if it has
more than <i class="arg">max</i> characters.</p></dd>
<dt><b class="const">-glob</b> <i class="arg">pattern</i></dt>
<dd><p>Specifies a <b class="cmd">string match</b> pattern; the value is invalid
if it doesn't match the pattern.</p></dd>
<dt><b class="const">-regexp</b> <i class="arg">regexp</i></dt>
<dd><p>Specifies a regular expression; the value is invalid if it doesn't
match the regular expression.</p></dd>
<dt><b class="const">-nocase</b> <i class="arg">flag</i></dt>
<dd><p>By default, both <b class="const">-glob</b> and <b class="const">-regexp</b> matches are
case-sensitive.  If <b class="const">-nocase</b> is set to true, then both
<b class="const">-glob</b> and <b class="const">-regexp</b> matches are case-insensitive.</p></dd>
</dl></dd>
<dt><a name="90"><b class="cmd">snit::window</b> <b class="const">validate</b> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd></dd>
<dt><a name="91"><b class="cmd">snit::window</b> <i class="arg">name</i></a></dt>
<dd><p><em>Tk programs only.</em>  Validates Tk window names.  The value must
cause <b class="cmd">winfo exists</b> to return true; otherwise, the value is
invalid.  It's possible to define subtypes--that is, instances--of
<b class="cmd">snit::window</b>, but as it has no options at present there's no 
reason to do so.</p></dd>
</dl>
</div>
<div id="subsection12" class="subsection"><h3><a name="subsection12">Defining Validation Types</a></h3>
<p>There are three ways to define a new validation type: as a subtype of
one of Snit's validation types, as a validation type command, and as
a full-fledged validation type similar to those provided by Snit.
Defining subtypes of Snit's validation types is described above,
under <span class="sectref"><a href="#subsection11">Validation Types</a></span>.</p>
<p>The next simplest way to create a new validation type is as a 
validation type command.  A validation type is simply an
object that has a <b class="method">validate</b> method; the <b class="method">validate</b>
method must take one argument, a value, return the value if it is
valid, and throw an error with <b class="cmd">-errorcode</b> INVALID if the
value is invalid.  This can be done with a simple <b class="cmd"><a href="../../../../index.html#key543">proc</a></b>.  For
example, the <b class="cmd">snit::boolean</b> validate type could have been
implemented like this:</p>
<pre class="example">    proc ::snit::boolean {&quot;validate&quot; value} {
        if {![string is boolean -strict $value]} {
            return -code error -errorcode INVALID \ 
                &quot;invalid boolean \&quot;$value\&quot;, should be one of: 1, 0, ...&quot;
        }
        return $value
    }
</pre>
<p>A validation type defined in this way cannot be subtyped, of course;
but for many applications this will be sufficient.</p>
<p>Finally, one can define a full-fledged, subtype-able validation type
as a <b class="cmd">snit::type</b>.  Here's a skeleton to get you started:</p>
<pre class="example">    snit::type myinteger {
        # First, define any options you'd like to use to define
        # subtypes.  Give them defaults such that they won't take
        # effect if they aren't used, and marked them &quot;read-only&quot;.
        # After all, you shouldn't be changing their values after
        # a subtype is defined.
        #
        # For example:
        option -min -default &quot;&quot; -readonly 1
        option -max -default &quot;&quot; -readonly 1
        # Next, define a &quot;validate&quot; type method which should do the
        # validation in the basic case.  This will allow the
        # type command to be used as a validation type.  
        typemethod validate {value} {
            if {![string is integer -strict $value]} {
                return -code error -errorcode INVALID \ 
                    &quot;invalid value \&quot;$value\&quot;, expected integer&quot;
            }
            return $value
        }
        # Next, the constructor should validate the subtype options,
        # if any.  Since they are all readonly, we don't need to worry
        # about validating the options on change.
        constructor {args} {
            # FIRST, get the options
            $self configurelist $args
            # NEXT, validate them.
            # I'll leave this to your imagination.
        }
        # Next, define a &quot;validate&quot; instance method; its job is to
        # validate values for subtypes.
        method validate {value} {
            # First, call the type method to do the basic validation.
            $type validate $value
            # Now we know it's a valid integer.
            if {(&quot;&quot; != $options(-min) &amp;&amp; $value &lt; $options(-min))  ||
                (&quot;&quot; != $options(-max) &amp;&amp; $value &gt; $options(-max))} {
                # It's out of range; format a detailed message about
                # the error, and throw it.
                set msg &quot;....&quot;
                
                return -code error -errorcode INVALID $msg
            }
            # Otherwise, if it's valid just return it.
            return $valid
        }
    }
</pre>
<p>And now you have a type that can be subtyped.</p>
<p>The file &quot;validate.tcl&quot; in the Snit distribution defines all of Snit's
validation types; you can find the complete implementation for 
<b class="cmd">snit::integer</b> and the other types there, to use as examples for
your own types.</p>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">CAVEATS</a></h2>
<p>If you have problems, find bugs, or new ideas you are hereby cordially
invited to submit a report of your problem, bug, or idea at the
SourceForge trackers for tcllib, which can be found at
<a href="http://sourceforge.net/projects/tcllib/">http://sourceforge.net/projects/tcllib/</a>.
The relevant category is <em>snit</em>.</p>
<p>Additionally, you might wish to join the Snit mailing list;
see <a href="http://www.wjduquette.com/snit">http://www.wjduquette.com/snit</a> for details.</p>
<p>One particular area to watch is using <b class="cmd">snit::widgetadaptor</b> to
adapt megawidgets created by other megawidget packages; correct
widget destruction depends on the order of the &lt;Destroy&gt; bindings.
The wisest course is simply not to do this.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">KNOWN BUGS</a></h2>
<ul class="itemized">
<li><p>Error stack traces returned by Snit 1.x are extremely ugly and typically
contain far too much information about Snit internals.  The error
messages are much improved in Snit 2.2.</p></li>
<li><p>Also see the SourceForge Trackers at
<a href="http://sourceforge.net/projects/tcllib/">http://sourceforge.net/projects/tcllib/</a>, category <em>snit</em>.</p></li>
</ul>
</div>
<div id="section6" class="section"><h2><a name="section6">HISTORY</a></h2>
<p>During the course of developing Notebook
(See <a href="http://www.wjduquette.com/notebook">http://www.wjduquette.com/notebook</a>), my Tcl-based personal
notebook application, I found I was writing it as a collection of
objects.  I wasn't using any particular object-oriented framework; I
was just writing objects in pure Tcl following the guidelines in my
Guide to Object Commands
(see <a href="http://www.wjduquette.com/tcl/objects.html">http://www.wjduquette.com/tcl/objects.html</a>), along with a
few other tricks I'd picked up since.  And though it was working well,
it quickly became tiresome because of the amount of boilerplate
code associated with each new object type.</p>
<p>So that was one thing--tedium is a powerful motivator.  But the other
thing I noticed is that I wasn't using inheritance at all, and I
wasn't missing it.  Instead, I was using delegation: objects that
created other objects and delegated methods to them.</p>
<p>And I said to myself, &quot;This is getting tedious...there has got to be a
better way.&quot;  And one afternoon, on a whim, I started working on Snit,
an object system that works the way Tcl works.  Snit doesn't support
inheritance, but it's great at delegation, and it makes creating
megawidgets easy.</p>
<p>If you have any comments or suggestions (or bug reports!) don't
hesitate to send me e-mail at <a href="[email protected]">[email protected]</a>.  In addition,
there's a Snit mailing list; you can find out more about it at the
Snit home page (see <a href="http://www.wjduquette.com/snit">http://www.wjduquette.com/snit</a>).</p>
</div>
<div id="section7" class="section"><h2><a name="section7">CREDITS</a></h2>
<p>Snit has been designed and implemented from the very beginning by
William H. Duquette.  However, much credit belongs to the following
people for using Snit and providing me with valuable feedback: Rolf
Ade, Colin McCormack, Jose Nazario, Jeff Godfrey, Maurice Diamanti,
Egon Pasztor, David S. Cargo, Tom Krehbiel, Michael Cleverly, 
Andreas Kupries, Marty Backe, Andy Goth, Jeff Hobbs, Brian
Griffin, Donal Fellows, Miguel Sofer, Kenneth Green, 
and Anton Kovalenko.  
If I've forgotten anyone, my apologies; let me know and I'll add 
your name to the list.</p>
</div>
<div id="section8" class="section"><h2><a name="section8">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>snit</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key218">BWidget</a>, <a href="../../../../index.html#key213">C++</a>, <a href="../../../../index.html#key220">Incr Tcl</a>, <a href="../../../../index.html#key734">Snit</a>, <a href="../../../../index.html#key217">adaptors</a>, <a href="../../../../index.html#key219">class</a>, <a href="../../../../index.html#key215">mega widget</a>, <a href="../../../../index.html#key221">object</a>, <a href="../../../../index.html#key214">object oriented</a>, <a href="../../../../index.html#key109">type</a>, <a href="../../../../index.html#key212">widget</a>, <a href="../../../../index.html#key216">widget adaptors</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003-2009, by William H. Duquette</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/snit/snitfaq.html.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>snitfaq - Snit's Not Incr Tcl, OO system</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/snit/snitfaq.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003-2006, by William H. Duquette
   -->
<! -- CVS: $Id$ snitfaq.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">snitfaq(n) 2.2 tcllib &quot;Snit's Not Incr Tcl, OO system&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>snitfaq - Snit Frequently Asked Questions</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a>
<ul>
<li class="subsection"><a href="#subsection1">What is this document?</a></li>
<li class="subsection"><a href="#subsection2">What is Snit?</a></li>
<li class="subsection"><a href="#subsection3">What version of Tcl does Snit require?</a></li>
<li class="subsection"><a href="#subsection4">Where can I download Snit?</a></li>
<li class="subsection"><a href="#subsection5">What are Snit's goals?</a></li>
<li class="subsection"><a href="#subsection6">How is Snit different from other OO frameworks?</a></li>
<li class="subsection"><a href="#subsection7">What can I do with Snit?</a></li>
</ul>
</li>
<li class="section"><a href="#section3">SNIT VERSIONS</a>
<ul>
<li class="subsection"><a href="#subsection8">Which version of Snit should I use?</a></li>
<li class="subsection"><a href="#subsection9">How do I select the version of Snit I want to use?</a></li>
<li class="subsection"><a href="#subsection10">How are Snit 1.3 and Snit 2.2 incompatible?</a></li>
<li class="subsection"><a href="#subsection11">Are there other differences between Snit 1.x and Snit 2.2?</a></li>
</ul>
</li>
<li class="section"><a href="#section4">OBJECTS</a>
<ul>
<li class="subsection"><a href="#subsection12">What is an object?</a></li>
<li class="subsection"><a href="#subsection13">What is an abstract data type?</a></li>
<li class="subsection"><a href="#subsection14">What kinds of abstract data types does Snit provide?</a></li>
<li class="subsection"><a href="#subsection15">What is a snit::type?</a></li>
<li class="subsection"><a href="#subsection16">What is a snit::widget?, the short story</a></li>
<li class="subsection"><a href="#subsection17">What is a snit::widgetadaptor?, the short story</a></li>
<li class="subsection"><a href="#subsection18">How do I create an instance of a snit::type?</a></li>
<li class="subsection"><a href="#subsection19">How do I refer to an object indirectly?</a></li>
<li class="subsection"><a href="#subsection20">How can I generate the object name automatically?</a></li>
<li class="subsection"><a href="#subsection21">Can types be renamed?</a></li>
<li class="subsection"><a href="#subsection22">Can objects be renamed?</a></li>
<li class="subsection"><a href="#subsection23">How do I destroy a Snit object?</a></li>
</ul>
</li>
<li class="section"><a href="#section5">INSTANCE METHODS</a>
<ul>
<li class="subsection"><a href="#subsection24">What is an instance method?</a></li>
<li class="subsection"><a href="#subsection25">How do I define an instance method?</a></li>
<li class="subsection"><a href="#subsection26">How does a client call an instance method?</a></li>
<li class="subsection"><a href="#subsection27">How does an instance method call another instance method?</a></li>
<li class="subsection"><a href="#subsection28">Are there any limitations on instance method names?</a></li>
<li class="subsection"><a href="#subsection29">What is a hierarchical method?</a></li>
<li class="subsection"><a href="#subsection30">How do I define a hierarchical method?</a></li>
<li class="subsection"><a href="#subsection31">How do I call hierarchical methods?</a></li>
<li class="subsection"><a href="#subsection32">How do I make an instance method private?</a></li>
<li class="subsection"><a href="#subsection33">Are there any limitations on instance method arguments?</a></li>
<li class="subsection"><a href="#subsection34">What implicit arguments are passed to each instance method?</a></li>
<li class="subsection"><a href="#subsection35">What is $type?</a></li>
<li class="subsection"><a href="#subsection36">What is $self?</a></li>
<li class="subsection"><a href="#subsection37">What is $selfns?</a></li>
<li class="subsection"><a href="#subsection38">What is $win?</a></li>
<li class="subsection"><a href="#subsection39">How do I pass an instance method as a callback?</a></li>
<li class="subsection"><a href="#subsection40">How do I delegate instance methods to a component?</a></li>
</ul>
</li>
<li class="section"><a href="#section6">INSTANCE VARIABLES</a>
<ul>
<li class="subsection"><a href="#subsection41">What is an instance variable?</a></li>
<li class="subsection"><a href="#subsection42">How is a scalar instance variable defined?</a></li>
<li class="subsection"><a href="#subsection43">How is an array instance variable defined?</a></li>
<li class="subsection"><a href="#subsection44">What happens if I don't initialize an instance variable?</a></li>
<li class="subsection"><a href="#subsection45">Are there any limitations on instance variable names?</a></li>
<li class="subsection"><a href="#subsection46">Do I need to declare my instance variables in my methods?</a></li>
<li class="subsection"><a href="#subsection47">How do I pass an instance variable's name to another object?</a></li>
<li class="subsection"><a href="#subsection48">How do I make an instance variable public?</a></li>
</ul>
</li>
<li class="section"><a href="#section7">OPTIONS</a>
<ul>
<li class="subsection"><a href="#subsection49">What is an option?</a></li>
<li class="subsection"><a href="#subsection50">How do I define an option?</a></li>
<li class="subsection"><a href="#subsection51">How can a client set options at object creation?</a></li>
<li class="subsection"><a href="#subsection52">How can a client retrieve an option's value?</a></li>
<li class="subsection"><a href="#subsection53">How can a client set options after object creation?</a></li>
<li class="subsection"><a href="#subsection54">How should an instance method access an option value?</a></li>
<li class="subsection"><a href="#subsection55">How can I make an option read-only?</a></li>
<li class="subsection"><a href="#subsection56">How can I catch accesses to an option's value?</a></li>
<li class="subsection"><a href="#subsection57">What is a -cgetmethod?</a></li>
<li class="subsection"><a href="#subsection58">How can I catch changes to an option's value?</a></li>
<li class="subsection"><a href="#subsection59">What is a -configuremethod?</a></li>
<li class="subsection"><a href="#subsection60">How can I validate an option's value?</a></li>
<li class="subsection"><a href="#subsection61">What is a -validatemethod?</a></li>
</ul>
</li>
<li class="section"><a href="#section8">TYPE VARIABLES</a>
<ul>
<li class="subsection"><a href="#subsection62">What is a type variable?</a></li>
<li class="subsection"><a href="#subsection63">How is a scalar type variable defined?</a></li>
<li class="subsection"><a href="#subsection64">How is an array-valued type variable defined?</a></li>
<li class="subsection"><a href="#subsection65">What happens if I don't initialize a type variable?</a></li>
<li class="subsection"><a href="#subsection66">Are there any limitations on type variable names?</a></li>
<li class="subsection"><a href="#subsection67">Do I need to declare my type variables in my methods?</a></li>
<li class="subsection"><a href="#subsection68">How do I pass a type variable's name to another object?</a></li>
<li class="subsection"><a href="#subsection69">How do I make a type variable public?</a></li>
</ul>
</li>
<li class="section"><a href="#section9">TYPE METHODS</a>
<ul>
<li class="subsection"><a href="#subsection70">What is a type method?</a></li>
<li class="subsection"><a href="#subsection71">How do I define a type method?</a></li>
<li class="subsection"><a href="#subsection72">How does a client call a type method?</a></li>
<li class="subsection"><a href="#subsection73">Are there any limitations on type method names?</a></li>
<li class="subsection"><a href="#subsection74">How do I make a type method private?</a></li>
<li class="subsection"><a href="#subsection75">Are there any limitations on type method arguments?</a></li>
<li class="subsection"><a href="#subsection76">How does an instance or type method call a type method?</a></li>
<li class="subsection"><a href="#subsection77">How do I pass a type method as a callback?</a></li>
<li class="subsection"><a href="#subsection78">Can type methods be hierarchical?</a></li>
</ul>
</li>
<li class="section"><a href="#section10">PROCS</a>
<ul>
<li class="subsection"><a href="#subsection79">What is a proc?</a></li>
<li class="subsection"><a href="#subsection80">How do I define a proc?</a></li>
<li class="subsection"><a href="#subsection81">Are there any limitations on proc names?</a></li>
<li class="subsection"><a href="#subsection82">How does a method call a proc?</a></li>
<li class="subsection"><a href="#subsection83">How can I pass a proc to another object as a callback?</a></li>
</ul>
</li>
<li class="section"><a href="#section11">TYPE CONSTRUCTORS</a>
<ul>
<li class="subsection"><a href="#subsection84">What is a type constructor?</a></li>
<li class="subsection"><a href="#subsection85">How do I define a type constructor?</a></li>
</ul>
</li>
<li class="section"><a href="#section12">CONSTRUCTORS</a>
<ul>
<li class="subsection"><a href="#subsection86">What is a constructor?</a></li>
<li class="subsection"><a href="#subsection87">How do I define a constructor?</a></li>
<li class="subsection"><a href="#subsection88">What does the default constructor do?</a></li>
<li class="subsection"><a href="#subsection89">Can I choose a different set of arguments for the constructor?</a></li>
<li class="subsection"><a href="#subsection90">Are there any limitations on constructor arguments?</a></li>
<li class="subsection"><a href="#subsection91">Is there anything special about writing the constructor?</a></li>
</ul>
</li>
<li class="section"><a href="#section13">DESTRUCTORS</a>
<ul>
<li class="subsection"><a href="#subsection92">What is a destructor?</a></li>
<li class="subsection"><a href="#subsection93">How do I define a destructor?</a></li>
<li class="subsection"><a href="#subsection94">Are there any limitations on destructor arguments?</a></li>
<li class="subsection"><a href="#subsection95">What implicit arguments are passed to the destructor?</a></li>
<li class="subsection"><a href="#subsection96">Must components be destroyed explicitly?</a></li>
<li class="subsection"><a href="#subsection97">Is there any special about writing a destructor?</a></li>
</ul>
</li>
<li class="section"><a href="#section14">COMPONENTS</a>
<ul>
<li class="subsection"><a href="#subsection98">What is a component?</a></li>
<li class="subsection"><a href="#subsection99">How do I declare a component?</a></li>
<li class="subsection"><a href="#subsection100">How is a component named?</a></li>
<li class="subsection"><a href="#subsection101">Are there any limitations on component names?</a></li>
<li class="subsection"><a href="#subsection102">What is an owned component?</a></li>
<li class="subsection"><a href="#subsection103">What does the install command do?</a></li>
<li class="subsection"><a href="#subsection104">Must owned components be created in the constructor?</a></li>
<li class="subsection"><a href="#subsection105">Are there any limitations on component object names?</a></li>
<li class="subsection"><a href="#subsection106">Must I destroy the components I own?</a></li>
<li class="subsection"><a href="#subsection107">Can I expose a component's object command as part of my interface?</a></li>
<li class="subsection"><a href="#subsection108">How do I expose a component's object command?</a></li>
</ul>
</li>
<li class="section"><a href="#section15">TYPE COMPONENTS</a>
<ul>
<li class="subsection"><a href="#subsection109">What is a type component?</a></li>
<li class="subsection"><a href="#subsection110">How do I declare a type component?</a></li>
<li class="subsection"><a href="#subsection111">How do I install a type component?</a></li>
<li class="subsection"><a href="#subsection112">Are there any limitations on type component names?</a></li>
</ul>
</li>
<li class="section"><a href="#section16">DELEGATION</a>
<ul>
<li class="subsection"><a href="#subsection113">What is delegation?</a></li>
<li class="subsection"><a href="#subsection114">How can I delegate a method to a component object?</a></li>
<li class="subsection"><a href="#subsection115">Can I delegate to a method with a different name?</a></li>
<li class="subsection"><a href="#subsection116">Can I delegate to a method with additional arguments?</a></li>
<li class="subsection"><a href="#subsection117">Can I delegate a method to something other than an object?</a></li>
<li class="subsection"><a href="#subsection118">How can I delegate a method to a type component object?</a></li>
<li class="subsection"><a href="#subsection119">How can I delegate a type method to a type component object?</a></li>
<li class="subsection"><a href="#subsection120">How can I delegate an option to a component object?</a></li>
<li class="subsection"><a href="#subsection121">Can I delegate to an option with a different name?</a></li>
<li class="subsection"><a href="#subsection122">How can I delegate any unrecognized method or option to a component object?</a></li>
<li class="subsection"><a href="#subsection123">How can I delegate all but certain methods or options to a component?</a></li>
<li class="subsection"><a href="#subsection124">Can a hierarchical method be delegated?</a></li>
</ul>
</li>
<li class="section"><a href="#section17">WIDGETS</a>
<ul>
<li class="subsection"><a href="#subsection125">What is a snit::widget?</a></li>
<li class="subsection"><a href="#subsection126">How do I define a snit::widget?</a></li>
<li class="subsection"><a href="#subsection127">How do snit::widgets differ from snit::types?</a></li>
<li class="subsection"><a href="#subsection128">What is a hull component?</a></li>
<li class="subsection"><a href="#subsection129">How can I set the hull type for a snit::widget?</a></li>
<li class="subsection"><a href="#subsection130">How should I name widgets which are components of a snit::widget?</a></li>
</ul>
</li>
<li class="section"><a href="#section18">WIDGET ADAPTORS</a>
<ul>
<li class="subsection"><a href="#subsection131">What is a snit::widgetadaptor?</a></li>
<li class="subsection"><a href="#subsection132">How do I define a snit::widgetadaptor?</a></li>
<li class="subsection"><a href="#subsection133">Can I adapt a widget created elsewhere in the program?</a></li>
<li class="subsection"><a href="#subsection134">Can I adapt another megawidget?</a></li>
</ul>
</li>
<li class="section"><a href="#section19">THE TK OPTION DATABASE</a>
<ul>
<li class="subsection"><a href="#subsection135">What is the Tk option database?</a></li>
<li class="subsection"><a href="#subsection136">Do snit::types use the Tk option database?</a></li>
<li class="subsection"><a href="#subsection137">What is my snit::widget's widget class?</a></li>
<li class="subsection"><a href="#subsection138">What is my snit::widgetadaptor's widget class?</a></li>
<li class="subsection"><a href="#subsection139">What are option resource and class names?</a></li>
<li class="subsection"><a href="#subsection140">What are the resource and class names for my megawidget's options?</a></li>
<li class="subsection"><a href="#subsection141">How does Snit initialize my megawidget's locally-defined options?</a></li>
<li class="subsection"><a href="#subsection142">How does Snit initialize delegated options?</a></li>
<li class="subsection"><a href="#subsection143">How does Snit initialize options delegated to the hull?</a></li>
<li class="subsection"><a href="#subsection144">How does Snit initialize options delegated to other components?</a></li>
<li class="subsection"><a href="#subsection145">What happens if I install a non-widget as a component of widget?</a></li>
</ul>
</li>
<li class="section"><a href="#section20">ENSEMBLE COMMANDS</a>
<ul>
<li class="subsection"><a href="#subsection146">What is an ensemble command?</a></li>
<li class="subsection"><a href="#subsection147">How can I create an ensemble command using Snit?</a></li>
<li class="subsection"><a href="#subsection148">How can I create an ensemble command using an instance of a snit::type?</a></li>
<li class="subsection"><a href="#subsection149">How can I create an ensemble command using a snit::type?</a></li>
</ul>
</li>
<li class="section"><a href="#section21">PRAGMAS</a>
<ul>
<li class="subsection"><a href="#subsection150">What is a pragma?</a></li>
<li class="subsection"><a href="#subsection151">How do I set a pragma?</a></li>
<li class="subsection"><a href="#subsection152">How can I get rid of the &quot;info&quot; type method?</a></li>
<li class="subsection"><a href="#subsection153">How can I get rid of the &quot;destroy&quot; type method?</a></li>
<li class="subsection"><a href="#subsection154">How can I get rid of the &quot;create&quot; type method?</a></li>
<li class="subsection"><a href="#subsection155">How can I get rid of type methods altogether?</a></li>
<li class="subsection"><a href="#subsection156">Why can't I create an object that replaces an old object with the same name?</a></li>
<li class="subsection"><a href="#subsection157">How can I make my simple type run faster?</a></li>
</ul>
</li>
<li class="section"><a href="#section22">MACROS</a>
<ul>
<li class="subsection"><a href="#subsection158">What is a macro?</a></li>
<li class="subsection"><a href="#subsection159">What are macros good for?</a></li>
<li class="subsection"><a href="#subsection160">How do I do conditional compilation?</a></li>
<li class="subsection"><a href="#subsection161">How do I define new type definition syntax?</a></li>
<li class="subsection"><a href="#subsection162">Are there are restrictions on macro names?</a></li>
</ul>
</li>
<li class="section"><a href="#section23">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">What is this document?</a></h3>
<p>This is an atypical FAQ list, in that few of the questions are
frequently asked.  Rather, these are the questions I think a newcomer
to Snit should be asking.  This file is not a complete reference to
Snit, however; that information is in the <b class="cmd"><a href="snit.html">snit</a></b> man page.</p>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">What is Snit?</a></h3>
<p>Snit is a framework for defining abstract data types and megawidgets
in pure Tcl.  The name &quot;Snit&quot; stands for &quot;Snit's Not Incr Tcl&quot;, 
signifying that Snit takes a different approach to defining objects 
than does Incr Tcl, the best known object framework for Tcl.  Had
I realized that Snit would become at all popular, I'd probably have
chosen something else.</p>
<p>The primary purpose of Snit is to be <i class="term">object glue</i>--to help you
compose diverse objects from diverse sources into types and
megawidgets with clean, convenient interfaces so that you can more
easily build your application.</p>
<p>Snit isn't about theoretical purity or minimalist design; it's about
being able to do powerful things easily and consistently without
having to think about them--so that you can concentrate on building
your application.</p>
<p>Snit isn't about implementing thousands of nearly identical
carefully-specified lightweight thingamajigs--not as individual Snit
objects.  Traditional Tcl methods will be much faster, and not much
more complicated.  But Snit <em>is</em> about implementing a clean interface
to manage a collection of thousands of nearly identical
carefully-specified lightweight thingamajigs (e.g., think of the text
widget and text tags, or the canvas widget and canvas objects).  Snit
lets you hide the details of just how those thingamajigs are
stored--so that you can ignore it, and concentrate on building your
application.</p>
<p>Snit isn't a way of life, a silver bullet, or the Fountain of
Youth. It's just a way of managing complexity--and of managing some of
the complexity of managing complexity--so that you can concentrate on
building your application.</p>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">What version of Tcl does Snit require?</a></h3>
<p>Snit 1.3 requires Tcl 8.3 or later; Snit 2.2 requires Tcl 8.5 or
later.  See <span class="sectref"><a href="#section3">SNIT VERSIONS</a></span> for the differences between Snit
1.3 and Snit 2.2.</p>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Where can I download Snit?</a></h3>
<p>Snit is part of Tcllib, the standard Tcl library, so you might already
have it.  It's also available at the Snit Home Page,
<a href="http://www.wjduquette.com/snit">http://www.wjduquette.com/snit</a>.</p>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">What are Snit's goals?</a></h3>
<ul class="itemized">
<li><p>A Snit object should be at least as efficient as a hand-coded Tcl
object (see <a href="http://www.wjduquette.com/tcl/objects.html">http://www.wjduquette.com/tcl/objects.html</a>).</p></li>
<li><p>The fact that Snit was used in an object's implementation should be
transparent (and irrelevant) to clients of that object.</p></li>
<li><p>Snit should be able to encapsulate objects from other sources,
particularly Tk widgets.</p></li>
<li><p>Snit megawidgets should be (to the extent possible) indistinguishable
in interface from Tk widgets.</p></li>
<li><p>Snit should be Tclish--that is, rather than trying to emulate C++,
Smalltalk, or anything else, it should try to emulate Tcl itself.</p></li>
<li><p>It should have a simple, easy-to-use, easy-to-remember syntax.</p></li>
</ul>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">How is Snit different from other OO frameworks?</a></h3>
<p>Snit is unique among Tcl object systems in that
it is based not on inheritance but on delegation.  Object
systems based on inheritance only allow you to inherit from classes
defined using the same system, and that's a shame.  In Tcl, an object
is anything that acts like an object; it shouldn't matter how the
object was implemented.  I designed Snit to help me build applications
out of the materials at hand; thus, Snit is designed to be able to
incorporate and build on any object, whether it's a hand-coded object,
a Tk widget, an Incr Tcl object, a BWidget or almost anything else.</p>
<p>Note that you can achieve the effect of inheritance using 
<span class="sectref"><a href="#section14">COMPONENTS</a></span> and <span class="sectref"><a href="#section16">DELEGATION</a></span>--and you can inherit
from anything that looks like a Tcl object.</p>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">What can I do with Snit?</a></h3>
<p>Using Snit, a programmer can:</p>
<ul class="itemized">
<li><p>Create abstract data types and Tk megawidgets.</p></li>
<li><p>Define instance variables, type variables, and Tk-style options.</p></li>
<li><p>Define constructors, destructors, instance methods, type methods, procs.</p></li>
<li><p>Assemble a type out of component types.  Instance methods and options
can be delegated to the component types automatically.</p></li>
</ul>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">SNIT VERSIONS</a></h2>
<div id="subsection8" class="subsection"><h3><a name="subsection8">Which version of Snit should I use?</a></h3>
<p>The current Snit distribution includes two versions, Snit 1.3 and Snit
2.2.  The reason that both are included is that Snit 2.2 takes
advantage of a number of new features of Tcl 8.5 to improve run-time
efficiency; as a side-effect, the ugliness of Snit's error messages
and stack traces has been reduced considerably.  The cost of using
Snit 2.2, of course, is that you must target Tcl 8.5.</p>
<p>Snit 1.3, on the other hand, lacks Snit 2.2's optimizations, but
requires only Tcl 8.3 and later.</p>
<p>In short, if you're targetting Tcl 8.3 or 8.4 you should use Snit 1.3.  If
you can afford to target Tcl 8.5, you should definitely use Snit 2.2.
If you will be targetting both, you can use Snit 1.3 exclusively, or
(if your code is unaffected by the minor incompatibilities between the
two versions) you can use Snit 1.3 for Tcl 8.4 and Snit 2.2 for Tcl
8.5.</p>
</div>
<div id="subsection9" class="subsection"><h3><a name="subsection9">How do I select the version of Snit I want to use?</a></h3>
<p>To always use Snit 1.3 (or a later version of Snit 1.x), invoke Snit
as follows:</p>
<pre class="example">package require snit 1.3
</pre>
<p>To always use Snit 2.2 (or a later version of Snit 2.x), say this
instead:</p>
<pre class="example">package require snit 2.2
</pre>
<p>Note that if you request Snit 2.2 explicitly, your application will
halt with Tcl 8.4, since Snit 2.2 is unavailable for Tcl 8.4.</p>
<p>If you wish your application to always use the latest available
version of Snit, don't specify a version number:</p>
<pre class="example">package require snit
</pre>
<p>Tcl will find and load the latest version that's available relative to
the version of Tcl being used.  In this case, be careful to avoid
using any incompatible features.</p>
</div>
<div id="subsection10" class="subsection"><h3><a name="subsection10">How are Snit 1.3 and Snit 2.2 incompatible?</a></h3>
<p>To the extent possible, Snit 2.2 is intended to be a drop-in
replacement for Snit 1.3. Unfortunately, some incompatibilities were
inevitable because Snit 2.2 uses Tcl 8.5's new 
<b class="cmd">namespace ensemble</b> mechanism to implement subcommand dispatch.
This approach is much faster than the mechanism used in Snit 1.3, and
also results in much better error messages; however, it also places
new constraints on the implementation.</p>
<p>There are four specific incompatibilities between Snit 1.3 and Snit 2.2.</p>
<ul class="itemized">
<li><p>Snit 1.3 supports implicit naming of objects.  Suppose you define a
new <b class="cmd">snit::type</b> called <b class="cmd">dog</b>.  You can create instances of
<b class="cmd">dog</b> in three ways:</p>
<pre class="example">dog spot               ;# Explicit naming
set obj1 [dog %AUTO%]  ;# Automatic naming
set obj2 [dog]         ;# Implicit naming
</pre>
<p>In Snit 2.2, type commands are defined using the <b class="cmd">namespace ensemble</b>
mechanism; and <b class="cmd">namespace ensemble</b> doesn't allow an ensemble command
to be called without a subcommand.  In short, using 
<b class="cmd">namespace ensemble</b> there's no way to support implicit naming.</p>
<p>All is not lost, however.  If the type has no type methods, then the
type command is a simple command rather than an ensemble, and 
<b class="cmd">namespace ensemble</b> is not used.  In this case, implicit naming
is still possible.</p>
<p>In short, you can have implicit naming if you're willing to do without
type methods (including the standard type methods, like 
<b class="cmd">$type info</b>).  To do so, use the <b class="const">-hastypemethods</b> pragma:</p>
<pre class="example">pragma -hastypemethods 0</pre>
</li>
<li><p>Hierarchical methods and type methods are implemented differently in
Snit 2.2.</p>
<p>A hierarchical method is an instance method which has
subcommands; these subcommands are themselves methods.  The Tk text
widget's <b class="cmd">tag</b> command and its subcommands are examples of 
hierarchical methods.  You can implement such subcommands in Snit
simply by including multiple words in the method names:</p>
<pre class="example">method {tag configure} {tag args} { ... }
method {tag cget} {tag option} {...}
</pre>
<p>Here we've implicitly defined a <b class="cmd">tag</b> method which has two
subcommands, <b class="cmd">configure</b> and <b class="cmd">cget</b>.</p>
<p>In Snit 1.3, hierarchical methods could be called in two ways:</p>
<pre class="example">$obj tag cget -myoption      ;# The good way
$obj {tag cget} -myoption    ;# The weird way
</pre>
<p>In the second call, we see that a hierarchical method or type method
is simply one whose name contains multiple words.</p>
<p>In Snit 2.2 this is no longer the case, and the &quot;weird&quot; way of calling
hierarchical methods and type methods no longer works.</p></li>
<li><p>The third incompatibility derives from the second.  In Snit 1.3,
hierarchical methods were also simply methods whose name contains
multiple words.  As a result, <b class="cmd">$obj info methods</b> returned the
full names of all hierarchical methods.  In the example above, 
the list returned by <b class="cmd">$obj info methods</b> would include
<b class="cmd">tag configure</b> and <b class="cmd">tag cget</b> but not <b class="cmd">tag</b>, since
<b class="cmd">tag</b> is defined only implicitly.</p>
<p>In Snit 2.2, hierarchical methods and type methods are no longer
simply ones whose
name contains multiple words; in the above example, the list returned
by <b class="cmd">$obj info methods</b> would include <b class="cmd">tag</b> but not
<b class="cmd">tag configure</b> or <b class="cmd">tag cget</b>.</p></li>
<li><p>The fourth incompatibility is due to a new feature.  Snit 2.2 uses
the new <b class="cmd">namespace path</b> command so that a type's code can 
call any command defined in the type's parent namespace without
qualification or importation.  For example, suppose you have a 
package called <b class="cmd">mypackage</b> which defines a number of commands
including a type, <b class="cmd">::mypackage::mytype</b>.  Thanks to 
<b class="cmd">namespace path</b>, the type's code can call any of the other
commands defined in <b class="cmd">::mypackage::</b>.</p>
<p>This is extremely convenient.  However, it also means that commands
defined in the parent namespace, <b class="cmd">::mypackage::</b> can block the
type's access to identically named commands in the global namespace.
This can lead to bugs.  For example, Tcllib includes a type called
<b class="cmd">::tie::std::file</b>.  This type's code calls the standard
<b class="cmd"><a href="../../../../index.html#key31">file</a></b> command.  When run with Snit 2.2, the code broke--
the type's command, <b class="cmd">::tie::std::file</b>, is itself a command
in the type's parent namespace, and so instead of calling 
the standard <b class="cmd"><a href="../../../../index.html#key31">file</a></b> command, the type found itself calling
itself.</p></li>
</ul>
</div>
<div id="subsection11" class="subsection"><h3><a name="subsection11">Are there other differences between Snit 1.x and Snit 2.2?</a></h3>
<p>Yes.</p>
<ul class="itemized">
<li><p>Method dispatch is considerably faster.</p></li>
<li><p>Many error messages and stack traces are cleaner.</p></li>
<li><p>The <b class="const">-simpledispatch</b> pragma is obsolete, and ignored if
present. In Snit 1.x, <b class="const">-simpledispatch</b> substitutes a faster
mechanism for method dispatch, at the cost of losing certain features.
Snit 2.2 method dispatch is faster still in all cases, so 
<b class="const">-simpledispatch</b> is no longer needed.</p></li>
<li><p>In Snit 2.2, a type's code (methods, type methods, etc.) can call commands
from the type's parent namespace without qualifying or importing
them, i.e., type <b class="cmd">::parentns::mytype</b>'s code can call
<b class="cmd">::parentns::someproc</b> as just <b class="cmd">someproc</b>.</p>
<p>This is extremely useful when a type is defined as part of a larger
package, and shares a parent namespace with the rest of the package;
it means that the type can call other commands defined by the
package without any extra work.</p>
<p>This feature depends on the new Tcl 8.5 <b class="cmd">namespace path</b> command,
which is why it hasn't been implemented for V1.x.  V1.x code can
achieve something similar by placing</p>
<pre class="example">namespace import [namespace parent]::*</pre>
<p>in a type constructor.  This is less useful, however, as it picks up
only those commands which have already been exported by the parent
namespace at the time the type is defined.</p></li>
</ul>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">OBJECTS</a></h2>
<div id="subsection12" class="subsection"><h3><a name="subsection12">What is an object?</a></h3>
<p>A full description of object-oriented programming is beyond
the scope of this FAQ, obviously.  In simple terms, an object is an instance of
an abstract data type--a coherent bundle of code and data.
There are many ways to represent objects in Tcl/Tk; the best known
examples are the Tk widgets.</p>
<p>A Tk widget is an object; it is represented by a Tcl command.  
The object's methods are subcommands of the Tcl command.  The object's
properties are options accessed using the <b class="method">configure</b> and 
<b class="method">cget</b> methods.  Snit uses the same conventions as Tk widgets do.</p>
</div>
<div id="subsection13" class="subsection"><h3><a name="subsection13">What is an abstract data type?</a></h3>
<p>In computer science terms, an abstract data type is a complex data
structure along with a set of operations--a stack, a queue, a
binary tree, etc--that is to say, in modern terms, an object.  In systems
that include some form of inheritance the word <i class="term"><a href="../../../../index.html#key219">class</a></i> is
usually used instead of <i class="term">abstract data type</i>, but as Snit
doesn't implement inheritance as it's ordinarily understood
the older term seems more appropriate.  Sometimes this is called 
<i class="term">object-based</i> programming as opposed to object-oriented
programming.  Note that you can easily create the effect of 
inheritance using <span class="sectref"><a href="#section14">COMPONENTS</a></span> and <span class="sectref"><a href="#section16">DELEGATION</a></span>.</p>
<p>In Snit, as in Tk, a <i class="term"><a href="../../../../index.html#key109">type</a></i> is a command that creates instances
-- objects -- which belong to the type.  Most types define some number
of <i class="term">options</i> which can be set at creation time, and usually can be
changed later.</p>
<p>Further, an <i class="term">instance</i> is also a Tcl command--a command that
gives access to the operations which are defined for that abstract
data type.  Conventionally, the operations are defined as subcommands
of the instance command.  For example, to insert
text into a Tk text widget, you use the text widget's <b class="method">insert</b>
subcommand:</p>
<pre class="example">    # Create a text widget and insert some text in it.
    text .mytext -width 80 -height 24
    .mytext insert end &quot;Howdy!&quot;
</pre>
<p>In this example, <b class="cmd"><a href="../../../../index.html#key454">text</a></b> is the <i class="term"><a href="../../../../index.html#key109">type</a></i> command and
<b class="cmd">.mytext</b> is the <i class="term">instance</i> command.</p>
<p>In Snit, object subcommands are generally called 
<span class="sectref"><a href="#section5">INSTANCE METHODS</a></span>.</p>
</div>
<div id="subsection14" class="subsection"><h3><a name="subsection14">What kinds of abstract data types does Snit provide?</a></h3>
<p>Snit allows you to define three kinds of abstract data type:</p>
<ul class="itemized">
<li><p><b class="cmd">snit::type</b></p></li>
<li><p><b class="cmd">snit::widget</b></p></li>
<li><p><b class="cmd">snit::widgetadaptor</b></p></li>
</ul>
</div>
<div id="subsection15" class="subsection"><h3><a name="subsection15">What is a snit::type?</a></h3>
<p>A <b class="cmd">snit::type</b> is a non-GUI abstract data type, e.g., a stack or a
queue.  <b class="cmd">snit::type</b>s are defined using the <b class="cmd">snit::type</b>
command.  For example, if you were designing a kennel management
system for a dog breeder, you'd need a dog type.</p>
<pre class="example">% snit::type dog {
    # ...
}
::dog
%
</pre>
<p>This definition defines a new command (<b class="cmd">::dog</b>, in this case)
that can be used to define dog objects.</p>
<p>An instance of a <b class="cmd">snit::type</b> can have <span class="sectref"><a href="#section5">INSTANCE METHODS</a></span>,
<span class="sectref"><a href="#section6">INSTANCE VARIABLES</a></span>, <span class="sectref"><a href="#section7">OPTIONS</a></span>, and <span class="sectref"><a href="#section14">COMPONENTS</a></span>.
The type itself can have <span class="sectref"><a href="#section9">TYPE METHODS</a></span>,
<span class="sectref"><a href="#section8">TYPE VARIABLES</a></span>, <span class="sectref"><a href="#section15">TYPE COMPONENTS</a></span>, and 
<span class="sectref"><a href="#section10">PROCS</a></span>.</p>
</div>
<div id="subsection16" class="subsection"><h3><a name="subsection16">What is a snit::widget?, the short story</a></h3>
<p>A <b class="cmd">snit::widget</b> is a Tk megawidget built using Snit; it is very
similar to a <b class="cmd">snit::type</b>.  See <span class="sectref"><a href="#section17">WIDGETS</a></span>.</p>
</div>
<div id="subsection17" class="subsection"><h3><a name="subsection17">What is a snit::widgetadaptor?, the short story</a></h3>
<p>A <b class="cmd">snit::widgetadaptor</b> uses Snit to wrap an existing widget type
(e.g., a Tk label), modifying its interface to a lesser or greater
extent.  It is very similar to a <b class="cmd">snit::widget</b>.
See <span class="sectref"><a href="#section18">WIDGET ADAPTORS</a></span>.</p>
</div>
<div id="subsection18" class="subsection"><h3><a name="subsection18">How do I create an instance of a snit::type?</a></h3>
<p>You create an instance of a <b class="cmd">snit::type</b> by passing the new
instance's name to the type's create method.  In the following
example, we create a <b class="cmd">dog</b> object called <b class="cmd">spot</b>.</p>
<pre class="example">% snit::type dog {
    # ....
}
::dog
% dog create spot
::spot
%
</pre>
<p>In general, the <b class="method">create</b> method name can be omitted so long as
the instance name doesn't conflict with any defined 
<span class="sectref"><a href="#section9">TYPE METHODS</a></span>. (See <span class="sectref"><a href="#section15">TYPE COMPONENTS</a></span> for the
special case in which this doesn't work.)
So the following example is identical to the
previous example:</p>
<pre class="example">% snit::type dog {
    # ....
}
::dog
% dog spot
::spot
%
</pre>
<p>This document generally uses the shorter form.</p>
<p>If the <b class="cmd">dog</b> type defines <span class="sectref"><a href="#section7">OPTIONS</a></span>, these can usually be 
given defaults at creation time:</p>
<pre class="example">% snit::type dog {
    option -breed mongrel
    option -color brown
    method bark {} { return &quot;$self barks.&quot; }
}
::dog
% dog create spot -breed dalmation -color spotted
::spot
% spot cget -breed
dalmation
% spot cget -color
spotted
%
</pre>
<p>Once created, the instance name now names a new Tcl command that is used
to manipulate the object.  For example, the following code makes the
dog bark:</p>
<pre class="example">% spot bark
::spot barks.
%
</pre>
</div>
<div id="subsection19" class="subsection"><h3><a name="subsection19">How do I refer to an object indirectly?</a></h3>
<p>Some programmers prefer to save the object name in a variable, and
reference it that way.  For example,</p>
<pre class="example">% snit::type dog { ... }
::dog
% set d [dog spot -breed dalmation -color spotted]
::spot
% $d cget -breed
dalmation
% $d bark
::spot barks.
%
</pre>
<p>If you prefer this style, you might prefer to have Snit
generate the instance's name automatically.</p>
</div>
<div id="subsection20" class="subsection"><h3><a name="subsection20">How can I generate the object name automatically?</a></h3>
<p>If you'd like Snit to generate an object name for you,
use the <b class="const">%AUTO%</b> keyword as the requested name:</p>
<pre class="example">% snit::type dog { ... }
::dog
% set d [dog %AUTO%]
::dog2
% $d bark
::dog2 barks.
%
</pre>
<p>The <b class="const">%AUTO%</b> keyword can be embedded in a longer string:</p>
<pre class="example">% set d [dog obj_%AUTO%]
::obj_dog4
% $d bark
::obj_dog4 barks.
%
</pre>
</div>
<div id="subsection21" class="subsection"><h3><a name="subsection21">Can types be renamed?</a></h3>
<p>Tcl's <b class="cmd">rename</b> command renames other commands.  It's a common
technique in Tcl to modify an existing command by renaming it and
defining a new command with the original name; the new command usually
calls the renamed command.</p>
<p><b class="cmd">snit::type</b> commands, however, should never be renamed; to do so breaks
the connection between the type and its objects.</p>
</div>
<div id="subsection22" class="subsection"><h3><a name="subsection22">Can objects be renamed?</a></h3>
<p>Tcl's <b class="cmd">rename</b> command renames other commands.  It's a common
technique in Tcl to modify an existing command by renaming it and
defining a new command with the original name; the new command usually
calls the renamed command.</p>
<p>All Snit objects (including <i class="term">widgets</i> and <i class="term">widgetadaptors</i>)
can be renamed, though this flexibility has some consequences:</p>
<ul class="itemized">
<li><p>In an instance method, the implicit argument <b class="variable">self</b> will always
contain the object's current name, so instance methods can always call
other instance methods using <b class="variable">$self</b>.</p></li>
<li><p>If the object is renamed, however, then <b class="variable">$self</b>'s value will change.
Therefore, don't use <b class="variable">$self</b> for anything that will break if 
<b class="variable">$self</b> changes. For example, don't pass a callback command to
another object like this:</p>
<pre class="example">
    .btn configure -command [list $self ButtonPress]
</pre>
<p>You'll get an error if <b class="cmd">.btn</b> calls your command after your object is
renamed.</p></li>
<li><p>Instead, your object should define its callback command like this:</p>
<pre class="example">
    .btn configure -command [mymethod ButtonPress]
</pre>
<p>The <b class="cmd">mymethod</b> command returns code that will call the desired
method safely; the caller of the callback can add additional
arguments to the end of the command as usual.</p></li>
<li><p>Every object has a private namespace; the name of this namespace is
available in method bodies, etc., as the value of the implicit
argument <b class="variable">selfns</b>.  This value is constant for the life of the
object.  Use <b class="variable">$selfns</b> instead of <b class="variable">$self</b> if you need a 
unique token to identify the object.</p></li>
<li><p>When a <b class="cmd">snit::widget</b>'s instance command is renamed, its Tk window
name remains the same -- and is still extremely
important. Consequently, the Tk window name is available in 
method bodies as the value of the implicit argument <b class="variable">win</b>.  
This value is constant for the
life of the object.  When creating child windows, it's best to use
<b class="variable">$win.child</b> rather than <b class="variable">$self.child</b> as the name of the
child window.</p></li>
</ul>
</div>
<div id="subsection23" class="subsection"><h3><a name="subsection23">How do I destroy a Snit object?</a></h3>
<p>Any Snit object of any type can be destroyed by renaming
it to the empty string using the Tcl <b class="cmd">rename</b> command.</p>
<p>Snit megawidgets (i.e., instances of <b class="cmd">snit::widget</b> and
<b class="cmd">snit::widgetadaptor</b>) can be destroyed like any other widget: by
using the Tk <b class="cmd">destroy</b> command on the widget or on one of its
ancestors in the window hierarchy.</p>
<p>Every instance of a <b class="cmd">snit::type</b> has a <b class="method">destroy</b> method:</p>
<pre class="example">% snit::type dog { ... }
::dog
% dog spot
::spot
% spot bark
::spot barks.
% spot destroy
% spot barks
invalid command name &quot;spot&quot;
%
</pre>
<p>Finally, every Snit type has a type method called <b class="method">destroy</b>; calling it
destroys the type and all of its instances:</p>
<pre class="example">% snit::type dog { ... }
::dog
% dog spot
::spot
% spot bark
::spot barks.
% dog destroy
% spot bark
invalid command name &quot;spot&quot;
% dog fido
invalid command name &quot;dog&quot;
%
</pre>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">INSTANCE METHODS</a></h2>
<div id="subsection24" class="subsection"><h3><a name="subsection24">What is an instance method?</a></h3>
<p>An instance method is a procedure associated with a specific object
and called as a subcommand of the object's command.  It is given free
access to all of the object's type variables, instance variables, and
so forth.</p>
</div>
<div id="subsection25" class="subsection"><h3><a name="subsection25">How do I define an instance method?</a></h3>
<p>Instance methods are defined in the type definition using
the <b class="cmd"><a href="../../../../index.html#key332">method</a></b> statement.  Consider the following code that might be
used to add dogs to a computer simulation:</p>
<pre class="example">% snit::type dog {
    method bark {} {
        return &quot;$self barks.&quot;
    }
    method chase {thing} {
        return &quot;$self chases $thing.&quot;
    }
}
::dog
%
</pre>
<p>A dog can bark, and it can chase things.</p>
<p>The <b class="cmd"><a href="../../../../index.html#key332">method</a></b> statement looks just like a normal Tcl <b class="cmd"><a href="../../../../index.html#key543">proc</a></b>,
except that it appears in a <b class="cmd">snit::type</b> definition.  Notice that
every instance method gets an implicit argument called <b class="variable">self</b>;
this argument contains the object's name.  (There's more on
implicit method arguments below.)</p>
</div>
<div id="subsection26" class="subsection"><h3><a name="subsection26">How does a client call an instance method?</a></h3>
<p>The method name becomes a subcommand of the object.  For example,
let's put a simulated dog through its paces:</p>
<pre class="example">% dog spot
::spot
% spot bark
::spot barks.
% spot chase cat
::spot chases cat.
%
</pre>
</div>
<div id="subsection27" class="subsection"><h3><a name="subsection27">How does an instance method call another instance method?</a></h3>
<p>If method A needs to call method B on the same object, it does so just
as a client does: it calls method B as a subcommand of the object
itself, using the object name stored in the implicit argument <b class="variable">self</b>.</p>
<p>Suppose, for example, that our dogs never chase anything without
barking at them:</p>
<pre class="example">% snit::type dog {
    method bark {} {
        return &quot;$self barks.&quot;
    }
    method chase {thing} {
        return &quot;$self chases $thing.  [$self bark]&quot;
    }
}
::dog
% dog spot
::spot
% spot bark
::spot barks.
% spot chase cat
::spot chases cat.  ::spot barks.
%
</pre>
</div>
<div id="subsection28" class="subsection"><h3><a name="subsection28">Are there any limitations on instance method names?</a></h3>
<p>Not really, so long as you avoid the standard instance method names:
<b class="method">configure</b>, <b class="method">configurelist</b>, <b class="method">cget</b>,
<b class="method">destroy</b>, and <b class="method">info</b>.  Also, method names consisting of 
multiple words define hierarchical methods.</p>
</div>
<div id="subsection29" class="subsection"><h3><a name="subsection29">What is a hierarchical method?</a></h3>
<p>An object's methods are subcommands of the object's instance command.
Hierarchical methods allow an object's methods to have subcommands of
their own; and these can in turn have subcommands, and so on.  This
allows the programmer to define a tree-shaped command structure, such
as is used by many of the Tk widgets--the subcommands of the 
Tk <b class="cmd"><a href="../../../../index.html#key454">text</a></b> widget's <b class="cmd">tag</b> method are hierarchical methods.</p>
</div>
<div id="subsection30" class="subsection"><h3><a name="subsection30">How do I define a hierarchical method?</a></h3>
<p>Define methods whose names consist of multiple words.  These words
define the hierarchy implicitly.  For example, the following code
defines a <b class="cmd">tag</b> method with subcommands <b class="cmd">cget</b> and 
<b class="cmd">configure</b>:</p>
<pre class="example">snit::widget mytext {
    method {tag configure} {tag args} { ... }
    method {tag cget} {tag option} {...}
}
</pre>
<p>Note that there is no explicit definition for the <b class="cmd">tag</b> method;
it is implicit in the definition of <b class="cmd">tag configure</b> and
<b class="cmd">tag cget</b>.  If you tried to define <b class="cmd">tag</b> explicitly in this
example, you'd get an error.</p>
</div>
<div id="subsection31" class="subsection"><h3><a name="subsection31">How do I call hierarchical methods?</a></h3>
<p>As subcommands of subcommands.</p>
<pre class="example">% mytext .text
.text
% .text tag configure redtext -foreground red -background black
% .text tag cget redtext -foreground
red
%
</pre>
</div>
<div id="subsection32" class="subsection"><h3><a name="subsection32">How do I make an instance method private?</a></h3>
<p>It's often useful to define private methods, that is, instance methods
intended to be called only by other methods of the same object.</p>
<p>Snit doesn't implement any access control on instance methods, so all
methods are <em>de facto</em> public.  Conventionally, though, the
names of public methods begin with a lower-case letter, and the names
of private methods begin with an upper-case letter.</p>
<p>For example, suppose our simulated dogs only bark in response to other
stimuli; they never bark just for fun.  So the <b class="method">bark</b> method
becomes <b class="method">Bark</b> to indicate that it is private:</p>
<pre class="example">% snit::type dog {
    # Private by convention: begins with uppercase letter.
    method Bark {} {
        return &quot;$self barks.&quot;
    }
    method chase {thing} {
        return &quot;$self chases $thing. [$self Bark]&quot;
    }
}
::dog
% dog fido
::fido
% fido chase cat
::fido chases cat. ::fido barks.
%
</pre>
</div>
<div id="subsection33" class="subsection"><h3><a name="subsection33">Are there any limitations on instance method arguments?</a></h3>
<p>Method argument lists are defined just like normal Tcl <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> argument
lists; in particular, they can include arguments with default values
 and the <b class="variable">args</b> argument.</p>
<p>However, every method also has a number of implicit arguments
provided by Snit in addition to those explicitly defined.  The names
of these implicit arguments may not used to name explicit arguments.</p>
</div>
<div id="subsection34" class="subsection"><h3><a name="subsection34">What implicit arguments are passed to each instance method?</a></h3>
<p>The arguments implicitly passed to every method are <b class="variable">type</b>,
<b class="variable">selfns</b>, <b class="variable">win</b>, and <b class="variable">self</b>.</p>
</div>
<div id="subsection35" class="subsection"><h3><a name="subsection35">What is $type?</a></h3>
<p>The implicit argument <b class="variable">type</b> contains the fully qualified name of
the object's type:</p>
<pre class="example">% snit::type thing {
    method mytype {} {
        return $type
    }
}
::thing
% thing something
::something
% something mytype
::thing
%
</pre>
</div>
<div id="subsection36" class="subsection"><h3><a name="subsection36">What is $self?</a></h3>
<p>The implicit argument <b class="variable">self</b> contains the object's fully
qualified name.</p>
<p>If the object's command is renamed, then <b class="variable">$self</b> will change to
match in subsequent calls.  Thus, your code should not assume that
<b class="variable">$self</b> is constant unless you know for sure that the object
will never be renamed.</p>
<pre class="example">% snit::type thing {
    method myself {} {
        return $self
    }
}
::thing
% thing mutt
::mutt
% mutt myself
::mutt
% rename mutt jeff
% jeff myself
::jeff
%
</pre>
</div>
<div id="subsection37" class="subsection"><h3><a name="subsection37">What is $selfns?</a></h3>
<p>Each Snit object has a private namespace in which to store its
<span class="sectref"><a href="#section6">INSTANCE VARIABLES</a></span> and <span class="sectref"><a href="#section7">OPTIONS</a></span>.  The implicit argument
<b class="variable">selfns</b> contains the name of this namespace; its value never changes, and
is constant for the life of the object, even if the object's name
changes:</p>
<pre class="example">% snit::type thing {
    method myNameSpace {} {
        return $selfns
    }
}
::thing
% thing jeff
::jeff
% jeff myNameSpace
::thing::Snit_inst3
% rename jeff mutt
% mutt myNameSpace
::thing::Snit_inst3
%
</pre>
<p>The above example reveals how Snit names an instance's private
namespace; however, you should not write code that depends on the
specific naming convention, as it might change in future releases.</p>
</div>
<div id="subsection38" class="subsection"><h3><a name="subsection38">What is $win?</a></h3>
<p>The implicit argument <b class="variable">win</b> is defined for all Snit methods,
though it really makes sense only for those of 
<span class="sectref"><a href="#section17">WIDGETS</a></span> and <span class="sectref"><a href="#section18">WIDGET ADAPTORS</a></span>.  <b class="variable">$win</b> is simply
the original name of the object, whether it's been renamed or not.
For widgets and widgetadaptors, it is also therefore the name of a Tk
window.</p>
<p>When a <b class="cmd">snit::widgetadaptor</b> is used to modify the interface of a
widget or megawidget, it must rename the widget's original command and
replace it with its own.</p>
<p>Thus, using <b class="variable">win</b> whenever the Tk window name is called for
means that a <b class="cmd">snit::widget</b> or <b class="cmd">snit::widgetadaptor</b> can be
adapted by a <b class="cmd">snit::widgetadaptor</b>.  See <span class="sectref"><a href="#section17">WIDGETS</a></span> for
more information.</p>
</div>
<div id="subsection39" class="subsection"><h3><a name="subsection39">How do I pass an instance method as a callback?</a></h3>
<p>It depends on the context.</p>
<p>Suppose in my application I have a <b class="cmd">dog</b> object named <b class="cmd">fido</b>,
and I want <b class="cmd">fido</b> to bark when a Tk button called <b class="cmd">.bark</b> is 
pressed.  In this case, I create the callback command in the usual
way, using <b class="cmd"><a href="../../../../index.html#key252">list</a></b>:</p>
<pre class="example">    button .bark -text &quot;Bark!&quot; -command [list fido bark]
</pre>
<p>In typical Tcl style, we use a callback to hook two independent
components together.  But suppose that the <b class="cmd">dog</b> object has
a graphical interface and owns the button itself?  In this case,
the <b class="cmd">dog</b> must pass one of its own instance methods to the
button it owns.  The obvious thing to do is this:</p>
<pre class="example">% snit::widget dog {
    constructor {args} {
        #...
        button $win.barkbtn -text &quot;Bark!&quot; -command [list $self bark]
        #...
    }
}
::dog
%
</pre>
<p>(Note that in this example, our <b class="cmd">dog</b>
becomes a <b class="cmd">snit::widget</b>, because it has GUI behavior.  See
<span class="sectref"><a href="#section17">WIDGETS</a></span> for more.)  Thus, if we create a <b class="cmd">dog</b> called
<b class="cmd">.spot</b>, it will create a Tk button called <b class="cmd">.spot.barkbtn</b>;
when pressed, the button will call <b class="cmd">$self bark</b>.</p>
<p>Now, this will work--provided that <b class="cmd">.spot</b> is never renamed to
something else.  But surely renaming widgets is
abnormal?  And so it is--unless <b class="cmd">.spot</b> is the hull component of a
<b class="cmd">snit::widgetadaptor</b>.  If it is, then it will be renamed, and
<b class="cmd">.spot</b> will become the name of the <b class="cmd">snit::widgetadaptor</b>
object.  When the button is pressed, the command <b class="cmd">$self bark</b>
will be handled by the <b class="cmd">snit::widgetadaptor</b>, which might or might
not do the right thing.</p>
<p>There's a safer way to do it, and it looks like this:</p>
<pre class="example">% snit::widget dog {
    constructor {args} {
        #...
        button $win.barkbtn -text &quot;Bark!&quot; -command [mymethod bark]
        #...
    }
}
::dog
%
</pre>
<p>The command <b class="cmd">mymethod</b> takes any number of arguments, and can be
used like <b class="cmd"><a href="../../../../index.html#key252">list</a></b> to build up a callback command; the only
difference is that <b class="cmd">mymethod</b> returns a 
form of the command that won't change even if the instance's name
changes.</p>
<p>On the other hand, you might prefer to allow a widgetadaptor to 
override a method such that your renamed widget will call the
widgetadaptor's method instead of its own.  In this case, 
using <b class="cmd">[list $self bark]</b> will do what you want...but
this is a technique which should be used only in carefully controlled
circumstances.</p>
</div>
<div id="subsection40" class="subsection"><h3><a name="subsection40">How do I delegate instance methods to a component?</a></h3>
<p>See <span class="sectref"><a href="#section16">DELEGATION</a></span>.</p>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">INSTANCE VARIABLES</a></h2>
<div id="subsection41" class="subsection"><h3><a name="subsection41">What is an instance variable?</a></h3>
<p>An instance variable is a private variable associated with some
particular Snit object.  Instance variables can be scalars or arrays.</p>
</div>
<div id="subsection42" class="subsection"><h3><a name="subsection42">How is a scalar instance variable defined?</a></h3>
<p>Scalar instance variables are defined in the type definition using the
<b class="cmd">variable</b> statement.  You can simply name it, or you can
initialize it with a value:</p>
<pre class="example">snit::type mytype {
    # Define variable &quot;greeting&quot; and initialize it with &quot;Howdy!&quot;
    variable greeting &quot;Howdy!&quot;
}
</pre>
</div>
<div id="subsection43" class="subsection"><h3><a name="subsection43">How is an array instance variable defined?</a></h3>
<p>Array instance variables are also defined in the type definition
using the <b class="cmd">variable</b> command.  You can initialize them at the same
time by specifying the <b class="const">-array</b> option:</p>
<pre class="example">snit::type mytype {
    # Define array variable &quot;greetings&quot;
    variable greetings -array {
        formal &quot;Good Evening&quot;
        casual &quot;Howdy!&quot;
    }
}
</pre>
</div>
<div id="subsection44" class="subsection"><h3><a name="subsection44">What happens if I don't initialize an instance variable?</a></h3>
<p>Variables do not really exist until they are given values.  If you 
do not initialize a variable when you define it, then you must be
sure to assign a value to it (in the constructor, say, or in some
method) before you reference it.</p>
</div>
<div id="subsection45" class="subsection"><h3><a name="subsection45">Are there any limitations on instance variable names?</a></h3>
<p>Just a few.</p>
<p>First, every Snit object has a built-in instance variable called
<b class="variable">options</b>, which should never be redefined.</p>
<p>Second, all names beginning with &quot;Snit_&quot; are reserved for
use by Snit internal code.</p>
<p>Third, instance variable names containing the namespace delimiter
(<b class="const">::</b>) are likely to cause great confusion.</p>
</div>
<div id="subsection46" class="subsection"><h3><a name="subsection46">Do I need to declare my instance variables in my methods?</a></h3>
<p>No. Once you've defined an instance variable in the type definition,
it can be used in any instance code (instance methods, the
constructor, and the destructor) without declaration.  This differs
from normal Tcl practice, in which all non-local variables in a proc
need to be declared.</p>
<p>There is a speed penalty to having all instance variables implicitly
available in all instance code.  Even though your code need not 
declare the variables explicitly, Snit must still declare them,
and that takes time.  If you have ten instance variables, a method
that uses none of them must still pay the declaration penalty for 
all ten.  In most cases, the additional runtime cost is negligible.
If extreme cases, you might wish to avoid it; there are two methods
for doing so.</p>
<p>The first is to define a single instance variable, an array, and store
all of your instance data in the array.  This way, you're only paying
the declaration penalty for one variable--and you probably need the
variable most of the time anyway.  This method breaks down if your
instance variables include multiple arrays; in Tcl 8.5, however,
the <b class="cmd">dict</b> command might come to your rescue.</p>
<p>The second method is to declare your instance variables explicitly
in your instance code, while <em>not</em> including them in the type
definition:</p>
<pre class="example">snit::type dog {
    constructor {} {
        variable mood
        set mood happy
    }
    method setmood {newMood} {
        variable mood
        set mood $newMood
    }
    method getmood {} {
        variable mood
        return $mood
    }
}
</pre>
<p>This allows you to ensure that only the required variables are
included in each method, at the cost of longer code and run-time
errors when you forget to declare a variable you need.</p>
</div>
<div id="subsection47" class="subsection"><h3><a name="subsection47">How do I pass an instance variable's name to another object?</a></h3>
<p>In Tk, it's common to pass a widget a variable name; for example, Tk
label widgets have a <b class="option">-textvariable</b> option which names the
variable which will contain the widget's text.  This allows the
program to update the label's value just by assigning a new value to
the variable.</p>
<p>If you naively pass the instance variable name to the label widget,
you'll be confused by the result; Tk will assume that the name names a
global variable.  Instead, you need to provide a fully-qualified
variable name.  From within an instance method or a constructor, you
can fully qualify the variable's name using the <b class="cmd">myvar</b> command:</p>
<pre class="example">snit::widget mywidget {
    variable labeltext &quot;&quot;
    constructor {args} {
        # ...
        label $win.label -textvariable [myvar labeltext]
        # ...
    }
}
</pre>
</div>
<div id="subsection48" class="subsection"><h3><a name="subsection48">How do I make an instance variable public?</a></h3>
<p>Practically speaking, you don't.  Instead, you'll implement public
variables as <span class="sectref"><a href="#section7">OPTIONS</a></span>.
Alternatively, you can write <span class="sectref"><a href="#section5">INSTANCE METHODS</a></span> to set and get
the variable's value.</p>
</div>
</div>
<div id="section7" class="section"><h2><a name="section7">OPTIONS</a></h2>
<div id="subsection49" class="subsection"><h3><a name="subsection49">What is an option?</a></h3>
<p>A type's options are the equivalent of what other object-oriented
languages would call public member variables or properties: they are
data values which can be retrieved and (usually) set by the clients of
an object.</p>
<p>Snit's implementation of options follows the Tk model fairly exactly,
except that <b class="cmd">snit::type</b> objects usually don't interact with 
<span class="sectref"><a href="#section19">THE TK OPTION DATABASE</a></span>; <b class="cmd">snit::widget</b> and 
<b class="cmd">snit::widgetadaptor</b> objects, on the other hand, always do.</p>
</div>
<div id="subsection50" class="subsection"><h3><a name="subsection50">How do I define an option?</a></h3>
<p>Options are defined in the type definition using the <b class="cmd">option</b>
statement.  Consider the following type, to be used in an application
that manages a list of dogs for a pet store:</p>
<pre class="example">snit::type dog {
    option -breed -default mongrel
    option -color -default brown
    option -akc   -default 0
    option -shots -default 0
}
</pre>
<p>According to this, a dog has four notable properties: a
breed, a color, a flag that says whether it's pedigreed with the
American Kennel Club, and another flag that says whether it has had
its shots.  The default dog, evidently, is a brown mutt.</p>
<p>There are a number of options you can specify when defining an option;
if <b class="const">-default</b> is the only one, you can omit the word 
<b class="const">-default</b> as follows:</p>
<pre class="example">snit::type dog {
    option -breed mongrel
    option -color brown
    option -akc   0
    option -shots 0
}
</pre>
<p>If no <b class="const">-default</b> value is specified, the option's default value
will be the empty string (but see <span class="sectref"><a href="#section19">THE TK OPTION DATABASE</a></span>).</p>
<p>The Snit man page refers to options like these as &quot;locally defined&quot; options.</p>
</div>
<div id="subsection51" class="subsection"><h3><a name="subsection51">How can a client set options at object creation?</a></h3>
<p>The normal convention is that the client may pass any number of
options and their values after the object's name at object creation.
For example, the <b class="cmd">::dog</b> command defined in the previous answer can now
be used to create individual dogs.  Any or all of the options may be
set at creation time.</p>
<pre class="example">% dog spot -breed beagle -color &quot;mottled&quot; -akc 1 -shots 1
::spot
% dog fido -shots 1
::fido
%
</pre>
<p>So <b class="cmd">::spot</b> is a pedigreed beagle; <b class="cmd">::fido</b> is a typical mutt,
but his owners evidently take care of him, because he's had his shots.</p>
<p><em>Note:</em> If the type defines a constructor, it can specify a
different object-creation syntax.  See <span class="sectref"><a href="#section12">CONSTRUCTORS</a></span> for more
information.</p>
</div>
<div id="subsection52" class="subsection"><h3><a name="subsection52">How can a client retrieve an option's value?</a></h3>
<p>Retrieve option values using the <b class="method">cget</b> method:</p>
<pre class="example">% spot cget -color
mottled
% fido cget -breed
mongrel
%
</pre>
</div>
<div id="subsection53" class="subsection"><h3><a name="subsection53">How can a client set options after object creation?</a></h3>
<p>Any number of options may be set at one time using the
<b class="method">configure</b> instance method.  Suppose that closer inspection
shows that ::fido is not a brown mongrel, but rather a rare Arctic Boar 
Hound of a lovely dun color:</p>
<pre class="example">% fido configure -color dun -breed &quot;Arctic Boar Hound&quot;
% fido cget -color
dun
% fido cget -breed
Arctic Boar Hound
</pre>
<p>Alternatively, the <b class="method">configurelist</b> method takes a list of
options and values; occasionally this is more convenient:</p>
<pre class="example">% set features [list -color dun -breed &quot;Arctic Boar Hound&quot;]
-color dun -breed {Arctic Boar Hound}
% fido configurelist $features
% fido cget -color
dun
% fido cget -breed
Arctic Boar Hound
%
</pre>
<p>In Tcl 8.5, the <b class="cmd">*</b> keyword can be used with 
<b class="method">configure</b> in this case:</p>
<pre class="example">% set features [list -color dun -breed &quot;Arctic Boar Hound&quot;]
-color dun -breed {Arctic Boar Hound}
% fido configure {*}$features
% fido cget -color
dun
% fido cget -breed
Arctic Boar Hound
%
</pre>
<p>The results are the same.</p>
</div>
<div id="subsection54" class="subsection"><h3><a name="subsection54">How should an instance method access an option value?</a></h3>
<p>There are two ways an instance method can set and retrieve an option's
value.  One is to use the <b class="method">configure</b> and <b class="method">cget</b>
methods, as shown below.</p>
<pre class="example">% snit::type dog {
    option -weight 10
    method gainWeight {} {
        set wt [$self cget -weight]
        incr wt
        $self configure -weight $wt
    }
}
::dog
% dog fido
::fido
% fido cget -weight
10
% fido gainWeight
% fido cget -weight
11
%
</pre>
<p>Alternatively, Snit provides a built-in array instance variable called
<b class="variable">options</b>.  The indices are the option names; the values are the
option values.  The method <b class="method">gainWeight</b> can thus be rewritten as
follows:</p>
<pre class="example">
    method gainWeight {} {
        incr options(-weight)
    }
</pre>
<p>As you can see, using the <b class="variable">options</b> variable involves considerably
less typing and is the usual way to do it.  But if you use 
<b class="const">-configuremethod</b> or <b class="const">-cgetmethod</b> (described in the following
answers), you might wish to use the <b class="method">configure</b> and 
<b class="method">cget</b> methods anyway, just so that any special processing you've
implemented is sure to get done.  Also, if the option is delegated to
a component then <b class="method">configure</b> and <b class="method">cget</b> are the only way
to access it without accessing the component directly.  See 
<span class="sectref"><a href="#section16">DELEGATION</a></span> for more information.</p>
</div>
<div id="subsection55" class="subsection"><h3><a name="subsection55">How can I make an option read-only?</a></h3>
<p>Define the option with <b class="const">-readonly yes</b>.</p>
<p>Suppose you've got an option that determines how
instances of your type are constructed; it must be set at creation
time, after which it's constant.  For example, a dog never changes its
breed; it might or might not have had its shots, and if not can have
them at a later time.  <b class="const">-breed</b> should be read-only, but
<b class="const">-shots</b> should not be.</p>
<pre class="example">% snit::type dog {
    option -breed -default mongrel -readonly yes
    option -shots -default no
}
::dog
% dog fido -breed retriever
::fido
% fido configure -shots yes
% fido configure -breed terrier
option -breed can only be set at instance creation
%
</pre>
</div>
<div id="subsection56" class="subsection"><h3><a name="subsection56">How can I catch accesses to an option's value?</a></h3>
<p>Define a <b class="const">-cgetmethod</b> for the option.</p>
</div>
<div id="subsection57" class="subsection"><h3><a name="subsection57">What is a -cgetmethod?</a></h3>
<p>A <b class="const">-cgetmethod</b> is a method that's called whenever the related
option's value is queried via the 
<b class="method">cget</b> instance method.  The handler can compute the option's
value, retrieve it from a database, or do anything else you'd like it to do.</p>
<p>Here's what the default behavior would look like if
written using a <b class="const">-cgetmethod</b>:</p>
<pre class="example">snit::type dog {
    option -color -default brown -cgetmethod GetOption
    method GetOption {option} {
        return $options($option)
    }
}
</pre>
<p>Any instance method can be used, provided that it takes one argument,
the name of the option whose value is to be retrieved.</p>
</div>
<div id="subsection58" class="subsection"><h3><a name="subsection58">How can I catch changes to an option's value?</a></h3>
<p>Define a <b class="const">-configuremethod</b> for the option.</p>
</div>
<div id="subsection59" class="subsection"><h3><a name="subsection59">What is a -configuremethod?</a></h3>
<p>A <b class="const">-configuremethod</b> is a method that's called whenever the
related option is given a new value via the <b class="method">configure</b> or
<b class="method">configurelist</b> instance methods. The method can 
pass the value on to some other object, store it in a database, or do
anything else you'd like it to do.</p>
<p>Here's what the default configuration behavior would look like if
written using a <b class="const">-configuremethod</b>:</p>
<pre class="example">snit::type dog {
    option -color -default brown -configuremethod SetOption
    method SetOption {option value} {
        set options($option) $value
    }
}
</pre>
<p>Any instance method can be used, provided that it takes two arguments,
the name of the option and the new value.</p>
<p>Note that if your method doesn't store the value in the <b class="variable">options</b>
array, the <b class="variable">options</b> array won't get updated.</p>
</div>
<div id="subsection60" class="subsection"><h3><a name="subsection60">How can I validate an option's value?</a></h3>
<p>Define a <b class="const">-validatemethod</b>.</p>
</div>
<div id="subsection61" class="subsection"><h3><a name="subsection61">What is a -validatemethod?</a></h3>
<p>A <b class="const">-validatemethod</b> is a method that's called whenever the
related option is given a new value via the <b class="method">configure</b> or
<b class="method">configurelist</b> instance methods.  It's the method's
responsibility to determine whether the new value is valid, and throw
an error if it isn't.  The <b class="const">-validatemethod</b>, if any, is called
before the value is stored in the <b class="variable">options</b> array; in particular,
it's called before the <b class="const">-configuremethod</b>, if any.</p>
<p>For example, suppose an option always takes a Boolean value.  You can
ensure that the value is in fact a valid Boolean like this:</p>
<pre class="example">% snit::type dog {
    option -shots -default no -validatemethod BooleanOption
    method BooleanOption {option value} {
        if {![string is boolean -strict $value]} {
            error &quot;expected a boolean value, got \&quot;$value\&quot;&quot;
        }
    }
}
::dog
% dog fido
% fido configure -shots yes
% fido configure -shots NotABooleanValue
expected a boolean value, got &quot;NotABooleanValue&quot;
%
</pre>
<p>Note that the same <b class="const">-validatemethod</b> can be used to validate any number
of boolean options.</p>
<p>Any method can be a <b class="const">-validatemethod</b> provided that it takes
two arguments, the option name and the new option value.</p>
</div>
</div>
<div id="section8" class="section"><h2><a name="section8">TYPE VARIABLES</a></h2>
<div id="subsection62" class="subsection"><h3><a name="subsection62">What is a type variable?</a></h3>
<p>A type variable is a private variable associated with a Snit type
rather than with a particular instance of the type.  In C++ and Java,
the term <i class="term">static member variable</i> is used for the same notion.
Type variables can be scalars or arrays.</p>
</div>
<div id="subsection63" class="subsection"><h3><a name="subsection63">How is a scalar type variable defined?</a></h3>
<p>Scalar type variables are defined in the type definition using the
<b class="cmd">typevariable</b> statement.  You can simply name it, or you can
initialize it with a value:</p>
<pre class="example">
snit::type mytype {
    # Define variable &quot;greeting&quot; and initialize it with &quot;Howdy!&quot;
    typevariable greeting &quot;Howdy!&quot;
}
</pre>
<p>Every object of type <b class="cmd">mytype</b> now has access to a single variable
called <b class="variable">greeting</b>.</p>
</div>
<div id="subsection64" class="subsection"><h3><a name="subsection64">How is an array-valued type variable defined?</a></h3>
<p>Array-valued type variables are also defined using the
<b class="cmd">typevariable</b> command; to initialize them, include the 
<b class="const">-array</b> option:</p>
<pre class="example">snit::type mytype {
    # Define typearray variable &quot;greetings&quot;
    typevariable greetings -array {
        formal &quot;Good Evening&quot;
        casual &quot;Howdy!&quot;
    }
}
</pre>
</div>
<div id="subsection65" class="subsection"><h3><a name="subsection65">What happens if I don't initialize a type variable?</a></h3>
<p>Variables do not really exist until they are given values.  If you 
do not initialize a variable when you define it, then you must be
sure to assign a value to it (in the type constructor, say)
before you reference it.</p>
</div>
<div id="subsection66" class="subsection"><h3><a name="subsection66">Are there any limitations on type variable names?</a></h3>
<p>Type variable names have the same restrictions as 
the names of <span class="sectref"><a href="#section6">INSTANCE VARIABLES</a></span> do.</p>
</div>
<div id="subsection67" class="subsection"><h3><a name="subsection67">Do I need to declare my type variables in my methods?</a></h3>
<p>No. Once you've defined a type variable in the type definition, it can
be used in <span class="sectref"><a href="#section5">INSTANCE METHODS</a></span> or <span class="sectref"><a href="#section9">TYPE METHODS</a></span> without
declaration.  This differs from normal Tcl practice, in which all
non-local variables in a proc need to be declared.</p>
<p>Type variables are subject to the same speed/readability tradeoffs
as instance variables; see
<span class="sectref"><a href="#subsection46">Do I need to declare my instance variables in my methods?</a></span></p>
</div>
<div id="subsection68" class="subsection"><h3><a name="subsection68">How do I pass a type variable's name to another object?</a></h3>
<p>In Tk, it's common to pass a widget a variable name; for example, Tk
label widgets have a <b class="option">-textvariable</b> option which names the
variable which will contain the widget's text.  This allows the
program to update the label's value just by assigning a new value to
the variable.</p>
<p>If you naively pass a type variable name to the label widget, you'll
be confused by the result; Tk will assume that the name names a global
variable.  Instead, you need to provide a fully-qualified variable
name.  From within an instance method or a constructor, you can fully
qualify the type variable's name using the <b class="cmd">mytypevar</b> command:</p>
<pre class="example">snit::widget mywidget {
    typevariable labeltext &quot;&quot;
    constructor {args} {
        # ...
        label $win.label -textvariable [mytypevar labeltext]
        # ...
    }
}
</pre>
</div>
<div id="subsection69" class="subsection"><h3><a name="subsection69">How do I make a type variable public?</a></h3>
<p>There are two ways to do this.  The preferred way is to write a pair
of <span class="sectref"><a href="#section9">TYPE METHODS</a></span> to set and query the type variable's value.</p>
<p>Type variables are stored in the type's namespace, which has
the same name as the type itself.  Thus, you can also
publicize the type variable's name in your
documentation so that clients can access it directly.  For example,</p>
<pre class="example">snit::type mytype {
    typevariable myvariable
}
set ::mytype::myvariable &quot;New Value&quot;
</pre>
</div>
</div>
<div id="section9" class="section"><h2><a name="section9">TYPE METHODS</a></h2>
<div id="subsection70" class="subsection"><h3><a name="subsection70">What is a type method?</a></h3>
<p>A type method is a procedure associated with the type itself rather
than with any specific instance of the type, and called as a
subcommand of the type command.</p>
</div>
<div id="subsection71" class="subsection"><h3><a name="subsection71">How do I define a type method?</a></h3>
<p>Type methods are defined in the type definition using the
<b class="cmd">typemethod</b> statement:</p>
<pre class="example">snit::type dog {
    # List of pedigreed dogs
    typevariable pedigreed
    typemethod pedigreedDogs {} {
        return $pedigreed
    }
}
</pre>
<p>Suppose the <b class="cmd">dog</b> type maintains a list of the names of the dogs
that have pedigrees.  The <b class="cmd">pedigreedDogs</b> type method returns this
list.</p>
<p>The <b class="cmd">typemethod</b> statement looks just like a normal Tcl
<b class="cmd"><a href="../../../../index.html#key543">proc</a></b>, except that it appears in a <b class="cmd">snit::type</b> definition.
Notice that every type method gets an implicit argument called
<b class="variable">type</b>, which contains the fully-qualified type name.</p>
</div>
<div id="subsection72" class="subsection"><h3><a name="subsection72">How does a client call a type method?</a></h3>
<p>The type method name becomes a subcommand of the type's command.  For
example, assuming that the constructor adds each pedigreed dog to the
list of <b class="variable">pedigreedDogs</b>,</p>
<pre class="example">snit::type dog {
    option -pedigreed 0
    # List of pedigreed dogs
    typevariable pedigreed
    typemethod pedigreedDogs {} {
        return $pedigreed
    }
    # ...
}
dog spot -pedigreed 1
dog fido
foreach dog [dog pedigreedDogs] { ... }
</pre>
</div>
<div id="subsection73" class="subsection"><h3><a name="subsection73">Are there any limitations on type method names?</a></h3>
<p>Not really, so long as you avoid the standard type method names:
<b class="method">create</b>, <b class="method">destroy</b>, and <b class="method">info</b>.</p>
</div>
<div id="subsection74" class="subsection"><h3><a name="subsection74">How do I make a type method private?</a></h3>
<p>It's sometimes useful to define private type methods, that is, type
methods intended to be called only by other type or instance methods
of the same object.</p>
<p>Snit doesn't implement any access control on type methods; by
convention, the names of public methods begin with a lower-case
letter, and the names of private methods begin with an upper-case
letter.</p>
<p>Alternatively, a Snit <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> can be used as a private type method; see
<span class="sectref"><a href="#section10">PROCS</a></span>.</p>
</div>
<div id="subsection75" class="subsection"><h3><a name="subsection75">Are there any limitations on type method arguments?</a></h3>
<p>Method argument lists are defined just like normal Tcl proc argument
lists; in particular, they can include arguments with default values
and the <b class="variable">args</b> argument.</p>
<p>However, every type method is called with an implicit argument called
<b class="variable">type</b> that contains the name of the type command.  In addition,
type methods should by convention avoid using the names of the
arguments implicitly defined for <span class="sectref"><a href="#section5">INSTANCE METHODS</a></span>.</p>
</div>
<div id="subsection76" class="subsection"><h3><a name="subsection76">How does an instance or type method call a type method?</a></h3>
<p>If an instance or type method needs to call a type method, it should
use <b class="variable">$type</b> to do so:</p>
<pre class="example">snit::type dog {
    typemethod pedigreedDogs {} { ... }
    typemethod printPedigrees {} {
        foreach obj [$type pedigreedDogs] { ... }
    }
}
</pre>
</div>
<div id="subsection77" class="subsection"><h3><a name="subsection77">How do I pass a type method as a callback?</a></h3>
<p>It's common in Tcl to pass a snippet of code to another object, for it
to call later.  Because types cannot be renamed, you can just
use the type name, or, if the callback is registered from within
a type method, <b class="variable">type</b>.  For example, suppose we want to print a
list of pedigreed dogs when a Tk button is pushed:</p>
<pre class="example">
button .btn -text &quot;Pedigrees&quot; -command [list dog printPedigrees]
pack .btn
</pre>
<p>Alternatively, from a method or type method you can use the 
<b class="cmd">mytypemethod</b> command, just as you would use <b class="cmd">mymethod</b>
to define a callback command for <span class="sectref"><a href="#section5">INSTANCE METHODS</a></span>.</p>
</div>
<div id="subsection78" class="subsection"><h3><a name="subsection78">Can type methods be hierarchical?</a></h3>
<p>Yes, you can define hierarchical type methods in just the same way as
you can define hierarchical instance methods.  See
<span class="sectref"><a href="#section5">INSTANCE METHODS</a></span> for more.</p>
</div>
</div>
<div id="section10" class="section"><h2><a name="section10">PROCS</a></h2>
<div id="subsection79" class="subsection"><h3><a name="subsection79">What is a proc?</a></h3>
<p>A Snit <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> is really just a Tcl proc defined within the type's
namespace.  You can use procs for private code that isn't related to
any particular instance.</p>
</div>
<div id="subsection80" class="subsection"><h3><a name="subsection80">How do I define a proc?</a></h3>
<p>Procs are defined by including a <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> statement in the type
definition:</p>
<pre class="example">snit::type mytype {
    # Pops and returns the first item from the list stored in the
    # listvar, updating the listvar
   proc pop {listvar} { ... }
   # ...
}
</pre>
</div>
<div id="subsection81" class="subsection"><h3><a name="subsection81">Are there any limitations on proc names?</a></h3>
<p>Any name can be used, so long as it does not begin with <b class="const">Snit_</b>;
names beginning with <b class="const">Snit_</b> are reserved for Snit's own use.
However, the wise programmer will avoid <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> names (<b class="cmd"><a href="../../../../index.html#key253">set</a></b>,
<b class="cmd"><a href="../../../../index.html#key252">list</a></b>, <b class="cmd">if</b>, etc.) that would shadow standard Tcl
command names.</p>
<p><b class="cmd"><a href="../../../../index.html#key543">proc</a></b> names, being private, should begin with a capital letter according
to convention; however, as there are typically no public <b class="cmd"><a href="../../../../index.html#key543">proc</a></b>s
in the type's namespace it doesn't matter much either way.</p>
</div>
<div id="subsection82" class="subsection"><h3><a name="subsection82">How does a method call a proc?</a></h3>
<p>Just like it calls any Tcl command.  For example,</p>
<pre class="example">snit::type mytype {
    # Pops and returns the first item from the list stored in the
    # listvar, updating the listvar
    proc pop {listvar} { ... }
    variable requestQueue {}
    # Get one request from the queue and process it.
    method processRequest {} {
        set req [pop requestQueue]
    }
}
</pre>
</div>
<div id="subsection83" class="subsection"><h3><a name="subsection83">How can I pass a proc to another object as a callback?</a></h3>
<p>The <b class="cmd">myproc</b> command returns a callback command for the 
<b class="cmd"><a href="../../../../index.html#key543">proc</a></b>, just as <b class="cmd">mymethod</b> does for a method.</p>
</div>
</div>
<div id="section11" class="section"><h2><a name="section11">TYPE CONSTRUCTORS</a></h2>
<div id="subsection84" class="subsection"><h3><a name="subsection84">What is a type constructor?</a></h3>
<p>A type constructor is a body of code that initializes the type as a
whole, rather like a C++ static initializer.  The body of a type
constructor is executed once when the type is defined, and never
again.</p>
<p>A type can have at most one type constructor.</p>
</div>
<div id="subsection85" class="subsection"><h3><a name="subsection85">How do I define a type constructor?</a></h3>
<p>A type constructor is defined by using the <b class="cmd">typeconstructor</b>
statement in the type definition.  For example, suppose the type uses
an array-valued type variable as a look-up table, and the values in
the array have to be computed at start-up.</p>
<pre class="example">% snit::type mytype {
    typevariable lookupTable
    typeconstructor {
        array set lookupTable {key value...}
    }
}
</pre>
</div>
</div>
<div id="section12" class="section"><h2><a name="section12">CONSTRUCTORS</a></h2>
<div id="subsection86" class="subsection"><h3><a name="subsection86">What is a constructor?</a></h3>
<p>In object-oriented programming, an object's constructor is responsible
for initializing the object completely at creation time. The constructor
receives the list of options passed to the <b class="cmd">snit::type</b> command's
<b class="method">create</b> method and can then do whatever it likes.  That might include
computing instance variable values, reading data from files, creating
other objects, updating type and instance variables, and so forth.</p>
<p>The constructor's return value is ignored (unless it's an
error, of course).</p>
</div>
<div id="subsection87" class="subsection"><h3><a name="subsection87">How do I define a constructor?</a></h3>
<p>A constructor is defined by using the <b class="cmd">constructor</b> statement in
the type definition.  Suppose that it's desired to keep a list of all
pedigreed dogs.  The list can be maintained in a 
type variable and retrieved by a type method.  Whenever a dog is
created, it can add itself to the list--provided that it's registered
with the American Kennel Club.</p>
<pre class="example">% snit::type dog {
    option -akc 0
    typevariable akcList {}
    constructor {args} {
        $self configurelist $args
        if {$options(-akc)} {
            lappend akcList $self
        }
    }
    typemethod akclist {} {
        return $akcList
    }
}
::dog
% dog spot -akc 1
::spot
% dog fido
::fido
% dog akclist
::spot
%
</pre>
</div>
<div id="subsection88" class="subsection"><h3><a name="subsection88">What does the default constructor do?</a></h3>
<p>If you don't provide a constructor explicitly, you get the default
constructor, which is identical to the explicitly-defined
constructor shown here:</p>
<pre class="example">snit::type dog {
    constructor {args} {
        $self configurelist $args
    }
}
</pre>
<p>When the constructor is called, <b class="variable">args</b> will be set to the list of
arguments that follow the object's name.  The constructor is allowed
to interpret this list any way it chooses; the normal convention is
to assume that it's a list of option names and values, as shown in the
example above.  If you simply want to save the option values, you
should use the <b class="method">configurelist</b> method, as shown.</p>
</div>
<div id="subsection89" class="subsection"><h3><a name="subsection89">Can I choose a different set of arguments for the constructor?</a></h3>
<p>Yes, you can.  For example, suppose we wanted to be sure that the
breed was explicitly stated for every dog at creation time, and
couldn't be changed thereafter.  One way to do that is as follows:</p>
<pre class="example">% snit::type dog {
    variable breed
    option -color brown
    option -akc 0
    constructor {theBreed args} {
        set breed $theBreed
        $self configurelist $args
    }
    method breed {} { return $breed }
}
::dog
% dog spot dalmatian -color spotted -akc 1
::spot
% spot breed
dalmatian
</pre>
<p>The drawback is that this syntax is non-standard, and may
limit the compatibility of your new type with other people's code.
For example, Snit assumes that it can create 
<span class="sectref"><a href="#section14">COMPONENTS</a></span> using the standard creation syntax.</p>
</div>
<div id="subsection90" class="subsection"><h3><a name="subsection90">Are there any limitations on constructor arguments?</a></h3>
<p>Constructor argument lists are subject to the same limitations
as those on instance method argument lists.  It has the
same implicit arguments, and can contain default values and the 
<b class="variable">args</b> argument.</p>
</div>
<div id="subsection91" class="subsection"><h3><a name="subsection91">Is there anything special about writing the constructor?</a></h3>
<p>Yes.  Writing the constructor can be tricky if you're delegating
options to components, and there are specific issues relating to
<b class="cmd">snit::widget</b>s and <b class="cmd">snit::widgetadaptor</b>s.  See 
<span class="sectref"><a href="#section16">DELEGATION</a></span>, <span class="sectref"><a href="#section17">WIDGETS</a></span>, 
<span class="sectref"><a href="#section18">WIDGET ADAPTORS</a></span>, and <span class="sectref"><a href="#section19">THE TK OPTION DATABASE</a></span>.</p>
</div>
</div>
<div id="section13" class="section"><h2><a name="section13">DESTRUCTORS</a></h2>
<div id="subsection92" class="subsection"><h3><a name="subsection92">What is a destructor?</a></h3>
<p>A destructor is a special kind of method that's called when an object
is destroyed.  It's responsible for doing any necessary clean-up when
the object goes away: destroying <span class="sectref"><a href="#section14">COMPONENTS</a></span>, closing files,
and so forth.</p>
</div>
<div id="subsection93" class="subsection"><h3><a name="subsection93">How do I define a destructor?</a></h3>
<p>Destructors are defined by using the <b class="cmd">destructor</b> statement in the
type definition.</p>
<p>Suppose we're maintaining a list of pedigreed dogs;
then we'll want to remove dogs from it when they are destroyed.</p>
<pre class="example">snit::type dog {
    option -akc 0
    typevariable akcList {}
    constructor {args} {
        $self configurelist $args
        if {$options(-akc)} {
            lappend akcList $self
        }
    }
    destructor {
        set ndx [lsearch $akcList $self]
        if {$ndx != -1} {
            set akcList [lreplace $akcList $ndx $ndx]
        }
    }
    typemethod akclist {} {
        return $akcList
    }
}
</pre>
</div>
<div id="subsection94" class="subsection"><h3><a name="subsection94">Are there any limitations on destructor arguments?</a></h3>
<p>Yes; a destructor has no explicit arguments.</p>
</div>
<div id="subsection95" class="subsection"><h3><a name="subsection95">What implicit arguments are passed to the destructor?</a></h3>
<p>The destructor gets the same implicit arguments that are passed to
<span class="sectref"><a href="#section5">INSTANCE METHODS</a></span>: <b class="variable">type</b>, <b class="variable">selfns</b>, <b class="variable">win</b>, and
<b class="variable">self</b>.</p>
</div>
<div id="subsection96" class="subsection"><h3><a name="subsection96">Must components be destroyed explicitly?</a></h3>
<p>Yes and no.</p>
<p>Any Tk widgets created by a <b class="cmd">snit::widget</b> or
<b class="cmd">snit::widgetadaptor</b> will be destroyed automatically by Tk
when the megawidget is destroyed, in keeping with normal Tk behavior 
(destroying a parent widget destroys the whole tree).</p>
<p>Components of normal <b class="cmd">snit::types</b>, on the other hand, 
are never destroyed automatically, nor are non-widget components 
of Snit megawidgets.  If your object creates them in its 
constructor, then it should generally destroy them in its destructor.</p>
</div>
<div id="subsection97" class="subsection"><h3><a name="subsection97">Is there any special about writing a destructor?</a></h3>
<p>Yes.  If an object's constructor throws an error, the object's
destructor will be called to clean up; this means that the object
might not be completely constructed when the destructor is called.
This can cause the destructor to throw its own error; the result
is usually misleading, confusing, and unhelpful.  Consequently, it's
important to write your destructor so that it's fail-safe.</p>
<p>For example, a <b class="cmd">dog</b> might create a <b class="cmd">tail</b> component; the
component will need to be destroyed.  But suppose there's an error
while processing the creation options--the destructor will be called,
and there will be no <b class="cmd">tail</b> to destroy.  The simplest solution is
generally to catch and ignore any errors while destroying components.</p>
<pre class="example">snit::type dog {
    component tail
    constructor {args} {
        $self configurelist $args
        set tail [tail %AUTO%]
    }
    destructor {
        catch {$tail destroy}
    }
}
</pre>
</div>
</div>
<div id="section14" class="section"><h2><a name="section14">COMPONENTS</a></h2>
<div id="subsection98" class="subsection"><h3><a name="subsection98">What is a component?</a></h3>
<p>Often an object will create and manage a number of other objects.  A
Snit megawidget, for example, will often create a number of Tk
widgets.  These objects are part of the main object; it is composed
of them, so they are called components of the object.</p>
<p>But Snit also has a more precise meaning for 
<span class="sectref"><a href="#section14">COMPONENT</a></span>.  The components of a Snit object are those
objects to which methods or options can be delegated.
(See <span class="sectref"><a href="#section16">DELEGATION</a></span> for more information about delegation.)</p>
</div>
<div id="subsection99" class="subsection"><h3><a name="subsection99">How do I declare a component?</a></h3>
<p>First, you must decide what role a component plays within your object,
and give the role a name.  Then, you declare the component using its
role name and the <b class="cmd">component</b> statement.  The <b class="cmd">component</b>
statement declares an <i class="term">instance variable</i> which is used to
store the component's command name when the component is created.</p>
<p>For example, suppose your <b class="cmd">dog</b> object
creates a <b class="cmd">tail</b> object (the better to wag with, no doubt):</p>
<pre class="example">snit::type dog {
    component mytail
    constructor {args} {
        # Create and save the component's command
        set mytail [tail %AUTO% -partof $self]
        $self configurelist $args
    }
    method wag {} {
        $mytail wag
    }
}
</pre>
<p>As shown here, it doesn't matter what the <b class="cmd">tail</b> object's real
name is; the <b class="cmd">dog</b> object refers to it by its component name.</p>
<p>The above example shows one way to delegate the <b class="method">wag</b> method to
the <b class="variable">mytail</b> component; see <span class="sectref"><a href="#section16">DELEGATION</a></span> for an easier way.</p>
</div>
<div id="subsection100" class="subsection"><h3><a name="subsection100">How is a component named?</a></h3>
<p>A component has two names.  The first name is that of the component
variable; this represents the role the component object plays within
the Snit object.  This is the component name proper, and is the name
used to refer to the component within Snit code.  The second name is
the name of the actual component object created by the Snit object's
constructor.  This second name is always a Tcl command name, and is
referred to as the component's object name.</p>
<p>In the example in the previous question, the component name is 
<b class="const">mytail</b>; the <b class="const">mytail</b> component's object name is chosen
automatically by Snit since <b class="const">%AUTO%</b> was used when the component
object was created.</p>
</div>
<div id="subsection101" class="subsection"><h3><a name="subsection101">Are there any limitations on component names?</a></h3>
<p>Yes.  <b class="cmd">snit::widget</b> and <b class="cmd">snit::widgetadaptor</b> objects have a special
component called the <b class="variable">hull</b> component; thus, the name <b class="variable">hull</b>
should be used for no other purpose.</p>
<p>Otherwise, since component names are in fact instance variable names
they must follow the rules for <span class="sectref"><a href="#section6">INSTANCE VARIABLES</a></span>.</p>
</div>
<div id="subsection102" class="subsection"><h3><a name="subsection102">What is an owned component?</a></h3>
<p>An <i class="term">owned</i> component is a component whose object command's
lifetime is controlled by the <b class="cmd">snit::type</b> or <b class="cmd">snit::widget</b>.</p>
<p>As stated above, a component is an object to
which our object can delegate methods or options.  Under this
definition, our object will usually create its component objects,
but not necessarily.  Consider the following: a dog object has a tail
component; but tail knows that it's part of the dog:</p>
<pre class="example">snit::type dog {
    component mytail
    constructor {args} {
        set mytail [tail %AUTO% -partof $self]
        $self configurelist $args
    }
    destructor {
        catch {$mytail destroy}
    }
    delegate method wagtail to mytail as wag
    method bark {} {
        return &quot;$self barked.&quot;
    }
}
 snit::type tail {
     component mydog
     option -partof -readonly yes
     constructor {args} {
         $self configurelist $args
         set mydog $options(-partof)
     }
     method wag {} {
         return &quot;Wag, wag.&quot;
     }
     method pull {} {
         $mydog bark
     }
 }
</pre>
<p>Thus, if you ask a dog to wag its tail, it tells its tail to wag;
and if you pull the dog's tail, the tail tells the dog to bark.  In
this scenario, the tail is a component of the dog, and the dog is a
component of the tail, but the dog owns the tail and not the other way
around.</p>
</div>
<div id="subsection103" class="subsection"><h3><a name="subsection103">What does the install command do?</a></h3>
<p>The <b class="cmd">install</b> command creates an owned component using a specified
command, and assigns the result to the component's instance variable.
For example:</p>
<pre class="example">snit::type dog {
    component mytail
    constructor {args} {
        # set mytail [tail %AUTO% -partof $self]
        install mytail using tail %AUTO% -partof $self
        $self configurelist $args
    }
}
</pre>
<p>In a <b class="cmd">snit::type</b>'s code, the <b class="cmd">install</b>
command shown above is equivalent to the <b class="const">set mytail</b> command
that's commented out.  In a <b class="cmd">snit::widget</b>'s or 
<b class="cmd">snit::widgetadaptor</b>'s, code, however, the
<b class="cmd">install</b> command also queries <span class="sectref"><a href="#section19">THE TK OPTION DATABASE</a></span>
and initializes the new component's options accordingly.  For consistency,
it's a good idea to get in the habit of using <b class="cmd">install</b> for all
owned components.</p>
</div>
<div id="subsection104" class="subsection"><h3><a name="subsection104">Must owned components be created in the constructor?</a></h3>
<p>No, not necessarily.  In fact, there's no reason why an
object can't destroy and recreate a component multiple times over
its own lifetime.</p>
</div>
<div id="subsection105" class="subsection"><h3><a name="subsection105">Are there any limitations on component object names?</a></h3>
<p>Yes.</p>
<p>Component objects which are Tk widgets or megawidgets must have valid
Tk window names.</p>
<p>Component objects which are not widgets or megawidgets must have
fully-qualified command names, i.e., names which include the full
namespace of the command.  Note that Snit always creates objects with
fully qualified names.</p>
<p>Next, the object names of components and owned by your object 
must be unique.  This is no problem for widget components, since
widget names are always unique; but consider the following code:</p>
<pre class="example">snit::type tail { ... }
snit::type dog {
    delegate method wag to mytail
    constructor {} {
        install mytail using tail mytail
    }
}
</pre>
<p>This code uses the component name, <b class="const">mytail</b>, as the component object
name.  This is not good, and here's why: Snit instance code executes
in the Snit type's namespace.  In this case, the <b class="const">mytail</b> component is
created in the <b class="const">::dog::</b> namespace, and will thus have the name
<b class="cmd">::dog::mytail</b>.</p>
<p>Now, suppose you create two dogs.  Both dogs will attempt to
create a tail called <b class="cmd">::dog::mytail</b>.  The first will succeed,
and the second will fail, since Snit won't let you create an object if
its name is already a command.  Here are two ways to avoid this situation:</p>
<p>First, if the component type is a <b class="cmd">snit::type</b> you can
specify <b class="const">%AUTO%</b> as its name, and be guaranteed to get a unique name.
This is the safest thing to do:</p>
<pre class="example">
    install mytail using tail %AUTO%
</pre>
<p>If the component type isn't a <b class="cmd">snit::type</b> you can create
the component in the object's instance namespace:</p>
<pre class="example">
    install mytail using tail ${selfns}::mytail
</pre>
<p>Make sure you pick a unique name within the instance namespace.</p>
</div>
<div id="subsection106" class="subsection"><h3><a name="subsection106">Must I destroy the components I own?</a></h3>
<p>That depends.  When a parent widget is destroyed, all child widgets
are destroyed automatically. Thus, if your object is a <b class="cmd">snit::widget</b>
or <b class="cmd">snit::widgetadaptor</b> you don't need to destroy any components
that are widgets, because they will generally be children or
descendants of your megawidget.</p>
<p>If your object is an instance of <b class="cmd">snit::type</b>, though, none of its
owned components will be destroyed automatically, nor will be
non-widget components of a <b class="cmd">snit::widget</b> be destroyed
automatically.  All such owned components must be destroyed
explicitly, or they won't be destroyed at all.</p>
</div>
<div id="subsection107" class="subsection"><h3><a name="subsection107">Can I expose a component's object command as part of my interface?</a></h3>
<p>Yes, and there are two ways to do it.  The most appropriate way is
usually to use <span class="sectref"><a href="#section16">DELEGATION</a></span>.  Delegation allows you to pass
the options and methods you specify along to particular components.
This effectively hides the components from the users of your type, and
ensures good encapsulation.</p>
<p>However, there are times when it's appropriate, not to mention
simpler, just to make the entire component part of your type's public
interface.</p>
</div>
<div id="subsection108" class="subsection"><h3><a name="subsection108">How do I expose a component's object command?</a></h3>
<p>When you declare the component, specify the <b class="cmd">component</b>
statement's <b class="const">-public</b> option.  The value of this option is the
name of a method which will be delegated to your component's object 
command.</p>
<p>For example, supposed you've written a combobox megawidget which owns
a listbox widget, and you want to make the listbox's entire interface 
public.  You can do it like this:</p>
<pre class="example">snit::widget combobox {
     component listbox -public listbox
     constructor {args} {
         install listbox using listbox $win.listbox ....
     }
}
combobox .mycombo
.mycombo listbox configure -width 30
</pre>
<p>Your comobox widget, <b class="cmd">.mycombo</b>, now has a <b class="method">listbox</b> method
which has all of the same subcommands as the listbox widget itself.
Thus, the above code sets the listbox component's width to 30.</p>
<p>Usually you'll let the method name be the same as the component name;
however, you can name it anything you like.</p>
</div>
</div>
<div id="section15" class="section"><h2><a name="section15">TYPE COMPONENTS</a></h2>
<div id="subsection109" class="subsection"><h3><a name="subsection109">What is a type component?</a></h3>
<p>A type component is a component that belongs to the type itself
instead of to a particular instance of the type.  The relationship
between components and type components is the same as the
relationship between <span class="sectref"><a href="#section6">INSTANCE VARIABLES</a></span> and 
<span class="sectref"><a href="#section8">TYPE VARIABLES</a></span>.  Both <span class="sectref"><a href="#section5">INSTANCE METHODS</a></span> and
<span class="sectref"><a href="#section9">TYPE METHODS</a></span> can be delegated to type components.</p>
<p>Once you understand <span class="sectref"><a href="#section14">COMPONENTS</a></span> and
<span class="sectref"><a href="#section16">DELEGATION</a></span>, type components are just more of the same.</p>
</div>
<div id="subsection110" class="subsection"><h3><a name="subsection110">How do I declare a type component?</a></h3>
<p>Declare a type component using the <b class="cmd">typecomponent</b> statement.  It
takes the same options (<b class="const">-inherit</b> and <b class="const">-public</b>) as the
<b class="cmd">component</b> statement does, and defines a type variable to hold
the type component's object command.</p>
<p>Suppose in your model you've got many dogs, but only one
veterinarian.  You might make the veterinarian a type component.</p>
<pre class="example">snit::type veterinarian { ... }
snit::type dog {
    typecomponent vet
    # ...
}
</pre>
</div>
<div id="subsection111" class="subsection"><h3><a name="subsection111">How do I install a type component?</a></h3>
<p>Just use the <b class="cmd"><a href="../../../../index.html#key253">set</a></b> command to assign the component's object
command to the type component.  Because types 
(even <b class="cmd">snit::widget</b> types) are not widgets, and do not have
options anyway, the extra features of the <b class="cmd">install</b> command are
not needed.</p>
<p>You'll usually install type components in the type constructor, as
shown here:</p>
<pre class="example">snit::type veterinarian { ... }
snit::type dog {
    typecomponent vet
    typeconstructor {
        set vet [veterinarian %AUTO%]
    }
}
</pre>
</div>
<div id="subsection112" class="subsection"><h3><a name="subsection112">Are there any limitations on type component names?</a></h3>
<p>Yes, the same as on <span class="sectref"><a href="#section6">INSTANCE VARIABLES</a></span>, 
<span class="sectref"><a href="#section8">TYPE VARIABLES</a></span>, and normal <span class="sectref"><a href="#section14">COMPONENTS</a></span>.</p>
</div>
</div>
<div id="section16" class="section"><h2><a name="section16">DELEGATION</a></h2>
<div id="subsection113" class="subsection"><h3><a name="subsection113">What is delegation?</a></h3>
<p>Delegation, simply put, is when you pass a task you've been given to
one of your assistants.  (You do have assistants, don't you?)  Snit
objects can do the same thing.  The following example shows one way in
which the <b class="cmd">dog</b> object can delegate its <b class="cmd">wag</b> method and its
<b class="option">-taillength</b> option to its <b class="cmd">tail</b> component.</p>
<pre class="example">snit::type dog {
    variable mytail
    option -taillength -configuremethod SetTailOption -cgetmethod GetTailOption
    
    method SetTailOption {option value} {
         $mytail configure $option $value
    }
    method GetTailOption {option} {
         $mytail cget $option
    }
    method wag {} {
        $mytail wag
    }
    constructor {args} {
        install mytail using tail %AUTO% -partof $self
        $self configurelist $args
    }
}
</pre>
<p>This is the hard way to do it, by it demonstrates what delegation is
all about.  See the following answers for the easy way to do it.</p>
<p>Note that the constructor calls the <b class="method">configurelist</b> method
<b class="cmd"><a href="../../../../index.html#key366">after</a></b> it creates its <b class="cmd">tail</b>; otherwise,
if <b class="option">-taillength</b> appeared in the list of <b class="variable">args</b> we'd get an
error.</p>
</div>
<div id="subsection114" class="subsection"><h3><a name="subsection114">How can I delegate a method to a component object?</a></h3>
<p>Delegation occurs frequently enough that Snit makes it easy. Any
method can be delegated to any component or type component 
by placing a single <b class="cmd">delegate</b> statement in the type definition.
(See <span class="sectref"><a href="#section14">COMPONENTS</a></span> and <span class="sectref"><a href="#section15">TYPE COMPONENTS</a></span>
for more information about component names.)</p>
<p>For example, here's a much better way to delegate the <b class="cmd">dog</b>
object's <b class="cmd">wag</b> method:</p>
<pre class="example">% snit::type dog {
    delegate method wag to mytail
    constructor {} {
        install mytail using tail %AUTO%
    }
}
::dog
% snit::type tail {
    method wag {} { return &quot;Wag, wag, wag.&quot;}
}
::tail
% dog spot
::spot
% spot wag
Wag, wag, wag.
</pre>
<p>This code has the same effect as the code shown under the previous
question: when a <b class="cmd">dog</b>'s <b class="cmd">wag</b> method is called, the call and
its arguments are passed along automatically to the <b class="cmd">tail</b> object.</p>
<p>Note that when a component is mentioned in a <b class="cmd">delegate</b> statement,
the component's instance variable is defined implicitly.  However,
it's still good practice to declare it explicitly using the
<b class="cmd">component</b> statement.</p>
<p>Note also that you can define a method name using the <b class="cmd"><a href="../../../../index.html#key332">method</a></b>
statement, or you can define it using <b class="cmd">delegate</b>; you can't do
both.</p>
</div>
<div id="subsection115" class="subsection"><h3><a name="subsection115">Can I delegate to a method with a different name?</a></h3>
<p>Suppose you wanted to delegate the <b class="cmd">dog</b>'s <b class="method">wagtail</b> method to
the <b class="cmd">tail</b>'s <b class="method">wag</b> method.  After all you wag the tail, not
the dog.  It's easily done:</p>
<pre class="example">snit::type dog {
    delegate method wagtail to mytail as wag
    constructor {args} {
        install mytail using tail %AUTO% -partof $self
        $self configurelist $args
    }
}
</pre>
</div>
<div id="subsection116" class="subsection"><h3><a name="subsection116">Can I delegate to a method with additional arguments?</a></h3>
<p>Suppose the <b class="cmd">tail</b>'s <b class="method">wag</b> method takes as an argument the
number of times the tail should be wagged.  You want to delegate the
<b class="cmd">dog</b>'s <b class="method">wagtail</b> method to the <b class="cmd">tail</b>'s <b class="method">wag</b>
method, specifying that the tail should be wagged exactly three times.
This is easily done, too:</p>
<pre class="example">snit::type dog {
    delegate method wagtail to mytail as {wag 3}
    # ...
}
snit::type tail {
    method wag {count} {
        return [string repeat &quot;Wag &quot; $count]
    }
    # ...
}
</pre>
</div>
<div id="subsection117" class="subsection"><h3><a name="subsection117">Can I delegate a method to something other than an object?</a></h3>
<p>Normal method delegation assumes that you're delegating a method (a
subcommand of an object command) to a method of another object (a 
subcommand of a different object command).  But not all Tcl objects
follow Tk conventions, and not everything you'd to which you'd like
to delegate a method is necessary an object.  Consequently, Snit makes
it easy to delegate a method to pretty much anything you like using
the <b class="cmd">delegate</b> statement's <b class="const">using</b> clause.</p>
<p>Suppose your dog simulation stores dogs in a database, each dog as a
single record.  The database API you're using provides a number of
commands to manage records; each takes the record ID (a string you
choose) as its first argument.  For example, <b class="cmd">saverec</b>
saves a record.  If you let the record ID be the name of the dog
object, you can delegate the dog's <b class="method">save</b> method to the 
<b class="cmd">saverec</b> command as follows:</p>
<pre class="example">snit::type dog {
    delegate method save using {saverec %s}
}
</pre>
<p>The <b class="const">%s</b> is replaced with the instance name when the 
<b class="method">save</b> method is called; any additional arguments are the
appended to the resulting command.</p>
<p>The <b class="const">using</b> clause understands a number of other %-conversions;
in addition to the instance name, you can substitute in the method 
name (<b class="const">%m</b>), the type name (<b class="const">%t</b>), the instance 
namespace (<b class="const">%n</b>), the Tk window name (<b class="const">%w</b>), and,
if a component or typecomponent name was given in the 
<b class="cmd">delegate</b> statement, the component's object command 
(<b class="const">%c</b>).</p>
</div>
<div id="subsection118" class="subsection"><h3><a name="subsection118">How can I delegate a method to a type component object?</a></h3>
<p>Just exactly as you would to a component object.  The 
<b class="cmd">delegate method</b> statement accepts both component and type
component names in its <b class="const">to</b> clause.</p>
</div>
<div id="subsection119" class="subsection"><h3><a name="subsection119">How can I delegate a type method to a type component object?</a></h3>
<p>Use the <b class="cmd">delegate typemethod</b> statement.  It works like
<b class="cmd">delegate method</b>, with these differences: first, it defines
a type method instead of an instance method; second, the 
<b class="const">using</b> clause ignores the <b class="const">%s</b>, <b class="const">%n</b>, 
and <b class="const">%w</b> %-conversions.</p>
<p>Naturally, you can't delegate a type method to an instance
component...Snit wouldn't know which instance should receive it.</p>
</div>
<div id="subsection120" class="subsection"><h3><a name="subsection120">How can I delegate an option to a component object?</a></h3>
<p>The first question in this section (see <span class="sectref"><a href="#section16">DELEGATION</a></span>) shows
one way to delegate an option to a component; but this pattern occurs
often enough that Snit makes it easy.  For example, every <b class="cmd">tail</b>
object has a <b class="option">-length</b> option; we want to allow the creator of
a <b class="cmd">dog</b> object to set the tail's length.  We can do this:</p>
<pre class="example">% snit::type dog {
    delegate option -length to mytail
    constructor {args} {
        install mytail using tail %AUTO% -partof $self
        $self configurelist $args
    }
}
::dog
% snit::type tail {
    option -partof
    option -length 5
}
::tail
% dog spot -length 7
::spot
% spot cget -length
7
</pre>
<p>This produces nearly the same result as the <b class="const">-configuremethod</b> and
<b class="const">-cgetmethod</b> shown under the first question in this
section: whenever a <b class="cmd">dog</b> object's <b class="option">-length</b> option is set
or retrieved, the underlying <b class="cmd">tail</b> object's option is set or
retrieved in turn.</p>
<p>Note that you can define an option name using the <b class="cmd">option</b>
statement, or you can define it using <b class="cmd">delegate</b>; you can't do
both.</p>
</div>
<div id="subsection121" class="subsection"><h3><a name="subsection121">Can I delegate to an option with a different name?</a></h3>
<p>In the previous answer we delegated the <b class="cmd">dog</b>'s <b class="option">-length</b>
option down to its <b class="cmd">tail</b>.  This is, of course, wrong.  The dog
has a length, and the tail has a length, and they are different.  What
we'd really like to do is give the <b class="cmd">dog</b> a <b class="option">-taillength</b>
option, but delegate it to the <b class="cmd">tail</b>'s <b class="option">-length</b> option:</p>
<pre class="example">snit::type dog {
    delegate option -taillength to mytail as -length
    constructor {args} {
        set mytail [tail %AUTO% -partof $self]
        $self configurelist $args
    }
}
</pre>
</div>
<div id="subsection122" class="subsection"><h3><a name="subsection122">How can I delegate any unrecognized method or option to a component object?</a></h3>
<p>It may happen that a Snit object gets most of its behavior from one of
its components.  This often happens with <b class="cmd">snit::widgetadaptors</b>,
for example, where we wish to slightly the modify the behavior of an
existing widget.  To carry on with our <b class="cmd">dog</b> example, however, suppose
that we have a <b class="cmd">snit::type</b> called <b class="cmd">animal</b> that implements a
variety of animal behaviors--moving, eating, sleeping, and so forth.
We want our <b class="cmd">dog</b> objects to inherit these same behaviors, while
adding dog-like behaviors of its own.
Here's how we can give a <b class="cmd">dog</b> methods and options of its own
while delegating all other methods and options to its <b class="cmd">animal</b>
component:</p>
<pre class="example">snit::type dog {
    delegate option * to animal
    delegate method * to animal
    option -akc 0
    constructor {args} {
        install animal using animal %AUTO% -name $self
        $self configurelist $args
    }
    method wag {} {
        return &quot;$self wags its tail&quot;
    }
}
</pre>
<p>That's it.  A <b class="cmd">dog</b> is now an <b class="cmd">animal</b> that has a
<b class="option">-akc</b> option and can <b class="cmd">wag</b> its tail.</p>
<p>Note that we don't need to specify the full list of method names or
option names that <b class="cmd">animal</b> will receive.
It gets anything <b class="cmd">dog</b> doesn't recognize--and if it doesn't
recognize it either, it will simply throw an error, just as it should.</p>
<p>You can also delegate all unknown type methods to a type component
using <b class="cmd">delegate typemethod *</b>.</p>
</div>
<div id="subsection123" class="subsection"><h3><a name="subsection123">How can I delegate all but certain methods or options to a component?</a></h3>
<p>In the previous answer, we said that every <b class="cmd">dog</b> is
an <b class="cmd">animal</b> by delegating all unknown methods and options to the
<b class="variable">animal</b> component. But what if the <b class="cmd">animal</b> type has some
methods or options that we'd like to suppress?</p>
<p>One solution is to explicitly delegate all the options and methods,
and forgo the convenience of <b class="cmd">delegate method *</b> and
<b class="cmd">delegate option *</b>.  But if we wish to suppress only a few
options or methods, there's an easier way:</p>
<pre class="example">snit::type dog {
    delegate option * to animal except -numlegs
    delegate method * to animal except {fly climb}
    # ...
    constructor {args} {
        install animal using animal %AUTO% -name $self -numlegs 4
        $self configurelist $args
    }
    # ...
}
</pre>
<p>Dogs have four legs, so we specify that explicitly when we create the
<b class="variable">animal</b> component, and explicitly exclude <b class="option">-numlegs</b> from the
set of delegated options.  Similarly, dogs can neither 
<b class="method">fly</b> nor <b class="method">climb</b>,
so we exclude those <b class="cmd">animal</b> methods as shown.</p>
</div>
<div id="subsection124" class="subsection"><h3><a name="subsection124">Can a hierarchical method be delegated?</a></h3>
<p>Yes; just specify multiple words in the delegated method's name:</p>
<pre class="example">snit::type tail {
    method wag {} {return &quot;Wag, wag&quot;}
    method droop {} {return &quot;Droop, droop&quot;}
}
snit::type dog {
    delegate method {tail wag} to mytail
    delegate method {tail droop} to mytail
    # ...
    constructor {args} {
        install mytail using tail %AUTO%
        $self configurelist $args
    }
    # ...
}
</pre>
<p>Unrecognized hierarchical methods can also be delegated; the following
code delegates all subcommands of the &quot;tail&quot; method to the &quot;mytail&quot;
component:</p>
<pre class="example">snit::type dog {
    delegate method {tail *} to mytail
    # ...
}
</pre>
</div>
</div>
<div id="section17" class="section"><h2><a name="section17">WIDGETS</a></h2>
<div id="subsection125" class="subsection"><h3><a name="subsection125">What is a snit::widget?</a></h3>
<p>A <b class="cmd">snit::widget</b> is the Snit version of what Tcl programmers
usually call a <i class="term">megawidget</i>: a widget-like object usually
consisting of one or more Tk widgets all contained within a Tk frame.</p>
<p>A <b class="cmd">snit::widget</b> is also a special kind of <b class="cmd">snit::type</b>.  Just
about everything in this FAQ list that relates to <b class="cmd">snit::types</b>
also applies to <b class="cmd">snit::widgets</b>.</p>
</div>
<div id="subsection126" class="subsection"><h3><a name="subsection126">How do I define a snit::widget?</a></h3>
<p><b class="cmd">snit::widgets</b> are defined using the <b class="cmd">snit::widget</b> command,
just as <b class="cmd">snit::types</b> are defined by the <b class="cmd">snit::type</b> command.</p>
<p>The body of the definition can contain all of the same kinds of
statements, plus a couple of others which will be mentioned below.</p>
</div>
<div id="subsection127" class="subsection"><h3><a name="subsection127">How do snit::widgets differ from snit::types?</a></h3>
<ul class="itemized">
<li><p>The name of an instance of a <b class="cmd">snit::type</b> can be any valid Tcl
command name, in any namespace.
The name of an instance of a <b class="cmd">snit::widget</b> must be a valid Tk
widget name, and its parent widget must already exist.</p></li>
<li><p>An instance of a <b class="cmd">snit::type</b> can be destroyed by calling
its <b class="cmd">destroy</b> method.  Instances of a <b class="cmd">snit::widget</b> have no
destroy method; use the Tk <b class="cmd">destroy</b> command instead.</p></li>
<li><p>Every instance of a <b class="cmd">snit::widget</b> has one predefined component
called its <b class="variable">hull</b> component.
The hull is usually a Tk <b class="cmd"><a href="../../../../index.html#key626">frame</a></b> or <b class="cmd">toplevel</b> widget; any other
widgets created as part of the <b class="cmd">snit::widget</b> will usually be
contained within the hull.</p></li>
<li><p><b class="cmd">snit::widget</b>s can have their options receive default values from
<span class="sectref"><a href="#section19">THE TK OPTION DATABASE</a></span>.</p></li>
</ul>
</div>
<div id="subsection128" class="subsection"><h3><a name="subsection128">What is a hull component?</a></h3>
<p>Snit can't create a Tk widget object; only Tk can do that.
Thus, every instance of a <b class="cmd">snit::widget</b> must be wrapped around a
genuine Tk widget; this Tk widget is called the <i class="term">hull component</i>.
Snit effectively piggybacks the behavior you define (methods, options,
and so forth) on top of the hull component so that the whole thing
behaves like a standard Tk widget.</p>
<p>For <b class="cmd">snit::widget</b>s the hull component must be a Tk widget that
defines the <b class="const">-class</b> option.</p>
<p><b class="cmd">snit::widgetadaptor</b>s differ from <b class="cmd">snit::widget</b>s chiefly in
that any kind of widget can be used as the hull component; see
<span class="sectref"><a href="#section18">WIDGET ADAPTORS</a></span>.</p>
</div>
<div id="subsection129" class="subsection"><h3><a name="subsection129">How can I set the hull type for a snit::widget?</a></h3>
<p>A <b class="cmd">snit::widget</b>'s hull component will usually be a Tk <b class="cmd"><a href="../../../../index.html#key626">frame</a></b>
widget; however, it may be any Tk widget that defines the 
<b class="const">-class</b> option.  You can
explicitly choose the hull type you prefer by including the <b class="cmd">hulltype</b>
command in the widget definition:</p>
<pre class="example">snit::widget mytoplevel {
    hulltype toplevel
    # ...
}
</pre>
<p>If no <b class="cmd">hulltype</b> command appears, the hull will be a <b class="cmd"><a href="../../../../index.html#key626">frame</a></b>.</p>
<p>By default, Snit recognizes the following hull types: the Tk widgets
<b class="cmd"><a href="../../../../index.html#key626">frame</a></b>, <b class="cmd">labelframe</b>, <b class="cmd">toplevel</b>, and the Tile widgets
<b class="cmd">ttk::frame</b>, <b class="cmd">ttk::labelframe</b>, and <b class="cmd">ttk::toplevel</b>.  To
enable the use of some other kind of widget as the hull type, you can
<b class="cmd">lappend</b> the widget command to the variable <b class="variable">snit::hulltypes</b> (always
provided the widget defines the <b class="const">-class</b> option.  For example,
suppose Tk gets a new widget type called a <b class="cmd">prettyframe</b>:</p>
<pre class="example">lappend snit::hulltypes prettyframe
snit::widget mywidget {
    hulltype prettyframe
    # ...
}
</pre>
</div>
<div id="subsection130" class="subsection"><h3><a name="subsection130">How should I name widgets which are components of a snit::widget?</a></h3>
<p>Every widget, whether a genuine Tk widget or a Snit megawidget, has to
have a valid Tk window name.  When a <b class="cmd">snit::widget</b> is first
created, its instance name, <b class="variable">self</b>, is a Tk window name;
however, if the <b class="cmd">snit::widget</b> is used as the hull component by a
<b class="cmd">snit::widgetadaptor</b> its instance name will be changed to
something else.  For this reason, every <b class="cmd">snit::widget</b> method,
constructor, destructor, and so forth is passed another implicit
argument, <b class="variable">win</b>, which is the window name of the megawidget.  Any
children should be named using <b class="variable">win</b> as the root.</p>
<p>Thus, suppose you're writing a toolbar widget, a frame consisting of a
number of buttons placed side-by-side.  It might look something like
this:</p>
<pre class="example">snit::widget toolbar {
    delegate option * to hull
    constructor {args} {
        button $win.open -text Open -command [mymethod open]
        button $win.save -text Save -command [mymethod save]
        # ....
        $self configurelist $args
    }
}
</pre>
<p>See also the question on renaming objects, toward the top of this
file.</p>
</div>
</div>
<div id="section18" class="section"><h2><a name="section18">WIDGET ADAPTORS</a></h2>
<div id="subsection131" class="subsection"><h3><a name="subsection131">What is a snit::widgetadaptor?</a></h3>
<p>A <b class="cmd">snit::widgetadaptor</b> is a kind of <b class="cmd">snit::widget</b>.  Whereas
a <b class="cmd">snit::widget</b>'s hull is automatically created and is always a
Tk frame, a <b class="cmd">snit::widgetadaptor</b> can be based on any Tk
widget--or on any Snit megawidget, or even (with luck) on megawidgets
defined using some other package.</p>
<p>It's called a <i class="term">widget adaptor</i> because it allows you to take an
existing widget and customize its behavior.</p>
</div>
<div id="subsection132" class="subsection"><h3><a name="subsection132">How do I define a snit::widgetadaptor?</a></h3>
<p>Use the <b class="cmd">snit::widgetadaptor</b> command.  The definition for a
<b class="cmd">snit::widgetadaptor</b> looks just like that for a <b class="cmd">snit::type</b>
or <b class="cmd">snit::widget</b>, except that the constructor must create and
install the hull component.</p>
<p>For example, the following code creates a read-only text widget by the
simple device of turning its <b class="method">insert</b> and <b class="method">delete</b>
methods into no-ops.  Then, we define new methods, <b class="method">ins</b> and
<b class="method">del</b>,
which get delegated to the hull component as <b class="method">insert</b> and
<b class="method">delete</b>.  Thus, we've adapted the text widget and given it new
behavior while still leaving it fundamentally a text widget.</p>
<pre class="example">::snit::widgetadaptor rotext {
    constructor {args} {
        # Create the text widget; turn off its insert cursor
        installhull using text -insertwidth 0
        # Apply any options passed at creation time.
        $self configurelist $args
    }
    # Disable the text widget's insert and delete methods, to
    # make this readonly.
    method insert {args} {}
    method delete {args} {}
    # Enable ins and del as synonyms, so the program can insert and
    # delete.
    delegate method ins to hull as insert
    delegate method del to hull as delete
    
    # Pass all other methods and options to the real text widget, so
    # that the remaining behavior is as expected.
    delegate method * to hull
    delegate option * to hull
}
</pre>
<p>The most important part is in the constructor.
Whereas <b class="cmd">snit::widget</b> creates the hull for you,
<b class="cmd">snit::widgetadaptor</b> cannot -- it doesn't know what kind of
widget you want.  So the first thing the constructor does is create
the hull component (a Tk text widget in this case), and then installs
it using the <b class="cmd">installhull</b> command.</p>
<p><em>Note:</em> There is no instance command until you create one by
installing a hull component.  Any attempt to pass methods to <b class="variable">$self</b>
prior to calling <b class="cmd">installhull</b> will fail.</p>
</div>
<div id="subsection133" class="subsection"><h3><a name="subsection133">Can I adapt a widget created elsewhere in the program?</a></h3>
<p>Yes.</p>
<p>At times, it can be convenient to adapt a pre-existing widget instead
of creating your own.
For example, the Bwidget <b class="cmd">PagesManager</b> widget manages a
set of <b class="cmd"><a href="../../../../index.html#key626">frame</a></b> widgets, only one of which is visible at a time.
The application chooses which <b class="cmd"><a href="../../../../index.html#key626">frame</a></b> is visible.  All of the
These <b class="cmd"><a href="../../../../index.html#key626">frame</a></b>s are created by the <b class="cmd">PagesManager</b> itself, using
its <b class="method">add</b> method.  It's convenient to adapt these frames to
do what we'd like them to do.</p>
<p>In a case like this, the Tk widget will already exist when the
<b class="cmd">snit::widgetadaptor</b> is created.  Snit provides an alternate form
of the <b class="cmd">installhull</b> command for this purpose:</p>
<pre class="example">snit::widgetadaptor pageadaptor {
    constructor {args} {
        # The widget already exists; just install it.
        installhull $win
        # ...
    }
}
</pre>
</div>
<div id="subsection134" class="subsection"><h3><a name="subsection134">Can I adapt another megawidget?</a></h3>
<p>Maybe. If the other megawidget is a <b class="cmd">snit::widget</b> or
<b class="cmd">snit::widgetadaptor</b>, then yes.  If it isn't then, again, maybe.
You'll have to try it and see.  You're most likely to have trouble
with widget destruction--you have to make sure that your 
megawidget code receives the <b class="const">&lt;Destroy&gt;</b> event before the
megawidget you're adapting does.</p>
</div>
</div>
<div id="section19" class="section"><h2><a name="section19">THE TK OPTION DATABASE</a></h2>
<div id="subsection135" class="subsection"><h3><a name="subsection135">What is the Tk option database?</a></h3>
<p>The Tk option database is a database of default option values
maintained by Tk itself; every Tk application has one.  The concept of
the option database derives from something called the X Windows
resource database; however, the option database is available in every
Tk implementation, including those which do not use the X Windows
system (e.g., Microsoft Windows).</p>
<p>Full details about the Tk option database are beyond the scope of this
document; both <em>Practical Programming in Tcl and Tk</em> by Welch,
Jones, and Hobbs, and <em>Effective Tcl/Tk Programming</em> by
Harrison and McClennan., have good introductions to it.</p>
<p>Snit is implemented so that most of the time it will simply do the
right thing with respect to the option database, provided that the
widget developer does the right thing by Snit.  The body of this
section goes into great deal about what Snit requires.  The following
is a brief statement of the requirements, for reference.</p>
<ul class="itemized">
<li><p>If the widget's default widget class is not what is desired, set it
explicitly using the <b class="cmd">widgetclass</b> statement in the widget
definition.</p></li>
<li><p>When defining or delegating options, specify the resource and class
names explicitly when necessary.</p></li>
<li><p>Use the <b class="cmd">installhull using</b> command to create and install the
hull for <b class="cmd">snit::widgetadaptor</b>s.</p></li>
<li><p>Use the <b class="cmd">install</b> command to create and install all
components which are widgets.</p></li>
<li><p>Use the <b class="cmd">install</b> command to create and install 
components which aren't widgets if you'd like them to 
receive option values from the option database.</p></li>
</ul>
<p>The interaction of Tk widgets with the option database is a complex
thing; the interaction of Snit with the option database is even more
so, and repays attention to detail.</p>
</div>
<div id="subsection136" class="subsection"><h3><a name="subsection136">Do snit::types use the Tk option database?</a></h3>
<p>No, they don't; querying the option database requires a Tk window
name, and <b class="cmd">snit::type</b>s don't have one.</p>
<p>If you create an instance of a <b class="cmd">snit::type</b> as a
component of a <b class="cmd">snit::widget</b> or <b class="cmd">snit::widgetadaptor</b>, on the
other hand, and if any options are delegated to the component,
and if you use <b class="cmd">install</b> to create and install it, then
the megawidget will query the option database on the
<b class="cmd">snit::type</b>'s behalf.  This might or might not be what you
want, so take care.</p>
</div>
<div id="subsection137" class="subsection"><h3><a name="subsection137">What is my snit::widget's widget class?</a></h3>
<p>Every Tk widget has a &quot;widget class&quot;: a name that is used when adding
option settings to the database.  For Tk widgets, the widget class is
the same as the widget command name with an initial capital.  For
example, the widget class of the Tk <b class="cmd">button</b> widget is 
<b class="const">Button</b>.</p>
<p>Similarly, the widget class of a <b class="cmd">snit::widget</b> defaults to the
unqualified type name with the first letter capitalized.  For example,
the widget class of</p>
<pre class="example">snit::widget ::mylibrary::scrolledText { ... }
</pre>
<p>is <b class="const">ScrolledText</b>.</p>
<p>The widget class can also be set explicitly using the
<b class="cmd">widgetclass</b> statement within the <b class="cmd">snit::widget</b> definition:</p>
<pre class="example">snit::widget ::mylibrary::scrolledText {
    widgetclass Text
    # ...
}
</pre>
<p>The above definition says that a <b class="cmd">scrolledText</b> megawidget has the
same widget class as an ordinary <b class="cmd"><a href="../../../../index.html#key454">text</a></b> widget.  This might or
might not be a good idea, depending on how the rest of the megawidget
is defined, and how its options are delegated.</p>
</div>
<div id="subsection138" class="subsection"><h3><a name="subsection138">What is my snit::widgetadaptor's widget class?</a></h3>
<p>The widget class of a <b class="cmd">snit::widgetadaptor</b> is just the widget
class of its hull widget; Snit has no control over this.</p>
<p>Note that the widget class can be changed only for <b class="cmd"><a href="../../../../index.html#key626">frame</a></b> and
<b class="cmd">toplevel</b> widgets, which is why these are the valid hull types
for <b class="cmd">snit::widget</b>s.</p>
<p>Try to use <b class="cmd">snit::widgetadaptor</b>s only to make small modifications
to another widget's behavior.  Then, it will usually not make sense to
change the widget's widget class anyway.</p>
</div>
<div id="subsection139" class="subsection"><h3><a name="subsection139">What are option resource and class names?</a></h3>
<p>Every Tk widget option has three names: the option name, the resource
name, and the class name.
The option name begins with a hyphen and is all lowercase; it's used
when creating widgets, and with the <b class="cmd">configure</b> and <b class="cmd">cget</b>
commands.</p>
<p>The resource and class names are used to initialize option
default values by querying the option database.
The resource name is usually just the option
name minus the hyphen, but may contain uppercase letters at word
boundaries; the class name is usually just the resource
name with an initial capital, but not always.  For example, here are
the option, resource, and class names for several Tk <b class="cmd"><a href="../../../../index.html#key454">text</a></b>
widget options:</p>
<pre class="example">    -background         background         Background 
    -borderwidth        borderWidth        BorderWidth 
    -insertborderwidth  insertBorderWidth  BorderWidth 
    -padx               padX               Pad 
</pre>
<p>As is easily seen, sometimes the resource and class names can be
inferred from the option name, but not always.</p>
</div>
<div id="subsection140" class="subsection"><h3><a name="subsection140">What are the resource and class names for my megawidget's options?</a></h3>
<p>For options implicitly delegated to a component using
<b class="cmd">delegate option *</b>, the resource and class names will be
exactly those defined by the component.  The <b class="cmd">configure</b> method
returns these names, along with the option's default and current
values:</p>
<pre class="example">% snit::widget mytext {
    delegate option * to text
    constructor {args} {
        install text using text .text
        # ...
    }
    # ...
}
::mytext
% mytext .text
.text
% .text configure -padx
-padx padX Pad 1 1
%
</pre>
<p>For all other options (whether locally defined or explicitly
delegated), the resource and class names can be defined explicitly, or
they can be allowed to have default values.</p>
<p>By default, the resource name is just the option name minus the
hyphen; the the class name is just the option name with an initial
capital letter.  For example, suppose we explicitly delegate &quot;-padx&quot;:</p>
<pre class="example">% snit::widget mytext {
    option -myvalue 5
    delegate option -padx to text
    delegate option * to text
    constructor {args} {
        install text using text .text
        # ...
    }
    # ...
}
::mytext
% mytext .text
.text
% .text configure -myvalue
-myvalue myvalue Myvalue 5 5
% .text configure -padx
-padx padx Padx 1 1
%
</pre>
<p>Here the resource and class names are chosen using the default rules.
Often these rules are sufficient, but in the case of &quot;-padx&quot; we'd most
likely prefer that the option's resource and class names are the same
as for the built-in Tk widgets.  This is easily done:</p>
<pre class="example">% snit::widget mytext {
    delegate option {-padx padX Pad} to text
    # ...
}
::mytext
% mytext .text
.text
% .text configure -padx
-padx padX Pad 1 1
%
</pre>
</div>
<div id="subsection141" class="subsection"><h3><a name="subsection141">How does Snit initialize my megawidget's locally-defined options?</a></h3>
<p>The option database is queried for each of the megawidget's
locally-defined options, using the option's resource and class name.
If the result isn't &quot;&quot;, then it replaces the default value given in
widget definition.  In either case, the default can be overridden by
the caller.  For example,</p>
<pre class="example">option add *Mywidget.texture pebbled
snit::widget mywidget {
    option -texture smooth
    # ...
}
mywidget .mywidget -texture greasy
</pre>
<p>Here, <b class="const">-texture</b> would normally default to &quot;smooth&quot;, but because of
the entry added to the option database it defaults to &quot;pebbled&quot;.
However, the caller has explicitly overridden the default, and so the
new widget will be &quot;greasy&quot;.</p>
</div>
<div id="subsection142" class="subsection"><h3><a name="subsection142">How does Snit initialize delegated options?</a></h3>
<p>That depends on whether the options are delegated to the hull, or to
some other component.</p>
</div>
<div id="subsection143" class="subsection"><h3><a name="subsection143">How does Snit initialize options delegated to the hull?</a></h3>
<p>A <b class="cmd">snit::widget</b>'s hull is a widget, and given that its class has
been set it is expected to query the option database for itself.  The
only exception concerns options that are delegated to it with a
different name.  Consider the following code:</p>
<pre class="example">option add *Mywidget.borderWidth 5
option add *Mywidget.relief sunken
option add *Mywidget.hullbackground red
option add *Mywidget.background green
snit::widget mywidget {
    delegate option -borderwidth to hull
    delegate option -hullbackground to hull as -background
    delegate option * to hull
    # ...
}
mywidget .mywidget
set A [.mywidget cget -relief]
set B [.mywidget cget -hullbackground]
set C [.mywidget cget -background]
set D [.mywidget cget -borderwidth]
</pre>
<p>The question is, what are the values of variables A, B, C and D?</p>
<p>The value of A is &quot;sunken&quot;.  The hull is a Tk frame which has been
given the widget class <b class="const">Mywidget</b>; it will automatically query the
option database and pick up this value.  Since the <b class="const">-relief</b> option is
implicitly delegated to the hull, Snit takes no action.</p>
<p>The value of B is &quot;red&quot;.  The hull will automatically pick up the
value &quot;green&quot; for its <b class="const">-background</b> option, just as it picked up the
<b class="const">-relief</b> value.  However, Snit knows that <b class="const">-hullbackground</b>
is mapped to the hull's <b class="const">-background</b> option; hence, it queries 
the option database for <b class="const">-hullbackground</b> and gets &quot;red&quot; and 
updates the hull accordingly.</p>
<p>The value of C is also &quot;red&quot;, because <b class="const">-background</b> is implicitly
delegated to the hull; thus, retrieving it is the same as retrieving
<b class="const">-hullbackground</b>.  Note that this case is unusual; the 
<b class="const">-background</b> option should probably have been excluded using the delegate
statement's <b class="const">except</b> clause, or (more likely) delegated to some other
component.</p>
<p>The value of D is &quot;5&quot;, but not for the reason you think.  Note that as
it is defined above, the resource name for <b class="const">-borderwidth</b> defaults to
<b class="const">borderwidth</b>, whereas the option database entry is 
<b class="const">borderWidth</b>, in
accordance with the standard Tk naming for this option.  As with
<b class="const">-relief</b>, the hull picks up its own <b class="const">-borderwidth</b>
option before Snit
does anything.  Because the option is delegated under its own name,
Snit assumes that the correct thing has happened, and doesn't worry
about it any further.  To avoid confusion, the 
<b class="const">-borderwidth</b> option
should have been delegated like this:</p>
<pre class="example">    delegate option {-borderwidth borderWidth BorderWidth} to hull
</pre>
<p>For <b class="cmd">snit::widgetadaptor</b>s, the case is somewhat altered.  Widget
adaptors retain the widget class of their hull, and the hull is not
created automatically by Snit.  Instead, the <b class="cmd">snit::widgetadaptor</b>
must call <b class="cmd">installhull</b> in its constructor.  The normal way
to do this is as follows:</p>
<pre class="example">snit::widgetadaptor mywidget {
    # ...
    constructor {args} {
        # ...
        installhull using text -foreground white
        # ...
    }
    # ...
}
</pre>
<p>In this case, the <b class="cmd">installhull</b> command will create the hull using
a command like this:</p>
<pre class="example">    set hull [text $win -foreground white]
</pre>
<p>The hull is a <b class="cmd"><a href="../../../../index.html#key454">text</a></b> widget, so its widget class is <b class="const">Text</b>.  Just
as with <b class="cmd">snit::widget</b> hulls, Snit assumes that it will pick up
all of its normal option values automatically, without help from Snit.
Options delegated from a different name are initialized from the
option database in the same way as described above.</p>
<p>In earlier versions of Snit, <b class="cmd">snit::widgetadaptor</b>s were expected
to call <b class="cmd">installhull</b> like this:</p>
<pre class="example">    installhull [text $win -foreground white]
</pre>
<p>This form still works--but Snit will not query the option database as
described above.</p>
</div>
<div id="subsection144" class="subsection"><h3><a name="subsection144">How does Snit initialize options delegated to other components?</a></h3>
<p>For hull components, Snit assumes that Tk will do most of the work
automatically.  Non-hull components are somewhat more complicated, because
they are matched against the option database twice.</p>
<p>A component widget remains a widget still, and is therefore
initialized from the option database in the usual way.  A <b class="cmd"><a href="../../../../index.html#key454">text</a></b>
widget remains a <b class="cmd"><a href="../../../../index.html#key454">text</a></b> widget whether it is a component of a
megawidget or not, and will be created as such.</p>
<p>But then, the option database is queried for all options delegated to
the component, and the component is initialized accordingly--provided
that the <b class="cmd">install</b> command is used to create it.</p>
<p>Before option database support was added to Snit, the usual way to
create a component was to simply create it in the constructor and
assign its command name to the component variable:</p>
<pre class="example">snit::widget mywidget {
    delegate option -background to myComp
    constructor {args} {
        set myComp [text $win.text -foreground black]
    }
}
</pre>
<p>The drawback of this method is that Snit has no opportunity to
initialize the component properly.  Hence, the following approach is
now used:</p>
<pre class="example">snit::widget mywidget {
    delegate option -background to myComp
    constructor {args} {
        install myComp using text $win.text -foreground black
    }
}
</pre>
<p>The <b class="cmd">install</b> command does the following:</p>
<ul class="itemized">
<li><p>Builds a list of the options explicitly included in the <b class="cmd">install</b>
command--in this case, <b class="const">-foreground</b>.</p></li>
<li><p>Queries the option database for all options delegated explicitly to
the named component.</p></li>
<li><p>Creates the component using the specified command, after inserting
into it a list of options and values read from the option database.
Thus, the explicitly included options (like <b class="const">-foreground</b>) will 
override anything read from the option database.</p></li>
<li><p>If the widget definition implicitly delegated options to the component
using <b class="cmd">delegate option *</b>, then Snit calls the newly created
component's <b class="cmd">configure</b> method to receive a list of all of the
component's options.  From this Snit builds a list of options
implicitly delegated to the component which were not explicitly
included in the <b class="cmd">install</b> command.  For all such options, Snit
queries the option database and configures the component accordingly.</p></li>
</ul>
<p>You don't really need to know all of this; just use <b class="cmd">install</b> to
install your components, and Snit will try to do the right thing.</p>
</div>
<div id="subsection145" class="subsection"><h3><a name="subsection145">What happens if I install a non-widget as a component of widget?</a></h3>
<p>A <b class="cmd">snit::type</b> never queries the option database.
However, a <b class="cmd">snit::widget</b> can have non-widget components.  And if
options are delegated to those components, and if the <b class="cmd">install</b>
command is used to install those components, then they will be
initialized from the option database just as widget components are.</p>
<p>However, when used within a megawidget, <b class="cmd">install</b> assumes that the
created component uses a reasonably standard widget-like creation
syntax.  If it doesn't, don't use <b class="cmd">install</b>.</p>
</div>
</div>
<div id="section20" class="section"><h2><a name="section20">ENSEMBLE COMMANDS</a></h2>
<div id="subsection146" class="subsection"><h3><a name="subsection146">What is an ensemble command?</a></h3>
<p>An ensemble command is a command with subcommands.  Snit objects are
all ensemble commands; however, the term more usually refers to
commands like the standard Tcl commands <b class="cmd"><a href="../../../../index.html#key239">string</a></b>, <b class="cmd"><a href="../../../../index.html#key31">file</a></b>, 
and <b class="cmd">clock</b>.  In a sense, these are singleton objects--there's
only one instance of them.</p>
</div>
<div id="subsection147" class="subsection"><h3><a name="subsection147">How can I create an ensemble command using Snit?</a></h3>
<p>There are two ways--as a <b class="cmd">snit::type</b>, or as an instance of
a <b class="cmd">snit::type</b>.</p>
</div>
<div id="subsection148" class="subsection"><h3><a name="subsection148">How can I create an ensemble command using an instance of a snit::type?</a></h3>
<p>Define a type whose <span class="sectref"><a href="#section5">INSTANCE METHODS</a></span> are the subcommands
of your ensemble command.  Then, create an instance of the type with
the desired name.</p>
<p>For example, the following code uses <span class="sectref"><a href="#section16">DELEGATION</a></span> to create
a work-alike for the standard <b class="cmd"><a href="../../../../index.html#key239">string</a></b> command:</p>
<pre class="example">snit::type ::mynamespace::mystringtype {
    delegate method * to stringhandler
    constructor {} {
        set stringhandler string
    }
}
::mynamespace::mystringtype mystring
</pre>
<p>We create the type in a namespace, so that the type command is hidden;
then we create a single instance with the desired name--
<b class="cmd">mystring</b>, in this case.</p>
<p>This method has two drawbacks.  First, it leaves the type command
floating about.  More seriously, your shiny new ensemble
command will have <b class="method">info</b> and <b class="method">destroy</b> subcommands that
you probably have no use for.  But read on.</p>
</div>
<div id="subsection149" class="subsection"><h3><a name="subsection149">How can I create an ensemble command using a snit::type?</a></h3>
<p>Define a type whose <span class="sectref"><a href="#section9">TYPE METHODS</a></span> are the subcommands
of your ensemble command.</p>
<p>For example, the following code uses <span class="sectref"><a href="#section16">DELEGATION</a></span> to create
a work-alike for the standard <b class="cmd"><a href="../../../../index.html#key239">string</a></b> command:</p>
<pre class="example">snit::type mystring {
    delegate typemethod * to stringhandler
    typeconstructor {
        set stringhandler string
    }
}
</pre>
<p>Now the type command itself is your ensemble command.</p>
<p>This method has only one drawback, and though it's major, it's 
also surmountable.  Your new ensemble command will have
<b class="method">create</b>, <b class="method">info</b> and <b class="method">destroy</b> subcommands
you don't want.  And worse yet, since the <b class="method">create</b> method
can be implicit, users of your command will accidentally be creating
instances of your <b class="cmd">mystring</b> type if they should mispell one
of the subcommands.  The command will succeed--the first time--but
won't do what's wanted.  This is very bad.</p>
<p>The work around is to set some <span class="sectref"><a href="#section21">PRAGMAS</a></span>, as shown here:</p>
<pre class="example">snit::type mystring {
    pragma -hastypeinfo    no 
    pragma -hastypedestroy no 
    pragma -hasinstances   no
    delegate typemethod * to stringhandler
    typeconstructor {
        set stringhandler string
    }
}
</pre>
<p>Here we've used the <b class="cmd">pragma</b> statement to tell Snit that we don't
want the <b class="method">info</b> typemethod or the <b class="method">destroy</b> typemethod,
and that our type has no instances; this eliminates the 
<b class="method">create</b> typemethod and all related code.  As
a result, our ensemble command will be well-behaved, with no
unexpected subcommands.</p>
</div>
</div>
<div id="section21" class="section"><h2><a name="section21">PRAGMAS</a></h2>
<div id="subsection150" class="subsection"><h3><a name="subsection150">What is a pragma?</a></h3>
<p>A pragma is an option you can set in your type definitions that
affects how the type is defined and how it works once it is defined.</p>
</div>
<div id="subsection151" class="subsection"><h3><a name="subsection151">How do I set a pragma?</a></h3>
<p>Use the <b class="cmd">pragma</b> statement.  Each pragma is an option with a
value; each time you use the <b class="cmd">pragma</b> statement you can set one or
more of them.</p>
</div>
<div id="subsection152" class="subsection"><h3><a name="subsection152">How can I get rid of the &quot;info&quot; type method?</a></h3>
<p>Set the <b class="const">-hastypeinfo</b> pragma to <b class="const">no</b>:</p>
<pre class="example">snit::type dog {
    pragma -hastypeinfo no
    # ...
}
</pre>
<p>Snit will refrain from defining the <b class="method">info</b> type method.</p>
</div>
<div id="subsection153" class="subsection"><h3><a name="subsection153">How can I get rid of the &quot;destroy&quot; type method?</a></h3>
<p>Set the <b class="const">-hastypedestroy</b> pragma to <b class="const">no</b>:</p>
<pre class="example">snit::type dog {
    pragma -hastypedestroy no
    # ...
}
</pre>
<p>Snit will refrain from defining the <b class="method">destroy</b> type method.</p>
</div>
<div id="subsection154" class="subsection"><h3><a name="subsection154">How can I get rid of the &quot;create&quot; type method?</a></h3>
<p>Set the <b class="const">-hasinstances</b> pragma to <b class="const">no</b>:</p>
<pre class="example">snit::type dog {
    pragma -hasinstances no
    # ...
}
</pre>
<p>Snit will refrain from defining the <b class="method">create</b> type method;
if you call the type command with an unknown method name, you'll get
an error instead of a new instance of the type.</p>
<p>This is useful if you wish to use a <b class="cmd">snit::type</b> to define
an ensemble command rather than a type with instances.</p>
<p>Pragmas <b class="const">-hastypemethods</b> and <b class="const">-hasinstances</b> cannot
both be false (or there'd be nothing left).</p>
</div>
<div id="subsection155" class="subsection"><h3><a name="subsection155">How can I get rid of type methods altogether?</a></h3>
<p>Normal Tk widget type commands don't have subcommands; all they do is 
create widgets--in Snit terms, the type command calls the 
<b class="method">create</b> type method directly.  To get the same behavior from 
Snit, set the <b class="const">-hastypemethods</b> pragma to <b class="const">no</b>:</p>
<pre class="example">snit::type dog {
    pragma -hastypemethods no
    #...
}
# Creates ::spot
dog spot
# Tries to create an instance called ::create
dog create spot
</pre>
<p>Pragmas <b class="const">-hastypemethods</b> and <b class="const">-hasinstances</b> cannot
both be false (or there'd be nothing left).</p>
</div>
<div id="subsection156" class="subsection"><h3><a name="subsection156">Why can't I create an object that replaces an old object with the same name?</a></h3>
<p>Up until Snit 0.95, you could use any name for an instance of a 
<b class="cmd">snit::type</b>, even if the name was already in use by some other
object or command.  You could do the following, for example:</p>
<pre class="example">snit::type dog { ... }
dog proc
</pre>
<p>You now have a new dog named &quot;proc&quot;, which is probably not something
that you really wanted to do.  As a result, Snit now throws an error
if your chosen instance name names an existing command.  To restore
the old behavior, set the <b class="const">-canreplace</b> pragma to <b class="const">yes</b>:</p>
<pre class="example">snit::type dog {
    pragma -canreplace yes
    # ...
}
</pre>
</div>
<div id="subsection157" class="subsection"><h3><a name="subsection157">How can I make my simple type run faster?</a></h3>
<p>In Snit 1.x, you can set the <b class="const">-simpledispatch</b> pragma to <b class="const">yes</b>.</p>
<p>Snit 1.x method dispatch is both flexible and fast, but the flexibility
comes with a price.  If your type doesn't require the flexibility, the 
<b class="const">-simpledispatch</b> pragma allows you to substitute a simpler
dispatch mechanism that runs quite a bit faster.  The limitations
are these:</p>
<ul class="itemized">
<li><p>Methods cannot be delegated.</p></li>
<li><p><b class="cmd">uplevel</b> and <b class="cmd">upvar</b> do not work as expected: the
caller's scope is two levels up rather than one.</p></li>
<li><p>The option-handling methods 
(<b class="cmd">cget</b>, <b class="cmd">configure</b>, and <b class="cmd">configurelist</b>) are very
slightly slower.</p></li>
</ul>
<p>In Snit 2.2, the <b class="const">-simpledispatch</b> macro is obsolete, and
ignored; all Snit 2.2 method dispatch is faster than Snit 1.x's 
<b class="const">-simpledispatch</b>.</p>
</div>
</div>
<div id="section22" class="section"><h2><a name="section22">MACROS</a></h2>
<div id="subsection158" class="subsection"><h3><a name="subsection158">What is a macro?</a></h3>
<p>A Snit macro is nothing more than a Tcl proc that's defined in the 
Tcl interpreter used to compile Snit type definitions.</p>
</div>
<div id="subsection159" class="subsection"><h3><a name="subsection159">What are macros good for?</a></h3>
<p>You can use Snit macros to define new type definition syntax, and to
support conditional compilation.</p>
</div>
<div id="subsection160" class="subsection"><h3><a name="subsection160">How do I do conditional compilation?</a></h3>
<p>Suppose you want your type to use a fast C extension if it's
available; otherwise, you'll fallback to a slower Tcl implementation.
You want to define one set of methods in the first case, and another
set in the second case.  But how can your type definition know whether
the fast C extension is available or not?</p>
<p>It's easily done.  Outside of any type definition, define a macro that
returns 1 if the extension is available, and 0 otherwise:</p>
<pre class="example">if {$gotFastExtension} {
    snit::macro fastcode {} {return 1}
} else {
    snit::macro fastcode {} {return 0}
}
</pre>
<p>Then, use your macro in your type definition:</p>
<pre class="example">snit::type dog {
    if {[fastcode]} {
        # Fast methods
        method bark {} {...}
        method wagtail {} {...}
    } else {
        # Slow methods
        method bark {} {...}
        method wagtail {} {...}
    }
}
</pre>
</div>
<div id="subsection161" class="subsection"><h3><a name="subsection161">How do I define new type definition syntax?</a></h3>
<p>Use a macro.  For example, your <b class="cmd">snit::widget</b>'s 
<b class="const">-background</b> option should be propagated to a number
of component widgets.  You could implement that like this:</p>
<pre class="example">snit::widget mywidget {
    option -background -default white -configuremethod PropagateBackground
    method PropagateBackground {option value} {
        $comp1 configure $option $value
        $comp2 configure $option $value
        $comp3 configure $option $value
    }
}
</pre>
<p>For one option, this is fine; if you've got a number of options, it
becomes tedious and error prone.  So package it as a macro:</p>
<pre class="example">snit::macro propagate {option &quot;to&quot; components} {
    option $option -configuremethod Propagate$option
    set body &quot;\n&quot;
    foreach comp $components {
        append body &quot;\$$comp configure $option \$value\n&quot;
    }
    method Propagate$option {option value} $body
}
</pre>
<p>Then you can use it like this:</p>
<pre class="example">snit::widget mywidget {
    option -background default -white
    option -foreground default -black
    propagate -background to {comp1 comp2 comp3}
    propagate -foreground to {comp1 comp2 comp3}
}
</pre>
</div>
<div id="subsection162" class="subsection"><h3><a name="subsection162">Are there are restrictions on macro names?</a></h3>
<p>Yes, there are.  You can't redefine any standard Tcl commands or Snit
type definition statements.  You can use any other command name,
including the name of a previously defined macro.</p>
<p>If you're using Snit macros in your application, go ahead and name
them in the global namespace, as shown above.  But if you're using
them to define types or widgets for use by others, you should define
your macros in the same namespace as your types or widgets.  That way,
they won't conflict with other people's macros.</p>
<p>If my fancy <b class="cmd">snit::widget</b> is called <b class="cmd">::mylib::mywidget</b>, 
for example, then I should define my <b class="cmd">propagate</b> macro as
<b class="cmd">::mylib::propagate</b>:</p>
<pre class="example">snit::macro mylib::propagate {option &quot;to&quot; components} { ... }
snit::widget ::mylib::mywidget {
    option -background default -white
    option -foreground default -black
    mylib::propagate -background to {comp1 comp2 comp3}
    mylib::propagate -foreground to {comp1 comp2 comp3}
}
</pre>
</div>
</div>
<div id="section23" class="section"><h2><a name="section23">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>snit</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key218">BWidget</a>, <a href="../../../../index.html#key213">C++</a>, <a href="../../../../index.html#key220">Incr Tcl</a>, <a href="../../../../index.html#key217">adaptors</a>, <a href="../../../../index.html#key219">class</a>, <a href="../../../../index.html#key215">mega widget</a>, <a href="../../../../index.html#key221">object</a>, <a href="../../../../index.html#key214">object oriented</a>, <a href="../../../../index.html#key212">widget</a>, <a href="../../../../index.html#key216">widget adaptors</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003-2006, by William H. Duquette</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/soundex/soundex.html.













































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>soundex - Soundex</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/soundex/soundex.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; ????, Algorithm: Donald E. Knuth   -- Copyright &copy; 2003, Documentation: Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 1998, Tcl port: Evan Rempel &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ soundex.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">soundex(n) 1.0 tcllib &quot;Soundex&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>soundex - Soundex</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">soundex <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::soundex::knuth</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides soundex algorithms which allow the
comparison of words based on their phonetic likeness.</p>
<p>Currently only an algorithm by Knuth is provided, which
is tuned to english names and words.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::soundex::knuth</b> <i class="arg">string</i></a></dt>
<dd><p>Computes the soundex code of the input <i class="arg">string</i> using
Knuth's algorithm and returns it as the result of the
command.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<pre class="example">
    % ::soundex::knuth Knuth
    K530
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>soundex</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key241">knuth</a>, <a href="../../../../index.html#key242">soundex</a>, <a href="../../../../index.html#key240">text comparison</a>, <a href="../../../../index.html#key243">text likeness</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; ????, Algorithm: Donald E. Knuth<br>
Copyright &copy; 2003, Documentation: Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 1998, Tcl port: Evan Rempel &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/stooop/stooop.html.











































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>stooop - Simple Tcl Only Object Oriented Programming</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/stooop/stooop.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ stooop.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">stooop(n) 4.4.1 tcllib &quot;Simple Tcl Only Object Oriented Programming&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>stooop - Object oriented extension.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">DEBUGGING</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">stooop <span class="opt">?4.4.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::stooop::class</b> <i class="arg">name body</i></a></li>
<li><a href="#2"><b class="cmd">::stooop::new</b> <i class="arg">class</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::stooop::delete</b> <i class="arg">object</i> <span class="opt">?<i class="arg">object ...</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::stooop::virtual</b> <b class="const">proc</b> <i class="arg">name</i> {<b class="const">this</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span>} <span class="opt">?<i class="arg">body</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::stooop::classof</b> <i class="arg">object</i></a></li>
<li><a href="#6"><b class="cmd">::stooop::new</b> <i class="arg">object</i></a></li>
<li><a href="#7"><b class="cmd">::stooop::printObjects</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::stooop::record</b></a></li>
<li><a href="#9"><b class="cmd">::stooop::report</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to extend Tcl in an object oriented
manner, using a familiar C++ like syntax and behaviour. Stooop only
introduces a few new commands: <b class="cmd"><a href="../../../../index.html#key219">class</a></b>, <b class="cmd">new</b>, <b class="cmd">delete</b>,
<b class="cmd">virtual</b> and <b class="cmd">classof</b>. Along with a few coding conventions,
that is basically all you need to know to use stooop. Stooop is meant
to be as simple to use as possible.</p>
<p>This manual is very succinct and is to be used as a quick reminder for
the programmer, who should have read the thorough <a href="stooop_man.html">stooop_man.html</a>
HTML documentation at this point.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::stooop::class</b> <i class="arg">name body</i></a></dt>
<dd><p>This command creates a class. The body, similar in contents to a Tcl
namespace (which a class actually also is), contains member procedure
definitions. Member procedures can also be defined outside the class
body, by prefixing their name with <b class="const">class::</b>, as you would
proceed with namespace procedures.</p>
<dl class="definitions">
<dt><b class="cmd"><a href="../../../../index.html#key543">proc</a></b> <i class="arg">class</i> {<b class="const">this</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span>} <span class="opt">?<i class="arg">base</i> {<span class="opt">?<i class="arg">arg arg ...</i>?</span>} ...?</span> <i class="arg">body</i></dt>
<dd><p>This is the constructor procedure for the class. It is invoked
following a <b class="cmd">new</b> invocation on the class. It must have the same
name as the class and a first argument named <b class="const">this</b>. Any number
of base classes specifications, including arguments to be passed to
their constructor, are allowed before the actual body of the
procedure.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key543">proc</a></b> ~<i class="arg">class</i> {<b class="const">this</b>} <i class="arg">body</i></dt>
<dd><p>This is the destructor procedure for the class. It is invoked
following a <b class="cmd">delete</b> invocation. Its name must be the
concatenation of a single <b class="const">~</b> character followed by the class
name (as in C++). It must have a single argument named <b class="const">this</b>.</p></dd>
<dt><b class="cmd"><a href="../../../../index.html#key543">proc</a></b> <i class="arg">name</i> {<b class="const">this</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span>} <i class="arg">body</i></dt>
<dd><p>This is a member procedure of the class, as its first argument is
named <b class="const">this</b>. It allows a simple access of member data for the
object referenced by <b class="const">this</b> inside the procedure. For example:</p>
<pre class="example">
   set ($this,data) 0
</pre>
</dd>
<dt><b class="cmd"><a href="../../../../index.html#key543">proc</a></b> <i class="arg">name</i> {<span class="opt">?<i class="arg">arg arg ...</i>?</span>} <i class="arg">body</i></dt>
<dd><p>This is a static (as in C++) member procedure of the class, as its
first argument is not named <b class="const">this</b>. Static (global) class data
can be accessed as in:</p>
<pre class="example">
   set (data) 0
</pre>
</dd>
<dt><b class="cmd"><a href="../../../../index.html#key543">proc</a></b> <i class="arg">class</i> {<b class="const">this copy</b>} <i class="arg">body</i></dt>
<dd><p>This is the optional copy procedure for the class. It must have the
same name as the class and exactly 2 arguments named <b class="const">this</b> and
<b class="const">copy</b>. It is invoked following a <b class="cmd">new</b> invocation on an
existing object of the class.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::stooop::new</b> <i class="arg">class</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>This command is used to create an object. The first argument is the
class name and is followed by the arguments needed by the
corresponding class constructor. A unique identifier for the object
just created is returned.</p></dd>
<dt><a name="3"><b class="cmd">::stooop::delete</b> <i class="arg">object</i> <span class="opt">?<i class="arg">object ...</i>?</span></a></dt>
<dd><p>This command is used to delete one or several objects. It takes one or
more object identifiers as argument(s).</p></dd>
<dt><a name="4"><b class="cmd">::stooop::virtual</b> <b class="const">proc</b> <i class="arg">name</i> {<b class="const">this</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span>} <span class="opt">?<i class="arg">body</i>?</span></a></dt>
<dd><p>The <b class="cmd">virtual</b> specifier may be used on member procedures to
achieve dynamic binding. A procedure in a base class can then be
redefined (overloaded) in the derived class(es). If the base class
procedure is invoked on an object, it is actually the derived class
procedure which is invoked, if it exists. If the base class procedure
has no body, then it is considered to be a pure virtual and the
derived class procedure is always invoked.</p></dd>
<dt><a name="5"><b class="cmd">::stooop::classof</b> <i class="arg">object</i></a></dt>
<dd><p>This command returns the class of the existing object passed as single
parameter.</p></dd>
<dt><a name="6"><b class="cmd">::stooop::new</b> <i class="arg">object</i></a></dt>
<dd><p>This command is used to create an object by copying an existing
object. The copy constructor of the corresponding class is invoked if
it exists, otherwise a simple copy of the copied object data members
is performed.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">DEBUGGING</a></h2>
<dl class="definitions">
<dt>Environment variables</dt>
<dd><dl class="definitions">
<dt><b class="variable">STOOOPCHECKDATA</b></dt>
<dd><p>Setting this variable to any true value will cause stooop to check for
invalid member or class data access.</p></dd>
<dt><b class="variable">STOOOPCHECKPROCEDURES</b></dt>
<dd><p>Setting this variable to any true value will cause stooop to check for
invalid member procedure arguments and pure interface classes
instanciation.</p></dd>
<dt><b class="variable">STOOOPCHECKALL</b></dt>
<dd><p>Setting this variable to any true value will cause stooop to activate
both procedure and data member checking.</p></dd>
<dt><b class="variable">STOOOPCHECKOBJECTS</b></dt>
<dd><p>Setting this variable to any true value will cause stooop to activate
object checking. The following stooop namespace procedures then become
available for debugging: <b class="cmd">printObjects</b>, <b class="cmd"><a href="../../../../index.html#key259">record</a></b> and
<b class="cmd"><a href="../report/report.html">report</a></b>.</p></dd>
<dt><b class="variable">STOOOPTRACEPROCEDURES</b></dt>
<dd><p>Setting this environment variable to either <b class="const">stdout</b>,
<b class="const">stderr</b> or a file name, activates procedure tracing. The
stooop library will then output to the specified channel 1 line of
informational text for each member procedure invocation.</p></dd>
<dt><b class="variable">STOOOPTRACEPROCEDURESFORMAT</b></dt>
<dd><p>Defines the trace procedures output format. Defaults to
<b class="const">&quot;class: %C, procedure: %p, object: %O, arguments: %a&quot;</b>.</p></dd>
<dt><b class="variable">STOOOPTRACEDATA</b></dt>
<dd><p>Setting this environment variable to either <b class="const">stdout</b>,
<b class="const">stderr</b> or a file name, activates data tracing. The stooop
library will then output to the specified channel 1 line of
informational text for each member data access.</p></dd>
<dt><b class="variable">STOOOPTRACEDATAFORMAT</b></dt>
<dd><p>Defines the trace data output format. Defaults to 
<b class="const">&quot;class: %C, procedure: %p, array: %A, object: %O, member: %m, operation: %o, value: %v&quot;</b>.</p></dd>
<dt><b class="variable">STOOOPTRACEDATAOPERATIONS</b></dt>
<dd><p>When tracing data output, by default, all read, write and unsetting
accesses are reported, but the user can set this variable to any
combination of the letters <b class="const">r</b>, <b class="const">w</b>, and <b class="const">u</b> for
more specific tracing (please refer to the <b class="cmd">trace</b> Tcl manual page
for more information).</p></dd>
<dt><b class="variable">STOOOPTRACEALL</b></dt>
<dd><p>Setting this environment variable to either <b class="const">stdout</b>,
<b class="const">stderr</b> or a file name, enables both procedure and data
tracing.</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::stooop::printObjects</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Prints an ordered list of existing objects, in creation order, oldest
first. Each output line contains the class name, object identifier and
the procedure within which the creation occurred. The optional pattern
argument (as in the Tcl <b class="cmd">string match</b> command) can be used to
limit the output to matching class names.</p></dd>
<dt><a name="8"><b class="cmd">::stooop::record</b></a></dt>
<dd><p>When invoked, a snapshot of all existing stooop objects is
taken. Reporting can then be used at a later time to see which objects
were created or deleted in the interval.</p></dd>
<dt><a name="9"><b class="cmd">::stooop::report</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Prints the created and deleted objects since the <b class="cmd">::stooop::record</b>
procedure was invoked last. If present, the pattern argument limits
the output to matching class names.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p>Please see the full HTML documentation in <a href="stooop_man.html">stooop_man.html</a>.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>stooop</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key213">C++</a>, <a href="../../../../index.html#key219">class</a>, <a href="../../../../index.html#key221">object</a>, <a href="../../../../index.html#key214">object oriented</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/stringprep/stringprep.html.







































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>stringprep - Preparation of Internationalized Strings</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/stringprep/stringprep.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2009, Sergei Golovan &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ stringprep.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">stringprep(n) 1.0.1 tcllib &quot;Preparation of Internationalized Strings&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>stringprep - Implementation of stringprep</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">AUTHORS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">stringprep 1.0.1</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::stringprep::register</b> <i class="arg">profile</i> <span class="opt">?<i class="arg">-mapping list</i>?</span> <span class="opt">?<i class="arg">-normalization form</i>?</span> <span class="opt">?<i class="arg">-prohibited list</i>?</span> <span class="opt">?<i class="arg">-prohibitedList list</i>?</span> <span class="opt">?<i class="arg">-prohibitedCommand command</i>?</span> <span class="opt">?<i class="arg">-prohibitedBidi boolean</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::stringprep::stringprep</b> <i class="arg">profile</i> <i class="arg">string</i></a></li>
<li><a href="#3"><b class="cmd">::stringprep::compare</b> <i class="arg">profile</i> <i class="arg">string1</i> <i class="arg">string2</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This is an implementation in Tcl of the Preparation of Internationalized
Strings (&quot;stringprep&quot;). It allows to define stringprep profiles and use
them to prepare Unicode strings for comparison as defined in RFC-3454.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::stringprep::register</b> <i class="arg">profile</i> <span class="opt">?<i class="arg">-mapping list</i>?</span> <span class="opt">?<i class="arg">-normalization form</i>?</span> <span class="opt">?<i class="arg">-prohibited list</i>?</span> <span class="opt">?<i class="arg">-prohibitedList list</i>?</span> <span class="opt">?<i class="arg">-prohibitedCommand command</i>?</span> <span class="opt">?<i class="arg">-prohibitedBidi boolean</i>?</span></a></dt>
<dd><p>Register the <b class="package">stringprep</b> profile named <i class="arg">profile</i>. Options
are the following.</p>
<p>Option <i class="arg">-mapping</i> specifies <b class="package">stringprep</b> mapping tables.
This parameter takes list of tables from appendix B of RFC-3454. The usual
list values are {B.1 B.2} or {B.1 B.3} where B.1 contains characters which
commonly map to nothing, B.3 specifies case folding, and B.2 is used in
profiles with unicode normalization form KC. Defult value is {} which means
no mapping.</p>
<p>Option <i class="arg">-normalization</i> takes a string and if it is nonempty then it
uses as a name of Unicode normalization form. Any value of &quot;D&quot;, &quot;C&quot;, &quot;KD&quot;
or &quot;KC&quot; may be used, though RFC-3454 defines only two options: no
normalization or normalization using form KC.</p>
<p>Option <i class="arg">-prohibited</i> takes a list of RFC-3454 tables with prohibited
characters. Current version does allow to prohibit either all tables from
C.3 to C.9 or neither of them. An example of this list for RFC-3491 is
{A.1 C.1.2 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}.</p>
<p>Option <i class="arg">-prohibitedList</i> specifies a list of additional prohibited
characters. The list contains not characters themselves but their Unicode
numbers. For example, Nodeprep specification from RFC-3920 forbids the
following codes: {0x22 0x26 0x27 0x2f 0x3a 0x3c 0x3e 0x40} (\&quot; \&amp; \' / : &lt; &gt; @).</p>
<p>Option <i class="arg">-prohibitedCommand</i> specifies a command which is called for
every character code in mapped and normalized string. If the command returns
true then the character is considered prohibited. This option is useful when
a list for <i class="arg">-prohibitedList</i> is too large.</p>
<p>Option <i class="arg">-prohibitedBidi</i> takes boolean value and if it is true then the
bidirectional character processing rules defined in section 6 of RFC-3454 are
used.</p></dd>
<dt><a name="2"><b class="cmd">::stringprep::stringprep</b> <i class="arg">profile</i> <i class="arg">string</i></a></dt>
<dd><p>Performs <b class="package">stringprep</b> operations defined in profile <i class="arg">profile</i>
to string <i class="arg">string</i>. Result is a prepared string or one of the following
errors: <i class="arg">invalid_profile</i> (profile <i class="arg">profile</i> is not defined),
<i class="arg">prohibited_character</i> (string <i class="arg">string</i> contains a prohibited character)
or <i class="arg">prohibited_bidi</i> (string <i class="arg">string</i> contains a prohibited bidirectional
sequence).</p></dd>
<dt><a name="3"><b class="cmd">::stringprep::compare</b> <i class="arg">profile</i> <i class="arg">string1</i> <i class="arg">string2</i></a></dt>
<dd><p>Compares two unicode strings prepared accordingly to <b class="package">stringprep</b>
profile <i class="arg">profile</i>. The command returns 0 if prepared strings are equal,
-1 if <i class="arg">string1</i> is lexicographically less than <i class="arg">string2</i>, or
1 if <i class="arg">string1</i> is lexicographically greater than <i class="arg">string2</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p>Nameprep profile definition (see RFC-3491):</p>
<pre class="example">
::stringprep::register nameprep  -mapping {B.1 B.2}  -normalization KC  -prohibited {A.1 C.1.2 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}  -prohibitedBidi 1
</pre>
<p>Nodeprep and resourceprep profile definitions (see RFC-3920):</p>
<pre class="example">
::stringprep::register nodeprep  -mapping {B.1 B.2}  -normalization KC  -prohibited {A.1 C.1.1 C.1.2 C.2.1 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}  -prohibitedList {0x22 0x26 0x27 0x2f 0x3a 0x3c 0x3e 0x40}  -prohibitedBidi 1
::stringprep::register resourceprep  -mapping {B.1}  -normalization KC  -prohibited {A.1 C.1.2 C.2.1 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}  -prohibitedBidi 1
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>&quot;Preparation of Internationalized Strings ('stringprep')&quot;,
    (<a href="http://www.ietf.org/rfc/rfc3454.txt">http://www.ietf.org/rfc/rfc3454.txt</a>)</p></li>
<li><p>&quot;Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)&quot;,
    (<a href="http://www.ietf.org/rfc/rfc3491.txt">http://www.ietf.org/rfc/rfc3491.txt</a>)</p></li>
<li><p>&quot;Extensible Messaging and Presence Protocol (XMPP): Core&quot;,
    (<a href="http://www.ietf.org/rfc/rfc3920.txt">http://www.ietf.org/rfc/rfc3920.txt</a>)</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">AUTHORS</a></h2>
<p>Sergei Golovan</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>stringprep</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="unicode.html">unicode(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key596">stringprep</a>, <a href="../../../../index.html#key597">unicode</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2009, Sergei Golovan &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/stringprep/stringprep_data.html.
























































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>stringprep::data - Preparation of Internationalized Strings</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/stringprep/stringprep_data.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2009, Sergei Golovan &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ stringprep::data.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">stringprep::data(n) 1.0.1 tcllib &quot;Preparation of Internationalized Strings&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>stringprep::data - stringprep data tables, generated, internal</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">stringprep::data 1.0.1</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">stringprep::data</b> package is a helper for
<b class="package"><a href="stringprep.html">stringprep</a></b>, providing it with the data tables needed to
perform its functions. It is an <em>internal</em> package which should
not be accessed on its own. Because of that it has no publicly
documented API either. Its implementation is generated by a script.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>stringprep</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key596">stringprep</a>, <a href="../../../../index.html#key597">unicode</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2009, Sergei Golovan &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/stringprep/unicode.html.














































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>unicode - Unicode normalization</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/stringprep/unicode.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007, Sergei Golovan &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ unicode.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">unicode(n) 1.0.0 tcllib &quot;Unicode normalization&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>unicode - Implementation of Unicode normalization</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">AUTHORS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">unicode 1.0</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::unicode::fromstring</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::unicode::tostring</b> <i class="arg">uclist</i></a></li>
<li><a href="#3"><b class="cmd">::unicode::normalize</b> <i class="arg">form</i> <i class="arg">uclist</i></a></li>
<li><a href="#4"><b class="cmd">::unicode::normalizeS</b> <i class="arg">form</i> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This is an implementation in Tcl of the Unicode normalization forms.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::unicode::fromstring</b> <i class="arg">string</i></a></dt>
<dd><p>Converts <i class="arg">string</i> to list of integer Unicode character codes which
is used in <b class="package">unicode</b> for internal string representation.</p></dd>
<dt><a name="2"><b class="cmd">::unicode::tostring</b> <i class="arg">uclist</i></a></dt>
<dd><p>Converts list of integers <i class="arg">uclist</i> back to Tcl string.</p></dd>
<dt><a name="3"><b class="cmd">::unicode::normalize</b> <i class="arg">form</i> <i class="arg">uclist</i></a></dt>
<dd><p>Normalizes Unicode characters list <i class="arg">ulist</i> according to <i class="arg">form</i>
and returns the normalized list. Form <i class="arg">form</i> takes one of the following
values: <i class="arg">D</i> (canonical decomposition), <i class="arg">C</i> (canonical decomposition, followed
by canonical composition), <i class="arg">KD</i> (compatibility decomposition), or <i class="arg">KC</i>
(compatibility decomposition, followed by canonical composition).</p></dd>
<dt><a name="4"><b class="cmd">::unicode::normalizeS</b> <i class="arg">form</i> <i class="arg">string</i></a></dt>
<dd><p>A shortcut to
::unicode::tostring [unicode::normalize \$form [::unicode::fromstring \$string]].
Normalizes Tcl string and returns normalized string.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<pre class="example">
% ::unicode::fromstring &quot;\u0410\u0411\u0412\u0413&quot;
1040 1041 1042 1043
% ::unicode::tostring {49 50 51 52 53}
12345
%
</pre>
<pre class="example">
% ::unicode::normalize D {7692 775}
68 803 775
% ::unicode::normalizeS KD &quot;\u1d2c&quot;
A
%
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>&quot;Unicode Standard Annex #15: Unicode Normalization Forms&quot;,
    (<a href="http://unicode.org/reports/tr15/">http://unicode.org/reports/tr15/</a>)</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">AUTHORS</a></h2>
<p>Sergei Golovan</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>stringprep</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="stringprep.html">stringprep(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key100">normalization</a>, <a href="../../../../index.html#key597">unicode</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007, Sergei Golovan &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/stringprep/unicode_data.html.
























































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>unicode::data - Preparation of Internationalized Strings</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/stringprep/unicode_data.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007, Sergei Golovan &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ unicode::data.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">unicode::data(n) 1.0.0 tcllib &quot;Preparation of Internationalized Strings&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>unicode::data - unicode data tables, generated, internal</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">unicode::data 1.0.0</b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">unicode::data</b> package is a helper for
<b class="package"><a href="unicode.html">unicode</a></b>, providing it with the data tables needed to
perform its functions. It is an <em>internal</em> package which should
not be accessed on its own. Because of that it has no publicly
documented API either. Its implementation is generated by a script.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>stringprep</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key596">stringprep</a>, <a href="../../../../index.html#key597">unicode</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007, Sergei Golovan &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/disjointset.html.






















































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>struct::disjointset - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/disjointset.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ struct::disjointset.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::disjointset(n) 1.0 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::disjointset - Disjoint set data structure</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">struct::disjointset <span class="opt">?1.0?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::struct::disjointset</b> <i class="arg">disjointsetName</i></a></li>
<li><a href="#2"><i class="arg">disjointsetName</i> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">disjointsetName</i> <b class="method">add-partition</b> <i class="arg">elements</i></a></li>
<li><a href="#4"><i class="arg">disjointsetName</i> <b class="method">partitions</b></a></li>
<li><a href="#5"><i class="arg">disjointsetName</i> <b class="method">num-partitions</b></a></li>
<li><a href="#6"><i class="arg">disjointsetName</i> <b class="method">equal</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#7"><i class="arg">disjointsetName</i> <b class="method">merge</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#8"><i class="arg">disjointsetName</i> <b class="method">find</b> <i class="arg">e</i></a></li>
<li><a href="#9"><i class="arg">disjointsetName</i> <b class="method">destroy</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides <i class="term">disjoint sets</i>. An alternative name for
this kind of structure is <i class="term">merge-find</i>.</p>
<p>Normally when dealing with sets and their elements the question is &quot;Is
this element E contained in this set S?&quot;, with both E and S known.</p>
<p>Here the question is &quot;Which of several sets contains the element
E?&quot;. I.e. while the element is known, the set is not, and we wish to
find it quickly. It is not quite the inverse of the original question,
but close.
Another operation which is often wanted is that of quickly merging two
sets into one, with the result still fast for finding elements. Hence
the alternative term <i class="term">merge-find</i> for this.</p>
<p>Why now is this named a <i class="term">disjoint-set</i> ?
Because another way of describing the whole situation is that we have</p>
<ul class="itemized">
<li><p>a finite <i class="term"><a href="../../../../index.html#key253">set</a></i> S, containing</p></li>
<li><p>a number of <i class="term">elements</i> E, split into</p></li>
<li><p>a set of <i class="term">partitions</i> P. The latter term
       applies, because the intersection of each pair P, P' of
       partitions is empty, with the union of all partitions
       covering the whole set.</p></li>
<li><p>An alternative name for the <i class="term">partitions</i> would be
       <i class="term">equvalence classes</i>, and all elements in the same
       class are considered as equal.</p></li>
</ul>
<p>Here is a pictorial representation of the concepts listed above:</p>
<pre class="example">
	+-----------------+ The outer lines are the boundaries of the set S.
	|           /     | The inner regions delineated by the skewed lines
	|  *       /   *  | are the partitions P. The *'s denote the elements
	|      *  / \     | E in the set, each in a single partition, their
	|*       /   \    | equivalence class.
	|       /  *  \   |
	|      / *   /    |
	| *   /\  * /     |
	|    /  \  /      |
	|   /    \/  *    |
	|  / *    \       |
	| /     *  \      |
	+-----------------+
</pre>
<p>For more information see <a href="http://en.wikipedia.org/wiki/Disjoint_set_data_structure">http://en.wikipedia.org/wiki/Disjoint_set_data_structure</a>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports a single command, <b class="cmd">::struct::disjointset</b>. All
functionality provided here can be reached through a subcommand of
this command.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::struct::disjointset</b> <i class="arg">disjointsetName</i></a></dt>
<dd><p>Creates a new disjoint set object with an associated global Tcl
command whose name is <em>disjointsetName</em>. This command may be used
to invoke various operations on the disjointset. It has the following
general form:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">disjointsetName</i> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The <b class="cmd">option</b> and the <i class="arg">arg</i>s determine the exact behavior of
the command. The following commands are possible for disjointset
objects:</p></dd>
</dl></dd>
<dt><a name="3"><i class="arg">disjointsetName</i> <b class="method">add-partition</b> <i class="arg">elements</i></a></dt>
<dd><p>Creates a new partition in specified disjoint set, and fills it with
the values found in the set of <i class="arg">elements</i>. The command maintains
the integrity of the disjoint set, i.e. it verifies that none of the
<i class="arg">elements</i> are already part of the disjoint set and throws an
error otherwise.</p>
<p>The result of the command is the empty string.</p></dd>
<dt><a name="4"><i class="arg">disjointsetName</i> <b class="method">partitions</b></a></dt>
<dd><p>Returns the set of partitions the named disjoint set currently
consists of.</p></dd>
<dt><a name="5"><i class="arg">disjointsetName</i> <b class="method">num-partitions</b></a></dt>
<dd><p>Returns the number of partitions the named disjoint set currently
consists of.</p></dd>
<dt><a name="6"><i class="arg">disjointsetName</i> <b class="method">equal</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Determines if the two elements <i class="arg">a</i> and <i class="arg">b</i> of the disjoint set
belong to the same partition. The result of the method is a boolean
value, <b class="const">True</b> if the two elements are contained in the same
partition, and <b class="const">False</b> otherwise.</p>
<p>An error will be thrown if either <i class="arg">a</i> or <i class="arg">b</i> are not elements
of the disjoint set.</p></dd>
<dt><a name="7"><i class="arg">disjointsetName</i> <b class="method">merge</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>Determines the partitions the elements <i class="arg">a</i> and <i class="arg">b</i> are
contained in and merges them into a single partition.  If the two
elements were already contained in the same partition nothing will
change.</p>
<p>The result of the method is the empty string.</p></dd>
<dt><a name="8"><i class="arg">disjointsetName</i> <b class="method">find</b> <i class="arg">e</i></a></dt>
<dd><p>Returns the partition of the disjoint set which contains the element
<i class="arg">e</i>.</p></dd>
<dt><a name="9"><i class="arg">disjointsetName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the disjoint set object and all associated memory.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: disjointset</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key573">disjoint set</a>, <a href="../../../../index.html#key572">equivalence class</a>, <a href="../../../../index.html#key574">find</a>, <a href="../../../../index.html#key576">merge find</a>, <a href="../../../../index.html#key577">partition</a>, <a href="../../../../index.html#key578">partitioned set</a>, <a href="../../../../index.html#key575">union</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/graph.html.


















































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::graph - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/graph.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::graph.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::graph(n) 2.4 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::graph - Create and manipulate directed graph objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Changes for 2.0</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">struct::graph <span class="opt">?2.4?</span></b></li>
<li>package require <b class="pkgname">struct::list <span class="opt">?1.5?</span></b></li>
<li>package require <b class="pkgname">struct::set <span class="opt">?2.2.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::struct::graph</b> <span class="opt">?<i class="arg">graphName</i>?</span> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">source</i>?</span></a></li>
<li><a href="#2"><b class="cmd">graphName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">graphName</i> <b class="method">=</b> <i class="arg">sourcegraph</i></a></li>
<li><a href="#4"><i class="arg">graphName</i> <b class="method">--&gt;</b> <i class="arg">destgraph</i></a></li>
<li><a href="#5"><i class="arg">graphName</i> <b class="method">append</b> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#6"><i class="arg">graphName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></li>
<li><a href="#7"><i class="arg">graphName</i> <b class="method">destroy</b></a></li>
<li><a href="#8"><i class="arg">graphName</i> <b class="method">arc append</b> <i class="arg">arc</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#9"><i class="arg">graphName</i> <b class="method">arc attr</b> <i class="arg">key</i></a></li>
<li><a href="#10"><i class="arg">graphName</i> <b class="method">arc attr</b> <i class="arg">key</i> <b class="option">-arcs</b> <i class="arg">list</i></a></li>
<li><a href="#11"><i class="arg">graphName</i> <b class="method">arc attr</b> <i class="arg">key</i> <b class="option">-glob</b> <i class="arg">globpattern</i></a></li>
<li><a href="#12"><i class="arg">graphName</i> <b class="method">arc attr</b> <i class="arg">key</i> <b class="option">-regexp</b> <i class="arg">repattern</i></a></li>
<li><a href="#13"><i class="arg">graphName</i> <b class="method">arc delete</b> <i class="arg">arc</i> <span class="opt">?<i class="arg">arc</i> ...?</span></a></li>
<li><a href="#14"><i class="arg">graphName</i> <b class="method">arc exists</b> <i class="arg">arc</i></a></li>
<li><a href="#15"><i class="arg">graphName</i> <b class="method">arc flip</b> <i class="arg">arc</i></a></li>
<li><a href="#16"><i class="arg">graphName</i> <b class="method">arc get</b> <i class="arg">arc</i> <i class="arg">key</i></a></li>
<li><a href="#17"><i class="arg">graphName</i> <b class="method">arc getall</b> <i class="arg">arc</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#18"><i class="arg">graphName</i> <b class="method">arc getunweighted</b></a></li>
<li><a href="#19"><i class="arg">graphName</i> <b class="method">arc getweight</b> <i class="arg">arc</i></a></li>
<li><a href="#20"><i class="arg">graphName</i> <b class="method">arc keys</b> <i class="arg">arc</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#21"><i class="arg">graphName</i> <b class="method">arc keyexists</b> <i class="arg">arc</i> <i class="arg">key</i></a></li>
<li><a href="#22"><i class="arg">graphName</i> <b class="method">arc insert</b> <i class="arg">start</i> <i class="arg">end</i> <span class="opt">?<i class="arg">child</i>?</span></a></li>
<li><a href="#23"><i class="arg">graphName</i> <b class="method">arc lappend</b> <i class="arg">arc</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#24"><i class="arg">graphName</i> <b class="method">arc rename</b> <i class="arg">arc</i> <i class="arg">newname</i></a></li>
<li><a href="#25"><i class="arg">graphName</i> <b class="method">arc set</b> <i class="arg">arc</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#26"><i class="arg">graphName</i> <b class="method">arc setunweighted</b> <span class="opt">?<i class="arg">weight</i>?</span></a></li>
<li><a href="#27"><i class="arg">graphName</i> <b class="method">arc setweight</b> <i class="arg">arc</i> <i class="arg">weight</i></a></li>
<li><a href="#28"><i class="arg">graphName</i> <b class="method">arc unsetweight</b> <i class="arg">arc</i></a></li>
<li><a href="#29"><i class="arg">graphName</i> <b class="method">arc hasweight</b> <i class="arg">arc</i></a></li>
<li><a href="#30"><i class="arg">graphName</i> <b class="method">arc source</b> <i class="arg">arc</i></a></li>
<li><a href="#31"><i class="arg">graphName</i> <b class="method">arc target</b> <i class="arg">arc</i></a></li>
<li><a href="#32"><i class="arg">graphName</i> <b class="method">arc nodes</b> <i class="arg">arc</i></a></li>
<li><a href="#33"><i class="arg">graphName</i> <b class="method">arc move-source</b> <i class="arg">arc</i> <i class="arg">newsource</i></a></li>
<li><a href="#34"><i class="arg">graphName</i> <b class="method">arc move-target</b> <i class="arg">arc</i> <i class="arg">newtarget</i></a></li>
<li><a href="#35"><i class="arg">graphName</i> <b class="method">arc move</b> <i class="arg">arc</i> <i class="arg">newsource</i> <i class="arg">newtarget</i></a></li>
<li><a href="#36"><i class="arg">graphName</i> <b class="method">arc unset</b> <i class="arg">arc</i> <i class="arg">key</i></a></li>
<li><a href="#37"><i class="arg">graphName</i> <b class="method">arc weights</b></a></li>
<li><a href="#38"><i class="arg">graphName</i> <b class="method">arcs</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?-value <i class="arg">value</i>?</span> <span class="opt">?-filter <i class="arg">cmdprefix</i>?</span> <span class="opt">?-in|-out|-adj|-inner|-embedding <i class="arg">node node...</i>?</span></a></li>
<li><a href="#39"><i class="arg">graphName</i> <b class="method">lappend</b> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#40"><i class="arg">graphName</i> <b class="method">node append</b> <i class="arg">node</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#41"><i class="arg">graphName</i> <b class="method">node attr</b> <i class="arg">key</i></a></li>
<li><a href="#42"><i class="arg">graphName</i> <b class="method">node attr</b> <i class="arg">key</i> <b class="option">-nodes</b> <i class="arg">list</i></a></li>
<li><a href="#43"><i class="arg">graphName</i> <b class="method">node attr</b> <i class="arg">key</i> <b class="option">-glob</b> <i class="arg">globpattern</i></a></li>
<li><a href="#44"><i class="arg">graphName</i> <b class="method">node attr</b> <i class="arg">key</i> <b class="option">-regexp</b> <i class="arg">repattern</i></a></li>
<li><a href="#45"><i class="arg">graphName</i> <b class="method">node degree</b> <span class="opt">?-in|-out?</span> <i class="arg">node</i></a></li>
<li><a href="#46"><i class="arg">graphName</i> <b class="method">node delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i>...?</span></a></li>
<li><a href="#47"><i class="arg">graphName</i> <b class="method">node exists</b> <i class="arg">node</i></a></li>
<li><a href="#48"><i class="arg">graphName</i> <b class="method">node get</b> <i class="arg">node</i> <i class="arg">key</i></a></li>
<li><a href="#49"><i class="arg">graphName</i> <b class="method">node getall</b> <i class="arg">node</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#50"><i class="arg">graphName</i> <b class="method">node keys</b> <i class="arg">node</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#51"><i class="arg">graphName</i> <b class="method">node keyexists</b> <i class="arg">node</i> <i class="arg">key</i></a></li>
<li><a href="#52"><i class="arg">graphName</i> <b class="method">node insert</b> <span class="opt">?<i class="arg">node</i>...?</span></a></li>
<li><a href="#53"><i class="arg">graphName</i> <b class="method">node lappend</b> <i class="arg">node</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#54"><i class="arg">graphName</i> <b class="method">node opposite</b> <i class="arg">node</i> <i class="arg">arc</i></a></li>
<li><a href="#55"><i class="arg">graphName</i> <b class="method">node rename</b> <i class="arg">node</i> <i class="arg">newname</i></a></li>
<li><a href="#56"><i class="arg">graphName</i> <b class="method">node set</b> <i class="arg">node</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#57"><i class="arg">graphName</i> <b class="method">node unset</b> <i class="arg">node</i> <i class="arg">key</i></a></li>
<li><a href="#58"><i class="arg">graphName</i> <b class="method">nodes</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?-value <i class="arg">value</i>?</span> <span class="opt">?-filter <i class="arg">cmdprefix</i>?</span> <span class="opt">?-in|-out|-adj|-inner|-embedding <i class="arg">node</i> <i class="arg">node</i>...?</span></a></li>
<li><a href="#59"><i class="arg">graphName</i> <b class="method">get</b> <i class="arg">key</i></a></li>
<li><a href="#60"><i class="arg">graphName</i> <b class="method">getall</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#61"><i class="arg">graphName</i> <b class="method">keys</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#62"><i class="arg">graphName</i> <b class="method">keyexists</b> <i class="arg">key</i></a></li>
<li><a href="#63"><i class="arg">graphName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">node</i>...?</span></a></li>
<li><a href="#64"><i class="arg">graphName</i> <b class="method">set</b> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#65"><i class="arg">graphName</i> <b class="method">swap</b> <i class="arg">node1</i> <i class="arg">node2</i></a></li>
<li><a href="#66"><i class="arg">graphName</i> <b class="method">unset</b> <i class="arg">key</i></a></li>
<li><a href="#67"><i class="arg">graphName</i> <b class="method">walk</b> <i class="arg">node</i> <span class="opt">?-order <i class="arg">order</i>?</span> <span class="opt">?-type <i class="arg">type</i>?</span> <span class="opt">?-dir <i class="arg">direction</i>?</span> -command <i class="arg">cmd</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>A directed graph is a structure containing two collections of
elements, called <i class="term">nodes</i> and <i class="term">arcs</i> respectively, together
with a relation (&quot;connectivity&quot;) that places a general structure upon
the nodes and arcs.</p>
<p>Each arc is connected to two nodes, one of which is called the
<i class="term"><a href="../../../../index.html#key388">source</a></i> and the other the <i class="term">target</i>. This imposes a
direction upon the arc, which is said to go from the source to the
target. It is allowed that source and target of an arc are the same
node. Such an arc is called a <i class="term"><a href="../../../../index.html#key406">loop</a></i>.
Whenever a node is either the source or target of an arc both are said
to be <i class="term"><a href="../../../../index.html#key434">adjacent</a></i>. This extends into a relation between nodes,
i.e. if two nodes are connected through at least one arc they are said
to be <i class="term"><a href="../../../../index.html#key434">adjacent</a></i> too.</p>
<p>Each node can be the source and target for any number of arcs. The
former are called the <i class="term">outgoing arcs</i> of the node, the latter
the <i class="term">incoming arcs</i> of the node. The number of arcs in either
set is called the <i class="term">in-degree</i> resp. the <i class="term">out-degree</i> of the
node.</p>
<p>In addition to maintaining the node and arc relationships, this graph
implementation allows any number of named <i class="term">attributes</i> to be
associated with the graph itself, and each node or arc.</p>
<p><em>Note:</em> The major version of the package <b class="package"><a href="../../../../index.html#key285">struct</a></b> has
been changed to version 2.0, due to backward incompatible changes in
the API of this module. Please read the section
<span class="sectref"><a href="#section2">Changes for 2.0</a></span> for a full list of all changes,
incompatible and otherwise.</p>
<p><em>Note:</em> A C-implementation of the command can be had from the
location <a href="http://www.purl.org/NET/schlenker/tcl/cgraph">http://www.purl.org/NET/schlenker/tcl/cgraph</a>. See also
<a href="http://wiki.tcl.tk/cgraph">http://wiki.tcl.tk/cgraph</a>.  This implementation uses a bit less
memory than the tcl version provided here directly, and is faster. Its
support is limited to versions of the package before 2.0.</p>
<p>As of version 2.2 of this package a critcl based C implementation is
available from here as well. This implementation however requires Tcl
8.4 to run.</p>
<p>The main command of the package is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::struct::graph</b> <span class="opt">?<i class="arg">graphName</i>?</span> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">source</i>?</span></a></dt>
<dd><p>The command creates a new graph object with an associated global Tcl
command whose name is <i class="arg">graphName</i>.  This command may be used to
invoke various operations on the graph.  It has the following general
form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">graphName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>If <i class="arg">graphName</i> is not specified a unique name will be generated by
the package itself. If a <i class="arg">source</i> is specified the new graph will
be initialized to it. For the operators <b class="const">=</b>, <b class="const">:=</b>, and
<b class="const">as</b> the <i class="arg">source</i> argument is interpreted as the name of
another graph object, and the assignment operator <b class="method">=</b> will be
executed. For the operator <b class="const">deserialize</b> the <i class="arg">source</i> is a
serialized graph object and <b class="method">deserialize</b> will be executed.</p>
<p>In other words</p>
<pre class="example">
    ::struct::graph mygraph = b
</pre>
<p>is equivalent to</p>
<pre class="example">
    ::struct::graph mygraph
    mygraph = b
</pre>
<p>and</p>
<pre class="example">
    ::struct::graph mygraph deserialize $b
</pre>
<p>is equivalent to</p>
<pre class="example">
    ::struct::graph mygraph
    mygraph deserialize $b
</pre>
</dd>
</dl>
<p>The following commands are possible for graph objects:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">graphName</i> <b class="method">=</b> <i class="arg">sourcegraph</i></a></dt>
<dd><p>This is the <i class="term">assignment</i> operator for graph objects. It copies
the graph contained in the graph object <i class="arg">sourcegraph</i> over the
graph data in <i class="arg">graphName</i>. The old contents of <i class="arg">graphName</i> are
deleted by this operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">graphName</i> <b class="method">deserialize</b> [<i class="arg">sourcegraph</i> <b class="method">serialize</b>]
</pre>
<p>The operation assumes that the <i class="arg">sourcegraph</i> provides the method
<b class="method">serialize</b> and that this method returns a valid graph
serialization.</p></dd>
<dt><a name="4"><i class="arg">graphName</i> <b class="method">--&gt;</b> <i class="arg">destgraph</i></a></dt>
<dd><p>This is the <i class="term">reverse assignment</i> operator for graph objects. It
copies the graph contained in the graph object <i class="arg">graphName</i> over
the graph data in the object <i class="arg">destgraph</i>.
The old contents of <i class="arg">destgraph</i> are deleted by this operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">destgraph</i> <b class="method">deserialize</b> [<i class="arg">graphName</i> <b class="method">serialize</b>]
</pre>
<p>The operation assumes that the <i class="arg">destgraph</i> provides the method
<b class="method">deserialize</b> and that this method takes a graph serialization.</p></dd>
<dt><a name="5"><i class="arg">graphName</i> <b class="method">append</b> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> to one of the keyed values associated with the graph.
Returns the new value given to the attribute <i class="arg">key</i>.</p></dd>
<dt><a name="6"><i class="arg">graphName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></dt>
<dd><p>This is the complement to <b class="method">serialize</b>. It replaces the graph
data in <i class="arg">graphName</i> with the graph described by the
<i class="arg">serialization</i> value. The old contents of <i class="arg">graphName</i> are
deleted by this operation.</p></dd>
<dt><a name="7"><i class="arg">graphName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the graph, including its storage space and associated command.</p></dd>
<dt><a name="8"><i class="arg">graphName</i> <b class="method">arc append</b> <i class="arg">arc</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> to one of the keyed values associated with an
<i class="arg">arc</i>. Returns the new value given to the attribute <i class="arg">key</i>.</p></dd>
<dt><a name="9"><i class="arg">graphName</i> <b class="method">arc attr</b> <i class="arg">key</i></a></dt>
<dd></dd>
<dt><a name="10"><i class="arg">graphName</i> <b class="method">arc attr</b> <i class="arg">key</i> <b class="option">-arcs</b> <i class="arg">list</i></a></dt>
<dd></dd>
<dt><a name="11"><i class="arg">graphName</i> <b class="method">arc attr</b> <i class="arg">key</i> <b class="option">-glob</b> <i class="arg">globpattern</i></a></dt>
<dd></dd>
<dt><a name="12"><i class="arg">graphName</i> <b class="method">arc attr</b> <i class="arg">key</i> <b class="option">-regexp</b> <i class="arg">repattern</i></a></dt>
<dd><p>This method retrieves the value of the attribute named <i class="arg">key</i>, for
all arcs in the graph (matching the restriction specified via one of
the possible options) and having the specified attribute.</p>
<p>The result is a dictionary mapping from arc names to the value of
attribute <i class="arg">key</i> at that arc.
Arcs not having the attribute <i class="arg">key</i>, or not passing a
specified restriction, are not listed in the result.</p>
<p>The possible restrictions are:</p>
<dl class="options">
<dt><b class="option">-arcs</b></dt>
<dd><p>The value is a list of arcs. Only the arcs mentioned in this list
are searched for the attribute.</p></dd>
<dt><b class="option">-glob</b></dt>
<dd><p>The value is a glob pattern. Only the arcs in the graph whose names
match this pattern are searched for the attribute.</p></dd>
<dt><b class="option">-regexp</b></dt>
<dd><p>The value is a regular expression. Only the arcs in the graph whose
names match this pattern are searched for the attribute.</p></dd>
</dl></dd>
<dt><a name="13"><i class="arg">graphName</i> <b class="method">arc delete</b> <i class="arg">arc</i> <span class="opt">?<i class="arg">arc</i> ...?</span></a></dt>
<dd><p>Remove the specified arcs from the graph.</p></dd>
<dt><a name="14"><i class="arg">graphName</i> <b class="method">arc exists</b> <i class="arg">arc</i></a></dt>
<dd><p>Return true if the specified <i class="arg">arc</i> exists in the graph.</p></dd>
<dt><a name="15"><i class="arg">graphName</i> <b class="method">arc flip</b> <i class="arg">arc</i></a></dt>
<dd><p>Reverses the direction of the named <i class="arg">arc</i>, i.e. the source and
target nodes of the arc are exchanged with each other.</p></dd>
<dt><a name="16"><i class="arg">graphName</i> <b class="method">arc get</b> <i class="arg">arc</i> <i class="arg">key</i></a></dt>
<dd><p>Returns the value associated with the key <i class="arg">key</i> for the <i class="arg">arc</i>.</p></dd>
<dt><a name="17"><i class="arg">graphName</i> <b class="method">arc getall</b> <i class="arg">arc</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a dictionary (suitable for use with [<b class="cmd">array set</b>])
for the <i class="arg">arc</i>.
If the <i class="arg">pattern</i> is specified only the attributes whose names
match the pattern will be part of the returned dictionary. The pattern
is a <b class="cmd">glob</b> pattern.</p></dd>
<dt><a name="18"><i class="arg">graphName</i> <b class="method">arc getunweighted</b></a></dt>
<dd><p>Returns a list containing the names of all arcs in the graph which
have no weight associated with them.</p></dd>
<dt><a name="19"><i class="arg">graphName</i> <b class="method">arc getweight</b> <i class="arg">arc</i></a></dt>
<dd><p>Returns the weight associated with the <i class="arg">arc</i>. Throws an error if
the arc has no weight associated with it.</p></dd>
<dt><a name="20"><i class="arg">graphName</i> <b class="method">arc keys</b> <i class="arg">arc</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of keys for the <i class="arg">arc</i>.
If the <i class="arg">pattern</i> is specified only the attributes whose names
match the pattern will be part of the returned list. The pattern is a
<b class="cmd">glob</b> pattern.</p></dd>
<dt><a name="21"><i class="arg">graphName</i> <b class="method">arc keyexists</b> <i class="arg">arc</i> <i class="arg">key</i></a></dt>
<dd><p>Return true if the specified <i class="arg">key</i> exists for the <i class="arg">arc</i>.</p></dd>
<dt><a name="22"><i class="arg">graphName</i> <b class="method">arc insert</b> <i class="arg">start</i> <i class="arg">end</i> <span class="opt">?<i class="arg">child</i>?</span></a></dt>
<dd><p>Insert an arc named <i class="arg">child</i> into the graph beginning at the node
<i class="arg">start</i> and ending at the node <i class="arg">end</i>. If the name of the new
arc is not specified the system will generate a unique name of the
form <em>arc</em><i class="arg">x</i>.</p></dd>
<dt><a name="23"><i class="arg">graphName</i> <b class="method">arc lappend</b> <i class="arg">arc</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> (as a list) to one of the keyed values
associated with an <i class="arg">arc</i>. Returns the new value given to the
attribute <i class="arg">key</i>.</p></dd>
<dt><a name="24"><i class="arg">graphName</i> <b class="method">arc rename</b> <i class="arg">arc</i> <i class="arg">newname</i></a></dt>
<dd><p>Renames the arc <i class="arg">arc</i> to <i class="arg">newname</i>. An error is thrown if
either the arc does not exist, or a arc with name <i class="arg">newname</i> does
exist. The result of the command is the new name of the arc.</p></dd>
<dt><a name="25"><i class="arg">graphName</i> <b class="method">arc set</b> <i class="arg">arc</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Set or get one of the keyed values associated with an arc. 
An arc may have any number of keyed values associated with it.  
If <i class="arg">value</i> is not specified, this command returns the current value assigned to the key; 
if <i class="arg">value</i> is specified, this command assigns that value to the key, and returns
that value.</p></dd>
<dt><a name="26"><i class="arg">graphName</i> <b class="method">arc setunweighted</b> <span class="opt">?<i class="arg">weight</i>?</span></a></dt>
<dd><p>Sets the weight of all arcs without a weight to <i class="arg">weight</i>. Returns
the empty string as its result. If not present <i class="arg">weight</i> defaults
to <b class="const">0</b>.</p></dd>
<dt><a name="27"><i class="arg">graphName</i> <b class="method">arc setweight</b> <i class="arg">arc</i> <i class="arg">weight</i></a></dt>
<dd><p>Sets the weight of the <i class="arg">arc</i> to <i class="arg">weight</i>. Returns <i class="arg">weight</i>.</p></dd>
<dt><a name="28"><i class="arg">graphName</i> <b class="method">arc unsetweight</b> <i class="arg">arc</i></a></dt>
<dd><p>Removes the weight of the <i class="arg">arc</i>, if present. Does nothing
otherwise. Returns the empty string.</p></dd>
<dt><a name="29"><i class="arg">graphName</i> <b class="method">arc hasweight</b> <i class="arg">arc</i></a></dt>
<dd><p>Determines if the <i class="arg">arc</i> has a weight associated with it.  The
result is a boolean value, <b class="const">True</b> if a weight is defined, and
<b class="const">False</b> otherwise.</p></dd>
<dt><a name="30"><i class="arg">graphName</i> <b class="method">arc source</b> <i class="arg">arc</i></a></dt>
<dd><p>Return the node the given <i class="arg">arc</i> begins at.</p></dd>
<dt><a name="31"><i class="arg">graphName</i> <b class="method">arc target</b> <i class="arg">arc</i></a></dt>
<dd><p>Return the node the given <i class="arg">arc</i> ends at.</p></dd>
<dt><a name="32"><i class="arg">graphName</i> <b class="method">arc nodes</b> <i class="arg">arc</i></a></dt>
<dd><p>Return the nodes the given <i class="arg">arc</i> begins and ends at,
as a two-element list.</p></dd>
<dt><a name="33"><i class="arg">graphName</i> <b class="method">arc move-source</b> <i class="arg">arc</i> <i class="arg">newsource</i></a></dt>
<dd><p>Changes the source node of the arc to <i class="arg">newsource</i>. It can be said
that the arc rotates around its target node.</p></dd>
<dt><a name="34"><i class="arg">graphName</i> <b class="method">arc move-target</b> <i class="arg">arc</i> <i class="arg">newtarget</i></a></dt>
<dd><p>Changes the target node of the arc to <i class="arg">newtarget</i>. It can be said
that the arc rotates around its source node.</p></dd>
<dt><a name="35"><i class="arg">graphName</i> <b class="method">arc move</b> <i class="arg">arc</i> <i class="arg">newsource</i> <i class="arg">newtarget</i></a></dt>
<dd><p>Changes both source and target nodes of the arc to <i class="arg">newsource</i>,
and <i class="arg">newtarget</i> resp.</p></dd>
<dt><a name="36"><i class="arg">graphName</i> <b class="method">arc unset</b> <i class="arg">arc</i> <i class="arg">key</i></a></dt>
<dd><p>Remove a keyed value from the arc <i class="arg">arc</i>. The method will do
nothing if the <i class="arg">key</i> does not exist.</p></dd>
<dt><a name="37"><i class="arg">graphName</i> <b class="method">arc weights</b></a></dt>
<dd><p>Returns a dictionary whose keys are the names of all arcs which have a
weight associated with them, and the values are these weights.</p></dd>
<dt><a name="38"><i class="arg">graphName</i> <b class="method">arcs</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?-value <i class="arg">value</i>?</span> <span class="opt">?-filter <i class="arg">cmdprefix</i>?</span> <span class="opt">?-in|-out|-adj|-inner|-embedding <i class="arg">node node...</i>?</span></a></dt>
<dd><p>Returns a list of arcs in the graph. If no restriction is specified a
list containing all arcs is returned. Restrictions can limit the list
of returned arcs based on the nodes that are connected by the arc, on
the keyed values associated with the arc, or both. A general filter
command can be used as well. The restrictions that involve connected
nodes take a variable number of nodes as argument, specified after the
name of the restriction itself.</p>
<p>The restrictions imposed by either <b class="option">-in</b>, <b class="option">-out</b>,
<b class="option">-adj</b>, <b class="option">-inner</b>, or <b class="option">-embedded</b> are applied
first. Specifying more than one of them is illegal.</p>
<p>After that the restrictions set via <b class="option">-key</b> (and
<b class="option">-value</b>) are applied. Specifying more than one <b class="option">-key</b>
(and <b class="option">-value</b>) is illegal. Specifying <b class="option">-value</b> alone,
without <b class="option">-key</b> is illegal as well.</p>
<p>Any restriction set through <b class="option">-filter</b> is applied
last. Specifying more than one <b class="option">-filter</b> is illegal.</p>
<p>Coming back to the restrictions based on a set of nodes, the command
recognizes the following switches:</p>
<dl class="definitions">
<dt><b class="option">-in</b></dt>
<dd><p>Return a list of all arcs whose target is one of the nodes in the set
of nodes. I.e. it computes the union of all incoming arcs of the nodes
in the set.</p></dd>
<dt><b class="option">-out</b></dt>
<dd><p>Return a list of all arcs whose source is one of the nodes in the set
of nodes. I.e. it computes the union of all outgoing arcs of the nodes
in the set.</p></dd>
<dt><b class="option">-adj</b></dt>
<dd><p>Return a list of all arcs adjacent to at least one of the nodes in the
set. This is the union of the nodes returned by <b class="option">-in</b> and
<b class="option">-out</b>.</p></dd>
<dt><b class="option">-inner</b></dt>
<dd><p>Return a list of all arcs which are adjacent to two of the nodes in
the set. This is the set of arcs in the subgraph spawned by the
specified nodes.</p></dd>
<dt><b class="option">-embedding</b></dt>
<dd><p>Return a list of all arcs adjacent to exactly one of the nodes in the
set. This is the set of arcs connecting the subgraph spawned by the
specified nodes to the rest of the graph.</p></dd>
<dt><b class="option">-key</b> <i class="arg">key</i></dt>
<dd><p>Limit the list of arcs that are returned to those arcs that have an
associated key <i class="arg">key</i>.</p></dd>
<dt><b class="option">-value</b> <i class="arg">value</i></dt>
<dd><p>This restriction can only be used in combination with
<b class="option">-key</b>. It limits the list of arcs that are returned to those
arcs whose associated key <i class="arg">key</i> has the value <i class="arg">value</i>.</p></dd>
<dt><b class="option">-filter</b> <i class="arg">cmdrefix</i></dt>
<dd><p>Limit the list of arcs that are returned to those arcs that pass the
test. The command in <i class="arg">cmdprefix</i> is called with two arguments, the
name of the graph object, and the name of the arc in question. It is
executed in the context of the caller and has to return a boolean
value. Arcs for which the command returns <b class="const">false</b> are removed
from the result list before it is returned to the caller.</p></dd>
</dl></dd>
<dt><a name="39"><i class="arg">graphName</i> <b class="method">lappend</b> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> (as a list) to one of the keyed values
associated with the graph. Returns the new value given to the
attribute <i class="arg">key</i>.</p></dd>
<dt><a name="40"><i class="arg">graphName</i> <b class="method">node append</b> <i class="arg">node</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> to one of the keyed values associated with an
<i class="arg">node</i>. Returns the new value given to the attribute <i class="arg">key</i>.</p></dd>
<dt><a name="41"><i class="arg">graphName</i> <b class="method">node attr</b> <i class="arg">key</i></a></dt>
<dd></dd>
<dt><a name="42"><i class="arg">graphName</i> <b class="method">node attr</b> <i class="arg">key</i> <b class="option">-nodes</b> <i class="arg">list</i></a></dt>
<dd></dd>
<dt><a name="43"><i class="arg">graphName</i> <b class="method">node attr</b> <i class="arg">key</i> <b class="option">-glob</b> <i class="arg">globpattern</i></a></dt>
<dd></dd>
<dt><a name="44"><i class="arg">graphName</i> <b class="method">node attr</b> <i class="arg">key</i> <b class="option">-regexp</b> <i class="arg">repattern</i></a></dt>
<dd><p>This method retrieves the value of the attribute named <i class="arg">key</i>, for
all nodes in the graph (matching the restriction specified via one of
the possible options) and having the specified attribute.</p>
<p>The result is a dictionary mapping from node names to the value of
attribute <i class="arg">key</i> at that node.
Nodes not having the attribute <i class="arg">key</i>, or not passing a
specified restriction, are not listed in the result.</p>
<p>The possible restrictions are:</p>
<dl class="options">
<dt><b class="option">-nodes</b></dt>
<dd><p>The value is a list of nodes. Only the nodes mentioned in this list
are searched for the attribute.</p></dd>
<dt><b class="option">-glob</b></dt>
<dd><p>The value is a glob pattern. Only the nodes in the graph whose names
match this pattern are searched for the attribute.</p></dd>
<dt><b class="option">-regexp</b></dt>
<dd><p>The value is a regular expression. Only the nodes in the graph whose
names match this pattern are searched for the attribute.</p></dd>
</dl></dd>
<dt><a name="45"><i class="arg">graphName</i> <b class="method">node degree</b> <span class="opt">?-in|-out?</span> <i class="arg">node</i></a></dt>
<dd><p>Return the number of arcs adjacent to the specified <i class="arg">node</i>. If one
of the restrictions <b class="option">-in</b> or <b class="option">-out</b> is given only the
incoming resp. outgoing arcs are counted.</p></dd>
<dt><a name="46"><i class="arg">graphName</i> <b class="method">node delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i>...?</span></a></dt>
<dd><p>Remove the specified nodes from the graph.  All of the nodes' arcs
will be removed as well to prevent unconnected arcs.</p></dd>
<dt><a name="47"><i class="arg">graphName</i> <b class="method">node exists</b> <i class="arg">node</i></a></dt>
<dd><p>Return true if the specified <i class="arg">node</i> exists in the graph.</p></dd>
<dt><a name="48"><i class="arg">graphName</i> <b class="method">node get</b> <i class="arg">node</i> <i class="arg">key</i></a></dt>
<dd><p>Return the value associated with the key <i class="arg">key</i> for the <i class="arg">node</i>.</p></dd>
<dt><a name="49"><i class="arg">graphName</i> <b class="method">node getall</b> <i class="arg">node</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a dictionary (suitable for use with [<b class="cmd">array set</b>])
for the <i class="arg">node</i>.
If the <i class="arg">pattern</i> is specified only the attributes whose names
match the pattern will be part of the returned dictionary. The pattern
is a <b class="cmd">glob</b> pattern.</p></dd>
<dt><a name="50"><i class="arg">graphName</i> <b class="method">node keys</b> <i class="arg">node</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of keys for the <i class="arg">node</i>.
If the <i class="arg">pattern</i> is specified only the attributes whose names
match the pattern will be part of the returned list. The pattern is a
<b class="cmd">glob</b> pattern.</p></dd>
<dt><a name="51"><i class="arg">graphName</i> <b class="method">node keyexists</b> <i class="arg">node</i> <i class="arg">key</i></a></dt>
<dd><p>Return true if the specified <i class="arg">key</i> exists for the <i class="arg">node</i>.</p></dd>
<dt><a name="52"><i class="arg">graphName</i> <b class="method">node insert</b> <span class="opt">?<i class="arg">node</i>...?</span></a></dt>
<dd><p>Insert one or more nodes into the graph. The new nodes have no arcs
connected to them. If no node is specified one node will be inserted,
and the system will generate a unique name of the form
<em>node</em><i class="arg">x</i> for it.</p></dd>
<dt><a name="53"><i class="arg">graphName</i> <b class="method">node lappend</b> <i class="arg">node</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> (as a list) to one of the keyed values
associated with an <i class="arg">node</i>. Returns the new value given to the
attribute <i class="arg">key</i>.</p></dd>
<dt><a name="54"><i class="arg">graphName</i> <b class="method">node opposite</b> <i class="arg">node</i> <i class="arg">arc</i></a></dt>
<dd><p>Return the node at the other end of the specified <i class="arg">arc</i>, which has
to be adjacent to the given <i class="arg">node</i>.</p></dd>
<dt><a name="55"><i class="arg">graphName</i> <b class="method">node rename</b> <i class="arg">node</i> <i class="arg">newname</i></a></dt>
<dd><p>Renames the node <i class="arg">node</i> to <i class="arg">newname</i>. An error is thrown if
either the node does not exist, or a node with name <i class="arg">newname</i> does
exist. The result of the command is the new name of the node.</p></dd>
<dt><a name="56"><i class="arg">graphName</i> <b class="method">node set</b> <i class="arg">node</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Set or get one of the keyed values associated with a node. A node may have any
number of keyed values associated with it.  If <i class="arg">value</i> is not
specified, this command returns the current value assigned to the key;
if <i class="arg">value</i> is specified, this command assigns that value to the
key.</p></dd>
<dt><a name="57"><i class="arg">graphName</i> <b class="method">node unset</b> <i class="arg">node</i> <i class="arg">key</i></a></dt>
<dd><p>Remove a keyed value from the node <i class="arg">node</i>. The method will do
nothing if the <i class="arg">key</i> does not exist.</p></dd>
<dt><a name="58"><i class="arg">graphName</i> <b class="method">nodes</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?-value <i class="arg">value</i>?</span> <span class="opt">?-filter <i class="arg">cmdprefix</i>?</span> <span class="opt">?-in|-out|-adj|-inner|-embedding <i class="arg">node</i> <i class="arg">node</i>...?</span></a></dt>
<dd><p>Return a list of nodes in the graph. Restrictions can limit the list
of returned nodes based on neighboring nodes, or based on the keyed
values associated with the node. The restrictions that involve
neighboring nodes have a list of nodes as argument, specified after
the name of the restriction itself.</p>
<p>The possible restrictions are the same as for method
<b class="method">arcs</b>. The exact meanings change slightly, as they operate on
nodes instead of arcs. The command recognizes:</p>
<dl class="definitions">
<dt><b class="option">-in</b></dt>
<dd><p>Return a list of all nodes with at least one outgoing arc ending in a
node found in the specified set of nodes. Alternatively specified as
the set of source nodes for the <b class="option">-in</b> arcs of the node set. The
<i class="term">incoming neighbours</i>.</p></dd>
<dt><b class="option">-out</b></dt>
<dd><p>Return a list of all nodes with at least one incoming arc starting in
a node found in the specified set of nodes. Alternatively specified as
the set of target nodes for the <b class="option">-out</b> arcs of the node
set. The <i class="term">outgoing neighbours</i>.</p></dd>
<dt><b class="option">-adj</b></dt>
<dd><p>This is the union of the nodes returned by <b class="option">-in</b> and
<b class="option">-out</b>. The <i class="term">neighbours</i>.</p></dd>
<dt><b class="option">-inner</b></dt>
<dd><p>The set of neighbours (see <b class="option">-adj</b> above) which are also in the
set of nodes. I.e. the intersection between the set of nodes and the
neighbours per <b class="option">-adj</b>.</p></dd>
<dt><b class="option">-embedding</b></dt>
<dd><p>The set of neighbours (see <b class="option">-adj</b> above) which are not in the
set of nodes. I.e. the difference between the neighbours as per
<b class="option">-adj</b>, and the set of nodes.</p></dd>
<dt><b class="option">-key</b> <i class="arg">key</i></dt>
<dd><p>Limit the list of nodes that are returned to those nodes that have an
associated key <i class="arg">key</i>.</p></dd>
<dt><b class="option">-value</b> <i class="arg">value</i></dt>
<dd><p>This restriction can only be used in combination with
<b class="option">-key</b>. It limits the list of nodes that are returned to those
nodes whose associated key <i class="arg">key</i> has the value <i class="arg">value</i>.</p></dd>
<dt><b class="option">-filter</b> <i class="arg">cmdrefix</i></dt>
<dd><p>Limit the list of nodes that are returned to those nodes that pass the
test. The command in <i class="arg">cmdprefix</i> is called with two arguments, the
name of the graph object, and the name of the node in question. It is
executed in the context of the caller and has to return a boolean
value. Nodes for which the command returns <b class="const">false</b> are removed
from the result list before it is returned to the caller.</p></dd>
</dl></dd>
<dt><a name="59"><i class="arg">graphName</i> <b class="method">get</b> <i class="arg">key</i></a></dt>
<dd><p>Return the value associated with the key <i class="arg">key</i> for the graph.</p></dd>
<dt><a name="60"><i class="arg">graphName</i> <b class="method">getall</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a dictionary (suitable for use with [<b class="cmd">array set</b>])
for the whole graph.
If the <i class="arg">pattern</i> is specified only the attributes whose names
match the pattern will be part of the returned dictionary. The pattern
is a <b class="cmd">glob</b> pattern.</p></dd>
<dt><a name="61"><i class="arg">graphName</i> <b class="method">keys</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of keys for the whole graph.
If the <i class="arg">pattern</i> is specified only the attributes whose names
match the pattern will be part of the returned list. The pattern is a
<b class="cmd">glob</b> pattern.</p></dd>
<dt><a name="62"><i class="arg">graphName</i> <b class="method">keyexists</b> <i class="arg">key</i></a></dt>
<dd><p>Return true if the specified <i class="arg">key</i> exists for the whole graph.</p></dd>
<dt><a name="63"><i class="arg">graphName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">node</i>...?</span></a></dt>
<dd><p>This method serializes the sub-graph spanned up by the <i class="arg">node</i>s. In
other words it returns a tcl value completely describing that
graph. If no nodes are specified the whole graph will be serialized.
This allows, for example, the transfer of graph objects (or parts
thereof) over arbitrary channels, persistence, etc.
This method is also the basis for both the copy constructor and
the assignment operator.</p>
<p>The result of this method has to be semantically identical over all
implementations of the graph interface. This is what will enable us to
copy graph data between different implementations of the same
interface.</p>
<p>The result is a list containing a multiple of three items, plus one!
In other words, '[llength $serial] % 3 == 1'. Valid values
include 1, 4, 7, ...</p>
<p>The last element of the list is a dictionary containing the attributes
associated with the whole graph.
Regarding the other elements; each triple consists of</p>
<ol class="enumerated">
<li><p>The name of the node to be described,</p></li>
<li><p>A dictionary containing the attributes associated with the node,</p></li>
<li><p>And a list describing all the arcs starting at that node.</p></li>
</ol>
<p>The elements of the arc list are lists containing three or four
elements each, i.e.</p>
<ol class="enumerated">
<li><p>The name of the arc described by the element,</p></li>
<li><p>A reference to the destination node of the arc. This reference is an
integer number given the index of that node in the main serialization
list. As that it is greater than or equal to zero, less than the
length of the serialization, and a multiple of three.
<em>Note:</em> For internal consistency no arc name may be used twice,
whether in the same node, or at some other node. This is a global
consistency requirement for the serialization.</p></li>
<li><p>And a dictionary containing the attributes associated with the arc.</p></li>
<li><p>The weight associated with the arc. This value is optional. Its
non-presence means that the arc in question has no weight associated
with it.</p>
<p><em>Note:</em> This information is new, compared to the
serialization of <b class="package"><a href="../../../../index.html#key256">graph</a></b> 2.3 and earlier. By making it an
optional element the new format is maximally compatible with the
old. This means that any graph not using weights will generate a
serialization which is still understood by the older graph package. A
serialization will not be understood any longer by the older packages
if, and only if the graph it was generated from actually has arcs with
weights.</p></li>
</ol>
<p>For all attribute dictionaries they keys are the names of the
attributes, and the values are the values for each name.</p>
<p><em>Note:</em> The order of the nodes in the serialization has no
relevance, nor has the order of the arcs per node.</p>
<pre class="example">
    # A possible serialization for the graph structure
    #
    #        d -----&gt; %2
    #       /         ^ \\
    #      /         /   \\
    #     /         b     \\
    #    /         /       \\
    #  %1 &lt;- a - %0         e
    #    ^         \\      /
    #     \\        c     /
    #      \\        \\  /
    #       \\        v v
    #        f ------ %3
    # is
    #
    # %3 {} {{f 6 {}}} %0 {} {{a 6 {}} {b 9 {}} {c 0 {}}} %1 {} {{d 9 {}}} %2 {} {{e 0 {}}} {}
    #
    # This assumes that the graph has neither attribute data nor weighted arcs.
</pre>
</dd>
<dt><a name="64"><i class="arg">graphName</i> <b class="method">set</b> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Set or get one of the keyed values associated with a graph. A graph
may have any number of keyed values associated with it. If <i class="arg">value</i>
is not specified, this command returns the current value assigned to
the key; if <i class="arg">value</i> is specified, this command assigns that value
to the key.</p></dd>
<dt><a name="65"><i class="arg">graphName</i> <b class="method">swap</b> <i class="arg">node1</i> <i class="arg">node2</i></a></dt>
<dd><p>Swap the position of <i class="arg">node1</i> and <i class="arg">node2</i> in the graph.</p></dd>
<dt><a name="66"><i class="arg">graphName</i> <b class="method">unset</b> <i class="arg">key</i></a></dt>
<dd><p>Remove a keyed value from the graph. The method will do nothing if the
<i class="arg">key</i> does not exist.</p></dd>
<dt><a name="67"><i class="arg">graphName</i> <b class="method">walk</b> <i class="arg">node</i> <span class="opt">?-order <i class="arg">order</i>?</span> <span class="opt">?-type <i class="arg">type</i>?</span> <span class="opt">?-dir <i class="arg">direction</i>?</span> -command <i class="arg">cmd</i></a></dt>
<dd><p>Perform a breadth-first or depth-first walk of the graph starting at
the node <i class="arg">node</i> going in either the direction of outgoing or
opposite to the incoming arcs.</p>
<p>The type of walk, breadth-first or depth-first, is determined by the
value of <i class="arg">type</i>; <b class="const">bfs</b> indicates breadth-first,
<b class="const">dfs</b> indicates depth-first.  Depth-first is the default.</p>
<p>The order of the walk, pre-order, post-order or both-order is
determined by the value of <i class="arg">order</i>; <b class="const">pre</b> indicates
pre-order, <b class="const">post</b> indicates post-order, <b class="const">both</b> indicates
both-order. Pre-order is the default. Pre-order walking means that a
node is visited before any of its neighbors (as defined by the
<i class="arg">direction</i>, see below). Post-order walking means that a parent is
visited after any of its neighbors. Both-order walking means that a
node is visited before <em>and</em> after any of its neighbors. The
combination of a breadth-first walk with post- or both-order is illegal.</p>
<p>The direction of the walk is determined by the value of <i class="arg">dir</i>;
<b class="const">backward</b> indicates the direction opposite to the incoming
arcs, <b class="const">forward</b> indicates the direction of the outgoing arcs.</p>
<p>As the walk progresses, the command <i class="arg">cmd</i> will be evaluated at
each node, with the mode of the call (<b class="const">enter</b> or
<b class="const">leave</b>) and values <i class="arg">graphName</i> and the name of the current
node appended. For a pre-order walk, all nodes are <b class="const">enter</b>ed, for a
post-order all nodes are left. In a both-order walk the first visit of
a node <b class="const">enter</b>s it, the second visit <b class="const">leave</b>s it.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">Changes for 2.0</a></h2>
<p>The following noteworthy changes have occurred:</p>
<ol class="enumerated">
<li><p>The API for accessing attributes and their values has been
simplified.</p>
<p>All functionality regarding the default attribute &quot;data&quot; has been
removed. This default attribute does not exist anymore. All accesses
to attributes have to specify the name of the attribute in
question. This backward <em>incompatible</em> change allowed us to
simplify the signature of all methods handling attributes.</p>
<p>Especially the flag <b class="option">-key</b> is not required anymore, even more,
its use is now forbidden. Please read the documentation for the arc
and node methods <b class="method">set</b>, <b class="method">get</b>, <b class="method">getall</b>,
<b class="method">unset</b>, <b class="method">append</b>, <b class="method">lappend</b>, <b class="method">keyexists</b>
and <b class="method">keys</b> for a description of the new API's.</p></li>
<li><p>The methods <b class="method">keys</b> and <b class="method">getall</b> now take an optional
pattern argument and will return only attribute data for keys matching
this pattern.</p></li>
<li><p>Arcs and nodes can now be renamed. See the documentation for the
methods <b class="method">arc rename</b> and <b class="method">node rename</b>.</p></li>
<li><p>The structure has been extended with API's for the serialization and
deserialization of graph objects, and a number of operations based on
them (graph assignment, copy construction).</p>
<p>Please read the documentation for the methods <b class="method">serialize</b>,
<b class="method">deserialize</b>, <b class="method">=</b>, and <b class="method">--&gt;</b>, and the
documentation on the construction of graph objects.</p>
<p>Beyond the copying of whole graph objects these new API's also enable
the transfer of graph objects over arbitrary channels and for easy
persistence.</p></li>
<li><p>A new method, <b class="method">attr</b>, was added to both <b class="method">arc</b> and
<b class="method">node</b> allowing the query and retrieval of attribute data
without regard to arc and node relationships.</p></li>
<li><p>Both methods <b class="method">arcs</b> and <b class="method">nodes</b> have been extended with
the ability to select arcs and nodes based on an arbitrary filtering
criterium.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: graph</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key434">adjacent</a>, <a href="../../../../index.html#key422">arc</a>, <a href="../../../../index.html#key565">cgraph</a>, <a href="../../../../index.html#key425">degree</a>, <a href="../../../../index.html#key409">edge</a>, <a href="../../../../index.html#key256">graph</a>, <a href="../../../../index.html#key406">loop</a>, <a href="../../../../index.html#key437">neighbour</a>, <a href="../../../../index.html#key412">node</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key429">subgraph</a>, <a href="../../../../index.html#key411">vertex</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/graph1.html.





























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::graph_v1 - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/graph1.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::graph_v1.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::graph_v1(n) 1.2.1 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::graph_v1 - Create and manipulate directed graph objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::graph <span class="opt">?1.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">graphName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><i class="arg">graphName</i> <b class="method">destroy</b></a></li>
<li><a href="#3"><i class="arg">graphName</i> <b class="method">arc append</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></li>
<li><a href="#4"><i class="arg">graphName</i> <b class="method">arc delete</b> <i class="arg">arc</i> <span class="opt">?<i class="arg">arc</i> ...?</span></a></li>
<li><a href="#5"><i class="arg">graphName</i> <b class="method">arc exists</b> <i class="arg">arc</i></a></li>
<li><a href="#6"><i class="arg">graphName</i> <b class="method">arc get</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#7"><i class="arg">graphName</i> <b class="method">arc getall</b> <i class="arg">arc</i></a></li>
<li><a href="#8"><i class="arg">graphName</i> <b class="method">arc keys</b> <i class="arg">arc</i></a></li>
<li><a href="#9"><i class="arg">graphName</i> <b class="method">arc keyexists</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#10"><i class="arg">graphName</i> <b class="method">arc insert</b> <i class="arg">start</i> <i class="arg">end</i> <span class="opt">?<i class="arg">child</i>?</span></a></li>
<li><a href="#11"><i class="arg">graphName</i> <b class="method">arc lappend</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></li>
<li><a href="#12"><i class="arg">graphName</i> <b class="method">arc set</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#13"><i class="arg">graphName</i> <b class="method">arc source</b> <i class="arg">arc</i></a></li>
<li><a href="#14"><i class="arg">graphName</i> <b class="method">arc target</b> <i class="arg">arc</i></a></li>
<li><a href="#15"><i class="arg">graphName</i> <b class="method">arc unset</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#16"><i class="arg">graphName</i> <b class="method">arcs</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?-value <i class="arg">value</i>?</span> <span class="opt">?-in|-out|-adj|-inner|-embedding <i class="arg">nodelist</i>?</span></a></li>
<li><a href="#17"><i class="arg">graphName</i> <b class="method">node append</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></li>
<li><a href="#18"><i class="arg">graphName</i> <b class="method">node degree</b> <span class="opt">?-in|-out?</span> <i class="arg">node</i></a></li>
<li><a href="#19"><i class="arg">graphName</i> <b class="method">node delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></li>
<li><a href="#20"><i class="arg">graphName</i> <b class="method">node exists</b> <i class="arg">node</i></a></li>
<li><a href="#21"><i class="arg">graphName</i> <b class="method">node get</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#22"><i class="arg">graphName</i> <b class="method">node getall</b> <i class="arg">node</i></a></li>
<li><a href="#23"><i class="arg">graphName</i> <b class="method">node keys</b> <i class="arg">node</i></a></li>
<li><a href="#24"><i class="arg">graphName</i> <b class="method">node keyexists</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#25"><i class="arg">graphName</i> <b class="method">node insert</b> <span class="opt">?<i class="arg">child</i>?</span></a></li>
<li><a href="#26"><i class="arg">graphName</i> <b class="method">node lappend</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></li>
<li><a href="#27"><i class="arg">graphName</i> <b class="method">node opposite</b> <i class="arg">node</i> <i class="arg">arc</i></a></li>
<li><a href="#28"><i class="arg">graphName</i> <b class="method">node set</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#29"><i class="arg">graphName</i> <b class="method">node unset</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#30"><i class="arg">graphName</i> <b class="method">nodes</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?-value <i class="arg">value</i>?</span> <span class="opt">?-in|-out|-adj|-inner|-embedding <i class="arg">nodelist</i>?</span></a></li>
<li><a href="#31"><i class="arg">graphName</i> <b class="method">get</b> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#32"><i class="arg">graphName</i> <b class="method">getall</b></a></li>
<li><a href="#33"><i class="arg">graphName</i> <b class="method">keys</b></a></li>
<li><a href="#34"><i class="arg">graphName</i> <b class="method">keyexists</b> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#35"><i class="arg">graphName</i> <b class="method">set</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#36"><i class="arg">graphName</i> <b class="method">swap</b> <i class="arg">node1</i> <i class="arg">node2</i></a></li>
<li><a href="#37"><i class="arg">graphName</i> <b class="method">unset</b> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#38"><i class="arg">graphName</i> <b class="method">walk</b> <i class="arg">node</i> <span class="opt">?-order <i class="arg">order</i>?</span> <span class="opt">?-type <i class="arg">type</i>?</span> <span class="opt">?-dir <i class="arg">direction</i>?</span> -command <i class="arg">cmd</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::graph</b> command creates a new graph object with an
associated global Tcl command whose name is <i class="arg">graphName</i>.  This
command may be used to invoke various operations on the graph.  It has
the following general form:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">graphName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>A directed graph is a structure containing two collections of
elements, called <em>nodes</em> and <em>arcs</em> respectively, together
with a relation (&quot;connectivity&quot;) that places a general structure upon
the nodes and arcs.</p>
<p>Each arc is connected to two nodes, one of which is called the
<em>source</em> and the other the <em>target</em>. This imposes a
direction upon the arc, which is said to go from the source to the
target. It is allowed that source and target of an arc are the same
node. Such an arc is called a <em>loop</em>. Whenever a node is source
or target of an arc both are said to be <em>adjacent</em>. This extends
into a relation between nodes, i.e. if two nodes are connected through
at least one arc they are said to be <em>adjacent</em> too.</p>
<p>Each node can be the source and target for any number of arcs. The
former are called the <em>outgoing arcs</em> of the node, the latter
the <em>incoming arcs</em> of the node. The number of edges in either
set is called the <em>in-</em> resp. the <em>out-degree</em> of the node.</p>
<p>In addition to maintaining the node and arc relationships, this graph
implementation allows any number of keyed values to be associated with
each node and arc.</p>
<p>The following commands are possible for graph objects:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">graphName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroy the graph, including its storage space and associated command.</p></dd>
<dt><a name="3"><i class="arg">graphName</i> <b class="method">arc append</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> to one of the keyed values associated with an
<i class="arg">arc</i>. If no <i class="arg">key</i> is specified, the key <b class="const">data</b> is
assumed.</p></dd>
<dt><a name="4"><i class="arg">graphName</i> <b class="method">arc delete</b> <i class="arg">arc</i> <span class="opt">?<i class="arg">arc</i> ...?</span></a></dt>
<dd><p>Remove the specified arcs from the graph.</p></dd>
<dt><a name="5"><i class="arg">graphName</i> <b class="method">arc exists</b> <i class="arg">arc</i></a></dt>
<dd><p>Return true if the specified <i class="arg">arc</i> exists in the graph.</p></dd>
<dt><a name="6"><i class="arg">graphName</i> <b class="method">arc get</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Return the value associated with the key <i class="arg">key</i> for the <i class="arg">arc</i>.
If no key is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="7"><i class="arg">graphName</i> <b class="method">arc getall</b> <i class="arg">arc</i></a></dt>
<dd><p>Returns a serialized list of key/value pairs (suitable for use with
[<b class="cmd">array set</b>]) for the <i class="arg">arc</i>.</p></dd>
<dt><a name="8"><i class="arg">graphName</i> <b class="method">arc keys</b> <i class="arg">arc</i></a></dt>
<dd><p>Returns a list of keys for the <i class="arg">arc</i>.</p></dd>
<dt><a name="9"><i class="arg">graphName</i> <b class="method">arc keyexists</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Return true if the specified <i class="arg">key</i> exists for the <i class="arg">arc</i>. If no
<i class="arg">key</i> is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="10"><i class="arg">graphName</i> <b class="method">arc insert</b> <i class="arg">start</i> <i class="arg">end</i> <span class="opt">?<i class="arg">child</i>?</span></a></dt>
<dd><p>Insert an arc named <i class="arg">child</i> into the graph beginning at the node
<i class="arg">start</i> and ending at the node <i class="arg">end</i>. If the name of the new
arc is not specified the system will generate a unique name of the
form <em>arc</em><i class="arg">x</i>.</p></dd>
<dt><a name="11"><i class="arg">graphName</i> <b class="method">arc lappend</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> (as a list) to one of the keyed values
associated with an <i class="arg">arc</i>.  If no <i class="arg">key</i> is specified, the key
<b class="const">data</b> is assumed.</p></dd>
<dt><a name="12"><i class="arg">graphName</i> <b class="method">arc set</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Set or get one of the keyed values associated with an arc.  If no key
is specified, the key <b class="const">data</b> is assumed.  Each arc that is
added to a graph has the empty string assigned to the key
<b class="const">data</b> automatically.  An arc may have any number of keyed
values associated with it.  If <i class="arg">value</i> is not specified, this
command returns the current value assigned to the key; if <i class="arg">value</i>
is specified, this command assigns that value to the key.</p></dd>
<dt><a name="13"><i class="arg">graphName</i> <b class="method">arc source</b> <i class="arg">arc</i></a></dt>
<dd><p>Return the node the given <i class="arg">arc</i> begins at.</p></dd>
<dt><a name="14"><i class="arg">graphName</i> <b class="method">arc target</b> <i class="arg">arc</i></a></dt>
<dd><p>Return the node the given <i class="arg">arc</i> ends at.</p></dd>
<dt><a name="15"><i class="arg">graphName</i> <b class="method">arc unset</b> <i class="arg">arc</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Remove a keyed value from the arc <i class="arg">arc</i>.  If no key is specified,
the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="16"><i class="arg">graphName</i> <b class="method">arcs</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?-value <i class="arg">value</i>?</span> <span class="opt">?-in|-out|-adj|-inner|-embedding <i class="arg">nodelist</i>?</span></a></dt>
<dd><p>Return a list of arcs in the graph. If no restriction is specified a
list containing all arcs is returned. Restrictions can limit the list
of returned arcs based on the nodes that are connected by the arc, on
the keyed values associated with the arc, or both. The restrictions
that involve connected nodes have a list of nodes as argument,
specified after the name of the restriction itself.</p>
<dl class="definitions">
<dt><b class="option">-in</b></dt>
<dd><p>Return a list of all arcs whose target is one of the nodes in the
<i class="arg">nodelist</i>.</p></dd>
<dt><b class="option">-out</b></dt>
<dd><p>Return a list of all arcs whose source is one of the nodes in the
<i class="arg">nodelist</i>.</p></dd>
<dt><b class="option">-adj</b></dt>
<dd><p>Return a list of all arcs adjacent to at least one of the nodes in the
<i class="arg">nodelist</i>. This is the union of the nodes returned by
<b class="option">-in</b> and <b class="option">-out</b>.</p></dd>
<dt><b class="option">-inner</b></dt>
<dd><p>Return a list of all arcs adjacent to two of the nodes in the
<i class="arg">nodelist</i>. This is the set of arcs in the subgraph spawned by the
specified nodes.</p></dd>
<dt><b class="option">-embedding</b></dt>
<dd><p>Return a list of all arcs adjacent to exactly one of the nodes in the
<i class="arg">nodelist</i>. This is the set of arcs connecting the subgraph
spawned by the specified nodes to the rest of the graph.</p></dd>
<dt><b class="option">-key</b> <i class="arg">key</i></dt>
<dd><p>Limit the list of arcs that are returned to those arcs that have an
associated key <i class="arg">key</i>.</p></dd>
<dt><b class="option">-value</b> <i class="arg">value</i></dt>
<dd><p>This restriction can only be used in combination with
<b class="option">-key</b>. It limits the list of arcs that are returned to those
arcs whose associated key <i class="arg">key</i> has the value <i class="arg">value</i>.</p></dd>
</dl>
<p>The restrictions imposed by either <b class="option">-in</b>, <b class="option">-out</b>,
<b class="option">-adj</b>, <b class="option">-inner</b>, or <b class="option">-embedded</b> are applied
first. Specifying more than one of them is illegal.
At last the restrictions set via <b class="option">-key</b> (and <b class="option">-value</b>)
are applied.
Specifying more than one <b class="option">-key</b> (and <b class="option">-value</b>) is
illegal.</p></dd>
<dt><a name="17"><i class="arg">graphName</i> <b class="method">node append</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> to one of the keyed values associated with an
<i class="arg">node</i>. If no <i class="arg">key</i> is specified, the key <b class="const">data</b> is
assumed.</p></dd>
<dt><a name="18"><i class="arg">graphName</i> <b class="method">node degree</b> <span class="opt">?-in|-out?</span> <i class="arg">node</i></a></dt>
<dd><p>Return the number of arcs adjacent to the specified <i class="arg">node</i>. If one
of the restrictions <b class="option">-in</b> or <b class="option">-out</b> is given only the
incoming resp. outgoing arcs are counted.</p></dd>
<dt><a name="19"><i class="arg">graphName</i> <b class="method">node delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></dt>
<dd><p>Remove the specified nodes from the graph.  All of the nodes' arcs
will be removed as well to prevent unconnected arcs.</p></dd>
<dt><a name="20"><i class="arg">graphName</i> <b class="method">node exists</b> <i class="arg">node</i></a></dt>
<dd><p>Return true if the specified <i class="arg">node</i> exists in the graph.</p></dd>
<dt><a name="21"><i class="arg">graphName</i> <b class="method">node get</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Return the value associated with the key <i class="arg">key</i> for the <i class="arg">node</i>.
If no key is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="22"><i class="arg">graphName</i> <b class="method">node getall</b> <i class="arg">node</i></a></dt>
<dd><p>Returns a serialized list of key/value pairs (suitable for use with
[<b class="cmd">array set</b>]) for the <i class="arg">node</i>.</p></dd>
<dt><a name="23"><i class="arg">graphName</i> <b class="method">node keys</b> <i class="arg">node</i></a></dt>
<dd><p>Returns a list of keys for the <i class="arg">node</i>.</p></dd>
<dt><a name="24"><i class="arg">graphName</i> <b class="method">node keyexists</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Return true if the specified <i class="arg">key</i> exists for the <i class="arg">node</i>. If
no <i class="arg">key</i> is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="25"><i class="arg">graphName</i> <b class="method">node insert</b> <span class="opt">?<i class="arg">child</i>?</span></a></dt>
<dd><p>Insert a node named <i class="arg">child</i> into the graph. The nodes has no arcs
connected to it. If the name of the new child is not specified the
system will generate a unique name of the form <em>node</em><i class="arg">x</i>.</p></dd>
<dt><a name="26"><i class="arg">graphName</i> <b class="method">node lappend</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> (as a list) to one of the keyed values
associated with an <i class="arg">node</i>. If no <i class="arg">key</i> is specified, the key
<b class="const">data</b> is assumed.</p></dd>
<dt><a name="27"><i class="arg">graphName</i> <b class="method">node opposite</b> <i class="arg">node</i> <i class="arg">arc</i></a></dt>
<dd><p>Return the node at the other end of the specified <i class="arg">arc</i>, which has
to be adjacent to the given <i class="arg">node</i>.</p></dd>
<dt><a name="28"><i class="arg">graphName</i> <b class="method">node set</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Set or get one of the keyed values associated with a node.  If no key
is specified, the key <b class="const">data</b> is assumed.  Each node that is
added to a graph has the empty string assigned to the key
<b class="const">data</b> automatically.  A node may have any number of keyed
values associated with it.  If <i class="arg">value</i> is not specified, this
command returns the current value assigned to the key; if <i class="arg">value</i>
is specified, this command assigns that value to the key.</p></dd>
<dt><a name="29"><i class="arg">graphName</i> <b class="method">node unset</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Remove a keyed value from the node <i class="arg">node</i>.  If no key is
specified, the key <b class="method">data</b> is assumed.</p></dd>
<dt><a name="30"><i class="arg">graphName</i> <b class="method">nodes</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?-value <i class="arg">value</i>?</span> <span class="opt">?-in|-out|-adj|-inner|-embedding <i class="arg">nodelist</i>?</span></a></dt>
<dd><p>Return a list of nodes in the graph. Restrictions can limit the list
of returned nodes based on neighboring nodes, or based on the keyed
values associated with the node. The restrictions that involve
neighboring nodes have a list of nodes as argument, specified after
the name of the restriction itself.</p>
<p>The possible restrictions are the same as for method
<b class="method">arcs</b>. The set of nodes to return is computed as the union of
all source and target nodes for all the arcs satisfying the
restriction as defined for <b class="method">arcs</b>.</p></dd>
<dt><a name="31"><i class="arg">graphName</i> <b class="method">get</b> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Return the value associated with the key <i class="arg">key</i> for the graph. If
no key is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="32"><i class="arg">graphName</i> <b class="method">getall</b></a></dt>
<dd><p>Returns a serialized list of key/value pairs (suitable for use with
[<b class="cmd">array set</b>]) for the whole graph.</p></dd>
<dt><a name="33"><i class="arg">graphName</i> <b class="method">keys</b></a></dt>
<dd><p>Returns a list of keys for the whole graph.</p></dd>
<dt><a name="34"><i class="arg">graphName</i> <b class="method">keyexists</b> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Return true if the specified <i class="arg">key</i> exists for the whole graph. If no
<i class="arg">key</i> is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="35"><i class="arg">graphName</i> <b class="method">set</b> <span class="opt">?-key <i class="arg">key</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Set or get one of the keyed values associated with a graph. If no key
is specified, the key <b class="const">data</b> is assumed. Each graph has the
empty string assigned to the key <b class="const">data</b> automatically. A graph
may have any number of keyed values associated with it. If <i class="arg">value</i>
is not specified, this command returns the current value assigned to
the key; if <i class="arg">value</i> is specified, this command assigns that value
to the key.</p></dd>
<dt><a name="36"><i class="arg">graphName</i> <b class="method">swap</b> <i class="arg">node1</i> <i class="arg">node2</i></a></dt>
<dd><p>Swap the position of <i class="arg">node1</i> and <i class="arg">node2</i> in the graph.</p></dd>
<dt><a name="37"><i class="arg">graphName</i> <b class="method">unset</b> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Remove a keyed value from the graph. If no key is specified, the key
<b class="const">data</b> is assumed.</p></dd>
<dt><a name="38"><i class="arg">graphName</i> <b class="method">walk</b> <i class="arg">node</i> <span class="opt">?-order <i class="arg">order</i>?</span> <span class="opt">?-type <i class="arg">type</i>?</span> <span class="opt">?-dir <i class="arg">direction</i>?</span> -command <i class="arg">cmd</i></a></dt>
<dd><p>Perform a breadth-first or depth-first walk of the graph starting at
the node <i class="arg">node</i> going in either the direction of outgoing or
opposite to the incoming arcs.</p>
<p>The type of walk, breadth-first or depth-first, is determined by the
value of <i class="arg">type</i>; <b class="const">bfs</b> indicates breadth-first,
<b class="const">dfs</b> indicates depth-first.  Depth-first is the default.</p>
<p>The order of the walk, pre-order, post-order or both-order is
determined by the value of <i class="arg">order</i>; <b class="const">pre</b> indicates
pre-order, <b class="const">post</b> indicates post-order, <b class="const">both</b> indicates
both-order. Pre-order is the default. Pre-order walking means that a
node is visited before any of its neighbors (as defined by the
<i class="arg">direction</i>, see below). Post-order walking means that a parent is
visited after any of its neighbors. Both-order walking means that a
node is visited before <em>and</em> after any of its neighbors. The
combination of a bread-first walk with post- or both-order is illegal.</p>
<p>The direction of the walk is determined by the value of <i class="arg">dir</i>;
<b class="const">backward</b> indicates the direction opposite to the incoming
arcs, <b class="const">forward</b> indicates the direction of the outgoing arcs.</p>
<p>As the walk progresses, the command <i class="arg">cmd</i> will be evaluated at
each node, with the mode of the call (<b class="const">enter</b> or
<b class="const">leave</b>) and values <i class="arg">graphName</i> and the name of the current
node appended. For a pre-order walk, all nodes are <b class="const">enter</b>ed, for a
post-order all nodes are left. In a both-order walk the first visit of
a node <b class="const">enter</b>s it, the second visit <b class="const">leave</b>s it.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: graph</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key565">cgraph</a>, <a href="../../../../index.html#key256">graph</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/graphops.html.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::graph::op - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/graphops.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Alejandro Paz &lt;[email protected]&gt;   -- Copyright &copy; 2008 (docs) Andreas Kupries &lt;[email protected]&gt;   -- Copyright &copy; 2009 Michal Antoniewski &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::graph::op.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::graph::op(n) 0.11.3 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::graph::op - Operation for (un)directed graph objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Operations</a></li>
<li class="section"><a href="#section3">Background theory and terms</a>
<ul>
<li class="subsection"><a href="#subsection1">Shortest Path Problem</a></li>
<li class="subsection"><a href="#subsection2">Travelling Salesman Problem</a></li>
<li class="subsection"><a href="#subsection3">Matching Problem</a></li>
<li class="subsection"><a href="#subsection4">Cut Problems</a></li>
<li class="subsection"><a href="#subsection5">K-Center Problem</a></li>
<li class="subsection"><a href="#subsection6">Flow Problems</a></li>
<li class="subsection"><a href="#subsection7">Approximation algorithm</a></li>
</ul>
</li>
<li class="section"><a href="#section4">References</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">struct::graph::op <span class="opt">?0.11.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">struct::graph::op::toAdjacencyMatrix</b> <i class="arg">g</i></a></li>
<li><a href="#2"><b class="cmd">struct::graph::op::toAdjacencyList</b> <i class="arg">G</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">struct::graph::op::kruskal</b> <i class="arg">g</i></a></li>
<li><a href="#4"><b class="cmd">struct::graph::op::prim</b> <i class="arg">g</i></a></li>
<li><a href="#5"><b class="cmd">struct::graph::op::isBipartite?</b> <i class="arg">g</i> <span class="opt">?<i class="arg">bipartvar</i>?</span></a></li>
<li><a href="#6"><b class="cmd">struct::graph::op::tarjan</b> <i class="arg">g</i></a></li>
<li><a href="#7"><b class="cmd">struct::graph::op::connectedComponents</b> <i class="arg">g</i></a></li>
<li><a href="#8"><b class="cmd">struct::graph::op::connectedComponentOf</b> <i class="arg">g</i> <i class="arg">n</i></a></li>
<li><a href="#9"><b class="cmd">struct::graph::op::isConnected?</b> <i class="arg">g</i></a></li>
<li><a href="#10"><b class="cmd">struct::graph::op::isCutVertex?</b> <i class="arg">g</i> <i class="arg">n</i></a></li>
<li><a href="#11"><b class="cmd">struct::graph::op::isBridge?</b> <i class="arg">g</i> <i class="arg">a</i></a></li>
<li><a href="#12"><b class="cmd">struct::graph::op::isEulerian?</b> <i class="arg">g</i> <span class="opt">?<i class="arg">tourvar</i>?</span></a></li>
<li><a href="#13"><b class="cmd">struct::graph::op::isSemiEulerian?</b> <i class="arg">g</i> <span class="opt">?<i class="arg">pathvar</i>?</span></a></li>
<li><a href="#14"><b class="cmd">struct::graph::op::dijkstra</b> <i class="arg">g</i> <i class="arg">start</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#15"><b class="cmd">struct::graph::op::distance</b> <i class="arg">g</i> <i class="arg">origin</i> <i class="arg">destination</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#16"><b class="cmd">struct::graph::op::eccentricity</b> <i class="arg">g</i> <i class="arg">n</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#17"><b class="cmd">struct::graph::op::radius</b> <i class="arg">g</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#18"><b class="cmd">struct::graph::op::diameter</b> <i class="arg">g</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#19"><b class="cmd">struct::graph::op::BellmanFord</b> <i class="arg">G</i> <i class="arg">startnode</i></a></li>
<li><a href="#20"><b class="cmd">struct::graph::op::Johnsons</b> <i class="arg">G</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#21"><b class="cmd">struct::graph::op::FloydWarshall</b> <i class="arg">G</i></a></li>
<li><a href="#22"><b class="cmd">struct::graph::op::MetricTravellingSalesman</b> <i class="arg">G</i></a></li>
<li><a href="#23"><b class="cmd">struct::graph::op::Christofides</b> <i class="arg">G</i></a></li>
<li><a href="#24"><b class="cmd">struct::graph::op::GreedyMaxMatching</b> <i class="arg">G</i></a></li>
<li><a href="#25"><b class="cmd">struct::graph::op::MaxCut</b> <i class="arg">G</i> <i class="arg">U</i> <i class="arg">V</i></a></li>
<li><a href="#26"><b class="cmd">struct::graph::op::UnweightedKCenter</b> <i class="arg">G</i> <i class="arg">k</i></a></li>
<li><a href="#27"><b class="cmd">struct::graph::op::WeightedKCenter</b> <i class="arg">G</i> <i class="arg">nodeWeights</i> <i class="arg">W</i></a></li>
<li><a href="#28"><b class="cmd">struct::graph::op::GreedyMaxIndependentSet</b> <i class="arg">G</i></a></li>
<li><a href="#29"><b class="cmd">struct::graph::op::GreedyWeightedMaxIndependentSet</b> <i class="arg">G</i> <i class="arg">nodeWeights</i></a></li>
<li><a href="#30"><b class="cmd">struct::graph::op::VerticesCover</b> <i class="arg">G</i></a></li>
<li><a href="#31"><b class="cmd">struct::graph::op::EdmondsKarp</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">t</i></a></li>
<li><a href="#32"><b class="cmd">struct::graph::op::BusackerGowen</b> <i class="arg">G</i> <i class="arg">desiredFlow</i> <i class="arg">s</i> <i class="arg">t</i></a></li>
<li><a href="#33"><b class="cmd">struct::graph::op::ShortestsPathsByBFS</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">outputFormat</i></a></li>
<li><a href="#34"><b class="cmd">struct::graph::op::BFS</b> <i class="arg">G</i> <i class="arg">s</i> <span class="opt">?<i class="arg">outputFormat</i>...?</span></a></li>
<li><a href="#35"><b class="cmd">struct::graph::op::MinimumDiameterSpanningTree</b> <i class="arg">G</i></a></li>
<li><a href="#36"><b class="cmd">struct::graph::op::MinimumDegreeSpanningTree</b> <i class="arg">G</i></a></li>
<li><a href="#37"><b class="cmd">struct::graph::op::MaximumFlowByDinic</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">t</i> <i class="arg">blockingFlowAlg</i></a></li>
<li><a href="#38"><b class="cmd">struct::graph::op::BlockingFlowByDinic</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">t</i></a></li>
<li><a href="#39"><b class="cmd">struct::graph::op::BlockingFlowByMKM</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">t</i></a></li>
<li><a href="#40"><b class="cmd">struct::graph::op::createResidualGraph</b> <i class="arg">G</i> <i class="arg">f</i></a></li>
<li><a href="#41"><b class="cmd">struct::graph::op::createAugmentingNetwork</b> <i class="arg">G</i> <i class="arg">f</i> <i class="arg">path</i></a></li>
<li><a href="#42"><b class="cmd">struct::graph::op::createLevelGraph</b> <i class="arg">Gf</i> <i class="arg">s</i></a></li>
<li><a href="#43"><b class="cmd">struct::graph::op::TSPLocalSearching</b> <i class="arg">G</i> <i class="arg">C</i></a></li>
<li><a href="#44"><b class="cmd">struct::graph::op::TSPLocalSearching3Approx</b> <i class="arg">G</i> <i class="arg">C</i></a></li>
<li><a href="#45"><b class="cmd">struct::graph::op::createSquaredGraph</b> <i class="arg">G</i></a></li>
<li><a href="#46"><b class="cmd">struct::graph::op::createCompleteGraph</b> <i class="arg">G</i> <i class="arg">originalEdges</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package described by this document, <b class="package">struct::graph::op</b>,
is a companion to the package <b class="package"><a href="graph.html">struct::graph</a></b>. It provides a
series of common operations and algorithms applicable to (un)directed
graphs.</p>
<p>Despite being a companion the package is not directly dependent on
<b class="package"><a href="graph.html">struct::graph</a></b>, only on the API defined by that
package. I.e. the operations of this package can be applied to any and
all graph objects which provide the same API as the objects created
through <b class="package"><a href="graph.html">struct::graph</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Operations</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">struct::graph::op::toAdjacencyMatrix</b> <i class="arg">g</i></a></dt>
<dd><p>This command takes the graph <i class="arg">g</i> and returns a nested list
containing the adjacency matrix of <i class="arg">g</i>.</p>
<p>The elements of the outer list are the rows of the matrix, the inner
elements are the column values in each row. The matrix has &quot;<b class="variable">n</b>+1&quot;
rows and columns, with the first row and column (index 0) containing
the name of the node the row/column is for. All other elements are
boolean values, <b class="const">True</b> if there is an arc between the 2 nodes
of the respective row and column, and <b class="const">False</b> otherwise.</p>
<p>Note that the matrix is symmetric. It does not represent the
directionality of arcs, only their presence between nodes. It is also
unable to represent parallel arcs in <i class="arg">g</i>.</p></dd>
<dt><a name="2"><b class="cmd">struct::graph::op::toAdjacencyList</b> <i class="arg">G</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>Procedure creates for input graph <i class="arg">G</i>, it's representation as <i class="term"><a href="../../../../index.html#key417">Adjacency List</a></i>.
It handles both directed and undirected graphs (default is undirected).
It returns dictionary that for each node (key) returns list of nodes adjacent
to it. When considering weighted version, for each adjacent node there is also
weight of the edge included.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph object <i class="arg">G</i> (input)</dt>
<dd><p>A graph to convert into an <i class="term"><a href="../../../../index.html#key417">Adjacency List</a></i>.</p></dd>
</dl></dd>
<dt>Options:</dt>
<dd><dl class="options">
<dt><b class="option">-directed</b></dt>
<dd><p>By default <i class="arg">G</i> is operated as if it were an <i class="term">Undirected graph</i>.
Using this option tells the command to handle <i class="arg">G</i> as the directed graph it is.</p></dd>
<dt><b class="option">-weights</b></dt>
<dd><p>By default any weight information the graph <i class="arg">G</i> may have is ignored.
Using this option tells the command to put weight information into the result.
In that case it is expected that all arcs have a proper weight, and an error
is thrown if that is not the case.</p></dd>
</dl></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">struct::graph::op::kruskal</b> <i class="arg">g</i></a></dt>
<dd><p>This command takes the graph <i class="arg">g</i> and returns a list containing the
names of the arcs in <i class="arg">g</i> which span up a minimum weight spanning tree
(MST), or, in the case of an un-connected graph, a minimum weight spanning
forest (except for the 1-vertex components). Kruskal's algorithm is used
to compute the tree or forest.
This algorithm has a time complexity of <i class="term">O(E*log E)</i> or <i class="term">O(E* log V)</i>,
where <i class="term">V</i> is the number of vertices and <i class="term"><a href="../../../../index.html#key744">E</a></i> is the number of edges
in graph <i class="arg">g</i>.</p>
<p>The command will throw an error if one or more arcs in <i class="arg">g</i> have no
weight associated with them.</p>
<p>A note regarding the result, the command refrains from explicitly
listing the nodes of the MST as this information is implicitly
provided in the arcs already.</p></dd>
<dt><a name="4"><b class="cmd">struct::graph::op::prim</b> <i class="arg">g</i></a></dt>
<dd><p>This command takes the graph <i class="arg">g</i> and returns a list containing the
names of the arcs in <i class="arg">g</i> which span up a minimum weight spanning tree
(MST), or, in the case of an un-connected graph, a minimum weight spanning
forest (except for the 1-vertex components). Prim's algorithm is used to
compute the tree or forest.
This algorithm has a time complexity between <i class="term">O(E+V*log V)</i> and <i class="term">O(V*V)</i>,
depending on the implementation (Fibonacci heap + Adjacency list versus
Adjacency Matrix).  As usual <i class="term">V</i> is the number of vertices and
<i class="term"><a href="../../../../index.html#key744">E</a></i> the number of edges in graph <i class="arg">g</i>.</p>
<p>The command will throw an error if one or more arcs in <i class="arg">g</i> have no
weight associated with them.</p>
<p>A note regarding the result, the command refrains from explicitly
listing the nodes of the MST as this information is implicitly
provided in the arcs already.</p></dd>
<dt><a name="5"><b class="cmd">struct::graph::op::isBipartite?</b> <i class="arg">g</i> <span class="opt">?<i class="arg">bipartvar</i>?</span></a></dt>
<dd><p>This command takes the graph <i class="arg">g</i> and returns a boolean value
indicating whether it is bipartite (<b class="const">true</b>) or not
(<b class="const">false</b>). If the variable <i class="arg">bipartvar</i> is specified the two
partitions of the graph are there as a list, if, and only if the graph
is bipartit. If it is not the variable, if specified, is not touched.</p></dd>
<dt><a name="6"><b class="cmd">struct::graph::op::tarjan</b> <i class="arg">g</i></a></dt>
<dd><p>This command computes the set of <em>strongly connected</em>
components (SCCs) of the graph <i class="arg">g</i>. The result of the command is a
list of sets, each of which contains the nodes for one of the SCCs of
<i class="arg">g</i>. The union of all SCCs covers the whole graph, and no two SCCs
intersect with each other.</p>
<p>The graph <i class="arg">g</i> is <i class="term">acyclic</i> if all SCCs in the result contain
only a single node. The graph <i class="arg">g</i> is <i class="term">strongly connected</i>
if the result contains only a single SCC containing all nodes of
<i class="arg">g</i>.</p></dd>
<dt><a name="7"><b class="cmd">struct::graph::op::connectedComponents</b> <i class="arg">g</i></a></dt>
<dd><p>This command computes the set of <em>connected</em> components (CCs) of
the graph <i class="arg">g</i>. The result of the command is a list of sets, each
of which contains the nodes for one of the CCs of <i class="arg">g</i>. The union
of all CCs covers the whole graph, and no two CCs intersect with each
other.</p>
<p>The graph <i class="arg">g</i> is <i class="term">connected</i> if the result contains only a
single SCC containing all nodes of <i class="arg">g</i>.</p></dd>
<dt><a name="8"><b class="cmd">struct::graph::op::connectedComponentOf</b> <i class="arg">g</i> <i class="arg">n</i></a></dt>
<dd><p>This command computes the <em>connected</em> component (CC) of the graph
<i class="arg">g</i> containing the node <i class="arg">n</i>. The result of the command is a
sets which contains the nodes for the CC of <i class="arg">n</i> in <i class="arg">g</i>.</p>
<p>The command will throw an error if <i class="arg">n</i> is not a node of the graph
<i class="arg">g</i>.</p></dd>
<dt><a name="9"><b class="cmd">struct::graph::op::isConnected?</b> <i class="arg">g</i></a></dt>
<dd><p>This is a convenience command determining whether the graph <i class="arg">g</i> is
<i class="term">connected</i> or not.  The result is a boolean value, <b class="const">true</b>
if the graph is connected, and <b class="const">false</b> otherwise.</p></dd>
<dt><a name="10"><b class="cmd">struct::graph::op::isCutVertex?</b> <i class="arg">g</i> <i class="arg">n</i></a></dt>
<dd><p>This command determines whether the node <i class="arg">n</i> in the graph <i class="arg">g</i>
is a <i class="term"><a href="../../../../index.html#key435">cut vertex</a></i> (aka <i class="term"><a href="../../../../index.html#key432">articulation point</a></i>). The result
is a boolean value, <b class="const">true</b> if the node is a cut vertex, and
<b class="const">false</b> otherwise.</p>
<p>The command will throw an error if <i class="arg">n</i> is not a node of the graph
<i class="arg">g</i>.</p></dd>
<dt><a name="11"><b class="cmd">struct::graph::op::isBridge?</b> <i class="arg">g</i> <i class="arg">a</i></a></dt>
<dd><p>This command determines whether the arc <i class="arg">a</i> in the graph <i class="arg">g</i>
is a <i class="term"><a href="../../../../index.html#key416">bridge</a></i> (aka <i class="term"><a href="../../../../index.html#key433">cut edge</a></i>, or <i class="term"><a href="../../../../index.html#key440">isthmus</a></i>). The
result is a boolean value, <b class="const">true</b> if the arc is a bridge, and
<b class="const">false</b> otherwise.</p>
<p>The command will throw an error if <i class="arg">a</i> is not an arc of the graph
<i class="arg">g</i>.</p></dd>
<dt><a name="12"><b class="cmd">struct::graph::op::isEulerian?</b> <i class="arg">g</i> <span class="opt">?<i class="arg">tourvar</i>?</span></a></dt>
<dd><p>This command determines whether the graph <i class="arg">g</i> is <i class="term">eulerian</i>
or not.  The result is a boolean value, <b class="const">true</b> if the graph is
eulerian, and <b class="const">false</b> otherwise.</p>
<p>If the graph is eulerian and <i class="arg">tourvar</i> is specified then an euler
tour is computed as well and stored in the named variable. The tour is
represented by the list of arcs traversed, in the order of traversal.</p></dd>
<dt><a name="13"><b class="cmd">struct::graph::op::isSemiEulerian?</b> <i class="arg">g</i> <span class="opt">?<i class="arg">pathvar</i>?</span></a></dt>
<dd><p>This command determines whether the graph <i class="arg">g</i> is
<i class="term">semi-eulerian</i> or not.  The result is a boolean value, <b class="const">true</b>
if the graph is semi-eulerian, and <b class="const">false</b> otherwise.</p>
<p>If the graph is semi-eulerian and <i class="arg">pathvar</i> is specified then an
euler path is computed as well and stored in the named variable. The
path is represented by the list of arcs traversed, in the order of
traversal.</p></dd>
<dt><a name="14"><b class="cmd">struct::graph::op::dijkstra</b> <i class="arg">g</i> <i class="arg">start</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command determines distances in the weighted <i class="arg">g</i> from the
node <i class="arg">start</i> to all other nodes in the graph. The options specify
how to traverse graphs, and the format of the result.</p>
<p>Two options are recognized</p>
<dl class="options">
<dt><b class="option">-arcmode</b> mode</dt>
<dd><p>The accepted mode values are <b class="const">directed</b> and <b class="const">undirected</b>.
For directed traversal all arcs are traversed from source to
target. For undirected traversal all arcs are traversed in the
opposite direction as well. Undirected traversal is the default.</p></dd>
<dt><b class="option">-outputformat</b> format</dt>
<dd><p>The accepted format values are <b class="const">distances</b> and <b class="const">tree</b>. In
both cases the result is a dictionary keyed by the names of all nodes
in the graph. For <b class="const">distances</b> the value is the distance of the
node to <i class="arg">start</i>, whereas for <b class="const">tree</b> the value is the path
from the node to <i class="arg">start</i>, excluding the node itself, but including
<i class="arg">start</i>. Tree format is the default.</p></dd>
</dl></dd>
<dt><a name="15"><b class="cmd">struct::graph::op::distance</b> <i class="arg">g</i> <i class="arg">origin</i> <i class="arg">destination</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command determines the (un)directed distance between the two
nodes <i class="arg">origin</i> and <i class="arg">destination</i> in the graph <i class="arg">g</i>. It
accepts the option <b class="option">-arcmode</b> of <b class="cmd">struct::graph::op::dijkstra</b>.</p></dd>
<dt><a name="16"><b class="cmd">struct::graph::op::eccentricity</b> <i class="arg">g</i> <i class="arg">n</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command determines the (un)directed <i class="term"><a href="../../../../index.html#key450">eccentricity</a></i> of the
node <i class="arg">n</i> in the graph <i class="arg">g</i>. It accepts the option
<b class="option">-arcmode</b> of <b class="cmd">struct::graph::op::dijkstra</b>.</p>
<p>The (un)directed <i class="term"><a href="../../../../index.html#key450">eccentricity</a></i> of a node is the maximal
(un)directed distance between the node and any other node in the
graph.</p></dd>
<dt><a name="17"><b class="cmd">struct::graph::op::radius</b> <i class="arg">g</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command determines the (un)directed <i class="term"><a href="../../../../index.html#key418">radius</a></i> of the graph
<i class="arg">g</i>. It accepts the option <b class="option">-arcmode</b> of <b class="cmd">struct::graph::op::dijkstra</b>.</p>
<p>The (un)directed <i class="term"><a href="../../../../index.html#key418">radius</a></i> of a graph is the minimal (un)directed
<i class="term"><a href="../../../../index.html#key450">eccentricity</a></i> of all nodes in the graph.</p></dd>
<dt><a name="18"><b class="cmd">struct::graph::op::diameter</b> <i class="arg">g</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command determines the (un)directed <i class="term"><a href="../../../../index.html#key407">diameter</a></i> of the graph
<i class="arg">g</i>. It accepts the option <b class="option">-arcmode</b> of <b class="cmd">struct::graph::op::dijkstra</b>.</p>
<p>The (un)directed <i class="term"><a href="../../../../index.html#key407">diameter</a></i> of a graph is the maximal (un)directed
<i class="term"><a href="../../../../index.html#key450">eccentricity</a></i> of all nodes in the graph.</p></dd>
<dt><a name="19"><b class="cmd">struct::graph::op::BellmanFord</b> <i class="arg">G</i> <i class="arg">startnode</i></a></dt>
<dd><p>Searching for <span class="sectref"><a href="#subsection1">shortests paths</a></span> between chosen node and all other nodes in graph <i class="arg">G</i>. Based
on relaxation method. In comparison to <b class="cmd">struct::graph::op::dijkstra</b> it doesn't need assumption that all weights
on edges in input graph <i class="arg">G</i> have to be positive.</p>
<p>That generality sets the complexity of algorithm to - <i class="term">O(V*E)</i>, where <i class="term">V</i> is the number of vertices
and <i class="term"><a href="../../../../index.html#key744">E</a></i> is number of edges in graph <i class="arg">G</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph object <i class="arg">G</i> (input)</dt>
<dd><p>Directed, connected and edge weighted graph <i class="arg">G</i>, without any negative cycles ( presence of cycles with the negative sum
of weight means that there is no shortest path, since the total weight becomes lower each time the cycle is
traversed ). Negative weights on edges are allowed.</p></dd>
<dt>Node <i class="arg">startnode</i> (input)</dt>
<dd><p>The node for which we find all shortest paths to each other node in graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Dictionary containing for each node (key) distances to each other node in graph <i class="arg">G</i>.</p></dd>
</dl>
<p><em>Note:</em> If algorithm finds a negative cycle, it will return error message.</p></dd>
<dt><a name="20"><b class="cmd">struct::graph::op::Johnsons</b> <i class="arg">G</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>Searching for <span class="sectref"><a href="#subsection1">shortest paths</a></span> between all pairs of vertices in graph. For sparse graphs
asymptotically quicker than <b class="cmd">struct::graph::op::FloydWarshall</b> algorithm. Johnson's algorithm
uses <b class="cmd">struct::graph::op::BellmanFord</b> and <b class="cmd">struct::graph::op::dijkstra</b> as subprocedures.</p>
<p>Time complexity: <i class="term">O(n**2*log(n) +n*m)</i>, where <i class="term">n</i> is the number of nodes and <i class="term">m</i> is
the number of edges in graph <i class="arg">G</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph object <i class="arg">G</i> (input)</dt>
<dd><p>Directed graph <i class="arg">G</i>, weighted on edges and not containing
any cycles with negative sum of weights ( the presence of such cycles means
there is no shortest path, since the total weight becomes lower each time the
cycle is traversed ). Negative weights on edges are allowed.</p></dd>
</dl></dd>
<dt>Options:</dt>
<dd><dl class="options">
<dt><b class="option">-filter</b></dt>
<dd><p>Returns only existing distances, cuts all <i class="term">Inf</i> values for 
non-existing connections between pairs of nodes.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Dictionary containing distances between all pairs of vertices.</p></dd>
</dl></dd>
<dt><a name="21"><b class="cmd">struct::graph::op::FloydWarshall</b> <i class="arg">G</i></a></dt>
<dd><p>Searching for <span class="sectref"><a href="#subsection1">shortest paths</a></span> between all pairs of edges in weighted graphs.</p>
<p>Time complexity: <i class="term">O(V^3)</i> - where <i class="term">V</i> is number of vertices.</p>
<p>Memory complexity: <i class="term">O(V^2)</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph object <i class="arg">G</i> (input)</dt>
<dd><p>Directed and weighted graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Dictionary containing shortest distances to each node from each node.</p></dd>
</dl>
<p><em>Note:</em> Algorithm finds solutions dynamically. It compares all possible paths through the graph
between each pair of vertices. Graph shouldn't possess any cycle with negative
sum of weights (the presence of such cycles means there is no shortest path, 
since the total weight becomes lower each time the cycle is traversed).</p>
<p>On the other hand algorithm can be used to find those cycles - if any shortest distance 
found by algorithm for any nodes <i class="term">v</i> and <i class="term">u</i> (when <i class="term">v</i> is the same node as <i class="term">u</i>) is negative,
that node surely belong to at least one negative cycle.</p></dd>
<dt><a name="22"><b class="cmd">struct::graph::op::MetricTravellingSalesman</b> <i class="arg">G</i></a></dt>
<dd><p>Algorithm for solving a metric variation of <span class="sectref"><a href="#subsection2">Travelling salesman problem</a></span>.
<i class="term">TSP problem</i> is <i class="term">NP-Complete</i>, so there is no efficient algorithm to solve it. Greedy methods
are getting extremely slow, with the increase in the set of nodes.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph object <i class="arg">G</i> (input)</dt>
<dd><p>Undirected, weighted graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Approximated solution of minimum <i class="term">Hamilton Cycle</i> - closed path visiting all nodes,
each exactly one time.</p></dd>
</dl>
<p><em>Note:</em> <span class="sectref"><a href="#subsection7">It's 2-approximation algorithm.</a></span></p></dd>
<dt><a name="23"><b class="cmd">struct::graph::op::Christofides</b> <i class="arg">G</i></a></dt>
<dd><p>Another algorithm for solving <span class="sectref"><a href="#subsection2">metric <i class="term">TSP problem</i></a></span>.
Christofides implementation uses <i class="term">Max Matching</i> for reaching better approximation factor.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Undirected, weighted graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Approximated solution of minimum <i class="term">Hamilton Cycle</i> - closed path visiting all nodes,
each exactly one time.</p></dd>
</dl>
<p><em>Note:</em> <span class="sectref"><a href="#subsection7">It's is a 3/2 approximation algorithm. </a></span></p></dd>
<dt><a name="24"><b class="cmd">struct::graph::op::GreedyMaxMatching</b> <i class="arg">G</i></a></dt>
<dd><p><i class="term">Greedy Max Matching</i> procedure, which finds <span class="sectref"><a href="#subsection3">maximal matching</a></span> (not maximum)
for given graph <i class="arg">G</i>. It adds edges to solution, beginning from edges with the
lowest cost.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Undirected graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Set of edges - the max matching for graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt><a name="25"><b class="cmd">struct::graph::op::MaxCut</b> <i class="arg">G</i> <i class="arg">U</i> <i class="arg">V</i></a></dt>
<dd><p>Algorithm solving a <span class="sectref"><a href="#subsection4">Maximum Cut Problem</a></span>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>The graph to cut.</p></dd>
<dt>List <i class="arg">U</i> (output)</dt>
<dd><p>Variable storing first set of nodes (cut) given by solution.</p></dd>
<dt>List <i class="arg">V</i> (output)</dt>
<dd><p>Variable storing second set of nodes (cut) given by solution.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Algorithm returns number of edges between found two sets of nodes.</p></dd>
</dl>
<p><em>Note:</em> <i class="term">MaxCut</i> is a <span class="sectref"><a href="#subsection7">2-approximation algorithm.</a></span></p></dd>
<dt><a name="26"><b class="cmd">struct::graph::op::UnweightedKCenter</b> <i class="arg">G</i> <i class="arg">k</i></a></dt>
<dd><p>Approximation algorithm that solves a <span class="sectref"><a href="#subsection5">k-center problem</a></span>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Undirected complete graph <i class="arg">G</i>, which satisfies triangle inequality.</p></dd>
<dt>Integer <i class="arg">k</i> (input)</dt>
<dd><p>Positive integer that sets the number of nodes that will be included in <i class="term">k-center</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Set of nodes - <i class="arg">k</i> center for graph <i class="arg">G</i>.</p></dd>
</dl>
<p><em>Note:</em> <i class="term">UnweightedKCenter</i> is a <span class="sectref"><a href="#subsection7">2-approximation algorithm.</a></span></p></dd>
<dt><a name="27"><b class="cmd">struct::graph::op::WeightedKCenter</b> <i class="arg">G</i> <i class="arg">nodeWeights</i> <i class="arg">W</i></a></dt>
<dd><p>Approximation algorithm that solves a weighted version of <span class="sectref"><a href="#subsection5">k-center problem</a></span>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Undirected complete graph <i class="arg">G</i>, which satisfies triangle inequality.</p></dd>
<dt>Integer <i class="arg">W</i> (input)</dt>
<dd><p>Positive integer that sets the maximum possible weight of <i class="term">k-center</i> found by algorithm.</p></dd>
<dt>List <i class="arg">nodeWeights</i> (input)</dt>
<dd><p>List of nodes and its weights in graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Set of nodes, which is solution found by algorithm.</p></dd>
</dl>
<p><em>Note:</em><i class="term">WeightedKCenter</i> is a <span class="sectref"><a href="#subsection7">3-approximation algorithm.</a></span></p></dd>
<dt><a name="28"><b class="cmd">struct::graph::op::GreedyMaxIndependentSet</b> <i class="arg">G</i></a></dt>
<dd><p>A <i class="term">maximal independent set</i> is an <i class="term"><a href="../../../../index.html#key420">independent set</a></i> such that adding any other node
to the set forces the set to contain an edge.</p>
<p>Algorithm for input graph <i class="arg">G</i> returns set of nodes (list), which are contained in Max Independent
Set found by algorithm.</p></dd>
<dt><a name="29"><b class="cmd">struct::graph::op::GreedyWeightedMaxIndependentSet</b> <i class="arg">G</i> <i class="arg">nodeWeights</i></a></dt>
<dd><p>Weighted variation of <i class="term">Maximal Independent Set</i>. It takes as an input argument
not only graph <i class="arg">G</i> but also set of weights for all vertices in graph <i class="arg">G</i>.</p>
<p><em>Note:</em>
Read also <i class="term">Maximal Independent Set</i> description for more info.</p></dd>
<dt><a name="30"><b class="cmd">struct::graph::op::VerticesCover</b> <i class="arg">G</i></a></dt>
<dd><p><i class="term">Vertices cover</i> is a set of vertices such that each edge of the graph is incident to
at least one vertex of the set. This 2-approximation algorithm searches for minimum
<i class="term">vertices cover</i>, which is a classical optimization problem in computer science and 
is a typical example of an <i class="term">NP-hard</i> optimization problem that has an approximation
algorithm.
For input graph <i class="arg">G</i> algorithm returns the set of edges (list), which is Vertex Cover found by algorithm.</p></dd>
<dt><a name="31"><b class="cmd">struct::graph::op::EdmondsKarp</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">t</i></a></dt>
<dd><p>Improved Ford-Fulkerson's algorithm, computing the <span class="sectref"><a href="#subsection6">maximum flow</a></span> in given flow network <i class="arg">G</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Weighted and directed graph. Each edge should have set integer attribute considered as
maximum throughputs that can be carried by that link (edge).</p></dd>
<dt>Node <i class="arg">s</i> (input)</dt>
<dd><p>The node that is a source for graph <i class="arg">G</i>.</p></dd>
<dt>Node <i class="arg">t</i> (input)</dt>
<dd><p>The node that is a sink for graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Procedure returns the dictionary containing throughputs for all edges. For
each key ( the edge between nodes <i class="term">u</i> and <i class="term">v</i> in the form of <i class="term">list u v</i> ) there is
a value that is a throughput for that key. Edges where throughput values
are equal to 0 are not returned ( it is like there was no link in the flow network
between nodes connected by such edge).</p></dd>
</dl>
<p>The general idea of algorithm is finding the shortest augumenting paths in graph <i class="arg">G</i>, as long 
as they exist, and for each path updating the edge's weights along that path,
with maximum possible throughput. The final (maximum) flow is found
when there is no other augumenting path from source to sink.</p>
<p><em>Note:</em> Algorithm complexity : <i class="term">O(V*E)</i>, where <i class="term">V</i> is the number of nodes and <i class="term"><a href="../../../../index.html#key744">E</a></i> is the number
of edges in graph <i class="term">G</i>.</p></dd>
<dt><a name="32"><b class="cmd">struct::graph::op::BusackerGowen</b> <i class="arg">G</i> <i class="arg">desiredFlow</i> <i class="arg">s</i> <i class="arg">t</i></a></dt>
<dd><p>Algorithm finds solution for a <span class="sectref"><a href="#subsection6">minimum cost flow problem</a></span>. So, the goal is to find a flow,
whose max value can be <i class="arg">desiredFlow</i>, from source node <i class="arg">s</i> to sink node <i class="arg">t</i> in given flow network <i class="arg">G</i>. 
That network except throughputs at edges has also defined a non-negative cost on each edge - cost of using that edge when
directing flow with that edge ( it can illustrate e.g. fuel usage, time or any other measure dependent on usages ).</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Flow network (directed graph), each edge in graph should have two integer attributes: <i class="term">cost</i> and <i class="term">throughput</i>.</p></dd>
<dt>Integer <i class="arg">desiredFlow</i> (input)</dt>
<dd><p>Max value of the flow for that network.</p></dd>
<dt>Node <i class="arg">s</i> (input)</dt>
<dd><p>The source node for graph <i class="arg">G</i>.</p></dd>
<dt>Node <i class="arg">t</i> (input)</dt>
<dd><p>The sink node for graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Dictionary containing values of used throughputs for each edge ( key ).
found by algorithm.</p></dd>
</dl>
<p><em>Note:</em> Algorithm complexity : <i class="term">O(V**2*desiredFlow)</i>, where <i class="term">V</i> is the number of nodes in graph <i class="arg">G</i>.</p></dd>
<dt><a name="33"><b class="cmd">struct::graph::op::ShortestsPathsByBFS</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">outputFormat</i></a></dt>
<dd><p>Shortest pathfinding algorithm using BFS method. In comparison to <b class="cmd">struct::graph::op::dijkstra</b> it can
work with negative weights on edges. Of course negative cycles are not allowed. Algorithm is better than dijkstra
for sparse graphs, but also there exist some pathological cases (those cases generally don't appear in practise) that 
make time complexity increase exponentially with the growth of the number of nodes.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Input graph.</p></dd>
<dt>Node <i class="arg">s</i> (input)</dt>
<dd><p>Source node for which all distances to each other node in graph <i class="arg">G</i> are computed.</p></dd>
</dl></dd>
<dt>Options and result:</dt>
<dd><dl class="options">
<dt><b class="option">distances</b></dt>
<dd><p>When selected <i class="arg">outputFormat</i> is <b class="const">distances</b> - procedure returns dictionary containing
distances between source node <i class="arg">s</i> and each other node in graph <i class="arg">G</i>.</p></dd>
<dt><b class="option">paths</b></dt>
<dd><p>When selected <i class="arg">outputFormat</i> is <b class="const">paths</b> - procedure returns dictionary containing
for each node <i class="term">v</i>, a list of nodes, which is a path between source node <i class="arg">s</i> and node <i class="term">v</i>.</p></dd>
</dl></dd>
</dl></dd>
<dt><a name="34"><b class="cmd">struct::graph::op::BFS</b> <i class="arg">G</i> <i class="arg">s</i> <span class="opt">?<i class="arg">outputFormat</i>...?</span></a></dt>
<dd><p>Breadth-First Search - algorithm creates the BFS Tree.
Memory and time complexity: <i class="term">O(V + E)</i>, where <i class="term">V</i> is the number of nodes and <i class="term"><a href="../../../../index.html#key744">E</a></i>
is number of edges.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Input graph.</p></dd>
<dt>Node <i class="arg">s</i> (input)</dt>
<dd><p>Source node for BFS procedure.</p></dd>
</dl></dd>
<dt>Options and result:</dt>
<dd><dl class="options">
<dt><b class="option">graph</b></dt>
<dd><p>When selected <b class="option">outputFormat</b> is <b class="option">graph</b> - procedure returns a graph structure (<b class="cmd"><a href="graph.html">struct::graph</a></b>),
which is equivalent to BFS tree found by algorithm.</p></dd>
<dt><b class="option">tree</b></dt>
<dd><p>When selected <b class="option">outputFormat</b> is <b class="option">tree</b> - procedure returns a tree structure (<b class="cmd"><a href="struct_tree.html">struct::tree</a></b>),
which is equivalent to BFS tree found by algorithm.</p></dd>
</dl></dd>
</dl></dd>
<dt><a name="35"><b class="cmd">struct::graph::op::MinimumDiameterSpanningTree</b> <i class="arg">G</i></a></dt>
<dd><p>The goal is to find for input graph <i class="arg">G</i>, the <i class="term">spanning tree</i> that
has the minimum <i class="term"><a href="../../../../index.html#key407">diameter</a></i> value.</p>
<p>General idea of algorithm is to run <i class="term"><a href="../../../../index.html#key415">BFS</a></i> over all vertices in graph
<i class="arg">G</i>. If the diameter <i class="term">d</i> of the tree is odd, then we are sure that tree
given by <i class="term"><a href="../../../../index.html#key415">BFS</a></i> is minimum (considering diameter value). When, diameter <i class="term">d</i>
is even, then optimal tree can have minimum <i class="term"><a href="../../../../index.html#key407">diameter</a></i> equal to <i class="term">d</i> or
<i class="term">d-1</i>.</p>
<p>In that case, what algorithm does is rebuilding the tree given by <i class="term"><a href="../../../../index.html#key415">BFS</a></i>, by
adding a vertice between root node and root's child node (nodes), such that
subtree created with child node as root node is the greatest one (has the
greatests height). In the next step for such rebuilded tree, we run again <i class="term"><a href="../../../../index.html#key415">BFS</a></i>
with new node as root node. If the height of the tree didn't changed, we have found
a better solution.</p>
<p>For input graph <i class="arg">G</i> algorithm returns the graph structure (<b class="cmd"><a href="graph.html">struct::graph</a></b>) that is
a spanning tree with minimum diameter found by algorithm.</p></dd>
<dt><a name="36"><b class="cmd">struct::graph::op::MinimumDegreeSpanningTree</b> <i class="arg">G</i></a></dt>
<dd><p>Algorithm finds for input graph <i class="arg">G</i>, a spanning tree <i class="term">T</i> with the minimum possible
degree. That problem is <i class="term">NP-hard</i>, so algorithm is an approximation algorithm.</p>
<p>Let <i class="term">V</i> be the set of nodes for graph <i class="arg">G</i> and let <i class="term">W</i> be any subset of <i class="term">V</i>. Lets
assume also that <i class="term">OPT</i> is optimal solution and <i class="term">ALG</i> is solution found by algorithm for input 
graph <i class="arg">G</i>.</p>
<p>It can be proven that solution found with the algorithm must fulfil inequality:</p>
<p><i class="term">((|W| + k - 1) / |W|) &lt;= ALG &lt;= 2*OPT + log2(n) + 1</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Undirected simple graph.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Algorithm returns graph structure, which is equivalent to spanning tree <i class="term">T</i> found by algorithm.</p></dd>
</dl></dd>
<dt><a name="37"><b class="cmd">struct::graph::op::MaximumFlowByDinic</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">t</i> <i class="arg">blockingFlowAlg</i></a></dt>
<dd><p>Algorithm finds <span class="sectref"><a href="#subsection6">maximum flow</a></span> for the flow network represented by graph <i class="arg">G</i>. It is based on
the blocking-flow finding methods, which give us different complexities what makes a better fit for
different graphs.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Directed graph <i class="arg">G</i> representing the flow network. Each edge should have attribute 
<i class="term">throughput</i> set with integer value.</p></dd>
<dt>Node <i class="arg">s</i> (input)</dt>
<dd><p>The source node for the flow network <i class="arg">G</i>.</p></dd>
<dt>Node <i class="arg">t</i> (input)</dt>
<dd><p>The sink node for the flow network <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Options:</dt>
<dd><dl class="options">
<dt><b class="option">dinic</b></dt>
<dd><p>Procedure will find maximum flow for flow network <i class="arg">G</i> using Dinic's algorithm (<b class="cmd">struct::graph::op::BlockingFlowByDinic</b>)
for blocking flow computation.</p></dd>
<dt><b class="option">mkm</b></dt>
<dd><p>Procedure will find maximum flow for flow network <i class="arg">G</i> using Malhotra, Kumar and Maheshwari's algorithm (<b class="cmd">struct::graph::op::BlockingFlowByMKM</b>)
for blocking flow computation.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Algorithm returns dictionary containing it's flow value for each edge (key) in network <i class="arg">G</i>.</p></dd>
</dl>
<p><em>Note:</em> <b class="cmd">struct::graph::op::BlockingFlowByDinic</b> gives <i class="term">O(m*n^2)</i> complexity and
<b class="cmd">struct::graph::op::BlockingFlowByMKM</b> gives <i class="term">O(n^3)</i> complexity, where <i class="term">n</i> is the number of nodes
and <i class="term">m</i> is the number of edges in flow network <i class="arg">G</i>.</p></dd>
<dt><a name="38"><b class="cmd">struct::graph::op::BlockingFlowByDinic</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">t</i></a></dt>
<dd><p>Algorithm for given network <i class="arg">G</i> with source <i class="arg">s</i> and sink <i class="arg">t</i>, finds a <span class="sectref"><a href="#subsection6">blocking
flow</a></span>, which can be used to obtain a <i class="term"><a href="../../../../index.html#key447">maximum flow</a></i> for that network <i class="arg">G</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Directed graph <i class="arg">G</i> representing the flow network. Each edge should have attribute 
<i class="term">throughput</i> set with integer value.</p></dd>
<dt>Node <i class="arg">s</i> (input)</dt>
<dd><p>The source node for the flow network <i class="arg">G</i>.</p></dd>
<dt>Node <i class="arg">t</i> (input)</dt>
<dd><p>The sink node for the flow network <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Algorithm returns dictionary containing it's blocking flow value for each edge (key) in network <i class="arg">G</i>.</p></dd>
</dl>
<p><em>Note:</em> Algorithm's complexity is <i class="term">O(n*m)</i>, where <i class="term">n</i> is the number of nodes
and <i class="term">m</i> is the number of edges in flow network <i class="arg">G</i>.</p></dd>
<dt><a name="39"><b class="cmd">struct::graph::op::BlockingFlowByMKM</b> <i class="arg">G</i> <i class="arg">s</i> <i class="arg">t</i></a></dt>
<dd><p>Algorithm for given network <i class="arg">G</i> with source <i class="arg">s</i> and sink <i class="arg">t</i>, finds a <span class="sectref"><a href="#subsection6">blocking
flow</a></span>, which can be used to obtain a <i class="term"><a href="../../../../index.html#key447">maximum flow</a></i> for that <i class="term"><a href="../../../../index.html#key624">network</a></i> <i class="arg">G</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Directed graph <i class="arg">G</i> representing the flow network. Each edge should have attribute 
<i class="term">throughput</i> set with integer value.</p></dd>
<dt>Node <i class="arg">s</i> (input)</dt>
<dd><p>The source node for the flow network <i class="arg">G</i>.</p></dd>
<dt>Node <i class="arg">t</i> (input)</dt>
<dd><p>The sink node for the flow network <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Algorithm returns dictionary containing it's blocking flow value for each edge (key) in network <i class="arg">G</i>.</p></dd>
</dl>
<p><em>Note:</em> Algorithm's complexity is <i class="term">O(n^2)</i>, where <i class="term">n</i> is the number of nodes in flow network <i class="arg">G</i>.</p></dd>
<dt><a name="40"><b class="cmd">struct::graph::op::createResidualGraph</b> <i class="arg">G</i> <i class="arg">f</i></a></dt>
<dd><p>Procedure creates a <i class="term"><a href="../../../../index.html#key414">residual graph</a></i> (or <span class="sectref"><a href="#subsection6">residual network</a></span> ) for network <i class="arg">G</i> and given
flow <i class="arg">f</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Flow network (directed graph where each edge has set attribute: <i class="term">throughput</i> ).</p></dd>
<dt>dictionary <i class="arg">f</i> (input)</dt>
<dd><p>Current flows in flow network <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Procedure returns graph structure that is a <i class="term"><a href="../../../../index.html#key414">residual graph</a></i> created from input flow
network <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt><a name="41"><b class="cmd">struct::graph::op::createAugmentingNetwork</b> <i class="arg">G</i> <i class="arg">f</i> <i class="arg">path</i></a></dt>
<dd><p>Procedure creates an <span class="sectref"><a href="#subsection6">augmenting network</a></span> for a given residual network <i class="arg">G</i> 
, flow <i class="arg">f</i> and augmenting path <i class="arg">path</i>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Residual network (directed graph), where for every edge there are set two attributes: throughput and cost.</p></dd>
<dt>Dictionary <i class="arg">f</i> (input)</dt>
<dd><p>Dictionary which contains for every edge (key), current value of the flow on that edge.</p></dd>
<dt>List <i class="arg">path</i> (input)</dt>
<dd><p>Augmenting path, set of edges (list) for which we create the network modification.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Algorithm returns graph structure containing the modified augmenting network.</p></dd>
</dl></dd>
<dt><a name="42"><b class="cmd">struct::graph::op::createLevelGraph</b> <i class="arg">Gf</i> <i class="arg">s</i></a></dt>
<dd><p>For given residual graph <i class="arg">Gf</i> procedure finds the <span class="sectref"><a href="#subsection6">level graph</a></span>.</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">Gf</i> (input)</dt>
<dd><p>Residual network, where each edge has it's attribute <i class="term">throughput</i> set with certain value.</p></dd>
<dt>Node <i class="arg">s</i> (input)</dt>
<dd><p>The source node for the residual network <i class="arg">Gf</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Procedure returns a <i class="term"><a href="../../../../index.html#key436">level graph</a></i> created from input <i class="term">residual network</i>.</p></dd>
</dl></dd>
<dt><a name="43"><b class="cmd">struct::graph::op::TSPLocalSearching</b> <i class="arg">G</i> <i class="arg">C</i></a></dt>
<dd><p>Algorithm is a <i class="term">heuristic of local searching</i> for <i class="term">Travelling Salesman Problem</i>. For some
solution of <i class="term">TSP problem</i>, it checks if it's possible to find a better solution. As <i class="term">TSP</i>
is well known NP-Complete problem, so algorithm is a approximation algorithm (with 2 approximation factor).</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Undirected and complete graph with attributes &quot;weight&quot; set on each single edge.</p></dd>
<dt>List <i class="arg">C</i> (input)</dt>
<dd><p>A list of edges being <i class="term">Hamiltonian cycle</i>, which is solution of <i class="term">TSP Problem</i> for graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Algorithm returns the best solution for <i class="term">TSP problem</i>, it was able to find.</p></dd>
</dl>
<p><em>Note:</em> The solution depends on the choosing of the beginning cycle <i class="arg">C</i>. It's not true that better cycle
assures that better solution will be found, but practise shows that we should give starting cycle with as small
sum of weights as possible.</p></dd>
<dt><a name="44"><b class="cmd">struct::graph::op::TSPLocalSearching3Approx</b> <i class="arg">G</i> <i class="arg">C</i></a></dt>
<dd><p>Algorithm is a <i class="term">heuristic of local searching</i> for <i class="term">Travelling Salesman Problem</i>. For some
solution of <i class="term">TSP problem</i>, it checks if it's possible to find a better solution. As <i class="term">TSP</i>
is well known NP-Complete problem, so algorithm is a approximation algorithm (with 3 approximation factor).</p>
<dl class="definitions">
<dt>Arguments:</dt>
<dd><dl class="arguments">
<dt>Graph Object <i class="arg">G</i> (input)</dt>
<dd><p>Undirected and complete graph with attributes &quot;weight&quot; set on each single edge.</p></dd>
<dt>List <i class="arg">C</i> (input)</dt>
<dd><p>A list of edges being <i class="term">Hamiltonian cycle</i>, which is solution of <i class="term">TSP Problem</i> for graph <i class="arg">G</i>.</p></dd>
</dl></dd>
<dt>Result:</dt>
<dd><p>Algorithm returns the best solution for <i class="term">TSP problem</i>, it was able to find.</p></dd>
</dl>
<p><em>Note:</em> In practise 3-approximation algorithm turns out to be far more effective than 2-approximation, but it gives
worser approximation factor. Further heuristics of local searching (e.g. 4-approximation) doesn't give enough boost to 
square the increase of approximation factor, so 2 and 3 approximations are mainly used.</p></dd>
<dt><a name="45"><b class="cmd">struct::graph::op::createSquaredGraph</b> <i class="arg">G</i></a></dt>
<dd><p>X-Squared graph is a graph with the same set of nodes as input graph <i class="arg">G</i>, but a different set of edges. X-Squared graph
has edge <i class="term">(u,v)</i>, if and only if, the distance between <i class="term">u</i> and <i class="term">v</i> nodes is not greater than X and <i class="term">u != v</i>.</p>
<p>Procedure for input graph <i class="arg">G</i>, returns its two-squared graph.</p>
<p><em>Note:</em> Distances used in choosing new set of edges are considering the number of edges, not the sum of weights at edges.</p></dd>
<dt><a name="46"><b class="cmd">struct::graph::op::createCompleteGraph</b> <i class="arg">G</i> <i class="arg">originalEdges</i></a></dt>
<dd><p>For input graph <i class="arg">G</i> procedure adds missing arcs to make it a <i class="term"><a href="../../../../index.html#key438">complete graph</a></i>. It also holds in
variable <i class="arg">originalEdges</i> the set of arcs that graph <i class="arg">G</i> possessed before that operation.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Background theory and terms</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Shortest Path Problem</a></h3>
<dl class="definitions">
<dt>Definition (<i class="term">single-pair shortest path problem</i>):</dt>
<dd><p>Formally, given a weighted graph (let <i class="term">V</i> be the set of vertices, and <i class="term"><a href="../../../../index.html#key744">E</a></i> a set of edges),
and one vertice <i class="term">v</i> of <i class="term">V</i>, find a path <i class="term">P</i> from <i class="term">v</i> to a <i class="term">v'</i> of V so that
the sum of weights on edges along the path is minimal among all paths connecting v to v'.</p></dd>
<dt>Generalizations:</dt>
<dd><ul class="itemized">
<li><p><i class="term">The single-source shortest path problem</i>, in which we have to find shortest paths from a source vertex v to all other vertices in the graph.</p></li>
<li><p><i class="term">The single-destination shortest path problem</i>, in which we have to find shortest paths from all vertices in the graph to a single destination vertex v. This can be reduced to the single-source shortest path problem by reversing the edges in the graph.</p></li>
<li><p><i class="term">The all-pairs shortest path problem</i>, in which we have to find shortest paths between every pair of vertices v, v' in the graph.</p></li>
</ul>
<p><em>Note:</em>
The result of <i class="term">Shortest Path problem</i> can be <i class="term">Shortest Path tree</i>, which is a subgraph of a given (possibly weighted) graph constructed so that the
distance between a selected root node and all other nodes is minimal. It is a tree because if there are two paths between the root node and some
vertex v (i.e. a cycle), we can delete the last edge of the longer path without increasing the distance from the root node to any node in the subgraph.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Travelling Salesman Problem</a></h3>
<dl class="definitions">
<dt>Definition:</dt>
<dd><p>For given edge-weighted (weights on edges should be positive) graph the goal is to find the cycle that visits each node in graph 
exactly once (<i class="term">Hamiltonian cycle</i>).</p></dd>
<dt>Generalizations:</dt>
<dd><ul class="itemized">
<li><p><i class="term">Metric TSP</i> - A very natural restriction of the <i class="term">TSP</i> is to require that the distances between cities form a <i class="term">metric</i>, i.e.,
they satisfy <i class="term">the triangle inequality</i>. That is, for any 3 cities <i class="term">A</i>, <i class="term">B</i> and <i class="term"><a href="../../../../index.html#key476">C</a></i>, the distance between <i class="term">A</i> and <i class="term"><a href="../../../../index.html#key476">C</a></i>
must be at most the distance from <i class="term">A</i> to <i class="term">B</i> plus the distance from <i class="term">B</i> to <i class="term"><a href="../../../../index.html#key476">C</a></i>. Most natural instances of <i class="term">TSP</i> 
satisfy this constraint.</p></li>
<li><p><i class="term">Euclidean TSP</i> - Euclidean TSP, or <i class="term">planar TSP</i>, is the <i class="term">TSP</i> with the distance being the ordinary <i class="term">Euclidean distance</i>. 
<i class="term">Euclidean TSP</i> is a particular case of <i class="term">TSP</i> with <i class="term">triangle inequality</i>, since distances in plane obey triangle inequality. However,
it seems to be easier than general <i class="term">TSP</i> with <i class="term">triangle inequality</i>. For example, <i class="term">the minimum spanning tree</i> of the graph associated 
with an instance of <i class="term">Euclidean TSP</i> is a <i class="term">Euclidean minimum spanning tree</i>, and so can be computed in expected <i class="term">O(n log n)</i> time for 
<i class="term">n</i> points (considerably less than the number of edges). This enables the simple <i class="term">2-approximation algorithm</i> for TSP with triangle 
inequality above to operate more quickly.</p></li>
<li><p><i class="term">Asymmetric TSP</i> - In most cases, the distance between two nodes in the <i class="term">TSP</i> network is the same in both directions.
The case where the distance from <i class="term">A</i> to <i class="term">B</i> is not equal to the distance from <i class="term">B</i> to <i class="term">A</i> is called <i class="term">asymmetric TSP</i>.
A practical application of an <i class="term">asymmetric TSP</i> is route optimisation using street-level routing (asymmetric due to one-way streets, 
slip-roads and motorways).</p></li>
</ul></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Matching Problem</a></h3>
<dl class="definitions">
<dt>Definition:</dt>
<dd><p>Given a graph <i class="term">G = (V,E)</i>, a matching or <i class="term">edge-independent set</i> <i class="term">M</i> in <i class="term">G</i> is a set of pairwise non-adjacent edges,
that is, no two edges share a common vertex. A vertex is <i class="term">matched</i> if it is incident to an edge in the <i class="term">matching M</i>.
Otherwise the vertex is <i class="term">unmatched</i>.</p></dd>
<dt>Generalizations:</dt>
<dd><ul class="itemized">
<li><p><i class="term">Maximal matching</i> - a matching <i class="term">M</i> of a graph G with the property that if any edge not in <i class="term">M</i> is added to <i class="term">M</i>,
it is no longer a <i class="term"><a href="../../../../index.html#key11">matching</a></i>, that is, <i class="term">M</i> is maximal if it is not a proper subset of any other <i class="term"><a href="../../../../index.html#key11">matching</a></i> in graph G. 
In other words, a <i class="term">matching M</i> of a graph G is maximal if every edge in G has a non-empty intersection with at least one edge in <i class="term">M</i>.</p></li>
<li><p><i class="term">Maximum matching</i> - a matching that contains the largest possible number of edges. There may be many <i class="term">maximum matchings</i>.
The <i class="term">matching number</i> of a graph G is the size of a <i class="term">maximum matching</i>. Note that every <i class="term">maximum matching</i> is <i class="term">maximal</i>,
but not every <i class="term">maximal matching</i> is a <i class="term">maximum matching</i>.</p></li>
<li><p><i class="term">Perfect matching</i> - a matching which matches all vertices of the graph. That is, every vertex of the graph is incident to exactly one
edge of the matching. Every <i class="term">perfect matching</i> is <i class="term"><a href="../../../../index.html#key262">maximum</a></i> and hence <i class="term">maximal</i>. In some literature, the term <i class="term">complete matching</i>
is used. A <i class="term">perfect matching</i> is also a <i class="term">minimum-size edge cover</i>. Moreover, the size of a <i class="term">maximum matching</i> is no larger than the 
size of a <i class="term">minimum edge cover</i>.</p></li>
<li><p><i class="term">Near-perfect matching</i> - a matching in which exactly one vertex is unmatched. This can only occur when the graph has an odd number of vertices,
and such a <i class="term"><a href="../../../../index.html#key11">matching</a></i> must be <i class="term"><a href="../../../../index.html#key262">maximum</a></i>. If, for every vertex in a graph, there is a near-perfect matching that omits only that vertex, the graph
is also called <i class="term">factor-critical</i>.</p></li>
</ul></dd>
<dt>Related terms:</dt>
<dd><ul class="itemized">
<li><p><i class="term">Alternating path</i> - given a matching <i class="term">M</i>, an <i class="term">alternating path</i> is a path in which the edges belong alternatively
to the matching and not to the matching.</p></li>
<li><p><i class="term"><a href="../../../../index.html#key439">Augmenting path</a></i> - given a matching <i class="term">M</i>, an <i class="term"><a href="../../../../index.html#key439">augmenting path</a></i> is an <i class="term">alternating path</i> that starts from 
and ends on free (unmatched) vertices.</p></li>
</ul></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Cut Problems</a></h3>
<dl class="definitions">
<dt>Definition:</dt>
<dd><p>A <i class="term">cut</i> is a partition of the vertices of a graph into two <i class="term">disjoint subsets</i>. The <i class="term">cut-set</i> of the <i class="term">cut</i> is the 
set of edges whose end points are in different subsets of the partition. Edges are said to be crossing the cut if they are in its <i class="term">cut-set</i>.</p>
<p>Formally:</p>
<ul class="itemized">
<li><p>a <i class="term">cut</i> <i class="term">C = (S,T)</i> is a partition of <i class="term">V</i> of a graph <i class="term">G = (V, E)</i>.</p></li>
<li><p>an <i class="term">s-t cut</i> <i class="term">C = (S,T)</i> of a <i class="term"><a href="../../../../index.html#key448">flow network</a></i> <i class="term">N = (V, E)</i> is a cut of <i class="term">N</i> such that <i class="term">s</i> is included in <i class="term">S</i>
and <i class="term">t</i> is included in <i class="term">T</i>, where <i class="term">s</i> and <i class="term">t</i> are the <i class="term"><a href="../../../../index.html#key388">source</a></i> and the <i class="term">sink</i> of <i class="term">N</i> respectively.</p></li>
<li><p>The <i class="term">cut-set</i> of a <i class="term">cut C = (S,T)</i> is such set of edges from graph <i class="term">G = (V, E)</i> that each edge <i class="term">(u, v)</i> satisfies
condition that <i class="term">u</i> is included in <i class="term">S</i> and <i class="term">v</i> is included in <i class="term">T</i>.</p></li>
</ul>
<p>In an <i class="term">unweighted undirected</i> graph, the size or weight of a cut is the number of edges crossing the cut. In a <i class="term">weighted graph</i>,
the same term is defined by the sum of the weights of the edges crossing the cut.</p>
<p>In a <i class="term"><a href="../../../../index.html#key448">flow network</a></i>, an <i class="term">s-t cut</i> is a cut that requires the <i class="term"><a href="../../../../index.html#key388">source</a></i> and the <i class="term">sink</i> to be in different subsets,
and its <i class="term">cut-set</i> only consists of edges going from the <i class="term">source's</i> side to the <i class="term">sink's</i> side. The capacity of an <i class="term">s-t cut</i>
is defined by the sum of capacity of each edge in the <i class="term">cut-set</i>.</p>
<p>The <i class="term">cut</i> of a graph can sometimes refer to its <i class="term">cut-set</i> instead of the partition.</p></dd>
<dt>Generalizations:</dt>
<dd><ul class="itemized">
<li><p><i class="term">Minimum cut</i> - A cut is minimum if the size of the cut is not larger than the size of any other cut.</p></li>
<li><p><i class="term">Maximum cut</i> - A cut is maximum if the size of the cut is not smaller than the size of any other cut.</p></li>
<li><p><i class="term">Sparsest cut</i> - The <i class="term">Sparsest cut problem</i> is to bipartition the vertices so as to minimize the ratio of the number
of edges across the cut divided by the number of vertices in the smaller half of the partition.</p></li>
</ul></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">K-Center Problem</a></h3>
<dl class="definitions">
<dt>Definitions:</dt>
<dd><dl class="definitions">
<dt><i class="term">Unweighted K-Center</i></dt>
<dd><p>For any set <i class="term">S</i> ( which is subset of <i class="term">V</i> ) and node <i class="term">v</i>, let the <i class="term">connect(v,S)</i> be the
cost of cheapest edge connecting <i class="term">v</i> with any node in <i class="term">S</i>. The goal is to find
such <i class="term">S</i>, that <i class="term">|S| = k</i> and <i class="term">max_v{connect(v,S)}</i> is possibly small.</p>
<p>In other words, we can use it i.e. for finding best locations in the city ( nodes
of input graph ) for placing k buildings, such that those buildings will be as close
as possible to all other locations in town.</p></dd>
<dt><i class="term">Weighted K-Center</i></dt>
<dd><p>The variation of <i class="term">unweighted k-center problem</i>. Besides the fact graph is edge-weighted,
there are also weights on vertices of input graph <i class="arg">G</i>. We've got also restriction
<i class="arg">W</i>. The goal is to choose such set of nodes <i class="term">S</i> ( which is a subset of <i class="term">V</i> ), that it's
total weight is not greater than <i class="arg">W</i> and also function: <i class="term">max_v { min_u { cost(u,v) }}</i>
has the smallest possible worth ( <i class="term">v</i> is a node in <i class="term">V</i> and <i class="term">u</i> is a node in <i class="term">S</i> ).</p></dd>
</dl></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Flow Problems</a></h3>
<dl class="definitions">
<dt>Definitions:</dt>
<dd><ul class="itemized">
<li><p><i class="term">the maximum flow problem</i> - the goal is to find a feasible flow through a single-source, single-sink flow network that is maximum.
The <i class="term">maximum flow problem</i> can be seen as a special case of more complex network flow problems, such as the <i class="term">circulation problem</i>.
The maximum value of an <i class="term">s-t flow</i> is equal to the minimum capacity of an <i class="term">s-t cut</i> in the network, as stated in the
<i class="term">max-flow min-cut theorem</i>.</p>
<p>More formally for flow network <i class="term">G = (V,E)</i>, where for each edge <i class="term">(u, v)</i> we have its throuhgput <i class="term">c(u,v)</i> defined. As <i class="term"><a href="../../../../index.html#key129">flow</a></i>
<i class="term">F</i> we define set of non-negative integer attributes <i class="term">f(u,v)</i> assigned to edges, satisfying such conditions:</p>
<ol class="enumerated">
<li><p>for each edge <i class="term">(u, v)</i> in <i class="term">G</i> such condition should be satisfied:      0 &lt;= f(u,v) &lt;= c(u,v)</p></li>
<li><p>Network <i class="term">G</i> has source node <i class="term">s</i> such that the flow <i class="term">F</i> is equal to the sum of outcoming flow decreased by the sum of incoming flow from that source node <i class="term">s</i>.</p></li>
<li><p>Network <i class="term">G</i> has sink node <i class="term">t</i> such that the the <i class="term">-F</i> value is equal to the sum of the incoming flow decreased by the sum of outcoming flow from that sink node <i class="term">t</i>.</p></li>
<li><p>For each node that is not a <i class="term"><a href="../../../../index.html#key388">source</a></i> or <i class="term">sink</i> the sum of incoming flow and sum of outcoming flow should be equal.</p></li>
</ol>
</li>
<li><p><i class="term">the minimum cost flow problem</i> - the goal is finding the cheapest possible way of sending a certain amount of flow through a <i class="term"><a href="../../../../index.html#key448">flow network</a></i>.</p></li>
<li><p><i class="term"><a href="../../../../index.html#key405">blocking flow</a></i> - a <i class="term"><a href="../../../../index.html#key405">blocking flow</a></i> for a <i class="term">residual network</i> <i class="term">Gf</i> we name such flow <i class="term">b</i> in <i class="term">Gf</i> that:</p>
<ol class="enumerated">
<li><p>Each path from <i class="term">sink</i> to <i class="term"><a href="../../../../index.html#key388">source</a></i> is the shortest path in <i class="term">Gf</i>.</p></li>
<li><p>Each shortest path in <i class="term">Gf</i> contains an edge with fully used throughput in <i class="term">Gf+b</i>.</p></li>
</ol>
</li>
<li><p><i class="term">residual network</i> - for a flow network <i class="term">G</i> and flow <i class="term">f</i> <i class="term">residual network</i> is built with those edges, which can
send larger flow. It contains only those edges, which can send flow larger than 0.</p></li>
<li><p><i class="term">level network</i> - it has the same set of nodes as <i class="term"><a href="../../../../index.html#key414">residual graph</a></i>, but has only those edges <i class="term">(u,v)</i> from <i class="arg">Gf</i>
for which such equality is satisfied: <i class="term">distance(s,u)+1 = distance(s,v)</i>.</p></li>
<li><p><i class="term"><a href="../../../../index.html#key419">augmenting network</a></i> - it is a modification of <i class="term">residual network</i> considering the new
flow values. Structure stays unchanged but values of throughputs and costs at edges
are different.</p></li>
</ul></dd>
</dl>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Approximation algorithm</a></h3>
<dl class="definitions">
<dt>k-approximation algorithm:</dt>
<dd><p>Algorithm is a k-approximation, when for <i class="term">ALG</i> (solution returned by algorithm) and
<i class="term">OPT</i> (optimal solution), such inequality is true:</p>
<ul class="itemized">
<li><p>for minimalization problems: <i class="term">ALG/OPT &lt;= k</i></p></li>
<li><p>for maximalization problems: <i class="term">OPT/ALG &lt;= k</i></p></li>
</ul></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://en.wikipedia.org/wiki/Adjacency_matrix">Adjacency matrix</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Adjacency_list">Adjacency list</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Kruskal%27s_algorithm">Kruskal's algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Prim%27s_algorithm">Prim's algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Bipartite_graph">Bipartite graph</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Strongly_connected_components">Strongly connected components</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm">Tarjan's strongly connected components algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Cut_vertex">Cut vertex</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Bridge_(graph_theory)">Bridge</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Bellman-Ford_algorithm">Bellman-Ford's algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Johnson_algorithm">Johnson's algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Floyd-Warshall_algorithm">Floyd-Warshall's algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Travelling_salesman_problem">Travelling Salesman Problem</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Christofides_algorithm">Christofides Algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Maxcut">Max Cut</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Matching">Matching</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Maximal_independent_set">Max Independent Set</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Vertex_cover_problem">Vertex Cover</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Ford-Fulkerson_algorithm">Ford-Fulkerson's algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Maximum_flow_problem">Maximum Flow problem</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Minimum_cost_flow_problem">Busacker-Gowen's algorithm</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Dinic's_algorithm">Dinic's algorithm</a></p></li>
<li><p><a href="http://www.csc.kth.se/~viggo/wwwcompendium/node128.html">K-Center problem</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Breadth-first_search">BFS</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Degree-constrained_spanning_tree">Minimum Degree Spanning Tree</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Approximation_algorithm">Approximation algorithm</a></p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: graph</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key417">adjacency list</a>, <a href="../../../../index.html#key441">adjacency matrix</a>, <a href="../../../../index.html#key434">adjacent</a>, <a href="../../../../index.html#key443">approximation algorithm</a>, <a href="../../../../index.html#key422">arc</a>, <a href="../../../../index.html#key432">articulation point</a>, <a href="../../../../index.html#key419">augmenting network</a>, <a href="../../../../index.html#key439">augmenting path</a>, <a href="../../../../index.html#key415">bfs</a>, <a href="../../../../index.html#key445">bipartite</a>, <a href="../../../../index.html#key405">blocking flow</a>, <a href="../../../../index.html#key416">bridge</a>, <a href="../../../../index.html#key438">complete graph</a>, <a href="../../../../index.html#key430">connected component</a>, <a href="../../../../index.html#key433">cut edge</a>, <a href="../../../../index.html#key435">cut vertex</a>, <a href="../../../../index.html#key425">degree</a>, <a href="../../../../index.html#key424">degree constrained spanning tree</a>, <a href="../../../../index.html#key407">diameter</a>, <a href="../../../../index.html#key444">dijkstra</a>, <a href="../../../../index.html#key428">distance</a>, <a href="../../../../index.html#key450">eccentricity</a>, <a href="../../../../index.html#key409">edge</a>, <a href="../../../../index.html#key448">flow network</a>, <a href="../../../../index.html#key256">graph</a>, <a href="../../../../index.html#key423">heuristic</a>, <a href="../../../../index.html#key420">independent set</a>, <a href="../../../../index.html#key440">isthmus</a>, <a href="../../../../index.html#key436">level graph</a>, <a href="../../../../index.html#key431">local searching</a>, <a href="../../../../index.html#key406">loop</a>, <a href="../../../../index.html#key11">matching</a>, <a href="../../../../index.html#key427">max cut</a>, <a href="../../../../index.html#key447">maximum flow</a>, <a href="../../../../index.html#key410">minimal spanning tree</a>, <a href="../../../../index.html#key421">minimum cost flow</a>, <a href="../../../../index.html#key413">minimum degree spanning tree</a>, <a href="../../../../index.html#key449">minimum diameter spanning tree</a>, <a href="../../../../index.html#key437">neighbour</a>, <a href="../../../../index.html#key412">node</a>, <a href="../../../../index.html#key418">radius</a>, <a href="../../../../index.html#key414">residual graph</a>, <a href="../../../../index.html#key426">shortest path</a>, <a href="../../../../index.html#key442">squared graph</a>, <a href="../../../../index.html#key404">strongly connected component</a>, <a href="../../../../index.html#key429">subgraph</a>, <a href="../../../../index.html#key408">travelling salesman</a>, <a href="../../../../index.html#key411">vertex</a>, <a href="../../../../index.html#key446">vertex cover</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Alejandro Paz &lt;[email protected]&gt;<br>
Copyright &copy; 2008 (docs) Andreas Kupries &lt;[email protected]&gt;<br>
Copyright &copy; 2009 Michal Antoniewski &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/matrix.html.













































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::matrix - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/matrix.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::matrix.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::matrix(n) 2.0.1 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::matrix - Create and manipulate matrix objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::matrix <span class="opt">?2.0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::struct::matrix</b> <span class="opt">?<i class="arg">matrixName</i>?</span> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">source</i>?</span></a></li>
<li><a href="#2"><b class="cmd">matrixName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">matrixName</i> <b class="method">=</b> <i class="arg">sourcematrix</i></a></li>
<li><a href="#4"><i class="arg">matrixName</i> <b class="method">--&gt;</b> <i class="arg">destmatrix</i></a></li>
<li><a href="#5"><i class="arg">matrixName</i> <b class="method">add column</b> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#6"><i class="arg">matrixName</i> <b class="method">add row</b> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#7"><i class="arg">matrixName</i> <b class="method">add columns</b> <i class="arg">n</i></a></li>
<li><a href="#8"><i class="arg">matrixName</i> <b class="method">add rows</b> <i class="arg">n</i></a></li>
<li><a href="#9"><i class="arg">matrixName</i> <b class="method">cells</b></a></li>
<li><a href="#10"><i class="arg">matrixName</i> <b class="method">cellsize</b> <i class="arg">column row</i></a></li>
<li><a href="#11"><i class="arg">matrixName</i> <b class="method">columns</b></a></li>
<li><a href="#12"><i class="arg">matrixName</i> <b class="method">columnwidth</b> <i class="arg">column</i></a></li>
<li><a href="#13"><i class="arg">matrixName</i> <b class="method">delete column</b> <i class="arg">column</i></a></li>
<li><a href="#14"><i class="arg">matrixName</i> <b class="method">delete columns</b> <i class="arg">n</i></a></li>
<li><a href="#15"><i class="arg">matrixName</i> <b class="method">delete row</b> <i class="arg">row</i></a></li>
<li><a href="#16"><i class="arg">matrixName</i> <b class="method">delete rows</b> <i class="arg">n</i></a></li>
<li><a href="#17"><i class="arg">matrixName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></li>
<li><a href="#18"><i class="arg">matrixName</i> <b class="method">destroy</b></a></li>
<li><a href="#19"><i class="arg">matrixName</i> <b class="method">format 2string</b> <span class="opt">?<i class="arg">report</i>?</span></a></li>
<li><a href="#20"><i class="arg">matrixName</i> <b class="method">format 2chan</b> <span class="opt">?<span class="opt">?<i class="arg">report</i>?</span> <i class="arg">channel</i>?</span></a></li>
<li><a href="#21"><i class="arg">matrixName</i> <b class="method">get cell</b> <i class="arg">column row</i></a></li>
<li><a href="#22"><i class="arg">matrixName</i> <b class="method">get column</b> <i class="arg">column</i></a></li>
<li><a href="#23"><i class="arg">matrixName</i> <b class="method">get rect</b> <i class="arg">column_tl row_tl column_br row_br</i></a></li>
<li><a href="#24"><i class="arg">matrixName</i> <b class="method">get row</b> <i class="arg">row</i></a></li>
<li><a href="#25"><i class="arg">matrixName</i> <b class="method">insert column</b> <i class="arg">column</i> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#26"><i class="arg">matrixName</i> <b class="method">insert row</b> <i class="arg">row</i> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#27"><i class="arg">matrixName</i> <b class="method">link</b> <span class="opt">?-transpose?</span> <i class="arg">arrayvar</i></a></li>
<li><a href="#28"><i class="arg">matrixName</i> <b class="method">links</b></a></li>
<li><a href="#29"><i class="arg">matrixName</i> <b class="method">rowheight</b> <i class="arg">row</i></a></li>
<li><a href="#30"><i class="arg">matrixName</i> <b class="method">rows</b></a></li>
<li><a href="#31"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">all</b> <i class="arg">pattern</i></a></li>
<li><a href="#32"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">column</b> <i class="arg">column pattern</i></a></li>
<li><a href="#33"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">row</b> <i class="arg">row pattern</i></a></li>
<li><a href="#34"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">rect</b> <i class="arg">column_tl row_tl column_br row_br pattern</i></a></li>
<li><a href="#35"><i class="arg">matrixName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">column_tl row_tl column_br row_br</i>?</span></a></li>
<li><a href="#36"><i class="arg">matrixName</i> <b class="method">set cell</b> <i class="arg">column row value</i></a></li>
<li><a href="#37"><i class="arg">matrixName</i> <b class="method">set column</b> <i class="arg">column values</i></a></li>
<li><a href="#38"><i class="arg">matrixName</i> <b class="method">set rect</b> <i class="arg">column row values</i></a></li>
<li><a href="#39"><i class="arg">matrixName</i> <b class="method">set row</b> <i class="arg">row values</i></a></li>
<li><a href="#40"><i class="arg">matrixName</i> <b class="method">sort columns</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">row</i></a></li>
<li><a href="#41"><i class="arg">matrixName</i> <b class="method">sort rows</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">column</i></a></li>
<li><a href="#42"><i class="arg">matrixName</i> <b class="method">swap columns</b> <i class="arg">column_a column_b</i></a></li>
<li><a href="#43"><i class="arg">matrixName</i> <b class="method">swap rows</b> <i class="arg">row_a row_b</i></a></li>
<li><a href="#44"><i class="arg">matrixName</i> <b class="method">transpose</b></a></li>
<li><a href="#45"><i class="arg">matrixName</i> <b class="method">unlink</b> <i class="arg">arrayvar</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>A matrix is a rectangular collection of cells, i.e. organized in rows
and columns. Each cell contains exactly one value of arbitrary
form. The cells in the matrix are addressed by pairs of integer
numbers, with the first (left) number in the pair specifying the
column and the second (right) number specifying the row the cell is
in. These indices are counted from 0 upward. The special non-numeric
index <b class="const">end</b> refers to the last row or column in the matrix,
depending on the context. Indices of the form
<b class="const">end</b>-<b class="variable">number</b> are counted from the end of the row or
column, like they are for standard Tcl lists. Trying to access
non-existing cells causes an error.</p>
<p>The matrices here are created empty, i.e. they have neither rows nor
columns. The user then has to add rows and columns as needed by his
application. A specialty of this structure is the ability to export an
array-view onto its contents. Such can be used by tkTable, for
example, to link the matrix into the display.</p>
<p>The main command of the package is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::struct::matrix</b> <span class="opt">?<i class="arg">matrixName</i>?</span> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">source</i>?</span></a></dt>
<dd><p>The command creates a new matrix object with an associated global Tcl
command whose name is <i class="arg">matrixName</i>.  This command may be used to
invoke various operations on the matrix.  It has the following general
form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">matrixName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>If <i class="arg">matrixName</i> is not specified a unique name will be generated
by the package itself. If a <i class="arg">source</i> is specified the new matrix
will be initialized to it. For the operators <b class="const">=</b>, <b class="const">:=</b>,
and <b class="const">as</b> the argument <i class="arg">source</i> is interpreted as the name of
another matrix object, and the assignment operator <b class="method">=</b> will be
executed. For <b class="const">deserialize</b> the <i class="arg">source</i> is a serialized
matrix object and <b class="method">deserialize</b> will be executed.</p>
<p>In other words</p>
<pre class="example">
    ::struct::matrix mymatrix = b
</pre>
<p>is equivalent to</p>
<pre class="example">
    ::struct::matrix mymatrix
    mymatrix = b
</pre>
<p>and</p>
<pre class="example">
    ::struct::matrix mymatrix deserialize $b
</pre>
<p>is equivalent to</p>
<pre class="example">
    ::struct::matrix mymatrix
    mymatrix deserialize $b
</pre>
</dd>
</dl>
<p>The following commands are possible for matrix objects:</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">matrixName</i> <b class="method">=</b> <i class="arg">sourcematrix</i></a></dt>
<dd><p>This is the assignment operator for matrix objects. It copies the matrix
contained in the matrix object <i class="arg">sourcematrix</i> over the matrix data in
<i class="arg">matrixName</i>. The old contents of <i class="arg">matrixName</i> are deleted by
this operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">matrixName</i> <b class="method">deserialize</b> [<i class="arg">sourcematrix</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="4"><i class="arg">matrixName</i> <b class="method">--&gt;</b> <i class="arg">destmatrix</i></a></dt>
<dd><p>This is the reverse assignment operator for matrix objects. It copies
the matrix contained in the matrix object <i class="arg">matrixName</i> over the matrix
data in the object <i class="arg">destmatrix</i>.
The old contents of <i class="arg">destmatrix</i> are deleted by this operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">destmatrix</i> <b class="method">deserialize</b> [<i class="arg">matrixName</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="5"><i class="arg">matrixName</i> <b class="method">add column</b> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one column and then acts like <b class="method">set column</b>
(see below) on this new column if there were <i class="arg">values</i>
supplied. Without <i class="arg">values</i> the new cells will be set to the empty
string. The new column is appended immediately behind the last
existing column.</p></dd>
<dt><a name="6"><i class="arg">matrixName</i> <b class="method">add row</b> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one row and then acts like <b class="method">set row</b> (see
below) on this new row if there were <i class="arg">values</i> supplied. Without
<i class="arg">values</i> the new cells will be set to the empty string. The new
row is appended immediately behind the last existing row.</p></dd>
<dt><a name="7"><i class="arg">matrixName</i> <b class="method">add columns</b> <i class="arg">n</i></a></dt>
<dd><p>Extends the matrix by <i class="arg">n</i> columns. The new cells will be set to
the empty string. The new columns are appended immediately behind the
last existing column. A value of <i class="arg">n</i> equal to or smaller than 0 is
not allowed.</p></dd>
<dt><a name="8"><i class="arg">matrixName</i> <b class="method">add rows</b> <i class="arg">n</i></a></dt>
<dd><p>Extends the matrix by <i class="arg">n</i> rows. The new cells will be set to the
empty string. The new rows are appended immediately behind the last
existing row. A value of <i class="arg">n</i> equal to or smaller than 0 is not
allowed.</p></dd>
<dt><a name="9"><i class="arg">matrixName</i> <b class="method">cells</b></a></dt>
<dd><p>Returns the number of cells currently managed by the matrix. This is
the product of <b class="method">rows</b> and <b class="method">columns</b>.</p></dd>
<dt><a name="10"><i class="arg">matrixName</i> <b class="method">cellsize</b> <i class="arg">column row</i></a></dt>
<dd><p>Returns the length of the string representation of the value currently
contained in the addressed cell.</p></dd>
<dt><a name="11"><i class="arg">matrixName</i> <b class="method">columns</b></a></dt>
<dd><p>Returns the number of columns currently managed by the matrix.</p></dd>
<dt><a name="12"><i class="arg">matrixName</i> <b class="method">columnwidth</b> <i class="arg">column</i></a></dt>
<dd><p>Returns the length of the longest string representation of all the
values currently contained in the cells of the addressed column if
these are all spanning only one line. For cell values spanning
multiple lines the length of their longest line goes into the
computation.</p></dd>
<dt><a name="13"><i class="arg">matrixName</i> <b class="method">delete column</b> <i class="arg">column</i></a></dt>
<dd><p>Deletes the specified column from the matrix and shifts all columns
with higher indices one index down.</p></dd>
<dt><a name="14"><i class="arg">matrixName</i> <b class="method">delete columns</b> <i class="arg">n</i></a></dt>
<dd><p>Deletes <i class="arg">n</i> columns from the right of the matrix. The value of
<i class="arg">n</i> has to satisfy the constraint
&quot;0 &lt; <i class="arg">n</i> &lt; [<b class="cmd">matrixName</b> <b class="method">columns</b>]&quot;</p></dd>
<dt><a name="15"><i class="arg">matrixName</i> <b class="method">delete row</b> <i class="arg">row</i></a></dt>
<dd><p>Deletes the specified row from the matrix and shifts all row with
higher indices one index down.</p></dd>
<dt><a name="16"><i class="arg">matrixName</i> <b class="method">delete rows</b> <i class="arg">n</i></a></dt>
<dd><p>Deletes <i class="arg">n</i> rows from the bottom of the matrix. The value of
<i class="arg">n</i> has to satisfy the constraint
&quot;0 &lt; <i class="arg">n</i> &lt; [<b class="cmd">matrixName</b> <b class="method">rows</b>]&quot;</p></dd>
<dt><a name="17"><i class="arg">matrixName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></dt>
<dd><p>This is the complement to <b class="method">serialize</b>. It replaces matrix data
in <i class="arg">matrixName</i> with the matrix described by the <i class="arg">serialization</i>
value. The old contents of <i class="arg">matrixName</i> are deleted by this
operation.</p></dd>
<dt><a name="18"><i class="arg">matrixName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the matrix, including its storage space and associated
command.</p></dd>
<dt><a name="19"><i class="arg">matrixName</i> <b class="method">format 2string</b> <span class="opt">?<i class="arg">report</i>?</span></a></dt>
<dd><p>Formats the matrix using the specified report object and returns the
string containing the result of this operation. The report has to
support the <b class="method">printmatrix</b> method. If no <i class="arg">report</i> is
specified the system will use an internal report definition to format
the matrix.</p></dd>
<dt><a name="20"><i class="arg">matrixName</i> <b class="method">format 2chan</b> <span class="opt">?<span class="opt">?<i class="arg">report</i>?</span> <i class="arg">channel</i>?</span></a></dt>
<dd><p>Formats the matrix using the specified report object and writes the
string containing the result of this operation into the channel. The
report has to support the <b class="method">printmatrix2channel</b> method.  If no
<i class="arg">report</i> is specified the system will use an internal report
definition to format the matrix. If no <i class="arg">channel</i> is specified the
system will use <b class="const">stdout</b>.</p></dd>
<dt><a name="21"><i class="arg">matrixName</i> <b class="method">get cell</b> <i class="arg">column row</i></a></dt>
<dd><p>Returns the value currently contained in the cell identified by row
and column index.</p></dd>
<dt><a name="22"><i class="arg">matrixName</i> <b class="method">get column</b> <i class="arg">column</i></a></dt>
<dd><p>Returns a list containing the values from all cells in the column
identified by the index. The contents of the cell in row 0 are stored
as the first element of this list.</p></dd>
<dt><a name="23"><i class="arg">matrixName</i> <b class="method">get rect</b> <i class="arg">column_tl row_tl column_br row_br</i></a></dt>
<dd><p>Returns a list of lists of cell values. The values stored in the
result come from the sub-matrix whose top-left and bottom-right cells
are specified by <i class="arg">column_tl, row_tl</i> and
<i class="arg">column_br, row_br</i> resp. Note that the following equations have
to be true: &quot;<i class="arg">column_tl</i> &lt;= <i class="arg">column_br</i>&quot; and &quot;<i class="arg">row_tl</i> &lt;=
<i class="arg">row_br</i>&quot;. The result is organized as follows: The outer list is
the list of rows, its elements are lists representing a single
row. The row with the smallest index is the first element of the outer
list. The elements of the row lists represent the selected cell
values. The cell with the smallest index is the first element in each
row list.</p></dd>
<dt><a name="24"><i class="arg">matrixName</i> <b class="method">get row</b> <i class="arg">row</i></a></dt>
<dd><p>Returns a list containing the values from all cells in the row
identified by the index. The contents of the cell in column 0 are
stored as the first element of this list.</p></dd>
<dt><a name="25"><i class="arg">matrixName</i> <b class="method">insert column</b> <i class="arg">column</i> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one column and then acts like <b class="method">set column</b>
(see below) on this new column if there were <i class="arg">values</i>
supplied. Without <i class="arg">values</i> the new cells will be set to the empty
string. The new column is inserted just before the column specified by
the given index. This means, if <i class="arg">column</i> is less than or equal to
zero, then the new column is inserted at the beginning of the matrix,
before the first column. If <i class="arg">column</i> has the value <b class="const">end</b>,
or if it is greater than or equal to the number of columns in the
matrix, then the new column is appended to the matrix, behind the last
column. The old column at the chosen index and all columns with higher
indices are shifted one index upward.</p></dd>
<dt><a name="26"><i class="arg">matrixName</i> <b class="method">insert row</b> <i class="arg">row</i> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one row and then acts like <b class="method">set row</b> (see
below) on this new row if there were <i class="arg">values</i> supplied. Without
<i class="arg">values</i> the new cells will be set to the empty string. The new
row is inserted just before the row specified by the given index. This
means, if <i class="arg">row</i> is less than or equal to zero, then the new row is
inserted at the beginning of the matrix, before the first row. If
<i class="arg">row</i> has the value <b class="const">end</b>, or if it is greater than or
equal to the number of rows in the matrix, then the new row is
appended to the matrix, behind the last row. The old row at that index
and all rows with higher indices are shifted one index upward.</p></dd>
<dt><a name="27"><i class="arg">matrixName</i> <b class="method">link</b> <span class="opt">?-transpose?</span> <i class="arg">arrayvar</i></a></dt>
<dd><p>Links the matrix to the specified array variable. This means that the
contents of all cells in the matrix is stored in the array too, with
all changes to the matrix propagated there too. The contents of the
cell <i class="arg">(column,row)</i> is stored in the array using the key
<i class="arg">column,row</i>. If the option <b class="option">-transpose</b> is specified the
key <i class="arg">row,column</i> will be used instead. It is possible to link the
matrix to more than one array. Note that the link is bidirectional,
i.e. changes to the array are mirrored in the matrix too.</p></dd>
<dt><a name="28"><i class="arg">matrixName</i> <b class="method">links</b></a></dt>
<dd><p>Returns a list containing the names of all array variables the matrix
was linked to through a call to method <b class="method">link</b>.</p></dd>
<dt><a name="29"><i class="arg">matrixName</i> <b class="method">rowheight</b> <i class="arg">row</i></a></dt>
<dd><p>Returns the height of the specified row in lines. This is the highest
number of lines spanned by a cell over all cells in the row.</p></dd>
<dt><a name="30"><i class="arg">matrixName</i> <b class="method">rows</b></a></dt>
<dd><p>Returns the number of rows currently managed by the matrix.</p></dd>
<dt><a name="31"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">all</b> <i class="arg">pattern</i></a></dt>
<dd><p>Searches the whole matrix for cells matching the <i class="arg">pattern</i> and
returns a list with all matches. Each item in the aforementioned list
is a list itself and contains the column and row index of the matching
cell, in this order. The results are ordered by column first and row
second, both times in ascending order. This means that matches to the
left and the top of the matrix come before matches to the right and
down.</p>
<p>The type of the pattern (string, glob, regular expression) is
determined by the option after the <b class="method">search</b> keyword. If no
option is given it defaults to <b class="option">-exact</b>.</p>
<p>If the option <b class="option">-nocase</b> is specified the search will be
case-insensitive.</p></dd>
<dt><a name="32"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">column</b> <i class="arg">column pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified column.</p></dd>
<dt><a name="33"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">row</b> <i class="arg">row pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified row.</p></dd>
<dt><a name="34"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">rect</b> <i class="arg">column_tl row_tl column_br row_br pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified rectangular area of the matrix.</p></dd>
<dt><a name="35"><i class="arg">matrixName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">column_tl row_tl column_br row_br</i>?</span></a></dt>
<dd><p>This method serializes the sub-matrix spanned up by the rectangle
specification. In other words it returns a tcl <em>value</em> completely
describing that matrix. If no rectangle is specified the whole matrix
will be serialized.
This allows, for example, the transfer of matrix objects (or parts
thereof) over arbitrary channels, persistence, etc.
This method is also the basis for both the copy constructor and the
assignment operator.</p>
<p>The result of this method has to be semantically identical over all
implementations of the matrix interface. This is what will enable us
to copy matrix data between different implementations of the same
interface.</p>
<p>The result is a list containing exactly three items.</p>
<p>The first two elements of the list specify the number of rows and
columns of the matrix, in that order. The values integer numbers
greater than or equal to zero.</p>
<p>The last element of the list contains the values of the matrix cells
we have serialized, in the form of a value like it is returned by the
<b class="method">get rect</b>. However empty cells to the right and bottom of
the matrix can be left out of that value as the size information in
the serialization allows the receiver the creation of a matrix with
the proper size despite the missing values.</p>
<pre class="example">
    # A possible serialization for the matrix structure
    #
    # | a b d g |
    # | c e     |
    # | f       |
    #
    # is
    #
    # 3 4 {{a b d g} {c e} {f}}
</pre>
</dd>
<dt><a name="36"><i class="arg">matrixName</i> <b class="method">set cell</b> <i class="arg">column row value</i></a></dt>
<dd><p>Sets the value in the cell identified by row and column index to the
data in the third argument.</p></dd>
<dt><a name="37"><i class="arg">matrixName</i> <b class="method">set column</b> <i class="arg">column values</i></a></dt>
<dd><p>Sets the values in the cells identified by the column index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in row 0 and then upward. If there are less values in the
list than there are rows the remaining rows are set to the empty
string. If there are more values in the list than there are rows the
superfluous elements are ignored. The matrix is not extended by this
operation.</p></dd>
<dt><a name="38"><i class="arg">matrixName</i> <b class="method">set rect</b> <i class="arg">column row values</i></a></dt>
<dd><p>Takes a list of lists of cell values and writes them into the
submatrix whose top-left cell is specified by the two indices. If the
sublists of the outerlist are not of equal length the shorter sublists
will be filled with empty strings to the length of the longest
sublist. If the submatrix specified by the top-left cell and the
number of rows and columns in the <i class="arg">values</i> extends beyond the
matrix we are modifying the over-extending parts of the values are
ignored, i.e. essentially cut off. This subcommand expects its input
in the format as returned by <b class="method">getrect</b>.</p></dd>
<dt><a name="39"><i class="arg">matrixName</i> <b class="method">set row</b> <i class="arg">row values</i></a></dt>
<dd><p>Sets the values in the cells identified by the row index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in column 0 and then upward. If there are less values in the
list than there are columns the remaining columns are set to the empty
string. If there are more values in the list than there are columns
the superfluous elements are ignored. The matrix is not extended by
this operation.</p></dd>
<dt><a name="40"><i class="arg">matrixName</i> <b class="method">sort columns</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">row</i></a></dt>
<dd><p>Sorts the columns in the matrix using the data in the specified
<i class="arg">row</i> as the key to sort by. The options <b class="option">-increasing</b>
and <b class="option">-decreasing</b> have the same meaning as for <b class="cmd">lsort</b>.
If no option is specified <b class="option">-increasing</b> is assumed.</p></dd>
<dt><a name="41"><i class="arg">matrixName</i> <b class="method">sort rows</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">column</i></a></dt>
<dd><p>Sorts the rows in the matrix using the data in the specified
<i class="arg">column</i> as the key to sort by. The options <b class="option">-increasing</b>
and <b class="option">-decreasing</b> have the same meaning as for <b class="cmd">lsort</b>.
If no option is specified <b class="option">-increasing</b> is assumed.</p></dd>
<dt><a name="42"><i class="arg">matrixName</i> <b class="method">swap columns</b> <i class="arg">column_a column_b</i></a></dt>
<dd><p>Swaps the contents of the two specified columns.</p></dd>
<dt><a name="43"><i class="arg">matrixName</i> <b class="method">swap rows</b> <i class="arg">row_a row_b</i></a></dt>
<dd><p>Swaps the contents of the two specified rows.</p></dd>
<dt><a name="44"><i class="arg">matrixName</i> <b class="method">transpose</b></a></dt>
<dd><p>Transposes the contents of the matrix, i.e. swaps rows for columns and
vice versa.</p></dd>
<dt><a name="45"><i class="arg">matrixName</i> <b class="method">unlink</b> <i class="arg">arrayvar</i></a></dt>
<dd><p>Removes the link between the matrix and the specified arrayvariable,
if there is one.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<p>The examples below assume a 5x5 matrix M with the first row containing
the values 1 to 5, with 1 in the top-left cell. Each other row
contains the contents of the row above it, rotated by one cell to the
right.</p>
<pre class="example">
 % M getrect 0 0 4 4
 {{1 2 3 4 5} {5 1 2 3 4} {4 5 1 2 3} {3 4 5 1 2} {2 3 4 5 1}}
</pre>
<pre class="example">
 % M setrect 1 1 {{0 0 0} {0 0 0} {0 0 0}}
 % M getrect 0 0 4 4
 {{1 2 3 4 5} {5 0 0 0 4} {4 0 0 0 3} {3 0 0 0 2} {2 3 4 5 1}}
</pre>
<p>Assuming that the style definitions in the example section of the
manpage for the package <b class="package"><a href="../report/report.html">report</a></b> are loaded into the
interpreter now an example which formats a matrix into a tabular
report. The code filling the matrix with data is not shown.  contains
useful data.</p>
<pre class="example">
    % ::struct::matrix m
    % # ... fill m with data, assume 5 columns
    % ::report::report r 5 style captionedtable 1
    % m format 2string r
    +---+-------------------+-------+-------+--------+
    |000|VERSIONS:          |2:8.4a3|1:8.4a3|1:8.4a3%|
    +---+-------------------+-------+-------+--------+
    |001|CATCH return ok    |7      |13     |53.85   |
    |002|CATCH return error |68     |91     |74.73   |
    |003|CATCH no catch used|7      |14     |50.00   |
    |004|IF if true numeric |12     |33     |36.36   |
    |005|IF elseif          |15     |47     |31.91   |
    |   |true numeric       |       |       |        |
    +---+-------------------+-------+-------+--------+
    %
    % # alternate way of doing the above
    % r printmatrix m
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: matrix</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key55">matrix</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/matrix1.html.
































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::matrix_v1 - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/matrix1.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::matrix_v1.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::matrix_v1(n) 1.2.1 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::matrix_v1 - Create and manipulate matrix objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::matrix <span class="opt">?1.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">matrixName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><i class="arg">matrixName</i> <b class="method">add column</b> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#3"><i class="arg">matrixName</i> <b class="method">add row</b> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#4"><i class="arg">matrixName</i> <b class="method">add columns</b> <i class="arg">n</i></a></li>
<li><a href="#5"><i class="arg">matrixName</i> <b class="method">add rows</b> <i class="arg">n</i></a></li>
<li><a href="#6"><i class="arg">matrixName</i> <b class="method">cells</b></a></li>
<li><a href="#7"><i class="arg">matrixName</i> <b class="method">cellsize</b> <i class="arg">column row</i></a></li>
<li><a href="#8"><i class="arg">matrixName</i> <b class="method">columns</b></a></li>
<li><a href="#9"><i class="arg">matrixName</i> <b class="method">columnwidth</b> <i class="arg">column</i></a></li>
<li><a href="#10"><i class="arg">matrixName</i> <b class="method">delete column</b> <i class="arg">column</i></a></li>
<li><a href="#11"><i class="arg">matrixName</i> <b class="method">delete row</b> <i class="arg">row</i></a></li>
<li><a href="#12"><i class="arg">matrixName</i> <b class="method">destroy</b></a></li>
<li><a href="#13"><i class="arg">matrixName</i> <b class="method">format 2string</b> <span class="opt">?<i class="arg">report</i>?</span></a></li>
<li><a href="#14"><i class="arg">matrixName</i> <b class="method">format 2chan</b> <span class="opt">?<span class="opt">?<i class="arg">report</i>?</span> <i class="arg">channel</i>?</span></a></li>
<li><a href="#15"><i class="arg">matrixName</i> <b class="method">get cell</b> <i class="arg">column row</i></a></li>
<li><a href="#16"><i class="arg">matrixName</i> <b class="method">get column</b> <i class="arg">column</i></a></li>
<li><a href="#17"><i class="arg">matrixName</i> <b class="method">get rect</b> <i class="arg">column_tl row_tl column_br row_br</i></a></li>
<li><a href="#18"><i class="arg">matrixName</i> <b class="method">get row</b> <i class="arg">row</i></a></li>
<li><a href="#19"><i class="arg">matrixName</i> <b class="method">insert column</b> <i class="arg">column</i> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#20"><i class="arg">matrixName</i> <b class="method">insert row</b> <i class="arg">row</i> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#21"><i class="arg">matrixName</i> <b class="method">link</b> <span class="opt">?-transpose?</span> <i class="arg">arrayvar</i></a></li>
<li><a href="#22"><i class="arg">matrixName</i> <b class="method">links</b></a></li>
<li><a href="#23"><i class="arg">matrixName</i> <b class="method">rowheight</b> <i class="arg">row</i></a></li>
<li><a href="#24"><i class="arg">matrixName</i> <b class="method">rows</b></a></li>
<li><a href="#25"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">all</b> <i class="arg">pattern</i></a></li>
<li><a href="#26"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">column</b> <i class="arg">column pattern</i></a></li>
<li><a href="#27"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">row</b> <i class="arg">row pattern</i></a></li>
<li><a href="#28"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">rect</b> <i class="arg">column_tl row_tl column_br row_br pattern</i></a></li>
<li><a href="#29"><i class="arg">matrixName</i> <b class="method">set cell</b> <i class="arg">column row value</i></a></li>
<li><a href="#30"><i class="arg">matrixName</i> <b class="method">set column</b> <i class="arg">column values</i></a></li>
<li><a href="#31"><i class="arg">matrixName</i> <b class="method">set rect</b> <i class="arg">column row values</i></a></li>
<li><a href="#32"><i class="arg">matrixName</i> <b class="method">set row</b> <i class="arg">row values</i></a></li>
<li><a href="#33"><i class="arg">matrixName</i> <b class="method">sort columns</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">row</i></a></li>
<li><a href="#34"><i class="arg">matrixName</i> <b class="method">sort rows</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">column</i></a></li>
<li><a href="#35"><i class="arg">matrixName</i> <b class="method">swap columns</b> <i class="arg">column_a column_b</i></a></li>
<li><a href="#36"><i class="arg">matrixName</i> <b class="method">swap rows</b> <i class="arg">row_a row_b</i></a></li>
<li><a href="#37"><i class="arg">matrixName</i> <b class="method">unlink</b> <i class="arg">arrayvar</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::matrix</b> command creates a new matrix object with an
associated global Tcl command whose name is <i class="arg">matrixName</i>.  This
command may be used to invoke various operations on the matrix.  It has
the following general form:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">matrixName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>A matrix is a rectangular collection of cells, i.e. organized in rows
and columns. Each cell contains exactly one value of arbitrary
form. The cells in the matrix are addressed by pairs of integer
numbers, with the first (left) number in the pair specifying the
column and the second (right) number specifying the row the cell is
in. These indices are counted from 0 upward. The special non-numeric
index <b class="const">end</b> refers to the last row or column in the matrix,
depending on the context. Indices of the form
<b class="const">end</b>-<b class="variable">number</b> are counted from the end of the row or
column, like they are for standard Tcl lists. Trying to access
non-existing cells causes an error.</p>
<p>The matrices here are created empty, i.e. they have neither rows nor
columns. The user then has to add rows and columns as needed by his
application. A specialty of this structure is the ability to export an
array-view onto its contents. Such can be used by tkTable, for
example, to link the matrix into the display.</p>
<p>The following commands are possible for matrix objects:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">matrixName</i> <b class="method">add column</b> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one column and then acts like <b class="method">setcolumn</b>
(see below) on this new column if there were <i class="arg">values</i>
supplied. Without <i class="arg">values</i> the new cells will be set to the empty
string. The new column is appended immediately behind the last
existing column.</p></dd>
<dt><a name="3"><i class="arg">matrixName</i> <b class="method">add row</b> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one row and then acts like <b class="method">setrow</b> (see
below) on this new row if there were <i class="arg">values</i> supplied. Without
<i class="arg">values</i> the new cells will be set to the empty string. The new
row is appended immediately behind the last existing row.</p></dd>
<dt><a name="4"><i class="arg">matrixName</i> <b class="method">add columns</b> <i class="arg">n</i></a></dt>
<dd><p>Extends the matrix by <i class="arg">n</i> columns. The new cells will be set to
the empty string. The new columns are appended immediately behind the
last existing column. A value of <i class="arg">n</i> equal to or smaller than 0 is
not allowed.</p></dd>
<dt><a name="5"><i class="arg">matrixName</i> <b class="method">add rows</b> <i class="arg">n</i></a></dt>
<dd><p>Extends the matrix by <i class="arg">n</i> rows. The new cells will be set to the
empty string. The new rows are appended immediately behind the last
existing row. A value of <i class="arg">n</i> equal to or smaller than 0 is not
allowed.</p></dd>
<dt><a name="6"><i class="arg">matrixName</i> <b class="method">cells</b></a></dt>
<dd><p>Returns the number of cells currently managed by the matrix. This is
the product of <b class="method">rows</b> and <b class="method">columns</b>.</p></dd>
<dt><a name="7"><i class="arg">matrixName</i> <b class="method">cellsize</b> <i class="arg">column row</i></a></dt>
<dd><p>Returns the length of the string representation of the value currently
contained in the addressed cell.</p></dd>
<dt><a name="8"><i class="arg">matrixName</i> <b class="method">columns</b></a></dt>
<dd><p>Returns the number of columns currently managed by the matrix.</p></dd>
<dt><a name="9"><i class="arg">matrixName</i> <b class="method">columnwidth</b> <i class="arg">column</i></a></dt>
<dd><p>Returns the length of the longest string representation of all the
values currently contained in the cells of the addressed column if
these are all spanning only one line. For cell values spanning
multiple lines the length of their longest line goes into the
computation.</p></dd>
<dt><a name="10"><i class="arg">matrixName</i> <b class="method">delete column</b> <i class="arg">column</i></a></dt>
<dd><p>Deletes the specified column from the matrix and shifts all columns
with higher indices one index down.</p></dd>
<dt><a name="11"><i class="arg">matrixName</i> <b class="method">delete row</b> <i class="arg">row</i></a></dt>
<dd><p>Deletes the specified row from the matrix and shifts all row with
higher indices one index down.</p></dd>
<dt><a name="12"><i class="arg">matrixName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the matrix, including its storage space and associated
command.</p></dd>
<dt><a name="13"><i class="arg">matrixName</i> <b class="method">format 2string</b> <span class="opt">?<i class="arg">report</i>?</span></a></dt>
<dd><p>Formats the matrix using the specified report object and returns the
string containing the result of this operation. The report has to
support the <b class="method">printmatrix</b> method. If no <i class="arg">report</i> is
specified the system will use an internal report definition to format
the matrix.</p></dd>
<dt><a name="14"><i class="arg">matrixName</i> <b class="method">format 2chan</b> <span class="opt">?<span class="opt">?<i class="arg">report</i>?</span> <i class="arg">channel</i>?</span></a></dt>
<dd><p>Formats the matrix using the specified report object and writes the
string containing the result of this operation into the channel. The
report has to support the <b class="method">printmatrix2channel</b> method.  If no
<i class="arg">report</i> is specified the system will use an internal report
definition to format the matrix. If no <i class="arg">channel</i> is specified the
system will use <b class="const">stdout</b>.</p></dd>
<dt><a name="15"><i class="arg">matrixName</i> <b class="method">get cell</b> <i class="arg">column row</i></a></dt>
<dd><p>Returns the value currently contained in the cell identified by row
and column index.</p></dd>
<dt><a name="16"><i class="arg">matrixName</i> <b class="method">get column</b> <i class="arg">column</i></a></dt>
<dd><p>Returns a list containing the values from all cells in the column
identified by the index. The contents of the cell in row 0 are stored
as the first element of this list.</p></dd>
<dt><a name="17"><i class="arg">matrixName</i> <b class="method">get rect</b> <i class="arg">column_tl row_tl column_br row_br</i></a></dt>
<dd><p>Returns a list of lists of cell values. The values stored in the
result come from the sub-matrix whose top-left and bottom-right cells
are specified by <i class="arg">column_tl, row_tl</i> and
<i class="arg">column_br, row_br</i> resp. Note that the following equations have
to be true: &quot;<i class="arg">column_tl</i> &lt;= <i class="arg">column_br</i>&quot; and &quot;<i class="arg">row_tl</i> &lt;=
<i class="arg">row_br</i>&quot;. The result is organized as follows: The outer list is
the list of rows, its elements are lists representing a single
row. The row with the smallest index is the first element of the outer
list. The elements of the row lists represent the selected cell
values. The cell with the smallest index is the first element in each
row list.</p></dd>
<dt><a name="18"><i class="arg">matrixName</i> <b class="method">get row</b> <i class="arg">row</i></a></dt>
<dd><p>Returns a list containing the values from all cells in the row
identified by the index. The contents of the cell in column 0 are
stored as the first element of this list.</p></dd>
<dt><a name="19"><i class="arg">matrixName</i> <b class="method">insert column</b> <i class="arg">column</i> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one column and then acts like <b class="method">setcolumn</b>
(see below) on this new column if there were <i class="arg">values</i>
supplied. Without <i class="arg">values</i> the new cells will be set to the empty
string. The new column is inserted just before the column specified by
the given index. This means, if <i class="arg">column</i> is less than or equal to
zero, then the new column is inserted at the beginning of the matrix,
before the first column. If <i class="arg">column</i> has the value <b class="const">end</b>,
or if it is greater than or equal to the number of columns in the
matrix, then the new column is appended to the matrix, behind the last
column. The old column at the chosen index and all columns with higher
indices are shifted one index upward.</p></dd>
<dt><a name="20"><i class="arg">matrixName</i> <b class="method">insert row</b> <i class="arg">row</i> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one row and then acts like <b class="method">setrow</b> (see
below) on this new row if there were <i class="arg">values</i> supplied. Without
<i class="arg">values</i> the new cells will be set to the empty string. The new
row is inserted just before the row specified by the given index. This
means, if <i class="arg">row</i> is less than or equal to zero, then the new row is
inserted at the beginning of the matrix, before the first row. If
<i class="arg">row</i> has the value <b class="const">end</b>, or if it is greater than or
equal to the number of rows in the matrix, then the new row is
appended to the matrix, behind the last row. The old row at that index
and all rows with higher indices are shifted one index upward.</p></dd>
<dt><a name="21"><i class="arg">matrixName</i> <b class="method">link</b> <span class="opt">?-transpose?</span> <i class="arg">arrayvar</i></a></dt>
<dd><p>Links the matrix to the specified array variable. This means that the
contents of all cells in the matrix is stored in the array too, with
all changes to the matrix propagated there too. The contents of the
cell <i class="arg">(column,row)</i> is stored in the array using the key
<i class="arg">column,row</i>. If the option <b class="option">-transpose</b> is specified the
key <i class="arg">row,column</i> will be used instead. It is possible to link the
matrix to more than one array. Note that the link is bidirectional,
i.e. changes to the array are mirrored in the matrix too.</p></dd>
<dt><a name="22"><i class="arg">matrixName</i> <b class="method">links</b></a></dt>
<dd><p>Returns a list containing the names of all array variables the matrix
was linked to through a call to method <b class="method">link</b>.</p></dd>
<dt><a name="23"><i class="arg">matrixName</i> <b class="method">rowheight</b> <i class="arg">row</i></a></dt>
<dd><p>Returns the height of the specified row in lines. This is the highest
number of lines spanned by a cell over all cells in the row.</p></dd>
<dt><a name="24"><i class="arg">matrixName</i> <b class="method">rows</b></a></dt>
<dd><p>Returns the number of rows currently managed by the matrix.</p></dd>
<dt><a name="25"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">all</b> <i class="arg">pattern</i></a></dt>
<dd><p>Searches the whole matrix for cells matching the <i class="arg">pattern</i> and
returns a list with all matches. Each item in the aforementioned list
is a list itself and contains the column and row index of the matching
cell, in this order. The results are ordered by column first and row
second, both times in ascending order. This means that matches to the
left and the top of the matrix come before matches to the right and
down.</p>
<p>The type of the pattern (string, glob, regular expression) is
determined by the option after the <b class="method">search</b> keyword. If no
option is given it defaults to <b class="option">-exact</b>.</p>
<p>If the option <b class="option">-nocase</b> is specified the search will be
case-insensitive.</p></dd>
<dt><a name="26"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">column</b> <i class="arg">column pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified column.</p></dd>
<dt><a name="27"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">row</b> <i class="arg">row pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified row.</p></dd>
<dt><a name="28"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">rect</b> <i class="arg">column_tl row_tl column_br row_br pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified rectangular area of the matrix.</p></dd>
<dt><a name="29"><i class="arg">matrixName</i> <b class="method">set cell</b> <i class="arg">column row value</i></a></dt>
<dd><p>Sets the value in the cell identified by row and column index to the
data in the third argument.</p></dd>
<dt><a name="30"><i class="arg">matrixName</i> <b class="method">set column</b> <i class="arg">column values</i></a></dt>
<dd><p>Sets the values in the cells identified by the column index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in row 0 and then upward. If there are less values in the
list than there are rows the remaining rows are set to the empty
string. If there are more values in the list than there are rows the
superfluous elements are ignored. The matrix is not extended by this
operation.</p></dd>
<dt><a name="31"><i class="arg">matrixName</i> <b class="method">set rect</b> <i class="arg">column row values</i></a></dt>
<dd><p>Takes a list of lists of cell values and writes them into the
submatrix whose top-left cell is specified by the two indices. If the
sublists of the outerlist are not of equal length the shorter sublists
will be filled with empty strings to the length of the longest
sublist. If the submatrix specified by the top-left cell and the
number of rows and columns in the <i class="arg">values</i> extends beyond the
matrix we are modifying the over-extending parts of the values are
ignored, i.e. essentially cut off. This subcommand expects its input
in the format as returned by <b class="method">getrect</b>.</p></dd>
<dt><a name="32"><i class="arg">matrixName</i> <b class="method">set row</b> <i class="arg">row values</i></a></dt>
<dd><p>Sets the values in the cells identified by the row index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in column 0 and then upward. If there are less values in the
list than there are columns the remaining columns are set to the empty
string. If there are more values in the list than there are columns
the superfluous elements are ignored. The matrix is not extended by
this operation.</p></dd>
<dt><a name="33"><i class="arg">matrixName</i> <b class="method">sort columns</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">row</i></a></dt>
<dd><p>Sorts the columns in the matrix using the data in the specified
<i class="arg">row</i> as the key to sort by. The options <b class="option">-increasing</b>
and <b class="option">-decreasing</b> have the same meaning as for <b class="cmd">lsort</b>.
If no option is specified <b class="option">-increasing</b> is assumed.</p></dd>
<dt><a name="34"><i class="arg">matrixName</i> <b class="method">sort rows</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">column</i></a></dt>
<dd><p>Sorts the rows in the matrix using the data in the specified
<i class="arg">column</i> as the key to sort by. The options <b class="option">-increasing</b>
and <b class="option">-decreasing</b> have the same meaning as for <b class="cmd">lsort</b>.
If no option is specified <b class="option">-increasing</b> is assumed.</p></dd>
<dt><a name="35"><i class="arg">matrixName</i> <b class="method">swap columns</b> <i class="arg">column_a column_b</i></a></dt>
<dd><p>Swaps the contents of the two specified columns.</p></dd>
<dt><a name="36"><i class="arg">matrixName</i> <b class="method">swap rows</b> <i class="arg">row_a row_b</i></a></dt>
<dd><p>Swaps the contents of the two specified rows.</p></dd>
<dt><a name="37"><i class="arg">matrixName</i> <b class="method">unlink</b> <i class="arg">arrayvar</i></a></dt>
<dd><p>Removes the link between the matrix and the specified arrayvariable,
if there is one.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<p>The examples below assume a 5x5 matrix M with the first row containing
the values 1 to 5, with 1 in the top-left cell. Each other row
contains the contents of the row above it, rotated by one cell to the
right.</p>
<pre class="example">
 % M getrect 0 0 4 4
 {{1 2 3 4 5} {5 1 2 3 4} {4 5 1 2 3} {3 4 5 1 2} {2 3 4 5 1}}
</pre>
<pre class="example">
 % M setrect 1 1 {{0 0 0} {0 0 0} {0 0 0}}
 % M getrect 0 0 4 4
 {{1 2 3 4 5} {5 0 0 0 4} {4 0 0 0 3} {3 0 0 0 2} {2 3 4 5 1}}
</pre>
<p>Assuming that the style definitions in the example section of the
manpage for the package <b class="package"><a href="../report/report.html">report</a></b> are loaded into the
interpreter now an example which formats a matrix into a tabular
report. The code filling the matrix with data is not shown.  contains
useful data.</p>
<pre class="example">
    % ::struct::matrix m
    % # ... fill m with data, assume 5 columns
    % ::report::report r 5 style captionedtable 1
    % m format 2string r
    +---+-------------------+-------+-------+--------+
    |000|VERSIONS:          |2:8.4a3|1:8.4a3|1:8.4a3%|
    +---+-------------------+-------+-------+--------+
    |001|CATCH return ok    |7      |13     |53.85   |
    |002|CATCH return error |68     |91     |74.73   |
    |003|CATCH no catch used|7      |14     |50.00   |
    |004|IF if true numeric |12     |33     |36.36   |
    |005|IF elseif          |15     |47     |31.91   |
    |   |true numeric       |       |       |        |
    +---+-------------------+-------+-------+--------+
    %
    % # alternate way of doing the above
    % r printmatrix m
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: matrix</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key55">matrix</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/pool.html.










































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::pool - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/pool.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Erik Leunissen &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::pool.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::pool(n) 1.2.1 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::pool - Create and manipulate pool objects (of discrete items)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">POOLS AND ALLOCATION</a></li>
<li class="section"><a href="#section3">ITEMS</a></li>
<li class="section"><a href="#section4">POOL OBJECT COMMAND</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::pool <span class="opt">?1.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::struct::pool</b> <span class="opt">?<i class="arg">poolName</i>?</span> <span class="opt">?<i class="arg">maxsize</i>?</span></a></li>
<li><a href="#2"><b class="cmd">poolName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">poolName</i> <b class="method">add</b> <i class="arg">itemName1</i> <span class="opt">?<i class="arg">itemName2 itemName3 ...</i>?</span></a></li>
<li><a href="#4"><i class="arg">poolName</i> <b class="method">clear</b> <span class="opt">?<b class="option">-force</b>?</span></a></li>
<li><a href="#5"><i class="arg">poolName</i> <b class="method">destroy</b> <span class="opt">?<b class="option">-force</b>?</span></a></li>
<li><a href="#6"><i class="arg">poolName</i> <b class="method">info</b> <i class="arg">type</i> <span class="opt">?<i class="arg">arg</i>?</span></a></li>
<li><a href="#7"><i class="arg">poolName</i> <b class="method">maxsize</b> <span class="opt">?<i class="arg">maxsize</i>?</span></a></li>
<li><a href="#8"><i class="arg">poolName</i> <b class="method">release</b> <i class="arg">itemName</i></a></li>
<li><a href="#9"><i class="arg">poolName</i> <b class="method">remove</b> <i class="arg">itemName</i> <span class="opt">?<b class="option">-force</b>?</span></a></li>
<li><a href="#10"><i class="arg">poolName</i> <b class="method">request</b> itemVar <span class="opt">?options?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides pool objects which can be used to manage
finite collections of discrete items.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::struct::pool</b> <span class="opt">?<i class="arg">poolName</i>?</span> <span class="opt">?<i class="arg">maxsize</i>?</span></a></dt>
<dd><p>Creates a new pool object. If no <i class="arg">poolName</i> is supplied, then the
new pool will be named pool<b class="variable">X</b>, where X is a positive integer.
The optional second argument <i class="arg">maxsize</i> has to be a positive
integer indicating the maximum size of the pool; this is the maximum
number of items the pool may hold. The default for this value is
<b class="const">10</b>.</p>
<p>The pool object has an associated global Tcl command whose name is
<i class="arg">poolName</i>. This command may be used to invoke various
configuration operations on the report. It has the following general
form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">poolName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command. See section <span class="sectref"><a href="#section4">POOL OBJECT COMMAND</a></span> for a detailed
list of options and their behaviour.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">POOLS AND ALLOCATION</a></h2>
<p>The purpose of the pool command and the pool object command that it
generates, is to manage pools of discrete items.
      
Examples of a pool of discrete items are:</p>
<ul class="itemized">
<li><p>the seats in a cinema, theatre, train etc.. for which visitors/travelers can  make a reservation;</p></li>
<li><p>the dynamic IP-addresses that an ISP can dole out  to subscribers;</p></li>
<li><p>a car rental's collection of cars, which can be rented by customers;</p></li>
<li><p>the class rooms in a school building, which need to be scheduled;</p></li>
<li><p>the database connections available to client-threads in a web-server application;</p></li>
<li><p>the books in a library that customers can borrow;</p></li>
<li><p>etc ...</p></li>
</ul>
<p>The common denominator in the examples is that there is a more or less
fixed number of items (seats, IP-addresses, cars, ...) that are
supposed to be allocated on a more or less regular basis. An item can
be allocated only once at a time. An item that is allocated, must be
released before it can be re-allocated.  While several items in a pool
are being allocated and released continuously, the total number of
items in the pool remains constant.</p>
<p>Keeping track of which items are allocated, and by whom, is the
purpose of the pool command and its subordinates.</p>
<p><em>Pool parlance</em>: If we say that an item is
<i class="term">allocated</i>, it means that the item is <i class="term">busy</i>,
<i class="term">owned</i> or <i class="term">occupied</i>; it is not available anymore. If
an item is <i class="term">free</i>, it is <i class="term">available</i>. Deallocating an
item is equivalent to setting free or releasing an item. The person or
entity to which the item has been allotted is said to own the item.</p>
</div>
<div id="section3" class="section"><h2><a name="section3">ITEMS</a></h2>
<p><em>Discrete items</em></p>
<p>The <b class="cmd"><a href="../../../../index.html#key255">pool</a></b> command is designed for
<em>discrete items only</em>. Note that there are pools where
allocation occurs on a non-discrete basis, for example computer
memory. There are also pools from which the shares that are doled out
are not expected to be returned, for example a charity fund or a pan
of soup from which you may receive a portion. Finally, there are even
pools from which nothing is ever allocated or returned, like a
swimming pool or a cesspool.</p>
<p><em>Unique item names</em></p>
<p>A pool cannot manage duplicate item names. Therefore, items in a pool
must have unique names.</p>
<p><em>Item equivalence</em></p>
<p>From the point of view of the manager of a pool, items are
equivalent. The manager of a pool is indifferent about which
entity/person occupies a given item. However, clients may have
preferences for a particular item, based on some item property they
know.</p>
<p><em>Preferences</em></p>
<p>A future owner may have a preference for a particular item. Preference
based allocation is supported (see the <b class="option">-prefer</b> option to the
request subcommand). A preference for a particular item is most likely
to result from variability among features associated with the
items. Note that the pool commands themselves are not designed to
manage such item properties. If item properties play a role in an
application, they should be managed separately.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">POOL OBJECT COMMAND</a></h2>
<p>The following subcommands and corresponding arguments are available to
any pool object command.</p>
<dl class="definitions">
 
<dt><a name="3"><i class="arg">poolName</i> <b class="method">add</b> <i class="arg">itemName1</i> <span class="opt">?<i class="arg">itemName2 itemName3 ...</i>?</span></a></dt>
<dd><p>This command adds the items on the command line to the pool. If
duplicate item names occur on the command line, an error is raised. If
one or more of the items already exist in the pool, this also is
considered an error.</p></dd>
<dt><a name="4"><i class="arg">poolName</i> <b class="method">clear</b> <span class="opt">?<b class="option">-force</b>?</span></a></dt>
<dd><p>Removes all items from the pool. If there are any allocated items at
the time when the command is invoked, an error is raised. This
behaviour may be modified through the <b class="option">-force</b> argument. If it
is supplied on the command line, the pool will be cleared regardless
the allocation state of its items.</p></dd>
<dt><a name="5"><i class="arg">poolName</i> <b class="method">destroy</b> <span class="opt">?<b class="option">-force</b>?</span></a></dt>
<dd><p>Destroys the pool data structure, all associated variables and the
associated pool object command. By default, the command checks whether
any items are still allocated and raises an error if such is the
case. This behaviour may be modified through the argument
<b class="option">-force</b>. If it is supplied on the command line, the pool data
structure will be destroyed regardless allocation state of its items.</p></dd>
<dt><a name="6"><i class="arg">poolName</i> <b class="method">info</b> <i class="arg">type</i> <span class="opt">?<i class="arg">arg</i>?</span></a></dt>
<dd><p>Returns various information about the pool for further programmatic
use. The <i class="arg">type</i> argument indicates the type of information
requested. Only the type <b class="const">allocID</b> uses an additional argument.</p>
<dl class="definitions">
     
<dt><b class="const">allocID</b> <i class="arg">itemName</i></dt>
<dd><p>returns the allocID of the item whose name is <i class="arg">itemName</i>. Free
items have an allocation id of <b class="const">-1</b>.</p></dd>
<dt><b class="const">allitems</b></dt>
<dd><p>returns a list of all items in the pool.</p></dd>
<dt><b class="const">allocstate</b></dt>
<dd><p>Returns a list of key-value pairs, where the keys are the items and
the values are the corresponding allocation id's. Free items have an
allocation id of <b class="const">-1</b>.</p></dd>
<dt><b class="const">cursize</b></dt>
<dd><p>returns the current pool size, i.e. the number of items in the pool.</p></dd>
<dt><b class="const">freeitems</b></dt>
<dd><p>returns a list of items that currently are not allocated.</p></dd>
<dt><b class="const">maxsize</b></dt>
<dd><p>returns the maximum size of the pool.</p></dd>
</dl></dd>
<dt><a name="7"><i class="arg">poolName</i> <b class="method">maxsize</b> <span class="opt">?<i class="arg">maxsize</i>?</span></a></dt>
<dd><p>Sets or queries the maximum size of the pool, depending on whether the
<i class="arg">maxsize</i> argument is supplied or not. If <i class="arg">maxsize</i> is
supplied, the maximum size of the pool will be set to that value. If
no argument is supplied, the current maximum size of the pool is
returned. In this variant, the command is an alias for:</p>
<p><b class="cmd">poolName info maxsize</b>.</p>
<p>The <i class="arg">maxsize</i> argument has to be a positive integer.</p></dd>
<dt><a name="8"><i class="arg">poolName</i> <b class="method">release</b> <i class="arg">itemName</i></a></dt>
<dd><p>Releases the item whose name is <i class="arg">itemName</i> that was allocated
previously. An error is raised if the item was not allocated at the
time when the command was issued.</p></dd>
<dt><a name="9"><i class="arg">poolName</i> <b class="method">remove</b> <i class="arg">itemName</i> <span class="opt">?<b class="option">-force</b>?</span></a></dt>
<dd><p>Removes the item whose name is <i class="arg">itemName</i> from the pool. If the
item was allocated at the time when the command was invoked, an error
is raised. This behaviour may be modified through the optional
argument <b class="option">-force</b>. If it is supplied on the command line, the
item will be removed regardless its allocation state.</p></dd>
<dt><a name="10"><i class="arg">poolName</i> <b class="method">request</b> itemVar <span class="opt">?options?</span></a></dt>
<dd><p>Handles a request for an item, taking into account a possible
preference for a particular item. There are two possible outcomes
depending on the availability of items:</p>
<ol class="enumerated">
<li><p>The request is honoured, an item is allocated and the variable whose
name is passed with the argument <i class="arg">itemVar</i> will be set to the name
of the item that was allocated. The command returns 1.</p></li>
<li><p>The request is denied. No item is allocated. The variable whose name
is itemVar is not set.  Attempts to read <i class="arg">itemVar</i> may raise an
error if the variable was not defined before issuing the request. The
command returns 0.</p></li>
</ol>
<p>The return values from this command are meant to be inspected. The
examples below show how to do this. Failure to check the return value
may result in erroneous behaviour. If no preference for a particular
item is supplied through the option <b class="option">-prefer</b> (see below), then
all requests are honoured as long as items are available.</p>
<p>The following options are supported:</p>
<dl class="definitions">
 
<dt><b class="option">-allocID</b> <i class="arg">allocID</i></dt>
<dd><p>If the request is honoured, an item will be allocated to the entity
identified by allocID. If the allocation state of an item is queried,
it is this allocation ID that will be returned. If the option
<b class="option">-allocID</b> is not supplied, the item will be given to and owned
by <b class="const">dummyID</b>. Allocation id's may be anything except the value
-1, which is reserved for free items.</p></dd>
<dt><b class="option">-prefer</b> <i class="arg">preferredItem</i></dt>
<dd><p>This option modifies the allocation strategy as follows: If the item
whose name is <i class="arg">preferredItem</i> is not allocated at the time when
the command is invoked, the request is honoured (return value is
1). If the item was allocated at the time when the command was
invoked, the request is denied (return value is 0).</p></dd>
</dl></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<p>Two examples are provided. The first one mimics a step by step
interactive tclsh session, where each step is explained. The second
example shows the usage in a server application that talks to a
back-end application.</p>
<p><em>Example 1</em></p>
<p>This example presents an interactive tclsh session which considers the
case of a Car rental's collection of cars. Ten steps explain its usage
in chronological order, from the creation of the pool, via the most
important stages in the usage of a pool, to the final destruction.</p>
<p><em>Note aside:</em></p>
<p>In this example, brand names are used to label the various
items. However, a brand name could be regarded as a property of an
item. Because the pool command is not designed to manage properties of
items, they need to be managed separately. In the latter case the
items should be labeled with more neutral names such as: car1, car2,
car3 , etc ... and a separate database or array should hold the brand
names associated with the car labels.</p>
<pre class="example">      
     1. Load the package into an interpreter
     % package require pool
     0.1
      
     2. Create a pool object called `CarPool' with a maximum size of 55 items (cars):
     % pool CarPool 55
     CarPool
      
     4. Add items to the pool:
     % CarPool add Toyota Trabant Chrysler1 Chrysler2 Volkswagen
                   
     5. Somebody crashed the Toyota. Remove it from the pool as follows:
     % CarPool remove Toyota
      
     6. Acquired a new car for the pool. Add it as follows:
     % CarPool add Nissan
      
     7. Check whether the pool was adjusted correctly:
     % CarPool info allitems
     Trabant Chrysler1 Chrysler2 Volkswagen Nissan
</pre>
<p>Suspend the interactive session temporarily, and show the programmatic
use of the request subcommand:</p>
<pre class="example">     
     # Mrs. Swift needs a car. She doesn't have a preference for a
     # particular car. We'll issue a request on her behalf as follows:
     if { [CarPool request car -allocID &quot;Mrs. Swift&quot;] }  {
         # request was honoured, process the variable `car'
         puts &quot;$car has been allocated to [CarPool info allocID $car].&quot;
     } else {
         # request was denied
          puts &quot;No car available.&quot;
     }
</pre>
<p>Note how the <b class="cmd">if</b> command uses the value returned by the
<b class="method">request</b> subcommand.</p>
<pre class="example">      
     # Suppose Mr. Wiggly has a preference for the Trabant:
     if { [CarPool request car -allocID &quot;Mr. Wiggly&quot; -prefer Trabant] }  {
         # request was honoured, process the variable `car'
         puts &quot;$car has been allocated to [CarPool info allocID $car].&quot;
     } else {
         # request was denied
          puts &quot;The Trabant was not available.&quot;
     }
</pre>
<p>Resume the interactive session:</p>
<pre class="example">
     8. When the car is returned then you can render it available by:
     % CarPool release Trabant
      
     9. When done, you delete the pool.
     % CarPool destroy
     Couldn't destroy `CarPool' because some items are still allocated.
      
     Oops, forgot that Mrs. Swift still occupies a car.
      
     10. We force the destruction of the pool as follows: 
     % CarPool destroy -force
</pre>
<p><em>Example 2</em></p>
<p>This example describes the case from which the author's need for pool
management originated. It is an example of a server application that
receives requests from client applications. The client requests are
dispatched onto a back-end application before being returned to the
client application. In many cases there are a few equivalent instances
of back-end applications to which a client request may be passed
along. The file descriptors that identify the channels to these
back-end instances make up a pool of connections. A particular
connection may be allocated to just one client request at a time.</p>
<pre class="example"> 
     # Create the pool of connections (pipes)
     set maxpipes 10
     pool Pipes $maxpipes
     for {set i 0} {$i &lt; $maxpipes} {incr i} {
         set fd [open &quot;|backendApplication&quot; w+]
         Pipes add $fd
     }
      
     # A client request comes in. The request is identified as `clientX'.
     # Dispatch it onto an instance of a back-end application
     if { [Pipes request fd -allocID clientX] } {
         # a connection was allocated
         # communicate to the back-end application via the variable `fd'
         puts $fd &quot;someInstruction&quot;
         # ...... etc.
     } else {
         # all connections are currently occupied
         # store the client request in a queue for later processing,
         # or return a 'Server busy' message to the client.
     }
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: pool</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key725">discrete items</a>, <a href="../../../../index.html#key726">finite</a>, <a href="../../../../index.html#key255">pool</a>, <a href="../../../../index.html#key285">struct</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Erik Leunissen &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/prioqueue.html.






























































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>struct::prioqueue - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/prioqueue.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003 Michael Schlenker &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::prioqueue.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::prioqueue(n) 1.4 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::prioqueue - Create and manipulate prioqueue objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::prioqueue <span class="opt">?1.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::struct::prioqueue</b> <span class="opt">?<b class="option">-ascii|-dictionary|-integer|-real</b>?</span> <span class="opt">?<i class="arg">prioqueueName</i>?</span></a></li>
<li><a href="#2"><i class="arg">prioqueueName</i> <b class="cmd">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">prioqueueName</i> <b class="cmd">clear</b></a></li>
<li><a href="#4"><i class="arg">prioqueueName</i> <b class="cmd"><a href="../../../../index.html#key209">remove</a></b> <i class="arg">item</i></a></li>
<li><a href="#5"><i class="arg">prioqueueName</i> <b class="cmd">destroy</b></a></li>
<li><a href="#6"><i class="arg">prioqueueName</i> <b class="cmd">get</b> <span class="opt">?<i class="arg">count</i>?</span></a></li>
<li><a href="#7"><i class="arg">prioqueueName</i> <b class="cmd">peek</b> <span class="opt">?<i class="arg">count</i>?</span></a></li>
<li><a href="#8"><i class="arg">prioqueueName</i> <b class="cmd">peekpriority</b> <span class="opt">?<i class="arg">count</i>?</span></a></li>
<li><a href="#9"><i class="arg">prioqueueName</i> <b class="cmd">put</b> <i class="arg">item prio</i> <span class="opt">?<i class="arg">item prio ...</i>?</span></a></li>
<li><a href="#10"><i class="arg">prioqueueName</i> <b class="cmd">size</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package implements a simple priority queue using nested tcl lists.</p>
<p>The command <b class="cmd">::struct::prioqueue</b> creates a new priority queue
with default priority key type <i class="arg">-integer</i>. This means that keys
given to the <b class="method">put</b> subcommand must have this type.</p>
<p>This also sets the priority ordering. For key types <i class="arg">-ascii</i> and
<i class="arg">-dictionary</i> the data is sorted in ascending order (as with
<b class="cmd">lsort</b> <i class="arg">-increasing</i>), thereas for <i class="arg">-integer</i> and
<i class="arg">-real</i> the data is sorted in descending order (as with
<b class="cmd">lsort</b> <i class="arg">-decreasing</i>).</p>
<p>Prioqueue names are unrestricted, but may be recognized as options if
no priority type is given.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::struct::prioqueue</b> <span class="opt">?<b class="option">-ascii|-dictionary|-integer|-real</b>?</span> <span class="opt">?<i class="arg">prioqueueName</i>?</span></a></dt>
<dd><p>The <b class="cmd">::struct::prioqueue</b> command creates a new prioqueue object
with an associated global Tcl command whose name is
<em>prioqueueName</em>. This command may be used to invoke various
operations on the prioqueue.  It has the following general form:</p></dd>
<dt><a name="2"><i class="arg">prioqueueName</i> <b class="cmd">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><b class="cmd">option</b> and the <i class="arg">arg</i>s determine the exact behavior of the
command.  The following commands are possible for prioqueue objects:</p></dd>
<dt><a name="3"><i class="arg">prioqueueName</i> <b class="cmd">clear</b></a></dt>
<dd><p>Remove all items from the prioqueue.</p></dd>
<dt><a name="4"><i class="arg">prioqueueName</i> <b class="cmd"><a href="../../../../index.html#key209">remove</a></b> <i class="arg">item</i></a></dt>
<dd><p>Remove the selected item from this priority queue.</p></dd>
<dt><a name="5"><i class="arg">prioqueueName</i> <b class="cmd">destroy</b></a></dt>
<dd><p>Destroy the prioqueue, including its storage space and associated
command.</p></dd>
<dt><a name="6"><i class="arg">prioqueueName</i> <b class="cmd">get</b> <span class="opt">?<i class="arg">count</i>?</span></a></dt>
<dd><p>Return the front <i class="arg">count</i> items of the prioqueue (but not their
priorities) and remove them from the prioqueue. 
If <i class="arg">count</i> is not specified, it defaults to 1.  If <i class="arg">count</i> is
1, the result is a simple string; otherwise, it is a list.  If
specified, <i class="arg">count</i> must be greater than or equal to 1.  If there
are no or too few items in the prioqueue, this command will throw an
error.</p></dd>
<dt><a name="7"><i class="arg">prioqueueName</i> <b class="cmd">peek</b> <span class="opt">?<i class="arg">count</i>?</span></a></dt>
<dd><p>Return the front <i class="arg">count</i> items of the prioqueue (but not their
priorities), without removing them from the prioqueue.
If <i class="arg">count</i> is not specified, it defaults to 1.  If <i class="arg">count</i> is
1, the result is a simple string; otherwise, it is a list.  If
specified, <i class="arg">count</i> must be greater than or equal to 1.  If there
are no or too few items in the queue, this command will throw an
error.</p></dd>
<dt><a name="8"><i class="arg">prioqueueName</i> <b class="cmd">peekpriority</b> <span class="opt">?<i class="arg">count</i>?</span></a></dt>
<dd><p>Return the front <i class="arg">count</i> items priority keys, without removing
them from the prioqueue.
If <i class="arg">count</i> is not specified, it defaults to 1.  If <i class="arg">count</i> is
1, the result is a simple string; otherwise, it is a list.  If
specified, <i class="arg">count</i> must be greater than or equal to 1.  If there
are no or too few items in the queue, this command will throw an
error.</p></dd>
<dt><a name="9"><i class="arg">prioqueueName</i> <b class="cmd">put</b> <i class="arg">item prio</i> <span class="opt">?<i class="arg">item prio ...</i>?</span></a></dt>
<dd><p>Put the <i class="arg">item</i> or items specified into the prioqueue. <i class="arg">prio</i>
must be a valid priority key for this type of prioqueue, otherwise an
error is thrown and no item is added.  Items are inserted at their
priority ranking. Items with equal priority are added in the order
they were added.</p></dd>
<dt><a name="10"><i class="arg">prioqueueName</i> <b class="cmd">size</b></a></dt>
<dd><p>Return the number of items in the prioqueue.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: prioqueue</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key692">ordered list</a>, <a href="../../../../index.html#key260">prioqueue</a>, <a href="../../../../index.html#key693">priority queue</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003 Michael Schlenker &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/queue.html.







































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::queue - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/queue.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ struct::queue.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::queue(n) 1.4.4 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::queue - Create and manipulate queue objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">struct::queue <span class="opt">?1.4.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><i class="arg">queueName</i> <b class="cmd">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><i class="arg">queueName</i> <b class="cmd">clear</b></a></li>
<li><a href="#3"><i class="arg">queueName</i> <b class="cmd">destroy</b></a></li>
<li><a href="#4"><i class="arg">queueName</i> <b class="cmd">get</b> <span class="opt">?<i class="arg">count</i>?</span></a></li>
<li><a href="#5"><i class="arg">queueName</i> <b class="cmd">peek</b> <span class="opt">?<i class="arg">count</i>?</span></a></li>
<li><a href="#6"><i class="arg">queueName</i> <b class="cmd">put</b> <i class="arg">item</i> <span class="opt">?<i class="arg">item ...</i>?</span></a></li>
<li><a href="#7"><i class="arg">queueName</i> <b class="cmd">unget</b> <i class="arg">item</i></a></li>
<li><a href="#8"><i class="arg">queueName</i> <b class="cmd">size</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="namespace">::struct</b> namespace contains a commands for processing
finite queues.</p>
<p>It exports a single command, <b class="cmd">::struct::queue</b>. All functionality
provided here can be reached through a subcommand of this command.</p>
<p><em>Note:</em> As of version 1.4.1 of this package a critcl based C
implementation is available. This implementation however requires Tcl
8.4 to run.</p>
<p>The <b class="cmd">::struct::queue</b> command creates a new queue object with an
associated global Tcl command whose name is <em>queueName</em>.  This
command may be used to invoke various operations on the queue.  It has
the following general form:</p>
<dl class="definitions">
<dt><a name="1"><i class="arg">queueName</i> <b class="cmd">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.  The following commands are possible for queue objects:</p></dd>
<dt><a name="2"><i class="arg">queueName</i> <b class="cmd">clear</b></a></dt>
<dd><p>Remove all items from the queue.</p></dd>
<dt><a name="3"><i class="arg">queueName</i> <b class="cmd">destroy</b></a></dt>
<dd><p>Destroy the queue, including its storage space and associated command.</p></dd>
<dt><a name="4"><i class="arg">queueName</i> <b class="cmd">get</b> <span class="opt">?<i class="arg">count</i>?</span></a></dt>
<dd><p>Return the front <i class="arg">count</i> items of the queue and remove them from
the queue.  If <i class="arg">count</i> is not specified, it defaults to 1.  If
<i class="arg">count</i> is 1, the result is a simple string; otherwise, it is a
list.  If specified, <i class="arg">count</i> must be greater than or equal to 1.
If there are not enough items in the queue to fulfull the request,
this command will throw an error.</p></dd>
<dt><a name="5"><i class="arg">queueName</i> <b class="cmd">peek</b> <span class="opt">?<i class="arg">count</i>?</span></a></dt>
<dd><p>Return the front <i class="arg">count</i> items of the queue, without removing them
from the queue.  If <i class="arg">count</i> is not specified, it defaults to 1.
If <i class="arg">count</i> is 1, the result is a simple string; otherwise, it is a
list.  If specified, <i class="arg">count</i> must be greater than or equal to 1.
If there are not enough items in the queue to fulfull the request,
this command will throw an error.</p></dd>
<dt><a name="6"><i class="arg">queueName</i> <b class="cmd">put</b> <i class="arg">item</i> <span class="opt">?<i class="arg">item ...</i>?</span></a></dt>
<dd><p>Put the <i class="arg">item</i> or items specified into the queue.  If more than
one <i class="arg">item</i> is given, they will be added in the order they are
listed.</p></dd>
<dt><a name="7"><i class="arg">queueName</i> <b class="cmd">unget</b> <i class="arg">item</i></a></dt>
<dd><p>Put the <i class="arg">item</i> into the queue, at the front, i.e. before any other
items already in the queue. This makes this operation the complement
to the method <b class="method">get</b>.</p></dd>
<dt><a name="8"><i class="arg">queueName</i> <b class="cmd">size</b></a></dt>
<dd><p>Return the number of items in the queue.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: queue</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key256">graph</a>, <a href="../../../../index.html#key252">list</a>, <a href="../../../../index.html#key55">matrix</a>, <a href="../../../../index.html#key255">pool</a>, <a href="../../../../index.html#key260">prioqueue</a>, <a href="../../../../index.html#key259">record</a>, <a href="../../../../index.html#key253">set</a>, <a href="../../../../index.html#key258">skiplist</a>, <a href="../../../../index.html#key257">stack</a>, <a href="../../../../index.html#key254">tree</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/record.html.
















































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::record - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/record.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002, Brett Schwarz &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::record.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::record(n) 1.2.1 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::record - Define and create records (similar to 'C' structures)</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">RECORD MEMBERS</a></li>
<li class="section"><a href="#section3">RECORD COMMAND</a></li>
<li class="section"><a href="#section4">INSTANCE COMMAND</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::record <span class="opt">?1.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">record define</b> <i class="arg">recordName</i> <i class="arg">recordMembers</i> <span class="opt">?<i class="arg">instanceName1 instanceName2 ...</i>?</span></a></li>
<li><a href="#2"><b class="cmd">record show</b> <i class="arg">record</i></a></li>
<li><a href="#3"><b class="cmd">record show</b> <i class="arg">instances</i> <i class="arg">recordName</i></a></li>
<li><a href="#4"><b class="cmd">record show</b> <i class="arg">members</i> <i class="arg">recordName</i></a></li>
<li><a href="#5"><b class="cmd">record show</b> <i class="arg">values</i> <i class="arg">instanceName</i></a></li>
<li><a href="#6"><b class="cmd">record exists</b> <i class="arg">record</i> <i class="arg">recordName</i></a></li>
<li><a href="#7"><b class="cmd">record exists</b> <i class="arg">instance</i> <i class="arg">instanceName</i></a></li>
<li><a href="#8"><b class="cmd">record delete</b> <i class="arg">record</i> <i class="arg">recordName</i></a></li>
<li><a href="#9"><b class="cmd">record delete</b> <i class="arg">instance</i> <i class="arg">instanceName</i></a></li>
<li><a href="#10"><i class="arg">recordName</i> <b class="method"><i class="arg">instanceName|#auto</i></b> <span class="opt">?<i class="arg">-member1 value1 -member2 value2 ...</i>?</span></a></li>
<li><a href="#11"><i class="arg">instanceName</i> <b class="method">cget</b> <span class="opt">?<i class="arg">-member1 -member2 ...</i>?</span></a></li>
<li><a href="#12"><i class="arg">instanceName</i> <b class="method">configure</b> <span class="opt">?<i class="arg">-member1 value1 -member2 value2 ...</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::record</b> package provides a mechanism to group variables together
as one data structure, similar to a 'C' structure. The members of a 
record can be variables or other records. However, a record can not contain circular
record, i.e. records that contain the same record as a
member.</p>
<p>This package was structured so that it is very similar to how Tk objects work. Each record
definition creates a record object that encompasses that definition. Subsequently, that
record object can create instances of that record. These instances can then
be manipulated with the <b class="method">cget</b> and <b class="method">configure</b> methods.</p>
<p>The package only contains one top level command, but several sub commands (see below). It also obeys the namespace in which the record was define, hence the objects returned are fully qualified.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">record define</b> <i class="arg">recordName</i> <i class="arg">recordMembers</i> <span class="opt">?<i class="arg">instanceName1 instanceName2 ...</i>?</span></a></dt>
<dd><p>Defines a record. <i class="arg">recordName</i> is the name of the record, and is also
used as an object command. This object command is used to create instances of the
record definition. <i class="arg">recordMembers</i> are the members of
the record that make up the record definition. These are variables
and other record. If optional <i class="arg">instanceName</i> args are given, then an instance
is generated after the definition is created for each <i class="arg">instanceName</i>.</p></dd>
<dt><a name="2"><b class="cmd">record show</b> <i class="arg">record</i></a></dt>
<dd><p>Returns a list of records that have been defined.</p></dd>
<dt><a name="3"><b class="cmd">record show</b> <i class="arg">instances</i> <i class="arg">recordName</i></a></dt>
<dd><p>Returns the instances that have been instantiated by
<i class="arg">recordName</i>.</p></dd>
<dt><a name="4"><b class="cmd">record show</b> <i class="arg">members</i> <i class="arg">recordName</i></a></dt>
<dd><p>Returns the members that are defined for
record <i class="arg">recordName</i>. It returns the same format as how the
records were defined.</p></dd>
<dt><a name="5"><b class="cmd">record show</b> <i class="arg">values</i> <i class="arg">instanceName</i></a></dt>
<dd><p>Returns a list of values that are set for the instance
<i class="arg">instanceName</i>. The output is a list of key/value pairs. If there
are nested records, then the values of the nested records will 
itself be a list.</p></dd>
<dt><a name="6"><b class="cmd">record exists</b> <i class="arg">record</i> <i class="arg">recordName</i></a></dt>
<dd><p>Tests for the existence of a <i class="arg">record</i> with the
name <i class="arg">recordName</i>.</p></dd>
<dt><a name="7"><b class="cmd">record exists</b> <i class="arg">instance</i> <i class="arg">instanceName</i></a></dt>
<dd><p>Tests for the existence of a <i class="arg">instance</i> with the
name <i class="arg">instanceName</i>.</p></dd>
<dt><a name="8"><b class="cmd">record delete</b> <i class="arg">record</i> <i class="arg">recordName</i></a></dt>
<dd><p>Deletes <i class="arg">recordName</i>, and all instances of <i class="arg">recordName</i>. It will return
an error if the record does not exist.</p></dd>
<dt><a name="9"><b class="cmd">record delete</b> <i class="arg">instance</i> <i class="arg">instanceName</i></a></dt>
<dd><p>Deletes <i class="arg">instance</i> with the name of <i class="arg">instanceName</i>. It
will return an error if the instance does not exist.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">RECORD MEMBERS</a></h2>
<p>Record members can either be variables, or other records, However, the
same record can not be nested witin itself (circular). To define a
nested record, you need to specify the <b class="const">record</b> keyword, along
the with name of the record, and the name of the instance of that
nested record. For example, it would look like this:</p>
<pre class="example">
# this is the nested record
record define mynestedrecord {
    nest1
    nest2
}
# This is the main record
record define myrecord {
    mem1
    mem2
    {record mynestedrecord mem3}
}
</pre>
<p>You can also assign default or initial values to the members of a record,
by enclosing the member entry in braces:</p>
<pre class="example">
record define myrecord {
    mem1
    {mem2 5}
}
</pre>
<p>All instances created from this record definition, will initially have 5 as
the value for <i class="arg">mem2</i>. If no default is given, then the value will be the empty string.</p>
<p><em>Getting Values</em></p>
<p>To get a value of a member, there are several ways to do this.</p>
<ol class="enumerated">
<li><p>To get a member value, then use the instance built-in <b class="method">cget</b> method:</p>
<p><i class="arg">instanceName</i> <b class="method">cget</b> -mem1</p></li>
<li><p>To get multiple member values, you can specify them all in one command:</p>
<p><i class="arg">instanceName</i> <b class="method">cget</b> -mem1 -mem2</p></li>
<li><p>To get a list of the key/value of all of the members, there are 3 ways:</p>
<p>- <i class="arg">instanceName</i> <b class="method">cget</b></p>
<p>- <i class="arg">instanceName</i> <b class="method">configure</b></p>
<p>- <i class="arg">instanceName</i></p></li>
<li><p>To get a value of a nested member, then use the dot notation:</p>
<p><i class="arg">instanceName</i> <b class="method">cget</b> -mem3.nest1</p></li>
</ol>
<p><em>Setting Values</em></p>
<p>To set a value of a member, there are several ways to do this.</p>
<ol class="enumerated">
<li><p>To set a member value, then use the instance built-in <b class="method">configure</b> method:</p>
<p><i class="arg">instanceName</i> <b class="method">configure</b> -mem1 val1</p></li>
<li><p>To set multiple member values, you can specify them all in one command:</p>
<p><i class="arg">instanceName</i> <b class="method">configure</b> -mem1 va1 -mem2 val2</p></li>
<li><p>To set a value of a nested member, then use the dot notation:</p>
<p><i class="arg">instanceName</i> <b class="method">configure</b> -mem3.nest1 value</p></li>
</ol>
<p><em>Alias access</em></p>
<p>In the original implementation, access was done by using dot notation similar to how 'C' structures are accessed. However, 
there was a concensus to make the interface more Tcl like, which made sense. However, the original alias access still
exists. It might prove to be helpful to some.</p>
<p>Basically, for every member of every instance, an alias is created. This alias is used to get and set values for that
member. An example will illustrate the point, using the above defined records:</p>
<pre class="example">
# Create an instance first
% myrecord inst1
::inst1
% # To get a member of an instance, just use the 
% # alias (it behaves like a Tcl command):
% inst1.mem1
%
% # To set a member via the alias, just include 
% # a value (optionally the equal sign - syntactic sugar)
% inst1.mem1 = 5
5
% inst1.mem1
5
% # For nested records, just continue with the 
% # dot notation (note no equal sign)
% inst1.mem3.nest1 10
10
% inst1.mem3.nest1
10
% # just the instance by itself gives all 
% # member/values pairs for that instance
% inst1
-mem1 5 -mem2 {} -mem3 {-nest1 10 -nest2 {}}
% # and to get all members within the nested record
% inst1.mem3
-nest1 10 -nest2 {}
%
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">RECORD COMMAND</a></h2>
<p>The following subcommands and corresponding arguments are available to any
record command:</p>
<dl class="definitions">
<dt><a name="10"><i class="arg">recordName</i> <b class="method"><i class="arg">instanceName|#auto</i></b> <span class="opt">?<i class="arg">-member1 value1 -member2 value2 ...</i>?</span></a></dt>
<dd><p>Using the <i class="arg">recordName</i> object command that was created from the record definition, 
instances of the record definition can be created. Once a instance is
created, then it inherits the members of the record definition, very
similar to how objects work. During instance generation, an object command for the instance
is created as well, using <i class="arg">instanceName</i>. This object command is used
to access the data members of the instance. During the instantiation, values for
that instance can be given, <em>but</em> all values must be given, and be given
in key/value pairs. Nested records, need to be in list format.</p>
<p>Optionally, <i class="arg">#auto</i> can be used in place of <i class="arg">instanceName</i>. When #auto is used,
then a instance name will automatically be generated, of the form recordName&lt;integer&gt;, where
&lt;integer&gt; is a unique integer (starting at 0) that is generated.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">INSTANCE COMMAND</a></h2>
<p>The following subcommands and corresponding arguments are available to
any record instance command:</p>
<dl class="definitions">
 
<dt><a name="11"><i class="arg">instanceName</i> <b class="method">cget</b> <span class="opt">?<i class="arg">-member1 -member2 ...</i>?</span></a></dt>
<dd><p>Each instance has the sub command <b class="method">cget</b> associated with it. This
is very similar to how Tk widget's cget command works. It queries
the values of the member for that particular instance. If
no arguments are given, then a key/value list is returned.</p></dd>
<dt><a name="12"><i class="arg">instanceName</i> <b class="method">configure</b> <span class="opt">?<i class="arg">-member1 value1 -member2 value2 ...</i>?</span></a></dt>
<dd><p>Each instance has the sub command <b class="method">configure</b> associated with it. This
is very similar to how Tk widget's configure command works. It sets
the values of the particular member for that particular instance. If
no arguments are given, then a key/value list is returned.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<p>Two examples are provided to give an good illustration on how to use
this package.</p>
<p><em>Example 1</em></p>
<p>Probably the most obvious example would be to hold contact information,
such as addresses, phone numbers, comments, etc. Since a person can have
multiple phone numbers, multiple email addresses, etc, we will use nested
records to define these. So, the first thing we do is define the nested
records:</p>
<pre class="example">
##
##  This is an interactive example, to see what is 
##  returned by each command as well.
##
% namespace import ::struct::record::*
% # define a nested record. Notice that country has default 'USA'.
% record define locations {
    street
    street2
    city
    state
    zipcode
    {country USA}
    phone
}
::locations
% # Define the main record. Notice that it uses the location record twice.
% record define contacts {
    first 
    middle 
    last 
    {record locations home}
    {record locations work}
}
::contacts
% # Create an instance for the contacts record.
% contacts cont1
::cont1
% # Display some introspection values
% record show records
::contacts ::locations
% #
% record show values cont1
-first {} -middle {} -last {} -home {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}} -work {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}}
% #
% record show instances contacts
::cont1
% #
% cont1 config
-first {} -middle {} -last {} -home {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}} -work {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}}
% #
% cont1 cget
-first {} -middle {} -last {} -home {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}} -work {-street {} -street2 {} -city {} -state {} -zipcode {} -country USA -phone {}}
% # copy one record to another record
% record define contacts2 [record show members contacts]
::contacts2
% record show members contacts2
first middle last {record locations home} {record locations work}
% record show members contacts
first middle last {record locations home} {record locations work}
%
</pre>
<p><em>Example 1</em></p>
<p>This next example just illustrates a simple linked list</p>
<pre class="example">
% # define a very simple record for linked list
% record define llist {
    value
    next
}
::llist
% llist lstart
::lstart
% lstart config -value 1 -next [llist #auto]
% [lstart cget -next] config -value 2 -next [llist #auto]
% [[lstart cget -next] cget -next] config -value 3 -next &quot;end&quot;
% set next lstart
lstart
% while 1 {
lappend values [$next cget -value]
set next [$next cget -next]
if {[string match &quot;end&quot; $next]} {break}
}
% puts &quot;$values&quot;
1 2 3
% # cleanup linked list
% # We could just use delete record llist also
% foreach I [record show instances llist] {
record delete instance $I
}
% record show instances llist
%
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: record</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key286">data structures</a>, <a href="../../../../index.html#key259">record</a>, <a href="../../../../index.html#key285">struct</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, Brett Schwarz &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/skiplist.html.








































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::skiplist - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/skiplist.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2000 Keith Vetter
   -->
<! -- CVS: $Id$ struct::skiplist.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::skiplist(n) 1.3 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::skiplist - Create and manipulate skiplists</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::skiplist <span class="opt">?1.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">skiplistName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><i class="arg">skiplistName</i> <b class="method">delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i>...?</span></a></li>
<li><a href="#3"><i class="arg">skiplistName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">skiplistName</i> <b class="method">insert</b> <i class="arg">key value</i></a></li>
<li><a href="#5"><i class="arg">skiplistName</i> <b class="method">search</b> <i class="arg">node</i> <span class="opt">?<b class="const">-key</b> <i class="arg">key</i>?</span></a></li>
<li><a href="#6"><i class="arg">skiplistName</i> <b class="method">size</b></a></li>
<li><a href="#7"><i class="arg">skiplistName</i> <b class="method">walk</b> <i class="arg">cmd</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::skiplist</b> command creates a new skiplist object
with an associated global Tcl command whose name is
<i class="arg">skiplistName</i>. This command may be used to invoke various
operations on the skiplist. It has the following general form:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">skiplistName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>Skip lists are an alternative data structure to binary trees. They can
be used to maintain ordered lists over any sequence of insertions and
deletions. Skip lists use randomness to achieve probabilistic
balancing, and as a result the algorithms for insertion and deletion
in skip lists are much simpler and faster than those for binary trees.</p>
<p>To read more about skip lists see Pugh, William.
<em>Skip lists: a probabilistic alternative to balanced trees</em>
In: Communications of the ACM, June 1990, 33(6) 668-676.</p>
<p>Currently, the key can be either a number or a string, and comparisons
are performed with the built in greater than operator.
The following commands are possible for skiplist objects:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">skiplistName</i> <b class="method">delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i>...?</span></a></dt>
<dd><p>Remove the specified nodes from the skiplist.</p></dd>
<dt><a name="3"><i class="arg">skiplistName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroy the skiplist, including its storage space and associated command.</p></dd>
<dt><a name="4"><i class="arg">skiplistName</i> <b class="method">insert</b> <i class="arg">key value</i></a></dt>
<dd><p>Insert a node with the given <i class="arg">key</i> and <i class="arg">value</i> into the
skiplist. If a node with that key already exists, then the that node's
value is updated and its node level is returned. Otherwise a new node
is created and 0 is returned.</p></dd>
<dt><a name="5"><i class="arg">skiplistName</i> <b class="method">search</b> <i class="arg">node</i> <span class="opt">?<b class="const">-key</b> <i class="arg">key</i>?</span></a></dt>
<dd><p>Search for a given key in a skiplist. If not found then 0 is returned.
If found, then a two element list of 1 followed by the node's value is retuned.</p></dd>
<dt><a name="6"><i class="arg">skiplistName</i> <b class="method">size</b></a></dt>
<dd><p>Return a count of the number of nodes in the skiplist.</p></dd>
<dt><a name="7"><i class="arg">skiplistName</i> <b class="method">walk</b> <i class="arg">cmd</i></a></dt>
<dd><p>Walk the skiplist from the first node to the last. At each node, the
command <i class="arg">cmd</i> will be evaluated with the key and value of the
current node appended.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: skiplist</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key258">skiplist</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2000 Keith Vetter</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/stack.html.





















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>struct::stack - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/stack.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ struct::stack.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::stack(n) 1.5.3 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::stack - Create and manipulate stack objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">struct::stack <span class="opt">?1.5.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><i class="arg">stackName</i> <b class="cmd">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><i class="arg">stackName</i> <b class="method">clear</b></a></li>
<li><a href="#3"><i class="arg">stackName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">stackName</i> <b class="method">get</b></a></li>
<li><a href="#5"><i class="arg">stackName</i> <b class="method">getr</b></a></li>
<li><a href="#6"><i class="arg">stackName</i> <b class="method">peek</b> <span class="opt">?<i class="arg">count</i>?</span></a></li>
<li><a href="#7"><i class="arg">stackName</i> <b class="method">peekr</b> <span class="opt">?<i class="arg">count</i>?</span></a></li>
<li><a href="#8"><i class="arg">stackName</i> <b class="method">trim</b> <span class="opt">?<i class="arg">newsize</i>?</span></a></li>
<li><a href="#9"><i class="arg">stackName</i> <b class="method">trim*</b> <span class="opt">?<i class="arg">newsize</i>?</span></a></li>
<li><a href="#10"><i class="arg">stackName</i> <b class="method">pop</b> <span class="opt">?<i class="arg">count</i>?</span></a></li>
<li><a href="#11"><i class="arg">stackName</i> <b class="method">push</b> <i class="arg">item</i> <span class="opt">?<i class="arg">item...</i>?</span></a></li>
<li><a href="#12"><i class="arg">stackName</i> <b class="method">size</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="namespace">::struct</b> namespace contains a commands for processing
finite stacks.</p>
<p>It exports a single command, <b class="cmd">::struct::stack</b>. All functionality
provided here can be reached through a subcommand of this command.</p>
<p><em>Note:</em> As of version 1.3.3 of this package a critcl based C
implementation is available. This implementation however requires Tcl
8.4 to run.</p>
<p>The <b class="cmd">::struct::stack</b> command creates a new stack object with an
associated global Tcl command whose name is <em>stackName</em>.  This
command may be used to invoke various operations on the stack.  It has
the following general form:</p>
<dl class="definitions">
<dt><a name="1"><i class="arg">stackName</i> <b class="cmd">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.  The following commands are possible for stack objects:</p></dd>
<dt><a name="2"><i class="arg">stackName</i> <b class="method">clear</b></a></dt>
<dd><p>Remove all items from the stack.</p></dd>
<dt><a name="3"><i class="arg">stackName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroy the stack, including its storage space and associated command.</p></dd>
<dt><a name="4"><i class="arg">stackName</i> <b class="method">get</b></a></dt>
<dd><p>Returns the whole contents of the stack as a list, without removing
them from the stack.</p></dd>
<dt><a name="5"><i class="arg">stackName</i> <b class="method">getr</b></a></dt>
<dd><p>A variant of <b class="method">get</b>, which returns the contents in reversed order.</p></dd>
<dt><a name="6"><i class="arg">stackName</i> <b class="method">peek</b> <span class="opt">?<i class="arg">count</i>?</span></a></dt>
<dd><p>Return the top <i class="arg">count</i> items of the stack, without removing them from
the stack.  If <i class="arg">count</i> is not specified, it defaults to 1.  If
<i class="arg">count</i> is 1, the result is a simple string; otherwise, it is a
list.  If specified, <i class="arg">count</i> must be greater than or equal to 1.
If there are not enoughs items on the stack to fulfull the request,
this command will throw an error.</p></dd>
<dt><a name="7"><i class="arg">stackName</i> <b class="method">peekr</b> <span class="opt">?<i class="arg">count</i>?</span></a></dt>
<dd><p>A variant of <b class="method">peek</b>, which returns the items in reversed order.</p></dd>
<dt><a name="8"><i class="arg">stackName</i> <b class="method">trim</b> <span class="opt">?<i class="arg">newsize</i>?</span></a></dt>
<dd><p>Shrinks the stack to contain at most <i class="arg">newsize</i> elements and
returns a list containing the elements which were removed. Nothing is
done if the stack is already at the specified size, or smaller. In
that case the result is the empty list.</p></dd>
<dt><a name="9"><i class="arg">stackName</i> <b class="method">trim*</b> <span class="opt">?<i class="arg">newsize</i>?</span></a></dt>
<dd><p>A variant of <b class="method">trim</b> which performs the shrinking, but does not
return the removed elements.</p></dd>
<dt><a name="10"><i class="arg">stackName</i> <b class="method">pop</b> <span class="opt">?<i class="arg">count</i>?</span></a></dt>
<dd><p>Return the top <i class="arg">count</i> items of the stack, and remove them
from the stack.  If <i class="arg">count</i> is not specified, it defaults to 1.
If <i class="arg">count</i> is 1, the result is a simple string; otherwise, it is a
list.  If specified, <i class="arg">count</i> must be greater than or equal to 1.
If there are not enoughs items on the stack to fulfull the request,
this command will throw an error.</p></dd>
<dt><a name="11"><i class="arg">stackName</i> <b class="method">push</b> <i class="arg">item</i> <span class="opt">?<i class="arg">item...</i>?</span></a></dt>
<dd><p>Push the <i class="arg">item</i> or items specified onto the stack.  If more than
one <i class="arg">item</i> is given, they will be pushed in the order they are
listed.</p></dd>
<dt><a name="12"><i class="arg">stackName</i> <b class="method">size</b></a></dt>
<dd><p>Return the number of items on the stack.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: stack</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key256">graph</a>, <a href="../../../../index.html#key55">matrix</a>, <a href="../../../../index.html#key54">queue</a>, <a href="../../../../index.html#key254">tree</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/struct_list.html.































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::list - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/struct_list.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2003-2005 by Kevin B. Kenny. All rights reserved   -- Copyright &copy; 2003-2012 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::list.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::list(n) 1.8.2 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::list - Procedures for manipulating lists</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">LONGEST COMMON SUBSEQUENCE AND FILE COMPARISON</a></li>
<li class="section"><a href="#section4">TABLE JOIN</a></li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">struct::list <span class="opt">?1.8.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::struct::list</b> <b class="method">longestCommonSubsequence</b> <i class="arg">sequence1</i> <i class="arg">sequence2</i> <span class="opt">?<i class="arg">maxOccurs</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::struct::list</b> <b class="method">longestCommonSubsequence2</b> <i class="arg">sequence1 sequence2</i> <span class="opt">?<i class="arg">maxOccurs</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::struct::list</b> <b class="method">lcsInvert</b> <i class="arg">lcsData</i> <i class="arg">len1</i> <i class="arg">len2</i></a></li>
<li><a href="#4"><b class="cmd">::struct::list</b> <b class="method">lcsInvert2</b> <i class="arg">lcs1</i> <i class="arg">lcs2</i> <i class="arg">len1</i> <i class="arg">len2</i></a></li>
<li><a href="#5"><b class="cmd">::struct::list</b> <b class="method">lcsInvertMerge</b> <i class="arg">lcsData</i> <i class="arg">len1</i> <i class="arg">len2</i></a></li>
<li><a href="#6"><b class="cmd">::struct::list</b> <b class="method">lcsInvertMerge2</b> <i class="arg">lcs1</i> <i class="arg">lcs2</i> <i class="arg">len1</i> <i class="arg">len2</i></a></li>
<li><a href="#7"><b class="cmd">::struct::list</b> <b class="method">reverse</b> <i class="arg">sequence</i></a></li>
<li><a href="#8"><b class="cmd">::struct::list</b> <b class="method">shuffle</b> <i class="arg">list</i></a></li>
<li><a href="#9"><b class="cmd">::struct::list</b> <b class="method">assign</b> <i class="arg">sequence</i> <i class="arg">varname</i> <span class="opt">?<i class="arg">varname</i>?</span>...</a></li>
<li><a href="#10"><b class="cmd">::struct::list</b> <b class="method">flatten</b> <span class="opt">?<b class="option">-full</b>?</span> <span class="opt">?<b class="option">--</b>?</span> <i class="arg">sequence</i></a></li>
<li><a href="#11"><b class="cmd">::struct::list</b> <b class="method">map</b> <i class="arg">sequence</i> <i class="arg">cmdprefix</i></a></li>
<li><a href="#12"><b class="cmd">::struct::list</b> <b class="method">mapfor</b> <i class="arg">var</i> <i class="arg">sequence</i> <i class="arg">script</i></a></li>
<li><a href="#13"><b class="cmd">::struct::list</b> <b class="method">filter</b> <i class="arg">sequence</i> <i class="arg">cmdprefix</i></a></li>
<li><a href="#14"><b class="cmd">::struct::list</b> <b class="method">filterfor</b> <i class="arg">var</i> <i class="arg">sequence</i> <i class="arg">expr</i></a></li>
<li><a href="#15"><b class="cmd">::struct::list</b> <b class="method">split</b> <i class="arg">sequence</i> <i class="arg">cmdprefix</i> <span class="opt">?<i class="arg">passVar</i> <i class="arg">failVar</i>?</span></a></li>
<li><a href="#16"><b class="cmd">::struct::list</b> <b class="method">fold</b> <i class="arg">sequence</i> <i class="arg">initialvalue</i> <i class="arg">cmdprefix</i></a></li>
<li><a href="#17"><b class="cmd">::struct::list</b> <b class="method">shift</b> <i class="arg">listvar</i></a></li>
<li><a href="#18"><b class="cmd">::struct::list</b> <b class="method">iota</b> <i class="arg">n</i></a></li>
<li><a href="#19"><b class="cmd">::struct::list</b> <b class="method">equal</b> <i class="arg">a</i> <i class="arg">b</i></a></li>
<li><a href="#20"><b class="cmd">::struct::list</b> <b class="method">repeat</b> <i class="arg">size</i> <i class="arg">element1</i> <span class="opt">?<i class="arg">element2</i> <i class="arg">element3</i>...?</span></a></li>
<li><a href="#21"><b class="cmd">::struct::list</b> <b class="method">repeatn</b> <i class="arg">value</i> <i class="arg">size</i>...</a></li>
<li><a href="#22"><b class="cmd">::struct::list</b> <b class="method">dbJoin</b> <span class="opt">?<b class="option">-inner</b>|<b class="option">-left</b>|<b class="option">-right</b>|<b class="option">-full</b>?</span> <span class="opt">?<b class="option">-keys</b> <i class="arg">varname</i>?</span> {<i class="arg">keycol</i> <i class="arg">table</i>}...</a></li>
<li><a href="#23"><b class="cmd">::struct::list</b> <b class="method">dbJoinKeyed</b> <span class="opt">?<b class="option">-inner</b>|<b class="option">-left</b>|<b class="option">-right</b>|<b class="option">-full</b>?</span> <span class="opt">?<b class="option">-keys</b> <i class="arg">varname</i>?</span> <i class="arg">table</i>...</a></li>
<li><a href="#24"><b class="cmd">::struct::list</b> <b class="method">swap</b> <i class="arg">listvar</i> <i class="arg">i</i> <i class="arg">j</i></a></li>
<li><a href="#25"><b class="cmd">::struct::list</b> <b class="method">firstperm</b> <i class="arg">list</i></a></li>
<li><a href="#26"><b class="cmd">::struct::list</b> <b class="method">nextperm</b> <i class="arg">perm</i></a></li>
<li><a href="#27"><b class="cmd">::struct::list</b> <b class="method">permutations</b> <i class="arg">list</i></a></li>
<li><a href="#28"><b class="cmd">::struct::list</b> <b class="method">foreachperm</b> <i class="arg">var</i> <i class="arg">list</i> <i class="arg">body</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::list</b> namespace contains several useful commands
for processing Tcl lists. Generally speaking, they implement
algorithms more complex or specialized than the ones provided by Tcl
itself.</p>
<p>It exports only a single command, <b class="cmd">struct::list</b>. All
functionality provided here can be reached through a subcommand of
this command.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::struct::list</b> <b class="method">longestCommonSubsequence</b> <i class="arg">sequence1</i> <i class="arg">sequence2</i> <span class="opt">?<i class="arg">maxOccurs</i>?</span></a></dt>
<dd><p>Returns the longest common subsequence of elements in the two lists
<i class="arg">sequence1</i> and <i class="arg">sequence2</i>. If the <i class="arg">maxOccurs</i> parameter
is provided, the common subsequence is restricted to elements that
occur no more than <i class="arg">maxOccurs</i> times in <i class="arg">sequence2</i>.</p>
<p>The return value is a list of two lists of equal length. The first
sublist is of indices into <i class="arg">sequence1</i>, and the second sublist is
of indices into <i class="arg">sequence2</i>.  Each corresponding pair of indices
corresponds to equal elements in the sequences; the sequence returned
is the longest possible.</p></dd>
<dt><a name="2"><b class="cmd">::struct::list</b> <b class="method">longestCommonSubsequence2</b> <i class="arg">sequence1 sequence2</i> <span class="opt">?<i class="arg">maxOccurs</i>?</span></a></dt>
<dd><p>Returns an approximation to the longest common sequence of elements in
the two lists <i class="arg">sequence1</i> and <i class="arg">sequence2</i>.
If the <i class="arg">maxOccurs</i> parameter is omitted, the subsequence computed
is exactly the longest common subsequence; otherwise, the longest
common subsequence is approximated by first determining the longest
common sequence of only those elements that occur no more than
<i class="arg">maxOccurs</i> times in <i class="arg">sequence2</i>, and then using that result
to align the two lists, determining the longest common subsequences of
the sublists between the two elements.</p>
<p>As with <b class="method">longestCommonSubsequence</b>, the return value is a list
of two lists of equal length.  The first sublist is of indices into
<i class="arg">sequence1</i>, and the second sublist is of indices into
<i class="arg">sequence2</i>.  Each corresponding pair of indices corresponds to
equal elements in the sequences.  The sequence approximates the
longest common subsequence.</p></dd>
<dt><a name="3"><b class="cmd">::struct::list</b> <b class="method">lcsInvert</b> <i class="arg">lcsData</i> <i class="arg">len1</i> <i class="arg">len2</i></a></dt>
<dd><p>This command takes a description of a longest common subsequence
(<i class="arg">lcsData</i>), inverts it, and returns the result. Inversion means
here that as the input describes which parts of the two sequences are
identical the output describes the differences instead.</p>
<p>To be fully defined the lengths of the two sequences have to be known
and are specified through <i class="arg">len1</i> and <i class="arg">len2</i>.</p>
<p>The result is a list where each element describes one chunk of the
differences between the two sequences. This description is a list
containing three elements, a type and two pairs of indices into
<i class="arg">sequence1</i> and <i class="arg">sequence2</i> respectively, in this order.
The type can be one of three values:</p>
<dl class="definitions">
<dt><b class="const">added</b></dt>
<dd><p>Describes an addition. I.e. items which are missing in <i class="arg">sequence1</i>
can be found in <i class="arg">sequence2</i>.
The pair of indices into <i class="arg">sequence1</i> describes where the added
range had been expected to be in <i class="arg">sequence1</i>. The first index
refers to the item just before the added range, and the second index
refers to the item just after the added range.
The pair of indices into <i class="arg">sequence2</i> describes the range of items
which has been added to it. The first index refers to the first item
in the range, and the second index refers to the last item in the
range.</p></dd>
<dt><b class="const">deleted</b></dt>
<dd><p>Describes a deletion. I.e. items which are in <i class="arg">sequence1</i> are
missing from <i class="arg">sequence2</i>.
The pair of indices into <i class="arg">sequence1</i> describes the range of items
which has been deleted. The first index refers to the first item in
the range, and the second index refers to the last item in the range.
The pair of indices into <i class="arg">sequence2</i> describes where the deleted
range had been expected to be in <i class="arg">sequence2</i>. The first index
refers to the item just before the deleted range, and the second index
refers to the item just after the deleted range.</p></dd>
<dt><b class="const">changed</b></dt>
<dd><p>Describes a general change. I.e a range of items in <i class="arg">sequence1</i>
has been replaced by a different range of items in <i class="arg">sequence2</i>.
The pair of indices into <i class="arg">sequence1</i> describes the range of items
which has been replaced. The first index refers to the first item in
the range, and the second index refers to the last item in the range.
The pair of indices into <i class="arg">sequence2</i> describes the range of items
replacing the original range. Again the first index refers to the
first item in the range, and the second index refers to the last item
in the range.</p></dd>
</dl>
<pre class="example">
    sequence 1 = {a b r a c a d a b r a}
    lcs 1      =   {1 2   4 5     8 9 10}
    lcs 2      =   {0 1   3 4     5 6 7}
    sequence 2 =   {b r i c a     b r a c}
    Inversion  = {{deleted  {0  0} {-1 0}}
                  {changed  {3  3}  {2 2}}
                  {deleted  {6  7}  {4 5}}
                  {added   {10 11}  {8 8}}}
</pre>
<p><em>Notes:</em></p>
<ul class="itemized">
<li><p>An index of <b class="const">-1</b> in a <i class="term">deleted</i> chunk refers to just before
the first element of the second sequence.</p></li>
<li><p>Also an index equal to the length of the first sequence in an
<i class="term">added</i> chunk refers to just behind the end of the sequence.</p></li>
</ul></dd>
<dt><a name="4"><b class="cmd">::struct::list</b> <b class="method">lcsInvert2</b> <i class="arg">lcs1</i> <i class="arg">lcs2</i> <i class="arg">len1</i> <i class="arg">len2</i></a></dt>
<dd><p>Similar to <b class="method">lcsInvert</b>. Instead of directly taking the result
of a call to <b class="method">longestCommonSubsequence</b> this subcommand expects
the indices for the two sequences in two separate lists.</p></dd>
<dt><a name="5"><b class="cmd">::struct::list</b> <b class="method">lcsInvertMerge</b> <i class="arg">lcsData</i> <i class="arg">len1</i> <i class="arg">len2</i></a></dt>
<dd><p>Similar to <b class="method">lcsInvert</b>. It returns essentially the same
structure as that command, except that it may contain chunks of type
<b class="const">unchanged</b> too.</p>
<p>These new chunks describe the parts which are unchanged between the
two sequences. This means that the result of this command describes
both the changed and unchanged parts of the two sequences in one
structure.</p>
<pre class="example">
    sequence 1 = {a b r a c a d a b r a}
    lcs 1      =   {1 2   4 5     8 9 10}
    lcs 2      =   {0 1   3 4     5 6 7}
    sequence 2 =   {b r i c a     b r a c}
    Inversion/Merge  = {{deleted   {0  0} {-1 0}}
                        {unchanged {1  2}  {0 1}}
                        {changed   {3  3}  {2 2}}
                        {unchanged {4  5}  {3 4}}
                        {deleted   {6  7}  {4 5}}
                        {unchanged {8 10}  {5 7}}
                        {added    {10 11}  {8 8}}}
</pre>
</dd>
<dt><a name="6"><b class="cmd">::struct::list</b> <b class="method">lcsInvertMerge2</b> <i class="arg">lcs1</i> <i class="arg">lcs2</i> <i class="arg">len1</i> <i class="arg">len2</i></a></dt>
<dd><p>Similar to <b class="method">lcsInvertMerge</b>. Instead of directly taking the
result of a call to <b class="method">longestCommonSubsequence</b> this subcommand
expects the indices for the two sequences in two separate lists.</p></dd>
<dt><a name="7"><b class="cmd">::struct::list</b> <b class="method">reverse</b> <i class="arg">sequence</i></a></dt>
<dd><p>The subcommand takes a single <i class="arg">sequence</i> as argument and returns a new
sequence containing the elements of the input sequence in reverse
order.</p></dd>
<dt><a name="8"><b class="cmd">::struct::list</b> <b class="method">shuffle</b> <i class="arg">list</i></a></dt>
<dd><p>The subcommand takes a <i class="arg">list</i> and returns a copy of that list
with the elements it contains in random order. Every possible
ordering of elements is equally likely to be generated. The
Fisher-Yates shuffling algorithm is used internally.</p></dd>
<dt><a name="9"><b class="cmd">::struct::list</b> <b class="method">assign</b> <i class="arg">sequence</i> <i class="arg">varname</i> <span class="opt">?<i class="arg">varname</i>?</span>...</a></dt>
<dd><p>The subcommand assigns the first <b class="variable">n</b> elements of the input
<i class="arg">sequence</i> to the one or more variables whose names were listed
after the sequence, where <b class="variable">n</b> is the number of specified
variables.</p>
<p>If there are more variables specified than there are elements in the
<i class="arg">sequence</i> the empty string will be assigned to the superfluous
variables.</p>
<p>If there are more elements in the <i class="arg">sequence</i> than variable names
specified the subcommand returns a list containing the unassigned
elements. Else an empty list is returned.</p>
<pre class="example">
    tclsh&gt; ::struct::list assign {a b c d e} foo bar
    c d e
    tclsh&gt; set foo
    a
    tclsh&gt; set bar
    b
</pre>
</dd>
<dt><a name="10"><b class="cmd">::struct::list</b> <b class="method">flatten</b> <span class="opt">?<b class="option">-full</b>?</span> <span class="opt">?<b class="option">--</b>?</span> <i class="arg">sequence</i></a></dt>
<dd><p>The subcommand takes a single <i class="arg">sequence</i> and returns a new
sequence where one level of nesting was removed from the input
sequence. In other words, the sublists in the input sequence are
replaced by their elements.</p>
<p>The subcommand will remove any nesting it finds if the option
<b class="option">-full</b> is specified.</p>
<pre class="example">
    tclsh&gt; ::struct::list flatten {1 2 3 {4 5} {6 7} {{8 9}} 10}
    1 2 3 4 5 6 7 {8 9} 10
    tclsh&gt; ::struct::list flatten -full {1 2 3 {4 5} {6 7} {{8 9}} 10}
    1 2 3 4 5 6 7 8 9 10
</pre>
</dd>
<dt><a name="11"><b class="cmd">::struct::list</b> <b class="method">map</b> <i class="arg">sequence</i> <i class="arg">cmdprefix</i></a></dt>
<dd><p>The subcommand takes a <i class="arg">sequence</i> to operate on and a command
prefix (<i class="arg">cmdprefix</i>) specifying an operation, applies the command
prefix to each element of the sequence and returns a sequence
consisting of the results of that application.</p>
<p>The command prefix will be evaluated with a single word appended to
it. The evaluation takes place in the context of the caller of the
subcommand.</p>
<pre class="example">
    tclsh&gt; # squaring all elements in a list
    tclsh&gt; proc sqr {x} {expr {$x*$x}}
    tclsh&gt; ::struct::list map {1 2 3 4 5} sqr
    1 4 9 16 25
    tclsh&gt; # Retrieving the second column from a matrix
    tclsh&gt; # given as list of lists.
    tclsh&gt; proc projection {n list} {::lindex $list $n}
    tclsh&gt; ::struct::list map {{a b c} {1 2 3} {d f g}} {projection 1}
    b 2 f
</pre>
</dd>
<dt><a name="12"><b class="cmd">::struct::list</b> <b class="method">mapfor</b> <i class="arg">var</i> <i class="arg">sequence</i> <i class="arg">script</i></a></dt>
<dd><p>The subcommand takes a <i class="arg">sequence</i> to operate on and a tcl <i class="arg">script</i>,
applies the script to each element of the sequence and returns a sequence
consisting of the results of that application.</p>
<p>The script will be evaluated as is, and has access to the current list element
through the specified iteration variable <i class="arg">var</i>. The evaluation takes place
in the context of the caller of the subcommand.</p>
<pre class="example">
    tclsh&gt; # squaring all elements in a list
    tclsh&gt; ::struct::list mapfor x {1 2 3 4 5} {
	expr {$x * $x}
    }
    1 4 9 16 25
    tclsh&gt; # Retrieving the second column from a matrix
    tclsh&gt; # given as list of lists.
    tclsh&gt; ::struct::list mapfor x {{a b c} {1 2 3} {d f g}} {
	lindex $x 1
    }
    b 2 f
</pre>
</dd>
<dt><a name="13"><b class="cmd">::struct::list</b> <b class="method">filter</b> <i class="arg">sequence</i> <i class="arg">cmdprefix</i></a></dt>
<dd><p>The subcommand takes a <i class="arg">sequence</i> to operate on and a command
prefix (<i class="arg">cmdprefix</i>) specifying an operation, applies the command
prefix to each element of the sequence and returns a sequence
consisting of all elements of the <i class="arg">sequence</i> for which the command
prefix returned <b class="const">true</b>.
In other words, this command filters out all elements of the input
<i class="arg">sequence</i> which fail the test the <i class="arg">cmdprefix</i> represents, and
returns the remaining elements.</p>
<p>The command prefix will be evaluated with a single word appended to
it. The evaluation takes place in the context of the caller of the
subcommand.</p>
<pre class="example">
    tclsh&gt; # removing all odd numbers from the input
    tclsh&gt; proc even {x} {expr {($x % 2) == 0}}
    tclsh&gt; ::struct::list filter {1 2 3 4 5} even
    2 4
</pre>
<p><em>Note:</em> The <b class="method">filter</b> is a specialized application of
<b class="method">fold</b> where the result is extended with the current item or
not, depending o nthe result of the test.</p></dd>
<dt><a name="14"><b class="cmd">::struct::list</b> <b class="method">filterfor</b> <i class="arg">var</i> <i class="arg">sequence</i> <i class="arg">expr</i></a></dt>
<dd><p>The subcommand takes a <i class="arg">sequence</i> to operate on and a tcl expression
(<i class="arg">expr</i>) specifying a condition, applies the conditionto each element
of the sequence and returns a sequence consisting of all elements of the
<i class="arg">sequence</i> for which the expression returned <b class="const">true</b>.
In other words, this command filters out all elements of the input
<i class="arg">sequence</i> which fail the test the condition <i class="arg">expr</i> represents, and
returns the remaining elements.</p>
<p>The expression will be evaluated as is, and has access to the current list
element through the specified iteration variable <i class="arg">var</i>. The evaluation
takes place in the context of the caller of the subcommand.</p>
<pre class="example">
    tclsh&gt; # removing all odd numbers from the input
    tclsh&gt; ::struct::list filterfor x {1 2 3 4 5} {($x % 2) == 0}
    2 4
</pre>
</dd>
<dt><a name="15"><b class="cmd">::struct::list</b> <b class="method">split</b> <i class="arg">sequence</i> <i class="arg">cmdprefix</i> <span class="opt">?<i class="arg">passVar</i> <i class="arg">failVar</i>?</span></a></dt>
<dd><p>This is a variant of method <b class="method">filter</b>, see above. Instead of
returning just the elements passing the test we get lists of both
passing and failing elements.</p>
<p>If no variable names are specified then the result of the command will
be a list containing the list of passing elements, and the list of
failing elements, in this order. Otherwise the lists of passing and
failing elements are stored into the two specified variables, and the
result will be a list containing two numbers, the number of elements
passing the test, and the number of elements failing, in this order.</p>
<p>The interface to the test is the same as used by <b class="method">filter</b>.</p></dd>
<dt><a name="16"><b class="cmd">::struct::list</b> <b class="method">fold</b> <i class="arg">sequence</i> <i class="arg">initialvalue</i> <i class="arg">cmdprefix</i></a></dt>
<dd><p>The subcommand takes a <i class="arg">sequence</i> to operate on, an arbitrary
string <i class="arg">initial value</i> and a command prefix (<i class="arg">cmdprefix</i>)
specifying an operation.</p>
<p>The command prefix will be evaluated with two words appended to
it. The second of these words will always be an element of the
sequence. The evaluation takes place in the context of the caller of
the subcommand.</p>
<p>It then reduces the sequence into a single value through repeated
application of the command prefix and returns that value. This
reduction is done by</p>
<dl class="definitions">
<dt><b class="const">1</b></dt>
<dd><p>Application of the command to the initial value and the first element
of the list.</p></dd>
<dt><b class="const">2</b></dt>
<dd><p>Application of the command to the result of the last call and the
second element of the list.</p></dd>
<dt><b class="const">...</b></dt>
<dd></dd>
<dt><b class="const">i</b></dt>
<dd><p>Application of the command to the result of the last call and the
<b class="variable">i</b>'th element of the list.</p></dd>
<dt><b class="const">...</b></dt>
<dd></dd>
<dt><b class="const">end</b></dt>
<dd><p>Application of the command to the result of the last call and the last
element of the list. The result of this call is returned as the result
of the subcommand.</p></dd>
</dl>
<pre class="example">
    tclsh&gt; # summing the elements in a list.
    tclsh&gt; proc + {a b} {expr {$a + $b}}
    tclsh&gt; ::struct::list fold {1 2 3 4 5} 0 +
    15
</pre>
</dd>
<dt><a name="17"><b class="cmd">::struct::list</b> <b class="method">shift</b> <i class="arg">listvar</i></a></dt>
<dd><p>The subcommand takes the list contained in the variable named by
<i class="arg">listvar</i> and shifts it down one element.
After the call <i class="arg">listvar</i> will contain a list containing the second
to last elements of the input list. The first element of the ist is
returned as the result of the command. Shifting the empty list does
nothing.</p></dd>
<dt><a name="18"><b class="cmd">::struct::list</b> <b class="method">iota</b> <i class="arg">n</i></a></dt>
<dd><p>The subcommand returns a list containing the integer numbers
in the range <b class="const">[0,n)</b>. The element at index <b class="variable">i</b>
of the list contain the number <b class="const">i</b>.</p>
<p>For &quot;<i class="arg">n</i> == <b class="const">0</b>&quot; an empty list will be returned.</p></dd>
<dt><a name="19"><b class="cmd">::struct::list</b> <b class="method">equal</b> <i class="arg">a</i> <i class="arg">b</i></a></dt>
<dd><p>The subcommand compares the two lists <i class="arg">a</i> and <i class="arg">b</i> for
equality. In other words, they have to be of the same length and have
to contain the same elements in the same order. If an element is a
list the same definition of equality applies recursively.</p>
<p>A boolean value will be returned as the result of the command.
This value will be <b class="const">true</b> if the two lists are equal, and
<b class="const">false</b> else.</p></dd>
<dt><a name="20"><b class="cmd">::struct::list</b> <b class="method">repeat</b> <i class="arg">size</i> <i class="arg">element1</i> <span class="opt">?<i class="arg">element2</i> <i class="arg">element3</i>...?</span></a></dt>
<dd><p>The subcommand creates a list of length
&quot;<i class="arg">size</i> * <em>number of elements</em>&quot; by repeating <i class="arg">size</i>
times the sequence of elements
<i class="arg">element1</i> <i class="arg">element2</i> <i class="arg">...</i>.
<i class="arg">size</i> must be a positive integer, <i class="arg">element</i><b class="variable">n</b> can be any
Tcl value.
Note that <b class="cmd">repeat 1 arg ...</b>  is identical to
<b class="cmd">list arg ...</b>, though the <i class="arg">arg</i> is required
with <b class="method">repeat</b>.</p>
<p><em>Examples:</em></p>
<pre class="example">
    tclsh&gt; ::struct::list repeat 3 a
    a a a
    tclsh&gt; ::struct::list repeat 3 [::struct::list repeat 3 0]
    {0 0 0} {0 0 0} {0 0 0}
    tclsh&gt; ::struct::list repeat 3 a b c
    a b c a b c a b c
    tclsh&gt; ::struct::list repeat 3 [::struct::list repeat 2 a] b c
    {a a} b c {a a} b c {a a} b c
</pre>
</dd>
<dt><a name="21"><b class="cmd">::struct::list</b> <b class="method">repeatn</b> <i class="arg">value</i> <i class="arg">size</i>...</a></dt>
<dd><p>The subcommand creates a (nested) list containing the <i class="arg">value</i> in
all positions. The exact size and degree of nesting is determined by
the <i class="arg">size</i> arguments, all of which have to be integer numbers
greater than or equal to zero.</p>
<p>A single argument <i class="arg">size</i> which is a list of more than one element
will be treated as if more than argument <i class="arg">size</i> was specified.</p>
<p>If only one argument <i class="arg">size</i> is present the returned list will not
be nested, of length <i class="arg">size</i> and contain <i class="arg">value</i> in all
positions.
If more than one <i class="arg">size</i> argument is present the returned
list will be nested, and of the length specified by the last
<i class="arg">size</i> argument given to it. The elements of that list
are defined as the result of <b class="cmd">Repeat</b> for the same arguments,
but with the last <i class="arg">size</i> value removed.</p>
<p>An empty list will be returned if no <i class="arg">size</i> arguments are present.</p>
<pre class="example">
    tclsh&gt; ::struct::list repeatn  0 3 4
    {0 0 0} {0 0 0} {0 0 0} {0 0 0}
    tclsh&gt; ::struct::list repeatn  0 {3 4}
    {0 0 0} {0 0 0} {0 0 0} {0 0 0}
    tclsh&gt; ::struct::list repeatn  0 {3 4 5}
    {{0 0 0} {0 0 0} {0 0 0} {0 0 0}} {{0 0 0} {0 0 0} {0 0 0} {0 0 0}} {{0 0 0} {0 0 0} {0 0 0} {0 0 0}} {{0 0 0} {0 0 0} {0 0 0} {0 0 0}} {{0 0 0} {0 0 0} {0 0 0} {0 0 0}}
</pre>
</dd>
<dt><a name="22"><b class="cmd">::struct::list</b> <b class="method">dbJoin</b> <span class="opt">?<b class="option">-inner</b>|<b class="option">-left</b>|<b class="option">-right</b>|<b class="option">-full</b>?</span> <span class="opt">?<b class="option">-keys</b> <i class="arg">varname</i>?</span> {<i class="arg">keycol</i> <i class="arg">table</i>}...</a></dt>
<dd><p>The method performs a table join according to relational algebra. The
execution of any of the possible outer join operation is triggered by
the presence of either option <b class="option">-left</b>, <b class="option">-right</b>, or
<b class="option">-full</b>. If none of these options is present a regular inner
join will be performed. This can also be triggered by specifying
<b class="option">-inner</b>. The various possible join operations are explained in
detail in section <span class="sectref"><a href="#section4">TABLE JOIN</a></span>.</p>
<p>If the <b class="option">-keys</b> is present its argument is the name of a
variable to store the full list of found keys into. Depending on the
exact nature of the input table and the join mode the output table may
not contain all the keys by default. In such a case the caller can
declare a variable for this information and then insert it into the
output table on its own, as she will have more information about the
placement than this command.</p>
<p>What is left to explain is the format of the arguments.</p>
<p>The <i class="arg">keycol</i> arguments are the indices of the columns in the
tables which contain the key values to use for the joining. Each
argument applies to the table following immediately after it. The
columns are counted from <b class="const">0</b>, which references the first
column. The table associated with the column index has to have at
least <i class="arg">keycol</i>+1 columns. An error will be thrown if there are
less.</p>
<p>The <i class="arg">table</i> arguments represent a table or matrix of rows and
columns of values. We use the same representation as generated and
consumed by the methods <b class="method">get rect</b> and <b class="method">set rect</b> of
<b class="cmd"><a href="../../../../index.html#key55">matrix</a></b> objects. In other words, each argument is a list,
representing the whole matrix.  Its elements are lists too, each
representing a single rows of the matrix. The elements of the
row-lists are the column values.</p>
<p>The table resulting from the join operation is returned as the result
of the command. We use the same representation as described above for
the input <i class="arg">table</i>s.</p></dd>
<dt><a name="23"><b class="cmd">::struct::list</b> <b class="method">dbJoinKeyed</b> <span class="opt">?<b class="option">-inner</b>|<b class="option">-left</b>|<b class="option">-right</b>|<b class="option">-full</b>?</span> <span class="opt">?<b class="option">-keys</b> <i class="arg">varname</i>?</span> <i class="arg">table</i>...</a></dt>
<dd><p>The operations performed by this method are the same as described
above for <b class="method">dbJoin</b>. The only difference is in the specification
of the keys to use. Instead of using column indices separate from the
table here the keys are provided within the table itself. The row
elements in each <i class="arg">table</i> are not the lists of column values, but a
two-element list where the second element is the regular list of
column values and the first element is the key to use.</p></dd>
<dt><a name="24"><b class="cmd">::struct::list</b> <b class="method">swap</b> <i class="arg">listvar</i> <i class="arg">i</i> <i class="arg">j</i></a></dt>
<dd><p>The subcommand exchanges the elements at the indices <i class="arg">i</i> and
<i class="arg">j</i> in the list stored in the variable named by <i class="arg">listvar</i>. The
list is modified in place, and also returned as the result of the
subcommand.</p></dd>
<dt><a name="25"><b class="cmd">::struct::list</b> <b class="method">firstperm</b> <i class="arg">list</i></a></dt>
<dd><p>This subcommand returns the lexicographically first permutation of the
input <i class="arg">list</i>.</p></dd>
<dt><a name="26"><b class="cmd">::struct::list</b> <b class="method">nextperm</b> <i class="arg">perm</i></a></dt>
<dd><p>This subcommand accepts a permutation of a set of elements (provided
by <i class="arg">perm</i>) and returns the next permutatation in lexicographic
sequence.</p>
<p>The algorithm used here is by Donal E. Knuth, see section
<span class="sectref"><a href="#section5">REFERENCES</a></span> for details.</p></dd>
<dt><a name="27"><b class="cmd">::struct::list</b> <b class="method">permutations</b> <i class="arg">list</i></a></dt>
<dd><p>This subcommand returns a list containing all permutations of the
input <i class="arg">list</i> in lexicographic order.</p></dd>
<dt><a name="28"><b class="cmd">::struct::list</b> <b class="method">foreachperm</b> <i class="arg">var</i> <i class="arg">list</i> <i class="arg">body</i></a></dt>
<dd><p>This subcommand executes the script <i class="arg">body</i> once for each
permutation of the specified <i class="arg">list</i>. The permutations are visited
in lexicographic order, and the variable <i class="arg">var</i> is set to the
permutation for which <i class="arg">body</i> is currently executed. The result of
the loop command is the empty string.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">LONGEST COMMON SUBSEQUENCE AND FILE COMPARISON</a></h2>
<p>The <b class="method">longestCommonSubsequence</b> subcommand forms the core of a
flexible system for doing differential comparisons of files, similar
to the capability offered by the Unix command <b class="syscmd"><a href="../../../../index.html#key513">diff</a></b>.
While this procedure is quite rapid for many tasks of file comparison,
its performance degrades severely if <i class="arg">sequence2</i> contains many
equal elements (as, for instance, when using this procedure to compare
two files, a quarter of whose lines are blank.  This drawback is
intrinsic to the algorithm used (see the Reference for details).</p>
<p>One approach to dealing with the performance problem that is sometimes
effective in practice is arbitrarily to exclude elements that appear
more than a certain number of times. 
This number is provided as the <i class="arg">maxOccurs</i> parameter.  If frequent
lines are excluded in this manner, they will not appear in the common
subsequence that is computed; the result will be the longest common
subsequence of infrequent elements.
The procedure <b class="method">longestCommonSubsequence2</b> implements this
heuristic.
It functions as a wrapper around <b class="method">longestCommonSubsequence</b>; it
computes the longest common subsequence of infrequent elements, and
then subdivides the subsequences that lie between the matches to
approximate the true longest common subsequence.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">TABLE JOIN</a></h2>
<p>This is an operation from relational algebra for relational databases.</p>
<p>The easiest way to understand the regular inner join is that it
creates the cartesian product of all the tables involved first and
then keeps only all those rows in the resulting table for which the
values in the specified key columns are equal to each other.</p>
<p>Implementing this description naively, i.e. as described above will
generate a <em>huge</em> intermediate result. To avoid this the
cartesian product and the filtering of row are done at the same
time. What is required is a fast way to determine if a key is present
in a table. In a true database this is done through indices. Here we
use arrays internally.</p>
<p>An <i class="term">outer</i> join is an extension of the inner join for two
tables. There are three variants of outerjoins, called <i class="term">left</i>,
<i class="term">right</i>, and <i class="term">full</i> outer joins. Their result always
contains all rows from an inner join and then some additional rows.</p>
<ol class="enumerated">
<li><p>For the left outer join the additional rows are all rows from the left
table for which there is no key in the right table. They are joined to
an empty row of the right table to fit them into the result.</p></li>
<li><p>For the right outer join the additional rows are all rows from the right
table for which there is no key in the left table. They are joined to
an empty row of the left table to fit them into the result.</p></li>
<li><p>The full outer join combines both left and right outer join. In other
words, the additional rows are as defined for left outer join, and
right outer join, combined.</p></li>
</ol>
<p>We extend all the joins from two to <b class="variable">n</b> tables (<b class="variable">n</b> &gt; 2) by
executing</p>
<pre class="example">
    (...((table1 join table2) join table3) ...) join tableN
</pre>
<p>Examples for all the joins:</p>
<pre class="example">
    Inner Join
    {0 foo}              {0 bagel}    {0 foo   0 bagel}
    {1 snarf} inner join {1 snatz}  = {1 snarf 1 snatz}
    {2 blue}             {3 driver}
    Left Outer Join
    {0 foo}                   {0 bagel}    {0 foo   0 bagel}
    {1 snarf} left outer join {1 snatz}  = {1 snarf 1 snatz}
    {2 blue}                  {3 driver}   {2 blue  {} {}}
    Right Outer Join
    {0 foo}                    {0 bagel}    {0 foo   0 bagel}
    {1 snarf} right outer join {1 snatz}  = {1 snarf 1 snatz}
    {2 blue}                   {3 driver}   {{} {}   3 driver}
    Full Outer Join
    {0 foo}                   {0 bagel}    {0 foo   0 bagel}
    {1 snarf} full outer join {1 snatz}  = {1 snarf 1 snatz}
    {2 blue}                  {3 driver}   {2 blue  {} {}}
                                           {{} {}   3 driver}
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>J. W. Hunt and M. D. McIlroy, &quot;An algorithm for differential 
file comparison,&quot; Comp. Sci. Tech. Rep. #41, Bell Telephone 
Laboratories (1976). Available on the Web at the second
author's personal site: <a href="http://www.cs.dartmouth.edu/~doug/">http://www.cs.dartmouth.edu/~doug/</a></p></li>
<li><p>Donald E. Knuth, &quot;Fascicle 2b of 'The Art of Computer Programming'
volume 4&quot;. Available on the Web at the author's personal site:
<a href="http://www-cs-faculty.stanford.edu/~knuth/fasc2b.ps.gz">http://www-cs-faculty.stanford.edu/~knuth/fasc2b.ps.gz</a>.</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: list</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key519">Fisher-Yates</a>, <a href="../../../../index.html#key521">assign</a>, <a href="../../../../index.html#key502">common</a>, <a href="../../../../index.html#key504">comparison</a>, <a href="../../../../index.html#key513">diff</a>, <a href="../../../../index.html#key507">differential</a>, <a href="../../../../index.html#key511">equal</a>, <a href="../../../../index.html#key523">equality</a>, <a href="../../../../index.html#key203">filter</a>, <a href="../../../../index.html#key509">first permutation</a>, <a href="../../../../index.html#key508">flatten</a>, <a href="../../../../index.html#key515">folding</a>, <a href="../../../../index.html#key514">full outer join</a>, <a href="../../../../index.html#key522">generate permutations</a>, <a href="../../../../index.html#key517">inner join</a>, <a href="../../../../index.html#key510">join</a>, <a href="../../../../index.html#key503">left outer join</a>, <a href="../../../../index.html#key252">list</a>, <a href="../../../../index.html#key501">longest common subsequence</a>, <a href="../../../../index.html#key187">map</a>, <a href="../../../../index.html#key524">next permutation</a>, <a href="../../../../index.html#key525">outer join</a>, <a href="../../../../index.html#key500">permutation</a>, <a href="../../../../index.html#key198">reduce</a>, <a href="../../../../index.html#key526">repeating</a>, <a href="../../../../index.html#key238">repetition</a>, <a href="../../../../index.html#key518">reshuffle</a>, <a href="../../../../index.html#key505">reverse</a>, <a href="../../../../index.html#key506">right outer join</a>, <a href="../../../../index.html#key520">shuffle</a>, <a href="../../../../index.html#key516">subsequence</a>, <a href="../../../../index.html#key512">swapping</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2003-2005 by Kevin B. Kenny. All rights reserved<br>
Copyright &copy; 2003-2012 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/struct_set.html.


















































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::set - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/struct_set.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::set.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::set(n) 2.2.3 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::set - Procedures for manipulating sets</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">REFERENCES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.0</b></li>
<li>package require <b class="pkgname">struct::set <span class="opt">?2.2.3?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::struct::set</b> <b class="method">empty</b> <i class="arg">set</i></a></li>
<li><a href="#2"><b class="cmd">::struct::set</b> <b class="method">size</b> <i class="arg">set</i></a></li>
<li><a href="#3"><b class="cmd">::struct::set</b> <b class="method">contains</b> <i class="arg">set</i> <i class="arg">item</i></a></li>
<li><a href="#4"><b class="cmd">::struct::set</b> <b class="method">union</b> <span class="opt">?<i class="arg">set1</i>...?</span></a></li>
<li><a href="#5"><b class="cmd">::struct::set</b> <b class="method">intersect</b> <span class="opt">?<i class="arg">set1</i>...?</span></a></li>
<li><a href="#6"><b class="cmd">::struct::set</b> <b class="method">difference</b> <i class="arg">set1</i> <i class="arg">set2</i></a></li>
<li><a href="#7"><b class="cmd">::struct::set</b> <b class="method">symdiff</b> <i class="arg">set1</i> <i class="arg">set2</i></a></li>
<li><a href="#8"><b class="cmd">::struct::set</b> <b class="method">intersect3</b> <i class="arg">set1</i> <i class="arg">set2</i></a></li>
<li><a href="#9"><b class="cmd">::struct::set</b> <b class="method">equal</b> <i class="arg">set1</i> <i class="arg">set2</i></a></li>
<li><a href="#10"><b class="cmd">::struct::set</b> <b class="method">include</b> <i class="arg">svar</i> <i class="arg">item</i></a></li>
<li><a href="#11"><b class="cmd">::struct::set</b> <b class="method">exclude</b> <i class="arg">svar</i> <i class="arg">item</i></a></li>
<li><a href="#12"><b class="cmd">::struct::set</b> <b class="method">add</b> <i class="arg">svar</i> <i class="arg">set</i></a></li>
<li><a href="#13"><b class="cmd">::struct::set</b> <b class="method">subtract</b> <i class="arg">svar</i> <i class="arg">set</i></a></li>
<li><a href="#14"><b class="cmd">::struct::set</b> <b class="method">subsetof</b> <i class="arg">A</i> <i class="arg">B</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::set</b> namespace contains several useful commands for
processing finite sets.</p>
<p>It exports only a single command, <b class="cmd">struct::set</b>. All
functionality provided here can be reached through a subcommand of
this command.</p>
<p><em>Note:</em> As of version 2.2 of this package a critcl based C
implementation is available. This implementation however requires Tcl
8.4 to run.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::struct::set</b> <b class="method">empty</b> <i class="arg">set</i></a></dt>
<dd><p>Returns a boolean value indicating if the <i class="arg">set</i> is
empty (<b class="const">true</b>), or not (<b class="const">false</b>).</p></dd>
<dt><a name="2"><b class="cmd">::struct::set</b> <b class="method">size</b> <i class="arg">set</i></a></dt>
<dd><p>Returns an integer number greater than or equal to zero. This is the
number of elements in the <i class="arg">set</i>. In other words, its cardinality.</p></dd>
<dt><a name="3"><b class="cmd">::struct::set</b> <b class="method">contains</b> <i class="arg">set</i> <i class="arg">item</i></a></dt>
<dd><p>Returns a boolean value indicating if the <i class="arg">set</i> contains the
element <i class="arg">item</i> (<b class="const">true</b>), or not (<b class="const">false</b>).</p></dd>
<dt><a name="4"><b class="cmd">::struct::set</b> <b class="method">union</b> <span class="opt">?<i class="arg">set1</i>...?</span></a></dt>
<dd><p>Computes the set containing the union of <i class="arg">set1</i>, <i class="arg">set2</i>,
etc., i.e. &quot;<i class="arg">set1</i> + <i class="arg">set2</i> + ...&quot;, and returns this set
as the result of the command.</p></dd>
<dt><a name="5"><b class="cmd">::struct::set</b> <b class="method">intersect</b> <span class="opt">?<i class="arg">set1</i>...?</span></a></dt>
<dd><p>Computes the set containing the intersection of <i class="arg">set1</i>,
<i class="arg">set2</i>, etc., i.e. &quot;<i class="arg">set1</i> * <i class="arg">set2</i> * ...&quot;, and
returns this set as the result of the command.</p></dd>
<dt><a name="6"><b class="cmd">::struct::set</b> <b class="method">difference</b> <i class="arg">set1</i> <i class="arg">set2</i></a></dt>
<dd><p>Computes the set containing the difference of <i class="arg">set1</i> and
<i class="arg">set2</i>, i.e. (&quot;<i class="arg">set1</i> - <i class="arg">set2</i>&quot;) and returns this
set as the result of the command.</p></dd>
<dt><a name="7"><b class="cmd">::struct::set</b> <b class="method">symdiff</b> <i class="arg">set1</i> <i class="arg">set2</i></a></dt>
<dd><p>Computes the set containing the symmetric difference of <i class="arg">set1</i> and
<i class="arg">set2</i>, i.e. (&quot;(<i class="arg">set1</i> - <i class="arg">set2</i>) + (<i class="arg">set2</i> - <i class="arg">set1</i>)&quot;)
and returns this set as the result of the command.</p></dd>
<dt><a name="8"><b class="cmd">::struct::set</b> <b class="method">intersect3</b> <i class="arg">set1</i> <i class="arg">set2</i></a></dt>
<dd><p>This command is a combination of the methods <b class="method">intersect</b> and
<b class="method">difference</b>.
It returns a three-element list containing &quot;<i class="arg">set1</i>*<i class="arg">set2</i>&quot;,
&quot;<i class="arg">set1</i>-<i class="arg">set2</i>&quot;, and &quot;<i class="arg">set2</i>-<i class="arg">set1</i>&quot;, in this
order. In other words, the intersection of the two parameter sets, and
their differences.</p></dd>
<dt><a name="9"><b class="cmd">::struct::set</b> <b class="method">equal</b> <i class="arg">set1</i> <i class="arg">set2</i></a></dt>
<dd><p>Returns a boolean value indicating if the two sets are equal
(<b class="const">true</b>) or not (<b class="const">false</b>).</p></dd>
<dt><a name="10"><b class="cmd">::struct::set</b> <b class="method">include</b> <i class="arg">svar</i> <i class="arg">item</i></a></dt>
<dd><p>The element <i class="arg">item</i> is added to the set specified by the variable
name in <i class="arg">svar</i>. The return value of the command is empty. This is
the equivalent of <b class="cmd">lappend</b> for sets. If the variable named by
<i class="arg">svar</i> does not exist it will be created.</p></dd>
<dt><a name="11"><b class="cmd">::struct::set</b> <b class="method">exclude</b> <i class="arg">svar</i> <i class="arg">item</i></a></dt>
<dd><p>The element <i class="arg">item</i> is removed from the set specified by the
variable name in <i class="arg">svar</i>. The return value of the command is
empty. This is a near-equivalent of <b class="cmd">lreplace</b> for sets.</p></dd>
<dt><a name="12"><b class="cmd">::struct::set</b> <b class="method">add</b> <i class="arg">svar</i> <i class="arg">set</i></a></dt>
<dd><p>All the element of <i class="arg">set</i> are added to the set specified by the
variable name in <i class="arg">svar</i>. The return value of the command is
empty. This is like the method <b class="method">include</b>, but for the addition
of a whole set. If the variable named by <i class="arg">svar</i> does not exist it
will be created.</p></dd>
<dt><a name="13"><b class="cmd">::struct::set</b> <b class="method">subtract</b> <i class="arg">svar</i> <i class="arg">set</i></a></dt>
<dd><p>All the element of <i class="arg">set</i> are removed from the set specified by the
variable name in <i class="arg">svar</i>. The return value of the command is
empty. This is like the method <b class="method">exclude</b>, but for the removal
of a whole set.</p></dd>
<dt><a name="14"><b class="cmd">::struct::set</b> <b class="method">subsetof</b> <i class="arg">A</i> <i class="arg">B</i></a></dt>
<dd><p>Returns a boolean value indicating if the set <i class="arg">A</i> is a true
subset of or equal to the set <i class="arg">B</i> (<b class="const">true</b>), or not
(<b class="const">false</b>).</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">REFERENCES</a></h2>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: set</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key672">cardinality</a>, <a href="../../../../index.html#key677">difference</a>, <a href="../../../../index.html#key674">emptiness</a>, <a href="../../../../index.html#key676">exclusion</a>, <a href="../../../../index.html#key671">inclusion</a>, <a href="../../../../index.html#key678">intersection</a>, <a href="../../../../index.html#key673">membership</a>, <a href="../../../../index.html#key253">set</a>, <a href="../../../../index.html#key675">symmetric difference</a>, <a href="../../../../index.html#key575">union</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/struct_tree.html.

























































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::tree - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/struct_tree.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002-2004,2012 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::tree.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::tree(n) 2.1.1 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::tree - Create and manipulate tree objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Tree CLASS API</a></li>
<li class="subsection"><a href="#subsection2">Tree OBJECT API</a></li>
<li class="subsection"><a href="#subsection3">Changes for 2.0</a></li>
</ul>
</li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::tree <span class="opt">?2.1.1?</span></b></li>
<li>package require <b class="pkgname">struct::list <span class="opt">?1.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::struct::tree</b> <span class="opt">?<i class="arg">treeName</i>?</span> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">source</i>?</span></a></li>
<li><a href="#2"><b class="cmd">treeName</b> <b class="method">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::struct::tree::prune</b></a></li>
<li><a href="#4"><i class="arg">treeName</i> <b class="method">=</b> <i class="arg">sourcetree</i></a></li>
<li><a href="#5"><i class="arg">treeName</i> <b class="method">--&gt;</b> <i class="arg">desttree</i></a></li>
<li><a href="#6"><i class="arg">treeName</i> <b class="method">ancestors</b> <i class="arg">node</i></a></li>
<li><a href="#7"><i class="arg">treeName</i> <b class="method">append</b> <i class="arg">node</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#8"><i class="arg">treeName</i> <b class="method">attr</b> <i class="arg">key</i></a></li>
<li><a href="#9"><i class="arg">treeName</i> <b class="method">attr</b> <i class="arg">key</i> <b class="option">-nodes</b> <i class="arg">list</i></a></li>
<li><a href="#10"><i class="arg">treeName</i> <b class="method">attr</b> <i class="arg">key</i> <b class="option">-glob</b> <i class="arg">globpattern</i></a></li>
<li><a href="#11"><i class="arg">treeName</i> <b class="method">attr</b> <i class="arg">key</i> <b class="option">-regexp</b> <i class="arg">repattern</i></a></li>
<li><a href="#12"><i class="arg">treeName</i> <b class="method">children</b> <span class="opt">?<b class="option">-all</b>?</span> <i class="arg">node</i> <span class="opt">?<b class="const">filter</b> <i class="arg">cmdprefix</i>?</span></a></li>
<li><a href="#13"><i class="arg">treeName</i> <b class="method">cut</b> <i class="arg">node</i></a></li>
<li><a href="#14"><i class="arg">treeName</i> <b class="method">delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></li>
<li><a href="#15"><i class="arg">treeName</i> <b class="method">depth</b> <i class="arg">node</i></a></li>
<li><a href="#16"><i class="arg">treeName</i> <b class="method">descendants</b> <i class="arg">node</i> <span class="opt">?<b class="const">filter</b> <i class="arg">cmdprefix</i>?</span></a></li>
<li><a href="#17"><i class="arg">treeName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></li>
<li><a href="#18"><i class="arg">treeName</i> <b class="method">destroy</b></a></li>
<li><a href="#19"><i class="arg">treeName</i> <b class="method">exists</b> <i class="arg">node</i></a></li>
<li><a href="#20"><i class="arg">treeName</i> <b class="method">get</b> <i class="arg">node</i> <i class="arg">key</i></a></li>
<li><a href="#21"><i class="arg">treeName</i> <b class="method">getall</b> <i class="arg">node</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#22"><i class="arg">treeName</i> <b class="method">keys</b> <i class="arg">node</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#23"><i class="arg">treeName</i> <b class="method">keyexists</b> <i class="arg">node</i> <i class="arg">key</i></a></li>
<li><a href="#24"><i class="arg">treeName</i> <b class="method">index</b> <i class="arg">node</i></a></li>
<li><a href="#25"><i class="arg">treeName</i> <b class="method">insert</b> <i class="arg">parent</i> <i class="arg">index</i> <span class="opt">?<i class="arg">child</i> <span class="opt">?<i class="arg">child</i> ...?</span>?</span></a></li>
<li><a href="#26"><i class="arg">treeName</i> <b class="method">isleaf</b> <i class="arg">node</i></a></li>
<li><a href="#27"><i class="arg">treeName</i> <b class="method">lappend</b> <i class="arg">node</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#28"><i class="arg">treeName</i> <b class="method">leaves</b></a></li>
<li><a href="#29"><i class="arg">treeName</i> <b class="method">move</b> <i class="arg">parent</i> <i class="arg">index</i> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></li>
<li><a href="#30"><i class="arg">treeName</i> <b class="method">next</b> <i class="arg">node</i></a></li>
<li><a href="#31"><i class="arg">treeName</i> <b class="method">numchildren</b> <i class="arg">node</i></a></li>
<li><a href="#32"><i class="arg">treeName</i> <b class="method">nodes</b></a></li>
<li><a href="#33"><i class="arg">treeName</i> <b class="method">parent</b> <i class="arg">node</i></a></li>
<li><a href="#34"><i class="arg">treeName</i> <b class="method">previous</b> <i class="arg">node</i></a></li>
<li><a href="#35"><i class="arg">treeName</i> <b class="method">rename</b> <i class="arg">node</i> <i class="arg">newname</i></a></li>
<li><a href="#36"><i class="arg">treeName</i> <b class="method">rootname</b></a></li>
<li><a href="#37"><i class="arg">treeName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">node</i>?</span></a></li>
<li><a href="#38"><i class="arg">treeName</i> <b class="method">set</b> <i class="arg">node</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#39"><i class="arg">treeName</i> <b class="method">size</b> <span class="opt">?<i class="arg">node</i>?</span></a></li>
<li><a href="#40"><i class="arg">treeName</i> <b class="method">splice</b> <i class="arg">parent</i> <i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span> <span class="opt">?<i class="arg">child</i>?</span></a></li>
<li><a href="#41"><i class="arg">treeName</i> <b class="method">swap</b> <i class="arg">node1</i> <i class="arg">node2</i></a></li>
<li><a href="#42"><i class="arg">treeName</i> <b class="method">unset</b> <i class="arg">node</i> <i class="arg">key</i></a></li>
<li><a href="#43"><i class="arg">treeName</i> <b class="method">walk</b> <i class="arg">node</i> <span class="opt">?<b class="option">-order</b> <i class="arg">order</i>?</span> <span class="opt">?<b class="option">-type</b> <i class="arg">type</i>?</span> <i class="arg">loopvar</i> <i class="arg">script</i></a></li>
<li><a href="#44"><i class="arg">treeName</i> <b class="method">walkproc</b> <i class="arg">node</i> <span class="opt">?<b class="option">-order</b> <i class="arg">order</i>?</span> <span class="opt">?<b class="option">-type</b> <i class="arg">type</i>?</span> <i class="arg">cmdprefix</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>A tree is a collection of named elements, called nodes, one of which is
distinguished as a root, along with a relation (&quot;parenthood&quot;) that
places a hierarchical structure on the nodes. (Data Structures and
Algorithms; Aho, Hopcroft and Ullman; Addison-Wesley, 1987).  In
addition to maintaining the node relationships, this tree
implementation allows any number of keyed values to be associated with
each node.</p>
<p>The element names can be arbitrary strings.</p>
<p>A tree is thus similar to an array, but with three important
differences:</p>
<ol class="enumerated">
<li><p>Trees are accessed through an object command, whereas arrays are
accessed as variables. (This means trees cannot be local to a procedure.)</p></li>
<li><p>Trees have a hierarchical structure, whereas an array is just an
unordered collection.</p></li>
<li><p>Each node of a tree has a separate collection of attributes and
values. This is like an array where every value is a dictionary.</p></li>
</ol>
<p><em>Note:</em> The major version of the package <b class="package"><a href="../../../../index.html#key285">struct</a></b> has
been changed to version 2.0, due to backward incompatible changes in
the API of this module. Please read the section
<span class="sectref"><a href="#subsection3">Changes for 2.0</a></span> for a full list of all changes,
incompatible and otherwise.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Tree CLASS API</a></h3>
<p>The main commands of the package are:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::struct::tree</b> <span class="opt">?<i class="arg">treeName</i>?</span> <span class="opt">?<b class="const">=</b>|<b class="const">:=</b>|<b class="const">as</b>|<b class="const">deserialize</b> <i class="arg">source</i>?</span></a></dt>
<dd><p>The command creates a new tree object with an associated global Tcl
command whose name is <i class="arg">treeName</i>. This command may be used to
invoke various operations on the tree.
It has the following general form:</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">treeName</b> <b class="method">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>If <i class="arg">treeName</i> is not specified a unique name will be generated by
the package itself. If a <i class="arg">source</i> is specified the new tree will
be initialized to it. For the operators <b class="const">=</b>, <b class="const">:=</b>, and
<b class="const">as</b> <i class="arg">source</i> is interpreted as the name of another tree
object, and the assignment operator <b class="method">=</b> will be executed. For
<b class="const">deserialize</b> the <i class="arg">source</i> is a serialized tree object and
<b class="method">deserialize</b> will be executed.</p>
<p>In other words</p>
<pre class="example">
    ::struct::tree mytree = b
</pre>
<p>is equivalent to</p>
<pre class="example">
    ::struct::tree mytree
    mytree = b
</pre>
<p>and</p>
<pre class="example">
    ::struct::tree mytree deserialize $b
</pre>
<p>is equivalent to</p>
<pre class="example">
    ::struct::tree mytree
    mytree deserialize $b
</pre>
</dd>
<dt><a name="3"><b class="cmd">::struct::tree::prune</b></a></dt>
<dd><p>This command is provided outside of the tree methods, as it is not a
tree method per se. It however interacts tightly with the method
<b class="method">walk</b>. When used in the walk script it causes the traversal to
ignore the children of the node we are currently at.
This command cannot be used with the traversal modes which look at
children before their parent, i.e. <b class="const">post</b> and <b class="const">in</b>. The
only applicable orders of traversal are <b class="const">pre</b> and
<b class="const">both</b>. An error is thrown if the command and chosen order of
traversal do not fit.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Tree OBJECT API</a></h3>
<p>Two general observations beforehand:</p>
<ol class="enumerated">
<li><p>The root node of the tree can be used in most places where a node is
asked for. The default name of the rootnode is &quot;root&quot;, but this can be
changed with the method <b class="method">rename</b> (see below). Whatever the
current name for the root node of the tree is, it can be retrieved by
calling the method <b class="method">rootname</b>.</p></li>
<li><p>The method <b class="method">insert</b> is the only way to create new nodes, and
they are automatically added to a parent. A tree object cannot have
nodes without a parent, save the root node.</p></li>
</ol>
<p>And now the methods supported by tree objects created by this package:</p>
<dl class="definitions">
<dt><a name="4"><i class="arg">treeName</i> <b class="method">=</b> <i class="arg">sourcetree</i></a></dt>
<dd><p>This is the assignment operator for tree objects. It copies the tree
contained in the tree object <i class="arg">sourcetree</i> over the tree data in
<i class="arg">treeName</i>. The old contents of <i class="arg">treeName</i> are deleted by this
operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">treeName</i> <b class="method">deserialize</b> [<i class="arg">sourcetree</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="5"><i class="arg">treeName</i> <b class="method">--&gt;</b> <i class="arg">desttree</i></a></dt>
<dd><p>This is the reverse assignment operator for tree objects. It copies the tree
contained in the tree object <i class="arg">treeName</i> over the tree data in the object
<i class="arg">desttree</i>. The old contents of <i class="arg">desttree</i> are deleted by this
operation.</p>
<p>This operation is in effect equivalent to</p>
<pre class="example">
    <i class="arg">desttree</i> <b class="method">deserialize</b> [<i class="arg">treeName</i> <b class="method">serialize</b>]
</pre>
</dd>
<dt><a name="6"><i class="arg">treeName</i> <b class="method">ancestors</b> <i class="arg">node</i></a></dt>
<dd><p>This method extends the method <b class="method">parent</b> and returns a list
containing all ancestor nodes to the specified <i class="arg">node</i>. The
immediate ancestor, in other words, parent node, is the first element
in that list, its parent the second element, and so on until the root
node is reached, making it the last element of the returned list.</p></dd>
<dt><a name="7"><i class="arg">treeName</i> <b class="method">append</b> <i class="arg">node</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> to one of the keyed values associated with an
node. Returns the new value given to the attribute <i class="arg">key</i>.</p></dd>
<dt><a name="8"><i class="arg">treeName</i> <b class="method">attr</b> <i class="arg">key</i></a></dt>
<dd></dd>
<dt><a name="9"><i class="arg">treeName</i> <b class="method">attr</b> <i class="arg">key</i> <b class="option">-nodes</b> <i class="arg">list</i></a></dt>
<dd></dd>
<dt><a name="10"><i class="arg">treeName</i> <b class="method">attr</b> <i class="arg">key</i> <b class="option">-glob</b> <i class="arg">globpattern</i></a></dt>
<dd></dd>
<dt><a name="11"><i class="arg">treeName</i> <b class="method">attr</b> <i class="arg">key</i> <b class="option">-regexp</b> <i class="arg">repattern</i></a></dt>
<dd><p>This method retrieves the value of the attribute named <i class="arg">key</i>, for
all nodes in the tree (matching the restriction specified via one of
the possible options) and having the specified attribute.</p>
<p>The result is a dictionary mapping from node names to the value of
attribute <i class="arg">key</i> at that node.
Nodes not having the attribute <i class="arg">key</i>, or not passing a
specified restriction, are not listed in the result.</p>
<p>The possible restrictions are:</p>
<dl class="options">
<dt><b class="option">-nodes</b></dt>
<dd><p>The value is a list of nodes. Only the nodes mentioned in this list
are searched for the attribute.</p></dd>
<dt><b class="option">-glob</b></dt>
<dd><p>The value is a glob pattern. Only the nodes in the tree whose names
match this pattern are searched for the attribute.</p></dd>
<dt><b class="option">-regexp</b></dt>
<dd><p>The value is a regular expression. Only the nodes in the tree whose
names match this pattern are searched for the attribute.</p></dd>
</dl></dd>
<dt><a name="12"><i class="arg">treeName</i> <b class="method">children</b> <span class="opt">?<b class="option">-all</b>?</span> <i class="arg">node</i> <span class="opt">?<b class="const">filter</b> <i class="arg">cmdprefix</i>?</span></a></dt>
<dd><p>Return a list of the children of <i class="arg">node</i>.
If the option <b class="option">-all</b> is specified, then not only the direct
children, but their children, and so on are returned in the result.
If a filter command is specified only those nodes are listed in the
final result which pass the test. The command in <i class="arg">cmdprefix</i> is
called with two arguments, the name of the tree object, and the name
of the node in question. It is executed in the context of the caller
and has to return a boolean value. Nodes for which the command returns
<b class="const">false</b> are removed from the result list before it is returned
to the caller.</p>
<p>Some examples:</p>
<pre class="example">
    mytree insert root end 0 ; mytree set 0 volume 30
    mytree insert root end 1
    mytree insert root end 2
    mytree insert 0    end 3
    mytree insert 0    end 4
    mytree insert 4    end 5 ; mytree set 5 volume 50
    mytree insert 4    end 6
    proc vol {t n} {
	$t keyexists $n volume
    }
    proc vgt40 {t n} {
	if {![$t keyexists $n volume]} {return 0}
	expr {[$t get $n volume] &gt; 40}
    }
    tclsh&gt; lsort [mytree children -all root filter vol]
    0 5
    tclsh&gt; lsort [mytree children -all root filter vgt40]
    5
    tclsh&gt; lsort [mytree children root filter vol]
    0
    tclsh&gt; puts ([lsort [mytree children root filter vgt40]])
    ()
</pre>
</dd>
<dt><a name="13"><i class="arg">treeName</i> <b class="method">cut</b> <i class="arg">node</i></a></dt>
<dd><p>Removes the node specified by <i class="arg">node</i> from the tree, but not its
children.  The children of <i class="arg">node</i> are made children of the parent
of the <i class="arg">node</i>, at the index at which <i class="arg">node</i> was located.</p></dd>
<dt><a name="14"><i class="arg">treeName</i> <b class="method">delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></dt>
<dd><p>Removes the specified nodes from the tree.  All of the nodes' children
will be removed as well to prevent orphaned nodes.</p></dd>
<dt><a name="15"><i class="arg">treeName</i> <b class="method">depth</b> <i class="arg">node</i></a></dt>
<dd><p>Return the number of steps from node <i class="arg">node</i> to the root node.</p></dd>
<dt><a name="16"><i class="arg">treeName</i> <b class="method">descendants</b> <i class="arg">node</i> <span class="opt">?<b class="const">filter</b> <i class="arg">cmdprefix</i>?</span></a></dt>
<dd><p>This method extends the method <b class="method">children</b> and returns a list
containing all nodes descending from <i class="arg">node</i>, and passing the
filter, if such was specified.</p>
<p>This is actually the same as
&quot;<i class="arg">treeName</i> <b class="method">children</b> <b class="option">-all</b>&quot;.
<b class="method">descendants</b> should be prefered, and &quot;children -all&quot;
will be deprecated sometime in the future.</p></dd>
<dt><a name="17"><i class="arg">treeName</i> <b class="method">deserialize</b> <i class="arg">serialization</i></a></dt>
<dd><p>This is the complement to <b class="method">serialize</b>. It replaces tree data in
<i class="arg">treeName</i> with the tree described by the <i class="arg">serialization</i>
value. The old contents of <i class="arg">treeName</i> are deleted by this
operation.</p></dd>
<dt><a name="18"><i class="arg">treeName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroy the tree, including its storage space and associated command.</p></dd>
<dt><a name="19"><i class="arg">treeName</i> <b class="method">exists</b> <i class="arg">node</i></a></dt>
<dd><p>Returns true if the specified node exists in the tree.</p></dd>
<dt><a name="20"><i class="arg">treeName</i> <b class="method">get</b> <i class="arg">node</i> <i class="arg">key</i></a></dt>
<dd><p>Returns the value associated with the key <i class="arg">key</i> for the node
<i class="arg">node</i>.</p></dd>
<dt><a name="21"><i class="arg">treeName</i> <b class="method">getall</b> <i class="arg">node</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a dictionary (suitable for use with [<b class="cmd">array set</b>])
containing the attribute data for the <i class="arg">node</i>.
If the glob <i class="arg">pattern</i> is specified only the attributes whose names
match the pattern will be part of the dictionary.</p></dd>
<dt><a name="22"><i class="arg">treeName</i> <b class="method">keys</b> <i class="arg">node</i> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>Returns a list of keys for the <i class="arg">node</i>.
If the <i class="arg">pattern</i> is specified only the attributes whose names
match the pattern will be part of the returned list. The pattern is a
<b class="cmd">glob</b> pattern.</p></dd>
<dt><a name="23"><i class="arg">treeName</i> <b class="method">keyexists</b> <i class="arg">node</i> <i class="arg">key</i></a></dt>
<dd><p>Return true if the specified <i class="arg">key</i> exists for the <i class="arg">node</i>.</p></dd>
<dt><a name="24"><i class="arg">treeName</i> <b class="method">index</b> <i class="arg">node</i></a></dt>
<dd><p>Returns the index of <i class="arg">node</i> in its parent's list of children.  For
example, if a node has <i class="term">nodeFoo</i>, <i class="term">nodeBar</i>, and
<i class="term">nodeBaz</i> as children, in that order, the index of
<i class="term">nodeBar</i> is 1.</p></dd>
<dt><a name="25"><i class="arg">treeName</i> <b class="method">insert</b> <i class="arg">parent</i> <i class="arg">index</i> <span class="opt">?<i class="arg">child</i> <span class="opt">?<i class="arg">child</i> ...?</span>?</span></a></dt>
<dd><p>Insert one or more nodes into the tree as children of the node
<i class="arg">parent</i>. The nodes will be added in the order they are given. If
<i class="arg">parent</i> is <b class="const">root</b>, it refers to the root of the tree. The
new nodes will be added to the <i class="arg">parent</i> node's child list at the
index given by <i class="arg">index</i>. The <i class="arg">index</i> can be <b class="const">end</b> in
which case the new nodes will be added after the current last child.
Indices of the form &quot;end-<b class="variable">n</b>&quot; are accepted as well.</p>
<p>If any of the specified children already exist in <i class="arg">treeName</i>,
those nodes will be moved from their original location to the new
location indicated by this command.</p>
<p>If no <i class="arg">child</i> is specified, a single node will be added, and a
name will be generated for the new node. The generated name is of the
form <em>node</em><b class="variable">x</b>, where <b class="variable">x</b> is a number. If names are
specified they must neither contain whitespace nor colons (&quot;:&quot;).</p>
<p>The return result from this command is a list of nodes added.</p></dd>
<dt><a name="26"><i class="arg">treeName</i> <b class="method">isleaf</b> <i class="arg">node</i></a></dt>
<dd><p>Returns true if <i class="arg">node</i> is a leaf of the tree (if <i class="arg">node</i> has no
children), false otherwise.</p></dd>
<dt><a name="27"><i class="arg">treeName</i> <b class="method">lappend</b> <i class="arg">node</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> (as a list) to one of the keyed values
associated with an <i class="arg">node</i>. Returns the new value given to the
attribute <i class="arg">key</i>.</p></dd>
<dt><a name="28"><i class="arg">treeName</i> <b class="method">leaves</b></a></dt>
<dd><p>Return a list containing all leaf nodes known to the tree.</p></dd>
<dt><a name="29"><i class="arg">treeName</i> <b class="method">move</b> <i class="arg">parent</i> <i class="arg">index</i> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></dt>
<dd><p>Make the specified nodes children of <i class="arg">parent</i>, inserting them into
the parent's child list at the index given by <i class="arg">index</i>. Note that
the command will take all nodes out of the tree before inserting them
under the new parent, and that it determines the position to place
them into after the removal, before the re-insertion. This behaviour
is important when it comes to moving one or more nodes to a different
index without changing their parent node.</p></dd>
<dt><a name="30"><i class="arg">treeName</i> <b class="method">next</b> <i class="arg">node</i></a></dt>
<dd><p>Return the right sibling of <i class="arg">node</i>, or the empty string if
<i class="arg">node</i> was the last child of its parent.</p></dd>
<dt><a name="31"><i class="arg">treeName</i> <b class="method">numchildren</b> <i class="arg">node</i></a></dt>
<dd><p>Return the number of immediate children of <i class="arg">node</i>.</p></dd>
<dt><a name="32"><i class="arg">treeName</i> <b class="method">nodes</b></a></dt>
<dd><p>Return a list containing all nodes known to the tree.</p></dd>
<dt><a name="33"><i class="arg">treeName</i> <b class="method">parent</b> <i class="arg">node</i></a></dt>
<dd><p>Return the parent of <i class="arg">node</i>.</p></dd>
<dt><a name="34"><i class="arg">treeName</i> <b class="method">previous</b> <i class="arg">node</i></a></dt>
<dd><p>Return the left sibling of <i class="arg">node</i>, or the empty string if
<i class="arg">node</i> was the first child of its parent.</p></dd>
<dt><a name="35"><i class="arg">treeName</i> <b class="method">rename</b> <i class="arg">node</i> <i class="arg">newname</i></a></dt>
<dd><p>Renames the node <i class="arg">node</i> to <i class="arg">newname</i>. An error is thrown if
either the node does not exist, or a node with name <i class="arg">newname</i> does
exist. The result of the command is the new name of the node.</p></dd>
<dt><a name="36"><i class="arg">treeName</i> <b class="method">rootname</b></a></dt>
<dd><p>Returns the name of the root node of the tree.</p></dd>
<dt><a name="37"><i class="arg">treeName</i> <b class="method">serialize</b> <span class="opt">?<i class="arg">node</i>?</span></a></dt>
<dd><p>This method serializes the sub-tree starting at <i class="arg">node</i>. In other
words it returns a tcl <em>value</em> completely describing the tree
starting at <i class="arg">node</i>.
This allows, for example, the transfer of tree objects (or parts
thereof) over arbitrary channels, persistence, etc.
This method is also the basis for both the copy constructor and
the assignment operator.</p>
<p>The result of this method has to be semantically identical over all
implementations of the tree interface. This is what will enable us to
copy tree data between different implementations of the same
interface.</p>
<p>The result is a list containing containing a multiple of three
elements. It is like a serialized array except that there are two
values following each key. They are the names of the nodes in the
serialized tree. The two values are a reference to the parent node and
the attribute data, in this order.</p>
<p>The reference to the parent node is the empty string for the root node
of the tree. For all other nodes it is the index of the parent node in
the list. This means that they are integers, greater than or equal to
zero, less than the length of the list, and multiples of three.
The order of the nodes in the list is important insofar as it is used
to reconstruct the lists of children for each node. The children of a
node have to be listed in the serialization in the same order as they
are listed in their parent in the tree.</p>
<p>The attribute data of a node is a dictionary, i.e. a list of even
length containing a serialized array. For a node without attribute
data the dictionary is the empty list.</p>
<p><em>Note:</em> While the current implementation returns the root node as
the first element of the list, followed by its children and their
children in a depth-first traversal this is not necessarily true for
other implementations.
The only information a reader of the serialized data can rely on for
the structure of the tree is that the root node is signaled by the
empty string for the parent reference, that all other nodes refer to
their parent through the index in the list, and that children occur in
the same order as in their parent.</p>
<pre class="example">
 A possible serialization for the tree structure
             +- d
       +- a -+
 root -+- b  +- e
       +- c
 is
 {root {} {} a 0 {} d 3 {} e 3 {} b 0 {} c 0 {}}
 The above assumes that none of the nodes have attributes.
</pre>
</dd>
<dt><a name="38"><i class="arg">treeName</i> <b class="method">set</b> <i class="arg">node</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Set or get one of the keyed values associated with a node. A node may
have any number of keyed values associated with it.  If <i class="arg">value</i> is
not specified, this command returns the current value assigned to the
key; if <i class="arg">value</i> is specified, this command assigns that value to
the key, and returns it.</p></dd>
<dt><a name="39"><i class="arg">treeName</i> <b class="method">size</b> <span class="opt">?<i class="arg">node</i>?</span></a></dt>
<dd><p>Return a count of the number of descendants of the node <i class="arg">node</i>; if
no node is specified, <b class="const">root</b> is assumed.</p></dd>
<dt><a name="40"><i class="arg">treeName</i> <b class="method">splice</b> <i class="arg">parent</i> <i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span> <span class="opt">?<i class="arg">child</i>?</span></a></dt>
<dd><p>Insert a node named <i class="arg">child</i> into the tree as a child of the node
<i class="arg">parent</i>. If <i class="arg">parent</i> is <b class="const">root</b>, it refers to the root
of the tree. The new node will be added to the parent node's child
list at the index given by <i class="arg">from</i>.  The children of <i class="arg">parent</i>
which are in the range of the indices <i class="arg">from</i> and <i class="arg">to</i> are made
children of <i class="arg">child</i>.  If the value of <i class="arg">to</i> is not specified it
defaults to <b class="const">end</b>.  If no name is given for <i class="arg">child</i>, a name
will be generated for the new node.  The generated name is of the form
<em>node</em><b class="variable">x</b>, where <b class="variable">x</b> is a number.  The return result
from this command is the name of the new node.</p>
<p>The arguments <i class="arg">from</i> and <i class="arg">to</i> are regular list indices, i.e.
the form &quot;end-<b class="variable">n</b>&quot; is accepted as well.</p></dd>
<dt><a name="41"><i class="arg">treeName</i> <b class="method">swap</b> <i class="arg">node1</i> <i class="arg">node2</i></a></dt>
<dd><p>Swap the position of <i class="arg">node1</i> and <i class="arg">node2</i> in the tree.</p></dd>
<dt><a name="42"><i class="arg">treeName</i> <b class="method">unset</b> <i class="arg">node</i> <i class="arg">key</i></a></dt>
<dd><p>Removes a keyed value from the node <i class="arg">node</i>. The method will do
nothing if the <i class="arg">key</i> does not exist.</p></dd>
<dt><a name="43"><i class="arg">treeName</i> <b class="method">walk</b> <i class="arg">node</i> <span class="opt">?<b class="option">-order</b> <i class="arg">order</i>?</span> <span class="opt">?<b class="option">-type</b> <i class="arg">type</i>?</span> <i class="arg">loopvar</i> <i class="arg">script</i></a></dt>
<dd><p>Perform a breadth-first or depth-first walk of the tree starting at
the node <i class="arg">node</i>.  The type of walk, breadth-first or depth-first,
is determined by the value of <i class="arg">type</i>; <b class="const">bfs</b> indicates
breadth-first, <b class="const">dfs</b> indicates depth-first.  Depth-first is the
default. The order of the walk, pre-, post-, both- or in-order is
determined by the value of <i class="arg">order</i>; <b class="const">pre</b> indicates
pre-order, <b class="const">post</b> indicates post-order, <b class="const">both</b> indicates
both-order and <b class="const">in</b> indicates in-order. Pre-order is the
default.</p>
<p>Pre-order walking means that a parent node is visited before any of
its children.  For example, a breadth-first search starting from the
root will visit the root, followed by all of the root's children,
followed by all of the root's grandchildren. Post-order walking means
that a parent node is visited after any of its children. Both-order
walking means that a parent node is visited before <em>and</em> after
any of its children. In-order walking means that a parent node is
visited after its first child and before the second. This is a
generalization of in-order walking for binary trees and will do the
right thing if a binary tree is walked. The combination of a breadth-first
walk with in-order is illegal.</p>
<p>As the walk progresses, the <i class="arg">script</i> will be evaluated at each
node. The evaluation takes place in the context of the caller of the
method.
Regarding loop variables, these are listed in <i class="arg">loopvar</i>. If one
only one variable is specified it will be set to the id of the
node. When two variables are specified, i.e. <i class="arg">loopvar</i> is a true
list, then the first variable will be set to the action performed at
the node, and the other to the id of the node itself.
All loop variables are created in the context of the caller.</p>
<p>There are three possible actions: <b class="const">enter</b>, <b class="const">leave</b>,
or <b class="const">visit</b>.  <b class="const">enter</b> actions occur during pre-order
walks; <b class="const">leave</b> actions occur during post-order walks;
<b class="const">visit</b> actions occur during in-order walks.  In a both-order
walk, the command will be evaluated twice for each node; the action is
<b class="const">enter</b> for the first evaluation, and <b class="const">leave</b> for the
second.</p>
<p><em>Note</em>: The <b class="const">enter</b> action for a node is always performed
before the walker will look at the children of that node. This means
that changes made by the <i class="arg">script</i> to the children of the node
will immediately influence the walker and the steps it will take.</p>
<p>Any other manipulation, for example of nodes higher in the tree (i.e
already visited), or upon leaving will have undefined results. They
may succeed, error out, silently compute the wrong result, or anything
in between.</p>
<p>At last a small table showing the relationship between the various
options and the possible actions.</p>
<pre class="example">
 order       type    actions         notes
 -----       ----    -----           -----
 pre         dfs     enter           parent before children
 post        dfs     leave           parent after children
 in          dfs     visit           parent between first and second child.
 both        dfs     enter, leave    parent before and after children
 -----       ----    -----           -----
 pre         bfs     enter           parent before children
 post        bfs     leave           parent after children
 in          bfs             -- illegal --
 both        bfs     enter, leave    parent before and after children
 -----       ----    -----           -----
</pre>
<p>Note the command <b class="cmd">::struct::tree::prune</b>. This command can be used
in the walk script to force the command to ignore the children of the
node we are currently at. It will throw an error if the order of
traversal is either <b class="const">post</b> or <b class="const">in</b> as these modes visit
the children before their parent, making pruning non-sensical.</p></dd>
<dt><a name="44"><i class="arg">treeName</i> <b class="method">walkproc</b> <i class="arg">node</i> <span class="opt">?<b class="option">-order</b> <i class="arg">order</i>?</span> <span class="opt">?<b class="option">-type</b> <i class="arg">type</i>?</span> <i class="arg">cmdprefix</i></a></dt>
<dd><p>This method is like method <b class="method">walk</b> in all essentials, except the
interface to the user code. This method invokes a command prefix with
three additional arguments (tree, node, and action), instead of
evaluating a script and passing the node via a loop variable.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Changes for 2.0</a></h3>
<p>The following noteworthy changes have occurred:</p>
<ol class="enumerated">
<li><p>The API for accessing attributes and their values has been
simplified.</p>
<p>All functionality regarding the default attribute &quot;data&quot; has been
removed. This default attribute does not exist anymore. All accesses
to attributes have to specify the name of the attribute in
question. This backward <em>incompatible</em> change allowed us to
simplify the signature of all methods handling attributes.</p>
<p>Especially the flag <b class="option">-key</b> is not required anymore, even more,
its use is now forbidden. Please read the documentation for the
methods <b class="method">set</b>, <b class="method">get</b>, <b class="method">getall</b>, <b class="method">unset</b>,
<b class="method">append</b>, <b class="method">lappend</b>, <b class="method">keyexists</b>
and <b class="method">keys</b> for a description of the new API's.</p></li>
<li><p>The methods <b class="method">keys</b> and <b class="method">getall</b> now take an optional
pattern argument and will return only attribute data for keys matching
this pattern.</p></li>
<li><p>Nodes can now be renamed. See the documentation for the method
<b class="method">rename</b>.</p></li>
<li><p>The structure has been extended with API's for the serialization and
deserialization of tree objects, and a number of operations based on
them (tree assignment, copy construction).</p>
<p>Please read the documentation for the methods <b class="method">serialize</b>,
<b class="method">deserialize</b>, <b class="method">=</b>, and <b class="method">--&gt;</b>, and the
documentation on the construction of tree objects.</p>
<p>Beyond the copying of whole tree objects these new API's also enable
the transfer of tree objects over arbitrary channels and for easy
persistence.</p></li>
<li><p>The walker API has been streamlined and made more similar to the
command <b class="cmd"><a href="../../../../index.html#key199">foreach</a></b>. In detail:</p>
<ul class="itemized">
<li><p>The superfluous option <b class="option">-command</b> has been removed.</p></li>
<li><p>Ditto for the place holders. Instead of the placeholders two loop
variables have to be specified to contain node and action information.</p></li>
<li><p>The old command argument has been documented as a script now, which it
was in the past too.</p></li>
<li><p>The fact that <b class="const">enter</b> actions are called before the walker looks
at the children of a node has been documented now. In other words it
is now officially allowed to manipulate the list of children for a
node under <em>these</em> circumstances. It has been made clear that
changes under any other circumstances will have undefined results,
from silently computing the wrong result to erroring out.</p></li>
</ul>
</li>
<li><p>A new method, <b class="method">attr</b>, was added allowing the query and
retrieval of attribute data without regard to the node relationship.</p></li>
<li><p>The method <b class="method">children</b> has been extended with the ability to
select from the children of the node based on an arbitrary filtering
criterium. Another extension is the ability to look not only at the
immediate children of the node, but the whole tree below it.</p></li>
</ol>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p>The following example demonstrates the creation of new nodes:</p>
<pre class="example">
    mytree insert root end 0   ; # Create node 0, as child of the root
    mytree insert root end 1 2 ; # Ditto nodes 1 &amp; 2
    mytree insert 0    end 3   ; # Now create node 3 as child of node 0
    mytree insert 0    end     ; # Create another child of 0, with a
    #                              generated name. The name is returned
    #                              as the result of the command.
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: tree</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key650">breadth-first</a>, <a href="../../../../index.html#key649">depth-first</a>, <a href="../../../../index.html#key647">in-order</a>, <a href="../../../../index.html#key412">node</a>, <a href="../../../../index.html#key651">post-order</a>, <a href="../../../../index.html#key648">pre-order</a>, <a href="../../../../index.html#key102">serialization</a>, <a href="../../../../index.html#key254">tree</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002-2004,2012 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/struct/struct_tree1.html.
































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>struct::tree_v1 - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/struct/struct_tree1.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ struct::tree_v1.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">struct::tree_v1(n) 1.2.2 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>struct::tree_v1 - Create and manipulate tree objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::tree <span class="opt">?1.2.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">treeName</b> <b class="method">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><i class="arg">treeName</i> <b class="method">append</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></li>
<li><a href="#3"><i class="arg">treeName</i> <b class="method">children</b> <i class="arg">node</i></a></li>
<li><a href="#4"><i class="arg">treeName</i> <b class="method">cut</b> <i class="arg">node</i></a></li>
<li><a href="#5"><i class="arg">treeName</i> <b class="method">delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></li>
<li><a href="#6"><i class="arg">treeName</i> <b class="method">depth</b> <i class="arg">node</i></a></li>
<li><a href="#7"><i class="arg">treeName</i> <b class="method">destroy</b></a></li>
<li><a href="#8"><i class="arg">treeName</i> <b class="method">exists</b> <i class="arg">node</i></a></li>
<li><a href="#9"><i class="arg">treeName</i> <b class="method">get</b> <i class="arg">node</i> <span class="opt">?<b class="option">-key</b> <i class="arg">key</i>?</span></a></li>
<li><a href="#10"><i class="arg">treeName</i> <b class="method">getall</b> <i class="arg">node</i></a></li>
<li><a href="#11"><i class="arg">treeName</i> <b class="method">keys</b> <i class="arg">node</i></a></li>
<li><a href="#12"><i class="arg">treeName</i> <b class="method">keyexists</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></li>
<li><a href="#13"><i class="arg">treeName</i> <b class="method">index</b> <i class="arg">node</i></a></li>
<li><a href="#14"><i class="arg">treeName</i> <b class="method">insert</b> <i class="arg">parent</i> <i class="arg">index</i> <span class="opt">?<i class="arg">child</i> <span class="opt">?<i class="arg">child</i> ...?</span>?</span></a></li>
<li><a href="#15"><i class="arg">treeName</i> <b class="method">isleaf</b> <i class="arg">node</i></a></li>
<li><a href="#16"><i class="arg">treeName</i> <b class="method">lappend</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></li>
<li><a href="#17"><i class="arg">treeName</i> <b class="method">move</b> <i class="arg">parent</i> <i class="arg">index</i> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></li>
<li><a href="#18"><i class="arg">treeName</i> <b class="method">next</b> <i class="arg">node</i></a></li>
<li><a href="#19"><i class="arg">treeName</i> <b class="method">numchildren</b> <i class="arg">node</i></a></li>
<li><a href="#20"><i class="arg">treeName</i> <b class="method">parent</b> <i class="arg">node</i></a></li>
<li><a href="#21"><i class="arg">treeName</i> <b class="method">previous</b> <i class="arg">node</i></a></li>
<li><a href="#22"><i class="arg">treeName</i> <b class="method">set</b> <i class="arg">node</i> <span class="opt">?<b class="option">-key</b> <i class="arg">key</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></li>
<li><a href="#23"><i class="arg">treeName</i> <b class="method">size</b> <span class="opt">?<i class="arg">node</i>?</span></a></li>
<li><a href="#24"><i class="arg">treeName</i> <b class="method">splice</b> <i class="arg">parent</i> <i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span> <span class="opt">?<i class="arg">child</i>?</span></a></li>
<li><a href="#25"><i class="arg">treeName</i> <b class="method">swap</b> <i class="arg">node1</i> <i class="arg">node2</i></a></li>
<li><a href="#26"><i class="arg">treeName</i> <b class="method">unset</b> <i class="arg">node</i> <span class="opt">?<b class="option">-key</b> <i class="arg">key</i>?</span></a></li>
<li><a href="#27"><i class="arg">treeName</i> <b class="method">walk</b> <i class="arg">node</i> <span class="opt">?<b class="option">-order</b> <i class="arg">order</i>?</span> <span class="opt">?<b class="option">-type</b> <i class="arg">type</i>?</span> <b class="option">-command</b> <i class="arg">cmd</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::tree</b> command creates a new tree object with an
associated global Tcl command whose name is <i class="arg">treeName</i>. This
command may be used to invoke various operations on the tree. It has
the following general form:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">treeName</b> <b class="method">option</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>A tree is a collection of named elements, called nodes, one of which is
distinguished as a root, along with a relation (&quot;parenthood&quot;) that
places a hierarchical structure on the nodes. (Data Structures and
Algorithms; Aho, Hopcroft and Ullman; Addison-Wesley, 1987).  In
addition to maintaining the node relationships, this tree
implementation allows any number of keyed values to be associated with
each node.</p>
<p>The element names can be arbitrary strings.</p>
<p>A tree is thus similar to an array, but with three important
differences:</p>
<ol class="enumerated">
<li><p>Trees are accessed through an object command, whereas arrays are
accessed as variables. (This means trees cannot be local to a procedure.)</p></li>
<li><p>Trees have a hierarchical structure, whereas an array is just an
unordered collection.</p></li>
<li><p>Each node of a tree has a separate collection of attributes and
values. This is like an array where every value is a dictionary.</p></li>
</ol>
<p>The following commands are possible for tree objects:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">treeName</i> <b class="method">append</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> to one of the keyed values associated with an
node. If no <i class="arg">key</i> is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="3"><i class="arg">treeName</i> <b class="method">children</b> <i class="arg">node</i></a></dt>
<dd><p>Return a list of the children of <i class="arg">node</i>.</p></dd>
<dt><a name="4"><i class="arg">treeName</i> <b class="method">cut</b> <i class="arg">node</i></a></dt>
<dd><p>Removes the node specified by <i class="arg">node</i> from the tree, but not its
children.  The children of <i class="arg">node</i> are made children of the parent
of the <i class="arg">node</i>, at the index at which <i class="arg">node</i> was located.</p></dd>
<dt><a name="5"><i class="arg">treeName</i> <b class="method">delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></dt>
<dd><p>Removes the specified nodes from the tree.  All of the nodes' children
will be removed as well to prevent orphaned nodes.</p></dd>
<dt><a name="6"><i class="arg">treeName</i> <b class="method">depth</b> <i class="arg">node</i></a></dt>
<dd><p>Return the number of steps from node <i class="arg">node</i> to the root node.</p></dd>
<dt><a name="7"><i class="arg">treeName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroy the tree, including its storage space and associated command.</p></dd>
<dt><a name="8"><i class="arg">treeName</i> <b class="method">exists</b> <i class="arg">node</i></a></dt>
<dd><p>Returns true if the specified node exists in the tree.</p></dd>
<dt><a name="9"><i class="arg">treeName</i> <b class="method">get</b> <i class="arg">node</i> <span class="opt">?<b class="option">-key</b> <i class="arg">key</i>?</span></a></dt>
<dd><p>Return the value associated with the key <i class="arg">key</i> for the node
<i class="arg">node</i>. If no key is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="10"><i class="arg">treeName</i> <b class="method">getall</b> <i class="arg">node</i></a></dt>
<dd><p>Returns a serialized list of key/value pairs (suitable for use with
[<b class="cmd">array set</b>]) for the <i class="arg">node</i>.</p></dd>
<dt><a name="11"><i class="arg">treeName</i> <b class="method">keys</b> <i class="arg">node</i></a></dt>
<dd><p>Returns a list of keys for the <i class="arg">node</i>.</p></dd>
<dt><a name="12"><i class="arg">treeName</i> <b class="method">keyexists</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span></a></dt>
<dd><p>Return true if the specified <i class="arg">key</i> exists for the <i class="arg">node</i>. If
no <i class="arg">key</i> is specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="13"><i class="arg">treeName</i> <b class="method">index</b> <i class="arg">node</i></a></dt>
<dd><p>Returns the index of <i class="arg">node</i> in its parent's list of children.  For
example, if a node has <i class="term">nodeFoo</i>, <i class="term">nodeBar</i>, and
<i class="term">nodeBaz</i> as children, in that order, the index of
<i class="term">nodeBar</i> is 1.</p></dd>
<dt><a name="14"><i class="arg">treeName</i> <b class="method">insert</b> <i class="arg">parent</i> <i class="arg">index</i> <span class="opt">?<i class="arg">child</i> <span class="opt">?<i class="arg">child</i> ...?</span>?</span></a></dt>
<dd><p>Insert one or more nodes into the tree as children of the node
<i class="arg">parent</i>. The nodes will be added in the order they are given. If
<i class="arg">parent</i> is <b class="const">root</b>, it refers to the root of the tree. The
new nodes will be added to the <i class="arg">parent</i> node's child list at the
index given by <i class="arg">index</i>. The <i class="arg">index</i> can be <b class="const">end</b> in
which case the new nodes will be added after the current last child.</p>
<p>If any of the specified children already exist in <i class="arg">treeName</i>,
those nodes will be moved from their original location to the new
location indicated by this command.</p>
<p>If no <i class="arg">child</i> is specified, a single node will be added, and a
name will be generated for the new node. The generated name is of the
form <em>node</em><b class="variable">x</b>, where <b class="variable">x</b> is a number. If names are
specified they must neither contain whitespace nor colons (&quot;:&quot;).</p>
<p>The return result from this command is a list of nodes added.</p></dd>
<dt><a name="15"><i class="arg">treeName</i> <b class="method">isleaf</b> <i class="arg">node</i></a></dt>
<dd><p>Returns true if <i class="arg">node</i> is a leaf of the tree (if <i class="arg">node</i> has no
children), false otherwise.</p></dd>
<dt><a name="16"><i class="arg">treeName</i> <b class="method">lappend</b> <i class="arg">node</i> <span class="opt">?-key <i class="arg">key</i>?</span> <i class="arg">value</i></a></dt>
<dd><p>Appends a <i class="arg">value</i> (as a list) to one of the keyed values
associated with an <i class="arg">node</i>. If no <i class="arg">key</i> is specified, the key
<b class="const">data</b> is assumed.</p></dd>
<dt><a name="17"><i class="arg">treeName</i> <b class="method">move</b> <i class="arg">parent</i> <i class="arg">index</i> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i> ...?</span></a></dt>
<dd><p>Make the specified nodes children of <i class="arg">parent</i>, inserting them into
the parent's child list at the index given by <i class="arg">index</i>. Note that
the command will take all nodes out of the tree before inserting them
under the new parent, and that it determines the position to place
them into after the removal, before the re-insertion. This behaviour
is important when it comes to moving one or more nodes to a different
index without changing their parent node.</p></dd>
<dt><a name="18"><i class="arg">treeName</i> <b class="method">next</b> <i class="arg">node</i></a></dt>
<dd><p>Return the right sibling of <i class="arg">node</i>, or the empty string if
<i class="arg">node</i> was the last child of its parent.</p></dd>
<dt><a name="19"><i class="arg">treeName</i> <b class="method">numchildren</b> <i class="arg">node</i></a></dt>
<dd><p>Return the number of immediate children of <i class="arg">node</i>.</p></dd>
<dt><a name="20"><i class="arg">treeName</i> <b class="method">parent</b> <i class="arg">node</i></a></dt>
<dd><p>Return the parent of <i class="arg">node</i>.</p></dd>
<dt><a name="21"><i class="arg">treeName</i> <b class="method">previous</b> <i class="arg">node</i></a></dt>
<dd><p>Return the left sibling of <i class="arg">node</i>, or the empty string if
<i class="arg">node</i> was the first child of its parent.</p></dd>
<dt><a name="22"><i class="arg">treeName</i> <b class="method">set</b> <i class="arg">node</i> <span class="opt">?<b class="option">-key</b> <i class="arg">key</i>?</span> <span class="opt">?<i class="arg">value</i>?</span></a></dt>
<dd><p>Set or get one of the keyed values associated with a node. If no key
is specified, the key <b class="const">data</b> is assumed.  Each node that is
added to a tree has the value &quot;&quot; assigned to the key <b class="const">data</b>
automatically.  A node may have any number of keyed values associated
with it.  If <i class="arg">value</i> is not specified, this command returns the
current value assigned to the key; if <i class="arg">value</i> is specified, this
command assigns that value to the key.</p></dd>
<dt><a name="23"><i class="arg">treeName</i> <b class="method">size</b> <span class="opt">?<i class="arg">node</i>?</span></a></dt>
<dd><p>Return a count of the number of descendants of the node <i class="arg">node</i>; if
no node is specified, <b class="const">root</b> is assumed.</p></dd>
<dt><a name="24"><i class="arg">treeName</i> <b class="method">splice</b> <i class="arg">parent</i> <i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span> <span class="opt">?<i class="arg">child</i>?</span></a></dt>
<dd><p>Insert a node named <i class="arg">child</i> into the tree as a child of the node
<i class="arg">parent</i>. If <i class="arg">parent</i> is <b class="const">root</b>, it refers to the root
of the tree. The new node will be added to the parent node's child
list at the index given by <i class="arg">from</i>.  The children of <i class="arg">parent</i>
which are in the range of the indices <i class="arg">from</i> and <i class="arg">to</i> are made
children of <i class="arg">child</i>.  If the value of <i class="arg">to</i> is not specified it
defaults to <b class="const">end</b>.  If no name is given for <i class="arg">child</i>, a name
will be generated for the new node.  The generated name is of the form
<em>node</em><b class="variable">x</b>, where <b class="variable">x</b> is a number.  The return result
from this command is the name of the new node.</p></dd>
<dt><a name="25"><i class="arg">treeName</i> <b class="method">swap</b> <i class="arg">node1</i> <i class="arg">node2</i></a></dt>
<dd><p>Swap the position of <i class="arg">node1</i> and <i class="arg">node2</i> in the tree.</p></dd>
<dt><a name="26"><i class="arg">treeName</i> <b class="method">unset</b> <i class="arg">node</i> <span class="opt">?<b class="option">-key</b> <i class="arg">key</i>?</span></a></dt>
<dd><p>Removes a keyed value from the node <i class="arg">node</i>.  If no key is
specified, the key <b class="const">data</b> is assumed.</p></dd>
<dt><a name="27"><i class="arg">treeName</i> <b class="method">walk</b> <i class="arg">node</i> <span class="opt">?<b class="option">-order</b> <i class="arg">order</i>?</span> <span class="opt">?<b class="option">-type</b> <i class="arg">type</i>?</span> <b class="option">-command</b> <i class="arg">cmd</i></a></dt>
<dd><p>Perform a breadth-first or depth-first walk of the tree starting at
the node <i class="arg">node</i>.  The type of walk, breadth-first or depth-first,
is determined by the value of <i class="arg">type</i>; <b class="const">bfs</b> indicates
breadth-first, <b class="const">dfs</b> indicates depth-first.  Depth-first is the
default. The order of the walk, pre-, post-, both- or in-order is
determined by the value of <i class="arg">order</i>; <b class="const">pre</b> indicates
pre-order, <b class="const">post</b> indicates post-order, <b class="const">both</b> indicates
both-order and <b class="const">in</b> indicates in-order. Pre-order is the
default.</p>
<p>Pre-order walking means that a parent node is visited before any of
its children.  For example, a breadth-first search starting from the
root will visit the root, followed by all of the root's children,
followed by all of the root's grandchildren. Post-order walking means
that a parent node is visited after any of its children. Both-order
walking means that a parent node is visited before <em>and</em> after
any of its children. In-order walking means that a parent node is
visited after its first child and before the second. This is a
generalization of in-order walking for binary trees and will do the
right thing if a binary is walked. The combination of a breadth-first
walk with in-order is illegal.</p>
<p>As the walk progresses, the command <i class="arg">cmd</i> will be evaluated at
each node.  Percent substitution will be performed on <i class="arg">cmd</i> before
evaluation, just as in a <b class="cmd"><a href="../../../../index.html#key659">bind</a></b> script.  The following
substitutions are recognized:</p>
<dl class="definitions">
<dt><b class="const">%%</b></dt>
<dd><p>Insert the literal % character.</p></dd>
<dt><b class="const">%t</b></dt>
<dd><p>Name of the tree object.</p></dd>
<dt><b class="const">%n</b></dt>
<dd><p>Name of the current node.</p></dd>
<dt><b class="const">%a</b></dt>
<dd><p>Name of the action occurring; one of <b class="const">enter</b>, <b class="const">leave</b>,
or <b class="const">visit</b>.  <b class="const">enter</b> actions occur during pre-order
walks; <b class="const">leave</b> actions occur during post-order walks;
<b class="const">visit</b> actions occur during in-order walks.  In a both-order
walk, the command will be evaluated twice for each node; the action is
<b class="const">enter</b> for the first evaluation, and <b class="const">leave</b> for the
second.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: tree</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key254">tree</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/tar/tar.html.








































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tar - Tar file handling</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/tar/tar.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ tar.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tar(n) 0.7 tcllib &quot;Tar file handling&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tar - Tar file creation, extraction &amp; manipulation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">tar <span class="opt">?0.7?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tar::contents</b> <i class="arg">tarball</i> <span class="opt">?<b class="option">-chan</b>?</span></a></li>
<li><a href="#2"><b class="cmd">::tar::stat</b> <i class="arg">tarball</i> <span class="opt">?file?</span> <span class="opt">?<b class="option">-chan</b>?</span></a></li>
<li><a href="#3"><b class="cmd">::tar::untar</b> <i class="arg">tarball</i> <i class="arg">args</i></a></li>
<li><a href="#4"><b class="cmd">::tar::get</b> <i class="arg">tarball</i> <i class="arg">fileName</i> <span class="opt">?<b class="option">-chan</b>?</span></a></li>
<li><a href="#5"><b class="cmd">::tar::create</b> <i class="arg">tarball</i> <i class="arg">files</i> <i class="arg">args</i></a></li>
<li><a href="#6"><b class="cmd">::tar::add</b> <i class="arg">tarball</i> <i class="arg">files</i> <i class="arg">args</i></a></li>
<li><a href="#7"><b class="cmd">::tar::remove</b> <i class="arg">tarball</i> <i class="arg">files</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tar::contents</b> <i class="arg">tarball</i> <span class="opt">?<b class="option">-chan</b>?</span></a></dt>
<dd><p>Returns a list of the files contained in <i class="arg">tarball</i>. The order is not sorted and depends on the order
files were stored in the archive.</p>
<p>If the option <b class="option">-chan</b> is present <i class="arg">tarball</i> is interpreted as an open channel.
It is assumed that the channel was opened for reading, and configured for binary input.
The command will <em>not</em> close the channel.</p></dd>
<dt><a name="2"><b class="cmd">::tar::stat</b> <i class="arg">tarball</i> <span class="opt">?file?</span> <span class="opt">?<b class="option">-chan</b>?</span></a></dt>
<dd><p>Returns a nested dict containing information on the named <span class="opt">?file?</span> in <i class="arg">tarball</i>,
or all files if none is specified. The top level are pairs of filename and info. The info is a dict with the keys
&quot;<b class="const">mode</b> <b class="const">uid</b> <b class="const">gid</b> <b class="const">size</b> <b class="const">mtime</b> <b class="const">type</b> <b class="const">linkname</b> <b class="const">uname</b> <b class="const">gname</b>
 <b class="const">devmajor</b> <b class="const">devminor</b>&quot;</p>
<pre class="example">
% ::tar::stat tarball.tar
foo.jpg {mode 0644 uid 1000 gid 0 size 7580 mtime 811903867 type file linkname {} uname user gname wheel devmajor 0 devminor 0}
</pre>
<p>If the option <b class="option">-chan</b> is present <i class="arg">tarball</i> is interpreted as an open channel.
It is assumed that the channel was opened for reading, and configured for binary input.
The command will <em>not</em> close the channel.</p></dd>
<dt><a name="3"><b class="cmd">::tar::untar</b> <i class="arg">tarball</i> <i class="arg">args</i></a></dt>
<dd><p>Extracts <i class="arg">tarball</i>. <i class="arg">-file</i> and <i class="arg">-glob</i> limit the extraction
to files which exactly match or pattern match the given argument. No error is
thrown if no files match. Returns a list of filenames extracted and the file
size. The size will be null for non regular files. Leading path seperators are
stripped so paths will always be relative.</p>
<dl class="options">
<dt><b class="option">-dir</b> dirName</dt>
<dd><p>Directory to extract to. Uses <b class="cmd">pwd</b> if none is specified</p></dd>
<dt><b class="option">-file</b> fileName</dt>
<dd><p>Only extract the file with this name. The name is matched against the complete path
stored in the archive including directories.</p></dd>
<dt><b class="option">-glob</b> pattern</dt>
<dd><p>Only extract files patching this glob style pattern. The pattern is matched against the complete path
stored in the archive.</p></dd>
<dt><b class="option">-nooverwrite</b></dt>
<dd><p>Dont overwrite files that already exist</p></dd>
<dt><b class="option">-nomtime</b></dt>
<dd><p>Leave the file modification time as the current time instead of setting it to the value in the archive.</p></dd>
<dt><b class="option">-noperms</b></dt>
<dd><p>In Unix, leave the file permissions as the current umask instead of setting them to the values in the archive.</p></dd>
<dt><b class="option">-chan</b></dt>
<dd><p>If this option is present <i class="arg">tarball</i> is interpreted as an open channel.
It is assumed that the channel was opened for reading, and configured for binary input.
The command will <em>not</em> close the channel.</p></dd>
</dl>
<pre class="example">
% foreach {file size} [::tar::untar tarball.tar -glob *.jpg] {
puts &quot;Extracted $file ($size bytes)&quot;
}
</pre>
</dd>
<dt><a name="4"><b class="cmd">::tar::get</b> <i class="arg">tarball</i> <i class="arg">fileName</i> <span class="opt">?<b class="option">-chan</b>?</span></a></dt>
<dd><p>Returns the contents of <i class="arg">fileName</i> from the <i class="arg">tarball</i></p>
<pre class="example">
% set readme [::tar::get tarball.tar doc/README] {
% puts $readme
}
</pre>
<p>If the option <b class="option">-chan</b> is present <i class="arg">tarball</i> is interpreted as an open channel.
It is assumed that the channel was opened for reading, and configured for binary input.
The command will <em>not</em> close the channel.</p></dd>
<dt><a name="5"><b class="cmd">::tar::create</b> <i class="arg">tarball</i> <i class="arg">files</i> <i class="arg">args</i></a></dt>
<dd><p>Creates a new tar file containing the <i class="arg">files</i>. <i class="arg">files</i> must be specified
as a single argument which is a proper list of filenames.</p>
<dl class="options">
<dt><b class="option">-dereference</b></dt>
<dd><p>Normally <b class="cmd">create</b> will store links as an actual link pointing at a file that may
or may not exist in the archive. Specifying this option will cause the actual file point to
 by the link to be stored instead.</p></dd>
<dt><b class="option">-chan</b></dt>
<dd><p>If this option is present <i class="arg">tarball</i> is interpreted as an open channel.
It is assumed that the channel was opened for writing, and configured for binary output.
The command will <em>not</em> close the channel.</p></dd>
</dl>
<pre class="example">
% ::tar::create new.tar [glob -nocomplain file*]
% ::tar::contents new.tar
file1 file2 file3
</pre>
</dd>
<dt><a name="6"><b class="cmd">::tar::add</b> <i class="arg">tarball</i> <i class="arg">files</i> <i class="arg">args</i></a></dt>
<dd><p>Appends <i class="arg">files</i> to the end of the existing <i class="arg">tarball</i>. <i class="arg">files</i> must be specified
as a single argument which is a proper list of filenames.</p>
<dl class="options">
<dt><b class="option">-dereference</b></dt>
<dd><p>Normally <b class="cmd">add</b> will store links as an actual link pointing at a file that may
or may not exist in the archive. Specifying this option will cause the actual file point to
 by the link to be stored instead.</p></dd>
<dt><b class="option">-prefix</b> string</dt>
<dd><p>Normally <b class="cmd">add</b> will store files under exactly the name specified as 
argument. Specifying a <span class="opt">?-prefix?</span> causes the <i class="arg">string</i> to be 
prepended to every name.</p></dd>
<dt><b class="option">-quick</b></dt>
<dd><p>The only sure way to find the position in the <i class="arg">tarball</i> where new 
files can be added is to read it from start, but if <i class="arg">tarball</i> was 
written with a &quot;blocksize&quot; of 1 (as this package does) then one can 
alternatively find this position by seeking from the end. The 
<span class="opt">?-quick?</span> option tells <b class="cmd">add</b> to do the latter.</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::tar::remove</b> <i class="arg">tarball</i> <i class="arg">files</i></a></dt>
<dd><p>Removes <i class="arg">files</i> from the <i class="arg">tarball</i>. No error will result if the file does not exist in the
tarball. Directory write permission and free disk space equivalent to at least the size of the tarball
will be needed.</p>
<pre class="example">
% ::tar::remove new.tar {file2 file3}
% ::tar::contents new.tar
file3
</pre>
</dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>tar</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key680">archive</a>, <a href="../../../../index.html#key679">tape archive</a>, <a href="../../../../index.html#key681">tar</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>File formats</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/tepam/tepam_argument_dialogbox.html.














































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>tepam::argument_dialogbox - Tcl's Enhanced Procedure and Argument Manager</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/tepam/tepam_argument_dialogbox.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009/2010, Andreas Drollinger
   -->
<! -- CVS: $Id$ tepam::argument_dialogbox.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tepam::argument_dialogbox(n) 0.4.0 tcllib &quot;Tcl's Enhanced Procedure and Argument Manager&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tepam::argument_dialogbox - TEPAM argument_dialogbox, reference manual</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">ARGUMENT DIALOGBOX CALL</a>
<ul>
<li class="subsection"><a href="#subsection1">Context Definition Items</a></li>
<li class="subsection"><a href="#subsection2">Formatting and Display Options</a></li>
<li class="subsection"><a href="#subsection3">Data Entry Widget Items</a></li>
<li class="subsection"><a href="#subsection4">Entry Widget Item Attributes</a></li>
</ul>
</li>
<li class="section"><a href="#section3">APPLICATION SPECIFIC ENTRY WIDGETS</a></li>
<li class="section"><a href="#section4">VARIABLES</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">Tk 8.3</b></li>
<li>package require <b class="pkgname">tepam <span class="opt">?0.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">tepam::argument_dialogbox</b> <i class="arg">item_name item_attributes <span class="opt">?item_name item_attributes?</span> <span class="opt">?...?</span></i></a></li>
<li><a href="#2"><b class="cmd">tepam::argument_dialogbox</b> {<i class="arg">item_name item_attributes <span class="opt">?item_name item_attributes?</span> <span class="opt">?...?</span></i>}</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
</div>
<div id="section2" class="section"><h2><a name="section2">ARGUMENT DIALOGBOX CALL</a></h2>
<p>TEPAM's <b class="cmd">argument_dialogbox</b> is a flexible and easily usable data entry form generator. Each data entry element of a form is defined via a <em>data entry item</em> that can be provided to <b class="cmd">argument_dialogbox</b> in two formats:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">tepam::argument_dialogbox</b> <i class="arg">item_name item_attributes <span class="opt">?item_name item_attributes?</span> <span class="opt">?...?</span></i></a></dt>
<dd><p>Using this first format, each <em>data entry item</em> is defined via a pair of two arguments. The first one is the <em>item name</em> that defines the entry widget that has to be used in the form. The second argument, called <em>item attributes</em>, specifies the variable which is attributed to the data entry element as well as eventual formatting and context information.</p>
<p>The <b class="cmd">argument_dialogbox</b> returns <b class="const">ok</b> if the entered data have been acknowledged (via the <em>OK</em> button) and validated by a data checker. If the entered data have been rejected (via the <em>Cancel</em> button) the <b class="cmd">argument_dialogbox</b> returns <b class="const">cancel</b>.</p>
<p>A small example illustrates how the <b class="cmd">argument_dialogbox</b> can be employed:</p>
<pre class="example">set DialogResult [<b class="cmd">tepam::argument_dialogbox</b> \
   <b class="cmd">-title</b> &quot;Itinerary selection&quot; \
   <b class="cmd">-file</b> {<i class="arg">-label &quot;Itinerary report&quot; -variable report_file</i>} \
   <b class="cmd">-frame</b> {<i class="arg">-label &quot;Itinerary start&quot;</i>} \
      <b class="cmd">-comment</b> {<i class="arg">-text &quot;Specify your itinerary start location&quot;</i>} \
      <b class="cmd">-entry</b> {<i class="arg">-label &quot;City&quot; -variable start_city -type string</i>} \
      <b class="cmd">-entry</b> {<i class="arg">-label &quot;Street&quot; -variable start_street -type string -optional 1</i>} \
      <b class="cmd">-entry</b> {<i class="arg">-label &quot;Street number&quot; -variable start_street_nbr -type integer -optional 1</i>} \
   <b class="cmd">-frame</b> {<i class="arg">-label &quot;Itinerary destination&quot;</i>} \
      <b class="cmd">-comment</b> {<i class="arg">-text &quot;Specify your itinerary destination&quot;</i>} \
      <b class="cmd">-entry</b> {<i class="arg">-label &quot;City&quot; -variable dest_city -type string</i>} \
      <b class="cmd">-entry</b> {<i class="arg">-label &quot;Street&quot; -variable dest_street -type string -optional 1</i>} \
      <b class="cmd">-entry</b> {<i class="arg">-label &quot;Street number&quot; -variable dest_street_nbr -type integer -optional 1</i>} \
   <b class="cmd">-frame</b> {} \
   <b class="cmd">-checkbutton</b> {<i class="arg">-label &quot;Don't use highways&quot; -variable no_highway</i>}]</pre>
<p>This example opens a dialog box that has the title <em>Itinerary selection</em>. A first entry widget in this box allows selecting a report file. It follows two frames to define respectively an itinerary start and end location. Each of these locations that are described with a comment has three entry widgets to specify respectively the city, street and the street number. Bellow the second frame there is a check button that allows specifying if eventual highways should be ignored.</p></dd>
<dt><a name="2"><b class="cmd">tepam::argument_dialogbox</b> {<i class="arg">item_name item_attributes <span class="opt">?item_name item_attributes?</span> <span class="opt">?...?</span></i>}</a></dt>
<dd><p>Sometimes it is simpler to provide all the data entry item definitions in form of a single list to <b class="cmd">argument_dialogbox</b>, and not as individual arguments. The second format that is supported by <b class="cmd">argument_dialogbox</b> corresponds exactly to the first one, except that all item definitions are packed into a single list that is provided to <b class="cmd">argument_dialogbox</b>. The previous example can therefore also be written in the following way:</p>
<pre class="example">set DialogResult [<b class="cmd">tepam::argument_dialogbox {</b>
   <b class="cmd">-title</b> &quot;Itinerary selection&quot;
   <b class="cmd">-file</b> {<i class="arg">-label &quot;Itinerary report&quot; -variable report_file</i>}
   ...
   <b class="cmd">-checkbutton</b> {<i class="arg">-label &quot;Don't use highways&quot; -variable no_highway</i>} <b class="cmd">}</b>]</pre>
</dd>
</dl>
<p>The commands <b class="cmd">argument_dialogbox</b> as well as <b class="cmd"><a href="../../../../index.html#key41">procedure</a></b> are exported from the namespace <b class="namespace">tepam</b>. To use these commands without the <b class="namespace">tepam::</b> namespace prefix, it is sufficient to import them into the main namespace:</p>
<pre class="example"><b class="cmd">namespace import tepam::*</b>
 
set DialogResult [<b class="cmd">argument_dialogbox</b> \
   -title &quot;Itinerary selection&quot;
   ...</pre>
<p>The following subsections explain the different argument item types that are accepted by the <b class="cmd">argument_dialogbox</b>, classified into three groups. The first data entry item definition format will be used in the remaining document, knowing that this format can always be transformed into the second format by putting all arguments into a single list that is then provided to <b class="cmd">argument_dialogbox</b>.</p>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Context Definition Items</a></h3>
<p>The first item group allows specifying some context aspects of an argument dialog box. These items are taking a simple character string as item attribute:</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-&lt;argument_name&gt;</b> <i class="arg">string</i> \
   ...</pre>
<p>The following items are classified into this group:</p>
<dl class="definitions">
<dt>-title <i class="arg">string</i></dt>
<dd><p>The dialog box window's title which is by default <em>Dialog</em> can be changed with the <em>-title</em> item:</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-title</b> &quot;System configuration&quot; \
   ...</pre>
</dd>
<dt>-window <i class="arg">string</i></dt>
<dd><p>The argument dialog box uses by default <em>.dialog</em> as dialog top level window. This path can be changed with the <em>-window</em> item:</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-window</b> .dialog \
   ...</pre>
</dd>
<dt>-parent <i class="arg">string</i></dt>
<dd><p>By defining a parent window, the argument dialog box will be displayed beside this one. Without explicit parent window definition, the top-level window will be considered as parent window.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-parent</b> .my_appl \
   ...</pre>
</dd>
<dt>-context <i class="arg">string</i></dt>
<dd><p>If a context is defined the dialog box's state, e.g. the entered data as well as the window size and position, is saved and restored then the next time the argument dialog box is called. The assignment of a context allows saving the dialog box' state in its context to distinguish between different usages of the argument dialog box.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-context</b> destination_definitions \
   ...</pre>
</dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Formatting and Display Options</a></h3>
<p>Especially for big, complex forms it becomes important that the different data entry widgets are graphically well organized and commented to provide an immediate and clear overview to the user. A couple of items allow structuring and commenting the dialog boxes.</p>
<p>The items of this classification group require as item attributes a definition list, which contains itself attribute name and value pairs:</p>
<pre class="example">tepam::argument_dialogbox \
   ...
   <b class="cmd">-&lt;argument_name&gt;</b> { <i class="arg">
      <span class="opt">?-&lt;attribute_name&gt; &lt;attribute_value&gt;?</span>
      <span class="opt">?-&lt;attribute_name&gt; &lt;attribute_value&gt;?</span>
      <span class="opt">?...?</span></i>
   }
   ...</pre>
<p>The following items are classified into this group:</p>
<dl class="definitions">
<dt>-frame <i class="arg">list</i></dt>
<dd><p>The <em>-frame</em> item allows packing all following entry widgets into a labeled frame, until a next frame item is defined or until the last entry widget has been defined. It recognizes the following attributes inside the item attribute list:</p>
<dl class="definitions">
<dt>-label <i class="arg">string</i></dt>
<dd><p>An optional frame label can be specified with the <i class="arg">-label</i> statement.</p></dd>
</dl>
<p>Example:</p>
<pre class="example">tepam::argument_dialogbox \
   ...
   <b class="cmd">-frame</b> {<i class="arg">-label &quot;Destination address&quot;</i>}
   ...</pre>
<p>To close an open frame without opening a new one, an empty list has to be provided to the <i class="arg">-frame</i> statement.</p>
<pre class="example">tepam::argument_dialogbox \
   ...
   <b class="cmd">-frame</b> {}
   ...</pre>
</dd>
<dt>-sep [const {{}}]</dt>
<dd><p>Entry widgets can be separated with the <i class="arg">-sep</i> statement which doesn't require additional definitions. The related definition list has to exist, but its content is ignored.</p>
<pre class="example">tepam::argument_dialogbox \
   ...
   <b class="cmd">-sep</b> {}
   ...</pre>
</dd>
<dt>-comment <i class="arg">string</i></dt>
<dd><p>Comments and descriptions can be added with the <i class="arg">-text</i> attribute of the <i class="arg">-comment</i> item. Please note that each entry widget itself can also contain a <i class="arg">-text</i> attribute for comments and descriptions. But the <i class="arg">-comment</i> item allows for example adding a description between two frames.</p>
<pre class="example">tepam::argument_dialogbox \
   ...
   <b class="cmd">-comment</b> {<i class="arg">-text &quot;Specify bellow the destination address&quot;</i>}
   ...</pre>
</dd>
<dt>-yscroll <b class="const">0</b>|<b class="const">1</b>|<b class="const">auto</b></dt>
<dd><p>This attribute allows controlling an eventual vertical scrollbar. Setting it to <b class="const">0</b> will permanently disable the scrollbar, setting it to <b class="const">1</b> will enable it. By default it is set to <b class="const">auto</b>. The scrollbar is enabled in this mode only if the vertical data entry form size exceeds 66% of the screen height.</p>
<pre class="example">tepam::argument_dialogbox \
   ...
   <b class="cmd">-yscroll</b> <b class="const">auto</b>
   ...</pre>
</dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Data Entry Widget Items</a></h3>
<p>Data entry widgets are created with the widget items. These items require as item attributes a definition list, which contains itself attribute name and value pairs:</p>
<pre class="example">tepam::argument_dialogbox \
   ...
   <b class="cmd">-&lt;argument_name&gt;</b> { <i class="arg">
      <span class="opt">?-&lt;attribute_name&gt; &lt;attribute_value&gt;?</span>
      <span class="opt">?-&lt;attribute_name&gt; &lt;attribute_value&gt;?</span>
      <span class="opt">?...?</span></i>
   }
   ...</pre>
<p>The attribute list can contain various attributes to describe and comment an entry widget and to constrain its entered value. All entry widgets are accepting a common set of attributes that are described in the section <span class="sectref"><a href="#subsection4">Entry Widget Item Attributes</a></span>.</p>
<p>TEPAM defines a rich set of entry widgets. If necessary, this set can be extended with additional application specific entry widgets (see <span class="sectref"><a href="#section3">APPLICATION SPECIFIC ENTRY WIDGETS</a></span>):</p>
<dl class="definitions">
<dt>-entry <i class="arg">list</i></dt>
<dd><p>The <i class="arg">-entry</i> item generates the simplest but most universal data entry widget. It allows entering any kind of data in form of single line strings.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-entry</b> {-label Name -variable Entry}</pre>
</dd>
<dt>-text <i class="arg">list</i></dt>
<dd><p>The <i class="arg">-text</i> item generates a multi line text entry widget. The widget's height can be selected with the <i class="arg">-height</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-text</b> {-label Name -variable Text -height 5}</pre>
</dd>
<dt>-checkbox <i class="arg">list</i></dt>
<dd><p>A group of check boxes is created with the <i class="arg">-checkbox</i> item. The number of check boxes and their option values are specified with a list assigned to the <i class="arg">-choices</i> attribute or via a variable declared with the <i class="arg">-choicevariable</i> attribute:</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-checkbox</b> {-label &quot;Font sytle&quot; -variable FontStyle \
               -choices {bold italic underline} -default italic}</pre>
<p>If the check boxes' labels should differ from the option values, their labels can be defined with the <i class="arg">-choicelabels</i> attribute:</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-checkbox</b> {-label &quot;Font sytle&quot; -variable FontStyle \
              -choices {bold italic underline} \
              -choicelabels {Bold Italic Underline} \
              -default italic}</pre>
<p>In contrast to a radio box group, a check box group allows selecting simultaneously several choice options. The selection is stored for this reason inside the defined variable in form of a list, even if only one choice option has been selected.</p></dd>
<dt>-radiobox <i class="arg">list</i></dt>
<dd><p>A group of radio boxes is created with the <i class="arg">-radiobox</i> item. The number of radio boxes and their option values are specified with a list assigned to the <i class="arg">-choices</i> attribute or via a variable declared with the <i class="arg">-choicevariable</i> attribute.</p>
<p>In contrast to a check box group, a radio box group allows selecting simultaneously only one choice option. The selected option value is stored directly, and not in form of a list, inside the defined variable.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-radiobox</b> {-label &quot;Text adjustment&quot; -variable Adjustment \
              -choices {left center right} -default left}</pre>
<p>If the radio boxes' labels should differ from the option values, their labels can be defined with the <i class="arg">-choicelabels</i> attribute:</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-radiobox</b> {-label &quot;Text adjustment&quot; -variable Adjustment \
              -choices {left center right} \
              -choicelabels {Left Center Right} -default left}</pre>
</dd>
<dt>-checkbutton <i class="arg">list</i></dt>
<dd><p>The <i class="arg">-checkbutton</i> entry widget allows activating or deactivating a single choice option. The result written into the variable will either be <b class="const">0</b> if the check button was not activated or <b class="const">1</b> if it was activated. An eventually provided default value has also to be either <b class="const">0</b> or <b class="const">1</b>.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-checkbutton</b> {-label Capitalize -variable Capitalize -default 1}</pre>
</dd>
</dl>
<p>Several types of list and combo boxes are available to handle selection lists.</p>
<dl class="definitions">
<dt>-combobox <i class="arg">list</i></dt>
<dd><p>The combobox is a combination of a normal entry widget together with a drop-down list box. The combobox allows selecting from this drop-down list box a single element. The list of the available elements can be provided either as a list to the <i class="arg">-choices</i> attribute, or via a variable that is specified with the <i class="arg">-choicevariable</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-combobox</b> {-label &quot;Text size&quot; -variable Size -choices {8 9 10 12 15 18} -default 12}</pre>
<p>And here is an example of using a variable to define the selection list:</p>
<pre class="example">set TextSizes {8 9 10 12 15 18}
tepam::argument_dialogbox \
   <b class="cmd">-combobox</b> {-label &quot;Text size&quot; -variable Size -choicevariable TextSizes -default 12}</pre>
</dd>
<dt>-listbox <i class="arg">list</i></dt>
<dd><p>In contrast to the combo box, the list box is always displayed by the <i class="arg">listbox</i> entry widget. Only one element is selectable unless the <i class="arg">-multiple_selection</i> attribute is set. The list box height can be selected with the <i class="arg">-height</i> attribute. If the height is not explicitly defined, the list box height is automatically adapted to the argument dialog box' size.
The first example uses a variable to define the available choices:</p>
<pre class="example">set set AvailableSizes
for {set k 0} {$k&lt;16} {incr k} {lappend AvailableSizes [expr 1&lt;&lt;$k]}
 
tepam::argument_dialogbox \
   <b class="cmd">-listbox</b> {-label &quot;Distance&quot; -variable Distance \
             -choicevariable AvailableSizes -default 6 -height 5}</pre>
<p>Here is a multi-element selection example. Please note that also the default selection can contain multiple elements:</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-listbox</b> {-label &quot;Text styles&quot; -variable Styles \
             -choices {bold italic underline overstrike} \
             -choicelabels {Bold Italic Underline Overstrike} \
             -default {bold underline} -multiple_selection 1 \
             -height 3}</pre>
</dd>
<dt>-disjointlistbox <i class="arg">list</i></dt>
<dd><p>A disjoint list box has to be used instead of a normal list box if the selection order is important. The disjoint list box entry widget has in fact two list boxes, one to select elements and one to display the selected elements in the chosen order.</p>
<p>Disjoint listboxes allow always selecting multiple elements. With the exception of the <i class="arg">-multiple_selection</i> attribute, disjointed list boxes are accepting the same attributes as the normal listbox, e.g. <i class="arg">-height, -choices, -choicevariable, -default</i>.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-disjointlistbox</b> {-label &quot;Preferred scripting languages&quot; -variable Languages \
             -comment &quot;Please select your preferred languages in the order&quot; \
             -choices {JavaScript Lisp Lua Octave PHP Perl Python Ruby Scheme Tcl} \
             -default {Tcl Perl Python}}</pre>
</dd>
</dl>
<p>The file and directory selectors are building a next group of data entry widgets. A paragraph of section <span class="sectref"><a href="#subsection4">Entry Widget Item Attributes</a></span> explains the widget specific attributes that allow specifying the targeted file types, active directory etc.</p>
<dl class="definitions">
<dt>-file <i class="arg">list</i></dt>
<dd><p>The item <i class="arg">-file</i> creates a group composed by an entry widget together with a button that allows opening a file browser. The data type <i class="arg">file</i> is automatically selected for this entry if no data type has been explicitly defined with the <i class="arg">-type</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-file</b> {-label &quot;Image file&quot; -variable ImageF \
          -filetypes {{&quot;GIF&quot; {*.gif}} {&quot;JPG&quot; {*.jpg}}} \
          -initialfile &quot;picture.gif&quot;}</pre>
</dd>
<dt>-existingfile <i class="arg">list</i></dt>
<dd><p>The item <i class="arg">-existingfile</i> creates a group composed by an entry widget together with a button that allows opening a browser to select an existing file. The data type <i class="arg">existingfile</i> is automatically selected for this entry if no data type has been explicitly defined with the <i class="arg">-type</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-existingfile</b> {-label &quot;Image file&quot; -variable ImageF \
                  -filetypes {{&quot;GIF&quot; {*.gif}} {&quot;JPG&quot; {*.jpg}}} \
                  -initialfile &quot;picture.gif&quot;}</pre>
</dd>
<dt>-directory <i class="arg">list</i></dt>
<dd><p>The item <i class="arg">-directory</i> creates a group composed by an entry widget together with a button that allows opening a directory browser. The data type <i class="arg">directory</i> is automatically selected for this entry if no data type has been explicitly defined with the <i class="arg">-type</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-directory</b> {-label &quot;Report directory&quot; -variable ReportDir}</pre>
</dd>
<dt>-existingdirectory <i class="arg">list</i></dt>
<dd><p>The item <i class="arg">-existingdirectory</i> creates a group composed by an entry widget together with a button that allows opening a browser to select an existing directory. The data type <i class="arg">existingdirectory</i> is automatically selected for this entry if no data type has been explicitly defined with the <i class="arg">-type</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-existingdirectory</b> {-label &quot;Report directory&quot; -variable ReportDir}</pre>
</dd>
</dl>
<p>Finally, there is a last group of some other special data entry widgets.</p>
<dl class="definitions">
<dt>-color <i class="arg">list</i></dt>
<dd><p>The color selector is composed by an entry widget together with a button that allows opening a color browser. The data type <i class="arg">color</i> is automatically selected for this entry widget type if no data type has been explicitly defined with the <i class="arg">-type</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-color</b> {-label &quot;Background color&quot; -variable Color -default red}</pre>
</dd>
<dt>-font <i class="arg">list</i></dt>
<dd><p>The font selector is composed by an entry widget together with a button that allows opening a font browser. The data type <i class="arg">font</i> is automatically selected for this entry widget type if no data type has been explicitly defined with the <i class="arg">-type</i> attribute. The entry widget displays an example text in the format of the selected font.</p>
<p>The font browser allows selecting by default the font families provided by the <b class="cmd">font families</b> Tk command as well as a reasonable set of different font sizes between 6 points and 40 points. Different sets of font families and font sizes can be specified respectively via the <i class="arg">-font_families</i> or <i class="arg">-font_sizes</i> attributes.</p>
<p>If no default font is provided via the <i class="arg">-default</i> attribute, the default font of the label widget to display the selected font will be used as default selected font. If the font family of this label widget is not part of the available families the first available family is used as default. If the font size of this label widget is not part of the available sizes the next close available size is selected as default size.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-font</b> {-label &quot;Font&quot; -variable Font \
          -font_sizes {8 10 12 16} \
          -default {Arial 20 italic}}</pre>
</dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Entry Widget Item Attributes</a></h3>
<p>All the entry widget items are accepting the following attributes:</p>
<dl class="definitions">
<dt>-text <i class="arg">string</i></dt>
<dd><p>Eventual descriptions and comments specified with the <i class="arg">-text</i> attribute are displayed above the entry widget.</p>
<pre class="example">tepam::argument_dialogbox \
   -entry {<b class="cmd">-text &quot;Please enter your name bellow&quot;</b> -variable Name}</pre>
</dd>
<dt>-label <i class="arg">string</i></dt>
<dd><p>The label attribute creates left to the entry widget a label using the provided string as label text:</p>
<pre class="example">tepam::argument_dialogbox \
   -entry {<b class="cmd">-label Name</b> -variable Name}</pre>
</dd>
<dt>-variable <i class="arg">string</i></dt>
<dd><p>All entry widgets require a specified variable. After accepting the entered information with the OK button, the entry widget's data are stored inside the defined variables.</p>
<pre class="example">tepam::argument_dialogbox \
   -existingdirectory {-label &quot;Report directory&quot; <b class="cmd">-variable ReportDir</b>}</pre>
</dd>
<dt>-default <i class="arg">string</i></dt>
<dd><p>Eventual default data for the entry widgets can be provided via the <i class="arg">-default</i> attribute. The default value is overridden if an argument dialog box with a defined context is called another time. The value acknowledged in a previous call will be used in this case as default value.</p>
<pre class="example">tepam::argument_dialogbox \
   -checkbox {-label &quot;Font sytle&quot; -variable FontStyle \
               -choices {bold italic underline} <b class="cmd">-default italic</b>}</pre>
</dd>
<dt>-optional <b class="const">0</b>|<b class="const">1</b></dt>
<dd><p>Data can be specified as optional or mandatory with the <i class="arg">-optional</i> attribute that requires either <b class="const">0</b> (mandatory) or <b class="const">1</b> (optional) as attribute data.</p>
<p>In case an entry is optional and no data has been entered, e.g. the entry contains an empty character string, the entry will be considered as undefined and the assigned variable will not be defined.</p>
<pre class="example">tepam::argument_dialogbox \
   -entry {-label &quot;City&quot; -variable start_city -type string} \
   -entry {-label &quot;Street&quot; -variable start_street -type string <b class="cmd">-optional 0</b>} \
   -entry {-label &quot;Street number&quot; -variable start_street_nbr -type integer <b class="cmd">-optional 1</b>} \</pre>
</dd>
<dt>-type <i class="arg">string</i></dt>
<dd><p>If the data type is defined with the <i class="arg">-type</i> attribute the argument dialog box will automatically perform a data type check after acknowledging the entered values and before the dialog box is closed. If a type incompatible value is found an error message box appears and the user can correct the value.</p>
<p>The argument dialog box accepts all types that have been specified by the TEPAM package and that are also used by <b class="cmd"><a href="tepam_procedure.html">tepam::procedure</a></b> (see the <em>tepam::procedure reference manual</em>).</p>
<p>Some entry widgets like the file and directory widgets, as well as the color and font widgets are specifying automatically the default data type if no type has been specified explicitly with the <i class="arg">-type</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   <b class="cmd">-entry</b> {-label &quot;Street number&quot; -variable start_street_nbr <b class="cmd">-type integer</b>} \</pre>
</dd>
<dt>-range <i class="arg">string</i></dt>
<dd><p>Values can be constrained with the <i class="arg">-range</i> attribute. The valid range is defined with a list containing the minimum valid value and a maximum valid value.</p>
<p>The <i class="arg">-range</i> attribute has to be used only for numerical arguments, like integers and doubles.</p>
<pre class="example">tepam::argument_dialogbox \
   -entry {-label Month -variable Month -type integer <b class="cmd">-range {1 12}</b>}</pre>
</dd>
<dt>-validatecommand <i class="arg">string</i></dt>
<dd><p>More complex value validations than type checks can be performed via specific validation commands that are declared with the <i class="arg">-validatecommand</i> attribute.
The provided validation command can be a script (command sequence) in which the pattern <em>%P</em> is replaced by the value that has to be checked.</p>
<pre class="example">tepam::argument_dialogbox \
   -entry {-label &quot;Your comment&quot; -variable YourCom \
           <b class="cmd">-validatecommand</b> &quot;IllegalWordDetector %P&quot;} ]</pre>
</dd>
</dl>
<p>Some other attributes are supported by the list and combo boxes as well as by the radio and check buttons.</p>
<dl class="definitions">
<dt>-choices <i class="arg">string</i></dt>
<dd><p>Choice lists can directly be defined with the <i class="arg">-choices</i> attribute. This way to define choice lists is especially adapted for smaller, fixed selection lists.</p>
<pre class="example">tepam::argument_dialogbox \
   -listbox {-label &quot;Text styles&quot; -variable Styles \
             <b class="cmd">-choices {bold italic underline}</b> -default underline</pre>
</dd>
<dt>-choicelabels <i class="arg">string</i> <em>(only check and radio buttons)</em></dt>
<dd><p>If the check and radio boxes' labels should differ from the option values, they can be defined with the <i class="arg">-choicelabels</i> attribute:</p>
<pre class="example">tepam::argument_dialogbox \
   -checkbox {-label &quot;Font sytle&quot; -variable FontStyle \
              -choices {bold italic underline} \
              <b class="cmd">-choicelabels {Bold Italic Underline}</b> </pre>
</dd>
<dt>-choicevariable <i class="arg">string</i></dt>
<dd><p>Another way to define the choice lists is using the <i class="arg">-choicevariable</i> attribute. This way to define choice lists is especially adapted for huge and eventually variable selection lists.</p>
<pre class="example">set TextSizes {8 9 10 12 15 18}
tepam::argument_dialogbox \
   -combobox {-label &quot;Text size&quot; -variable Size <b class="cmd">-choicevariable TextSizes</b>}</pre>
</dd>
<dt>-multiple_selection <b class="const">0</b>|<b class="const">1</b></dt>
<dd><p>The list box item (<b class="cmd">-listbox</b>) allows by default selecting only one list element. By setting the <i class="arg">-multiple_selection</i> attribute to <b class="const">1</b>, multiple elements can be selected.</p>
<pre class="example">tepam::argument_dialogbox \
   -listbox {-label &quot;Text styles&quot; -variable Styles \
             -choices {bold italic underline} -default underline \
             <b class="cmd">-multiple_selection 1</b> -height 3}</pre>
</dd>
</dl>
<p>Some additional attributes are supported by the file and directory selection widgets.</p>
<dl class="definitions">
<dt>-filetypes <i class="arg">string</i></dt>
<dd><p>The file type attribute is used by the <b class="cmd">-file</b> and <b class="cmd">-existingfile</b> items to define the file endings that are searched by the file browser.</p>
<pre class="example">tepam::argument_dialogbox \
   -file {-label &quot;Image file&quot; -variable ImageF \
          <b class="cmd">-filetypes {{&quot;GIF&quot; {*.gif}} {&quot;JPG&quot; {*.jpg}}}</b>}</pre>
</dd>
<dt>-initialfile <i class="arg">string</i></dt>
<dd><p>The initial file used by the file browsers of the <b class="cmd">-file</b> and <b class="cmd">-existingfile</b> widgets are by default the file defined with the <i class="arg">-default</i> attribute, unless a file is specified with the <i class="arg">-initialfile</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   -file {-variable ImageF <b class="cmd">-initialfile &quot;picture.gif&quot;</b>}</pre>
</dd>
<dt>-activedir <i class="arg">string</i></dt>
<dd><p>The <i class="arg">-activedir</i> attribute will override the default active search directory used by the file browsers of all file and directory entry widgets. The default active search directory is defined by the directory of a specified initial file (<i class="arg">-initialfile</i>) if defined, and otherwise by the directory of the default file/directory, specified with the <i class="arg">-default</i> attribute.</p>
<pre class="example">tepam::argument_dialogbox \
   -file &quot;-variable ImageF <b class="cmd">-activedir $pwd</b>&quot;</pre>
</dd>
</dl>
<p>Finally, there is a last attribute supported by some widgets:</p>
<dl class="definitions">
<dt>-height <i class="arg">string</i></dt>
<dd><p>All widgets containing a selection list (<b class="cmd">-listbox</b>, <b class="cmd">-disjointlistbox</b>, <b class="cmd">-font</b>) as well as the multi line <b class="cmd">-text</b> widget are accepting the <i class="arg">-height</i> attribute that defines the number of displayed rows of the selection lists.</p>
<pre class="example">tepam::argument_dialogbox \
   -listbox {-label &quot;Text size&quot; -variable Size \
             -choices {8 9 10 12 15 18} -default 12 <b class="cmd">-height 3</b>}</pre>
<p>If the no height has been explicitly specified the height of the widget will be dynamically adapted to the argument dialog box' size.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">APPLICATION SPECIFIC ENTRY WIDGETS</a></h2>
<p>An application specific entry widget can be made available to the argument dialog box by adding a dedicated procedure to the <b class="namespace">tepam</b> namespace. This procedure has three arguments; the first one is the widget path, the second one a subcommand and the third argument has various purposes:</p>
<pre class="example"><i class="arg">proc</i> tepam::ad_form(&lt;WidgetName&gt;) {W Command {Par &quot;&quot;}} {
   <i class="arg">upvar Option Option; # if required</i>
   <i class="arg">variable argument_dialogbox; # if required</i>
   switch $Command {
      &quot;create&quot; &lt;CreateCommandSequence&gt;
      &quot;set_choice&quot; &lt;SetChoiceCommandSequence&gt;
      &quot;set&quot; &lt;SetCommandv&gt;
      &quot;get&quot; &lt;GetCommandSequence&gt;
   }
}</pre>
<p><b class="cmd">Argument_dialogbox</b> takes care about the <i class="arg">-label</i> and <i class="arg">-text</i> attributes for all entry widgets. For any data entry widget it creates a frame into which the data entry widget components can be placed. The path to this frame is provided via the <i class="arg">W</i> argument.</p>
<p>The entry widget procedure has to support 3 mandatory and an optional command that are selected via the argument <i class="arg">Command</i>:</p>
<dl class="definitions">
<dt><i class="arg">create</i></dt>
<dd><p>The entry widget is called a first time with the command <i class="arg">create</i> to build the data entry widget.</p>
<p>The frames that are made available by <b class="cmd">argument_dialogbox</b> for the entry widgets are by default only extendable in the X direction. To make them also extendable in the Y direction, for example for extendable list boxes, the command <b class="cmd">ad_form(make_expandable) $W</b> has to be executed when an entry widget is built.</p></dd>
<dt><i class="arg">set_choice</i></dt>
<dd><p>The entry widget procedure is only called with the <i class="arg">set_choice</i> command if the <i class="arg">-choices</i> or <i class="arg">-choicevariable</i> has been specified. The command is therefore only relevant for list and combo boxes.</p>
<p>The available selection list that is either specified with the <i class="arg">-choices</i> or <i class="arg">-choicevariable</i> attribute is provided via the <i class="arg">Par</i> argument to the entry widget procedure. This list can be used to initialize an available choice list.</p></dd>
<dt><i class="arg">set</i></dt>
<dd><p>If a default value is either defined via the <i class="arg">-default</i> attribute or via a preceding call the entry widget procedure is called with the <i class="arg">set</i> command. The argument <i class="arg">Par</i> contains in this case the value to which the entry widget has to be initialized.</p></dd>
<dt><i class="arg">get</i></dt>
<dd><p>The entry widget procedure's command <i class="arg">get</i> has to return the current value of the entry widget.</p></dd>
</dl>
<p>Eventually specified entry widget item attributes are available via the <b class="variable">Option</b> array variable of the calling procedure. This variable becomes accessible inside the entry widget procedure via the <b class="cmd">upvar</b> command.</p>
<p>There may be a need to store some information in a variable. The array variable <b class="variable">argument_dialogbox</b> has to be used for this purpose together with array indexes starting with <em>&quot;$W,&quot;</em>, e.g. <em>argument_dialogbox($W,values)</em>.</p>
<p>Examples of entry widget procedures are directly provided by the TEPAM package source file that specifies the standard entry widget procedures. The simplest procedure is the one for the basic <em>entry</em> widget:</p>
<pre class="example">proc tepam::ad_form(entry) {W Command {Par &quot;&quot;}} {
   switch $Command {
      &quot;create&quot; {pack [entry \$W.entry] -fill x \
                        -expand yes -pady 4 -side left}
      &quot;set&quot; {\$W.entry insert 0 $Par}
      &quot;get&quot; {return [\$W.entry get]}
   }
}</pre>
<p>It is also possible to relay on an existing entry widget procedure to derive a new, more specific one. The <em>radiobox</em> widget is used for example, to create a new entry widget that allows selecting either <em>left</em>, <em>center</em> or <em>right</em>. The original <em>radiobox</em> widget is called with the <i class="arg">set_choice</i> command immediately after the <em>create</em> command, to define the fixed list of selection options.</p>
<pre class="example">proc tepam::ad_form(rcl) {W Command {Par &quot;&quot;}} {
   set Res [ad_form(radiobox) $W $Command $Par]
   if {$Command==&quot;create&quot;} {
      ad_form(radiobox) $W set_choice {left center right}
   }
   return $Res
}</pre>
<p>Please consult the TEPAM package source file to find additional and more complex examples of entry widget procedures.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">VARIABLES</a></h2>
<p>The <b class="cmd">argument_dialogbox</b> is using two variables inside the namespace <b class="namespace">::tepam</b>:</p>
<dl class="definitions">
<dt><b class="variable">argument_dialogbox</b></dt>
<dd><p>Application specific entry widget procedures can use this array variable to store their own data, using as index the widget path provided to the procedure, e.g. <em>argument_dialogbox($W,&lt;sub_index&gt;)</em>.</p></dd>
<dt><b class="variable">last_parameters</b></dt>
<dd><p>This array variable is only used by an argument dialog box if its context has been specified via the <i class="arg">-context</i> attribute. The argument dialog box' position and size as well as its entered data are stored inside this variable if the data are acknowledged and the form is closed. This allows the form to restore its previous state once it is called another time.</p>
<p>To reuse the saved parameters not just in the actual application session but also in another one, it is sufficient to store the <b class="variable">last_parameter</b> array variable contents in a configuration file which is loaded the next time an application is launched.</p></dd>
</dl>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="tepam_introduction.html">tepam(n)</a>, <a href="tepam_procedure.html">tepam::procedure(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key353">data entry form</a>, <a href="../../../../index.html#key354">parameter entry form</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Argument entry form, mega widget</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009/2010, Andreas Drollinger</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/tepam/tepam_introduction.html.













































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>tepam - Tcl's Enhanced Procedure and Argument Manager</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/tepam/tepam_introduction.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009/2010, Andreas Drollinger
   -->
<! -- CVS: $Id$ tepam.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tepam(n) 0.4.0 tcllib &quot;Tcl's Enhanced Procedure and Argument Manager&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tepam - An introduction into TEPAM, Tcl's Enhanced Procedure and Argument Manager</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">OVERVIEW</a></li>
<li class="section"><a href="#section3">PROCEDURE DECLARATION</a></li>
<li class="section"><a href="#section4">PROCEDURE HELP</a></li>
<li class="section"><a href="#section5">PROCEDURE CALL</a></li>
<li class="section"><a href="#section6">INTERACTIVE PROCEDURE CALLS</a></li>
<li class="section"><a href="#section7">FLEXIBLE ARGUMENT DIALOG BOX</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This document is an informal introduction into TEPAM, the Tcl's Enhanced Procedure and Argument Manager. Detailed information to the TEPAM package is provided in the <em>tepam::procedure</em> and <em>tepam::argument_dialogbox</em> reference manuals.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">OVERVIEW</a></h2>
<p>This package provides a new Tcl procedure declaration syntax that simplifies the implementation of procedure subcommands and the handling of the different types of procedure arguments like flags or switches, options, unnamed arguments, optional and mandatory options and arguments, default values, etc. Procedure declarations can be enriched with detailed information about the procedure and its arguments. This information is used for the following purposes:</p>
<p>First of all, a preamble is added in front of the body of a procedure that is declared with TEPAM. This preamble calls an argument manager that that uses the provided information to check the validity of the argument types and values before the procedure body is executed. Then, the information is used to generate help and usage texts if requested, or to generate clear error message in case an argument validation fails. The information also allows generating automatically graphical forms that allows an interactive definition of all arguments, in case a procedure is called interactively. And finally, the additional information helps self-commenting in a clean way the declaration of a procedure and of all its arguments.</p>
<p>The graphical form generator that creates the necessary argument specification forms for the interactive procedure calls is also available for other purposes than for procedure argument specifications. It allows creating code efficiently complex parameter entry forms that are usable independently from TEPAM's new procedure definition method.</p>
<p>Here is a short overview about all major TEPAM features:</p>
<ul class="itemized">
<li><p>New self-documenting procedure declaration syntax: The additional information to declare properly a procedure has not to be provided with additional statements, but can be added in a natural syntax directly into the procedure header.</p></li>
<li><p>Easy way to specify subcommands: A subcommand is declared like a procedure, simply with a procedure name composed by a base name followed by a subcommand name. Sub-subcommands are created identically using simply procedure names composed by 3 words.</p></li>
<li><p>Flexible usage of flags (switches), options (named arguments) and unnamed arguments. Option names are optionally automatically completed.</p></li>
<li><p>Support for default values, mandatory/optional options and arguments, choice lists, value ranges, multiple usable options/arguments.</p></li>
<li><p>Choice of a <em>named arguments first, unnamed arguments later</em> procedure calling style (typical for Tcl commands) or of an <em>unnamed arguments first, named arguments later</em> procedure calling style (typical for Tk commands).</p></li>
<li><p>In case the <em>named arguments first, unnamed arguments later</em> style (Tcl) is selected:  Clear separation between options and arguments via the &quot;--&quot; flag. The unnamed arguments can optionally be accessed as options (named arguments).</p></li>
<li><p>Automatic type and value check before the procedure body is executed, taking into account validation ranges, choice lists and custom validation commands. Generation of clear error message if necessary.</p></li>
<li><p>Many predefined types exist (integer, boolean, double, color, file, font, ...). Other application specific types can easily be added.</p></li>
<li><p>Automatic help and usage text generation if a procedure is called with the <i class="arg">-help</i> flag.</p></li>
<li><p>Automatic generation of an interactive argument definition form, in case a procedure is called with the <i class="arg">-interactive</i> flag.</p></li>
<li><p>Procedure calls can be logged which is useful to get for interactively called procedures the command call lines.</p></li>
<li><p>Powerful and code efficient generation of complex parameter definition forms.</p></li>
</ul>
</div>
<div id="section3" class="section"><h2><a name="section3">PROCEDURE DECLARATION</a></h2>
<p>TEPAM's procedure declaration syntax is simple and self-explaining. Instead of declaring a procedure with the Tcl key word <b class="cmd"><a href="../../../../index.html#key543">proc</a></b>, a procedure is declared with the TEPAM command <b class="cmd"><a href="../../../../index.html#key41">procedure</a></b> which takes as <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> also 3 arguments: The procedure name, the procedure header and the procedure body.</p>
<p>The following example declares the subcommand <b class="cmd"><a href="../../../../index.html#key320">message</a></b> of the procedure <b class="cmd">display</b>. This command has several named and unnamed arguments:</p>
<pre class="example"><b class="cmd"><a href="tepam_procedure.html">tepam::procedure</a></b> {display message} {
   -return            -
   -short_description &quot;Displays a simple message box&quot;
   -description       &quot;This procedure allows displaying a configurable message box.
   -args {
      {-mtype -default Warning -choices {Info Warning Error} -description &quot;Message type&quot;}
      {-font -type font -default {Arial 10 italic} -description &quot;Message text font&quot;}
      {-level -type integer -optional -range {1 10} -description &quot;Message level&quot;}
      {-fg -type color -default black -description &quot;Message color&quot;}
      {-bg -type color -optional -description &quot;Background color&quot;}
      {-no_border -type none -description &quot;Use a splash window style (no border)&quot;}
      {-log_file -type file -optional -description &quot;Optional message log file&quot;}
      {text -type string -multiple -description &quot;Multiple text lines to display&quot;}
   }
} {
<em>   puts &quot;display message:&quot;
   foreach var {mtype font level fg bg no_border log_file text} {
      if {[info exists $var]} {
         puts  &quot;  $var=[set $var]&quot;
      }
   }
</em>}</pre>
<p>A call of procedure that has been declared in this way will first invoke the TEPAM argument manager, before the procedure body is executed. The argument manager parses the provided arguments, validates them, completes them eventually with some default values, and makes them finally available to the procedure body as local variables. In case an argument is missing or has a wrong type, the argument manager generates an error message that explains the reason for the error.</p>
<p>As the example above shows, the TEPAM command <b class="cmd"><a href="../../../../index.html#key41">procedure</a></b> accepts subcommand definitions as procedure name and allows defining much more information than just the argument list inside the procedure header. The procedure body on the other hand is identical between a command declared with <b class="cmd"><a href="../../../../index.html#key543">proc</a></b> and a command declared with <b class="cmd"><a href="../../../../index.html#key41">procedure</a></b>.</p>
<p>The procedure header allows defining in addition to the arguments some procedure attributes, like a description, information concerning the return value, etc. This information is basically used for the automatic generation of comprehensive help and usage texts.</p>
<p>A list of argument definition statements assigned to the <i class="arg">-args</i> argument is defining the procedure arguments. Each argument definition statement starts with the argument name, optionally followed by some argument attributes.</p>
<p>Three types of arguments can be defined: Unnamed arguments, named arguments and flags. The distinction between the named and unnamed arguments is made by the first argument name character which is simply &quot;-&quot; for named arguments. A flag is defined as named argument that has the type  <em>none</em>.</p>
<p>Named and unnamed arguments are mandatory, unless they are declared with the <i class="arg">-optional</i> flag and unless they have a default value specified with the <i class="arg">-default</i> option. Named arguments and the last unnamed argument can have the attribute <i class="arg">-multiple</i>, which means that they can be defined multiple times. The expected argument data type is specified with the <i class="arg">-type</i> option. TEPAM defines a large set of standard data types which can easily be completed with application specific data types.</p>
<p>The argument declaration order has only an importance for unnamed arguments that are by default parsed after the named arguments (Tcl style). A variable allows changing this behavior in a way that unnamed arguments are parsed first, before the named arguments (Tk style).</p>
</div>
<div id="section4" class="section"><h2><a name="section4">PROCEDURE HELP</a></h2>
<p>The declared procedure can simply be called with the <i class="arg">-help</i> option to get the information about the usage of the procedure and its arguments:</p>
<pre class="example"><b class="cmd">display message</b> -help
<em>  -&gt;
NAME
      display message - Displays a simple message box
SYNOPSYS
      display message
            [-mtype &lt;mtype&gt;] :
               Message type, default: &quot;Warning&quot;, choices: {Info Warning Error}
            [-font &lt;font&gt;] :
               Message text font, type: font, default: Arial 10 italic
            [-level &lt;level&gt;] :
               Message level, type: integer, range: 1..10
            [-fg &lt;fg&gt;] :
               Message color, type: color, default: black
            [-bg &lt;bg&gt;] :
               Background color, type: color
            [-no_border ] :
               Use a splash window style (no border)
            [-log_file &lt;log_file&gt;] :
               Optional message log file, type: file
            &lt;text&gt; :
               Multiple text lines to display, type: string
DESCRIPTION
      This procedure allows displaying a configurable message box.</em></pre>
</div>
<div id="section5" class="section"><h2><a name="section5">PROCEDURE CALL</a></h2>
<p>The specified procedure can be called in many ways. The following listing shows some valid procedure calls:</p>
<pre class="example"><b class="cmd">display message</b> &quot;The document hasn't yet been saved!&quot;
<em>-&gt; display message:
     mtype=Warning
     font=Arial 10 italic
     fg=black
     no_border=0
     text={The document hasn't yet been saved!}</em>
 
<b class="cmd">display message</b> -fg red -bg black &quot;Please save first the document&quot;
<em>-&gt; display message:
     mtype=Warning
     font=Arial 10 italic
     fg=red
     bg=black
     no_border=0
     text={Please save first the document}</em>
 
<b class="cmd">display message</b> -mtype Error -no_border &quot;Why is here no border?&quot;
<em>-&gt; display message:
     mtype=Error
     font=Arial 10 italic
     fg=black
     no_border=1
     text={Why is here no border?}</em>
 
<b class="cmd">display message</b> -font {Courier 12} -level 10 \
   &quot;Is there enough space?&quot; &quot;Reduce otherwise the font size!&quot;
<em>-&gt; display message:
     mtype=Warning
     font=Courier 12
     level=10
     fg=black
     no_border=0
     text={Is there enough space?} {Reduce otherwise the font size!}</em></pre>
<p>The next lines show how wrong arguments are recognized. The <i class="arg">text</i> argument that is mandatory is missing in the first procedure call:</p>
<pre class="example"><b class="cmd">display message</b> -font {Courier 12}
<em>  -&gt; display message: Required argument is missing: text</em></pre>
<p>Only known arguments are accepted:</p>
<pre class="example"><b class="cmd">display message</b> -category warning Hello
<em>  -&gt; display message: Argument '-category' not known</em></pre>
<p>Argument types are automatically checked and an error message is generated in case the argument value has not the expected type:</p>
<pre class="example"><b class="cmd">display message</b> -fg MyColor &quot;Hello&quot;
<em>  -&gt; display message: Argument 'fg' requires type 'color'. \ 
            Provided value: 'MyColor'</em></pre>
<p>Selection choices have to be respected ...</p>
<pre class="example"><b class="cmd">display message</b> -mtype Fatal Hello
<em>  -&gt; display message: Argument (mtype) has to be one of the \ 
            following elements: Info, Warning, Error</em></pre>
<p>... as well as valid value ranges:</p>
<pre class="example"><b class="cmd">display message</b> -level 12 Hello
<em>  -&gt; display message: Argument (level) has to be between 1 and 10</em></pre>
</div>
<div id="section6" class="section"><h2><a name="section6">INTERACTIVE PROCEDURE CALLS</a></h2>
<p>The most intuitive way to call the procedure is using an form that allows specifying all arguments interactively. This form will automatically be generated if the declared procedure is called with the <i class="arg">-interactive</i> flag.</p>
<pre class="example"><b class="cmd">display message</b> -interactive</pre>
<p>The generated form contains for each argument a data entry widget that is adapted to the argument type. Check buttons are used to specify flags, radio boxes for tiny choice lists, disjoint list boxes for larger choice lists and files, directories, fonts and colors can be selected with dedicated browsers.</p>
<p>After acknowledging the specified argument data via an OK button, the entered data are first validated, before the provided arguments are transformed into local variables and the procedure body is executed. In case the entered data are invalid, a message appears and the user can correct them until they are valid.</p>
<p>The procedure calls can optionally be logged in a variable. This is for example useful to get the command call lines of interactively called procedures.</p>
</div>
<div id="section7" class="section"><h2><a name="section7">FLEXIBLE ARGUMENT DIALOG BOX</a></h2>
<p>The form generator that creates in the previous example the argument dialog box for the interactive procedure call is also available for other purposes than for the definition of procedure arguments. TEPAM's provided argument dialog box allows crating complex parameter definition forms in a very efficient way.</p>
<p>The following example tries to illustrate the simplicity to create complex data entry forms. It creates an input mask that allows specifying a file to copy, a destination folder as well as a checkbox that allows specifying if an eventual existing file can be overwritten. Comfortable browsers can be used to select files and directories. And finally, the form offers also the possibility to accept and decline the selection. Here is the code snippet that is doing all this:</p>
<pre class="example"><b class="cmd"><a href="tepam_argument_dialogbox.html">tepam::argument_dialogbox</a></b> \
   <b class="cmd">-existingfile</b> {-label &quot;Source file&quot; -variable SourceFile} \
   <b class="cmd">-existingdirectory</b> {-label &quot;Destination folder&quot; -variable DestDir} \
   <b class="cmd">-checkbutton</b> {-label &quot;Overwrite existing file&quot; -variable Overwrite}</pre>
<p>The <b class="cmd">argument_dialogbox</b> returns <b class="const">ok</b> if the entered data are validated. It will return <b class="const">cancel</b> if the data entry has been canceled. After the validation of the entered data, the <b class="cmd">argument_dialogbox</b> defines all the specified variables with the entered data inside the calling context.</p>
<p>An <b class="cmd">argument_dialogbox</b> requires a pair of arguments for each variable that it has to handle. The first argument defines the entry widget type used to select the variable's value and the second one is a lists of attributes related to the variable and the entry widget.</p>
<p>Many entry widget types are available: Beside the simple generic entries, there are different kinds of list and combo boxes available, browsers for existing and new files and directories, check and radio boxes and buttons, as well as color and font pickers. If necessary, additional entry widgets can be defined.</p>
<p>The attribute list contains pairs of attribute names and attribute data. The primary attribute is <i class="arg">-variable</i> used to specify the variable in the calling context into which the entered data has to be stored. Another often used attribute is <i class="arg">-label</i> that allows adding a label to the data entry widget. Other attributes are available that allow specifying default values, the expected data types, valid data ranges, etc.</p>
<p>The next example of a more complex argument dialog box provides a good overview about the different available entry widget types and parameter attributes. The example contains also some formatting instructions like <i class="arg">-frame</i> and <i class="arg">-sep</i> which allows organizing the different entry widgets in frames and sections:</p>
<pre class="example">set ChoiceList {&quot;Choice 1&quot; &quot;Choice 2&quot; &quot;Choice 3&quot; &quot;Choice 4&quot; &quot;Choice 5&quot; &quot;Choice 6&quot;}
 
set Result [<b class="cmd"><a href="tepam_argument_dialogbox.html">tepam::argument_dialogbox</a></b> \
   <b class="cmd">-title</b> &quot;System configuration&quot; \
   <b class="cmd">-context</b> test_1 \
   <b class="cmd">-frame</b> {-label &quot;Entries&quot;} \
      <b class="cmd">-entry</b> {-label Entry1 -variable Entry1} \
      <b class="cmd">-entry</b> {-label Entry2 -variable Entry2 -default &quot;my default&quot;} \
   <b class="cmd">-frame</b> {-label &quot;Listbox &amp; combobox&quot;} \
      <b class="cmd">-listbox</b> {-label &quot;Listbox, single selection&quot; -variable Listbox1 \
                -choices {1 2 3 4 5 6 7 8} -default 1 -height 3} \
      <b class="cmd">-listbox</b> {-label &quot;Listbox, multiple selection&quot; -variable Listbox2 
                -choicevariable ChoiceList -default {&quot;Choice 2&quot; &quot;Choice 3&quot;} 
                -multiple_selection 1 -height 3} \
      <b class="cmd">-disjointlistbox</b> {-label &quot;Disjoined listbox&quot; -variable DisJntListbox 
                        -choicevariable ChoiceList \
                        -default {&quot;Choice 3&quot; &quot;Choice 5&quot;} -height 3} \
      <b class="cmd">-combobox</b> {-label &quot;Combobox&quot; -variable Combobox \
                 -choices {1 2 3 4 5 6 7 8} -default 3} \
   <b class="cmd">-frame</b> {-label &quot;Checkbox, radiobox and checkbutton&quot;} \
      <b class="cmd">-checkbox</b> {-label Checkbox -variable Checkbox 
                 -choices {bold italic underline} -choicelabels {Bold Italic Underline} \
                 -default italic} \
      <b class="cmd">-radiobox</b> {-label Radiobox -variable Radiobox 
                 -choices {bold italic underline} -choicelabels {Bold Italic Underline} \
                 -default underline} \
      <b class="cmd">-checkbutton</b> {-label CheckButton -variable Checkbutton -default 1} \
   <b class="cmd">-frame</b> {-label &quot;Files &amp; directories&quot;} \
      <b class="cmd">-existingfile</b> {-label &quot;Input file&quot; -variable InputFile} \
      <b class="cmd">-file</b> {-label &quot;Output file&quot; -variable OutputFile} \
      <b class="cmd">-sep</b> {} \
      <b class="cmd">-existingdirectory</b> {-label &quot;Input directory&quot; -variable InputDirectory} \
      <b class="cmd">-directory</b> {-label &quot;Output irectory&quot; -variable OutputDirectory} \
   <b class="cmd">-frame</b> {-label &quot;Colors and fonts&quot;} \
      <b class="cmd">-color</b> {-label &quot;Background color&quot; -variable Color -default red} \
      <b class="cmd">-sep</b> {} \
      <b class="cmd">-font</b> {-label &quot;Font&quot; -variable Font -default {Courier 12 italic}}]</pre>
<p>The <b class="cmd">argument_dialogbox</b> defines all the specified variables with the entered data and returns <b class="const">ok</b> if the data have been validated via the Ok button. If the data entry is cancelled by activating the Cancel button, the <b class="cmd">argument_dialogbox</b> returns <b class="const">cancel</b>.</p>
<pre class="example">if {$Result==&quot;cancel&quot;} {
   puts &quot;Canceled&quot;
} else { # $Result==&quot;ok&quot;
   puts &quot;Arguments: &quot;
   foreach Var {
      Entry1 Entry2
      Listbox1 Listbox2 DisJntListbox 
      Combobox Checkbox Radiobox Checkbutton
      InputFile OutputFile InputDirectory OutputDirectory
      Color Font
   } {
      puts &quot;  $Var: '[set $Var]'&quot;
   }
}
<em>-&gt; Arguments:
   Entry1: 'Hello, this is a trial'
   Entry2: 'my default'
   Listbox1: '1'
   Listbox2: '{Choice 2} {Choice 3}'
   DisJntListbox: '{Choice 3} {Choice 5}'
   Combobox: '3'
   Checkbox: 'italic'
   Radiobox: 'underline'
   Checkbutton: '1'
   InputFile: 'c:\tepam\in.txt'
   OutputFile: 'c:\tepam\out.txt'
   InputDirectory: 'c:\tepam\input'
   OutputDirectory: 'c:\tepam\output'
   Color: 'red'
   Font: 'Courier 12 italic'</em></pre>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="tepam_argument_dialogbox.html">tepam::argument_dialogbox(n)</a>, <a href="tepam_procedure.html">tepam::procedure(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key697">argument integrity</a>, <a href="../../../../index.html#key698">argument validation</a>, <a href="../../../../index.html#key699">arguments</a>, <a href="../../../../index.html#key700">entry mask</a>, <a href="../../../../index.html#key354">parameter entry form</a>, <a href="../../../../index.html#key41">procedure</a>, <a href="../../../../index.html#key696">subcommand</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Procedures, arguments, parameters, options</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009/2010, Andreas Drollinger</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/tepam/tepam_procedure.html.



































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>tepam::procedure - Tcl's Enhanced Procedure and Argument Manager</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/tepam/tepam_procedure.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009/2010, Andreas Drollinger
   -->
<! -- CVS: $Id$ tepam::procedure.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tepam::procedure(n) 0.4.0 tcllib &quot;Tcl's Enhanced Procedure and Argument Manager&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tepam::procedure - TEPAM procedure, reference manual</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">TERMINOLOGY</a></li>
<li class="section"><a href="#section3">PROCEDURE DECLARATION</a>
<ul>
<li class="subsection"><a href="#subsection1">Procedure Attributes</a></li>
<li class="subsection"><a href="#subsection2">Argument Declaration</a></li>
</ul>
</li>
<li class="section"><a href="#section4">VARIABLES</a></li>
<li class="section"><a href="#section5">ARGUMENT TYPES</a>
<ul>
<li class="subsection"><a href="#subsection3">Predefined Argument Types</a></li>
<li class="subsection"><a href="#subsection4">Defining Application Specific Argument Types</a></li>
</ul>
</li>
<li class="section"><a href="#section6">PROCEDURE CALLS</a>
<ul>
<li class="subsection"><a href="#subsection5">Help</a></li>
<li class="subsection"><a href="#subsection6">Interactive Procedure Call</a></li>
<li class="subsection"><a href="#subsection7">Unnamed Arguments</a></li>
<li class="subsection"><a href="#subsection8">Named Arguments</a></li>
<li class="subsection"><a href="#subsection9">Unnamed Arguments First, Named Arguments Later (Tk Style)</a></li>
<li class="subsection"><a href="#subsection10">Named Arguments First, Unnamed Arguments Later (Tcl Style)</a></li>
<li class="subsection"><a href="#subsection11">Raw Argument List</a></li>
</ul>
</li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.3</b></li>
<li>package require <b class="pkgname">tepam <span class="opt">?0.4?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">tepam::procedure</b> <i class="arg">name</i> <i class="arg">attributes</i> <i class="arg">body</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides an alternative way to declare Tcl procedures and to manage its arguments. There is a lot of benefit to declare a procedure with TEPAM rather than with the Tcl standard command <b class="function">proc</b>: TEPAM allows specifying inside the procedure declaration all information that is required to generate comprehensive documentations and help support.  The information is also used by an automatically invoked argument checker that validates the provided procedure arguments before the procedure body is executed. Finally, a procedure can be called interactively which will open a graphical form that allows specifying the procedure arguments.</p>
<p>TEPAM simplifies also the handling of the different types of argument, like the <em>named arguments</em> (often also called <em>options</em>) and the <em>unnamed arguments</em>. TEPAM supports the <em>named first, unnamed later</em> style (typical Tcl command style) as well as also the <em>unnamed first, named later</em> style (typical Tk command style). TEPAM takes care about default values for arguments, optional arguments, multiple applicable arguments, etc. and eliminates the need to check the validity of the argument inside the procedure bodies.</p>
<p>An informal overview of all the TEPAM procedure declaration and calling features as well as a short introduction into TEPAM is provided by <em>tepam(n)</em>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">TERMINOLOGY</a></h2>
<p>The exact meaning of several terms that are used in this document will be shortly explained to avoid any ambiguities and misunderstandings.</p>
<dl class="definitions">
<dt><em>Subcommand</em></dt>
<dd><p>The usage of subcommands is heavily used in the Tcl language. Several commands are incorporated into a single main command and are selectable via the first argument.</p>
<p>The <b class="function">string</b> command is an example of such a command that implements for example subcommands to check a character string's length, to compare strings, to extract substrings, etc:</p>
<pre class="example"><b class="function">string length</b> <i class="arg">string</i>
<b class="function">string compare</b> <i class="arg">string</i> <i class="arg">string</i>
<b class="function">string range</b> <i class="arg">string</i> <i class="arg">first</i> <i class="arg">last</i>
...</pre>
<p>TEPAM provides a framework that allows implementing easily such subcommands in form of Tcl procedures. It allows not only defining a first level of subcommands, but also a higher level of subcommands. The <b class="function">string</b> command's class check could be implemented as independent sub-sub-commands of the <b class="function">string</b> command:</p>
<pre class="example"><b class="function">string is alnum</b> <i class="arg">string</i>
<b class="function">string is integer</b> <i class="arg">string</i>
<b class="function">string is double</b> <i class="arg">string</i>
...</pre>
</dd>
<dt><em>Procedure attribute</em></dt>
<dd><p>TEPAM allows attaching to a declared procedure different kind of attributes. Some of these attributes are <em>just</em> used for documentation purposes, but other attributes specify the way how the procedure has to be called. Also the procedure arguments are defined in form of a procedure attribute.</p></dd>
<dt><em>Argument</em></dt>
<dd><p>TEPAM uses the term <em>argument</em> for the parameters of a procedure.</p>
<p>The following example calls the subcommand <b class="cmd">string compare</b> with several arguments:</p>
<pre class="example"><b class="cmd">string compare</b> <i class="arg">-nocase -length 3 &quot;emphasized&quot; &quot;emphasised&quot;</i></pre>
<p>The following paragraphs discuss these different argument types.</p></dd>
<dt><em>Named argument</em></dt>
<dd><p>Some parameters, as <i class="arg">-length 3</i> of the subcommand <b class="cmd">string compare</b> have to be provided as pairs of argument names and argument values. This parameter type is often also called <em>option</em>.</p>
<p>TEPAM uses the term <em>named argument</em> for such options as well as for the flags (see next item).</p></dd>
<dt><em>Flag, switch</em></dt>
<dd><p>Another parameter type is the <em>flag</em> or the <em>switch</em>. Flags are provided simply by naming the flag leading with the '-' character. The <i class="arg">-nocase</i> of the previous <b class="cmd">string compare</b> example is such a flag.</p>
<p><em>Flags</em> are considered by TEPAM like a special form of <em>named arguments</em>.</p></dd>
<dt><em>Unnamed argument</em></dt>
<dd><p>For the other parameters, e.g. the ones for which the argument name has not to be mentioned, TEPAM uses the term <em>unnamed argument</em>. The previous <b class="cmd">string compare</b> example uses for the two provided character strings two <em>unnamed arguments</em>.</p></dd>
<dt><em>Argument attribute</em></dt>
<dd><p>TEPAM allows describing the purpose of each procedure argument with <em>argument attributes</em>. While some of them are just documenting the attributes, most attributes are used by an argument manager to control and validate the arguments that are provided during a procedure call. Argument attributes are used to specify default values, parameter classes (integer, xdigit, font, ...), choice validation lists, value ranges, etc.</p></dd>
<dt><em>Named arguments first, unnamed arguments later</em></dt>
<dd><p>The <b class="cmd">string compare</b> command of the previous example requires that the <em>named arguments</em> (options, flags) are provided first. The two mandatory (unnamed) arguments have to be provided as last argument.</p>
<p>This is the usual Tcl style (exceptions exist) which is referred in the TEPAM documentation as <em>named arguments first, unnamed arguments later style</em>.</p></dd>
<dt><em>Unnamed arguments first, named arguments later</em></dt>
<dd><p>In contrast to most Tcl commands, Tk uses generally (exceptions exist also here) a different calling style where the <em>unnamed arguments</em> have to be provided first, before the <em>named arguments</em> have to be provided:</p>
<pre class="example"><b class="cmd">pack</b> <i class="arg">.ent1 .ent2 -fill x -expand yes -side left</i></pre>
<p>This style is referred in the TEPAM documentation as <em>unnamed arguments first, named arguments later style</em>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">PROCEDURE DECLARATION</a></h2>
<p>TEPAM allows declaring new Tcl procedures with the command <b class="function">tepam::procedure</b> that has similar to the standard Tcl command <b class="function">proc</b> also 3 arguments:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">tepam::procedure</b> <i class="arg">name</i> <i class="arg">attributes</i> <i class="arg">body</i></a></dt>
<dd></dd>
</dl>
<p>The TEPAM procedure declaration syntax is demonstrated by the following example:</p>
<pre class="example"><b class="function">tepam::procedure</b> {display message} {
   -short_description
      &quot;Displays a simple message box&quot;
   -description
      &quot;This procedure allows displaying a configurable\
       message box. The default message type that is\
       created is a warning, but also errors and info can\
       be generated.
       The procedure accepts multiple text lines.&quot;
   -example
      {display message -mtype Warning &quot;Save first your job&quot;}
   -args {
      {-mtype -choices {Info Warning Error} \
              -default Warning -description &quot;Message type&quot;}
      {text   -type string -multiple \
              -description &quot;Multiple text lines to display&quot;}
   }
} {
   puts &quot;Message type: $mtype&quot;
   puts &quot;Message: $text&quot;
}</pre>
<p>The 3 arguments of <b class="function">procedure</b> are:</p>
<dl class="definitions">
<dt><i class="arg">name</i></dt>
<dd><p>The procedure name can be used in very flexible ways. Procedure names can have namespace qualifiers. By providing a two element name list as procedure name, a subcommand of a procedure will be declared. It is even possible to declare sub-sub-commands of a procedure by providing name lists with three elements.</p>
<p>Here are some valid procedure declarations using different procedure names (the attribute and body arguments are empty for simplicity):</p>
<pre class="example"><em># Simple procedure name:</em>
tepam::procedure <b class="function">display_message</b> {} {}
<em></em>
<em># Procedure declared in the main namespace:</em>
tepam::procedure <b class="function">::display_message</b> {} {}
<em></em>
<em># Procedure in the namespace</em> <b class="namespace">::ns</b><em>:</em>
tepam::procedure <b class="function">::ns::display_message</b> {} {}
<em></em>
<em># Declaration of the subcommand</em> <b class="function">message</b> <em>of the procedure</em> <b class="function">display</b><em>:</em>
tepam::procedure <b class="function">{display message}</b> {} {}</pre>
</dd>
<dt><i class="arg">attributes</i></dt>
<dd><p>All procedure attributes are provided in form of an option list that contains pairs of option names and option values. The example above has as procedure attribute a short and a normal description, but also the procedure arguments are defined in form of a procedure attribute.</p>
<p>Most procedure attributes are providing information for documentation purposes. But some of them affect also the way how the procedure can be called. The section <span class="sectref"><a href="#subsection1">Procedure Attributes</a></span> discusses in detail the available procedure attributes.</p>
<p>The procedure arguments are defined in form of a special procedure attribute. Most of the information provided in the argument definition is not just used for documentation purposes. This information is in fact used by the TEPAM argument manager to handle and validate the various forms of arguments that are provided during the procedure calls. The section <span class="sectref"><a href="#subsection2">Argument Declaration</a></span> discusses in detail all the argument definition attributes.</p></dd>
<dt><i class="arg">body</i></dt>
<dd><p>This is the normal procedure body. The declared arguments will be available to the procedure body in form of variables.</p>
<p>The procedure body will only be executed if the provided set of arguments could be validated by the TEPAM argument manager.</p>
<pre class="example">tepam::procedure {display_message} {
   -args {
      {-<b class="variable">mtype</b> -default Warning -choices {Warning Error}}
      {<b class="variable">text</b> -type string}
   }
} {
   puts &quot;Message type: <b class="variable">$mtype</b>&quot;
   puts &quot;Message: <b class="variable">$text</b>&quot;
}</pre>
</dd>
</dl>
<p>The commands <b class="cmd"><a href="../../../../index.html#key41">procedure</a></b> as well as <b class="cmd">argument_dialogbox</b> are exported from the namespace <b class="namespace">tepam</b>. To use these commands without the <b class="namespace">tepam::</b> namespace prefix, it is sufficient to import them into the main namespace:</p>
<pre class="example"><b class="cmd">namespace import tepam::*</b>
 
<b class="cmd"><a href="../../../../index.html#key41">procedure</a></b> {display_message} {
   -args {
      ...</pre>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Procedure Attributes</a></h3>
<p>The first group of procedure attributes is not affecting the behavior of the declared procedure. These attributes are just used for the purpose of documentation and help text generation:</p>
<dl class="definitions">
<dt>-category <i class="arg">string</i></dt>
<dd><p>A category can be assigned to a procedure for documentation purposes. Any string is accepted as category.</p></dd>
<dt>-short_description <i class="arg">string</i></dt>
<dd><p>The short description of a procedure is used in the documentation summary of a generated procedure list as well as
in the NAME section of a generated procedure manual page.</p></dd>
<dt>-description <i class="arg">string</i></dt>
<dd><p>The (full) description assigned to a procedure is used to create user manual and help pages.</p></dd>
<dt>-return <i class="arg">string</i></dt>
<dd><p>The <em>-return</em> attribute allows defining the expected return value of a procedure (used for documentation purposes).</p></dd>
<dt>-example <i class="arg">string</i></dt>
<dd><p>A help text or manual page of a procedure can be enriched with eventual examples, using the <em>-example</em> attribute.</p></dd>
</dl>
<p>The following attributes are not relevant for the documentation and help text generation, but they affect the behavior of the declared procedure:</p>
<dl class="definitions">
<dt>-named_arguments_first <b class="const">0</b>|<b class="const">1</b></dt>
<dd><p>This attribute defines the calling style of a procedure. TEPAM uses by default the <em>named arguments first, unnamed arguments later</em> style (Tcl). This default behavior can globally be changed by setting the variable <b class="variable">tepam::named_arguments_first</b> to <b class="const">0</b>. This global calling style can be changed individually for a procedure with the procedure's <i class="arg">-named_arguments_first</i> attribute.</p></dd>
<dt>-auto_argument_name_completion <b class="const">0</b>|<b class="const">1</b></dt>
<dd><p>The declared procedures will by default automatically try to match eventually abbreviated argument names to the defined arguments names. This default behavior can globally be changed by setting the variable <b class="variable">tepam::auto_argument_name_completion</b> to <b class="const">0</b>. This global setting of the automatic argument name completion can be changed individually for a procedure with the <i class="arg">-auto_argument_name_completion</i> procedure attribute.</p></dd>
<dt>-interactive_display_format <b class="const">extended</b>|<b class="const">short</b></dt>
<dd><p>A procedure declared with the TEPAM <b class="function">procedure</b> command can always be called with the <b class="variable">-interactive</b> option. By doing so, a graphical form will be generated that allows specifying all procedure argument values. There are two display modes for these interactive forms. While the <em>extended</em> mode is more adapted for small procedure argument sets, the <b class="const">short</b> form is more adequate for huge procedure argument sets.</p>
<p>The choice to use short or extended forms can be globally configured via the variable <b class="variable">tepam::interactive_display_format</b>. This global setting can then be changed individually for a procedure with the <i class="arg">-interactive_display_format</i> procedure attribute.</p></dd>
<dt>-args <i class="arg">list</i></dt>
<dd><p>The procedure's arguments are declared via the <i class="arg">-args</i> attribute. An argument is defined via a list having as first element the argument name, followed by eventual argument attributes. All these argument definition lists are packaged themselves into a global list that is assigned to the procedure's <i class="arg">-args</i> attribute.</p>
<p>The argument definition syntax will be described more in detail in the following sub section.</p></dd>
</dl>
<p>The following attribute allows controlling the logging settings for an individual procedure:</p>
<dl class="definitions">
<dt>-command_log <b class="const">0</b>|<b class="const">1</b>|<b class="const">&quot;interactive&quot;</b></dt>
<dd><p>This argument configures the logging of the procedure calls into the list variable <b class="variable">tepam::ProcedureCallLogList</b>. The default configuration defined by the variable <b class="variable">tepam::command_log</b> will be used if this argument is not defined in a procedure declaration.</p>
<p>Setting this argument to <b class="const">0</b> will disable any procedure call loggings, setting it to <b class="const">1</b> will log any procedure calls and setting it to <b class="const">interactive</b> will log just the procedures that are called interactively (procedures called with the <b class="const">-interactive</b> flag).</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Argument Declaration</a></h3>
<p>The following example shows the structure that is used for the argument definitions in the context of a procedure declaration:</p>
<pre class="example">tepam::procedure {display_message} {
   -args <b class="cmd">{
      {-mtype -default Warning -choices {Info Warning Error} -description &quot;Message type&quot;}
      {-font -type font -default {Arial 10 italic} -description &quot;Message text font&quot;}
      {-level -type integer -optional -range {1 10} -description &quot;Message level&quot;}
      {-fg -type color -optional -description &quot;Message color&quot;}
      {-log_file -type file -optional -description &quot;Optional message log file&quot;}
      {text -type string -multiple -description &quot;Multiple text lines to display&quot;}
   }</b>
} {
}</pre>
<p>Each of the procedure arguments is declared with a list that has as first element the argument name, followed by eventual attributes. The argument definition syntax can be formalized in the following way:</p>
<pre class="example">tepam::procedure &lt;name&gt; {
   -args <b class="cmd">{
      {&lt;argument_name_1&gt; &lt;arg_attr_name_1a&gt; &lt;arg_attr_value_1a&gt; \ 
                         &lt;arg_attr_name_1b&gt; &lt;arg_attr_value_1b&gt; ...}
      {&lt;argument_name_2&gt; &lt;arg_attr_name_2a&gt; &lt;arg_attr_value_2a&gt; \ 
                         &lt;arg_attr_name_2b&gt; &lt;arg_attr_value_2b&gt; ...}
      ...
   }</b>
} &lt;body&gt;</pre>
<p>The argument names and attributes have to be used in the following way:</p>
<dl class="definitions">
<dt>Argument name (<em>&lt;argument_name_&lt;n&gt;&gt;</em>)</dt>
<dd><p>The provided argument name specifies whether the argument is an <em>unnamed argument</em> or a <em>named argument</em>. In addition to this, an argument name can also be blank to indicate an argument comment, or it can start with # to indicate a section comment.</p>
<dl class="definitions">
<dt><i class="arg">&quot;&lt;Name&gt;&quot;</i></dt>
<dd><p>This is the simplest form of an argument name: An argument whose name is not starting with '-' is an <em>unnamed argument</em>. The parameter provided during a procedure call will be assigned to a variable with the name <em>&lt;Name&gt;</em>.</p>
<pre class="example">tepam::procedure {print_string} {
   -args {
      {<b class="cmd"><a href="../../../../index.html#key454">text</a></b> -type string -description &quot;This is an unnamed argument&quot;}
   }
} {
   puts <b class="cmd">$text</b>
}
print_string <b class="cmd">&quot;Hello&quot;</b>
<em> -&gt; Hello</em></pre>
</dd>
<dt><i class="arg">&quot;-&lt;Name&gt;&quot;</i></dt>
<dd><p>An argument whose name starts with '-' is a <em>named argument</em> (also called <em>option</em>). The parameter provided during a procedure call will be assigned to a variable with the name <em>&lt;Name&gt;</em> (not <em>-&lt;Name&gt;</em>).</p>
<pre class="example">tepam::procedure {print_string} {
   -args {
      {<b class="cmd">-text</b> -type string -description &quot;This is a named argument&quot;}
   }
} {
   puts <b class="cmd">$text</b>
}
print_string <b class="cmd">-text &quot;Hello&quot;</b>
<em> -&gt; Hello</em></pre>
</dd>
<dt><i class="arg">&quot;--&quot;</i></dt>
<dd><p>This flag allows clearly specifying the end of the named arguments and the beginning of the unnamed arguments, in case the <em>named arguments first, unnamed arguments later style (Tcl)</em> has been selected.</p>
<p>If the <em>unnamed arguments first, named arguments later style (Tk)</em> style is selected, this flag is ignored if the unnamed arguments have already been parsed. Otherwise it will be assigned to the corresponding unnamed argument.</p></dd>
<dt><i class="arg">&quot;-&quot;</i> or <i class="arg">&quot;&quot;</i></dt>
<dd><p>A blank argument name (either '-' or <em>''</em>) starts a comment for the following arguments.</p>
<pre class="example">tepam::procedure {print_time} {
   -interactive_display_format short
   -args {
      {hours -type integer -description &quot;Hour&quot;}
      {minutes -type integer -description &quot;Minute&quot;}
 
      <b class="cmd">{- The following arguments are optional:}</b>
      {seconds -type integer -default 0 -description &quot;Seconds&quot;}
      {milliseconds -type integer -default 0 -description &quot;Milliseconds&quot;}
   }
} {
   puts &quot;${hour}h${minutes}:[expr $seconds+0.001*$milliseconds]&quot;
}</pre>
<p>Argument comments are basically used in the graphical argument definition forms that are created if a procedure is called interactively.</p></dd>
<dt><i class="arg">&quot;#*&quot;</i></dt>
<dd><p>An argument definition list that starts with '#' is considered as a section comment. The argument definition list will be trimmed from the '#' characters and the remaining string will be used as section comment.</p>
<p>Section comments can be used to structure visually the argument definition code. Section comments are also used to structure the generated help texts and the interactive argument definition forms.</p>
<pre class="example">tepam::procedure {complex_multiply} {
   -description &quot;This function perform a complex multiplication&quot;
   -args {
      <b class="cmd">{#### First complex number ####}</b>
      {-r0 -type double -description &quot;First number's real part&quot;}
      {-i0 -type double -description &quot;First number's imaginary part&quot;}
      
      <b class="cmd">{#### Second complex number ####}</b>
      {-r1 -type double -description &quot;Second number's real part&quot;}
      {-i1 -type double -description &quot;Second number's imaginary part&quot;}
   }
} {
   return [expr $r0*$r1 - $i0*$i1]
}</pre>
</dd>
</dl></dd>
<dt>Argument attributes (<em>&lt;arg_attr_name_&lt;mn&gt;&gt; &lt;arg_attr_value_&lt;mn&gt;&gt;</em>)</dt>
<dd><p>The following argument attributes are supported:</p>
<dl class="definitions">
<dt>-description <i class="arg">string</i></dt>
<dd><p>The description argument attribute is used for documentation purpose. Interactive argument definition forms use this attribute to provide explanations for an argument.</p></dd>
<dt>-type <i class="arg">type</i></dt>
<dd><p>The type argument attribute allows assigning the argument either to a predefined data type, or to an application specific data type. The argument values that are provided during a procedure call are automatically checked with respect to the defined argument type.</p>
<p>The section <span class="sectref"><a href="#section5">ARGUMENT TYPES</a></span> provides a list of predefined data types and explains how application specific types can be specified.</p>
<p>The argument type <em>none</em> has a special meaning. An argument that has the type <em>none</em> is handled as a <i class="arg">flag</i>. A flag is always optional and its related variable contains the logical value <b class="const">1</b> if the flag has been defined during the procedure call, or otherwise <b class="const">0</b>.</p></dd>
<dt>-default <i class="arg">value</i></dt>
<dd><p>Eventual default values can be defined with the -default argument attribute. Arguments with default values are automatically optional arguments.</p></dd>
<dt>-optional|-mandatory</dt>
<dd><p>Arguments are by default mandatory, unless a default value is defined. The flag <i class="arg">-optional</i> transforms an argument into an optional argument.</p>
<p>In case an optional argument is not defined during a procedure call, the corresponding variable will not be defined.
The flag <i class="arg">-mandatory</i> is the opposite to <i class="arg">-optional</i>. This flag exists only for completion reason, since an argument is anyway mandatory by default.</p></dd>
<dt>-multiple</dt>
<dd><p>Arguments that have the <i class="arg">-multiple</i> attribute can be defined multiple times during a procedure call. The values that are provided during a procedure call for such an argument are stored in a list variable. This is even the case if such an argument is only defined once during a procedure call.</p>
<p>The <i class="arg">-multiple</i> attribute can be attributed to unnamed arguments and to named arguments. The pair of argument name/argument value has to be repeated for each provided value in case of a named argument.
In case the argument with the <i class="arg">-multiple</i> attribute is an unnamed argument, this one has to be the absolute last one of all unnamed arguments.</p></dd>
<dt>-choices <i class="arg">list</i></dt>
<dd><p>A possible set of valid argument values can be attributed to an argument via the <i class="arg">-choices</i> attribute. The argument value provided during a procedure call will be checked against the provided choice values.</p></dd>
<dt>-choicelabels <i class="arg">list</i></dt>
<dd><p>An eventual short description can be attributed to each choice option with the <i class="arg">-choicelabels</i> attribute. These descriptions will be used in the generated help texts and as radio and check box labels for the interactive calls.</p>
<p>The <i class="arg">-choicelabels</i> attribute is optional, but if it is defined, its list needs to have the identical size as the <i class="arg">-choices</i> argument list.</p></dd>
<dt>-range <i class="arg">{double double}</i></dt>
<dd><p>Another argument constraint can be defined with the <i class="arg">-range</i> attribute. The valid range is defined with a list containing the minimum valid value and a maximum valid value. The <i class="arg">-range</i> attribute has to be used only for numerical arguments, like integers and doubles.</p></dd>
<dt>-validatecommand <i class="arg">script</i></dt>
<dd><p>Eventual more complex argument value validations can be performed via specific validation commands that are assigned to the <i class="arg">-validatecommand</i> attribute. The provided validation command can be a complete script in which the pattern <em>%P</em> is replaced by the argument value that has to be validated.
An example of a validation command declaration is:</p>
<pre class="example">tepam::procedure {display_message} {
   -args {
      {text -type string -description &quot;Message text&quot; \ 
            <b class="cmd">-validatecommand &quot;IllegalWordDetector %P&quot;</b>}
} {
}</pre>
</dd>
<dt>-widget <i class="arg">string</i></dt>
<dd><p>The widgets that allow defining the different arguments in case of an interactive procedure call are normally selected automatically in function of the argument type. The <i class="arg">-widget</i> attribute allows specifying explicitly a certain widget type for an argument.</p></dd>
<dt>-auxargs <i class="arg">list</i></dt>
<dd><p>In case a procedure is called interactively, additional argument attributes can be provided to the interactive argument definition form via the <em>-auxargs</em> attribute that is itself a list of attribute name/attribute value pairs:</p>
<pre class="example">-auxargs {-&lt;arg_attr_name_1a&gt; &lt;arg_attr_value_1a&gt; \ 
          -&lt;arg_attr_name_1b&gt; &lt;arg_attr_value_1b&gt;
          ...
}</pre>
<p>For example, if a procedure takes as argument a file name it may be beneficial to specify the required file type for the interactive argument definition form. This information can be provided via the <em>-auxargs</em> attribute to the argument definition form:</p>
<pre class="example">tepam::procedure LoadPicture {
   -args {
      {FileName -type existingfile -description &quot;Picture file&quot; \ 
                 <b class="cmd">-auxargs {-filetypes {{&quot;GIF&quot; {*.gif}} {&quot;JPG&quot; {*.jpg}} }}</b>}
   }
} {
}</pre>
</dd>
<dt>-auxargs_commands <i class="arg">script</i></dt>
<dd><p>If the auxiliary argument attributes are not static but have to be dynamically adaptable, the <em>-auxargs_commands</em> allows defining them via commands that are executed during a procedure call. A list of pairs of auxiliary attribute names and commands has to be provided to the <em>-auxargs_commands</em> attribute. The provided commands are executed in the context of the calling procedure.</p>
<pre class="example">-auxargs_commands {-&lt;arg_attr_name_1a&gt; &lt;arg_attr_command_1a&gt; \ 
                   -&lt;arg_attr_name_1b&gt; &lt;arg_attr_command_1b&gt;
                   ...
}</pre>
</dd>
</dl></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">VARIABLES</a></h2>
<p>Several variables defined inside the <b class="namespace">::tepam</b> namespace are impacting the mode of operation of the procedures that have been declared with TEPAM' <b class="function">procedure</b> command.</p>
<dl class="definitions">
<dt><b class="variable">named_arguments_first</b></dt>
<dd><p>This variable defines the general calling style of the procedures. It is by default set to <b class="const">1</b> which selects the <em>named arguments first, unnamed arguments later</em> style (Tcl style).</p>
<p>By setting this variable to <b class="const">0</b>, the <em>named arguments first, unnamed arguments later</em> style is globally selected (Tk style):</p>
<pre class="example">set tepam::named_arguments_first 0</pre>
<p>While this variable defines the general calling style, the procedure attribute <i class="arg">-named_arguments_first</i> can adapt this style individually for each declared procedure.</p></dd>
<dt><b class="variable">auto_argument_name_completion</b></dt>
<dd><p>This variable controls the general automatic argument name matching mode. By default it is set to <b class="const">1</b>, meaning that the called procedures are trying to match eventually abbreviated argument names with the declared argument names.</p>
<p>By setting this variable to <b class="const">0</b> the automatic argument name matching mode is disabled:</p>
<pre class="example">set tepam::auto_argument_name_completion 0</pre>
<p>While this variable defines the general matching mode, the procedure attribute <i class="arg">-auto_argument_name_completion</i> can adapt this mode individually for each declared procedure.</p></dd>
<dt><b class="variable">interactive_display_format</b></dt>
<dd><p>A procedure declared via the TEPAM <b class="function">procedure</b> command can always be called with the <b class="variable">-interactive</b> switch. By doing so, a graphical form will be generated that allows entering interactively all procedure arguments.</p>
<p>There are two display modes for these interactive forms. The <em>extended</em> mode which is the default mode is more adapted for small procedure argument sets. The <b class="const">short</b> form is more adequate for huge procedure argument sets:</p>
<pre class="example">set tepam::interactive_display_format &quot;short&quot;</pre>
<p>The choice to use short or extended forms can be globally configured via the variable <b class="variable">interactive_display_format</b>.
This global setting can be changed individually for a procedure with the procedure attribute <i class="arg">-interactive_display_format</i>.</p></dd>
<dt><b class="variable">help_line_length</b></dt>
<dd><p>The maximum line length used by the procedure help text generator can be specified with this variable. The default length which is set to 80 (characters) can easily be adapted to the need of an application:</p>
<pre class="example">set tepam::help_line_length 120</pre>
<p>Since this variable is applied directly during the help text generation, its value can continuously be adapted to the current need.</p></dd>
<dt><b class="variable">command_log</b></dt>
<dd><p>Procedure calls can be logged inside the list variable <b class="variable">tepam::ProcedureCallLogList</b>. The variable <b class="variable">tepam::command_log</b> controls the default logging settings for any procedures. The following configurations are supported:</p>
<ul class="itemized">
<li><p><em>0</em>: Disables any procedure call loggings</p></li>
<li><p><em>1</em>: Enables any procedure call loggings</p></li>
<li><p><em>&quot;interactive&quot;</em>: Will log any procedures called interactively (e.g. procedures called with the -interactive flag). This is the default configuration.</p></li>
</ul>
<p>This default logging configuration can be changed individually for each procedure with the <i class="arg">-command_log</i> attribute.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">ARGUMENT TYPES</a></h2>
<p>A comprehensive set of procedure argument types that is already predefined by TEPAM can easily be completed with additional types that are required for a specific application.</p>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Predefined Argument Types</a></h3>
<p>To remember, a type can be assigned to each specified procedure argument:</p>
<pre class="example">tepam::procedure {warning} {
   -args {
      {-font <b class="cmd">-type font</b> -default {Arial 10 italic}}
      {-severity_level <b class="cmd">-type integer</b> -optional -range {1 10}}
      {-fg <b class="cmd">-type color</b> -optional -description &quot;Message color&quot;}
      {text <b class="cmd">-type string</b> -multiple -description &quot;Multiple text lines to display&quot;}
   }
} {
   ...
}</pre>
<p>There are some <em>special purpose types</em> that are building the first category of predefined argument types:</p>
<ul class="itemized">
<li><p><b class="type">none</b></p>
<p>A <em>flag</em>, also called <em>switch</em>, is defined as a named argument that has the type <b class="type">none</b>. Flags are always optional and the default value of the assigned variable is set to <b class="const">0</b>. In contrast to the (normal) named arguments, no argument value has to be provided to a flag.</p>
<pre class="example">tepam::procedure flag_test {
   -args {
      <b class="cmd">{-flag -type none -description &quot;This is a flag&quot;}</b>
   }
} {
   puts <b class="cmd">$flag</b>
}
 
flag_test
<em>-&gt; 0</em>
 
flag_test -flag
<em>-&gt; 1</em></pre>
<p>Since no argument value has to be provided to a flag, also no data check is performed for this argument type.</p></li>
<li><p><b class="type">string</b></p>
<p><b class="type">String</b> is a generic argument data type. Any data string can be provided to a string type argument and no data type checks are therefore performed. The string type allows defining single line strings during the interactive procedure calls.</p></li>
<li><p><b class="type">text</b></p>
<p><b class="type">Text</b> is identical to <b class="type">string</b> with the exception that it allows entering multi line strings during interactive procedure calls.</p></li>
<li><p><b class="type">{}</b></p>
<p>A <b class="type">blank</b> argument type signifies an undefined argument type. This is the default argument type that will be used if no type has been explicitly specified. An argument that has a <b class="type">blank</b> type behaves identically than an argument that has a <b class="type">string</b> type, e.g. no argument data checks are performed. The only difference is that the data type <b class="type">string</b> is mentioned in the generated help documentation, while this is not the case for <b class="type">blank</b> type.</p></li>
</ul>
<p>Several <em>numerical types</em> are defined by TEPAM. The type validation procedures are using the <b class="cmd">string is &lt;type&gt; -strict</b> commands to check the validity of the provided arguments, which assures that no empty strings are accepted as argument value. The type validation expression for the numerical types and the argument types to which this expression is applied are:</p>
<pre class="example">string is <b class="type">&lt;type_to_check&gt;</b> -strict <i class="arg">&lt;argument_value&gt;</i></pre>
<ul class="itemized">
<li><p><em>boolean</em></p></li>
<li><p><em>integer</em></p></li>
<li><p><em>double</em></p></li>
</ul>
<p>Empty strings are accepted as argument value for all the alpha numeric argument types. The argument types that are falling into this category and validation expression used for them are:</p>
<pre class="example">string is <em>&lt;type_to_check&gt;</em> <i class="arg">&lt;argument_value&gt;</i></pre>
<ul class="itemized">
<li><p><em>alnum</em></p></li>
<li><p><em>alpha</em></p></li>
<li><p><em>ascii</em></p></li>
<li><p><em>control</em></p></li>
<li><p><em>digit</em></p></li>
<li><p><em>graph</em></p></li>
<li><p><em>lower</em></p></li>
<li><p><em>print</em></p></li>
<li><p><em>punct</em></p></li>
<li><p><em>space</em></p></li>
<li><p><em>upper</em></p></li>
<li><p><em>wordchar</em></p></li>
<li><p><em>xdigit</em></p></li>
</ul>
<p>In addition to the data types checked with the <b class="cmd">string is &lt;type&gt;</b> commands, TEPAM specifies some other useful data types:</p>
<ul class="itemized">
<li><p><em>char</em></p>
<p>Each string that has a length of 1 character meets the <em>character</em> type. The type check is made with the following expression:</p>
<pre class="example">expr [string length <i class="arg">&lt;argument_value&gt;</i>]==1</pre>
</li>
<li><p><em>color</em></p>
<p>Any character strings that are accepted by Tk as a color are considered as valid color argument. Please note that the Tk package has to be loaded to use the type <em>color</em>. TEPAM is using the following command to validate the color type:</p>
<pre class="example">expr ![catch {winfo rgb . <i class="arg">&lt;argument_value&gt;</i>}]</pre>
</li>
<li><p><em>font</em></p>
<p>Any character strings that are accepted by Tk as a font are considered as valid font argument. Please note that the Tk package has to be loaded to use the <em>font</em> type. TEPAM is using the following command to validate the color type:</p>
<pre class="example">expr ![catch {font measure &lt;argument_value&gt; &quot;&quot;}]</pre>
</li>
<li><p><em>file</em></p>
<p>Any strings that are not containing one of the following characters are considered as valid file names: * ? &quot; &lt; &gt;. It is not necessary that the file and its containing directory exist. Zero-length strings are not considered as valid file names.</p>
<p>The following expression is used to validate the file names:</p>
<pre class="example">expr [string length &lt;argument_value&gt;]&gt;0 &amp;&amp; ![regexp {[\&quot;*?&lt;&gt;:]} &lt;argument_value&gt;]</pre>
</li>
<li><p><em>existingfile</em></p>
<p>The argument is valid if it matches with an existing file. The following check is performed to validate the arguments of this type:</p>
<pre class="example">file exists &lt;argument_value&gt;</pre>
</li>
<li><p><em>directory</em></p>
<p>The directory argument is validated exactly in the same way as the file arguments.</p></li>
<li><p><em>existingdirectory</em></p>
<p>The argument is valid if it matches with an existing directory. The following check is performed to validate the arguments of this type:</p>
<pre class="example">file isdirectory &lt;argument_value&gt;</pre>
</li>
</ul>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Defining Application Specific Argument Types</a></h3>
<p>To add support for a new application specific argument type it is just necessary to add into the namespace <b class="namespace">tepam</b> a validation function <b class="function">Validation(&lt;type&gt;)</b>. This function requires one argument. It has to returns <b class="const">1</b> if the provided argument matches with the relevant data type. The function has to return otherwise <b class="const">0</b>.</p>
<p>The validation command section of the &quot;<b class="file">tepam.tcl</b>&quot; package provides sufficient examples of validation functions, since it implements the ones for the standard TEPAM types.</p>
<p>The following additional code snippet shows the validation function for a custom argument type that requires values that have a character string length of exactly 2:</p>
<pre class="example">proc tepam::Validate(two_char) {v} {expr [string length $v]==2}</pre>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">PROCEDURE CALLS</a></h2>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Help</a></h3>
<p>Each procedure can be called with the <i class="arg">-help</i> flag. The procedure will then print a generated help text to <em>stdout</em> and will then return without performing any additional actions.</p>
<p>Taking the first procedure declared in <span class="sectref"><a href="#section6">PROCEDURE CALLS</a></span>, the help request and the printed help text would be:</p>
<pre class="example"><b class="cmd">display message -help</b>
<em>-&gt;
NAME
      display message - Displays a simple message box
SYNOPSIS
      display message
            [-mtype &lt;mtype&gt;]
               Message type, default: &quot;Warning&quot;, choices: {Info, Warning, Error}
            &lt;text&gt;
               Multiple text lines to display, type: string
DESCRIPTION
      This procedure allows displaying a configurable message box. The default
      message type that is created is a warning, but also errors and info can
      be generated.
      The procedure accepts multiple text lines.
EXAMPLE
      display message -mtype Warning &quot;Save first your job&quot;</em></pre>
<p>The argument manager is checking if the last provided argument is <em>-help</em> and generates the requested help message if this is the case. So, also the following example will print the help message:</p>
<pre class="example"><b class="cmd">display message -mtype Info &quot;It is 7:00&quot; -help</b></pre>
<p>On the other hand, the following call will result in an error:</p>
<pre class="example"><b class="cmd">display message -help -mtype Info &quot;It is 7:00&quot;</b>
<em>-&gt;
display message: Argument '-help' not known</em></pre>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Interactive Procedure Call</a></h3>
<p>Calling a procedure with the <i class="arg">-interactive</i> flag will open a graphical form that allows specifying interactively all procedure arguments. The Tk library has to be loaded to use the interactive call. The following example assures that the Tk library is loaded and shows the command line to call interactively the procedure declared in <span class="sectref"><a href="#section6">PROCEDURE CALLS</a></span>:</p>
<pre class="example">package require Tk
<b class="cmd">display message -interactive</b></pre>
<p>Also the <i class="arg">-interactive</i> flag has to be placed at the last argument position as this is also required for the <i class="arg">-help</i> flag. Arguments defined before the <i class="arg">-interactive</i> flag will be ignored. The following example is therefore also a valid interactive procedure call:</p>
<pre class="example"><b class="cmd">display message</b> -mtype Info &quot;It is 7:00&quot; <b class="cmd">-interactive</b></pre>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Unnamed Arguments</a></h3>
<p>Unnamed arguments are typically provided to the called procedure as simple parameters. This procedure calling form requires that the provided arguments are strictly following the order of the specified arguments. Several parameters can be assigned to the last argument if this one has the <em>-multiple</em> attribute. So, the following declared procedure ...</p>
<pre class="example">tepam::procedure {display_message} {
   -args {
      {mtype -choices {Info Warning Error}}
      {text -type string -multiple}
   }
} {
   puts &quot;$mtype: [join $text]&quot;
}</pre>
<p>... can for example be called in the following ways:</p>
<pre class="example"><b class="cmd">display_message Info &quot;It is PM 7:00.&quot;</b>
<em>-&gt; Info: It is PM 7:00.</em>
 
<b class="cmd">display_message Info &quot;It is PM 7:00.&quot; &quot;You should go home.&quot;</b>
<em>-&gt; Info: It is PM 7:00. You should go home.</em></pre>
<p>The nice thing is that unnamed arguments can also be called as named arguments, which can be handy, for example if the exact specified argument order is not known to a user:</p>
<pre class="example"><b class="cmd">display_message -mtype Info -text &quot;It is PM 7:00.&quot;</b>
<em>-&gt; Info: It is PM 7:00.</em>
 
<b class="cmd">display_message -text &quot;It is PM 7:00.&quot; -mtype Info</b>
<em>-&gt; Info: It is PM 7:00.</em>
 
<b class="cmd">display_message -mtype Info -text &quot;It is PM 7:00.&quot; -text &quot;You should go home.&quot;</b>
<em>-&gt; Info: It is PM 7:00. You should go home.</em>
 
<b class="cmd">display_message -text &quot;It is PM 7:00.&quot; -text &quot;You should go home.&quot; -mtype Info</b>
<em>-&gt; Info: It is PM 7:00. You should go home.</em></pre>
</div>
<div id="subsection8" class="subsection"><h3><a name="subsection8">Named Arguments</a></h3>
<p>Named arguments have to be provided to a procedure in form of a parameter pairs composed by the argument names and the argument values. The order how they are provided during a procedure call is irrelevant and has not to match with the argument specification order.</p>
<p>The following declared procedure ...</p>
<pre class="example">tepam::procedure {display_message} {
   -args {
      {-mtype -choices {Info Warning Error}}
      {-text -type string -multiple}
   }
} {
   puts &quot;$mtype: [join $text]&quot;
}</pre>
<p>... can be called in the following ways:</p>
<pre class="example"><b class="cmd">display_message -mtype Info -text &quot;It is PM 7:00.&quot;</b>
<em>-&gt; Info: It is PM 7:00.</em>
 
<b class="cmd">display_message -text &quot;It is PM 7:00.&quot; -mtype Info</b>
<em>-&gt; Info: It is PM 7:00.</em>
 
<b class="cmd">display_message -mtype Info -text &quot;It is PM 7:00.&quot; -text &quot;You should go home.&quot;</b>
<em>-&gt; Info: It is PM 7:00. You should go home.</em>
 
<b class="cmd">display_message -text &quot;It is PM 7:00.&quot; -text &quot;You should go home.&quot; -mtype Info</b>
<em>-&gt; Info: It is PM 7:00. You should go home.</em></pre>
<p>Also named arguments that have not the <em>-multiple</em> attribute can be provided multiple times. Only the last provided argument will be retained in such a case:</p>
<pre class="example"><b class="cmd">display_message -mtype Info -text &quot;It is PM 7:00.&quot; -mtype Warning</b>
<em>-&gt; Warning: It is PM 7:00.</em></pre>
</div>
<div id="subsection9" class="subsection"><h3><a name="subsection9">Unnamed Arguments First, Named Arguments Later (Tk Style)</a></h3>
<p>A procedure that has been defined while the variable <b class="variable">tepam::named_arguments_first</b> was set to 1, or with the procedure attribute <i class="arg">-named_arguments_first</i> set to 1 has to be called in the Tcl style. The following procedure declaration will be used in this section to illustrate the meaning of this calling style:</p>
<pre class="example"><b class="cmd">set tepam::named_arguments_first 1</b>
tepam::procedure my_proc {
   -args {
      {-n1 -default &quot;&quot;}
      {-n2 -default &quot;&quot;}
      {u1 -default &quot;&quot;}
      {u2 -default &quot;&quot;}
   }
} {
   puts &quot;n1:'$n1', n2:'$n2', u1:'$u1', u2:'$u2'&quot;
}</pre>
<p>The unnamed arguments are placed at the end of procedure call, after the named arguments:</p>
<pre class="example">my_proc <b class="cmd">-n1 N1 -n2 N2 U1 U2</b>
<em>-&gt; n1:'N1', n2:'N2', u1:'U1', u2:'U2'</em></pre>
<p>The argument parser considers the first argument that doesn't start with the '-' character as well as all following arguments as unnamed argument:</p>
<pre class="example">my_proc <b class="cmd">U1 U2</b>
<em>-&gt; n1:'', n2:'', u1:'U1', u2:'U2'</em></pre>
<p>Named arguments can be defined multiple times. If the named argument has the <em>-multiply</em> attribute, all argument values will be collected in a list. Otherwise, only the last provided attribute value will be retained:</p>
<pre class="example">my_proc <b class="cmd">-n1 N1 -n2 N2 -n1 M1 U1 U2</b>
<em>-&gt; n1:'M1', n2:'N2', u1:'U1', u2:'U2'</em></pre>
<p>The name of the first unnamed argument has therefore not to start with the '-' character. The unnamed argument is otherwise considered as name of another named argument. This is especially important if the first unnamed argument is given by a variable that can contain any character strings:</p>
<pre class="example">my_proc <b class="cmd">-n1 N1 -n2 N2 &quot;-&gt;&quot; &quot;&lt;-&quot;</b>
<em>-&gt; my_proc: Argument '-&gt;' not known</em>
 
set U1 &quot;-&gt;&quot;
my_proc -n1 N1 -n2 N2 $U1 U2}]
my_proc: Argument '-&gt;' not known</pre>
<p>The '--' flag allows separating unambiguously the unnamed arguments from the named arguments. All data after the '--' flag will be considered as unnamed argument:</p>
<pre class="example">my_proc <b class="cmd">-n1 N1 -n2 N2 -- &quot;-&gt;&quot; &quot;&lt;-&quot;</b>
<em>-&gt; n1:'N1', n2:'N2', u1:'-&gt;', u2:'&lt;-'</em>
 
set U1 &quot;-&gt;&quot;
my_proc <b class="cmd">-n1 N1 -n2 N2 -- $U1 U2</b>
<em>-&gt; n1:'N1', n2:'N2', u1:'-&gt;', u2:'&lt;-'</em></pre>
</div>
<div id="subsection10" class="subsection"><h3><a name="subsection10">Named Arguments First, Unnamed Arguments Later (Tcl Style)</a></h3>
<p>The Tk calling style will be chosen if a procedure is defined while the variable <b class="variable">tepam::named_arguments_first</b> is set to 0, or if the procedure attribute <i class="arg">-named_arguments_first</i> has been set to 0. The following procedure will be used in this section to illustrate this calling style:</p>
<pre class="example"><b class="cmd">set tepam::named_arguments_first 0</b>
tepam::procedure my_proc {
   -args {
      {-n1 -default &quot;&quot;}
      {-n2 -default &quot;&quot;}
      {u1}
      {u2 -default &quot;&quot; -multiple}
   }
} {
   puts &quot;n1:'$n1', n2:'$n2', u1:'$u1', u2:'$u2'&quot;
}</pre>
<p>The unnamed arguments have to be provided first in this case. The named arguments are provided afterwards:</p>
<pre class="example">my_proc <b class="cmd">U1 U2 -n1 N1 -n2 N2</b>
<em>-&gt; n1:'N1', n1:'N1', u1:'U1', u2:'U2'</em></pre>
<p>The argument parser will assign to each defined unnamed argument a value before it switches to read the named arguments. This default behavior changes a bit if there are unnamed arguments that are optional or that can take multiple values.</p>
<p>An argument value will only be assigned to an unnamed argument that is optional (that has either the <i class="arg">-optional</i> attribute or that has a default value), if the value is not beginning with the '-' character or if no named arguments are defined. The value that starts with '-' is otherwise considered as the name of a named argument.</p>
<p>Argument values are assigned to an argument that has the <i class="arg">-multiple</i> attribute as long as the parameter value doesn't starts with the '-' character.</p>
<p>Values that start with the '-' character can therefore not be assigned to optional unnamed arguments, which restricts the usage of the Tcl procedure calling style. The Tk style may be preferable in some cases, since it allows separating unambiguously the named arguments from the unnamed ones with the '--' flag.</p>
<p>Let's explore in a bit less theoretically the ways how the previously defined procedure can be called: The first example calls the procedure without any parameters, which leads to an error since <i class="arg">u1</i> is a mandatory argument:</p>
<pre class="example">my_proc
<em>-&gt; my_proc: Required argument is missing: u1</em></pre>
<p>The procedure call is valid if one parameter is provided for <i class="arg">u1</i>:</p>
<pre class="example">my_proc <b class="cmd">U1</b>
<em>-&gt; n1:'', n2:'', u1:'U1', u2:''</em></pre>
<p>If more parameters are provided that are not starting with the '-' character, they will be attributed to the unnamed arguments. <i class="arg">U2</i> will receive 3 of these parameters, since it accepts multiple values:</p>
<pre class="example">my_proc <b class="cmd">U1 U2 U3 U4</b>
<em>-&gt; n1:'', n2:'', u1:'U1', u2:'U2 U3 U4'</em></pre>
<p>As soon as one parameter starts with '-' and all unnamed arguments have been assigned, the argument manager tries to interpret the parameter as name of a named argument. The procedure call will fail if a value beginning with '-' is assigned to an unnamed argument:</p>
<pre class="example">my_proc <b class="cmd">U1 U2 U3 U4 -U5</b>
<em>-&gt; my_proc: Argument '-U5' not known</em></pre>
<p>The attribution of a parameter to a named argument will fail if there are undefined unnamed (non optional) arguments. The name specification will in this case simply be considered as a parameter value that is attributed to the <em>next</em> unnamed argument. This was certainly not the intention in the following example:</p>
<pre class="example">my_proc <b class="cmd">-n1 N1</b>
<em>-&gt; n1:'', n2:'', u1:'-n1', u2:'N1'</em></pre>
<p>The situation is completely different if values have already been assigned to all mandatory unnamed arguments. A parameter beginning with the '-' character will in this case be considered as a name identifier for a named argument:</p>
<pre class="example">my_proc <b class="cmd">U1 -n1 N1</b>
<em>-&gt; n1:'N1', n2:'', u1:'U1', u2:''</em></pre>
<p>No unnamed arguments are allowed behind the named arguments:</p>
<pre class="example">my_proc <b class="cmd">U1 -n1 N1 U2</b>
<em>-&gt; my_proc: Argument 'U2' is not an option</em></pre>
<p>The '--' flag has no special meaning if not all mandatory arguments have got assigned a value. This flag will simply be attributed to one of the unnamed arguments:</p>
<pre class="example">my_proc <b class="cmd">-- -n1 N1</b>
<em>-&gt; n1:'N1', n2:'', u1:'--', u2:''</em></pre>
<p>But the '--' flag is simply ignored if the argument parser has started to handle the named arguments:</p>
<pre class="example">my_proc <b class="cmd">U1 -- -n1 N1</b>
<em>-&gt; n1:'N1', n2:'', u1:'U1', u2:''</em>
 
my_proc <b class="cmd">U1 -n1 N1 -- -n2 N2</b>
<em>-&gt; n1:'N1', n2:'N2', u1:'U1', u2:''</em></pre>
</div>
<div id="subsection11" class="subsection"><h3><a name="subsection11">Raw Argument List</a></h3>
<p>It may be necessary sometimes that the procedure body is able to access the entire list of arguments provided during a procedure call. This can happen via the <b class="variable">args</b> variable that contains always the unprocessed argument list:</p>
<pre class="example">tepam::procedure {display_message} {
   -args {
      {-mtype -choices {Warning Error} -default Warning}
      {text -type string -multiple}
   }
} {
   puts &quot;args: <b class="cmd">$args</b>&quot;
}
display_message -mtype Warning &quot;It is 7:00&quot;
<em>-&gt; args: -mtype Warning {It is 7:00}</em></pre>
</div>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="tepam_introduction.html">tepam(n)</a>, <a href="tepam_argument_dialogbox.html">tepam::argument_dialogbox(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key697">argument integrity</a>, <a href="../../../../index.html#key698">argument validation</a>, <a href="../../../../index.html#key699">arguments</a>, <a href="../../../../index.html#key41">procedure</a>, <a href="../../../../index.html#key696">subcommand</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Procedures, arguments, parameters, options</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009/2010, Andreas Drollinger</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/ansi_cattr.html.

































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::ansi::code::attr - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/ansi_cattr.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::ansi::code::attr.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::ansi::code::attr(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::ansi::code::attr - ANSI attribute sequences</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Introspection</a></li>
<li class="subsection"><a href="#subsection2">Attributes</a></li>
</ul>
</li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::ansi::code <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">term::ansi::code::attr <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::term::ansi::code::attr::names</b></a></li>
<li><a href="#2"><b class="cmd">::term::ansi::code::attr::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">::term::ansi::code::attr::fgblack</b></a></li>
<li><a href="#4"><b class="cmd">::term::ansi::code::attr::fgred</b></a></li>
<li><a href="#5"><b class="cmd">::term::ansi::code::attr::fggreen</b></a></li>
<li><a href="#6"><b class="cmd">::term::ansi::code::attr::fgyellow</b></a></li>
<li><a href="#7"><b class="cmd">::term::ansi::code::attr::fgblue</b></a></li>
<li><a href="#8"><b class="cmd">::term::ansi::code::attr::fgmagenta</b></a></li>
<li><a href="#9"><b class="cmd">::term::ansi::code::attr::fgcyan</b></a></li>
<li><a href="#10"><b class="cmd">::term::ansi::code::attr::fgwhite</b></a></li>
<li><a href="#11"><b class="cmd">::term::ansi::code::attr::fgdefault</b></a></li>
<li><a href="#12"><b class="cmd">::term::ansi::code::attr::bgblack</b></a></li>
<li><a href="#13"><b class="cmd">::term::ansi::code::attr::bgred</b></a></li>
<li><a href="#14"><b class="cmd">::term::ansi::code::attr::bggreen</b></a></li>
<li><a href="#15"><b class="cmd">::term::ansi::code::attr::bgyellow</b></a></li>
<li><a href="#16"><b class="cmd">::term::ansi::code::attr::bgblue</b></a></li>
<li><a href="#17"><b class="cmd">::term::ansi::code::attr::bgmagenta</b></a></li>
<li><a href="#18"><b class="cmd">::term::ansi::code::attr::bgcyan</b></a></li>
<li><a href="#19"><b class="cmd">::term::ansi::code::attr::bgwhite</b></a></li>
<li><a href="#20"><b class="cmd">::term::ansi::code::attr::bgdefault</b></a></li>
<li><a href="#21"><b class="cmd">::term::ansi::code::attr::bold</b></a></li>
<li><a href="#22"><b class="cmd">::term::ansi::code::attr::dim</b></a></li>
<li><a href="#23"><b class="cmd">::term::ansi::code::attr::italic</b></a></li>
<li><a href="#24"><b class="cmd">::term::ansi::code::attr::underline</b></a></li>
<li><a href="#25"><b class="cmd">::term::ansi::code::attr::blink</b></a></li>
<li><a href="#26"><b class="cmd">::term::ansi::code::attr::revers</b></a></li>
<li><a href="#27"><b class="cmd">::term::ansi::code::attr::hidden</b></a></li>
<li><a href="#28"><b class="cmd">::term::ansi::code::attr::strike</b></a></li>
<li><a href="#29"><b class="cmd">::term::ansi::code::attr::nobold</b></a></li>
<li><a href="#30"><b class="cmd">::term::ansi::code::attr::noitalic</b></a></li>
<li><a href="#31"><b class="cmd">::term::ansi::code::attr::nounderline</b></a></li>
<li><a href="#32"><b class="cmd">::term::ansi::code::attr::noblink</b></a></li>
<li><a href="#33"><b class="cmd">::term::ansi::code::attr::norevers</b></a></li>
<li><a href="#34"><b class="cmd">::term::ansi::code::attr::nohidden</b></a></li>
<li><a href="#35"><b class="cmd">::term::ansi::code::attr::nostrike</b></a></li>
<li><a href="#36"><b class="cmd">::term::ansi::code::attr::reset</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides symbolic names for the ANSI attribute control
codes. For each control code a single command is provided which
returns this code as its result. None of the commands of this package
write to a channel; that is handled by higher level packages, like
<b class="package"><a href="ansi_send.html">term::ansi::send</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Introspection</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::term::ansi::code::attr::names</b></a></dt>
<dd><p>This command is for introspection. It returns as its result a list
containing the names of all attribute commands.</p></dd>
<dt><a name="2"><b class="cmd">::term::ansi::code::attr::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This command imports some or all attribute commands into the namespace
<i class="arg">ns</i>. This is by default the namespace <em>attr</em>. Note that this
is relative namespace name, placing the imported command into a child
of the current namespace. By default all commands are imported, this
can howver be restricted by listing the names of the wanted commands
after the namespace argument.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Attributes</a></h3>
<dl class="definitions">
<dt><a name="3"><b class="cmd">::term::ansi::code::attr::fgblack</b></a></dt>
<dd><p>Set text color to <em>Black</em>.</p></dd>
<dt><a name="4"><b class="cmd">::term::ansi::code::attr::fgred</b></a></dt>
<dd><p>Set text color to <em>Red</em>.</p></dd>
<dt><a name="5"><b class="cmd">::term::ansi::code::attr::fggreen</b></a></dt>
<dd><p>Set text color to <em>Green</em>.</p></dd>
<dt><a name="6"><b class="cmd">::term::ansi::code::attr::fgyellow</b></a></dt>
<dd><p>Set text color to <em>Yellow</em>.</p></dd>
<dt><a name="7"><b class="cmd">::term::ansi::code::attr::fgblue</b></a></dt>
<dd><p>Set text color to <em>Blue</em>.</p></dd>
<dt><a name="8"><b class="cmd">::term::ansi::code::attr::fgmagenta</b></a></dt>
<dd><p>Set text color to <em>Magenta</em>.</p></dd>
<dt><a name="9"><b class="cmd">::term::ansi::code::attr::fgcyan</b></a></dt>
<dd><p>Set text color to <em>Cyan</em>.</p></dd>
<dt><a name="10"><b class="cmd">::term::ansi::code::attr::fgwhite</b></a></dt>
<dd><p>Set text color to <em>White</em>.</p></dd>
<dt><a name="11"><b class="cmd">::term::ansi::code::attr::fgdefault</b></a></dt>
<dd><p>Set default text color (<em>Black</em>).</p></dd>
<dt><a name="12"><b class="cmd">::term::ansi::code::attr::bgblack</b></a></dt>
<dd><p>Set background to <em>Black</em>.</p></dd>
<dt><a name="13"><b class="cmd">::term::ansi::code::attr::bgred</b></a></dt>
<dd><p>Set background to <em>Red</em>.</p></dd>
<dt><a name="14"><b class="cmd">::term::ansi::code::attr::bggreen</b></a></dt>
<dd><p>Set background to <em>Green</em>.</p></dd>
<dt><a name="15"><b class="cmd">::term::ansi::code::attr::bgyellow</b></a></dt>
<dd><p>Set background to <em>Yellow</em>.</p></dd>
<dt><a name="16"><b class="cmd">::term::ansi::code::attr::bgblue</b></a></dt>
<dd><p>Set background to <em>Blue</em>.</p></dd>
<dt><a name="17"><b class="cmd">::term::ansi::code::attr::bgmagenta</b></a></dt>
<dd><p>Set background to <em>Magenta</em>.</p></dd>
<dt><a name="18"><b class="cmd">::term::ansi::code::attr::bgcyan</b></a></dt>
<dd><p>Set background to <em>Cyan</em>.</p></dd>
<dt><a name="19"><b class="cmd">::term::ansi::code::attr::bgwhite</b></a></dt>
<dd><p>Set background to <em>White</em>.</p></dd>
<dt><a name="20"><b class="cmd">::term::ansi::code::attr::bgdefault</b></a></dt>
<dd><p>Set default background (Transparent).</p></dd>
<dt><a name="21"><b class="cmd">::term::ansi::code::attr::bold</b></a></dt>
<dd><p>Bold on.</p></dd>
<dt><a name="22"><b class="cmd">::term::ansi::code::attr::dim</b></a></dt>
<dd><p>Dim on.</p></dd>
<dt><a name="23"><b class="cmd">::term::ansi::code::attr::italic</b></a></dt>
<dd><p>Italics on.</p></dd>
<dt><a name="24"><b class="cmd">::term::ansi::code::attr::underline</b></a></dt>
<dd><p>Underscore on.</p></dd>
<dt><a name="25"><b class="cmd">::term::ansi::code::attr::blink</b></a></dt>
<dd><p>Blink on.</p></dd>
<dt><a name="26"><b class="cmd">::term::ansi::code::attr::revers</b></a></dt>
<dd><p>Reverse on.</p></dd>
<dt><a name="27"><b class="cmd">::term::ansi::code::attr::hidden</b></a></dt>
<dd><p>Hidden on.</p></dd>
<dt><a name="28"><b class="cmd">::term::ansi::code::attr::strike</b></a></dt>
<dd><p>Strike-through on.</p></dd>
<dt><a name="29"><b class="cmd">::term::ansi::code::attr::nobold</b></a></dt>
<dd><p>Bold off.</p></dd>
<dt><a name="30"><b class="cmd">::term::ansi::code::attr::noitalic</b></a></dt>
<dd><p>Italics off.</p></dd>
<dt><a name="31"><b class="cmd">::term::ansi::code::attr::nounderline</b></a></dt>
<dd><p>Underscore off.</p></dd>
<dt><a name="32"><b class="cmd">::term::ansi::code::attr::noblink</b></a></dt>
<dd><p>Blink off.</p></dd>
<dt><a name="33"><b class="cmd">::term::ansi::code::attr::norevers</b></a></dt>
<dd><p>Reverse off.</p></dd>
<dt><a name="34"><b class="cmd">::term::ansi::code::attr::nohidden</b></a></dt>
<dd><p>Hidden off.</p></dd>
<dt><a name="35"><b class="cmd">::term::ansi::code::attr::nostrike</b></a></dt>
<dd><p>Strike-through off.</p></dd>
<dt><a name="36"><b class="cmd">::term::ansi::code::attr::reset</b></a></dt>
<dd><p>Reset all attributes to their default values.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key158">ansi</a>, <a href="../../../../index.html#key157">attribute control</a>, <a href="../../../../index.html#key156">color control</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/ansi_cctrl.html.





















































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::ansi::code::ctrl - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/ansi_cctrl.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::ansi::code::ctrl.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::ansi::code::ctrl(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::ansi::code::ctrl - ANSI control sequences</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Introspection</a></li>
<li class="subsection"><a href="#subsection2">Sequences</a></li>
</ul>
</li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::ansi::code <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">term::ansi::code::ctrl <span class="opt">?0.1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::term::ansi::code::ctrl::names</b></a></li>
<li><a href="#2"><b class="cmd">::term::ansi::code::ctrl::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">::term::ansi::code::ctrl::eeol</b></a></li>
<li><a href="#4"><b class="cmd">::term::ansi::code::ctrl::esol</b></a></li>
<li><a href="#5"><b class="cmd">::term::ansi::code::ctrl::el</b></a></li>
<li><a href="#6"><b class="cmd">::term::ansi::code::ctrl::ed</b></a></li>
<li><a href="#7"><b class="cmd">::term::ansi::code::ctrl::eu</b></a></li>
<li><a href="#8"><b class="cmd">::term::ansi::code::ctrl::es</b></a></li>
<li><a href="#9"><b class="cmd">::term::ansi::code::ctrl::sd</b></a></li>
<li><a href="#10"><b class="cmd">::term::ansi::code::ctrl::su</b></a></li>
<li><a href="#11"><b class="cmd">::term::ansi::code::ctrl::ch</b></a></li>
<li><a href="#12"><b class="cmd">::term::ansi::code::ctrl::sc</b></a></li>
<li><a href="#13"><b class="cmd">::term::ansi::code::ctrl::rc</b></a></li>
<li><a href="#14"><b class="cmd">::term::ansi::code::ctrl::sca</b></a></li>
<li><a href="#15"><b class="cmd">::term::ansi::code::ctrl::rca</b></a></li>
<li><a href="#16"><b class="cmd">::term::ansi::code::ctrl::st</b></a></li>
<li><a href="#17"><b class="cmd">::term::ansi::code::ctrl::ct</b></a></li>
<li><a href="#18"><b class="cmd">::term::ansi::code::ctrl::cat</b></a></li>
<li><a href="#19"><b class="cmd">::term::ansi::code::ctrl::qdc</b></a></li>
<li><a href="#20"><b class="cmd">::term::ansi::code::ctrl::qds</b></a></li>
<li><a href="#21"><b class="cmd">::term::ansi::code::ctrl::qcp</b></a></li>
<li><a href="#22"><b class="cmd">::term::ansi::code::ctrl::rd</b></a></li>
<li><a href="#23"><b class="cmd">::term::ansi::code::ctrl::elw</b></a></li>
<li><a href="#24"><b class="cmd">::term::ansi::code::ctrl::dlw</b></a></li>
<li><a href="#25"><b class="cmd">::term::ansi::code::ctrl::eg</b></a></li>
<li><a href="#26"><b class="cmd">::term::ansi::code::ctrl::lg</b></a></li>
<li><a href="#27"><b class="cmd">::term::ansi::code::ctrl::scs0</b> <i class="arg">tag</i></a></li>
<li><a href="#28"><b class="cmd">::term::ansi::code::ctrl::scs1</b> <i class="arg">tag</i></a></li>
<li><a href="#29"><b class="cmd">::term::ansi::code::ctrl::sda</b> <i class="arg">arg</i>...</a></li>
<li><a href="#30"><b class="cmd">::term::ansi::code::ctrl::sda_fgblack</b></a></li>
<li><a href="#31"><b class="cmd">::term::ansi::code::ctrl::sda_fgred</b></a></li>
<li><a href="#32"><b class="cmd">::term::ansi::code::ctrl::sda_fggreen</b></a></li>
<li><a href="#33"><b class="cmd">::term::ansi::code::ctrl::sda_fgyellow</b></a></li>
<li><a href="#34"><b class="cmd">::term::ansi::code::ctrl::sda_fgblue</b></a></li>
<li><a href="#35"><b class="cmd">::term::ansi::code::ctrl::sda_fgmagenta</b></a></li>
<li><a href="#36"><b class="cmd">::term::ansi::code::ctrl::sda_fgcyan</b></a></li>
<li><a href="#37"><b class="cmd">::term::ansi::code::ctrl::sda_fgwhite</b></a></li>
<li><a href="#38"><b class="cmd">::term::ansi::code::ctrl::sda_fgdefault</b></a></li>
<li><a href="#39"><b class="cmd">::term::ansi::code::ctrl::sda_bgblack</b></a></li>
<li><a href="#40"><b class="cmd">::term::ansi::code::ctrl::sda_bgred</b></a></li>
<li><a href="#41"><b class="cmd">::term::ansi::code::ctrl::sda_bggreen</b></a></li>
<li><a href="#42"><b class="cmd">::term::ansi::code::ctrl::sda_bgyellow</b></a></li>
<li><a href="#43"><b class="cmd">::term::ansi::code::ctrl::sda_bgblue</b></a></li>
<li><a href="#44"><b class="cmd">::term::ansi::code::ctrl::sda_bgmagenta</b></a></li>
<li><a href="#45"><b class="cmd">::term::ansi::code::ctrl::sda_bgcyan</b></a></li>
<li><a href="#46"><b class="cmd">::term::ansi::code::ctrl::sda_bgwhite</b></a></li>
<li><a href="#47"><b class="cmd">::term::ansi::code::ctrl::sda_bgdefault</b></a></li>
<li><a href="#48"><b class="cmd">::term::ansi::code::ctrl::sda_bold</b></a></li>
<li><a href="#49"><b class="cmd">::term::ansi::code::ctrl::sda_dim</b></a></li>
<li><a href="#50"><b class="cmd">::term::ansi::code::ctrl::sda_italic</b></a></li>
<li><a href="#51"><b class="cmd">::term::ansi::code::ctrl::sda_underline</b></a></li>
<li><a href="#52"><b class="cmd">::term::ansi::code::ctrl::sda_blink</b></a></li>
<li><a href="#53"><b class="cmd">::term::ansi::code::ctrl::sda_revers</b></a></li>
<li><a href="#54"><b class="cmd">::term::ansi::code::ctrl::sda_hidden</b></a></li>
<li><a href="#55"><b class="cmd">::term::ansi::code::ctrl::sda_strike</b></a></li>
<li><a href="#56"><b class="cmd">::term::ansi::code::ctrl::sda_nobold</b></a></li>
<li><a href="#57"><b class="cmd">::term::ansi::code::ctrl::sda_noitalic</b></a></li>
<li><a href="#58"><b class="cmd">::term::ansi::code::ctrl::sda_nounderline</b></a></li>
<li><a href="#59"><b class="cmd">::term::ansi::code::ctrl::sda_noblink</b></a></li>
<li><a href="#60"><b class="cmd">::term::ansi::code::ctrl::sda_norevers</b></a></li>
<li><a href="#61"><b class="cmd">::term::ansi::code::ctrl::sda_nohidden</b></a></li>
<li><a href="#62"><b class="cmd">::term::ansi::code::ctrl::sda_nostrike</b></a></li>
<li><a href="#63"><b class="cmd">::term::ansi::code::ctrl::sda_reset</b></a></li>
<li><a href="#64"><b class="cmd">::term::ansi::send::fcp</b> <i class="arg">row</i> <i class="arg">col</i></a></li>
<li><a href="#65"><b class="cmd">::term::ansi::code::ctrl::cu</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#66"><b class="cmd">::term::ansi::code::ctrl::cd</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#67"><b class="cmd">::term::ansi::code::ctrl::cf</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#68"><b class="cmd">::term::ansi::code::ctrl::cb</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#69"><b class="cmd">::term::ansi::code::ctrl::ss</b> <span class="opt">?<i class="arg">s</i> <i class="arg">e</i>?</span></a></li>
<li><a href="#70"><b class="cmd">::term::ansi::code::ctrl::skd</b> <i class="arg">code</i> <i class="arg">str</i></a></li>
<li><a href="#71"><b class="cmd">::term::ansi::code::ctrl::title</b> <i class="arg">str</i></a></li>
<li><a href="#72"><b class="cmd">::term::ansi::code::ctrl::gron</b></a></li>
<li><a href="#73"><b class="cmd">::term::ansi::code::ctrl::groff</b></a></li>
<li><a href="#74"><b class="cmd">::term::ansi::code::ctrl::tlc</b></a></li>
<li><a href="#75"><b class="cmd">::term::ansi::code::ctrl::trc</b></a></li>
<li><a href="#76"><b class="cmd">::term::ansi::code::ctrl::brc</b></a></li>
<li><a href="#77"><b class="cmd">::term::ansi::code::ctrl::blc</b></a></li>
<li><a href="#78"><b class="cmd">::term::ansi::code::ctrl::ltj</b></a></li>
<li><a href="#79"><b class="cmd">::term::ansi::code::ctrl::ttj</b></a></li>
<li><a href="#80"><b class="cmd">::term::ansi::code::ctrl::rtj</b></a></li>
<li><a href="#81"><b class="cmd">::term::ansi::code::ctrl::btj</b></a></li>
<li><a href="#82"><b class="cmd">::term::ansi::code::ctrl::fwj</b></a></li>
<li><a href="#83"><b class="cmd">::term::ansi::code::ctrl::hl</b></a></li>
<li><a href="#84"><b class="cmd">::term::ansi::code::ctrl::vl</b></a></li>
<li><a href="#85"><b class="cmd">::term::ansi::code::ctrl::groptim</b> <i class="arg">str</i></a></li>
<li><a href="#86"><b class="cmd">::term::ansi::code::ctrl::clear</b></a></li>
<li><a href="#87"><b class="cmd">::term::ansi::code::ctrl::init</b></a></li>
<li><a href="#88"><b class="cmd">::term::ansi::code::ctrl::showat</b> <i class="arg">row</i> <i class="arg">col</i> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides symbolic names for the ANSI control
sequences. For each sequence a single command is provided which
returns the sequence as its result. None of the commands of this
package write to a channel; that is handled by higher level packages,
like <b class="package"><a href="ansi_send.html">term::ansi::send</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Introspection</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::term::ansi::code::ctrl::names</b></a></dt>
<dd><p>This command is for introspection. It returns as its result a list
containing the names of all attribute commands.</p></dd>
<dt><a name="2"><b class="cmd">::term::ansi::code::ctrl::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This command imports some or all attribute commands into the namespace
<i class="arg">ns</i>. This is by default the namespace <em>ctrl</em>. Note that this
is relative namespace name, placing the imported command into a child
of the current namespace. By default all commands are imported, this
can howver be restricted by listing the names of the wanted commands
after the namespace argument.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Sequences</a></h3>
<dl class="definitions">
<dt><a name="3"><b class="cmd">::term::ansi::code::ctrl::eeol</b></a></dt>
<dd><p>Erase (to) End Of Line</p></dd>
<dt><a name="4"><b class="cmd">::term::ansi::code::ctrl::esol</b></a></dt>
<dd><p>Erase (to) Start Of Line</p></dd>
<dt><a name="5"><b class="cmd">::term::ansi::code::ctrl::el</b></a></dt>
<dd><p>Erase (current) Line</p></dd>
<dt><a name="6"><b class="cmd">::term::ansi::code::ctrl::ed</b></a></dt>
<dd><p>Erase Down (to bottom)</p></dd>
<dt><a name="7"><b class="cmd">::term::ansi::code::ctrl::eu</b></a></dt>
<dd><p>Erase Up (to top)</p></dd>
<dt><a name="8"><b class="cmd">::term::ansi::code::ctrl::es</b></a></dt>
<dd><p>Erase Screen</p></dd>
<dt><a name="9"><b class="cmd">::term::ansi::code::ctrl::sd</b></a></dt>
<dd><p>Scroll Down</p></dd>
<dt><a name="10"><b class="cmd">::term::ansi::code::ctrl::su</b></a></dt>
<dd><p>Scroll Up</p></dd>
<dt><a name="11"><b class="cmd">::term::ansi::code::ctrl::ch</b></a></dt>
<dd><p>Cursor Home</p></dd>
<dt><a name="12"><b class="cmd">::term::ansi::code::ctrl::sc</b></a></dt>
<dd><p>Save Cursor</p></dd>
<dt><a name="13"><b class="cmd">::term::ansi::code::ctrl::rc</b></a></dt>
<dd><p>Restore Cursor (Unsave)</p></dd>
<dt><a name="14"><b class="cmd">::term::ansi::code::ctrl::sca</b></a></dt>
<dd><p>Save Cursor + Attributes</p></dd>
<dt><a name="15"><b class="cmd">::term::ansi::code::ctrl::rca</b></a></dt>
<dd><p>Restore Cursor + Attributes</p></dd>
<dt><a name="16"><b class="cmd">::term::ansi::code::ctrl::st</b></a></dt>
<dd><p>Set Tab (@ current position)</p></dd>
<dt><a name="17"><b class="cmd">::term::ansi::code::ctrl::ct</b></a></dt>
<dd><p>Clear Tab (@ current position)</p></dd>
<dt><a name="18"><b class="cmd">::term::ansi::code::ctrl::cat</b></a></dt>
<dd><p>Clear All Tabs</p></dd>
<dt><a name="19"><b class="cmd">::term::ansi::code::ctrl::qdc</b></a></dt>
<dd><p>Query Device Code</p></dd>
<dt><a name="20"><b class="cmd">::term::ansi::code::ctrl::qds</b></a></dt>
<dd><p>Query Device Status</p></dd>
<dt><a name="21"><b class="cmd">::term::ansi::code::ctrl::qcp</b></a></dt>
<dd><p>Query Cursor Position</p></dd>
<dt><a name="22"><b class="cmd">::term::ansi::code::ctrl::rd</b></a></dt>
<dd><p>Reset Device</p></dd>
<dt><a name="23"><b class="cmd">::term::ansi::code::ctrl::elw</b></a></dt>
<dd><p>Enable Line Wrap</p></dd>
<dt><a name="24"><b class="cmd">::term::ansi::code::ctrl::dlw</b></a></dt>
<dd><p>Disable Line Wrap</p></dd>
<dt><a name="25"><b class="cmd">::term::ansi::code::ctrl::eg</b></a></dt>
<dd><p>Enter Graphics Mode</p></dd>
<dt><a name="26"><b class="cmd">::term::ansi::code::ctrl::lg</b></a></dt>
<dd><p>Exit Graphics Mode</p></dd>
<dt><a name="27"><b class="cmd">::term::ansi::code::ctrl::scs0</b> <i class="arg">tag</i></a></dt>
<dd><p>Set default character set</p></dd>
<dt><a name="28"><b class="cmd">::term::ansi::code::ctrl::scs1</b> <i class="arg">tag</i></a></dt>
<dd><p>Set alternate character set
Select Character Set.</p>
<p>Choose which character set is used for either default (scs0) or
alternate font (scs1). This does not change whether default or
alternate font are used, only their definition.</p>
<p>The legal tags, and their meanings, are:</p>
<dl class="definitions">
<dt>A</dt>
<dd><p>United Kingdom Set</p></dd>
<dt>B</dt>
<dd><p>ASCII Set</p></dd>
<dt>0</dt>
<dd><p>Special Graphics</p></dd>
<dt>1</dt>
<dd><p>Alternate Character ROM Standard Character Set</p></dd>
<dt>2</dt>
<dd><p>Alternate Character ROM Special Graphics</p></dd>
</dl></dd>
<dt><a name="29"><b class="cmd">::term::ansi::code::ctrl::sda</b> <i class="arg">arg</i>...</a></dt>
<dd><p>Set Display Attributes. The arguments are the code sequences for the possible
attributes, as provided by the package <b class="package"><a href="ansi_cattr.html">term::ansi::code::attr</a></b>. For
convenience this package also provides additional commands each setting a single
specific attribute.</p></dd>
<dt><a name="30"><b class="cmd">::term::ansi::code::ctrl::sda_fgblack</b></a></dt>
<dd><p>Set text color to <em>Black</em>.</p></dd>
<dt><a name="31"><b class="cmd">::term::ansi::code::ctrl::sda_fgred</b></a></dt>
<dd><p>Set text color to <em>Red</em>.</p></dd>
<dt><a name="32"><b class="cmd">::term::ansi::code::ctrl::sda_fggreen</b></a></dt>
<dd><p>Set text color to <em>Green</em>.</p></dd>
<dt><a name="33"><b class="cmd">::term::ansi::code::ctrl::sda_fgyellow</b></a></dt>
<dd><p>Set text color to <em>Yellow</em>.</p></dd>
<dt><a name="34"><b class="cmd">::term::ansi::code::ctrl::sda_fgblue</b></a></dt>
<dd><p>Set text color to <em>Blue</em>.</p></dd>
<dt><a name="35"><b class="cmd">::term::ansi::code::ctrl::sda_fgmagenta</b></a></dt>
<dd><p>Set text color to <em>Magenta</em>.</p></dd>
<dt><a name="36"><b class="cmd">::term::ansi::code::ctrl::sda_fgcyan</b></a></dt>
<dd><p>Set text color to <em>Cyan</em>.</p></dd>
<dt><a name="37"><b class="cmd">::term::ansi::code::ctrl::sda_fgwhite</b></a></dt>
<dd><p>Set text color to <em>White</em>.</p></dd>
<dt><a name="38"><b class="cmd">::term::ansi::code::ctrl::sda_fgdefault</b></a></dt>
<dd><p>Set default text color (<em>Black</em>).</p></dd>
<dt><a name="39"><b class="cmd">::term::ansi::code::ctrl::sda_bgblack</b></a></dt>
<dd><p>Set background to <em>Black</em>.</p></dd>
<dt><a name="40"><b class="cmd">::term::ansi::code::ctrl::sda_bgred</b></a></dt>
<dd><p>Set background to <em>Red</em>.</p></dd>
<dt><a name="41"><b class="cmd">::term::ansi::code::ctrl::sda_bggreen</b></a></dt>
<dd><p>Set background to <em>Green</em>.</p></dd>
<dt><a name="42"><b class="cmd">::term::ansi::code::ctrl::sda_bgyellow</b></a></dt>
<dd><p>Set background to <em>Yellow</em>.</p></dd>
<dt><a name="43"><b class="cmd">::term::ansi::code::ctrl::sda_bgblue</b></a></dt>
<dd><p>Set background to <em>Blue</em>.</p></dd>
<dt><a name="44"><b class="cmd">::term::ansi::code::ctrl::sda_bgmagenta</b></a></dt>
<dd><p>Set background to <em>Magenta</em>.</p></dd>
<dt><a name="45"><b class="cmd">::term::ansi::code::ctrl::sda_bgcyan</b></a></dt>
<dd><p>Set background to <em>Cyan</em>.</p></dd>
<dt><a name="46"><b class="cmd">::term::ansi::code::ctrl::sda_bgwhite</b></a></dt>
<dd><p>Set background to <em>White</em>.</p></dd>
<dt><a name="47"><b class="cmd">::term::ansi::code::ctrl::sda_bgdefault</b></a></dt>
<dd><p>Set default background (Transparent).</p></dd>
<dt><a name="48"><b class="cmd">::term::ansi::code::ctrl::sda_bold</b></a></dt>
<dd><p>Bold on.</p></dd>
<dt><a name="49"><b class="cmd">::term::ansi::code::ctrl::sda_dim</b></a></dt>
<dd><p>Dim on.</p></dd>
<dt><a name="50"><b class="cmd">::term::ansi::code::ctrl::sda_italic</b></a></dt>
<dd><p>Italics on.</p></dd>
<dt><a name="51"><b class="cmd">::term::ansi::code::ctrl::sda_underline</b></a></dt>
<dd><p>Underscore on.</p></dd>
<dt><a name="52"><b class="cmd">::term::ansi::code::ctrl::sda_blink</b></a></dt>
<dd><p>Blink on.</p></dd>
<dt><a name="53"><b class="cmd">::term::ansi::code::ctrl::sda_revers</b></a></dt>
<dd><p>Reverse on.</p></dd>
<dt><a name="54"><b class="cmd">::term::ansi::code::ctrl::sda_hidden</b></a></dt>
<dd><p>Hidden on.</p></dd>
<dt><a name="55"><b class="cmd">::term::ansi::code::ctrl::sda_strike</b></a></dt>
<dd><p>Strike-through on.</p></dd>
<dt><a name="56"><b class="cmd">::term::ansi::code::ctrl::sda_nobold</b></a></dt>
<dd><p>Bold off.</p></dd>
<dt><a name="57"><b class="cmd">::term::ansi::code::ctrl::sda_noitalic</b></a></dt>
<dd><p>Italics off.</p></dd>
<dt><a name="58"><b class="cmd">::term::ansi::code::ctrl::sda_nounderline</b></a></dt>
<dd><p>Underscore off.</p></dd>
<dt><a name="59"><b class="cmd">::term::ansi::code::ctrl::sda_noblink</b></a></dt>
<dd><p>Blink off.</p></dd>
<dt><a name="60"><b class="cmd">::term::ansi::code::ctrl::sda_norevers</b></a></dt>
<dd><p>Reverse off.</p></dd>
<dt><a name="61"><b class="cmd">::term::ansi::code::ctrl::sda_nohidden</b></a></dt>
<dd><p>Hidden off.</p></dd>
<dt><a name="62"><b class="cmd">::term::ansi::code::ctrl::sda_nostrike</b></a></dt>
<dd><p>Strike-through off.</p></dd>
<dt><a name="63"><b class="cmd">::term::ansi::code::ctrl::sda_reset</b></a></dt>
<dd><p>Reset all attributes to their default values.</p></dd>
<dt><a name="64"><b class="cmd">::term::ansi::send::fcp</b> <i class="arg">row</i> <i class="arg">col</i></a></dt>
<dd><p>Force Cursor Position (aka Go To).</p></dd>
<dt><a name="65"><b class="cmd">::term::ansi::code::ctrl::cu</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>Cursor Up. <i class="arg">n</i> defaults to 1.</p></dd>
<dt><a name="66"><b class="cmd">::term::ansi::code::ctrl::cd</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>Cursor Down. <i class="arg">n</i> defaults to 1.</p></dd>
<dt><a name="67"><b class="cmd">::term::ansi::code::ctrl::cf</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>Cursor Forward. <i class="arg">n</i> defaults to 1.</p></dd>
<dt><a name="68"><b class="cmd">::term::ansi::code::ctrl::cb</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>Cursor Backward. <i class="arg">n</i> defaults to 1.</p></dd>
<dt><a name="69"><b class="cmd">::term::ansi::code::ctrl::ss</b> <span class="opt">?<i class="arg">s</i> <i class="arg">e</i>?</span></a></dt>
<dd><p>Scroll Screen (entire display, or between rows start end, inclusive).</p></dd>
<dt><a name="70"><b class="cmd">::term::ansi::code::ctrl::skd</b> <i class="arg">code</i> <i class="arg">str</i></a></dt>
<dd><p>Set Key Definition.</p></dd>
<dt><a name="71"><b class="cmd">::term::ansi::code::ctrl::title</b> <i class="arg">str</i></a></dt>
<dd><p>Set the terminal title.</p></dd>
<dt><a name="72"><b class="cmd">::term::ansi::code::ctrl::gron</b></a></dt>
<dd><p>Switch to character/box graphics. I.e. switch to the alternate font.</p></dd>
<dt><a name="73"><b class="cmd">::term::ansi::code::ctrl::groff</b></a></dt>
<dd><p>Switch to regular characters. I.e. switch to the default font.</p></dd>
<dt><a name="74"><b class="cmd">::term::ansi::code::ctrl::tlc</b></a></dt>
<dd><p>Character graphics, Top Left Corner.</p></dd>
<dt><a name="75"><b class="cmd">::term::ansi::code::ctrl::trc</b></a></dt>
<dd><p>Character graphics, Top Right Corner.</p></dd>
<dt><a name="76"><b class="cmd">::term::ansi::code::ctrl::brc</b></a></dt>
<dd><p>Character graphics, Bottom Right Corner.</p></dd>
<dt><a name="77"><b class="cmd">::term::ansi::code::ctrl::blc</b></a></dt>
<dd><p>Character graphics, Bottom Left Corner.</p></dd>
<dt><a name="78"><b class="cmd">::term::ansi::code::ctrl::ltj</b></a></dt>
<dd><p>Character graphics, Left T Junction.</p></dd>
<dt><a name="79"><b class="cmd">::term::ansi::code::ctrl::ttj</b></a></dt>
<dd><p>Character graphics, Top T Junction.</p></dd>
<dt><a name="80"><b class="cmd">::term::ansi::code::ctrl::rtj</b></a></dt>
<dd><p>Character graphics, Right T Junction.</p></dd>
<dt><a name="81"><b class="cmd">::term::ansi::code::ctrl::btj</b></a></dt>
<dd><p>Character graphics, Bottom T Junction.</p></dd>
<dt><a name="82"><b class="cmd">::term::ansi::code::ctrl::fwj</b></a></dt>
<dd><p>Character graphics, Four-Way Junction.</p></dd>
<dt><a name="83"><b class="cmd">::term::ansi::code::ctrl::hl</b></a></dt>
<dd><p>Character graphics, Horizontal Line.</p></dd>
<dt><a name="84"><b class="cmd">::term::ansi::code::ctrl::vl</b></a></dt>
<dd><p>Character graphics, Vertical Line.</p></dd>
<dt><a name="85"><b class="cmd">::term::ansi::code::ctrl::groptim</b> <i class="arg">str</i></a></dt>
<dd><p>Optimize character graphics. The generator commands above create way to many
superfluous commands shifting into and out of the graphics mode. This command
removes all shifts which are not needed. To this end it also knows which
characters will look the same in both modes, to handle strings created outside
of this package.</p></dd>
<dt><a name="86"><b class="cmd">::term::ansi::code::ctrl::clear</b></a></dt>
<dd><p>Clear screen. In essence a sequence of CursorHome + EraseDown.</p></dd>
<dt><a name="87"><b class="cmd">::term::ansi::code::ctrl::init</b></a></dt>
<dd><p>Initialize default and alternate fonts to ASCII and box graphics.</p></dd>
<dt><a name="88"><b class="cmd">::term::ansi::code::ctrl::showat</b> <i class="arg">row</i> <i class="arg">col</i> <i class="arg">text</i></a></dt>
<dd><p>Format the block of text for display at the specified location.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key158">ansi</a>, <a href="../../../../index.html#key157">attribute control</a>, <a href="../../../../index.html#key156">color control</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/ansi_cmacros.html.






































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::ansi::code::macros - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/ansi_cmacros.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::ansi::code::macros.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::ansi::code::macros(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::ansi::code::macros - Macro sequences</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Introspection</a></li>
<li class="subsection"><a href="#subsection2">Sequences</a></li>
</ul>
</li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">textutil::repeat</b></li>
<li>package require <b class="pkgname">textutil::tabify</b></li>
<li>package require <b class="pkgname">term::ansi::code::macros <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::term::ansi::code::macros::names</b></a></li>
<li><a href="#2"><b class="cmd">::term::ansi::code::macros::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">::term::ansi::code::macros::menu</b> <i class="arg">menu</i></a></li>
<li><a href="#4"><b class="cmd">::term::ansi::code::macros::frame</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides higher level control sequences for more complex
shapes.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Introspection</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::term::ansi::code::macros::names</b></a></dt>
<dd><p>This command is for introspection. It returns as its result a list
containing the names of all attribute commands.</p></dd>
<dt><a name="2"><b class="cmd">::term::ansi::code::macros::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This command imports some or all attribute commands into the namespace
<i class="arg">ns</i>. This is by default the namespace <em>macros</em>. Note that
this is relative namespace name, placing the imported command into a
child of the current namespace. By default all commands are imported,
this can howver be restricted by listing the names of the wanted
commands after the namespace argument.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Sequences</a></h3>
<dl class="definitions">
<dt><a name="3"><b class="cmd">::term::ansi::code::macros::menu</b> <i class="arg">menu</i></a></dt>
<dd><p>The description of a menu is converted into a formatted rectangular
block of text, with the menu command characters highlighted using bold
red text.  The result is returned as the result of the command.</p>
<p>The description, <i class="arg">menu</i>, is a dictionary mapping from menu label
to command character.</p></dd>
<dt><a name="4"><b class="cmd">::term::ansi::code::macros::frame</b> <i class="arg">string</i></a></dt>
<dd><p>The paragraph of text contained in the string is padded with spaces at
the right margin, after normalizing internal tabs, and then put into a
frame made of box-graphics. The result is returned as the result of
the command.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key158">ansi</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key626">frame</a>, <a href="../../../../index.html#key625">menu</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/ansi_code.html.














































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::ansi::code - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/ansi_code.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::ansi::code.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::ansi::code(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::ansi::code - Helper for control sequences</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::ansi::code <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::term::ansi::code::esc</b> <i class="arg">str</i></a></li>
<li><a href="#2"><b class="cmd">::term::ansi::code::escb</b> <i class="arg">str</i></a></li>
<li><a href="#3"><b class="cmd">::term::ansi::code::define</b> <i class="arg">name</i> <i class="arg">escape</i> <i class="arg">code</i></a></li>
<li><a href="#4"><b class="cmd">::term::ansi::code::const</b> <i class="arg">name</i> <i class="arg">code</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands enabling the definition of control
sequences in an easy manner.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::term::ansi::code::esc</b> <i class="arg">str</i></a></dt>
<dd><p>This command returns the argument string, prefixed with the ANSI
escape character, &quot;\033.&quot;</p></dd>
<dt><a name="2"><b class="cmd">::term::ansi::code::escb</b> <i class="arg">str</i></a></dt>
<dd><p>This command returns the argument string, prefixed with a common ANSI
escape sequence, &quot;\033[&quot;.</p></dd>
<dt><a name="3"><b class="cmd">::term::ansi::code::define</b> <i class="arg">name</i> <i class="arg">escape</i> <i class="arg">code</i></a></dt>
<dd><p>This command defines a procedure <i class="arg">name</i> which returns the control
sequence <i class="arg">code</i>, beginning with the specified escape sequence,
either <b class="const">esc</b>, or <b class="const">escb</b>.</p></dd>
<dt><a name="4"><b class="cmd">::term::ansi::code::const</b> <i class="arg">name</i> <i class="arg">code</i></a></dt>
<dd><p>This command defines a procedure <i class="arg">name</i> which returns the control
sequence <i class="arg">code</i>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key296">declare</a>, <a href="../../../../index.html#key297">define</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/ansi_ctrlu.html.














































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::ansi::ctrl::unix - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/ansi_ctrlu.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2011 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::ansi::ctrl::unix.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::ansi::ctrl::unix(n) 0.1.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::ansi::ctrl::unix - Control operations and queries</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Introspection</a></li>
<li class="subsection"><a href="#subsection2">Operations</a></li>
</ul>
</li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::ansi::ctrl::unix <span class="opt">?0.1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::term::ansi::ctrl::unix::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">::term::ansi::ctrl::unix::raw</b></a></li>
<li><a href="#3"><b class="cmd">::term::ansi::ctrl::unix::raw</b></a></li>
<li><a href="#4"><b class="cmd">::term::ansi::ctrl::unix::columns</b></a></li>
<li><a href="#5"><b class="cmd">::term::ansi::ctrl::unix::rows</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p><em>WARNING</em>: This package is unix-specific and depends on the
availability of two unix system commands for terminal control,
i.e. <b class="syscmd">stty</b> and <b class="syscmd">tput</b>, both of which have to be found
in the <b class="variable">$PATH</b>. If any of these two commands is missing the
loading of the package will fail.</p>
<p>The package provides commands to switch the standard input of the
current process between <i class="term"><a href="../../../../index.html#key460">raw</a></i> and <i class="term"><a href="../../../../index.html#key459">cooked</a></i> input modes, and
to query the size of terminals, i.e. the available number of columns
and lines.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Introspection</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::term::ansi::ctrl::unix::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This command imports some or all attribute commands into the namespace
<i class="arg">ns</i>. This is by default the namespace <em>ctrl</em>. Note that this
is relative namespace name, placing the imported command into a child
of the current namespace. By default all commands are imported, this
can howver be restricted by listing the names of the wanted commands
after the namespace argument.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Operations</a></h3>
<dl class="definitions">
<dt><a name="2"><b class="cmd">::term::ansi::ctrl::unix::raw</b></a></dt>
<dd><p>This command switches the standard input of the current process to
<i class="term"><a href="../../../../index.html#key460">raw</a></i> input mode. This means that from then on all characters
typed by the user are immediately reported to the application instead
of waiting in the OS buffer until the Enter/Return key is received.</p></dd>
<dt><a name="3"><b class="cmd">::term::ansi::ctrl::unix::raw</b></a></dt>
<dd><p>This command switches the standard input of the current process to
<i class="term"><a href="../../../../index.html#key459">cooked</a></i> input mode. This means that from then on all characters
typed by the user are kept in OS buffers for editing until the
Enter/Return key is received.</p></dd>
<dt><a name="4"><b class="cmd">::term::ansi::ctrl::unix::columns</b></a></dt>
<dd><p>This command queries the terminal connected to the standard input for
the number of columns available for display.</p></dd>
<dt><a name="5"><b class="cmd">::term::ansi::ctrl::unix::rows</b></a></dt>
<dd><p>This command queries the terminal connected to the standard input for
the number of rows (aka lines) available for display.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key158">ansi</a>, <a href="../../../../index.html#key457">columns</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key459">cooked</a>, <a href="../../../../index.html#key458">input mode</a>, <a href="../../../../index.html#key462">lines</a>, <a href="../../../../index.html#key460">raw</a>, <a href="../../../../index.html#key461">rows</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006-2011 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/ansi_send.html.





































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::ansi::send - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/ansi_send.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::ansi::send.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::ansi::send(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::ansi::send - Output of ANSI control sequences to terminals</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::ansi::send <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::term::ansi::send::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <i class="arg">...</i></a></li>
<li><a href="#2"><b class="cmd">::term::ansi::send::eeol</b></a></li>
<li><a href="#3"><b class="cmd">::term::ansi::send::esol</b></a></li>
<li><a href="#4"><b class="cmd">::term::ansi::send::el</b></a></li>
<li><a href="#5"><b class="cmd">::term::ansi::send::ed</b></a></li>
<li><a href="#6"><b class="cmd">::term::ansi::send::eu</b></a></li>
<li><a href="#7"><b class="cmd">::term::ansi::send::es</b></a></li>
<li><a href="#8"><b class="cmd">::term::ansi::send::sd</b></a></li>
<li><a href="#9"><b class="cmd">::term::ansi::send::su</b></a></li>
<li><a href="#10"><b class="cmd">::term::ansi::send::ch</b></a></li>
<li><a href="#11"><b class="cmd">::term::ansi::send::sc</b></a></li>
<li><a href="#12"><b class="cmd">::term::ansi::send::rc</b></a></li>
<li><a href="#13"><b class="cmd">::term::ansi::send::sca</b></a></li>
<li><a href="#14"><b class="cmd">::term::ansi::send::rca</b></a></li>
<li><a href="#15"><b class="cmd">::term::ansi::send::st</b></a></li>
<li><a href="#16"><b class="cmd">::term::ansi::send::ct</b></a></li>
<li><a href="#17"><b class="cmd">::term::ansi::send::cat</b></a></li>
<li><a href="#18"><b class="cmd">::term::ansi::send::qdc</b></a></li>
<li><a href="#19"><b class="cmd">::term::ansi::send::qds</b></a></li>
<li><a href="#20"><b class="cmd">::term::ansi::send::qcp</b></a></li>
<li><a href="#21"><b class="cmd">::term::ansi::send::rd</b></a></li>
<li><a href="#22"><b class="cmd">::term::ansi::send::elw</b></a></li>
<li><a href="#23"><b class="cmd">::term::ansi::send::dlw</b></a></li>
<li><a href="#24"><b class="cmd">::term::ansi::send::eg</b></a></li>
<li><a href="#25"><b class="cmd">::term::ansi::send::lg</b></a></li>
<li><a href="#26"><b class="cmd">::term::ansi::send::scs0</b> <i class="arg">tag</i></a></li>
<li><a href="#27"><b class="cmd">::term::ansi::send::scs1</b> <i class="arg">tag</i></a></li>
<li><a href="#28"><b class="cmd">::term::ansi::send::sda</b> <i class="arg">arg</i>...</a></li>
<li><a href="#29"><b class="cmd">::term::ansi::send::sda_fgblack</b></a></li>
<li><a href="#30"><b class="cmd">::term::ansi::send::sda_fgred</b></a></li>
<li><a href="#31"><b class="cmd">::term::ansi::send::sda_fggreen</b></a></li>
<li><a href="#32"><b class="cmd">::term::ansi::send::sda_fgyellow</b></a></li>
<li><a href="#33"><b class="cmd">::term::ansi::send::sda_fgblue</b></a></li>
<li><a href="#34"><b class="cmd">::term::ansi::send::sda_fgmagenta</b></a></li>
<li><a href="#35"><b class="cmd">::term::ansi::send::sda_fgcyan</b></a></li>
<li><a href="#36"><b class="cmd">::term::ansi::send::sda_fgwhite</b></a></li>
<li><a href="#37"><b class="cmd">::term::ansi::send::sda_fgdefault</b></a></li>
<li><a href="#38"><b class="cmd">::term::ansi::send::sda_bgblack</b></a></li>
<li><a href="#39"><b class="cmd">::term::ansi::send::sda_bgred</b></a></li>
<li><a href="#40"><b class="cmd">::term::ansi::send::sda_bggreen</b></a></li>
<li><a href="#41"><b class="cmd">::term::ansi::send::sda_bgyellow</b></a></li>
<li><a href="#42"><b class="cmd">::term::ansi::send::sda_bgblue</b></a></li>
<li><a href="#43"><b class="cmd">::term::ansi::send::sda_bgmagenta</b></a></li>
<li><a href="#44"><b class="cmd">::term::ansi::send::sda_bgcyan</b></a></li>
<li><a href="#45"><b class="cmd">::term::ansi::send::sda_bgwhite</b></a></li>
<li><a href="#46"><b class="cmd">::term::ansi::send::sda_bgdefault</b></a></li>
<li><a href="#47"><b class="cmd">::term::ansi::send::sda_bold</b></a></li>
<li><a href="#48"><b class="cmd">::term::ansi::send::sda_dim</b></a></li>
<li><a href="#49"><b class="cmd">::term::ansi::send::sda_italic</b></a></li>
<li><a href="#50"><b class="cmd">::term::ansi::send::sda_underline</b></a></li>
<li><a href="#51"><b class="cmd">::term::ansi::send::sda_blink</b></a></li>
<li><a href="#52"><b class="cmd">::term::ansi::send::sda_revers</b></a></li>
<li><a href="#53"><b class="cmd">::term::ansi::send::sda_hidden</b></a></li>
<li><a href="#54"><b class="cmd">::term::ansi::send::sda_strike</b></a></li>
<li><a href="#55"><b class="cmd">::term::ansi::send::sda_nobold</b></a></li>
<li><a href="#56"><b class="cmd">::term::ansi::send::sda_noitalic</b></a></li>
<li><a href="#57"><b class="cmd">::term::ansi::send::sda_nounderline</b></a></li>
<li><a href="#58"><b class="cmd">::term::ansi::send::sda_noblink</b></a></li>
<li><a href="#59"><b class="cmd">::term::ansi::send::sda_norevers</b></a></li>
<li><a href="#60"><b class="cmd">::term::ansi::send::sda_nohidden</b></a></li>
<li><a href="#61"><b class="cmd">::term::ansi::send::sda_nostrike</b></a></li>
<li><a href="#62"><b class="cmd">::term::ansi::send::sda_reset</b></a></li>
<li><a href="#63"><b class="cmd">::term::ansi::send::fcp</b> <i class="arg">row</i> <i class="arg">col</i></a></li>
<li><a href="#64"><b class="cmd">::term::ansi::send::cu</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#65"><b class="cmd">::term::ansi::send::cd</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#66"><b class="cmd">::term::ansi::send::cf</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#67"><b class="cmd">::term::ansi::send::cb</b> <span class="opt">?<i class="arg">n</i>?</span></a></li>
<li><a href="#68"><b class="cmd">::term::ansi::send::ss</b> <span class="opt">?<i class="arg">s</i> <i class="arg">e</i>?</span></a></li>
<li><a href="#69"><b class="cmd">::term::ansi::send::skd</b> <i class="arg">code</i> <i class="arg">str</i></a></li>
<li><a href="#70"><b class="cmd">::term::ansi::send::title</b> <i class="arg">str</i></a></li>
<li><a href="#71"><b class="cmd">::term::ansi::send::gron</b></a></li>
<li><a href="#72"><b class="cmd">::term::ansi::send::groff</b></a></li>
<li><a href="#73"><b class="cmd">::term::ansi::send::tlc</b></a></li>
<li><a href="#74"><b class="cmd">::term::ansi::send::trc</b></a></li>
<li><a href="#75"><b class="cmd">::term::ansi::send::brc</b></a></li>
<li><a href="#76"><b class="cmd">::term::ansi::send::blc</b></a></li>
<li><a href="#77"><b class="cmd">::term::ansi::send::ltj</b></a></li>
<li><a href="#78"><b class="cmd">::term::ansi::send::ttj</b></a></li>
<li><a href="#79"><b class="cmd">::term::ansi::send::rtj</b></a></li>
<li><a href="#80"><b class="cmd">::term::ansi::send::btj</b></a></li>
<li><a href="#81"><b class="cmd">::term::ansi::send::fwj</b></a></li>
<li><a href="#82"><b class="cmd">::term::ansi::send::hl</b></a></li>
<li><a href="#83"><b class="cmd">::term::ansi::send::vl</b></a></li>
<li><a href="#84"><b class="cmd">::term::ansi::send::groptim</b> <i class="arg">str</i></a></li>
<li><a href="#85"><b class="cmd">::term::ansi::send::clear</b></a></li>
<li><a href="#86"><b class="cmd">::term::ansi::send::init</b></a></li>
<li><a href="#87"><b class="cmd">::term::ansi::send::showat</b> <i class="arg">row</i> <i class="arg">col</i> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to send ANSI terminal control sequences to a
terminal. All commands come in two variants, one for sending to any channel,
the other for sending to <em>stdout</em>.</p>
<p>The commands are defined using the control sequences provided by the package
<b class="package"><a href="ansi_cctrl.html">term::ansi::code::ctrl</a></b>. They have the same arguments as the commands
they are based on, with the exception of the variant for sending to any channel.
Their first argument is always a channel handle, then followed by the original
arguments. Below we will list only the variant sending to <em>stdout</em>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::term::ansi::send::import</b> <span class="opt">?<i class="arg">ns</i>?</span> <i class="arg">...</i></a></dt>
<dd><p>Imports the commands of this package into the namespace <i class="arg">ns</i>. If not specified
it defaults to <em>send</em>. Note that this default is a relative namespace name,
i.e. the actual namespace will be created under the current namespace.</p>
<p>By default all commands will be imported, this can however be restricted to specific
commands, by listing them after the namespace to import them into.</p></dd>
<dt><a name="2"><b class="cmd">::term::ansi::send::eeol</b></a></dt>
<dd><p>Erase (to) End Of Line.</p></dd>
<dt><a name="3"><b class="cmd">::term::ansi::send::esol</b></a></dt>
<dd><p>Erase (to) Start Of Line.</p></dd>
<dt><a name="4"><b class="cmd">::term::ansi::send::el</b></a></dt>
<dd><p>Erase (current) Line.</p></dd>
<dt><a name="5"><b class="cmd">::term::ansi::send::ed</b></a></dt>
<dd><p>Erase Down (to bottom).</p></dd>
<dt><a name="6"><b class="cmd">::term::ansi::send::eu</b></a></dt>
<dd><p>Erase Up (to top).</p></dd>
<dt><a name="7"><b class="cmd">::term::ansi::send::es</b></a></dt>
<dd><p>Erase Screen.</p></dd>
<dt><a name="8"><b class="cmd">::term::ansi::send::sd</b></a></dt>
<dd><p>Scroll Down.</p></dd>
<dt><a name="9"><b class="cmd">::term::ansi::send::su</b></a></dt>
<dd><p>Scroll Up.</p></dd>
<dt><a name="10"><b class="cmd">::term::ansi::send::ch</b></a></dt>
<dd><p>Cursor Home.</p></dd>
<dt><a name="11"><b class="cmd">::term::ansi::send::sc</b></a></dt>
<dd><p>Save Cursor. Note: Only one saved position can be handled.
This is no unlimited stack. Saving before restoring will
overwrite the saved data.</p></dd>
<dt><a name="12"><b class="cmd">::term::ansi::send::rc</b></a></dt>
<dd><p>Restore Cursor (Unsave).</p></dd>
<dt><a name="13"><b class="cmd">::term::ansi::send::sca</b></a></dt>
<dd><p>Save Cursor + Attributes.</p></dd>
<dt><a name="14"><b class="cmd">::term::ansi::send::rca</b></a></dt>
<dd><p>Restore Cursor + Attributes.</p></dd>
<dt><a name="15"><b class="cmd">::term::ansi::send::st</b></a></dt>
<dd><p>Set Tab (@ current position).</p></dd>
<dt><a name="16"><b class="cmd">::term::ansi::send::ct</b></a></dt>
<dd><p>Clear Tab (@ current position).</p></dd>
<dt><a name="17"><b class="cmd">::term::ansi::send::cat</b></a></dt>
<dd><p>Clear All Tabs.</p></dd>
<dt><a name="18"><b class="cmd">::term::ansi::send::qdc</b></a></dt>
<dd><p>Query Device Code.</p></dd>
<dt><a name="19"><b class="cmd">::term::ansi::send::qds</b></a></dt>
<dd><p>Query Device Status.</p></dd>
<dt><a name="20"><b class="cmd">::term::ansi::send::qcp</b></a></dt>
<dd><p>Query Cursor Position.</p></dd>
<dt><a name="21"><b class="cmd">::term::ansi::send::rd</b></a></dt>
<dd><p>Reset Device.</p></dd>
<dt><a name="22"><b class="cmd">::term::ansi::send::elw</b></a></dt>
<dd><p>Enable Line Wrap.</p></dd>
<dt><a name="23"><b class="cmd">::term::ansi::send::dlw</b></a></dt>
<dd><p>Disable Line Wrap.</p></dd>
<dt><a name="24"><b class="cmd">::term::ansi::send::eg</b></a></dt>
<dd><p>Enter Graphics Mode.</p></dd>
<dt><a name="25"><b class="cmd">::term::ansi::send::lg</b></a></dt>
<dd><p>Exit Graphics Mode.</p></dd>
<dt><a name="26"><b class="cmd">::term::ansi::send::scs0</b> <i class="arg">tag</i></a></dt>
<dd></dd>
<dt><a name="27"><b class="cmd">::term::ansi::send::scs1</b> <i class="arg">tag</i></a></dt>
<dd><p>Select Character Set.</p>
<p>Choose which character set is used for default (scs0) and alternate font (scs1).
This does not change whether default or alternate font are used, just their
definitions.</p>
<p>The legal tags, and their meanings, are:</p>
<dl class="definitions">
<dt>A</dt>
<dd><p>United Kingdom Set</p></dd>
<dt>B</dt>
<dd><p>ASCII Set</p></dd>
<dt>0</dt>
<dd><p>Special Graphics</p></dd>
<dt>1</dt>
<dd><p>Alternate Character ROM Standard Character Set</p></dd>
<dt>2</dt>
<dd><p>Alternate Character ROM Special Graphics</p></dd>
</dl></dd>
<dt><a name="28"><b class="cmd">::term::ansi::send::sda</b> <i class="arg">arg</i>...</a></dt>
<dd><p>Set Display Attributes. The arguments are the code sequences for the possible
attributes, as provided by the package <b class="package"><a href="ansi_cattr.html">term::ansi::code::attr</a></b>. For
convenience this package also provides additional commands each setting a single
specific attribute.</p></dd>
<dt><a name="29"><b class="cmd">::term::ansi::send::sda_fgblack</b></a></dt>
<dd><p>Set text color to <em>Black</em>.</p></dd>
<dt><a name="30"><b class="cmd">::term::ansi::send::sda_fgred</b></a></dt>
<dd><p>Set text color to <em>Red</em>.</p></dd>
<dt><a name="31"><b class="cmd">::term::ansi::send::sda_fggreen</b></a></dt>
<dd><p>Set text color to <em>Green</em>.</p></dd>
<dt><a name="32"><b class="cmd">::term::ansi::send::sda_fgyellow</b></a></dt>
<dd><p>Set text color to <em>Yellow</em>.</p></dd>
<dt><a name="33"><b class="cmd">::term::ansi::send::sda_fgblue</b></a></dt>
<dd><p>Set text color to <em>Blue</em>.</p></dd>
<dt><a name="34"><b class="cmd">::term::ansi::send::sda_fgmagenta</b></a></dt>
<dd><p>Set text color to <em>Magenta</em>.</p></dd>
<dt><a name="35"><b class="cmd">::term::ansi::send::sda_fgcyan</b></a></dt>
<dd><p>Set text color to <em>Cyan</em>.</p></dd>
<dt><a name="36"><b class="cmd">::term::ansi::send::sda_fgwhite</b></a></dt>
<dd><p>Set text color to <em>White</em>.</p></dd>
<dt><a name="37"><b class="cmd">::term::ansi::send::sda_fgdefault</b></a></dt>
<dd><p>Set default text color (<em>Black</em>).</p></dd>
<dt><a name="38"><b class="cmd">::term::ansi::send::sda_bgblack</b></a></dt>
<dd><p>Set background to <em>Black</em>.</p></dd>
<dt><a name="39"><b class="cmd">::term::ansi::send::sda_bgred</b></a></dt>
<dd><p>Set background to <em>Red</em>.</p></dd>
<dt><a name="40"><b class="cmd">::term::ansi::send::sda_bggreen</b></a></dt>
<dd><p>Set background to <em>Green</em>.</p></dd>
<dt><a name="41"><b class="cmd">::term::ansi::send::sda_bgyellow</b></a></dt>
<dd><p>Set background to <em>Yellow</em>.</p></dd>
<dt><a name="42"><b class="cmd">::term::ansi::send::sda_bgblue</b></a></dt>
<dd><p>Set background to <em>Blue</em>.</p></dd>
<dt><a name="43"><b class="cmd">::term::ansi::send::sda_bgmagenta</b></a></dt>
<dd><p>Set background to <em>Magenta</em>.</p></dd>
<dt><a name="44"><b class="cmd">::term::ansi::send::sda_bgcyan</b></a></dt>
<dd><p>Set background to <em>Cyan</em>.</p></dd>
<dt><a name="45"><b class="cmd">::term::ansi::send::sda_bgwhite</b></a></dt>
<dd><p>Set background to <em>White</em>.</p></dd>
<dt><a name="46"><b class="cmd">::term::ansi::send::sda_bgdefault</b></a></dt>
<dd><p>Set default background (Transparent).</p></dd>
<dt><a name="47"><b class="cmd">::term::ansi::send::sda_bold</b></a></dt>
<dd><p>Bold on.</p></dd>
<dt><a name="48"><b class="cmd">::term::ansi::send::sda_dim</b></a></dt>
<dd><p>Dim on.</p></dd>
<dt><a name="49"><b class="cmd">::term::ansi::send::sda_italic</b></a></dt>
<dd><p>Italics on.</p></dd>
<dt><a name="50"><b class="cmd">::term::ansi::send::sda_underline</b></a></dt>
<dd><p>Underscore on.</p></dd>
<dt><a name="51"><b class="cmd">::term::ansi::send::sda_blink</b></a></dt>
<dd><p>Blink on.</p></dd>
<dt><a name="52"><b class="cmd">::term::ansi::send::sda_revers</b></a></dt>
<dd><p>Reverse on.</p></dd>
<dt><a name="53"><b class="cmd">::term::ansi::send::sda_hidden</b></a></dt>
<dd><p>Hidden on.</p></dd>
<dt><a name="54"><b class="cmd">::term::ansi::send::sda_strike</b></a></dt>
<dd><p>Strike-through on.</p></dd>
<dt><a name="55"><b class="cmd">::term::ansi::send::sda_nobold</b></a></dt>
<dd><p>Bold off.</p></dd>
<dt><a name="56"><b class="cmd">::term::ansi::send::sda_noitalic</b></a></dt>
<dd><p>Italics off.</p></dd>
<dt><a name="57"><b class="cmd">::term::ansi::send::sda_nounderline</b></a></dt>
<dd><p>Underscore off.</p></dd>
<dt><a name="58"><b class="cmd">::term::ansi::send::sda_noblink</b></a></dt>
<dd><p>Blink off.</p></dd>
<dt><a name="59"><b class="cmd">::term::ansi::send::sda_norevers</b></a></dt>
<dd><p>Reverse off.</p></dd>
<dt><a name="60"><b class="cmd">::term::ansi::send::sda_nohidden</b></a></dt>
<dd><p>Hidden off.</p></dd>
<dt><a name="61"><b class="cmd">::term::ansi::send::sda_nostrike</b></a></dt>
<dd><p>Strike-through off.</p></dd>
<dt><a name="62"><b class="cmd">::term::ansi::send::sda_reset</b></a></dt>
<dd><p>Reset all attributes to their default values.</p></dd>
<dt><a name="63"><b class="cmd">::term::ansi::send::fcp</b> <i class="arg">row</i> <i class="arg">col</i></a></dt>
<dd><p>Force Cursor Position (aka Go To).</p></dd>
<dt><a name="64"><b class="cmd">::term::ansi::send::cu</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>Cursor Up. <i class="arg">n</i> defaults to 1.</p></dd>
<dt><a name="65"><b class="cmd">::term::ansi::send::cd</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>Cursor Down. <i class="arg">n</i> defaults to 1.</p></dd>
<dt><a name="66"><b class="cmd">::term::ansi::send::cf</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>Cursor Forward. <i class="arg">n</i> defaults to 1.</p></dd>
<dt><a name="67"><b class="cmd">::term::ansi::send::cb</b> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>Cursor Backward. <i class="arg">n</i> defaults to 1.</p></dd>
<dt><a name="68"><b class="cmd">::term::ansi::send::ss</b> <span class="opt">?<i class="arg">s</i> <i class="arg">e</i>?</span></a></dt>
<dd><p>Scroll Screen (entire display, or between rows start end, inclusive).</p></dd>
<dt><a name="69"><b class="cmd">::term::ansi::send::skd</b> <i class="arg">code</i> <i class="arg">str</i></a></dt>
<dd><p>Set Key Definition.</p></dd>
<dt><a name="70"><b class="cmd">::term::ansi::send::title</b> <i class="arg">str</i></a></dt>
<dd><p>Set the terminal title.</p></dd>
<dt><a name="71"><b class="cmd">::term::ansi::send::gron</b></a></dt>
<dd><p>Switch to character/box graphics. I.e. switch to the alternate font.</p></dd>
<dt><a name="72"><b class="cmd">::term::ansi::send::groff</b></a></dt>
<dd><p>Switch to regular characters. I.e. switch to the default font.</p></dd>
<dt><a name="73"><b class="cmd">::term::ansi::send::tlc</b></a></dt>
<dd><p>Character graphics, Top Left Corner.</p></dd>
<dt><a name="74"><b class="cmd">::term::ansi::send::trc</b></a></dt>
<dd><p>Character graphics, Top Right Corner.</p></dd>
<dt><a name="75"><b class="cmd">::term::ansi::send::brc</b></a></dt>
<dd><p>Character graphics, Bottom Right Corner.</p></dd>
<dt><a name="76"><b class="cmd">::term::ansi::send::blc</b></a></dt>
<dd><p>Character graphics, Bottom Left Corner.</p></dd>
<dt><a name="77"><b class="cmd">::term::ansi::send::ltj</b></a></dt>
<dd><p>Character graphics, Left T Junction.</p></dd>
<dt><a name="78"><b class="cmd">::term::ansi::send::ttj</b></a></dt>
<dd><p>Character graphics, Top T Junction.</p></dd>
<dt><a name="79"><b class="cmd">::term::ansi::send::rtj</b></a></dt>
<dd><p>Character graphics, Right T Junction.</p></dd>
<dt><a name="80"><b class="cmd">::term::ansi::send::btj</b></a></dt>
<dd><p>Character graphics, Bottom T Junction.</p></dd>
<dt><a name="81"><b class="cmd">::term::ansi::send::fwj</b></a></dt>
<dd><p>Character graphics, Four-Way Junction.</p></dd>
<dt><a name="82"><b class="cmd">::term::ansi::send::hl</b></a></dt>
<dd><p>Character graphics, Horizontal Line.</p></dd>
<dt><a name="83"><b class="cmd">::term::ansi::send::vl</b></a></dt>
<dd><p>Character graphics, Vertical Line.</p></dd>
<dt><a name="84"><b class="cmd">::term::ansi::send::groptim</b> <i class="arg">str</i></a></dt>
<dd><p>Optimize character graphics. The generator commands above create way to many
superfluous commands shifting into and out of the graphics mode. This command
removes all shifts which are not needed. To this end it also knows which
characters will look the same in both modes, to handle strings created outside
of this package.</p></dd>
<dt><a name="85"><b class="cmd">::term::ansi::send::clear</b></a></dt>
<dd><p>Clear screen. In essence a sequence of CursorHome + EraseDown.</p></dd>
<dt><a name="86"><b class="cmd">::term::ansi::send::init</b></a></dt>
<dd><p>Initialize default and alternate fonts to ASCII and box graphics.</p></dd>
<dt><a name="87"><b class="cmd">::term::ansi::send::showat</b> <i class="arg">row</i> <i class="arg">col</i> <i class="arg">text</i></a></dt>
<dd><p>Show the block of text at the specified location.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key371">character output</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/imenu.html.



































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::interact::menu - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/imenu.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::interact::menu.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::interact::menu(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::interact::menu - Terminal widget, menu</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Class API</a></li>
<li class="section"><a href="#section3">Object API</a></li>
<li class="section"><a href="#section4">Configuration</a></li>
<li class="section"><a href="#section5">Interaction</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::interact::menu <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">term::interact::menu</b> <i class="arg">object</i> <i class="arg">dict</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><i class="arg">object</i> <b class="method">interact</b></a></li>
<li><a href="#3"><i class="arg">object</i> <b class="method">done</b></a></li>
<li><a href="#4"><i class="arg">object</i> <b class="method">clear</b></a></li>
<li><a href="#5"><i class="arg">object</i> <b class="method">configure</b></a></li>
<li><a href="#6"><i class="arg">object</i> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#7"><i class="arg">object</i> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#8"><i class="arg">object</i> <b class="method">cget</b> <i class="arg">option</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for the creation of a simple menu
control.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Class API</a></h2>
<p>The package exports a single command, the class command, enabling the
creation of menu instances. Its API is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">term::interact::menu</b> <i class="arg">object</i> <i class="arg">dict</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command creates a new menu object with the name <i class="arg">object</i>,
initializes it, and returns the fully qualified name of the object
command as its result.</p>
<p>The argument is the menu to show, possibly followed by configuration
options and their values. The options are explained in the section
<span class="sectref"><a href="#section4">Configuration</a></span>. The menu is a dictionary maping labels
to symbolic action codes.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Object API</a></h2>
<p>The objects created by the class command provide the methods listed
below:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">object</i> <b class="method">interact</b></a></dt>
<dd><p>Shows the menu in the screen at the configured location and starts
interacting with it. This opens its own event loop for the processing
of incoming characters. The method returns when the interaction has
completed. See section <span class="sectref"><a href="#section5">Interaction</a></span> for a description of the
possible interaction.</p>
<p>The method returns the symbolic action of the menu item selected by
the user at the end of the interaction.</p></dd>
<dt><a name="3"><i class="arg">object</i> <b class="method">done</b></a></dt>
<dd><p>This method can be used by user supplied actions to terminate the
interaction with the object.</p></dd>
<dt><a name="4"><i class="arg">object</i> <b class="method">clear</b></a></dt>
<dd><p>This method can be used by user supplied actions to remove the menu
from the terminal.</p></dd>
<dt><a name="5"><i class="arg">object</i> <b class="method">configure</b></a></dt>
<dd></dd>
<dt><a name="6"><i class="arg">object</i> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd></dd>
<dt><a name="7"><i class="arg">object</i> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd></dd>
<dt><a name="8"><i class="arg">object</i> <b class="method">cget</b> <i class="arg">option</i></a></dt>
<dd><p>Standard methods to retrieve and configure the options of the menu.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Configuration</a></h2>
<p>A menu instance recognizes the following options:</p>
<dl class="options">
<dt><b class="option">-in</b> chan</dt>
<dd><p>Specifies the channel to read character sequences from. Defaults to
<b class="const">stdin</b>.</p></dd>
<dt><b class="option">-out</b> chan</dt>
<dd><p>Specifies the channel to write the menu contents to. Defaults to
<b class="const">stdout</b>.</p></dd>
<dt><b class="option">-column</b> int</dt>
<dd><p>Specifies the column of the terminal where the left margin of the
menu display should appear. Defaults to 0, i.e. the left-most
column.</p></dd>
<dt><b class="option">-line</b> int</dt>
<dd><p>Specifies the line of the terminal where the top margin of the menu
display should appear. Defaults to 0, i.e. the top-most line.</p></dd>
<dt><b class="option">-height</b> int</dt>
<dd><p>Specifies the number of lines of text to show at most in the
display. Defaults to 25.</p></dd>
<dt><b class="option">-actions</b> dict</dt>
<dd><p>Specifies a dictionary containing additional actions, using character
sequences as keys. Note that these sequences cannot override the
hardwired sequences described in section <span class="sectref"><a href="#section5">Interaction</a></span>.</p></dd>
<dt><b class="option">-hilitleft</b> int</dt>
<dd></dd>
<dt><b class="option">-hilitright</b> int</dt>
<dd><p>By default the entire selected menu entry is highlighted in revers
output. However, when present these two options restrict revers dispay
to the specified sub-range of the entry.</p></dd>
<dt><b class="option">-framed</b> bool</dt>
<dd><p>By default the menu is shown using only header and footer out of
characters box graphics. If this flag is set the menu is fully
enclosed in a box.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Interaction</a></h2>
<p>A menu object recognizes the control sequences listed below and acts
as described. The user can supply more control sequences to act on via
the configuration, but is not able to overide these defaults.</p>
<dl class="definitions">
<dt>Cursor Up</dt>
<dd><p>The selection is moved up one entry, except if the first entry of the
menu is already selected.</p></dd>
<dt>Cursor Down</dt>
<dd><p>The selection is moved down one entry, except if the last entry of the
menu is already selected.</p></dd>
<dt>Enter/Return</dt>
<dd><p>The interaction with the object is terminated.</p></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key625">menu</a>, <a href="../../../../index.html#key88">terminal</a>, <a href="../../../../index.html#key727">text display</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/ipager.html.



































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::interact::pager - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/ipager.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::interact::pager.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::interact::pager(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::interact::pager - Terminal widget, paging</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Class API</a></li>
<li class="section"><a href="#section3">Object API</a></li>
<li class="section"><a href="#section4">Configuration</a></li>
<li class="section"><a href="#section5">Interaction</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::interact::pager <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">term::interact::pager</b> <i class="arg">object</i> <i class="arg">text</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><i class="arg">object</i> <b class="method">interact</b></a></li>
<li><a href="#3"><i class="arg">object</i> <b class="method">done</b></a></li>
<li><a href="#4"><i class="arg">object</i> <b class="method">clear</b></a></li>
<li><a href="#5"><i class="arg">object</i> <b class="method">text</b> <i class="arg">text</i></a></li>
<li><a href="#6"><i class="arg">object</i> <b class="method">configure</b></a></li>
<li><a href="#7"><i class="arg">object</i> <b class="method">configure</b> <i class="arg">option</i></a></li>
<li><a href="#8"><i class="arg">object</i> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></li>
<li><a href="#9"><i class="arg">object</i> <b class="method">cget</b> <i class="arg">option</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for the creation of a simple paging
text display.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Class API</a></h2>
<p>The package exports a single command, the class command, enabling the
creation of pager instances. Its API is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">term::interact::pager</b> <i class="arg">object</i> <i class="arg">text</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command creates a new pager object with the name <i class="arg">object</i>,
initializes it, and returns the fully qualified name of the object
command as its result.</p>
<p>The argument is the text to show, possibly followed by configuration
options and their values. The options are explained in the section
<span class="sectref"><a href="#section4">Configuration</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Object API</a></h2>
<p>The objects created by the class command provide the methods listed
below:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">object</i> <b class="method">interact</b></a></dt>
<dd><p>Show the pager in the screen at the configured location and start
interacting with it. This opens its own event loop for the processing
of incoming characters. The method returns when the interaction has
completed. See section <span class="sectref"><a href="#section5">Interaction</a></span> for a description of the
possible interaction.</p></dd>
<dt><a name="3"><i class="arg">object</i> <b class="method">done</b></a></dt>
<dd><p>This method can be used by user supplied actions to terminate the
interaction with the object.</p></dd>
<dt><a name="4"><i class="arg">object</i> <b class="method">clear</b></a></dt>
<dd><p>This method can be used by user supplied actions to remove the pager
from the terminal.</p></dd>
<dt><a name="5"><i class="arg">object</i> <b class="method">text</b> <i class="arg">text</i></a></dt>
<dd><p>This method can be used to change the text shown by the pager.
The pager will reset the dispay to show the first line of the
text at the top.</p></dd>
<dt><a name="6"><i class="arg">object</i> <b class="method">configure</b></a></dt>
<dd></dd>
<dt><a name="7"><i class="arg">object</i> <b class="method">configure</b> <i class="arg">option</i></a></dt>
<dd></dd>
<dt><a name="8"><i class="arg">object</i> <b class="method">configure</b> <i class="arg">option</i> <i class="arg">value</i>...</a></dt>
<dd></dd>
<dt><a name="9"><i class="arg">object</i> <b class="method">cget</b> <i class="arg">option</i></a></dt>
<dd><p>Standard methods to retrieve and configure the options of the pager.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Configuration</a></h2>
<p>A pager instance recognizes the following options:</p>
<dl class="options">
<dt><b class="option">-in</b> chan</dt>
<dd><p>Specifies the channel to read character sequences from. Defaults to
<b class="const">stdin</b>.</p></dd>
<dt><b class="option">-out</b> chan</dt>
<dd><p>Specifies the channel to write the pager contents to. Defaults to
<b class="const">stdout</b>.</p></dd>
<dt><b class="option">-column</b> int</dt>
<dd><p>Specifies the column of the terminal where the left margin of the
pager display should appear. Defaults to 0, i.e. the left-most
column.</p></dd>
<dt><b class="option">-line</b> int</dt>
<dd><p>Specifies the line of the terminal where the top margin of the pager
display should appear. Defaults to 0, i.e. the top-most line.</p></dd>
<dt><b class="option">-height</b> int</dt>
<dd><p>Specifies the number of lines of text to show at most in the
display. Defaults to 25.</p></dd>
<dt><b class="option">-actions</b> dict</dt>
<dd><p>Specifies a dictionary containing additional actions, using character
sequences as keys. Note that these sequences cannot override the
hardwired sequences described in section <span class="sectref"><a href="#section5">Interaction</a></span>.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">Interaction</a></h2>
<p>A pager object recognizes the control sequences listed below and acts
as described. The user can supply more control sequences to act on via
the configuration, but is not able to overide these defaults.</p>
<dl class="definitions">
<dt>Cursor Up</dt>
<dd><p>The text is scrolled down a single line, making one more line visible
at the top. The pager will not react if the first line of the text is
already shown.</p></dd>
<dt>Cursor Down</dt>
<dd><p>The text is scrolled up a single line, making one more line visible at
the bottom. The pager will not react if the last line of the text is
already shown.</p></dd>
<dt>Page Up</dt>
<dd><p>The text is scrolled down a page. The pager will not react if the
first line of the text is already shown.</p></dd>
<dt>Page Down</dt>
<dd><p>The text is scrolled up a page. The pager will not react if the last
line of the text is already shown.</p></dd>
<dt>Enter/Return</dt>
<dd><p>The interaction with the object is terminated.</p></dd>
</dl>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key728">pager</a>, <a href="../../../../index.html#key88">terminal</a>, <a href="../../../../index.html#key727">text display</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/receive.html.




























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::receive - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/receive.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::receive.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::receive(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::receive - General input from terminals</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::receive <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::term::receive::getch</b> <span class="opt">?<i class="arg">chan</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::term::receive::listen</b> <i class="arg">cmd</i> <span class="opt">?<i class="arg">chan</i>?</span></a></li>
<li><a href="#3"><i class="arg">cmd</i> <b class="method">process</b> <i class="arg">string</i></a></li>
<li><a href="#4"><i class="arg">cmd</i> <b class="method">eof</b></a></li>
<li><a href="#5"><b class="cmd">::term::receive::unlisten</b> <span class="opt">?<i class="arg">chan</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides the most primitive commands for receiving
characters to a terminal. They are in essence convenient wrappers
around the builtin commands <b class="cmd"><a href="../../../../index.html#key362">read</a></b> and <b class="cmd">fileevent</b>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::term::receive::getch</b> <span class="opt">?<i class="arg">chan</i>?</span></a></dt>
<dd><p>This command reads a single character from the channel with handle
<i class="arg">chan</i> and returns it as the result of the command.</p>
<p>If not specified <i class="arg">chan</i> defaults to <b class="const">stdin</b>.</p>
<p>It is the responsibility of the caller to make sure that the channel
can provide single characters. On unix this can be done, for example,
by using the command of package <b class="package"><a href="ansi_ctrlu.html">term::ansi::ctrl::unix</a></b>.</p></dd>
<dt><a name="2"><b class="cmd">::term::receive::listen</b> <i class="arg">cmd</i> <span class="opt">?<i class="arg">chan</i>?</span></a></dt>
<dd><p>This command sets up a filevent listener for the channel with handle
<i class="arg">chan</i> and invokes the command prefix <i class="arg">cmd</i> whenever
characters have been received, or EOF was reached.</p>
<p>If not specified <i class="arg">chan</i> defaults to <b class="const">stdin</b>.</p>
<p>The signature of the command prefix is</p>
<dl class="definitions">
<dt><a name="3"><i class="arg">cmd</i> <b class="method">process</b> <i class="arg">string</i></a></dt>
<dd><p>This method is invoked when characters were received, and <i class="arg">string</i>
holds them for processing.</p></dd>
<dt><a name="4"><i class="arg">cmd</i> <b class="method">eof</b></a></dt>
<dd><p>This method is invoked when EOF was reached on the channel we listen
on.  It will be the last call to be received by the callback.</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::term::receive::unlisten</b> <span class="opt">?<i class="arg">chan</i>?</span></a></dt>
<dd><p>This command disables the filevent listener for the channel with handle
<i class="arg">chan</i>.</p>
<p>If not specified <i class="arg">chan</i> defaults to <b class="const">stdin</b>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key91">character input</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key89">get character</a>, <a href="../../../../index.html#key93">listener</a>, <a href="../../../../index.html#key90">receiver</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/term.html.



























































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/term.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term - General terminal control</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term <span class="opt">?0.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>It is planned to have this package provide highlevel general terminal control
commands, in the vein of ncurses or similar packages. Currently nothing has
been implemented however. I.e. this package is empty. It can be loaded, yet
provides nothing.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/term_bind.html.








































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::receive::bind - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/term_bind.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::receive::bind.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::receive::bind(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::receive::bind - Keyboard dispatch from terminals</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Class API</a></li>
<li class="section"><a href="#section3">Object API</a></li>
<li class="section"><a href="#section4">Notes</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::receive::bind <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">term::receive::bind</b> <i class="arg">object</i> <span class="opt">?<i class="arg">map</i>?</span></a></li>
<li><a href="#2"><i class="arg">object</i> <b class="method">map</b> <i class="arg">str</i> <i class="arg">cmd</i></a></li>
<li><a href="#3"><i class="arg">object</i> <b class="method">default</b> <i class="arg">cmd</i></a></li>
<li><a href="#4"><i class="arg">object</i> <b class="method">listen</b> <span class="opt">?<i class="arg">chan</i>?</span></a></li>
<li><a href="#5"><i class="arg">object</i> <b class="method">unlisten</b> <span class="opt">?<i class="arg">chan</i>?</span></a></li>
<li><a href="#6"><i class="arg">object</i> <b class="method">reset</b></a></li>
<li><a href="#7"><i class="arg">object</i> <b class="method">next</b> <i class="arg">char</i></a></li>
<li><a href="#8"><i class="arg">object</i> <b class="method">process</b> <i class="arg">str</i></a></li>
<li><a href="#9"><i class="arg">object</i> <b class="method">eof</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a class for the creation of simple dispatchers
from character sequences to actions. Internally each dispatcher is in
essence a deterministic finite automaton with tree structure.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Class API</a></h2>
<p>The package exports a single command, the
class command, enabling the creation of
dispatcher instances. Its API
is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">term::receive::bind</b> <i class="arg">object</i> <span class="opt">?<i class="arg">map</i>?</span></a></dt>
<dd><p>This command creates a new dispatcher object with the name
<i class="arg">object</i>, initializes it, and returns the fully qualified name of
the object command as its result.</p>
<p>The argument is a dictionary mapping from strings, i.e. character
sequences to the command prefices to invoke when the sequence is found
in the input stream.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Object API</a></h2>
<p>The objects created by the class command provide the methods listed
below:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">object</i> <b class="method">map</b> <i class="arg">str</i> <i class="arg">cmd</i></a></dt>
<dd><p>This method adds an additional mapping from the string <i class="arg">str</i> to
the action <i class="arg">cmd</i>. The mapping will take effect immediately
should the processor be in a prefix of <i class="arg">str</i>, or at the next
reset operation. The action is a command prefix and will be invoked
with one argument appended to it, the character sequence causing
the invokation. It is executed in the global namespace.</p></dd>
<dt><a name="3"><i class="arg">object</i> <b class="method">default</b> <i class="arg">cmd</i></a></dt>
<dd><p>This method defines a default action <i class="arg">cmd</i> which will be invoked
whenever an unknown character sequence is encountered. The command
prefix is handled in the same as the regular action defined via
method <b class="method">map</b>.</p></dd>
<dt><a name="4"><i class="arg">object</i> <b class="method">listen</b> <span class="opt">?<i class="arg">chan</i>?</span></a></dt>
<dd><p>This methods sets up a filevent listener for the channel with handle
<i class="arg">chan</i> and invokes the dispatcher object whenever characters have
been received, or EOF was reached.</p>
<p>If not specified <i class="arg">chan</i> defaults to <b class="const">stdin</b>.</p></dd>
<dt><a name="5"><i class="arg">object</i> <b class="method">unlisten</b> <span class="opt">?<i class="arg">chan</i>?</span></a></dt>
<dd><p>This methods removes the filevent listener for the channel with handle
<i class="arg">chan</i>.</p>
<p>If not specified <i class="arg">chan</i> defaults to <b class="const">stdin</b>.</p></dd>
<dt><a name="6"><i class="arg">object</i> <b class="method">reset</b></a></dt>
<dd><p>This method resets the character processor
to the beginning of the tree.</p></dd>
<dt><a name="7"><i class="arg">object</i> <b class="method">next</b> <i class="arg">char</i></a></dt>
<dd><p>This method causes the character processor to process the character
<i class="arg">c</i>. This may simply advance the internal state, or invoke an
associated action for a recognized sequence.</p></dd>
<dt><a name="8"><i class="arg">object</i> <b class="method">process</b> <i class="arg">str</i></a></dt>
<dd><p>This method causes the character processor to process the character
sequence <i class="arg">str</i>, advancing the internal state and invoking action
as necessary. This is a callback for <b class="method">listen</b>.</p></dd>
<dt><a name="9"><i class="arg">object</i> <b class="method">eof</b></a></dt>
<dd><p>This method causes the character processor to handle EOF on the
input. This is currently no-op.
This is a callback for <b class="method">listen</b>.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">Notes</a></h2>
<p>The simplicity of the DFA means that it is not possible to recognize a
character sequence with has a another recognized character sequence as
its prefix.</p>
<p>In other words, the set of recognized strings has to form a
<i class="term">prefix code</i>.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key91">character input</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key470">dispatcher</a>, <a href="../../../../index.html#key93">listener</a>, <a href="../../../../index.html#key90">receiver</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/term/term_send.html.









































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>term::send - Terminal control</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/term/term_send.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ term::send.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">term::send(n) 0.1 tcllib &quot;Terminal control&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>term::send - General output to terminals</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">term::send <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::term::send::wrch</b> <i class="arg">chan</i> <i class="arg">str</i></a></li>
<li><a href="#2"><b class="cmd">::term::send::wr</b> <i class="arg">str</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides the most primitive commands for sending characters
to a terminal. They are in essence convenient wrappers around the
builtin command <b class="cmd">puts</b>.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::term::send::wrch</b> <i class="arg">chan</i> <i class="arg">str</i></a></dt>
<dd><p>Send the text <i class="arg">str</i> to the channel specified by the handle <i class="arg">chan</i>.
In contrast to the builtin command <b class="cmd">puts</b> this command does not
terminate the string with a line terminator. It also forces an  flush of
Tcl internal and OS buffers to ensure that the characters are processed
immediately.</p></dd>
<dt><a name="2"><b class="cmd">::term::send::wr</b> <i class="arg">str</i></a></dt>
<dd><p>This convenience command is like <b class="cmd">::term::send::wrch</b>, except that the
destination channel is fixed to <em>stdout</em>.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>term</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key371">character output</a>, <a href="../../../../index.html#key92">control</a>, <a href="../../../../index.html#key88">terminal</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Terminal control</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/textutil/adjust.html.

















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>textutil::adjust - Text and string utilities, macro processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/textutil/adjust.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ textutil::adjust.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">textutil::adjust(n) 0.7.1 tcllib &quot;Text and string utilities, macro processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>textutil::adjust - Procedures to adjust, indent, and undent paragraphs</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil::adjust <span class="opt">?0.7.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::textutil::adjust::adjust</b> <i class="arg">string</i> <span class="opt">?<i class="arg">option value...</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::textutil::adjust::readPatterns</b> <i class="arg">filename</i></a></li>
<li><a href="#3"><b class="cmd">::textutil::adjust::listPredefined</b></a></li>
<li><a href="#4"><b class="cmd">::textutil::adjust::getPredefined</b> <i class="arg">filename</i></a></li>
<li><a href="#5"><b class="cmd">::textutil::adjust::indent</b> <i class="arg">string</i> <i class="arg">prefix</i> <span class="opt">?<i class="arg">skip</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::textutil::adjust::undent</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">textutil::adjust</b> provides commands that manipulate
strings or texts (a.k.a. long strings or string with embedded newlines
or paragraphs), adjusting, or indenting them.</p>
<p>The complete set of procedures is described below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::textutil::adjust::adjust</b> <i class="arg">string</i> <span class="opt">?<i class="arg">option value...</i>?</span></a></dt>
<dd><p>Do a justification on the <i class="arg">string</i> according to the options.  The
string is taken as one big paragraph, ignoring any newlines.  Then the
line is formatted according to the options used, and the command
returns a new string with enough lines to contain all the printable
chars in the input string. A line is a set of characters between the
beginning of the string and a newline, or between 2 newlines, or
between a newline and the end of the string. If the input string is
small enough, the returned string won't contain any newlines.</p>
<p>Together with <b class="cmd">::textutil::adjust::indent</b> it is possible to
create properly wrapped paragraphs with arbitrary indentations.</p>
<p>By default, any occurrence of space or tabulation characters are
replaced by a single space so that each word in a line is separated
from the next one by exactly one space character, and this forms a
<em>real</em> line.
Each <em>real</em> line is placed in a <em>logical</em> line, which has
exactly a given length (see the option <b class="option">-length</b> below).
The <em>real</em> line may be shorter. Again by default, trailing spaces
are ignored before returning the string (see the option <b class="option">-full</b>
below).</p>
<p>The following options may be used after the <i class="arg">string</i> parameter,
and change the way the command places a <em>real</em> line in a
<em>logical</em> line.</p>
<dl class="options">
<dt><b class="option">-full</b> <i class="arg">boolean</i></dt>
<dd><p>If set to <b class="const">false</b> (default), trailing space characters are
deleted before returning the string. If set to <b class="const">true</b>, any
trailing space characters are left in the string.</p></dd>
<dt><b class="option">-hyphenate</b> <i class="arg">boolean</i></dt>
<dd><p>If set to <b class="const">false</b> (default), no hyphenation will be done. If set
to <b class="const">true</b>, the command will try to hyphenate the last word of a
line. <em>Note</em>: Hyphenation patterns must be loaded prior, using
the command <b class="cmd">::textutil::adjust::readPatterns</b>.</p></dd>
<dt><b class="option">-justify</b> <b class="const">center|left|plain|right</b></dt>
<dd><p>Sets the justification of the returned string to either <b class="const">left</b>
(default), <b class="const">center</b>, <b class="const">plain</b> or <b class="const">right</b>. The
justification means that any line in the returned string but the last
one is build according to the value.
If the justification is set to <b class="const">plain</b> and the number of
printable chars in the last line is less than 90% of the length of a
line (see the option <b class="option">-length</b>), then this line is justified
with the <b class="const">left</b> value, avoiding the expansion of this line when
it is too small. The meaning of each value is:</p>
<dl class="definitions">
<dt><b class="const">center</b></dt>
<dd><p>The real line is centered in the logical line. If needed, a set of
space characters are added at the beginning (half of the needed set)
and at the end (half of the needed set) of the line if required (see
the option <b class="option">-full</b>).</p></dd>
<dt><b class="const">left</b></dt>
<dd><p>The real line is set on the left of the logical line. It means that
there are no space chars at the beginning of this line. If required,
all needed space chars are added at the end of the line (see the
option <b class="option">-full</b>).</p></dd>
<dt><b class="const">plain</b></dt>
<dd><p>The real line is exactly set in the logical line. It means that there
are no leading or trailing space chars. All the needed space chars are
added in the <em>real</em> line, between 2 (or more) words.</p></dd>
<dt><b class="const">right</b></dt>
<dd><p>The real line is set on the right of the logical line. It means that
there are no space chars at the end of this line, and there may be
some space chars at the beginning, despite of the <b class="option">-full</b> option.</p></dd>
</dl></dd>
<dt><b class="option">-length</b> <i class="arg">integer</i></dt>
<dd><p>Set the length of the <em>logical</em> line in the string to
<i class="arg">integer</i>.  <i class="arg">integer</i> must be a positive integer
value. Defaults to <b class="const">72</b>.</p></dd>
<dt><b class="option">-strictlength</b></dt>
<dd><p><i class="arg">boolean</i>]
If set to <b class="const">false</b> (default), a line can exceed the specified
<b class="option">-length</b> if a single word is longer than <b class="option">-length</b>. If
set to <b class="const">true</b>, words that are longer than <b class="option">-length</b> are
split so that no line exceeds the specified <b class="option">-length</b>.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::textutil::adjust::readPatterns</b> <i class="arg">filename</i></a></dt>
<dd><p>Loads the internal storage for hyphenation patterns with the contents
of the file <i class="arg">filename</i>. This has to be done prior to calling
command <b class="cmd">::textutil::adjust::adjust</b> with &quot;<b class="option">-hyphenate</b>
<b class="const">true</b>&quot;, or the hyphenation process will not work correctly.</p>
<p>The package comes with a number of predefined pattern files, and the
command <b class="cmd">::textutil::adjust::listPredefined</b> can be used to find
out their names.</p></dd>
<dt><a name="3"><b class="cmd">::textutil::adjust::listPredefined</b></a></dt>
<dd><p>This command returns a list containing the names of the hyphenation
files coming with this package.</p></dd>
<dt><a name="4"><b class="cmd">::textutil::adjust::getPredefined</b> <i class="arg">filename</i></a></dt>
<dd><p>Use this command to query the package for the full path name of the
hyphenation file <i class="arg">filename</i> coming with the package. Only the
filenames found in the list returned by
<b class="cmd">::textutil::adjust::listPredefined</b> are legal arguments for this
command.</p></dd>
<dt><a name="5"><b class="cmd">::textutil::adjust::indent</b> <i class="arg">string</i> <i class="arg">prefix</i> <span class="opt">?<i class="arg">skip</i>?</span></a></dt>
<dd><p>Each line in the <i class="arg">string</i> is indented by adding the string
<i class="arg">prefix</i> at its beginning. The modified string is returned
as the result of the command.</p>
<p>If <i class="arg">skip</i> is specified the first <i class="arg">skip</i> lines are left
untouched. The default for <i class="arg">skip</i> is <b class="const">0</b>, causing the
modification of all lines. Negative values for <i class="arg">skip</i> are treated
like <b class="const">0</b>. In other words, <i class="arg">skip</i> &gt; <b class="const">0</b> creates a
hanging indentation.</p>
<p>Together with <b class="cmd">::textutil::adjust::adjust</b> it is possible to
create properly wrapped paragraphs with arbitrary indentations.</p></dd>
<dt><a name="6"><b class="cmd">::textutil::adjust::undent</b> <i class="arg">string</i></a></dt>
<dd><p>The command computes the common prefix for all lines in <i class="arg">string</i>
consisting solely out of whitespace, removes this from each line and
returns the modified string.</p>
<p>Lines containing only whitespace are always reduced to completely
empty lines. They and empty lines are also ignored when computing the
prefix to remove.</p>
<p>Together with <b class="cmd">::textutil::adjust::adjust</b> it is possible to
create properly wrapped paragraphs with arbitrary indentations.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>textutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>regexp(n), split(n), string(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key304">TeX</a>, <a href="../../../../index.html#key303">adjusting</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key306">hyphenation</a>, <a href="../../../../index.html#key301">indenting</a>, <a href="../../../../index.html#key302">justification</a>, <a href="../../../../index.html#key305">paragraph</a>, <a href="../../../../index.html#key239">string</a>, <a href="../../../../index.html#key300">undenting</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/textutil/expander.html.

































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>textutil::expander - Text and string utilities, macro processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/textutil/expander.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; William H. Duquette, http://www.wjduquette.com/expand
   -->
<! -- CVS: $Id$ textutil::expander.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">textutil::expander(n) 1.3.1 tcllib &quot;Text and string utilities, macro processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>textutil::expander - Procedures to process templates and expand text.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXPANDER API</a></li>
<li class="section"><a href="#section3">TUTORIAL</a>
<ul>
<li class="subsection"><a href="#subsection1">Basics</a></li>
<li class="subsection"><a href="#subsection2">Embedding Macros</a></li>
<li class="subsection"><a href="#subsection3">Writing Macro Commands</a></li>
<li class="subsection"><a href="#subsection4">Changing the Expansion Brackets</a></li>
<li class="subsection"><a href="#subsection5">Customized Macro Expansion</a></li>
<li class="subsection"><a href="#subsection6">Using the Context Stack</a></li>
</ul>
</li>
<li class="section"><a href="#section4">HISTORY</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil::expander <span class="opt">?1.3.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::textutil::expander</b> <i class="arg">expanderName</i></a></li>
<li><a href="#2"><i class="arg">expanderName</i> <b class="method">cappend</b> <i class="arg">text</i></a></li>
<li><a href="#3"><i class="arg">expanderName</i> <b class="method">cget</b> <i class="arg">varname</i></a></li>
<li><a href="#4"><i class="arg">expanderName</i> <b class="method">cis</b> <i class="arg">cname</i></a></li>
<li><a href="#5"><i class="arg">expanderName</i> <b class="method">cname</b></a></li>
<li><a href="#6"><i class="arg">expanderName</i> <b class="method">cpop</b> <i class="arg">cname</i></a></li>
<li><a href="#7"><i class="arg">expanderName</i> <b class="method">ctopandclear</b></a></li>
<li><a href="#8"><i class="arg">expanderName</i> <b class="method">cpush</b> <i class="arg">cname</i></a></li>
<li><a href="#9"><i class="arg">expanderName</i> <b class="method">cset</b> <i class="arg">varname</i> <i class="arg">value</i></a></li>
<li><a href="#10"><i class="arg">expanderName</i> <b class="method">cvar</b> <i class="arg">varname</i></a></li>
<li><a href="#11"><i class="arg">expanderName</i> <b class="method">errmode</b> <i class="arg">newErrmode</i></a></li>
<li><a href="#12"><i class="arg">expanderName</i> <b class="method">evalcmd</b> <span class="opt">?<i class="arg">newEvalCmd</i>?</span></a></li>
<li><a href="#13"><i class="arg">expanderName</i> <b class="method">expand</b> <i class="arg">string</i> <span class="opt">?<i class="arg">brackets</i>?</span></a></li>
<li><a href="#14"><i class="arg">expanderName</i> <b class="method">lb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></li>
<li><a href="#15"><i class="arg">expanderName</i> <b class="method">rb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></li>
<li><a href="#16"><i class="arg">expanderName</i> <b class="method">reset</b></a></li>
<li><a href="#17"><i class="arg">expanderName</i> <b class="method">setbrackets</b> <i class="arg">lbrack rbrack</i></a></li>
<li><a href="#18"><i class="arg">expanderName</i> <b class="method">textcmd</b> <span class="opt">?<i class="arg">newTextCmd</i>?</span></a></li>
<li><a href="#19"><i class="arg">expanderName</i> <b class="method">where</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The Tcl <b class="cmd"><a href="../../../../index.html#key234">subst</a></b> command is often used to support a kind of
template processing. Given a string with embedded variables or
function calls, <b class="cmd"><a href="../../../../index.html#key234">subst</a></b> will interpolate the variable and function
values, returning the new string:</p>
<pre class="example">
    % set greeting &quot;Howdy&quot;
    Howdy
    % proc place {} {return &quot;World&quot;}
    % subst {$greeting, [place]!}
    Howdy, World!
    %
</pre>
<p>By defining a suitable set of Tcl commands, <b class="cmd"><a href="../../../../index.html#key234">subst</a></b> can be used to
implement a markup language similar to HTML.</p>
<p>The <b class="cmd"><a href="../../../../index.html#key234">subst</a></b> command is efficient, but it has three drawbacks for
this kind of template processing:</p>
<ul class="itemized">
<li><p>There's no way to identify and process the plain text between two
embedded Tcl commands; that makes it difficult to handle plain text in
a context-sensitive way.</p></li>
<li><p>Embedded commands are necessarily bracketed by <b class="const">[</b> and
<b class="const">]</b>; it's convenient to be able to choose different brackets
in special cases.  Someone producing web pages that include a large
quantity of Tcl code examples might easily prefer to use <b class="const">&lt;&lt;</b>
and <b class="const">&gt;&gt;</b> as the embedded code delimiters instead.</p></li>
<li><p>There's no easy way to handle incremental input, as one might wish to
do when reading data from a socket.</p></li>
</ul>
<p>At present, expander solves the first two problems; eventually it will
solve the third problem as well.</p>
<p>The following section describes the command API to the expander; this
is followed by the tutorial sections, see <span class="sectref"><a href="#section3">TUTORIAL</a></span>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">EXPANDER API</a></h2>
<p>The <b class="package">textutil::expander</b> package provides only one command,
described below. The rest of the section is taken by a description of
the methods for the expander objects created by this command.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::textutil::expander</b> <i class="arg">expanderName</i></a></dt>
<dd><p>The command creates a new expander object with an associated Tcl
command whose name is <i class="arg">expanderName</i>. This command may be used to
invoke various operations on the graph. If the <i class="arg">expanderName</i> is
not fully qualified it is interpreted as relative to the current
namespace.  The command has the following general form:</p>
<pre class="example">
<i class="arg">expanderName</i> option <span class="opt">?<i class="arg">arg arg ...</i>?</span>
</pre>
<p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>The following commands are possible for expander objects:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">expanderName</i> <b class="method">cappend</b> <i class="arg">text</i></a></dt>
<dd><p>Appends a string to the output in the current context.  This command
should rarely be used by macros or application code.</p></dd>
<dt><a name="3"><i class="arg">expanderName</i> <b class="method">cget</b> <i class="arg">varname</i></a></dt>
<dd><p>Retrieves the value of variable <i class="arg">varname</i>, defined in the current
context.</p></dd>
<dt><a name="4"><i class="arg">expanderName</i> <b class="method">cis</b> <i class="arg">cname</i></a></dt>
<dd><p>Determines whether or not the name of the current context is
<i class="arg">cname</i>.</p></dd>
<dt><a name="5"><i class="arg">expanderName</i> <b class="method">cname</b></a></dt>
<dd><p>Returns the name of the current context.</p></dd>
<dt><a name="6"><i class="arg">expanderName</i> <b class="method">cpop</b> <i class="arg">cname</i></a></dt>
<dd><p>Pops a context from the context stack, returning all accumulated
output in that context.  The context must be named <i class="arg">cname</i>, or an
error results.</p></dd>
<dt><a name="7"><i class="arg">expanderName</i> <b class="method">ctopandclear</b></a></dt>
<dd><p>Returns the output currently captured in the topmost context and
clears that buffer. This is similar to a combination of <b class="method">cpop</b>
followed by <b class="method">cpush</b>, except that internal state (brackets) is
preserved here.</p></dd>
<dt><a name="8"><i class="arg">expanderName</i> <b class="method">cpush</b> <i class="arg">cname</i></a></dt>
<dd><p>Pushes a context named <i class="arg">cname</i> onto the context stack.  The
context must be popped by <b class="method">cpop</b> before expansion ends or an
error results.</p></dd>
<dt><a name="9"><i class="arg">expanderName</i> <b class="method">cset</b> <i class="arg">varname</i> <i class="arg">value</i></a></dt>
<dd><p>Sets variable <i class="arg">varname</i> to <i class="arg">value</i> in the current context.</p></dd>
<dt><a name="10"><i class="arg">expanderName</i> <b class="method">cvar</b> <i class="arg">varname</i></a></dt>
<dd><p>Retrieves the internal variable name of context variable
<i class="arg">varname</i>; this allows the variable to be passed to commands like
<b class="cmd">lappend</b>.</p></dd>
<dt><a name="11"><i class="arg">expanderName</i> <b class="method">errmode</b> <i class="arg">newErrmode</i></a></dt>
<dd><p>Sets the macro expansion error mode to one of <b class="const">nothing</b>,
<b class="const">macro</b>, <b class="const">error</b>, or <b class="const">fail</b>; the default value is
<b class="const">fail</b>.  The value determines what the expander does if an
error is detected during expansion of a macro.</p>
<dl class="definitions">
<dt><b class="const">fail</b></dt>
<dd><p>The error propagates normally and can be caught or ignored by the
application.</p></dd>
<dt><b class="const">error</b></dt>
<dd><p>The macro expands into a detailed error message, and expansion
continues.</p></dd>
<dt><b class="const">macro</b></dt>
<dd><p>The macro expands to itself; that is, it is passed along to the output
unchanged.</p></dd>
<dt><b class="const">nothing</b></dt>
<dd><p>The macro expands to the empty string, and is effectively ignored.</p></dd>
</dl></dd>
<dt><a name="12"><i class="arg">expanderName</i> <b class="method">evalcmd</b> <span class="opt">?<i class="arg">newEvalCmd</i>?</span></a></dt>
<dd><p>Returns the current evaluation command, which defaults to
<b class="cmd">uplevel #0</b>.  If specified, <i class="arg">newEvalCmd</i> will be saved for
future use and then returned; it must be a Tcl command expecting one
additional argument: the macro to evaluate.</p></dd>
<dt><a name="13"><i class="arg">expanderName</i> <b class="method">expand</b> <i class="arg">string</i> <span class="opt">?<i class="arg">brackets</i>?</span></a></dt>
<dd><p>Expands the input string, replacing embedded macros with their
expanded values, and returns the expanded string.</p>
<p>If <i class="arg">brackets</i> is given, it must be a list of two strings; the
items will be used as the left and right macro expansion bracket
sequences for this expansion only.</p></dd>
<dt><a name="14"><i class="arg">expanderName</i> <b class="method">lb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></dt>
<dd><p>Returns the current value of the left macro expansion bracket; this is
for use as or within a macro, when the bracket needs to be included in
the output text.  If <i class="arg">newbracket</i> is specified, it becomes the new
bracket, and is returned.</p></dd>
<dt><a name="15"><i class="arg">expanderName</i> <b class="method">rb</b> <span class="opt">?<i class="arg">newbracket</i>?</span></a></dt>
<dd><p>Returns the current value of the right macro expansion bracket; this
is for use as or within a macro, when the bracket needs to be included
in the output text.  If <i class="arg">newbracket</i> is specified, it becomes the
new bracket, and is returned.</p></dd>
<dt><a name="16"><i class="arg">expanderName</i> <b class="method">reset</b></a></dt>
<dd><p>Resets all expander settings to their initial values.  Unusual results
are likely if this command is called from within a call to
<b class="method">expand</b>.</p></dd>
<dt><a name="17"><i class="arg">expanderName</i> <b class="method">setbrackets</b> <i class="arg">lbrack rbrack</i></a></dt>
<dd><p>Sets the left and right macro expansion brackets.  This command is for
use as or within a macro, or to permanently change the bracket
definitions.  By default, the brackets are <b class="const">[</b> and
<b class="const">]</b>, but any non-empty string can be used; for example,
<b class="const">&lt;</b> and <b class="const">&gt;</b> or <b class="const">(*</b> and <b class="const">*)</b> or even
<b class="const">Hello,</b> and <b class="const">World!</b>.</p></dd>
<dt><a name="18"><i class="arg">expanderName</i> <b class="method">textcmd</b> <span class="opt">?<i class="arg">newTextCmd</i>?</span></a></dt>
<dd><p>Returns the current command for processing plain text, which defaults
to the empty string, meaning <em>identity</em>. If specified,
<i class="arg">newTextCmd</i> will be saved for future use and then returned; it
must be a Tcl command expecting one additional argument: the text to
process. The expander object will this command for all plain text it
encounters, giving the user of the object the ability to process all
plain text in some standard way before writing it to the output. The
object expects that the command returns the processed plain text.</p>
<p><em>Note</em> that the combination of &quot;<b class="cmd">textcmd</b> <i class="arg">plaintext</i>&quot;
is run through the <i class="arg">evalcmd</i> for the actual evaluation. In other
words, the <i class="arg">textcmd</i> is treated as a special macro implicitly
surrounding all plain text in the template.</p></dd>
<dt><a name="19"><i class="arg">expanderName</i> <b class="method">where</b></a></dt>
<dd><p>Returns a three-element list containing the current character
position, line, and column the expander is at in the processing of the
current input string.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">TUTORIAL</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Basics</a></h3>
<p>To begin, create an expander object:</p>
<pre class="example">
    % package require expander
    1.2
    % ::expander::expander myexp
    ::myexp
    %
</pre>
<p>The created <b class="cmd">::myexp</b> object can be used to expand text strings
containing embedded Tcl commands.  By default, embedded commands are
delimited by square brackets.  Note that expander doesn't attempt to
interpolate variables, since variables can be referenced by embedded
commands:</p>
<pre class="example">
    % set greeting &quot;Howdy&quot;
    Howdy
    % proc place {} {return &quot;World&quot;}
    % ::myexp expand {[set greeting], [place]!}
    Howdy, World!
    %
</pre>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Embedding Macros</a></h3>
<p>An expander macro is simply a Tcl script embedded within a text
string.  Expander evaluates the script in the global context, and
replaces it with its result string.  For example,</p>
<pre class="example">
    % set greetings {Howdy Hi &quot;What's up&quot;}
    Howdy Hi &quot;What's up&quot;
    % ::myexp expand {There are many ways to say &quot;Hello, World!&quot;:
    [set result {}
    foreach greeting $greetings {
	append result &quot;$greeting, World!\\n&quot;
    }
    set result]
    And that's just a small sample!}
    There are many ways to say &quot;Hello, World!&quot;:
    Howdy, World!
    Hi, World!
    What's up, World!
    And that's just a small sample!
    %
</pre>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Writing Macro Commands</a></h3>
<p>More typically, <em>macro commands</em> are used to create a markup
language.  A macro command is just a Tcl command that returns an
output string.  For example, expand can be used to implement a generic
document markup language that can be retargeted to HTML or any other
output format:</p>
<pre class="example">
    % proc bold {} {return &quot;&lt;b&gt;&quot;}
    % proc /bold {} {return &quot;&lt;/b&gt;&quot;}
    % ::myexp expand {Some of this text is in [bold]boldface[/bold]}
    Some of this text is in &lt;b&gt;boldface&lt;/b&gt;
    %
</pre>
<p>The above definitions of <b class="cmd">bold</b> and <b class="cmd">/bold</b> returns HTML, but
such commands can be as complicated as needed; they could, for
example, decide what to return based on the desired output format.</p>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Changing the Expansion Brackets</a></h3>
<p>By default, embedded macros are enclosed in square brackets,
<b class="const">[</b> and <b class="const">]</b>.  If square brackets need to be
included in the output, the input can contain the <b class="cmd">lb</b> and
<b class="cmd">rb</b> commands.  Alternatively, or if square brackets are
objectionable for some other reason, the macro expansion brackets can
be changed to any pair of non-empty strings.</p>
<p>The <b class="method">setbrackets</b> command changes the brackets permanently.
For example, you can write pseudo-html by change them to <b class="const">&lt;</b>
and <b class="const">&gt;</b>:</p>
<pre class="example">
    % ::myexp setbrackets &lt; &gt;
    % ::myexp expand {&lt;bold&gt;This is boldface&lt;/bold&gt;}
    &lt;b&gt;This is boldface&lt;/b&gt;
</pre>
<p>Alternatively, you can change the expansion brackets temporarily by
passing the desired brackets to the <b class="method">expand</b> command:</p>
<pre class="example">
    % ::myexp setbrackets &quot;\\[&quot; &quot;\\]&quot;
    % ::myexp expand {&lt;bold&gt;This is boldface&lt;/bold&gt;} {&lt; &gt;}
    &lt;b&gt;This is boldface&lt;/b&gt;
    %
</pre>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Customized Macro Expansion</a></h3>
<p>By default, macros are evaluated using the Tcl <b class="cmd">uplevel #0</b>
command, so that the embedded code executes in the global context.
The application can provide a different evaluation command using
<b class="method">evalcmd</b>; this allows the application to use a safe
interpreter, for example, or even to evaluated something other than
Tcl code.  There is one caveat: to be recognized as valid, a macro
must return 1 when passed to Tcl's &quot;info complete&quot; command.</p>
<p>For example, the following code &quot;evaluates&quot; each macro by returning
the macro text itself.</p>
<pre class="example">
    proc identity {macro} {return $macro}
    ::myexp evalcmd identity
</pre>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Using the Context Stack</a></h3>
<p>Often it's desirable to define a pair of macros which operate in some
way on the plain text between them.  Consider a set of macros for
adding footnotes to a web page: one could have implement something
like this:</p>
<pre class="example">
    Dr. Pangloss, however, thinks that this is the best of all
    possible worlds.[footnote &quot;See Candide, by Voltaire&quot;]
</pre>
<p>The <b class="cmd">footnote</b> macro would, presumably, assign a number to this
footnote and save the text to be formatted later on.  However, this
solution is ugly if the footnote text is long or should contain
additional markup.  Consider the following instead:</p>
<pre class="example">
    Dr. Pangloss, however, thinks that this is the best of all
    possible worlds.[footnote]See [bookTitle &quot;Candide&quot;], by
    [authorsName &quot;Voltaire&quot;], for more information.[/footnote]
</pre>
<p>Here the footnote text is contained between <b class="cmd">footnote</b> and
<b class="cmd">/footnote</b> macros, continues onto a second line, and contains
several macros of its own.  This is both clearer and more flexible;
however, with the features presented so far there's no easy way to do
it.  That's the purpose of the context stack.</p>
<p>All macro expansion takes place in a particular context.  Here, the
<b class="cmd">footnote</b> macro pushes a new context onto the context stack.
Then, all expanded text gets placed in that new context.
<b class="cmd">/footnote</b> retrieves it by popping the context.  Here's a
skeleton implementation of these two macros:</p>
<pre class="example">
    proc footnote {} {
        ::myexp cpush footnote
    }
    proc /footnote {} {
        set footnoteText [::myexp cpop footnote]
        # Save the footnote text, and return an appropriate footnote
        # number and link.
    }
</pre>
<p>The <b class="method">cpush</b> command pushes a new context onto the stack; the
argument is the context's name.  It can be any string, but would
typically be the name of the macro itself.  Then, <b class="method">cpop</b>
verifies that the current context has the expected name, pops it off
of the stack, and returns the accumulated text.</p>
<p>Expand provides several other tools related to the context stack.
Suppose the first macro in a context pair takes arguments or computes
values which the second macro in the pair needs.  After calling
<b class="method">cpush</b>, the first macro can define one or more context
variables; the second macro can retrieve their values any time before
calling <b class="method">cpop</b>.  For example, suppose the document must specify
the footnote number explicitly:</p>
<pre class="example">
    proc footnote {footnoteNumber} {
        ::myexp cpush footnote
        ::myexp csave num $footnoteNumber
        # Return an appropriate link
    }
    proc /footnote {} {
        set footnoteNumber [::myexp cget num]
        set footnoteText [::myexp cpop footnote]
        # Save the footnote text and its footnoteNumber for future
        # output.
    }
</pre>
<p>At times, it might be desirable to define macros that are valid only
within a particular context pair; such macros should verify that they
are only called within the correct context using either <b class="method">cis</b>
or <b class="method">cname</b>.</p>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">HISTORY</a></h2>
<p><b class="cmd">expander</b> was written by William H. Duquette; it is a repackaging
of the central algorithm of the expand macro processing tool.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>textutil :: expander</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="http://www.wjduquette.com/expand">http://www.wjduquette.com/expand</a>, regexp, <a href="../../../../index.html#key391">split</a>, <a href="../../../../index.html#key239">string</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key239">string</a>, <a href="../../../../index.html#key719">template processing</a>, <a href="../../../../index.html#key720">text expansion</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Documentation tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; William H. Duquette, http://www.wjduquette.com/expand</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/textutil/repeat.html.








































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>textutil::repeat - Text and string utilities, macro processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/textutil/repeat.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ textutil::repeat.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">textutil::repeat(n) 0.7.1 tcllib &quot;Text and string utilities, macro processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>textutil::repeat - Procedures to repeat strings.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil::repeat <span class="opt">?0.7?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::textutil::repeat::strRepeat</b> <i class="arg">text</i> <i class="arg">num</i></a></li>
<li><a href="#2"><b class="cmd">::textutil::repeat::blank</b> <i class="arg">num</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">textutil::repeat</b> provides commands to generate
long strings by repeating a shorter string many times.</p>
<p>The complete set of procedures is described below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::textutil::repeat::strRepeat</b> <i class="arg">text</i> <i class="arg">num</i></a></dt>
<dd><p>This command returns a string containing the <i class="arg">text</i> repeated
<i class="arg">num</i> times. The repetitions are joined without characters between
them. A value of <i class="arg">num</i> &lt;= 0 causes the command to return an empty
string.</p>
<p><em>Note</em>: If the Tcl core the package is loaded in provides the
command <b class="cmd">string repeat</b> then this command will be implemented in
its terms, for maximum possible speed. Otherwise a fast implementation
in Tcl will be used.</p></dd>
<dt><a name="2"><b class="cmd">::textutil::repeat::blank</b> <i class="arg">num</i></a></dt>
<dd><p>A convenience command. Returns a string of <i class="arg">num</i> spaces.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>textutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>regexp(n), split(n), string(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key237">blanks</a>, <a href="../../../../index.html#key238">repetition</a>, <a href="../../../../index.html#key239">string</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/textutil/tabify.html.




























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>textutil::tabify - Text and string utilities, macro processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/textutil/tabify.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ textutil::tabify.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">textutil::tabify(n) 0.7 tcllib &quot;Text and string utilities, macro processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>textutil::tabify - Procedures to (un)tabify strings</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil::tabify <span class="opt">?0.7?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::textutil::tabify::tabify</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::textutil::tabify::tabify2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::textutil::tabify::untabify</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::textutil::tabify::untabify2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">textutil::tabify</b> provides commands that convert
between tabulation and ordinary whitespace in strings.</p>
<p>The complete set of procedures is described below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::textutil::tabify::tabify</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></dt>
<dd><p>Tabify the <i class="arg">string</i> by replacing any substring of <i class="arg">num</i> space
chars by a tabulation and return the result as a new string. <i class="arg">num</i>
defaults to 8.</p></dd>
<dt><a name="2"><b class="cmd">::textutil::tabify::tabify2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></dt>
<dd><p>Similar to <b class="cmd">::textutil::tabify</b> this command tabifies the
<i class="arg">string</i> and returns the result as a new string. A different
algorithm is used however. Instead of replacing any substring of
<i class="arg">num</i> spaces this command works more like an editor. <i class="arg">num</i>
defaults to 8.</p>
<p>Each line of the text in <i class="arg">string</i> is treated as if there are
tabstops every <i class="arg">num</i> columns. Only sequences of space characters
containing more than one space character and found immediately before
a tabstop are replaced with tabs.</p></dd>
<dt><a name="3"><b class="cmd">::textutil::tabify::untabify</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></dt>
<dd><p>Untabify the <i class="arg">string</i> by replacing any tabulation char by a
substring of <i class="arg">num</i> space chars and return the result as a new
string. <i class="arg">num</i> defaults to 8.</p></dd>
<dt><a name="4"><b class="cmd">::textutil::tabify::untabify2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></dt>
<dd><p>Untabify the <i class="arg">string</i> by replacing any tabulation char by a
substring of at most <i class="arg">num</i> space chars and return the result as a
new string. Unlike <b class="cmd">textutil::tabify::untabify</b> each tab is not
replaced by a fixed number of space characters.  The command overlays
each line in the <i class="arg">string</i> with tabstops every <i class="arg">num</i> columns
instead and replaces tabs with just enough space characters to reach
the next tabstop. This is the complement of the actions taken by
<b class="cmd">::textutil::tabify::tabify2</b>. <i class="arg">num</i> defaults to 8.</p>
<p>There is one asymmetry though: A tab can be replaced with a single
space, but not the other way around.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>textutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>regexp(n), split(n), string(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key239">string</a>, <a href="../../../../index.html#key498">tabstops</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/textutil/textutil.html.





































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>textutil - Text and string utilities, macro processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/textutil/textutil.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ textutil.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">textutil(n) 0.7.1 tcllib &quot;Text and string utilities, macro processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>textutil - Procedures to manipulate texts and strings.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil <span class="opt">?0.7.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::textutil::adjust</b> <i class="arg">string args</i></a></li>
<li><a href="#2"><b class="cmd">::textutil::adjust::readPatterns</b> <i class="arg">filename</i></a></li>
<li><a href="#3"><b class="cmd">::textutil::adjust::listPredefined</b></a></li>
<li><a href="#4"><b class="cmd">::textutil::adjust::getPredefined</b> <i class="arg">filename</i></a></li>
<li><a href="#5"><b class="cmd">::textutil::indent</b> <i class="arg">string</i> <i class="arg">prefix</i> <span class="opt">?<i class="arg">skip</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::textutil::undent</b> <i class="arg">string</i></a></li>
<li><a href="#7"><b class="cmd">::textutil::splitn</b> <i class="arg">string</i> <span class="opt">?<i class="arg">len</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::textutil::splitx</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></li>
<li><a href="#9"><b class="cmd">::textutil::tabify</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::textutil::tabify2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></li>
<li><a href="#11"><b class="cmd">::textutil::trim</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></li>
<li><a href="#12"><b class="cmd">::textutil::trimleft</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::textutil::trimright</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::textutil::trimPrefix</b> <i class="arg">string</i> <i class="arg">prefix</i></a></li>
<li><a href="#15"><b class="cmd">::textutil::trimEmptyHeading</b> <i class="arg">string</i></a></li>
<li><a href="#16"><b class="cmd">::textutil::untabify</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></li>
<li><a href="#17"><b class="cmd">::textutil::untabify2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></li>
<li><a href="#18"><b class="cmd">::textutil::strRepeat</b> <i class="arg">text num</i></a></li>
<li><a href="#19"><b class="cmd">::textutil::blank</b> <i class="arg">num</i></a></li>
<li><a href="#20"><b class="cmd">::textutil::chop</b> <i class="arg">string</i></a></li>
<li><a href="#21"><b class="cmd">::textutil::tail</b> <i class="arg">string</i></a></li>
<li><a href="#22"><b class="cmd">::textutil::cap</b> <i class="arg">string</i></a></li>
<li><a href="#23"><b class="cmd">::textutil::uncap</b> <i class="arg">string</i></a></li>
<li><a href="#24"><b class="cmd">::textutil::longestCommonPrefixList</b> <i class="arg">list</i></a></li>
<li><a href="#25"><b class="cmd">::textutil::longestCommonPrefix</b> <span class="opt">?<i class="arg">string</i>...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">textutil</b> provides commands that manipulate
strings or texts (a.k.a. long strings or string with embedded newlines
or paragraphs).
It is actually a bundle providing the commands of the six packages</p>
<dl class="definitions">
<dt><b class="package"><a href="adjust.html">textutil::adjust</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="repeat.html">textutil::repeat</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="textutil_split.html">textutil::split</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="textutil_string.html">textutil::string</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="tabify.html">textutil::tabify</a></b></dt>
<dd></dd>
<dt><b class="package"><a href="trim.html">textutil::trim</a></b></dt>
<dd></dd>
</dl>
<p>in the namespace <b class="namespace">textutil</b>.</p>
<p>The bundle is <em>deprecated</em>, and it will be removed in a future
release of Tcllib, after the next release. It is recommended to use the
relevant sub packages instead for whatever functionality is needed by
the using package or application.</p>
<p>The complete set of procedures is described below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::textutil::adjust</b> <i class="arg">string args</i></a></dt>
<dd><p>Do a justification on the <i class="arg">string</i> according to <i class="arg">args</i>.  The
string is taken as one big paragraph, ignoring any newlines.  Then the
line is formatted according to the options used, and the command
return a new string with enough lines to contain all the printable
chars in the input string. A line is a set of chars between the
beginning of the string and a newline, or between 2 newlines, or
between a newline and the end of the string. If the input string is
small enough, the returned string won't contain any newlines.</p>
<p>Together with <b class="cmd">::textutil::indent</b> it is possible to create
properly wrapped paragraphs with arbitrary indentations.</p>
<p>By default, any occurrence of spaces characters or tabulation are
replaced by a single space so each word in a line is separated from
the next one by exactly one space char, and this forms a <em>real</em>
line. Each <em>real</em> line is placed in a <em>logical</em> line, which
have exactly a given length (see <b class="option">-length</b> option below). The
<em>real</em> line may have a lesser length. Again by default, any
trailing spaces are ignored before returning the string (see
<b class="option">-full</b> option below). The following options may be used after the
<i class="arg">string</i> parameter, and change the way the command place a
<em>real</em> line in a <em>logical</em> line.</p>
<dl class="definitions">
<dt>-full <i class="arg">boolean</i></dt>
<dd><p>If set to <b class="const">false</b>, any trailing space chars are deleted before
returning the string. If set to <b class="const">true</b>, any trailing space
chars are left in the string. Default to <b class="const">false</b>.</p></dd>
<dt><b class="option">-hyphenate</b> <i class="arg">boolean</i></dt>
<dd><p>if set to <b class="const">false</b>, no hyphenation will be done. If set to
<b class="const">true</b>, the last word of a line is tried to be hyphenated.
Defaults to <b class="const">false</b>. Note: hyphenation patterns must be loaded
prior, using the command <b class="cmd">::textutil::adjust::readPatterns</b>.</p></dd>
<dt><b class="option">-justify</b> <b class="const">center|left|plain|right</b></dt>
<dd><p>Set the justification of the returned string to <b class="const">center</b>,
<b class="const">left</b>, <b class="const">plain</b> or <b class="const">right</b>. By default, it is set to
<b class="const">left</b>.  The justification means that any line in the returned
string but the last one is build according to the value. If the
justification is set to <b class="const">plain</b> and the number of printable
chars in the last line is less than 90% of the length of a line (see
<b class="option">-length</b>), then this line is justified with the <b class="const">left</b>
value, avoiding the expansion of this line when it is too small. The
meaning of each value is:</p>
<dl class="definitions">
<dt><b class="const">center</b></dt>
<dd><p>The real line is centered in the logical line. If needed, a set of
space characters are added at the beginning (half of the needed set)
and at the end (half of the needed set) of the line if required (see
the option <b class="option">-full</b>).</p></dd>
<dt><b class="const">left</b></dt>
<dd><p>The real line is set on the left of the logical line. It means that
there are no space chars at the beginning of this line. If required,
all needed space chars are added at the end of the line (see the
option <b class="option">-full</b>).</p></dd>
<dt><b class="const">plain</b></dt>
<dd><p>The real line is exactly set in the logical line. It means that there
are no leading or trailing space chars. All the needed space chars are
added in the <em>real</em> line, between 2 (or more) words.</p></dd>
<dt><b class="const">right</b></dt>
<dd><p>The real line is set on the right of the logical line. It means that
there are no space chars at the end of this line, and there may be
some space chars at the beginning, despite of the <b class="option">-full</b> option.</p></dd>
</dl></dd>
<dt><b class="option">-length</b> <i class="arg">integer</i></dt>
<dd><p>Set the length of the <em>logical</em> line in the string to
<i class="arg">integer</i>.  <i class="arg">integer</i> must be a positive integer
value. Defaults to <b class="const">72</b>.</p></dd>
<dt><b class="option">-strictlength</b> <i class="arg">boolean</i></dt>
<dd><p>If set to <b class="const">false</b>, a line can exceed the specified
<b class="option">-length</b> if a single word is longer than <b class="option">-length</b>. If
set to <b class="const">true</b>, words that are longer than <b class="option">-length</b> are
split so that no line exceeds the specified <b class="option">-length</b>. Defaults
to <b class="const">false</b>.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::textutil::adjust::readPatterns</b> <i class="arg">filename</i></a></dt>
<dd><p>Loads the internal storage for hyphenation patterns with the contents
of the file <i class="arg">filename</i>. This has to be done prior to calling
command <b class="cmd">::textutil::adjust</b> with
&quot;<b class="option">-hyphenate</b> <b class="const">true</b>&quot;, or the hyphenation process will
not work correctly.</p>
<p>The package comes with a number of predefined pattern files, and the
command <b class="cmd">::textutil::adjust::listPredefined</b> can be used to find
out their names.</p></dd>
<dt><a name="3"><b class="cmd">::textutil::adjust::listPredefined</b></a></dt>
<dd><p>This command returns a list containing the names of the hyphenation
files coming with this package.</p></dd>
<dt><a name="4"><b class="cmd">::textutil::adjust::getPredefined</b> <i class="arg">filename</i></a></dt>
<dd><p>Use this command to query the package for the full path name of the
hyphenation file <i class="arg">filename</i> coming with the package. Only the
filenames found in the list returned by
<b class="cmd">::textutil::adjust::listPredefined</b> are legal arguments for this
command.</p></dd>
<dt><a name="5"><b class="cmd">::textutil::indent</b> <i class="arg">string</i> <i class="arg">prefix</i> <span class="opt">?<i class="arg">skip</i>?</span></a></dt>
<dd><p>Each line in the <i class="arg">string</i> indented by adding the string
<i class="arg">prefix</i> at its beginning. The modified string is returned
as the result of the command.</p>
<p>If <i class="arg">skip</i> is specified the first <i class="arg">skip</i> lines are left
untouched. The default for <i class="arg">skip</i> is <b class="const">0</b>, causing the
modification of all lines. Negative values for <i class="arg">skip</i> are treated
like <b class="const">0</b>. In other words, <i class="arg">skip</i> &gt; <b class="const">0</b> creates a
hanging indentation.</p>
<p>Together with <b class="cmd">::textutil::adjust</b> it is possible to create
properly wrapped paragraphs with arbitrary indentations.</p></dd>
<dt><a name="6"><b class="cmd">::textutil::undent</b> <i class="arg">string</i></a></dt>
<dd><p>The command computes the common prefix for all
lines in <i class="arg">string</i> consisting solely out of whitespace,
removes this from each line and returns the modified string.</p>
<p>Lines containing only whitespace are always reduced to completely
empty lines. They and empty lines are also ignored when computing the
prefix to remove.</p>
<p>Together with <b class="cmd">::textutil::adjust</b> it is possible to create
properly wrapped paragraphs with arbitrary indentations.</p></dd>
<dt><a name="7"><b class="cmd">::textutil::splitn</b> <i class="arg">string</i> <span class="opt">?<i class="arg">len</i>?</span></a></dt>
<dd><p>This command splits the given <i class="arg">string</i> into chunks of <i class="arg">len</i>
characters and returns a list containing these chunks. The argument
<i class="arg">len</i> defaults to <b class="const">1</b> if none is specified. A negative
length is not allowed and will cause the command to throw an
error. Providing an empty string as input is allowed, the command will
then return an empty list. If the length of the <i class="arg">string</i> is not an
entire multiple of the chunk length, then the last chunk in the
generated list will be shorter than <i class="arg">len</i>.</p></dd>
<dt><a name="8"><b class="cmd">::textutil::splitx</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></dt>
<dd><p>Split the <i class="arg">string</i> and return a list. The string is split
according to the regular expression <i class="arg">regexp</i> instead of a simple
list of chars. Note that if you add parenthesis into the <i class="arg">regexp</i>,
the parentheses part of separator would be added into list as
additional element. If the <i class="arg">string</i> is empty the result is the
empty list, like for <b class="cmd"><a href="../../../../index.html#key391">split</a></b>. If <i class="arg">regexp</i> is empty the
<i class="arg">string</i> is split at every character, like <b class="cmd"><a href="../../../../index.html#key391">split</a></b> does.
The regular expression <i class="arg">regexp</i> defaults to &quot;[\\t \\r\\n]+&quot;.</p></dd>
<dt><a name="9"><b class="cmd">::textutil::tabify</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></dt>
<dd><p>Tabify the <i class="arg">string</i> by replacing any substring of <i class="arg">num</i> space
chars by a tabulation and return the result as a new string. <i class="arg">num</i>
defaults to 8.</p></dd>
<dt><a name="10"><b class="cmd">::textutil::tabify2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></dt>
<dd><p>Similar to <b class="cmd">::textutil::tabify</b> this command tabifies the
<i class="arg">string</i> and returns the result as a new string. A different
algorithm is used however. Instead of replacing any substring of
<i class="arg">num</i> spaces this command works more like an editor. <i class="arg">num</i>
defaults to 8.</p>
<p>Each line of the text in <i class="arg">string</i> is treated as if there are
tabstops every <i class="arg">num</i> columns. Only sequences of space characters
containing more than one space character and found immediately before
a tabstop are replaced with tabs.</p></dd>
<dt><a name="11"><b class="cmd">::textutil::trim</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></dt>
<dd><p>Remove in <i class="arg">string</i> any leading and trailing substring according to
the regular expression <i class="arg">regexp</i> and return the result as a new
string.  This apply on any <em>line</em> in the string, that is any
substring between 2 newline chars, or between the beginning of the
string and a newline, or between a newline and the end of the string,
or, if the string contain no newline, between the beginning and the
end of the string.
The regular expression <i class="arg">regexp</i> defaults to &quot;[ \\t]+&quot;.</p></dd>
<dt><a name="12"><b class="cmd">::textutil::trimleft</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></dt>
<dd><p>Remove in <i class="arg">string</i> any leading substring according to the regular
expression <i class="arg">regexp</i> and return the result as a new string. This
apply on any <em>line</em> in the string, that is any substring between
2 newline chars, or between the beginning of the string and a newline,
or between a newline and the end of the string, or, if the string
contain no newline, between the beginning and the end of the string.
The regular expression <i class="arg">regexp</i> defaults to &quot;[ \\t]+&quot;.</p></dd>
<dt><a name="13"><b class="cmd">::textutil::trimright</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></dt>
<dd><p>Remove in <i class="arg">string</i> any trailing substring according to the regular
expression <i class="arg">regexp</i> and return the result as a new string. This
apply on any <em>line</em> in the string, that is any substring between
2 newline chars, or between the beginning of the string and a newline,
or between a newline and the end of the string, or, if the string
contain no newline, between the beginning and the end of the string.
The regular expression <i class="arg">regexp</i> defaults to &quot;[ \\t]+&quot;.</p></dd>
<dt><a name="14"><b class="cmd">::textutil::trimPrefix</b> <i class="arg">string</i> <i class="arg">prefix</i></a></dt>
<dd><p>Removes the <i class="arg">prefix</i> from the beginning of <i class="arg">string</i> and
returns the result. The <i class="arg">string</i> is left unchanged if it doesn't
have <i class="arg">prefix</i> at its beginning.</p></dd>
<dt><a name="15"><b class="cmd">::textutil::trimEmptyHeading</b> <i class="arg">string</i></a></dt>
<dd><p>Looks for empty lines (including lines consisting of only whitespace)
at the beginning of the <i class="arg">string</i> and removes it. The modified
string is returned as the result of the command.</p></dd>
<dt><a name="16"><b class="cmd">::textutil::untabify</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></dt>
<dd><p>Untabify the <i class="arg">string</i> by replacing any tabulation char by a
substring of <i class="arg">num</i> space chars and return the result as a new
string. <i class="arg">num</i> defaults to 8.</p></dd>
<dt><a name="17"><b class="cmd">::textutil::untabify2</b> <i class="arg">string</i> <span class="opt">?<i class="arg">num</i>?</span></a></dt>
<dd><p>Untabify the <i class="arg">string</i> by replacing any tabulation char by a
substring of at most <i class="arg">num</i> space chars and return the result as a
new string. Unlike <b class="cmd">textutil::untabify</b> each tab is not replaced
by a fixed number of space characters.  The command overlays each line
in the <i class="arg">string</i> with tabstops every <i class="arg">num</i> columns instead and
replaces tabs with just enough space characters to reach the next
tabstop. This is the complement of the actions taken by
<b class="cmd">::textutil::tabify2</b>. <i class="arg">num</i> defaults to 8.</p>
<p>There is one asymmetry though: A tab can be replaced with a single
space, but not the other way around.</p></dd>
<dt><a name="18"><b class="cmd">::textutil::strRepeat</b> <i class="arg">text num</i></a></dt>
<dd><p>The implementation depends on the core executing the package. Used
<b class="cmd">string repeat</b> if it is present, or a fast tcl implementation
if it is not. Returns a string containing the <i class="arg">text</i> repeated
<i class="arg">num</i> times. The repetitions are joined without characters between
them. A value of <i class="arg">num</i> &lt;= 0 causes the command to return an empty
string.</p></dd>
<dt><a name="19"><b class="cmd">::textutil::blank</b> <i class="arg">num</i></a></dt>
<dd><p>A convenience command. Returns a string of <i class="arg">num</i> spaces.</p></dd>
<dt><a name="20"><b class="cmd">::textutil::chop</b> <i class="arg">string</i></a></dt>
<dd><p>A convenience command. Removes the last character of <i class="arg">string</i> and
returns the shortened string.</p></dd>
<dt><a name="21"><b class="cmd">::textutil::tail</b> <i class="arg">string</i></a></dt>
<dd><p>A convenience command. Removes the first character of <i class="arg">string</i> and
returns the shortened string.</p></dd>
<dt><a name="22"><b class="cmd">::textutil::cap</b> <i class="arg">string</i></a></dt>
<dd><p>Capitalizes the first character of <i class="arg">string</i> and returns the modified string.</p></dd>
<dt><a name="23"><b class="cmd">::textutil::uncap</b> <i class="arg">string</i></a></dt>
<dd><p>The complementary operation to <b class="cmd">::textutil::cap</b>. Forces the first
character of <i class="arg">string</i> to lower case and returns the modified
string.</p></dd>
<dt><a name="24"><b class="cmd">::textutil::longestCommonPrefixList</b> <i class="arg">list</i></a></dt>
<dd></dd>
<dt><a name="25"><b class="cmd">::textutil::longestCommonPrefix</b> <span class="opt">?<i class="arg">string</i>...?</span></a></dt>
<dd><p>Computes the longest common prefix for either the <i class="arg">string</i>s given
to the command, or the strings specified in the single <i class="arg">list</i>, and
returns it as the result of the command.</p>
<p>If no strings were specified the result is the empty string.  If only
one string was specified, the string itself is returned, as it is its
own longest common prefix.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>textutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>regexp(n), split(n), string(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key304">TeX</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key306">hyphenation</a>, <a href="../../../../index.html#key301">indenting</a>, <a href="../../../../index.html#key305">paragraph</a>, <a href="../../../../index.html#key281">regular expression</a>, <a href="../../../../index.html#key239">string</a>, <a href="../../../../index.html#key380">trimming</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/textutil/textutil_split.html.
















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>textutil::split - Text and string utilities, macro processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/textutil/textutil_split.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ textutil::split.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">textutil::split(n) 0.7 tcllib &quot;Text and string utilities, macro processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>textutil::split - Procedures to split texts</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil::split <span class="opt">?0.7?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::textutil::split::splitn</b> <i class="arg">string</i> <span class="opt">?<i class="arg">len</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::textutil::split::splitx</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">textutil::split</b> provides commands that split
strings by size and arbitrary regular expressions.</p>
<p>The complete set of procedures is described below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::textutil::split::splitn</b> <i class="arg">string</i> <span class="opt">?<i class="arg">len</i>?</span></a></dt>
<dd><p>This command splits the given <i class="arg">string</i> into chunks of <i class="arg">len</i>
characters and returns a list containing these chunks. The argument
<i class="arg">len</i> defaults to <b class="const">1</b> if none is specified. A negative
length is not allowed and will cause the command to throw an
error. Providing an empty string as input is allowed, the command will
then return an empty list. If the length of the <i class="arg">string</i> is not an
entire multiple of the chunk length, then the last chunk in the
generated list will be shorter than <i class="arg">len</i>.</p></dd>
<dt><a name="2"><b class="cmd">::textutil::split::splitx</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></dt>
<dd><p>This command splits the <i class="arg">string</i> and return a list. The string is
split according to the regular expression <i class="arg">regexp</i> instead of a
simple list of chars.
Note that if you parentheses are added into the <i class="arg">regexp</i>, the
parentheses part of separator will be added into the result list as
additional element. If the <i class="arg">string</i> is empty the result is the
empty list, like for <b class="cmd"><a href="../../../../index.html#key391">split</a></b>. If <i class="arg">regexp</i> is empty the
<i class="arg">string</i> is split at every character, like <b class="cmd"><a href="../../../../index.html#key391">split</a></b> does.
The regular expression <i class="arg">regexp</i> defaults to &quot;[\\t \\r\\n]+&quot;.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>textutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>regexp(n), split(n), string(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key281">regular expression</a>, <a href="../../../../index.html#key391">split</a>, <a href="../../../../index.html#key239">string</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/textutil/textutil_string.html.























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>textutil::string - Text and string utilities, macro processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/textutil/textutil_string.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ textutil::string.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">textutil::string(n) 0.7 tcllib &quot;Text and string utilities, macro processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>textutil::string - Procedures to manipulate texts and strings.</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil::string <span class="opt">?0.7?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::textutil::string::chop</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::textutil::string::tail</b> <i class="arg">string</i></a></li>
<li><a href="#3"><b class="cmd">::textutil::string::cap</b> <i class="arg">string</i></a></li>
<li><a href="#4"><b class="cmd">::textutil::string::uncap</b> <i class="arg">string</i></a></li>
<li><a href="#5"><b class="cmd">::textutil::string::longestCommonPrefixList</b> <i class="arg">list</i></a></li>
<li><a href="#6"><b class="cmd">::textutil::string::longestCommonPrefix</b> <span class="opt">?<i class="arg">string</i>...?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">textutil::string</b> provides miscellaneous string
manipulation commands.</p>
<p>The complete set of procedures is described below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::textutil::string::chop</b> <i class="arg">string</i></a></dt>
<dd><p>A convenience command. Removes the last character of <i class="arg">string</i> and
returns the shortened string.</p></dd>
<dt><a name="2"><b class="cmd">::textutil::string::tail</b> <i class="arg">string</i></a></dt>
<dd><p>A convenience command. Removes the first character of <i class="arg">string</i> and
returns the shortened string.</p></dd>
<dt><a name="3"><b class="cmd">::textutil::string::cap</b> <i class="arg">string</i></a></dt>
<dd><p>Capitalizes the first character of <i class="arg">string</i> and returns the
modified string.</p></dd>
<dt><a name="4"><b class="cmd">::textutil::string::uncap</b> <i class="arg">string</i></a></dt>
<dd><p>The complementary operation to <b class="cmd">::textutil::string::cap</b>. Forces
the first character of <i class="arg">string</i> to lower case and returns the
modified string.</p></dd>
<dt><a name="5"><b class="cmd">::textutil::string::longestCommonPrefixList</b> <i class="arg">list</i></a></dt>
<dd></dd>
<dt><a name="6"><b class="cmd">::textutil::string::longestCommonPrefix</b> <span class="opt">?<i class="arg">string</i>...?</span></a></dt>
<dd><p>Computes the longest common prefix for either the <i class="arg">string</i>s given
to the command, or the strings specified in the single <i class="arg">list</i>, and
returns it as the result of the command.</p>
<p>If no strings were specified the result is the empty string.  If only
one string was specified, the string itself is returned, as it is its
own longest common prefix.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>textutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>regexp(n), split(n), string(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key641">capitalize</a>, <a href="../../../../index.html#key639">chop</a>, <a href="../../../../index.html#key642">common prefix</a>, <a href="../../../../index.html#key307">formatting</a>, <a href="../../../../index.html#key640">prefix</a>, <a href="../../../../index.html#key239">string</a>, <a href="../../../../index.html#key638">uncapitalize</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/textutil/trim.html.

































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>textutil::trim - Text and string utilities, macro processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/textutil/trim.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ textutil::trim.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">textutil::trim(n) 0.7 tcllib &quot;Text and string utilities, macro processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>textutil::trim - Procedures to trim strings</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">textutil::trim <span class="opt">?0.7?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::textutil::trim::trim</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::textutil::trim::trimleft</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::textutil::trim::trimright</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::textutil::trim::trimPrefix</b> <i class="arg">string</i> <i class="arg">prefix</i></a></li>
<li><a href="#5"><b class="cmd">::textutil::trim::trimEmptyHeading</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The package <b class="package">textutil::trim</b> provides commands that trim
strings using arbitrary regular expressions.</p>
<p>The complete set of procedures is described below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::textutil::trim::trim</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></dt>
<dd><p>Remove in <i class="arg">string</i> any leading and trailing substring according to
the regular expression <i class="arg">regexp</i> and return the result as a new
string.  This is done for all <em>lines</em> in the string, that is any
substring between 2 newline chars, or between the beginning of the
string and a newline, or between a newline and the end of the string,
or, if the string contain no newline, between the beginning and the
end of the string.
The regular expression <i class="arg">regexp</i> defaults to &quot;[ \\t]+&quot;.</p></dd>
<dt><a name="2"><b class="cmd">::textutil::trim::trimleft</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></dt>
<dd><p>Remove in <i class="arg">string</i> any leading substring according to the regular
expression <i class="arg">regexp</i> and return the result as a new string. This
apply on any <em>line</em> in the string, that is any substring between
2 newline chars, or between the beginning of the string and a newline,
or between a newline and the end of the string, or, if the string
contain no newline, between the beginning and the end of the string.
The regular expression <i class="arg">regexp</i> defaults to &quot;[ \\t]+&quot;.</p></dd>
<dt><a name="3"><b class="cmd">::textutil::trim::trimright</b> <i class="arg">string</i> <span class="opt">?<i class="arg">regexp</i>?</span></a></dt>
<dd><p>Remove in <i class="arg">string</i> any trailing substring according to the regular
expression <i class="arg">regexp</i> and return the result as a new string. This
apply on any <em>line</em> in the string, that is any substring between
2 newline chars, or between the beginning of the string and a newline,
or between a newline and the end of the string, or, if the string
contain no newline, between the beginning and the end of the string.
The regular expression <i class="arg">regexp</i> defaults to &quot;[ \\t]+&quot;.</p></dd>
<dt><a name="4"><b class="cmd">::textutil::trim::trimPrefix</b> <i class="arg">string</i> <i class="arg">prefix</i></a></dt>
<dd><p>Removes the <i class="arg">prefix</i> from the beginning of <i class="arg">string</i> and
returns the result. The <i class="arg">string</i> is left unchanged if it doesn't
have <i class="arg">prefix</i> at its beginning.</p></dd>
<dt><a name="5"><b class="cmd">::textutil::trim::trimEmptyHeading</b> <i class="arg">string</i></a></dt>
<dd><p>Looks for empty lines (including lines consisting of only whitespace)
at the beginning of the <i class="arg">string</i> and removes it. The modified
string is returned as the result of the command.</p></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>textutil</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>regexp(n), split(n), string(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key640">prefix</a>, <a href="../../../../index.html#key281">regular expression</a>, <a href="../../../../index.html#key239">string</a>, <a href="../../../../index.html#key380">trimming</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/tie/tie.html.


























































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>tie - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/tie/tie.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004-2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tie.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tie(n) 1.1 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tie - Array persistence</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">USING TIES</a>
<ul>
<li class="subsection"><a href="#subsection1">TIE API</a></li>
<li class="subsection"><a href="#subsection2">STANDARD DATA SOURCE TYPES</a></li>
</ul>
</li>
<li class="section"><a href="#section3">CREATING NEW DATA SOURCES</a>
<ul>
<li class="subsection"><a href="#subsection3">DATA SOURCE OBJECTS</a></li>
<li class="subsection"><a href="#subsection4">REGISTERING A NEW DATA SOURCE CLASS</a></li>
<li class="subsection"><a href="#subsection5">DATA SOURCE CLASS</a></li>
<li class="subsection"><a href="#subsection6">DATA SOURCE OBJECT API</a></li>
</ul>
</li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">tie <span class="opt">?1.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tie::tie</b> <i class="arg">arrayvarname</i> <i class="arg">options</i>... <i class="arg">dstype</i> <i class="arg">dsname</i>...</a></li>
<li><a href="#2"><b class="cmd">::tie::untie</b> <i class="arg">arrayvarname</i> <span class="opt">?<i class="arg">token</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::tie::info</b> <b class="method">ties</b> <i class="arg">arrayvarname</i></a></li>
<li><a href="#4"><b class="cmd">::tie::info</b> <b class="method">types</b></a></li>
<li><a href="#5"><b class="cmd">::tie::info</b> <b class="method">type</b> <i class="arg">dstype</i></a></li>
<li><a href="#6"><b class="cmd">::tie::register</b> <i class="arg">dsclasscmd</i> <b class="const">as</b> <i class="arg">dstype</i></a></li>
<li><a href="#7"><b class="cmd">dsclasscmd</b> <i class="arg">objname</i> <span class="opt">?<i class="arg">dsname</i>...?</span></a></li>
<li><a href="#8"><b class="cmd">ds</b> <b class="method">destroy</b></a></li>
<li><a href="#9"><b class="cmd">ds</b> <b class="method">names</b></a></li>
<li><a href="#10"><b class="cmd">ds</b> <b class="method">size</b></a></li>
<li><a href="#11"><b class="cmd">ds</b> <b class="method">get</b></a></li>
<li><a href="#12"><b class="cmd">ds</b> <b class="method">set</b> <i class="arg">dict</i></a></li>
<li><a href="#13"><b class="cmd">ds</b> <b class="method">unset</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></li>
<li><a href="#14"><b class="cmd">ds</b> <b class="method">setv</b> <i class="arg">index</i> <i class="arg">value</i></a></li>
<li><a href="#15"><b class="cmd">ds</b> <b class="method">unsetv</b> <i class="arg">index</i></a></li>
<li><a href="#16"><b class="cmd">ds</b> <b class="method">getv</b> <i class="arg">index</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tie</b> package provides a framework for the creation of
persistent Tcl array variables. It should be noted that the provided
mechanism is generic enough to also allow its usage for the
distribution of the contents of Tcl arrays over multiple threads and
processes, i.e. communication.</p>
<p>This, persistence and communication, is accomplished by <i class="term">tying</i>)
a Tcl array variable to a <i class="term"><a href="../../../../index.html#key331">data source</a></i>. Examples of data
sources are other Tcl arrays and files.</p>
<p>It should be noted that a single Tcl array variable can be tied to
more than one <i class="term"><a href="../../../../index.html#key331">data source</a></i>. It is this feature which allows
the framework to be used for communication as well. Just tie several
Tcl arrays in many client processes to a Tcl array in a server and all
changes to any of them will be distributed to all. Less centralized
variants of this are of course possible as well.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">USING TIES</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">TIE API</a></h3>
<p>This section describes the basic API used to establish and remove ties
between Tcl array variables and data sources. This interface is the
only one a casual user has to be concerned about. The following
sections about the various internal interfaces can be safely skipped.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tie::tie</b> <i class="arg">arrayvarname</i> <i class="arg">options</i>... <i class="arg">dstype</i> <i class="arg">dsname</i>...</a></dt>
<dd><p>This command establishes a tie between the Tcl array whose name is
provided by the argument <i class="arg">arrayvarname</i> and the
<i class="term"><a href="../../../../index.html#key331">data source</a></i> identified by the <i class="arg">dstype</i> and its series of
<i class="arg">dsname</i> arguments. All changes made to the Tcl array after this
command returns will be saved to the <i class="term"><a href="../../../../index.html#key331">data source</a></i> for
safekeeping (or distribution).</p>
<p>The result of the command is always a token which identifies the new
tie. This token can be used later to destroy this specific tie.</p>
<dl class="arguments">
<dt>varname <i class="arg">arrayvarname</i> (in)</dt>
<dd><p>The name of the Tcl array variable to connect the new tie to.</p></dd>
<dt>name|command <i class="arg">dstype</i> (in)</dt>
<dd><p>This argument specifies the type of the <i class="term"><a href="../../../../index.html#key331">data source</a></i> we wish
to access.
The <i class="arg">dstype</i> can be one of <b class="const">log</b>, <b class="const">array</b>,
<b class="const">remotearray</b>, <b class="const">file</b>, <b class="const">growfile</b>, or
<b class="const">dsource</b>; in addition, the programmer can register additional
data source types.
Each <i class="arg">dstype</i> is followed by one or more arguments that identify
the <i class="term"><a href="../../../../index.html#key331">data source</a></i> to which the array is to be tied.</p></dd>
<dt>string <i class="arg">dsname</i> (in)</dt>
<dd><p>The series of <i class="arg">dsname</i> arguments coming after the <i class="arg">dstype</i>
identifies the <i class="term"><a href="../../../../index.html#key331">data source</a></i> we wish to connect to, and has to
be appropriate for the chosen type.</p></dd>
</dl>
<p>The command understands a number of additional options which guide the
process of setting up the connection between Tcl array and
<i class="term"><a href="../../../../index.html#key331">data source</a></i>.</p>
<dl class="options">
<dt><b class="option">-open</b></dt>
<dd><p>The Tcl array for the new tie is <i class="term">loaded</i> from the
<i class="term"><a href="../../../../index.html#key331">data source</a></i>, and the previously existing contents of the Tcl
array are erased. Care is taken to <em>not</em> erase the previous
contents should the creation of the tie fail.</p>
<p>This option and the option <b class="option">-save</b> exclude each other. If
neither this nor option <b class="option">-save</b> are specified then this option
is assumed as default.</p></dd>
<dt><b class="option">-save</b></dt>
<dd><p>The Tcl array for the new tie is <i class="term">saved</i> to the
<i class="term"><a href="../../../../index.html#key331">data source</a></i>, and the previously existing contents of the
<i class="term"><a href="../../../../index.html#key331">data source</a></i> are erased.</p>
<p>This option and the option <b class="option">-open</b> exclude each other. If
neither this nor option <b class="option">-open</b> are specified then option
<b class="option">-open</b> is assumed as default.</p></dd>
<dt><b class="option">-merge</b></dt>
<dd><p>Using this option prevents the erasure of any previously existing
content and merges the data instead. It can be specified in
conjunction with either <b class="option">-open</b> or <b class="option">-save</b>. They
determine how data existing in both Tcl array and
<i class="term"><a href="../../../../index.html#key331">data source</a></i>, i.e duplicates, are dealt with.</p>
<p>When used with <b class="option">-open</b> data in the <i class="term"><a href="../../../../index.html#key331">data source</a></i> has
precedence.
In other words, for duplicates the data in the <i class="term"><a href="../../../../index.html#key331">data source</a></i> is
loaded into the Tcl array.</p>
<p>When used with <b class="option">-save</b> data in the Tcl array has precedence. In
other words, for duplicates the data in the Tcl array is saved into
the <i class="term"><a href="../../../../index.html#key331">data source</a></i>.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::tie::untie</b> <i class="arg">arrayvarname</i> <span class="opt">?<i class="arg">token</i>?</span></a></dt>
<dd><p>This command dissolves one or more ties associated with the Tcl array
named by <i class="arg">arrayvarname</i>. If no <i class="arg">token</i> is specified then all
ties to that Tcl array are dissolved. Otherwise only the tie the token
stands for is removed, if it is actually connected to the
array. Trying to remove a specific tie not belonging to the provided
array will cause an error.</p>
<p>It should be noted that while severing a tie will destroy management
information internal to the package the <i class="term"><a href="../../../../index.html#key331">data source</a></i> which was
handled by the tie will not be touched, only closed.</p>
<p>After the command returns none of changes made to the array will be
saved to the <i class="term"><a href="../../../../index.html#key331">data source</a></i> anymore.</p>
<p>The result of the command is an empty string.</p>
<dl class="arguments">
<dt>varname <i class="arg">arrayname</i> (in)</dt>
<dd><p>The name of a Tcl array variable which may have ties.</p></dd>
<dt>handle <i class="arg">token</i> (in)</dt>
<dd><p>A handle representing a specific tie. This argument is optional.</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::tie::info</b> <b class="method">ties</b> <i class="arg">arrayvarname</i></a></dt>
<dd><p>This command returns a list of ties associated with the Tcl array
variable named by <i class="arg">arrayvarname</i>. The result list will be empty if
the variable has no ties associated with it.</p></dd>
<dt><a name="4"><b class="cmd">::tie::info</b> <b class="method">types</b></a></dt>
<dd><p>This command returns a dictionary of registered types, and the class
commands they are associated with.</p></dd>
<dt><a name="5"><b class="cmd">::tie::info</b> <b class="method">type</b> <i class="arg">dstype</i></a></dt>
<dd><p>This command returns the fully resolved class command for a type
name. This means that the command will follow a chain of type
definitions ot its end.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">STANDARD DATA SOURCE TYPES</a></h3>
<p>This package provides the six following types as examples and standard
data sources.</p>
<dl class="definitions">
<dt><b class="const">log</b></dt>
<dd><p>This <i class="term"><a href="../../../../index.html#key331">data source</a></i> does not maintain any actual data, nor
persistence. It does not accept any identifying arguments. All changes
are simply logged to <b class="const">stdout</b>.</p></dd>
<dt><b class="const">array</b></dt>
<dd><p>This <i class="term"><a href="../../../../index.html#key331">data source</a></i> uses a regular Tcl array as the origin of
the persistent data. It accepts a single identifying argument, the
name of this Tcl array. All changes are mirrored to that array.</p></dd>
<dt><b class="const">remotearray</b></dt>
<dd><p>This <i class="term"><a href="../../../../index.html#key331">data source</a></i> is similar to <b class="const">array</b>. The difference
is that the Tcl array to which we are mirroring is not directly
accessible, but through a <b class="cmd"><a href="../../../../index.html#key312">send</a></b>-like command.</p>
<p>It accepts three identifying arguments, the name of the other Tcl
array, the command prefix for the <b class="cmd"><a href="../../../../index.html#key312">send</a></b>-like accessor command,
and an identifier for the remote entity hosting the array, in this
order. All changes are mirrored to that array, via the command
prefix. All commands will be executed in the context of the global
namespace.</p>
<p><b class="cmd"><a href="../../../../index.html#key312">send</a></b>-like means that the command prefix has to have <b class="cmd"><a href="../../../../index.html#key312">send</a></b>
syntax and semantics. I.e. it is a channel over which we can send
arbitrary commands to some other entity.
The remote array <i class="term"><a href="../../../../index.html#key331">data source</a></i> however uses only the commands
<b class="cmd"><a href="../../../../index.html#key253">set</a></b>, <b class="cmd">unset</b>, <b class="cmd">array exists</b>, <b class="cmd">array names</b>, <b class="cmd">array set</b>, and
<b class="cmd">array get</b> to retrieve and set values in the remote array.</p>
<p>The command prefix and the entity id are separate to allow the data
source to use options like <b class="option">-async</b> when assembling the actual
commands.</p>
<p>Examples of command prefixes, listed with the id of the remote entity,
without options. In reality only the part before the id is the command
prefix:</p>
<dl class="definitions">
<dt><b class="cmd"><a href="../../../../index.html#key312">send</a></b> <i class="arg">tkname</i></dt>
<dd><p>The Tcl array is in a remote interpreter and is accessed via Tk's X
communication.</p></dd>
<dt><b class="cmd">comm::comm send</b> <i class="arg">hostportid</i></dt>
<dd><p>The Tcl array is in a remote interpreter and is accessed through a
socket.</p></dd>
<dt><b class="cmd">thread::send</b> <i class="arg">threadid</i></dt>
<dd><p>The Tcl array is in a remote interpreter in a different thread of this
process.</p></dd>
</dl></dd>
<dt><b class="const">file</b></dt>
<dd><p>This <i class="term"><a href="../../../../index.html#key331">data source</a></i> uses a single file as origin of the
persistent data. It accepts a single identifying argument, the path to
this file. The file has to be both readable and writable. It may not
exist, the <i class="term"><a href="../../../../index.html#key331">data source</a></i> will create it in that case. This (and
only this) situation will require that the directory for the file
exists and is writable as well.</p>
<p>All changes are saved in the file, as proper Tcl commands, one command
per operation. In other words, the file will always contain a proper
Tcl script.</p>
<p>If the file exists when the tie using it is set up, then it will be
compacted, i.e. superfluous operations are removed, if the operations
log stored in it contains either at least one operation clearing the
whole array, or at least 1.5 times more operations than entries in the
loaded array.</p></dd>
<dt><b class="const">growfile</b></dt>
<dd><p>This <i class="term"><a href="../../../../index.html#key331">data source</a></i> is like <b class="const">file</b> in terms of the storage
medium for the array data, and how it is configured. In constrast to
the former it however assumes and ensures that the tied array will
never shrink. I.e. the creation of new array entries, and the
modification of existing entries is allowed, but the deletion of
entries is not, and causes the data source to throw errors.</p>
<p>This restriction allows us to simplify both file format and access to
the file radically. For one, the file is read only once and the
internal cache cannot be invalidated. Second, writing data is reduced
to a simple append, and no compaction step is necessary. The format of
the contents is the string representation of a dictionary which can be
incrementally extended forever at the end.</p></dd>
<dt><b class="const">dsource</b></dt>
<dd><p>This <i class="term"><a href="../../../../index.html#key331">data source</a></i> uses an explicitly specified
<i class="term">data source object</i> as the source for the persistent
data. It accepts a single identifying argument, the command prefix,
i.e. object command.</p>
<p>To use this type it is necessary to know how the framework manages
ties and what <span class="sectref"><a href="#subsection3">data source objects</a></span> are.</p>
<p>All changes are delegated to the specified object.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">CREATING NEW DATA SOURCES</a></h2>
<p>This section is of no interest to the casual user of ties. Only
developers wishing to create new data sources have to know the
information provided herein.</p>
<div id="subsection3" class="subsection"><h3><a name="subsection3">DATA SOURCE OBJECTS</a></h3>
<p>All ties are represented internally by an in-memory object which
mediates between the tie framework and the specific
<i class="term"><a href="../../../../index.html#key331">data source</a></i>, like an array, file, etc.
This is the <i class="term">data source object</i>.</p>
<p>Its class, the <span class="sectref"><a href="#subsection5">data source class</a></span> is <em>not</em> generic,
but specific to the type of the <i class="term"><a href="../../../../index.html#key331">data source</a></i>. Writing a new
<i class="term"><a href="../../../../index.html#key331">data source</a></i> requires us to write such a class, and then
registering it with the framework as a new type.</p>
<p>The following subsections describe the various APIs a
<span class="sectref"><a href="#subsection5">data source class</a></span> and the objects it generates will have
to follow to be compatible with the tie framework.</p>
<p>Data source objects are normally automatically created and destroyed
by the framework when a tie is created, or removed. This management
can be explicitly bypassed through the usage of the &quot;dsource&quot; type.
The <i class="term"><a href="../../../../index.html#key331">data source</a></i> for this type is a
<i class="term">data source object</i> itself, and this object is outside of the
scope of the tie framework and not managed by it.
In other words, this type allows the creation of ties which talk to
pre-existing <i class="term">data source object</i>s, and these objects will
survive the removal of the ties using them as well.</p>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">REGISTERING A NEW DATA SOURCE CLASS</a></h3>
<p>After a <span class="sectref"><a href="#subsection5">data source class</a></span> has been written it is necessary
to register it as a new type with the framework.</p>
<dl class="definitions">
<dt><a name="6"><b class="cmd">::tie::register</b> <i class="arg">dsclasscmd</i> <b class="const">as</b> <i class="arg">dstype</i></a></dt>
<dd><p>Using this command causes the tie framework to remember the class
command <i class="arg">dsclasscmd</i> of a <span class="sectref"><a href="#subsection5">data source class</a></span> under the
type name <i class="arg">dstype</i>.</p>
<p>After the call the argument <i class="arg">dstype</i> of the basic user command
<b class="cmd">::tie::tie</b> will accept <i class="arg">dstype</i> as a type name and translate
it internally to the appropriate class command for the creation of
<span class="sectref"><a href="#subsection3">data source objects</a></span> for the new <i class="term"><a href="../../../../index.html#key331">data source</a></i>.</p></dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">DATA SOURCE CLASS</a></h3>
<p>Each data source class is represented by a single command, also called
the <i class="term">class command</i>, or <i class="term">object creation command</i>. Its
syntax is</p>
<dl class="definitions">
<dt><a name="7"><b class="cmd">dsclasscmd</b> <i class="arg">objname</i> <span class="opt">?<i class="arg">dsname</i>...?</span></a></dt>
<dd><p>The first argument of the class command is the name of the
<i class="term">data source object</i> to create.
The framework itself will always supply the string <b class="const">%AUTO%</b>, to
signal that the class command has to generate not only the object, but
the object name as well.</p>
<p>This is followed by a series of arguments identifying the data source
the new object is for. These are the same <i class="arg">dsname</i> arguments which
are given to the basic user command <b class="cmd">::tie::tie</b>. Their actual
meaning is dependent on the <i class="term">data source class</i>.</p>
<p>The result of the class command has to be the fully-qualified name of
the new <i class="term">data source object</i>, i.e. the name of the
<i class="term">object command</i>.
The interface this command has to follow is described in the section
<span class="sectref"><a href="#subsection6">DATA SOURCE OBJECT API</a></span></p></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">DATA SOURCE OBJECT API</a></h3>
<p>Please read the section <span class="sectref"><a href="#subsection5">DATA SOURCE CLASS</a></span> first, to know
how to generate new <i class="term">object commands</i>.</p>
<p>Each <i class="term">object command</i> for a <i class="term"><a href="../../../../index.html#key331">data source</a></i> object has to
provide at least the methods listed below for proper inter-operation
with the tie framework. Note that the names of most of the methods
match the subcommands of the builtin <b class="cmd"><a href="../../../../index.html#key37">array</a></b> command.</p>
<dl class="definitions">
<dt><a name="8"><b class="cmd">ds</b> <b class="method">destroy</b></a></dt>
<dd><p>This method is called when the object <b class="cmd">ds</b> is destroyed. It now
has to release all its internal resources associated with the external
data source.</p></dd>
<dt><a name="9"><b class="cmd">ds</b> <b class="method">names</b></a></dt>
<dd><p>This command has to return a list containing the names of all keys
found in the <i class="term"><a href="../../../../index.html#key331">data source</a></i> the object talks to. This is
equivalent to <b class="cmd">array names</b>.</p></dd>
<dt><a name="10"><b class="cmd">ds</b> <b class="method">size</b></a></dt>
<dd><p>This command has to return an integer number specifying the number of
keys found in the <i class="term"><a href="../../../../index.html#key331">data source</a></i> the object talks to. This is
equivalent to <b class="cmd">array size</b>.</p></dd>
<dt><a name="11"><b class="cmd">ds</b> <b class="method">get</b></a></dt>
<dd><p>This command has to return a dictionary containing the data found in
the <i class="term"><a href="../../../../index.html#key331">data source</a></i> the object talks to. This is equivalent to
<b class="cmd">array get</b>.</p></dd>
<dt><a name="12"><b class="cmd">ds</b> <b class="method">set</b> <i class="arg">dict</i></a></dt>
<dd><p>This command takes a dictionary and adds its contents to the data
source the object talks to. This is equivalent to <b class="cmd">array set</b>.</p></dd>
<dt><a name="13"><b class="cmd">ds</b> <b class="method">unset</b> <span class="opt">?<i class="arg">pattern</i>?</span></a></dt>
<dd><p>This command takes a pattern and removes all elements whose keys
matching it from the <i class="term"><a href="../../../../index.html#key331">data source</a></i>. If no pattern is specified
it defaults to <b class="const">*</b>, causing the removal of all elements. This
is nearly equivalent to <b class="cmd">array unset</b>.</p></dd>
<dt><a name="14"><b class="cmd">ds</b> <b class="method">setv</b> <i class="arg">index</i> <i class="arg">value</i></a></dt>
<dd><p>This command has to save the <i class="arg">value</i> in the <i class="term"><a href="../../../../index.html#key331">data source</a></i>
the object talks to, under the key <i class="arg">index</i>.</p>
<p>The result of the command is ignored. If an error is thrown then this
error will show up as error of the set operation which caused the
method call.</p></dd>
<dt><a name="15"><b class="cmd">ds</b> <b class="method">unsetv</b> <i class="arg">index</i></a></dt>
<dd><p>This command has to remove the value under the key <i class="arg">index</i> from
the <i class="term"><a href="../../../../index.html#key331">data source</a></i> the object talks to.</p>
<p>The result of the command is ignored. If an error is thrown then this
error will show up as error of the unset operation which caused the
method call.</p></dd>
<dt><a name="16"><b class="cmd">ds</b> <b class="method">getv</b> <i class="arg">index</i></a></dt>
<dd><p>This command has to return the value for the key <i class="arg">index</i> in the
<i class="term"><a href="../../../../index.html#key331">data source</a></i> the object talks to.</p></dd>
</dl>
<p>And here a small table comparing the <i class="term"><a href="../../../../index.html#key331">data source</a></i> methods to
the regular Tcl commands for accessing an array.</p>
<pre class="example">
        Regular Tcl             Data source
        -----------             -----------
        array names a           ds names
        array size  a           ds size
        array get   a           ds get
        array set   a dict      ds set   dict
        array unset a pattern   ds unset ?pattern?
        -----------             -----------
        set a($idx) $val        ds setv   idx val
        unset a($idx)           ds unsetv idx
        $a($idx)                ds getv   idx
        -----------             -----------
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>tie</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key37">array</a>, <a href="../../../../index.html#key32">database</a>, <a href="../../../../index.html#key31">file</a>, <a href="../../../../index.html#key36">metakit</a>, <a href="../../../../index.html#key33">persistence</a>, <a href="../../../../index.html#key35">tie</a>, <a href="../../../../index.html#key34">untie</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004-2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/tie/tie_std.html.


































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>tie - Tcl Data Structures</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/tie/tie_std.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tie.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tie(n) 1.1 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tie - Array persistence, standard data sources</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">tie::std::log <span class="opt">?1.1?</span></b></li>
<li>package require <b class="pkgname">tie::std::array <span class="opt">?1.1?</span></b></li>
<li>package require <b class="pkgname">tie::std::rarray <span class="opt">?1.1?</span></b></li>
<li>package require <b class="pkgname">tie::std::file <span class="opt">?1.1?</span></b></li>
<li>package require <b class="pkgname">tie::std::growfile <span class="opt">?1.1?</span></b></li>
<li>package require <b class="pkgname">tie::std::dsource <span class="opt">?1.1?</span></b></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The packages listed as requirements for this document are internal
packages providing the standard data sources of package <b class="package"><a href="tie.html">tie</a></b>,
as described in section <i class="term">STANDARD DATA SOURCE TYPES</i> of
<b class="package"><a href="tie.html">tie</a></b>'s documentation.</p>
<p>They are automatically loaded and registered by <b class="package"><a href="tie.html">tie</a></b> when it
itself is requested, and as such there is no need to request them on
their own, although it is possible to do so.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the packages it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>tie</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key37">array</a>, <a href="../../../../index.html#key32">database</a>, <a href="../../../../index.html#key31">file</a>, <a href="../../../../index.html#key36">metakit</a>, <a href="../../../../index.html#key33">persistence</a>, <a href="../../../../index.html#key35">tie</a>, <a href="../../../../index.html#key34">untie</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/tiff/tiff.html.




































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>tiff - TIFF image manipulation</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/tiff/tiff.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2005-2006, Aaron Faupell &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tiff.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tiff(n) 0.2.1 tcllib &quot;TIFF image manipulation&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tiff - TIFF reading, writing, and querying and manipulation of meta data</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">VARIABLES</a></li>
<li class="section"><a href="#section4">LIMITATIONS</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">tiff <span class="opt">?0.2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tiff::isTIFF</b> <i class="arg">file</i></a></li>
<li><a href="#2"><b class="cmd">::tiff::byteOrder</b> <i class="arg">file</i></a></li>
<li><a href="#3"><b class="cmd">::tiff::numImages</b> <i class="arg">file</i></a></li>
<li><a href="#4"><b class="cmd">::tiff::dimensions</b> <i class="arg">file</i> <span class="opt">?image?</span></a></li>
<li><a href="#5"><b class="cmd">::tiff::imageInfo</b> <i class="arg">file</i> <span class="opt">?image?</span></a></li>
<li><a href="#6"><b class="cmd">::tiff::entries</b> <i class="arg">file</i> <span class="opt">?image?</span></a></li>
<li><a href="#7"><b class="cmd">::tiff::getEntry</b> <i class="arg">file</i> <i class="arg">entry</i> <span class="opt">?image?</span></a></li>
<li><a href="#8"><b class="cmd">::tiff::addEntry</b> <i class="arg">file</i> <i class="arg">entry</i> <span class="opt">?image?</span></a></li>
<li><a href="#9"><b class="cmd">::tiff::deleteEntry</b> <i class="arg">file</i> <i class="arg">entry</i> <span class="opt">?image?</span></a></li>
<li><a href="#10"><b class="cmd">::tiff::getImage</b> <i class="arg">file</i> <span class="opt">?image?</span></a></li>
<li><a href="#11"><b class="cmd">::tiff::writeImage</b> <i class="arg">image</i> <i class="arg">file</i> <span class="opt">?entry?</span></a></li>
<li><a href="#12"><b class="cmd">::tiff::nametotag</b> <i class="arg">names</i></a></li>
<li><a href="#13"><b class="cmd">::tiff::tagtoname</b> <i class="arg">tags</i></a></li>
<li><a href="#14"><b class="cmd">::tiff::debug</b> <i class="arg">file</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides commands to query, modify, read, and write TIFF images.
TIFF stands for <i class="term">Tagged Image File Format</i> and is a standard
for lossless storage of photographical images and associated metadata.
It is specified at <a href="http://partners.adobe.com/public/developer/tiff/index.html">http://partners.adobe.com/public/developer/tiff/index.html</a>.</p>
<p>Multiple images may be stored in a single TIFF file. The <span class="opt">?image?</span> options to the functions
in this package are for accessing images other than the first. Data in a TIFF image is
stored as a series of tags having a numerical value, which are represented in either a 4 digit
hexadecimal format or a string name. For a reference on defined tags and their meanings see
<a href="http://www.awaresystems.be/imaging/tiff/tifftags.html">http://www.awaresystems.be/imaging/tiff/tifftags.html</a></p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tiff::isTIFF</b> <i class="arg">file</i></a></dt>
<dd><p>Returns a boolean value indicating if <i class="arg">file</i> is a
TIFF image.</p></dd>
<dt><a name="2"><b class="cmd">::tiff::byteOrder</b> <i class="arg">file</i></a></dt>
<dd><p>Returns either <b class="const">big</b> or <b class="const">little</b>.
Throws an error if <i class="arg">file</i> is not a TIFF image.</p></dd>
<dt><a name="3"><b class="cmd">::tiff::numImages</b> <i class="arg">file</i></a></dt>
<dd><p>Returns the number of images in <i class="arg">file</i>.
Throws an error if <i class="arg">file</i> is not a TIFF image.</p></dd>
<dt><a name="4"><b class="cmd">::tiff::dimensions</b> <i class="arg">file</i> <span class="opt">?image?</span></a></dt>
<dd><p>Returns the dimensions of image number <span class="opt">?image?</span> in <i class="arg">file</i> as a list of the
horizontal and vertical pixel count.
Throws an error if <i class="arg">file</i> is not a TIFF image.</p></dd>
<dt><a name="5"><b class="cmd">::tiff::imageInfo</b> <i class="arg">file</i> <span class="opt">?image?</span></a></dt>
<dd><p>Returns a dictionary with keys <b class="const">ImageWidth</b>, <b class="const">ImageLength</b>,
<b class="const">BitsPerSample</b>, <b class="const">Compression</b>, <b class="const">PhotometricInterpretation</b>,
<b class="const">ImageDescription</b>, <b class="const">Orientation</b>, <b class="const">XResolution</b>,
<b class="const">YResolution</b>, <b class="const">ResolutionUnit</b>, <b class="const">DateTime</b>, <b class="const">Artist</b>,
and <b class="const">HostComputer</b>. The values are the associated properties of
the TIFF <span class="opt">?image?</span> in <i class="arg">file</i>. Values may be empty if the associated tag is not
present in the file.</p>
<pre class="example">
    puts [::tiff::imageInfo photo.tif]
    ImageWidth 686 ImageLength 1024 BitsPerSample {8 8 8} Compression 1
    PhotometricInterpretation 2 ImageDescription {} Orientation 1
    XResolution 170.667 YResolution 170.667 ResolutionUnit 2 DateTime {2005:12:28 19:44:45}
    Artist {} HostComputer {}
</pre>
<p>There is nothing special about these tags, this is simply a convience procedure which calls
<b class="cmd">getEntry</b> with common entries.
Throws an error if <i class="arg">file</i> is not a TIFF image.</p></dd>
<dt><a name="6"><b class="cmd">::tiff::entries</b> <i class="arg">file</i> <span class="opt">?image?</span></a></dt>
<dd><p>Returns a list of all entries in the given <i class="arg">file</i> and <span class="opt">?image?</span>
in hexadecimal format.
Throws an error if <i class="arg">file</i> is not a TIFF image.</p></dd>
<dt><a name="7"><b class="cmd">::tiff::getEntry</b> <i class="arg">file</i> <i class="arg">entry</i> <span class="opt">?image?</span></a></dt>
<dd><p>Returns the value of <i class="arg">entry</i> from image <span class="opt">?image?</span> in the TIFF <i class="arg">file</i>.
<i class="arg">entry</i> may be a list of multiple entries. If an entry does not exist, an
empty string is returned</p>
<pre class="example">
    set data [::tiff::getEntry photo.tif {0131 0132}]
    puts &quot;file was written at [lindex $data 0] with software [lindex $data 1]&quot;
</pre>
<p>Throws an error if <i class="arg">file</i> is not a TIFF image.</p></dd>
<dt><a name="8"><b class="cmd">::tiff::addEntry</b> <i class="arg">file</i> <i class="arg">entry</i> <span class="opt">?image?</span></a></dt>
<dd><p>Adds the specified entries to the image named by <span class="opt">?image?</span> (default 0), or optionally <b class="const">all</b>.
<i class="arg">entry</i> must be a list where each element is a list of tag, type, and value. If a tag already
exists, it is overwritten.</p>
<pre class="example">
    ::tiff::addEntry photo.tif {{010e 2 &quot;an example photo&quot;} {013b 2 &quot;Aaron F&quot;}}
</pre>
<p>The data types are defined as follows</p>
<dl class="definitions">
<dt><b class="const">1</b></dt>
<dd><p>BYTE (8 bit unsigned integer)</p></dd>
<dt><b class="const">2</b></dt>
<dd><p>ASCII</p></dd>
<dt><b class="const">3</b></dt>
<dd><p>SHORT (16 bit unsigned integer)</p></dd>
<dt><b class="const">4</b></dt>
<dd><p>LONG (32 bit unsigned integer)</p></dd>
<dt><b class="const">5</b></dt>
<dd><p>RATIONAL</p></dd>
<dt><b class="const">6</b></dt>
<dd><p>SBYTE (8 bit signed byte)</p></dd>
<dt><b class="const">7</b></dt>
<dd><p>UNDEFINED (uninterpreted binary data)</p></dd>
<dt><b class="const">8</b></dt>
<dd><p>SSHORT (signed 16 bit integer)</p></dd>
<dt><b class="const">9</b></dt>
<dd><p>SLONG (signed 32 bit integer)</p></dd>
<dt><b class="const">10</b></dt>
<dd><p>SRATIONAL</p></dd>
<dt><b class="const">11</b></dt>
<dd><p>FLOAT (32 bit floating point number)</p></dd>
<dt><b class="const">12</b></dt>
<dd><p>DOUBLE (64 bit floating point number)</p></dd>
</dl>
<p>Throws an error if <i class="arg">file</i> is not a TIFF image.</p></dd>
<dt><a name="9"><b class="cmd">::tiff::deleteEntry</b> <i class="arg">file</i> <i class="arg">entry</i> <span class="opt">?image?</span></a></dt>
<dd><p>Deletes the specified entries from the image named by <span class="opt">?image?</span> (default 0), or optionally <b class="const">all</b>.
Throws an error if <i class="arg">file</i> is not a TIFF image.</p></dd>
<dt><a name="10"><b class="cmd">::tiff::getImage</b> <i class="arg">file</i> <span class="opt">?image?</span></a></dt>
<dd><p>Returns the name of a Tk image containing the image at index <span class="opt">?image?</span> from <i class="arg">file</i>
Throws an error if <i class="arg">file</i> is not a TIFF image, or if image is an unsupported format.
Supported formats are uncompressed 24 bit RGB and uncompressed 8 bit palette.</p></dd>
<dt><a name="11"><b class="cmd">::tiff::writeImage</b> <i class="arg">image</i> <i class="arg">file</i> <span class="opt">?entry?</span></a></dt>
<dd><p>Writes the contents of the Tk image <i class="arg">image</i> to a tiff file <i class="arg">file</i>. Files are
written in the 24 bit uncompressed format, with big endian byte order. Additional entries
to be added to the image may be specified, in the same format as <b class="cmd">tiff::addEntry</b></p></dd>
<dt><a name="12"><b class="cmd">::tiff::nametotag</b> <i class="arg">names</i></a></dt>
<dd><p>Returns a list with <i class="arg">names</i> translated from string to 4 digit format. 4 digit names
in the input are passed through unchanged. Strings without a defined tag name will throw
an error.</p></dd>
<dt><a name="13"><b class="cmd">::tiff::tagtoname</b> <i class="arg">tags</i></a></dt>
<dd><p>Returns a list with <i class="arg">tags</i> translated from 4 digit to string format. If a tag does
not have a defined name it is passed through unchanged.</p></dd>
<dt><a name="14"><b class="cmd">::tiff::debug</b> <i class="arg">file</i></a></dt>
<dd><p>Prints everything we know about the given file in a nice format.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">VARIABLES</a></h2>
<p>The mapping of 4 digit tag names to string names uses the array ::tiff::tiff_tags. The reverse
mapping uses the array ::tiff::tiff_sgat.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">LIMITATIONS</a></h2>
<ol class="enumerated">
<li><p>Cannot write exif ifd</p></li>
<li><p>Reading limited to uncompressed 8 bit rgb and 8 bit palletized images</p></li>
<li><p>Writing limited to uncompressed 8 bit rgb</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>tiff</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key135">image</a>, <a href="../../../../index.html#key136">tif</a>, <a href="../../../../index.html#key134">tiff</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>File formats</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005-2006, Aaron Faupell &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/transfer/connect.html.




























































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>transfer::connect - Data transfer facilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/transfer/connect.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ transfer::connect.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">transfer::connect(n) 0.2 tcllib &quot;Data transfer facilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>transfer::connect - Connection setup</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
<li class="subsection"><a href="#subsection4">Options</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Secure connections</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">transfer::connect <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">transfer::connect</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">connect</b> <i class="arg">command</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects holding enough information to enable
them to either actively connect to a counterpart, or to passively wait
for a connection from said counterpart.
I.e. any object created by this packages is always in one of two
complementary modes, called <i class="term"><a href="../../../../index.html#key562">active</a></i> (the object initiates the
connection) and <i class="term"><a href="../../../../index.html#key564">passive</a></i> (the object receives the connection).</p>
<p>Of the two objects in a connecting pair one has to be configured for
<i class="term"><a href="../../../../index.html#key562">active</a></i> mode, and the other then has to be configured for
<i class="term"><a href="../../../../index.html#key564">passive</a></i> mode. This establishes which of the two partners
connects to whom (the <i class="term"><a href="../../../../index.html#key562">active</a></i> to the other), or, who is waiting
on whom (the <i class="term"><a href="../../../../index.html#key564">passive</a></i> on the other).
Note that this is completely independent of the direction of any data
transmission using the connection after it has been established.
An active object can, after establishing the connection, either
transmit or receive data. Equivalently the passive object can do the
same after the waiting for its partner has ended.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">transfer::connect</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command creates a new connection object with an associated Tcl
command whose name is <i class="arg">objectName</i>.
This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is explained in full detail in the sections
<span class="sectref"><a href="#subsection2">Object command</a></span> and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The set of
supported <i class="arg">options</i> is explained in section <span class="sectref"><a href="#subsection4">Options</a></span>.</p>
<p>The object command will be created under the current namespace if the
<i class="arg">objectName</i> is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::transfer::connect</b> command have the
following general form:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object. 
This is safe to do for an <i class="term"><a href="../../../../index.html#key562">active</a></i> object when a connection has
been started, as the completion callback is synchronous.
For a <i class="term"><a href="../../../../index.html#key564">passive</a></i> object currently waiting for its partner to
establish the connection however this is not safe and will cause
errors later on, when the connection setup completes and tries to
access the now missing data structures of the destroyed object.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">connect</b> <i class="arg">command</i></a></dt>
<dd><p>This method starts the connection setup per the configuration of the
object. When the connection is established the callback <i class="arg">command</i>
will be invoked with one additional argument, the channel handle of
the socket over which data can be transfered.</p>
<p>The detailed behaviour of the method depends on the configured
mode.</p>
<dl class="definitions">
<dt><i class="term"><a href="../../../../index.html#key562">active</a></i></dt>
<dd><p>The connection setup is done synchronously. The object waits until the
connection is established. The method returns the empty string as its
result.</p></dd>
<dt><i class="term"><a href="../../../../index.html#key564">passive</a></i></dt>
<dd><p>The connection setup is done asynchronously. The method returns
immediately after a listening socket has been set up. The connection
will be established in the background.
The method returns the port number of the listening socket, for use by
the caller. One important use is the transfer of this information to
the counterpart so that it knows where it has to connect to.</p>
<p>This is necessary as the object might have been configured for port
<b class="const">0</b>, allowing the operating system to choose the actual port it
will listen on.</p>
<p>The listening port is closed immediately when the connection was
established by the partner, to keep the time interval small within
which a third party can connect to the port too.
Even so it is recommended to use additional measures in the protocol
outside of the connect and transfer object to ensure that a connection
is not used with an unidentified/unauthorized partner
One possibility for this is the use of SSL/TLS.
See the option <b class="option">-socketcmd</b> and section
<span class="sectref"><a href="#section3">Secure connections</a></span> for information on how to do this.</p></dd>
</dl></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Options</a></h3>
<p>Connection objects support the set of options listed below.</p>
<dl class="options">
<dt><b class="option">-mode</b> <i class="arg">mode</i></dt>
<dd><p>This option specifies the mode the object is in. It is optional and
defaults to <b class="const">active</b> mode. The two possible modes are:</p>
<dl class="definitions">
<dt><b class="const">active</b></dt>
<dd><p>In this mode the two options <b class="option">-host</b> and <b class="option">-port</b> are
relevant and specify the host and TCP port the object has to connect
to. The host is given by either name or IP address.</p></dd>
<dt><b class="const">passive</b></dt>
<dd><p>In this mode the option <b class="option">-host</b> has no relevance and is ignored
should it be configured.
The only option the object needs is <b class="option">-port</b>, and it specifies
the TCP port on which the listening socket is opened to await the
connection from the partner.</p></dd>
</dl></dd>
<dt><b class="option">-host</b> <i class="arg">hostname-or-ipaddr</i></dt>
<dd><p>This option specifies the host to connect to in <i class="term"><a href="../../../../index.html#key562">active</a></i> mode,
either by name or ip-address. An object configured for <i class="term"><a href="../../../../index.html#key564">passive</a></i>
mode ignores this option.</p></dd>
<dt><b class="option">-port</b> <i class="arg">int</i></dt>
<dd><p>For <i class="term"><a href="../../../../index.html#key562">active</a></i> mode this option specifies the port the object is
expected to connect to. For <i class="term"><a href="../../../../index.html#key564">passive</a></i> mode however it is the port
where the object creates the listening socket waiting for a
connection. It defaults to <b class="const">0</b>, which allows the OS to choose
the actual port to listen on.</p></dd>
<dt><b class="option">-socketcmd</b> <i class="arg">command</i></dt>
<dd><p>This option allows the user to specify which command to use to open a
socket. The default is to use the builtin <b class="cmd">::socket</b>. Any
compatible with that command is allowed.</p>
<p>The envisioned main use is the specfication of <b class="cmd">tls::socket</b>. I.e.
this option allows the creation of secure transfer channels, without
making this package explicitly dependent on the <b class="package"><a href="../../../../index.html#key289">tls</a></b> package.</p>
<p>See also section <span class="sectref"><a href="#section3">Secure connections</a></span>.</p></dd>
<dt><b class="option">-encoding</b> encodingname</dt>
<dd></dd>
<dt><b class="option">-eofchar</b> eofspec</dt>
<dd></dd>
<dt><b class="option">-translation</b> transspec</dt>
<dd><p>These options are the same as are recognized by the builtin command
<b class="cmd">fconfigure</b>. They provide the configuration to be set for the
channel between the two partners after it has been established, but
before the callback is invoked (See method <b class="method">connect</b>).</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Secure connections</a></h2>
<p>One way to secure connections made by objects of this package is to
require the package <b class="package"><a href="../../../../index.html#key289">tls</a></b> and then configure the option
<b class="option">-socketcmd</b> to force the use of command <b class="cmd">tls::socket</b> to
open the socket.</p>
<pre class="example">
    # Load and initialize tls
    package require tls
    tls::init -cafile /path/to/ca/cert -keyfile ...
    # Create a connector with secure socket setup,
    transfer::connect C -socketcmd tls::socket ...
    ...
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>transfer</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key562">active</a>, <a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key563">connection</a>, <a href="../../../../index.html#key564">passive</a>, <a href="../../../../index.html#key315">secure</a>, <a href="../../../../index.html#key318">ssl</a>, <a href="../../../../index.html#key289">tls</a>, <a href="../../../../index.html#key60">transfer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Transfer module</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/transfer/copyops.html.































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>transfer::copy - Data transfer facilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/transfer/copyops.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ transfer::copy.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">transfer::copy(n) 0.2 tcllib &quot;Data transfer facilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>transfer::copy - Data transfer foundation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">transfer::copy <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">transfer::copy::do</b> <b class="const">chan</b>|<b class="const">string</b> <i class="arg">data</i> <i class="arg">outchannel</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">transfer::copy::chan</b> <i class="arg">channel</i> <i class="arg">outchannel</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">transfer::copy::string</b> <i class="arg">string</i> <i class="arg">outchannel</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#4"><b class="cmd">transfer::copy::doChan</b> <i class="arg">channel</i> <i class="arg">outchannel</i> <i class="arg">optvar</i></a></li>
<li><a href="#5"><b class="cmd">transfer::copy::doString</b> <i class="arg">string</i> <i class="arg">outchannel</i> <i class="arg">optvar</i></a></li>
<li><a href="#6"><b class="cmd">transfer::copy::options</b> <i class="arg">outchannel</i> <i class="arg">optionlist</i> <i class="arg">optvar</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a number of commands for the asynchronous of
information contained in either a string or channel. The main point of
this package is that the commands here provide a nicer callback API
than the builtin command <b class="cmd">fcopy</b>, making the use of these
facilities simpler than the builtin.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">transfer::copy::do</b> <b class="const">chan</b>|<b class="const">string</b> <i class="arg">data</i> <i class="arg">outchannel</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command transfers the information in <i class="arg">data</i> to the
<i class="arg">outchannel</i>, according to the <i class="arg">options</i>. The type of the
information in <i class="arg">data</i> is determined by the first argument.</p>
<p>The options available to this command are the same as are available to
the command <b class="cmd">transfer::copy::options</b>, and explained there.</p>
<dl class="definitions">
<dt><b class="const">chan</b></dt>
<dd><p>The argument <i class="arg">data</i> contains the handle of a channel and the
actual infomration to transfer is read from that channel.</p></dd>
<dt><b class="const">string</b></dt>
<dd><p>The argument <i class="arg">data</i> contains a string and this is the information
to be transfered.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">transfer::copy::chan</b> <i class="arg">channel</i> <i class="arg">outchannel</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command is a shorter and more direct form for the command
<b class="cmd">transfer::copy::do chan</b>.</p></dd>
<dt><a name="3"><b class="cmd">transfer::copy::string</b> <i class="arg">string</i> <i class="arg">outchannel</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command is a shorter and more direct form for the command
<b class="cmd">transfer::copy::do string</b>.</p></dd>
<dt><a name="4"><b class="cmd">transfer::copy::doChan</b> <i class="arg">channel</i> <i class="arg">outchannel</i> <i class="arg">optvar</i></a></dt>
<dd><p>This command is an alternate form of <b class="cmd">transfer::copy::chan</b> which
reads its options out of the array variable named by <i class="arg">optvar</i>
instead of from a variable length argument list.</p></dd>
<dt><a name="5"><b class="cmd">transfer::copy::doString</b> <i class="arg">string</i> <i class="arg">outchannel</i> <i class="arg">optvar</i></a></dt>
<dd><p>This command is an alternate form of <b class="cmd">transfer::copy::string</b> which
reads its options out of the array variable named by <i class="arg">optvar</i>
instead of from a variable length argument list.</p></dd>
<dt><a name="6"><b class="cmd">transfer::copy::options</b> <i class="arg">outchannel</i> <i class="arg">optionlist</i> <i class="arg">optvar</i></a></dt>
<dd><p>This command is the option processor used by all the commands above
which read their options from a variable length argument list. It
first reads default settings from the channel handle <i class="arg">outchannel</i>,
then processes the list of options in <i class="arg">optionlist</i>, at last stores
the results in the array variable named by <i class="arg">optvar</i>. The contents
of that variable are in a format which is directly understood by all
the commands above which read their options out of an array variable.</p>
<p>The recognized options are:</p>
<dl class="options">
<dt><b class="option">-blocksize</b> <i class="arg">int</i></dt>
<dd><p>This option specifies the size of the chunks to transfer in one
operation. It is optional and defaults to the value of
<b class="option">-buffersize</b> as configured for the output channel.</p>
<p>If specified its value has to be an integer number greater than zero.</p></dd>
<dt><b class="option">-command</b> <i class="arg">commandprefix</i></dt>
<dd><p>This option specifies the completion callback of the operation. This
option has to be specified. An error will be thrown if it is not, or
if the empty list was specified as argument to it.</p>
<p>Its value has to be a command prefix, i.e. a list whose first word is
the command to execute, followed by words containing fixed
arguments. When the callback is invoked one or two additional
arguments are appended to the prefix. The first argument is the number
of bytes which were transfered. The optional second argument is an
error message and added if and only if an error occured during the the
transfer.</p></dd>
<dt><b class="option">-progress</b> <i class="arg">commandprefix</i></dt>
<dd><p>This option specifies the progress callback of the operation. It is
optional and defaults to the empty list. This last possibility signals
that no feedback was asked for and disabled it.</p>
<p>Its value has to be a command prefix, see above, <b class="option">-command</b> for
a more detailed explanation. When the callback is invoked a single
additional arguments is appended to the prefix. This argument is the
number of bytes which were transfered so far.</p></dd>
<dt><b class="option">-size</b> <i class="arg">int</i></dt>
<dd><p>This option specifies the number of bytes to read from the input data
and transfer. It is optional and defaults to &quot;Transfer everything&quot;.
Its value has to be an integer number and any value less than zero has
the same meaning, i.e. to transfer all available data. Any other value
is the amount of bytes to transfer.</p>
<p>All transfer commands will throw error an when their user tries to
transfer more data than is available in the input. This happens
immediately, before the transfer is actually started, should the input
be a string. Otherwise the, i.e. for a channel as input, the error is
thrown the moment the underflow condition is actually detected.</p></dd>
<dt><b class="option">-encoding</b> <i class="arg">encodingname</i></dt>
<dd></dd>
<dt><b class="option">-eofchar</b> <i class="arg">eofspec</i></dt>
<dd></dd>
<dt><b class="option">-translation</b> <i class="arg">transspec</i></dt>
<dd><p>These options are the same as are recognized by the builtin command
<b class="cmd">fconfigure</b> and provide the settings for the output channel which
are to be active during the transfer, and only then. I.e. the settings
of the output channel before the transfer are saved, and restored at
the end of a transfer, regardless of its success or failure. None of
these options are required, and they default to the settings of the
output channel if not specified.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>transfer</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key61">copy</a>, <a href="../../../../index.html#key60">transfer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Transfer module</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/transfer/ddest.html.































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>transfer::data::destination - Data transfer facilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/transfer/ddest.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ transfer::data::destination.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">transfer::data::destination(n) 0.2 tcllib &quot;Data transfer facilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>transfer::data::destination - Data destination</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Object command</a></li>
<li class="subsection"><a href="#subsection2">Object methods</a></li>
<li class="subsection"><a href="#subsection3">Options</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">transfer::data::destination <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">transfer::data::destination</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">put</b> <i class="arg">chunk</i></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">done</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">valid</b> <i class="arg">msgvar</i></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">receive</b> <i class="arg">channel</i> <i class="arg">done</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects mainly describing the destination of a
data transfer. They are also able to initiate the reception of
information from a channel into the described destination.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">transfer::data::destination</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command creates a new data destination object with an associated
Tcl command whose name is <i class="arg">objectName</i>.
This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is explained in full detail in the sections
<span class="sectref"><a href="#subsection1">Object command</a></span> and <span class="sectref"><a href="#subsection2">Object methods</a></span>. The set of
supported <i class="arg">options</i> is explained in section <span class="sectref"><a href="#subsection3">Options</a></span>.</p>
<p>The object command will be created under the current namespace if the
<i class="arg">objectName</i> is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.</p></dd>
</dl>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Object command</a></h3>
<p>All objects created by the <b class="cmd">::transfer::data::destination</b> command
have the following general form:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection2">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object. Doing so while the object is busy
with the reception of information from a channel will cause errors
later on, when the reception completes and tries to access the now
missing data structures of the destroyed object.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">put</b> <i class="arg">chunk</i></a></dt>
<dd><p>The main receptor method. Saves the received <i class="arg">chunk</i> of data into
the configured destination. It has to be called for each piece of data
received.</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">done</b></a></dt>
<dd><p>The secondary receptor method. Finalizes the receiver. It has to be
called when the receiving channel signals EOF. Afterward neither
itself nor method <b class="method">put</b> can be called anymore.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">valid</b> <i class="arg">msgvar</i></a></dt>
<dd><p>This method checks the configuration of the object for validity. It
returns a boolean flag as result, whose value is <b class="const">True</b> if the
object is valid, and <b class="const">False</b> otherwise. In the latter case the
variable whose name is stored in <i class="arg">msgvar</i> is set to an error
message describing the problem found with the configuration. Otherwise
this variable is not touched.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">receive</b> <i class="arg">channel</i> <i class="arg">done</i></a></dt>
<dd><p>This method initiates the reception of data from the specified
<i class="arg">channel</i>. The received data will be stored into the configured
destination, via calls to the methods <b class="method">put</b> and <b class="method">done</b>.
When the reception completes the command prefix <i class="arg">done</i> is invoked,
with the number of received characters appended to it as the sole
additional argument.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Options</a></h3>
<p>All data destinations support the options listed below. It should be
noted that all are semi-exclusive, each specifying a different type of
destination and associated information. If these options are specified
more than once then the last option specified is used to actually
configure the object.</p>
<dl class="options">
<dt><b class="option">-channel</b> <i class="arg">handle</i></dt>
<dd><p>This option specifies that the destination of the data is a channel,
and its associated argument is the handle of the channel to write the
received data to.</p></dd>
<dt><b class="option">-file</b> <i class="arg">path</i></dt>
<dd><p>This option specifies that the destination of the data is a file, and
its associated argument is the path of the file to write the received
data to.</p></dd>
<dt><b class="option">-variable</b> <i class="arg">varname</i></dt>
<dd><p>This option specifies that the destination of the data is a variable,
and its associated argument contains the name of the variable to write
the received data to. The variable is assumed to be global or
namespaced, anchored at the global namespace.</p></dd>
<dt><b class="option">-progress</b> <i class="arg">command</i></dt>
<dd><p>This option, if specified, defines a command to be invoked for each
chunk of bytes received, allowing the user to monitor the progress of
the reception of the data. The callback is always invoked with one
additional argument, the number of bytes received so far.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>transfer</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key61">copy</a>, <a href="../../../../index.html#key58">data destination</a>, <a href="../../../../index.html#key60">transfer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Transfer module</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/transfer/dsource.html.































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>transfer::data::source - Data transfer facilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/transfer/dsource.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ transfer::data::source.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">transfer::data::source(n) 0.2 tcllib &quot;Data transfer facilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>transfer::data::source - Data source</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
<li class="subsection"><a href="#subsection4">Options</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">transfer::copy <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">transfer::data::source <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">transfer::data::source</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">type</b></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">data</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">size</b></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">valid</b> <i class="arg">msgvar</i></a></li>
<li><a href="#8"><i class="arg">objectName</i> <b class="method">transmit</b> <i class="arg">channel</i> <i class="arg">blocksize</i> <i class="arg">done</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects mainly describing the origin of some
data to transfer. They are also able to initiate transfers of the
described information to a channel using the foundation package
<b class="package"><a href="copyops.html">transfer::copy</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">transfer::data::source</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command creates a new data source object with an associated Tcl
command whose name is <i class="arg">objectName</i>.
This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is explained in full detail in the sections
<span class="sectref"><a href="#subsection2">Object command</a></span> and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The set of
supported <i class="arg">options</i> is explained in section <span class="sectref"><a href="#subsection4">Options</a></span>.</p>
<p>The object command will be created under the current namespace if the
<i class="arg">objectName</i> is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::transfer::data::source</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object. Doing so while a transfer initiated
by the object is active is safe as all data required for the transfer
itself was copied, and the completion of the transfer will not try to
access the initiating object anymore. i.e. the transfer is completely
separate from the source object itself.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">type</b></a></dt>
<dd><p>This method returns a string describing the type of the data the
object is refering to. The possible values and their meanings are:</p>
<dl class="definitions">
<dt><b class="const">undefined</b></dt>
<dd><p>No data was specified at all, or it was specified incompletely. The
object does not know the type.</p></dd>
<dt><b class="const">string</b></dt>
<dd><p>The data to transfer is contained in a string.</p></dd>
<dt><b class="const">channel</b></dt>
<dd><p>The data to transfer is contained in a channel.</p></dd>
</dl></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">data</b></a></dt>
<dd><p>This method returns a value depending on the type of the data the
object refers to, through which the data can be accessed.
The method throws an error if the type is <b class="const">undefined</b>. For type
<b class="const">string</b> the returned result is the data itself, whereas for
type <b class="const">channel</b> the returned result is the handle of the channel
containing the data.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">size</b></a></dt>
<dd><p>This method returns a value depending on the type of the data the
object refers to, the size of the data.
The method throws an error if the type is <b class="const">undefined</b>. Return of
a negative value signals that the object is unable to determine an
absolute size upfront (like for data in a channel).</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">valid</b> <i class="arg">msgvar</i></a></dt>
<dd><p>This method checks the configuration of the object for validity. It
returns a boolean flag as result, whose value is <b class="const">True</b> if the
object is valid, and <b class="const">False</b> otherwise. In the latter case the
variable whose name is stored in <i class="arg">msgvar</i> is set to an error
message describing the problem found with the configuration. Otherwise
this variable is not touched.</p></dd>
<dt><a name="8"><i class="arg">objectName</i> <b class="method">transmit</b> <i class="arg">channel</i> <i class="arg">blocksize</i> <i class="arg">done</i></a></dt>
<dd><p>This method initiates a transfer of the referenced data to the
specified <i class="arg">channel</i>.
When the transfer completes the command prefix <i class="arg">done</i> is invoked,
per the rules for the option <b class="option">-command</b> of command
<b class="cmd">transfer::copy::do</b> in the package <b class="package"><a href="copyops.html">transfer::copy</a></b>.
The <i class="arg">blocksize</i> specifies the size of the chunks to transfer in
one go. See the option <b class="option">-blocksize</b> of command
<b class="cmd">transfer::copy::do</b> in the package <b class="package"><a href="copyops.html">transfer::copy</a></b>.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Options</a></h3>
<p>All data sources support the options listed below. It should be noted
that the first four options are semi-exclusive, each specifying a
different type of data source and associated content. If these options
are specified more than once then the last option specified is used to
actually configure the object.</p>
<dl class="options">
<dt><b class="option">-string</b> <i class="arg">text</i></dt>
<dd><p>This option specifies that the source of the data is an immediate
string, and its associated argument contains the string in question.</p></dd>
<dt><b class="option">-channel</b> <i class="arg">handle</i></dt>
<dd><p>This option specifies that the source of the data is a channel, and
its associated argument is the handle of the channel containing the
data.</p></dd>
<dt><b class="option">-file</b> <i class="arg">path</i></dt>
<dd><p>This option specifies that the source of the data is a file, and its
associated argument is the path of the file containing the data.</p></dd>
<dt><b class="option">-variable</b> <i class="arg">varname</i></dt>
<dd><p>This option specifies that the source of the data is a string stored
in a variable, and its associated argument contains the name of the
variable in question. The variable is assumed to be global or
namespaced, anchored at the global namespace.</p></dd>
<dt><b class="option">-size</b> <i class="arg">int</i></dt>
<dd><p>This option specifies the size of the data transfer. It is optional
and defaults to -1. This value, and any other value less than zero
signals to transfer all the data from the source.</p></dd>
<dt><b class="option">-progress</b> <i class="arg">command</i></dt>
<dd><p>This option, if specified, defines a command to be invoked for each
chunk of bytes transmitted, allowing the user to monitor the progress
of the transmission of the data. The callback is always invoked with
one additional argument, the number of bytes transmitted so far.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>transfer</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key61">copy</a>, <a href="../../../../index.html#key331">data source</a>, <a href="../../../../index.html#key60">transfer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Transfer module</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/transfer/receiver.html.



































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>transfer::receiver - Data transfer facilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/transfer/receiver.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ transfer::receiver.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">transfer::receiver(n) 0.2 tcllib &quot;Data transfer facilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>transfer::receiver - Data source</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
<li class="subsection"><a href="#subsection4">Options</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Secure connections</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">transfer::data::destination <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">transfer::connect <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">transfer::receiver <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">transfer::receiver</b> <i class="arg">object</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">transfer::receiver</b> <b class="method">stream channel</b> <i class="arg">chan</i> <i class="arg">host</i> <i class="arg">port</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">transfer::receiver</b> <b class="method">stream file</b> <i class="arg">path</i> <i class="arg">host</i> <i class="arg">port</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">start</b></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">busy</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package pulls data destinations and connection setup together
into a combined object for the reception of information coming in over
a socket.
These objects understand all the options from objects created by the
packages <b class="package"><a href="ddest.html">transfer::data::destination</a></b> and
<b class="package"><a href="connect.html">transfer::connect</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">transfer::receiver</b> <i class="arg">object</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command creates a new receiver object with an associated Tcl
command whose name is <i class="arg">objectName</i>.
This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is explained in full detail in the sections
<span class="sectref"><a href="#subsection2">Object command</a></span> and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The set of
supported <i class="arg">options</i> is explained in section <span class="sectref"><a href="#subsection4">Options</a></span>.</p>
<p>The object command will be created under the current namespace if the
<i class="arg">objectName</i> is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.</p></dd>
<dt><a name="2"><b class="cmd">transfer::receiver</b> <b class="method">stream channel</b> <i class="arg">chan</i> <i class="arg">host</i> <i class="arg">port</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This method creates a fire-and-forget transfer for the data coming
from the source at host/port (details below) and writing to the
channel <i class="arg">chan</i>, starting at the current seek location. The channel
is configured to use binary translation and encoding for the transfer.
The channel is <em>not</em> closed when the transfer has completed. This
is left to the completion callback.</p>
<p>If both <i class="arg">host</i> and <i class="arg">port</i> are provided an <b class="const">active</b>
connection to the data source is made. If only a <i class="arg">port</i> is
specified (with <i class="arg">host</i> the empty string) then a <b class="const">passive</b>
connection is made instead, i.e. the receiver then waits for a
conneciton by the transmitter.</p>
<p>Any arguments after the port are treated as options and are used to
configure the internal receiver object.
See the section <span class="sectref"><a href="#subsection4">Options</a></span> for a list of the supported options
and their meaning.
<em>Note</em> however that the signature of the command prefix specified
for the <b class="option">-command</b> callback differs from the signature for the
same option of the receiver object.
This callback is only given the number of bytes and transfered, and
possibly an error message. No reference to the internally used
receiver object is made.</p>
<p>The result returned by the command is the empty string
if it was set to make an <i class="term"><a href="../../../../index.html#key562">active</a></i> connection, and the port the
internal receiver object is listening on otherwise, i.e when it is
configured to connect <i class="term"><a href="../../../../index.html#key564">passive</a></i>ly.
See also the package <b class="package"><a href="connect.html">transfer::connect</a></b> and the description
of the method <b class="method">connect</b> for where this behaviour comes from.</p></dd>
<dt><a name="3"><b class="cmd">transfer::receiver</b> <b class="method">stream file</b> <i class="arg">path</i> <i class="arg">host</i> <i class="arg">port</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This method is like <b class="method">stream channel</b>, except that the
received data is written to the file <i class="arg">path</i>, replacing any prior
content.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::transfer::receiver</b> command have the
following general form:</p>
<dl class="definitions">
<dt><a name="4"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="5"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object. Doing so while a reception is on
progress will cause errors later on, when the reception completes
and tries to access the now missing data structures of the destroyed
object.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">start</b></a></dt>
<dd><p>This method initiates the data reception, setting up the connection
first and then copying the received information into the
destination.
The method will throw an error if a reception is already/still in
progress.
I.e. it is not possible to run two receptions in parallel, only in
sequence.
Errors will also be thrown if the configuration of the data
destination is invalid, or if no completion callback was specified.</p>
<p>The result returned by the method is the empty string
for an object configured to make an <i class="term"><a href="../../../../index.html#key562">active</a></i> connection, and the port the
 object is listening on otherwise, i.e when it is
configured to connect <i class="term"><a href="../../../../index.html#key564">passive</a></i>ly.
See also the package <b class="package"><a href="connect.html">transfer::connect</a></b> and the description
of the method <b class="method">connect</b> for where this behaviour comes from.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">busy</b></a></dt>
<dd><p>This method returns a boolean value telling us whether a reception
is in progress (<b class="const">True</b>), or not (<b class="const">False</b>).</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Options</a></h3>
<p>All receiver objects support the union of the options supported by
their connect and data destination components, plus one of their own.
See also the documentation for the packages
<b class="package"><a href="ddest.html">transfer::data::destination</a></b> and <b class="package"><a href="connect.html">transfer::connect</a></b>.</p>
<dl class="options">
 
<dt><b class="option">-command</b> <i class="arg">cmdprefix</i></dt>
<dd><p>This option specifies the command to invoke when the reception of
the information has been completed.
The arguments given to this command are the same as given to the
completion callback of the command <b class="cmd">transfer::copy::do</b> provided
by the package <b class="package"><a href="copyops.html">transfer::copy</a></b>.</p></dd>
<dt><b class="option">-mode</b> <i class="arg">mode</i></dt>
<dd><p>This option specifies the mode the object is in. It is optional and
defaults to <b class="const">active</b> mode. The two possible modes are:</p>
<dl class="definitions">
<dt><b class="const">active</b></dt>
<dd><p>In this mode the two options <b class="option">-host</b> and <b class="option">-port</b> are
relevant and specify the host and TCP port the object has to connect
to. The host is given by either name or IP address.</p></dd>
<dt><b class="const">passive</b></dt>
<dd><p>In this mode the option <b class="option">-host</b> has no relevance and is ignored
should it be configured.
The only option the object needs is <b class="option">-port</b>, and it specifies
the TCP port on which the listening socket is opened to await the
connection from the partner.</p></dd>
</dl></dd>
<dt><b class="option">-host</b> <i class="arg">hostname-or-ipaddr</i></dt>
<dd><p>This option specifies the host to connect to in <i class="term"><a href="../../../../index.html#key562">active</a></i> mode,
either by name or ip-address. An object configured for <i class="term"><a href="../../../../index.html#key564">passive</a></i>
mode ignores this option.</p></dd>
<dt><b class="option">-port</b> <i class="arg">int</i></dt>
<dd><p>For <i class="term"><a href="../../../../index.html#key562">active</a></i> mode this option specifies the port the object is
expected to connect to. For <i class="term"><a href="../../../../index.html#key564">passive</a></i> mode however it is the port
where the object creates the listening socket waiting for a
connection. It defaults to <b class="const">0</b>, which allows the OS to choose
the actual port to listen on.</p></dd>
<dt><b class="option">-socketcmd</b> <i class="arg">command</i></dt>
<dd><p>This option allows the user to specify which command to use to open a
socket. The default is to use the builtin <b class="cmd">::socket</b>. Any
compatible with that command is allowed.</p>
<p>The envisioned main use is the specfication of <b class="cmd">tls::socket</b>. I.e.
this option allows the creation of secure transfer channels, without
making this package explicitly dependent on the <b class="package"><a href="../../../../index.html#key289">tls</a></b> package.</p>
<p>See also section <span class="sectref"><a href="#section3">Secure connections</a></span>.</p></dd>
<dt><b class="option">-encoding</b> encodingname</dt>
<dd></dd>
<dt><b class="option">-eofchar</b> eofspec</dt>
<dd></dd>
<dt><b class="option">-translation</b> transspec</dt>
<dd><p>These options are the same as are recognized by the builtin command
<b class="cmd">fconfigure</b>. They provide the configuration to be set for the
channel between the two partners after it has been established, but
before the callback is invoked (See method <b class="method">connect</b>).</p></dd>
<dt><b class="option">-channel</b> <i class="arg">handle</i></dt>
<dd><p>This option specifies that the destination of the data is a channel,
and its associated argument is the handle of the channel to write the
received data to.</p></dd>
<dt><b class="option">-file</b> <i class="arg">path</i></dt>
<dd><p>This option specifies that the destination of the data is a file, and
its associated argument is the path of the file to write the received
data to.</p></dd>
<dt><b class="option">-variable</b> <i class="arg">varname</i></dt>
<dd><p>This option specifies that the destination of the data is a variable,
and its associated argument contains the name of the variable to write
the received data to. The variable is assumed to be global or
namespaced, anchored at the global namespace.</p></dd>
<dt><b class="option">-progress</b> <i class="arg">command</i></dt>
<dd><p>This option, if specified, defines a command to be invoked for each
chunk of bytes received, allowing the user to monitor the progress of
the reception of the data. The callback is always invoked with one
additional argument, the number of bytes received so far.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Secure connections</a></h2>
<p>One way to secure connections made by objects of this package is to
require the package <b class="package"><a href="../../../../index.html#key289">tls</a></b> and then configure the option
<b class="option">-socketcmd</b> to force the use of command <b class="cmd">tls::socket</b> to
open the socket.</p>
<pre class="example">
    # Load and initialize tls
    package require tls
    tls::init -cafile /path/to/ca/cert -keyfile ...
    # Create a connector with secure socket setup,
    transfer::receiver R -socketcmd tls::socket ...
    ...
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>transfer</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key61">copy</a>, <a href="../../../../index.html#key58">data destination</a>, <a href="../../../../index.html#key90">receiver</a>, <a href="../../../../index.html#key315">secure</a>, <a href="../../../../index.html#key318">ssl</a>, <a href="../../../../index.html#key289">tls</a>, <a href="../../../../index.html#key60">transfer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Transfer module</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/transfer/tqueue.html.




















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>transfer::copy::queue - Data transfer facilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/transfer/tqueue.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ transfer::copy::queue.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">transfer::copy::queue(n) 0.1 tcllib &quot;Data transfer facilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>transfer::copy::queue - Queued transfers</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Options</a></li>
<li class="section"><a href="#section4">Use</a></li>
<li class="section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">struct::queue <span class="opt">?1.4?</span></b></li>
<li>package require <b class="pkgname">transfer::copy <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">transfer::copy::queue <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">transfer::copy::queue</b> <i class="arg">objectName</i> <i class="arg">outchannel</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">busy</b></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">pending</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">put</b> <i class="arg">request</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects which serialize transfer requests for a
single channel by means of a fifo queue. Accumulated requests are
executed in order of entrance, with the first request reaching an idle
object starting the execution in general. New requests can be added
while the object is active and are defered until all requests entered
before them have been completed successfully.</p>
<p>When a request causes a transfer error execution stops and all
requests coming after it are not served. Currently this means that
their completion callbacks are never triggered at all.</p>
<p><em>NOTE</em>:
	Not triggering the completion callbacks of the unserved
	requests after an error stops the queue object is something I
	am not fully sure that it makes sense. It forces the user of
	the queue to remember the callbacks as well and run
	them. Because otherwise everything in the system which depends
	on getting a notification about the status of a request will
	hang in the air. I am slowly convincing myself that it is more
	sensible to trigger the relevant completion callbacks with an
	error message about the queue abort, and 0 bytes transfered.</p>
<p>All transfer requests are of the form</p>
<pre class="example">
	{type data options...}
</pre>
<p>where <i class="arg">type</i> is in {<b class="const">chan</b>, <b class="const">string</b>}, and <i class="arg">data</i>
specifies the information to transfer.
For <b class="const">chan</b> the data is the handle of the channel containing the
actual information to transfer, whereas for <b class="const">string</b> <i class="arg">data</i>
contains directly the information to transfer.
The <i class="arg">options</i> are a list of them and their values, and are the
same as are accepted by the low-level copy operations of the package
<b class="package"><a href="copyops.html">transfer::copy</a></b>.
Note how just prepending the request with <b class="cmd">transfer::copy::do</b> and
inserting a channel handle in between <i class="arg">data</i> and <i class="arg">options</i>
easily transforms it from a pure data structure into a command whose
evaluation will perform the request.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">transfer::copy::queue</b> <i class="arg">objectName</i> <i class="arg">outchannel</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command creates a new queue object for the management of the
channel <i class="arg">outchannel</i>, with an associated Tcl command whose name is
<i class="arg">objectName</i>.
This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is explained in full detail in the sections
<span class="sectref"><a href="#subsection2">Object command</a></span> and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The set of
supported <i class="arg">options</i> is explained in section <span class="sectref"><a href="#section3">Options</a></span>.</p>
<p>The object command will be created under the current namespace if the
<i class="arg">objectName</i> is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::transfer::copy::queue</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="3"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object. Doing so while the object is busy
will cause errors later on, when the currently executed request
completes and tries to access the now missing data structures of the
destroyed object.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">busy</b></a></dt>
<dd><p>This method returns a boolean value telling us if the object is
currently serving a request (i.e. <i class="term">busy</i>, value <b class="const">True</b>), or
not (i.e. <i class="term"><a href="../../../../index.html#key495">idle</a></i>, value <b class="const">False</b>).</p></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">pending</b></a></dt>
<dd><p>This method returns the number of requests currently waiting in the
queue for their execution. A request currently served is not counted
as waiting.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">put</b> <i class="arg">request</i></a></dt>
<dd><p>This method enters the transfer <i class="arg">request</i> into the object's queue
of waiting requests.
If the object is <i class="term"><a href="../../../../index.html#key495">idle</a></i> it will become <i class="term">busy</i>, immediately
servicing the request. Otherwise servicing the new request will be
defered until all preceding requests have been served.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Options</a></h2>
<p>The only option known is <b class="option">-on-status-change</b>. It is optional
and defaults to the empty list, disabling the reporting of status
changes. Otherwise its argument is a command prefix which is invoked
whenever the internal status of the object changed. The callback is
invoked with two additional arguments, the result of the methods
<b class="method">pending</b> and <b class="method">busy</b>, in this order. This allows any
user to easily know, for example, when the object has processed all
outstanding requests.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">Use</a></h2>
<p>A possible application of this package and class is within a HTTP 1.1
server, managing the results waiting for transfer to the client.</p>
<p>It should be noted that in this application the system also needs an
additional data structure which keeps track of outstanding results as
they may come back in a different order than the requests from the
client, and releases them to the actual queue in the proper order.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>transfer</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key61">copy</a>, <a href="../../../../index.html#key54">queue</a>, <a href="../../../../index.html#key60">transfer</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Transfer module</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/transfer/transmitter.html.








































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>transfer::transmitter - Data transfer facilities</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/transfer/transmitter.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ transfer::transmitter.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">transfer::transmitter(n) 0.2 tcllib &quot;Data transfer facilities&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>transfer::transmitter - Data source</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">Package commands</a></li>
<li class="subsection"><a href="#subsection2">Object command</a></li>
<li class="subsection"><a href="#subsection3">Object methods</a></li>
<li class="subsection"><a href="#subsection4">Options</a></li>
</ul>
</li>
<li class="section"><a href="#section3">Secure connections</a></li>
<li class="section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">snit <span class="opt">?1.0?</span></b></li>
<li>package require <b class="pkgname">transfer::copy <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">transfer::data::source <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">transfer::connect <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">transfer::transmitter <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">transfer::transmitter</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#2"><b class="cmd">transfer::transmitter</b> <b class="method">stream channel</b> <i class="arg">chan</i> <i class="arg">host</i> <i class="arg">port</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">transfer::transmitter</b> <b class="method">stream file</b> <i class="arg">path</i> <i class="arg">host</i> <i class="arg">port</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
<li><a href="#6"><i class="arg">objectName</i> <b class="method">start</b></a></li>
<li><a href="#7"><i class="arg">objectName</i> <b class="method">busy</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package pulls data sources and connection setup together into a
combined object for the transmission of information over a socket.
These objects understand all the options from objects created
by the packages <b class="package"><a href="dsource.html">transfer::data::source</a></b> and
<b class="package"><a href="connect.html">transfer::connect</a></b>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Package commands</a></h3>
<dl class="definitions">
<dt><a name="1"><b class="cmd">transfer::transmitter</b> <i class="arg">objectName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p>This command creates a new transmitter object with an associated Tcl
command whose name is <i class="arg">objectName</i>.
This <i class="term"><a href="../../../../index.html#key221">object</a></i> command is explained in full detail in the sections
<span class="sectref"><a href="#subsection2">Object command</a></span> and <span class="sectref"><a href="#subsection3">Object methods</a></span>. The set of
supported <i class="arg">options</i> is explained in section <span class="sectref"><a href="#subsection4">Options</a></span>.</p>
<p>The object command will be created under the current namespace if the
<i class="arg">objectName</i> is not fully qualified, and in the specified
namespace otherwise.
The fully qualified name of the object command is returned as the
result of the command.</p></dd>
<dt><a name="2"><b class="cmd">transfer::transmitter</b> <b class="method">stream channel</b> <i class="arg">chan</i> <i class="arg">host</i> <i class="arg">port</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This method creates a fire-and-forget transfer for the data contained
in the channel <i class="arg">chan</i>, starting at the current seek location. The
channel is configured to use binary translation and encoding for the
transfer.
The channel is automatically closed when the transfer has completed.</p>
<p>If both <i class="arg">host</i> and <i class="arg">port</i> are provided an <b class="const">active</b>
connection to the destination is made. If only a <i class="arg">port</i> is
specified (with <i class="arg">host</i> the empty string) then a <b class="const">passive</b>
connection is made instead.</p>
<p>Any arguments after the port are treated as options and are used to
configure the internal transmitter object.
See the section <span class="sectref"><a href="#subsection4">Options</a></span> for a list of the supported options
and their meaning.
<em>Note</em> however that the signature of the command prefix specified
for the <b class="option">-command</b> callback differs from the signature for the
same option of the transmitter object.
This callback is only given the number of bytes and transfered, and
possibly an error message. No reference to the internally used
transmitter object is made.</p>
<p>The result returned by the command is the empty string
if it was set to make an <i class="term"><a href="../../../../index.html#key562">active</a></i> connection, and the port the
internal transmitter object is listening on otherwise, i.e when it is
configured to connect <i class="term"><a href="../../../../index.html#key564">passive</a></i>ly.
See also the package <b class="package"><a href="connect.html">transfer::connect</a></b> and the description
of the method <b class="method">connect</b> for where this behaviour comes from.</p></dd>
<dt><a name="3"><b class="cmd">transfer::transmitter</b> <b class="method">stream file</b> <i class="arg">path</i> <i class="arg">host</i> <i class="arg">port</i> <span class="opt">?<i class="arg">arg</i>...?</span></a></dt>
<dd><p>This method is like <b class="method">stream channel</b>, except that the data
contained in the file <i class="arg">path</i> is transfered.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">Object command</a></h3>
<p>All objects created by the <b class="cmd">::transfer::transmitter</b> command have
the following general form:</p>
<dl class="definitions">
<dt><a name="4"><i class="arg">objectName</i> <b class="method">method</b> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p>The method <b class="method">method</b> and its <i class="arg">arg</i>'uments determine the
exact behavior of the command.
See section <span class="sectref"><a href="#subsection3">Object methods</a></span> for the detailed
specifications.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Object methods</a></h3>
<dl class="definitions">
<dt><a name="5"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>This method destroys the object. Doing so while a transmission is in
progress will cause errors later on, when the transmission completes
and tries to access the now missing data structures of the destroyed
object.</p></dd>
<dt><a name="6"><i class="arg">objectName</i> <b class="method">start</b></a></dt>
<dd><p>This method initiates the data transmission, setting up the connection
first and then copying the information.
The method will throw an error if a transmission is already/still in
progress.
I.e. it is not possible to run two transmissions in parallel on a
single object, only in sequence. Multiple transmitter objects are
needed to manage parallel transfers, one per transmission.
Errors will also be thrown if the configuration of the data source is
invalid, or if no completion callback was specified.</p>
<p>The result returned by the method is the empty string
for an object configured to make an <i class="term"><a href="../../../../index.html#key562">active</a></i> connection, and the port the
 object is listening on otherwise, i.e when it is
configured to connect <i class="term"><a href="../../../../index.html#key564">passive</a></i>ly.
See also the package <b class="package"><a href="connect.html">transfer::connect</a></b> and the description
of the method <b class="method">connect</b> for where this behaviour comes from.</p></dd>
<dt><a name="7"><i class="arg">objectName</i> <b class="method">busy</b></a></dt>
<dd><p>This method returns a boolean value telling us whether a transmission
is in progress (<b class="const">True</b>), or not (<b class="const">False</b>).</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Options</a></h3>
<p>All transmitter objects support the union of the options supported
by their connect and data source components, plus two of their own.
See also the documentation for the packages
<b class="package"><a href="dsource.html">transfer::data::source</a></b> and <b class="package"><a href="connect.html">transfer::connect</a></b>.</p>
<dl class="options">
<dt><b class="option">-blocksize</b> <i class="arg">int</i></dt>
<dd><p>This option specifies the size of the chunks to be transmitted in one
block. Usage is optional, its default value is <b class="const">1024</b>.</p></dd>
<dt><b class="option">-command</b> <i class="arg">cmdprefix</i></dt>
<dd><p>This option specifies the command to invoke when the transmission of
the information has been completed.
The arguments given to this command are the same as given to the
completion callback of the command <b class="cmd">transfer::copy::do</b> provided
by the package <b class="package"><a href="copyops.html">transfer::copy</a></b>.</p></dd>
<dt><b class="option">-mode</b> <i class="arg">mode</i></dt>
<dd><p>This option specifies the mode the object is in. It is optional and
defaults to <b class="const">active</b> mode. The two possible modes are:</p>
<dl class="definitions">
<dt><b class="const">active</b></dt>
<dd><p>In this mode the two options <b class="option">-host</b> and <b class="option">-port</b> are
relevant and specify the host and TCP port the object has to connect
to. The host is given by either name or IP address.</p></dd>
<dt><b class="const">passive</b></dt>
<dd><p>In this mode the option <b class="option">-host</b> has no relevance and is ignored
should it be configured.
The only option the object needs is <b class="option">-port</b>, and it specifies
the TCP port on which the listening socket is opened to await the
connection from the partner.</p></dd>
</dl></dd>
<dt><b class="option">-host</b> <i class="arg">hostname-or-ipaddr</i></dt>
<dd><p>This option specifies the host to connect to in <i class="term"><a href="../../../../index.html#key562">active</a></i> mode,
either by name or ip-address. An object configured for <i class="term"><a href="../../../../index.html#key564">passive</a></i>
mode ignores this option.</p></dd>
<dt><b class="option">-port</b> <i class="arg">int</i></dt>
<dd><p>For <i class="term"><a href="../../../../index.html#key562">active</a></i> mode this option specifies the port the object is
expected to connect to. For <i class="term"><a href="../../../../index.html#key564">passive</a></i> mode however it is the port
where the object creates the listening socket waiting for a
connection. It defaults to <b class="const">0</b>, which allows the OS to choose
the actual port to listen on.</p></dd>
<dt><b class="option">-socketcmd</b> <i class="arg">command</i></dt>
<dd><p>This option allows the user to specify which command to use to open a
socket. The default is to use the builtin <b class="cmd">::socket</b>. Any
compatible with that command is allowed.</p>
<p>The envisioned main use is the specfication of <b class="cmd">tls::socket</b>. I.e.
this option allows the creation of secure transfer channels, without
making this package explicitly dependent on the <b class="package"><a href="../../../../index.html#key289">tls</a></b> package.</p>
<p>See also section <span class="sectref"><a href="#section3">Secure connections</a></span>.</p></dd>
<dt><b class="option">-encoding</b> encodingname</dt>
<dd></dd>
<dt><b class="option">-eofchar</b> eofspec</dt>
<dd></dd>
<dt><b class="option">-translation</b> transspec</dt>
<dd><p>These options are the same as are recognized by the builtin command
<b class="cmd">fconfigure</b>. They provide the configuration to be set for the
channel between the two partners after it has been established, but
before the callback is invoked (See method <b class="method">connect</b>).</p></dd>
<dt><b class="option">-string</b> <i class="arg">text</i></dt>
<dd><p>This option specifies that the source of the data is an immediate
string, and its associated argument contains the string in question.</p></dd>
<dt><b class="option">-channel</b> <i class="arg">handle</i></dt>
<dd><p>This option specifies that the source of the data is a channel, and
its associated argument is the handle of the channel containing the
data.</p></dd>
<dt><b class="option">-file</b> <i class="arg">path</i></dt>
<dd><p>This option specifies that the source of the data is a file, and its
associated argument is the path of the file containing the data.</p></dd>
<dt><b class="option">-variable</b> <i class="arg">varname</i></dt>
<dd><p>This option specifies that the source of the data is a string stored
in a variable, and its associated argument contains the name of the
variable in question. The variable is assumed to be global or
namespaced, anchored at the global namespace.</p></dd>
<dt><b class="option">-size</b> <i class="arg">int</i></dt>
<dd><p>This option specifies the size of the data transfer. It is optional
and defaults to -1. This value, and any other value less than zero
signals to transfer all the data from the source.</p></dd>
<dt><b class="option">-progress</b> <i class="arg">command</i></dt>
<dd><p>This option, if specified, defines a command to be invoked for each
chunk of bytes transmitted, allowing the user to monitor the progress
of the transmission of the data. The callback is always invoked with
one additional argument, the number of bytes transmitted so far.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">Secure connections</a></h2>
<p>One way to secure connections made by objects of this package is to
require the package <b class="package"><a href="../../../../index.html#key289">tls</a></b> and then configure the option
<b class="option">-socketcmd</b> to force the use of command <b class="cmd">tls::socket</b> to
open the socket.</p>
<pre class="example">
    # Load and initialize tls
    package require tls
    tls::init -cafile /path/to/ca/cert -keyfile ...
    # Create a connector with secure socket setup,
    transfer::transmitter T -socketcmd tls::socket ...
    ...
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>transfer</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key59">channel</a>, <a href="../../../../index.html#key61">copy</a>, <a href="../../../../index.html#key331">data source</a>, <a href="../../../../index.html#key315">secure</a>, <a href="../../../../index.html#key318">ssl</a>, <a href="../../../../index.html#key289">tls</a>, <a href="../../../../index.html#key60">transfer</a>, <a href="../../../../index.html#key663">transmitter</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Transfer module</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2006-2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/treeql/treeql.html.















































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>treeql - Tree Query Language</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/treeql/treeql.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004 Colin McCormack &lt;[email protected]&gt;   -- Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ treeql.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">treeql(n) 1.3.1 tcllib &quot;Tree Query Language&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>treeql - Query tree objects</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a>
<ul>
<li class="subsection"><a href="#subsection1">TreeQL CLASS API</a></li>
<li class="subsection"><a href="#subsection2">TreeQL OBJECT API</a></li>
</ul>
</li>
<li class="section"><a href="#section3">The Tree Query Language</a>
<ul>
<li class="subsection"><a href="#subsection3">TreeQL Concepts</a></li>
<li class="subsection"><a href="#subsection4">Structural generators</a></li>
<li class="subsection"><a href="#subsection5">Attribute Filters</a></li>
<li class="subsection"><a href="#subsection6">Attribute Mutators</a></li>
<li class="subsection"><a href="#subsection7">Attribute String Accessors</a></li>
<li class="subsection"><a href="#subsection8">Sub-queries</a></li>
<li class="subsection"><a href="#subsection9">Node Set Operators</a></li>
<li class="subsection"><a href="#subsection10">Node Set Iterators</a></li>
<li class="subsection"><a href="#subsection11">Typed node support</a></li>
</ul>
</li>
<li class="section"><a href="#section4">Examples</a></li>
<li class="section"><a href="#section5">References</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">snit</b></li>
<li>package require <b class="pkgname">struct::list</b></li>
<li>package require <b class="pkgname">struct::set</b></li>
<li>package require <b class="pkgname">treeql <span class="opt">?1.3.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">treeql</b> <i class="arg">objectname</i> <b class="option">-tree</b> <i class="arg">tree</i> <span class="opt">?<b class="option">-query</b> <i class="arg">query</i>?</span> <span class="opt">?<b class="option">-nodes</b> <i class="arg">nodes</i>?</span> <span class="opt">?<i class="arg">args</i>...?</span></a></li>
<li><a href="#2"><i class="arg">qo</i> <b class="method">query</b> <i class="arg">args</i>...</a></li>
<li><a href="#3"><i class="arg">qo</i> <b class="method">result</b></a></li>
<li><a href="#4"><i class="arg">qo</i> <b class="method">discard</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects which can be used to query and transform
tree objects following the API of tree objects created by the package
<b class="package"><a href="../struct/struct_tree.html">struct::tree</a></b>.</p>
<p>The tree query and manipulation language used here, TreeQL, is
inspired by Cost (See section <span class="sectref"><a href="#section5">References</a></span> for more
information).</p>
<p><b class="package">treeql</b>, the package, is a fairly thin query facility over
tree-structured data types.  It implements an ordered set of nodes
(really a list) which are generated and filtered through the
application of TreeQL operators to each node in turn.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<div id="subsection1" class="subsection"><h3><a name="subsection1">TreeQL CLASS API</a></h3>
<p>The command <b class="cmd">treeql</b> is a <b class="package"><a href="../snit/snit.html">snit</a></b>::type which implements
the Treeql Query Language. This means that it follows the API for
class commands as specified by the package <b class="package"><a href="../snit/snit.html">snit</a></b>.
Its general syntax is</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">treeql</b> <i class="arg">objectname</i> <b class="option">-tree</b> <i class="arg">tree</i> <span class="opt">?<b class="option">-query</b> <i class="arg">query</i>?</span> <span class="opt">?<b class="option">-nodes</b> <i class="arg">nodes</i>?</span> <span class="opt">?<i class="arg">args</i>...?</span></a></dt>
<dd><p>The command creates a new tree query object and returns the fully
qualified name of the object command as its result.
The API the returned command is following is described in the section
<span class="sectref"><a href="#subsection2">TreeQL OBJECT API</a></span></p>
<p>Each query object is associated with a single <i class="arg">tree</i> object. This
is the object all queries will be run against.</p>
<p>If the option <b class="option">-nodes</b> was specified then its argument is
treated as a list of nodes. This list is used to initialize the node
set. It defaults to the empty list.</p>
<p>If the option <b class="option">-query</b> was specified then its argument will be
interpreted as an object, the <i class="term">parent query</i> of this query. It
defaults to the object itself. All queries will be interpreted in the
environment of this object.</p>
<p>Any arguments coming after the options are treated as a query and run
immediately, after the <i class="term">node set</i> has been initialized. This
uses the same syntax for the query as the method <b class="method">query</b>.</p>
<p>The operations of the TreeQL available for this are explained in the
section about <span class="sectref"><a href="#section3">The Tree Query Language</a></span>. This section also
explains the term <i class="term">node set</i> used above.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">TreeQL OBJECT API</a></h3>
<p>As <b class="package">treeql</b> has been implemented in <b class="package"><a href="../snit/snit.html">snit</a></b> all the
standard methods of <b class="package"><a href="../snit/snit.html">snit</a></b>-based classes are available to the
user and therefore not listed here. Please read the documentation for
<b class="package"><a href="../snit/snit.html">snit</a></b> for what they are and what functionality they provide</p>
<p>The methods provided by the package <b class="package">treeql</b> itself are listed
and explained below.</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">qo</i> <b class="method">query</b> <i class="arg">args</i>...</a></dt>
<dd><p>This method interprets its arguments as a series of TreeQL operators
and interpretes them from the left to right (i.e. first to last).
Note that the first operator uses the <i class="term">node set</i> currently
known to the object to perform its actions.
In other words, the <i class="term">node set</i> is <em>not</em> cleared, or
modified in other ways, before the query is run. This allows the user
to run several queries one after the other and have each use the
results of the last. Any initialization has to be done by any query
itself, using TreeQL operators.
The result of the method is the <i class="term">node set</i> after the last
operator of the query has been executed.</p>
<p><em>Note</em> that uncaught errors will leave the <i class="term">node set</i> of
the object in an intermediate state, per the TreeQL operators which
were executed successfully before the error occurred.</p>
<p>The above means in detail that:</p>
<ol class="enumerated">
<li><p>The first argument is interpreted as the name of a query operator, the
number of arguments required by that operator is then determined, and
taken from the immediately following arguments.</p>
<p>Because of this operators cannot have optional arguments, all
arguments have to be present as defined.  Failure to do this will, at
least, confuse the query interpreter, but more likely cause errors.</p></li>
<li><p>The operator is applied to the current node set, yielding a new node
set, and/or manipulating the tree object the query object is connected
to.</p></li>
<li><p>The arguments used (i.e. operator name and arguments) are removed from
the list of method arguments, and then the whole process is repeated
from step [1], until the list of arguments is empty or an error
occurred.</p></li>
</ol>
<pre class="example">
    # q is the query object.
    q query root children get data
    # The above query
    # - Resets the node set to the root node - root
    # - Adds the children of root to the set - children
    # - Replaces the node set with the       - get data
    #   values for the attribute 'data',
    #   for all nodes in the set which
    #   have such an attribute.
    # - And returns this information.
    # Below we can see the same query, but rewritten
    # to show the structure as it is seen by the query
    # interpreter.
    q query \\
	    root \\
	    children \\
	    get data
</pre>
<p>The operators of the TreeQL language available for this are explained
in the section about <span class="sectref"><a href="#section3">The Tree Query Language</a></span>. This section
also explains the term <i class="term">node set</i> used above.</p></dd>
<dt><a name="3"><i class="arg">qo</i> <b class="method">result</b></a></dt>
<dd><p>This method returns a list containing the current node set.</p></dd>
<dt><a name="4"><i class="arg">qo</i> <b class="method">discard</b></a></dt>
<dd><p>This method returns the current node set (like method
<b class="method">result</b>), but also destroys the query object (<i class="arg">qo</i>).
This is useful when constructing and using sub-queries (%AUTO% objects
immediately destroyed after use).</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">The Tree Query Language</a></h2>
<p>This and the following sections specify the Tree Query Language used
by the query objects of this package in detail.</p>
<p>First we explain the general concepts underneath the language which
are required to comprehend it. This is followed by the specifications
for all the available query operators. They fall into eight
categories, and each category has its own section.</p>
<ol class="enumerated">
<li><p><span class="sectref"><a href="#subsection3">TreeQL Concepts</a></span></p></li>
<li><p><span class="sectref"><a href="#subsection4">Structural generators</a></span></p></li>
<li><p><span class="sectref"><a href="#subsection5">Attribute Filters</a></span></p></li>
<li><p><span class="sectref"><a href="#subsection6">Attribute Mutators</a></span></p></li>
<li><p><span class="sectref"><a href="#subsection7">Attribute String Accessors</a></span></p></li>
<li><p><span class="sectref"><a href="#subsection8">Sub-queries</a></span></p></li>
<li><p><span class="sectref"><a href="#subsection9">Node Set Operators</a></span></p></li>
<li><p><span class="sectref"><a href="#subsection10">Node Set Iterators</a></span></p></li>
<li><p><span class="sectref"><a href="#subsection11">Typed node support</a></span></p></li>
</ol>
<div id="subsection3" class="subsection"><h3><a name="subsection3">TreeQL Concepts</a></h3>
<p>The main concept which has to be understood is that of the
<i class="term">node set</i>.
Each query object maintains exactly one such <i class="term">node set</i>, and
essentially all operators use it and input argument and for their
result.
This structure simply contains the handles of all nodes which are
currently of interest to the query object.
To name it a <i class="term"><a href="../../../../index.html#key253">set</a></i> is a bit of a misnomer, because</p>
<ol class="enumerated">
<li><p>A node (handle) can occur in the structure more than once, and</p></li>
<li><p>the order of nodes in the structure is important as well.
Whenever an operator processes all nodes in the node set it will do so
in the order they occur in the structure.</p></li>
</ol>
<p>Regarding the possible multiple occurrence of a node, consider a node
set containing two nodes A and B, both having node P as their
immediate parent. Application of the TreeQL operator &quot;parent&quot; will
then add P to the new node set twice, once per node it was parent
of. I.e. the new node set will then be {P P}.</p>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">Structural generators</a></h3>
<p>All tree-structural operators locate nodes in the tree based on a
structural relation ship to the nodes currently in the set and then
replace the current node set with the set of nodes found
Nodes which fulfill such a relationship multiple times are added to
the result as often as they fulfill the relationship.</p>
<p>It is important to note that the found nodes are collected in a
separate storage area while processing the node set, and are added to
(or replacing) the current node set only after the current node set
has been processed completely.
In other words, the new nodes are <em>not</em> processed by the operator
as well and do not affect the iteration.</p>
<p>When describing an operator the variable <b class="variable">N</b> will be used to refer
to any node in the node set.</p>
<dl class="definitions">
<dt><b class="method">ancestors</b></dt>
<dd><p>Replaces the current node set with the ancestors for all nodes <b class="variable">N</b>
in the node set, should <b class="variable">N</b> have a parent. In other words, nodes
without a parent do not contribute to the new node set. In other
words, uses all nodes on the path from node <b class="variable">N</b> to root, in this
order (root last), for all nodes <b class="variable">N</b> in the node set. This
includes the root, but not the node itself.</p></dd>
<dt><b class="method">rootpath</b></dt>
<dd><p>Replaces the current node set with the ancestors for all nodes <b class="variable">N</b>
in the node set, should <b class="variable">N</b> have a parent. In other words, nodes
without a parent do not contribute to the new node set.
In contrast to the operator <b class="method">ancestors</b> the nodes are added in
reverse order however, i.e. the root node first.</p></dd>
<dt><b class="method">parent</b></dt>
<dd><p>Replaces the current node set with the parent of node <b class="variable">N</b>, for all
nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b> have a parent. In other
words, nodes without a parent do not contribute to the new node set.</p></dd>
<dt><b class="method">children</b></dt>
<dd><p>Replaces the current node set with the immediate children of node
<b class="variable">N</b>, for all nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b> have
children. In other words, nodes without children do not contribute to
the new node set.</p></dd>
<dt><b class="method">left</b></dt>
<dd><p>Replaces the current node set with the previous/left sibling for all
nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b> have siblings to the
left. In other words, nodes without left siblings do not contribute to
the new node set.</p></dd>
<dt><b class="method">right</b></dt>
<dd><p>Replaces the current node set with the next/right sibling for all
nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b> have siblings to the
right. In other words, nodes without right siblings do not contribute
to the new node set.</p></dd>
<dt><b class="method">prev</b></dt>
<dd><p>Replaces the current node set with all previous/left siblings of node
<b class="variable">N</b>, for all nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b> have
siblings to the left. In other words, nodes without left siblings are
ignored. The left sibling adjacent to the node is added first, and the
leftmost sibling last (reverse tree order).</p></dd>
<dt><b class="method">esib</b></dt>
<dd><p>Replaces the current node set with all previous/left siblings of node
<b class="variable">N</b>, for all nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b> have
siblings to the left. In other words, nodes without left siblings are
ignored. The leftmost sibling is added first, and the left sibling
adjacent to the node last (tree order).</p>
<p>The method name is a shorthand for <i class="term">Earlier SIBling</i>.</p></dd>
<dt><b class="method">next</b></dt>
<dd><p>Replaces the current node set with all next/right siblings of node
<b class="variable">N</b>, for all nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b> have
siblings to the right. In other words, nodes without right siblings do
not contribute to the new node set. The right sibling adjacent to the
node is added first, and the rightmost sibling last (tree order).</p></dd>
<dt><b class="method">root</b></dt>
<dd><p>Replaces the current node set with a node set containing a single
node, the root of the tree.</p></dd>
<dt><b class="method">tree</b></dt>
<dd><p>Replaces the current node set with a node set containing all nodes
found in the tree. The nodes are added in pre-order (parent first,
then children, the latter from left to right, first to last).</p></dd>
<dt><b class="method">descendants</b></dt>
<dd><p>Replaces the current node set with the nodes in all subtrees rooted at
node <b class="variable">N</b>, for all nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b>
have children. In other words, nodes without children do not
contribute to the new node set.</p>
<p>This is like the operator <b class="method">children</b>, but covers the children
of children as well, i.e. all the <i class="term">proper descendants</i>. &quot;Rooted
at <b class="variable">N</b>&quot; means that <b class="variable">N</b> itself is not added to the new set,
which is also implied by <i class="term">proper descendants</i>.</p></dd>
<dt><b class="method">subtree</b></dt>
<dd><p>Like operator <b class="method">descendants</b>, but includes the node <b class="variable">N</b>. In
other words:</p>
<p>Replaces the current node set with the nodes of the subtree of node
<b class="variable">N</b>, for all nodes <b class="variable">N</b> in the node set, should <b class="variable">N</b> have
children. In other words, nodes without children do not contribute to
the new node set. I.e this is like the operator <b class="method">children</b>, but
covers the children of children, etc. as well. &quot;Of <b class="variable">N</b>&quot; means that
<b class="variable">N</b> itself is added to the new set.</p></dd>
<dt><b class="method">forward</b></dt>
<dd><p>Replaces the current node set with the nodes in the subtrees rooted at
the right siblings of node <b class="variable">N</b>, for all nodes <b class="variable">N</b> in the node
set, should <b class="variable">N</b> have right siblings, and they children. In other
words, nodes without right siblings, and them without children are
ignored.</p>
<p>This is equivalent to the operator sequence</p>
<pre class="example">next descendants</pre>
</dd>
<dt><b class="method">later</b></dt>
<dd><p>This is an alias for the operator <b class="method">forward</b>.</p></dd>
<dt><b class="method">backward</b></dt>
<dd><p>Replaces the current node set with the nodes in the flattened previous
subtrees, in reverse tree order.</p>
<p>This is nearly equivalent to the operator sequence</p>
<pre class="example">prev descendants</pre>
<p>The only difference is that this uses the nodes in reverse order.</p></dd>
<dt><b class="method">earlier</b></dt>
<dd><p>Replaces the current node set with the nodes in the flattened previous
subtrees, in tree order.</p>
<p>This is equivalent to the operator sequence</p>
<pre class="example">prev subtree</pre>
</dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Attribute Filters</a></h3>
<p>These operators filter the node set by reference to attributes of
nodes and their properties. Filter means that all nodes not fulfilling
the criteria are removed from the node set. In other words, the node
set is replaced by the set of nodes fulfilling the filter criteria.</p>
<dl class="definitions">
<dt><b class="method">hasatt</b> <i class="arg">attr</i></dt>
<dd><p>Reduces the node set to nodes which have an attribute named
<i class="arg">attr</i>.</p></dd>
<dt><b class="method">withatt</b> <i class="arg">attr</i> <i class="arg">value</i></dt>
<dd><p>Reduces the node set to nodes which have an attribute named
<i class="arg">attr</i>, and where the value of that attribute is equal to
<i class="arg">value</i> (The &quot;==&quot; operator is <b class="cmd">string equal -nocase</b>).</p></dd>
<dt><b class="method">withatt!</b> <i class="arg">attr</i> <i class="arg">val</i></dt>
<dd><p>This is the same as <b class="method">withatt</b>, but all nodes in the node set
have to have the attribute, and the &quot;==&quot; operator is
<b class="cmd">string equal</b>, i.e. no <b class="option">-nocase</b>.
The operator will fail with an error if they don't have the attribute.</p></dd>
<dt><b class="method">attof</b> <i class="arg">attr</i> <i class="arg">vals</i></dt>
<dd><p>Reduces the node set to nodes which which have an attribute named
<i class="arg">attr</i> and where the value of that attribute is contained in the
list <i class="arg">vals</i> of legal values. The contained-in operator used here
does glob matching (using the attribute value as pattern) and ignores
the case of the attribute value, <em>but not</em> for the elements of
<i class="arg">vals</i>.</p></dd>
<dt><b class="method">attmatch</b> <i class="arg">attr</i> <i class="arg">match</i></dt>
<dd><p>Same as <b class="method">withatt</b>, but <b class="cmd">string match</b> is used as the &quot;==&quot;
operator, and <i class="arg">match</i> is the pattern checked for.</p>
<p><em>Note</em> that <i class="arg">match</i> is a interpreted as a partial argument
<em>list</em> for <b class="cmd">string match</b>. This means that it is
interpreted as a list containing the pattern, and the pattern element
can be preceded by options understand by <b class="cmd">string match</b>, like
<b class="option">-nocase</b>.
This is especially important should the pattern contain spaces. It has
to be wrapped into a list for correct interpretation by this operator</p></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Attribute Mutators</a></h3>
<p>These operators change node attributes within the underlying tree. In
other words, all these operators have <i class="term">side effects</i>.</p>
<dl class="definitions">
<dt><b class="method">set</b> <i class="arg">attr</i> <i class="arg">val</i></dt>
<dd><p>Sets the attribute <i class="arg">attr</i> to the value <i class="arg">val</i>, for all nodes
<b class="variable">N</b> in the node set.
The operator will fail if a node does not have an attribute named
<i class="arg">attr</i>. The tree will be left in a partially modified state.</p></dd>
<dt><b class="method">unset</b> <i class="arg">attr</i></dt>
<dd><p>Unsets the attribute <i class="arg">attr</i>, for all nodes <b class="variable">N</b> in the node
set.
The operator will fail if a node does not have an attribute named
<i class="arg">attr</i>. The tree will be left in a partially modified state.</p></dd>
</dl>
</div>
<div id="subsection7" class="subsection"><h3><a name="subsection7">Attribute String Accessors</a></h3>
<p>These operators retrieve the values of node attributes from the
underlying tree. The collected results are stored in the node set, but
are not actually nodes.</p>
<p>In other words, they redefine the semantics of the node set stored by
the query object to contain non-node data after their completion.</p>
<p>The query interpreter will terminate after it has finished processing
one of these operators, silently discarding any later query elements.
It also means that our talk about maintenance of a node set is not
quite true. It is a node set while the interpreter is processing
commands, but can be left as an attribute value set at the end of
query processing.</p>
<dl class="definitions">
<dt><b class="method">string</b> <i class="arg">op</i> <i class="arg">attr</i></dt>
<dd><p>Applies the string operator <i class="arg">op</i> to the attribute named
<i class="arg">attr</i>, for all nodes <b class="variable">N</b> in the node set, collects the
results of that application and places them into the node set.</p>
<p>The operator will fail if a node does not have an attribute named
<i class="arg">attr</i>.</p>
<p>The argument <i class="arg">op</i> is interpreted as partial argument list for the
builtin command <b class="cmd"><a href="../../../../index.html#key239">string</a></b>.  Its first word has to be any of the
sub-commands understood by <b class="cmd"><a href="../../../../index.html#key239">string</a></b>.  This has to be followed by
all arguments required for the subcommand, except the last.  that last
argument is supplied by the attribute value.</p></dd>
<dt><b class="method">get</b> <i class="arg">pattern</i></dt>
<dd><p>For all nodes <b class="variable">N</b> in the node set it determines all their
attributes with names matching the glob <i class="arg">pattern</i>, then the values
of these attributes, at last it replaces the node set with the list of
these attribute values.</p></dd>
<dt><b class="method">attlist</b></dt>
<dd><p>This is a convenience definition for the operator
<b class="method">getvals *</b>. In other words, it replaces the node set with a
list of the attribute values for all attributes for all nodes <b class="variable">N</b>
in the node set.</p></dd>
<dt><b class="method">attrs</b> <i class="arg">glob</i></dt>
<dd><p>Replaces the current node set with a list of attribute lists, one
attribute list per for all nodes <b class="variable">N</b> in the node set.</p></dd>
<dt><b class="method">attval</b> <i class="arg">attname</i></dt>
<dd><p>Reduces the current node set with the operator <b class="method">hasatt</b>, and
then replaces it with a list containing the values of the attribute
named <i class="arg">attname</i> for all nodes <b class="variable">N</b> in the node set.</p></dd>
</dl>
</div>
<div id="subsection8" class="subsection"><h3><a name="subsection8">Sub-queries</a></h3>
<p>Sub-queries yield node sets which are then used to augment, reduce or
replace the current node set.</p>
<dl class="definitions">
<dt><b class="method">andq</b> <i class="arg">query</i></dt>
<dd><p>Replaces the node set with the set-intersection of the node set
generated by the sub-query <i class="arg">query</i> and itself.</p>
<p>The execution of the sub-query uses the current node set as its own
initial node set.</p></dd>
<dt><b class="method">orq</b> <i class="arg">query</i></dt>
<dd><p>Replaces the node set with the set-union of the node set generated by
the sub-query <i class="arg">query</i> and itself. Duplicate nodes are removed.</p>
<p>The execution of the sub-query uses the current node set as its own
initial node set.</p></dd>
<dt><b class="method">notq</b> <i class="arg">query</i></dt>
<dd><p>Replaces the node set with the set of nodes generated by the sub-query
<i class="arg">query</i> which are also not in the current node set. In other word
the set difference of itself and the node set generated by the
sub-query.</p>
<p>The execution of the sub-query uses the current node set as its own
initial node set.</p></dd>
</dl>
</div>
<div id="subsection9" class="subsection"><h3><a name="subsection9">Node Set Operators</a></h3>
<p>These operators change the node set directly, without referring to the
tree.</p>
<dl class="definitions">
<dt><b class="method">unique</b></dt>
<dd><p>Removes duplicate nodes from the node set, preserving order. In other
words, the earliest occurrence of a node handle is preserved, every
other occurrence is removed.</p></dd>
<dt><b class="method">select</b></dt>
<dd><p>Replaces the current node set with a node set containing only the
first node from the current node set</p></dd>
<dt><b class="method">transform</b> <i class="arg">query</i> <i class="arg">var</i> <i class="arg">body</i></dt>
<dd><p>First it interprets the sub-query <i class="arg">query</i>, using the current node
set as its initial node set.
Then it iterates over the result of that query, binding the handle of
each node to the variable named in <i class="arg">var</i>, and executing the script
<i class="arg">body</i>.
The collected results of these executions is made the new node set,
replacing the current one.</p>
<p>The script <i class="arg">body</i> is executed in the context of the caller.</p></dd>
<dt><b class="method">map</b> <i class="arg">var</i> <i class="arg">body</i></dt>
<dd><p>Iterates over the current node set, binding the handle of each node to
the variable named in <i class="arg">var</i>, and executing the script <i class="arg">body</i>.
The collected results of these executions is made the new node set,
replacing the current one.</p>
<p>The script <i class="arg">body</i> is executed in the context of the caller.</p></dd>
<dt><b class="method">quote</b> <i class="arg">val</i></dt>
<dd><p>Appends the literal value <i class="arg">val</i> to the current node set.</p></dd>
<dt><b class="method">replace</b> <i class="arg">val</i></dt>
<dd><p>Replaces the current node set with the literal list value <i class="arg">val</i>.</p></dd>
</dl>
</div>
<div id="subsection10" class="subsection"><h3><a name="subsection10">Node Set Iterators</a></h3>
<dl class="definitions">
<dt><b class="method">foreach</b> <i class="arg">query</i> <i class="arg">var</i> <i class="arg">body</i></dt>
<dd><p>Interprets the sub-query <i class="arg">query</i>, then performs the equivalent of
operator <b class="method">over</b> on the nodes in the node set created by that
query. The current node set is not changed, except through side
effects from the script <i class="arg">body</i>.</p>
<p>The script <i class="arg">body</i> is executed in the context of the caller.</p></dd>
<dt><b class="method">with</b> <i class="arg">query</i> <i class="arg">body</i></dt>
<dd><p>Interprets the <i class="arg">query</i>, then runs the script <i class="arg">body</i> on the
node set generated by the query. At last it restores the current node
set as it was before the execution of the query.</p>
<p>The script <i class="arg">body</i> is executed in the context of the caller.</p></dd>
<dt><b class="method">over</b> <i class="arg">var</i> <i class="arg">body</i></dt>
<dd><p>Executes the script <i class="arg">body</i> for each node in the node set, with the
variable named by <i class="arg">var</i> bound to the name of the current node.
The script <i class="arg">body</i> is executed in the context of the caller.</p>
<p>This is like the builtin <b class="cmd"><a href="../../../../index.html#key199">foreach</a></b>, with the node set as the
source of the list to iterate over.</p>
<p>The results of executing the <i class="arg">body</i> are ignored.</p></dd>
<dt><b class="method">delete</b></dt>
<dd><p>Deletes all the nodes contained in the current node set from the tree.</p></dd>
</dl>
</div>
<div id="subsection11" class="subsection"><h3><a name="subsection11">Typed node support</a></h3>
<p>These filters and accessors assume the existence of an attribute
called <b class="const">@type</b>, and are short-hand forms useful for cost-like
tree query, html tree editing, and so on.</p>
<dl class="definitions">
<dt><b class="method">nodetype</b></dt>
<dd><p>Returns the node type of nodes.
Attribute string accessor. This is equivalent to</p>
<pre class="example">get @type</pre>
</dd>
<dt><b class="method">oftype</b> <i class="arg">t</i></dt>
<dd><p>Reduces the node set to nodes whose type is equal to <i class="arg">t</i>, with
letter case ignored.</p></dd>
<dt><b class="method">nottype</b> <i class="arg">t</i></dt>
<dd><p>Reduces the node set to nodes whose type is not equal to <i class="arg">t</i>, with
letter case ignored.</p></dd>
<dt><b class="method">oftypes</b> <i class="arg">attrs</i></dt>
<dd><p>Reduces set to nodes whose @type is an element in the list <i class="arg">attrs</i>
of types. The value of @type is used as a glob pattern, and letter
case is relevant.</p></dd>
</dl>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">Examples</a></h2>
<p>... TODO ...</p>
</div>
<div id="section5" class="section"><h2><a name="section5">References</a></h2>
<ol class="enumerated">
<li><p><a href="http://wiki.tcl.tk/COST">COST</a> on the Tcler's Wiki.</p></li>
<li><p><a href="http://wiki.tcl.tk/treeql">TreeQL</a> on the Tcler's Wiki. Discuss
this package there.</p></li>
</ol>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>treeql</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key760">Cost</a>, <a href="../../../../index.html#key758">DOM</a>, <a href="../../../../index.html#key761">TreeQL</a>, <a href="../../../../index.html#key759">XPath</a>, <a href="../../../../index.html#key763">XSLT</a>, <a href="../../../../index.html#key764">structured queries</a>, <a href="../../../../index.html#key254">tree</a>, <a href="../../../../index.html#key762">tree query language</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004 Colin McCormack &lt;[email protected]&gt;<br>
Copyright &copy; 2004 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/try/tcllib_try.html.














































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>try - Forward compatibility implementation of [try]</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/try/tcllib_try.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Donal K. Fellows, BSD licensed
   -->
<! -- CVS: $Id$ try.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">try(n) 1 tcllib &quot;Forward compatibility implementation of [try]&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>try - try - Trap and process errors and exceptions</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">EXAMPLES</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">try <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::try</b> <i class="arg">body</i> <span class="opt">?<i class="arg">handler...</i>?</span> <span class="opt">?<b class="method">finally</b> <i class="arg">script</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a forward-compatibility implementation of Tcl
8.6's try/finally command (TIP 329), for Tcl 8.5. The code was
directly pulled from Tcl 8.6 revision ?, when try/finally was
implemented as Tcl procedure instead of in C.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::try</b> <i class="arg">body</i> <span class="opt">?<i class="arg">handler...</i>?</span> <span class="opt">?<b class="method">finally</b> <i class="arg">script</i>?</span></a></dt>
<dd><p>This command executes the script <i class="arg">body</i> and, depending on what the
outcome of that script is (normal exit, error, or some other
exceptional result), runs a handler script to deal with the case. Once
that has all happened, if the <b class="method">finally</b> clause is present, the
<i class="arg">script</i> it includes will be run and the result of the handler (or
the <i class="arg">body</i> if no handler matched) is allowed to continue to
propagate. Note that the <b class="method">finally</b> clause is processed even if
an error occurs and irrespective of which, if any, <i class="arg">handler</i> is
used.</p>
<p>The <i class="arg">handler</i> clauses are each expressed as several words,
and must have one of the following forms:</p>
<dl class="definitions">
<dt><b class="method">on</b> <i class="arg">code variableList script</i></dt>
<dd><p>This clause matches if the evaluation of <i class="arg">body</i> completed with the
exception code <i class="arg">code</i>. The <i class="arg">code</i> may be expressed as an
integer or one of the following literal words:
<b class="const">ok</b>, <b class="const">error</b>, <b class="const">return</b>, <b class="const">break</b>, or
<b class="const">continue</b>. Those literals correspond to the integers 0 through
4 respectively.</p></dd>
<dt><b class="method">trap</b> <i class="arg">pattern variableList script</i></dt>
<dd><p>This clause matches if the evaluation of <i class="arg">body</i> resulted in an
error and the prefix of the <b class="option">-errorcode</b> from the interpreter's
status dictionary is equal to the <i class="arg">pattern</i>. The number of prefix
words taken from the <b class="option">-errorcode</b> is equal to the list-length
of <i class="arg">pattern</i>, and inter-word spaces are normalized in both the
<b class="option">-errorcode</b> and <i class="arg">pattern</i> before comparison.</p>
<p>The <i class="arg">variableList</i> word in each <i class="arg">handler</i> is always
interpreted as a list of variable names. If the first word of the list
is present and non-empty, it names a variable into which the result of
the evaluation of <i class="arg">body</i> (from the main <b class="cmd">try</b>) will be placed;
this will contain the human-readable form of any errors. If the second
word of the list is present and non-empty, it names a variable into
which the options dictionary of the interpreter at the moment of
completion of execution of <i class="arg">body</i> will be placed.</p>
<p>The <i class="arg">script</i> word of each <i class="arg">handler</i> is also always
interpreted the same: as a Tcl script to evaluate if the clause is
matched. If <i class="arg">script</i> is a literal <b class="const">-</b> and the <i class="arg">handler</i>
is not the last one, the <i class="arg">script</i> of the following <i class="arg">handler</i>
is invoked instead (just like with the <b class="cmd">switch</b> command).</p>
<p>Note that <i class="arg">handler</i> clauses are matched against in order,
and that the first matching one is always selected.
At most one <i class="arg">handler</i> clause will selected.
As a consequence, an <b class="method">on error</b> will mask any subsequent
<b class="method">trap</b> in the <b class="cmd">try</b>. Also note that <b class="method">on error</b> is
equivalent to <b class="method">trap {}</b>.</p>
<p>If an exception (i.e. any non-<b class="const">ok</b> result) occurs during
the evaluation of either the <i class="arg">handler</i> or the <b class="method">finally</b>
clause, the original exception's status dictionary will be added to
the new exception's status dictionary under the <b class="option">-during</b> key.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section2" class="section"><h2><a name="section2">EXAMPLES</a></h2>
<p>Ensure that a file is closed no matter what:</p>
<pre class="example">
set f [open /some/file/name a]
<b class="cmd">try</b> {
    puts \$f &quot;some message&quot;
    # ...
} <b class="cmd">finally</b> {
    close \$f
}
</pre>
<p>Handle different reasons for a file to not be openable for reading:</p>
<pre class="example">
<b class="cmd">try</b> {
    set f [open /some/file/name]
} <b class="method">trap</b> {POSIX EISDIR} {} {
    puts &quot;failed to open /some/file/name: it's a directory&quot;
} <b class="method">trap</b> {POSIX ENOENT} {} {
    puts &quot;failed to open /some/file/name: it doesn't exist&quot;
}
</pre>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>try</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p>catch(n), error(n), return(n), throw(n)</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key151">cleanup</a>, <a href="../../../../index.html#key154">error</a>, <a href="../../../../index.html#key155">exception</a>, <a href="../../../../index.html#key153">final</a>, <a href="../../../../index.html#key152">resource management</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Utility</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Donal K. Fellows, BSD licensed</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/uev/uevent.html.




























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>uevent - User events</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/uev/uevent.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2012 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ uevent.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">uevent(n) 0.3.1 tcllib &quot;User events&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>uevent - User events</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">uevent <span class="opt">?0.3.1?</span></b></li>
<li>package require <b class="pkgname">logger</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::uevent::bind</b> <i class="arg">tag</i> <i class="arg">event</i> <i class="arg">command</i></a></li>
<li><a href="#2"><b class="cmd"><a href="../../../../index.html#key236">command</a></b> <i class="arg">tag</i> <i class="arg">event</i> <i class="arg">details</i></a></li>
<li><a href="#3"><b class="cmd">::uevent::unbind</b> <i class="arg">token</i></a></li>
<li><a href="#4"><b class="cmd">::uevent::generate</b> <i class="arg">tag</i> <i class="arg">event</i> <span class="opt">?<i class="arg">details</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::uevent::list</b></a></li>
<li><a href="#6"><b class="cmd">::uevent::list</b> <i class="arg">tag</i></a></li>
<li><a href="#7"><b class="cmd">::uevent::list</b> <i class="arg">tag</i> <i class="arg">event</i></a></li>
<li><a href="#8"><b class="cmd">::uevent::watch::tag::add</b> <i class="arg">pattern</i> <i class="arg">command</i></a></li>
<li><a href="#9"><b class="cmd">{*}command</b> <b class="const">bound</b> <i class="arg">tag</i></a></li>
<li><a href="#10"><b class="cmd">{*}command</b> <b class="const">unbound</b> <i class="arg">tag</i></a></li>
<li><a href="#11"><b class="cmd">::uevent::watch::tag::remove</b> <i class="arg">token</i></a></li>
<li><a href="#12"><b class="cmd">::uevent::watch::event::add</b> <i class="arg">tag_pattern</i> <i class="arg">event_pattern</i> <i class="arg">command</i></a></li>
<li><a href="#13"><b class="cmd">{*}command</b> <b class="const">bound</b> <i class="arg">tag</i> <i class="arg">event</i></a></li>
<li><a href="#14"><b class="cmd">{*}command</b> <b class="const">unbound</b> <i class="arg">tag</i> <i class="arg">event</i></a></li>
<li><a href="#15"><b class="cmd">::uevent::watch::event::remove</b> <i class="arg">token</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a general facility for the handling of user
events. Allows the binding of arbitrary commands to arbitrary events
on arbitrary tags, removal of bindings, and event generation.</p>
<p>The main difference to the event system built into the Tcl/Tk core is
that the latter can generate only virtual events, and only for
widgets. It is not possible to use the builtin facilities to bind to
events on arbitrary (pseudo-)objects, nor is it able to generate
events for such.</p>
<p>Here we can, by assuming that each object in question is represented
by its own tag. Which is possible as we allow arbitrary tags.</p>
<p>More differences:</p>
<ol class="enumerated">
<li><p>The package uses only a two-level hierarchy, tags and events, to
handle everything, whereas the Tcl/Tk system uses three levels, i.e.
objects, tags, and events, with a n:m relationship between objects and
tags.</p></li>
<li><p>This package triggers all bound commands for a tag/event combination,
and they are independent of each other. A bound command cannot force
the event processing core to abort the processing of command coming
after it.</p></li>
</ol>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports eight commands, as specified below. Note that when
the package is used from within Tcl 8.5+ all the higher commands are
ensembles, i.e. the :: separators can be replaceed by spaces.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::uevent::bind</b> <i class="arg">tag</i> <i class="arg">event</i> <i class="arg">command</i></a></dt>
<dd><p>Using this command registers the <i class="arg">command</i> prefix to be triggered
when the <i class="arg">event</i> occurs for the <i class="arg">tag</i>. The result of the
command is an opaque token representing the binding. Note that if the
same combination of &lt;<i class="arg">tag</i>,<i class="arg">event</i>,<i class="arg">command</i>&gt; is used
multiple times the same token is returned by every call.</p>
<p>The signature of the <i class="arg">command</i> prefix is</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd"><a href="../../../../index.html#key236">command</a></b> <i class="arg">tag</i> <i class="arg">event</i> <i class="arg">details</i></a></dt>
<dd></dd>
</dl>
<p>where <i class="arg">details</i> contains the argument(s) of the event. Its
contents are event specific and have to be agreed upon between actual
event generator and consumer. This package simply transfers the
information and does not perform any processing beyond that.</p></dd>
<dt><a name="3"><b class="cmd">::uevent::unbind</b> <i class="arg">token</i></a></dt>
<dd><p>This command releases the event binding represented by the
<i class="arg">token</i>. The token has to be the result of a call to
<b class="cmd">::uevent::bind</b>. The result of the command is the empty string.</p></dd>
<dt><a name="4"><b class="cmd">::uevent::generate</b> <i class="arg">tag</i> <i class="arg">event</i> <span class="opt">?<i class="arg">details</i>?</span></a></dt>
<dd><p>This command generates an <i class="arg">event</i> for the <i class="arg">tag</i>, triggering
all commands bound to that combination. The <i class="arg">details</i> argument is
simply passed unchanged to all event handlers. It is the
responsibility of the code generating and consuming the event to have
an agreement about the format and contents of the information carried
therein. The result of the command is the empty string.</p>
<p>Note that all bound commands are triggered, independently of each
other. The event handlers cannot assume a specific order. They are
also <em>not</em> called synchronously with the invokation of this
command, but simply put into the event queue for processing when the
system returns to the event loop.</p>
<p>Generating an event for an unknown tag, or for a
&lt;<i class="arg">tag</i>,<i class="arg">event</i>&gt; combination which has no commands bound to it
is allowed, such calls will be ignored.</p></dd>
<dt><a name="5"><b class="cmd">::uevent::list</b></a></dt>
<dd><p>In this form the command returns a list containing the names of all
tags which have events with commands bound to them.</p></dd>
<dt><a name="6"><b class="cmd">::uevent::list</b> <i class="arg">tag</i></a></dt>
<dd><p>In this format the command returns a list containing the names of all
events for the <i class="arg">tag</i> with commands bound to them. Specifying an
unknown tag, i.e. a tag without event and commands, will cause the
command to throw an error.</p></dd>
<dt><a name="7"><b class="cmd">::uevent::list</b> <i class="arg">tag</i> <i class="arg">event</i></a></dt>
<dd><p>In this format the command returns a list containing all commands
bound to the <i class="arg">event</i> for the <i class="arg">tag</i>. Specifying an unknown tag
or unknown event, will cause the command to throw an error.</p></dd>
<dt><a name="8"><b class="cmd">::uevent::watch::tag::add</b> <i class="arg">pattern</i> <i class="arg">command</i></a></dt>
<dd><p>This command sets up a sort of reverse events. Events generated,
i.e. the <i class="arg">command</i> prefix invoked, when observers bind to and
unbind from specific tags.</p>
<p>Note that the command prefix is only invoked twice per tag,
first when the first command is bound to any event of the tag, and
second when the last command bound to the tag is removed.</p>
<p>The signature of the <i class="arg">command</i> prefix is</p>
<dl class="definitions">
<dt><a name="9"><b class="cmd">{*}command</b> <b class="const">bound</b> <i class="arg">tag</i></a></dt>
<dd></dd>
<dt><a name="10"><b class="cmd">{*}command</b> <b class="const">unbound</b> <i class="arg">tag</i></a></dt>
<dd></dd>
</dl>
<p>The result of the command is a token representing the watcher.</p></dd>
<dt><a name="11"><b class="cmd">::uevent::watch::tag::remove</b> <i class="arg">token</i></a></dt>
<dd><p>This command removes a watcher for (un)bind events on tags.</p>
<p>The result of the command is the empty string.</p></dd>
<dt><a name="12"><b class="cmd">::uevent::watch::event::add</b> <i class="arg">tag_pattern</i> <i class="arg">event_pattern</i> <i class="arg">command</i></a></dt>
<dd><p>This command sets up a sort of reverse events. Events generated,
i.e. the <i class="arg">command</i> prefix invoked, when observers bind to and
unbind from specific combinations of tags and events.</p>
<p>Note that the command prefix is only invoked twice per
tag/event combination, first when the first command is bound to it,
and second when the last command bound to the it is removed.</p>
<p>The signature of the <i class="arg">command</i> prefix is</p>
<dl class="definitions">
<dt><a name="13"><b class="cmd">{*}command</b> <b class="const">bound</b> <i class="arg">tag</i> <i class="arg">event</i></a></dt>
<dd></dd>
<dt><a name="14"><b class="cmd">{*}command</b> <b class="const">unbound</b> <i class="arg">tag</i> <i class="arg">event</i></a></dt>
<dd></dd>
</dl>
<p>The result of the command is a token representing the watcher.</p></dd>
<dt><a name="15"><b class="cmd">::uevent::watch::event::remove</b> <i class="arg">token</i></a></dt>
<dd><p>This command removes a watcher for (un)bind events on tag/event
combinations.</p>
<p>The result of the command is the empty string.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>uevent</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../hook/hook.html">hook(n)</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key659">bind</a>, <a href="../../../../index.html#key496">event</a>, <a href="../../../../index.html#key658">generate event</a>, <a href="../../../../index.html#key632">hook</a>, <a href="../../../../index.html#key657">unbind</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2012 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/uev/uevent_onidle.html.
























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>uevent::onidle - User events</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/uev/uevent_onidle.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ uevent::onidle.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">uevent::onidle(n) 0.1 tcllib &quot;User events&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>uevent::onidle - Request merging and deferal to idle time</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Examples</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">uevent::onidle <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">logger</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::uevent::onidle</b> <i class="arg">objectName</i> <i class="arg">commandprefix</i></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">request</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides objects which can merge multiple requestes for
an action and execute the action the moment the system (event loop)
becomes idle. The action to be run is configured during object
construction.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<p>The package exports a class, <b class="class">uevent::onidle</b>, as specified
below.</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::uevent::onidle</b> <i class="arg">objectName</i> <i class="arg">commandprefix</i></a></dt>
<dd><p>The command creates a new <i class="term">onidle</i> object with an associated
global Tcl command whose name is <i class="arg">objectName</i>.  This command may
be used to invoke various operations on the object.</p>
<p>The <i class="arg">commandprefix</i> is the action to perform when the event loop
is idle and the user asked for it using the method <b class="method">request</b>
(See below).</p></dd>
</dl>
<p>The object commands created by the class commands above have
the form:</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">request</b></a></dt>
<dd><p>This method requests the execution of the command prefix specified
during the construction of <i class="arg">objectName</i> the next time the event
loop is idle. Multiple requests are merged and cause only one
execution of the command prefix.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Examples</a></h2>
<p>Examples of this type of deferal are buried in the (C-level)
implementations all the Tk widgets, defering geometry calculations and
window redraw activity in this manner.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>uevent</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key494">callback</a>, <a href="../../../../index.html#key497">deferal</a>, <a href="../../../../index.html#key496">event</a>, <a href="../../../../index.html#key495">idle</a>, <a href="../../../../index.html#key493">merge</a>, <a href="../../../../index.html#key492">on-idle</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/units/units.html.




























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>units - Convert and manipulate quantities with units</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/units/units.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2000-2005 Mayo Foundation
   -->
<! -- CVS: $Id$ units.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">units(n) 1.2 tcllib &quot;Convert and manipulate quantities with units&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>units - unit conversion</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">UNIT STRING FORMAT</a>
<ul>
<li class="subsection"><a href="#subsection1">Example Valid Unit Strings</a></li>
</ul>
</li>
<li class="section"><a href="#section4">SI UNITS</a>
<ul>
<li class="subsection"><a href="#subsection2">SI Base Units</a></li>
<li class="subsection"><a href="#subsection3">SI Derived Units with Special Names</a></li>
<li class="subsection"><a href="#subsection4">SI Prefixes</a></li>
<li class="subsection"><a href="#subsection5">Non-SI Units</a></li>
<li class="subsection"><a href="#subsection6">Quantities and Derived Units with Special Names</a></li>
</ul>
</li>
<li class="section"><a href="#section5">REFERENCES</a></li>
<li class="section"><a href="#section6">AUTHORS</a></li>
<li class="section"><a href="#section7">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.1</b></li>
<li>package require <b class="pkgname">units <span class="opt">?2.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::units::convert</b> <i class="arg">value</i> <i class="arg">targetUnits</i></a></li>
<li><a href="#2"><b class="cmd">::units::reduce</b> <i class="arg">unitString</i></a></li>
<li><a href="#3"><b class="cmd">::units::new</b> <i class="arg">name</i> <i class="arg">baseUnits</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This library provides a conversion facility from a variety of
scientific and engineering shorthand notations into floating point
numbers.  This allows application developers to easily convert
values with different units into uniformly scaled numbers.</p>
<p>The units conversion facility is also able to convert between
compatible units.  If, for example, a application is expecting a value
in <em>ohms</em> (Resistance), and the user specifies units of
<em>milliwebers/femtocoulomb</em>, the conversion routine will
handle it appropriately.  An error will be generated if an incorrect
conversion is attempted.</p>
<p>Values are scaled from one set of units to another by dimensional
analysis.  Both the value units and the target units are reduced into
primitive units and a scale factor.  Units are checked for
compatibility, and the scale factors are applied by multiplication and
division.  This technique is extremely flexible and quite robust.</p>
<p>New units and new unit abbreviations can be defined in terms of
existing units and abbreviations.  It is also possible to define a new
primitive unit, although that will probably be unnecessary.  New units
will most commonly be defined to accommodate non-SI measurement
systems, such as defining the unit <em>inch</em> as <em>2.54 cm</em>.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::units::convert</b> <i class="arg">value</i> <i class="arg">targetUnits</i></a></dt>
<dd><p>Converts the <i class="arg">value</i> string into a floating point number, scaled to the
specified <i class="arg">targetUnits</i>.  The <i class="arg">value</i> string may contain a
number and units.  If units are specified, then they must be
compatible with the <i class="arg">targetUnits</i>.  If units are not specified
for the <i class="arg">value</i>, then it will be scaled to the target units.  For
example,</p>
<pre class="example">
% ::units::convert &quot;2.3 miles&quot; km
3.7014912
% ::units::convert 300m/s miles/hour
671.080887616
% ::units::convert &quot;1.0 m kg/s^2&quot; newton
1.0
% ::units::convert 1.0 millimeter
1000.0
</pre>
</dd>
<dt><a name="2"><b class="cmd">::units::reduce</b> <i class="arg">unitString</i></a></dt>
<dd><p>Returns a unit string consisting of a scale factor followed by a space
separated list of sorted and reduced primitive units.  The reduced
unit string may include a forward-slash (separated from the
surrounding primitive subunits by spaces) indicating that the
remaining subunits are in the denominator.  Generates an error if the
<i class="arg">unitString</i> is invalid.</p>
<pre class="example">
% ::units::reduce pascal
1000.0 gram / meter second second
</pre>
</dd>
<dt><a name="3"><b class="cmd">::units::new</b> <i class="arg">name</i> <i class="arg">baseUnits</i></a></dt>
<dd><p>Creates a new unit conversion with the specified name.  The new unit
<i class="arg">name</i> must be only alphabetic (upper or lower case) letters.
The <i class="arg">baseUnits</i> string can consist of any valid units conversion
string, including constant factors, numerator and denominator parts,
units with prefixes, and exponents.  The baseUnits may contain any
number of subunits, but it must reduce to primitive units.  BaseUnits
could also be the string <em>-primitive</em> to represent a new
kind of quantity which cannot be derived from other units.  But you
probably would not do that unless you have discovered some kind of new
universal property.</p>
<pre class="example">
% ::units::new furlong &quot;220 yards&quot;
% ::units::new fortnight &quot;14 days&quot;
% ::units::convert 100m/s furlongs/fortnight
601288.475303
</pre>
</dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">UNIT STRING FORMAT</a></h2>
<p>Value and unit string format is quite flexible.  It is possible to
define virtually any combination of units, prefixes, and powers.
Valid unit strings must conform to these rules.</p>
<ul class="itemized">
<li><p>A unit string consists of an optional scale factor followed by zero or
more subunits.  The scale factor must be a valid floating point
number, and may or may not be separated from the subunits.  The scale
factor could be negative.</p></li>
<li><p>Subunits are separated form each other by one or more separator
characters, which are space (&quot; &quot;), hyphen (&quot;-&quot;), asterisk (&quot;*&quot;), and
forward-slash (&quot;/&quot;).  Sure, go ahead and complain about using a minus
sign (&quot;-&quot;) to represent multiplication.  It just isn't sound
mathematics, and, by rights, we should require everyone to use the
asterisk (&quot;*&quot;) to separate all units.  But the bottom line is that
complex unit strings like <em>m-kg/s^2</em> are pleasantly
readable.</p></li>
<li><p>The forward-slash seperator (&quot;/&quot;) indicates that following subunits are
in the denominator.  There can be at most one forward-slash separator.</p></li>
<li><p>Subunits can be floating point scale factors, but with the exception
of the leading scale factor, they must be surrounded by valid
separators.  Subunit scale factors cannot be negative. (Remember that
the hyphen is a unit separator.)</p></li>
<li><p>Subunits can be valid units or abbreviations.  They may include a
prefix.  They may include a plural suffix &quot;s&quot; or &quot;es&quot;.  They may also
include a power string denoted by a circumflex (&quot;^&quot;), followed by a
integer, after the unit name (or plural suffix, if there is one).
Negative exponents are not allowed.  (Remember that the hyphen is a
unit separator.)</p></li>
</ul>
<div id="subsection1" class="subsection"><h3><a name="subsection1">Example Valid Unit Strings</a></h3>
<pre class="example">
Unit String              Reduced Unit String
------------------------------------------------------------
meter                    1.0 meter
kilometer                1000.0 meter
km                       1000.0 meter
km/s                     1000.0 meter / second
/microsecond             1000000.0 / second
/us                      1000000.0 / second
kg-m/s^2                 1000.0 gram meter / second second
30second                 30.0 second
30 second                30.0 second
30 seconds               30.0 second
200*meter/20.5*second    9.75609756098 meter / second
</pre>
</div>
</div>
<div id="section4" class="section"><h2><a name="section4">SI UNITS</a></h2>
<p>The standard SI units are predefined according to <em>NIST Special
Publication 330</em>.  Standard units for both SI Base Units (Table
1) and SI Derived Units with Special Names (Tables 3a and 3b) are
included here for reference.  Each standard unit name and abbreviation
are included in this package.</p>
<div id="subsection2" class="subsection"><h3><a name="subsection2">SI Base Units</a></h3>
<pre class="example">
Quantity                Unit Name    Abbr.
---------------------------------------------
Length                  meter        m
Mass                    kilogram     kg
Time                    second       s
Current                 ampere       A
Temperature             kelvin       K
Amount                  mole         mol
Luminous Intensity      candela      cd
</pre>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">SI Derived Units with Special Names</a></h3>
<pre class="example">
Quantity                Unit Name    Abbr.   Units     Base Units
--------------------------------------------------------------------
plane angle             radian      rad     m/m       m/m
solid angle             steradian   sr      m^2/m^2   m^2/m^2
frequency               hertz       Hz                /s
force                   newton      N                 m-kg/s^2
pressure                pascal      Pa      N/m^2     kg/m-s^2
energy, work            joule       J       N-m       m^2-kg/s^2
power, radiant flux     watt        W       J/s       m^2-kg/s^3
electric charge         coulomb     C                 s-A
electric potential      volt        V       W/A       m^2-kg/s^3-A
capacitance             farad       F       C/V       s^4-A^2/m^2-kg
electric resistance     ohm                 V/A       m^2-kg/s^3-A^2
electric conductance    siemens     S       A/V       s^3-A^2/m^2-kg
magnetic flux           weber       Wb      V-s       m^2-kg/s^2-A
magnetic flux density   tesla       T       Wb/m^2    kg/s^2-A
inductance              henry       H       Wb/A      m^2-kg/s^2-A^2
luminous flux           lumen       lm                cd-sr
illuminance             lux         lx      lm/m^2    cd-sr/m^2
activity (of a
radionuclide)           becquerel   Bq                /s
absorbed dose           gray        Gy      J/kg      m^2/s^2
dose equivalent         sievert     Sv      J/kg      m^2/s^2
</pre>
<p>Note that the SI unit kilograms is actually implemented as grams
because 1e-6 kilogram = 1 milligram, not 1 microkilogram.  The
abbreviation for Electric Resistance (ohms), which is the omega
character, is not supported.</p>
<p>Also note that there is no support for Celsius or Farenheit
temperature.  The units conversion routines can only scale values
with multiplication and division, so it is not possible to convert
from thermodynamic temperature (kelvins) to absolute degrees Celsius
or Farenheit.  Conversion of thermodynamic quantities, such as
thermal expansion (per unit temperature), however, are easy to add
to the units library.</p>
<p>SI Units can have a multiple or sub-multiple prefix.  The prefix or its
abbreviation should appear before the unit, without spaces.  Compound
prefixes are not allowed, and a prefix should never be used alone.
These prefixes are defined in Table 5 of <em>Special Publication
330</em>.</p>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">SI Prefixes</a></h3>
<pre class="example">
Prefix Name     Abbr.   Factor
---------------------------------------
yotta           Y       1e24
zetta           Z       1e21
exa             E       1e18
peta            P       1e15
tera            T       1e12
giga            G       1e9
mega            M       1e6
kilo            k       1e3
hecto           h       1e2
deka            da      1e1
deca                    1e1
deci            d       1e-1
centi           c       1e-2
milli           m       1e-3
micro           u       1e-6
nano            n       1e-9
pico            p       1e-12
femto           f       1e-15
atto            a       1e-18
zepto           z       1e-21
yocto           y       1e-24
</pre>
<p>Note that we define the same prefix with both the USA (&quot;deka&quot;) and
non-USA (&quot;deca&quot;) spellings.  Also note that we take the liberty of
allowing &quot;micro&quot; to be typed as a &quot;u&quot; instead of the Greek character
mu.</p>
<p>Many non-SI units are commonly used in applications.  Appendix B.8 of
<em>NIST Special Publication 811</em> lists many non-SI conversion
factors.  It is not possible to include all possible unit definitions
in this package.  In some cases, many different conversion factors
exist for a given unit, depending on the context. (The appendix lists
over 40 conversions for British thermal units!)  Application specific
conversions can always be added using the <b class="cmd">new</b>
command, but some well known and often used conversions are included
in this package.</p>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Non-SI Units</a></h3>
<pre class="example">
Unit Name            Abbr.    Base Units
--------------------------------------------------
angstrom                      1.0E-10 m
astronomicalUnit     AU       1.495979E11 m
atmosphere                    1.01325E5 Pa
bar                           1.0E5 Pa
calorie                       4.1868 J
curie                         3.7E10 Bq
day                           8.64E4 s
degree                        1.745329E-2 rad
erg                           1.0E-7 J
faraday                       9.648531 C
fermi                         1.0E-15 m
foot                 ft       3.048E-1 m
gauss                         1.0E-4 T
gilbert                       7.957747E-1 A
grain                gr       6.479891E-5 kg
hectare              ha       1.0E4 m^2
hour                 h        3.6E3 s
inch                 in       2.54E-2 m
lightYear                     9.46073E15 m
liter                L        1.0E-3 m^3
maxwell              Mx       1.0E-8 Wb
mho                           1.0 S
micron                        1.0E-6 m
mil                           2.54E-5 m
mile                 mi       1.609344E3 m
minute               min      6.0E1 s
parsec               pc       3.085E16 m
pica                          4.233333E-3 m
pound                lb       4.535924E-1 kg
revolution                    6.283185 rad
revolutionPerMinute  rpm      1.047198E-1 rad/s
yard                 yd       9.144E-1 m
year                          3.1536E7 s
</pre>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Quantities and Derived Units with Special Names</a></h3>
<p>This units conversion package is limited specifically to unit
reduction, comparison, and scaling.  This package does not consider
any of the quantity names for either base or derived units.  A similar
implementation or an extension in a typed or object-oriented language
might introduce user defined types for the quantities.  Quantity type
checking could be used, for example, to ensure that all
<em>length</em> values properly reduced to <em>meters</em>, or
that all <em>velocity</em> values properly reduced to
<em>meters/second</em>.</p>
<p>A C implementation of this package has been created to work in
conjunction with the Simplified Wrapper Interface Generator
(<a href="http://www.swig.org/">http://www.swig.org/</a>).  That package (units.i) exploits SWIG's typemap
system to automatically convert script quantity strings into floating
point quantities.  Function arguments are specified as quantity types
(e.g., <em>typedef float Length</em>), and target units (expected
by the C application code) are specified in an associative array.
Default units are also defined for each quantity type, and are applied
to any unit-less quantity strings.</p>
<p>A units system enhanced with quantity type checking might benefit from
inclusion of other derived types which are expressed in terms of
special units, as illustrated in Table 2 of <em>NIST Publication
330</em>.  The quantity <em>area</em>, for example, could be
defined as units properly reducing to <em>meter^2</em>, although
the utility of defining a unit named <em>square meter</em> is
arguable.</p>
</div>
</div>
<div id="section5" class="section"><h2><a name="section5">REFERENCES</a></h2>
<p>The unit names, abbreviations, and conversion values are derived from
those published by the United States Department of Commerce Technology
Administration, National Institute of Standards and Technology (NIST)
in <em>NIST Special Publication 330: The International System of
Units (SI)</em> and <em>NIST Special Publication 811: Guide for
the Use of the International System of Units (SI)</em>.  Both of
these publications are available (as of December 2000) from
<a href="http://physics.nist.gov/cuu/Reference/contents.html">http://physics.nist.gov/cuu/Reference/contents.html</a></p>
<p>The ideas behind implementation of this package is based in part on
code written in 1993 by Adrian Mariano which performed dimensional
analysis of unit strings using fixed size tables of C structs.  After
going missing in the late 1990's, Adrian's code has reappeared in the
GNU Units program at <a href="http://www.gnu.org/software/units/">http://www.gnu.org/software/units/</a></p>
</div>
<div id="section6" class="section"><h2><a name="section6">AUTHORS</a></h2>
<p>Robert W. Techentin</p>
</div>
<div id="section7" class="section"><h2><a name="section7">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>units</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key532">angle</a>, <a href="../../../../index.html#key560">constants</a>, <a href="../../../../index.html#key3">conversion</a>, <a href="../../../../index.html#key428">distance</a>, <a href="../../../../index.html#key561">radians</a>, <a href="../../../../index.html#key559">unit</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2000-2005 Mayo Foundation</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/uri/uri.html.














































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>uri - Tcl Uniform Resource Identifier Management</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/uri/uri.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ uri.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">uri(n) 1.2.2 tcllib &quot;Tcl Uniform Resource Identifier Management&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>uri - URI utilities</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">SCHEMES</a></li>
<li class="section"><a href="#section4">EXTENDING</a></li>
<li class="section"><a href="#section5">CREDITS</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">uri <span class="opt">?1.2.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">uri::split</b> <i class="arg">url</i> <span class="opt">?<i class="arg">defaultscheme</i>?</span></a></li>
<li><a href="#2"><b class="cmd">uri::join</b> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>?</span>...</a></li>
<li><a href="#3"><b class="cmd">uri::resolve</b> <i class="arg">base</i> <i class="arg">url</i></a></li>
<li><a href="#4"><b class="cmd">uri::isrelative</b> <i class="arg">url</i></a></li>
<li><a href="#5"><b class="cmd">uri::geturl</b> <i class="arg">url</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#6"><b class="cmd">uri::canonicalize</b> <i class="arg">uri</i></a></li>
<li><a href="#7"><b class="cmd">uri::register</b> <i class="arg">schemeList</i> <i class="arg">script</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package contains two parts. First it provides regular expressions
for a number of url/uri schemes. Second it provides a number of
commands for manipulating urls/uris and fetching data specified by
them. For the latter this package analyses the requested url/uri and
then dispatches it to the appropriate package (http, ftp, ...) for
actual fetching.</p>
<p>The package currently does not conform to
RFC 2396 (<a href="http://www.rfc-editor.org/rfc/rfc2396.txt">http://www.rfc-editor.org/rfc/rfc2396.txt</a>),
but quite likely should be. Patches and other help are welcome.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">uri::split</b> <i class="arg">url</i> <span class="opt">?<i class="arg">defaultscheme</i>?</span></a></dt>
<dd><p><b class="cmd">uri::split</b> takes an <i class="arg">url</i>, decodes it and then returns a
list of key/value pairs suitable for <b class="cmd">array set</b> containing the
constituents of the <i class="arg">url</i>. If the scheme is missing from the url
it defaults to the value of <i class="arg">defaultscheme</i> if it was specified,
or <i class="term"><a href="../../../../index.html#key481">http</a></i> else. Currently only the schemes <i class="term"><a href="../../../../index.html#key481">http</a></i>,
<i class="term"><a href="../../../../index.html#key249">ftp</a></i>, <i class="term"><a href="../../../../index.html#key488">mailto</a></i>, <i class="term"><a href="../../../../index.html#key527">urn</a></i>, <i class="term"><a href="../../../../index.html#key485">news</a></i>, <i class="term"><a href="../../../../index.html#key124">ldap</a></i> and
<i class="term"><a href="../../../../index.html#key31">file</a></i> are supported by the package itself.
See section <span class="sectref"><a href="#section4">EXTENDING</a></span> on how to expand that range.</p>
<p>The set of constituents of an url (= the set of keys in the returned
dictionary) is dependent on the scheme of the url. The only key which
is therefore always present is <b class="const">scheme</b>. For the following
schemes the constituents and their keys are known:</p>
<dl class="definitions">
<dt>ftp</dt>
<dd><p><b class="const">user</b>, <b class="const">pwd</b>, <b class="const">host</b>, <b class="const">port</b>,
<b class="const">path</b>, <b class="const">type</b></p></dd>
<dt>http(s)</dt>
<dd><p><b class="const">user</b>, <b class="const">pwd</b>, <b class="const">host</b>, <b class="const">port</b>,
<b class="const">path</b>, <b class="const">query</b>, <b class="const">fragment</b>. The fragment
is optional.</p></dd>
<dt>file</dt>
<dd><p><b class="const">path</b>, <b class="const">host</b>. The host is optional.</p></dd>
<dt>mailto</dt>
<dd><p><b class="const">user</b>, <b class="const">host</b>. The host is optional.</p></dd>
<dt>news</dt>
<dd><p>Either <b class="const">message-id</b> or <b class="const">newsgroup-name</b>.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">uri::join</b> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>?</span>...</a></dt>
<dd><p><b class="cmd">uri::join</b> takes a list of key/value pairs (generated by
<b class="cmd">uri::split</b>, for example) and returns the canonical url they
represent. Currently only the schemes <i class="term"><a href="../../../../index.html#key481">http</a></i>, <i class="term"><a href="../../../../index.html#key249">ftp</a></i>,
<i class="term"><a href="../../../../index.html#key488">mailto</a></i>, <i class="term"><a href="../../../../index.html#key527">urn</a></i>, <i class="term"><a href="../../../../index.html#key485">news</a></i>, <i class="term"><a href="../../../../index.html#key124">ldap</a></i> and <i class="term"><a href="../../../../index.html#key31">file</a></i>
are supported. See section <span class="sectref"><a href="#section4">EXTENDING</a></span> on how to expand that
range.</p></dd>
<dt><a name="3"><b class="cmd">uri::resolve</b> <i class="arg">base</i> <i class="arg">url</i></a></dt>
<dd><p><b class="cmd">uri::resolve</b> resolves the specified <i class="arg">url</i> relative to
<i class="arg">base</i>. In other words: A non-relative <i class="arg">url</i> is returned
unchanged, whereas for a relative <i class="arg">url</i> the missing parts are
taken from <i class="arg">base</i> and prepended to it. The result of this
operation is returned. For an empty <i class="arg">url</i> the result is
<i class="arg">base</i>.</p></dd>
<dt><a name="4"><b class="cmd">uri::isrelative</b> <i class="arg">url</i></a></dt>
<dd><p><b class="cmd">uri::isrelative</b> determines whether the specified <i class="arg">url</i> is
absolute or relative.</p></dd>
<dt><a name="5"><b class="cmd">uri::geturl</b> <i class="arg">url</i> <span class="opt">?<i class="arg">options</i>...?</span></a></dt>
<dd><p><b class="cmd">uri::geturl</b> decodes the specified <i class="arg">url</i> and then dispatches
the request to the package appropriate for the scheme found in the
url. The command assumes that the package to handle the given scheme
either has the same name as the scheme itself (including possible
capitalization) followed by <b class="cmd">::geturl</b>, or, in case of this
failing, has the same name as the scheme itself (including possible
capitalization). It further assumes that whatever package was loaded
provides a <b class="cmd">geturl</b>-command in the namespace of the same name as
the package itself. This command is called with the given <i class="arg">url</i>
and all given <i class="arg">options</i>. Currently <b class="cmd">geturl</b> does not handle
any options itself.</p>
<p><em>Note:</em> <i class="term"><a href="../../../../index.html#key31">file</a></i>-urls are an exception to the rule
described above. They are handled internally.</p>
<p>It is not possible to specify results of the command. They depend on
the <b class="cmd">geturl</b>-command for the scheme the request was dispatched to.</p></dd>
<dt><a name="6"><b class="cmd">uri::canonicalize</b> <i class="arg">uri</i></a></dt>
<dd><p><b class="cmd">uri::canonicalize</b> returns the canonical form of a URI.  The
canonical form of a URI is one where relative path specifications,
ie. . and .., have been resolved.</p></dd>
<dt><a name="7"><b class="cmd">uri::register</b> <i class="arg">schemeList</i> <i class="arg">script</i></a></dt>
<dd><p><b class="cmd">uri::register</b> registers the first element of <i class="arg">schemeList</i> as
a new scheme and the remaining elements as aliases for this scheme. It
creates the namespace for the scheme and executes the <i class="arg">script</i> in
the new namespace. The script has to declare variables containing the
regular expressions relevant to the scheme. At least the variable
<b class="variable">schemepart</b> has to be declared as that one is used to extend
the variables keeping track of the registered schemes.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">SCHEMES</a></h2>
<p>In addition to the commands mentioned above this package provides
regular expression to recognize urls for a number of url schemes.</p>
<p>For each supported scheme a namespace of the same name as the scheme
itself is provided inside of the namespace <em>uri</em> containing the
variable <b class="variable">url</b> whose contents are a regular expression to
recognize urls of that scheme. Additional variables may contain
regular expressions for parts of urls for that scheme.</p>
<p>The variable <b class="variable">uri::schemes</b> contains a list of all supported
schemes. Currently these are <i class="term"><a href="../../../../index.html#key249">ftp</a></i>, <i class="term"><a href="../../../../index.html#key124">ldap</a></i>, <i class="term"><a href="../../../../index.html#key31">file</a></i>,
<i class="term"><a href="../../../../index.html#key481">http</a></i>, <i class="term"><a href="../../../../index.html#key486">gopher</a></i>, <i class="term"><a href="../../../../index.html#key488">mailto</a></i>, <i class="term"><a href="../../../../index.html#key485">news</a></i>,
<i class="term"><a href="../../../../index.html#key484">wais</a></i> and <i class="term"><a href="../../../../index.html#key482">prospero</a></i>.</p>
</div>
<div id="section4" class="section"><h2><a name="section4">EXTENDING</a></h2>
<p>Extending the range of schemes supported by <b class="cmd">uri::split</b> and
<b class="cmd">uri::join</b> is easy because both commands do not handle the
request by themselves but dispatch it to another command in the
<em>uri</em> namespace using the scheme of the url as criterion.</p>
<p><b class="cmd">uri::split</b> and <b class="cmd">uri::join</b>
call <b class="cmd">Split[string totitle &lt;scheme&gt;]</b>
and  <b class="cmd">Join[string totitle &lt;scheme&gt;]</b> respectively.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">CREDITS</a></h2>
<p>Original code (regular expressions) by Andreas Kupries.
Modularisation by Steve Ball, also the split/join/resolve
functionality.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>uri</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key487">fetching information</a>, <a href="../../../../index.html#key31">file</a>, <a href="../../../../index.html#key249">ftp</a>, <a href="../../../../index.html#key486">gopher</a>, <a href="../../../../index.html#key481">http</a>, <a href="../../../../index.html#key124">ldap</a>, <a href="../../../../index.html#key488">mailto</a>, <a href="../../../../index.html#key485">news</a>, <a href="../../../../index.html#key482">prospero</a>, <a href="../../../../index.html#key489">rfc 2255</a>, <a href="../../../../index.html#key491">rfc 2396</a>, <a href="../../../../index.html#key480">uri</a>, <a href="../../../../index.html#key483">url</a>, <a href="../../../../index.html#key484">wais</a>, <a href="../../../../index.html#key490">www</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/uri/urn-scheme.html.







































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>uri_urn - Tcl Uniform Resource Identifier Management</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/uri/urn-scheme.html' by tcllib/doctools with format 'html'
   -->
<! -- CVS: $Id$ uri_urn.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">uri_urn(n) 1.1.2 tcllib &quot;Tcl Uniform Resource Identifier Management&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>uri_urn - URI utilities, URN scheme</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">uri::urn <span class="opt">?1.1.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">uri::urn::quote</b> <i class="arg">url</i></a></li>
<li><a href="#2"><b class="cmd">uri::urn::unquote</b> <i class="arg">url</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides two commands to quote and unquote the disallowed
characters for url using the <i class="term"><a href="../../../../index.html#key527">urn</a></i> scheme, registers the scheme
with the package <b class="package"><a href="uri.html">uri</a></b>, and provides internal helpers which
will be automatically used by the commands <b class="cmd">uri::split</b> and
<b class="cmd">uri::join</b> of package <b class="package"><a href="uri.html">uri</a></b> to handle urls using the
<i class="term"><a href="../../../../index.html#key527">urn</a></i> scheme.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">uri::urn::quote</b> <i class="arg">url</i></a></dt>
<dd><p>This command quotes the characters disallowed by the <i class="term"><a href="../../../../index.html#key527">urn</a></i> scheme
(per RFC 2141 sec2.2) in the <i class="arg">url</i> and returns the modified url as
its result.</p></dd>
<dt><a name="2"><b class="cmd">uri::urn::unquote</b> <i class="arg">url</i></a></dt>
<dd><p>This commands performs the reverse of <b class="cmd">::uri::urn::quote</b>. It
takes an <i class="term"><a href="../../../../index.html#key527">urn</a></i> url, removes the quoting from all disallowed
characters, and returns the modified urls as its result.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>uri</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key528">rfc 2141</a>, <a href="../../../../index.html#key480">uri</a>, <a href="../../../../index.html#key483">url</a>, <a href="../../../../index.html#key527">urn</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Networking</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/uuid/uuid.html.























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title>uuid - uuid</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/uuid/uuid.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2004, Pat Thoyts &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ uuid.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">uuid(n) 1.0.2 tcllib &quot;uuid&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>uuid - UUID generation and comparison</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">REFERENCES</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">uuid <span class="opt">?1.0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::uuid::uuid generate</b></a></li>
<li><a href="#2"><b class="cmd">::uuid::uuid equal</b> <i class="arg">id1</i> <i class="arg">id2</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a generator of universally unique identifiers
(UUID) also known as globally unique identifiers (GUID). This
implementation follows the draft specification from (1) although this
is actually an expired draft document.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::uuid::uuid generate</b></a></dt>
<dd><p>Creates a type 4 uuid by MD5 hashing a number of bits of variant data
including the time and hostname.
Returns the string representation of the new uuid.</p></dd>
<dt><a name="2"><b class="cmd">::uuid::uuid equal</b> <i class="arg">id1</i> <i class="arg">id2</i></a></dt>
<dd><p>Compares two uuids and returns true if both arguments are the same uuid.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<pre class="example">
% uuid::uuid generate
b12dc22c-5c36-41d2-57da-e29d0ef5839c
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">REFERENCES</a></h2>
<ol class="enumerated">
<li><p>Paul J. Leach, &quot;UUIDs and GUIDs&quot;, February 1998.
    (<a href="http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt">http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt</a>)</p></li>
</ol>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>uuid</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key196">GUID</a>, <a href="../../../../index.html#key197">UUID</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2004, Pat Thoyts &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/cat.html.
















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::cat - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/cat.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2011 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::cat.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::cat(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::cat - Concatenation channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::cat <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::cat</b> <i class="arg">chan</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::cat</b> package provides a command creating
concatenation channels. These are non-seekable channels owning a list
of subordinate channels whose contents they return in order, until all
are exhausted. In this manner the cahnnel is the concatentation of the
contents of all the sub-ordinate channels.</p>
<p>Note that the created channels take ownership of the channels
they were constructed with. Whenever they have exhausted one of their
channel it will be closed. Similarly, closing the cat channel will
close all the sub-ordinates it still has.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/core.html">tcl::chan::core</a></b> framework.</p>
<p>Event handling is delegated to the currently active sub-channel.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::cat</b> <i class="arg">chan</i>...</a></dt>
<dd><p>This command creates the concatenation channel using all the provided
channels, and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key159">concatenation channel</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/facade.html.


































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::facade - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/facade.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2011 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::facade.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::facade(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::facade - Facade channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">logger</b></li>
<li>package require <b class="pkgname">tcl::chan::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::facade <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::facade</b> <i class="arg">chan</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::facade</b> package provides a command creating
facades to other channels. These are channels which own a single
subordinate channel and delegate all operations to.</p>
<p>The main use for facades is the debugging of actions on a
channel. While most of the information could be tracked by a virtual
channel transformation it does not have access to the event-related
operation, and furthermore they are only available in Tcl 8.6.</p>
<p>Therefore this channel, usable with Tcl 8.5, and having access
to everything going on for a channel.</p>
<p>The intercepted actions on channel are logged through package
<b class="package"><a href="../log/logger.html">logger</a></b>.</p>
<p>Beyond that facades provide the following additional channel
configuration options:</p>
<dl class="options">
<dt><b class="option">-self</b></dt>
<dd><p>The TclOO object handling the facade.</p></dd>
<dt><b class="option">-fd</b></dt>
<dd><p>The handle of the subordinate, i.e. wrapped channel.</p></dd>
<dt><b class="option">-used</b></dt>
<dd><p>The last time the wrapped channel was read from or written to by
the facade, as per <b class="cmd">clock milliseconds</b>. A value of <b class="const">0</b>
indicates that the subordinate channel was not accessed at all, yet.</p></dd>
<dt><b class="option">-created</b></dt>
<dd><p>The time the facade was created, as per <b class="cmd">clock milliseconds</b>.</p></dd>
<dt><b class="option">-user</b></dt>
<dd><p>A free-form value identifying the user of the facade and its
wrapped channel.</p></dd>
</dl>
<p>Of these only option <b class="option">-user</b> is writable.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::facade</b> <i class="arg">chan</i></a></dt>
<dd><p>This command creates the facade channel around the provided
channel <i class="arg">chan</i>, and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key159">concatenation channel</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/fifo.html.












































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::fifo - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/fifo.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::fifo.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::fifo(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::fifo - In-memory fifo channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::fifo <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::fifo</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::fifo</b> package provides a command creating
channels which live purely in memory. Access is fifo-like, i.e. things
are read out of the channel in the order they were written to it.
This is equivalent to the fifo channels provided by the package
<b class="package">Mmechan</b>, except that this is written in pure Tcl, not C. On
the other hand, <b class="package">Memchan</b> is usable with Tcl 8.4 and before,
whereas this package requires Tcl 8.5 or higher, and <b class="package"><a href="../../../../index.html#key706">TclOO</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::fifo</b></a></dt>
<dd><p>This command creates a new fifo channel and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key95">fifo</a>, <a href="../../../../index.html#key97">in-memory channel</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/fifo2.html.

















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::fifo2 - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/fifo2.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::fifo2.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::fifo2(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::fifo2 - In-memory interconnected fifo channels</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::halfpipe <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::fifo2 <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::fifo2</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::fifo2</b> package provides a command creating
pairs of channels which live purely in memory and are connected to
each other in a fifo manner. What is written to one half of the pair
can be read from the other half, in the same order. One particular
application for this is communication between threads, with one half
of the pair moved to the thread to talk to.
This is equivalent to the fifo2 channels provided by the package
<b class="package">Mmechan</b>, except that this is written in pure Tcl, not C. On
the other hand, <b class="package">Memchan</b> is usable with Tcl 8.4 and before,
whereas this package requires Tcl 8.5 or higher, and <b class="package"><a href="../../../../index.html#key706">TclOO</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::fifo2</b></a></dt>
<dd><p>This command creates a new connected pair of fifo channels and returns
their handles, as a list containing two elements.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key770">connected fifos</a>, <a href="../../../../index.html#key95">fifo</a>, <a href="../../../../index.html#key97">in-memory channel</a>, <a href="../../../../index.html#key769">inter-thread communication</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/halfpipe.html.








































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::halfpipe - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/halfpipe.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::halfpipe.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::halfpipe(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::halfpipe - In-memory channel, half of a fifo2</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Options</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::halfpipe <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::halfpipe <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::halfpipe</b> <span class="opt">?<b class="option">-option</b> <i class="arg">value</i>...?</span></a></li>
<li><a href="#2"><i class="arg">objectCmd</i> <b class="method">put</b> <i class="arg">bytes</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::halfpipe</b> package provides a command creating
one half of a <b class="package"><a href="fifo2.html">tcl::chan::fifo2</a></b> pair. Writing into such a
channel invokes a set of callbacks which then handle the data. This is
similar to a channel handler, except having a much simpler API.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::halfpipe</b> <span class="opt">?<b class="option">-option</b> <i class="arg">value</i>...?</span></a></dt>
<dd><p>This command creates a halfpipe channel and configures it with the
callbacks to run when the channel is closed, data was written to it,
or ran empty. See the section <span class="sectref"><a href="#section3">Options</a></span> for the list of
options and associated semantics.
The result of the command is a list containing two elements, the
handle of the new channel, and the object command of the channel
handler, in this order.
The latter is supplied to the caller to provide her with access to the
<b class="method">put</b> method for adding data to the channel.</p>
<p>Two halfpipes with a bit of glue logic in the callbacks make
for one <b class="package"><a href="fifo2.html">tcl::chan::fifo2</a></b>.</p></dd>
<dt><a name="2"><i class="arg">objectCmd</i> <b class="method">put</b> <i class="arg">bytes</i></a></dt>
<dd><p>This method of the channel handler object puts the data <i class="arg">bytes</i>
into the channel so that it can be read from it.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Options</a></h2>
<dl class="options">
<dt><b class="option">-close-command</b> cmdprefix</dt>
<dd><p>This callback is invoked when the channel is closed.
A single argument is supplied, the handle of the channel being closed.
The result of the callback is ignored.</p></dd>
<dt><b class="option">-write-command</b> cmdprefix</dt>
<dd><p>This callback is invoked when data is written to the channel.
Two arguments are supplied, the handle of the channel written to, and the data written.
The result of the callback is ignored.</p></dd>
<dt><b class="option">-empty-command</b> cmdprefix</dt>
<dd><p>This callback is invoked when the channel has run out of data to read.
A single argument is supplied, the handle of the channel.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key666">callbacks</a>, <a href="../../../../index.html#key95">fifo</a>, <a href="../../../../index.html#key97">in-memory channel</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/memchan.html.














































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::memchan - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/memchan.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::memchan.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::memchan(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::memchan - In-memory channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::memchan <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::memchan</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::memchan</b> package provides a command creating
channels which live purely in memory. They provide random-access,
i.e. are seekable. This is equivalent to the memchan channels provided by
the package <b class="package">Memchan</b>, except that this is written in pure Tcl,
not C. On the other hand, <b class="package">Memchan</b> is usable with Tcl 8.4 and
before, whereas this package requires Tcl 8.5 or higher, and
<b class="package"><a href="../../../../index.html#key706">TclOO</a></b>.</p>
<p>Packages related to this are <b class="package"><a href="string.html">tcl::chan::string</a></b> and
<b class="package"><a href="variable.html">tcl::chan::variable</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::memchan</b></a></dt>
<dd><p>This command creates a new memchan channel and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key97">in-memory channel</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/null.html.














































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::null - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/null.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::null.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::null(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::null - Null channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::null <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::null</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::null</b> package provides a command creating null
channels, i.e. write-only channels which immediately forget whatever
is written to them. This is equivalent to the null channels provided by
the package <b class="package">Memchan</b>, except that this is written in pure Tcl,
not C. On the other hand, <b class="package">Memchan</b> is usable with Tcl 8.4 and
before, whereas this package requires Tcl 8.5 or higher, and
<b class="package"><a href="../../../../index.html#key706">TclOO</a></b>.</p>
<p>Packages related to this are <b class="package"><a href="zero.html">tcl::chan::zero</a></b> and
<b class="package"><a href="nullzero.html">tcl::chan::nullzero</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::null</b></a></dt>
<dd><p>This command creates a new null channel and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key455">/dev/null</a>, <a href="../../../../index.html#key456">null</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/nullzero.html.











































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::nullzero - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/nullzero.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::nullzero.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::nullzero(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::nullzero - Null/Zero channel combination</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::nullzero <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::nullzero</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::nullzero</b> package provides a command creating channels,
which are a combination of null and zero devices. They immediately forget
whatever is written to them, and on reading return an infinite stream of null
characters.</p>
<p>Packages related to this are <b class="package"><a href="null.html">tcl::chan::null</a></b> and
<b class="package"><a href="zero.html">tcl::chan::zero</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel handler
is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::nullzero</b></a></dt>
<dd><p>This command creates a new nullzero channel and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key455">/dev/null</a>, <a href="../../../../index.html#key534">/dev/zero</a>, <a href="../../../../index.html#key456">null</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a>, <a href="../../../../index.html#key533">zero</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/random.html.















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::random - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/random.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::random.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::random(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::random - Random channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::random <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::random</b> <i class="arg">seed</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::random</b> package provides a command creating
random channels, i.e. read-only channels which return an infinite
stream of pseudo-random characters upon reading. This is similar to
the random channels provided by the package <b class="package">Memchan</b>, except
that this is written in pure Tcl, not C, and uses a much simpler
generator as well. On the other hand, <b class="package">Memchan</b> is usable with
Tcl 8.4 and before, whereas this package requires Tcl 8.5 or higher,
and TclOO.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::random</b> <i class="arg">seed</i></a></dt>
<dd><p>This command creates a new random channel and returns its handle.
The seed is a list of integer numbers used to initialize the
internal feedback shift register of the generator.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key276">/dev/random</a>, <a href="../../../../index.html#key275">random</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/randseed.html.










































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::randseed - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/randseed.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::randseed.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::randseed(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::randseed - Utilities for random channels</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::randseed <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::randomseed</b></a></li>
<li><a href="#2"><b class="cmd">::tcl::combine</b> <i class="arg">seed1</i> <i class="arg">seed2</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::randseed</b> package provides a a few utility commands to help with the seeding of <b class="package"><a href="random.html">tcl::chan::random</a></b> channels.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::randomseed</b></a></dt>
<dd><p>This command creates returns a list of seed integers suitable as seed
argument for random channels. The numbers are derived from the process
id, current time, and Tcl random number generator.</p></dd>
<dt><a name="2"><b class="cmd">::tcl::combine</b> <i class="arg">seed1</i> <i class="arg">seed2</i></a></dt>
<dd><p>This command takes to seed lists and combines them into a single list
by XORing them elementwise, modulo 256. If the lists are not of equial
length the shorter of the two is padded with 0s before merging.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key276">/dev/random</a>, <a href="../../../../index.html#key493">merge</a>, <a href="../../../../index.html#key275">random</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key771">seed</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/std.html.











































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::std - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/std.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2011 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::std.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::std(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::std - Standard I/O, unification of stdin and stdout</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::std <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::std</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::std</b> package provides a command creating
a standard channel which unifies stdin and stdout into a single
read- and writable channel. The result is not seek-able, like
the original standard channels.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/core.html">tcl::chan::core</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::std</b></a></dt>
<dd><p>This command creates the std channel and returns its handle.</p>
<p>The channel is created only once, on the first call, and all
future calls simply return this handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key765">standard io</a>, <a href="../../../../index.html#key766">stdin</a>, <a href="../../../../index.html#key767">stdout</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/string.html.














































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::string - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/string.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::string.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::string(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::string - Read-only in-memory channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::string <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::string</b> <i class="arg">content</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::string</b> package provides a command creating
channels which live purely in memory. They provide random-access,
i.e. are seekable.
In contrast to the channels created by <b class="package"><a href="memchan.html">tcl::chan::memchan</a></b>
they are read-only however, their content is provided at the time of
construction and immutable afterward.</p>
<p>Packages related to this are <b class="package"><a href="memchan.html">tcl::chan::memchan</a></b> and
<b class="package"><a href="variable.html">tcl::chan::variable</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::string</b> <i class="arg">content</i></a></dt>
<dd><p>This command creates a new string channel and returns its handle. The
channel provides random read-only access to the <i class="arg">content</i> string.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key97">in-memory channel</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/textwindow.html.









































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::textwindow - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/textwindow.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::textwindow.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::textwindow(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::textwindow - Textwindow channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::textwindow <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::textwindow</b> <i class="arg">widget</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::textwindow</b> package provides a command creating
write-only channels connected to text widgets. Anything written to the
channel is printed into the associated widget.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::textwindow</b> <i class="arg">widget</i></a></dt>
<dd><p>This command creates a new textwindow channel and returns its handle.
Data written to this channel will appear in the associated <i class="arg">widget</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key190">Tk</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key189">text widget</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/variable.html.















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::variable - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/variable.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::variable.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::variable(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::variable - In-memory channel using variable for storage</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::variable <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::variable</b> <i class="arg">varname</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::variable</b> package provides a command creating
channels which live purely in memory. They provide random-access,
i.e. are seekable.
In contrast to the channels created by <b class="package"><a href="memchan.html">tcl::chan::memchan</a></b>
the data is not hidden in the channel however, but stored in an
associated variable, specified at the time of construction.</p>
<p>Packages related to this are <b class="package"><a href="memchan.html">tcl::chan::memchan</a></b> and
<b class="package"><a href="string.html">tcl::chan::string</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::variable</b> <i class="arg">varname</i></a></dt>
<dd><p>This command creates a new variable channel and returns its handle.
The content of the channel is stored in the associated namespace
variable <i class="arg">varname</i>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key97">in-memory channel</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_base/zero.html.














































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::zero - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_base/zero.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::zero.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::zero(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::zero - Zero channel</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::zero <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::zero</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::zero</b> package provides a command creating zero
channels, i.e. read-only channels which return an infinite stream of null
characters upon reading. This is equivalent to the zero channels
provided by the package <b class="package">Memchan</b>, except that this is written
in pure Tcl, not C. On the other hand, <b class="package">Memchan</b> is usable with
Tcl 8.4 and before, whereas this package requires Tcl 8.5 or higher,
and TclOO.</p>
<p>Packages related to this are <b class="package"><a href="null.html">tcl::chan::null</a></b> and
<b class="package"><a href="nullzero.html">tcl::chan::nullzero</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the channel
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/events.html">tcl::chan::events</a></b> framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::zero</b></a></dt>
<dd><p>This command creates a new zero channel and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key534">/dev/zero</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a>, <a href="../../../../index.html#key533">zero</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_core/core.html.






































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::core - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_core/core.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::core.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::core(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::core - Basic reflected/virtual channel support</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Class API</a></li>
<li class="section"><a href="#section3">Instance API</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::core <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::core</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">initialize</b> <i class="arg">thechannel</i> <i class="arg">mode</i></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">finalize</b> <i class="arg">thechannel</i></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::core</b> package provides a <b class="package"><a href="../../../../index.html#key706">TclOO</a></b>
class implementing common behaviour needed by virtually every
reflected or virtual channel (initialization, finalization).</p>
<p>This class expects to be used as either superclass of a concrete
channel class, or to be mixed into such a class.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Class API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::core</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new channel core object with an associated
global Tcl command whose name is <em>objectName</em>. This command may
be used to invoke various operations on the object, as described in
the section for the <span class="sectref"><a href="#section3">Instance API</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Instance API</a></h2>
<p>The API of channel core instances provides only two methods, both
corresponding to channel handler commands (For reference see
<a href="http:/tip.tcl.tk/219">TIP 219</a>). They expect to be called
from whichever object instance the channel core was made a part of.</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">initialize</b> <i class="arg">thechannel</i> <i class="arg">mode</i></a></dt>
<dd><p>This method implements standard behaviour for the <b class="method">initialize</b>
method of channel handlers. Using introspection it finds the handler
methods supported by the instance and returns a list containing their
names, as expected by the support for reflected channels in the Tcl
core.</p>
<p>It further remembers the channel handle in an instance variable
for access by sub-classes.</p></dd>
<dt><a name="3"><i class="arg">objectName</i> <b class="method">finalize</b> <i class="arg">thechannel</i></a></dt>
<dd><p>This method implements standard behaviour for the <b class="method">finalize</b>
method of channel handlers. It simply destroys itself.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroying the channel core instance closes the channel it was
initialized for, see the method <b class="method">initialize</b>. When destroyed
from within a call of <b class="method">finalize</b> this does not happen, under
the assumption that the channel is being destroyed by Tcl.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_core/events.html.














































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::chan::events - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_core/events.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::chan::events.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::chan::events(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::chan::events - Event support for reflected/virtual channels</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Class API</a></li>
<li class="section"><a href="#section3">Instance API</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::chan::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::chan::events <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::chan::events</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">finalize</b> <i class="arg">thechannel</i></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">watch</b> <i class="arg">thechannel</i> <i class="arg">eventmask</i></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">allow</b> <i class="arg">eventname</i>...</a></li>
<li><a href="#5"><i class="arg">objectName</i> <b class="method">disallow</b> <i class="arg">eventname</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::chan::events</b> package provides a <b class="package"><a href="../../../../index.html#key706">TclOO</a></b>
class implementing common behaviour needed by virtually every
reflected or virtual channel supporting event driven IO. It is a
sub-class of <b class="package"><a href="core.html">tcl::chan::core</a></b>, inheriting all of its behaviour.</p>
<p>This class expects to be used as either superclass of a concrete
channel class, or to be mixed into such a class.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Class API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::chan::events</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new channel event core object with an associated
global Tcl command whose name is <em>objectName</em>. This command may
be used to invoke various operations on the object, as described in
the section for the <span class="sectref"><a href="#section3">Instance API</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Instance API</a></h2>
<p>The API of channel event core instances provides only four methods, two
corresponding to channel handler commands (For reference see
<a href="http:/tip.tcl.tk/219">TIP 219</a>), and the other two for use by
sub-classes to control event generation. They former expect to be called
from whichever object instance the channel event core was made a part of.</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">finalize</b> <i class="arg">thechannel</i></a></dt>
<dd><p>This method implements standard behaviour for the <b class="method">finalize</b>
method of channel handlers. It overrides the behaviour inherited from
<b class="package"><a href="core.html">tcl::chan::core</a></b> and additionally disables any and all event
generation before destroying itself.</p></dd>
<dt><a name="3"><i class="arg">objectName</i> <b class="method">watch</b> <i class="arg">thechannel</i> <i class="arg">eventmask</i></a></dt>
<dd><p>This method implements standard behaviour for the <b class="method">watch</b>
method of channel handlers. Called by the IO system whenever the
interest in event changes it updates the instance state to activate
and/or suppress the generation of the events of (non-)interest.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">allow</b> <i class="arg">eventname</i>...</a></dt>
<dd></dd>
<dt><a name="5"><i class="arg">objectName</i> <b class="method">disallow</b> <i class="arg">eventname</i>...</a></dt>
<dd><p>These two methods are exported to sub-classes, so that their instances
can notify their event core of the events the channel they implement
can (allow) or cannot (disallow) generate.
Together with the information about the events requested by Tcl's IO
system coming in through the <b class="method">watch</b> method the event core is
able to determine which events it should (not) generate and act
accordingly.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key469">event management</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_core/transformcore.html.






































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::core - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_core/transformcore.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::core.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::core(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::core - Basic reflected/virtual channel transform support</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Class API</a></li>
<li class="section"><a href="#section3">Instance API</a></li>
<li class="section"><a href="#section4">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">TclOO</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::core</b> <i class="arg">objectName</i></a></li>
<li><a href="#2"><i class="arg">objectName</i> <b class="method">initialize</b> <i class="arg">thechannel</i> <i class="arg">mode</i></a></li>
<li><a href="#3"><i class="arg">objectName</i> <b class="method">finalize</b> <i class="arg">thechannel</i></a></li>
<li><a href="#4"><i class="arg">objectName</i> <b class="method">destroy</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::core</b> package provides a <b class="package"><a href="../../../../index.html#key706">TclOO</a></b>
class implementing common behaviour needed by virtually every
reflected or virtual channel transformation (initialization, finalization).</p>
<p>This class expects to be used as either superclass of a concrete
channel class, or to be mixed into such a class.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">Class API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::core</b> <i class="arg">objectName</i></a></dt>
<dd><p>This command creates a new transform core object with an associated
global Tcl command whose name is <em>objectName</em>. This command may
be used to invoke various operations on the object, as described in
the section for the <span class="sectref"><a href="#section3">Instance API</a></span>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Instance API</a></h2>
<p>The API of transform core instances provides only two methods, both
corresponding to transform handler commands (For reference see
<a href="http:/tip.tcl.tk/230">TIP 230</a>). They expect to be called
from whichever object instance the transform core was made a part of.</p>
<dl class="definitions">
<dt><a name="2"><i class="arg">objectName</i> <b class="method">initialize</b> <i class="arg">thechannel</i> <i class="arg">mode</i></a></dt>
<dd><p>This method implements standard behaviour for the <b class="method">initialize</b>
method of transform handlers. Using introspection it finds the handler
methods supported by the instance and returns a list containing their
names, as expected by the support for reflected transformation in the
Tcl core.</p>
<p>It further remembers the channel handle in an instance variable
for access by sub-classes.</p></dd>
<dt><a name="3"><i class="arg">objectName</i> <b class="method">finalize</b> <i class="arg">thechannel</i></a></dt>
<dd><p>This method implements standard behaviour for the <b class="method">finalize</b>
method of channel handlers. It simply destroys itself.</p></dd>
<dt><a name="4"><i class="arg">objectName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroying the transform core instance closes the channel and transform
it was initialized for, see the method <b class="method">initialize</b>. When destroyed
from within a call of <b class="method">finalize</b> this does not happen, under
the assumption that the channel and transform are being destroyed by Tcl.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key96">tip 219</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/adler32.html.































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::adler32 - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/adler32.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::adler32.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::adler32(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::adler32 - Adler32 transformation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::adler32 <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::adler32</b> <i class="arg">chan</i> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::adler32</b> package provides a command
creating a channel transformation which passes the read and written
bytes through unchanged (like <b class="package"><a href="identity.html">tcl::transform::identity</a></b>), but
additionally continuously computes the adler32 checksums of the data
it has seen for each direction and stores them in Tcl variables
specified at construction time.</p>
<p>Related transformations in this module are
<b class="package"><a href="counter.html">tcl::transform::counter</a></b>,
<b class="package"><a href="crc32.html">tcl::transform::crc32</a></b>,
<b class="package"><a href="identity.html">tcl::transform::identity</a></b>, and
<b class="package"><a href="observe.html">tcl::transform::observe</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::adler32</b> <i class="arg">chan</i> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>This command creates an adler32 checksumming transformation on top of
the channel <i class="arg">chan</i> and returns its handle. The accepted options are</p>
<dl class="options">
<dt><b class="option">-read-variable</b> varname</dt>
<dd><p>The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
adler32 checksum of the data read from the channel.</p>
<p>If not specified, or the empty string, the checksum of the read
direction is not saved.</p></dd>
<dt><b class="option">-write-variable</b> varname</dt>
<dd><p>The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
adler32 checksum of the data written to the channel.</p>
<p>If not specified, or the empty string, the checksum of the
write direction is not saved.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key621">adler32</a>, <a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key140">checksum</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/base64.html.











































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::base64 - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/base64.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::base64.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::base64(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::base64 - Base64 encoding transformation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::base64 <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::base64</b> <i class="arg">chan</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::base64</b> package provides a command
creating a channel transformation which base64 encodes data written to
it, and decodes the data read from it.</p>
<p>A related transformations in this module is
<b class="package"><a href="hex.html">tcl::transform::hex</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::base64</b> <i class="arg">chan</i></a></dt>
<dd><p>This command creates a base64 transformation on top of the channel
<i class="arg">chan</i> and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key716">base64</a>, <a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key715">tip 317</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/counter.html.






























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::counter - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/counter.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::counter.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::counter(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::counter - Counter transformation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::counter <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::counter</b> <i class="arg">chan</i> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::counterr</b> package provides a command
creating a channel transformation which passes the read and written
bytes through unchanged (like <b class="package"><a href="identity.html">tcl::transform::identity</a></b>), but
additionally counts the bytes it has seen for each direction and
stores these counts in Tcl variables specified at construction time.</p>
<p>Related transformations in this module are
<b class="package"><a href="adler32.html">tcl::transform::adler32</a></b>,
<b class="package"><a href="crc32.html">tcl::transform::crc32</a></b>,
<b class="package"><a href="identity.html">tcl::transform::identity</a></b>, and
<b class="package"><a href="observe.html">tcl::transform::observe</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::counter</b> <i class="arg">chan</i> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>This command creates a counter transformation on top of the channel
<i class="arg">chan</i> and returns its handle. The accepted options are</p>
<dl class="options">
<dt><b class="option">-read-variable</b> varname</dt>
<dd><p>The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
byte count of the data read from the channel.</p>
<p>If not specified, or the empty string, the counter of the read
direction is not saved.</p></dd>
<dt><b class="option">-write-variable</b> varname</dt>
<dd><p>The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
byte count of the data written to the channel.</p>
<p>If not specified, or the empty string, the counter of the
write direction is not saved.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key272">counter</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/crc32.html.































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::crc32 - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/crc32.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::crc32.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::crc32(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::crc32 - Crc32 transformation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::crc32 <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::crc32</b> <i class="arg">chan</i> <b class="option">-option</b> <i class="arg">value</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::crc32</b> package provides a command
creating a channel transformation which passes the read and written
bytes through unchanged (like <b class="package"><a href="identity.html">tcl::transform::identity</a></b>), but
additionally continuously computes the crc32 checksums of the data it
has seen for each direction and stores them in Tcl variables specified
at construction time. The checksum in question is zlib's crc32.</p>
<p>Related transformations in this module are
<b class="package"><a href="adler32.html">tcl::transform::adler32</a></b>,
<b class="package"><a href="counter.html">tcl::transform::counter</a></b>,
<b class="package"><a href="identity.html">tcl::transform::identity</a></b>, and
<b class="package"><a href="observe.html">tcl::transform::observe</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::crc32</b> <i class="arg">chan</i> <b class="option">-option</b> <i class="arg">value</i>...</a></dt>
<dd><p>This command creates a crc32 checksumming transformation on top of
the channel <i class="arg">chan</i> and returns its handle. The accepted options are</p>
<dl class="options">
<dt><b class="option">-read-variable</b> varname</dt>
<dd><p>The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
crc32 checksum of the data read from the channel.</p>
<p>If not specified, or the empty string, the checksum of the read
direction is not saved.</p></dd>
<dt><b class="option">-write-variable</b> varname</dt>
<dd><p>The value of the option is the name of a global or namespaced
variable, the location where the transformation has to store the
crc32 checksum of the data written to the channel.</p>
<p>If not specified, or the empty string, the checksum of the
write direction is not saved.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key140">checksum</a>, <a href="../../../../index.html#key138">crc32</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/hex.html.











































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::hex - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/hex.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::hex.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::hex(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::hex - Hexadecimal encoding transformation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::hex <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::hex</b> <i class="arg">chan</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::hex</b> package provides a command creating
a channel transformation which hex encodes data written to it, and
decodes the data read from it.</p>
<p>A related transformations in this module is
<b class="package"><a href="base64.html">tcl::transform::base64</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::hex</b> <i class="arg">chan</i></a></dt>
<dd><p>This command creates a hex transformation on top of the channel
<i class="arg">chan</i> and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key682">hexadecimal</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/identity.html.


















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::identity - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/identity.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::identity.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::identity(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::identity - Identity transformation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::identity <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::identity</b> <i class="arg">chan</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::identity</b> package provides a command
creating an identity channel transformation, which does nothing but
pass the read and written bytes through it unchanged. Not really
useful in an application, however as the prototypical observer
transformation its code is a useful starting point for any other
observers people may wish to write.</p>
<p>The transformations in this module which derived from
identity's code are
<b class="package"><a href="adler32.html">tcl::transform::adler32</a></b>,
<b class="package"><a href="counter.html">tcl::transform::counter</a></b>,
<b class="package"><a href="crc32.html">tcl::transform::crc32</a></b>, and
<b class="package"><a href="observe.html">tcl::transform::observe</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::identity</b> <i class="arg">chan</i></a></dt>
<dd><p>This command creates an identity transformation on top of the channel
<i class="arg">chan</i> and returns its handle.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key393">identity</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/limitsize.html.













































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::limitsize - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/limitsize.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::limitsize.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::limitsize(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::limitsize - limiting input</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::limitsize <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::limitsize</b> <i class="arg">chan</i> <i class="arg">max</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::limitsize</b> package provides a command
creating a channel transformation which limits the number of
characters which can be read from the channel. A generator for an
artificial EOF.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::limitsize</b> <i class="arg">chan</i> <i class="arg">max</i></a></dt>
<dd><p>This command creates a size limiting transformation on top of the
channel <i class="arg">chan</i> and returns its handle.</p>
<p><i class="arg">max</i> is the number of bytes which can be read from the
channel before EOF is signaled by the transformation. Note that
popping the transformation clears the EOF it generated as well.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key669">limitsize</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key670">size limit</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/observe.html.

















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::observe - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/observe.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::observe.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::observe(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::observe - Observer transformation, stream copy</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::observe <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::observe</b> <i class="arg">chan</i> <i class="arg">logw</i> <i class="arg">logr</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::observer</b> package provides a command
creating a channel transformation which passes the read and written
bytes through unchanged (like <b class="package"><a href="identity.html">tcl::transform::identity</a></b>), but
additionally copies the data it has seen for each direction into
channels specified at construction time.</p>
<p>Related transformations in this module are
<b class="package"><a href="adler32.html">tcl::transform::adler32</a></b>,
<b class="package"><a href="counter.html">tcl::transform::counter</a></b>,
<b class="package"><a href="crc32.html">tcl::transform::crc32</a></b>, and
<b class="package"><a href="identity.html">tcl::transform::identity</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::observe</b> <i class="arg">chan</i> <i class="arg">logw</i> <i class="arg">logr</i></a></dt>
<dd><p>This command creates an observer transformation on top of the channel
<i class="arg">chan</i> and returns its handle. The channel handles <i class="arg">logr</i> and
<i class="arg">logw</i> are there the data is copied to.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key600">observer</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key601">stream copy</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/otp.html.















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::otp - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/otp.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::otp.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::otp(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::otp - Encryption via one-time pad</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::otp <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::otp</b> <i class="arg">chan</i> <i class="arg">keychanw</i> <i class="arg">keychanr</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::otp</b> package provides a command creating
a channel transformation which uses externally provided one-time pads
to perform encryption (on writing) and decryption (on reading).</p>
<p>A related transformations in this module is
<b class="package"><a href="rot.html">tcl::transform::rot</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::otp</b> <i class="arg">chan</i> <i class="arg">keychanw</i> <i class="arg">keychanr</i></a></dt>
<dd><p>This command creates a one-time pad based encryption transformation on
top of the channel <i class="arg">chan</i> and returns its handle.</p>
<p>The two channels <i class="arg">keychanw</i> and <i class="arg">keychanr</i> contain the
one-time pads for the write and read directions, respectively. Their
contents are reads and xored with the bytes written to and read from
the channel.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key162">cipher</a>, <a href="../../../../index.html#key349">decryption</a>, <a href="../../../../index.html#key114">encryption</a>, <a href="../../../../index.html#key732">one time pad</a>, <a href="../../../../index.html#key733">otp</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a>, <a href="../../../../index.html#key731">xor</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/rot.html.


















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::rot - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/rot.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::rot.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::rot(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::rot - rot-encryption</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::rot <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::rot</b> <i class="arg">chan</i> <i class="arg">key</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::rot</b> package provides a command creating
a channel transformation which performs primitive encryption (on
writing) and decryption (on reading) on the alphabetic characters. The
algorithm is the Caesar-cipher, a specific variant of which is rot13.</p>
<p>A related transformations in this module is
<b class="package"><a href="otp.html">tcl::transform::otp</a></b>.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::rot</b> <i class="arg">chan</i> <i class="arg">key</i></a></dt>
<dd><p>This command creates a rot encryption transformation on top of the
channel <i class="arg">chan</i> and returns its handle.</p>
<p>The &quot;<i class="arg">key</i>&quot; specifies how far characters are rotated in the
alphabet, and is wrapped to the range &quot;0...25&quot;.</p>
<p>Note that this transformation affects only bytes in the ranges
ASCII 65...90, and 97...122, i.e. the upper- and lower-case alphabetic
characters, i.e. &quot;A...Z&quot; and &quot;a...z&quot;. All other bytes are passed
through unchanged.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key351">caesar cipher</a>, <a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key162">cipher</a>, <a href="../../../../index.html#key349">decryption</a>, <a href="../../../../index.html#key114">encryption</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key350">rot</a>, <a href="../../../../index.html#key348">rot13</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/spacer.html.













































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::spacer - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/spacer.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::spacer.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::spacer(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::spacer - Space insertation and removal</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::spacer <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::spacer</b> <i class="arg">chan</i> <i class="arg">n</i> <span class="opt">?<i class="arg">space</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::spacer</b> package provides a command
creating a channel transformation which adds spacing to the data
written to it, and removes such spacing from the data read from it.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::spacer</b> <i class="arg">chan</i> <i class="arg">n</i> <span class="opt">?<i class="arg">space</i>?</span></a></dt>
<dd><p>This command creates a spacer transformation on top of the channel
<i class="arg">chan</i> and returns its handle.</p>
<p>The <i class="arg">space</i> character sequence will be added every <i class="arg">n</i>
bytes of data written, and on the read side the same is done in
reverse, removing the spacing. If <i class="arg">space</i> is not specified it
defaults to a single space character (ASCII 32).</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key472">spacing</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/virtchannel_transform/zlib.html.











































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>tcl::transform::zlib - Reflected/virtual channel support</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/virtchannel_transform/zlib.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ tcl::transform::zlib.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">tcl::transform::zlib(n) 1 tcllib &quot;Reflected/virtual channel support&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>tcl::transform::zlib - zlib (de)compression</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.6</b></li>
<li>package require <b class="pkgname">tcl::transform::core <span class="opt">?1?</span></b></li>
<li>package require <b class="pkgname">tcl::transform::zlib <span class="opt">?1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::tcl::transform::zlib</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">level</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">tcl::transform::zlib</b> package provides a command creating
a channel transformation which zlib compresses the written data, and
decompresses on reading.</p>
<p>The internal <b class="package"><a href="../../../../index.html#key706">TclOO</a></b> class implementing the transform
handler is a sub-class of the <b class="package"><a href="../virtchannel_core/transformcore.html">tcl::transform::core</a></b>
framework.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::tcl::transform::zlib</b> <i class="arg">chan</i> <span class="opt">?<i class="arg">level</i>?</span></a></dt>
<dd><p>This command creates a zlib compressor transformation on top of the
channel <i class="arg">chan</i> and returns its handle.</p>
<p>The <i class="arg">level</i> specifies how much effort is put into the
compression, from <b class="const">0</b> to <b class="const">9</b>, and defaults to <b class="const">4</b>.</p></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>virtchannel</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key271">channel transformation</a>, <a href="../../../../index.html#key323">compression</a>, <a href="../../../../index.html#key324">decompression</a>, <a href="../../../../index.html#key98">reflected channel</a>, <a href="../../../../index.html#key273">tip 230</a>, <a href="../../../../index.html#key322">tip 234</a>, <a href="../../../../index.html#key274">transformation</a>, <a href="../../../../index.html#key94">virtual channel</a>, <a href="../../../../index.html#key321">zlib</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Channels</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2009 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/wip/wip.html.






























































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>wip - Word Interpreter</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/wip/wip.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2010 Andreas Kupries &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ wip.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">wip(n) 2.2 tcllib &quot;Word Interpreter&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>wip - Word Interpreter</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">GENERAL BEHAVIOUR</a></li>
<li class="section"><a href="#section3">CLASS API</a></li>
<li class="section"><a href="#section4">OBJECT API</a></li>
<li class="section"><a href="#section5">EXAMPLES</a></li>
<li class="section"><a href="#section6">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#category">Category</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">wip <span class="opt">?2.2?</span></b></li>
<li>package require <b class="pkgname">snit <span class="opt">?1.3?</span></b></li>
<li>package require <b class="pkgname">struct::set</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::wip</b> <i class="arg">wipName</i> <i class="arg">engine</i> <i class="arg">arg</i>...</a></li>
<li><a href="#2"><b class="cmd">def</b> <i class="arg">name</i></a></li>
<li><a href="#3"><b class="cmd">def</b> <i class="arg">name</i> <i class="arg">method_prefix</i></a></li>
<li><a href="#4"><b class="cmd">wipName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#5"><b class="cmd">wip::dsl</b> <span class="opt">?<i class="arg">suffix</i>?</span></a></li>
<li><a href="#6"><i class="arg">wipName</i> <b class="method">def</b> <i class="arg">name</i> <span class="opt">?<i class="arg">method_prefix</i>?</span></a></li>
<li><a href="#7"><i class="arg">wipName</i> <b class="method">defl</b> <i class="arg">names</i></a></li>
<li><a href="#8"><i class="arg">wipName</i> <b class="method">defd</b> <i class="arg">dict</i></a></li>
<li><a href="#9"><i class="arg">wipName</i> <b class="method">deflva</b> <i class="arg">name</i>...</a></li>
<li><a href="#10"><i class="arg">wipName</i> <b class="method">defdva</b> (<i class="arg">name</i> <i class="arg">method_prefix</i>)...</a></li>
<li><a href="#11"><i class="arg">wipName</i> <b class="method">undefl</b> <i class="arg">names</i></a></li>
<li><a href="#12"><i class="arg">wipName</i> <b class="method">undefva</b> <i class="arg">name</i>...</a></li>
<li><a href="#13"><i class="arg">wipName</i> <b class="method">unknown</b> <i class="arg">cmdprefix</i></a></li>
<li><a href="#14"><i class="arg">wipName</i> <b class="method">runl</b> <i class="arg">wordlist</i></a></li>
<li><a href="#15"><i class="arg">wipName</i> <b class="method">run</b> <i class="arg">word</i>...</a></li>
<li><a href="#16"><i class="arg">wipName</i> <b class="method">run_next</b></a></li>
<li><a href="#17"><i class="arg">wipName</i> <b class="method">run_next_while</b> <i class="arg">acceptable</i></a></li>
<li><a href="#18"><i class="arg">wipName</i> <b class="method">run_next_until</b> <i class="arg">rejected</i></a></li>
<li><a href="#19"><i class="arg">wipName</i> <b class="method">run_next_if</b> <i class="arg">acceptable</i></a></li>
<li><a href="#20"><i class="arg">wipName</i> <b class="method">run_next_ifnot</b> <i class="arg">rejected</i></a></li>
<li><a href="#21"><i class="arg">wipName</i> <b class="method">next</b></a></li>
<li><a href="#22"><i class="arg">wipName</i> <b class="method">peek</b></a></li>
<li><a href="#23"><i class="arg">wipName</i> <b class="method">peekall</b></a></li>
<li><a href="#24"><i class="arg">wipName</i> <b class="method">insertl</b> <i class="arg">at</i> <i class="arg">wordlist</i></a></li>
<li><a href="#25"><i class="arg">wipName</i> <b class="method">replacel</b> <i class="arg">wordlist</i></a></li>
<li><a href="#26"><i class="arg">wipName</i> <b class="method">pushl</b> <i class="arg">wordlist</i></a></li>
<li><a href="#27"><i class="arg">wipName</i> <b class="method">addl</b> <i class="arg">wordlist</i></a></li>
<li><a href="#28"><i class="arg">wipName</i> <b class="method">insert</b> <i class="arg">at</i> <i class="arg">word</i>...</a></li>
<li><a href="#29"><i class="arg">wipName</i> <b class="method">replace</b> <i class="arg">word</i>...</a></li>
<li><a href="#30"><i class="arg">wipName</i> <b class="method">push</b> <i class="arg">word</i>...</a></li>
<li><a href="#31"><i class="arg">wipName</i> <b class="method">add</b> <i class="arg">word</i>...</a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package provides a micro interpreter for lists of words. Domain
specific languages based on this will have a bit of a Forth feel, with
the input stream segmented into words and any other structuring left
to whatever the language desired. Note that we have here in essence
only the core dispatch loop, and no actual commands whatsoever, making
this definitely only a Forth feel and not an actual Forth.</p>
<p>The idea is derived from Colin McCormack's <b class="package"><a href="../treeql/treeql.html">treeql</a></b> processor,
modified to require less boiler plate within the command
implementations, at the expense of, likely, execution speed. In
addition the interface between processor core and commands is more
complex too.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">GENERAL BEHAVIOUR</a></h2>
<p>Word interpreters have a mappping from the names of the language
commands they shall recognize to the methods in the engine to invoke
for them, and possibly fixed arguments for these methods. This mapping
is largely static, however it is possible to change it during the
execution of a word list (= program).</p>
<p>At the time a language command is defined the word interpreter will
use <b class="package"><a href="../snit/snit.html">snit</a></b>'s introspection capabilities to determine the
number of arguments expected by the method of the egnine, and together
with the number of fixed arguments supplied in the method prefix of
the mapping it then knows how many arguments the language command is
expecting. This is the command's <i class="term">arity</i>. Variable-argument
methods (i.e. with the last argument named <i class="arg">args</i>) are <em>not</em>
allowed and will cause the word interpreter to throw an error at
definition time.</p>
<p>Note that while I said <b class="package"><a href="../snit/snit.html">snit</a></b>'s abilities the engine object
can be written in any way, as long as it understands the method
<b class="method">info args</b>, which takes a method name and returns the list
of arguments for that method.</p>
<p>When executing a list of words (aka program) the first word is always
taken as the name of a language command, and the next words as its
arguments, per the <i class="term">arity</i> of the command. Command and argument
words are removed from the list and then associated method of the
engine is executed with the argument words. The process then repeats
using the then-first word of the list.</p>
<p>Note that the methods implementing the language commands may have full
access to the list of words and are allowed to manipulate as they see
fit.</p>
<ol class="enumerated">
<li><p>This means, for example, that while we cannot specify
variable-argument methods directly they can consume words after their
fixed arguments before returning to the execution loop. This may be
under the control of their fixed arguments.</p></li>
<li><p>Another possibility is the use of method <b class="method">run_next</b> and its
variants to execute commands coming after the current command,
changing the order of execution.</p></li>
<li><p>Execution can be further changed by use of the program accessor
methods which allow a command implementation to modify the remaining
list of words (insert, replace, prepend, append words) without
executing them immediately.</p></li>
<li><p>At last the basic <b class="method">run</b> methods save and restore an existing
list of words when used, enabling recursive use from within command
implementations.</p></li>
</ol>
</div>
<div id="section3" class="section"><h2><a name="section3">CLASS API</a></h2>
<p>The main command of the package is:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::wip</b> <i class="arg">wipName</i> <i class="arg">engine</i> <i class="arg">arg</i>...</a></dt>
<dd><p>The command creates a new word interpreter object with an associated
global Tcl command whose name is <i class="arg">wipName</i>. If however the string
<b class="const">%AUTO%</b> was used as object name the package will generate its
own unique name for the object.</p>
<p>The <i class="arg">engine</i> is the object the word interpreter will dispatch all
recognized commands to, and the <i class="arg">arg</i>uments are a word list which
defines an initial mapping from language words to engine methods.</p>
<p>The recognized language of this word list is</p>
<dl class="definitions">
<dt><a name="2"><b class="cmd">def</b> <i class="arg">name</i></a></dt>
<dd><p>Defines <i class="arg">name</i> as command of the language, to be mapped to a
method of the <i class="arg">engine</i> having the same name.</p></dd>
<dt><a name="3"><b class="cmd">def</b> <i class="arg">name</i> <i class="arg">method_prefix</i></a></dt>
<dd><p>Defines <i class="arg">name</i> as command of the language, to be mapped to the
method of the <i class="arg">engine</i> named in the <i class="arg">method_prefix</i>.</p></dd>
</dl>
<p>The returned command may be used to invoke various operations on the
object.  It has the following general form:</p>
<dl class="definitions">
<dt><a name="4"><b class="cmd">wipName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl></dd>
</dl>
<p>The package additionally exports the command:</p>
<dl class="definitions">
<dt><a name="5"><b class="cmd">wip::dsl</b> <span class="opt">?<i class="arg">suffix</i>?</span></a></dt>
<dd><p>This command is for use within snit types which wish to use one or
more wip interpreters as a component. Use within the type definition
installs most of the boilerplate needed to setup and use a word
interpreter.</p>
<p>It installs a component named <em>wip</em>, and a method
<b class="method">wip_setup</b> for initializing it. This method has to be called
from within the constructor of the type using the word interpreter.
If further installs a series of procedures which make the object API
of the word interpreter directly available to the type's methods,
without having to specify the component.</p>
<p><em>Note</em> that this does and cannot install the language to
interpret, i.e. the mapping from words to engine methods.</p>
<p>It is possible to instantiate multiple word interpreter components
within a type by using different suffices as arguments to the command.
In that case the name of the component changes to
'wip_<b class="variable">$suffix</b>', the setup command becomes
'wip_<b class="variable">$suffix</b>_setup' and all the procedures also get the suffix
'_<b class="variable">$suffix</b>'.</p></dd>
</dl>
</div>
<div id="section4" class="section"><h2><a name="section4">OBJECT API</a></h2>
<p>The following commands are possible for word interpreter objects:</p>
<dl class="definitions">
<dt><a name="6"><i class="arg">wipName</i> <b class="method">def</b> <i class="arg">name</i> <span class="opt">?<i class="arg">method_prefix</i>?</span></a></dt>
<dd><p>Defines a language command <i class="arg">name</i> and maps it to the method named
in the engine's <i class="arg">method_prefix</i>. If the <i class="arg">method_prefix</i> name
is not specified it is simply the name of the language command.</p></dd>
<dt><a name="7"><i class="arg">wipName</i> <b class="method">defl</b> <i class="arg">names</i></a></dt>
<dd><p>Defines a series of language commands, specified through the list of
<i class="arg">names</i>, all of which are mapped to engine methods of the same
name.</p></dd>
<dt><a name="8"><i class="arg">wipName</i> <b class="method">defd</b> <i class="arg">dict</i></a></dt>
<dd><p>Defines a series of language commands, specified through the
dictionary <i class="arg">dict</i> of names and method prefixes.</p></dd>
<dt><a name="9"><i class="arg">wipName</i> <b class="method">deflva</b> <i class="arg">name</i>...</a></dt>
<dd><p>As method <b class="method">defl</b>, however the list of names is specified
through multiple arguments.</p></dd>
<dt><a name="10"><i class="arg">wipName</i> <b class="method">defdva</b> (<i class="arg">name</i> <i class="arg">method_prefix</i>)...</a></dt>
<dd><p>As method <b class="method">defd</b>, however the dictionary of names and method
prefixes is specified through multiple arguments.</p></dd>
<dt><a name="11"><i class="arg">wipName</i> <b class="method">undefl</b> <i class="arg">names</i></a></dt>
<dd><p>Removes the named series of language commands from the mapping.</p></dd>
<dt><a name="12"><i class="arg">wipName</i> <b class="method">undefva</b> <i class="arg">name</i>...</a></dt>
<dd><p>As method <b class="method">undefl</b>, however the list of names is specified
through multiple arguments.</p></dd>
<dt><a name="13"><i class="arg">wipName</i> <b class="method">unknown</b> <i class="arg">cmdprefix</i></a></dt>
<dd><p>Sets the handler for unknown words to <i class="arg">cmdprefix</i>. This command
prefix takes one argument, the current word, and either throws some
error, or returns the result of executing the word, as defined by the
handler. The default handler simply throws an error.</p></dd>
<dt><a name="14"><i class="arg">wipName</i> <b class="method">runl</b> <i class="arg">wordlist</i></a></dt>
<dd><p>Treats the list of words in <i class="arg">wordlist</i> as a program and executes
the contained command one by one. The result of the command executed
last is returned as the result of this command.</p>
<p>The <i class="arg">wordlist</i> is stored in the object for access by the other
<i class="term">run</i>-methods, and the general program accessor methods (see
below). A previously stored wordlist is saved during the execution of
this method and restored before it returns. This enables the recursive
execution of word lists within word lists.</p></dd>
<dt><a name="15"><i class="arg">wipName</i> <b class="method">run</b> <i class="arg">word</i>...</a></dt>
<dd><p>As method <b class="method">runl</b>, however the list of words to execute is
specified through multiple arguments.</p></dd>
<dt><a name="16"><i class="arg">wipName</i> <b class="method">run_next</b></a></dt>
<dd><p>Low-level method. Determines the next word in the list of words, and
its arguments, and then executes it. The result of the executed word
is the result of this method.</p>
<p>Exposed for use within command implementations.
The methods <b class="method">run</b> and <b class="method">runl</b> use it to execute words
until their word list is exhausted.</p></dd>
<dt><a name="17"><i class="arg">wipName</i> <b class="method">run_next_while</b> <i class="arg">acceptable</i></a></dt>
<dd><p>Low-level method. Invokes the method <b class="method">run_next</b> as long as the
next word is in the set of <i class="arg">acceptable</i> words, and the program is
not empty. The result of the command executed last is returned as the
result of this command.</p>
<p>Exposed for use within command implementations to change the order of
execution.</p></dd>
<dt><a name="18"><i class="arg">wipName</i> <b class="method">run_next_until</b> <i class="arg">rejected</i></a></dt>
<dd><p>Low-level method. Invokes the method <b class="method">run_next</b> until the next
word is in the set of <i class="arg">rejected</i> words, and the program is not
empty. The result of the command executed last is returned as the
result of this command.</p>
<p>Exposed for use within command implementations to change the order of
execution.</p></dd>
<dt><a name="19"><i class="arg">wipName</i> <b class="method">run_next_if</b> <i class="arg">acceptable</i></a></dt>
<dd><p>Low-level method. Invokes the method <b class="method">run_next</b> if the next
word is in the set of <i class="arg">acceptable</i> words, and the program is not
empty. The result of the command executed last is returned as the
result of this command.</p>
<p>Exposed for use within command implementations to change the order of
execution.</p></dd>
<dt><a name="20"><i class="arg">wipName</i> <b class="method">run_next_ifnot</b> <i class="arg">rejected</i></a></dt>
<dd><p>Low-level method. Invokes the method <b class="method">run_next</b> if the next
word is not in the set of <i class="arg">rejected</i> words, and the program is not
empty. The result of the command executed last is returned as the
result of this command.</p>
<p>Exposed for use within command implementations to change the order of
execution.</p></dd>
<dt><a name="21"><i class="arg">wipName</i> <b class="method">next</b></a></dt>
<dd><p>Returns the next word in the programm. The word is also removed.</p></dd>
<dt><a name="22"><i class="arg">wipName</i> <b class="method">peek</b></a></dt>
<dd><p>Returns the next word in the programm without removing it</p></dd>
<dt><a name="23"><i class="arg">wipName</i> <b class="method">peekall</b></a></dt>
<dd><p>Returns the remaining programm in toto.</p></dd>
<dt><a name="24"><i class="arg">wipName</i> <b class="method">insertl</b> <i class="arg">at</i> <i class="arg">wordlist</i></a></dt>
<dd><p>Basic programm accessor method. Inserts the specified <i class="arg">wordlist</i>
into the program, just before the word at position <i class="arg">at</i>. Positions
are counted from <b class="const">zero</b>.</p></dd>
<dt><a name="25"><i class="arg">wipName</i> <b class="method">replacel</b> <i class="arg">wordlist</i></a></dt>
<dd><p>Basic programm accessor method. Replaces the whole stored program with
the specified <i class="arg">wordlist</i>.</p></dd>
<dt><a name="26"><i class="arg">wipName</i> <b class="method">pushl</b> <i class="arg">wordlist</i></a></dt>
<dd><p>Program accessor method. The specified <i class="arg">wordlist</i> is added to the
front of the remaining program. Equivalent to</p>
<pre class="example">$wip insertl 0 $wordlist</pre>
</dd>
<dt><a name="27"><i class="arg">wipName</i> <b class="method">addl</b> <i class="arg">wordlist</i></a></dt>
<dd><p>Program accessor method. The specified <i class="arg">wordlist</i> is appended at
the end of the remaining program. Equivalent to</p>
<pre class="example">$wip insertl end $wordlist</pre>
</dd>
<dt><a name="28"><i class="arg">wipName</i> <b class="method">insert</b> <i class="arg">at</i> <i class="arg">word</i>...</a></dt>
<dd><p>Like method <b class="method">insertl</b>, except the words are specified through
multiple arguments.</p></dd>
<dt><a name="29"><i class="arg">wipName</i> <b class="method">replace</b> <i class="arg">word</i>...</a></dt>
<dd><p>Like method <b class="method">setl</b>, except the words are specified through
multiple arguments.</p></dd>
<dt><a name="30"><i class="arg">wipName</i> <b class="method">push</b> <i class="arg">word</i>...</a></dt>
<dd><p>Like method <b class="method">pushl</b>, except the words are specified through
multiple arguments.</p></dd>
<dt><a name="31"><i class="arg">wipName</i> <b class="method">add</b> <i class="arg">word</i>...</a></dt>
<dd><p>Like method <b class="method">addl</b>, except the words are specified through
multiple arguments.</p></dd>
</dl>
</div>
<div id="section5" class="section"><h2><a name="section5">EXAMPLES</a></h2>
<p>No examples yet.</p>
</div>
<div id="section6" class="section"><h2><a name="section6">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>wip</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key40">interpreter</a>, <a href="../../../../index.html#key252">list</a>, <a href="../../../../index.html#key233">word</a></p>
</div>
<div id="category" class="section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2007-2010 Andreas Kupries &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/yaml/huddle.html.

























































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>huddle - HUDDLE</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/yaml/huddle.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 KATO Kanryu &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ huddle.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">huddle(n) 0.1.5 tcllib &quot;HUDDLE&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>huddle - Create and manipulate huddle object</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">TYPE CALLBACK</a></li>
<li class="section"><a href="#section4">How to add type</a></li>
<li class="section"><a href="#section5">WORKING SAMPLE</a></li>
<li class="section"><a href="#section6">LIMITATIONS</a></li>
<li class="section"><a href="#section7">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">huddle <span class="opt">?0.1.5?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">huddle create</b> <i class="arg">key</i> <i class="arg">value</i> <span class="opt">?<i class="arg">key value ...</i>?</span></a></li>
<li><a href="#2"><b class="cmd">huddle list</b> <span class="opt">?<i class="arg">value value ...</i>?</span></a></li>
<li><a href="#3"><b class="cmd">huddle get</b> <i class="arg">object</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key ...</i>?</span></a></li>
<li><a href="#4"><b class="cmd">huddle gets</b> <i class="arg">object</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key ...</i>?</span></a></li>
<li><a href="#5"><b class="cmd">huddle set</b> <i class="arg">objectVar</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key ...</i>?</span> <i class="arg">value</i></a></li>
<li><a href="#6"><b class="cmd">huddle remove</b> <i class="arg">object</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key ...</i>?</span></a></li>
<li><a href="#7"><b class="cmd">huddle combine</b> <i class="arg">object1</i> <i class="arg">object2</i> <span class="opt">?<i class="arg">object3 ...</i>?</span></a></li>
<li><a href="#8"><b class="cmd">huddle equal</b> <i class="arg">object1</i> <i class="arg">object2</i></a></li>
<li><a href="#9"><b class="cmd">huddle append</b> <i class="arg">objectVar</i> <i class="arg">key</i> <i class="arg">value</i> <span class="opt">?<i class="arg">key value ...</i>?</span></a></li>
<li><a href="#10"><b class="cmd">huddle append</b> <i class="arg">objectVar</i> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></li>
<li><a href="#11"><b class="cmd">huddle keys</b> <i class="arg">object</i></a></li>
<li><a href="#12"><b class="cmd">huddle llength</b> <i class="arg">object</i></a></li>
<li><a href="#13"><b class="cmd">huddle type</b> <i class="arg">object</i> <span class="opt">?<i class="arg">key key...</i>?</span></a></li>
<li><a href="#14"><b class="cmd">huddle strip</b> <i class="arg">object</i></a></li>
<li><a href="#15"><b class="cmd">huddle jsondump</b> <i class="arg">object</i> <span class="opt">?<i class="arg">offset</i>?</span> <span class="opt">?<i class="arg">newline</i>?</span> <span class="opt">?<i class="arg">begin_offset</i>?</span></a></li>
<li><a href="#16"><b class="cmd">huddle compile</b> <i class="arg">spec</i> <i class="arg">data</i></a></li>
<li><a href="#17"><b class="cmd">huddle isHuddle</b> <i class="arg">object</i></a></li>
<li><a href="#18"><b class="cmd">huddle checkHuddle</b> <i class="arg">object</i></a></li>
<li><a href="#19"><b class="cmd">huddle to_node</b> <i class="arg">object</i> <span class="opt">?<i class="arg">tag</i>?</span></a></li>
<li><a href="#20"><b class="cmd">huddle wrap</b> <i class="arg">tag</i> <i class="arg">src</i></a></li>
<li><a href="#21"><b class="cmd">huddle call</b> <i class="arg">tag</i> <i class="arg">command</i> <i class="arg">args</i></a></li>
<li><a href="#22"><b class="cmd">huddle addType</b> <i class="arg">callback</i></a></li>
<li><a href="#23"><b class="cmd"><a href="../../../../index.html#key494">callback</a></b> <i class="arg">command</i> <span class="opt">?<i class="arg">args</i>?</span></a></li>
<li><a href="#24"><b class="cmd">setting</b></a></li>
<li><a href="#25"><b class="cmd">get_sub</b> <i class="arg">src</i> <i class="arg">key</i></a></li>
<li><a href="#26"><b class="cmd">strip</b> <i class="arg">src</i></a></li>
<li><a href="#27"><b class="cmd"><a href="../../../../index.html#key253">set</a></b> <i class="arg">src</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#28"><b class="cmd"><a href="../../../../index.html#key209">remove</a></b> <i class="arg">src</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Huddle provides a generic Tcl-based serialization/intermediary format.
Currently, each node is wrapped in a tag with simple type information.</p>
<p>When converting huddle-notation to other serialization formats like
JSON or YAML this type information is used to select the proper notation.
And when going from JSON/YAML/... to huddle their notation can be used
to select the proper huddle type.</p>
<p>In that manner huddle can serve as a common intermediary format.</p>
<pre class="example">
huddle-format: &gt;
  {HUDDLE {huddle-node}}
huddle-node: &gt;
  {tag content}
each content of tag means:
  s: (content is a) string
  L: list, each sub node is a huddle-node
  D: dict, each sub node is a huddle-node
confirmed:
  - JSON
  - YAML(generally, but cannot discribe YAML-tags)
limitation:
  - cannot discribe aliases from a node to other node.
</pre>
<p>The <b class="package">huddle</b> package returns
data as a Tcl <b class="cmd">dict</b>.  Either the <b class="package">dict</b> package or Tcl 8.5 is
required for use.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">huddle create</b> <i class="arg">key</i> <i class="arg">value</i> <span class="opt">?<i class="arg">key value ...</i>?</span></a></dt>
<dd><p>Create a huddle object as a dict. It can contain other huddle objects.</p></dd>
<dt><a name="2"><b class="cmd">huddle list</b> <span class="opt">?<i class="arg">value value ...</i>?</span></a></dt>
<dd><p>Create a huddle object as a list. It can contain other huddle objects.</p></dd>
<dt><a name="3"><b class="cmd">huddle get</b> <i class="arg">object</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key ...</i>?</span></a></dt>
<dd><p>Almost the same as <b class="cmd">dict get</b>.
Get a sub-object from the huddle object.
<i class="arg">key</i> can be used to huddle-list's index.</p></dd>
<dt><a name="4"><b class="cmd">huddle gets</b> <i class="arg">object</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key ...</i>?</span></a></dt>
<dd><p>Get a sub-object from the huddle object, stripped.</p></dd>
<dt><a name="5"><b class="cmd">huddle set</b> <i class="arg">objectVar</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key ...</i>?</span> <i class="arg">value</i></a></dt>
<dd><p>Almost the same as <b class="cmd">dict set</b>.
Set a sub-object from the huddle object.
<i class="arg">key</i> can be used to huddle-list's index.</p></dd>
<dt><a name="6"><b class="cmd">huddle remove</b> <i class="arg">object</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key ...</i>?</span></a></dt>
<dd><p>Almost the same as <b class="cmd">dict remove</b>.
Remove a sub-object from the huddle object.
<i class="arg">key</i> can be used to huddle-list's index.</p></dd>
<dt><a name="7"><b class="cmd">huddle combine</b> <i class="arg">object1</i> <i class="arg">object2</i> <span class="opt">?<i class="arg">object3 ...</i>?</span></a></dt>
<dd><p>Merging huddle objects given.</p>
<pre class="example">
% set aa [huddle create a b c d]
HUDDLE {D {a {s b} c {s d}}}
% set bb [huddle create a k l m]
HUDDLE {D {a {s k} l {s m}}}
% huddle combine $aa $bb
HUDDLE {D {a {s k} c {s d} l {s m}}}
</pre>
</dd>
<dt><a name="8"><b class="cmd">huddle equal</b> <i class="arg">object1</i> <i class="arg">object2</i></a></dt>
<dd><p>Comparing two huddle objects recursively.
When to equal, returns 1, otherwise 0.</p>
<pre class="example">
% set aa [huddle create a b c d]
HUDDLE {D {a {s b} c {s d}}}
% set bb [huddle create c d a b]
HUDDLE {D {c {s d} a {s b}}}
% huddle equal $aa $bb
1
</pre>
</dd>
<dt><a name="9"><b class="cmd">huddle append</b> <i class="arg">objectVar</i> <i class="arg">key</i> <i class="arg">value</i> <span class="opt">?<i class="arg">key value ...</i>?</span></a></dt>
<dd></dd>
<dt><a name="10"><b class="cmd">huddle append</b> <i class="arg">objectVar</i> <i class="arg">value</i> <span class="opt">?<i class="arg">value ...</i>?</span></a></dt>
<dd><p>Appending child elements. When for dicts, giving key/value. When for lists, giving values.</p>
<pre class="example">
% set aa [huddle create a b c d]
HUDDLE {D {a {s b} c {s d}}}
% huddle append aa a k l m
HUDDLE {D {a {s k} c {s d} l {s m}}}
% set bb [huddle list i j k l]
HUDDLE {L {{s i} {s j} {s k} {s l}}}
% huddle append bb g h i
HUDDLE {L {{s i} {s j} {s k} {s l} {s g} {s h} {s i}}}
</pre>
</dd>
<dt><a name="11"><b class="cmd">huddle keys</b> <i class="arg">object</i></a></dt>
<dd><p>The same as <b class="cmd">dict keys</b>.</p></dd>
<dt><a name="12"><b class="cmd">huddle llength</b> <i class="arg">object</i></a></dt>
<dd><p>The same as <b class="cmd">llength</b>.</p></dd>
<dt><a name="13"><b class="cmd">huddle type</b> <i class="arg">object</i> <span class="opt">?<i class="arg">key key...</i>?</span></a></dt>
<dd><p>Return the element type of specified by keys.
if <span class="opt">?key?</span> is not given, returns the type of root node.</p>
<dl class="options">
<dt><b class="option"><b class="const">string</b></b></dt>
<dd><p>the node is a tcl's string.</p></dd>
<dt><b class="option"><b class="const">dict</b></b></dt>
<dd><p>the node is a dict.</p></dd>
<dt><b class="option"><b class="const">list</b></b></dt>
<dd><p>the node is a list.</p></dd>
</dl>
<pre class="example">
% huddle type {HUDDLE {s str}}
string
% huddle type {HUDDLE {L {{s a} {s b} {s c}}}}
list
% huddle type {HUDDLE {D {aa {s b} cc {s d}}}} cc
string
</pre>
</dd>
<dt><a name="14"><b class="cmd">huddle strip</b> <i class="arg">object</i></a></dt>
<dd><p>Stripped all tags. Converted to normal Tcl's list/dict.</p></dd>
<dt><a name="15"><b class="cmd">huddle jsondump</b> <i class="arg">object</i> <span class="opt">?<i class="arg">offset</i>?</span> <span class="opt">?<i class="arg">newline</i>?</span> <span class="opt">?<i class="arg">begin_offset</i>?</span></a></dt>
<dd><p>dump a json-stream from the huddle-object.</p>
<dl class="options">
<dt><b class="option"><b class="const">offset</b> &quot;&quot;</b></dt>
<dd><p>begin offset as spaces &quot;  &quot;.</p></dd>
</dl>
<pre class="example"># normal output has some indents. some strings are escaped.
% huddle jsondump {HUDDLE {L {{L {{s i} {s baa} {s \\k} {L {{s 1.0} {s true} {s /g} {s h}}} {L {{s g}}}}} {s t}}}}
[
  [
    &quot;i&quot;,
    &quot;baa&quot;,
    &quot;\\k&quot;,
    [
      1.0,
      true,
      &quot;\/g&quot;,
      &quot;h&quot;
    ],
    [&quot;g&quot;]
  ],
  &quot;t&quot;
]
# stripped output
% huddle jsondump {HUDDLE {D {dd {D {bb {D {a {s baa} c {s {d
a}}}} cc {D {g {s h}}}}} ee {D {i {s j} k {s 1} j {s { m\a}}}}}}} &quot;&quot; &quot;&quot;
{&quot;dd&quot;: {&quot;bb&quot;: {&quot;a&quot;: &quot;baa&quot;,&quot;c&quot;: &quot;d\na&quot;},&quot;cc&quot;: {&quot;g&quot;: &quot;h&quot;}},&quot;ee&quot;: {&quot;i&quot;: &quot;j&quot;,&quot;k&quot;: 1,&quot;j&quot;: &quot; m\\a&quot;}}
</pre>
</dd>
<dt><a name="16"><b class="cmd">huddle compile</b> <i class="arg">spec</i> <i class="arg">data</i></a></dt>
<dd><p>construct a huddle object from plain old tcl values.
<i class="arg">spec</i> is defined as follows:</p>
<dl class="definitions">
<dt><b class="const">string</b></dt>
<dd><p>data is simply a string</p></dd>
<dt><b class="const">list</b></dt>
<dd><p>data is a tcl list of strings</p></dd>
<dt><b class="const">dict</b></dt>
<dd><p>data is a tcl dict of strings</p></dd>
<dt>list list</dt>
<dd><p>data is a tcl list of lists</p></dd>
<dt>list dict</dt>
<dd><p>data is a tcl list of dicts</p></dd>
<dt>dict xx list</dt>
<dd><p>data is a tcl dict where the value of key xx is a tcl list</p></dd>
<dt>dict * list</dt>
<dd><p>data is a tcl dict of lists
<i class="arg">data</i> is plain old tcl values</p></dd>
</dl>
<pre class="example">% huddle compile {dict * list} {a {1 2 3} b {4 5}}
HUDDLE {D {a {L {{s 1} {s 2} {s 3}}} b {L {{s 4} {s 5}}}}}
% huddle compile {dict * {list {dict d list}}} {a {{c 1} {d {2 2 2} e 3}} b {{f 4 g 5}}}
HUDDLE {D {a {L {{D {c {s 1}}} {D {d {L {{s 2} {s 2} {s 2}}} e {s 3}}}}} b {L {{D {f {s 4} g {s 5}}}}}}}
</pre>
</dd>
<dt><a name="17"><b class="cmd">huddle isHuddle</b> <i class="arg">object</i></a></dt>
<dd><p>if <i class="arg">object</i> is a huddle, returns 1. the other, returns 0.</p></dd>
<dt><a name="18"><b class="cmd">huddle checkHuddle</b> <i class="arg">object</i></a></dt>
<dd><p>if <i class="arg">object</i> is not a huddle, rises an error.</p></dd>
<dt><a name="19"><b class="cmd">huddle to_node</b> <i class="arg">object</i> <span class="opt">?<i class="arg">tag</i>?</span></a></dt>
<dd><p>for type-callbacks.</p>
<p>if <i class="arg">object</i> is a huddle, returns root-node. the other, returns <b class="cmd">[list s $object]</b>.</p>
<pre class="example">
% huddle to_node str
s str
% huddle to_node str !!str
!!str str
% huddle to_node {HUDDLE {s str}}
s str
% huddle to_node {HUDDLE {l {a b c}}}
l {a b c}
</pre>
</dd>
<dt><a name="20"><b class="cmd">huddle wrap</b> <i class="arg">tag</i> <i class="arg">src</i></a></dt>
<dd><p>for type-callbacks.</p>
<p>Create a huddle object from <i class="arg">src</i> with specified <i class="arg">tag</i>.</p>
<pre class="example">
% huddle wrap &quot;&quot; str
HUDDLE str
% huddle wrap s str
HUDDLE {s str}
</pre>
</dd>
<dt><a name="21"><b class="cmd">huddle call</b> <i class="arg">tag</i> <i class="arg">command</i> <i class="arg">args</i></a></dt>
<dd><p>for type-callbacks.</p>
<p>devolving <i class="arg">command</i> to default <i class="arg">tag</i>-callback</p></dd>
<dt><a name="22"><b class="cmd">huddle addType</b> <i class="arg">callback</i></a></dt>
<dd><p>add a user-specified-type/tag to the huddle library.
To see &quot;Additional Type&quot;.</p>
<dl class="options">
<dt><b class="option">callback</b></dt>
<dd><p>callback function name for additional type.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">TYPE CALLBACK</a></h2>
<p>The definition of callback for user-type.</p>
<dl class="definitions">
<dt><a name="23"><b class="cmd"><a href="../../../../index.html#key494">callback</a></b> <i class="arg">command</i> <span class="opt">?<i class="arg">args</i>?</span></a></dt>
<dd><dl class="options">
<dt><b class="option">command</b></dt>
<dd><p>huddle subcomand which is needed to reply by the callback.</p></dd>
<dt><b class="option">args</b></dt>
<dd><p>arguments of subcommand. The number of list of arguments is different for each subcommand.</p></dd>
</dl></dd>
</dl>
<p>The callback procedure shuould reply the following subcommands.</p>
<dl class="definitions">
<dt><a name="24"><b class="cmd">setting</b></a></dt>
<dd><p>only returns a fixed dict of the type infomation for setting the user-tag.</p>
<dl class="definitions">
<dt><b class="const">type</b> typename</dt>
<dd><p>typename of the type</p></dd>
<dt><b class="const">method</b> {method1 method2 method3 ...}</dt>
<dd><p>method list as huddle subcommand. Then, you can call <b class="cmd">[huddle method1 ...]</b></p></dd>
<dt><b class="const">tag</b> {tag1 child/parent tag2 child/parent ...}</dt>
<dd><p>tag list for huddle-node as a dict. if the type has child-nodes, use &quot;parent&quot;, otherwise use &quot;child&quot;.</p></dd>
</dl></dd>
<dt><a name="25"><b class="cmd">get_sub</b> <i class="arg">src</i> <i class="arg">key</i></a></dt>
<dd><p>returns a sub node specified by <i class="arg">key</i>.</p>
<dl class="options">
<dt><b class="option">src</b></dt>
<dd><p>a node content in huddle object.</p></dd>
</dl></dd>
<dt><a name="26"><b class="cmd">strip</b> <i class="arg">src</i></a></dt>
<dd><p>returns stripped node contents. if the type has child nodes, every node must be stripped.</p></dd>
<dt><a name="27"><b class="cmd"><a href="../../../../index.html#key253">set</a></b> <i class="arg">src</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>sets a sub-node from the tagged-content, and returns self.</p></dd>
<dt><a name="28"><b class="cmd"><a href="../../../../index.html#key209">remove</a></b> <i class="arg">src</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>removes a sub-node from the tagged-content, and returns self.</p></dd>
</dl>
<p><b class="cmd">strip</b> must be defined at all types.
<b class="cmd">get_sub</b> must be defined at container types.
<b class="cmd">set/remove</b> shuould be defined, if you call them.</p>
<pre class="example">
# callback sample for my-dict
proc my_dict_setting {command args} {
    switch -- $command {
        setting { ; # type definition
            return {
                type dict
                method {create keys}
                tag {d child D parent}
                constructor create
                str s
            }
            # type:   the type-name
            # method: add methods to huddle's subcommand.
            #          &quot;get_sub/strip/set/remove/equal/append&quot; called by huddle module.
            #          &quot;strip&quot; must be defined at all types.
            #          &quot;get_sub&quot; must be defined at container types.
            #          &quot;set/remove/equal/append&quot; shuould be defined, if you call them.
            # tag:    tag definition(&quot;child/parent&quot; word is maybe obsoleted)
        }
        get_sub { ; # get a sub-node specified by &quot;key&quot; from the tagged-content
            foreach {src key} $args break
            return [dict get $src $key]
        }
        strip { ; # strip from the tagged-content
            foreach {src nop} $args break
            foreach {key val} $src {
                lappend result $key [huddle strip $val]
            }
            return $result
        }
        set { ; # set a sub-node from the tagged-content
            foreach {src key value} $args break
            dict set src $key $value
            return $src
        }
        remove { ; # remove a sub-node from the tagged-content
            foreach {src key value} $args break
            return [dict remove $src $key]
        }
        equal { ; # check equal for each node
            foreach {src1 src2} $args break
            if {[llength $src1] != [llength $src2]} {return 0}
            foreach {key1 val1} $src1 {
                if {![dict exists $src2 $key1]} {return 0}
                if {![huddle _equal_subs $val1 [dict get $src2 $key1]]} {return 0}
            }
            return 1
        }
        append { ; # append nodes
            foreach {str src list} $args break
            if {[llength $list] % 2} {error {wrong # args: should be &quot;huddle append objvar ?key value ...?&quot;}}
            set resultL $src
            foreach {key value} $list {
                if {$str ne &quot;&quot;} {
                    lappend resultL $key [huddle to_node $value $str]
                } else {
                    lappend resultL $key $value
                }
            }
            return [eval dict create $resultL]
        }
        create { ; # $args: all arguments after &quot;huddle create&quot;
            if {[llength $args] % 2} {error {wrong # args: should be &quot;huddle create ?key value ...?&quot;}}
            set resultL {}
            foreach {key value} $args {
                lappend resultL $key [huddle to_node $value]
            }
            return [huddle wrap D $resultL]
        }
        keys {
            foreach {src nop} $args break
            return [dict keys [lindex [lindex $src 1] 1]]
        }
        default {
            error &quot;$command is not callback for dict&quot;
        }
    }
}
</pre>
<pre class="example">
# inheritance sample from default dict-callback
proc ::yaml::_huddle_mapping {command args} {
    switch -- $command {
        setting { ; # type definition
            return {
                type dict
                method {mapping}
                tag {!!map parent}
                constructor mapping
                str !!str
            }
        }
        mapping { ; # $args: all arguments after &quot;huddle mapping&quot;
            if {[llength $args] % 2} {error {wrong # args: should be &quot;huddle mapping ?key value ...?&quot;}}
            set resultL {}
            foreach {key value} $args {
                lappend resultL $key [huddle to_node $value !!str]
            }
            return [huddle wrap !!map $resultL]
        }
        default { ; # devolving to default dict-callback
            return [huddle call D $command $args]
        }
    }
}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">How to add type</a></h2>
<p>You can add huddle-node types e.g. ::struct::tree.
To do so, first, define a callback-procedure for additional tagged-type.
The proc get argments as <i class="arg">command</i> and <span class="opt">?<i class="arg">args</i>?</span>. It has some switch-sections.</p>
<p>And, addType subcommand will called.</p>
<pre class="example">
huddle addType my_dict_setting
</pre>
</div>
<div id="section5" class="section"><h2><a name="section5">WORKING SAMPLE</a></h2>
<pre class="example">
# create as a dict
% set bb [huddle create a b c d]
HUDDLE {D {a {s b} c {s d}}}
# create as a list
% set cc [huddle list e f g h]
HUDDLE {L {{s e} {s f} {s g} {s h}}}
% set bbcc [huddle create bb $bb cc $cc]
HUDDLE {D {bb {D {a {s b} c {s d}}} cc {L {{s e} {s f} {s g} {s h}}}}}
% set folding [huddle list $bbcc p [huddle list q r] s]
HUDDLE {L {{D {bb {D {a {s b} c {s d}}} cc {L {{s e} {s f} {s g} {s h}}}}} {s p} {L {{s q} {s r}}} {s s}}}
# normal Tcl's notation
% huddle strip $folding
{bb {a b c d} cc {e f g h}} p {q r} s
# get a sub node
% huddle get $folding 0 bb
HUDDLE {D {a {s b} c {s d}}}
% huddle gets $folding 0 bb
a b c d
# overwrite a node
% huddle set folding 0 bb c kkk
HUDDLE {L {{D {bb {D {a {s b} c {s kkk}}} cc {L {{s e} {s f} {s g} {s h}}}}} {s p} {L {{s q} {s r}}} {s s}}}
# remove a node
% huddle remove $folding 2 1
HUDDLE {L {{D {bb {D {a {s b} c {s kkk}}} cc {L {{s e} {s f} {s g} {s h}}}}} {s p} {L {{s q}}} {s s}}}
% huddle strip $folding
{bb {a b c kkk} cc {e f g h}} p {q r} s
# dump as a JSON stream
% huddle jsondump $folding
[
  {
    &quot;bb&quot;: {
      &quot;a&quot;: &quot;b&quot;,
      &quot;c&quot;: &quot;kkk&quot;
    },
    &quot;cc&quot;: [
      &quot;e&quot;,
      &quot;f&quot;,
      &quot;g&quot;,
      &quot;h&quot;
    ]
  },
  &quot;p&quot;,
  [
    &quot;q&quot;,
    &quot;r&quot;
  ],
  &quot;s&quot;
]
</pre>
</div>
<div id="section6" class="section"><h2><a name="section6">LIMITATIONS</a></h2>
<p>now printing.</p>
</div>
<div id="section7" class="section"><h2><a name="section7">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>huddle</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="yaml.html">yaml</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key171">data exchange</a>, <a href="../../../../index.html#key170">exchange format</a>, <a href="../../../../index.html#key541">huddle</a>, <a href="../../../../index.html#key172">json</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key178">text processing</a>, <a href="../../../../index.html#key542">yaml</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 KATO Kanryu &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/files/modules/yaml/yaml.html.




























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

<html><head>
<title>yaml - YAML processing</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file '/net/nas/data/andreask/Dev/Tcllib/tcllib/embedded/www/tcllib/files/modules/yaml/yaml.html' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2008 KATO Kanryu &lt;[email protected]&gt;
   -->
<! -- CVS: $Id$ yaml.n
   -->
<body><div class="doctools">
<hr> [
  <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h1 class="title">yaml(n) 0.3.6 tcllib &quot;YAML processing&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>yaml - YAML Format Encoder/Decoder</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">COMMANDS</a></li>
<li class="section"><a href="#section3">EXAMPLES</a></li>
<li class="section"><a href="#section4">LIMITATIONS</a></li>
<li class="section"><a href="#section5">BUGS, IDEAS, FEEDBACK</a></li>
<li class="section"><a href="#see-also">See Also</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">yaml <span class="opt">?0.3.6?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::yaml::yaml2dict</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">txt</i></a></li>
<li><a href="#2"><b class="cmd">::yaml::yaml2huddle</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">txt</i></a></li>
<li><a href="#3"><b class="cmd">::yaml::setOption</b> <span class="opt">?<i class="arg">options</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::yaml::dict2yaml</b> <i class="arg">dict</i> <span class="opt">?<i class="arg">indent</i>?</span> <span class="opt">?<i class="arg">wordwrap</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::yaml::list2yaml</b> <i class="arg">list</i> <span class="opt">?<i class="arg">indent</i>?</span> <span class="opt">?<i class="arg">wordwrap</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::yaml::huddle2yaml</b> <i class="arg">huddle</i> <span class="opt">?<i class="arg">indent</i>?</span> <span class="opt">?<i class="arg">wordwrap</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <b class="package">yaml</b> package provides a simple Tcl-only library for parsing the
YAML <a href="http://www.yaml.org/">http://www.yaml.org/</a> data exchange format as specified in 
<a href="http://www.yaml.org/spec/1.1/">http://www.yaml.org/spec/1.1/</a>.</p>
<p>The <b class="package">yaml</b> package returns
data as a Tcl <b class="cmd">dict</b>.  Either the <b class="package">dict</b> package or Tcl 8.5 is
required for use.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::yaml::yaml2dict</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">txt</i></a></dt>
<dd></dd>
<dt><a name="2"><b class="cmd">::yaml::yaml2huddle</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">txt</i></a></dt>
<dd><p>Parse yaml formatted text <i class="arg">txt</i> into a Tcl dict/huddle and return the value.</p>
<dl class="options">
<dt><b class="option"><b class="const">-file</b></b></dt>
<dd><p><i class="arg">txt</i> is a filename of YAML-stream.</p></dd>
<dt><b class="option"><b class="const">-stream</b></b></dt>
<dd><p><i class="arg">txt</i> is just a YAML-stream.</p></dd>
<dt><b class="option"><b class="const">-types</b> <i class="arg">list</i></b></dt>
<dd><p>The <i class="arg">list</i> is a type list for the yaml-scalar types.(e.g. !!str !!timestamp !!integer !!true ...)</p>
<pre class="example"> -types {timestamp integer null true false}</pre>
<p>In this case, if a string matched &quot;timestamp&quot;, converted to the TCL internal timestamp.(e.g. &quot;2001-12-15T02:59:43.1Z&quot; =&gt; 1008385183)</p></dd>
<dt><b class="option"><b class="const">-m:true</b> <i class="arg">param</i></b></dt>
<dd><p>The <i class="arg">param</i> is two elements of list for the value of true, and considered strings.</p>
<pre class="example"> -m:true {1 {true on + yes y}}</pre>
<p>In this case, the string &quot;yes&quot; found in YAML Stream, automatically converted 1.</p></dd>
<dt><b class="option"><b class="const">-m:false</b> <i class="arg">param</i></b></dt>
<dd><p>The <i class="arg">param</i> is two elements of list for the value of false, and considered strings.</p>
<pre class="example"> -m:false {0 {false off - no n}}</pre>
</dd>
<dt><b class="option"><b class="const">-m:null</b> <i class="arg">param</i></b></dt>
<dd><p>The <i class="arg">param</i> is two elements of list for the value of null, and considered strings.</p>
<pre class="example"> -m:null {&quot;&quot; {null nil &quot;&quot; ~}}</pre>
</dd>
<dt><b class="option"><b class="const">-validate</b></b></dt>
<dd><p>Experiment,old: Output stream contains YAML's-tag, each node.</p>
<pre class="example">% puts [::yaml::load -validate {[aaa, bbb]}]
=&gt;
!!seq {{!!str aaa} {!!str bbb}}
</pre>
</dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::yaml::setOption</b> <span class="opt">?<i class="arg">options</i>?</span></a></dt>
<dd><p>Change implicit options for the library.
Now, the params are the same as <b class="cmd">::yaml::yaml2dict</b>.
Arguments of<b class="cmd">::yaml::yaml2dict</b> is more priority than this setting.</p></dd>
<dt><a name="4"><b class="cmd">::yaml::dict2yaml</b> <i class="arg">dict</i> <span class="opt">?<i class="arg">indent</i>?</span> <span class="opt">?<i class="arg">wordwrap</i>?</span></a></dt>
<dd></dd>
<dt><a name="5"><b class="cmd">::yaml::list2yaml</b> <i class="arg">list</i> <span class="opt">?<i class="arg">indent</i>?</span> <span class="opt">?<i class="arg">wordwrap</i>?</span></a></dt>
<dd></dd>
<dt><a name="6"><b class="cmd">::yaml::huddle2yaml</b> <i class="arg">huddle</i> <span class="opt">?<i class="arg">indent</i>?</span> <span class="opt">?<i class="arg">wordwrap</i>?</span></a></dt>
<dd><p>Convert a dict/list/huddle object into YAML stream.</p>
<dl class="definitions">
<dt>indent</dt>
<dd><p>spaces indent of each block node.
currently default is 2.</p></dd>
<dt>wordwrap</dt>
<dd><p>word wrap for YAML stream.
currently default is 40.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">EXAMPLES</a></h2>
<p>An example of a yaml stream converted to Tcl.  A yaml stream is returned as a
single item with multiple elements.</p>
<pre class="example">{
--- !&lt;tag:clarkevans.com,2002:invoice&gt;
invoice: 34843
date   : 2001-01-23
bill-to: &amp;id001
    given  : Chris
    family : Dumars
    address:
        lines: |
            458 Walkman Dr.
            Suite #292
        city    : Royal Oak
        state   : MI
        postal  : 48046
ship-to: *id001
product:
    - sku         : BL394D
      quantity    : 4
      description : Basketball
      price       : 450.00
    - sku         : BL4438H
      quantity    : 1
      description : Super Hoop
      price       : 2392.00
tax  : 251.42
total: 4443.52
comments:
    Late afternoon is best.
    Backup contact is Nancy
    Billsmer @ 338-4338.
}
=&gt;
invoice 34843 date 2001-01-23 bill-to {given Chris family Dumars address {lines {458 Walkman Dr.
Suite #292
} city {Royal Oak} state MI postal 48046}} ship-to {given Chris family Dumars address {lines {458 Walkman Dr.
Suite #292
} city {Royal Oak} state MI postal 48046}} product {{sku BL394D quantity 4 description Basketball price 450.00} {sku BL4438H quantity 1 description {Super Hoop} price 2392.00}} tax 251.42 total 4443.52 comments {Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.}</pre>
<p>An example of a yaml object converted to Tcl.  A yaml object is returned as a
multi-element list (a dict).</p>
<pre class="example">{
---
- [name        , hr, avg  ]
- [Mark McGwire, 65, 0.278]
- [Sammy Sosa  , 63, 0.288]
- 
  Mark McGwire: {hr: 65, avg: 0.278}
  Sammy Sosa: { hr: 63, avg: 0.288}
}
=&gt;
{name hr avg} {{Mark McGwire} 65 0.278} {{Sammy Sosa} 63 0.288} {{Mark McGwire} {hr 65 avg 0.278} {Sammy Sosa} {hr 63 avg 0.288}}
</pre>
</div>
<div id="section4" class="section"><h2><a name="section4">LIMITATIONS</a></h2>
<p>tag parser not implemented. currentry, tags are merely ignored.</p>
<p>Only Anchor =&gt; Aliases ordering. back alias-referring is not supported.</p>
<p>Too many braces, or too few braces.</p>
<p>Not enough character set of line feeds. Please use only &quot;\n&quot; as line breaks.</p>
</div>
<div id="section5" class="section"><h2><a name="section5">BUGS, IDEAS, FEEDBACK</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>yaml</em> of the
<a href="http://sourceforge.net/tracker/?group_id=12883">Tcllib SF Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="see-also" class="section"><h2><a name="see-also">See Also</a></h2>
<p><a href="../base64/base64.html">base64</a>, <a href="huddle.html">huddle</a>, <a href="../json/json.html">json</a></p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key171">data exchange</a>, <a href="../../../../index.html#key541">huddle</a>, <a href="../../../../index.html#key26">parsing</a>, <a href="../../../../index.html#key178">text processing</a>, <a href="../../../../index.html#key542">yaml</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2008 KATO Kanryu &lt;[email protected]&gt;</p>
</div>
</div></body></html>

Added embedded/www/tcllib/toc.html.


















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title> Table Of Contents </title>
</head>
<! -- Generated by tcllib/doctools/toc with format 'html'
   -->
<! -- CVS: $Id$ Table Of Contents
   -->
<body>
<hr> [
  <a href="../index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h3> Table Of Contents </h3>
<hr><dl><dt><h2> tcllib </h2><dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/aes/aes.html">aes</a></td>
<td class="#tocright">Implementation of the AES block cipher</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/base64/ascii85.html">ascii85</a></td>
<td class="#tocright">ascii85-encode/decode binary data</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/asn/asn.html">asn</a></td>
<td class="#tocright">ASN.1 BER encoder/decoder</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/http/autoproxy.html">autoproxy</a></td>
<td class="#tocright">Automatic HTTP proxy usage and authentication</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/base32/base32.html">base32</a></td>
<td class="#tocright">base32 standard encoding</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/base32/base32core.html">base32::core</a></td>
<td class="#tocright">Expanding basic base32 maps</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/base32/base32hex.html">base32::hex</a></td>
<td class="#tocright">base32 extended hex encoding</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/base64/base64.html">base64</a></td>
<td class="#tocright">base64-encode/decode binary data</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/bee/bee.html">bee</a></td>
<td class="#tocright">BitTorrent Serialization Format Encoder/Decoder</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/bench/bench.html">bench</a></td>
<td class="#tocright">bench - Processing benchmark suites</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/bench/bench_read.html">bench::in</a></td>
<td class="#tocright">bench::in - Reading benchmark results</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/bench/bench_wcsv.html">bench::out::csv</a></td>
<td class="#tocright">bench::out::csv - Formatting benchmark results as CSV</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/bench/bench_wtext.html">bench::out::text</a></td>
<td class="#tocright">bench::out::text - Formatting benchmark results as human readable text</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/bench/bench_intro.html">bench_intro</a></td>
<td class="#tocright">bench introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/bench/bench_lang_intro.html">bench_lang_intro</a></td>
<td class="#tocright">bench language introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/bench/bench_lang_spec.html">bench_lang_spec</a></td>
<td class="#tocright">bench language specification</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/bibtex/bibtex.html">bibtex</a></td>
<td class="#tocright">Parse bibtex files</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/blowfish/blowfish.html">blowfish</a></td>
<td class="#tocright">Implementation of the Blowfish block cipher</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/cache/async.html">cache::async</a></td>
<td class="#tocright">Asynchronous in-memory cache</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/crc/cksum.html">cksum</a></td>
<td class="#tocright">Calculate a cksum(1) compatible checksum</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/clock/iso8601.html">clock_iso8601</a></td>
<td class="#tocright">Parsing ISO 8601 dates/times</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/clock/rfc2822.html">clock_rfc2822</a></td>
<td class="#tocright">Parsing ISO 8601 dates/times</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/cmdline/cmdline.html">cmdline</a></td>
<td class="#tocright">Procedures to process command lines and options.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/comm/comm.html">comm</a></td>
<td class="#tocright">A remote communication facility for Tcl (8.3 and later)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/comm/comm_wire.html">comm_wire</a></td>
<td class="#tocright">The comm wire protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/control/control.html">control</a></td>
<td class="#tocright">Procedures for control flow structures.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/coroutine/coroutine.html">coroutine</a></td>
<td class="#tocright">Coroutine based event and IO handling</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/coroutine/coro_auto.html">coroutine::auto</a></td>
<td class="#tocright">Automatic event and IO coroutine awareness</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/counter/counter.html">counter</a></td>
<td class="#tocright">Procedures for counters and histograms</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/crc/crc16.html">crc16</a></td>
<td class="#tocright">Perform a 16bit Cyclic Redundancy Check</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/crc/crc32.html">crc32</a></td>
<td class="#tocright">Perform a 32bit Cyclic Redundancy Check</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/csv/csv.html">csv</a></td>
<td class="#tocright">Procedures to handle CSV data.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/interp/deleg_method.html">deleg_method</a></td>
<td class="#tocright">Creation of comm delegates (snit methods)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/interp/deleg_proc.html">deleg_proc</a></td>
<td class="#tocright">Creation of comm delegates (procedures)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/des/des.html">des</a></td>
<td class="#tocright">Implementation of the DES and triple-DES ciphers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/dns/tcllib_dns.html">dns</a></td>
<td class="#tocright">Tcl Domain Name Service Client</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/docidx_intro.html">docidx_intro</a></td>
<td class="#tocright">docidx introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/docidx_lang_cmdref.html">docidx_lang_cmdref</a></td>
<td class="#tocright">docidx language command reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/docidx_lang_faq.html">docidx_lang_faq</a></td>
<td class="#tocright">docidx language faq</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/docidx_lang_intro.html">docidx_lang_intro</a></td>
<td class="#tocright">docidx language introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/docidx_lang_syntax.html">docidx_lang_syntax</a></td>
<td class="#tocright">docidx language syntax</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/docidx_plugin_apiref.html">docidx_plugin_apiref</a></td>
<td class="#tocright">docidx plugin API reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/docstrip/docstrip.html">docstrip</a></td>
<td class="#tocright">Docstrip style source code extraction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/docstrip/docstrip_util.html">docstrip_util</a></td>
<td class="#tocright">Docstrip-related utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/doctoc_intro.html">doctoc_intro</a></td>
<td class="#tocright">doctoc introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/doctoc_lang_cmdref.html">doctoc_lang_cmdref</a></td>
<td class="#tocright">doctoc language command reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/doctoc_lang_faq.html">doctoc_lang_faq</a></td>
<td class="#tocright">doctoc language faq</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/doctoc_lang_intro.html">doctoc_lang_intro</a></td>
<td class="#tocright">doctoc language introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/doctoc_lang_syntax.html">doctoc_lang_syntax</a></td>
<td class="#tocright">doctoc language syntax</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/doctoc_plugin_apiref.html">doctoc_plugin_apiref</a></td>
<td class="#tocright">doctoc plugin API reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/doctools.html">doctools</a></td>
<td class="#tocright">doctools - Processing documents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/introduction.html">doctools2idx_introduction</a></td>
<td class="#tocright">DocTools - Keyword indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/introduction.html">doctools2toc_introduction</a></td>
<td class="#tocright">DocTools - Tables of Contents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/changelog.html">doctools::changelog</a></td>
<td class="#tocright">Processing text in Emacs ChangeLog format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/cvs.html">doctools::cvs</a></td>
<td class="#tocright">Processing text in 'cvs log' format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2base/html_cssdefaults.html">doctools::html::cssdefaults</a></td>
<td class="#tocright">Default CSS style for HTML export plugins</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/docidx.html">doctools::idx</a></td>
<td class="#tocright">docidx - Processing indices</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/container.html">doctools::idx</a></td>
<td class="#tocright">Holding keyword indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2idx/export.html">doctools::idx::export</a></td>
<td class="#tocright">Exporting keyword indices</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/export_docidx.html">doctools::idx::export::docidx</a></td>
<td class="#tocright">docidx export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2idx/export_html.html">doctools::idx::export::html</a></td>
<td class="#tocright">HTML export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/export_json.html">doctools::idx::export::json</a></td>
<td class="#tocright">JSON export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2idx/export_nroff.html">doctools::idx::export::nroff</a></td>
<td class="#tocright">nroff export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/export_text.html">doctools::idx::export::text</a></td>
<td class="#tocright">plain text export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2idx/export_wiki.html">doctools::idx::export::wiki</a></td>
<td class="#tocright">wiki export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/import.html">doctools::idx::import</a></td>
<td class="#tocright">Importing keyword indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2idx/import_docidx.html">doctools::idx::import::docidx</a></td>
<td class="#tocright">docidx import plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/import_json.html">doctools::idx::import::json</a></td>
<td class="#tocright">JSON import plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2idx/parse.html">doctools::idx::parse</a></td>
<td class="#tocright">Parsing text in docidx format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/structure.html">doctools::idx::structure</a></td>
<td class="#tocright">Docidx serialization utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2base/tcllib_msgcat.html">doctools::msgcat</a></td>
<td class="#tocright">Message catalog management for the various document parsers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/msgcat_c.html">doctools::msgcat::idx::c</a></td>
<td class="#tocright">Message catalog for the docidx parser (C)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2idx/msgcat_de.html">doctools::msgcat::idx::de</a></td>
<td class="#tocright">Message catalog for the docidx parser (DE)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2idx/msgcat_en.html">doctools::msgcat::idx::en</a></td>
<td class="#tocright">Message catalog for the docidx parser (EN)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2idx/msgcat_fr.html">doctools::msgcat::idx::fr</a></td>
<td class="#tocright">Message catalog for the docidx parser (FR)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2toc/msgcat_c.html">doctools::msgcat::toc::c</a></td>
<td class="#tocright">Message catalog for the doctoc parser (C)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/msgcat_de.html">doctools::msgcat::toc::de</a></td>
<td class="#tocright">Message catalog for the doctoc parser (DE)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2toc/msgcat_en.html">doctools::msgcat::toc::en</a></td>
<td class="#tocright">Message catalog for the doctoc parser (EN)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/msgcat_fr.html">doctools::msgcat::toc::fr</a></td>
<td class="#tocright">Message catalog for the doctoc parser (FR)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2base/nroff_manmacros.html">doctools::nroff::man_macros</a></td>
<td class="#tocright">Default CSS style for NROFF export plugins</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2base/tcl_parse.html">doctools::tcl::parse</a></td>
<td class="#tocright">Processing text in 'subst -novariables' format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/doctoc.html">doctools::toc</a></td>
<td class="#tocright">doctoc - Processing tables of contents</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/container.html">doctools::toc</a></td>
<td class="#tocright">Holding tables of contents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2toc/export.html">doctools::toc::export</a></td>
<td class="#tocright">Exporting tables of contents</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/export_doctoc.html">doctools::toc::export::doctoc</a></td>
<td class="#tocright">doctoc export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2toc/export_html.html">doctools::toc::export::html</a></td>
<td class="#tocright">HTML export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/export_json.html">doctools::toc::export::json</a></td>
<td class="#tocright">JSON export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2toc/export_nroff.html">doctools::toc::export::nroff</a></td>
<td class="#tocright">nroff export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/export_text.html">doctools::toc::export::text</a></td>
<td class="#tocright">plain text export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2toc/export_wiki.html">doctools::toc::export::wiki</a></td>
<td class="#tocright">wiki export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/import.html">doctools::toc::import</a></td>
<td class="#tocright">Importing keyword indices</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2toc/import_doctoc.html">doctools::toc::import::doctoc</a></td>
<td class="#tocright">doctoc import plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/import_json.html">doctools::toc::import::json</a></td>
<td class="#tocright">JSON import plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools2toc/parse.html">doctools::toc::parse</a></td>
<td class="#tocright">Parsing text in doctoc format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools2toc/structure.html">doctools::toc::structure</a></td>
<td class="#tocright">Doctoc serialization utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/doctools_intro.html">doctools_intro</a></td>
<td class="#tocright">doctools introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/doctools_lang_cmdref.html">doctools_lang_cmdref</a></td>
<td class="#tocright">doctools language command reference</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/doctools_lang_faq.html">doctools_lang_faq</a></td>
<td class="#tocright">doctools language faq</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/doctools_lang_intro.html">doctools_lang_intro</a></td>
<td class="#tocright">doctools language introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/doctools_lang_syntax.html">doctools_lang_syntax</a></td>
<td class="#tocright">doctools language syntax</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/doctools/doctools_plugin_apiref.html">doctools_plugin_apiref</a></td>
<td class="#tocright">doctools plugin API reference</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/apps/dtplite.html">dtplite</a></td>
<td class="#tocright">Lightweight DocTools Markup Processor</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/exif/exif.html">exif</a></td>
<td class="#tocright">Tcl EXIF extracts and parses EXIF fields from digital images</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/fileutil/fileutil.html">fileutil</a></td>
<td class="#tocright">Procedures implementing some file utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/fumagic/cfront.html">fileutil::magic::cfront</a></td>
<td class="#tocright">Generator core for compiler of magic(5) files</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/fumagic/cgen.html">fileutil::magic::cgen</a></td>
<td class="#tocright">Generator core for compiler of magic(5) files</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/fumagic/filetypes.html">fileutil::magic::filetype</a></td>
<td class="#tocright">Procedures implementing file-type recognition</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/fumagic/mimetypes.html">fileutil::magic::mimetype</a></td>
<td class="#tocright">Procedures implementing mime-type recognition</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/fumagic/rtcore.html">fileutil::magic::rt</a></td>
<td class="#tocright">Runtime core for file type recognition engines written in pure Tcl</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/fileutil/multi.html">fileutil::multi</a></td>
<td class="#tocright">Multi-file operation, scatter/gather, standard object</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/fileutil/multiop.html">fileutil::multi::op</a></td>
<td class="#tocright">Multi-file operation, scatter/gather</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/fileutil/traverse.html">fileutil_traverse</a></td>
<td class="#tocright">Iterative directory traversal</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/ftp/ftp.html">ftp</a></td>
<td class="#tocright">Client-side tcl implementation of the ftp protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/ftp/ftp_geturl.html">ftp::geturl</a></td>
<td class="#tocright">Uri handler for ftp urls</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/ftpd/ftpd.html">ftpd</a></td>
<td class="#tocright">Tcl FTP server implementation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/generator/generator.html">generator</a></td>
<td class="#tocright">Procedures for creating and using generators.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/gpx/gpx.html">gpx</a></td>
<td class="#tocright">Extracts waypoints, tracks and routes from GPX files</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/grammar_aycock/aycock.html">grammar::aycock</a></td>
<td class="#tocright">Aycock-Horspool-Earley parser generator for Tcl</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/grammar_fa/fa.html">grammar::fa</a></td>
<td class="#tocright">Create and manipulate finite automatons</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/grammar_fa/dacceptor.html">grammar::fa::dacceptor</a></td>
<td class="#tocright">Create and use deterministic acceptors</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/grammar_fa/dexec.html">grammar::fa::dexec</a></td>
<td class="#tocright">Execute deterministic finite automatons</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/grammar_fa/faop.html">grammar::fa::op</a></td>
<td class="#tocright">Operations on finite automatons</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/grammar_me/me_cpu.html">grammar::me::cpu</a></td>
<td class="#tocright">Virtual machine implementation II for parsing token streams</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/grammar_me/me_cpucore.html">grammar::me::cpu::core</a></td>
<td class="#tocright">ME virtual machine state manipulation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/grammar_me/gasm.html">grammar::me::cpu::gasm</a></td>
<td class="#tocright">ME assembler</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/grammar_me/me_tcl.html">grammar::me::tcl</a></td>
<td class="#tocright">Virtual machine implementation I for parsing token streams</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/grammar_me/me_util.html">grammar::me::util</a></td>
<td class="#tocright">AST utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/grammar_me/me_ast.html">grammar::me_ast</a></td>
<td class="#tocright">Various representations of ASTs</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/grammar_me/me_intro.html">grammar::me_intro</a></td>
<td class="#tocright">Introduction to virtual machines for parsing token streams</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/grammar_me/me_vm.html">grammar::me_vm</a></td>
<td class="#tocright">Virtual machine for parsing token streams</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/grammar_peg/peg.html">grammar::peg</a></td>
<td class="#tocright">Create and manipulate parsing expression grammars</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/grammar_peg/peg_interp.html">grammar::peg::interp</a></td>
<td class="#tocright">Interpreter for parsing expression grammars</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/hook/hook.html">hook</a></td>
<td class="#tocright">Hooks</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/html/html.html">html</a></td>
<td class="#tocright">Procedures to generate HTML structures</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/htmlparse/htmlparse.html">htmlparse</a></td>
<td class="#tocright">Procedures to parse HTML strings</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/yaml/huddle.html">huddle</a></td>
<td class="#tocright">Create and manipulate huddle object</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/ident/ident.html">ident</a></td>
<td class="#tocright">Ident protocol client</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/imap4/imap4.html">imap4</a></td>
<td class="#tocright">imap client-side tcl implementation of imap protocol</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/inifile/ini.html">inifile</a></td>
<td class="#tocright">Parsing of Windows INI files</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/interp/tcllib_interp.html">interp</a></td>
<td class="#tocright">Interp creation and aliasing</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/irc/irc.html">irc</a></td>
<td class="#tocright">Create IRC connection and interface.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/javascript/javascript.html">javascript</a></td>
<td class="#tocright">Procedures to generate HTML and Java Script structures.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/jpeg/jpeg.html">jpeg</a></td>
<td class="#tocright">JPEG querying and manipulation of meta data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/json/json.html">json</a></td>
<td class="#tocright">JSON parser</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/json/json_write.html">json::write</a></td>
<td class="#tocright">JSON generation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/lambda/lambda.html">lambda</a></td>
<td class="#tocright">Utility commands for anonymous procedures</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/ldap/ldap.html">ldap</a></td>
<td class="#tocright">LDAP client</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/ldap/ldapx.html">ldapx</a></td>
<td class="#tocright">LDAP extended object interface</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/log/log.html">log</a></td>
<td class="#tocright">Procedures to log messages of libraries and applications.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/log/logger.html">logger</a></td>
<td class="#tocright">System to control logging of events.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/log/loggerAppender.html">logger::appender</a></td>
<td class="#tocright">Collection of predefined appenders for logger</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/log/loggerUtils.html">logger::utils</a></td>
<td class="#tocright">Utilities for logger</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/map/map_geocode_nominatim.html">map::geocode::nominatim</a></td>
<td class="#tocright">Resolving geographical names with a Nominatim service</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/map/map_slippy.html">map::slippy</a></td>
<td class="#tocright">Common code for slippy based map packages</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/map/map_slippy_cache.html">map::slippy::cache</a></td>
<td class="#tocright">Management of a tile cache in the local filesystem</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/map/map_slippy_fetcher.html">map::slippy::fetcher</a></td>
<td class="#tocright">Accessing a server providing tiles for slippy-based maps</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/mapproj/mapproj.html">mapproj</a></td>
<td class="#tocright">Map projection routines</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/math.html">math</a></td>
<td class="#tocright">Tcl Math Library</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/bigfloat.html">math::bigfloat</a></td>
<td class="#tocright">Arbitrary precision floating-point numbers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/bignum.html">math::bignum</a></td>
<td class="#tocright">Arbitrary precision integer numbers</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/calculus.html">math::calculus</a></td>
<td class="#tocright">Integration and ordinary differential equations</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/romberg.html">math::calculus::romberg</a></td>
<td class="#tocright">Romberg integration</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/symdiff.html">math::calculus::symdiff</a></td>
<td class="#tocright">Symbolic differentiation for Tcl</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/combinatorics.html">math::combinatorics</a></td>
<td class="#tocright">Combinatorial functions in the Tcl Math Library</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/qcomplex.html">math::complexnumbers</a></td>
<td class="#tocright">Straightforward complex number package</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/constants.html">math::constants</a></td>
<td class="#tocright">Mathematical and numerical constants</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/decimal.html">math::decimal</a></td>
<td class="#tocright">General decimal arithmetic</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/fourier.html">math::fourier</a></td>
<td class="#tocright">Discrete and fast fourier transforms</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/fuzzy.html">math::fuzzy</a></td>
<td class="#tocright">Fuzzy comparison of floating-point numbers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/math_geometry.html">math::geometry</a></td>
<td class="#tocright">Geometrical computations</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/interpolate.html">math::interpolate</a></td>
<td class="#tocright">Interpolation routines</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/linalg.html">math::linearalgebra</a></td>
<td class="#tocright">Linear Algebra</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/numtheory.html">math::numtheory</a></td>
<td class="#tocright">Number Theory</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/optimize.html">math::optimize</a></td>
<td class="#tocright">Optimisation routines</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/polynomials.html">math::polynomials</a></td>
<td class="#tocright">Polynomial functions</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/rational_funcs.html">math::rationalfunctions</a></td>
<td class="#tocright">Polynomial functions</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/roman.html">math::roman</a></td>
<td class="#tocright">Tools for creating and manipulating roman numerals</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/special.html">math::special</a></td>
<td class="#tocright">Special mathematical functions</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/math/statistics.html">math::statistics</a></td>
<td class="#tocright">Basic statistical functions and procedures</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/md4/md4.html">md4</a></td>
<td class="#tocright">MD4 Message-Digest Algorithm</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/md5/md5.html">md5</a></td>
<td class="#tocright">MD5 Message-Digest Algorithm</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/md5crypt/md5crypt.html">md5crypt</a></td>
<td class="#tocright">MD5-based password encryption</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/mime/mime.html">mime</a></td>
<td class="#tocright">Manipulation of MIME body parts</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/doctools/mpexpand.html">mpexpand</a></td>
<td class="#tocright">Markup processor</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/multiplexer/multiplexer.html">multiplexer</a></td>
<td class="#tocright">One-to-many communication with sockets.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/nns/nns_client.html">nameserv</a></td>
<td class="#tocright">Name service facility, Client</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/nns/nns_auto.html">nameserv::auto</a></td>
<td class="#tocright">Name service facility, Client Extension</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/nns/nns_common.html">nameserv::common</a></td>
<td class="#tocright">Name service facility, shared definitions</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/nns/nns_protocol.html">nameserv::protocol</a></td>
<td class="#tocright">Name service facility, client/server protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/nns/nns_server.html">nameserv::server</a></td>
<td class="#tocright">Name service facility, Server</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/namespacex/namespacex.html">namespacex</a></td>
<td class="#tocright">Namespace utility commands</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/ncgi/ncgi.html">ncgi</a></td>
<td class="#tocright">Procedures to manipulate CGI values.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/nmea/nmea.html">nmea</a></td>
<td class="#tocright">Process NMEA data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/apps/nns.html">nns</a></td>
<td class="#tocright">Name service facility, Commandline Client Application</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/nns/nns_intro.html">nns_intro</a></td>
<td class="#tocright">Name service facility, introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/apps/nnsd.html">nnsd</a></td>
<td class="#tocright">Name service facility, Commandline Server Application</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/apps/nnslog.html">nnslog</a></td>
<td class="#tocright">Name service facility, Commandline Logging Client Application</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/nntp/nntp.html">nntp</a></td>
<td class="#tocright">Tcl client for the NNTP protocol</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/ntp/ntp_time.html">ntp_time</a></td>
<td class="#tocright">Tcl Time Service Client</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/ooutil/ooutil.html">oo::util</a></td>
<td class="#tocright">Utility commands for TclOO</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/otp/otp.html">otp</a></td>
<td class="#tocright">One-Time Passwords</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/apps/page.html">page</a></td>
<td class="#tocright">Parser Generator</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/page/page_intro.html">page_intro</a></td>
<td class="#tocright">page introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/page/page_pluginmgr.html">page_pluginmgr</a></td>
<td class="#tocright">page plugin manager</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/page/page_util_flow.html">page_util_flow</a></td>
<td class="#tocright">page dataflow/treewalker utility</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/page/page_util_norm_lemon.html">page_util_norm_lemon</a></td>
<td class="#tocright">page AST normalization, LEMON</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/page/page_util_norm_peg.html">page_util_norm_peg</a></td>
<td class="#tocright">page AST normalization, PEG</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/page/page_util_peg.html">page_util_peg</a></td>
<td class="#tocright">page PEG transformation utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/page/page_util_quote.html">page_util_quote</a></td>
<td class="#tocright">page character quoting utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/irc/picoirc.html">picoirc</a></td>
<td class="#tocright">Small and simple embeddable IRC client.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pki/pki.html">pki</a></td>
<td class="#tocright">Implementation of the public key cipher</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pluginmgr/pluginmgr.html">pluginmgr</a></td>
<td class="#tocright">Manage a plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/png/png.html">png</a></td>
<td class="#tocright">PNG querying and manipulation of meta data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pop3/pop3.html">pop3</a></td>
<td class="#tocright">Tcl client for POP3 email protocol</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pop3d/pop3d.html">pop3d</a></td>
<td class="#tocright">Tcl POP3 server implementation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pop3d/pop3d_dbox.html">pop3d::dbox</a></td>
<td class="#tocright">Simple mailbox database for pop3d</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pop3d/pop3d_udb.html">pop3d::udb</a></td>
<td class="#tocright">Simple user database for pop3d</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/profiler/profiler.html">profiler</a></td>
<td class="#tocright">Tcl source code profiler</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt.html">pt</a></td>
<td class="#tocright">Parser Tools Application</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_astree.html">pt::ast</a></td>
<td class="#tocright">Abstract Syntax Tree Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_cparam_config_critcl.html">pt::cparam::configuration::critcl</a></td>
<td class="#tocright">C/PARAM, Canned configuration, Critcl</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_json_language.html">pt::json_language</a></td>
<td class="#tocright">The JSON Grammar Exchange Format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_param.html">pt::param</a></td>
<td class="#tocright">PackRat Machine Specification</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_pexpression.html">pt::pe</a></td>
<td class="#tocright">Parsing Expression Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_pexpr_op.html">pt::pe::op</a></td>
<td class="#tocright">Parsing Expression Utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_pegrammar.html">pt::peg</a></td>
<td class="#tocright">Parsing Expression Grammar Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_container.html">pt::peg::container</a></td>
<td class="#tocright">PEG Storage</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_container_peg.html">pt::peg::container::peg</a></td>
<td class="#tocright">PEG Storage. Canned PEG grammar specification</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_export.html">pt::peg::export</a></td>
<td class="#tocright">PEG Export</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_export_container.html">pt::peg::export::container</a></td>
<td class="#tocright">PEG Export Plugin. Write CONTAINER format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_export_json.html">pt::peg::export::json</a></td>
<td class="#tocright">PEG Export Plugin. Write JSON format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_export_peg.html">pt::peg::export::peg</a></td>
<td class="#tocright">PEG Export Plugin. Write PEG format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_from_container.html">pt::peg::from::container</a></td>
<td class="#tocright">PEG Conversion. From CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_from_json.html">pt::peg::from::json</a></td>
<td class="#tocright">PEG Conversion. Read JSON format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_from_peg.html">pt::peg::from::peg</a></td>
<td class="#tocright">PEG Conversion. Read PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_import.html">pt::peg::import</a></td>
<td class="#tocright">PEG Import</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_import_container.html">pt::peg::import::container</a></td>
<td class="#tocright">PEG Import Plugin. From CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_import_json.html">pt::peg::import::json</a></td>
<td class="#tocright">PEG Import Plugin. Read JSON format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_import_peg.html">pt::peg::import::peg</a></td>
<td class="#tocright">PEG Import Plugin. Read PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_interp.html">pt::peg::interp</a></td>
<td class="#tocright">Interpreter for parsing expression grammars</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_to_container.html">pt::peg::to::container</a></td>
<td class="#tocright">PEG Conversion. Write CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_to_cparam.html">pt::peg::to::cparam</a></td>
<td class="#tocright">PEG Conversion. Write CPARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_to_json.html">pt::peg::to::json</a></td>
<td class="#tocright">PEG Conversion. Write JSON format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_to_param.html">pt::peg::to::param</a></td>
<td class="#tocright">PEG Conversion. Write PARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_to_peg.html">pt::peg::to::peg</a></td>
<td class="#tocright">PEG Conversion. Write PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></td>
<td class="#tocright">PEG Conversion. Write TCLPARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_language.html">pt::peg_language</a></td>
<td class="#tocright">PEG Language Tutorial</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_peg_introduction.html">pt::pegrammar</a></td>
<td class="#tocright">Introduction to Parsing Expression Grammars</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_pgen.html">pt::pgen</a></td>
<td class="#tocright">Parser Generator</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_rdengine.html">pt::rde</a></td>
<td class="#tocright">Parsing Runtime Support, PARAM based</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_tclparam_config_snit.html">pt::tclparam::configuration::snit</a></td>
<td class="#tocright">Tcl/PARAM, Canned configuration, Snit</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_tclparam_config_tcloo.html">pt::tclparam::configuration::tcloo</a></td>
<td class="#tocright">Tcl/PARAM, Canned configuration, Tcloo</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_to_api.html">pt_export_api</a></td>
<td class="#tocright">Parser Tools Export API</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_from_api.html">pt_import_api</a></td>
<td class="#tocright">Parser Tools Import API</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/pt/pt_introduction.html">pt_introduction</a></td>
<td class="#tocright">Introduction to Parser Tools</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/pt/pt_parser_api.html">pt_parser_api</a></td>
<td class="#tocright">Parser API</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/rc4/rc4.html">rc4</a></td>
<td class="#tocright">Implementation of the RC4 stream cipher</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/rcs/rcs.html">rcs</a></td>
<td class="#tocright">RCS low level utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/report/report.html">report</a></td>
<td class="#tocright">Create and manipulate report objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/rest/rest.html">rest</a></td>
<td class="#tocright">define REST web APIs and call them inline or asychronously</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/ripemd/ripemd128.html">ripemd128</a></td>
<td class="#tocright">RIPEMD-128 Message-Digest Algorithm</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/ripemd/ripemd160.html">ripemd160</a></td>
<td class="#tocright">RIPEMD-160 Message-Digest Algorithm</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/amazon-s3/S3.html">S3</a></td>
<td class="#tocright">Amazon S3 Web Service Interface</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/sasl/sasl.html">SASL</a></td>
<td class="#tocright">Implementation of SASL mechanisms for Tcl</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/sha1/sha1.html">sha1</a></td>
<td class="#tocright">SHA1 Message-Digest Algorithm</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/sha1/sha256.html">sha256</a></td>
<td class="#tocright">SHA256 Message-Digest Algorithm</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/simulation/annealing.html">simulation::annealing</a></td>
<td class="#tocright">Simulated annealing</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/simulation/montecarlo.html">simulation::montecarlo</a></td>
<td class="#tocright">Monte Carlo simulations</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/simulation/simulation_random.html">simulation::random</a></td>
<td class="#tocright">Pseudo-random number generators</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/mime/smtp.html">smtp</a></td>
<td class="#tocright">Client-side tcl implementation of the smtp protocol</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/smtpd/smtpd.html">smtpd</a></td>
<td class="#tocright">Tcl SMTP server implementation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/snit/snit.html">snit</a></td>
<td class="#tocright">Snit's Not Incr Tcl</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/snit/snitfaq.html">snitfaq</a></td>
<td class="#tocright">Snit Frequently Asked Questions</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/soundex/soundex.html">soundex</a></td>
<td class="#tocright">Soundex</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/stooop/stooop.html">stooop</a></td>
<td class="#tocright">Object oriented extension.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/stringprep/stringprep.html">stringprep</a></td>
<td class="#tocright">Implementation of stringprep</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/stringprep/stringprep_data.html">stringprep::data</a></td>
<td class="#tocright">stringprep data tables, generated, internal</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/struct/disjointset.html">struct::disjointset</a></td>
<td class="#tocright">Disjoint set data structure</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/struct/graph.html">struct::graph</a></td>
<td class="#tocright">Create and manipulate directed graph objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/struct/graphops.html">struct::graph::op</a></td>
<td class="#tocright">Operation for (un)directed graph objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/struct/graph1.html">struct::graph_v1</a></td>
<td class="#tocright">Create and manipulate directed graph objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/struct/struct_list.html">struct::list</a></td>
<td class="#tocright">Procedures for manipulating lists</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/struct/matrix.html">struct::matrix</a></td>
<td class="#tocright">Create and manipulate matrix objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/struct/matrix1.html">struct::matrix_v1</a></td>
<td class="#tocright">Create and manipulate matrix objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/struct/pool.html">struct::pool</a></td>
<td class="#tocright">Create and manipulate pool objects (of discrete items)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/struct/prioqueue.html">struct::prioqueue</a></td>
<td class="#tocright">Create and manipulate prioqueue objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/struct/queue.html">struct::queue</a></td>
<td class="#tocright">Create and manipulate queue objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/struct/record.html">struct::record</a></td>
<td class="#tocright">Define and create records (similar to 'C' structures)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/struct/struct_set.html">struct::set</a></td>
<td class="#tocright">Procedures for manipulating sets</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/struct/skiplist.html">struct::skiplist</a></td>
<td class="#tocright">Create and manipulate skiplists</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/struct/stack.html">struct::stack</a></td>
<td class="#tocright">Create and manipulate stack objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/struct/struct_tree.html">struct::tree</a></td>
<td class="#tocright">Create and manipulate tree objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/struct/struct_tree1.html">struct::tree_v1</a></td>
<td class="#tocright">Create and manipulate tree objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/crc/sum.html">sum</a></td>
<td class="#tocright">Calculate a sum(1) compatible checksum</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/tar/tar.html">tar</a></td>
<td class="#tocright">Tar file creation, extraction &amp; manipulation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/cat.html">tcl::chan::cat</a></td>
<td class="#tocright">Concatenation channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_core/core.html">tcl::chan::core</a></td>
<td class="#tocright">Basic reflected/virtual channel support</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_core/events.html">tcl::chan::events</a></td>
<td class="#tocright">Event support for reflected/virtual channels</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/facade.html">tcl::chan::facade</a></td>
<td class="#tocright">Facade channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/fifo.html">tcl::chan::fifo</a></td>
<td class="#tocright">In-memory fifo channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/fifo2.html">tcl::chan::fifo2</a></td>
<td class="#tocright">In-memory interconnected fifo channels</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/halfpipe.html">tcl::chan::halfpipe</a></td>
<td class="#tocright">In-memory channel, half of a fifo2</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/memchan.html">tcl::chan::memchan</a></td>
<td class="#tocright">In-memory channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/null.html">tcl::chan::null</a></td>
<td class="#tocright">Null channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/nullzero.html">tcl::chan::nullzero</a></td>
<td class="#tocright">Null/Zero channel combination</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/random.html">tcl::chan::random</a></td>
<td class="#tocright">Random channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/randseed.html">tcl::chan::randseed</a></td>
<td class="#tocright">Utilities for random channels</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/std.html">tcl::chan::std</a></td>
<td class="#tocright">Standard I/O, unification of stdin and stdout</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/string.html">tcl::chan::string</a></td>
<td class="#tocright">Read-only in-memory channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/textwindow.html">tcl::chan::textwindow</a></td>
<td class="#tocright">Textwindow channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/variable.html">tcl::chan::variable</a></td>
<td class="#tocright">In-memory channel using variable for storage</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_base/zero.html">tcl::chan::zero</a></td>
<td class="#tocright">Zero channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/adler32.html">tcl::transform::adler32</a></td>
<td class="#tocright">Adler32 transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/base64.html">tcl::transform::base64</a></td>
<td class="#tocright">Base64 encoding transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_core/transformcore.html">tcl::transform::core</a></td>
<td class="#tocright">Basic reflected/virtual channel transform support</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/counter.html">tcl::transform::counter</a></td>
<td class="#tocright">Counter transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/crc32.html">tcl::transform::crc32</a></td>
<td class="#tocright">Crc32 transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/hex.html">tcl::transform::hex</a></td>
<td class="#tocright">Hexadecimal encoding transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/identity.html">tcl::transform::identity</a></td>
<td class="#tocright">Identity transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/limitsize.html">tcl::transform::limitsize</a></td>
<td class="#tocright">limiting input</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/observe.html">tcl::transform::observe</a></td>
<td class="#tocright">Observer transformation, stream copy</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/otp.html">tcl::transform::otp</a></td>
<td class="#tocright">Encryption via one-time pad</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/rot.html">tcl::transform::rot</a></td>
<td class="#tocright">rot-encryption</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/spacer.html">tcl::transform::spacer</a></td>
<td class="#tocright">Space insertation and removal</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/virtchannel_transform/zlib.html">tcl::transform::zlib</a></td>
<td class="#tocright">zlib (de)compression</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/apps/tcldocstrip.html">tcldocstrip</a></td>
<td class="#tocright">Tcl-based Docstrip Processor</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/dns/tcllib_ip.html">tcllib_ip</a></td>
<td class="#tocright">IPv4 and IPv6 address manipulation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/math/machineparameters.html">tclrep/machineparameters</a></td>
<td class="#tocright">Compute double precision machine parameters.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/tepam/tepam_introduction.html">tepam</a></td>
<td class="#tocright">An introduction into TEPAM, Tcl's Enhanced Procedure and Argument Manager</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/tepam/tepam_argument_dialogbox.html">tepam::argument_dialogbox</a></td>
<td class="#tocright">TEPAM argument_dialogbox, reference manual</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/tepam/tepam_procedure.html">tepam::procedure</a></td>
<td class="#tocright">TEPAM procedure, reference manual</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/term/term.html">term</a></td>
<td class="#tocright">General terminal control</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/term/ansi_code.html">term::ansi::code</a></td>
<td class="#tocright">Helper for control sequences</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/term/ansi_cattr.html">term::ansi::code::attr</a></td>
<td class="#tocright">ANSI attribute sequences</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/term/ansi_cctrl.html">term::ansi::code::ctrl</a></td>
<td class="#tocright">ANSI control sequences</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/term/ansi_cmacros.html">term::ansi::code::macros</a></td>
<td class="#tocright">Macro sequences</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/term/ansi_ctrlu.html">term::ansi::ctrl::unix</a></td>
<td class="#tocright">Control operations and queries</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/term/ansi_send.html">term::ansi::send</a></td>
<td class="#tocright">Output of ANSI control sequences to terminals</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/term/imenu.html">term::interact::menu</a></td>
<td class="#tocright">Terminal widget, menu</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/term/ipager.html">term::interact::pager</a></td>
<td class="#tocright">Terminal widget, paging</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/term/receive.html">term::receive</a></td>
<td class="#tocright">General input from terminals</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/term/term_bind.html">term::receive::bind</a></td>
<td class="#tocright">Keyboard dispatch from terminals</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/term/term_send.html">term::send</a></td>
<td class="#tocright">General output to terminals</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/textutil/textutil.html">textutil</a></td>
<td class="#tocright">Procedures to manipulate texts and strings.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/textutil/adjust.html">textutil::adjust</a></td>
<td class="#tocright">Procedures to adjust, indent, and undent paragraphs</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/textutil/expander.html">textutil::expander</a></td>
<td class="#tocright">Procedures to process templates and expand text.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/textutil/repeat.html">textutil::repeat</a></td>
<td class="#tocright">Procedures to repeat strings.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/textutil/textutil_split.html">textutil::split</a></td>
<td class="#tocright">Procedures to split texts</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/textutil/textutil_string.html">textutil::string</a></td>
<td class="#tocright">Procedures to manipulate texts and strings.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/textutil/tabify.html">textutil::tabify</a></td>
<td class="#tocright">Procedures to (un)tabify strings</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/textutil/trim.html">textutil::trim</a></td>
<td class="#tocright">Procedures to trim strings</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/tie/tie_std.html">tie</a></td>
<td class="#tocright">Array persistence, standard data sources</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/tie/tie.html">tie</a></td>
<td class="#tocright">Array persistence</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/tiff/tiff.html">tiff</a></td>
<td class="#tocright">TIFF reading, writing, and querying and manipulation of meta data</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/transfer/connect.html">transfer::connect</a></td>
<td class="#tocright">Connection setup</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/transfer/copyops.html">transfer::copy</a></td>
<td class="#tocright">Data transfer foundation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/transfer/tqueue.html">transfer::copy::queue</a></td>
<td class="#tocright">Queued transfers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/transfer/ddest.html">transfer::data::destination</a></td>
<td class="#tocright">Data destination</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/transfer/dsource.html">transfer::data::source</a></td>
<td class="#tocright">Data source</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/transfer/receiver.html">transfer::receiver</a></td>
<td class="#tocright">Data source</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/transfer/transmitter.html">transfer::transmitter</a></td>
<td class="#tocright">Data source</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/treeql/treeql.html">treeql</a></td>
<td class="#tocright">Query tree objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/try/tcllib_try.html">try</a></td>
<td class="#tocright">try - Trap and process errors and exceptions</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/uev/uevent.html">uevent</a></td>
<td class="#tocright">User events</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/uev/uevent_onidle.html">uevent::onidle</a></td>
<td class="#tocright">Request merging and deferal to idle time</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/stringprep/unicode.html">unicode</a></td>
<td class="#tocright">Implementation of Unicode normalization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/stringprep/unicode_data.html">unicode::data</a></td>
<td class="#tocright">unicode data tables, generated, internal</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/units/units.html">units</a></td>
<td class="#tocright">unit conversion</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/uri/uri.html">uri</a></td>
<td class="#tocright">URI utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/uri/urn-scheme.html">uri_urn</a></td>
<td class="#tocright">URI utilities, URN scheme</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/base64/uuencode.html">uuencode</a></td>
<td class="#tocright">UU-encode/decode binary data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/uuid/uuid.html">uuid</a></td>
<td class="#tocright">UUID generation and comparison</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/wip/wip.html">wip</a></td>
<td class="#tocright">Word Interpreter</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/amazon-s3/xsxp.html">xsxp</a></td>
<td class="#tocright">eXtremely Simple Xml Parser</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="files/modules/yaml/yaml.html">yaml</a></td>
<td class="#tocright">YAML Format Encoder/Decoder</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="files/modules/base64/yencode.html">yencode</a></td>
<td class="#tocright">Y-encode/decode binary data</td>
</tr>
</table>
</dl><hr></body></html>

Added embedded/www/toc.html.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<html><head>
<title> Table Of Contents </title>
</head>
<! -- Generated by tcllib/doctools/toc with format 'html'
   -->
<! -- CVS: $Id$ Table Of Contents
   -->
<body>
<hr> [
  <a href="index.html">Keyword Index</a>
| <a href="/tcllib">Home</a>
] <hr>
<h3> Table Of Contents </h3>
<hr><dl><dt><h2>  </h2><dd>
<dl><dt>By Categories<dd>
<dl><dt>Argument entry form, mega widget<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tepam/tepam_argument_dialogbox.html">tepam::argument_dialogbox</a></td>
<td class="#tocright">TEPAM argument_dialogbox, reference manual</td>
</tr>
</table></dl>
<dl><dt>Benchmark tools<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench.html">bench</a></td>
<td class="#tocright">bench - Processing benchmark suites</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_read.html">bench::in</a></td>
<td class="#tocright">bench::in - Reading benchmark results</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_wcsv.html">bench::out::csv</a></td>
<td class="#tocright">bench::out::csv - Formatting benchmark results as CSV</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_wtext.html">bench::out::text</a></td>
<td class="#tocright">bench::out::text - Formatting benchmark results as human readable text</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_intro.html">bench_intro</a></td>
<td class="#tocright">bench introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_lang_intro.html">bench_lang_intro</a></td>
<td class="#tocright">bench language introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_lang_spec.html">bench_lang_spec</a></td>
<td class="#tocright">bench language specification</td>
</tr>
</table></dl>
<dl><dt>CGI programming<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/html/html.html">html</a></td>
<td class="#tocright">Procedures to generate HTML structures</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/javascript/javascript.html">javascript</a></td>
<td class="#tocright">Procedures to generate HTML and Java Script structures.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/json/json.html">json</a></td>
<td class="#tocright">JSON parser</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/json/json_write.html">json::write</a></td>
<td class="#tocright">JSON generation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ncgi/ncgi.html">ncgi</a></td>
<td class="#tocright">Procedures to manipulate CGI values.</td>
</tr>
</table></dl>
<dl><dt>Channels<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/cat.html">tcl::chan::cat</a></td>
<td class="#tocright">Concatenation channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_core/core.html">tcl::chan::core</a></td>
<td class="#tocright">Basic reflected/virtual channel support</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_core/events.html">tcl::chan::events</a></td>
<td class="#tocright">Event support for reflected/virtual channels</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/facade.html">tcl::chan::facade</a></td>
<td class="#tocright">Facade channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/fifo.html">tcl::chan::fifo</a></td>
<td class="#tocright">In-memory fifo channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/fifo2.html">tcl::chan::fifo2</a></td>
<td class="#tocright">In-memory interconnected fifo channels</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/halfpipe.html">tcl::chan::halfpipe</a></td>
<td class="#tocright">In-memory channel, half of a fifo2</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/memchan.html">tcl::chan::memchan</a></td>
<td class="#tocright">In-memory channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/null.html">tcl::chan::null</a></td>
<td class="#tocright">Null channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/nullzero.html">tcl::chan::nullzero</a></td>
<td class="#tocright">Null/Zero channel combination</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/random.html">tcl::chan::random</a></td>
<td class="#tocright">Random channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/randseed.html">tcl::chan::randseed</a></td>
<td class="#tocright">Utilities for random channels</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/std.html">tcl::chan::std</a></td>
<td class="#tocright">Standard I/O, unification of stdin and stdout</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/string.html">tcl::chan::string</a></td>
<td class="#tocright">Read-only in-memory channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/textwindow.html">tcl::chan::textwindow</a></td>
<td class="#tocright">Textwindow channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/variable.html">tcl::chan::variable</a></td>
<td class="#tocright">In-memory channel using variable for storage</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/zero.html">tcl::chan::zero</a></td>
<td class="#tocright">Zero channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/adler32.html">tcl::transform::adler32</a></td>
<td class="#tocright">Adler32 transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/base64.html">tcl::transform::base64</a></td>
<td class="#tocright">Base64 encoding transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_core/transformcore.html">tcl::transform::core</a></td>
<td class="#tocright">Basic reflected/virtual channel transform support</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/counter.html">tcl::transform::counter</a></td>
<td class="#tocright">Counter transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/crc32.html">tcl::transform::crc32</a></td>
<td class="#tocright">Crc32 transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/hex.html">tcl::transform::hex</a></td>
<td class="#tocright">Hexadecimal encoding transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/identity.html">tcl::transform::identity</a></td>
<td class="#tocright">Identity transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/limitsize.html">tcl::transform::limitsize</a></td>
<td class="#tocright">limiting input</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/observe.html">tcl::transform::observe</a></td>
<td class="#tocright">Observer transformation, stream copy</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/otp.html">tcl::transform::otp</a></td>
<td class="#tocright">Encryption via one-time pad</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/rot.html">tcl::transform::rot</a></td>
<td class="#tocright">rot-encryption</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/spacer.html">tcl::transform::spacer</a></td>
<td class="#tocright">Space insertation and removal</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/zlib.html">tcl::transform::zlib</a></td>
<td class="#tocright">zlib (de)compression</td>
</tr>
</table></dl>
<dl><dt>Coroutine<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/coroutine/coroutine.html">coroutine</a></td>
<td class="#tocright">Coroutine based event and IO handling</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/coroutine/coro_auto.html">coroutine::auto</a></td>
<td class="#tocright">Automatic event and IO coroutine awareness</td>
</tr>
</table></dl>
<dl><dt>Data structures<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/counter/counter.html">counter</a></td>
<td class="#tocright">Procedures for counters and histograms</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/report/report.html">report</a></td>
<td class="#tocright">Create and manipulate report objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/disjointset.html">struct::disjointset</a></td>
<td class="#tocright">Disjoint set data structure</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/graph.html">struct::graph</a></td>
<td class="#tocright">Create and manipulate directed graph objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/graphops.html">struct::graph::op</a></td>
<td class="#tocright">Operation for (un)directed graph objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/graph1.html">struct::graph_v1</a></td>
<td class="#tocright">Create and manipulate directed graph objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/struct_list.html">struct::list</a></td>
<td class="#tocright">Procedures for manipulating lists</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/matrix.html">struct::matrix</a></td>
<td class="#tocright">Create and manipulate matrix objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/matrix1.html">struct::matrix_v1</a></td>
<td class="#tocright">Create and manipulate matrix objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/pool.html">struct::pool</a></td>
<td class="#tocright">Create and manipulate pool objects (of discrete items)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/prioqueue.html">struct::prioqueue</a></td>
<td class="#tocright">Create and manipulate prioqueue objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/queue.html">struct::queue</a></td>
<td class="#tocright">Create and manipulate queue objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/record.html">struct::record</a></td>
<td class="#tocright">Define and create records (similar to 'C' structures)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/struct_set.html">struct::set</a></td>
<td class="#tocright">Procedures for manipulating sets</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/skiplist.html">struct::skiplist</a></td>
<td class="#tocright">Create and manipulate skiplists</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/stack.html">struct::stack</a></td>
<td class="#tocright">Create and manipulate stack objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/struct_tree.html">struct::tree</a></td>
<td class="#tocright">Create and manipulate tree objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/struct_tree1.html">struct::tree_v1</a></td>
<td class="#tocright">Create and manipulate tree objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/treeql/treeql.html">treeql</a></td>
<td class="#tocright">Query tree objects</td>
</tr>
</table></dl>
<dl><dt>Documentation tools<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_intro.html">docidx_intro</a></td>
<td class="#tocright">docidx introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_lang_cmdref.html">docidx_lang_cmdref</a></td>
<td class="#tocright">docidx language command reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_lang_faq.html">docidx_lang_faq</a></td>
<td class="#tocright">docidx language faq</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_lang_intro.html">docidx_lang_intro</a></td>
<td class="#tocright">docidx language introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_lang_syntax.html">docidx_lang_syntax</a></td>
<td class="#tocright">docidx language syntax</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html">docidx_plugin_apiref</a></td>
<td class="#tocright">docidx plugin API reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/docstrip/docstrip.html">docstrip</a></td>
<td class="#tocright">Docstrip style source code extraction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/docstrip/docstrip_util.html">docstrip_util</a></td>
<td class="#tocright">Docstrip-related utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_intro.html">doctoc_intro</a></td>
<td class="#tocright">doctoc introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_lang_cmdref.html">doctoc_lang_cmdref</a></td>
<td class="#tocright">doctoc language command reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_lang_faq.html">doctoc_lang_faq</a></td>
<td class="#tocright">doctoc language faq</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_lang_intro.html">doctoc_lang_intro</a></td>
<td class="#tocright">doctoc language introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_lang_syntax.html">doctoc_lang_syntax</a></td>
<td class="#tocright">doctoc language syntax</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html">doctoc_plugin_apiref</a></td>
<td class="#tocright">doctoc plugin API reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools.html">doctools</a></td>
<td class="#tocright">doctools - Processing documents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/introduction.html">doctools2idx_introduction</a></td>
<td class="#tocright">DocTools - Keyword indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/introduction.html">doctools2toc_introduction</a></td>
<td class="#tocright">DocTools - Tables of Contents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/changelog.html">doctools::changelog</a></td>
<td class="#tocright">Processing text in Emacs ChangeLog format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/cvs.html">doctools::cvs</a></td>
<td class="#tocright">Processing text in 'cvs log' format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2base/html_cssdefaults.html">doctools::html::cssdefaults</a></td>
<td class="#tocright">Default CSS style for HTML export plugins</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/container.html">doctools::idx</a></td>
<td class="#tocright">Holding keyword indices</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx.html">doctools::idx</a></td>
<td class="#tocright">docidx - Processing indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export.html">doctools::idx::export</a></td>
<td class="#tocright">Exporting keyword indices</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/import.html">doctools::idx::import</a></td>
<td class="#tocright">Importing keyword indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/parse.html">doctools::idx::parse</a></td>
<td class="#tocright">Parsing text in docidx format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/structure.html">doctools::idx::structure</a></td>
<td class="#tocright">Docidx serialization utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html">doctools::msgcat</a></td>
<td class="#tocright">Message catalog management for the various document parsers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/msgcat_c.html">doctools::msgcat::idx::c</a></td>
<td class="#tocright">Message catalog for the docidx parser (C)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/msgcat_de.html">doctools::msgcat::idx::de</a></td>
<td class="#tocright">Message catalog for the docidx parser (DE)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/msgcat_en.html">doctools::msgcat::idx::en</a></td>
<td class="#tocright">Message catalog for the docidx parser (EN)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/msgcat_fr.html">doctools::msgcat::idx::fr</a></td>
<td class="#tocright">Message catalog for the docidx parser (FR)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/msgcat_c.html">doctools::msgcat::toc::c</a></td>
<td class="#tocright">Message catalog for the doctoc parser (C)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/msgcat_de.html">doctools::msgcat::toc::de</a></td>
<td class="#tocright">Message catalog for the doctoc parser (DE)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/msgcat_en.html">doctools::msgcat::toc::en</a></td>
<td class="#tocright">Message catalog for the doctoc parser (EN)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/msgcat_fr.html">doctools::msgcat::toc::fr</a></td>
<td class="#tocright">Message catalog for the doctoc parser (FR)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2base/nroff_manmacros.html">doctools::nroff::man_macros</a></td>
<td class="#tocright">Default CSS style for NROFF export plugins</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2base/tcl_parse.html">doctools::tcl::parse</a></td>
<td class="#tocright">Processing text in 'subst -novariables' format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/container.html">doctools::toc</a></td>
<td class="#tocright">Holding tables of contents</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc.html">doctools::toc</a></td>
<td class="#tocright">doctoc - Processing tables of contents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export.html">doctools::toc::export</a></td>
<td class="#tocright">Exporting tables of contents</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/import.html">doctools::toc::import</a></td>
<td class="#tocright">Importing keyword indices</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/parse.html">doctools::toc::parse</a></td>
<td class="#tocright">Parsing text in doctoc format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/structure.html">doctools::toc::structure</a></td>
<td class="#tocright">Doctoc serialization utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_intro.html">doctools_intro</a></td>
<td class="#tocright">doctools introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_lang_cmdref.html">doctools_lang_cmdref</a></td>
<td class="#tocright">doctools language command reference</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_lang_faq.html">doctools_lang_faq</a></td>
<td class="#tocright">doctools language faq</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_lang_intro.html">doctools_lang_intro</a></td>
<td class="#tocright">doctools language introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_lang_syntax.html">doctools_lang_syntax</a></td>
<td class="#tocright">doctools language syntax</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_plugin_apiref.html">doctools_plugin_apiref</a></td>
<td class="#tocright">doctools plugin API reference</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="apps/dtplite.html">dtplite</a></td>
<td class="#tocright">Lightweight DocTools Markup Processor</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/mpexpand.html">mpexpand</a></td>
<td class="#tocright">Markup processor</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="apps/tcldocstrip.html">tcldocstrip</a></td>
<td class="#tocright">Tcl-based Docstrip Processor</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/expander.html">textutil::expander</a></td>
<td class="#tocright">Procedures to process templates and expand text.</td>
</tr>
</table></dl>
<dl><dt>File formats<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/exif/exif.html">exif</a></td>
<td class="#tocright">Tcl EXIF extracts and parses EXIF fields from digital images</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/gpx/gpx.html">gpx</a></td>
<td class="#tocright">Extracts waypoints, tracks and routes from GPX files</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/jpeg/jpeg.html">jpeg</a></td>
<td class="#tocright">JPEG querying and manipulation of meta data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/png/png.html">png</a></td>
<td class="#tocright">PNG querying and manipulation of meta data</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tar/tar.html">tar</a></td>
<td class="#tocright">Tar file creation, extraction &amp; manipulation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/tiff/tiff.html">tiff</a></td>
<td class="#tocright">TIFF reading, writing, and querying and manipulation of meta data</td>
</tr>
</table></dl>
<dl><dt>Grammars and finite automata<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_aycock/aycock.html">grammar::aycock</a></td>
<td class="#tocright">Aycock-Horspool-Earley parser generator for Tcl</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_fa/fa.html">grammar::fa</a></td>
<td class="#tocright">Create and manipulate finite automatons</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_fa/dacceptor.html">grammar::fa::dacceptor</a></td>
<td class="#tocright">Create and use deterministic acceptors</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_fa/dexec.html">grammar::fa::dexec</a></td>
<td class="#tocright">Execute deterministic finite automatons</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_fa/faop.html">grammar::fa::op</a></td>
<td class="#tocright">Operations on finite automatons</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_cpu.html">grammar::me::cpu</a></td>
<td class="#tocright">Virtual machine implementation II for parsing token streams</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_cpucore.html">grammar::me::cpu::core</a></td>
<td class="#tocright">ME virtual machine state manipulation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/gasm.html">grammar::me::cpu::gasm</a></td>
<td class="#tocright">ME assembler</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_tcl.html">grammar::me::tcl</a></td>
<td class="#tocright">Virtual machine implementation I for parsing token streams</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_util.html">grammar::me::util</a></td>
<td class="#tocright">AST utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_ast.html">grammar::me_ast</a></td>
<td class="#tocright">Various representations of ASTs</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_intro.html">grammar::me_intro</a></td>
<td class="#tocright">Introduction to virtual machines for parsing token streams</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_vm.html">grammar::me_vm</a></td>
<td class="#tocright">Virtual machine for parsing token streams</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_peg/peg.html">grammar::peg</a></td>
<td class="#tocright">Create and manipulate parsing expression grammars</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_peg/peg_interp.html">grammar::peg::interp</a></td>
<td class="#tocright">Interpreter for parsing expression grammars</td>
</tr>
</table></dl>
<dl><dt>Hashes, checksums, and encryption<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/aes/aes.html">aes</a></td>
<td class="#tocright">Implementation of the AES block cipher</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/blowfish/blowfish.html">blowfish</a></td>
<td class="#tocright">Implementation of the Blowfish block cipher</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/crc/cksum.html">cksum</a></td>
<td class="#tocright">Calculate a cksum(1) compatible checksum</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/crc/crc16.html">crc16</a></td>
<td class="#tocright">Perform a 16bit Cyclic Redundancy Check</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/crc/crc32.html">crc32</a></td>
<td class="#tocright">Perform a 32bit Cyclic Redundancy Check</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/des/des.html">des</a></td>
<td class="#tocright">Implementation of the DES and triple-DES ciphers</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/md4/md4.html">md4</a></td>
<td class="#tocright">MD4 Message-Digest Algorithm</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/md5/md5.html">md5</a></td>
<td class="#tocright">MD5 Message-Digest Algorithm</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/md5crypt/md5crypt.html">md5crypt</a></td>
<td class="#tocright">MD5-based password encryption</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/otp/otp.html">otp</a></td>
<td class="#tocright">One-Time Passwords</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pki/pki.html">pki</a></td>
<td class="#tocright">Implementation of the public key cipher</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/rc4/rc4.html">rc4</a></td>
<td class="#tocright">Implementation of the RC4 stream cipher</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ripemd/ripemd128.html">ripemd128</a></td>
<td class="#tocright">RIPEMD-128 Message-Digest Algorithm</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/ripemd/ripemd160.html">ripemd160</a></td>
<td class="#tocright">RIPEMD-160 Message-Digest Algorithm</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/sha1/sha1.html">sha1</a></td>
<td class="#tocright">SHA1 Message-Digest Algorithm</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/sha1/sha256.html">sha256</a></td>
<td class="#tocright">SHA256 Message-Digest Algorithm</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/soundex/soundex.html">soundex</a></td>
<td class="#tocright">Soundex</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/crc/sum.html">sum</a></td>
<td class="#tocright">Calculate a sum(1) compatible checksum</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/uuid/uuid.html">uuid</a></td>
<td class="#tocright">UUID generation and comparison</td>
</tr>
</table></dl>
<dl><dt>Mathematics<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/math.html">math</a></td>
<td class="#tocright">Tcl Math Library</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/bigfloat.html">math::bigfloat</a></td>
<td class="#tocright">Arbitrary precision floating-point numbers</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/bignum.html">math::bignum</a></td>
<td class="#tocright">Arbitrary precision integer numbers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/calculus.html">math::calculus</a></td>
<td class="#tocright">Integration and ordinary differential equations</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/romberg.html">math::calculus::romberg</a></td>
<td class="#tocright">Romberg integration</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/combinatorics.html">math::combinatorics</a></td>
<td class="#tocright">Combinatorial functions in the Tcl Math Library</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/qcomplex.html">math::complexnumbers</a></td>
<td class="#tocright">Straightforward complex number package</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/constants.html">math::constants</a></td>
<td class="#tocright">Mathematical and numerical constants</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/decimal.html">math::decimal</a></td>
<td class="#tocright">General decimal arithmetic</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/fourier.html">math::fourier</a></td>
<td class="#tocright">Discrete and fast fourier transforms</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/fuzzy.html">math::fuzzy</a></td>
<td class="#tocright">Fuzzy comparison of floating-point numbers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/math_geometry.html">math::geometry</a></td>
<td class="#tocright">Geometrical computations</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/interpolate.html">math::interpolate</a></td>
<td class="#tocright">Interpolation routines</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/linalg.html">math::linearalgebra</a></td>
<td class="#tocright">Linear Algebra</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/numtheory.html">math::numtheory</a></td>
<td class="#tocright">Number Theory</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/optimize.html">math::optimize</a></td>
<td class="#tocright">Optimisation routines</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/polynomials.html">math::polynomials</a></td>
<td class="#tocright">Polynomial functions</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/rational_funcs.html">math::rationalfunctions</a></td>
<td class="#tocright">Polynomial functions</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/roman.html">math::roman</a></td>
<td class="#tocright">Tools for creating and manipulating roman numerals</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/special.html">math::special</a></td>
<td class="#tocright">Special mathematical functions</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/statistics.html">math::statistics</a></td>
<td class="#tocright">Basic statistical functions and procedures</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/simulation/annealing.html">simulation::annealing</a></td>
<td class="#tocright">Simulated annealing</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/simulation/montecarlo.html">simulation::montecarlo</a></td>
<td class="#tocright">Monte Carlo simulations</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/simulation/simulation_random.html">simulation::random</a></td>
<td class="#tocright">Pseudo-random number generators</td>
</tr>
</table></dl>
<dl><dt>Networking<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/asn/asn.html">asn</a></td>
<td class="#tocright">ASN.1 BER encoder/decoder</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/http/autoproxy.html">autoproxy</a></td>
<td class="#tocright">Automatic HTTP proxy usage and authentication</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bee/bee.html">bee</a></td>
<td class="#tocright">BitTorrent Serialization Format Encoder/Decoder</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/dns/tcllib_dns.html">dns</a></td>
<td class="#tocright">Tcl Domain Name Service Client</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ftp/ftp.html">ftp</a></td>
<td class="#tocright">Client-side tcl implementation of the ftp protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/ftp/ftp_geturl.html">ftp::geturl</a></td>
<td class="#tocright">Uri handler for ftp urls</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ftpd/ftpd.html">ftpd</a></td>
<td class="#tocright">Tcl FTP server implementation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/ident/ident.html">ident</a></td>
<td class="#tocright">Ident protocol client</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/irc/irc.html">irc</a></td>
<td class="#tocright">Create IRC connection and interface.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/ldap/ldap.html">ldap</a></td>
<td class="#tocright">LDAP client</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ldap/ldapx.html">ldapx</a></td>
<td class="#tocright">LDAP extended object interface</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_client.html">nameserv</a></td>
<td class="#tocright">Name service facility, Client</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_auto.html">nameserv::auto</a></td>
<td class="#tocright">Name service facility, Client Extension</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_common.html">nameserv::common</a></td>
<td class="#tocright">Name service facility, shared definitions</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_protocol.html">nameserv::protocol</a></td>
<td class="#tocright">Name service facility, client/server protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_server.html">nameserv::server</a></td>
<td class="#tocright">Name service facility, Server</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nmea/nmea.html">nmea</a></td>
<td class="#tocright">Process NMEA data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="apps/nns.html">nns</a></td>
<td class="#tocright">Name service facility, Commandline Client Application</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_intro.html">nns_intro</a></td>
<td class="#tocright">Name service facility, introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="apps/nnsd.html">nnsd</a></td>
<td class="#tocright">Name service facility, Commandline Server Application</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="apps/nnslog.html">nnslog</a></td>
<td class="#tocright">Name service facility, Commandline Logging Client Application</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/nntp/nntp.html">nntp</a></td>
<td class="#tocright">Tcl client for the NNTP protocol</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ntp/ntp_time.html">ntp_time</a></td>
<td class="#tocright">Tcl Time Service Client</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/irc/picoirc.html">picoirc</a></td>
<td class="#tocright">Small and simple embeddable IRC client.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pop3/pop3.html">pop3</a></td>
<td class="#tocright">Tcl client for POP3 email protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pop3d/pop3d.html">pop3d</a></td>
<td class="#tocright">Tcl POP3 server implementation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pop3d/pop3d_dbox.html">pop3d::dbox</a></td>
<td class="#tocright">Simple mailbox database for pop3d</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pop3d/pop3d_udb.html">pop3d::udb</a></td>
<td class="#tocright">Simple user database for pop3d</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/amazon-s3/S3.html">S3</a></td>
<td class="#tocright">Amazon S3 Web Service Interface</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/sasl/sasl.html">SASL</a></td>
<td class="#tocright">Implementation of SASL mechanisms for Tcl</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/mime/smtp.html">smtp</a></td>
<td class="#tocright">Client-side tcl implementation of the smtp protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/smtpd/smtpd.html">smtpd</a></td>
<td class="#tocright">Tcl SMTP server implementation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/dns/tcllib_ip.html">tcllib_ip</a></td>
<td class="#tocright">IPv4 and IPv6 address manipulation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/uri/uri.html">uri</a></td>
<td class="#tocright">URI utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/uri/urn-scheme.html">uri_urn</a></td>
<td class="#tocright">URI utilities, URN scheme</td>
</tr>
</table></dl>
<dl><dt>Page Parser Generator<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="apps/page.html">page</a></td>
<td class="#tocright">Parser Generator</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_intro.html">page_intro</a></td>
<td class="#tocright">page introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_pluginmgr.html">page_pluginmgr</a></td>
<td class="#tocright">page plugin manager</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_flow.html">page_util_flow</a></td>
<td class="#tocright">page dataflow/treewalker utility</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_norm_lemon.html">page_util_norm_lemon</a></td>
<td class="#tocright">page AST normalization, LEMON</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_norm_peg.html">page_util_norm_peg</a></td>
<td class="#tocright">page AST normalization, PEG</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_peg.html">page_util_peg</a></td>
<td class="#tocright">page PEG transformation utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_quote.html">page_util_quote</a></td>
<td class="#tocright">page character quoting utilities</td>
</tr>
</table></dl>
<dl><dt>Parsing and Grammars<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt.html">pt</a></td>
<td class="#tocright">Parser Tools Application</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_astree.html">pt::ast</a></td>
<td class="#tocright">Abstract Syntax Tree Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html">pt::cparam::configuration::critcl</a></td>
<td class="#tocright">C/PARAM, Canned configuration, Critcl</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_json_language.html">pt::json_language</a></td>
<td class="#tocright">The JSON Grammar Exchange Format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_param.html">pt::param</a></td>
<td class="#tocright">PackRat Machine Specification</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_pexpression.html">pt::pe</a></td>
<td class="#tocright">Parsing Expression Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_pexpr_op.html">pt::pe::op</a></td>
<td class="#tocright">Parsing Expression Utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_pegrammar.html">pt::peg</a></td>
<td class="#tocright">Parsing Expression Grammar Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_container.html">pt::peg::container</a></td>
<td class="#tocright">PEG Storage</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_container_peg.html">pt::peg::container::peg</a></td>
<td class="#tocright">PEG Storage. Canned PEG grammar specification</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_export.html">pt::peg::export</a></td>
<td class="#tocright">PEG Export</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_export_container.html">pt::peg::export::container</a></td>
<td class="#tocright">PEG Export Plugin. Write CONTAINER format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_export_json.html">pt::peg::export::json</a></td>
<td class="#tocright">PEG Export Plugin. Write JSON format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_export_peg.html">pt::peg::export::peg</a></td>
<td class="#tocright">PEG Export Plugin. Write PEG format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_from_container.html">pt::peg::from::container</a></td>
<td class="#tocright">PEG Conversion. From CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_from_json.html">pt::peg::from::json</a></td>
<td class="#tocright">PEG Conversion. Read JSON format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_from_peg.html">pt::peg::from::peg</a></td>
<td class="#tocright">PEG Conversion. Read PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_import.html">pt::peg::import</a></td>
<td class="#tocright">PEG Import</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_import_container.html">pt::peg::import::container</a></td>
<td class="#tocright">PEG Import Plugin. From CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_import_json.html">pt::peg::import::json</a></td>
<td class="#tocright">PEG Import Plugin. Read JSON format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_import_peg.html">pt::peg::import::peg</a></td>
<td class="#tocright">PEG Import Plugin. Read PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_interp.html">pt::peg::interp</a></td>
<td class="#tocright">Interpreter for parsing expression grammars</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_container.html">pt::peg::to::container</a></td>
<td class="#tocright">PEG Conversion. Write CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_cparam.html">pt::peg::to::cparam</a></td>
<td class="#tocright">PEG Conversion. Write CPARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_json.html">pt::peg::to::json</a></td>
<td class="#tocright">PEG Conversion. Write JSON format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_param.html">pt::peg::to::param</a></td>
<td class="#tocright">PEG Conversion. Write PARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_peg.html">pt::peg::to::peg</a></td>
<td class="#tocright">PEG Conversion. Write PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></td>
<td class="#tocright">PEG Conversion. Write TCLPARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_language.html">pt::peg_language</a></td>
<td class="#tocright">PEG Language Tutorial</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_introduction.html">pt::pegrammar</a></td>
<td class="#tocright">Introduction to Parsing Expression Grammars</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_pgen.html">pt::pgen</a></td>
<td class="#tocright">Parser Generator</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_rdengine.html">pt::rde</a></td>
<td class="#tocright">Parsing Runtime Support, PARAM based</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html">pt::tclparam::configuration::snit</a></td>
<td class="#tocright">Tcl/PARAM, Canned configuration, Snit</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html">pt::tclparam::configuration::tcloo</a></td>
<td class="#tocright">Tcl/PARAM, Canned configuration, Tcloo</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_to_api.html">pt_export_api</a></td>
<td class="#tocright">Parser Tools Export API</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_from_api.html">pt_import_api</a></td>
<td class="#tocright">Parser Tools Import API</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_introduction.html">pt_introduction</a></td>
<td class="#tocright">Introduction to Parser Tools</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_parser_api.html">pt_parser_api</a></td>
<td class="#tocright">Parser API</td>
</tr>
</table></dl>
<dl><dt>Procedures, arguments, parameters, options<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tepam/tepam_introduction.html">tepam</a></td>
<td class="#tocright">An introduction into TEPAM, Tcl's Enhanced Procedure and Argument Manager</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/tepam/tepam_procedure.html">tepam::procedure</a></td>
<td class="#tocright">TEPAM procedure, reference manual</td>
</tr>
</table></dl>
<dl><dt>Programming tools<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/cmdline/cmdline.html">cmdline</a></td>
<td class="#tocright">Procedures to process command lines and options.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/comm/comm.html">comm</a></td>
<td class="#tocright">A remote communication facility for Tcl (8.3 and later)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/comm/comm_wire.html">comm_wire</a></td>
<td class="#tocright">The comm wire protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/control/control.html">control</a></td>
<td class="#tocright">Procedures for control flow structures.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/interp/deleg_method.html">deleg_method</a></td>
<td class="#tocright">Creation of comm delegates (snit methods)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/interp/deleg_proc.html">deleg_proc</a></td>
<td class="#tocright">Creation of comm delegates (procedures)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fileutil/fileutil.html">fileutil</a></td>
<td class="#tocright">Procedures implementing some file utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/cfront.html">fileutil::magic::cfront</a></td>
<td class="#tocright">Generator core for compiler of magic(5) files</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/cgen.html">fileutil::magic::cgen</a></td>
<td class="#tocright">Generator core for compiler of magic(5) files</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/filetypes.html">fileutil::magic::filetype</a></td>
<td class="#tocright">Procedures implementing file-type recognition</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/mimetypes.html">fileutil::magic::mimetype</a></td>
<td class="#tocright">Procedures implementing mime-type recognition</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/rtcore.html">fileutil::magic::rt</a></td>
<td class="#tocright">Runtime core for file type recognition engines written in pure Tcl</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fileutil/multi.html">fileutil::multi</a></td>
<td class="#tocright">Multi-file operation, scatter/gather, standard object</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/fileutil/multiop.html">fileutil::multi::op</a></td>
<td class="#tocright">Multi-file operation, scatter/gather</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fileutil/traverse.html">fileutil_traverse</a></td>
<td class="#tocright">Iterative directory traversal</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/hook/hook.html">hook</a></td>
<td class="#tocright">Hooks</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/interp/tcllib_interp.html">interp</a></td>
<td class="#tocright">Interp creation and aliasing</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/log/log.html">log</a></td>
<td class="#tocright">Procedures to log messages of libraries and applications.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/log/logger.html">logger</a></td>
<td class="#tocright">System to control logging of events.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/log/loggerAppender.html">logger::appender</a></td>
<td class="#tocright">Collection of predefined appenders for logger</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/log/loggerUtils.html">logger::utils</a></td>
<td class="#tocright">Utilities for logger</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/multiplexer/multiplexer.html">multiplexer</a></td>
<td class="#tocright">One-to-many communication with sockets.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pluginmgr/pluginmgr.html">pluginmgr</a></td>
<td class="#tocright">Manage a plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/profiler/profiler.html">profiler</a></td>
<td class="#tocright">Tcl source code profiler</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/snit/snit.html">snit</a></td>
<td class="#tocright">Snit's Not Incr Tcl</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/snit/snitfaq.html">snitfaq</a></td>
<td class="#tocright">Snit Frequently Asked Questions</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/stooop/stooop.html">stooop</a></td>
<td class="#tocright">Object oriented extension.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/tie/tie.html">tie</a></td>
<td class="#tocright">Array persistence</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tie/tie_std.html">tie</a></td>
<td class="#tocright">Array persistence, standard data sources</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/uev/uevent.html">uevent</a></td>
<td class="#tocright">User events</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/wip/wip.html">wip</a></td>
<td class="#tocright">Word Interpreter</td>
</tr>
</table></dl>
<dl><dt>Terminal control<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/term.html">term</a></td>
<td class="#tocright">General terminal control</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_code.html">term::ansi::code</a></td>
<td class="#tocright">Helper for control sequences</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_cattr.html">term::ansi::code::attr</a></td>
<td class="#tocright">ANSI attribute sequences</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_cctrl.html">term::ansi::code::ctrl</a></td>
<td class="#tocright">ANSI control sequences</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_cmacros.html">term::ansi::code::macros</a></td>
<td class="#tocright">Macro sequences</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_ctrlu.html">term::ansi::ctrl::unix</a></td>
<td class="#tocright">Control operations and queries</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_send.html">term::ansi::send</a></td>
<td class="#tocright">Output of ANSI control sequences to terminals</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/imenu.html">term::interact::menu</a></td>
<td class="#tocright">Terminal widget, menu</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ipager.html">term::interact::pager</a></td>
<td class="#tocright">Terminal widget, paging</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/receive.html">term::receive</a></td>
<td class="#tocright">General input from terminals</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/term_bind.html">term::receive::bind</a></td>
<td class="#tocright">Keyboard dispatch from terminals</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/term_send.html">term::send</a></td>
<td class="#tocright">General output to terminals</td>
</tr>
</table></dl>
<dl><dt>Text formatter plugin<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_docidx.html">doctools::idx::export::docidx</a></td>
<td class="#tocright">docidx export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_html.html">doctools::idx::export::html</a></td>
<td class="#tocright">HTML export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_json.html">doctools::idx::export::json</a></td>
<td class="#tocright">JSON export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_nroff.html">doctools::idx::export::nroff</a></td>
<td class="#tocright">nroff export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_text.html">doctools::idx::export::text</a></td>
<td class="#tocright">plain text export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_wiki.html">doctools::idx::export::wiki</a></td>
<td class="#tocright">wiki export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/import_docidx.html">doctools::idx::import::docidx</a></td>
<td class="#tocright">docidx import plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/import_json.html">doctools::idx::import::json</a></td>
<td class="#tocright">JSON import plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_doctoc.html">doctools::toc::export::doctoc</a></td>
<td class="#tocright">doctoc export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_html.html">doctools::toc::export::html</a></td>
<td class="#tocright">HTML export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_json.html">doctools::toc::export::json</a></td>
<td class="#tocright">JSON export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_nroff.html">doctools::toc::export::nroff</a></td>
<td class="#tocright">nroff export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_text.html">doctools::toc::export::text</a></td>
<td class="#tocright">plain text export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_wiki.html">doctools::toc::export::wiki</a></td>
<td class="#tocright">wiki export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/import_doctoc.html">doctools::toc::import::doctoc</a></td>
<td class="#tocright">doctoc import plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/import_json.html">doctools::toc::import::json</a></td>
<td class="#tocright">JSON import plugin</td>
</tr>
</table></dl>
<dl><dt>Text processing<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base64/ascii85.html">ascii85</a></td>
<td class="#tocright">ascii85-encode/decode binary data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/base32/base32.html">base32</a></td>
<td class="#tocright">base32 standard encoding</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base32/base32core.html">base32::core</a></td>
<td class="#tocright">Expanding basic base32 maps</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/base32/base32hex.html">base32::hex</a></td>
<td class="#tocright">base32 extended hex encoding</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base64/base64.html">base64</a></td>
<td class="#tocright">base64-encode/decode binary data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/bibtex/bibtex.html">bibtex</a></td>
<td class="#tocright">Parse bibtex files</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/clock/iso8601.html">clock_iso8601</a></td>
<td class="#tocright">Parsing ISO 8601 dates/times</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/clock/rfc2822.html">clock_rfc2822</a></td>
<td class="#tocright">Parsing ISO 8601 dates/times</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/csv/csv.html">csv</a></td>
<td class="#tocright">Procedures to handle CSV data.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/htmlparse/htmlparse.html">htmlparse</a></td>
<td class="#tocright">Procedures to parse HTML strings</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/inifile/ini.html">inifile</a></td>
<td class="#tocright">Parsing of Windows INI files</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/mime/mime.html">mime</a></td>
<td class="#tocright">Manipulation of MIME body parts</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/rcs/rcs.html">rcs</a></td>
<td class="#tocright">RCS low level utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/textutil.html">textutil</a></td>
<td class="#tocright">Procedures to manipulate texts and strings.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/adjust.html">textutil::adjust</a></td>
<td class="#tocright">Procedures to adjust, indent, and undent paragraphs</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/repeat.html">textutil::repeat</a></td>
<td class="#tocright">Procedures to repeat strings.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/textutil_split.html">textutil::split</a></td>
<td class="#tocright">Procedures to split texts</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/textutil_string.html">textutil::string</a></td>
<td class="#tocright">Procedures to manipulate texts and strings.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/tabify.html">textutil::tabify</a></td>
<td class="#tocright">Procedures to (un)tabify strings</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/trim.html">textutil::trim</a></td>
<td class="#tocright">Procedures to trim strings</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base64/uuencode.html">uuencode</a></td>
<td class="#tocright">UU-encode/decode binary data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/amazon-s3/xsxp.html">xsxp</a></td>
<td class="#tocright">eXtremely Simple Xml Parser</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base64/yencode.html">yencode</a></td>
<td class="#tocright">Y-encode/decode binary data</td>
</tr>
</table></dl>
<dl><dt>Transfer module<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/connect.html">transfer::connect</a></td>
<td class="#tocright">Connection setup</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/copyops.html">transfer::copy</a></td>
<td class="#tocright">Data transfer foundation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/tqueue.html">transfer::copy::queue</a></td>
<td class="#tocright">Queued transfers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/ddest.html">transfer::data::destination</a></td>
<td class="#tocright">Data destination</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/dsource.html">transfer::data::source</a></td>
<td class="#tocright">Data source</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/receiver.html">transfer::receiver</a></td>
<td class="#tocright">Data source</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/transmitter.html">transfer::transmitter</a></td>
<td class="#tocright">Data source</td>
</tr>
</table></dl>
<dl><dt>Unfiled<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/cache/async.html">cache::async</a></td>
<td class="#tocright">Asynchronous in-memory cache</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/generator/generator.html">generator</a></td>
<td class="#tocright">Procedures for creating and using generators.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/yaml/huddle.html">huddle</a></td>
<td class="#tocright">Create and manipulate huddle object</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/imap4/imap4.html">imap4</a></td>
<td class="#tocright">imap client-side tcl implementation of imap protocol</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/map/map_geocode_nominatim.html">map::geocode::nominatim</a></td>
<td class="#tocright">Resolving geographical names with a Nominatim service</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/map/map_slippy.html">map::slippy</a></td>
<td class="#tocright">Common code for slippy based map packages</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/map/map_slippy_cache.html">map::slippy::cache</a></td>
<td class="#tocright">Management of a tile cache in the local filesystem</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/map/map_slippy_fetcher.html">map::slippy::fetcher</a></td>
<td class="#tocright">Accessing a server providing tiles for slippy-based maps</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/mapproj/mapproj.html">mapproj</a></td>
<td class="#tocright">Map projection routines</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/symdiff.html">math::calculus::symdiff</a></td>
<td class="#tocright">Symbolic differentiation for Tcl</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/namespacex/namespacex.html">namespacex</a></td>
<td class="#tocright">Namespace utility commands</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/rest/rest.html">rest</a></td>
<td class="#tocright">define REST web APIs and call them inline or asychronously</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/stringprep/stringprep.html">stringprep</a></td>
<td class="#tocright">Implementation of stringprep</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/stringprep/stringprep_data.html">stringprep::data</a></td>
<td class="#tocright">stringprep data tables, generated, internal</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/machineparameters.html">tclrep/machineparameters</a></td>
<td class="#tocright">Compute double precision machine parameters.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/uev/uevent_onidle.html">uevent::onidle</a></td>
<td class="#tocright">Request merging and deferal to idle time</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/stringprep/unicode.html">unicode</a></td>
<td class="#tocright">Implementation of Unicode normalization</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/stringprep/unicode_data.html">unicode::data</a></td>
<td class="#tocright">unicode data tables, generated, internal</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/units/units.html">units</a></td>
<td class="#tocright">unit conversion</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/yaml/yaml.html">yaml</a></td>
<td class="#tocright">YAML Format Encoder/Decoder</td>
</tr>
</table></dl>
<dl><dt>Utility<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/lambda/lambda.html">lambda</a></td>
<td class="#tocright">Utility commands for anonymous procedures</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/ooutil/ooutil.html">oo::util</a></td>
<td class="#tocright">Utility commands for TclOO</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/try/tcllib_try.html">try</a></td>
<td class="#tocright">try - Trap and process errors and exceptions</td>
</tr>
</table></dl>
<dl><dt>Validation, Type checking<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/valtype_common.html">valtype::common</a></td>
<td class="#tocright">Validation, common code</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/cc_amex.html">valtype::creditcard::amex</a></td>
<td class="#tocright">Validation for AMEX creditcard number</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/cc_discover.html">valtype::creditcard::discover</a></td>
<td class="#tocright">Validation for Discover creditcard number</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/cc_mastercard.html">valtype::creditcard::mastercard</a></td>
<td class="#tocright">Validation for Mastercard creditcard number</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/cc_visa.html">valtype::creditcard::visa</a></td>
<td class="#tocright">Validation for VISA creditcard number</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/ean13.html">valtype::gs1::ean13</a></td>
<td class="#tocright">Validation for EAN13</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/iban.html">valtype::iban</a></td>
<td class="#tocright">Validation for IBAN</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/imei.html">valtype::imei</a></td>
<td class="#tocright">Validation for IMEI</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/isbn.html">valtype::isbn</a></td>
<td class="#tocright">Validation for ISBN</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/luhn.html">valtype::luhn</a></td>
<td class="#tocright">Validation for plain number with a LUHN checkdigit</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/luhn5.html">valtype::luhn5</a></td>
<td class="#tocright">Validation for plain number with a LUHN5 checkdigit</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/usnpi.html">valtype::usnpi</a></td>
<td class="#tocright">Validation for USNPI</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/verhoeff.html">valtype::verhoeff</a></td>
<td class="#tocright">Validation for plain number with a VERHOEFF checkdigit</td>
</tr>
</table></dl></table></dl>
<dl><dt>By Type<dd>
<dl><dt>Applications<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="apps/dtplite.html">dtplite</a></td>
<td class="#tocright">Lightweight DocTools Markup Processor</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="apps/nns.html">nns</a></td>
<td class="#tocright">Name service facility, Commandline Client Application</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="apps/nnsd.html">nnsd</a></td>
<td class="#tocright">Name service facility, Commandline Server Application</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="apps/nnslog.html">nnslog</a></td>
<td class="#tocright">Name service facility, Commandline Logging Client Application</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="apps/page.html">page</a></td>
<td class="#tocright">Parser Generator</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="apps/tcldocstrip.html">tcldocstrip</a></td>
<td class="#tocright">Tcl-based Docstrip Processor</td>
</tr>
</table></dl>
<dl><dt>Modules<dd>
<dl><dt>aes<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/aes/aes.html">aes</a></td>
<td class="#tocright">Implementation of the AES block cipher</td>
</tr>
</table></dl>
<dl><dt>amazon-s3<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/amazon-s3/S3.html">S3</a></td>
<td class="#tocright">Amazon S3 Web Service Interface</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/amazon-s3/xsxp.html">xsxp</a></td>
<td class="#tocright">eXtremely Simple Xml Parser</td>
</tr>
</table></dl>
<dl><dt>asn<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/asn/asn.html">asn</a></td>
<td class="#tocright">ASN.1 BER encoder/decoder</td>
</tr>
</table></dl>
<dl><dt>base32<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base32/base32.html">base32</a></td>
<td class="#tocright">base32 standard encoding</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/base32/base32core.html">base32::core</a></td>
<td class="#tocright">Expanding basic base32 maps</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base32/base32hex.html">base32::hex</a></td>
<td class="#tocright">base32 extended hex encoding</td>
</tr>
</table></dl>
<dl><dt>base64<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base64/ascii85.html">ascii85</a></td>
<td class="#tocright">ascii85-encode/decode binary data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/base64/base64.html">base64</a></td>
<td class="#tocright">base64-encode/decode binary data</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/base64/uuencode.html">uuencode</a></td>
<td class="#tocright">UU-encode/decode binary data</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/base64/yencode.html">yencode</a></td>
<td class="#tocright">Y-encode/decode binary data</td>
</tr>
</table></dl>
<dl><dt>bee<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bee/bee.html">bee</a></td>
<td class="#tocright">BitTorrent Serialization Format Encoder/Decoder</td>
</tr>
</table></dl>
<dl><dt>bench<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench.html">bench</a></td>
<td class="#tocright">bench - Processing benchmark suites</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_read.html">bench::in</a></td>
<td class="#tocright">bench::in - Reading benchmark results</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_wcsv.html">bench::out::csv</a></td>
<td class="#tocright">bench::out::csv - Formatting benchmark results as CSV</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_wtext.html">bench::out::text</a></td>
<td class="#tocright">bench::out::text - Formatting benchmark results as human readable text</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_intro.html">bench_intro</a></td>
<td class="#tocright">bench introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_lang_intro.html">bench_lang_intro</a></td>
<td class="#tocright">bench language introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bench/bench_lang_spec.html">bench_lang_spec</a></td>
<td class="#tocright">bench language specification</td>
</tr>
</table></dl>
<dl><dt>bibtex<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/bibtex/bibtex.html">bibtex</a></td>
<td class="#tocright">Parse bibtex files</td>
</tr>
</table></dl>
<dl><dt>blowfish<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/blowfish/blowfish.html">blowfish</a></td>
<td class="#tocright">Implementation of the Blowfish block cipher</td>
</tr>
</table></dl>
<dl><dt>cache<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/cache/async.html">cache::async</a></td>
<td class="#tocright">Asynchronous in-memory cache</td>
</tr>
</table></dl>
<dl><dt>clock<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/clock/iso8601.html">clock_iso8601</a></td>
<td class="#tocright">Parsing ISO 8601 dates/times</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/clock/rfc2822.html">clock_rfc2822</a></td>
<td class="#tocright">Parsing ISO 8601 dates/times</td>
</tr>
</table></dl>
<dl><dt>cmdline<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/cmdline/cmdline.html">cmdline</a></td>
<td class="#tocright">Procedures to process command lines and options.</td>
</tr>
</table></dl>
<dl><dt>comm<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/comm/comm.html">comm</a></td>
<td class="#tocright">A remote communication facility for Tcl (8.3 and later)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/comm/comm_wire.html">comm_wire</a></td>
<td class="#tocright">The comm wire protocol</td>
</tr>
</table></dl>
<dl><dt>control<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/control/control.html">control</a></td>
<td class="#tocright">Procedures for control flow structures.</td>
</tr>
</table></dl>
<dl><dt>coroutine<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/coroutine/coroutine.html">coroutine</a></td>
<td class="#tocright">Coroutine based event and IO handling</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/coroutine/coro_auto.html">coroutine::auto</a></td>
<td class="#tocright">Automatic event and IO coroutine awareness</td>
</tr>
</table></dl>
<dl><dt>counter<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/counter/counter.html">counter</a></td>
<td class="#tocright">Procedures for counters and histograms</td>
</tr>
</table></dl>
<dl><dt>crc<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/crc/cksum.html">cksum</a></td>
<td class="#tocright">Calculate a cksum(1) compatible checksum</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/crc/crc16.html">crc16</a></td>
<td class="#tocright">Perform a 16bit Cyclic Redundancy Check</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/crc/crc32.html">crc32</a></td>
<td class="#tocright">Perform a 32bit Cyclic Redundancy Check</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/crc/sum.html">sum</a></td>
<td class="#tocright">Calculate a sum(1) compatible checksum</td>
</tr>
</table></dl>
<dl><dt>csv<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/csv/csv.html">csv</a></td>
<td class="#tocright">Procedures to handle CSV data.</td>
</tr>
</table></dl>
<dl><dt>des<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/des/des.html">des</a></td>
<td class="#tocright">Implementation of the DES and triple-DES ciphers</td>
</tr>
</table></dl>
<dl><dt>dns<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/dns/tcllib_dns.html">dns</a></td>
<td class="#tocright">Tcl Domain Name Service Client</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/dns/tcllib_ip.html">tcllib_ip</a></td>
<td class="#tocright">IPv4 and IPv6 address manipulation</td>
</tr>
</table></dl>
<dl><dt>docstrip<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/docstrip/docstrip.html">docstrip</a></td>
<td class="#tocright">Docstrip style source code extraction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/docstrip/docstrip_util.html">docstrip_util</a></td>
<td class="#tocright">Docstrip-related utilities</td>
</tr>
</table></dl>
<dl><dt>doctools<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_intro.html">docidx_intro</a></td>
<td class="#tocright">docidx introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_lang_cmdref.html">docidx_lang_cmdref</a></td>
<td class="#tocright">docidx language command reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_lang_faq.html">docidx_lang_faq</a></td>
<td class="#tocright">docidx language faq</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_lang_intro.html">docidx_lang_intro</a></td>
<td class="#tocright">docidx language introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_lang_syntax.html">docidx_lang_syntax</a></td>
<td class="#tocright">docidx language syntax</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx_plugin_apiref.html">docidx_plugin_apiref</a></td>
<td class="#tocright">docidx plugin API reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_intro.html">doctoc_intro</a></td>
<td class="#tocright">doctoc introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_lang_cmdref.html">doctoc_lang_cmdref</a></td>
<td class="#tocright">doctoc language command reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_lang_faq.html">doctoc_lang_faq</a></td>
<td class="#tocright">doctoc language faq</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_lang_intro.html">doctoc_lang_intro</a></td>
<td class="#tocright">doctoc language introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_lang_syntax.html">doctoc_lang_syntax</a></td>
<td class="#tocright">doctoc language syntax</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc_plugin_apiref.html">doctoc_plugin_apiref</a></td>
<td class="#tocright">doctoc plugin API reference</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools.html">doctools</a></td>
<td class="#tocright">doctools - Processing documents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/changelog.html">doctools::changelog</a></td>
<td class="#tocright">Processing text in Emacs ChangeLog format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/cvs.html">doctools::cvs</a></td>
<td class="#tocright">Processing text in 'cvs log' format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/docidx.html">doctools::idx</a></td>
<td class="#tocright">docidx - Processing indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctoc.html">doctools::toc</a></td>
<td class="#tocright">doctoc - Processing tables of contents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_intro.html">doctools_intro</a></td>
<td class="#tocright">doctools introduction</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_lang_cmdref.html">doctools_lang_cmdref</a></td>
<td class="#tocright">doctools language command reference</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_lang_faq.html">doctools_lang_faq</a></td>
<td class="#tocright">doctools language faq</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_lang_intro.html">doctools_lang_intro</a></td>
<td class="#tocright">doctools language introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_lang_syntax.html">doctools_lang_syntax</a></td>
<td class="#tocright">doctools language syntax</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/doctools_plugin_apiref.html">doctools_plugin_apiref</a></td>
<td class="#tocright">doctools plugin API reference</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools/mpexpand.html">mpexpand</a></td>
<td class="#tocright">Markup processor</td>
</tr>
</table></dl>
<dl><dt>doctools2base<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2base/html_cssdefaults.html">doctools::html::cssdefaults</a></td>
<td class="#tocright">Default CSS style for HTML export plugins</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2base/tcllib_msgcat.html">doctools::msgcat</a></td>
<td class="#tocright">Message catalog management for the various document parsers</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2base/nroff_manmacros.html">doctools::nroff::man_macros</a></td>
<td class="#tocright">Default CSS style for NROFF export plugins</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2base/tcl_parse.html">doctools::tcl::parse</a></td>
<td class="#tocright">Processing text in 'subst -novariables' format</td>
</tr>
</table></dl>
<dl><dt>doctools2idx<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/introduction.html">doctools2idx_introduction</a></td>
<td class="#tocright">DocTools - Keyword indices</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/container.html">doctools::idx</a></td>
<td class="#tocright">Holding keyword indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export.html">doctools::idx::export</a></td>
<td class="#tocright">Exporting keyword indices</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_docidx.html">doctools::idx::export::docidx</a></td>
<td class="#tocright">docidx export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_html.html">doctools::idx::export::html</a></td>
<td class="#tocright">HTML export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_json.html">doctools::idx::export::json</a></td>
<td class="#tocright">JSON export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_nroff.html">doctools::idx::export::nroff</a></td>
<td class="#tocright">nroff export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_text.html">doctools::idx::export::text</a></td>
<td class="#tocright">plain text export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/export_wiki.html">doctools::idx::export::wiki</a></td>
<td class="#tocright">wiki export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/import.html">doctools::idx::import</a></td>
<td class="#tocright">Importing keyword indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/import_docidx.html">doctools::idx::import::docidx</a></td>
<td class="#tocright">docidx import plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/import_json.html">doctools::idx::import::json</a></td>
<td class="#tocright">JSON import plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/parse.html">doctools::idx::parse</a></td>
<td class="#tocright">Parsing text in docidx format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/structure.html">doctools::idx::structure</a></td>
<td class="#tocright">Docidx serialization utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/msgcat_c.html">doctools::msgcat::idx::c</a></td>
<td class="#tocright">Message catalog for the docidx parser (C)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/msgcat_de.html">doctools::msgcat::idx::de</a></td>
<td class="#tocright">Message catalog for the docidx parser (DE)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/msgcat_en.html">doctools::msgcat::idx::en</a></td>
<td class="#tocright">Message catalog for the docidx parser (EN)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2idx/msgcat_fr.html">doctools::msgcat::idx::fr</a></td>
<td class="#tocright">Message catalog for the docidx parser (FR)</td>
</tr>
</table></dl>
<dl><dt>doctools2toc<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/introduction.html">doctools2toc_introduction</a></td>
<td class="#tocright">DocTools - Tables of Contents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/msgcat_c.html">doctools::msgcat::toc::c</a></td>
<td class="#tocright">Message catalog for the doctoc parser (C)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/msgcat_de.html">doctools::msgcat::toc::de</a></td>
<td class="#tocright">Message catalog for the doctoc parser (DE)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/msgcat_en.html">doctools::msgcat::toc::en</a></td>
<td class="#tocright">Message catalog for the doctoc parser (EN)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/msgcat_fr.html">doctools::msgcat::toc::fr</a></td>
<td class="#tocright">Message catalog for the doctoc parser (FR)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/container.html">doctools::toc</a></td>
<td class="#tocright">Holding tables of contents</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export.html">doctools::toc::export</a></td>
<td class="#tocright">Exporting tables of contents</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_doctoc.html">doctools::toc::export::doctoc</a></td>
<td class="#tocright">doctoc export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_html.html">doctools::toc::export::html</a></td>
<td class="#tocright">HTML export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_json.html">doctools::toc::export::json</a></td>
<td class="#tocright">JSON export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_nroff.html">doctools::toc::export::nroff</a></td>
<td class="#tocright">nroff export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_text.html">doctools::toc::export::text</a></td>
<td class="#tocright">plain text export plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/export_wiki.html">doctools::toc::export::wiki</a></td>
<td class="#tocright">wiki export plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/import.html">doctools::toc::import</a></td>
<td class="#tocright">Importing keyword indices</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/import_doctoc.html">doctools::toc::import::doctoc</a></td>
<td class="#tocright">doctoc import plugin</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/import_json.html">doctools::toc::import::json</a></td>
<td class="#tocright">JSON import plugin</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/parse.html">doctools::toc::parse</a></td>
<td class="#tocright">Parsing text in doctoc format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/doctools2toc/structure.html">doctools::toc::structure</a></td>
<td class="#tocright">Doctoc serialization utilities</td>
</tr>
</table></dl>
<dl><dt>exif<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/exif/exif.html">exif</a></td>
<td class="#tocright">Tcl EXIF extracts and parses EXIF fields from digital images</td>
</tr>
</table></dl>
<dl><dt>fileutil<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fileutil/fileutil.html">fileutil</a></td>
<td class="#tocright">Procedures implementing some file utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/fileutil/multi.html">fileutil::multi</a></td>
<td class="#tocright">Multi-file operation, scatter/gather, standard object</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fileutil/multiop.html">fileutil::multi::op</a></td>
<td class="#tocright">Multi-file operation, scatter/gather</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/fileutil/traverse.html">fileutil_traverse</a></td>
<td class="#tocright">Iterative directory traversal</td>
</tr>
</table></dl>
<dl><dt>ftp<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ftp/ftp.html">ftp</a></td>
<td class="#tocright">Client-side tcl implementation of the ftp protocol</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/ftp/ftp_geturl.html">ftp::geturl</a></td>
<td class="#tocright">Uri handler for ftp urls</td>
</tr>
</table></dl>
<dl><dt>ftpd<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ftpd/ftpd.html">ftpd</a></td>
<td class="#tocright">Tcl FTP server implementation</td>
</tr>
</table></dl>
<dl><dt>fumagic<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/cfront.html">fileutil::magic::cfront</a></td>
<td class="#tocright">Generator core for compiler of magic(5) files</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/cgen.html">fileutil::magic::cgen</a></td>
<td class="#tocright">Generator core for compiler of magic(5) files</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/filetypes.html">fileutil::magic::filetype</a></td>
<td class="#tocright">Procedures implementing file-type recognition</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/mimetypes.html">fileutil::magic::mimetype</a></td>
<td class="#tocright">Procedures implementing mime-type recognition</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/fumagic/rtcore.html">fileutil::magic::rt</a></td>
<td class="#tocright">Runtime core for file type recognition engines written in pure Tcl</td>
</tr>
</table></dl>
<dl><dt>generator<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/generator/generator.html">generator</a></td>
<td class="#tocright">Procedures for creating and using generators.</td>
</tr>
</table></dl>
<dl><dt>gpx<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/gpx/gpx.html">gpx</a></td>
<td class="#tocright">Extracts waypoints, tracks and routes from GPX files</td>
</tr>
</table></dl>
<dl><dt>grammar_aycock<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_aycock/aycock.html">grammar::aycock</a></td>
<td class="#tocright">Aycock-Horspool-Earley parser generator for Tcl</td>
</tr>
</table></dl>
<dl><dt>grammar_fa<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_fa/fa.html">grammar::fa</a></td>
<td class="#tocright">Create and manipulate finite automatons</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_fa/dacceptor.html">grammar::fa::dacceptor</a></td>
<td class="#tocright">Create and use deterministic acceptors</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_fa/dexec.html">grammar::fa::dexec</a></td>
<td class="#tocright">Execute deterministic finite automatons</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_fa/faop.html">grammar::fa::op</a></td>
<td class="#tocright">Operations on finite automatons</td>
</tr>
</table></dl>
<dl><dt>grammar_me<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_cpu.html">grammar::me::cpu</a></td>
<td class="#tocright">Virtual machine implementation II for parsing token streams</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_cpucore.html">grammar::me::cpu::core</a></td>
<td class="#tocright">ME virtual machine state manipulation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/gasm.html">grammar::me::cpu::gasm</a></td>
<td class="#tocright">ME assembler</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_tcl.html">grammar::me::tcl</a></td>
<td class="#tocright">Virtual machine implementation I for parsing token streams</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_util.html">grammar::me::util</a></td>
<td class="#tocright">AST utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_ast.html">grammar::me_ast</a></td>
<td class="#tocright">Various representations of ASTs</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_intro.html">grammar::me_intro</a></td>
<td class="#tocright">Introduction to virtual machines for parsing token streams</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_me/me_vm.html">grammar::me_vm</a></td>
<td class="#tocright">Virtual machine for parsing token streams</td>
</tr>
</table></dl>
<dl><dt>grammar_peg<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_peg/peg.html">grammar::peg</a></td>
<td class="#tocright">Create and manipulate parsing expression grammars</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/grammar_peg/peg_interp.html">grammar::peg::interp</a></td>
<td class="#tocright">Interpreter for parsing expression grammars</td>
</tr>
</table></dl>
<dl><dt>hook<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/hook/hook.html">hook</a></td>
<td class="#tocright">Hooks</td>
</tr>
</table></dl>
<dl><dt>html<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/html/html.html">html</a></td>
<td class="#tocright">Procedures to generate HTML structures</td>
</tr>
</table></dl>
<dl><dt>htmlparse<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/htmlparse/htmlparse.html">htmlparse</a></td>
<td class="#tocright">Procedures to parse HTML strings</td>
</tr>
</table></dl>
<dl><dt>http<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/http/autoproxy.html">autoproxy</a></td>
<td class="#tocright">Automatic HTTP proxy usage and authentication</td>
</tr>
</table></dl>
<dl><dt>ident<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ident/ident.html">ident</a></td>
<td class="#tocright">Ident protocol client</td>
</tr>
</table></dl>
<dl><dt>imap4<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/imap4/imap4.html">imap4</a></td>
<td class="#tocright">imap client-side tcl implementation of imap protocol</td>
</tr>
</table></dl>
<dl><dt>inifile<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/inifile/ini.html">inifile</a></td>
<td class="#tocright">Parsing of Windows INI files</td>
</tr>
</table></dl>
<dl><dt>interp<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/interp/deleg_method.html">deleg_method</a></td>
<td class="#tocright">Creation of comm delegates (snit methods)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/interp/deleg_proc.html">deleg_proc</a></td>
<td class="#tocright">Creation of comm delegates (procedures)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/interp/tcllib_interp.html">interp</a></td>
<td class="#tocright">Interp creation and aliasing</td>
</tr>
</table></dl>
<dl><dt>irc<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/irc/irc.html">irc</a></td>
<td class="#tocright">Create IRC connection and interface.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/irc/picoirc.html">picoirc</a></td>
<td class="#tocright">Small and simple embeddable IRC client.</td>
</tr>
</table></dl>
<dl><dt>javascript<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/javascript/javascript.html">javascript</a></td>
<td class="#tocright">Procedures to generate HTML and Java Script structures.</td>
</tr>
</table></dl>
<dl><dt>jpeg<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/jpeg/jpeg.html">jpeg</a></td>
<td class="#tocright">JPEG querying and manipulation of meta data</td>
</tr>
</table></dl>
<dl><dt>json<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/json/json.html">json</a></td>
<td class="#tocright">JSON parser</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/json/json_write.html">json::write</a></td>
<td class="#tocright">JSON generation</td>
</tr>
</table></dl>
<dl><dt>lambda<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/lambda/lambda.html">lambda</a></td>
<td class="#tocright">Utility commands for anonymous procedures</td>
</tr>
</table></dl>
<dl><dt>ldap<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ldap/ldap.html">ldap</a></td>
<td class="#tocright">LDAP client</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/ldap/ldapx.html">ldapx</a></td>
<td class="#tocright">LDAP extended object interface</td>
</tr>
</table></dl>
<dl><dt>log<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/log/log.html">log</a></td>
<td class="#tocright">Procedures to log messages of libraries and applications.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/log/logger.html">logger</a></td>
<td class="#tocright">System to control logging of events.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/log/loggerAppender.html">logger::appender</a></td>
<td class="#tocright">Collection of predefined appenders for logger</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/log/loggerUtils.html">logger::utils</a></td>
<td class="#tocright">Utilities for logger</td>
</tr>
</table></dl>
<dl><dt>map<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/map/map_geocode_nominatim.html">map::geocode::nominatim</a></td>
<td class="#tocright">Resolving geographical names with a Nominatim service</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/map/map_slippy.html">map::slippy</a></td>
<td class="#tocright">Common code for slippy based map packages</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/map/map_slippy_cache.html">map::slippy::cache</a></td>
<td class="#tocright">Management of a tile cache in the local filesystem</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/map/map_slippy_fetcher.html">map::slippy::fetcher</a></td>
<td class="#tocright">Accessing a server providing tiles for slippy-based maps</td>
</tr>
</table></dl>
<dl><dt>mapproj<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/mapproj/mapproj.html">mapproj</a></td>
<td class="#tocright">Map projection routines</td>
</tr>
</table></dl>
<dl><dt>math<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/math.html">math</a></td>
<td class="#tocright">Tcl Math Library</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/bigfloat.html">math::bigfloat</a></td>
<td class="#tocright">Arbitrary precision floating-point numbers</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/bignum.html">math::bignum</a></td>
<td class="#tocright">Arbitrary precision integer numbers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/calculus.html">math::calculus</a></td>
<td class="#tocright">Integration and ordinary differential equations</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/romberg.html">math::calculus::romberg</a></td>
<td class="#tocright">Romberg integration</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/symdiff.html">math::calculus::symdiff</a></td>
<td class="#tocright">Symbolic differentiation for Tcl</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/combinatorics.html">math::combinatorics</a></td>
<td class="#tocright">Combinatorial functions in the Tcl Math Library</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/qcomplex.html">math::complexnumbers</a></td>
<td class="#tocright">Straightforward complex number package</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/constants.html">math::constants</a></td>
<td class="#tocright">Mathematical and numerical constants</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/decimal.html">math::decimal</a></td>
<td class="#tocright">General decimal arithmetic</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/fourier.html">math::fourier</a></td>
<td class="#tocright">Discrete and fast fourier transforms</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/fuzzy.html">math::fuzzy</a></td>
<td class="#tocright">Fuzzy comparison of floating-point numbers</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/math_geometry.html">math::geometry</a></td>
<td class="#tocright">Geometrical computations</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/interpolate.html">math::interpolate</a></td>
<td class="#tocright">Interpolation routines</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/linalg.html">math::linearalgebra</a></td>
<td class="#tocright">Linear Algebra</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/numtheory.html">math::numtheory</a></td>
<td class="#tocright">Number Theory</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/optimize.html">math::optimize</a></td>
<td class="#tocright">Optimisation routines</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/polynomials.html">math::polynomials</a></td>
<td class="#tocright">Polynomial functions</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/rational_funcs.html">math::rationalfunctions</a></td>
<td class="#tocright">Polynomial functions</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/roman.html">math::roman</a></td>
<td class="#tocright">Tools for creating and manipulating roman numerals</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/special.html">math::special</a></td>
<td class="#tocright">Special mathematical functions</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/math/statistics.html">math::statistics</a></td>
<td class="#tocright">Basic statistical functions and procedures</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/math/machineparameters.html">tclrep/machineparameters</a></td>
<td class="#tocright">Compute double precision machine parameters.</td>
</tr>
</table></dl>
<dl><dt>md4<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/md4/md4.html">md4</a></td>
<td class="#tocright">MD4 Message-Digest Algorithm</td>
</tr>
</table></dl>
<dl><dt>md5<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/md5/md5.html">md5</a></td>
<td class="#tocright">MD5 Message-Digest Algorithm</td>
</tr>
</table></dl>
<dl><dt>md5crypt<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/md5crypt/md5crypt.html">md5crypt</a></td>
<td class="#tocright">MD5-based password encryption</td>
</tr>
</table></dl>
<dl><dt>mime<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/mime/mime.html">mime</a></td>
<td class="#tocright">Manipulation of MIME body parts</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/mime/smtp.html">smtp</a></td>
<td class="#tocright">Client-side tcl implementation of the smtp protocol</td>
</tr>
</table></dl>
<dl><dt>multiplexer<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/multiplexer/multiplexer.html">multiplexer</a></td>
<td class="#tocright">One-to-many communication with sockets.</td>
</tr>
</table></dl>
<dl><dt>namespacex<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/namespacex/namespacex.html">namespacex</a></td>
<td class="#tocright">Namespace utility commands</td>
</tr>
</table></dl>
<dl><dt>ncgi<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ncgi/ncgi.html">ncgi</a></td>
<td class="#tocright">Procedures to manipulate CGI values.</td>
</tr>
</table></dl>
<dl><dt>nmea<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nmea/nmea.html">nmea</a></td>
<td class="#tocright">Process NMEA data</td>
</tr>
</table></dl>
<dl><dt>nns<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_client.html">nameserv</a></td>
<td class="#tocright">Name service facility, Client</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_auto.html">nameserv::auto</a></td>
<td class="#tocright">Name service facility, Client Extension</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_common.html">nameserv::common</a></td>
<td class="#tocright">Name service facility, shared definitions</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_protocol.html">nameserv::protocol</a></td>
<td class="#tocright">Name service facility, client/server protocol</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_server.html">nameserv::server</a></td>
<td class="#tocright">Name service facility, Server</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/nns/nns_intro.html">nns_intro</a></td>
<td class="#tocright">Name service facility, introduction</td>
</tr>
</table></dl>
<dl><dt>nntp<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/nntp/nntp.html">nntp</a></td>
<td class="#tocright">Tcl client for the NNTP protocol</td>
</tr>
</table></dl>
<dl><dt>ntp<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ntp/ntp_time.html">ntp_time</a></td>
<td class="#tocright">Tcl Time Service Client</td>
</tr>
</table></dl>
<dl><dt>ooutil<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ooutil/ooutil.html">oo::util</a></td>
<td class="#tocright">Utility commands for TclOO</td>
</tr>
</table></dl>
<dl><dt>otp<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/otp/otp.html">otp</a></td>
<td class="#tocright">One-Time Passwords</td>
</tr>
</table></dl>
<dl><dt>page<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_intro.html">page_intro</a></td>
<td class="#tocright">page introduction</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_pluginmgr.html">page_pluginmgr</a></td>
<td class="#tocright">page plugin manager</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_flow.html">page_util_flow</a></td>
<td class="#tocright">page dataflow/treewalker utility</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_norm_lemon.html">page_util_norm_lemon</a></td>
<td class="#tocright">page AST normalization, LEMON</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_norm_peg.html">page_util_norm_peg</a></td>
<td class="#tocright">page AST normalization, PEG</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_peg.html">page_util_peg</a></td>
<td class="#tocright">page PEG transformation utilities</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/page/page_util_quote.html">page_util_quote</a></td>
<td class="#tocright">page character quoting utilities</td>
</tr>
</table></dl>
<dl><dt>pki<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pki/pki.html">pki</a></td>
<td class="#tocright">Implementation of the public key cipher</td>
</tr>
</table></dl>
<dl><dt>pluginmgr<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pluginmgr/pluginmgr.html">pluginmgr</a></td>
<td class="#tocright">Manage a plugin</td>
</tr>
</table></dl>
<dl><dt>png<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/png/png.html">png</a></td>
<td class="#tocright">PNG querying and manipulation of meta data</td>
</tr>
</table></dl>
<dl><dt>pop3<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pop3/pop3.html">pop3</a></td>
<td class="#tocright">Tcl client for POP3 email protocol</td>
</tr>
</table></dl>
<dl><dt>pop3d<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pop3d/pop3d.html">pop3d</a></td>
<td class="#tocright">Tcl POP3 server implementation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pop3d/pop3d_dbox.html">pop3d::dbox</a></td>
<td class="#tocright">Simple mailbox database for pop3d</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pop3d/pop3d_udb.html">pop3d::udb</a></td>
<td class="#tocright">Simple user database for pop3d</td>
</tr>
</table></dl>
<dl><dt>profiler<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/profiler/profiler.html">profiler</a></td>
<td class="#tocright">Tcl source code profiler</td>
</tr>
</table></dl>
<dl><dt>pt<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt.html">pt</a></td>
<td class="#tocright">Parser Tools Application</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_astree.html">pt::ast</a></td>
<td class="#tocright">Abstract Syntax Tree Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_cparam_config_critcl.html">pt::cparam::configuration::critcl</a></td>
<td class="#tocright">C/PARAM, Canned configuration, Critcl</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_json_language.html">pt::json_language</a></td>
<td class="#tocright">The JSON Grammar Exchange Format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_param.html">pt::param</a></td>
<td class="#tocright">PackRat Machine Specification</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_pexpression.html">pt::pe</a></td>
<td class="#tocright">Parsing Expression Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_pexpr_op.html">pt::pe::op</a></td>
<td class="#tocright">Parsing Expression Utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_pegrammar.html">pt::peg</a></td>
<td class="#tocright">Parsing Expression Grammar Serialization</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_container.html">pt::peg::container</a></td>
<td class="#tocright">PEG Storage</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_container_peg.html">pt::peg::container::peg</a></td>
<td class="#tocright">PEG Storage. Canned PEG grammar specification</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_export.html">pt::peg::export</a></td>
<td class="#tocright">PEG Export</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_export_container.html">pt::peg::export::container</a></td>
<td class="#tocright">PEG Export Plugin. Write CONTAINER format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_export_json.html">pt::peg::export::json</a></td>
<td class="#tocright">PEG Export Plugin. Write JSON format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_export_peg.html">pt::peg::export::peg</a></td>
<td class="#tocright">PEG Export Plugin. Write PEG format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_from_container.html">pt::peg::from::container</a></td>
<td class="#tocright">PEG Conversion. From CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_from_json.html">pt::peg::from::json</a></td>
<td class="#tocright">PEG Conversion. Read JSON format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_from_peg.html">pt::peg::from::peg</a></td>
<td class="#tocright">PEG Conversion. Read PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_import.html">pt::peg::import</a></td>
<td class="#tocright">PEG Import</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_import_container.html">pt::peg::import::container</a></td>
<td class="#tocright">PEG Import Plugin. From CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_import_json.html">pt::peg::import::json</a></td>
<td class="#tocright">PEG Import Plugin. Read JSON format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_import_peg.html">pt::peg::import::peg</a></td>
<td class="#tocright">PEG Import Plugin. Read PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_interp.html">pt::peg::interp</a></td>
<td class="#tocright">Interpreter for parsing expression grammars</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_container.html">pt::peg::to::container</a></td>
<td class="#tocright">PEG Conversion. Write CONTAINER format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_cparam.html">pt::peg::to::cparam</a></td>
<td class="#tocright">PEG Conversion. Write CPARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_json.html">pt::peg::to::json</a></td>
<td class="#tocright">PEG Conversion. Write JSON format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_param.html">pt::peg::to::param</a></td>
<td class="#tocright">PEG Conversion. Write PARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_peg.html">pt::peg::to::peg</a></td>
<td class="#tocright">PEG Conversion. Write PEG format</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_to_tclparam.html">pt::peg::to::tclparam</a></td>
<td class="#tocright">PEG Conversion. Write TCLPARAM format</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_language.html">pt::peg_language</a></td>
<td class="#tocright">PEG Language Tutorial</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_peg_introduction.html">pt::pegrammar</a></td>
<td class="#tocright">Introduction to Parsing Expression Grammars</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_pgen.html">pt::pgen</a></td>
<td class="#tocright">Parser Generator</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_rdengine.html">pt::rde</a></td>
<td class="#tocright">Parsing Runtime Support, PARAM based</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_tclparam_config_snit.html">pt::tclparam::configuration::snit</a></td>
<td class="#tocright">Tcl/PARAM, Canned configuration, Snit</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_tclparam_config_tcloo.html">pt::tclparam::configuration::tcloo</a></td>
<td class="#tocright">Tcl/PARAM, Canned configuration, Tcloo</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_to_api.html">pt_export_api</a></td>
<td class="#tocright">Parser Tools Export API</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_from_api.html">pt_import_api</a></td>
<td class="#tocright">Parser Tools Import API</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_introduction.html">pt_introduction</a></td>
<td class="#tocright">Introduction to Parser Tools</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/pt/pt_parser_api.html">pt_parser_api</a></td>
<td class="#tocright">Parser API</td>
</tr>
</table></dl>
<dl><dt>rc4<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/rc4/rc4.html">rc4</a></td>
<td class="#tocright">Implementation of the RC4 stream cipher</td>
</tr>
</table></dl>
<dl><dt>rcs<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/rcs/rcs.html">rcs</a></td>
<td class="#tocright">RCS low level utilities</td>
</tr>
</table></dl>
<dl><dt>report<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/report/report.html">report</a></td>
<td class="#tocright">Create and manipulate report objects</td>
</tr>
</table></dl>
<dl><dt>rest<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/rest/rest.html">rest</a></td>
<td class="#tocright">define REST web APIs and call them inline or asychronously</td>
</tr>
</table></dl>
<dl><dt>ripemd<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/ripemd/ripemd128.html">ripemd128</a></td>
<td class="#tocright">RIPEMD-128 Message-Digest Algorithm</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/ripemd/ripemd160.html">ripemd160</a></td>
<td class="#tocright">RIPEMD-160 Message-Digest Algorithm</td>
</tr>
</table></dl>
<dl><dt>sasl<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/sasl/sasl.html">SASL</a></td>
<td class="#tocright">Implementation of SASL mechanisms for Tcl</td>
</tr>
</table></dl>
<dl><dt>sha1<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/sha1/sha1.html">sha1</a></td>
<td class="#tocright">SHA1 Message-Digest Algorithm</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/sha1/sha256.html">sha256</a></td>
<td class="#tocright">SHA256 Message-Digest Algorithm</td>
</tr>
</table></dl>
<dl><dt>simulation<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/simulation/annealing.html">simulation::annealing</a></td>
<td class="#tocright">Simulated annealing</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/simulation/montecarlo.html">simulation::montecarlo</a></td>
<td class="#tocright">Monte Carlo simulations</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/simulation/simulation_random.html">simulation::random</a></td>
<td class="#tocright">Pseudo-random number generators</td>
</tr>
</table></dl>
<dl><dt>smtpd<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/smtpd/smtpd.html">smtpd</a></td>
<td class="#tocright">Tcl SMTP server implementation</td>
</tr>
</table></dl>
<dl><dt>snit<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/snit/snit.html">snit</a></td>
<td class="#tocright">Snit's Not Incr Tcl</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/snit/snitfaq.html">snitfaq</a></td>
<td class="#tocright">Snit Frequently Asked Questions</td>
</tr>
</table></dl>
<dl><dt>soundex<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/soundex/soundex.html">soundex</a></td>
<td class="#tocright">Soundex</td>
</tr>
</table></dl>
<dl><dt>stooop<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/stooop/stooop.html">stooop</a></td>
<td class="#tocright">Object oriented extension.</td>
</tr>
</table></dl>
<dl><dt>stringprep<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/stringprep/stringprep.html">stringprep</a></td>
<td class="#tocright">Implementation of stringprep</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/stringprep/stringprep_data.html">stringprep::data</a></td>
<td class="#tocright">stringprep data tables, generated, internal</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/stringprep/unicode.html">unicode</a></td>
<td class="#tocright">Implementation of Unicode normalization</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/stringprep/unicode_data.html">unicode::data</a></td>
<td class="#tocright">unicode data tables, generated, internal</td>
</tr>
</table></dl>
<dl><dt>struct<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/disjointset.html">struct::disjointset</a></td>
<td class="#tocright">Disjoint set data structure</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/graph.html">struct::graph</a></td>
<td class="#tocright">Create and manipulate directed graph objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/graphops.html">struct::graph::op</a></td>
<td class="#tocright">Operation for (un)directed graph objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/graph1.html">struct::graph_v1</a></td>
<td class="#tocright">Create and manipulate directed graph objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/struct_list.html">struct::list</a></td>
<td class="#tocright">Procedures for manipulating lists</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/matrix.html">struct::matrix</a></td>
<td class="#tocright">Create and manipulate matrix objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/matrix1.html">struct::matrix_v1</a></td>
<td class="#tocright">Create and manipulate matrix objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/pool.html">struct::pool</a></td>
<td class="#tocright">Create and manipulate pool objects (of discrete items)</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/prioqueue.html">struct::prioqueue</a></td>
<td class="#tocright">Create and manipulate prioqueue objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/queue.html">struct::queue</a></td>
<td class="#tocright">Create and manipulate queue objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/record.html">struct::record</a></td>
<td class="#tocright">Define and create records (similar to 'C' structures)</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/struct_set.html">struct::set</a></td>
<td class="#tocright">Procedures for manipulating sets</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/skiplist.html">struct::skiplist</a></td>
<td class="#tocright">Create and manipulate skiplists</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/stack.html">struct::stack</a></td>
<td class="#tocright">Create and manipulate stack objects</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/struct_tree.html">struct::tree</a></td>
<td class="#tocright">Create and manipulate tree objects</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/struct/struct_tree1.html">struct::tree_v1</a></td>
<td class="#tocright">Create and manipulate tree objects</td>
</tr>
</table></dl>
<dl><dt>tar<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tar/tar.html">tar</a></td>
<td class="#tocright">Tar file creation, extraction &amp; manipulation</td>
</tr>
</table></dl>
<dl><dt>tepam<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tepam/tepam_introduction.html">tepam</a></td>
<td class="#tocright">An introduction into TEPAM, Tcl's Enhanced Procedure and Argument Manager</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/tepam/tepam_argument_dialogbox.html">tepam::argument_dialogbox</a></td>
<td class="#tocright">TEPAM argument_dialogbox, reference manual</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tepam/tepam_procedure.html">tepam::procedure</a></td>
<td class="#tocright">TEPAM procedure, reference manual</td>
</tr>
</table></dl>
<dl><dt>term<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/term.html">term</a></td>
<td class="#tocright">General terminal control</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_code.html">term::ansi::code</a></td>
<td class="#tocright">Helper for control sequences</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_cattr.html">term::ansi::code::attr</a></td>
<td class="#tocright">ANSI attribute sequences</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_cctrl.html">term::ansi::code::ctrl</a></td>
<td class="#tocright">ANSI control sequences</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_cmacros.html">term::ansi::code::macros</a></td>
<td class="#tocright">Macro sequences</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_ctrlu.html">term::ansi::ctrl::unix</a></td>
<td class="#tocright">Control operations and queries</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ansi_send.html">term::ansi::send</a></td>
<td class="#tocright">Output of ANSI control sequences to terminals</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/imenu.html">term::interact::menu</a></td>
<td class="#tocright">Terminal widget, menu</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/ipager.html">term::interact::pager</a></td>
<td class="#tocright">Terminal widget, paging</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/receive.html">term::receive</a></td>
<td class="#tocright">General input from terminals</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/term/term_bind.html">term::receive::bind</a></td>
<td class="#tocright">Keyboard dispatch from terminals</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/term/term_send.html">term::send</a></td>
<td class="#tocright">General output to terminals</td>
</tr>
</table></dl>
<dl><dt>textutil<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/textutil.html">textutil</a></td>
<td class="#tocright">Procedures to manipulate texts and strings.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/adjust.html">textutil::adjust</a></td>
<td class="#tocright">Procedures to adjust, indent, and undent paragraphs</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/expander.html">textutil::expander</a></td>
<td class="#tocright">Procedures to process templates and expand text.</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/repeat.html">textutil::repeat</a></td>
<td class="#tocright">Procedures to repeat strings.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/textutil_split.html">textutil::split</a></td>
<td class="#tocright">Procedures to split texts</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/textutil_string.html">textutil::string</a></td>
<td class="#tocright">Procedures to manipulate texts and strings.</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/tabify.html">textutil::tabify</a></td>
<td class="#tocright">Procedures to (un)tabify strings</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/textutil/trim.html">textutil::trim</a></td>
<td class="#tocright">Procedures to trim strings</td>
</tr>
</table></dl>
<dl><dt>tie<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tie/tie.html">tie</a></td>
<td class="#tocright">Array persistence</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/tie/tie_std.html">tie</a></td>
<td class="#tocright">Array persistence, standard data sources</td>
</tr>
</table></dl>
<dl><dt>tiff<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/tiff/tiff.html">tiff</a></td>
<td class="#tocright">TIFF reading, writing, and querying and manipulation of meta data</td>
</tr>
</table></dl>
<dl><dt>transfer<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/connect.html">transfer::connect</a></td>
<td class="#tocright">Connection setup</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/copyops.html">transfer::copy</a></td>
<td class="#tocright">Data transfer foundation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/tqueue.html">transfer::copy::queue</a></td>
<td class="#tocright">Queued transfers</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/ddest.html">transfer::data::destination</a></td>
<td class="#tocright">Data destination</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/dsource.html">transfer::data::source</a></td>
<td class="#tocright">Data source</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/receiver.html">transfer::receiver</a></td>
<td class="#tocright">Data source</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/transfer/transmitter.html">transfer::transmitter</a></td>
<td class="#tocright">Data source</td>
</tr>
</table></dl>
<dl><dt>treeql<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/treeql/treeql.html">treeql</a></td>
<td class="#tocright">Query tree objects</td>
</tr>
</table></dl>
<dl><dt>try<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/try/tcllib_try.html">try</a></td>
<td class="#tocright">try - Trap and process errors and exceptions</td>
</tr>
</table></dl>
<dl><dt>uev<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/uev/uevent.html">uevent</a></td>
<td class="#tocright">User events</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/uev/uevent_onidle.html">uevent::onidle</a></td>
<td class="#tocright">Request merging and deferal to idle time</td>
</tr>
</table></dl>
<dl><dt>units<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/units/units.html">units</a></td>
<td class="#tocright">unit conversion</td>
</tr>
</table></dl>
<dl><dt>uri<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/uri/uri.html">uri</a></td>
<td class="#tocright">URI utilities</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/uri/urn-scheme.html">uri_urn</a></td>
<td class="#tocright">URI utilities, URN scheme</td>
</tr>
</table></dl>
<dl><dt>uuid<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/uuid/uuid.html">uuid</a></td>
<td class="#tocright">UUID generation and comparison</td>
</tr>
</table></dl>
<dl><dt>valtype<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/valtype_common.html">valtype::common</a></td>
<td class="#tocright">Validation, common code</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/cc_amex.html">valtype::creditcard::amex</a></td>
<td class="#tocright">Validation for AMEX creditcard number</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/cc_discover.html">valtype::creditcard::discover</a></td>
<td class="#tocright">Validation for Discover creditcard number</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/cc_mastercard.html">valtype::creditcard::mastercard</a></td>
<td class="#tocright">Validation for Mastercard creditcard number</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/cc_visa.html">valtype::creditcard::visa</a></td>
<td class="#tocright">Validation for VISA creditcard number</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/ean13.html">valtype::gs1::ean13</a></td>
<td class="#tocright">Validation for EAN13</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/iban.html">valtype::iban</a></td>
<td class="#tocright">Validation for IBAN</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/imei.html">valtype::imei</a></td>
<td class="#tocright">Validation for IMEI</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/isbn.html">valtype::isbn</a></td>
<td class="#tocright">Validation for ISBN</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/luhn.html">valtype::luhn</a></td>
<td class="#tocright">Validation for plain number with a LUHN checkdigit</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/luhn5.html">valtype::luhn5</a></td>
<td class="#tocright">Validation for plain number with a LUHN5 checkdigit</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/usnpi.html">valtype::usnpi</a></td>
<td class="#tocright">Validation for USNPI</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/valtype/verhoeff.html">valtype::verhoeff</a></td>
<td class="#tocright">Validation for plain number with a VERHOEFF checkdigit</td>
</tr>
</table></dl>
<dl><dt>virtchannel_base<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/cat.html">tcl::chan::cat</a></td>
<td class="#tocright">Concatenation channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/facade.html">tcl::chan::facade</a></td>
<td class="#tocright">Facade channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/fifo.html">tcl::chan::fifo</a></td>
<td class="#tocright">In-memory fifo channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/fifo2.html">tcl::chan::fifo2</a></td>
<td class="#tocright">In-memory interconnected fifo channels</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/halfpipe.html">tcl::chan::halfpipe</a></td>
<td class="#tocright">In-memory channel, half of a fifo2</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/memchan.html">tcl::chan::memchan</a></td>
<td class="#tocright">In-memory channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/null.html">tcl::chan::null</a></td>
<td class="#tocright">Null channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/nullzero.html">tcl::chan::nullzero</a></td>
<td class="#tocright">Null/Zero channel combination</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/random.html">tcl::chan::random</a></td>
<td class="#tocright">Random channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/randseed.html">tcl::chan::randseed</a></td>
<td class="#tocright">Utilities for random channels</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/std.html">tcl::chan::std</a></td>
<td class="#tocright">Standard I/O, unification of stdin and stdout</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/string.html">tcl::chan::string</a></td>
<td class="#tocright">Read-only in-memory channel</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/textwindow.html">tcl::chan::textwindow</a></td>
<td class="#tocright">Textwindow channel</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/variable.html">tcl::chan::variable</a></td>
<td class="#tocright">In-memory channel using variable for storage</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_base/zero.html">tcl::chan::zero</a></td>
<td class="#tocright">Zero channel</td>
</tr>
</table></dl>
<dl><dt>virtchannel_core<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_core/core.html">tcl::chan::core</a></td>
<td class="#tocright">Basic reflected/virtual channel support</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_core/events.html">tcl::chan::events</a></td>
<td class="#tocright">Event support for reflected/virtual channels</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_core/transformcore.html">tcl::transform::core</a></td>
<td class="#tocright">Basic reflected/virtual channel transform support</td>
</tr>
</table></dl>
<dl><dt>virtchannel_transform<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/adler32.html">tcl::transform::adler32</a></td>
<td class="#tocright">Adler32 transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/base64.html">tcl::transform::base64</a></td>
<td class="#tocright">Base64 encoding transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/counter.html">tcl::transform::counter</a></td>
<td class="#tocright">Counter transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/crc32.html">tcl::transform::crc32</a></td>
<td class="#tocright">Crc32 transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/hex.html">tcl::transform::hex</a></td>
<td class="#tocright">Hexadecimal encoding transformation</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/identity.html">tcl::transform::identity</a></td>
<td class="#tocright">Identity transformation</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/limitsize.html">tcl::transform::limitsize</a></td>
<td class="#tocright">limiting input</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/observe.html">tcl::transform::observe</a></td>
<td class="#tocright">Observer transformation, stream copy</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/otp.html">tcl::transform::otp</a></td>
<td class="#tocright">Encryption via one-time pad</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/rot.html">tcl::transform::rot</a></td>
<td class="#tocright">rot-encryption</td>
</tr>
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/spacer.html">tcl::transform::spacer</a></td>
<td class="#tocright">Space insertation and removal</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/virtchannel_transform/zlib.html">tcl::transform::zlib</a></td>
<td class="#tocright">zlib (de)compression</td>
</tr>
</table></dl>
<dl><dt>wip<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/wip/wip.html">wip</a></td>
<td class="#tocright">Word Interpreter</td>
</tr>
</table></dl>
<dl><dt>yaml<dd>
<table class="#toc">
<tr class="#toceven" >
<td class="#tocleft" ><a href="tcllib/files/modules/yaml/huddle.html">huddle</a></td>
<td class="#tocright">Create and manipulate huddle object</td>
</tr>
<tr class="#tocodd"  >
<td class="#tocleft" ><a href="tcllib/files/modules/yaml/yaml.html">yaml</a></td>
<td class="#tocright">YAML Format Encoder/Decoder</td>
</tr>
</table></dl></table></dl></table></dl>
</dl><hr></body></html>

Changes to modules/amazon-s3/ChangeLog.






1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
12
+
+
+
+
+







2013-02-08  Andreas Kupries  <[email protected]>

	* xsxp.man: Fixed moddesc/titledesc confusion.
	* S3.man: Ditto.

2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2011-12-13  Andreas Kupries  <[email protected]>

Changes to modules/amazon-s3/S3.man.

1
2


3
4
5
6
7
8
9
1

2
3
4
5
6
7
8
9
10

-
+
+







[manpage_begin S3 n 1.0.0]
[moddesc {Amazon S3 Web Service Interface}]
[moddesc {Amazon S3 Web Service Utilities}]
[titledesc {Amazon S3 Web Service Interface}]
[category  Networking]
[copyright {Copyright 2006,2008 Darren New. All Rights Reserved. See LICENSE.TXT for terms.}]
[require Tcl 8.5]
[require sha1 1.0]
[require md5 2.0]
[require base64 2.3]
[require xsxp 1.0]

Changes to modules/amazon-s3/xsxp.man.

1

2

3
4
5
6
7
8
9
1
2

3
4
5
6
7
8
9
10

+
-
+







[manpage_begin xsxp n 1.0]
[moddesc {Amazon S3 Web Service Utilities}]
[moddesc {eXtremely Simple Xml Parser}]
[titledesc {eXtremely Simple Xml Parser}]
[copyright {Copyright 2006 Darren New. All Rights Reserved.}]
[category  {Text processing}]
[require Tcl 8.4]
[require xml]
[keywords xml dom parser]
[description]
This package provides a simple interface to parse XML into a pure-value list.

Changes to modules/coroutine/ChangeLog.






1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
12
+
+
+
+
+







2013-02-08  Andreas Kupries  <[email protected]>

	* coroutine.man: Fixed missing short package title.
	* coro_auto.man: Ditto.

2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2011-12-13  Andreas Kupries  <[email protected]>

Changes to modules/coroutine/coro_auto.man.

1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3
4
5

6
7
8
9
10
11
12
13





-
+







[comment {-*- tcl -*- doctools manpage}]
[manpage_begin coroutine::auto n 1]
[copyright {2010-2011 Andreas Kupries <[email protected]>}]
[moddesc   {Coroutine utilities}]
[category  Coroutine]
[titledesc {}]
[titledesc {Automatic event and IO coroutine awareness}]
[require Tcl 8.6]
[require coroutine::auto 1.1]
[require coroutine 1.1]
[description]
[keywords coroutine global exit after vwait update gets read]
[keywords channel threads {green threads} events]

Changes to modules/coroutine/coroutine.man.

1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3
4
5

6
7
8
9
10
11
12
13





-
+







[comment {-*- tcl -*- doctools manpage}]
[manpage_begin coroutine n 1]
[copyright {2010-2011 Andreas Kupries <[email protected]>}]
[moddesc   {Coroutine utilities}]
[category  Coroutine]
[titledesc {}]
[titledesc {Coroutine based event and IO handling}]
[require Tcl 8.6]
[require coroutine 1.1]
[description]
[keywords coroutine channel events threads {green threads}]
[keywords global exit after vwait update gets read]

The [package coroutine] package provides coroutine-aware

Changes to modules/gpx/ChangeLog.





1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
+
+
+
+







2013-02-08  Andreas Kupries  <[email protected]>

	* gpx.man: Fixed categorization.

2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2011-12-13  Andreas Kupries  <[email protected]>

Changes to modules/gpx/gpx.man.

1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3
4
5

6
7
8
9
10
11
12
13





-
+







[comment {-*- tcl -*- doctools manpage}]
[manpage_begin gpx n 0.9]
[copyright {2010, Keith Vetter <[email protected]>}]
[moddesc {GPS eXchange Format (GPX)}]
[titledesc {Extracts waypoints, tracks and routes from GPX files}]
[category  {gpx, gpx}]
[category  {File formats}]
[require Tcl 8.5]
[require gpx [opt 0.9]]
[description]
[para]

This module parses and extracts waypoints, tracks, routes and
metadata from a GPX (GPS eXchange) file. Both GPX version 1.0

Changes to modules/grammar_aycock/ChangeLog.





1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
+
+
+
+







2013-02-08  Andreas Kupries  <[email protected]>

	* aycock.man: Fixed missing short package title.

2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2011-12-13  Andreas Kupries  <[email protected]>

Changes to modules/grammar_aycock/aycock.man.

1
2

3
4
5
6

7
8
9
10
11
12
13
1

2
3
4
5
6
7
8
9
10
11
12
13
14

-
+




+







[comment {-*- tcl -*- doctools manpage}]
[manpage_begin aycock n 1.0]
[manpage_begin grammar::aycock n 1.0]
[copyright "2006 by Kevin B. Kenny <[email protected]>
Redistribution permitted under the terms of the Open\
Publication License <http://www.opencontent.org/openpub/>"]
[moddesc "Aycock-Horspool-Earley parser generator for Tcl"]
[titledesc "Aycock-Horspool-Earley parser generator for Tcl"]
[category "Grammars and finite automata"]
[require Tcl 8.5]
[require grammar::aycock [opt 1.0]]
[description]
[keywords grammar parser aycock earley horspool]
[keywords ambiguous parsing transducer]
[para]

Changes to modules/math/ChangeLog.






1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
12
+
+
+
+
+







2013-02-08  Andreas Kupries  <[email protected]>

	* decimal.man: Fixed leading namespace qualifier in label.
	* symdiff.man: Fixed missing short package title.

2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2012-06-25  Arjen Markus <[email protected]>

Changes to modules/math/decimal.man.

1
2

3
4
5
6
7
8
9
1

2
3
4
5
6
7
8
9

-
+







[comment {-*- tcl -*- doctools manpage}]
[manpage_begin ::math::decimal n 1.0.2]
[manpage_begin math::decimal n 1.0.2]
[copyright {2011 Mark Alston <mark at beernut dot com>}]
[moddesc   {Tcl Decimal Arithmetic Library}]
[titledesc {General decimal arithmetic}]
[category  Mathematics]
[require Tcl [opt 8.5]]

[description]

Changes to modules/math/symdiff.man.

1

2
3
4
5

6
7
8
9
10
11
12

1
2
3
4
5
6
7
8
9
10
11
12
13
-
+




+







[manpage_begin symdiff n 1.0]
[manpage_begin math::calculus::symdiff n 1.0]
[copyright "2010 by Kevin B. Kenny <[email protected]>
Redistribution permitted under the terms of the Open\
Publication License <http://www.opencontent.org/openpub/>"]
[moddesc "Symbolic differentiation for Tcl"]
[titledesc "Symbolic differentiation for Tcl"]
[require Tcl 8.5]
[require grammar::aycock 1.0]
[require math::calculus::symdiff 1.0]
[description]
[para]
The [cmd math::calculus::symdiff] package provides a symbolic differentiation
facility for Tcl math expressions. It is useful for providing derivatives

Changes to modules/rc4/ChangeLog.





1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
+
+
+
+







2013-02-08  Andreas Kupries  <[email protected]>

	* rc4.man: fixed bogus trailing comma in list of keywords.

2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2011-12-13  Andreas Kupries  <[email protected]>

Changes to modules/rc4/rc4.man.

116
117
118
119
120
121
122
123

124
116
117
118
119
120
121
122

123
124







-
+

Please report such in the category [emph rc4] of the
[uri {http://sourceforge.net/tracker/?group_id=12883} {Tcllib SF Trackers}].

Please also report any ideas for enhancements you may have for either
package and/or documentation.


[keywords rc4 arcfour, {stream cipher} security encryption {data integrity}]
[keywords rc4 arcfour {stream cipher} security encryption {data integrity}]
[manpage_end]

Changes to support/devel/sak/doc/doc.tcl.

74
75
76
77
78
79
80

81
82

83
84
85
86
87
88
89
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90







+

-
+








    auto::saveKeywordIndex    kwic  name
    auto::saveTableOfContents title name cat apps mods
    return
}

proc ::sak::doc::imake {modules} {
    global base
    # The argument (= set of modules) is irrelevant to this command.
    auto::saveManpages [auto::findManpages]
    auto::saveManpages [auto::findManpages $base]
    return
}

proc ::sak::doc::ishow {modules} {
    if {[catch {
	set manpages [auto::loadManpages]
    } msg]} {

Changes to support/devel/sak/doc/doc_auto.tcl.

56
57
58
59
60
61
62

63
64
65
66
67
68
69
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70







+








proc ::sak::doc::auto::scanManpages {manpages} {
    ::doctools::new dt -format list
    set data {}
    puts Scanning...
    foreach page $manpages {
	puts ...$page
	dt configure -ibase $page
	lappend data $page [lindex [dt format [fileutil::cat $page]] 1]
    }

    dt destroy
    return $data
}

Changes to support/devel/sak/doc/kwic.txt.

1
2
3
4
5
6









7
8
9
10
11
12
13
14
15
16
17
18
19
20


21
22
23
24
25
26
27


28
29



30
31
32
33






34
35
36




37
38
39
40
41
42
43
44
45
46
47
48


49
50
51
52

53
54
55



56
57






58
59
60
61
62
63
64
65
66


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81




82
83
84
85
86
87
88
89
90
91








92
93
94
95
96
97


98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115


116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135


136
137


138
139
140
141
142
143
144



145
146
147
148
149
150
151


152
153
154
155



156


157
158





159
160
161
162














163
164
165
166
167
168
169
170
171
172
173

174
175
176
177


178
179
180
181
182
183
184













185
186
187
188
189
190
191
192
193
194
195
196
197
198
199














200
201
202
203
204






205
206




207
208
209
210
211
212
213
214
215






216
217
218
219
220
221
222
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56


57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257

258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314




315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348






+
+
+
+
+
+
+
+
+














+
+







+
+


+
+
+




+
+
+
+
+
+

-
-
+
+
+
+












+
+



-
+



+
+
+


+
+
+
+
+
+









+
+















+
+
+
+










+
+
+
+
+
+
+
+





-
+
+


















+
+




















+
+


+
+







+
+
+







+
+




+
+
+

+
+


+
+
+
+
+




+
+
+
+
+
+
+
+
+
+
+
+
+
+










-
+




+
+







+
+
+
+
+
+
+
+
+
+
+
+
+















+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
+
+
+
+
+
+


+
+
+
+









+
+
+
+
+
+







[index_begin {Keyword Index} {}]
[key .ddt]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[key .dtx]
[manpage modules/docstrip/docstrip.man docstrip]
[manpage apps/tcldocstrip.man          tcldocstrip]
[key /dev/null]
[manpage modules/virtchannel_base/null.man     tcl::chan::null]
[manpage modules/virtchannel_base/nullzero.man tcl::chan::nullzero]
[key /dev/random]
[manpage modules/virtchannel_base/random.man   tcl::chan::random]
[manpage modules/virtchannel_base/randseed.man tcl::chan::randseed]
[key /dev/zero]
[manpage modules/virtchannel_base/nullzero.man tcl::chan::nullzero]
[manpage modules/virtchannel_base/zero.man     tcl::chan::zero]
[key 3DES]
[manpage modules/des/des.man des]
[key {abstract syntax tree}]
[manpage modules/grammar_me/me_util.man grammar::me::util]
[manpage modules/grammar_me/me_ast.man  grammar::me_ast]
[key acceptance]
[manpage modules/grammar_fa/dacceptor.man grammar::fa::dacceptor]
[key acceptor]
[manpage modules/grammar_fa/dacceptor.man grammar::fa::dacceptor]
[key active]
[manpage modules/transfer/connect.man transfer::connect]
[key adaptors]
[manpage modules/snit/snit.man    snit]
[manpage modules/snit/snitfaq.man snitfaq]
[key {adjacency list}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {adjacency matrix}]
[manpage modules/struct/graphops.man struct::graph::op]
[key adjacent]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graphops.man struct::graph::op]
[key adjusting]
[manpage modules/textutil/adjust.man textutil::adjust]
[key adler32]
[manpage modules/virtchannel_transform/adler32.man tcl::transform::adler32]
[key aes]
[manpage modules/aes/aes.man aes]
[key after]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key alias]
[manpage modules/interp/tcllib_interp.man interp]
[key amazon]
[manpage modules/amazon-s3/S3.man S3]
[key ambiguous]
[manpage modules/grammar_aycock/aycock.man grammar::aycock]
[key {American Express}]
[manpage modules/valtype/cc_amex.man valtype::creditcard::amex]
[key AMEX]
[manpage modules/valtype/cc_amex.man valtype::creditcard::amex]
[key angle]
[manpage modules/math/geometry.man math::geometry]
[manpage modules/units/units.man   units]
[manpage modules/math/math_geometry.man math::geometry]
[manpage modules/units/units.man        units]
[key {anonymous procedure}]
[manpage modules/lambda/lambda.man lambda]
[key ansi]
[manpage modules/term/ansi_cattr.man   term::ansi::code::attr]
[manpage modules/term/ansi_cctrl.man   term::ansi::code::ctrl]
[manpage modules/term/ansi_cmacros.man term::ansi::code::macros]
[manpage modules/term/ansi_ctrlu.man   term::ansi::ctrl::unix]
[key appender]
[manpage modules/log/loggerAppender.man logger::appender]
[manpage modules/log/loggerUtils.man    logger::utils]
[key application]
[manpage apps/nns.man    nns]
[manpage apps/nnsd.man   nnsd]
[manpage apps/nnslog.man nnslog]
[key {approximation algorithm}]
[manpage modules/struct/graphops.man struct::graph::op]
[key arc]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graphops.man struct::graph::op]
[key arcfour,]
[key arcfour]
[manpage modules/rc4/rc4.man rc4]
[key archive]
[manpage modules/tar/tar.man tar]
[key {argument integrity}]
[manpage modules/tepam/tepam_introduction.man tepam]
[manpage modules/tepam/tepam_procedure.man    tepam::procedure]
[key {argument processing}]
[manpage modules/cmdline/cmdline.man cmdline]
[key {argument validation}]
[manpage modules/tepam/tepam_introduction.man tepam]
[manpage modules/tepam/tepam_procedure.man    tepam::procedure]
[key arguments]
[manpage modules/tepam/tepam_introduction.man tepam]
[manpage modules/tepam/tepam_procedure.man    tepam::procedure]
[key argv]
[manpage modules/cmdline/cmdline.man cmdline]
[key argv0]
[manpage modules/cmdline/cmdline.man cmdline]
[key array]
[manpage modules/tie/tie.man     tie]
[manpage modules/tie/tie_std.man tie]
[key {articulation point}]
[manpage modules/struct/graphops.man struct::graph::op]
[key ascii85]
[manpage modules/base64/ascii85.man ascii85]
[key asn]
[manpage modules/asn/asn.man asn]
[key assembler]
[manpage modules/grammar_me/gasm.man grammar::me::cpu::gasm]
[key assert]
[manpage modules/control/control.man control]
[key assign]
[manpage modules/struct/struct_list.man struct::list]
[key AST]
[manpage modules/grammar_me/me_ast.man grammar::me_ast]
[key asynchronous]
[manpage modules/cache/async.man cache::async]
[key {attribute control}]
[manpage modules/term/ansi_cattr.man term::ansi::code::attr]
[manpage modules/term/ansi_cctrl.man term::ansi::code::ctrl]
[key {augmenting network}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {augmenting path}]
[manpage modules/struct/graphops.man struct::graph::op]
[key authentication]
[manpage modules/http/autoproxy.man autoproxy]
[manpage modules/sasl/sasl.man      SASL]
[key automatic]
[manpage modules/nns/nns_auto.man nameserv::auto]
[key automaton]
[manpage modules/grammar_fa/fa.man        grammar::fa]
[manpage modules/grammar_fa/dacceptor.man grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man     grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man      grammar::fa::op]
[key aycock]
[manpage modules/grammar_aycock/aycock.man grammar::aycock]
[key bank]
[manpage modules/valtype/cc_amex.man       valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man   valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man       valtype::creditcard::visa]
[manpage modules/valtype/iban.man          valtype::iban]
[key base32]
[manpage modules/base32/base32.man     base32]
[manpage modules/base32/base32core.man base32::core]
[manpage modules/base32/base32hex.man  base32::hex]
[key base64]
[manpage modules/base64/base64.man base64]
[manpage modules/base64/base64.man                base64]
[manpage modules/virtchannel_transform/base64.man tcl::transform::base64]
[key bee]
[manpage modules/bee/bee.man bee]
[key {bench language}]
[manpage modules/bench/bench_intro.man      bench_intro]
[manpage modules/bench/bench_lang_intro.man bench_lang_intro]
[manpage modules/bench/bench_lang_spec.man  bench_lang_spec]
[key benchmark]
[manpage modules/bench/bench.man            bench]
[manpage modules/bench/bench_read.man       bench::in]
[manpage modules/bench/bench_wcsv.man       bench::out::csv]
[manpage modules/bench/bench_wtext.man      bench::out::text]
[manpage modules/bench/bench_intro.man      bench_intro]
[manpage modules/bench/bench_lang_intro.man bench_lang_intro]
[manpage modules/bench/bench_lang_spec.man  bench_lang_spec]
[key ber]
[manpage modules/asn/asn.man asn]
[key {Bessel functions}]
[manpage modules/math/special.man math::special]
[key bfs]
[manpage modules/struct/graphops.man struct::graph::op]
[key bibliography]
[manpage modules/bibtex/bibtex.man bibtex]
[key bibtex]
[manpage modules/bibtex/bibtex.man bibtex]
[key bignums]
[manpage modules/math/bignum.man math::bignum]
[key bind]
[manpage modules/uev/uevent.man uevent]
[key bipartite]
[manpage modules/struct/graphops.man struct::graph::op]
[key BitTorrent]
[manpage modules/bee/bee.man bee]
[key bittorrent]
[manpage modules/bee/bee.man bee]
[key blanks]
[manpage modules/textutil/repeat.man textutil::repeat]
[key {block cipher}]
[manpage modules/aes/aes.man           aes]
[manpage modules/blowfish/blowfish.man blowfish]
[manpage modules/des/des.man           des]
[key {blocking flow}]
[manpage modules/struct/graphops.man struct::graph::op]
[key blowfish]
[manpage modules/blowfish/blowfish.man blowfish]
[key {Book Number}]
[manpage modules/valtype/isbn.man valtype::isbn]
[key breadth-first]
[manpage modules/struct/struct_tree.man struct::tree]
[key bridge]
[manpage modules/struct/graphops.man struct::graph::op]
[key BWidget]
[manpage modules/snit/snit.man    snit]
[manpage modules/snit/snitfaq.man snitfaq]
[key C]
[manpage modules/doctools2idx/msgcat_c.man doctools::msgcat::idx::c]
[manpage modules/doctools2toc/msgcat_c.man doctools::msgcat::toc::c]
[key C++]
[manpage modules/snit/snit.man     snit]
[manpage modules/snit/snitfaq.man  snitfaq]
[manpage modules/stooop/stooop.man stooop]
[key cache]
[manpage modules/cache/async.man          cache::async]
[manpage modules/map/map_slippy_cache.man map::slippy::cache]
[key {caesar cipher}]
[manpage modules/virtchannel_transform/rot.man tcl::transform::rot]
[key calculus]
[manpage modules/math/calculus.man math::calculus]
[key callback]
[manpage modules/cache/async.man       cache::async]
[manpage modules/hook/hook.man         hook]
[manpage modules/lambda/lambda.man     lambda]
[manpage modules/ooutil/ooutil.man     oo::util]
[manpage modules/uev/uevent_onidle.man uevent::onidle]
[key callbacks]
[manpage modules/virtchannel_base/halfpipe.man tcl::chan::halfpipe]
[key capitalize]
[manpage modules/textutil/textutil_string.man textutil::string]
[key {card for credit}]
[manpage modules/valtype/cc_amex.man       valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man   valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man       valtype::creditcard::visa]
[key cardinality]
[manpage modules/struct/struct_set.man struct::set]
[key cat]
[manpage modules/fileutil/fileutil.man fileutil]
[key {catalog package}]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man       doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man      doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man      doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man      doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_c.man       doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man      doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man      doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man      doctools::msgcat::toc::fr]
[key catalogue]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[key cell-phone]
[manpage modules/valtype/imei.man valtype::imei]
[key cer]
[manpage modules/asn/asn.man asn]
[key CFG]
[manpage modules/grammar_me/me_intro.man grammar::me_intro]
[key CFL]
[manpage modules/grammar_me/me_intro.man grammar::me_intro]
[key CGI]
[manpage modules/ncgi/ncgi.man ncgi]
[key cgraph]
[manpage modules/struct/graph.man  struct::graph]
[manpage modules/struct/graph1.man {struct::graph v1}]
[manpage modules/struct/graph1.man struct::graph_v1]
[key changelog]
[manpage modules/doctools/changelog.man doctools::changelog]
[manpage modules/doctools/cvs.man       doctools::cvs]
[key channel]
[manpage modules/coroutine/coroutine.man  coroutine]
[manpage modules/coroutine/coro_auto.man  coroutine::auto]
[manpage modules/transfer/connect.man     transfer::connect]
[manpage modules/transfer/copyops.man     transfer::copy]
[manpage modules/transfer/tqueue.man      transfer::copy::queue]
[manpage modules/transfer/ddest.man       transfer::data::destination]
[manpage modules/transfer/dsource.man     transfer::data::source]
[manpage modules/transfer/receiver.man    transfer::receiver]
[manpage modules/transfer/transmitter.man transfer::transmitter]
[key {channel transformation}]
[manpage modules/virtchannel_transform/adler32.man   tcl::transform::adler32]
[manpage modules/virtchannel_transform/base64.man    tcl::transform::base64]
[manpage modules/virtchannel_transform/counter.man   tcl::transform::counter]
[manpage modules/virtchannel_transform/crc32.man     tcl::transform::crc32]
[manpage modules/virtchannel_transform/hex.man       tcl::transform::hex]
[manpage modules/virtchannel_transform/identity.man  tcl::transform::identity]
[manpage modules/virtchannel_transform/limitsize.man tcl::transform::limitsize]
[manpage modules/virtchannel_transform/observe.man   tcl::transform::observe]
[manpage modules/virtchannel_transform/otp.man       tcl::transform::otp]
[manpage modules/virtchannel_transform/rot.man       tcl::transform::rot]
[manpage modules/virtchannel_transform/spacer.man    tcl::transform::spacer]
[manpage modules/virtchannel_transform/zlib.man      tcl::transform::zlib]
[key {character input}]
[manpage modules/term/receive.man   term::receive]
[manpage modules/term/term_bind.man term::receive::bind]
[key {character output}]
[manpage modules/term/ansi_send.man term::ansi::send]
[manpage modules/term/term_send.man term::send]
[key chat]
[manpage modules/irc/irc.man                 irc]
[manpage modules/multiplexer/multiplexer.man multiplexer]
[manpage modules/irc/picoirc.man             picoirc]
[key checkbox]
[manpage modules/html/html.man             html]
[manpage modules/javascript/javascript.man javascript]
[key checkbutton]
[manpage modules/html/html.man html]
[key Checking]
[manpage modules/valtype/valtype_common.man valtype::common]
[manpage modules/valtype/cc_amex.man        valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man    valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man  valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man        valtype::creditcard::visa]
[manpage modules/valtype/ean13.man          valtype::gs1::ean13]
[manpage modules/valtype/iban.man           valtype::iban]
[manpage modules/valtype/imei.man           valtype::imei]
[manpage modules/valtype/isbn.man           valtype::isbn]
[manpage modules/valtype/luhn.man           valtype::luhn]
[manpage modules/valtype/luhn5.man          valtype::luhn5]
[manpage modules/valtype/usnpi.man          valtype::usnpi]
[manpage modules/valtype/verhoeff.man       valtype::verhoeff]
[key checksum]
[manpage modules/crc/cksum.man cksum]
[manpage modules/crc/crc16.man crc16]
[manpage modules/crc/crc32.man crc32]
[manpage modules/crc/sum.man   sum]
[manpage modules/crc/cksum.man                     cksum]
[manpage modules/crc/crc16.man                     crc16]
[manpage modules/crc/crc32.man                     crc32]
[manpage modules/crc/sum.man                       sum]
[manpage modules/virtchannel_transform/adler32.man tcl::transform::adler32]
[manpage modules/virtchannel_transform/crc32.man   tcl::transform::crc32]
[key chop]
[manpage modules/textutil/textutil_string.man textutil::string]
[key cipher]
[manpage modules/pki/pki.man                   pki]
[manpage modules/virtchannel_transform/otp.man tcl::transform::otp]
[manpage modules/virtchannel_transform/rot.man tcl::transform::rot]
[key cksum]
[manpage modules/crc/cksum.man cksum]
[manpage modules/crc/crc16.man crc16]
[manpage modules/crc/crc32.man crc32]
[manpage modules/crc/sum.man   sum]
[key class]
[manpage modules/snit/snit.man     snit]
[manpage modules/snit/snitfaq.man  snitfaq]
[manpage modules/stooop/stooop.man stooop]
[key {class methods}]
[manpage modules/ooutil/ooutil.man oo::util]
[key {class variables}]
[manpage modules/ooutil/ooutil.man oo::util]
[key cleanup]
[manpage modules/try/tcllib_try.man try]
[key client]
[manpage modules/nns/nns_client.man nameserv]
[manpage modules/nns/nns_auto.man   nameserv::auto]
[manpage modules/nns/nns_common.man nameserv::common]
[manpage apps/nns.man               nns]
[manpage modules/nns/nns_intro.man  nns_intro]
[manpage apps/nnslog.man            nnslog]
231
232
233
234
235
236
237


238
239



240
241
242
243
244
245
246
247
248
249
250
251


252
253
254


255
256



257
258


259
260
261
262
263





264
265
266
267
268
269









































270
271
272
273
274
275
276
277
278
279
280
281
282
283


284
285
286
287
288
289
290
291
292
























293
294
295
296
297
298
299
300
301
302
303
304
305




306
307


308
309


310
311
312
313
314
315
316
317
318
319
320
321










322
323


324
325
326
327



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347


348
349
350
351




352
353
354
355
356
357

358
359
360
361
362
363
364
365
366
367
368
369





370
371





372
373
374
375
376
377


378
379
380
381
382
383
384
385
386
387
388
389







390
391
392

393

394
395
396
397
398
399
400
401
402
403
404
405
406
407
408


409
410
411
412
413
414
415
416
417
418



419
420
421
422
423
424
425













426
427
428
429
430
431
432
433
434
435
436
437
438
439
440

441
442
443
444
445
446
447
448
449





450
451








452
453
454
455
456
457
458
459
460
461
462
463
464
465
466

467
468
469
470
471
472
473
474



































475
476
477
478
479
480
481
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469








470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526




527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636

637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661



662
663
664
665
666
667
668
669


670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712


713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741



742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783







+
+


+
+
+












+
+



+
+


+
+
+


+
+





+
+
+
+
+



-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+














+
+

-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+













+
+
+
+


+
+


+
+








-
-
-
-
+
+
+
+
+
+
+
+
+
+


+
+




+
+
+




















+
+

-
-
-
+
+
+
+






+












+
+
+
+
+


+
+
+
+
+






+
+












+
+
+
+
+
+
+



+
-
+















+
+







-
-
-
+
+
+





-
-
+
+
+
+
+
+
+
+
+
+
+
+
+















+









+
+
+
+
+
-
-
+
+
+
+
+
+
+
+















+





-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







[manpage modules/term/ansi_ctrlu.man term::ansi::ctrl::unix]
[key comm]
[manpage modules/comm/comm.man           comm]
[manpage modules/comm/comm_wire.man      comm_wire]
[manpage modules/interp/deleg_method.man deleg_method]
[manpage modules/interp/deleg_proc.man   deleg_proc]
[manpage modules/nns/nns_protocol.man    nameserv::protocol]
[key command]
[manpage modules/doctools2base/tcl_parse.man doctools::tcl::parse]
[key {command line processing}]
[manpage modules/cmdline/cmdline.man cmdline]
[key {command prefix}]
[manpage modules/lambda/lambda.man lambda]
[manpage modules/ooutil/ooutil.man oo::util]
[key comment]
[manpage modules/jpeg/jpeg.man jpeg]
[manpage modules/png/png.man   png]
[key common]
[manpage modules/struct/struct_list.man struct::list]
[key {common prefix}]
[manpage modules/textutil/textutil_string.man textutil::string]
[key communication]
[manpage modules/comm/comm.man      comm]
[manpage modules/comm/comm_wire.man comm_wire]
[key comparison]
[manpage modules/struct/struct_list.man struct::list]
[key {complete graph}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {complex numbers}]
[manpage modules/math/qcomplex.man math::complexnumbers]
[manpage modules/math/fourier.man  math::fourier]
[key compression]
[manpage modules/virtchannel_transform/zlib.man tcl::transform::zlib]
[key computations]
[manpage modules/math/bigfloat.man math::bigfloat]
[key {concatenation channel}]
[manpage modules/virtchannel_base/cat.man    tcl::chan::cat]
[manpage modules/virtchannel_base/facade.man tcl::chan::facade]
[key {connected component}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {connected fifos}]
[manpage modules/virtchannel_base/fifo2.man tcl::chan::fifo2]
[key connection]
[manpage modules/transfer/connect.man transfer::connect]
[key constants]
[manpage modules/math/constants.man math::constants]
[manpage modules/units/units.man    units]
[key CONTAINER]
[manpage modules/pt/pt_peg_export_container.man pt::peg::export::container]
[manpage modules/pt/pt_peg_to_container.man     pt::peg::to::container]
[key contents]
[manpage modules/doctools2toc/introduction.man doctools2toc_introduction]
[key {context-free grammar}]
[manpage modules/grammar_me/me_intro.man grammar::me_intro]
[key {context-free languages}]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key control]
[manpage modules/control/control.man   control]
[manpage modules/term/term.man         term]
[manpage modules/term/ansi_code.man    term::ansi::code]
[manpage modules/term/ansi_cattr.man   term::ansi::code::attr]
[manpage modules/term/ansi_cctrl.man   term::ansi::code::ctrl]
[manpage modules/term/ansi_cmacros.man term::ansi::code::macros]
[manpage modules/term/ansi_ctrlu.man   term::ansi::ctrl::unix]
[manpage modules/term/ansi_send.man    term::ansi::send]
[manpage modules/term/imenu.man        term::interact::menu]
[manpage modules/term/ipager.man       term::interact::pager]
[manpage modules/term/receive.man      term::receive]
[manpage modules/term/term_bind.man    term::receive::bind]
[manpage modules/term/term_send.man    term::send]
[key {control structure}]
[manpage modules/generator/generator.man generator]
[key conversion]
[manpage modules/doctools/doctools.man doctools]
[manpage modules/doctools/docidx.man   doctools::idx]
[manpage modules/doctools/doctoc.man   doctools::toc]
[manpage apps/dtplite.man              dtplite]
[manpage modules/math/roman.man        math::roman]
[manpage modules/doctools/mpexpand.man mpexpand]
[manpage apps/tcldocstrip.man          tcldocstrip]
[manpage modules/units/units.man       units]
[manpage modules/doctools/doctools.man         doctools]
[manpage modules/doctools2idx/introduction.man doctools2idx_introduction]
[manpage modules/doctools2toc/introduction.man doctools2toc_introduction]
[manpage modules/doctools2idx/container.man    doctools::idx]
[manpage modules/doctools/docidx.man           doctools::idx]
[manpage modules/doctools2idx/export.man       doctools::idx::export]
[manpage modules/doctools2idx/import.man       doctools::idx::import]
[manpage modules/doctools2toc/container.man    doctools::toc]
[manpage modules/doctools/doctoc.man           doctools::toc]
[manpage modules/doctools2toc/export.man       doctools::toc::export]
[manpage modules/doctools2toc/import.man       doctools::toc::import]
[manpage apps/dtplite.man                      dtplite]
[manpage modules/math/roman.man                math::roman]
[manpage modules/doctools/mpexpand.man         mpexpand]
[manpage modules/pt/pt_peg_from_json.man       pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man        pt::peg::from::peg]
[manpage modules/pt/pt_peg_to_container.man    pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man       pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man         pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man        pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man          pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man     pt::peg::to::tclparam]
[manpage apps/tcldocstrip.man                  tcldocstrip]
[manpage modules/units/units.man               units]
[key cooked]
[manpage modules/term/ansi_ctrlu.man term::ansi::ctrl::unix]
[key cookie]
[manpage modules/ncgi/ncgi.man ncgi]
[key copy]
[manpage modules/fileutil/multi.man       fileutil::multi]
[manpage modules/fileutil/multiop.man     fileutil::multi::op]
[manpage modules/transfer/copyops.man     transfer::copy]
[manpage modules/transfer/tqueue.man      transfer::copy::queue]
[manpage modules/transfer/ddest.man       transfer::data::destination]
[manpage modules/transfer/dsource.man     transfer::data::source]
[manpage modules/transfer/receiver.man    transfer::receiver]
[manpage modules/transfer/transmitter.man transfer::transmitter]
[key coroutine]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[manpage modules/generator/generator.man generator]
[key Cost]
[manpage modules/treeql/treeql.man treeql]
[key counter]
[manpage modules/virtchannel_transform/counter.man tcl::transform::counter]
[key counting]
[manpage modules/counter/counter.man counter]
[key CPARAM]
[manpage modules/pt/pt_peg_to_cparam.man pt::peg::to::cparam]
[key crc]
[manpage modules/crc/cksum.man cksum]
[manpage modules/crc/crc16.man crc16]
[manpage modules/crc/crc32.man crc32]
[manpage modules/crc/sum.man   sum]
[key crc16]
[manpage modules/crc/crc16.man crc16]
[key crc32]
[manpage modules/crc/cksum.man cksum]
[manpage modules/crc/crc16.man crc16]
[manpage modules/crc/crc32.man crc32]
[manpage modules/crc/sum.man   sum]
[manpage modules/crc/cksum.man                   cksum]
[manpage modules/crc/crc16.man                   crc16]
[manpage modules/crc/crc32.man                   crc32]
[manpage modules/crc/sum.man                     sum]
[manpage modules/virtchannel_transform/crc32.man tcl::transform::crc32]
[key {credit card}]
[manpage modules/valtype/cc_amex.man       valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man   valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man       valtype::creditcard::visa]
[key cryptography]
[manpage modules/blowfish/blowfish.man blowfish]
[key CSS]
[manpage modules/doctools2base/html_cssdefaults.man doctools::html::cssdefaults]
[key csv]
[manpage modules/bench/bench_read.man bench::in]
[manpage modules/bench/bench_wcsv.man bench::out::csv]
[manpage modules/csv/csv.man          csv]
[key currying]
[manpage modules/lambda/lambda.man lambda]
[manpage modules/ooutil/ooutil.man oo::util]
[key {cut edge}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {cut vertex}]
[manpage modules/struct/graphops.man struct::graph::op]
[key CVS]
[manpage modules/rcs/rcs.man rcs]
[key cvs]
[manpage modules/doctools/cvs.man doctools::cvs]
[key {cvs log}]
[manpage modules/doctools/cvs.man doctools::cvs]
[key {cyclic redundancy check}]
[manpage modules/crc/cksum.man cksum]
[manpage modules/crc/crc16.man crc16]
[manpage modules/crc/crc32.man crc32]
[manpage modules/crc/sum.man   sum]
[key {data analysis}]
[manpage modules/math/statistics.man math::statistics]
[key {data destination}]
[manpage modules/transfer/ddest.man    transfer::data::destination]
[manpage modules/transfer/receiver.man transfer::receiver]
[key {data entry form}]
[manpage modules/tepam/tepam_argument_dialogbox.man tepam::argument_dialogbox]
[key {data exchange}]
[manpage modules/yaml/huddle.man huddle]
[manpage modules/json/json.man   json]
[manpage modules/yaml/yaml.man   yaml]
[manpage modules/yaml/huddle.man     huddle]
[manpage modules/json/json.man       json]
[manpage modules/json/json_write.man json::write]
[manpage modules/yaml/yaml.man       yaml]
[key {data integrity}]
[manpage modules/aes/aes.man   aes]
[manpage modules/crc/cksum.man cksum]
[manpage modules/crc/crc16.man crc16]
[manpage modules/crc/crc32.man crc32]
[manpage modules/des/des.man   des]
[manpage modules/pki/pki.man   pki]
[manpage modules/rc4/rc4.man   rc4]
[manpage modules/crc/sum.man   sum]
[key {data source}]
[manpage modules/transfer/dsource.man     transfer::data::source]
[manpage modules/transfer/transmitter.man transfer::transmitter]
[key {data structures}]
[manpage modules/struct/record.man struct::record]
[key database]
[manpage modules/tie/tie.man     tie]
[manpage modules/tie/tie_std.man tie]
[key dataflow]
[manpage modules/page/page_util_flow.man page_util_flow]
[key DE]
[manpage modules/doctools2idx/msgcat_de.man doctools::msgcat::idx::de]
[manpage modules/doctools2toc/msgcat_de.man doctools::msgcat::toc::de]
[key decimal]
[manpage modules/math/decimal.man math::decimal]
[key declare]
[manpage modules/term/ansi_code.man term::ansi::code]
[key decompression]
[manpage modules/virtchannel_transform/zlib.man tcl::transform::zlib]
[key decryption]
[manpage modules/virtchannel_transform/otp.man tcl::transform::otp]
[manpage modules/virtchannel_transform/rot.man tcl::transform::rot]
[key deferal]
[manpage modules/uev/uevent_onidle.man uevent::onidle]
[key define]
[manpage modules/term/ansi_code.man term::ansi::code]
[key degree]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graphops.man struct::graph::op]
[key {degree constrained spanning tree}]
[manpage modules/struct/graphops.man struct::graph::op]
[key degrees]
[manpage modules/math/constants.man math::constants]
[key delegation]
[manpage modules/interp/deleg_method.man deleg_method]
[manpage modules/interp/deleg_proc.man   deleg_proc]
[key depth-first]
[manpage modules/struct/struct_tree.man struct::tree]
[key der]
[manpage modules/asn/asn.man asn]
[key DES]
[manpage modules/des/des.man des]
[key deserialization]
[manpage modules/doctools2idx/import_docidx.man doctools::idx::import::docidx]
[manpage modules/doctools2idx/import_json.man   doctools::idx::import::json]
[manpage modules/doctools2idx/structure.man     doctools::idx::structure]
[manpage modules/doctools2toc/import_doctoc.man doctools::toc::import::doctoc]
[manpage modules/doctools2toc/import_json.man   doctools::toc::import::json]
[manpage modules/doctools2toc/structure.man     doctools::toc::structure]
[key diameter]
[manpage modules/struct/graphops.man struct::graph::op]
[key diff]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[manpage modules/struct/struct_list.man struct::list]
[manpage modules/struct/struct_list.man     struct::list]
[key {diff -n format}]
[manpage modules/rcs/rcs.man rcs]
[key difference]
[manpage modules/struct/struct_set.man struct::set]
[key differential]
[manpage modules/struct/struct_list.man struct::list]
[key {differential equations}]
[manpage modules/math/calculus.man math::calculus]
[key dijkstra]
[manpage modules/struct/graphops.man struct::graph::op]
[key {directory access}]
[manpage modules/ldap/ldap.man  ldap]
[manpage modules/ldap/ldapx.man ldapx]
[key {directory traversal}]
[manpage modules/fileutil/traverse.man fileutil_traverse]
[key Discover]
[manpage modules/valtype/cc_discover.man valtype::creditcard::discover]
[key {discrete items}]
[manpage modules/struct/pool.man struct::pool]
[key {disjoint set}]
[manpage modules/struct/disjointset.man struct::disjointset]
[key dispatcher]
[manpage modules/term/term_bind.man term::receive::bind]
[key distance]
[manpage modules/math/geometry.man   math::geometry]
[manpage modules/struct/graphops.man struct::graph::op]
[manpage modules/units/units.man     units]
[manpage modules/math/math_geometry.man math::geometry]
[manpage modules/struct/graphops.man    struct::graph::op]
[manpage modules/units/units.man        units]
[key DNS]
[manpage modules/dns/tcllib_dns.man dns]
[key do]
[manpage modules/control/control.man control]
[key docidx]
[manpage modules/doctools/docidx.man doctools::idx]
[manpage apps/dtplite.man            dtplite]
[manpage modules/doctools/docidx.man             doctools::idx]
[manpage modules/doctools2idx/export.man         doctools::idx::export]
[manpage modules/doctools2idx/export_docidx.man  doctools::idx::export::docidx]
[manpage modules/doctools2idx/import.man         doctools::idx::import]
[manpage modules/doctools2idx/import_docidx.man  doctools::idx::import::docidx]
[manpage modules/doctools2idx/parse.man          doctools::idx::parse]
[manpage modules/doctools2idx/structure.man      doctools::idx::structure]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man       doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man      doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man      doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man      doctools::msgcat::idx::fr]
[manpage apps/dtplite.man                        dtplite]
[key {docidx commands}]
[manpage modules/doctools/docidx_lang_cmdref.man docidx_lang_cmdref]
[manpage modules/doctools/docidx_lang_faq.man    docidx_lang_faq]
[manpage modules/doctools/docidx_lang_intro.man  docidx_lang_intro]
[manpage modules/doctools/docidx_lang_syntax.man docidx_lang_syntax]
[key {docidx language}]
[manpage modules/doctools/docidx_lang_cmdref.man docidx_lang_cmdref]
[manpage modules/doctools/docidx_lang_faq.man    docidx_lang_faq]
[manpage modules/doctools/docidx_lang_intro.man  docidx_lang_intro]
[manpage modules/doctools/docidx_lang_syntax.man docidx_lang_syntax]
[key {docidx markup}]
[manpage modules/doctools/docidx_lang_cmdref.man docidx_lang_cmdref]
[manpage modules/doctools/docidx_lang_faq.man    docidx_lang_faq]
[manpage modules/doctools/docidx_lang_intro.man  docidx_lang_intro]
[manpage modules/doctools/docidx_lang_syntax.man docidx_lang_syntax]
[manpage modules/doctools2idx/container.man      doctools::idx]
[key {docidx syntax}]
[manpage modules/doctools/docidx_lang_faq.man    docidx_lang_faq]
[manpage modules/doctools/docidx_lang_intro.man  docidx_lang_intro]
[manpage modules/doctools/docidx_lang_syntax.man docidx_lang_syntax]
[key docstrip]
[manpage modules/docstrip/docstrip.man      docstrip]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[manpage apps/tcldocstrip.man               tcldocstrip]
[key doctoc]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2toc/msgcat_c.man       doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man      doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man      doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man      doctools::msgcat::toc::fr]
[manpage modules/doctools/doctoc.man doctools::toc]
[manpage apps/dtplite.man            dtplite]
[manpage modules/doctools/doctoc.man             doctools::toc]
[manpage modules/doctools2toc/export.man         doctools::toc::export]
[manpage modules/doctools2toc/export_doctoc.man  doctools::toc::export::doctoc]
[manpage modules/doctools2toc/import.man         doctools::toc::import]
[manpage modules/doctools2toc/import_doctoc.man  doctools::toc::import::doctoc]
[manpage modules/doctools2toc/parse.man          doctools::toc::parse]
[manpage modules/doctools2toc/structure.man      doctools::toc::structure]
[manpage apps/dtplite.man                        dtplite]
[key {doctoc commands}]
[manpage modules/doctools/doctoc_lang_cmdref.man doctoc_lang_cmdref]
[manpage modules/doctools/doctoc_lang_faq.man    doctoc_lang_faq]
[manpage modules/doctools/doctoc_lang_intro.man  doctoc_lang_intro]
[manpage modules/doctools/doctoc_lang_syntax.man doctoc_lang_syntax]
[key {doctoc language}]
[manpage modules/doctools/doctoc_lang_cmdref.man doctoc_lang_cmdref]
[manpage modules/doctools/doctoc_lang_faq.man    doctoc_lang_faq]
[manpage modules/doctools/doctoc_lang_intro.man  doctoc_lang_intro]
[manpage modules/doctools/doctoc_lang_syntax.man doctoc_lang_syntax]
[key {doctoc markup}]
[manpage modules/doctools/doctoc_lang_cmdref.man doctoc_lang_cmdref]
[manpage modules/doctools/doctoc_lang_faq.man    doctoc_lang_faq]
[manpage modules/doctools/doctoc_lang_intro.man  doctoc_lang_intro]
[manpage modules/doctools/doctoc_lang_syntax.man doctoc_lang_syntax]
[manpage modules/doctools2toc/container.man      doctools::toc]
[key {doctoc syntax}]
[manpage modules/doctools/doctoc_lang_faq.man    doctoc_lang_faq]
[manpage modules/doctools/doctoc_lang_intro.man  doctoc_lang_intro]
[manpage modules/doctools/doctoc_lang_syntax.man doctoc_lang_syntax]
[key doctools]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[manpage modules/doctools/changelog.man     doctools::changelog]
[manpage apps/dtplite.man                   dtplite]
[manpage modules/docstrip/docstrip_util.man         docstrip_util]
[manpage modules/doctools/changelog.man             doctools::changelog]
[manpage modules/doctools2base/html_cssdefaults.man doctools::html::cssdefaults]
[manpage modules/doctools2idx/export_docidx.man     doctools::idx::export::docidx]
[manpage modules/doctools2idx/export_html.man       doctools::idx::export::html]
[manpage modules/doctools2idx/export_json.man       doctools::idx::export::json]
[manpage modules/doctools2idx/export_nroff.man      doctools::idx::export::nroff]
[manpage modules/doctools2idx/export_text.man       doctools::idx::export::text]
[manpage modules/doctools2idx/export_wiki.man       doctools::idx::export::wiki]
[manpage modules/doctools2idx/import_docidx.man     doctools::idx::import::docidx]
[manpage modules/doctools2idx/import_json.man       doctools::idx::import::json]
[manpage modules/doctools2idx/parse.man             doctools::idx::parse]
[manpage modules/doctools2idx/structure.man         doctools::idx::structure]
[manpage modules/doctools2base/tcllib_msgcat.man    doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man          doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man         doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man         doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man         doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_c.man          doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man         doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man         doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man         doctools::msgcat::toc::fr]
[manpage modules/doctools2base/nroff_manmacros.man  doctools::nroff::man_macros]
[manpage modules/doctools2base/tcl_parse.man        doctools::tcl::parse]
[manpage modules/doctools2toc/export_doctoc.man     doctools::toc::export::doctoc]
[manpage modules/doctools2toc/export_html.man       doctools::toc::export::html]
[manpage modules/doctools2toc/export_json.man       doctools::toc::export::json]
[manpage modules/doctools2toc/export_nroff.man      doctools::toc::export::nroff]
[manpage modules/doctools2toc/export_text.man       doctools::toc::export::text]
[manpage modules/doctools2toc/export_wiki.man       doctools::toc::export::wiki]
[manpage modules/doctools2toc/import_doctoc.man     doctools::toc::import::doctoc]
[manpage modules/doctools2toc/import_json.man       doctools::toc::import::json]
[manpage modules/doctools2toc/parse.man             doctools::toc::parse]
[manpage modules/doctools2toc/structure.man         doctools::toc::structure]
[manpage apps/dtplite.man                           dtplite]
[key {doctools commands}]
[manpage modules/doctools/doctools_lang_cmdref.man doctools_lang_cmdref]
[manpage modules/doctools/doctools_lang_faq.man    doctools_lang_faq]
[manpage modules/doctools/doctools_lang_intro.man  doctools_lang_intro]
[manpage modules/doctools/doctools_lang_syntax.man doctools_lang_syntax]
[key {doctools language}]
[manpage modules/doctools/doctools_lang_cmdref.man doctools_lang_cmdref]
493
494
495
496
497
498
499

500



501


502
503
504
505
506
507
508
509
510















































511
512
513
514
515
516
517
518
519

520
521
522



523
524
525
526



527

528
529
530
531
532
533
534
535









536
537
538
539
540
541


542
543



544

545
546





547
548
549
550
551


552
553
554



555
556
557
558
559
560
561























562
563
564
565











































566
567
568
569
570
571
572
573




574
575
576
577
578
579
580
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875



876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891




892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930


931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964



965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026







+

+
+
+

+
+









+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+









+
-
-
-
+
+
+




+
+
+

+




-
-
-
-
+
+
+
+
+
+
+
+
+






+
+


+
+
+

+


+
+
+
+
+





+
+

-
-
+
+
+







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








+
+
+
+







[manpage modules/doctools/doctools_lang_syntax.man doctools_lang_syntax]
[key document]
[manpage modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref]
[key documentation]
[manpage modules/docstrip/docstrip.man      docstrip]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[manpage modules/doctools/doctools.man      doctools]
[manpage modules/doctools2idx/container.man doctools::idx]
[manpage modules/doctools/docidx.man        doctools::idx]
[manpage modules/doctools2idx/export.man    doctools::idx::export]
[manpage modules/doctools2idx/import.man    doctools::idx::import]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools/doctoc.man        doctools::toc]
[manpage modules/doctools2toc/export.man    doctools::toc::export]
[manpage modules/doctools2toc/import.man    doctools::toc::import]
[manpage apps/tcldocstrip.man               tcldocstrip]
[key DOM]
[manpage modules/treeql/treeql.man treeql]
[key dom]
[manpage modules/amazon-s3/xsxp.man xsxp]
[key {domain name service}]
[manpage modules/dns/tcllib_dns.man dns]
[key e]
[manpage modules/math/constants.man math::constants]
[key EAN]
[manpage modules/valtype/ean13.man valtype::gs1::ean13]
[manpage modules/valtype/isbn.man  valtype::isbn]
[key EAN13]
[manpage modules/valtype/ean13.man valtype::gs1::ean13]
[manpage modules/valtype/isbn.man  valtype::isbn]
[key earley]
[manpage modules/grammar_aycock/aycock.man grammar::aycock]
[key EBNF]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key eccentricity]
[manpage modules/struct/graphops.man struct::graph::op]
[key edge]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graphops.man struct::graph::op]
[key emacs]
[manpage modules/doctools/changelog.man doctools::changelog]
[manpage modules/doctools/cvs.man       doctools::cvs]
[key email]
[manpage modules/imap4/imap4.man imap4]
[manpage modules/mime/mime.man mime]
[manpage modules/pop3/pop3.man pop3]
[manpage modules/mime/smtp.man smtp]
[manpage modules/mime/mime.man   mime]
[manpage modules/pop3/pop3.man   pop3]
[manpage modules/mime/smtp.man   smtp]
[key emptiness]
[manpage modules/struct/struct_set.man struct::set]
[key {empty interpreter}]
[manpage modules/interp/tcllib_interp.man interp]
[key EN]
[manpage modules/doctools2idx/msgcat_en.man doctools::msgcat::idx::en]
[manpage modules/doctools2toc/msgcat_en.man doctools::msgcat::toc::en]
[key encoding]
[manpage modules/base64/ascii85.man  ascii85]
[manpage modules/base64/base64.man   base64]
[manpage modules/base64/uuencode.man uuencode]
[manpage modules/base64/yencode.man  yencode]
[key encryption]
[manpage modules/aes/aes.man           aes]
[manpage modules/blowfish/blowfish.man blowfish]
[manpage modules/des/des.man           des]
[manpage modules/rc4/rc4.man           rc4]
[manpage modules/aes/aes.man                   aes]
[manpage modules/blowfish/blowfish.man         blowfish]
[manpage modules/des/des.man                   des]
[manpage modules/pki/pki.man                   pki]
[manpage modules/rc4/rc4.man                   rc4]
[manpage modules/virtchannel_transform/otp.man tcl::transform::otp]
[manpage modules/virtchannel_transform/rot.man tcl::transform::rot]
[key {entry mask}]
[manpage modules/tepam/tepam_introduction.man tepam]
[key equal]
[manpage modules/struct/struct_list.man struct::list]
[key equality]
[manpage modules/struct/struct_list.man struct::list]
[key {equivalence class}]
[manpage modules/struct/disjointset.man struct::disjointset]
[key error]
[manpage modules/try/tcllib_try.man try]
[key {error function}]
[manpage modules/math/special.man math::special]
[key {European Article Number}]
[manpage modules/valtype/ean13.man valtype::gs1::ean13]
[manpage modules/valtype/isbn.man  valtype::isbn]
[key event]
[manpage modules/hook/hook.man         hook]
[manpage modules/uev/uevent.man        uevent]
[manpage modules/uev/uevent_onidle.man uevent::onidle]
[key {event management}]
[manpage modules/virtchannel_core/events.man tcl::chan::events]
[key events]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key examples]
[manpage modules/bench/bench_lang_intro.man     bench_lang_intro]
[manpage modules/doctools/docidx_lang_faq.man   docidx_lang_faq]
[manpage modules/doctools/doctoc_lang_faq.man   doctoc_lang_faq]
[manpage modules/doctools/doctools_lang_faq.man doctools_lang_faq]
[key exception]
[manpage modules/try/tcllib_try.man try]
[key {exchange format}]
[manpage modules/yaml/huddle.man huddle]
[manpage modules/json/json.man   json]
[manpage modules/yaml/huddle.man     huddle]
[manpage modules/json/json.man       json]
[manpage modules/json/json_write.man json::write]
[key exclusion]
[manpage modules/struct/struct_set.man struct::set]
[key execution]
[manpage modules/grammar_fa/dexec.man grammar::fa::dexec]
[key exif]
[manpage modules/exif/exif.man exif]
[manpage modules/jpeg/jpeg.man jpeg]
[key exit]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key export]
[manpage modules/doctools2base/html_cssdefaults.man doctools::html::cssdefaults]
[manpage modules/doctools2idx/export.man            doctools::idx::export]
[manpage modules/doctools2idx/export_docidx.man     doctools::idx::export::docidx]
[manpage modules/doctools2idx/export_html.man       doctools::idx::export::html]
[manpage modules/doctools2idx/export_json.man       doctools::idx::export::json]
[manpage modules/doctools2idx/export_nroff.man      doctools::idx::export::nroff]
[manpage modules/doctools2idx/export_text.man       doctools::idx::export::text]
[manpage modules/doctools2idx/export_wiki.man       doctools::idx::export::wiki]
[manpage modules/doctools2base/nroff_manmacros.man  doctools::nroff::man_macros]
[manpage modules/doctools2toc/export.man            doctools::toc::export]
[manpage modules/doctools2toc/export_doctoc.man     doctools::toc::export::doctoc]
[manpage modules/doctools2toc/export_html.man       doctools::toc::export::html]
[manpage modules/doctools2toc/export_json.man       doctools::toc::export::json]
[manpage modules/doctools2toc/export_nroff.man      doctools::toc::export::nroff]
[manpage modules/doctools2toc/export_text.man       doctools::toc::export::text]
[manpage modules/doctools2toc/export_wiki.man       doctools::toc::export::wiki]
[manpage modules/pt/pt_peg_export_container.man     pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man          pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man           pt::peg::export::peg]
[key expression]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key {extended namespace}]
[manpage modules/namespacex/namespacex.man namespacex]
[key faq]
[manpage modules/doctools/docidx_lang_faq.man   docidx_lang_faq]
[manpage modules/doctools/doctoc_lang_faq.man   doctoc_lang_faq]
[manpage modules/doctools/doctools_lang_faq.man doctools_lang_faq]
[key {fetching information}]
[manpage modules/uri/uri.man uri]
[key FFT]
[manpage modules/math/fourier.man math::fourier]
[key fifo]
[manpage modules/virtchannel_base/fifo.man     tcl::chan::fifo]
[manpage modules/virtchannel_base/fifo2.man    tcl::chan::fifo2]
[manpage modules/virtchannel_base/halfpipe.man tcl::chan::halfpipe]
[key file]
[manpage modules/tie/tie.man     tie]
[manpage modules/tie/tie_std.man tie]
[manpage modules/uri/uri.man     uri]
[key {file recognition}]
[manpage modules/fumagic/cfront.man    fileutil::magic::cfront]
[manpage modules/fumagic/cgen.man      fileutil::magic::cgen]
595
596
597
598
599
600
601

602









603
604
605
606
607
608
609
610
611
612
613
614
615
616


617
618
619
620
621
622
623


624
625






626
627
628









629
630
631
632
633
634
635
636
637
638













639
640
641
642
643
644



645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661









662
663
664
665
666
667
668






669
670
671

672


673

674
675
676
677
678
679
680
681
682
683
684
685


















































686
687
688
689
690


691
692
693
694
695
696



697
698
699
700
701
702
703
704
705
706
707
708
709


710
711


712
713





714
715
716
717
718
719












720
721
722
723
724
725
726
727
728




729
730
731
732
733
734
735
736
737












738
739
740
741


742
743
744
745
746
747




















748
749
750
751
752
753
754
755
756
757


758
759
760


761










762
763


764
765
766
767
768
769
770
771





















772
773
774
775

776
777
778
779
780
781
782
1041
1042
1043
1044
1045
1046
1047
1048

1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105







1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175












1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228


1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266





1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284



1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414







+
-
+
+
+
+
+
+
+
+
+














+
+







+
+


+
+
+
+
+
+



+
+
+
+
+
+
+
+
+



-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+






+
+
+

















+
+
+
+
+
+
+
+
+







+
+
+
+
+
+



+

+
+

+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



-
-
+
+






+
+
+













+
+


+
+


+
+
+
+
+

-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+






-
-
-
+
+
+
+









+
+
+
+
+
+
+
+
+
+
+
+




+
+






+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+










+
+



+
+

+
+
+
+
+
+
+
+
+
+


+
+








+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+




+







[manpage modules/fumagic/mimetypes.man fileutil::magic::mimetype]
[manpage modules/fumagic/rtcore.man    fileutil::magic::rt]
[manpage modules/fileutil/multi.man    fileutil::multi]
[manpage modules/fileutil/multiop.man  fileutil::multi::op]
[key filesystem]
[manpage modules/map/map_slippy_cache.man map::slippy::cache]
[key filter]
[manpage modules/generator/generator.man generator]
[manpage modules/struct/struct_list.man struct::list]
[manpage modules/struct/struct_list.man  struct::list]
[key final]
[manpage modules/try/tcllib_try.man try]
[key finance]
[manpage modules/valtype/cc_amex.man       valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man   valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man       valtype::creditcard::visa]
[manpage modules/valtype/iban.man          valtype::iban]
[key find]
[manpage modules/struct/disjointset.man struct::disjointset]
[key finite]
[manpage modules/struct/pool.man struct::pool]
[key {finite automaton}]
[manpage modules/grammar_fa/fa.man        grammar::fa]
[manpage modules/grammar_fa/dacceptor.man grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man     grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man      grammar::fa::op]
[key {FIPS 180-1}]
[manpage modules/sha1/sha1.man   sha1]
[manpage modules/sha1/sha256.man sha256]
[key {first permutation}]
[manpage modules/struct/struct_list.man struct::list]
[key Fisher-Yates]
[manpage modules/struct/struct_list.man struct::list]
[key flatten]
[manpage modules/struct/struct_list.man struct::list]
[key floating-point]
[manpage modules/math/bigfloat.man math::bigfloat]
[manpage modules/math/fuzzy.man    math::fuzzy]
[key flow]
[manpage modules/control/control.man control]
[key {flow network}]
[manpage modules/struct/graphops.man struct::graph::op]
[key folding]
[manpage modules/struct/struct_list.man struct::list]
[key foldl]
[manpage modules/generator/generator.man generator]
[key foldr]
[manpage modules/generator/generator.man generator]
[key foreach]
[manpage modules/generator/generator.man generator]
[key form]
[manpage modules/html/html.man html]
[manpage modules/ncgi/ncgi.man ncgi]
[key {format conversion}]
[manpage modules/pt/pt_peg_from_json.man    pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man     pt::peg::from::peg]
[manpage modules/pt/pt_peg_to_container.man pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man    pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man      pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man     pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man       pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man  pt::peg::to::tclparam]
[key formatter]
[manpage modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref]
[key formatting]
[manpage modules/bench/bench_read.man         bench::in]
[manpage modules/bench/bench_wcsv.man         bench::out::csv]
[manpage modules/bench/bench_wtext.man        bench::out::text]
[manpage modules/textutil/textutil.man        textutil]
[manpage modules/textutil/adjust.man          textutil::adjust]
[manpage modules/textutil/textutil_string.man textutil::string]
[manpage modules/textutil/tabify.man          textutil::tabify]
[manpage modules/bench/bench_read.man          bench::in]
[manpage modules/bench/bench_wcsv.man          bench::out::csv]
[manpage modules/bench/bench_wtext.man         bench::out::text]
[manpage modules/doctools2idx/introduction.man doctools2idx_introduction]
[manpage modules/doctools2toc/introduction.man doctools2toc_introduction]
[manpage modules/doctools2idx/container.man    doctools::idx]
[manpage modules/doctools2idx/export.man       doctools::idx::export]
[manpage modules/doctools2toc/container.man    doctools::toc]
[manpage modules/doctools2toc/export.man       doctools::toc::export]
[manpage modules/textutil/textutil.man         textutil]
[manpage modules/textutil/adjust.man           textutil::adjust]
[manpage modules/textutil/textutil_string.man  textutil::string]
[manpage modules/textutil/tabify.man           textutil::tabify]
[key {formatting engine}]
[manpage modules/doctools/docidx_plugin_apiref.man   docidx_plugin_apiref]
[manpage modules/doctools/doctoc_plugin_apiref.man   doctoc_plugin_apiref]
[manpage modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref]
[key {Fourier transform}]
[manpage modules/math/fourier.man math::fourier]
[key FR]
[manpage modules/doctools2idx/msgcat_fr.man doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_fr.man doctools::msgcat::toc::fr]
[key frame]
[manpage modules/term/ansi_cmacros.man term::ansi::code::macros]
[key ftp]
[manpage modules/ftp/ftp.man        ftp]
[manpage modules/ftp/ftp_geturl.man ftp::geturl]
[manpage modules/ftpd/ftpd.man      ftpd]
[manpage modules/uri/uri.man        uri]
[key ftpd]
[manpage modules/ftpd/ftpd.man ftpd]
[key ftpserver]
[manpage modules/ftpd/ftpd.man ftpd]
[key {full outer join}]
[manpage modules/struct/struct_list.man struct::list]
[key {generate event}]
[manpage modules/uev/uevent.man uevent]
[key {generate permutations}]
[manpage modules/struct/struct_list.man struct::list]
[key generation]
[manpage modules/doctools2idx/container.man doctools::idx]
[manpage modules/doctools2idx/export.man    doctools::idx::export]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools2toc/export.man    doctools::toc::export]
[key generator]
[manpage modules/generator/generator.man generator]
[key geocoding]
[manpage modules/map/map_geocode_nominatim.man map::geocode::nominatim]
[key geodesy]
[manpage modules/map/map_slippy.man  map::slippy]
[manpage modules/mapproj/mapproj.man mapproj]
[key geography]
[manpage modules/map/map_slippy.man map::slippy]
[key {get character}]
[manpage modules/term/receive.man term::receive]
[key gets]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key global]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key gopher]
[manpage modules/uri/uri.man uri]
[key gps]
[manpage modules/gpx/gpx.man   gpx]
[manpage modules/nmea/nmea.man nmea]
[key gpx]
[manpage modules/gpx/gpx.man gpx]
[key grammar]
[manpage modules/grammar_aycock/aycock.man       grammar::aycock]
[manpage modules/grammar_fa/fa.man          grammar::fa]
[manpage modules/grammar_fa/dacceptor.man   grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man       grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man        grammar::fa::op]
[manpage modules/grammar_me/me_cpu.man      grammar::me::cpu]
[manpage modules/grammar_me/me_cpucore.man  grammar::me::cpu::core]
[manpage modules/grammar_me/gasm.man        grammar::me::cpu::gasm]
[manpage modules/grammar_me/me_tcl.man      grammar::me::tcl]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_me/me_vm.man       grammar::me_vm]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_fa/fa.man               grammar::fa]
[manpage modules/grammar_fa/dacceptor.man        grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man            grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man             grammar::fa::op]
[manpage modules/grammar_me/me_cpu.man           grammar::me::cpu]
[manpage modules/grammar_me/me_cpucore.man       grammar::me::cpu::core]
[manpage modules/grammar_me/gasm.man             grammar::me::cpu::gasm]
[manpage modules/grammar_me/me_tcl.man           grammar::me::tcl]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_me/me_vm.man            grammar::me_vm]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key graph]
[manpage modules/grammar_me/gasm.man grammar::me::cpu::gasm]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graph1.man   {struct::graph v1}]
[manpage modules/struct/graphops.man struct::graph::op]
[manpage modules/struct/graphops.man struct::graph::op]
[manpage modules/struct/graph1.man   struct::graph_v1]
[manpage modules/struct/queue.man    struct::queue]
[manpage modules/struct/stack.man    struct::stack]
[key {graph walking}]
[manpage modules/page/page_util_flow.man       page_util_flow]
[manpage modules/page/page_util_norm_lemon.man page_util_norm_lemon]
[manpage modules/page/page_util_norm_peg.man   page_util_norm_peg]
[key {green threads}]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key grep]
[manpage modules/fileutil/fileutil.man fileutil]
[key GUID]
[manpage modules/uuid/uuid.man uuid]
[key hashing]
[manpage modules/md4/md4.man           md4]
[manpage modules/md5/md5.man           md5]
[manpage modules/md5crypt/md5crypt.man md5crypt]
[manpage modules/otp/otp.man           otp]
[manpage modules/ripemd/ripemd128.man  ripemd128]
[manpage modules/ripemd/ripemd160.man  ripemd160]
[manpage modules/sha1/sha1.man         sha1]
[manpage modules/sha1/sha256.man       sha256]
[key heuristic]
[manpage modules/struct/graphops.man struct::graph::op]
[key hex]
[manpage modules/base32/base32hex.man base32::hex]
[key hexadecimal]
[manpage modules/virtchannel_transform/hex.man tcl::transform::hex]
[key histogram]
[manpage modules/counter/counter.man counter]
[key hook]
[manpage modules/hook/hook.man  hook]
[manpage modules/uev/uevent.man uevent]
[key horspool]
[manpage modules/grammar_aycock/aycock.man grammar::aycock]
[key HTML]
[manpage modules/doctools/doctools.man doctools]
[manpage modules/doctools/docidx.man   doctools::idx]
[manpage modules/doctools/doctoc.man   doctools::toc]
[manpage apps/dtplite.man              dtplite]
[manpage modules/doctools/mpexpand.man mpexpand]
[manpage modules/doctools/doctools.man              doctools]
[manpage modules/doctools2base/html_cssdefaults.man doctools::html::cssdefaults]
[manpage modules/doctools2idx/container.man         doctools::idx]
[manpage modules/doctools/docidx.man                doctools::idx]
[manpage modules/doctools2idx/export.man            doctools::idx::export]
[manpage modules/doctools2idx/export_html.man       doctools::idx::export::html]
[manpage modules/doctools2toc/container.man         doctools::toc]
[manpage modules/doctools/doctoc.man                doctools::toc]
[manpage modules/doctools2toc/export.man            doctools::toc::export]
[manpage modules/doctools2toc/export_html.man       doctools::toc::export::html]
[manpage apps/dtplite.man                           dtplite]
[manpage modules/doctools/mpexpand.man              mpexpand]
[key html]
[manpage modules/html/html.man             html]
[manpage modules/htmlparse/htmlparse.man   htmlparse]
[manpage modules/javascript/javascript.man javascript]
[manpage modules/ncgi/ncgi.man             ncgi]
[key http]
[manpage modules/http/autoproxy.man         autoproxy]
[manpage modules/map/map_slippy_fetcher.man map::slippy::fetcher]
[manpage modules/uri/uri.man                uri]
[manpage modules/http/autoproxy.man            autoproxy]
[manpage modules/map/map_geocode_nominatim.man map::geocode::nominatim]
[manpage modules/map/map_slippy_fetcher.man    map::slippy::fetcher]
[manpage modules/uri/uri.man                   uri]
[key huddle]
[manpage modules/yaml/huddle.man huddle]
[manpage modules/yaml/yaml.man   yaml]
[key {human readable}]
[manpage modules/bench/bench_read.man  bench::in]
[manpage modules/bench/bench_wtext.man bench::out::text]
[key hyphenation]
[manpage modules/textutil/textutil.man textutil]
[manpage modules/textutil/adjust.man   textutil::adjust]
[key i18n]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man       doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man      doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man      doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man      doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_c.man       doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man      doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man      doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man      doctools::msgcat::toc::fr]
[key IBAN]
[manpage modules/valtype/iban.man valtype::iban]
[key ident]
[manpage modules/ident/ident.man ident]
[key identification]
[manpage modules/ident/ident.man ident]
[key identity]
[manpage modules/virtchannel_transform/identity.man tcl::transform::identity]
[key idle]
[manpage modules/uev/uevent_onidle.man uevent::onidle]
[key image]
[manpage modules/jpeg/jpeg.man jpeg]
[manpage modules/png/png.man   png]
[manpage modules/tiff/tiff.man tiff]
[key imap]
[manpage modules/imap4/imap4.man imap4]
[key IMEI]
[manpage modules/valtype/imei.man valtype::imei]
[key import]
[manpage modules/doctools2idx/import.man        doctools::idx::import]
[manpage modules/doctools2idx/import_docidx.man doctools::idx::import::docidx]
[manpage modules/doctools2idx/import_json.man   doctools::idx::import::json]
[manpage modules/doctools2toc/import.man        doctools::toc::import]
[manpage modules/doctools2toc/import_doctoc.man doctools::toc::import::doctoc]
[manpage modules/doctools2toc/import_json.man   doctools::toc::import::json]
[manpage modules/pt/pt_peg_import_json.man      pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man       pt::peg::import::peg]
[key {in-memory channel}]
[manpage modules/virtchannel_base/fifo.man     tcl::chan::fifo]
[manpage modules/virtchannel_base/fifo2.man    tcl::chan::fifo2]
[manpage modules/virtchannel_base/halfpipe.man tcl::chan::halfpipe]
[manpage modules/virtchannel_base/memchan.man  tcl::chan::memchan]
[manpage modules/virtchannel_base/string.man   tcl::chan::string]
[manpage modules/virtchannel_base/variable.man tcl::chan::variable]
[key in-order]
[manpage modules/struct/struct_tree.man struct::tree]
[key inclusion]
[manpage modules/struct/struct_set.man struct::set]
[key {Incr Tcl}]
[manpage modules/snit/snit.man    snit]
[manpage modules/snit/snitfaq.man snitfaq]
[key indenting]
[manpage modules/textutil/textutil.man textutil]
[manpage modules/textutil/adjust.man   textutil::adjust]
[key {independent set}]
[manpage modules/struct/graphops.man struct::graph::op]
[key index]
[manpage modules/doctools/docidx_intro.man         docidx_intro]
[manpage modules/doctools/docidx_plugin_apiref.man docidx_plugin_apiref]
[manpage modules/doctools2idx/introduction.man     doctools2idx_introduction]
[manpage modules/doctools2idx/container.man        doctools::idx]
[manpage modules/doctools/docidx.man               doctools::idx]
[manpage modules/doctools2idx/export.man           doctools::idx::export]
[manpage modules/doctools2idx/export_docidx.man    doctools::idx::export::docidx]
[manpage modules/doctools2idx/export_html.man      doctools::idx::export::html]
[manpage modules/doctools2idx/export_json.man      doctools::idx::export::json]
[manpage modules/doctools2idx/export_nroff.man     doctools::idx::export::nroff]
[manpage modules/doctools2idx/export_text.man      doctools::idx::export::text]
[manpage modules/doctools2idx/export_wiki.man      doctools::idx::export::wiki]
[manpage modules/doctools2idx/import.man           doctools::idx::import]
[manpage modules/doctools2idx/import_docidx.man    doctools::idx::import::docidx]
[manpage modules/doctools2idx/import_json.man      doctools::idx::import::json]
[key {index formatter}]
[manpage modules/doctools/docidx_plugin_apiref.man docidx_plugin_apiref]
[key info]
[manpage modules/namespacex/namespacex.man namespacex]
[key {inner join}]
[manpage modules/struct/struct_list.man struct::list]
[key {input mode}]
[manpage modules/term/ansi_ctrlu.man term::ansi::ctrl::unix]
[key integer]
[manpage modules/math/roman.man math::roman]
[key integration]
[manpage modules/math/calculus.man math::calculus]
[key {inter-thread communication}]
[manpage modules/virtchannel_base/fifo2.man tcl::chan::fifo2]
[key {International Article Number}]
[manpage modules/valtype/ean13.man valtype::gs1::ean13]
[manpage modules/valtype/isbn.man  valtype::isbn]
[key {International Bank Account Number}]
[manpage modules/valtype/iban.man valtype::iban]
[key {International Mobile Equipment Identity}]
[manpage modules/valtype/imei.man valtype::imei]
[key {International Standard Book Number}]
[manpage modules/valtype/isbn.man valtype::isbn]
[key internationalization]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man       doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man      doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man      doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man      doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_c.man       doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man      doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man      doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man      doctools::msgcat::toc::fr]
[key internet]
[manpage modules/asn/asn.man          asn]
[manpage modules/ftp/ftp.man          ftp]
[manpage modules/ftp/ftp_geturl.man   ftp::geturl]
[manpage modules/imap4/imap4.man      imap4]
[manpage modules/ldap/ldap.man        ldap]
[manpage modules/ldap/ldapx.man       ldapx]
[manpage modules/mime/mime.man        mime]
[manpage modules/pop3d/pop3d.man      pop3d]
[manpage modules/pop3d/pop3d_dbox.man pop3d::dbox]
[manpage modules/pop3d/pop3d_udb.man  pop3d::udb]
[manpage modules/mime/smtp.man        smtp]
801
802
803
804
805
806
807
















808
809


810
811
812

813
814
815
816
817
818
819









820






821
822



823
824
825
826
827






828
829
830
831












832
833
834
835

836
837



838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854







855
856

857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879





















































880

881
882
883



884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901







902

903
904
905



906
907
908
909


910
911

912


913


914
915
916
917


918
919
920
921
922





923
924
925
926
927
928
929
930
931
932
933
934
935
936



937



938


939
940
941
942
943
944
945
946
947


948
949
950









































951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968


















969
970
971
972
973
974
975

976
977
978

979
980


981
982


983
984
985
986
987
988
989
990
991


992
993
994
995
996
997
998
999
1000

1001

1002
1003
1004
1005
1006
1007
1008
1009










1010
1011










1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026


1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037










1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050


1051
1052
1053
1054
1055
1056
1057
1058
1059
1060






1061
1062
1063
1064
1065
1066

1067
1068
1069
1070
1071
1072
1073
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486


1487
1488
1489
1490
1491
1492


1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519


1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547

1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568



1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623



1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653



1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677





1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718


1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760

















1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788

1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818

1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


+
+



+







+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
-
-
+
+
+



-
-
+
+
+
+
+
+




+
+
+
+
+
+
+
+
+
+
+
+




+
-
-
+
+
+

















+
+
+
+
+
+
+

-
+




















-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
-
-
-
+
+
+


















+
+
+
+
+
+
+

+
-
-
-
+
+
+




+
+


+

+
+

+
+




+
+
-
-
-
-
-
+
+
+
+
+














+
+
+

+
+
+

+
+









+
+

-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







+


-
+


+
+


+
+









+
+









+
-
+








+
+
+
+
+
+
+
+
+
+


+
+
+
+
+
+
+
+
+
+















+
+











+
+
+
+
+
+
+
+
+
+













+
+










+
+
+
+
+
+






+







[key ipv4]
[manpage modules/dns/tcllib_ip.man tcllib_ip]
[key ipv6]
[manpage modules/dns/tcllib_ip.man tcllib_ip]
[key irc]
[manpage modules/irc/irc.man     irc]
[manpage modules/irc/picoirc.man picoirc]
[key isA]
[manpage modules/valtype/valtype_common.man valtype::common]
[manpage modules/valtype/cc_amex.man        valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man    valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man  valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man        valtype::creditcard::visa]
[manpage modules/valtype/ean13.man          valtype::gs1::ean13]
[manpage modules/valtype/iban.man           valtype::iban]
[manpage modules/valtype/imei.man           valtype::imei]
[manpage modules/valtype/isbn.man           valtype::isbn]
[manpage modules/valtype/luhn.man           valtype::luhn]
[manpage modules/valtype/luhn5.man          valtype::luhn5]
[manpage modules/valtype/usnpi.man          valtype::usnpi]
[manpage modules/valtype/verhoeff.man       valtype::verhoeff]
[key ISBN]
[manpage modules/valtype/isbn.man valtype::isbn]
[key isthmus]
[manpage modules/struct/graphops.man struct::graph::op]
[key iterator]
[manpage modules/generator/generator.man generator]
[key javascript]
[manpage modules/javascript/javascript.man javascript]
[manpage modules/json/json.man             json]
[manpage modules/json/json_write.man       json::write]
[key jfif]
[manpage modules/jpeg/jpeg.man jpeg]
[key join]
[manpage modules/struct/struct_list.man struct::list]
[key jpeg]
[manpage modules/exif/exif.man exif]
[manpage modules/jpeg/jpeg.man jpeg]
[key JSON]
[manpage modules/doctools2idx/export_json.man doctools::idx::export::json]
[manpage modules/doctools2idx/import_json.man doctools::idx::import::json]
[manpage modules/doctools2toc/export_json.man doctools::toc::export::json]
[manpage modules/doctools2toc/import_json.man doctools::toc::import::json]
[manpage modules/pt/pt_peg_export_json.man    pt::peg::export::json]
[manpage modules/pt/pt_peg_from_json.man      pt::peg::from::json]
[manpage modules/pt/pt_peg_import_json.man    pt::peg::import::json]
[manpage modules/pt/pt_peg_to_json.man        pt::peg::to::json]
[key json]
[manpage modules/doctools2idx/container.man doctools::idx]
[manpage modules/doctools2idx/export.man    doctools::idx::export]
[manpage modules/doctools2idx/import.man    doctools::idx::import]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools2toc/export.man    doctools::toc::export]
[manpage modules/doctools2toc/import.man    doctools::toc::import]
[manpage modules/yaml/huddle.man huddle]
[manpage modules/json/json.man   json]
[manpage modules/yaml/huddle.man            huddle]
[manpage modules/json/json.man              json]
[manpage modules/json/json_write.man        json::write]
[key justification]
[manpage modules/textutil/adjust.man textutil::adjust]
[key {keyword index}]
[manpage modules/doctools/docidx_intro.man docidx_intro]
[manpage modules/doctools/docidx.man       doctools::idx]
[manpage modules/doctools/docidx_intro.man     docidx_intro]
[manpage modules/doctools2idx/introduction.man doctools2idx_introduction]
[manpage modules/doctools2idx/container.man    doctools::idx]
[manpage modules/doctools/docidx.man           doctools::idx]
[manpage modules/doctools2idx/export.man       doctools::idx::export]
[manpage modules/doctools2idx/import.man       doctools::idx::import]
[key keywords]
[manpage modules/doctools/docidx_plugin_apiref.man docidx_plugin_apiref]
[key knuth]
[manpage modules/soundex/soundex.man soundex]
[key l10n]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man       doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man      doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man      doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man      doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_c.man       doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man      doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man      doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man      doctools::msgcat::toc::fr]
[key lambda]
[manpage modules/lambda/lambda.man lambda]
[key LaTeX]
[manpage modules/docstrip/docstrip.man docstrip]
[manpage apps/tcldocstrip.man          tcldocstrip]
[key latex]
[manpage modules/doctools2idx/container.man doctools::idx]
[manpage modules/doctools/docidx.man doctools::idx]
[manpage modules/doctools/doctoc.man doctools::toc]
[manpage modules/doctools/docidx.man        doctools::idx]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools/doctoc.man        doctools::toc]
[key latitute]
[manpage modules/map/map_slippy.man map::slippy]
[key ldap]
[manpage modules/ldap/ldap.man  ldap]
[manpage modules/ldap/ldapx.man ldapx]
[manpage modules/uri/uri.man    uri]
[key {ldap client}]
[manpage modules/ldap/ldap.man  ldap]
[manpage modules/ldap/ldapx.man ldapx]
[key ldif]
[manpage modules/ldap/ldapx.man ldapx]
[key {least squares}]
[manpage modules/math/linalg.man math::linearalgebra]
[key {left outer join}]
[manpage modules/struct/struct_list.man struct::list]
[key lemon]
[manpage modules/page/page_util_norm_lemon.man page_util_norm_lemon]
[key {level graph}]
[manpage modules/struct/graphops.man struct::graph::op]
[key lexer]
[manpage modules/doctools2idx/parse.man doctools::idx::parse]
[manpage modules/doctools2toc/parse.man doctools::toc::parse]
[key limitsize]
[manpage modules/virtchannel_transform/limitsize.man tcl::transform::limitsize]
[key line]
[manpage modules/math/geometry.man math::geometry]
[manpage modules/math/math_geometry.man math::geometry]
[key {linear algebra}]
[manpage modules/math/linalg.man math::linearalgebra]
[key {linear equations}]
[manpage modules/math/linalg.man math::linearalgebra]
[key {linear program}]
[manpage modules/math/optimize.man math::optimize]
[key lines]
[manpage modules/term/ansi_ctrlu.man term::ansi::ctrl::unix]
[key list]
[manpage modules/struct/struct_list.man struct::list]
[manpage modules/struct/queue.man       struct::queue]
[manpage modules/wip/wip.man            wip]
[key listener]
[manpage modules/term/receive.man   term::receive]
[manpage modules/term/term_bind.man term::receive::bind]
[key {literate programming}]
[manpage modules/docstrip/docstrip.man      docstrip]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[manpage apps/tcldocstrip.man               tcldocstrip]
[key LL(k)]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key {local searching}]
[manpage modules/struct/graphops.man struct::graph::op]
[key localization]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man       doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man      doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man      doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man      doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_c.man       doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man      doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man      doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man      doctools::msgcat::toc::fr]
[key location]
[manpage modules/map/map_geocode_nominatim.man map::geocode::nominatim]
[manpage modules/map/map_slippy.man         map::slippy]
[manpage modules/map/map_slippy_cache.man   map::slippy::cache]
[manpage modules/map/map_slippy_fetcher.man map::slippy::fetcher]
[manpage modules/map/map_slippy.man            map::slippy]
[manpage modules/map/map_slippy_cache.man      map::slippy::cache]
[manpage modules/map/map_slippy_fetcher.man    map::slippy::fetcher]
[key log]
[manpage modules/doctools/cvs.man doctools::cvs]
[manpage modules/log/log.man      log]
[manpage modules/log/logger.man   logger]
[key {log level}]
[manpage modules/log/log.man    log]
[manpage modules/log/logger.man logger]
[key logger]
[manpage modules/log/logger.man         logger]
[manpage modules/log/loggerAppender.man logger::appender]
[manpage modules/log/loggerUtils.man    logger::utils]
[key {longest common subsequence}]
[manpage modules/struct/struct_list.man struct::list]
[key longitude]
[manpage modules/map/map_slippy.man map::slippy]
[key loop]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graphops.man struct::graph::op]
[key luhn]
[manpage modules/valtype/luhn.man  valtype::luhn]
[manpage modules/valtype/luhn5.man valtype::luhn5]
[key luhn-5]
[manpage modules/valtype/luhn5.man valtype::luhn5]
[key macros]
[manpage modules/doctools2base/nroff_manmacros.man doctools::nroff::man_macros]
[key mail]
[manpage modules/imap4/imap4.man imap4]
[manpage modules/mime/mime.man mime]
[manpage modules/pop3/pop3.man pop3]
[manpage modules/mime/smtp.man smtp]
[manpage modules/mime/mime.man   mime]
[manpage modules/pop3/pop3.man   pop3]
[manpage modules/mime/smtp.man   smtp]
[key mailto]
[manpage modules/uri/uri.man uri]
[key {maker note}]
[manpage modules/exif/exif.man exif]
[key man_macros]
[manpage modules/doctools2base/nroff_manmacros.man doctools::nroff::man_macros]
[key manpage]
[manpage modules/doctools/doctools.man               doctools]
[manpage modules/doctools2idx/container.man          doctools::idx]
[manpage modules/doctools/docidx.man                 doctools::idx]
[manpage modules/doctools2idx/export.man             doctools::idx::export]
[manpage modules/doctools2idx/import.man             doctools::idx::import]
[manpage modules/doctools/doctoc.man                 doctools::toc]
[manpage modules/doctools2toc/export.man             doctools::toc::export]
[manpage modules/doctools2toc/import.man             doctools::toc::import]
[manpage modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref]
[manpage apps/dtplite.man                            dtplite]
[manpage modules/doctools/mpexpand.man               mpexpand]
[key map]
[manpage modules/generator/generator.man       generator]
[manpage modules/map/map_geocode_nominatim.man map::geocode::nominatim]
[manpage modules/map/map_slippy.man         map::slippy]
[manpage modules/map/map_slippy_cache.man   map::slippy::cache]
[manpage modules/map/map_slippy_fetcher.man map::slippy::fetcher]
[manpage modules/mapproj/mapproj.man        mapproj]
[manpage modules/struct/struct_list.man     struct::list]
[manpage modules/map/map_slippy.man            map::slippy]
[manpage modules/map/map_slippy_cache.man      map::slippy::cache]
[manpage modules/map/map_slippy_fetcher.man    map::slippy::fetcher]
[manpage modules/mapproj/mapproj.man           mapproj]
[manpage modules/struct/struct_list.man        struct::list]
[key markup]
[manpage modules/doctools/docidx_intro.man           docidx_intro]
[manpage modules/doctools/docidx_lang_cmdref.man     docidx_lang_cmdref]
[manpage modules/doctools/docidx_lang_faq.man        docidx_lang_faq]
[manpage modules/doctools/docidx_lang_intro.man      docidx_lang_intro]
[manpage modules/doctools/docidx_lang_syntax.man     docidx_lang_syntax]
[manpage modules/doctools/docidx_plugin_apiref.man   docidx_plugin_apiref]
[manpage modules/doctools/doctoc_intro.man           doctoc_intro]
[manpage modules/doctools/doctoc_lang_cmdref.man     doctoc_lang_cmdref]
[manpage modules/doctools/doctoc_lang_faq.man        doctoc_lang_faq]
[manpage modules/doctools/doctoc_lang_intro.man      doctoc_lang_intro]
[manpage modules/doctools/doctoc_lang_syntax.man     doctoc_lang_syntax]
[manpage modules/doctools/doctoc_plugin_apiref.man   doctoc_plugin_apiref]
[manpage modules/doctools/doctools.man               doctools]
[manpage modules/doctools2idx/introduction.man       doctools2idx_introduction]
[manpage modules/doctools2toc/introduction.man       doctools2toc_introduction]
[manpage modules/doctools2idx/container.man          doctools::idx]
[manpage modules/doctools/docidx.man                 doctools::idx]
[manpage modules/doctools2idx/export.man             doctools::idx::export]
[manpage modules/doctools2idx/import.man             doctools::idx::import]
[manpage modules/doctools2toc/container.man          doctools::toc]
[manpage modules/doctools/doctoc.man                 doctools::toc]
[manpage modules/doctools2toc/export.man             doctools::toc::export]
[manpage modules/doctools2toc/import.man             doctools::toc::import]
[manpage modules/doctools/doctools_intro.man         doctools_intro]
[manpage modules/doctools/doctools_lang_cmdref.man   doctools_lang_cmdref]
[manpage modules/doctools/doctools_lang_faq.man      doctools_lang_faq]
[manpage modules/doctools/doctools_lang_intro.man    doctools_lang_intro]
[manpage modules/doctools/doctools_lang_syntax.man   doctools_lang_syntax]
[manpage modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref]
[manpage apps/dtplite.man                            dtplite]
[manpage modules/doctools/mpexpand.man               mpexpand]
[manpage apps/tcldocstrip.man                        tcldocstrip]
[key MasterCard]
[manpage modules/valtype/cc_mastercard.man valtype::creditcard::mastercard]
[key matching]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[manpage modules/struct/graphops.man             struct::graph::op]
[key math]
[manpage modules/math/math.man             math]
[manpage modules/math/bigfloat.man         math::bigfloat]
[manpage modules/math/bignum.man           math::bignum]
[manpage modules/math/calculus.man         math::calculus]
[manpage modules/math/qcomplex.man         math::complexnumbers]
[manpage modules/math/constants.man        math::constants]
[manpage modules/math/fuzzy.man            math::fuzzy]
[manpage modules/math/geometry.man         math::geometry]
[manpage modules/math/interpolate.man      math::interpolate]
[manpage modules/math/linalg.man           math::linearalgebra]
[manpage modules/math/optimize.man         math::optimize]
[manpage modules/math/polynomials.man      math::polynomials]
[manpage modules/math/rational_funcs.man   math::rationalfunctions]
[manpage modules/math/special.man          math::special]
[manpage modules/simulation/annealing.man  simulation::annealing]
[manpage modules/simulation/montecarlo.man simulation::montecarlo]
[manpage modules/simulation/random.man     simulation::random]
[manpage modules/math/math.man                    math]
[manpage modules/math/bigfloat.man                math::bigfloat]
[manpage modules/math/bignum.man                  math::bignum]
[manpage modules/math/calculus.man                math::calculus]
[manpage modules/math/qcomplex.man                math::complexnumbers]
[manpage modules/math/constants.man               math::constants]
[manpage modules/math/decimal.man                 math::decimal]
[manpage modules/math/fuzzy.man                   math::fuzzy]
[manpage modules/math/math_geometry.man           math::geometry]
[manpage modules/math/interpolate.man             math::interpolate]
[manpage modules/math/linalg.man                  math::linearalgebra]
[manpage modules/math/optimize.man                math::optimize]
[manpage modules/math/polynomials.man             math::polynomials]
[manpage modules/math/rational_funcs.man          math::rationalfunctions]
[manpage modules/math/special.man                 math::special]
[manpage modules/simulation/annealing.man         simulation::annealing]
[manpage modules/simulation/montecarlo.man        simulation::montecarlo]
[manpage modules/simulation/simulation_random.man simulation::random]
[key mathematics]
[manpage modules/math/fourier.man    math::fourier]
[manpage modules/math/statistics.man math::statistics]
[key matrices]
[manpage modules/math/linalg.man math::linearalgebra]
[key matrix]
[manpage modules/csv/csv.man        csv]
[manpage modules/math/linalg.man    math::linearalgebra]
[manpage modules/report/report.man  report]
[manpage modules/struct/matrix.man  struct::matrix]
[manpage modules/struct/matrix1.man {struct::matrix v1}]
[manpage modules/struct/matrix1.man struct::matrix_v1]
[manpage modules/struct/queue.man   struct::queue]
[manpage modules/struct/stack.man   struct::stack]
[key {max cut}]
[manpage modules/struct/graphops.man struct::graph::op]
[key maximum]
[manpage modules/math/optimize.man math::optimize]
[key {maximum flow}]
[manpage modules/struct/graphops.man struct::graph::op]
[key md4]
[manpage modules/md4/md4.man          md4]
[manpage modules/ripemd/ripemd128.man ripemd128]
[manpage modules/ripemd/ripemd160.man ripemd160]
[key md5]
[manpage modules/md5/md5.man           md5]
[manpage modules/md5crypt/md5crypt.man md5crypt]
[key md5crypt]
[manpage modules/md5crypt/md5crypt.man md5crypt]
[key medicare]
[manpage modules/valtype/usnpi.man valtype::usnpi]
[key {mega widget}]
[manpage modules/snit/snit.man    snit]
[manpage modules/snit/snitfaq.man snitfaq]
[key membership]
[manpage modules/struct/struct_set.man struct::set]
[key menu]
[manpage modules/term/ansi_cmacros.man term::ansi::code::macros]
[manpage modules/term/imenu.man        term::interact::menu]
[key merge]
[manpage modules/virtchannel_base/randseed.man tcl::chan::randseed]
[manpage modules/uev/uevent_onidle.man uevent::onidle]
[manpage modules/uev/uevent_onidle.man         uevent::onidle]
[key {merge find}]
[manpage modules/struct/disjointset.man struct::disjointset]
[key merging]
[manpage modules/bench/bench.man bench]
[key message]
[manpage modules/comm/comm.man      comm]
[manpage modules/comm/comm_wire.man comm_wire]
[manpage modules/log/log.man        log]
[key {message catalog}]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man       doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man      doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man      doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man      doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_c.man       doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man      doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man      doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man      doctools::msgcat::toc::fr]
[key {message level}]
[manpage modules/log/log.man log]
[key {message package}]
[manpage modules/doctools2base/tcllib_msgcat.man doctools::msgcat]
[manpage modules/doctools2idx/msgcat_c.man       doctools::msgcat::idx::c]
[manpage modules/doctools2idx/msgcat_de.man      doctools::msgcat::idx::de]
[manpage modules/doctools2idx/msgcat_en.man      doctools::msgcat::idx::en]
[manpage modules/doctools2idx/msgcat_fr.man      doctools::msgcat::idx::fr]
[manpage modules/doctools2toc/msgcat_c.man       doctools::msgcat::toc::c]
[manpage modules/doctools2toc/msgcat_de.man      doctools::msgcat::toc::de]
[manpage modules/doctools2toc/msgcat_en.man      doctools::msgcat::toc::en]
[manpage modules/doctools2toc/msgcat_fr.man      doctools::msgcat::toc::fr]
[key message-digest]
[manpage modules/md4/md4.man           md4]
[manpage modules/md5/md5.man           md5]
[manpage modules/md5crypt/md5crypt.man md5crypt]
[manpage modules/otp/otp.man           otp]
[manpage modules/ripemd/ripemd128.man  ripemd128]
[manpage modules/ripemd/ripemd160.man  ripemd160]
[manpage modules/sha1/sha1.man         sha1]
[manpage modules/sha1/sha256.man       sha256]
[key metakit]
[manpage modules/tie/tie.man     tie]
[manpage modules/tie/tie_std.man tie]
[key method]
[manpage modules/interp/deleg_method.man  deleg_method]
[manpage modules/interp/tcllib_interp.man interp]
[key {method reference}]
[manpage modules/ooutil/ooutil.man oo::util]
[key mime]
[manpage modules/fumagic/cfront.man    fileutil::magic::cfront]
[manpage modules/fumagic/cgen.man      fileutil::magic::cgen]
[manpage modules/fumagic/mimetypes.man fileutil::magic::mimetype]
[manpage modules/fumagic/rtcore.man    fileutil::magic::rt]
[manpage modules/mime/mime.man         mime]
[manpage modules/mime/smtp.man         smtp]
[key {minimal spanning tree}]
[manpage modules/struct/graphops.man struct::graph::op]
[key minimum]
[manpage modules/math/optimize.man math::optimize]
[key {minimum cost flow}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {minimum degree spanning tree}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {minimum diameter spanning tree}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {mobile phone}]
[manpage modules/valtype/imei.man valtype::imei]
[key module]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[key {montecarlo simulation}]
[manpage modules/simulation/montecarlo.man simulation::montecarlo]
[key move]
[manpage modules/fileutil/multi.man   fileutil::multi]
[manpage modules/fileutil/multiop.man fileutil::multi::op]
[key multi-file]
[manpage modules/fileutil/multi.man   fileutil::multi]
[manpage modules/fileutil/multiop.man fileutil::multi::op]
[key multiplexer]
[manpage modules/multiplexer/multiplexer.man multiplexer]
[key multiprecision]
[manpage modules/math/bigfloat.man math::bigfloat]
[manpage modules/math/bignum.man   math::bignum]
[key {my method}]
[manpage modules/ooutil/ooutil.man oo::util]
[key {name service}]
[manpage modules/nns/nns_client.man   nameserv]
[manpage modules/nns/nns_auto.man     nameserv::auto]
[manpage modules/nns/nns_common.man   nameserv::common]
[manpage modules/nns/nns_protocol.man nameserv::protocol]
[manpage modules/nns/nns_server.man   nameserv::server]
[manpage apps/nns.man                 nns]
[manpage modules/nns/nns_intro.man    nns_intro]
[manpage apps/nnsd.man                nnsd]
[manpage apps/nnslog.man              nnslog]
[key {namespace unknown}]
[manpage modules/namespacex/namespacex.man namespacex]
[key {namespace utilities}]
[manpage modules/namespacex/namespacex.man namespacex]
[key {National Provider Identifier}]
[manpage modules/valtype/usnpi.man valtype::usnpi]
[key neighbour]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graphops.man struct::graph::op]
[key net]
[manpage modules/ftp/ftp.man        ftp]
[manpage modules/ftp/ftp_geturl.man ftp::geturl]
[manpage modules/imap4/imap4.man    imap4]
[manpage modules/mime/mime.man      mime]
[manpage modules/mime/smtp.man      smtp]
[key network]
[manpage modules/pop3d/pop3d.man      pop3d]
[manpage modules/pop3d/pop3d_dbox.man pop3d::dbox]
[manpage modules/pop3d/pop3d_udb.man  pop3d::udb]
[key news]
1083
1084
1085
1086
1087
1088
1089


1090
1091
1092
1093
1094


1095
1096
1097
1098
1099
1100












1101
1102





1103
1104
1105
1106
1107
1108
1109
1110



1111
1112


1113
1114
1115
1116
1117


1118
1119
1120
1121


1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134





1135










































1136

1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
























1164
1165
1166








































1167
1168
1169
1170
1171












































1172
1173
1174
1175
1176
1177
1178
1179


1180
1181
1182
1183
1184
1185









































1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199


1200
1201



1202
1203

1204
1205
1206

















1207
1208
1209
1210
1211
1212
1213
1214

1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233


1234
1235
1236
1237
1238


1239
1240





1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256




1257
1258
1259
1260









































1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274



1275
1276

1277
1278
1279
1280
1281
1282
1283
1284
1285
1286



1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301









































1302

1303







































1304
1305
1306
1307
1308
1309
1310
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958





1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066

2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077

















2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102


2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143




2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200



2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263

2264
2265


2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289

2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319

2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345



2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404

2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430



2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473

2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519







+
+





+
+

-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+


+
+
+
+
+








+
+
+


+
+





+
+




+
+













+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+










-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








+
+



-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+














+
+


+
+
+

-
+

-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







-
+



















+
+





+
+

-
+
+
+
+
+
















+
+
+
+

-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+














+
+
+

-
+










+
+
+












-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







[manpage modules/nntp/nntp.man nntp]
[key no-op]
[manpage modules/control/control.man control]
[key node]
[manpage modules/struct/graph.man       struct::graph]
[manpage modules/struct/graphops.man    struct::graph::op]
[manpage modules/struct/struct_tree.man struct::tree]
[key nominatim]
[manpage modules/map/map_geocode_nominatim.man map::geocode::nominatim]
[key normalization]
[manpage modules/bench/bench.man               bench]
[manpage modules/page/page_util_norm_lemon.man page_util_norm_lemon]
[manpage modules/page/page_util_norm_peg.man   page_util_norm_peg]
[manpage modules/stringprep/unicode.man        unicode]
[key NPI]
[manpage modules/valtype/usnpi.man valtype::usnpi]
[key nroff]
[manpage modules/doctools/doctools.man doctools]
[manpage modules/doctools/docidx.man   doctools::idx]
[manpage modules/doctools/doctoc.man   doctools::toc]
[manpage apps/dtplite.man              dtplite]
[manpage modules/doctools/mpexpand.man mpexpand]
[manpage modules/doctools/doctools.man             doctools]
[manpage modules/doctools2idx/container.man        doctools::idx]
[manpage modules/doctools/docidx.man               doctools::idx]
[manpage modules/doctools2idx/export.man           doctools::idx::export]
[manpage modules/doctools2idx/export_nroff.man     doctools::idx::export::nroff]
[manpage modules/doctools2base/nroff_manmacros.man doctools::nroff::man_macros]
[manpage modules/doctools2toc/container.man        doctools::toc]
[manpage modules/doctools/doctoc.man               doctools::toc]
[manpage modules/doctools2toc/export.man           doctools::toc::export]
[manpage modules/doctools2toc/export_nroff.man     doctools::toc::export::nroff]
[manpage apps/dtplite.man                          dtplite]
[manpage modules/doctools/mpexpand.man             mpexpand]
[key NTP]
[manpage modules/ntp/ntp_time.man ntp_time]
[key null]
[manpage modules/virtchannel_base/null.man     tcl::chan::null]
[manpage modules/virtchannel_base/nullzero.man tcl::chan::nullzero]
[key {number theory}]
[manpage modules/math/numtheory.man math::numtheory]
[key object]
[manpage modules/snit/snit.man     snit]
[manpage modules/snit/snitfaq.man  snitfaq]
[manpage modules/stooop/stooop.man stooop]
[key {object oriented}]
[manpage modules/snit/snit.man     snit]
[manpage modules/snit/snitfaq.man  snitfaq]
[manpage modules/stooop/stooop.man stooop]
[key observer]
[manpage modules/hook/hook.man                     hook]
[manpage modules/virtchannel_transform/observe.man tcl::transform::observe]
[key on-idle]
[manpage modules/uev/uevent_onidle.man uevent::onidle]
[key {one time pad}]
[manpage modules/virtchannel_transform/otp.man tcl::transform::otp]
[key optimization]
[manpage modules/math/optimize.man        math::optimize]
[manpage modules/simulation/annealing.man simulation::annealing]
[key {ordered list}]
[manpage modules/struct/prioqueue.man struct::prioqueue]
[key otp]
[manpage modules/virtchannel_transform/otp.man tcl::transform::otp]
[key {outer join}]
[manpage modules/struct/struct_list.man struct::list]
[key package]
[manpage modules/csv/csv.man csv]
[key {package indexing}]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[key page]
[manpage modules/page/page_intro.man           page_intro]
[manpage modules/page/page_pluginmgr.man       page_pluginmgr]
[manpage modules/page/page_util_flow.man       page_util_flow]
[manpage modules/page/page_util_norm_lemon.man page_util_norm_lemon]
[manpage modules/page/page_util_norm_peg.man   page_util_norm_peg]
[manpage modules/page/page_util_peg.man        page_util_peg]
[manpage modules/page/page_util_quote.man      page_util_quote]
[key pager]
[manpage modules/term/ipager.man term::interact::pager]
[key paragraph]
[manpage modules/textutil/textutil.man textutil]
[manpage modules/textutil/adjust.man   textutil::adjust]
[key PARAM]
[manpage modules/pt/pt_peg_to_param.man pt::peg::to::param]
[key {parameter entry form}]
[manpage modules/tepam/tepam_introduction.man       tepam]
[manpage modules/tepam/tepam_argument_dialogbox.man tepam::argument_dialogbox]
[key parser]
[manpage modules/doctools2idx/parse.man          doctools::idx::parse]
[manpage modules/doctools2base/tcl_parse.man     doctools::tcl::parse]
[manpage modules/doctools2toc/parse.man          doctools::toc::parse]
[manpage modules/grammar_aycock/aycock.man       grammar::aycock]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[manpage modules/amazon-s3/xsxp.man xsxp]
[manpage modules/amazon-s3/xsxp.man              xsxp]
[key {parser generator}]
[manpage apps/page.man                         page]
[manpage modules/page/page_intro.man           page_intro]
[manpage modules/page/page_pluginmgr.man       page_pluginmgr]
[manpage modules/page/page_util_flow.man       page_util_flow]
[manpage modules/page/page_util_norm_lemon.man page_util_norm_lemon]
[manpage modules/page/page_util_norm_peg.man   page_util_norm_peg]
[manpage modules/page/page_util_peg.man        page_util_peg]
[manpage modules/page/page_util_quote.man      page_util_quote]
[key parsing]
[manpage modules/bench/bench_read.man       bench::in]
[manpage modules/bibtex/bibtex.man          bibtex]
[manpage modules/grammar_fa/fa.man          grammar::fa]
[manpage modules/grammar_fa/dacceptor.man   grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man       grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man        grammar::fa::op]
[manpage modules/grammar_me/me_cpu.man      grammar::me::cpu]
[manpage modules/grammar_me/me_cpucore.man  grammar::me::cpu::core]
[manpage modules/grammar_me/gasm.man        grammar::me::cpu::gasm]
[manpage modules/grammar_me/me_tcl.man      grammar::me::tcl]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_me/me_vm.man       grammar::me_vm]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/htmlparse/htmlparse.man    htmlparse]
[manpage modules/yaml/huddle.man            huddle]
[manpage modules/yaml/yaml.man              yaml]
[manpage modules/bench/bench_read.man          bench::in]
[manpage modules/bibtex/bibtex.man             bibtex]
[manpage modules/doctools2idx/introduction.man doctools2idx_introduction]
[manpage modules/doctools2toc/introduction.man doctools2toc_introduction]
[manpage modules/doctools2idx/container.man    doctools::idx]
[manpage modules/doctools2idx/import.man       doctools::idx::import]
[manpage modules/doctools2toc/container.man    doctools::toc]
[manpage modules/doctools2toc/import.man       doctools::toc::import]
[manpage modules/grammar_aycock/aycock.man     grammar::aycock]
[manpage modules/grammar_fa/fa.man             grammar::fa]
[manpage modules/grammar_fa/dacceptor.man      grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man          grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man           grammar::fa::op]
[manpage modules/grammar_me/me_cpu.man         grammar::me::cpu]
[manpage modules/grammar_me/me_cpucore.man     grammar::me::cpu::core]
[manpage modules/grammar_me/gasm.man           grammar::me::cpu::gasm]
[manpage modules/grammar_me/me_tcl.man         grammar::me::tcl]
[manpage modules/grammar_me/me_intro.man       grammar::me_intro]
[manpage modules/grammar_me/me_vm.man          grammar::me_vm]
[manpage modules/grammar_peg/peg.man           grammar::peg]
[manpage modules/grammar_peg/peg_interp.man    grammar::peg::interp]
[manpage modules/htmlparse/htmlparse.man       htmlparse]
[manpage modules/yaml/huddle.man               huddle]
[manpage modules/yaml/yaml.man                 yaml]
[key {parsing expression}]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key {parsing expression grammar}]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/page/page_util_peg.man     page_util_peg]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/page/page_util_peg.man          page_util_peg]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key {partial application}]
[manpage modules/lambda/lambda.man lambda]
[key partition]
[manpage modules/struct/disjointset.man struct::disjointset]
[key {partitioned set}]
[manpage modules/struct/disjointset.man struct::disjointset]
[key passive]
[manpage modules/transfer/connect.man transfer::connect]
[key password]
[manpage modules/otp/otp.man otp]
[key patch]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[key patching]
[manpage modules/rcs/rcs.man rcs]
[key PEG]
[manpage modules/grammar_me/me_intro.man     grammar::me_intro]
[manpage modules/page/page_util_norm_peg.man page_util_norm_peg]
[manpage modules/page/page_util_peg.man      page_util_peg]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/page/page_util_norm_peg.man     page_util_norm_peg]
[manpage modules/page/page_util_peg.man          page_util_peg]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key performance]
[manpage modules/bench/bench.man            bench]
[manpage modules/bench/bench_read.man       bench::in]
[manpage modules/bench/bench_wcsv.man       bench::out::csv]
[manpage modules/bench/bench_wtext.man      bench::out::text]
[manpage modules/bench/bench_intro.man      bench_intro]
[manpage modules/bench/bench_lang_intro.man bench_lang_intro]
[manpage modules/bench/bench_lang_spec.man  bench_lang_spec]
[manpage modules/profiler/profiler.man      profiler]
[key permutation]
[manpage modules/struct/struct_list.man struct::list]
[key persistence]
[manpage modules/tie/tie.man     tie]
[manpage modules/tie/tie_std.man tie]
[key phone]
[manpage modules/valtype/imei.man valtype::imei]
[key pi]
[manpage modules/math/constants.man math::constants]
[key {plain text}]
[manpage modules/doctools2idx/export_text.man doctools::idx::export::text]
[manpage modules/doctools2toc/export_text.man doctools::toc::export::text]
[key {plane geometry}]
[manpage modules/math/geometry.man math::geometry]
[manpage modules/math/math_geometry.man math::geometry]
[key plugin]
[manpage modules/doctools/docidx_plugin_apiref.man docidx_plugin_apiref]
[manpage modules/doctools/doctoc_plugin_apiref.man doctoc_plugin_apiref]
[manpage modules/doctools/docidx_plugin_apiref.man  docidx_plugin_apiref]
[manpage modules/doctools/doctoc_plugin_apiref.man  doctoc_plugin_apiref]
[manpage modules/doctools2idx/introduction.man      doctools2idx_introduction]
[manpage modules/doctools2toc/introduction.man      doctools2toc_introduction]
[manpage modules/doctools2base/html_cssdefaults.man doctools::html::cssdefaults]
[manpage modules/doctools2idx/container.man         doctools::idx]
[manpage modules/doctools2idx/export.man            doctools::idx::export]
[manpage modules/doctools2idx/import.man            doctools::idx::import]
[manpage modules/doctools2base/nroff_manmacros.man  doctools::nroff::man_macros]
[manpage modules/doctools2toc/container.man         doctools::toc]
[manpage modules/doctools2toc/export.man            doctools::toc::export]
[manpage modules/doctools2toc/import.man            doctools::toc::import]
[manpage modules/pt/pt_peg_export_container.man     pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man          pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man           pt::peg::export::peg]
[manpage modules/pt/pt_peg_import_json.man          pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man           pt::peg::import::peg]
[key {plugin management}]
[manpage modules/pluginmgr/pluginmgr.man pluginmgr]
[key {plugin search}]
[manpage modules/pluginmgr/pluginmgr.man pluginmgr]
[key png]
[manpage modules/png/png.man png]
[key point]
[manpage modules/math/geometry.man math::geometry]
[manpage modules/math/math_geometry.man math::geometry]
[key {polynomial functions}]
[manpage modules/math/polynomials.man math::polynomials]
[key pool]
[manpage modules/struct/pool.man  struct::pool]
[manpage modules/struct/queue.man struct::queue]
[key pop]
[manpage modules/pop3/pop3.man pop3]
[key pop3]
[manpage modules/pop3/pop3.man        pop3]
[manpage modules/pop3d/pop3d.man      pop3d]
[manpage modules/pop3d/pop3d_dbox.man pop3d::dbox]
[manpage modules/pop3d/pop3d_udb.man  pop3d::udb]
[key post-order]
[manpage modules/struct/struct_tree.man struct::tree]
[key pre-order]
[manpage modules/struct/struct_tree.man struct::tree]
[key prefix]
[manpage modules/textutil/textutil_string.man textutil::string]
[manpage modules/textutil/trim.man            textutil::trim]
[key prime]
[manpage modules/math/numtheory.man math::numtheory]
[key prioqueue]
[manpage modules/struct/prioqueue.man struct::prioqueue]
[manpage modules/struct/queue.man     struct::queue]
[key {priority queue}]
[manpage modules/struct/prioqueue.man struct::prioqueue]
[key proc]
[manpage modules/lambda/lambda.man lambda]
[key procedure]
[manpage modules/interp/deleg_proc.man deleg_proc]
[manpage modules/interp/deleg_proc.man        deleg_proc]
[manpage modules/tepam/tepam_introduction.man tepam]
[manpage modules/tepam/tepam_procedure.man    tepam::procedure]
[key producer]
[manpage modules/hook/hook.man hook]
[key profile]
[manpage modules/profiler/profiler.man profiler]
[key projection]
[manpage modules/mapproj/mapproj.man mapproj]
[key prospero]
[manpage modules/uri/uri.man uri]
[key protocol]
[manpage modules/asn/asn.man          asn]
[manpage modules/ldap/ldap.man        ldap]
[manpage modules/ldap/ldapx.man       ldapx]
[manpage modules/nns/nns_protocol.man nameserv::protocol]
[manpage modules/pop3d/pop3d.man      pop3d]
[manpage modules/pop3d/pop3d_dbox.man pop3d::dbox]
[manpage modules/pop3d/pop3d_udb.man  pop3d::udb]
[key proxy]
[manpage modules/http/autoproxy.man autoproxy]
[key {public key cipher}]
[manpage modules/pki/pki.man pki]
[key publisher]
[manpage modules/hook/hook.man hook]
[key {push down automaton}]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key queue]
[manpage modules/csv/csv.man             csv]
[manpage modules/htmlparse/htmlparse.man htmlparse]
[manpage modules/struct/stack.man        struct::stack]
[manpage modules/transfer/tqueue.man     transfer::copy::queue]
[key quoting]
[manpage modules/page/page_util_quote.man page_util_quote]
[key radians]
[manpage modules/math/constants.man math::constants]
[manpage modules/units/units.man    units]
[key radiobutton]
[manpage modules/html/html.man html]
[key radius]
[manpage modules/struct/graphops.man struct::graph::op]
[key random]
[manpage modules/virtchannel_base/random.man   tcl::chan::random]
[manpage modules/virtchannel_base/randseed.man tcl::chan::randseed]
[key {random numbers}]
[manpage modules/simulation/random.man simulation::random]
[manpage modules/simulation/simulation_random.man simulation::random]
[key {rational functions}]
[manpage modules/math/rational_funcs.man math::rationalfunctions]
[key raw]
[manpage modules/term/ansi_ctrlu.man term::ansi::ctrl::unix]
[key rc4]
[manpage modules/rc4/rc4.man rc4]
[key RCS]
[manpage modules/rcs/rcs.man rcs]
[key {RCS patch}]
[manpage modules/rcs/rcs.man rcs]
[key read]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key reading]
[manpage modules/bench/bench_read.man bench::in]
[key receiver]
[manpage modules/term/receive.man      term::receive]
[manpage modules/term/term_bind.man    term::receive::bind]
[manpage modules/transfer/receiver.man transfer::receiver]
[key reconnect]
[manpage modules/nns/nns_auto.man nameserv::auto]
[key record]
[manpage modules/struct/queue.man  struct::queue]
[manpage modules/struct/record.man struct::record]
[key {recursive descent}]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key reduce]
[manpage modules/generator/generator.man generator]
[manpage modules/struct/struct_list.man struct::list]
[manpage modules/struct/struct_list.man  struct::list]
[key reference]
[manpage modules/doctools2idx/container.man doctools::idx]
[manpage modules/doctools2idx/export.man    doctools::idx::export]
[manpage modules/doctools2idx/import.man    doctools::idx::import]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools2toc/export.man    doctools::toc::export]
[manpage modules/doctools2toc/import.man    doctools::toc::import]
[key {reflected channel}]
[manpage modules/virtchannel_base/cat.man            tcl::chan::cat]
[manpage modules/virtchannel_core/core.man           tcl::chan::core]
[manpage modules/virtchannel_core/events.man         tcl::chan::events]
[manpage modules/virtchannel_base/facade.man         tcl::chan::facade]
[manpage modules/virtchannel_base/fifo.man           tcl::chan::fifo]
[manpage modules/virtchannel_base/fifo2.man          tcl::chan::fifo2]
[manpage modules/virtchannel_base/halfpipe.man       tcl::chan::halfpipe]
[manpage modules/virtchannel_base/memchan.man        tcl::chan::memchan]
[manpage modules/virtchannel_base/null.man           tcl::chan::null]
[manpage modules/virtchannel_base/nullzero.man       tcl::chan::nullzero]
[manpage modules/virtchannel_base/random.man         tcl::chan::random]
[manpage modules/virtchannel_base/randseed.man       tcl::chan::randseed]
[manpage modules/virtchannel_base/std.man            tcl::chan::std]
[manpage modules/virtchannel_base/string.man         tcl::chan::string]
[manpage modules/virtchannel_base/textwindow.man     tcl::chan::textwindow]
[manpage modules/virtchannel_base/variable.man       tcl::chan::variable]
[manpage modules/virtchannel_base/zero.man           tcl::chan::zero]
[manpage modules/virtchannel_transform/adler32.man   tcl::transform::adler32]
[manpage modules/virtchannel_transform/base64.man    tcl::transform::base64]
[manpage modules/virtchannel_core/transformcore.man  tcl::transform::core]
[manpage modules/virtchannel_transform/counter.man   tcl::transform::counter]
[manpage modules/virtchannel_transform/crc32.man     tcl::transform::crc32]
[manpage modules/virtchannel_transform/hex.man       tcl::transform::hex]
[manpage modules/virtchannel_transform/identity.man  tcl::transform::identity]
[manpage modules/virtchannel_transform/limitsize.man tcl::transform::limitsize]
[manpage modules/virtchannel_transform/observe.man   tcl::transform::observe]
[manpage modules/virtchannel_transform/otp.man       tcl::transform::otp]
[manpage modules/virtchannel_transform/rot.man       tcl::transform::rot]
[manpage modules/virtchannel_transform/spacer.man    tcl::transform::spacer]
[manpage modules/virtchannel_transform/zlib.man      tcl::transform::zlib]
[key {regular expression}]
[manpage modules/grammar_fa/fa.man           grammar::fa]
[manpage modules/grammar_fa/dacceptor.man    grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man        grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man         grammar::fa::op]
[manpage modules/textutil/textutil.man       textutil]
[manpage modules/textutil/textutil_split.man textutil::split]
1331
1332
1333
1334
1335
1336
1337




1338
1339


1340
1341
1342
1343
1344
1345
1346
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561







+
+
+
+


+
+







[key repeating]
[manpage modules/struct/struct_list.man struct::list]
[key repetition]
[manpage modules/struct/struct_list.man struct::list]
[manpage modules/textutil/repeat.man    textutil::repeat]
[key report]
[manpage modules/report/report.man report]
[key reshuffle]
[manpage modules/struct/struct_list.man struct::list]
[key {residual graph}]
[manpage modules/struct/graphops.man struct::graph::op]
[key resolver]
[manpage modules/dns/tcllib_dns.man dns]
[key {resource management}]
[manpage modules/try/tcllib_try.man try]
[key restore]
[manpage modules/nns/nns_auto.man nameserv::auto]
[key reverse]
[manpage modules/struct/struct_list.man struct::list]
[key {rfc 821}]
[manpage modules/mime/mime.man   mime]
[manpage modules/mime/smtp.man   smtp]
1415
1416
1417
1418
1419
1420
1421


1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433




1434
1435
1436
1437
1438
1439
1440


1441
1442
1443
1444
1445
1446


1447
1448







1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459

1460
1461
1462
1463
1464
1465


1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480


1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492






























1493

1494
1495
1496
1497
1498





1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510




1511
1512
1513
1514





1515
1516
1517
1518
1519
1520
1521
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726



2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758





2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782

2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794







+
+












+
+
+
+







+
+






+
+


+
+
+
+
+
+
+











+






+
+















+
+









-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
-
-
-
-
-
+
+
+
+
+












+
+
+
+



-
+
+
+
+
+







[manpage modules/ldap/ldapx.man ldapx]
[key {rfc 3207}]
[manpage modules/mime/smtp.man smtp]
[key {rfc 3513}]
[manpage modules/dns/tcllib_ip.man tcllib_ip]
[key {rfc 4511}]
[manpage modules/ldap/ldap.man ldap]
[key rfc3501]
[manpage modules/imap4/imap4.man imap4]
[key rfc3548]
[manpage modules/base32/base32.man    base32]
[manpage modules/base32/base32hex.man base32::hex]
[key {right outer join}]
[manpage modules/struct/struct_list.man struct::list]
[key RIPEMD]
[manpage modules/ripemd/ripemd128.man ripemd128]
[manpage modules/ripemd/ripemd160.man ripemd160]
[key {roman numeral}]
[manpage modules/math/roman.man math::roman]
[key roots]
[manpage modules/math/calculus.man math::calculus]
[key rot]
[manpage modules/virtchannel_transform/rot.man tcl::transform::rot]
[key rot13]
[manpage modules/virtchannel_transform/rot.man tcl::transform::rot]
[key rounding]
[manpage modules/math/fuzzy.man math::fuzzy]
[key rows]
[manpage modules/term/ansi_ctrlu.man term::ansi::ctrl::unix]
[key rpc]
[manpage modules/comm/comm.man      comm]
[manpage modules/comm/comm_wire.man comm_wire]
[key rsa]
[manpage modules/pki/pki.man pki]
[key running]
[manpage modules/grammar_fa/dexec.man grammar::fa::dexec]
[key s3]
[manpage modules/amazon-s3/S3.man S3]
[key SASL]
[manpage modules/sasl/sasl.man SASL]
[key scanl]
[manpage modules/generator/generator.man generator]
[key SCCS]
[manpage modules/rcs/rcs.man rcs]
[key secure]
[manpage modules/comm/comm.man            comm]
[manpage modules/pop3/pop3.man            pop3]
[manpage modules/pop3d/pop3d.man          pop3d]
[manpage modules/transfer/connect.man     transfer::connect]
[manpage modules/transfer/receiver.man    transfer::receiver]
[manpage modules/transfer/transmitter.man transfer::transmitter]
[key security]
[manpage modules/aes/aes.man           aes]
[manpage modules/blowfish/blowfish.man blowfish]
[manpage modules/crc/cksum.man         cksum]
[manpage modules/crc/crc16.man         crc16]
[manpage modules/crc/crc32.man         crc32]
[manpage modules/des/des.man           des]
[manpage modules/md4/md4.man           md4]
[manpage modules/md5/md5.man           md5]
[manpage modules/md5crypt/md5crypt.man md5crypt]
[manpage modules/otp/otp.man           otp]
[manpage modules/pki/pki.man           pki]
[manpage modules/rc4/rc4.man           rc4]
[manpage modules/ripemd/ripemd128.man  ripemd128]
[manpage modules/ripemd/ripemd160.man  ripemd160]
[manpage modules/sha1/sha1.man         sha1]
[manpage modules/sha1/sha256.man       sha256]
[manpage modules/crc/sum.man           sum]
[key seed]
[manpage modules/virtchannel_base/randseed.man tcl::chan::randseed]
[key selectionbox]
[manpage modules/javascript/javascript.man javascript]
[key {semantic markup}]
[manpage modules/doctools/docidx_intro.man           docidx_intro]
[manpage modules/doctools/docidx_lang_cmdref.man     docidx_lang_cmdref]
[manpage modules/doctools/docidx_lang_faq.man        docidx_lang_faq]
[manpage modules/doctools/docidx_lang_intro.man      docidx_lang_intro]
[manpage modules/doctools/docidx_lang_syntax.man     docidx_lang_syntax]
[manpage modules/doctools/docidx_plugin_apiref.man   docidx_plugin_apiref]
[manpage modules/doctools/doctoc_intro.man           doctoc_intro]
[manpage modules/doctools/doctoc_lang_cmdref.man     doctoc_lang_cmdref]
[manpage modules/doctools/doctoc_lang_faq.man        doctoc_lang_faq]
[manpage modules/doctools/doctoc_lang_intro.man      doctoc_lang_intro]
[manpage modules/doctools/doctoc_lang_syntax.man     doctoc_lang_syntax]
[manpage modules/doctools/doctoc_plugin_apiref.man   doctoc_plugin_apiref]
[manpage modules/doctools2idx/introduction.man       doctools2idx_introduction]
[manpage modules/doctools2toc/introduction.man       doctools2toc_introduction]
[manpage modules/doctools/doctools_intro.man         doctools_intro]
[manpage modules/doctools/doctools_lang_cmdref.man   doctools_lang_cmdref]
[manpage modules/doctools/doctools_lang_faq.man      doctools_lang_faq]
[manpage modules/doctools/doctools_lang_intro.man    doctools_lang_intro]
[manpage modules/doctools/doctools_lang_syntax.man   doctools_lang_syntax]
[manpage modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref]
[key send]
[manpage modules/comm/comm.man comm]
[key serialization]
[manpage modules/bee/bee.man            bee]
[manpage modules/struct/graph.man       struct::graph]
[manpage modules/struct/struct_tree.man struct::tree]
[manpage modules/bee/bee.man                    bee]
[manpage modules/doctools2idx/export_docidx.man doctools::idx::export::docidx]
[manpage modules/doctools2idx/export_html.man   doctools::idx::export::html]
[manpage modules/doctools2idx/export_json.man   doctools::idx::export::json]
[manpage modules/doctools2idx/export_nroff.man  doctools::idx::export::nroff]
[manpage modules/doctools2idx/export_text.man   doctools::idx::export::text]
[manpage modules/doctools2idx/export_wiki.man   doctools::idx::export::wiki]
[manpage modules/doctools2idx/structure.man     doctools::idx::structure]
[manpage modules/doctools2toc/export_doctoc.man doctools::toc::export::doctoc]
[manpage modules/doctools2toc/export_html.man   doctools::toc::export::html]
[manpage modules/doctools2toc/export_json.man   doctools::toc::export::json]
[manpage modules/doctools2toc/export_nroff.man  doctools::toc::export::nroff]
[manpage modules/doctools2toc/export_text.man   doctools::toc::export::text]
[manpage modules/doctools2toc/export_wiki.man   doctools::toc::export::wiki]
[manpage modules/doctools2toc/structure.man     doctools::toc::structure]
[manpage modules/pt/pt_peg_export_container.man pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man      pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man       pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_json.man        pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man         pt::peg::from::peg]
[manpage modules/pt/pt_peg_import_json.man      pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man       pt::peg::import::peg]
[manpage modules/pt/pt_peg_to_container.man     pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man        pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man          pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man         pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man           pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man      pt::peg::to::tclparam]
[manpage modules/struct/graph.man               struct::graph]
[manpage modules/struct/struct_tree.man         struct::tree]
[key server]
[manpage modules/map/map_geocode_nominatim.man map::geocode::nominatim]
[manpage modules/map/map_slippy_fetcher.man map::slippy::fetcher]
[manpage modules/nns/nns_common.man         nameserv::common]
[manpage modules/nns/nns_server.man         nameserv::server]
[manpage modules/nns/nns_intro.man          nns_intro]
[manpage apps/nnsd.man                      nnsd]
[manpage modules/map/map_slippy_fetcher.man    map::slippy::fetcher]
[manpage modules/nns/nns_common.man            nameserv::common]
[manpage modules/nns/nns_server.man            nameserv::server]
[manpage modules/nns/nns_intro.man             nns_intro]
[manpage apps/nnsd.man                         nnsd]
[key service]
[manpage modules/log/logger.man logger]
[key services]
[manpage modules/ftpd/ftpd.man   ftpd]
[manpage modules/smtpd/smtpd.man smtpd]
[key set]
[manpage modules/struct/queue.man      struct::queue]
[manpage modules/struct/struct_set.man struct::set]
[key sha1]
[manpage modules/sha1/sha1.man sha1]
[key sha256]
[manpage modules/sha1/sha256.man sha256]
[key {shortest path}]
[manpage modules/struct/graphops.man struct::graph::op]
[key shuffle]
[manpage modules/struct/struct_list.man struct::list]
[key {simulated annealing}]
[manpage modules/simulation/annealing.man simulation::annealing]
[key simulation]
[manpage modules/simulation/random.man simulation::random]
[manpage modules/simulation/simulation_random.man simulation::random]
[key singleton]
[manpage modules/ooutil/ooutil.man oo::util]
[key {size limit}]
[manpage modules/virtchannel_transform/limitsize.man tcl::transform::limitsize]
[key skiplist]
[manpage modules/struct/queue.man    struct::queue]
[manpage modules/struct/skiplist.man struct::skiplist]
[key slippy]
[manpage modules/map/map_slippy.man         map::slippy]
[manpage modules/map/map_slippy_cache.man   map::slippy::cache]
[manpage modules/map/map_slippy_fetcher.man map::slippy::fetcher]
1538
1539
1540
1541
1542
1543
1544


1545
1546
1547
1548
1549
1550
1551
1552
1553
1554










1555
1556


1557
1558
1559
1560
1561
1562
1563














































1564
1565

1566
1567
1568
1569




1570
1571
1572
1573


1574
1575
1576
1577
1578
1579
1580
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844






2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891

2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913







+
+










+
+
+
+
+
+
+
+
+
+


+
+

-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
+




+
+
+
+




+
+







[manpage modules/smtpd/smtpd.man    smtpd]
[key soundex]
[manpage modules/soundex/soundex.man soundex]
[key source]
[manpage modules/docstrip/docstrip.man      docstrip]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[manpage apps/tcldocstrip.man               tcldocstrip]
[key spacing]
[manpage modules/virtchannel_transform/spacer.man tcl::transform::spacer]
[key {spatial interpolation}]
[manpage modules/math/interpolate.man math::interpolate]
[key {special functions}]
[manpage modules/math/special.man math::special]
[key specification]
[manpage modules/bench/bench_lang_spec.man bench_lang_spec]
[key speed]
[manpage modules/profiler/profiler.man profiler]
[key split]
[manpage modules/textutil/textutil_split.man textutil::split]
[key {squared graph}]
[manpage modules/struct/graphops.man struct::graph::op]
[key ssl]
[manpage modules/comm/comm.man            comm]
[manpage modules/imap4/imap4.man          imap4]
[manpage modules/pop3/pop3.man            pop3]
[manpage modules/pop3d/pop3d.man          pop3d]
[manpage modules/transfer/connect.man     transfer::connect]
[manpage modules/transfer/receiver.man    transfer::receiver]
[manpage modules/transfer/transmitter.man transfer::transmitter]
[key stack]
[manpage modules/struct/queue.man struct::queue]
[key {standard io}]
[manpage modules/virtchannel_base/std.man tcl::chan::std]
[key state]
[manpage modules/grammar_fa/fa.man          grammar::fa]
[manpage modules/grammar_fa/dacceptor.man   grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man       grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man        grammar::fa::op]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_fa/fa.man               grammar::fa]
[manpage modules/grammar_fa/dacceptor.man        grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man            grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man             grammar::fa::op]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key {state (de)serialization}]
[manpage modules/namespacex/namespacex.man namespacex]
[key {statistical distribution}]
[manpage modules/simulation/random.man simulation::random]
[manpage modules/simulation/simulation_random.man simulation::random]
[key statistics]
[manpage modules/counter/counter.man counter]
[manpage modules/math/math.man       math]
[manpage modules/math/statistics.man math::statistics]
[key stdin]
[manpage modules/virtchannel_base/std.man tcl::chan::std]
[key stdout]
[manpage modules/virtchannel_base/std.man tcl::chan::std]
[key {stochastic modelling}]
[manpage modules/simulation/montecarlo.man simulation::montecarlo]
[key {stream cipher}]
[manpage modules/rc4/rc4.man rc4]
[key {stream copy}]
[manpage modules/virtchannel_transform/observe.man tcl::transform::observe]
[key string]
[manpage modules/textutil/textutil.man        textutil]
[manpage modules/textutil/adjust.man          textutil::adjust]
[manpage modules/textutil/expander.man        textutil::expander]
[manpage modules/textutil/repeat.man          textutil::repeat]
[manpage modules/textutil/textutil_split.man  textutil::split]
[manpage modules/textutil/textutil_string.man textutil::string]
1589
1590
1591
1592
1593
1594
1595





1596
1597
1598


1599
1600


1601
1602


1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613



1614
1615


1616
1617
1618


1619










1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630










1631
1632




1633
1634
1635








































1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654














1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668






1669
1670
1671
1672
1673
1674
1675
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960


2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006


3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091


3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104







+
+
+
+
+



+
+


+
+


+
+











+
+
+
-
-
+
+



+
+

+
+
+
+
+
+
+
+
+
+











+
+
+
+
+
+
+
+
+
+


+
+
+
+

-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



















+
+
+
+
+
+
+
+
+
+
+
+
+
+












-
-
+
+
+
+
+
+







[key struct]
[manpage modules/struct/pool.man   struct::pool]
[manpage modules/struct/record.man struct::record]
[key structure]
[manpage modules/control/control.man control]
[key {structured queries}]
[manpage modules/treeql/treeql.man treeql]
[key style]
[manpage modules/doctools2base/html_cssdefaults.man doctools::html::cssdefaults]
[key subcommand]
[manpage modules/tepam/tepam_introduction.man tepam]
[manpage modules/tepam/tepam_procedure.man    tepam::procedure]
[key subgraph]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graphops.man struct::graph::op]
[key subject]
[manpage modules/hook/hook.man hook]
[key submitbutton]
[manpage modules/javascript/javascript.man javascript]
[key subscriber]
[manpage modules/hook/hook.man hook]
[key subsequence]
[manpage modules/struct/struct_list.man struct::list]
[key subst]
[manpage modules/doctools2base/tcl_parse.man doctools::tcl::parse]
[key sum]
[manpage modules/crc/sum.man sum]
[key swapping]
[manpage modules/struct/struct_list.man struct::list]
[key {symmetric difference}]
[manpage modules/struct/struct_set.man struct::set]
[key synchronous]
[manpage modules/cache/async.man cache::async]
[key {syntax tree}]
[manpage modules/grammar_me/me_util.man grammar::me::util]
[key table]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools2toc/export.man    doctools::toc::export]
[manpage modules/doctools2toc/import.man    doctools::toc::import]
[manpage modules/html/html.man     html]
[manpage modules/report/report.man report]
[manpage modules/html/html.man              html]
[manpage modules/report/report.man          report]
[key {table of contents}]
[manpage modules/doctools/doctoc_intro.man         doctoc_intro]
[manpage modules/doctools/doctoc_plugin_apiref.man doctoc_plugin_apiref]
[manpage modules/doctools2toc/introduction.man     doctools2toc_introduction]
[manpage modules/doctools2toc/container.man        doctools::toc]
[manpage modules/doctools/doctoc.man               doctools::toc]
[manpage modules/doctools2toc/export.man           doctools::toc::export]
[manpage modules/doctools2toc/export_doctoc.man    doctools::toc::export::doctoc]
[manpage modules/doctools2toc/export_html.man      doctools::toc::export::html]
[manpage modules/doctools2toc/export_json.man      doctools::toc::export::json]
[manpage modules/doctools2toc/export_nroff.man     doctools::toc::export::nroff]
[manpage modules/doctools2toc/export_text.man      doctools::toc::export::text]
[manpage modules/doctools2toc/export_wiki.man      doctools::toc::export::wiki]
[manpage modules/doctools2toc/import.man           doctools::toc::import]
[manpage modules/doctools2toc/import_doctoc.man    doctools::toc::import::doctoc]
[manpage modules/doctools2toc/import_json.man      doctools::toc::import::json]
[key tabstops]
[manpage modules/textutil/tabify.man textutil::tabify]
[key tallying]
[manpage modules/counter/counter.man counter]
[key {tape archive}]
[manpage modules/tar/tar.man tar]
[key tar]
[manpage modules/tar/tar.man tar]
[key tcl]
[manpage modules/math/bigfloat.man math::bigfloat]
[manpage modules/math/bignum.man   math::bignum]
[manpage modules/math/decimal.man  math::decimal]
[key {Tcl module}]
[manpage modules/docstrip/docstrip_util.man docstrip_util]
[key {Tcl syntax}]
[manpage modules/doctools2base/tcl_parse.man doctools::tcl::parse]
[key {tcler's wiki}]
[manpage modules/doctools2idx/container.man doctools::idx]
[manpage modules/doctools2idx/export.man    doctools::idx::export]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools2toc/export.man    doctools::toc::export]
[key tcllib]
[manpage modules/csv/csv.man csv]
[key TclOO]
[manpage modules/ooutil/ooutil.man oo::util]
[key TCLPARAM]
[manpage modules/pt/pt_peg_to_tclparam.man pt::peg::to::tclparam]
[key TDPL]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key {temp file}]
[manpage modules/fileutil/fileutil.man fileutil]
[key {template processing}]
[manpage modules/textutil/expander.man textutil::expander]
[key terminal]
[manpage modules/term/term.man         term]
[manpage modules/term/ansi_code.man    term::ansi::code]
[manpage modules/term/ansi_cattr.man   term::ansi::code::attr]
[manpage modules/term/ansi_cctrl.man   term::ansi::code::ctrl]
[manpage modules/term/ansi_cmacros.man term::ansi::code::macros]
[manpage modules/term/ansi_ctrlu.man   term::ansi::ctrl::unix]
[manpage modules/term/ansi_send.man    term::ansi::send]
[manpage modules/term/imenu.man        term::interact::menu]
[manpage modules/term/ipager.man       term::interact::pager]
[manpage modules/term/receive.man      term::receive]
[manpage modules/term/term_bind.man    term::receive::bind]
[manpage modules/term/term_send.man    term::send]
[key test]
[manpage modules/fileutil/fileutil.man fileutil]
[key Testing]
[manpage modules/valtype/valtype_common.man valtype::common]
[manpage modules/valtype/cc_amex.man        valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man    valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man  valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man        valtype::creditcard::visa]
[manpage modules/valtype/ean13.man          valtype::gs1::ean13]
[manpage modules/valtype/iban.man           valtype::iban]
[manpage modules/valtype/imei.man           valtype::imei]
[manpage modules/valtype/isbn.man           valtype::isbn]
[manpage modules/valtype/luhn.man           valtype::luhn]
[manpage modules/valtype/luhn5.man          valtype::luhn5]
[manpage modules/valtype/usnpi.man          valtype::usnpi]
[manpage modules/valtype/verhoeff.man       valtype::verhoeff]
[key testing]
[manpage modules/bench/bench.man            bench]
[manpage modules/bench/bench_read.man       bench::in]
[manpage modules/bench/bench_wcsv.man       bench::out::csv]
[manpage modules/bench/bench_wtext.man      bench::out::text]
[manpage modules/bench/bench_intro.man      bench_intro]
[manpage modules/bench/bench_lang_intro.man bench_lang_intro]
[manpage modules/bench/bench_lang_spec.man  bench_lang_spec]
[key TeX]
[manpage modules/textutil/textutil.man textutil]
[manpage modules/textutil/adjust.man   textutil::adjust]
[key text]
[manpage modules/bench/bench_read.man  bench::in]
[manpage modules/bench/bench_wtext.man bench::out::text]
[manpage modules/bench/bench_read.man       bench::in]
[manpage modules/bench/bench_wtext.man      bench::out::text]
[manpage modules/doctools2idx/container.man doctools::idx]
[manpage modules/doctools2idx/export.man    doctools::idx::export]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools2toc/export.man    doctools::toc::export]
[key {text comparison}]
[manpage modules/soundex/soundex.man soundex]
[key {text conversion}]
[manpage modules/rcs/rcs.man rcs]
[key {text differences}]
[manpage modules/rcs/rcs.man rcs]
[key {text display}]
1687
1688
1689
1690
1691
1692
1693





1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710






































1711




1712




1713
1714
1715
1716
1717
1718







1719
1720
1721
1722








1723
1724
1725
1726
1727
1728









































1729
1730
1731
1732
1733
1734
1735

1736
1737
1738
1739
1740
1741
1742













































1743
1744
1745
1746
1747
1748
1749
1750
1751
1752













1753
1754


1755
1756
1757
1758
1759
1760
1761
1762
1763
1764

1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
















1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800


1801
1802
1803



1804
1805
1806
1807






1808
1809
1810



1811
1812




1813
1814
1815
1816




























1817
1818


1819
1820
1821

































1822
1823
1824
1825
1826
1827
1828
1829



1830


1831

1832
1833
1834
1835
1836
1837
1838
1839
1840

1841
1842







1843

1844

1845
1846
1847
1848
1849
1850
1851
1852
1853
1854


1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867





1868
1869
1870
1871
1872
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187

3188
3189
3190
3191
3192





3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214



3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263







3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317

3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343

3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414



3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509

3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520


3521
3522
3523
3524
3525
3526
3527
3528
3529

3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565







+
+
+
+
+

















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
-
+
+
+
+

-
-
-
-
-
+
+
+
+
+
+
+




+
+
+
+
+
+
+
+



-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+









-
+
+
+
+
+
+
+
+
+
+
+
+
+


+
+









-
+




















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
















+
+



+
+
+




+
+
+
+
+
+
-
-
-
+
+
+


+
+
+
+




+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


+
+



+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








+
+
+

+
+
-
+









+
-
-
+
+
+
+
+
+
+

+
-
+










+
+













+
+
+
+
+





[manpage modules/page/page_pluginmgr.man       page_pluginmgr]
[manpage modules/page/page_util_flow.man       page_util_flow]
[manpage modules/page/page_util_norm_lemon.man page_util_norm_lemon]
[manpage modules/page/page_util_norm_peg.man   page_util_norm_peg]
[manpage modules/page/page_util_peg.man        page_util_peg]
[manpage modules/page/page_util_quote.man      page_util_quote]
[manpage modules/yaml/yaml.man                 yaml]
[key {text widget}]
[manpage modules/virtchannel_base/textwindow.man tcl::chan::textwindow]
[key threads]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key thumbnail]
[manpage modules/jpeg/jpeg.man jpeg]
[key tie]
[manpage modules/tie/tie.man     tie]
[manpage modules/tie/tie_std.man tie]
[key tif]
[manpage modules/tiff/tiff.man tiff]
[key tiff]
[manpage modules/exif/exif.man exif]
[manpage modules/tiff/tiff.man tiff]
[key tile]
[manpage modules/map/map_slippy_cache.man   map::slippy::cache]
[manpage modules/map/map_slippy_fetcher.man map::slippy::fetcher]
[key time]
[manpage modules/ntp/ntp_time.man ntp_time]
[key timestamp]
[manpage modules/png/png.man png]
[key {tip 219}]
[manpage modules/virtchannel_base/cat.man           tcl::chan::cat]
[manpage modules/virtchannel_core/core.man          tcl::chan::core]
[manpage modules/virtchannel_core/events.man        tcl::chan::events]
[manpage modules/virtchannel_base/facade.man        tcl::chan::facade]
[manpage modules/virtchannel_base/fifo.man          tcl::chan::fifo]
[manpage modules/virtchannel_base/fifo2.man         tcl::chan::fifo2]
[manpage modules/virtchannel_base/halfpipe.man      tcl::chan::halfpipe]
[manpage modules/virtchannel_base/memchan.man       tcl::chan::memchan]
[manpage modules/virtchannel_base/null.man          tcl::chan::null]
[manpage modules/virtchannel_base/nullzero.man      tcl::chan::nullzero]
[manpage modules/virtchannel_base/random.man        tcl::chan::random]
[manpage modules/virtchannel_base/randseed.man      tcl::chan::randseed]
[manpage modules/virtchannel_base/std.man           tcl::chan::std]
[manpage modules/virtchannel_base/string.man        tcl::chan::string]
[manpage modules/virtchannel_base/textwindow.man    tcl::chan::textwindow]
[manpage modules/virtchannel_base/variable.man      tcl::chan::variable]
[manpage modules/virtchannel_base/zero.man          tcl::chan::zero]
[manpage modules/virtchannel_core/transformcore.man tcl::transform::core]
[key {tip 230}]
[manpage modules/virtchannel_transform/adler32.man   tcl::transform::adler32]
[manpage modules/virtchannel_transform/base64.man    tcl::transform::base64]
[manpage modules/virtchannel_transform/counter.man   tcl::transform::counter]
[manpage modules/virtchannel_transform/crc32.man     tcl::transform::crc32]
[manpage modules/virtchannel_transform/hex.man       tcl::transform::hex]
[manpage modules/virtchannel_transform/identity.man  tcl::transform::identity]
[manpage modules/virtchannel_transform/limitsize.man tcl::transform::limitsize]
[manpage modules/virtchannel_transform/observe.man   tcl::transform::observe]
[manpage modules/virtchannel_transform/otp.man       tcl::transform::otp]
[manpage modules/virtchannel_transform/rot.man       tcl::transform::rot]
[manpage modules/virtchannel_transform/spacer.man    tcl::transform::spacer]
[manpage modules/virtchannel_transform/zlib.man      tcl::transform::zlib]
[key {tip 234}]
[manpage modules/virtchannel_transform/zlib.man tcl::transform::zlib]
[key {tip 317}]
[manpage modules/virtchannel_transform/base64.man tcl::transform::base64]
[key Tk]
[manpage modules/virtchannel_base/textwindow.man tcl::chan::textwindow]
[key tls]
[manpage modules/comm/comm.man            comm]
[manpage modules/imap4/imap4.man          imap4]
[manpage modules/pop3/pop3.man            pop3]
[manpage modules/pop3d/pop3d.man          pop3d]
[manpage modules/mime/smtp.man smtp]
[manpage modules/mime/smtp.man            smtp]
[manpage modules/transfer/connect.man     transfer::connect]
[manpage modules/transfer/receiver.man    transfer::receiver]
[manpage modules/transfer/transmitter.man transfer::transmitter]
[key TMML]
[manpage modules/doctools/doctools.man doctools]
[manpage modules/doctools/docidx.man   doctools::idx]
[manpage modules/doctools/doctoc.man   doctools::toc]
[manpage apps/dtplite.man              dtplite]
[manpage modules/doctools/mpexpand.man mpexpand]
[manpage modules/doctools/doctools.man      doctools]
[manpage modules/doctools2idx/container.man doctools::idx]
[manpage modules/doctools/docidx.man        doctools::idx]
[manpage modules/doctools2toc/container.man doctools::toc]
[manpage modules/doctools/doctoc.man        doctools::toc]
[manpage apps/dtplite.man                   dtplite]
[manpage modules/doctools/mpexpand.man      mpexpand]
[key toc]
[manpage modules/doctools/doctoc_intro.man         doctoc_intro]
[manpage modules/doctools/doctoc_plugin_apiref.man doctoc_plugin_apiref]
[manpage modules/doctools/doctoc.man               doctools::toc]
[manpage modules/doctools2toc/export_doctoc.man    doctools::toc::export::doctoc]
[manpage modules/doctools2toc/export_html.man      doctools::toc::export::html]
[manpage modules/doctools2toc/export_json.man      doctools::toc::export::json]
[manpage modules/doctools2toc/export_nroff.man     doctools::toc::export::nroff]
[manpage modules/doctools2toc/export_text.man      doctools::toc::export::text]
[manpage modules/doctools2toc/export_wiki.man      doctools::toc::export::wiki]
[manpage modules/doctools2toc/import_doctoc.man    doctools::toc::import::doctoc]
[manpage modules/doctools2toc/import_json.man      doctools::toc::import::json]
[key {toc formatter}]
[manpage modules/doctools/doctoc_plugin_apiref.man doctoc_plugin_apiref]
[key {top-down parsing languages}]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key torrent]
[manpage modules/bee/bee.man bee]
[key touch]
[manpage modules/fileutil/fileutil.man fileutil]
[key TPDL]
[manpage modules/grammar_me/me_intro.man grammar::me_intro]
[key transducer]
[manpage modules/grammar_aycock/aycock.man       grammar::aycock]
[manpage modules/grammar_fa/fa.man          grammar::fa]
[manpage modules/grammar_fa/dacceptor.man   grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man       grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man        grammar::fa::op]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_peg/peg.man        grammar::peg]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/grammar_fa/fa.man               grammar::fa]
[manpage modules/grammar_fa/dacceptor.man        grammar::fa::dacceptor]
[manpage modules/grammar_fa/dexec.man            grammar::fa::dexec]
[manpage modules/grammar_fa/faop.man             grammar::fa::op]
[manpage modules/grammar_me/me_intro.man         grammar::me_intro]
[manpage modules/grammar_peg/peg.man             grammar::peg]
[manpage modules/grammar_peg/peg_interp.man      grammar::peg::interp]
[manpage modules/pt/pt.man                       pt]
[manpage modules/pt/pt_astree.man                pt::ast]
[manpage modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl]
[manpage modules/pt/pt_json_language.man         pt::json_language]
[manpage modules/pt/pt_param.man                 pt::param]
[manpage modules/pt/pt_pexpression.man           pt::pe]
[manpage modules/pt/pt_pexpr_op.man              pt::pe::op]
[manpage modules/pt/pt_pegrammar.man             pt::peg]
[manpage modules/pt/pt_peg_container.man         pt::peg::container]
[manpage modules/pt/pt_peg_container_peg.man     pt::peg::container::peg]
[manpage modules/pt/pt_peg_export.man            pt::peg::export]
[manpage modules/pt/pt_peg_export_container.man  pt::peg::export::container]
[manpage modules/pt/pt_peg_export_json.man       pt::peg::export::json]
[manpage modules/pt/pt_peg_export_peg.man        pt::peg::export::peg]
[manpage modules/pt/pt_peg_from_container.man    pt::peg::from::container]
[manpage modules/pt/pt_peg_from_json.man         pt::peg::from::json]
[manpage modules/pt/pt_peg_from_peg.man          pt::peg::from::peg]
[manpage modules/pt/pt_peg_import.man            pt::peg::import]
[manpage modules/pt/pt_peg_import_container.man  pt::peg::import::container]
[manpage modules/pt/pt_peg_import_json.man       pt::peg::import::json]
[manpage modules/pt/pt_peg_import_peg.man        pt::peg::import::peg]
[manpage modules/pt/pt_peg_interp.man            pt::peg::interp]
[manpage modules/pt/pt_peg_to_container.man      pt::peg::to::container]
[manpage modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam]
[manpage modules/pt/pt_peg_to_json.man           pt::peg::to::json]
[manpage modules/pt/pt_peg_to_param.man          pt::peg::to::param]
[manpage modules/pt/pt_peg_to_peg.man            pt::peg::to::peg]
[manpage modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam]
[manpage modules/pt/pt_peg_language.man          pt::peg_language]
[manpage modules/pt/pt_peg_introduction.man      pt::pegrammar]
[manpage modules/pt/pt_pgen.man                  pt::pgen]
[manpage modules/pt/pt_rdengine.man              pt::rde]
[manpage modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit]
[manpage modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo]
[manpage modules/pt/pt_to_api.man                pt_export_api]
[manpage modules/pt/pt_from_api.man              pt_import_api]
[manpage modules/pt/pt_introduction.man          pt_introduction]
[manpage modules/pt/pt_parser_api.man            pt_parser_api]
[key transfer]
[manpage modules/transfer/connect.man     transfer::connect]
[manpage modules/transfer/copyops.man     transfer::copy]
[manpage modules/transfer/tqueue.man      transfer::copy::queue]
[manpage modules/transfer/ddest.man       transfer::data::destination]
[manpage modules/transfer/dsource.man     transfer::data::source]
[manpage modules/transfer/receiver.man    transfer::receiver]
[manpage modules/transfer/transmitter.man transfer::transmitter]
[key transformation]
[manpage modules/page/page_util_peg.man page_util_peg]
[manpage modules/page/page_util_peg.man              page_util_peg]
[manpage modules/virtchannel_transform/adler32.man   tcl::transform::adler32]
[manpage modules/virtchannel_transform/base64.man    tcl::transform::base64]
[manpage modules/virtchannel_transform/counter.man   tcl::transform::counter]
[manpage modules/virtchannel_transform/crc32.man     tcl::transform::crc32]
[manpage modules/virtchannel_transform/hex.man       tcl::transform::hex]
[manpage modules/virtchannel_transform/identity.man  tcl::transform::identity]
[manpage modules/virtchannel_transform/limitsize.man tcl::transform::limitsize]
[manpage modules/virtchannel_transform/observe.man   tcl::transform::observe]
[manpage modules/virtchannel_transform/otp.man       tcl::transform::otp]
[manpage modules/virtchannel_transform/rot.man       tcl::transform::rot]
[manpage modules/virtchannel_transform/spacer.man    tcl::transform::spacer]
[manpage modules/virtchannel_transform/zlib.man      tcl::transform::zlib]
[key transmitter]
[manpage modules/transfer/transmitter.man transfer::transmitter]
[key {travelling salesman}]
[manpage modules/struct/graphops.man struct::graph::op]
[key traversal]
[manpage modules/fileutil/traverse.man fileutil_traverse]
[key tree]
[manpage modules/grammar_me/gasm.man     grammar::me::cpu::gasm]
[manpage modules/grammar_me/me_util.man  grammar::me::util]
[manpage modules/htmlparse/htmlparse.man htmlparse]
[manpage modules/struct/queue.man        struct::queue]
[manpage modules/struct/stack.man        struct::stack]
[manpage modules/struct/struct_tree.man  struct::tree]
[manpage modules/struct/struct_tree1.man {struct::tree v1}]
[manpage modules/struct/struct_tree1.man struct::tree_v1]
[manpage modules/treeql/treeql.man       treeql]
[key {tree query language}]
[manpage modules/treeql/treeql.man treeql]
[key {tree walking}]
[manpage modules/page/page_util_flow.man       page_util_flow]
[manpage modules/page/page_util_norm_lemon.man page_util_norm_lemon]
[manpage modules/page/page_util_norm_peg.man   page_util_norm_peg]
[key TreeQL]
[manpage modules/treeql/treeql.man treeql]
[key trimming]
[manpage modules/textutil/textutil.man textutil]
[manpage modules/textutil/trim.man     textutil::trim]
[key type]
[manpage modules/fileutil/fileutil.man fileutil]
[manpage modules/fumagic/cfront.man    fileutil::magic::cfront]
[manpage modules/fumagic/cgen.man      fileutil::magic::cgen]
[manpage modules/fumagic/filetypes.man fileutil::magic::filetype]
[manpage modules/fumagic/mimetypes.man fileutil::magic::mimetype]
[manpage modules/fumagic/rtcore.man    fileutil::magic::rt]
[manpage modules/snit/snit.man         snit]
[key {Type checking}]
[manpage modules/valtype/valtype_common.man valtype::common]
[manpage modules/valtype/cc_amex.man        valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man    valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man  valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man        valtype::creditcard::visa]
[manpage modules/valtype/ean13.man          valtype::gs1::ean13]
[manpage modules/valtype/iban.man           valtype::iban]
[manpage modules/valtype/imei.man           valtype::imei]
[manpage modules/valtype/isbn.man           valtype::isbn]
[manpage modules/valtype/luhn.man           valtype::luhn]
[manpage modules/valtype/luhn5.man          valtype::luhn5]
[manpage modules/valtype/usnpi.man          valtype::usnpi]
[manpage modules/valtype/verhoeff.man       valtype::verhoeff]
[key uevent]
[manpage modules/hook/hook.man hook]
[key unbind]
[manpage modules/uev/uevent.man uevent]
[key uncapitalize]
[manpage modules/textutil/textutil_string.man textutil::string]
[key undenting]
[manpage modules/textutil/adjust.man textutil::adjust]
[key unicode]
[manpage modules/stringprep/stringprep.man      stringprep]
[manpage modules/stringprep/stringprep_data.man stringprep::data]
[manpage modules/stringprep/unicode.man         unicode]
[manpage modules/stringprep/unicode_data.man    unicode::data]
[key union]
[manpage modules/struct/disjointset.man struct::disjointset]
[manpage modules/struct/struct_set.man  struct::set]
[key unit]
[manpage modules/units/units.man units]
[key {unknown hooking}]
[manpage modules/namespacex/namespacex.man namespacex]
[key untie]
[manpage modules/tie/tie.man     tie]
[manpage modules/tie/tie_std.man tie]
[key update]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[key uri]
[manpage modules/uri/uri.man        uri]
[manpage modules/uri/urn-scheme.man uri_urn]
[key url]
[manpage modules/doctools2idx/container.man    doctools::idx]
[manpage modules/doctools2idx/export.man       doctools::idx::export]
[manpage modules/doctools2idx/import.man       doctools::idx::import]
[manpage modules/doctools2toc/export.man       doctools::toc::export]
[manpage modules/doctools2toc/import.man       doctools::toc::import]
[manpage modules/map/map_geocode_nominatim.man map::geocode::nominatim]
[manpage modules/map/map_slippy_fetcher.man map::slippy::fetcher]
[manpage modules/uri/uri.man                uri]
[manpage modules/uri/urn-scheme.man         uri_urn]
[manpage modules/map/map_slippy_fetcher.man    map::slippy::fetcher]
[manpage modules/uri/uri.man                   uri]
[manpage modules/uri/urn-scheme.man            uri_urn]
[key urn]
[manpage modules/uri/urn-scheme.man uri_urn]
[key US-NPI]
[manpage modules/valtype/usnpi.man valtype::usnpi]
[key utilities]
[manpage modules/namespacex/namespacex.man namespacex]
[key uuencode]
[manpage modules/base64/uuencode.man uuencode]
[key UUID]
[manpage modules/uuid/uuid.man uuid]
[key Validation]
[manpage modules/valtype/valtype_common.man valtype::common]
[manpage modules/valtype/cc_amex.man        valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man    valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man  valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man        valtype::creditcard::visa]
[manpage modules/valtype/ean13.man          valtype::gs1::ean13]
[manpage modules/valtype/iban.man           valtype::iban]
[manpage modules/valtype/imei.man           valtype::imei]
[manpage modules/valtype/isbn.man           valtype::isbn]
[manpage modules/valtype/luhn.man           valtype::luhn]
[manpage modules/valtype/luhn5.man          valtype::luhn5]
[manpage modules/valtype/usnpi.man          valtype::usnpi]
[manpage modules/valtype/verhoeff.man       valtype::verhoeff]
[key {Value checking}]
[manpage modules/valtype/valtype_common.man valtype::common]
[manpage modules/valtype/cc_amex.man        valtype::creditcard::amex]
[manpage modules/valtype/cc_discover.man    valtype::creditcard::discover]
[manpage modules/valtype/cc_mastercard.man  valtype::creditcard::mastercard]
[manpage modules/valtype/cc_visa.man        valtype::creditcard::visa]
[manpage modules/valtype/ean13.man          valtype::gs1::ean13]
[manpage modules/valtype/iban.man           valtype::iban]
[manpage modules/valtype/imei.man           valtype::imei]
[manpage modules/valtype/isbn.man           valtype::isbn]
[manpage modules/valtype/luhn.man           valtype::luhn]
[manpage modules/valtype/luhn5.man          valtype::luhn5]
[manpage modules/valtype/usnpi.man          valtype::usnpi]
[manpage modules/valtype/verhoeff.man       valtype::verhoeff]
[key vectors]
[manpage modules/math/linalg.man math::linearalgebra]
[key verhoeff]
[manpage modules/valtype/verhoeff.man valtype::verhoeff]
[key vertex]
[manpage modules/struct/graph.man    struct::graph]
[manpage modules/struct/graphops.man struct::graph::op]
[key {vertex cover}]
[manpage modules/struct/graphops.man struct::graph::op]
[key {virtual channel}]
[manpage modules/virtchannel_base/cat.man            tcl::chan::cat]
[manpage modules/virtchannel_core/core.man           tcl::chan::core]
[manpage modules/virtchannel_core/events.man         tcl::chan::events]
[manpage modules/virtchannel_base/facade.man         tcl::chan::facade]
[manpage modules/virtchannel_base/fifo.man           tcl::chan::fifo]
[manpage modules/virtchannel_base/fifo2.man          tcl::chan::fifo2]
[manpage modules/virtchannel_base/halfpipe.man       tcl::chan::halfpipe]
[manpage modules/virtchannel_base/memchan.man        tcl::chan::memchan]
[manpage modules/virtchannel_base/null.man           tcl::chan::null]
[manpage modules/virtchannel_base/nullzero.man       tcl::chan::nullzero]
[manpage modules/virtchannel_base/random.man         tcl::chan::random]
[manpage modules/virtchannel_base/randseed.man       tcl::chan::randseed]
[manpage modules/virtchannel_base/std.man            tcl::chan::std]
[manpage modules/virtchannel_base/string.man         tcl::chan::string]
[manpage modules/virtchannel_base/textwindow.man     tcl::chan::textwindow]
[manpage modules/virtchannel_base/variable.man       tcl::chan::variable]
[manpage modules/virtchannel_base/zero.man           tcl::chan::zero]
[manpage modules/virtchannel_transform/adler32.man   tcl::transform::adler32]
[manpage modules/virtchannel_transform/base64.man    tcl::transform::base64]
[manpage modules/virtchannel_core/transformcore.man  tcl::transform::core]
[manpage modules/virtchannel_transform/counter.man   tcl::transform::counter]
[manpage modules/virtchannel_transform/crc32.man     tcl::transform::crc32]
[manpage modules/virtchannel_transform/hex.man       tcl::transform::hex]
[manpage modules/virtchannel_transform/identity.man  tcl::transform::identity]
[manpage modules/virtchannel_transform/limitsize.man tcl::transform::limitsize]
[manpage modules/virtchannel_transform/observe.man   tcl::transform::observe]
[manpage modules/virtchannel_transform/otp.man       tcl::transform::otp]
[manpage modules/virtchannel_transform/rot.man       tcl::transform::rot]
[manpage modules/virtchannel_transform/spacer.man    tcl::transform::spacer]
[manpage modules/virtchannel_transform/zlib.man      tcl::transform::zlib]
[key {virtual machine}]
[manpage modules/grammar_me/me_cpu.man      grammar::me::cpu]
[manpage modules/grammar_me/me_cpucore.man  grammar::me::cpu::core]
[manpage modules/grammar_me/gasm.man        grammar::me::cpu::gasm]
[manpage modules/grammar_me/me_tcl.man      grammar::me::tcl]
[manpage modules/grammar_me/me_intro.man    grammar::me_intro]
[manpage modules/grammar_me/me_vm.man       grammar::me_vm]
[manpage modules/grammar_peg/peg_interp.man grammar::peg::interp]
[manpage modules/pt/pt_param.man            pt::param]
[key VISA]
[manpage modules/valtype/cc_visa.man valtype::creditcard::visa]
[key vwait]
[manpage modules/coroutine/coroutine.man coroutine]
[manpage modules/coroutine/coro_auto.man coroutine::auto]
[manpage modules/smtpd/smtpd.man smtpd]
[manpage modules/smtpd/smtpd.man         smtpd]
[key wais]
[manpage modules/uri/uri.man uri]
[key widget]
[manpage modules/snit/snit.man    snit]
[manpage modules/snit/snitfaq.man snitfaq]
[key {widget adaptors}]
[manpage modules/snit/snit.man    snit]
[manpage modules/snit/snitfaq.man snitfaq]
[key wiki]
[manpage modules/doctools2idx/container.man   doctools::idx]
[manpage modules/doctools/docidx.man doctools::idx]
[manpage modules/doctools/doctoc.man doctools::toc]
[manpage modules/doctools/docidx.man          doctools::idx]
[manpage modules/doctools2idx/export.man      doctools::idx::export]
[manpage modules/doctools2idx/export_wiki.man doctools::idx::export::wiki]
[manpage modules/doctools2toc/container.man   doctools::toc]
[manpage modules/doctools/doctoc.man          doctools::toc]
[manpage modules/doctools2toc/export.man      doctools::toc::export]
[manpage modules/doctools2toc/export_wiki.man doctools::toc::export::wiki]
[key word]
[manpage modules/doctools2base/tcl_parse.man doctools::tcl::parse]
[manpage modules/wip/wip.man wip]
[manpage modules/wip/wip.man                 wip]
[key www]
[manpage modules/uri/uri.man uri]
[key x.208]
[manpage modules/asn/asn.man asn]
[key x.209]
[manpage modules/asn/asn.man asn]
[key x.500]
[manpage modules/ldap/ldap.man ldap]
[key xml]
[manpage modules/amazon-s3/xsxp.man xsxp]
[key xor]
[manpage modules/virtchannel_transform/otp.man tcl::transform::otp]
[key XPath]
[manpage modules/treeql/treeql.man treeql]
[key XSLT]
[manpage modules/treeql/treeql.man treeql]
[key yaml]
[manpage modules/yaml/huddle.man huddle]
[manpage modules/yaml/yaml.man   yaml]
[key ydecode]
[manpage modules/base64/yencode.man yencode]
[key yEnc]
[manpage modules/base64/yencode.man yencode]
[key yencode]
[manpage modules/base64/yencode.man yencode]
[key zero]
[manpage modules/virtchannel_base/nullzero.man tcl::chan::nullzero]
[manpage modules/virtchannel_base/zero.man     tcl::chan::zero]
[key zlib]
[manpage modules/virtchannel_transform/zlib.man tcl::transform::zlib]
[key zoom]
[manpage modules/map/map_slippy.man         map::slippy]
[manpage modules/map/map_slippy_cache.man   map::slippy::cache]
[manpage modules/map/map_slippy_fetcher.man map::slippy::fetcher]
[index_end]

Changes to support/devel/sak/doc/manpages.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27


28
29
30
31


32
33
34
35
36
37
38
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43













+














+
+




+
+







apps/dtplite.man
apps/nns.man
apps/nnsd.man
apps/nnslog.man
apps/page.man
apps/tcldocstrip.man
modules/aes/aes.man
modules/amazon-s3/S3.man
modules/amazon-s3/xsxp.man
modules/asn/asn.man
modules/base32/base32.man
modules/base32/base32core.man
modules/base32/base32hex.man
modules/base64/ascii85.man
modules/base64/base64.man
modules/base64/uuencode.man
modules/base64/yencode.man
modules/bee/bee.man
modules/bench/bench.man
modules/bench/bench_intro.man
modules/bench/bench_lang_intro.man
modules/bench/bench_lang_spec.man
modules/bench/bench_read.man
modules/bench/bench_wcsv.man
modules/bench/bench_wtext.man
modules/bibtex/bibtex.man
modules/blowfish/blowfish.man
modules/cache/async.man
modules/clock/iso8601.man
modules/clock/rfc2822.man
modules/cmdline/cmdline.man
modules/comm/comm.man
modules/comm/comm_wire.man
modules/control/control.man
modules/coroutine/coro_auto.man
modules/coroutine/coroutine.man
modules/counter/counter.man
modules/crc/cksum.man
modules/crc/crc16.man
modules/crc/crc32.man
modules/crc/sum.man
modules/csv/csv.man
modules/des/des.man
60
61
62
63
64
65
66








































67
68
69
70
71
72
73
74
75
76
77
78
79



80
81
82
83
84
85
86
87
88
89
90
91
92
93

94
95
96
97

98
99
100
101
102
103
104
105
106


107
108
109
110
111
112

113
114
115
116
117
118
119
120
121
122
123
124



125
126

127


128
129
130
131
132
133
134
135

136
137
138
139
140
141

142
143
144
145
146
147
148
149
150
151

152
153
154
155
156
157
158
159

160
161
162
163
164
165
166






































167
168
169

170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

276
277
278
279
280
281
282
283







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+













+
+
+














+




+









+
+






+









-
-
-
+
+
+


+

+
+








+






+










+








+







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



+







-
+







modules/doctools/doctools_intro.man
modules/doctools/doctools_lang_cmdref.man
modules/doctools/doctools_lang_faq.man
modules/doctools/doctools_lang_intro.man
modules/doctools/doctools_lang_syntax.man
modules/doctools/doctools_plugin_apiref.man
modules/doctools/mpexpand.man
modules/doctools2base/html_cssdefaults.man
modules/doctools2base/nroff_manmacros.man
modules/doctools2base/tcl_parse.man
modules/doctools2base/tcllib_msgcat.man
modules/doctools2idx/container.man
modules/doctools2idx/export.man
modules/doctools2idx/export_docidx.man
modules/doctools2idx/export_html.man
modules/doctools2idx/export_json.man
modules/doctools2idx/export_nroff.man
modules/doctools2idx/export_text.man
modules/doctools2idx/export_wiki.man
modules/doctools2idx/import.man
modules/doctools2idx/import_docidx.man
modules/doctools2idx/import_json.man
modules/doctools2idx/introduction.man
modules/doctools2idx/msgcat_c.man
modules/doctools2idx/msgcat_de.man
modules/doctools2idx/msgcat_en.man
modules/doctools2idx/msgcat_fr.man
modules/doctools2idx/parse.man
modules/doctools2idx/structure.man
modules/doctools2toc/container.man
modules/doctools2toc/export.man
modules/doctools2toc/export_doctoc.man
modules/doctools2toc/export_html.man
modules/doctools2toc/export_json.man
modules/doctools2toc/export_nroff.man
modules/doctools2toc/export_text.man
modules/doctools2toc/export_wiki.man
modules/doctools2toc/import.man
modules/doctools2toc/import_doctoc.man
modules/doctools2toc/import_json.man
modules/doctools2toc/introduction.man
modules/doctools2toc/msgcat_c.man
modules/doctools2toc/msgcat_de.man
modules/doctools2toc/msgcat_en.man
modules/doctools2toc/msgcat_fr.man
modules/doctools2toc/parse.man
modules/doctools2toc/structure.man
modules/exif/exif.man
modules/fileutil/fileutil.man
modules/fileutil/multi.man
modules/fileutil/multiop.man
modules/fileutil/traverse.man
modules/ftp/ftp.man
modules/ftp/ftp_geturl.man
modules/ftpd/ftpd.man
modules/fumagic/cfront.man
modules/fumagic/cgen.man
modules/fumagic/filetypes.man
modules/fumagic/mimetypes.man
modules/fumagic/rtcore.man
modules/generator/generator.man
modules/gpx/gpx.man
modules/grammar_aycock/aycock.man
modules/grammar_fa/dacceptor.man
modules/grammar_fa/dexec.man
modules/grammar_fa/fa.man
modules/grammar_fa/faop.man
modules/grammar_me/gasm.man
modules/grammar_me/me_ast.man
modules/grammar_me/me_cpu.man
modules/grammar_me/me_cpucore.man
modules/grammar_me/me_intro.man
modules/grammar_me/me_tcl.man
modules/grammar_me/me_util.man
modules/grammar_me/me_vm.man
modules/grammar_peg/peg.man
modules/grammar_peg/peg_interp.man
modules/hook/hook.man
modules/html/html.man
modules/htmlparse/htmlparse.man
modules/http/autoproxy.man
modules/ident/ident.man
modules/imap4/imap4.man
modules/inifile/ini.man
modules/interp/deleg_method.man
modules/interp/deleg_proc.man
modules/interp/tcllib_interp.man
modules/irc/irc.man
modules/irc/picoirc.man
modules/javascript/javascript.man
modules/jpeg/jpeg.man
modules/json/json.man
modules/json/json_write.man
modules/lambda/lambda.man
modules/ldap/ldap.man
modules/ldap/ldapx.man
modules/log/log.man
modules/log/logger.man
modules/log/loggerAppender.man
modules/log/loggerUtils.man
modules/map/map_geocode_nominatim.man
modules/map/map_slippy.man
modules/map/map_slippy_cache.man
modules/map/map_slippy_fetcher.man
modules/mapproj/mapproj.man
modules/math/bigfloat.man
modules/math/bignum.man
modules/math/calculus.man
modules/math/combinatorics.man
modules/math/constants.man
modules/math/fourier.man
modules/math/fuzzy.man
modules/math/geometry.man
modules/math/decimal.man
modules/math/fourier.man
modules/math/fuzzy.man
modules/math/interpolate.man
modules/math/linalg.man
modules/math/machineparameters.man
modules/math/math.man
modules/math/math_geometry.man
modules/math/numtheory.man
modules/math/optimize.man
modules/math/polynomials.man
modules/math/qcomplex.man
modules/math/rational_funcs.man
modules/math/roman.man
modules/math/romberg.man
modules/math/special.man
modules/math/statistics.man
modules/math/symdiff.man
modules/md4/md4.man
modules/md5/md5.man
modules/md5crypt/md5crypt.man
modules/mime/mime.man
modules/mime/smtp.man
modules/multiplexer/multiplexer.man
modules/namespacex/namespacex.man
modules/ncgi/ncgi.man
modules/nmea/nmea.man
modules/nns/nns_auto.man
modules/nns/nns_client.man
modules/nns/nns_common.man
modules/nns/nns_intro.man
modules/nns/nns_protocol.man
modules/nns/nns_server.man
modules/nntp/nntp.man
modules/ntp/ntp_time.man
modules/ooutil/ooutil.man
modules/otp/otp.man
modules/page/page_intro.man
modules/page/page_pluginmgr.man
modules/page/page_util_flow.man
modules/page/page_util_norm_lemon.man
modules/page/page_util_norm_peg.man
modules/page/page_util_peg.man
modules/page/page_util_quote.man
modules/pki/pki.man
modules/pluginmgr/pluginmgr.man
modules/png/png.man
modules/pop3/pop3.man
modules/pop3d/pop3d.man
modules/pop3d/pop3d_dbox.man
modules/pop3d/pop3d_udb.man
modules/profiler/profiler.man
modules/pt/pt.man
modules/pt/pt_astree.man
modules/pt/pt_cparam_config_critcl.man
modules/pt/pt_from_api.man
modules/pt/pt_introduction.man
modules/pt/pt_json_language.man
modules/pt/pt_param.man
modules/pt/pt_parser_api.man
modules/pt/pt_peg_container.man
modules/pt/pt_peg_container_peg.man
modules/pt/pt_peg_export.man
modules/pt/pt_peg_export_container.man
modules/pt/pt_peg_export_json.man
modules/pt/pt_peg_export_peg.man
modules/pt/pt_peg_from_container.man
modules/pt/pt_peg_from_json.man
modules/pt/pt_peg_from_peg.man
modules/pt/pt_peg_import.man
modules/pt/pt_peg_import_container.man
modules/pt/pt_peg_import_json.man
modules/pt/pt_peg_import_peg.man
modules/pt/pt_peg_interp.man
modules/pt/pt_peg_introduction.man
modules/pt/pt_peg_language.man
modules/pt/pt_peg_to_container.man
modules/pt/pt_peg_to_cparam.man
modules/pt/pt_peg_to_json.man
modules/pt/pt_peg_to_param.man
modules/pt/pt_peg_to_peg.man
modules/pt/pt_peg_to_tclparam.man
modules/pt/pt_pegrammar.man
modules/pt/pt_pexpr_op.man
modules/pt/pt_pexpression.man
modules/pt/pt_pgen.man
modules/pt/pt_rdengine.man
modules/pt/pt_tclparam_config_snit.man
modules/pt/pt_tclparam_config_tcloo.man
modules/pt/pt_to_api.man
modules/rc4/rc4.man
modules/rcs/rcs.man
modules/report/report.man
modules/rest/rest.man
modules/ripemd/ripemd128.man
modules/ripemd/ripemd160.man
modules/sasl/sasl.man
modules/sha1/sha1.man
modules/sha1/sha256.man
modules/simulation/annealing.man
modules/simulation/montecarlo.man
modules/simulation/random.man
modules/simulation/simulation_random.man
modules/smtpd/smtpd.man
modules/snit/snit.man
modules/snit/snitfaq.man
modules/soundex/soundex.man
modules/stooop/stooop.man
modules/stringprep/stringprep.man
modules/stringprep/stringprep_data.man
197
198
199
200
201
202
203



204
205
206
207
208
209
210
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312







+
+
+







modules/struct/skiplist.man
modules/struct/stack.man
modules/struct/struct_list.man
modules/struct/struct_set.man
modules/struct/struct_tree.man
modules/struct/struct_tree1.man
modules/tar/tar.man
modules/tepam/tepam_argument_dialogbox.man
modules/tepam/tepam_introduction.man
modules/tepam/tepam_procedure.man
modules/term/ansi_cattr.man
modules/term/ansi_cctrl.man
modules/term/ansi_cmacros.man
modules/term/ansi_code.man
modules/term/ansi_ctrlu.man
modules/term/ansi_send.man
modules/term/imenu.man
228
229
230
231
232
233
234

235
236
237
238
239
240











































241
242
243
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389







+






+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



modules/transfer/copyops.man
modules/transfer/ddest.man
modules/transfer/dsource.man
modules/transfer/receiver.man
modules/transfer/tqueue.man
modules/transfer/transmitter.man
modules/treeql/treeql.man
modules/try/tcllib_try.man
modules/uev/uevent.man
modules/uev/uevent_onidle.man
modules/units/units.man
modules/uri/uri.man
modules/uri/urn-scheme.man
modules/uuid/uuid.man
modules/valtype/cc_amex.man
modules/valtype/cc_discover.man
modules/valtype/cc_mastercard.man
modules/valtype/cc_visa.man
modules/valtype/ean13.man
modules/valtype/iban.man
modules/valtype/imei.man
modules/valtype/isbn.man
modules/valtype/luhn.man
modules/valtype/luhn5.man
modules/valtype/usnpi.man
modules/valtype/valtype_common.man
modules/valtype/verhoeff.man
modules/virtchannel_base/cat.man
modules/virtchannel_base/facade.man
modules/virtchannel_base/fifo.man
modules/virtchannel_base/fifo2.man
modules/virtchannel_base/halfpipe.man
modules/virtchannel_base/memchan.man
modules/virtchannel_base/null.man
modules/virtchannel_base/nullzero.man
modules/virtchannel_base/random.man
modules/virtchannel_base/randseed.man
modules/virtchannel_base/std.man
modules/virtchannel_base/string.man
modules/virtchannel_base/textwindow.man
modules/virtchannel_base/variable.man
modules/virtchannel_base/zero.man
modules/virtchannel_core/core.man
modules/virtchannel_core/events.man
modules/virtchannel_core/transformcore.man
modules/virtchannel_transform/adler32.man
modules/virtchannel_transform/base64.man
modules/virtchannel_transform/counter.man
modules/virtchannel_transform/crc32.man
modules/virtchannel_transform/hex.man
modules/virtchannel_transform/identity.man
modules/virtchannel_transform/limitsize.man
modules/virtchannel_transform/observe.man
modules/virtchannel_transform/otp.man
modules/virtchannel_transform/rot.man
modules/virtchannel_transform/spacer.man
modules/virtchannel_transform/zlib.man
modules/wip/wip.man
modules/yaml/huddle.man
modules/yaml/yaml.man

Changes to support/devel/sak/doc/toc.txt.

1
2



3
4
5
6
7
8
9
10
11
12
13
14
15
16









































17
18
19
20
21
22
23
24

25
26
27

28
29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68





















































69
70
71

72
73
74
75
76
77

78
79
80
81
82
83
84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15




16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

63
64
65
66

67
68
69
70
71
72
73
74
75

76
77
78
79





























80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150


+
+
+










-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+






-

+


-
+








-
+



-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



+






+







[toc_begin {Table Of Contents} {}]
[division_start {By Categories}]
[division_start {Argument entry form, mega widget}]
[item modules/tepam/tepam_argument_dialogbox.man tepam::argument_dialogbox {TEPAM argument_dialogbox, reference manual}]
[division_end]
[division_start {Benchmark tools}]
[item modules/bench/bench.man            bench            {bench - Processing benchmark suites}]
[item modules/bench/bench_read.man       bench::in        {bench::in - Reading benchmark results}]
[item modules/bench/bench_wcsv.man       bench::out::csv  {bench::out::csv - Formatting benchmark results as CSV}]
[item modules/bench/bench_wtext.man      bench::out::text {bench::out::text - Formatting benchmark results as human readable text}]
[item modules/bench/bench_intro.man      bench_intro      {bench introduction}]
[item modules/bench/bench_lang_intro.man bench_lang_intro {bench language introduction}]
[item modules/bench/bench_lang_spec.man  bench_lang_spec  {bench language specification}]
[division_end]
[division_start {CGI programming}]
[item modules/html/html.man             html       {Procedures to generate HTML structures}]
[item modules/javascript/javascript.man javascript {Procedures to generate HTML and Java Script structures.}]
[item modules/json/json.man             json       {JSON parser}]
[item modules/ncgi/ncgi.man             ncgi       {Procedures to manipulate CGI values.}]
[item modules/html/html.man             html        {Procedures to generate HTML structures}]
[item modules/javascript/javascript.man javascript  {Procedures to generate HTML and Java Script structures.}]
[item modules/json/json.man             json        {JSON parser}]
[item modules/json/json_write.man       json::write {JSON generation}]
[item modules/ncgi/ncgi.man             ncgi        {Procedures to manipulate CGI values.}]
[division_end]
[division_start Channels]
[item modules/virtchannel_base/cat.man            tcl::chan::cat            {Concatenation channel}]
[item modules/virtchannel_core/core.man           tcl::chan::core           {Basic reflected/virtual channel support}]
[item modules/virtchannel_core/events.man         tcl::chan::events         {Event support for reflected/virtual channels}]
[item modules/virtchannel_base/facade.man         tcl::chan::facade         {Facade channel}]
[item modules/virtchannel_base/fifo.man           tcl::chan::fifo           {In-memory fifo channel}]
[item modules/virtchannel_base/fifo2.man          tcl::chan::fifo2          {In-memory interconnected fifo channels}]
[item modules/virtchannel_base/halfpipe.man       tcl::chan::halfpipe       {In-memory channel, half of a fifo2}]
[item modules/virtchannel_base/memchan.man        tcl::chan::memchan        {In-memory channel}]
[item modules/virtchannel_base/null.man           tcl::chan::null           {Null channel}]
[item modules/virtchannel_base/nullzero.man       tcl::chan::nullzero       {Null/Zero channel combination}]
[item modules/virtchannel_base/random.man         tcl::chan::random         {Random channel}]
[item modules/virtchannel_base/randseed.man       tcl::chan::randseed       {Utilities for random channels}]
[item modules/virtchannel_base/std.man            tcl::chan::std            {Standard I/O, unification of stdin and stdout}]
[item modules/virtchannel_base/string.man         tcl::chan::string         {Read-only in-memory channel}]
[item modules/virtchannel_base/textwindow.man     tcl::chan::textwindow     {Textwindow channel}]
[item modules/virtchannel_base/variable.man       tcl::chan::variable       {In-memory channel using variable for storage}]
[item modules/virtchannel_base/zero.man           tcl::chan::zero           {Zero channel}]
[item modules/virtchannel_transform/adler32.man   tcl::transform::adler32   {Adler32 transformation}]
[item modules/virtchannel_transform/base64.man    tcl::transform::base64    {Base64 encoding transformation}]
[item modules/virtchannel_core/transformcore.man  tcl::transform::core      {Basic reflected/virtual channel transform support}]
[item modules/virtchannel_transform/counter.man   tcl::transform::counter   {Counter transformation}]
[item modules/virtchannel_transform/crc32.man     tcl::transform::crc32     {Crc32 transformation}]
[item modules/virtchannel_transform/hex.man       tcl::transform::hex       {Hexadecimal encoding transformation}]
[item modules/virtchannel_transform/identity.man  tcl::transform::identity  {Identity transformation}]
[item modules/virtchannel_transform/limitsize.man tcl::transform::limitsize {limiting input}]
[item modules/virtchannel_transform/observe.man   tcl::transform::observe   {Observer transformation, stream copy}]
[item modules/virtchannel_transform/otp.man       tcl::transform::otp       {Encryption via one-time pad}]
[item modules/virtchannel_transform/rot.man       tcl::transform::rot       rot-encryption]
[item modules/virtchannel_transform/spacer.man    tcl::transform::spacer    {Space insertation and removal}]
[item modules/virtchannel_transform/zlib.man      tcl::transform::zlib      {zlib (de)compression}]
[division_end]
[division_start Coroutine]
[item modules/coroutine/coroutine.man coroutine       {Coroutine based event and IO handling}]
[item modules/coroutine/coro_auto.man coroutine::auto {Automatic event and IO coroutine awareness}]
[division_end]
[division_start {Data structures}]
[item modules/counter/counter.man     counter             {Procedures for counters and histograms}]
[item modules/report/report.man       report              {Create and manipulate report objects}]
[item modules/struct/disjointset.man  struct::disjointset {Disjoint set data structure}]
[item modules/struct/graph.man        struct::graph       {Create and manipulate directed graph objects}]
[item modules/struct/graph1.man       {struct::graph v1}  {Create and manipulate directed graph objects}]
[item modules/struct/graphops.man     struct::graph::op   {Operation for (un)directed graph objects}]
[item modules/struct/graph1.man       struct::graph_v1    {Create and manipulate directed graph objects}]
[item modules/struct/struct_list.man  struct::list        {Procedures for manipulating lists}]
[item modules/struct/matrix.man       struct::matrix      {Create and manipulate matrix objects}]
[item modules/struct/matrix1.man      {struct::matrix v1} {Create and manipulate matrix objects}]
[item modules/struct/matrix1.man      struct::matrix_v1   {Create and manipulate matrix objects}]
[item modules/struct/pool.man         struct::pool        {Create and manipulate pool objects (of discrete items)}]
[item modules/struct/prioqueue.man    struct::prioqueue   {Create and manipulate prioqueue objects}]
[item modules/struct/queue.man        struct::queue       {Create and manipulate queue objects}]
[item modules/struct/record.man       struct::record      {Define and create records (similar to 'C' structures)}]
[item modules/struct/struct_set.man   struct::set         {Procedures for manipulating sets}]
[item modules/struct/skiplist.man     struct::skiplist    {Create and manipulate skiplists}]
[item modules/struct/stack.man        struct::stack       {Create and manipulate stack objects}]
[item modules/struct/struct_tree.man  struct::tree        {Create and manipulate tree objects}]
[item modules/struct/struct_tree1.man {struct::tree v1}   {Create and manipulate tree objects}]
[item modules/struct/struct_tree1.man struct::tree_v1     {Create and manipulate tree objects}]
[item modules/treeql/treeql.man       treeql              {Query tree objects}]
[division_end]
[division_start {Documentation tools}]
[item modules/doctools/docidx_intro.man           docidx_intro           {docidx introduction}]
[item modules/doctools/docidx_lang_cmdref.man     docidx_lang_cmdref     {docidx language command reference}]
[item modules/doctools/docidx_lang_faq.man        docidx_lang_faq        {docidx language faq}]
[item modules/doctools/docidx_lang_intro.man      docidx_lang_intro      {docidx language introduction}]
[item modules/doctools/docidx_lang_syntax.man     docidx_lang_syntax     {docidx language syntax}]
[item modules/doctools/docidx_plugin_apiref.man   docidx_plugin_apiref   {docidx plugin API reference}]
[item modules/docstrip/docstrip.man               docstrip               {Docstrip style source code extraction}]
[item modules/docstrip/docstrip_util.man          docstrip_util          {Docstrip-related utilities}]
[item modules/doctools/doctoc_intro.man           doctoc_intro           {doctoc introduction}]
[item modules/doctools/doctoc_lang_cmdref.man     doctoc_lang_cmdref     {doctoc language command reference}]
[item modules/doctools/doctoc_lang_faq.man        doctoc_lang_faq        {doctoc language faq}]
[item modules/doctools/doctoc_lang_intro.man      doctoc_lang_intro      {doctoc language introduction}]
[item modules/doctools/doctoc_lang_syntax.man     doctoc_lang_syntax     {doctoc language syntax}]
[item modules/doctools/doctoc_plugin_apiref.man   doctoc_plugin_apiref   {doctoc plugin API reference}]
[item modules/doctools/doctools.man               doctools               {doctools - Processing documents}]
[item modules/doctools/changelog.man              doctools::changelog    {Processing text in Emacs ChangeLog format}]
[item modules/doctools/cvs.man                    doctools::cvs          {Processing text in 'cvs log' format}]
[item modules/doctools/docidx.man                 doctools::idx          {docidx - Processing indices}]
[item modules/doctools/doctoc.man                 doctools::toc          {doctoc - Processing tables of contents}]
[item modules/doctools/doctools_intro.man         doctools_intro         {doctools introduction}]
[item modules/doctools/doctools_lang_cmdref.man   doctools_lang_cmdref   {doctools language command reference}]
[item modules/doctools/doctools_lang_faq.man      doctools_lang_faq      {doctools language faq}]
[item modules/doctools/doctools_lang_intro.man    doctools_lang_intro    {doctools language introduction}]
[item modules/doctools/doctools_lang_syntax.man   doctools_lang_syntax   {doctools language syntax}]
[item modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref {doctools plugin API reference}]
[item apps/dtplite.man                            dtplite                {Lightweight DocTools Markup Processor}]
[item modules/doctools/mpexpand.man               mpexpand               {Markup processor}]
[item apps/tcldocstrip.man                        tcldocstrip            {Tcl-based Docstrip Processor}]
[item modules/textutil/expander.man               textutil::expander     {Procedures to process templates and expand text.}]
[item modules/doctools/docidx_intro.man           docidx_intro                {docidx introduction}]
[item modules/doctools/docidx_lang_cmdref.man     docidx_lang_cmdref          {docidx language command reference}]
[item modules/doctools/docidx_lang_faq.man        docidx_lang_faq             {docidx language faq}]
[item modules/doctools/docidx_lang_intro.man      docidx_lang_intro           {docidx language introduction}]
[item modules/doctools/docidx_lang_syntax.man     docidx_lang_syntax          {docidx language syntax}]
[item modules/doctools/docidx_plugin_apiref.man   docidx_plugin_apiref        {docidx plugin API reference}]
[item modules/docstrip/docstrip.man               docstrip                    {Docstrip style source code extraction}]
[item modules/docstrip/docstrip_util.man          docstrip_util               {Docstrip-related utilities}]
[item modules/doctools/doctoc_intro.man           doctoc_intro                {doctoc introduction}]
[item modules/doctools/doctoc_lang_cmdref.man     doctoc_lang_cmdref          {doctoc language command reference}]
[item modules/doctools/doctoc_lang_faq.man        doctoc_lang_faq             {doctoc language faq}]
[item modules/doctools/doctoc_lang_intro.man      doctoc_lang_intro           {doctoc language introduction}]
[item modules/doctools/doctoc_lang_syntax.man     doctoc_lang_syntax          {doctoc language syntax}]
[item modules/doctools/doctoc_plugin_apiref.man   doctoc_plugin_apiref        {doctoc plugin API reference}]
[item modules/doctools/doctools.man               doctools                    {doctools - Processing documents}]
[item modules/doctools2idx/introduction.man       doctools2idx_introduction   {DocTools - Keyword indices}]
[item modules/doctools2toc/introduction.man       doctools2toc_introduction   {DocTools - Tables of Contents}]
[item modules/doctools/changelog.man              doctools::changelog         {Processing text in Emacs ChangeLog format}]
[item modules/doctools/cvs.man                    doctools::cvs               {Processing text in 'cvs log' format}]
[item modules/doctools2base/html_cssdefaults.man  doctools::html::cssdefaults {Default CSS style for HTML export plugins}]
[item modules/doctools2idx/container.man          doctools::idx               {Holding keyword indices}]
[item modules/doctools/docidx.man                 doctools::idx               {docidx - Processing indices}]
[item modules/doctools2idx/export.man             doctools::idx::export       {Exporting keyword indices}]
[item modules/doctools2idx/import.man             doctools::idx::import       {Importing keyword indices}]
[item modules/doctools2idx/parse.man              doctools::idx::parse        {Parsing text in docidx format}]
[item modules/doctools2idx/structure.man          doctools::idx::structure    {Docidx serialization utilities}]
[item modules/doctools2base/tcllib_msgcat.man     doctools::msgcat            {Message catalog management for the various document parsers}]
[item modules/doctools2idx/msgcat_c.man           doctools::msgcat::idx::c    {Message catalog for the docidx parser (C)}]
[item modules/doctools2idx/msgcat_de.man          doctools::msgcat::idx::de   {Message catalog for the docidx parser (DE)}]
[item modules/doctools2idx/msgcat_en.man          doctools::msgcat::idx::en   {Message catalog for the docidx parser (EN)}]
[item modules/doctools2idx/msgcat_fr.man          doctools::msgcat::idx::fr   {Message catalog for the docidx parser (FR)}]
[item modules/doctools2toc/msgcat_c.man           doctools::msgcat::toc::c    {Message catalog for the doctoc parser (C)}]
[item modules/doctools2toc/msgcat_de.man          doctools::msgcat::toc::de   {Message catalog for the doctoc parser (DE)}]
[item modules/doctools2toc/msgcat_en.man          doctools::msgcat::toc::en   {Message catalog for the doctoc parser (EN)}]
[item modules/doctools2toc/msgcat_fr.man          doctools::msgcat::toc::fr   {Message catalog for the doctoc parser (FR)}]
[item modules/doctools2base/nroff_manmacros.man   doctools::nroff::man_macros {Default CSS style for NROFF export plugins}]
[item modules/doctools2base/tcl_parse.man         doctools::tcl::parse        {Processing text in 'subst -novariables' format}]
[item modules/doctools2toc/container.man          doctools::toc               {Holding tables of contents}]
[item modules/doctools/doctoc.man                 doctools::toc               {doctoc - Processing tables of contents}]
[item modules/doctools2toc/export.man             doctools::toc::export       {Exporting tables of contents}]
[item modules/doctools2toc/import.man             doctools::toc::import       {Importing keyword indices}]
[item modules/doctools2toc/parse.man              doctools::toc::parse        {Parsing text in doctoc format}]
[item modules/doctools2toc/structure.man          doctools::toc::structure    {Doctoc serialization utilities}]
[item modules/doctools/doctools_intro.man         doctools_intro              {doctools introduction}]
[item modules/doctools/doctools_lang_cmdref.man   doctools_lang_cmdref        {doctools language command reference}]
[item modules/doctools/doctools_lang_faq.man      doctools_lang_faq           {doctools language faq}]
[item modules/doctools/doctools_lang_intro.man    doctools_lang_intro         {doctools language introduction}]
[item modules/doctools/doctools_lang_syntax.man   doctools_lang_syntax        {doctools language syntax}]
[item modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref      {doctools plugin API reference}]
[item apps/dtplite.man                            dtplite                     {Lightweight DocTools Markup Processor}]
[item modules/doctools/mpexpand.man               mpexpand                    {Markup processor}]
[item apps/tcldocstrip.man                        tcldocstrip                 {Tcl-based Docstrip Processor}]
[item modules/textutil/expander.man               textutil::expander          {Procedures to process templates and expand text.}]
[division_end]
[division_start {File formats}]
[item modules/exif/exif.man exif {Tcl EXIF extracts and parses EXIF fields from digital images}]
[item modules/gpx/gpx.man   gpx  {Extracts waypoints, tracks and routes from GPX files}]
[item modules/jpeg/jpeg.man jpeg {JPEG querying and manipulation of meta data}]
[item modules/png/png.man   png  {PNG querying and manipulation of meta data}]
[item modules/tar/tar.man   tar  {Tar file creation, extraction & manipulation}]
[item modules/tiff/tiff.man tiff {TIFF reading, writing, and querying and manipulation of meta data}]
[division_end]
[division_start {Grammars and finite automata}]
[item modules/grammar_aycock/aycock.man  grammar::aycock        {Aycock-Horspool-Earley parser generator for Tcl}]
[item modules/grammar_fa/fa.man          grammar::fa            {Create and manipulate finite automatons}]
[item modules/grammar_fa/dacceptor.man   grammar::fa::dacceptor {Create and use deterministic acceptors}]
[item modules/grammar_fa/dexec.man       grammar::fa::dexec     {Execute deterministic finite automatons}]
[item modules/grammar_fa/faop.man        grammar::fa::op        {Operations on finite automatons}]
[item modules/grammar_me/me_cpu.man      grammar::me::cpu       {Virtual machine implementation II for parsing token streams}]
[item modules/grammar_me/me_cpucore.man  grammar::me::cpu::core {ME virtual machine state manipulation}]
[item modules/grammar_me/gasm.man        grammar::me::cpu::gasm {ME assembler}]
97
98
99
100
101
102
103

104

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
























136
137
138
139
140
141
142
163
164
165
166
167
168
169
170

171
172
173
174
175
176
177
178
179
180






















181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211







+
-
+









-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







[item modules/crc/crc16.man         crc16     {Perform a 16bit Cyclic Redundancy Check}]
[item modules/crc/crc32.man         crc32     {Perform a 32bit Cyclic Redundancy Check}]
[item modules/des/des.man           des       {Implementation of the DES and triple-DES ciphers}]
[item modules/md4/md4.man           md4       {MD4 Message-Digest Algorithm}]
[item modules/md5/md5.man           md5       {MD5 Message-Digest Algorithm}]
[item modules/md5crypt/md5crypt.man md5crypt  {MD5-based password encryption}]
[item modules/otp/otp.man           otp       {One-Time Passwords}]
[item modules/pki/pki.man           pki       {Implementation of the public key cipher}]
[item modules/rc4/rc4.man           rc4       {Impementation of the RC4 stream cipher}]
[item modules/rc4/rc4.man           rc4       {Implementation of the RC4 stream cipher}]
[item modules/ripemd/ripemd128.man  ripemd128 {RIPEMD-128 Message-Digest Algorithm}]
[item modules/ripemd/ripemd160.man  ripemd160 {RIPEMD-160 Message-Digest Algorithm}]
[item modules/sha1/sha1.man         sha1      {SHA1 Message-Digest Algorithm}]
[item modules/sha1/sha256.man       sha256    {SHA256 Message-Digest Algorithm}]
[item modules/soundex/soundex.man   soundex   Soundex]
[item modules/crc/sum.man           sum       {Calculate a sum(1) compatible checksum}]
[item modules/uuid/uuid.man         uuid      {UUID generation and comparison}]
[division_end]
[division_start Mathematics]
[item modules/math/math.man             math                    {Tcl Math Library}]
[item modules/math/bigfloat.man         math::bigfloat          {Arbitrary precision floating-point numbers}]
[item modules/math/bignum.man           math::bignum            {Arbitrary precision integer numbers}]
[item modules/math/calculus.man         math::calculus          {Integration and ordinary differential equations}]
[item modules/math/romberg.man          math::calculus::romberg {Romberg integration}]
[item modules/math/combinatorics.man    math::combinatorics     {Combinatorial functions in the Tcl Math Library}]
[item modules/math/qcomplex.man         math::complexnumbers    {Straightforward complex number package}]
[item modules/math/constants.man        math::constants         {Mathematical and numerical constants}]
[item modules/math/fourier.man          math::fourier           {Discrete and fast fourier transforms}]
[item modules/math/fuzzy.man            math::fuzzy             {Fuzzy comparison of floating-point numbers}]
[item modules/math/geometry.man         math::geometry          {Geometrical computations}]
[item modules/math/interpolate.man      math::interpolate       {Interpolation routines}]
[item modules/math/linalg.man           math::linearalgebra     {Linear Algebra}]
[item modules/math/optimize.man         math::optimize          {Optimisation routines}]
[item modules/math/polynomials.man      math::polynomials       {Polynomial functions}]
[item modules/math/rational_funcs.man   math::rationalfunctions {Polynomial functions}]
[item modules/math/roman.man            math::roman             {Tools for creating and manipulating roman numerals}]
[item modules/math/special.man          math::special           {Special mathematical functions}]
[item modules/math/statistics.man       math::statistics        {Basic statistical functions and procedures}]
[item modules/simulation/annealing.man  simulation::annealing   {Simulated annealing}]
[item modules/simulation/montecarlo.man simulation::montecarlo  {Monte Carlo simulations}]
[item modules/simulation/random.man     simulation::random      {Pseudo-random number generators}]
[item modules/math/math.man                    math                    {Tcl Math Library}]
[item modules/math/bigfloat.man                math::bigfloat          {Arbitrary precision floating-point numbers}]
[item modules/math/bignum.man                  math::bignum            {Arbitrary precision integer numbers}]
[item modules/math/calculus.man                math::calculus          {Integration and ordinary differential equations}]
[item modules/math/romberg.man                 math::calculus::romberg {Romberg integration}]
[item modules/math/combinatorics.man           math::combinatorics     {Combinatorial functions in the Tcl Math Library}]
[item modules/math/qcomplex.man                math::complexnumbers    {Straightforward complex number package}]
[item modules/math/constants.man               math::constants         {Mathematical and numerical constants}]
[item modules/math/decimal.man                 math::decimal           {General decimal arithmetic}]
[item modules/math/fourier.man                 math::fourier           {Discrete and fast fourier transforms}]
[item modules/math/fuzzy.man                   math::fuzzy             {Fuzzy comparison of floating-point numbers}]
[item modules/math/math_geometry.man           math::geometry          {Geometrical computations}]
[item modules/math/interpolate.man             math::interpolate       {Interpolation routines}]
[item modules/math/linalg.man                  math::linearalgebra     {Linear Algebra}]
[item modules/math/numtheory.man               math::numtheory         {Number Theory}]
[item modules/math/optimize.man                math::optimize          {Optimisation routines}]
[item modules/math/polynomials.man             math::polynomials       {Polynomial functions}]
[item modules/math/rational_funcs.man          math::rationalfunctions {Polynomial functions}]
[item modules/math/roman.man                   math::roman             {Tools for creating and manipulating roman numerals}]
[item modules/math/special.man                 math::special           {Special mathematical functions}]
[item modules/math/statistics.man              math::statistics        {Basic statistical functions and procedures}]
[item modules/simulation/annealing.man         simulation::annealing   {Simulated annealing}]
[item modules/simulation/montecarlo.man        simulation::montecarlo  {Monte Carlo simulations}]
[item modules/simulation/simulation_random.man simulation::random      {Pseudo-random number generators}]
[division_end]
[division_start Networking]
[item modules/asn/asn.man          asn                {ASN.1 BER encoder/decoder}]
[item modules/http/autoproxy.man   autoproxy          {Automatic HTTP proxy usage and authentication}]
[item modules/bee/bee.man          bee                {BitTorrent Serialization Format Encoder/Decoder}]
[item modules/dns/tcllib_dns.man   dns                {Tcl Domain Name Service Client}]
[item modules/ftp/ftp.man          ftp                {Client-side tcl implementation of the ftp protocol}]
177
178
179
180
181
182
183












































184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199

200
201
202
203
204
205
206
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
















+







[item modules/page/page_pluginmgr.man       page_pluginmgr       {page plugin manager}]
[item modules/page/page_util_flow.man       page_util_flow       {page dataflow/treewalker utility}]
[item modules/page/page_util_norm_lemon.man page_util_norm_lemon {page AST normalization, LEMON}]
[item modules/page/page_util_norm_peg.man   page_util_norm_peg   {page AST normalization, PEG}]
[item modules/page/page_util_peg.man        page_util_peg        {page PEG transformation utilities}]
[item modules/page/page_util_quote.man      page_util_quote      {page character quoting utilities}]
[division_end]
[division_start {Parsing and Grammars}]
[item modules/pt/pt.man                       pt                                 {Parser Tools Application}]
[item modules/pt/pt_astree.man                pt::ast                            {Abstract Syntax Tree Serialization}]
[item modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl  {C/PARAM, Canned configuration, Critcl}]
[item modules/pt/pt_json_language.man         pt::json_language                  {The JSON Grammar Exchange Format}]
[item modules/pt/pt_param.man                 pt::param                          {PackRat Machine Specification}]
[item modules/pt/pt_pexpression.man           pt::pe                             {Parsing Expression Serialization}]
[item modules/pt/pt_pexpr_op.man              pt::pe::op                         {Parsing Expression Utilities}]
[item modules/pt/pt_pegrammar.man             pt::peg                            {Parsing Expression Grammar Serialization}]
[item modules/pt/pt_peg_container.man         pt::peg::container                 {PEG Storage}]
[item modules/pt/pt_peg_container_peg.man     pt::peg::container::peg            {PEG Storage. Canned PEG grammar specification}]
[item modules/pt/pt_peg_export.man            pt::peg::export                    {PEG Export}]
[item modules/pt/pt_peg_export_container.man  pt::peg::export::container         {PEG Export Plugin. Write CONTAINER format}]
[item modules/pt/pt_peg_export_json.man       pt::peg::export::json              {PEG Export Plugin. Write JSON format}]
[item modules/pt/pt_peg_export_peg.man        pt::peg::export::peg               {PEG Export Plugin. Write PEG format}]
[item modules/pt/pt_peg_from_container.man    pt::peg::from::container           {PEG Conversion. From CONTAINER format}]
[item modules/pt/pt_peg_from_json.man         pt::peg::from::json                {PEG Conversion. Read JSON format}]
[item modules/pt/pt_peg_from_peg.man          pt::peg::from::peg                 {PEG Conversion. Read PEG format}]
[item modules/pt/pt_peg_import.man            pt::peg::import                    {PEG Import}]
[item modules/pt/pt_peg_import_container.man  pt::peg::import::container         {PEG Import Plugin. From CONTAINER format}]
[item modules/pt/pt_peg_import_json.man       pt::peg::import::json              {PEG Import Plugin. Read JSON format}]
[item modules/pt/pt_peg_import_peg.man        pt::peg::import::peg               {PEG Import Plugin. Read PEG format}]
[item modules/pt/pt_peg_interp.man            pt::peg::interp                    {Interpreter for parsing expression grammars}]
[item modules/pt/pt_peg_to_container.man      pt::peg::to::container             {PEG Conversion. Write CONTAINER format}]
[item modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam                {PEG Conversion. Write CPARAM format}]
[item modules/pt/pt_peg_to_json.man           pt::peg::to::json                  {PEG Conversion. Write JSON format}]
[item modules/pt/pt_peg_to_param.man          pt::peg::to::param                 {PEG Conversion. Write PARAM format}]
[item modules/pt/pt_peg_to_peg.man            pt::peg::to::peg                   {PEG Conversion. Write PEG format}]
[item modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam              {PEG Conversion. Write TCLPARAM format}]
[item modules/pt/pt_peg_language.man          pt::peg_language                   {PEG Language Tutorial}]
[item modules/pt/pt_peg_introduction.man      pt::pegrammar                      {Introduction to Parsing Expression Grammars}]
[item modules/pt/pt_pgen.man                  pt::pgen                           {Parser Generator}]
[item modules/pt/pt_rdengine.man              pt::rde                            {Parsing Runtime Support, PARAM based}]
[item modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit  {Tcl/PARAM, Canned configuration, Snit}]
[item modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo {Tcl/PARAM, Canned configuration, Tcloo}]
[item modules/pt/pt_to_api.man                pt_export_api                      {Parser Tools Export API}]
[item modules/pt/pt_from_api.man              pt_import_api                      {Parser Tools Import API}]
[item modules/pt/pt_introduction.man          pt_introduction                    {Introduction to Parser Tools}]
[item modules/pt/pt_parser_api.man            pt_parser_api                      {Parser API}]
[division_end]
[division_start {Procedures, arguments, parameters, options}]
[item modules/tepam/tepam_introduction.man tepam            {An introduction into TEPAM, Tcl's Enhanced Procedure and Argument Manager}]
[item modules/tepam/tepam_procedure.man    tepam::procedure {TEPAM procedure, reference manual}]
[division_end]
[division_start {Programming tools}]
[item modules/cmdline/cmdline.man         cmdline                   {Procedures to process command lines and options.}]
[item modules/comm/comm.man               comm                      {A remote communication facility for Tcl (8.3 and later)}]
[item modules/comm/comm_wire.man          comm_wire                 {The comm wire protocol}]
[item modules/control/control.man         control                   {Procedures for control flow structures.}]
[item modules/interp/deleg_method.man     deleg_method              {Creation of comm delegates (snit methods)}]
[item modules/interp/deleg_proc.man       deleg_proc                {Creation of comm delegates (procedures)}]
[item modules/fileutil/fileutil.man       fileutil                  {Procedures implementing some file utilities}]
[item modules/fumagic/cfront.man          fileutil::magic::cfront   {Generator core for compiler of magic(5) files}]
[item modules/fumagic/cgen.man            fileutil::magic::cgen     {Generator core for compiler of magic(5) files}]
[item modules/fumagic/filetypes.man       fileutil::magic::filetype {Procedures implementing file-type recognition}]
[item modules/fumagic/mimetypes.man       fileutil::magic::mimetype {Procedures implementing mime-type recognition}]
[item modules/fumagic/rtcore.man          fileutil::magic::rt       {Runtime core for file type recognition engines written in pure Tcl}]
[item modules/fileutil/multi.man          fileutil::multi           {Multi-file operation, scatter/gather, standard object}]
[item modules/fileutil/multiop.man        fileutil::multi::op       {Multi-file operation, scatter/gather}]
[item modules/fileutil/traverse.man       fileutil_traverse         {Iterative directory traversal}]
[item modules/hook/hook.man               hook                      Hooks]
[item modules/interp/tcllib_interp.man    interp                    {Interp creation and aliasing}]
[item modules/log/log.man                 log                       {Procedures to log messages of libraries and applications.}]
[item modules/log/logger.man              logger                    {System to control logging of events.}]
[item modules/log/loggerAppender.man      logger::appender          {Collection of predefined appenders for logger}]
[item modules/log/loggerUtils.man         logger::utils             {Utilities for logger}]
[item modules/multiplexer/multiplexer.man multiplexer               {One-to-many communication with sockets.}]
[item modules/pluginmgr/pluginmgr.man     pluginmgr                 {Manage a plugin}]
223
224
225
226
227
228
229


















230

231
232
233
234
235


236
237
238
239
240
241
242
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+





+
+







[item modules/term/ansi_send.man    term::ansi::send         {Output of ANSI control sequences to terminals}]
[item modules/term/imenu.man        term::interact::menu     {Terminal widget, menu}]
[item modules/term/ipager.man       term::interact::pager    {Terminal widget, paging}]
[item modules/term/receive.man      term::receive            {General input from terminals}]
[item modules/term/term_bind.man    term::receive::bind      {Keyboard dispatch from terminals}]
[item modules/term/term_send.man    term::send               {General output to terminals}]
[division_end]
[division_start {Text formatter plugin}]
[item modules/doctools2idx/export_docidx.man doctools::idx::export::docidx {docidx export plugin}]
[item modules/doctools2idx/export_html.man   doctools::idx::export::html   {HTML export plugin}]
[item modules/doctools2idx/export_json.man   doctools::idx::export::json   {JSON export plugin}]
[item modules/doctools2idx/export_nroff.man  doctools::idx::export::nroff  {nroff export plugin}]
[item modules/doctools2idx/export_text.man   doctools::idx::export::text   {plain text export plugin}]
[item modules/doctools2idx/export_wiki.man   doctools::idx::export::wiki   {wiki export plugin}]
[item modules/doctools2idx/import_docidx.man doctools::idx::import::docidx {docidx import plugin}]
[item modules/doctools2idx/import_json.man   doctools::idx::import::json   {JSON import plugin}]
[item modules/doctools2toc/export_doctoc.man doctools::toc::export::doctoc {doctoc export plugin}]
[item modules/doctools2toc/export_html.man   doctools::toc::export::html   {HTML export plugin}]
[item modules/doctools2toc/export_json.man   doctools::toc::export::json   {JSON export plugin}]
[item modules/doctools2toc/export_nroff.man  doctools::toc::export::nroff  {nroff export plugin}]
[item modules/doctools2toc/export_text.man   doctools::toc::export::text   {plain text export plugin}]
[item modules/doctools2toc/export_wiki.man   doctools::toc::export::wiki   {wiki export plugin}]
[item modules/doctools2toc/import_doctoc.man doctools::toc::import::doctoc {doctoc import plugin}]
[item modules/doctools2toc/import_json.man   doctools::toc::import::json   {JSON import plugin}]
[division_end]
[division_start {Text processing}]
[item modules/base64/ascii85.man           ascii85          {ascii85-encode/decode binary data}]
[item modules/base32/base32.man            base32           {base32 standard encoding}]
[item modules/base32/base32core.man        base32::core     {Expanding basic base32 maps}]
[item modules/base32/base32hex.man         base32::hex      {base32 extended hex encoding}]
[item modules/base64/base64.man            base64           {base64-encode/decode binary data}]
[item modules/bibtex/bibtex.man            bibtex           {Parse bibtex files}]
[item modules/clock/iso8601.man            clock_iso8601    {Parsing ISO 8601 dates/times}]
[item modules/clock/rfc2822.man            clock_rfc2822    {Parsing ISO 8601 dates/times}]
[item modules/csv/csv.man                  csv              {Procedures to handle CSV data.}]
[item modules/htmlparse/htmlparse.man      htmlparse        {Procedures to parse HTML strings}]
[item modules/inifile/ini.man              inifile          {Parsing of Windows INI files}]
[item modules/mime/mime.man                mime             {Manipulation of MIME body parts}]
[item modules/rcs/rcs.man                  rcs              {RCS low level utilities}]
[item modules/textutil/textutil.man        textutil         {Procedures to manipulate texts and strings.}]
[item modules/textutil/adjust.man          textutil::adjust {Procedures to adjust, indent, and undent paragraphs}]
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274








































275
276
277
278
279
280
281
390
391
392
393
394
395
396













397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443







-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







[item modules/transfer/tqueue.man      transfer::copy::queue       {Queued transfers}]
[item modules/transfer/ddest.man       transfer::data::destination {Data destination}]
[item modules/transfer/dsource.man     transfer::data::source      {Data source}]
[item modules/transfer/receiver.man    transfer::receiver          {Data source}]
[item modules/transfer/transmitter.man transfer::transmitter       {Data source}]
[division_end]
[division_start Unfiled]
[item modules/cache/async.man                cache::async         {Asynchronous in-memory cache}]
[item modules/yaml/huddle.man                huddle               {Create and manipulate huddle object}]
[item modules/map/map_slippy.man             map::slippy          {Common code for slippy based map packages}]
[item modules/map/map_slippy_cache.man       map::slippy::cache   {Management of a tile cache in the local filesystem}]
[item modules/map/map_slippy_fetcher.man     map::slippy::fetcher {Accessing a server providing tiles for slippy-based maps}]
[item modules/mapproj/mapproj.man            mapproj              {Map projection routines}]
[item modules/stringprep/stringprep.man      stringprep           {Implementation of stringprep}]
[item modules/stringprep/stringprep_data.man stringprep::data     {stringprep data tables, generated, internal}]
[item modules/uev/uevent_onidle.man          uevent::onidle       {Request merging and deferal to idle time}]
[item modules/stringprep/unicode.man         unicode              {Implementation of Unicode normalization}]
[item modules/stringprep/unicode_data.man    unicode::data        {unicode data tables, generated, internal}]
[item modules/units/units.man                units                {unit conversion}]
[item modules/yaml/yaml.man                  yaml                 {YAML Format Encoder/Decoder}]
[item modules/cache/async.man                cache::async             {Asynchronous in-memory cache}]
[item modules/generator/generator.man        generator                {Procedures for creating and using generators.}]
[item modules/yaml/huddle.man                huddle                   {Create and manipulate huddle object}]
[item modules/imap4/imap4.man                imap4                    {imap client-side tcl implementation of imap protocol}]
[item modules/map/map_geocode_nominatim.man  map::geocode::nominatim  {Resolving geographical names with a Nominatim service}]
[item modules/map/map_slippy.man             map::slippy              {Common code for slippy based map packages}]
[item modules/map/map_slippy_cache.man       map::slippy::cache       {Management of a tile cache in the local filesystem}]
[item modules/map/map_slippy_fetcher.man     map::slippy::fetcher     {Accessing a server providing tiles for slippy-based maps}]
[item modules/mapproj/mapproj.man            mapproj                  {Map projection routines}]
[item modules/math/symdiff.man               math::calculus::symdiff  {Symbolic differentiation for Tcl}]
[item modules/namespacex/namespacex.man      namespacex               {Namespace utility commands}]
[item modules/rest/rest.man                  rest                     {define REST web APIs and call them inline or asychronously}]
[item modules/stringprep/stringprep.man      stringprep               {Implementation of stringprep}]
[item modules/stringprep/stringprep_data.man stringprep::data         {stringprep data tables, generated, internal}]
[item modules/math/machineparameters.man     tclrep/machineparameters {Compute double precision machine parameters.}]
[item modules/uev/uevent_onidle.man          uevent::onidle           {Request merging and deferal to idle time}]
[item modules/stringprep/unicode.man         unicode                  {Implementation of Unicode normalization}]
[item modules/stringprep/unicode_data.man    unicode::data            {unicode data tables, generated, internal}]
[item modules/units/units.man                units                    {unit conversion}]
[item modules/yaml/yaml.man                  yaml                     {YAML Format Encoder/Decoder}]
[division_end]
[division_start Utility]
[item modules/lambda/lambda.man  lambda   {Utility commands for anonymous procedures}]
[item modules/ooutil/ooutil.man  oo::util {Utility commands for TclOO}]
[item modules/try/tcllib_try.man try      {try - Trap and process errors and exceptions}]
[division_end]
[division_start {Validation, Type checking}]
[item modules/valtype/valtype_common.man valtype::common                 {Validation, common code}]
[item modules/valtype/cc_amex.man        valtype::creditcard::amex       {Validation for AMEX creditcard number}]
[item modules/valtype/cc_discover.man    valtype::creditcard::discover   {Validation for Discover creditcard number}]
[item modules/valtype/cc_mastercard.man  valtype::creditcard::mastercard {Validation for Mastercard creditcard number}]
[item modules/valtype/cc_visa.man        valtype::creditcard::visa       {Validation for VISA creditcard number}]
[item modules/valtype/ean13.man          valtype::gs1::ean13             {Validation for EAN13}]
[item modules/valtype/iban.man           valtype::iban                   {Validation for IBAN}]
[item modules/valtype/imei.man           valtype::imei                   {Validation for IMEI}]
[item modules/valtype/isbn.man           valtype::isbn                   {Validation for ISBN}]
[item modules/valtype/luhn.man           valtype::luhn                   {Validation for plain number with a LUHN checkdigit}]
[item modules/valtype/luhn5.man          valtype::luhn5                  {Validation for plain number with a LUHN5 checkdigit}]
[item modules/valtype/usnpi.man          valtype::usnpi                  {Validation for USNPI}]
[item modules/valtype/verhoeff.man       valtype::verhoeff               {Validation for plain number with a VERHOEFF checkdigit}]
[division_end]
[division_end]
[division_start {By Type}]
[division_start Applications]
[item apps/dtplite.man     dtplite     {Lightweight DocTools Markup Processor}]
[item apps/nns.man         nns         {Name service facility, Commandline Client Application}]
[item apps/nnsd.man        nnsd        {Name service facility, Commandline Server Application}]
296
297
298
299
300
301
302

303
304
305
306
307
308
309
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472







+







[division_end]
[division_start base32]
[item modules/base32/base32.man     base32       {base32 standard encoding}]
[item modules/base32/base32core.man base32::core {Expanding basic base32 maps}]
[item modules/base32/base32hex.man  base32::hex  {base32 extended hex encoding}]
[division_end]
[division_start base64]
[item modules/base64/ascii85.man  ascii85  {ascii85-encode/decode binary data}]
[item modules/base64/base64.man   base64   {base64-encode/decode binary data}]
[item modules/base64/uuencode.man uuencode {UU-encode/decode binary data}]
[item modules/base64/yencode.man  yencode  {Y-encode/decode binary data}]
[division_end]
[division_start bee]
[item modules/bee/bee.man bee {BitTorrent Serialization Format Encoder/Decoder}]
[division_end]
321
322
323
324
325
326
327




328
329
330
331
332
333
334
335
336
337




338
339
340
341
342
343
344
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515







+
+
+
+










+
+
+
+







[division_end]
[division_start blowfish]
[item modules/blowfish/blowfish.man blowfish {Implementation of the Blowfish block cipher}]
[division_end]
[division_start cache]
[item modules/cache/async.man cache::async {Asynchronous in-memory cache}]
[division_end]
[division_start clock]
[item modules/clock/iso8601.man clock_iso8601 {Parsing ISO 8601 dates/times}]
[item modules/clock/rfc2822.man clock_rfc2822 {Parsing ISO 8601 dates/times}]
[division_end]
[division_start cmdline]
[item modules/cmdline/cmdline.man cmdline {Procedures to process command lines and options.}]
[division_end]
[division_start comm]
[item modules/comm/comm.man      comm      {A remote communication facility for Tcl (8.3 and later)}]
[item modules/comm/comm_wire.man comm_wire {The comm wire protocol}]
[division_end]
[division_start control]
[item modules/control/control.man control {Procedures for control flow structures.}]
[division_end]
[division_start coroutine]
[item modules/coroutine/coroutine.man coroutine       {Coroutine based event and IO handling}]
[item modules/coroutine/coro_auto.man coroutine::auto {Automatic event and IO coroutine awareness}]
[division_end]
[division_start counter]
[item modules/counter/counter.man counter {Procedures for counters and histograms}]
[division_end]
[division_start crc]
[item modules/crc/cksum.man cksum {Calculate a cksum(1) compatible checksum}]
[item modules/crc/crc16.man crc16 {Perform a 16bit Cyclic Redundancy Check}]
[item modules/crc/crc32.man crc32 {Perform a 32bit Cyclic Redundancy Check}]
380
381
382
383
384
385
386














































387
388
389
390
391
392
393
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







[item modules/doctools/doctools_lang_cmdref.man   doctools_lang_cmdref   {doctools language command reference}]
[item modules/doctools/doctools_lang_faq.man      doctools_lang_faq      {doctools language faq}]
[item modules/doctools/doctools_lang_intro.man    doctools_lang_intro    {doctools language introduction}]
[item modules/doctools/doctools_lang_syntax.man   doctools_lang_syntax   {doctools language syntax}]
[item modules/doctools/doctools_plugin_apiref.man doctools_plugin_apiref {doctools plugin API reference}]
[item modules/doctools/mpexpand.man               mpexpand               {Markup processor}]
[division_end]
[division_start doctools2base]
[item modules/doctools2base/html_cssdefaults.man doctools::html::cssdefaults {Default CSS style for HTML export plugins}]
[item modules/doctools2base/tcllib_msgcat.man    doctools::msgcat            {Message catalog management for the various document parsers}]
[item modules/doctools2base/nroff_manmacros.man  doctools::nroff::man_macros {Default CSS style for NROFF export plugins}]
[item modules/doctools2base/tcl_parse.man        doctools::tcl::parse        {Processing text in 'subst -novariables' format}]
[division_end]
[division_start doctools2idx]
[item modules/doctools2idx/introduction.man  doctools2idx_introduction     {DocTools - Keyword indices}]
[item modules/doctools2idx/container.man     doctools::idx                 {Holding keyword indices}]
[item modules/doctools2idx/export.man        doctools::idx::export         {Exporting keyword indices}]
[item modules/doctools2idx/export_docidx.man doctools::idx::export::docidx {docidx export plugin}]
[item modules/doctools2idx/export_html.man   doctools::idx::export::html   {HTML export plugin}]
[item modules/doctools2idx/export_json.man   doctools::idx::export::json   {JSON export plugin}]
[item modules/doctools2idx/export_nroff.man  doctools::idx::export::nroff  {nroff export plugin}]
[item modules/doctools2idx/export_text.man   doctools::idx::export::text   {plain text export plugin}]
[item modules/doctools2idx/export_wiki.man   doctools::idx::export::wiki   {wiki export plugin}]
[item modules/doctools2idx/import.man        doctools::idx::import         {Importing keyword indices}]
[item modules/doctools2idx/import_docidx.man doctools::idx::import::docidx {docidx import plugin}]
[item modules/doctools2idx/import_json.man   doctools::idx::import::json   {JSON import plugin}]
[item modules/doctools2idx/parse.man         doctools::idx::parse          {Parsing text in docidx format}]
[item modules/doctools2idx/structure.man     doctools::idx::structure      {Docidx serialization utilities}]
[item modules/doctools2idx/msgcat_c.man      doctools::msgcat::idx::c      {Message catalog for the docidx parser (C)}]
[item modules/doctools2idx/msgcat_de.man     doctools::msgcat::idx::de     {Message catalog for the docidx parser (DE)}]
[item modules/doctools2idx/msgcat_en.man     doctools::msgcat::idx::en     {Message catalog for the docidx parser (EN)}]
[item modules/doctools2idx/msgcat_fr.man     doctools::msgcat::idx::fr     {Message catalog for the docidx parser (FR)}]
[division_end]
[division_start doctools2toc]
[item modules/doctools2toc/introduction.man  doctools2toc_introduction     {DocTools - Tables of Contents}]
[item modules/doctools2toc/msgcat_c.man      doctools::msgcat::toc::c      {Message catalog for the doctoc parser (C)}]
[item modules/doctools2toc/msgcat_de.man     doctools::msgcat::toc::de     {Message catalog for the doctoc parser (DE)}]
[item modules/doctools2toc/msgcat_en.man     doctools::msgcat::toc::en     {Message catalog for the doctoc parser (EN)}]
[item modules/doctools2toc/msgcat_fr.man     doctools::msgcat::toc::fr     {Message catalog for the doctoc parser (FR)}]
[item modules/doctools2toc/container.man     doctools::toc                 {Holding tables of contents}]
[item modules/doctools2toc/export.man        doctools::toc::export         {Exporting tables of contents}]
[item modules/doctools2toc/export_doctoc.man doctools::toc::export::doctoc {doctoc export plugin}]
[item modules/doctools2toc/export_html.man   doctools::toc::export::html   {HTML export plugin}]
[item modules/doctools2toc/export_json.man   doctools::toc::export::json   {JSON export plugin}]
[item modules/doctools2toc/export_nroff.man  doctools::toc::export::nroff  {nroff export plugin}]
[item modules/doctools2toc/export_text.man   doctools::toc::export::text   {plain text export plugin}]
[item modules/doctools2toc/export_wiki.man   doctools::toc::export::wiki   {wiki export plugin}]
[item modules/doctools2toc/import.man        doctools::toc::import         {Importing keyword indices}]
[item modules/doctools2toc/import_doctoc.man doctools::toc::import::doctoc {doctoc import plugin}]
[item modules/doctools2toc/import_json.man   doctools::toc::import::json   {JSON import plugin}]
[item modules/doctools2toc/parse.man         doctools::toc::parse          {Parsing text in doctoc format}]
[item modules/doctools2toc/structure.man     doctools::toc::structure      {Doctoc serialization utilities}]
[division_end]
[division_start exif]
[item modules/exif/exif.man exif {Tcl EXIF extracts and parses EXIF fields from digital images}]
[division_end]
[division_start fileutil]
[item modules/fileutil/fileutil.man fileutil            {Procedures implementing some file utilities}]
[item modules/fileutil/multi.man    fileutil::multi     {Multi-file operation, scatter/gather, standard object}]
[item modules/fileutil/multiop.man  fileutil::multi::op {Multi-file operation, scatter/gather}]
403
404
405
406
407
408
409









410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429



430
431
432
433
434
435
436
437
438
439
440
441



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461





462
463
464
465
466
467
468
469
470
471
472
473

474
475
476



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500























501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517



518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537



538
539
540
541
542
543
544
545
546
547
548
549



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566








































567
568

569
570
571
572
573
574
575



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590



591
592
593
594
595
596
597
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692

693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710



711
712
713
714
715
716
717
718



















719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857

858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880



881
882
883
884
885
886
887
888
889
890







+
+
+
+
+
+
+
+
+




















+
+
+












+
+
+



















-
+
+
+
+
+












+
-
-
-
+
+
+





-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

















+
+
+




















+
+
+












+
+
+

















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
+







+
+
+












-
-
-
+
+
+







[division_start fumagic]
[item modules/fumagic/cfront.man    fileutil::magic::cfront   {Generator core for compiler of magic(5) files}]
[item modules/fumagic/cgen.man      fileutil::magic::cgen     {Generator core for compiler of magic(5) files}]
[item modules/fumagic/filetypes.man fileutil::magic::filetype {Procedures implementing file-type recognition}]
[item modules/fumagic/mimetypes.man fileutil::magic::mimetype {Procedures implementing mime-type recognition}]
[item modules/fumagic/rtcore.man    fileutil::magic::rt       {Runtime core for file type recognition engines written in pure Tcl}]
[division_end]
[division_start generator]
[item modules/generator/generator.man generator {Procedures for creating and using generators.}]
[division_end]
[division_start gpx]
[item modules/gpx/gpx.man gpx {Extracts waypoints, tracks and routes from GPX files}]
[division_end]
[division_start grammar_aycock]
[item modules/grammar_aycock/aycock.man grammar::aycock {Aycock-Horspool-Earley parser generator for Tcl}]
[division_end]
[division_start grammar_fa]
[item modules/grammar_fa/fa.man        grammar::fa            {Create and manipulate finite automatons}]
[item modules/grammar_fa/dacceptor.man grammar::fa::dacceptor {Create and use deterministic acceptors}]
[item modules/grammar_fa/dexec.man     grammar::fa::dexec     {Execute deterministic finite automatons}]
[item modules/grammar_fa/faop.man      grammar::fa::op        {Operations on finite automatons}]
[division_end]
[division_start grammar_me]
[item modules/grammar_me/me_cpu.man     grammar::me::cpu       {Virtual machine implementation II for parsing token streams}]
[item modules/grammar_me/me_cpucore.man grammar::me::cpu::core {ME virtual machine state manipulation}]
[item modules/grammar_me/gasm.man       grammar::me::cpu::gasm {ME assembler}]
[item modules/grammar_me/me_tcl.man     grammar::me::tcl       {Virtual machine implementation I for parsing token streams}]
[item modules/grammar_me/me_util.man    grammar::me::util      {AST utilities}]
[item modules/grammar_me/me_ast.man     grammar::me_ast        {Various representations of ASTs}]
[item modules/grammar_me/me_intro.man   grammar::me_intro      {Introduction to virtual machines for parsing token streams}]
[item modules/grammar_me/me_vm.man      grammar::me_vm         {Virtual machine for parsing token streams}]
[division_end]
[division_start grammar_peg]
[item modules/grammar_peg/peg.man        grammar::peg         {Create and manipulate parsing expression grammars}]
[item modules/grammar_peg/peg_interp.man grammar::peg::interp {Interpreter for parsing expression grammars}]
[division_end]
[division_start hook]
[item modules/hook/hook.man hook Hooks]
[division_end]
[division_start html]
[item modules/html/html.man html {Procedures to generate HTML structures}]
[division_end]
[division_start htmlparse]
[item modules/htmlparse/htmlparse.man htmlparse {Procedures to parse HTML strings}]
[division_end]
[division_start http]
[item modules/http/autoproxy.man autoproxy {Automatic HTTP proxy usage and authentication}]
[division_end]
[division_start ident]
[item modules/ident/ident.man ident {Ident protocol client}]
[division_end]
[division_start imap4]
[item modules/imap4/imap4.man imap4 {imap client-side tcl implementation of imap protocol}]
[division_end]
[division_start inifile]
[item modules/inifile/ini.man inifile {Parsing of Windows INI files}]
[division_end]
[division_start interp]
[item modules/interp/deleg_method.man  deleg_method {Creation of comm delegates (snit methods)}]
[item modules/interp/deleg_proc.man    deleg_proc   {Creation of comm delegates (procedures)}]
[item modules/interp/tcllib_interp.man interp       {Interp creation and aliasing}]
[division_end]
[division_start irc]
[item modules/irc/irc.man     irc     {Create IRC connection and interface.}]
[item modules/irc/picoirc.man picoirc {Small and simple embeddable IRC client.}]
[division_end]
[division_start javascript]
[item modules/javascript/javascript.man javascript {Procedures to generate HTML and Java Script structures.}]
[division_end]
[division_start jpeg]
[item modules/jpeg/jpeg.man jpeg {JPEG querying and manipulation of meta data}]
[division_end]
[division_start json]
[item modules/json/json.man json {JSON parser}]
[item modules/json/json.man       json        {JSON parser}]
[item modules/json/json_write.man json::write {JSON generation}]
[division_end]
[division_start lambda]
[item modules/lambda/lambda.man lambda {Utility commands for anonymous procedures}]
[division_end]
[division_start ldap]
[item modules/ldap/ldap.man  ldap  {LDAP client}]
[item modules/ldap/ldapx.man ldapx {LDAP extended object interface}]
[division_end]
[division_start log]
[item modules/log/log.man            log              {Procedures to log messages of libraries and applications.}]
[item modules/log/logger.man         logger           {System to control logging of events.}]
[item modules/log/loggerAppender.man logger::appender {Collection of predefined appenders for logger}]
[item modules/log/loggerUtils.man    logger::utils    {Utilities for logger}]
[division_end]
[division_start map]
[item modules/map/map_geocode_nominatim.man map::geocode::nominatim {Resolving geographical names with a Nominatim service}]
[item modules/map/map_slippy.man         map::slippy          {Common code for slippy based map packages}]
[item modules/map/map_slippy_cache.man   map::slippy::cache   {Management of a tile cache in the local filesystem}]
[item modules/map/map_slippy_fetcher.man map::slippy::fetcher {Accessing a server providing tiles for slippy-based maps}]
[item modules/map/map_slippy.man            map::slippy             {Common code for slippy based map packages}]
[item modules/map/map_slippy_cache.man      map::slippy::cache      {Management of a tile cache in the local filesystem}]
[item modules/map/map_slippy_fetcher.man    map::slippy::fetcher    {Accessing a server providing tiles for slippy-based maps}]
[division_end]
[division_start mapproj]
[item modules/mapproj/mapproj.man mapproj {Map projection routines}]
[division_end]
[division_start math]
[item modules/math/math.man           math                    {Tcl Math Library}]
[item modules/math/bigfloat.man       math::bigfloat          {Arbitrary precision floating-point numbers}]
[item modules/math/bignum.man         math::bignum            {Arbitrary precision integer numbers}]
[item modules/math/calculus.man       math::calculus          {Integration and ordinary differential equations}]
[item modules/math/romberg.man        math::calculus::romberg {Romberg integration}]
[item modules/math/combinatorics.man  math::combinatorics     {Combinatorial functions in the Tcl Math Library}]
[item modules/math/qcomplex.man       math::complexnumbers    {Straightforward complex number package}]
[item modules/math/constants.man      math::constants         {Mathematical and numerical constants}]
[item modules/math/fourier.man        math::fourier           {Discrete and fast fourier transforms}]
[item modules/math/fuzzy.man          math::fuzzy             {Fuzzy comparison of floating-point numbers}]
[item modules/math/geometry.man       math::geometry          {Geometrical computations}]
[item modules/math/interpolate.man    math::interpolate       {Interpolation routines}]
[item modules/math/linalg.man         math::linearalgebra     {Linear Algebra}]
[item modules/math/optimize.man       math::optimize          {Optimisation routines}]
[item modules/math/polynomials.man    math::polynomials       {Polynomial functions}]
[item modules/math/rational_funcs.man math::rationalfunctions {Polynomial functions}]
[item modules/math/roman.man          math::roman             {Tools for creating and manipulating roman numerals}]
[item modules/math/special.man        math::special           {Special mathematical functions}]
[item modules/math/statistics.man     math::statistics        {Basic statistical functions and procedures}]
[item modules/math/math.man              math                     {Tcl Math Library}]
[item modules/math/bigfloat.man          math::bigfloat           {Arbitrary precision floating-point numbers}]
[item modules/math/bignum.man            math::bignum             {Arbitrary precision integer numbers}]
[item modules/math/calculus.man          math::calculus           {Integration and ordinary differential equations}]
[item modules/math/romberg.man           math::calculus::romberg  {Romberg integration}]
[item modules/math/symdiff.man           math::calculus::symdiff  {Symbolic differentiation for Tcl}]
[item modules/math/combinatorics.man     math::combinatorics      {Combinatorial functions in the Tcl Math Library}]
[item modules/math/qcomplex.man          math::complexnumbers     {Straightforward complex number package}]
[item modules/math/constants.man         math::constants          {Mathematical and numerical constants}]
[item modules/math/decimal.man           math::decimal            {General decimal arithmetic}]
[item modules/math/fourier.man           math::fourier            {Discrete and fast fourier transforms}]
[item modules/math/fuzzy.man             math::fuzzy              {Fuzzy comparison of floating-point numbers}]
[item modules/math/math_geometry.man     math::geometry           {Geometrical computations}]
[item modules/math/interpolate.man       math::interpolate        {Interpolation routines}]
[item modules/math/linalg.man            math::linearalgebra      {Linear Algebra}]
[item modules/math/numtheory.man         math::numtheory          {Number Theory}]
[item modules/math/optimize.man          math::optimize           {Optimisation routines}]
[item modules/math/polynomials.man       math::polynomials        {Polynomial functions}]
[item modules/math/rational_funcs.man    math::rationalfunctions  {Polynomial functions}]
[item modules/math/roman.man             math::roman              {Tools for creating and manipulating roman numerals}]
[item modules/math/special.man           math::special            {Special mathematical functions}]
[item modules/math/statistics.man        math::statistics         {Basic statistical functions and procedures}]
[item modules/math/machineparameters.man tclrep/machineparameters {Compute double precision machine parameters.}]
[division_end]
[division_start md4]
[item modules/md4/md4.man md4 {MD4 Message-Digest Algorithm}]
[division_end]
[division_start md5]
[item modules/md5/md5.man md5 {MD5 Message-Digest Algorithm}]
[division_end]
[division_start md5crypt]
[item modules/md5crypt/md5crypt.man md5crypt {MD5-based password encryption}]
[division_end]
[division_start mime]
[item modules/mime/mime.man mime {Manipulation of MIME body parts}]
[item modules/mime/smtp.man smtp {Client-side tcl implementation of the smtp protocol}]
[division_end]
[division_start multiplexer]
[item modules/multiplexer/multiplexer.man multiplexer {One-to-many communication with sockets.}]
[division_end]
[division_start namespacex]
[item modules/namespacex/namespacex.man namespacex {Namespace utility commands}]
[division_end]
[division_start ncgi]
[item modules/ncgi/ncgi.man ncgi {Procedures to manipulate CGI values.}]
[division_end]
[division_start nmea]
[item modules/nmea/nmea.man nmea {Process NMEA data}]
[division_end]
[division_start nns]
[item modules/nns/nns_client.man   nameserv           {Name service facility, Client}]
[item modules/nns/nns_auto.man     nameserv::auto     {Name service facility, Client Extension}]
[item modules/nns/nns_common.man   nameserv::common   {Name service facility, shared definitions}]
[item modules/nns/nns_protocol.man nameserv::protocol {Name service facility, client/server protocol}]
[item modules/nns/nns_server.man   nameserv::server   {Name service facility, Server}]
[item modules/nns/nns_intro.man    nns_intro          {Name service facility, introduction}]
[division_end]
[division_start nntp]
[item modules/nntp/nntp.man nntp {Tcl client for the NNTP protocol}]
[division_end]
[division_start ntp]
[item modules/ntp/ntp_time.man ntp_time {Tcl Time Service Client}]
[division_end]
[division_start ooutil]
[item modules/ooutil/ooutil.man oo::util {Utility commands for TclOO}]
[division_end]
[division_start otp]
[item modules/otp/otp.man otp {One-Time Passwords}]
[division_end]
[division_start page]
[item modules/page/page_intro.man           page_intro           {page introduction}]
[item modules/page/page_pluginmgr.man       page_pluginmgr       {page plugin manager}]
[item modules/page/page_util_flow.man       page_util_flow       {page dataflow/treewalker utility}]
[item modules/page/page_util_norm_lemon.man page_util_norm_lemon {page AST normalization, LEMON}]
[item modules/page/page_util_norm_peg.man   page_util_norm_peg   {page AST normalization, PEG}]
[item modules/page/page_util_peg.man        page_util_peg        {page PEG transformation utilities}]
[item modules/page/page_util_quote.man      page_util_quote      {page character quoting utilities}]
[division_end]
[division_start pki]
[item modules/pki/pki.man pki {Implementation of the public key cipher}]
[division_end]
[division_start pluginmgr]
[item modules/pluginmgr/pluginmgr.man pluginmgr {Manage a plugin}]
[division_end]
[division_start png]
[item modules/png/png.man png {PNG querying and manipulation of meta data}]
[division_end]
[division_start pop3]
[item modules/pop3/pop3.man pop3 {Tcl client for POP3 email protocol}]
[division_end]
[division_start pop3d]
[item modules/pop3d/pop3d.man      pop3d       {Tcl POP3 server implementation}]
[item modules/pop3d/pop3d_dbox.man pop3d::dbox {Simple mailbox database for pop3d}]
[item modules/pop3d/pop3d_udb.man  pop3d::udb  {Simple user database for pop3d}]
[division_end]
[division_start profiler]
[item modules/profiler/profiler.man profiler {Tcl source code profiler}]
[division_end]
[division_start pt]
[item modules/pt/pt.man                       pt                                 {Parser Tools Application}]
[item modules/pt/pt_astree.man                pt::ast                            {Abstract Syntax Tree Serialization}]
[item modules/pt/pt_cparam_config_critcl.man  pt::cparam::configuration::critcl  {C/PARAM, Canned configuration, Critcl}]
[item modules/pt/pt_json_language.man         pt::json_language                  {The JSON Grammar Exchange Format}]
[item modules/pt/pt_param.man                 pt::param                          {PackRat Machine Specification}]
[item modules/pt/pt_pexpression.man           pt::pe                             {Parsing Expression Serialization}]
[item modules/pt/pt_pexpr_op.man              pt::pe::op                         {Parsing Expression Utilities}]
[item modules/pt/pt_pegrammar.man             pt::peg                            {Parsing Expression Grammar Serialization}]
[item modules/pt/pt_peg_container.man         pt::peg::container                 {PEG Storage}]
[item modules/pt/pt_peg_container_peg.man     pt::peg::container::peg            {PEG Storage. Canned PEG grammar specification}]
[item modules/pt/pt_peg_export.man            pt::peg::export                    {PEG Export}]
[item modules/pt/pt_peg_export_container.man  pt::peg::export::container         {PEG Export Plugin. Write CONTAINER format}]
[item modules/pt/pt_peg_export_json.man       pt::peg::export::json              {PEG Export Plugin. Write JSON format}]
[item modules/pt/pt_peg_export_peg.man        pt::peg::export::peg               {PEG Export Plugin. Write PEG format}]
[item modules/pt/pt_peg_from_container.man    pt::peg::from::container           {PEG Conversion. From CONTAINER format}]
[item modules/pt/pt_peg_from_json.man         pt::peg::from::json                {PEG Conversion. Read JSON format}]
[item modules/pt/pt_peg_from_peg.man          pt::peg::from::peg                 {PEG Conversion. Read PEG format}]
[item modules/pt/pt_peg_import.man            pt::peg::import                    {PEG Import}]
[item modules/pt/pt_peg_import_container.man  pt::peg::import::container         {PEG Import Plugin. From CONTAINER format}]
[item modules/pt/pt_peg_import_json.man       pt::peg::import::json              {PEG Import Plugin. Read JSON format}]
[item modules/pt/pt_peg_import_peg.man        pt::peg::import::peg               {PEG Import Plugin. Read PEG format}]
[item modules/pt/pt_peg_interp.man            pt::peg::interp                    {Interpreter for parsing expression grammars}]
[item modules/pt/pt_peg_to_container.man      pt::peg::to::container             {PEG Conversion. Write CONTAINER format}]
[item modules/pt/pt_peg_to_cparam.man         pt::peg::to::cparam                {PEG Conversion. Write CPARAM format}]
[item modules/pt/pt_peg_to_json.man           pt::peg::to::json                  {PEG Conversion. Write JSON format}]
[item modules/pt/pt_peg_to_param.man          pt::peg::to::param                 {PEG Conversion. Write PARAM format}]
[item modules/pt/pt_peg_to_peg.man            pt::peg::to::peg                   {PEG Conversion. Write PEG format}]
[item modules/pt/pt_peg_to_tclparam.man       pt::peg::to::tclparam              {PEG Conversion. Write TCLPARAM format}]
[item modules/pt/pt_peg_language.man          pt::peg_language                   {PEG Language Tutorial}]
[item modules/pt/pt_peg_introduction.man      pt::pegrammar                      {Introduction to Parsing Expression Grammars}]
[item modules/pt/pt_pgen.man                  pt::pgen                           {Parser Generator}]
[item modules/pt/pt_rdengine.man              pt::rde                            {Parsing Runtime Support, PARAM based}]
[item modules/pt/pt_tclparam_config_snit.man  pt::tclparam::configuration::snit  {Tcl/PARAM, Canned configuration, Snit}]
[item modules/pt/pt_tclparam_config_tcloo.man pt::tclparam::configuration::tcloo {Tcl/PARAM, Canned configuration, Tcloo}]
[item modules/pt/pt_to_api.man                pt_export_api                      {Parser Tools Export API}]
[item modules/pt/pt_from_api.man              pt_import_api                      {Parser Tools Import API}]
[item modules/pt/pt_introduction.man          pt_introduction                    {Introduction to Parser Tools}]
[item modules/pt/pt_parser_api.man            pt_parser_api                      {Parser API}]
[division_end]
[division_start rc4]
[item modules/rc4/rc4.man rc4 {Impementation of the RC4 stream cipher}]
[item modules/rc4/rc4.man rc4 {Implementation of the RC4 stream cipher}]
[division_end]
[division_start rcs]
[item modules/rcs/rcs.man rcs {RCS low level utilities}]
[division_end]
[division_start report]
[item modules/report/report.man report {Create and manipulate report objects}]
[division_end]
[division_start rest]
[item modules/rest/rest.man rest {define REST web APIs and call them inline or asychronously}]
[division_end]
[division_start ripemd]
[item modules/ripemd/ripemd128.man ripemd128 {RIPEMD-128 Message-Digest Algorithm}]
[item modules/ripemd/ripemd160.man ripemd160 {RIPEMD-160 Message-Digest Algorithm}]
[division_end]
[division_start sasl]
[item modules/sasl/sasl.man SASL {Implementation of SASL mechanisms for Tcl}]
[division_end]
[division_start sha1]
[item modules/sha1/sha1.man   sha1   {SHA1 Message-Digest Algorithm}]
[item modules/sha1/sha256.man sha256 {SHA256 Message-Digest Algorithm}]
[division_end]
[division_start simulation]
[item modules/simulation/annealing.man  simulation::annealing  {Simulated annealing}]
[item modules/simulation/montecarlo.man simulation::montecarlo {Monte Carlo simulations}]
[item modules/simulation/random.man     simulation::random     {Pseudo-random number generators}]
[item modules/simulation/annealing.man         simulation::annealing  {Simulated annealing}]
[item modules/simulation/montecarlo.man        simulation::montecarlo {Monte Carlo simulations}]
[item modules/simulation/simulation_random.man simulation::random     {Pseudo-random number generators}]
[division_end]
[division_start smtpd]
[item modules/smtpd/smtpd.man smtpd {Tcl SMTP server implementation}]
[division_end]
[division_start snit]
[item modules/snit/snit.man    snit    {Snit's Not Incr Tcl}]
[item modules/snit/snitfaq.man snitfaq {Snit Frequently Asked Questions}]
607
608
609
610
611
612
613
614
615

616
617
618

619
620
621
622
623
624
625
626
627

628
629
630
631





632
633
634
635
636
637
638
900
901
902
903
904
905
906

907
908
909
910

911
912
913
914
915
916
917
918
919

920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936







-

+


-
+








-
+




+
+
+
+
+







[item modules/stringprep/stringprep_data.man stringprep::data {stringprep data tables, generated, internal}]
[item modules/stringprep/unicode.man         unicode          {Implementation of Unicode normalization}]
[item modules/stringprep/unicode_data.man    unicode::data    {unicode data tables, generated, internal}]
[division_end]
[division_start struct]
[item modules/struct/disjointset.man  struct::disjointset {Disjoint set data structure}]
[item modules/struct/graph.man        struct::graph       {Create and manipulate directed graph objects}]
[item modules/struct/graph1.man       {struct::graph v1}  {Create and manipulate directed graph objects}]
[item modules/struct/graphops.man     struct::graph::op   {Operation for (un)directed graph objects}]
[item modules/struct/graph1.man       struct::graph_v1    {Create and manipulate directed graph objects}]
[item modules/struct/struct_list.man  struct::list        {Procedures for manipulating lists}]
[item modules/struct/matrix.man       struct::matrix      {Create and manipulate matrix objects}]
[item modules/struct/matrix1.man      {struct::matrix v1} {Create and manipulate matrix objects}]
[item modules/struct/matrix1.man      struct::matrix_v1   {Create and manipulate matrix objects}]
[item modules/struct/pool.man         struct::pool        {Create and manipulate pool objects (of discrete items)}]
[item modules/struct/prioqueue.man    struct::prioqueue   {Create and manipulate prioqueue objects}]
[item modules/struct/queue.man        struct::queue       {Create and manipulate queue objects}]
[item modules/struct/record.man       struct::record      {Define and create records (similar to 'C' structures)}]
[item modules/struct/struct_set.man   struct::set         {Procedures for manipulating sets}]
[item modules/struct/skiplist.man     struct::skiplist    {Create and manipulate skiplists}]
[item modules/struct/stack.man        struct::stack       {Create and manipulate stack objects}]
[item modules/struct/struct_tree.man  struct::tree        {Create and manipulate tree objects}]
[item modules/struct/struct_tree1.man {struct::tree v1}   {Create and manipulate tree objects}]
[item modules/struct/struct_tree1.man struct::tree_v1     {Create and manipulate tree objects}]
[division_end]
[division_start tar]
[item modules/tar/tar.man tar {Tar file creation, extraction & manipulation}]
[division_end]
[division_start tepam]
[item modules/tepam/tepam_introduction.man       tepam                     {An introduction into TEPAM, Tcl's Enhanced Procedure and Argument Manager}]
[item modules/tepam/tepam_argument_dialogbox.man tepam::argument_dialogbox {TEPAM argument_dialogbox, reference manual}]
[item modules/tepam/tepam_procedure.man          tepam::procedure          {TEPAM procedure, reference manual}]
[division_end]
[division_start term]
[item modules/term/term.man         term                     {General terminal control}]
[item modules/term/ansi_code.man    term::ansi::code         {Helper for control sequences}]
[item modules/term/ansi_cattr.man   term::ansi::code::attr   {ANSI attribute sequences}]
[item modules/term/ansi_cctrl.man   term::ansi::code::ctrl   {ANSI control sequences}]
[item modules/term/ansi_cmacros.man term::ansi::code::macros {Macro sequences}]
[item modules/term/ansi_ctrlu.man   term::ansi::ctrl::unix   {Control operations and queries}]
668
669
670
671
672
673
674



675
676
677
678
679
680
681
682
683
684
685
686
687
688



















































689
690
691
692
693
694
695
696
697
698
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050







+
+
+














+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+










[item modules/transfer/dsource.man     transfer::data::source      {Data source}]
[item modules/transfer/receiver.man    transfer::receiver          {Data source}]
[item modules/transfer/transmitter.man transfer::transmitter       {Data source}]
[division_end]
[division_start treeql]
[item modules/treeql/treeql.man treeql {Query tree objects}]
[division_end]
[division_start try]
[item modules/try/tcllib_try.man try {try - Trap and process errors and exceptions}]
[division_end]
[division_start uev]
[item modules/uev/uevent.man        uevent         {User events}]
[item modules/uev/uevent_onidle.man uevent::onidle {Request merging and deferal to idle time}]
[division_end]
[division_start units]
[item modules/units/units.man units {unit conversion}]
[division_end]
[division_start uri]
[item modules/uri/uri.man        uri     {URI utilities}]
[item modules/uri/urn-scheme.man uri_urn {URI utilities, URN scheme}]
[division_end]
[division_start uuid]
[item modules/uuid/uuid.man uuid {UUID generation and comparison}]
[division_end]
[division_start valtype]
[item modules/valtype/valtype_common.man valtype::common                 {Validation, common code}]
[item modules/valtype/cc_amex.man        valtype::creditcard::amex       {Validation for AMEX creditcard number}]
[item modules/valtype/cc_discover.man    valtype::creditcard::discover   {Validation for Discover creditcard number}]
[item modules/valtype/cc_mastercard.man  valtype::creditcard::mastercard {Validation for Mastercard creditcard number}]
[item modules/valtype/cc_visa.man        valtype::creditcard::visa       {Validation for VISA creditcard number}]
[item modules/valtype/ean13.man          valtype::gs1::ean13             {Validation for EAN13}]
[item modules/valtype/iban.man           valtype::iban                   {Validation for IBAN}]
[item modules/valtype/imei.man           valtype::imei                   {Validation for IMEI}]
[item modules/valtype/isbn.man           valtype::isbn                   {Validation for ISBN}]
[item modules/valtype/luhn.man           valtype::luhn                   {Validation for plain number with a LUHN checkdigit}]
[item modules/valtype/luhn5.man          valtype::luhn5                  {Validation for plain number with a LUHN5 checkdigit}]
[item modules/valtype/usnpi.man          valtype::usnpi                  {Validation for USNPI}]
[item modules/valtype/verhoeff.man       valtype::verhoeff               {Validation for plain number with a VERHOEFF checkdigit}]
[division_end]
[division_start virtchannel_base]
[item modules/virtchannel_base/cat.man        tcl::chan::cat        {Concatenation channel}]
[item modules/virtchannel_base/facade.man     tcl::chan::facade     {Facade channel}]
[item modules/virtchannel_base/fifo.man       tcl::chan::fifo       {In-memory fifo channel}]
[item modules/virtchannel_base/fifo2.man      tcl::chan::fifo2      {In-memory interconnected fifo channels}]
[item modules/virtchannel_base/halfpipe.man   tcl::chan::halfpipe   {In-memory channel, half of a fifo2}]
[item modules/virtchannel_base/memchan.man    tcl::chan::memchan    {In-memory channel}]
[item modules/virtchannel_base/null.man       tcl::chan::null       {Null channel}]
[item modules/virtchannel_base/nullzero.man   tcl::chan::nullzero   {Null/Zero channel combination}]
[item modules/virtchannel_base/random.man     tcl::chan::random     {Random channel}]
[item modules/virtchannel_base/randseed.man   tcl::chan::randseed   {Utilities for random channels}]
[item modules/virtchannel_base/std.man        tcl::chan::std        {Standard I/O, unification of stdin and stdout}]
[item modules/virtchannel_base/string.man     tcl::chan::string     {Read-only in-memory channel}]
[item modules/virtchannel_base/textwindow.man tcl::chan::textwindow {Textwindow channel}]
[item modules/virtchannel_base/variable.man   tcl::chan::variable   {In-memory channel using variable for storage}]
[item modules/virtchannel_base/zero.man       tcl::chan::zero       {Zero channel}]
[division_end]
[division_start virtchannel_core]
[item modules/virtchannel_core/core.man          tcl::chan::core      {Basic reflected/virtual channel support}]
[item modules/virtchannel_core/events.man        tcl::chan::events    {Event support for reflected/virtual channels}]
[item modules/virtchannel_core/transformcore.man tcl::transform::core {Basic reflected/virtual channel transform support}]
[division_end]
[division_start virtchannel_transform]
[item modules/virtchannel_transform/adler32.man   tcl::transform::adler32   {Adler32 transformation}]
[item modules/virtchannel_transform/base64.man    tcl::transform::base64    {Base64 encoding transformation}]
[item modules/virtchannel_transform/counter.man   tcl::transform::counter   {Counter transformation}]
[item modules/virtchannel_transform/crc32.man     tcl::transform::crc32     {Crc32 transformation}]
[item modules/virtchannel_transform/hex.man       tcl::transform::hex       {Hexadecimal encoding transformation}]
[item modules/virtchannel_transform/identity.man  tcl::transform::identity  {Identity transformation}]
[item modules/virtchannel_transform/limitsize.man tcl::transform::limitsize {limiting input}]
[item modules/virtchannel_transform/observe.man   tcl::transform::observe   {Observer transformation, stream copy}]
[item modules/virtchannel_transform/otp.man       tcl::transform::otp       {Encryption via one-time pad}]
[item modules/virtchannel_transform/rot.man       tcl::transform::rot       rot-encryption]
[item modules/virtchannel_transform/spacer.man    tcl::transform::spacer    {Space insertation and removal}]
[item modules/virtchannel_transform/zlib.man      tcl::transform::zlib      {zlib (de)compression}]
[division_end]
[division_start wip]
[item modules/wip/wip.man wip {Word Interpreter}]
[division_end]
[division_start yaml]
[item modules/yaml/huddle.man huddle {Create and manipulate huddle object}]
[item modules/yaml/yaml.man   yaml   {YAML Format Encoder/Decoder}]
[division_end]
[division_end]
[division_end]
[toc_end]

Added support/devel/sak/localdoc/cmd.tcl.






















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*- tcl -*-
# Implementation of 'localdoc'.

# Available variables
# * argv  - Cmdline arguments
# * base  - Location of sak.tcl = Top directory of Tcllib distribution
# * cbase - Location of all files relevant to this command.
# * sbase - Location of all files supporting the SAK.

# ###

package require sak::localdoc

if {[llength $argv]} {
    sak::localdoc::usage
}

sak::localdoc::run

##
# ###

Added support/devel/sak/localdoc/help.txt.









1
2
3
4
5
6
7
8
+
+
+
+
+
+
+
+

    localdoc -- Generate documentation for website and installer.

    sak localdoc

        Convert all documentation into html and nroff, for use by the
        installer, and the website. For the latter the results of the
        conversion are stored in the repository itself.

Added support/devel/sak/localdoc/localdoc.tcl.


























































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*- tcl -*-
# sak::doc - Documentation facilities

package require sak::util
package require sak::doc

namespace eval ::sak::localdoc {}

# ###
# API commands

## ### ### ### ######### ######### #########

proc ::sak::localdoc::usage {} {
    package require sak::help
    puts stdout \n[sak::help::on localdoc]
    exit 1
}

proc ::sak::localdoc::run {} {
    set noe [info nameofexecutable]

    # Relative path is necessary to handle possibility of fossil
    # repository and website as child of a larger website. Absolute
    # adressing may not point to our root, but the outer site.
    #set nav /home

    # NOTE: This may not work for the deeper nested manpages.
    # doc/tip/embedded/www/tcoc.html
    #set nav ../../../../../home

    # Indeed, not working for the nested pages.
    # Use absolute, for main location.
    set nav /tcllib

    puts "Removing old documentation..."
    file delete -force embedded
    file mkdir embedded/man
    file mkdir embedded/www

    puts "Reindex the documentation..."
    sak::doc::imake __dummy__
    sak::doc::index __dummy__

    puts "Generating manpages..."
    exec 2>@ stderr >@ stdout $noe apps/dtplite \
	-exclude {*/doctools/tests/*} \
	-exclude {*/support/*} \
	-ext n \
	-o embedded/man \
	nroff .

    # Note: Might be better to run them separately.
    # Note @: Or we shuffle the results a bit more in the post processing stage.

    set toc [string map {
	.man     .html
	modules/ tcllib/files/modules/
    } [fileutil::cat support/devel/sak/doc/toc.txt]]

    puts "Generating HTML... Pass 1, draft..."
    exec 2>@ stderr >@ stdout $noe apps/dtplite \
	-toc $toc \
	-nav Home $nav \
	-exclude {*/doctools/tests/*} \
	-exclude {*/support/*} \
	-merge \
	-o embedded/www \
	html .

    puts "Generating HTML... Pass 2, resolving cross-references..."
    exec 2>@ stderr >@ stdout $noe apps/dtplite \
	-toc $toc \
	-nav Home $nav \
	-exclude {*/doctools/tests/*} \
	-exclude {*/support/*} \
	-merge \
	-o embedded/www \
	html .

    return
}

# ### ### ### ######### ######### #########

package provide sak::localdoc 1.0

##
# ###

Added support/devel/sak/localdoc/pkgIndex.tcl.



1
2
+
+
if {![package vsatisfies [package provide Tcl] 8.2]} return
package ifneeded sak::localdoc 1.0 [list source [file join $dir localdoc.tcl]]

Added support/devel/sak/localdoc/topic.txt.



1
2
+
+
localdoc	Generate html & nroff documentation for display
				from the website, and the installer.